	.file	"extr_sdhci-pci-o2micro.c_sdhci_o2_dll_recovery.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"%s: DLL unlocked when dll_adjust_count is %d.\n"
	.align 8
.LC1:
	.string	"%s: card present detect failed.\n"
	.align 8
.LC2:
	.string	"%s: DLL adjust over max times\n"
	.text
	.p2align 4
	.type	sdhci_o2_dll_recovery, @function
sdhci_o2_dll_recovery:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	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
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 24[rsp], rax
	xor	eax, eax
	mov	DWORD PTR 16[rsp], 0
	mov	DWORD PTR 20[rsp], 0
	call	sdhci_priv@PLT
	mov	r12, QWORD PTR [rax]
	mov	rdi, rax
	call	sdhci_pci_priv@PLT
	mov	esi, DWORD PTR O2_SD_LOCK_WP[rip]
	lea	rdx, 16[rsp]
	mov	edi, DWORD PTR [r12]
	mov	QWORD PTR 8[rsp], rdx
	mov	rbx, rax
	call	pci_read_config_byte@PLT
	mov	edx, DWORD PTR 16[rsp]
	mov	esi, DWORD PTR O2_SD_LOCK_WP[rip]
	and	edx, 127
	mov	DWORD PTR 16[rsp], edx
	mov	edi, DWORD PTR [r12]
	call	pci_write_config_byte@PLT
	mov	rax, QWORD PTR [rbx]
	mov	rdx, QWORD PTR DMDN_SZ[rip]
	cmp	rdx, rax
	jbe	.L2
	lea	r13, 20[rsp]
	lea	r14, .LC0[rip]
	.p2align 4,,10
	.p2align 3
.L6:
	mov	edx, DWORD PTR SDHCI_CLOCK_CONTROL[rip]
	xor	esi, esi
	mov	rdi, rbp
	call	sdhci_writeb@PLT
	mov	esi, DWORD PTR O2_PLL_DLL_WDT_CONTROL1[rip]
	mov	rdi, rbp
	call	sdhci_readl@PLT
	mov	edx, DWORD PTR O2_PLL_DLL_WDT_CONTROL1[rip]
	or	eax, DWORD PTR O2_PLL_SOFT_RESET[rip]
	mov	rdi, rbp
	mov	esi, eax
	mov	DWORD PTR 20[rsp], eax
	call	sdhci_writel@PLT
	mov	esi, DWORD PTR O2_SD_FUNC_REG4[rip]
	mov	edi, DWORD PTR [r12]
	mov	rdx, r13
	call	pci_read_config_dword@PLT
	mov	edx, DWORD PTR 20[rsp]
	or	edx, DWORD PTR O2_SD_FREG4_ENABLE_CLK_SET[rip]
	mov	DWORD PTR 20[rsp], edx
	mov	esi, DWORD PTR O2_SD_FUNC_REG4[rip]
	mov	edi, DWORD PTR [r12]
	call	pci_write_config_dword@PLT
	mov	rdx, QWORD PTR [rbx]
	mov	rax, QWORD PTR dmdn_table[rip]
	mov	rdi, r12
	mov	esi, DWORD PTR [rax+rdx*4]
	call	o2_pci_set_baseclk@PLT
	mov	esi, DWORD PTR SDHCI_CLOCK_INT_EN[rip]
	mov	edx, DWORD PTR SDHCI_CLOCK_CONTROL[rip]
	mov	rdi, rbp
	mov	DWORD PTR 16[rsp], esi
	call	sdhci_writeb@PLT
	mov	edi, DWORD PTR 0[rbp]
	call	sdhci_o2_get_cd@PLT
	test	rax, rax
	je	.L3
	mov	edi, 5000
	mov	esi, 6000
	call	usleep_range@PLT
	mov	rdi, rbp
	call	sdhci_o2_wait_dll_detect_lock@PLT
	test	rax, rax
	je	.L4
	mov	edx, DWORD PTR SDHCI_CLOCK_CONTROL[rip]
	mov	esi, DWORD PTR 16[rsp]
	mov	rdi, rbp
	mov	r13d, 1
	or	esi, DWORD PTR SDHCI_CLOCK_CARD_EN[rip]
	mov	DWORD PTR 16[rsp], esi
	call	sdhci_writeb@PLT
	add	QWORD PTR [rbx], 1
