	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sdhci_o2_dll_recovery
_sdhci_o2_dll_recovery:                 ## @sdhci_o2_dll_recovery
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movl	$0, -44(%rbp)
	movl	$0, -48(%rbp)
	callq	_sdhci_priv
	movq	(%rax), %rbx
	movq	%rax, %rdi
	callq	_sdhci_pci_priv
	movq	%rax, %r15
	movl	(%rbx), %edi
	movq	_O2_SD_LOCK_WP@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	leaq	-44(%rbp), %rdx
	callq	_pci_read_config_byte
	movl	-44(%rbp), %edx
	andl	$127, %edx
	movl	%edx, -44(%rbp)
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movl	(%rbx), %edi
	movl	(%r12), %esi
	callq	_pci_write_config_byte
	movq	(%r15), %rax
	movq	_DMDN_SZ@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jae	LBB0_7
## %bb.1:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	_SDHCI_CLOCK_CONTROL@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_sdhci_writeb
	movq	_O2_PLL_DLL_WDT_CONTROL1@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%r14, %rdi
	callq	_sdhci_readl
	movq	_O2_PLL_SOFT_RESET@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, -48(%rbp)
	movl	(%r12), %edx
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_sdhci_writel
	movl	(%rbx), %edi
	movq	_O2_SD_FUNC_REG4@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	leaq	-48(%rbp), %rdx
	callq	_pci_read_config_dword
	movl	-48(%rbp), %edx
	movq	_O2_SD_FREG4_ENABLE_CLK_SET@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movl	%edx, -48(%rbp)
	movl	(%rbx), %edi
	movl	(%r12), %esi
	callq	_pci_write_config_dword
	movq	_dmdn_table@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%r15), %rcx
	movl	(%rax,%rcx,4), %esi
	movq	%rbx, %rdi
	callq	_o2_pci_set_baseclk
	movq	_SDHCI_CLOCK_INT_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%esi, -44(%rbp)
	movl	(%r13), %edx
	movq	%r14, %rdi
	callq	_sdhci_writeb
	movl	(%r14), %edi
	callq	_sdhci_o2_get_cd
	testq	%rax, %rax
	je	LBB0_6
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	$5000, %edi                     ## imm = 0x1388
	movl	$6000, %esi                     ## imm = 0x1770
	callq	_usleep_range
	movq	%r14, %rdi
	callq	_sdhci_o2_wait_dll_detect_lock
	testq	%rax, %rax
	jne	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r14), %edi
	callq	_mmc_hostname
	movq	(%r15), %rdx
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	callq	_pr_warn
	movq	(%r15), %rax
	incq	%rax
	movq	%rax, (%r15)
	movq	_DMDN_SZ@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jb	LBB0_2
	jmp	LBB0_7
LBB0_6:
	movl	(%r14), %edi
	callq	_mmc_hostname
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %esi
	callq	_pr_err
LBB0_7:
	movq	(%r15), %rax
	xorl	%r15d, %r15d
	movq	_DMDN_SZ@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
## %bb.8:
	movl	(%r14), %edi
	callq	_mmc_hostname
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %esi
	callq	_pr_err
	jmp	LBB0_9
LBB0_5:
	movq	_SDHCI_CLOCK_CARD_EN@GOTPCREL(%rip), %rax
	movl	-44(%rbp), %esi
	orl	(%rax), %esi
	movl	%esi, -44(%rbp)
	movq	_SDHCI_CLOCK_CONTROL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r14, %rdi
	callq	_sdhci_writeb
	incq	(%r15)
	movl	$1, %r15d
LBB0_9:
	movq	-56(%rbp), %rbx                 ## 8-byte Reload
	movl	(%rbx), %edi
	movq	_O2_SD_LOCK_WP@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	leaq	-44(%rbp), %rdx
	callq	_pci_read_config_byte
	movl	$128, %edx
	orl	-44(%rbp), %edx
	movl	%edx, -44(%rbp)
	movl	(%rbx), %edi
	movl	(%r14), %esi
	callq	_pci_write_config_byte
	movl	%r15d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_O2_SD_LOCK_WP,4,2              ## @O2_SD_LOCK_WP
	.comm	_DMDN_SZ,8,3                    ## @DMDN_SZ
	.comm	_SDHCI_CLOCK_CONTROL,4,2        ## @SDHCI_CLOCK_CONTROL
	.comm	_O2_PLL_DLL_WDT_CONTROL1,4,2    ## @O2_PLL_DLL_WDT_CONTROL1
	.comm	_O2_PLL_SOFT_RESET,4,2          ## @O2_PLL_SOFT_RESET
	.comm	_O2_SD_FUNC_REG4,4,2            ## @O2_SD_FUNC_REG4
	.comm	_O2_SD_FREG4_ENABLE_CLK_SET,4,2 ## @O2_SD_FREG4_ENABLE_CLK_SET
	.comm	_dmdn_table,8,3                 ## @dmdn_table
	.comm	_SDHCI_CLOCK_INT_EN,4,2         ## @SDHCI_CLOCK_INT_EN
	.comm	_SDHCI_CLOCK_CARD_EN,4,2        ## @SDHCI_CLOCK_CARD_EN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s: DLL unlocked when dll_adjust_count is %d.\n"

