	.file	"extr_dw_mmc-hi3798cv200.c_dw_mci_hi3798cv200_execute_tuning.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"Tuning clk_sample[%d, %d], set[%d]\n"
	.align 8
.LC1:
	.string	"No valid clk_sample shift! use default\n"
	.text
	.p2align 4
	.type	dw_mci_hi3798cv200_execute_tuning, @function
dw_mci_hi3798cv200_execute_tuning:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	mov	r15d, esi
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	xor	r12d, r12d
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	ebp, -1
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	r14, QWORD PTR 8[rdi]
	mov	QWORD PTR 16[rsp], rdi
	mov	rax, QWORD PTR 8[r14]
	mov	DWORD PTR 28[rsp], 0
	mov	DWORD PTR 4[rsp], -1
	mov	QWORD PTR 8[rsp], rax
	mov	DWORD PTR 24[rsp], -1
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L34:
	cmp	DWORD PTR 24[rsp], -1
	setne	al
	test	ebx, ebx
	je	.L4
	test	ebp, ebp
	jne	.L4
	lea	ecx, -1[rbx]
	mov	DWORD PTR 4[rsp], ecx
.L4:
	add	r12, 1
	cmp	DWORD PTR 4[rsp], -1
	je	.L19
	test	al, al
	jne	.L5
.L19:
	mov	ebp, r9d
.L2:
	lea	rdi, degrees.1953[rip]
	mov	ebx, r12d
	call	ARRAY_SIZE@PLT
	cmp	eax, r12d
	jle	.L33
	mov	rax, QWORD PTR 8[rsp]
	lea	r13, degrees.1953[rip]
	mov	esi, DWORD PTR 0[r13+r12*4]
	mov	edi, DWORD PTR [rax]
	call	clk_set_phase@PLT
	mov	edx, DWORD PTR ALL_INT_CLR[rip]
	mov	esi, DWORD PTR RINTSTS[rip]
	mov	rdi, r14
	call	mci_writel@PLT
	mov	rax, QWORD PTR 16[rsp]
	xor	edx, edx
	mov	esi, r15d
	mov	edi, DWORD PTR [rax]
	call	mmc_send_tuning@PLT
	mov	r9d, eax
	test	eax, eax
	jne	.L34
	test	ebx, ebx
	jne	.L16
.L31:
	cmp	DWORD PTR 24[rsp], -1
	mov	DWORD PTR 28[rsp], 1
	setne	al
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L16:
	test	ebp, ebp
	je	.L31
	mov	DWORD PTR 24[rsp], r12d
	mov	eax, 1
	mov	DWORD PTR 28[rsp], 1
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L33:
.L8:
	endbr64
	mov	edx, DWORD PTR 28[rsp]
	test	edx, edx
	je	.L9
	mov	edx, DWORD PTR 24[rsp]
	mov	eax, 0
	lea	r13, degrees.1953[rip]
	cmp	edx, -1
	cmovne	eax, edx
	xor	r9d, r9d
	cmp	DWORD PTR 4[rsp], -1
	mov	DWORD PTR 24[rsp], eax
	jne	.L11
	mov	rdi, r13
	mov	DWORD PTR 16[rsp], r9d
	call	ARRAY_SIZE@PLT
	mov	r9d, DWORD PTR 16[rsp]
	sub	eax, 1
	mov	DWORD PTR 4[rsp], eax
.L11:
	mov	edx, DWORD PTR 4[rsp]
	mov	ecx, DWORD PTR 24[rsp]
	mov	ebx, edx
	add	ebx, ecx
	mov	eax, ebx
	sar	eax
	cmp	edx, ecx
	jl	.L35
