	.file	"extr_bf5xx_nand.c_bf5xx_nand_hw_init.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"page_size=%d, data_width=%d, wr_dly=%d, rd_dly=%d\n"
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"NFC_CTL is 0x%04x\n"
	.text
	.p2align 4
	.type	bf5xx_nand_hw_init, @function
bf5xx_nand_hw_init:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	mov	r12, rdi
	lea	rsi, .LC0[rip]
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	mov	rbx, QWORD PTR 8[rdi]
	mov	edi, DWORD PTR [rdi]
	cmp	DWORD PTR 4[rbx], 1
	mov	r8d, DWORD PTR 12[rbx]
	sbb	ecx, ecx
	movzx	r9d, WORD PTR 8[rbx]
	and	ecx, -8
	add	ecx, 16
	cmp	DWORD PTR [rbx], 1
	sbb	edx, edx
	xor	dl, dl
	add	edx, 512
	call	dev_info@PLT
	movzx	ecx, WORD PTR NFC_PG_SIZE_OFFSET[rip]
	mov	ebp, DWORD PTR [rbx]
	lea	rsi, .LC1[rip]
	mov	edx, DWORD PTR 4[rbx]
	movzx	eax, WORD PTR 8[rbx]
	sal	ebp, cl
	movzx	ecx, WORD PTR NFC_NWIDTH_OFFSET[rip]
	mov	edi, DWORD PTR [r12]
	sal	edx, cl
	movzx	ecx, WORD PTR NFC_RDDLY_OFFSET[rip]
	or	ebp, edx
	mov	edx, eax
	sal	edx, cl
	movzx	ecx, WORD PTR NFC_WRDLY_OFFSET[rip]
	or	ebp, edx
	sal	eax, cl
	or	ebp, eax
	movzx	ebp, bp
	mov	edx, ebp
	call	dev_dbg@PLT
	mov	edi, ebp
	call	bfin_write_NFC_CTL@PLT
	xor	eax, eax
	call	SSYNC@PLT
	xor	edi, edi
	call	bfin_write_NFC_IRQMASK@PLT
	xor	eax, eax
	call	SSYNC@PLT
	xor	eax, eax
	call	bfin_read_NFC_IRQSTAT@PLT
	movzx	edi, ax
	call	bfin_write_NFC_IRQSTAT@PLT
	xor	eax, eax
	call	SSYNC@PLT
	mov	rdi, r12
	call	bf5xx_nand_dma_init@PLT
	mov	r8, rax
	xor	eax, eax
	test	r8, r8
	je	.L1
	mov	eax, DWORD PTR ENXIO[rip]
	neg	eax
.L1:
	pop	rbx
	.cfi_def_cfa_offset 24
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	bf5xx_nand_hw_init, .-bf5xx_nand_hw_init
	.comm	NFC_WRDLY_OFFSET,2,2
	.comm	NFC_RDDLY_OFFSET,2,2
	.comm	NFC_PG_SIZE_OFFSET,2,2
	.comm	NFC_NWIDTH_OFFSET,2,2
	.comm	ENXIO,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_bf5xx_nand.c_bf5xx_nand_hw_init.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"page_size=%d, data_width=%d, wr_dly=%d, rd_dly=%d\012"
	.ascii	"\000"
	.align	2
.LC1:
	.ascii	"NFC_CTL is 0x%04x\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	bf5xx_nand_hw_init, %function
bf5xx_nand_hw_init:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	mov	r6, r0
	ldm	r0, {r0, r5}
	ldrh	r3, [r5, #8]
	sub	sp, sp, #8
	ldr	r2, [r5]
	ldr	r1, [r5, #4]
	str	r3, [sp, #4]
	ldr	r3, [r5, #12]
	cmp	r2, #0
	movne	r2, #512
	moveq	r2, #256
	cmp	r1, #0
	str	r3, [sp]
	ldr	r1, .L12
	movne	r3, #16
	moveq	r3, #8
	bl	dev_info
	ldr	r3, .L12+4
	ldr	r4, [r5, #4]
	ldrh	r3, [r3]
	ldr	r2, .L12+8
	ldr	r1, .L12+12
	ldr	ip, [r5]
	ldrh	r0, [r2]
	lsl	r4, r4, r3
	ldr	r3, .L12+16
	ldrh	r2, [r5, #8]
	ldrh	r1, [r1]
	ldrh	r3, [r3]
	orr	r4, r4, ip, lsl r0
	orr	r4, r4, r2, lsl r1
	orr	r4, r4, r2, lsl r3
	lsl	r4, r4, #16
	lsr	r4, r4, #16
	mov	r2, r4
	ldr	r1, .L12+20
	ldr	r0, [r6]
	bl	dev_dbg
	mov	r0, r4
	bl	bfin_write_NFC_CTL
	bl	SSYNC
	mov	r0, #0
	bl	bfin_write_NFC_IRQMASK
	bl	SSYNC
	bl	bfin_read_NFC_IRQSTAT
	bl	bfin_write_NFC_IRQSTAT
	bl	SSYNC
	mov	r0, r6
	bl	bf5xx_nand_dma_init
	cmp	r0, #0
	ldrne	r3, .L12+24
	ldrne	r0, [r3]
	rsbne	r0, r0, #0
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, pc}
.L13:
	.align	2
.L12:
	.word	.LC0
	.word	NFC_NWIDTH_OFFSET
	.word	NFC_PG_SIZE_OFFSET
	.word	NFC_RDDLY_OFFSET
	.word	NFC_WRDLY_OFFSET
	.word	.LC1
	.word	ENXIO
	.size	bf5xx_nand_hw_init, .-bf5xx_nand_hw_init
	.comm	NFC_WRDLY_OFFSET,2,2
	.comm	NFC_RDDLY_OFFSET,2,2
	.comm	NFC_PG_SIZE_OFFSET,2,2
	.comm	NFC_NWIDTH_OFFSET,2,2
	.comm	ENXIO,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
