	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function firmware_load
_firmware_load:                         ## @firmware_load
	.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	$104, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	%rsi, %rdi
	callq	_spi_get_drvdata
	testq	%rbx, %rbx
	je	LBB0_1
## %bb.4:
	cmpl	$0, (%rbx)
	je	LBB0_5
## %bb.7:
	movq	%rax, -136(%rbp)                ## 8-byte Spill
	movq	$0, -76(%rbp)
	movl	$0, -68(%rbp)
	movq	_FPGA_CMD_READ_ID@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -80(%rbp)
	leaq	-80(%rbp), %rsi
	leaq	-112(%rbp), %rcx
	movq	%r12, %rdi
	movl	$8, %edx
	movl	$8, %r8d
	callq	_spi_write_then_read
	leaq	-96(%rbp), %rdi
	callq	_get_unaligned_be32
	movq	%rax, %r15
	leaq	L_.str.2(%rip), %rsi
	movq	%r12, %rdi
	movq	%rax, %rdx
	callq	_dev_dbg
	movq	_ecp3_dev@GOTPCREL(%rip), %r14
	movq	(%r14), %rdi
	callq	_ARRAY_SIZE
	testl	%eax, %eax
	movq	%rbx, -128(%rbp)                ## 8-byte Spill
	jle	LBB0_8
## %bb.9:
	xorl	%ebx, %ebx
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rdi
	cmpq	(%rdi,%rbx), %r15
	je	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	incq	%r13
	callq	_ARRAY_SIZE
	cltq
	addq	$16, %rbx
	cmpq	%rax, %r13
	jl	LBB0_10
LBB0_12:
	movq	-128(%rbp), %rbx                ## 8-byte Reload
	jmp	LBB0_13
LBB0_1:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_27
## %bb.2:
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_3
LBB0_5:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_27
## %bb.6:
	leaq	L_.str.1(%rip), %rsi
LBB0_3:
	movq	%r12, %rdi
	xorl	%eax, %eax
	addq	$104, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_dev_err                        ## TAILCALL
LBB0_8:
	xorl	%r13d, %r13d
LBB0_13:
	movq	(%r14), %rdi
	callq	_ARRAY_SIZE
	cmpl	%eax, %r13d
	jne	LBB0_15
## %bb.14:
	leaq	L_.str.3(%rip), %rsi
	movq	%r12, %rdi
	movq	%r15, %rdx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_25
LBB0_15:
	movq	(%r14), %rax
	movl	%r13d, %ecx
	shlq	$4, %rcx
	movl	8(%rax,%rcx), %edx
	leaq	L_.str.4(%rip), %rsi
	xorl	%r15d, %r15d
	movq	%r12, %rdi
	xorl	%eax, %eax
	callq	_dev_info
	movq	_FPGA_CMD_READ_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -80(%rbp)
	leaq	-80(%rbp), %rsi
	leaq	-112(%rbp), %rcx
	movq	%r12, %rdi
	movl	$8, %edx
	movl	$8, %r8d
	callq	_spi_write_then_read
	leaq	-96(%rbp), %rdi
	callq	_get_unaligned_be32
	movq	%rax, %r14
	leaq	L_.str.5(%rip), %rsi
	movq	%r12, %rdi
	movq	%rax, %rdx
	callq	_dev_dbg
	movl	(%rbx), %edi
	addl	$8, %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_16
## %bb.17:
	movq	_FPGA_CMD_WRITE_INC@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, (%rax)
	movabsq	$1095216660735, %rcx            ## imm = 0xFF000000FF
	movq	%rcx, 4(%rax)
	movl	$255, 12(%rax)
	movq	%rax, -120(%rbp)                ## 8-byte Spill
	movq	%rax, %rdi
	addq	$16, %rdi
	movl	(%rbx), %edx
	movl	4(%rbx), %esi
	callq	_memcpy
	movq	_FPGA_CMD_REFRESH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -80(%rbp)
	leaq	-80(%rbp), %rbx
	movq	%r12, %rdi
	movq	%rbx, %rsi
	movl	$4, %edx
	callq	_spi_write
	movq	_FPGA_CMD_WRITE_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -80(%rbp)
	movq	%r12, %rdi
	movq	%rbx, %rsi
	movl	$4, %edx
	callq	_spi_write
	movq	_FPGA_CMD_CLEAR@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -80(%rbp)
	movq	%r12, %rdi
	movq	%rbx, %rsi
	movl	$4, %edx
	callq	_spi_write
	movq	_FPGA_CLEAR_LOOP_COUNT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	jle	LBB0_22