L_.str.1:                               ## @.str.1
	.asciz	"%s: card present detect failed.\n"

L_.str.2:                               ## @.str.2
	.asciz	"%s: DLL adjust over max times\n"

	.no_dead_strip	_sdhci_o2_dll_recovery
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function sdhci_o2_dll_recovery
_sdhci_o2_dll_recovery:                 ; @sdhci_o2_dll_recovery
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x0
	str	xzr, [sp, #8]
	bl	_sdhci_priv
	ldr	x19, [x0]
	bl	_sdhci_pci_priv
	mov	x21, x0
	ldr	w0, [x19]
Lloh0:
	adrp	x22, _O2_SD_LOCK_WP@GOTPAGE
Lloh1:
	ldr	x22, [x22, _O2_SD_LOCK_WP@GOTPAGEOFF]
	ldr	w1, [x22]
	add	x2, sp, #12
	bl	_pci_read_config_byte
	ldr	w8, [sp, #12]
	and	w2, w8, #0x7f
	str	w2, [sp, #12]
	ldr	w0, [x19]
	ldr	w1, [x22]
	bl	_pci_write_config_byte
	ldr	x8, [x21]
Lloh2:
	adrp	x24, _DMDN_SZ@GOTPAGE
Lloh3:
	ldr	x24, [x24, _DMDN_SZ@GOTPAGEOFF]
	ldr	x9, [x24]
	cmp	x8, x9
	b.hs	LBB0_6
; %bb.1:
Lloh4:
	adrp	x25, _SDHCI_CLOCK_CONTROL@GOTPAGE
Lloh5:
	ldr	x25, [x25, _SDHCI_CLOCK_CONTROL@GOTPAGEOFF]
Lloh6:
	adrp	x26, _O2_PLL_DLL_WDT_CONTROL1@GOTPAGE
Lloh7:
	ldr	x26, [x26, _O2_PLL_DLL_WDT_CONTROL1@GOTPAGEOFF]
Lloh8:
	adrp	x28, _O2_SD_FUNC_REG4@GOTPAGE
Lloh9:
	ldr	x28, [x28, _O2_SD_FUNC_REG4@GOTPAGEOFF]
Lloh10:
	adrp	x23, _O2_SD_FREG4_ENABLE_CLK_SET@GOTPAGE
Lloh11:
	ldr	x23, [x23, _O2_SD_FREG4_ENABLE_CLK_SET@GOTPAGEOFF]
Lloh12:
	adrp	x27, _dmdn_table@GOTPAGE
Lloh13:
	ldr	x27, [x27, _dmdn_table@GOTPAGEOFF]
Lloh14:
	adrp	x22, _SDHCI_CLOCK_INT_EN@GOTPAGE
Lloh15:
	ldr	x22, [x22, _SDHCI_CLOCK_INT_EN@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w2, [x25]
	mov	x0, x20
	mov	w1, #0
	bl	_sdhci_writeb
	ldr	w1, [x26]
	mov	x0, x20
	bl	_sdhci_readl
Lloh16:
	adrp	x8, _O2_PLL_SOFT_RESET@GOTPAGE
Lloh17:
	ldr	x8, [x8, _O2_PLL_SOFT_RESET@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	orr	w1, w8, w0
	str	w1, [sp, #8]
	ldr	w2, [x26]
	mov	x0, x20
	bl	_sdhci_writel
	ldr	w0, [x19]
	ldr	w1, [x28]
	add	x2, sp, #8
	bl	_pci_read_config_dword
	ldr	w8, [x23]
	ldr	w9, [sp, #8]
	orr	w2, w9, w8
	str	w2, [sp, #8]
	ldr	w0, [x19]
	ldr	w1, [x28]
	bl	_pci_write_config_dword
	ldr	x8, [x27]
	ldr	x9, [x21]
	ldr	w1, [x8, x9, lsl #2]
	mov	x0, x19
	bl	_o2_pci_set_baseclk
	ldr	w1, [x22]
	str	w1, [sp, #12]
	ldr	w2, [x25]
	mov	x0, x20
	bl	_sdhci_writeb
	ldr	w0, [x20]
	bl	_sdhci_o2_get_cd
	cbz	x0, LBB0_5
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w0, #5000
	mov	w1, #6000
	bl	_usleep_range
	mov	x0, x20
	bl	_sdhci_o2_wait_dll_detect_lock
	cbnz	x0, LBB0_10
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w0, [x20]
	bl	_mmc_hostname
	mov	x1, x0
	ldr	x2, [x21]
Lloh19:
	adrp	x0, l_.str@PAGE
Lloh20:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_warn
	ldr	x8, [x21]
	add	x8, x8, #1
	str	x8, [x21]
	ldr	x9, [x24]
	cmp	x8, x9
	b.lo	LBB0_2
	b	LBB0_6
LBB0_5:
	ldr	w0, [x20]
	bl	_mmc_hostname
	mov	x1, x0
Lloh21:
	adrp	x0, l_.str.1@PAGE
Lloh22:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_err
LBB0_6:
	ldr	x8, [x21]
	ldr	x9, [x24]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.7:
	ldr	w0, [x20]
	bl	_mmc_hostname
	mov	x1, x0
Lloh23:
	adrp	x0, l_.str.2@PAGE
Lloh24:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_pr_err
LBB0_8:
	mov	w20, #0
LBB0_9:
	ldr	w0, [x19]
Lloh25:
	adrp	x21, _O2_SD_LOCK_WP@GOTPAGE
Lloh26:
	ldr	x21, [x21, _O2_SD_LOCK_WP@GOTPAGEOFF]
	ldr	w1, [x21]
	add	x2, sp, #12
	bl	_pci_read_config_byte
	ldr	w8, [sp, #12]
	orr	w2, w8, #0x80
	str	w2, [sp, #12]
	ldr	w0, [x19]
	ldr	w1, [x21]
	bl	_pci_write_config_byte
	mov	x0, x20
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_10:
Lloh27:
	adrp	x8, _SDHCI_CLOCK_CARD_EN@GOTPAGE
Lloh28:
	ldr	x8, [x8, _SDHCI_CLOCK_CARD_EN@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	ldr	w9, [sp, #12]
	orr	w1, w9, w8
	str	w1, [sp, #12]
	ldr	w2, [x25]
	mov	x0, x20
	bl	_sdhci_writeb
	ldr	x8, [x21]
	add	x8, x8, #1
	str	x8, [x21]
	mov	w20, #1
	b	LBB0_9
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_O2_SD_LOCK_WP,4,2              ; @O2_SD_LOCK_WP
	.comm	_DMDN_SZ,8,3                    ; @DMDN_SZ
	.comm	_SDHCI_CLOCK_CONTROL,4,2        ; @SDHCI_CLOCK_CONTROL
	.comm	_O2_PLL_DLL_WDT_CONTROL1,4,2    ; @O2_PLL_DLL_WDT_CONTROL1
	.comm	_O2_PLL_SOFT_RESET,4,2          ; @O2_PLL_SOFT_RESET
	.comm	_O2_SD_FUNC_REG4,4,2            ; @O2_SD_FUNC_REG4
	.comm	_O2_SD_FREG4_ENABLE_CLK_SET,4,2 ; @O2_SD_FREG4_ENABLE_CLK_SET
	.comm	_dmdn_table,8,3                 ; @dmdn_table
	.comm	_SDHCI_CLOCK_INT_EN,4,2         ; @SDHCI_CLOCK_INT_EN
	.comm	_SDHCI_CLOCK_CARD_EN,4,2        ; @SDHCI_CLOCK_CARD_EN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s: DLL unlocked when dll_adjust_count is %d.\n"

l_.str.1:                               ; @.str.1
	.asciz	"%s: card present detect failed.\n"

l_.str.2:                               ; @.str.2
	.asciz	"%s: DLL adjust over max times\n"

	.no_dead_strip	_sdhci_o2_dll_recovery
.subsections_via_symbols
