	.file	"extr_if_spi.c_if_spi_prog_helper_firmware.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"failed to load helper firmware (err=%d)\n"
	.text
	.p2align 4
	.type	if_spi_prog_helper_firmware, @function
if_spi_prog_helper_firmware:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsp
	.cfi_def_cfa_register 6
	push	r15
	push	r14
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	mov	r14, rsi
	push	r13
	push	r12
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	mov	r12, rdi
	push	rbx
	sub	rsp, 40
	.cfi_offset 3, -56
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR -56[rbp], rax
	xor	eax, eax
	movsx	rax, DWORD PTR HELPER_FW_LOAD_CHUNK_SZ[rip]
	mov	rcx, rsp
	mov	r15, rax
	lea	rax, 15[0+rax*4]
	mov	rdx, rax
	and	rax, -4096
	sub	rcx, rax
	and	rdx, -16
	mov	rax, rcx
	cmp	rsp, rax
	je	.L3
.L22:
	sub	rsp, 4096
	or	QWORD PTR 4088[rsp], 0
	cmp	rsp, rax
	jne	.L22
.L3:
	and	edx, 4095
	sub	rsp, rdx
	test	rdx, rdx
	jne	.L23
.L4:
	xor	edx, edx
	mov	esi, 1
	mov	rdi, r12
	mov	r13, rsp
	call	spu_set_interrupt_mode@PLT
	mov	r8d, eax
	test	eax, eax
	jne	.L5
	mov	ebx, DWORD PTR [r14]
	mov	r14, QWORD PTR 8[r14]
	test	ebx, ebx
	jle	.L9
	mov	edx, DWORD PTR HELPER_FW_LOAD_CHUNK_SZ[rip]
	sal	r15d, 2
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L24:
	mov	edx, DWORD PTR IF_SPI_HIST_CMD_DOWNLOAD_RDY[rip]
	mov	esi, DWORD PTR IF_SPI_HOST_INT_STATUS_REG[rip]
	mov	rdi, r12
	mov	ecx, edx
	call	spu_wait_for_u16@PLT
	mov	r8d, eax
	test	eax, eax
	jne	.L5
	mov	edx, r15d
	xor	esi, esi
	mov	rdi, r13
	call	memset@PLT
	mov	esi, DWORD PTR HELPER_FW_LOAD_CHUNK_SZ[rip]
	mov	edi, ebx
	call	min@PLT
	mov	rsi, r14
	mov	rdi, r13
	mov	edx, eax
	call	memcpy@PLT
	mov	edi, 10
	call	mdelay@PLT
	mov	ecx, DWORD PTR HELPER_FW_LOAD_CHUNK_SZ[rip]
	mov	rdx, r13
	mov	rdi, r12
	mov	esi, DWORD PTR IF_SPI_CMD_RDWRPORT_REG[rip]
	call	spu_write@PLT
	mov	r8d, eax
	test	eax, eax
	jne	.L5
	mov	esi, DWORD PTR IF_SPI_HOST_INT_STATUS_REG[rip]
	xor	edx, edx
	mov	rdi, r12
	call	spu_write_u16@PLT
	mov	r8d, eax
	test	eax, eax
	jne	.L5
	mov	edx, DWORD PTR IF_SPI_CIC_CMD_DOWNLOAD_OVER[rip]
	mov	esi, DWORD PTR IF_SPI_CARD_INT_CAUSE_REG[rip]
	mov	rdi, r12
	call	spu_write_u16@PLT
	mov	r8d, eax
	test	eax, eax
	jne	.L5
	movsx	rax, DWORD PTR HELPER_FW_LOAD_CHUNK_SZ[rip]
	sub	ebx, eax
	mov	rdx, rax
	lea	r14, [r14+rax*4]
	test	ebx, ebx
	jle	.L9