## %bb.18:
	xorl	%r15d, %r15d
	movq	_FPGA_STATUS_CLEARED@GOTPCREL(%rip), %rbx
	movq	_FPGA_CLEAR_MSLEEP@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_19:                                ## =>This Inner Loop Header: Depth=1
	movq	_FPGA_CMD_READ_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -80(%rbp)
	movq	%r12, %rdi
	leaq	-80(%rbp), %rsi
	movl	$8, %edx
	leaq	-112(%rbp), %rcx
	movl	$8, %r8d
	callq	_spi_write_then_read
	leaq	-96(%rbp), %rdi
	callq	_get_unaligned_be32
	movq	%rax, %r14
	cmpq	(%rbx), %rax
	je	LBB0_20
## %bb.21:                              ##   in Loop: Header=BB0_19 Depth=1
	movl	(%r13), %edi
	callq	_msleep
	incl	%r15d
	movq	_FPGA_CLEAR_LOOP_COUNT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%eax, %r15d
	jl	LBB0_19
LBB0_22:
	cmpl	%eax, %r15d
	jne	LBB0_24
LBB0_23:
	leaq	L_.str.7(%rip), %rsi
	movq	%r12, %rdi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	_dev_err
	movq	-120(%rbp), %rdi                ## 8-byte Reload
	callq	_kfree
	jmp	LBB0_25
LBB0_16:
	leaq	L_.str.6(%rip), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_25
LBB0_20:
	movq	_FPGA_CLEAR_LOOP_COUNT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%eax, %r15d
	je	LBB0_23
LBB0_24:
	leaq	L_.str.8(%rip), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	callq	_dev_info
	movq	-128(%rbp), %r14                ## 8-byte Reload
	movl	(%r14), %edx
	addl	$8, %edx
	movq	%r12, %rdi
	movq	-120(%rbp), %r15                ## 8-byte Reload
	movq	%r15, %rsi
	callq	_spi_write
	movq	_FPGA_CMD_WRITE_DIS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -80(%rbp)
	leaq	-80(%rbp), %rbx
	movq	%r12, %rdi
	movq	%rbx, %rsi
	movl	$4, %edx
	callq	_spi_write
	movq	_FPGA_CMD_READ_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -80(%rbp)
	leaq	-112(%rbp), %rcx
	movq	%r12, %rdi
	movq	%rbx, %rsi
	movl	$8, %edx
	movl	$8, %r8d
	callq	_spi_write_then_read
	leaq	-96(%rbp), %rdi
	callq	_get_unaligned_be32
	movq	%rax, %rbx
	leaq	L_.str.5(%rip), %rsi
	movq	%r12, %rdi
	movq	%rax, %rdx
	callq	_dev_dbg
	movq	_FPGA_STATUS_DONE@GOTPCREL(%rip), %rax
	andq	(%rax), %rbx
	leaq	L_.str.10(%rip), %rax
	leaq	L_.str.9(%rip), %rsi
	cmoveq	%rax, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	callq	_dev_info
	movq	%r14, %rdi
	callq	_release_firmware
	movq	%r15, %rdi
	callq	_kfree
	movq	-136(%rbp), %rdi                ## 8-byte Reload
	callq	_complete
LBB0_25:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_27
## %bb.26:
	addq	$104, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_27:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Cannot load firmware, aborting\n"

L_.str.1:                               ## @.str.1
	.asciz	"Error: Firmware size is 0!\n"

	.comm	_FPGA_CMD_READ_ID,4,2           ## @FPGA_CMD_READ_ID
L_.str.2:                               ## @.str.2
	.asciz	"FPGA JTAG ID=%08x\n"

	.comm	_ecp3_dev,8,3                   ## @ecp3_dev
