	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function aspeed_i2c_recover_bus
_aspeed_i2c_recover_bus:                ## @aspeed_i2c_recover_bus
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	callq	_spin_lock_irqsave
	movq	_ASPEED_I2C_CMD_REG@GOTPCREL(%rip), %r15
	movq	(%r15), %rdi
	addq	8(%rbx), %rdi
	callq	_readl
	movq	_ASPEED_I2CD_SDA_LINE_STS@GOTPCREL(%rip), %r12
	testl	%eax, (%r12)
	je	LBB0_6
## %bb.1:
	movq	_ASPEED_I2CD_SCL_LINE_STS@GOTPCREL(%rip), %r12
	testl	%eax, (%r12)
	je	LBB0_2
LBB0_8:
	movq	%rbx, %rdi
	callq	_spin_unlock_irqrestore
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movl	32(%rbx), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_dbg
	leaq	28(%rbx), %r14
	movq	%r14, %rdi
	callq	_reinit_completion
	movq	_ASPEED_I2CD_BUS_RECOVER_CMD@GOTPCREL(%rip), %rax
	jmp	LBB0_3
LBB0_2:
	movl	32(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	callq	_dev_dbg
	leaq	28(%rbx), %r14
	movq	%r14, %rdi
	callq	_reinit_completion
	movq	_ASPEED_I2CD_M_STOP_CMD@GOTPCREL(%rip), %rax
LBB0_3:
	movl	(%rax), %edi
	movq	(%r15), %rsi
	addq	8(%rbx), %rsi
	callq	_writel
	movq	%rbx, %rdi
	callq	_spin_unlock_irqrestore
	movl	24(%rbx), %esi
	movq	%r14, %rdi
	callq	_wait_for_completion_timeout
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_spin_lock_irqsave
	testq	%r14, %r14
	je	LBB0_5
## %bb.4:
	cmpq	$0, 16(%rbx)
	je	LBB0_7
LBB0_5:
	movq	%rbx, %rdi
	callq	_spin_unlock_irqrestore
	movq	%rbx, %rdi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_aspeed_i2c_reset               ## TAILCALL
LBB0_7:
	movq	(%r15), %rdi
	addq	8(%rbx), %rdi
	callq	_readl
	testl	%eax, (%r12)
	jne	LBB0_8
	jmp	LBB0_5
	.cfi_endproc
                                        ## -- End function
	.comm	_ASPEED_I2C_CMD_REG,8,3         ## @ASPEED_I2C_CMD_REG
	.comm	_ASPEED_I2CD_SDA_LINE_STS,4,2   ## @ASPEED_I2CD_SDA_LINE_STS
	.comm	_ASPEED_I2CD_SCL_LINE_STS,4,2   ## @ASPEED_I2CD_SCL_LINE_STS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"SCL hung (state %x), attempting recovery\n"

	.comm	_ASPEED_I2CD_M_STOP_CMD,4,2     ## @ASPEED_I2CD_M_STOP_CMD
L_.str.1:                               ## @.str.1
	.asciz	"SDA hung (state %x), attempting recovery\n"

	.comm	_ASPEED_I2CD_BUS_RECOVER_CMD,4,2 ## @ASPEED_I2CD_BUS_RECOVER_CMD
	.no_dead_strip	_aspeed_i2c_recover_bus
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function aspeed_i2c_recover_bus
_aspeed_i2c_recover_bus:                ; @aspeed_i2c_recover_bus
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x0
	bl	_spin_lock_irqsave
	ldr	x8, [x19, #8]
Lloh0:
	adrp	x21, _ASPEED_I2C_CMD_REG@GOTPAGE
Lloh1:
	ldr	x21, [x21, _ASPEED_I2C_CMD_REG@GOTPAGEOFF]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_readl
	mov	x2, x0
Lloh2:
	adrp	x22, _ASPEED_I2CD_SDA_LINE_STS@GOTPAGE
Lloh3:
	ldr	x22, [x22, _ASPEED_I2CD_SDA_LINE_STS@GOTPAGEOFF]
	ldr	w8, [x22]
	tst	w8, w0
	b.eq	LBB0_3
; %bb.1:
Lloh4:
	adrp	x22, _ASPEED_I2CD_SCL_LINE_STS@GOTPAGE
Lloh5:
	ldr	x22, [x22, _ASPEED_I2CD_SCL_LINE_STS@GOTPAGEOFF]
	ldr	w8, [x22]
	tst	w8, w2
	b.eq	LBB0_4
LBB0_2:
	mov	x0, x19
	bl	_spin_unlock_irqrestore
	mov	w0, #0
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_3:
	ldr	w0, [x19, #32]
Lloh6:
	adrp	x1, l_.str.1@PAGE
Lloh7:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_dbg
	add	x20, x19, #28
	mov	x0, x20
	bl	_reinit_completion
Lloh8:
	adrp	x8, _ASPEED_I2CD_BUS_RECOVER_CMD@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ASPEED_I2CD_BUS_RECOVER_CMD@GOTPAGEOFF]
	b	LBB0_5
LBB0_4:
	ldr	w0, [x19, #32]
Lloh10:
	adrp	x1, l_.str@PAGE
Lloh11:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	add	x20, x19, #28
	mov	x0, x20
	bl	_reinit_completion
Lloh12:
	adrp	x8, _ASPEED_I2CD_M_STOP_CMD@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ASPEED_I2CD_M_STOP_CMD@GOTPAGEOFF]
LBB0_5:
	ldr	w0, [x8]
	ldr	x8, [x19, #8]
	ldr	x9, [x21]
	add	x1, x9, x8
	bl	_writel
	mov	x0, x19
	bl	_spin_unlock_irqrestore
	ldr	w1, [x19, #24]
	mov	x0, x20
	bl	_wait_for_completion_timeout
	mov	x20, x0
	mov	x0, x19
	bl	_spin_lock_irqsave
	cbz	x20, LBB0_7
; %bb.6:
	ldr	x8, [x19, #16]
	cbz	x8, LBB0_8
LBB0_7:
	mov	x0, x19
	bl	_spin_unlock_irqrestore
	mov	x0, x19
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_aspeed_i2c_reset
LBB0_8:
	ldr	x8, [x19, #8]
	ldr	x9, [x21]
	add	x0, x9, x8
	bl	_readl
	ldr	w8, [x22]
	tst	w8, w0
	b.ne	LBB0_2
	b	LBB0_7
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh10, Lloh11
	.cfi_endproc
                                        ; -- End function
	.comm	_ASPEED_I2C_CMD_REG,8,3         ; @ASPEED_I2C_CMD_REG
	.comm	_ASPEED_I2CD_SDA_LINE_STS,4,2   ; @ASPEED_I2CD_SDA_LINE_STS
	.comm	_ASPEED_I2CD_SCL_LINE_STS,4,2   ; @ASPEED_I2CD_SCL_LINE_STS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"SCL hung (state %x), attempting recovery\n"

	.comm	_ASPEED_I2CD_M_STOP_CMD,4,2     ; @ASPEED_I2CD_M_STOP_CMD
l_.str.1:                               ; @.str.1
	.asciz	"SDA hung (state %x), attempting recovery\n"

	.comm	_ASPEED_I2CD_BUS_RECOVER_CMD,4,2 ; @ASPEED_I2CD_BUS_RECOVER_CMD
	.no_dead_strip	_aspeed_i2c_recover_bus
.subsections_via_symbols