.L14:
	cdqe
	mov	DWORD PTR 16[rsp], r9d
	mov	ebx, DWORD PTR 0[r13+rax*4]
	mov	rax, QWORD PTR 8[rsp]
	mov	edi, DWORD PTR [rax]
	mov	esi, ebx
	call	clk_set_phase@PLT
	mov	ecx, DWORD PTR 4[rsp]
	mov	edx, DWORD PTR 24[rsp]
	mov	r8d, ebx
	mov	edi, DWORD PTR [r14]
	lea	rsi, .LC0[rip]
	call	dev_dbg@PLT
	mov	r9d, DWORD PTR 16[rsp]
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L5:
	mov	eax, DWORD PTR 28[rsp]
	test	eax, eax
	jne	.L11
.L9:
	mov	edi, DWORD PTR [r14]
	lea	rsi, .LC1[rip]
	call	dev_err@PLT
	mov	r9d, DWORD PTR EINVAL[rip]
	neg	r9d
.L15:
	mov	edx, DWORD PTR ALL_INT_CLR[rip]
	mov	esi, DWORD PTR RINTSTS[rip]
	mov	rdi, r14
	mov	DWORD PTR 4[rsp], r9d
	call	mci_writel@PLT
	mov	r9d, DWORD PTR 4[rsp]
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	mov	eax, r9d
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L35:
	.cfi_restore_state
	lea	rdi, degrees.1953[rip]
	mov	DWORD PTR 16[rsp], r9d
	call	ARRAY_SIZE@PLT
	mov	r9d, DWORD PTR 16[rsp]
	cmp	eax, ebx
	jg	.L13
	mov	edx, DWORD PTR 4[rsp]
	mov	eax, edx
	shr	eax, 31
	add	eax, edx
	sar	eax
	jmp	.L14
.L13:
	lea	rdi, degrees.1953[rip]
	mov	DWORD PTR 16[rsp], r9d
	call	ARRAY_SIZE@PLT
	mov	edx, DWORD PTR 24[rsp]
	mov	r9d, DWORD PTR 16[rsp]
	lea	edx, -1[rdx+rax]
	mov	eax, edx
	shr	eax, 31
	add	eax, edx
	sar	eax
	jmp	.L14
	.cfi_endproc
.LFE0:
	.size	dw_mci_hi3798cv200_execute_tuning, .-dw_mci_hi3798cv200_execute_tuning
	.section	.rodata
	.align 32
	.type	degrees.1953, @object
	.size	degrees.1953, 32
degrees.1953:
	.long	0
	.long	45
	.long	90
	.long	135
	.long	180
	.long	225
	.long	270
	.long	315
	.comm	RINTSTS,4,4
	.comm	EINVAL,4,4
	.comm	ALL_INT_CLR,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_dw_mmc-hi3798cv200.c_dw_mci_hi3798cv200_execute_tuning.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Tuning clk_sample[%d, %d], set[%d]\012\000"
	.align	2
.LC1:
	.ascii	"No valid clk_sample shift! use default\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	dw_mci_hi3798cv200_execute_tuning, %function
