	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function socfpga_a10_fpga_write_complete
_socfpga_a10_fpga_write_complete:       ## @socfpga_a10_fpga_write_complete
	.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, %r14
	movq	8(%rdi), %rbx
	movq	%rbx, %rdi
	callq	_socfpga_a10_fpga_wait_for_pr_done
	movl	%eax, %r15d
	movl	(%rbx), %edi
	movq	_A10_FPGAMGR_IMGCFG_CTL_01_OFST@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	_A10_FPGAMGR_IMGCFG_CTL_01_S2F_PR_REQUEST@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%ecx, %ecx
	callq	_regmap_update_bits
	movq	%rbx, %rdi
	movl	$256, %esi                      ## imm = 0x100
	callq	_socfpga_a10_fpga_generate_dclks
	movl	(%rbx), %edi
	movq	_A10_FPGAMGR_IMGCFG_CTL_02_OFST@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_A10_FPGAMGR_IMGCFG_CTL_02_EN_CFG_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%ecx, %ecx
	callq	_regmap_update_bits
	movl	(%rbx), %edi
	movl	(%r12), %esi
	movq	_A10_FPGAMGR_IMGCFG_CTL_01_S2F_NCE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%ecx, %edx
	callq	_regmap_update_bits
	movl	(%rbx), %edi
	movl	(%r12), %esi
	movq	_A10_FPGAMGR_IMGCFG_CTL_01_S2F_NENABLE_CONFIG@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	%ecx, %edx
	callq	_regmap_update_bits
	testl	%r15d, %r15d
	jne	LBB0_5
## %bb.1:
	movq	%rbx, %rdi
	callq	_socfpga_a10_fpga_read_stat
	movq	_A10_FPGAMGR_IMGCFG_STAT_F2S_USERMODE@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_4
## %bb.2:
	movq	_A10_FPGAMGR_IMGCFG_STAT_F2S_CONDONE_PIN@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_4
## %bb.3:
	movq	_A10_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN@GOTPCREL(%rip), %rcx
	xorl	%r15d, %r15d
	testl	%eax, (%rcx)
	jne	LBB0_5
