	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bf5xx_nand_hw_init
_bf5xx_nand_hw_init:                    ## @bf5xx_nand_hw_init
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %r14
	movq	8(%rdi), %rbx
	movl	(%rdi), %edi
	xorl	%edx, %edx
	cmpl	$0, (%rbx)
	setne	%dl
	shll	$8, %edx
	addl	$256, %edx                      ## imm = 0x100
	xorl	%eax, %eax
	cmpl	$0, 4(%rbx)
	setne	%al
	leal	8(,%rax,8), %ecx
	movl	12(%rbx), %r8d
	movzwl	8(%rbx), %r9d
	leaq	L_.str(%rip), %rsi
	callq	_dev_info
	movq	_NFC_PG_SIZE_OFFSET@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	(%rbx), %eax
	movl	4(%rbx), %edx
	shll	%cl, %eax
	movq	_NFC_NWIDTH_OFFSET@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %edx
	orl	%eax, %edx
	movzwl	8(%rbx), %eax
	movq	_NFC_RDDLY_OFFSET@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	%eax, %esi
	shll	%cl, %esi
	movq	_NFC_WRDLY_OFFSET@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %eax
	orl	%esi, %eax
	orl	%edx, %eax
	movl	(%r14), %edi
	movzwl	%ax, %ebx
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %edx
	callq	_dev_dbg
	movl	%ebx, %edi
	callq	_bfin_write_NFC_CTL
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_SSYNC
	xorl	%edi, %edi
	callq	_bfin_write_NFC_IRQMASK
	xorl	%eax, %eax
	callq	_SSYNC
	xorl	%eax, %eax
	callq	_bfin_read_NFC_IRQSTAT
	movzwl	%ax, %edi
	callq	_bfin_write_NFC_IRQSTAT
	xorl	%eax, %eax
	callq	_SSYNC
	movq	%r14, %rdi
	callq	_bf5xx_nand_dma_init
	movq	_ENXIO@GOTPCREL(%rip), %rdx
	xorl	%ecx, %ecx
	subl	(%rdx), %ecx
	testq	%rax, %rax
	cmovel	%ebx, %ecx
	movl	%ecx, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"page_size=%d, data_width=%d, wr_dly=%d, rd_dly=%d\n"

	.comm	_NFC_PG_SIZE_OFFSET,2,1         ## @NFC_PG_SIZE_OFFSET
	.comm	_NFC_NWIDTH_OFFSET,2,1          ## @NFC_NWIDTH_OFFSET
	.comm	_NFC_RDDLY_OFFSET,2,1           ## @NFC_RDDLY_OFFSET
	.comm	_NFC_WRDLY_OFFSET,2,1           ## @NFC_WRDLY_OFFSET
L_.str.1:                               ## @.str.1
	.asciz	"NFC_CTL is 0x%04x\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.no_dead_strip	_bf5xx_nand_hw_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bf5xx_nand_hw_init
_bf5xx_nand_hw_init:                    ; @bf5xx_nand_hw_init
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldr	x20, [x0, #8]
	ldr	w0, [x0]
	mov	w8, #512
	mov	w9, #256
	ldp	w10, w11, [x20]
	cmp	w10, #0
	csel	w2, w9, w8, eq
	mov	w8, #16
	mov	w9, #8
	cmp	w11, #0
	csel	w3, w9, w8, eq
	ldr	w4, [x20, #12]
	ldrh	w5, [x20, #8]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_info
Lloh2:
	adrp	x8, _NFC_PG_SIZE_OFFSET@GOTPAGE
Lloh3:
	ldr	x8, [x8, _NFC_PG_SIZE_OFFSET@GOTPAGEOFF]
	ldrh	w8, [x8]
	ldp	w9, w10, [x20]
	lsl	w8, w9, w8
Lloh4:
	adrp	x9, _NFC_NWIDTH_OFFSET@GOTPAGE
Lloh5:
	ldr	x9, [x9, _NFC_NWIDTH_OFFSET@GOTPAGEOFF]
	ldrh	w9, [x9]
	lsl	w9, w10, w9
	orr	w8, w9, w8
	ldrh	w9, [x20, #8]
Lloh6:
	adrp	x10, _NFC_RDDLY_OFFSET@GOTPAGE
Lloh7:
	ldr	x10, [x10, _NFC_RDDLY_OFFSET@GOTPAGEOFF]
	ldrh	w10, [x10]
	lsl	w10, w9, w10
Lloh8:
	adrp	x11, _NFC_WRDLY_OFFSET@GOTPAGE
Lloh9:
	ldr	x11, [x11, _NFC_WRDLY_OFFSET@GOTPAGEOFF]
	orr	w8, w8, w10
	ldrh	w10, [x11]
	lsl	w9, w9, w10
	orr	w8, w8, w9
	ldr	w0, [x19]
	and	w20, w8, #0xffff
Lloh10:
	adrp	x1, l_.str.1@PAGE
Lloh11:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x20
	bl	_dev_dbg
	mov	x0, x20
	bl	_bfin_write_NFC_CTL
	bl	_SSYNC
	mov	w0, #0
	bl	_bfin_write_NFC_IRQMASK
	bl	_SSYNC
	bl	_bfin_read_NFC_IRQSTAT
	bl	_bfin_write_NFC_IRQSTAT
	bl	_SSYNC
	mov	x0, x19
	bl	_bf5xx_nand_dma_init
Lloh12:
	adrp	x8, _ENXIO@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	cmp	x0, #0
	csneg	w0, wzr, w8, eq
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"page_size=%d, data_width=%d, wr_dly=%d, rd_dly=%d\n"

	.comm	_NFC_PG_SIZE_OFFSET,2,1         ; @NFC_PG_SIZE_OFFSET
	.comm	_NFC_NWIDTH_OFFSET,2,1          ; @NFC_NWIDTH_OFFSET
	.comm	_NFC_RDDLY_OFFSET,2,1           ; @NFC_RDDLY_OFFSET
	.comm	_NFC_WRDLY_OFFSET,2,1           ; @NFC_WRDLY_OFFSET
l_.str.1:                               ; @.str.1
	.asciz	"NFC_CTL is 0x%04x\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.no_dead_strip	_bf5xx_nand_hw_init
.subsections_via_symbols