L_.str.3:                               ## @.str.3
	.asciz	"Error: No supported FPGA detected (JEDEC_ID=%08x)!\n"

L_.str.4:                               ## @.str.4
	.asciz	"FPGA %s detected\n"

	.comm	_FPGA_CMD_READ_STATUS,4,2       ## @FPGA_CMD_READ_STATUS
L_.str.5:                               ## @.str.5
	.asciz	"FPGA Status=%08x\n"

	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.6:                               ## @.str.6
	.asciz	"Error: Can't allocate memory!\n"

	.comm	_FPGA_CMD_WRITE_INC,4,2         ## @FPGA_CMD_WRITE_INC
	.comm	_FPGA_CMD_REFRESH,4,2           ## @FPGA_CMD_REFRESH
	.comm	_FPGA_CMD_WRITE_EN,4,2          ## @FPGA_CMD_WRITE_EN
	.comm	_FPGA_CMD_CLEAR,4,2             ## @FPGA_CMD_CLEAR
	.comm	_FPGA_CLEAR_LOOP_COUNT,4,2      ## @FPGA_CLEAR_LOOP_COUNT
	.comm	_FPGA_STATUS_CLEARED,8,3        ## @FPGA_STATUS_CLEARED
	.comm	_FPGA_CLEAR_MSLEEP,4,2          ## @FPGA_CLEAR_MSLEEP
L_.str.7:                               ## @.str.7
	.asciz	"Error: Timeout waiting for FPGA to clear (status=%08x)!\n"

L_.str.8:                               ## @.str.8
	.asciz	"Configuring the FPGA...\n"

	.comm	_FPGA_CMD_WRITE_DIS,4,2         ## @FPGA_CMD_WRITE_DIS
	.comm	_FPGA_STATUS_DONE,8,3           ## @FPGA_STATUS_DONE
L_.str.9:                               ## @.str.9
	.asciz	"FPGA successfully configured!\n"

