	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function qcaspi_qca7k_sync
_qcaspi_qca7k_sync:                     ## @qcaspi_qca7k_sync
	.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	%rbx
	subq	$24, %rsp
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	$0, -32(%rbp)
	movq	$0, -40(%rbp)
	movq	_QCASPI_EVENT_CPUON@GOTPCREL(%rip), %rax
	cmpl	%esi, (%rax)
	jne	LBB0_5
## %bb.1:
	movq	_SPI_REG_SIGNATURE@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	leaq	-32(%rbp), %r14
	movq	%rbx, %rdi
	movq	%r14, %rdx
	callq	_qcaspi_read_register
	movl	(%r15), %esi
	movq	%rbx, %rdi
	movq	%r14, %rdx
	callq	_qcaspi_read_register
	movq	-32(%rbp), %rax
	movq	_QCASPI_GOOD_SIGNATURE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
## %bb.3:
	movq	_SPI_REG_WRBUF_SPC_AVA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-40(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_qcaspi_read_register
	movq	-40(%rbp), %rax
	movq	_QCASPI_HW_BUF_LEN@GOTPCREL(%rip), %rcx
	movl	4(%rbx), %edi
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.17:
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_netdev_dbg
	movl	$130, (%rbx)
	jmp	LBB0_16
LBB0_2:
	movl	$128, (%rbx)
	movl	4(%rbx), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_netdev_dbg
	jmp	LBB0_5
LBB0_4:
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	callq	_netdev_dbg
	movl	$128, (%rbx)
LBB0_5:
	movl	(%rbx), %eax
	cmpl	$128, %eax
	je	LBB0_10
## %bb.6:
	cmpl	$129, %eax
	je	LBB0_13
## %bb.7:
	cmpl	$130, %eax
	jne	LBB0_16
## %bb.8:
	movq	_SPI_REG_SIGNATURE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-32(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_qcaspi_read_register
	movq	-32(%rbp), %rax
	movq	_QCASPI_GOOD_SIGNATURE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_16
## %bb.9:
	movl	$128, (%rbx)
	movl	4(%rbx), %edi
	leaq	L_.str.3(%rip), %rsi
	jmp	LBB0_15
LBB0_10:
	movq	_SPI_REG_SIGNATURE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-32(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_qcaspi_read_register
	movq	-32(%rbp), %rax
	movq	_QCASPI_GOOD_SIGNATURE@GOTPCREL(%rip), %rcx
	movl	4(%rbx), %edi
	cmpq	(%rcx), %rax
	jne	LBB0_11
## %bb.12:
	leaq	L_.str.5(%rip), %rsi
	xorl	%eax, %eax
	callq	_netdev_dbg
	movq	_SPI_REG_SPI_CONFIG@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	leaq	-48(%rbp), %rdx
	movq	%rbx, %rdi
	callq	_qcaspi_read_register
	movq	_QCASPI_SLAVE_RESET_BIT@GOTPCREL(%rip), %rax
	movq	-48(%rbp), %rdx
	orq	(%rax), %rdx
	movq	%rdx, -48(%rbp)
	movl	(%r14), %esi
	movq	%rbx, %rdi
	xorl	%ecx, %ecx
	callq	_qcaspi_write_register
	movl	$129, (%rbx)
	incl	12(%rbx)
	movq	$0, _qcaspi_qca7k_sync.reset_count(%rip)
	jmp	LBB0_16
LBB0_13:
	movq	_qcaspi_qca7k_sync.reset_count(%rip), %rdx
	incq	%rdx
	movq	%rdx, _qcaspi_qca7k_sync.reset_count(%rip)
	movl	4(%rbx), %edi
	leaq	L_.str.6(%rip), %rsi
	xorl	%eax, %eax
	callq	_netdev_dbg
	movq	_qcaspi_qca7k_sync.reset_count(%rip), %rax
	movq	_QCASPI_RESET_TIMEOUT@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jl	LBB0_16
## %bb.14:
	movl	$128, (%rbx)
	incl	8(%rbx)
	movl	4(%rbx), %edi
	leaq	L_.str.7(%rip), %rsi
	jmp	LBB0_15
LBB0_11:
	leaq	L_.str.4(%rip), %rsi
LBB0_15:
	xorl	%eax, %eax
	callq	_netdev_dbg
LBB0_16:
	addq	$24, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_qcaspi_qca7k_sync.reset_count,8,3 ## @qcaspi_qca7k_sync.reset_count
	.comm	_QCASPI_EVENT_CPUON,4,2         ## @QCASPI_EVENT_CPUON
	.comm	_SPI_REG_SIGNATURE,4,2          ## @SPI_REG_SIGNATURE
	.comm	_QCASPI_GOOD_SIGNATURE,8,3      ## @QCASPI_GOOD_SIGNATURE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"sync: got CPU on, but signature was invalid, restart\n"

	.comm	_SPI_REG_WRBUF_SPC_AVA,4,2      ## @SPI_REG_WRBUF_SPC_AVA
	.comm	_QCASPI_HW_BUF_LEN,8,3          ## @QCASPI_HW_BUF_LEN
L_.str.1:                               ## @.str.1
	.asciz	"sync: got CPU on, but wrbuf not empty. reset!\n"

L_.str.2:                               ## @.str.2
	.asciz	"sync: got CPU on, now in sync\n"

L_.str.3:                               ## @.str.3
	.asciz	"sync: bad signature, restart\n"

L_.str.4:                               ## @.str.4
	.asciz	"sync: could not read signature to reset device, retry.\n"

L_.str.5:                               ## @.str.5
	.asciz	"sync: resetting device.\n"

	.comm	_SPI_REG_SPI_CONFIG,4,2         ## @SPI_REG_SPI_CONFIG
	.comm	_QCASPI_SLAVE_RESET_BIT,8,3     ## @QCASPI_SLAVE_RESET_BIT
L_.str.6:                               ## @.str.6
	.asciz	"sync: waiting for CPU on, count %u.\n"

	.comm	_QCASPI_RESET_TIMEOUT,8,3       ## @QCASPI_RESET_TIMEOUT
L_.str.7:                               ## @.str.7
	.asciz	"sync: reset timeout, restarting process.\n"

	.no_dead_strip	_qcaspi_qca7k_sync
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function qcaspi_qca7k_sync
_qcaspi_qca7k_sync:                     ; @qcaspi_qca7k_sync
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	str	xzr, [sp, #24]
	str	xzr, [sp, #8]
Lloh0:
	adrp	x8, _QCASPI_EVENT_CPUON@GOTPAGE
Lloh1:
	ldr	x8, [x8, _QCASPI_EVENT_CPUON@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, w1
	b.ne	LBB0_6
; %bb.1:
Lloh3:
	adrp	x20, _SPI_REG_SIGNATURE@GOTPAGE
Lloh4:
	ldr	x20, [x20, _SPI_REG_SIGNATURE@GOTPAGEOFF]
	ldr	w1, [x20]
	add	x2, sp, #24
	mov	x0, x19
	bl	_qcaspi_read_register
	ldr	w1, [x20]
	add	x2, sp, #24
	mov	x0, x19
	bl	_qcaspi_read_register
	ldr	x8, [sp, #24]
Lloh5:
	adrp	x9, _QCASPI_GOOD_SIGNATURE@GOTPAGE
Lloh6:
	ldr	x9, [x9, _QCASPI_GOOD_SIGNATURE@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.2:
Lloh8:
	adrp	x8, _SPI_REG_WRBUF_SPC_AVA@GOTPAGE
Lloh9:
	ldr	x8, [x8, _SPI_REG_WRBUF_SPC_AVA@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	add	x2, sp, #8
	mov	x0, x19
	bl	_qcaspi_read_register
	ldr	x8, [sp, #8]
Lloh11:
	adrp	x9, _QCASPI_HW_BUF_LEN@GOTPAGE
Lloh12:
	ldr	x9, [x9, _QCASPI_HW_BUF_LEN@GOTPAGEOFF]
Lloh13:
	ldr	x9, [x9]
	ldr	w0, [x19, #4]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.3:
Lloh14:
	adrp	x1, l_.str.2@PAGE
Lloh15:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_netdev_dbg
	mov	w8, #130
	str	w8, [x19]
	b	LBB0_17
LBB0_4:
	mov	w8, #128
	str	w8, [x19]
	ldr	w0, [x19, #4]
Lloh16:
	adrp	x1, l_.str@PAGE
Lloh17:
	add	x1, x1, l_.str@PAGEOFF
	bl	_netdev_dbg
	b	LBB0_6
LBB0_5:
Lloh18:
	adrp	x1, l_.str.1@PAGE
Lloh19:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_netdev_dbg
	mov	w8, #128
	str	w8, [x19]
LBB0_6:
	ldr	w8, [x19]
	cmp	w8, #128
	b.eq	LBB0_11
; %bb.7:
	cmp	w8, #129
	b.eq	LBB0_13
; %bb.8:
	cmp	w8, #130
	b.ne	LBB0_17
; %bb.9:
Lloh20:
	adrp	x8, _SPI_REG_SIGNATURE@GOTPAGE
Lloh21:
	ldr	x8, [x8, _SPI_REG_SIGNATURE@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	add	x2, sp, #24
	mov	x0, x19
	bl	_qcaspi_read_register
	ldr	x8, [sp, #24]
Lloh23:
	adrp	x9, _QCASPI_GOOD_SIGNATURE@GOTPAGE
Lloh24:
	ldr	x9, [x9, _QCASPI_GOOD_SIGNATURE@GOTPAGEOFF]
Lloh25:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_17
; %bb.10:
	mov	w8, #128
	str	w8, [x19]
	ldr	w0, [x19, #4]
Lloh26:
	adrp	x1, l_.str.3@PAGE
Lloh27:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_16
LBB0_11:
Lloh28:
	adrp	x8, _SPI_REG_SIGNATURE@GOTPAGE
Lloh29:
	ldr	x8, [x8, _SPI_REG_SIGNATURE@GOTPAGEOFF]
Lloh30:
	ldr	w1, [x8]
	add	x2, sp, #24
	mov	x0, x19
	bl	_qcaspi_read_register
	ldr	x8, [sp, #24]
Lloh31:
	adrp	x9, _QCASPI_GOOD_SIGNATURE@GOTPAGE
Lloh32:
	ldr	x9, [x9, _QCASPI_GOOD_SIGNATURE@GOTPAGEOFF]
Lloh33:
	ldr	x9, [x9]
	ldr	w0, [x19, #4]
	cmp	x8, x9
	b.ne	LBB0_15
; %bb.12:
Lloh34:
	adrp	x1, l_.str.5@PAGE
Lloh35:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_netdev_dbg
Lloh36:
	adrp	x20, _SPI_REG_SPI_CONFIG@GOTPAGE
Lloh37:
	ldr	x20, [x20, _SPI_REG_SPI_CONFIG@GOTPAGEOFF]
	ldr	w1, [x20]
	add	x2, sp, #16
	mov	x0, x19
	bl	_qcaspi_read_register
Lloh38:
	adrp	x8, _QCASPI_SLAVE_RESET_BIT@GOTPAGE
Lloh39:
	ldr	x8, [x8, _QCASPI_SLAVE_RESET_BIT@GOTPAGEOFF]
Lloh40:
	ldr	x8, [x8]
	ldr	x9, [sp, #16]
	orr	x2, x9, x8
	str	x2, [sp, #16]
	ldr	w1, [x20]
	mov	x0, x19
	mov	w3, #0
	bl	_qcaspi_write_register
	mov	w8, #129
	str	w8, [x19]
	ldr	w8, [x19, #12]
	add	w8, w8, #1
	str	w8, [x19, #12]
	adrp	x8, _qcaspi_qca7k_sync.reset_count@PAGE
	str	xzr, [x8, _qcaspi_qca7k_sync.reset_count@PAGEOFF]
	b	LBB0_17
LBB0_13:
	adrp	x20, _qcaspi_qca7k_sync.reset_count@PAGE
	ldr	x8, [x20, _qcaspi_qca7k_sync.reset_count@PAGEOFF]
	add	x8, x8, #1
	str	x8, [x20, _qcaspi_qca7k_sync.reset_count@PAGEOFF]
	ldr	w0, [x19, #4]
	str	x8, [sp]
Lloh41:
	adrp	x1, l_.str.6@PAGE
Lloh42:
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_netdev_dbg
	ldr	x8, [x20, _qcaspi_qca7k_sync.reset_count@PAGEOFF]
Lloh43:
	adrp	x9, _QCASPI_RESET_TIMEOUT@GOTPAGE
Lloh44:
	ldr	x9, [x9, _QCASPI_RESET_TIMEOUT@GOTPAGEOFF]
Lloh45:
	ldr	x9, [x9]
	cmp	x8, x9
	b.lt	LBB0_17
; %bb.14:
	mov	w8, #128
	str	w8, [x19]
	ldp	w0, w8, [x19, #4]
	add	w8, w8, #1
	str	w8, [x19, #8]
Lloh46:
	adrp	x1, l_.str.7@PAGE
Lloh47:
	add	x1, x1, l_.str.7@PAGEOFF
	b	LBB0_16
LBB0_15:
Lloh48:
	adrp	x1, l_.str.4@PAGE
Lloh49:
	add	x1, x1, l_.str.4@PAGEOFF
LBB0_16:
	bl	_netdev_dbg
LBB0_17:
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGot	Lloh36, Lloh37
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh43, Lloh44, Lloh45
	.loh AdrpAdd	Lloh41, Lloh42
	.loh AdrpAdd	Lloh46, Lloh47
	.loh AdrpAdd	Lloh48, Lloh49
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_qcaspi_qca7k_sync.reset_count,8,3 ; @qcaspi_qca7k_sync.reset_count
	.comm	_QCASPI_EVENT_CPUON,4,2         ; @QCASPI_EVENT_CPUON
	.comm	_SPI_REG_SIGNATURE,4,2          ; @SPI_REG_SIGNATURE
	.comm	_QCASPI_GOOD_SIGNATURE,8,3      ; @QCASPI_GOOD_SIGNATURE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"sync: got CPU on, but signature was invalid, restart\n"

	.comm	_SPI_REG_WRBUF_SPC_AVA,4,2      ; @SPI_REG_WRBUF_SPC_AVA
	.comm	_QCASPI_HW_BUF_LEN,8,3          ; @QCASPI_HW_BUF_LEN
l_.str.1:                               ; @.str.1
	.asciz	"sync: got CPU on, but wrbuf not empty. reset!\n"

l_.str.2:                               ; @.str.2
	.asciz	"sync: got CPU on, now in sync\n"

l_.str.3:                               ; @.str.3
	.asciz	"sync: bad signature, restart\n"

l_.str.4:                               ; @.str.4
	.asciz	"sync: could not read signature to reset device, retry.\n"

l_.str.5:                               ; @.str.5
	.asciz	"sync: resetting device.\n"

	.comm	_SPI_REG_SPI_CONFIG,4,2         ; @SPI_REG_SPI_CONFIG
	.comm	_QCASPI_SLAVE_RESET_BIT,8,3     ; @QCASPI_SLAVE_RESET_BIT
l_.str.6:                               ; @.str.6
	.asciz	"sync: waiting for CPU on, count %u.\n"

	.comm	_QCASPI_RESET_TIMEOUT,8,3       ; @QCASPI_RESET_TIMEOUT
l_.str.7:                               ; @.str.7
	.asciz	"sync: reset timeout, restarting process.\n"

	.no_dead_strip	_qcaspi_qca7k_sync
.subsections_via_symbols
