	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bf5xx_nand_dma_rw
_bf5xx_nand_dma_rw:                     ## @bf5xx_nand_dma_rw
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %r12d
	movq	%rsi, %r15
	movq	%rdi, %r13
	callq	_mtd_to_nand_info
	movq	%rax, %r14
	movq	8(%rax), %rax
	xorl	%ebx, %ebx
	cmpw	$0, (%rax)
	setne	%bl
	movl	4(%r14), %edi
	leaq	L_.str(%rip), %rsi
	movq	%r13, %rdx
	movq	%r15, %rcx
	movl	%r12d, %r8d
	callq	_dev_dbg
	shll	$10, %ebx
	leal	(%rbx,%r15), %esi
	addl	$1024, %esi                     ## imm = 0x400
	movl	%r15d, %edi
	testl	%r12d, %r12d
	je	LBB0_2
## %bb.1:
	callq	_invalidate_dcache_range
	jmp	LBB0_3
LBB0_2:
	callq	_flush_dcache_range
LBB0_3:
	movl	$1, %edi
	callq	_bfin_write_NFC_RST
	xorl	%eax, %eax
	callq	_SSYNC
	movq	_CH_NFC@GOTPCREL(%rip), %rbx
	movl	(%rbx), %edi
	callq	_disable_dma
	movl	(%rbx), %edi
	callq	_clear_dma_irqstat
	movl	(%rbx), %edi
	xorl	%esi, %esi
	callq	_set_dma_config
	movl	(%rbx), %edi
	movq	%r15, %rsi
	callq	_set_dma_start_addr
	movq	_WNR@GOTPCREL(%rip), %rax
	movzwl	(%rax), %esi
	movl	(%rbx), %edi
	callq	_set_dma_config
	movl	(%rbx), %edi
	callq	_enable_dma
	movl	$1, %edi
	callq	_bfin_write_NFC_PGCTL
	movq	%r14, %rdi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_wait_for_completion            ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	" mtd->%p, buf->%p, is_read %d\n"

	.comm	_CH_NFC,4,2                     ## @CH_NFC
	.comm	_WNR,2,1                        ## @WNR
	.comm	_DI_EN,2,1                      ## @DI_EN
	.comm	_WDSIZE_16,2,1                  ## @WDSIZE_16
	.comm	_WDSIZE_32,2,1                  ## @WDSIZE_32
	.no_dead_strip	_bf5xx_nand_dma_rw
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bf5xx_nand_dma_rw
_bf5xx_nand_dma_rw:                     ; @bf5xx_nand_dma_rw
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x21, x2
	mov	x20, x1
	mov	x22, x0
	bl	_mtd_to_nand_info
	mov	x19, x0
	ldr	x8, [x0, #8]
	ldrh	w23, [x8]
	ldr	w0, [x0, #4]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x22
	mov	x3, x20
	mov	x4, x21
	bl	_dev_dbg
	cmp	w23, #0
	mov	w8, #2048
	mov	w9, #1024
	csel	x8, x9, x8, eq
	add	w1, w20, w8
	mov	x0, x20
	cbz	w21, LBB0_2
; %bb.1:
	bl	_invalidate_dcache_range
	b	LBB0_3
LBB0_2:
	bl	_flush_dcache_range
LBB0_3:
	mov	w0, #1
	bl	_bfin_write_NFC_RST
	bl	_SSYNC
Lloh2:
	adrp	x21, _CH_NFC@GOTPAGE
Lloh3:
	ldr	x21, [x21, _CH_NFC@GOTPAGEOFF]
	ldr	w0, [x21]
	bl	_disable_dma
	ldr	w0, [x21]
	bl	_clear_dma_irqstat
	ldr	w0, [x21]
	mov	w1, #0
	bl	_set_dma_config
	ldr	w0, [x21]
	mov	x1, x20
	bl	_set_dma_start_addr
Lloh4:
	adrp	x8, _WNR@GOTPAGE
Lloh5:
	ldr	x8, [x8, _WNR@GOTPAGEOFF]
	ldrh	w1, [x8]
	ldr	w0, [x21]
	bl	_set_dma_config
	ldr	w0, [x21]
	bl	_enable_dma
	mov	w0, #1
	bl	_bfin_write_NFC_PGCTL
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	b	_wait_for_completion
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	" mtd->%p, buf->%p, is_read %d\n"

	.comm	_CH_NFC,4,2                     ; @CH_NFC
	.comm	_WNR,2,1                        ; @WNR
	.comm	_DI_EN,2,1                      ; @DI_EN
	.comm	_WDSIZE_16,2,1                  ; @WDSIZE_16
	.comm	_WDSIZE_32,2,1                  ; @WDSIZE_32
	.no_dead_strip	_bf5xx_nand_dma_rw
.subsections_via_symbols