L_.str.10:                              ## @.str.10
	.asciz	"FPGA not configured (DONE not set)\n"

	.no_dead_strip	_firmware_load
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function firmware_load
_firmware_load:                         ; @firmware_load
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #192
	.cfi_def_cfa_offset 192
	stp	x28, x27, [sp, #96]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #112]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #128]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #144]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #160]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #176]            ; 16-byte Folded Spill
	add	x29, sp, #176
	.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	x19, x1
	mov	x21, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #88]
	mov	x0, x1
	bl	_spi_get_drvdata
	cbz	x21, LBB0_6
; %bb.1:
	ldr	w8, [x21]
	cbz	w8, LBB0_8
; %bb.2:
	mov	x28, x0
	str	xzr, [sp, #64]
Lloh3:
	adrp	x8, _FPGA_CMD_READ_ID@GOTPAGE
Lloh4:
	ldr	x8, [x8, _FPGA_CMD_READ_ID@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	stp	w8, wzr, [sp, #56]
	add	x20, sp, #24
	add	x1, sp, #56
	add	x3, sp, #24
	mov	x0, x19
	mov	w2, #8
	mov	w4, #8
	bl	_spi_write_then_read
	add	x22, x20, #16
	mov	x0, x22
	bl	_get_unaligned_be32
	mov	x23, x0
Lloh6:
	adrp	x1, l_.str.2@PAGE
Lloh7:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	mov	x2, x23
	bl	_dev_dbg
Lloh8:
	adrp	x24, _ecp3_dev@GOTPAGE
Lloh9:
	ldr	x24, [x24, _ecp3_dev@GOTPAGEOFF]
	ldr	x0, [x24]
	bl	_ARRAY_SIZE
	cmp	w0, #1
	b.lt	LBB0_11
; %bb.3:
	mov	x20, #0
	mov	x25, #0
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x24]
	ldr	x8, [x0, x20]
	cmp	x23, x8
	b.eq	LBB0_12
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x25, x25, #1
	bl	_ARRAY_SIZE
	add	x20, x20, #16
	cmp	x25, w0, sxtw
	b.lt	LBB0_4
	b	LBB0_12
LBB0_6:
	ldr	x8, [sp, #88]
Lloh10:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh11:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_28
; %bb.7:
Lloh13:
	adrp	x1, l_.str@PAGE
Lloh14:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_10
LBB0_8:
	ldr	x8, [sp, #88]
Lloh15:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh16:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_28
; %bb.9:
Lloh18:
	adrp	x1, l_.str.1@PAGE
Lloh19:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_10:
	mov	x0, x19
	ldp	x29, x30, [sp, #176]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #160]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #144]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #128]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #112]            ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #96]             ; 16-byte Folded Reload
	add	sp, sp, #192
	b	_dev_err
LBB0_11:
	mov	w25, #0
LBB0_12:
	ldr	x0, [x24]
	bl	_ARRAY_SIZE
	cmp	w25, w0
	b.ne	LBB0_14
; %bb.13:
	str	x23, [sp]
Lloh20:
	adrp	x1, l_.str.3@PAGE
Lloh21:
	add	x1, x1, l_.str.3@PAGEOFF
	b	LBB0_20
LBB0_14:
	ldr	x8, [x24]
	add	x8, x8, w25, uxtw #4
	ldr	w8, [x8, #8]
	str	x8, [sp]
Lloh22:
	adrp	x1, l_.str.4@PAGE
Lloh23:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x19
	bl	_dev_info
Lloh24:
	adrp	x25, _FPGA_CMD_READ_STATUS@GOTPAGE
Lloh25:
	ldr	x25, [x25, _FPGA_CMD_READ_STATUS@GOTPAGEOFF]
	ldr	w8, [x25]
	str	w8, [sp, #56]
	add	x1, sp, #56
	add	x3, sp, #24
	mov	x0, x19
	mov	w2, #8
	mov	w4, #8
	bl	_spi_write_then_read
	mov	x0, x22
	bl	_get_unaligned_be32
	mov	x24, x0
Lloh26:
	adrp	x1, l_.str.5@PAGE
Lloh27:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x19
	mov	x2, x24
	bl	_dev_dbg
	ldr	w8, [x21]
	add	w0, w8, #8
Lloh28:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh29:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh30:
	ldr	w1, [x8]
	bl	_kzalloc
	cbz	x0, LBB0_19
; %bb.15:
	mov	x23, x0
Lloh31:
	adrp	x8, _FPGA_CMD_WRITE_INC@GOTPAGE
Lloh32:
	ldr	x8, [x8, _FPGA_CMD_WRITE_INC@GOTPAGEOFF]
Lloh33:
	ldr	w8, [x8]
	str	w8, [x0]
	movi	d0, #0x0000ff000000ff
	stur	d0, [x0, #4]
	mov	w8, #255
	str	w8, [x0, #12]
	add	x0, x0, #16
	ldp	w2, w1, [x21]
	bl	_memcpy
Lloh34:
	adrp	x8, _FPGA_CMD_REFRESH@GOTPAGE
Lloh35:
	ldr	x8, [x8, _FPGA_CMD_REFRESH@GOTPAGEOFF]
Lloh36:
	ldr	w8, [x8]
	str	w8, [sp, #56]
	add	x1, sp, #56
	mov	x0, x19
	mov	w2, #4
	bl	_spi_write
Lloh37:
	adrp	x8, _FPGA_CMD_WRITE_EN@GOTPAGE
Lloh38:
	ldr	x8, [x8, _FPGA_CMD_WRITE_EN@GOTPAGEOFF]
Lloh39:
	ldr	w8, [x8]
	str	w8, [sp, #56]
	add	x1, sp, #56
	mov	x0, x19
	mov	w2, #4
	bl	_spi_write
Lloh40:
	adrp	x8, _FPGA_CMD_CLEAR@GOTPAGE
Lloh41:
	ldr	x8, [x8, _FPGA_CMD_CLEAR@GOTPAGEOFF]
Lloh42:
	ldr	w8, [x8]
	str	w8, [sp, #56]
	add	x1, sp, #56
	mov	x0, x19
	mov	w2, #4
	bl	_spi_write
Lloh43:
	adrp	x27, _FPGA_CLEAR_LOOP_COUNT@GOTPAGE
Lloh44:
	ldr	x27, [x27, _FPGA_CLEAR_LOOP_COUNT@GOTPAGEOFF]
	ldr	w8, [x27]
	cmp	w8, #1
	b.lt	LBB0_23
; %bb.16:
	str	x28, [sp, #16]                  ; 8-byte Folded Spill
	mov	w26, #0
Lloh45:
	adrp	x28, _FPGA_STATUS_CLEARED@GOTPAGE
Lloh46:
	ldr	x28, [x28, _FPGA_STATUS_CLEARED@GOTPAGEOFF]
Lloh47:
	adrp	x20, _FPGA_CLEAR_MSLEEP@GOTPAGE
Lloh48:
	ldr	x20, [x20, _FPGA_CLEAR_MSLEEP@GOTPAGEOFF]
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x25]
	str	w8, [sp, #56]
	add	x1, sp, #56
	add	x3, sp, #24
	mov	x0, x19
	mov	w2, #8
	mov	w4, #8
	bl	_spi_write_then_read
	mov	x0, x22
	bl	_get_unaligned_be32
	mov	x24, x0
	ldr	x8, [x28]
	cmp	x0, x8
	b.eq	LBB0_25
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=1
	ldr	w0, [x20]
	bl	_msleep
	add	w26, w26, #1
	ldr	w8, [x27]
	cmp	w26, w8
	b.lt	LBB0_17
	b	LBB0_26
LBB0_19:
Lloh49:
	adrp	x1, l_.str.6@PAGE
Lloh50:
	add	x1, x1, l_.str.6@PAGEOFF
LBB0_20:
	mov	x0, x19
	bl	_dev_err
LBB0_21:
	ldr	x8, [sp, #88]
Lloh51:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh52:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh53:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_28
; %bb.22:
	ldp	x29, x30, [sp, #176]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #160]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #144]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #128]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #112]            ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #96]             ; 16-byte Folded Reload
	add	sp, sp, #192
	ret
LBB0_23:
	mov	w26, #0
	cmp	w26, w8
	b.eq	LBB0_27
LBB0_24:
Lloh54:
	adrp	x1, l_.str.8@PAGE
Lloh55:
	add	x1, x1, l_.str.8@PAGEOFF
	mov	x0, x19
	bl	_dev_info
	ldr	w8, [x21]
	add	w2, w8, #8
	mov	x0, x19
	mov	x1, x23
	bl	_spi_write
Lloh56:
	adrp	x8, _FPGA_CMD_WRITE_DIS@GOTPAGE
Lloh57:
	ldr	x8, [x8, _FPGA_CMD_WRITE_DIS@GOTPAGEOFF]
Lloh58:
	ldr	w8, [x8]
	str	w8, [sp, #56]
	add	x1, sp, #56
	mov	x0, x19
	mov	w2, #4
	bl	_spi_write
	ldr	w8, [x25]
	str	w8, [sp, #56]
	add	x1, sp, #56
	add	x3, sp, #24
	mov	x0, x19
	mov	w2, #8
	mov	w4, #8
	bl	_spi_write_then_read
	mov	x0, x22
	bl	_get_unaligned_be32
	mov	x22, x0
Lloh59:
	adrp	x1, l_.str.5@PAGE
Lloh60:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x19
	mov	x2, x22
	bl	_dev_dbg
Lloh61:
	adrp	x8, _FPGA_STATUS_DONE@GOTPAGE
Lloh62:
	ldr	x8, [x8, _FPGA_STATUS_DONE@GOTPAGEOFF]
Lloh63:
	ldr	x8, [x8]
Lloh64:
	adrp	x9, l_.str.9@PAGE
Lloh65:
	add	x9, x9, l_.str.9@PAGEOFF
Lloh66:
	adrp	x10, l_.str.10@PAGE
Lloh67:
	add	x10, x10, l_.str.10@PAGEOFF
	tst	x8, x22
	csel	x1, x10, x9, eq
	mov	x0, x19
	bl	_dev_info
	mov	x0, x21
	bl	_release_firmware
	mov	x0, x23
	bl	_kfree
	mov	x0, x28
	bl	_complete
	b	LBB0_21
LBB0_25:
	ldr	w8, [x27]
LBB0_26:
	ldr	x28, [sp, #16]                  ; 8-byte Folded Reload
	cmp	w26, w8
	b.ne	LBB0_24
LBB0_27:
	str	x24, [sp]
Lloh68:
	adrp	x1, l_.str.7@PAGE
Lloh69:
	add	x1, x1, l_.str.7@PAGEOFF
	mov	x0, x19
	bl	_dev_err
	mov	x0, x23
	bl	_kfree
	b	LBB0_21
LBB0_28:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh40, Lloh41, Lloh42
	.loh AdrpLdrGotLdr	Lloh37, Lloh38, Lloh39
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh47, Lloh48
	.loh AdrpLdrGot	Lloh45, Lloh46
	.loh AdrpAdd	Lloh49, Lloh50
	.loh AdrpLdrGotLdr	Lloh51, Lloh52, Lloh53
	.loh AdrpAdd	Lloh66, Lloh67
	.loh AdrpAdd	Lloh64, Lloh65
	.loh AdrpLdrGotLdr	Lloh61, Lloh62, Lloh63
	.loh AdrpAdd	Lloh59, Lloh60
	.loh AdrpLdrGotLdr	Lloh56, Lloh57, Lloh58
	.loh AdrpAdd	Lloh54, Lloh55
	.loh AdrpAdd	Lloh68, Lloh69
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Cannot load firmware, aborting\n"

l_.str.1:                               ; @.str.1
	.asciz	"Error: Firmware size is 0!\n"

	.comm	_FPGA_CMD_READ_ID,4,2           ; @FPGA_CMD_READ_ID
l_.str.2:                               ; @.str.2
	.asciz	"FPGA JTAG ID=%08x\n"

	.comm	_ecp3_dev,8,3                   ; @ecp3_dev
l_.str.3:                               ; @.str.3
	.asciz	"Error: No supported FPGA detected (JEDEC_ID=%08x)!\n"

l_.str.4:                               ; @.str.4
	.asciz	"FPGA %s detected\n"

	.comm	_FPGA_CMD_READ_STATUS,4,2       ; @FPGA_CMD_READ_STATUS
l_.str.5:                               ; @.str.5
	.asciz	"FPGA Status=%08x\n"

	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.6:                               ; @.str.6
	.asciz	"Error: Can't allocate memory!\n"

	.comm	_FPGA_CMD_WRITE_INC,4,2         ; @FPGA_CMD_WRITE_INC
	.comm	_FPGA_CMD_REFRESH,4,2           ; @FPGA_CMD_REFRESH
	.comm	_FPGA_CMD_WRITE_EN,4,2          ; @FPGA_CMD_WRITE_EN
	.comm	_FPGA_CMD_CLEAR,4,2             ; @FPGA_CMD_CLEAR
	.comm	_FPGA_CLEAR_LOOP_COUNT,4,2      ; @FPGA_CLEAR_LOOP_COUNT
	.comm	_FPGA_STATUS_CLEARED,8,3        ; @FPGA_STATUS_CLEARED
	.comm	_FPGA_CLEAR_MSLEEP,4,2          ; @FPGA_CLEAR_MSLEEP
l_.str.7:                               ; @.str.7
	.asciz	"Error: Timeout waiting for FPGA to clear (status=%08x)!\n"

l_.str.8:                               ; @.str.8
	.asciz	"Configuring the FPGA...\n"

	.comm	_FPGA_CMD_WRITE_DIS,4,2         ; @FPGA_CMD_WRITE_DIS
	.comm	_FPGA_STATUS_DONE,8,3           ; @FPGA_STATUS_DONE
l_.str.9:                               ; @.str.9
	.asciz	"FPGA successfully configured!\n"

l_.str.10:                              ; @.str.10
	.asciz	"FPGA not configured (DONE not set)\n"

	.no_dead_strip	_firmware_load
.subsections_via_symbols