dw_mci_hi3798cv200_execute_tuning:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	mov	r8, #0
	mvn	r6, #0
	ldr	r9, [r0, #4]
	ldr	r5, .L32
	ldr	r2, [r9, #4]
	sub	sp, sp, #28
	mov	r4, r8
	str	r8, [sp, #20]
	mov	r10, r1
	mov	r7, r6
	mov	r8, r0
	str	r2, [sp, #16]
	str	r6, [sp, #12]
	add	fp, r5, #4
	b	.L2
.L29:
	ldr	r3, [sp, #12]
	adds	r2, r3, #1
	movne	r2, #1
	cmp	r4, #0
	beq	.L4
	cmp	r6, #0
	subeq	r7, r4, #1
.L4:
	adds	r1, r7, #1
	movne	r1, #1
	tst	r2, r1
	bne	.L5
.L30:
	mov	r6, r0
	add	r4, r4, #1
.L2:
	mov	r0, fp
	bl	ARRAY_SIZE
	cmp	r0, r4
	ble	.L28
	ldr	r3, [sp, #16]
	ldr	r1, [r5, #4]!
	ldr	r0, [r3]
	bl	clk_set_phase
	ldr	r3, .L32+4
	mov	r0, r9
	ldr	r2, [r3]
	ldr	r3, .L32+8
	ldr	r1, [r3]
	bl	mci_writel
	mov	r2, #0
	mov	r1, r10
	ldr	r0, [r8]
	bl	mmc_send_tuning
	cmp	r0, #0
	bne	.L29
	cmp	r4, #0
	bne	.L15
.L26:
	ldr	r3, [sp, #12]
	adds	r2, r3, #1
	movne	r2, #1
	adds	r1, r7, #1
	movne	r1, #1
	mov	r3, #1
	tst	r2, r1
	str	r3, [sp, #20]
	beq	.L30
.L5:
	ldr	r3, [sp, #20]
	mov	r4, r0
	cmp	r3, #0
	beq	.L8
.L10:
	ldr	r3, [sp, #12]
	ldr	r6, .L32+12
	cmp	r7, r3
	add	r5, r7, r3
	asrge	r5, r5, #1
	blt	.L31
.L13:
	ldr	r5, [r6, r5, lsl #2]
	ldr	r3, [sp, #16]
	mov	r1, r5
	ldr	r0, [r3]
	bl	clk_set_phase
	ldr	r0, [r9]
	mov	r3, r7
	ldr	r2, [sp, #12]
	ldr	r1, .L32+16
	str	r5, [sp]
	bl	dev_dbg
	b	.L14
.L15:
	cmp	r6, #0
	movne	r3, #1
	strne	r4, [sp, #12]
	movne	r2, r3
	strne	r3, [sp, #20]
	bne	.L4
	b	.L26
.L28:
.L7:
	ldr	r3, [sp, #20]
	cmp	r3, #0
	beq	.L8
	ldr	r3, [sp, #12]
	cmn	r3, #1
	moveq	r3, #0
	cmn	r7, #1
	movne	r4, #0
	str	r3, [sp, #12]
	bne	.L10
	ldr	r0, .L32+12
	bl	ARRAY_SIZE
	mov	r4, #0
	sub	r7, r0, #1
	b	.L10
.L8:
	ldr	r1, .L32+20
	ldr	r0, [r9]
	bl	dev_err
	ldr	r3, .L32+24
	ldr	r4, [r3]
	rsb	r4, r4, #0
.L14:
	ldr	r3, .L32+4
	mov	r0, r9
	ldr	r2, [r3]
	ldr	r3, .L32+8
	ldr	r1, [r3]
	bl	mci_writel
	mov	r0, r4
	add	sp, sp, #28
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L31:
	mov	r0, r6
	bl	ARRAY_SIZE
	cmp	r0, r5
	addle	r5, r7, r7, lsr #31
	asrle	r5, r5, #1
	ble	.L13
.L12:
	mov	r0, r6
	bl	ARRAY_SIZE
	ldr	r3, [sp, #12]
	add	r5, r0, r3
	sub	r5, r5, #1
	add	r5, r5, r5, lsr #31
	asr	r5, r5, #1
	b	.L13
.L33:
	.align	2
.L32:
	.word	.LANCHOR0-4
	.word	ALL_INT_CLR
	.word	RINTSTS
	.word	.LANCHOR0
	.word	.LC0
	.word	.LC1
	.word	EINVAL
	.size	dw_mci_hi3798cv200_execute_tuning, .-dw_mci_hi3798cv200_execute_tuning
	.comm	RINTSTS,4,4
	.comm	EINVAL,4,4
	.comm	ALL_INT_CLR,4,4
	.section	.rodata
	.align	2
	.set	.LANCHOR0,. + 0
	.type	degrees.4237, %object
	.size	degrees.4237, 32
degrees.4237:
	.word	0
	.word	45
	.word	90
	.word	135
	.word	180
	.word	225
	.word	270
	.word	315
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