.L8:
	mov	esi, DWORD PTR IF_SPI_SCRATCH_1_REG[rip]
	mov	rdi, r12
	call	spu_write_u16@PLT
	mov	r8d, eax
	test	eax, eax
	je	.L24
	.p2align 4,,10
	.p2align 3
.L5:
	mov	esi, r8d
	lea	rdi, .LC0[rip]
	mov	DWORD PTR -68[rbp], r8d
	call	pr_err@PLT
	mov	r8d, DWORD PTR -68[rbp]
.L1:
	mov	rax, QWORD PTR -56[rbp]
	xor	rax, QWORD PTR fs:40
	jne	.L25
	lea	rsp, -40[rbp]
	mov	eax, r8d
	pop	rbx
	pop	r12
	pop	r13
	pop	r14
	pop	r15
	pop	rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
	.p2align 4,,10
	.p2align 3
.L23:
	.cfi_restore_state
	or	QWORD PTR -8[rsp+rdx], 0
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L9:
	mov	edx, DWORD PTR FIRMWARE_DNLD_OK[rip]
	mov	esi, DWORD PTR IF_SPI_SCRATCH_1_REG[rip]
	mov	rdi, r12
	call	spu_write_u16@PLT
	mov	r8d, eax
	test	eax, eax
	jne	.L5
	mov	esi, DWORD PTR IF_SPI_HOST_INT_STATUS_REG[rip]
	xor	edx, edx
	mov	rdi, r12
	call	spu_write_u16@PLT
	mov	r8d, eax
	test	eax, eax
	jne	.L5
	mov	edx, DWORD PTR IF_SPI_CIC_CMD_DOWNLOAD_OVER[rip]
	mov	esi, DWORD PTR IF_SPI_CARD_INT_CAUSE_REG[rip]
	mov	rdi, r12
	call	spu_write_u16@PLT
	mov	r8d, eax
	test	eax, eax
	je	.L1
	jmp	.L5
.L25:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	if_spi_prog_helper_firmware, .-if_spi_prog_helper_firmware
	.comm	IF_SPI_SCRATCH_1_REG,4,4
	.comm	IF_SPI_HOST_INT_STATUS_REG,4,4
	.comm	IF_SPI_HIST_CMD_DOWNLOAD_RDY,4,4
	.comm	IF_SPI_CMD_RDWRPORT_REG,4,4
	.comm	IF_SPI_CIC_CMD_DOWNLOAD_OVER,4,4
	.comm	IF_SPI_CARD_INT_CAUSE_REG,4,4
	.comm	HELPER_FW_LOAD_CHUNK_SZ,4,4
	.comm	FIRMWARE_DNLD_OK,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_if_spi.c_if_spi_prog_helper_firmware.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"failed to load helper firmware (err=%d)\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	if_spi_prog_helper_firmware, %function