.L5:
	mov	rdx, QWORD PTR 8[rsp]
	mov	esi, DWORD PTR O2_SD_LOCK_WP[rip]
	mov	edi, DWORD PTR [r12]
	call	pci_read_config_byte@PLT
	mov	edx, DWORD PTR 16[rsp]
	mov	esi, DWORD PTR O2_SD_LOCK_WP[rip]
	or	dl, -128
	mov	DWORD PTR 16[rsp], edx
	mov	edi, DWORD PTR [r12]
	call	pci_write_config_byte@PLT
	mov	rax, QWORD PTR 24[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L12
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r13d
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	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
.L4:
	.cfi_restore_state
	mov	edi, DWORD PTR 0[rbp]
	mov	r15, QWORD PTR [rbx]
	call	mmc_hostname@PLT
	mov	rdx, r15
	mov	rdi, r14
	mov	esi, eax
	call	pr_warn@PLT
	mov	rax, QWORD PTR [rbx]
	add	rax, 1
	mov	QWORD PTR [rbx], rax
	mov	rdx, QWORD PTR DMDN_SZ[rip]
	cmp	rax, rdx
	jb	.L6
.L2:
	xor	r13d, r13d
	cmp	rax, rdx
	jne	.L5
.L13:
	mov	edi, DWORD PTR 0[rbp]
	call	mmc_hostname@PLT
	lea	rdi, .LC2[rip]
	mov	esi, eax
	call	pr_err@PLT
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	mov	edi, DWORD PTR 0[rbp]
	xor	r13d, r13d
	call	mmc_hostname@PLT
	lea	rdi, .LC1[rip]
	mov	esi, eax
	call	pr_err@PLT
	mov	rax, QWORD PTR [rbx]
	mov	rdx, QWORD PTR DMDN_SZ[rip]
	cmp	rax, rdx
	jne	.L5
	jmp	.L13
.L12:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	sdhci_o2_dll_recovery, .-sdhci_o2_dll_recovery
	.comm	dmdn_table,8,8
	.comm	SDHCI_CLOCK_INT_EN,4,4
	.comm	SDHCI_CLOCK_CONTROL,4,4
	.comm	SDHCI_CLOCK_CARD_EN,4,4
	.comm	O2_SD_LOCK_WP,4,4
	.comm	O2_SD_FUNC_REG4,4,4
	.comm	O2_SD_FREG4_ENABLE_CLK_SET,4,4
	.comm	O2_PLL_SOFT_RESET,4,4
	.comm	O2_PLL_DLL_WDT_CONTROL1,4,4
	.comm	DMDN_SZ,8,8
	.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_sdhci-pci-o2micro.c_sdhci_o2_dll_recovery.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"%s: DLL unlocked when dll_adjust_count is %d.\012\000"
	.align	2
.LC1:
	.ascii	"%s: card present detect failed.\012\000"
	.align	2
.LC2:
	.ascii	"%s: DLL adjust over max times\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC3:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	sdhci_o2_dll_recovery, %function
sdhci_o2_dll_recovery:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	mov	r3, #0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r2, .L14
	sub	sp, sp, #20
	ldr	r2, [r2]
	str	r2, [sp, #12]
	mov	r2,#0
	mov	r4, r0
	str	r3, [sp, #4]
	str	r3, [sp, #8]
	bl	sdhci_priv
	ldr	r6, [r0]
	bl	sdhci_pci_priv
	mov	r5, r0
	ldr	r7, .L14+4
	add	r2, sp, #4
	ldr	r1, [r7]
	ldr	r0, [r6]
	bl	pci_read_config_byte
	ldr	r2, [sp, #4]
	ldr	r1, [r7]
	and	r2, r2, #127
	str	r2, [sp, #4]
	ldr	r0, [r6]
	bl	pci_write_config_byte
	ldr	r2, .L14+8
	ldr	r3, [r5]
	ldr	r2, [r2]
	cmp	r2, r3
	bls	.L2
	ldr	r7, .L14+12
	ldr	r9, .L14+16
	ldr	fp, .L14+20
	ldr	r8, .L14+24
	ldr	r10, .L14+28
.L6:
	ldr	r2, [r7]
	mov	r1, #0
	mov	r0, r4
	bl	sdhci_writeb
	ldr	r1, [r9]
	mov	r0, r4
	bl	sdhci_readl
	ldr	r1, [fp]
	ldr	r2, [r9]
	orr	r1, r0, r1
	mov	r0, r4
	str	r1, [sp, #8]
	bl	sdhci_writel
	ldr	r1, [r8]
	add	r2, sp, #8
	ldr	r0, [r6]
	bl	pci_read_config_dword
	ldr	r2, [sp, #8]
	ldr	r3, [r10]
	ldr	r1, [r8]
	orr	r2, r2, r3
	str	r2, [sp, #8]
	ldr	r0, [r6]
	bl	pci_write_config_dword
	ldr	r3, .L14+32
	ldr	r2, [r5]
	ldr	r3, [r3]
	mov	r0, r6
	ldr	r1, [r3, r2, lsl #2]
	bl	o2_pci_set_baseclk
	ldr	r3, .L14+36
	ldr	r2, [r7]
	ldr	r1, [r3]
	mov	r0, r4
	str	r1, [sp, #4]
	bl	sdhci_writeb
	ldr	r0, [r4]
	bl	sdhci_o2_get_cd
	cmp	r0, #0
	beq	.L3
	ldr	r1, .L14+40
	ldr	r0, .L14+44
	bl	usleep_range
	mov	r0, r4
	bl	sdhci_o2_wait_dll_detect_lock
	cmp	r0, #0
	beq	.L4
	mov	r0, r4
	mov	r4, #1
	ldr	r3, .L14+48
	ldr	r1, [sp, #4]
	ldr	r3, [r3]
	ldr	r2, [r7]
	orr	r1, r1, r3
	str	r1, [sp, #4]
	bl	sdhci_writeb
	ldr	r3, [r5]
	add	r3, r3, r4
	str	r3, [r5]
.L5:
	ldr	r5, .L14+4
	add	r2, sp, #4
	ldr	r1, [r5]
	ldr	r0, [r6]
	bl	pci_read_config_byte
	ldr	r2, [sp, #4]
	ldr	r1, [r5]
	orr	r2, r2, #128
	str	r2, [sp, #4]
	ldr	r0, [r6]
	bl	pci_write_config_byte
	ldr	r3, .L14
	ldr	r2, [r3]
	ldr	r3, [sp, #12]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L12
	mov	r0, r4
	add	sp, sp, #20
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L4:
	ldr	r0, [r4]
	bl	mmc_hostname
	ldr	r2, [r5]
	mov	r1, r0
	ldr	r0, .L14+52
	bl	pr_warn
	ldr	r3, [r5]
	ldr	r2, .L14+8
	add	r3, r3, #1
	str	r3, [r5]
	ldr	r2, [r2]
	cmp	r3, r2
	bcc	.L6
.L2:
	cmp	r3, r2
	movne	r4, #0
	bne	.L5
.L13:
	ldr	r0, [r4]
	bl	mmc_hostname
	mov	r1, r0
	ldr	r0, .L14+56
	bl	pr_err
	mov	r4, #0
	b	.L5
.L3:
	ldr	r0, [r4]
	bl	mmc_hostname
	mov	r1, r0
	ldr	r0, .L14+60
	bl	pr_err
	ldr	r2, .L14+8
	ldr	r3, [r5]
	ldr	r2, [r2]
	cmp	r3, r2
	movne	r4, #0
	bne	.L5
	b	.L13
.L12:
	bl	__stack_chk_fail
.L15:
	.align	2
.L14:
	.word	.LC3
	.word	O2_SD_LOCK_WP
	.word	DMDN_SZ
	.word	SDHCI_CLOCK_CONTROL
	.word	O2_PLL_DLL_WDT_CONTROL1
	.word	O2_PLL_SOFT_RESET
	.word	O2_SD_FUNC_REG4
	.word	O2_SD_FREG4_ENABLE_CLK_SET
	.word	dmdn_table
	.word	SDHCI_CLOCK_INT_EN
	.word	6000
	.word	5000
	.word	SDHCI_CLOCK_CARD_EN
	.word	.LC0
	.word	.LC2
	.word	.LC1
	.size	sdhci_o2_dll_recovery, .-sdhci_o2_dll_recovery
	.comm	dmdn_table,4,4
	.comm	SDHCI_CLOCK_INT_EN,4,4
	.comm	SDHCI_CLOCK_CONTROL,4,4
	.comm	SDHCI_CLOCK_CARD_EN,4,4
	.comm	O2_SD_LOCK_WP,4,4
	.comm	O2_SD_FUNC_REG4,4,4
	.comm	O2_SD_FREG4_ENABLE_CLK_SET,4,4
	.comm	O2_PLL_SOFT_RESET,4,4
	.comm	O2_PLL_DLL_WDT_CONTROL1,4,4
	.comm	DMDN_SZ,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