LBB0_4:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	callq	_dev_dbg
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_5:
	movl	%r15d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_A10_FPGAMGR_IMGCFG_CTL_01_OFST,4,2 ## @A10_FPGAMGR_IMGCFG_CTL_01_OFST
	.comm	_A10_FPGAMGR_IMGCFG_CTL_01_S2F_PR_REQUEST,4,2 ## @A10_FPGAMGR_IMGCFG_CTL_01_S2F_PR_REQUEST
	.comm	_A10_FPGAMGR_IMGCFG_CTL_02_OFST,4,2 ## @A10_FPGAMGR_IMGCFG_CTL_02_OFST
	.comm	_A10_FPGAMGR_IMGCFG_CTL_02_EN_CFG_CTRL,4,2 ## @A10_FPGAMGR_IMGCFG_CTL_02_EN_CFG_CTRL
	.comm	_A10_FPGAMGR_IMGCFG_CTL_01_S2F_NCE,4,2 ## @A10_FPGAMGR_IMGCFG_CTL_01_S2F_NCE
	.comm	_A10_FPGAMGR_IMGCFG_CTL_01_S2F_NENABLE_CONFIG,4,2 ## @A10_FPGAMGR_IMGCFG_CTL_01_S2F_NENABLE_CONFIG
	.comm	_A10_FPGAMGR_IMGCFG_STAT_F2S_USERMODE,4,2 ## @A10_FPGAMGR_IMGCFG_STAT_F2S_USERMODE
	.comm	_A10_FPGAMGR_IMGCFG_STAT_F2S_CONDONE_PIN,4,2 ## @A10_FPGAMGR_IMGCFG_STAT_F2S_CONDONE_PIN
	.comm	_A10_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN,4,2 ## @A10_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Timeout in final check. Status=%08xf\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.no_dead_strip	_socfpga_a10_fpga_write_complete
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function socfpga_a10_fpga_write_complete
_socfpga_a10_fpga_write_complete:       ; @socfpga_a10_fpga_write_complete
	.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
	ldr	x20, [x0, #8]
	mov	x0, x20
	bl	_socfpga_a10_fpga_wait_for_pr_done
	mov	x21, x0
	ldr	w0, [x20]
Lloh0:
	adrp	x22, _A10_FPGAMGR_IMGCFG_CTL_01_OFST@GOTPAGE
Lloh1:
	ldr	x22, [x22, _A10_FPGAMGR_IMGCFG_CTL_01_OFST@GOTPAGEOFF]
	ldr	w1, [x22]
Lloh2:
	adrp	x8, _A10_FPGAMGR_IMGCFG_CTL_01_S2F_PR_REQUEST@GOTPAGE
Lloh3:
	ldr	x8, [x8, _A10_FPGAMGR_IMGCFG_CTL_01_S2F_PR_REQUEST@GOTPAGEOFF]
Lloh4:
	ldr	w2, [x8]
	mov	w3, #0
	bl	_regmap_update_bits
	mov	x0, x20
	mov	w1, #256
	bl	_socfpga_a10_fpga_generate_dclks
	ldr	w0, [x20]
Lloh5:
	adrp	x8, _A10_FPGAMGR_IMGCFG_CTL_02_OFST@GOTPAGE
Lloh6:
	ldr	x8, [x8, _A10_FPGAMGR_IMGCFG_CTL_02_OFST@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
Lloh8:
	adrp	x8, _A10_FPGAMGR_IMGCFG_CTL_02_EN_CFG_CTRL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _A10_FPGAMGR_IMGCFG_CTL_02_EN_CFG_CTRL@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	mov	w3, #0
	bl	_regmap_update_bits
	ldr	w0, [x20]
	ldr	w1, [x22]
Lloh11:
	adrp	x8, _A10_FPGAMGR_IMGCFG_CTL_01_S2F_NCE@GOTPAGE
Lloh12:
	ldr	x8, [x8, _A10_FPGAMGR_IMGCFG_CTL_01_S2F_NCE@GOTPAGEOFF]
Lloh13:
	ldr	w2, [x8]
	mov	x3, x2
	bl	_regmap_update_bits
	ldr	w0, [x20]
	ldr	w1, [x22]
Lloh14:
	adrp	x8, _A10_FPGAMGR_IMGCFG_CTL_01_S2F_NENABLE_CONFIG@GOTPAGE
Lloh15:
	ldr	x8, [x8, _A10_FPGAMGR_IMGCFG_CTL_01_S2F_NENABLE_CONFIG@GOTPAGEOFF]
Lloh16:
	ldr	w2, [x8]
	mov	x3, x2
	bl	_regmap_update_bits
	cbnz	w21, LBB0_6
; %bb.1:
	mov	x0, x20
	bl	_socfpga_a10_fpga_read_stat
	mov	x2, x0
Lloh17:
	adrp	x8, _A10_FPGAMGR_IMGCFG_STAT_F2S_USERMODE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _A10_FPGAMGR_IMGCFG_STAT_F2S_USERMODE@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_5
; %bb.2:
Lloh20:
	adrp	x8, _A10_FPGAMGR_IMGCFG_STAT_F2S_CONDONE_PIN@GOTPAGE
Lloh21:
	ldr	x8, [x8, _A10_FPGAMGR_IMGCFG_STAT_F2S_CONDONE_PIN@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	tst	w8, w2
	b.eq	LBB0_5
; %bb.3:
Lloh23:
	adrp	x8, _A10_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN@GOTPAGE
Lloh24:
	ldr	x8, [x8, _A10_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	tst	w8, w2
	b.eq	LBB0_5
; %bb.4:
	mov	w21, #0
	b	LBB0_6
LBB0_5:
Lloh26:
	adrp	x1, l_.str@PAGE
Lloh27:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_dev_dbg
Lloh28:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh29:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_6:
	mov	x0, x21
	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
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_A10_FPGAMGR_IMGCFG_CTL_01_OFST,4,2 ; @A10_FPGAMGR_IMGCFG_CTL_01_OFST
	.comm	_A10_FPGAMGR_IMGCFG_CTL_01_S2F_PR_REQUEST,4,2 ; @A10_FPGAMGR_IMGCFG_CTL_01_S2F_PR_REQUEST
	.comm	_A10_FPGAMGR_IMGCFG_CTL_02_OFST,4,2 ; @A10_FPGAMGR_IMGCFG_CTL_02_OFST
	.comm	_A10_FPGAMGR_IMGCFG_CTL_02_EN_CFG_CTRL,4,2 ; @A10_FPGAMGR_IMGCFG_CTL_02_EN_CFG_CTRL
	.comm	_A10_FPGAMGR_IMGCFG_CTL_01_S2F_NCE,4,2 ; @A10_FPGAMGR_IMGCFG_CTL_01_S2F_NCE
	.comm	_A10_FPGAMGR_IMGCFG_CTL_01_S2F_NENABLE_CONFIG,4,2 ; @A10_FPGAMGR_IMGCFG_CTL_01_S2F_NENABLE_CONFIG
	.comm	_A10_FPGAMGR_IMGCFG_STAT_F2S_USERMODE,4,2 ; @A10_FPGAMGR_IMGCFG_STAT_F2S_USERMODE
	.comm	_A10_FPGAMGR_IMGCFG_STAT_F2S_CONDONE_PIN,4,2 ; @A10_FPGAMGR_IMGCFG_STAT_F2S_CONDONE_PIN
	.comm	_A10_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN,4,2 ; @A10_FPGAMGR_IMGCFG_STAT_F2S_NSTATUS_PIN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Timeout in final check. Status=%08xf\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.no_dead_strip	_socfpga_a10_fpga_write_complete
.subsections_via_symbols