if_spi_prog_helper_firmware:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 1, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	add	fp, sp, #32
	sub	sp, sp, #20
	ldr	r6, .L24
	mov	r2, #0
	ldr	r9, [r6]
	mov	r8, r1
	lsl	r9, r9, #2
	add	r3, r9, #7
	bic	r3, r3, #7
	sub	sp, sp, r3
	ldr	r3, .L24+4
	mov	r1, #1
	ldr	r3, [r3]
	str	r3, [fp, #-40]
	mov	r3,#0
	mov	r4, r0
	bl	spu_set_interrupt_mode
	subs	r1, r0, #0
	bne	.L2
	ldm	r8, {r5, r8}
	cmp	r5, #0
	ble	.L21
	ldr	r3, .L24+8
	mov	r7, sp
	ldr	r2, [r6]
	ldr	r10, .L24+12
	str	r3, [fp, #-48]
	b	.L5
.L22:
	ldr	r3, [r10]
	ldr	r2, .L24+16
	mov	r0, r4
	ldr	r1, [r2]
	mov	r2, r3
	bl	spu_wait_for_u16
	subs	r1, r0, #0
	bne	.L2
	mov	r2, r9
	mov	r0, r7
	bl	memset
	ldr	r1, [r6]
	mov	r0, r5
	bl	min
	mov	r1, r8
	mov	r2, r0
	mov	r0, r7
	bl	memcpy
	mov	r0, #10
	bl	mdelay
	ldr	r1, .L24+20
	mov	r2, r7
	ldr	r1, [r1]
	mov	r0, r4
	ldr	r3, [r6]
	bl	spu_write
	subs	r1, r0, #0
	bne	.L2
	ldr	r3, .L24+16
	mov	r2, r1
	mov	r0, r4
	ldr	r1, [r3]
	bl	spu_write_u16
	subs	r1, r0, #0
	bne	.L2
	ldr	r3, .L24+24
	mov	r0, r4
	ldr	r2, [r3]
	ldr	r3, .L24+28
	ldr	r1, [r3]
	bl	spu_write_u16
	subs	r1, r0, #0
	bne	.L2
	ldr	r2, [r6]
	sub	r5, r5, r2
	cmp	r5, #0
	add	r8, r8, r2, lsl #2
	ble	.L6
.L5:
	ldr	r3, [fp, #-48]
	mov	r0, r4
	ldr	r1, [r3]
	bl	spu_write_u16
	subs	r1, r0, #0
	beq	.L22
.L2:
	ldr	r0, .L24+32
	str	r1, [fp, #-48]
	bl	pr_err
	ldr	r1, [fp, #-48]
.L1:
	ldr	r3, .L24+4
	ldr	r2, [r3]
	ldr	r3, [fp, #-40]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L23
	mov	r0, r1
	sub	sp, fp, #32
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L21:
	ldr	r3, .L24+8
	str	r3, [fp, #-48]
.L6:
	ldr	r2, [fp, #-48]
	ldr	r3, .L24+36
	ldr	r1, [r2]
	mov	r0, r4
	ldr	r2, [r3]
	bl	spu_write_u16
	subs	r1, r0, #0
	bne	.L2
	ldr	r3, .L24+16
	mov	r2, r1
	mov	r0, r4
	ldr	r1, [r3]
	bl	spu_write_u16
	subs	r1, r0, #0
	bne	.L2
	ldr	r3, .L24+28
	ldr	r2, .L24+24
	ldr	r1, [r3]
	mov	r0, r4
	ldr	r2, [r2]
	bl	spu_write_u16
	subs	r1, r0, #0
	beq	.L1
	b	.L2
.L23:
	bl	__stack_chk_fail
.L25:
	.align	2
.L24:
	.word	HELPER_FW_LOAD_CHUNK_SZ
	.word	.LC1
	.word	IF_SPI_SCRATCH_1_REG
	.word	IF_SPI_HIST_CMD_DOWNLOAD_RDY
	.word	IF_SPI_HOST_INT_STATUS_REG
	.word	IF_SPI_CMD_RDWRPORT_REG
	.word	IF_SPI_CIC_CMD_DOWNLOAD_OVER
	.word	IF_SPI_CARD_INT_CAUSE_REG
	.word	.LC0
	.word	FIRMWARE_DNLD_OK
	.size	if_spi_prog_helper_firmware, .-if_spi_prog_helper_firmware
	.comm	IF_SPI_SCRATCH_1_REG,4,4
	.comm	IF_SPI_HOST_INT_STATUS_REG,4,4
	.comm	IF_SPI_HIST_CMD_DOWNLOAD_RDY,4,4
	.comm	IF_SPI_CMD_RDWRPORT_REG,4,4
	.comm	IF_SPI_CIC_CMD_DOWNLOAD_OVER,4,4
	.comm	IF_SPI_CARD_INT_CAUSE_REG,4,4
	.comm	HELPER_FW_LOAD_CHUNK_SZ,4,4
	.comm	FIRMWARE_DNLD_OK,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
