	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_nfc_read_subpage
_mtk_nfc_read_subpage:                  ## @mtk_nfc_read_subpage
	.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	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r9d, -80(%rbp)                 ## 4-byte Spill
	movq	%r8, -72(%rbp)                  ## 8-byte Spill
	movl	%ecx, %r12d
	movl	%edx, %r14d
	movq	%rsi, %r15
	movq	%rdi, -104(%rbp)                ## 8-byte Spill
	movq	%rsi, %rdi
	callq	_nand_get_controller_data
	movq	%rax, -120(%rbp)                ## 8-byte Spill
	movq	%r15, %rdi
	callq	_to_mtk_nand
	movq	%rax, -112(%rbp)                ## 8-byte Spill
	movl	(%rax), %ebx
	movl	(%r15), %esi
	movl	%r14d, %eax
	cltd
	idivl	%esi
	movl	%eax, %r13d
	addl	%r14d, %r12d
	movl	%r12d, %edi
	callq	_DIV_ROUND_UP
	movl	%eax, %r12d
	movl	%eax, -84(%rbp)                 ## 4-byte Spill
	subl	%r13d, %r12d
	movl	(%r15), %eax
	leal	(%rax,%rbx), %edx
	imull	%r13d, %edx
	movl	%r12d, %ecx
	imull	%eax, %ecx
	imull	%r12d, %ebx
	movl	16(%rbp), %esi
	testl	%esi, %esi
	cmovel	%esi, %ebx
	addl	%ecx, %ebx
	movslq	%ebx, %r14
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movl	%r13d, -52(%rbp)                ## 4-byte Spill
	imull	%r13d, %eax
	cltq
	leaq	(%rcx,%rax,4), %rbx
	movq	%r15, %rdi
	movl	-80(%rbp), %esi                 ## 4-byte Reload
	movq	-120(%rbp), %r13                ## 8-byte Reload
	xorl	%ecx, %ecx
	xorl	%r8d, %r8d
	callq	_nand_read_page_op
	movl	4(%r13), %edi
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rsi
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	movq	%r14, %rdx
	callq	_dma_map_single
	movl	%eax, %r14d
	movl	4(%r13), %edi
	movl	%eax, %esi
	callq	_dma_mapping_error
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	4(%r13), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_20
LBB0_2:
	movl	%r12d, -48(%rbp)                ## 4-byte Spill
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	movq	%r15, -96(%rbp)                 ## 8-byte Spill
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movq	_NFI_CNFG@GOTPCREL(%rip), %rbx
	movl	(%rbx), %esi
	movq	%r13, %rdi
	callq	_nfi_readw
	movq	%r13, %r15
	movl	%eax, %r13d
	movq	_CNFG_READ_EN@GOTPCREL(%rip), %rax
	movq	_CNFG_DMA_BURST_EN@GOTPCREL(%rip), %rcx
	orl	(%rax), %r13d
	orl	(%rcx), %r13d
	movq	_CNFG_AHB@GOTPCREL(%rip), %rax
	orl	(%rax), %r13d
	cmpl	$0, 16(%rbp)
	je	LBB0_3
## %bb.5:
	movl	(%rbx), %edx
	movq	%r15, %rdi
	movl	%r13d, %esi
	callq	_nfi_writew
LBB0_6:
	movq	_CON_SEC_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	-48(%rbp), %r14d                ## 4-byte Reload
	movl	%r14d, %esi
	shll	%cl, %esi
	movq	_NFI_CON@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	movq	%r15, %rdi
	callq	_nfi_writel
	movq	_INTR_AHB_DONE_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_NFI_INTR_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_nfi_writew
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	callq	_lower_32_bits
	movq	_NFI_STRADDR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	_nfi_writel
	movq	%r15, %rbx
	addq	$16, %rbx
	movq	%rbx, %rdi
	callq	_init_completion
	movl	(%r13), %esi
	movq	%r15, %rdi
	callq	_nfi_readl
	movl	%eax, %r12d
	movq	_CON_BRD@GOTPCREL(%rip), %rax
	orl	(%rax), %r12d
	movl	(%r13), %edx
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_nfi_writel
	movq	_STAR_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_NFI_STRDATA@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_nfi_writew
	movl	$500, %edi                      ## imm = 0x1F4
	callq	_msecs_to_jiffies
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_wait_for_completion_timeout
	testl	%eax, %eax
	jne	LBB0_8
## %bb.7:
	movl	4(%r15), %edi
	leaq	L_.str.2(%rip), %rsi
	callq	_dev_warn
LBB0_8:
	movq	_NFI_BYTELEN@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	addq	8(%r15), %rbx
	movl	%r12d, %edi
	callq	_ADDRCNTR_SEC
	xorl	%edx, %edx
	cmpl	%r14d, %eax
	setge	%dl
	movq	_MTK_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %r8d
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movl	$10, %ecx
	callq	_readl_poll_timeout_atomic
	testl	%eax, %eax
	movq	-104(%rbp), %rbx                ## 8-byte Reload
	movq	-80(%rbp), %r14                 ## 8-byte Reload
	js	LBB0_15
## %bb.9:
	cmpl	$0, 16(%rbp)
	je	LBB0_11
## %bb.10:
	movl	4(%r15), %edi
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	callq	_dma_unmap_single
	xorl	%r14d, %r14d
	movq	_NFI_CON@GOTPCREL(%rip), %rbx
	jmp	LBB0_19
LBB0_3:
	movq	_CNFG_AUTO_FMT_EN@GOTPCREL(%rip), %rax
	orl	(%rax), %r13d
	movq	_CNFG_HW_ECC_EN@GOTPCREL(%rip), %rax
	orl	(%rax), %r13d
	movl	(%rbx), %edx
	movq	%r15, %rdi
	movl	%r13d, %esi
	callq	_nfi_writew
	movq	_ECC_NFI_MODE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	leaq	20(%r15), %rsi
	movl	%eax, 28(%r15)
	movl	-48(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, 20(%r15)
	movq	_ECC_DECODE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%r15)
	movl	(%r15), %edi
	callq	_mtk_ecc_enable
	testl	%eax, %eax
	je	LBB0_6
## %bb.4:
	movl	%eax, %r14d
	movl	4(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
	movq	_CNFG_AHB@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_CNFG_DMA_BURST_EN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	_CNFG_READ_EN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	_CNFG_AUTO_FMT_EN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	_CNFG_HW_ECC_EN@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	notl	%eax
	andl	%eax, %r13d
	movl	(%rbx), %edx
	movq	%r15, %rdi
	movl	%r13d, %esi
	callq	_nfi_writew
	movl	4(%r15), %edi
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movq	%r12, %rdx
	callq	_dma_unmap_single
	jmp	LBB0_20
LBB0_15:
	movl	4(%r15), %edi
	leaq	L_.str.3(%rip), %rsi
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	movl	4(%r15), %edi
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	callq	_dma_unmap_single
	cmpl	$0, 16(%rbp)
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movq	_NFI_CON@GOTPCREL(%rip), %rbx
	jne	LBB0_19
	jmp	LBB0_16
LBB0_11:
	movl	(%r15), %edi
	movq	_ECC_DECODE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_mtk_ecc_wait_done
	testl	%eax, %eax
	movq	_DMA_FROM_DEVICE@GOTPCREL(%rip), %r12
	js	LBB0_12
## %bb.13:
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	-52(%rbp), %r14d                ## 4-byte Reload
	movl	%r14d, %edx
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %ecx
	callq	_mtk_nfc_update_ecc_stats
	movl	%ebx, %edx
	movl	%r14d, %esi
	movl	%eax, %r14d
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	jmp	LBB0_14
LBB0_12:
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movl	-52(%rbp), %esi                 ## 4-byte Reload
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	movl	-48(%rbp), %edx                 ## 4-byte Reload
LBB0_14:
	callq	_mtk_nfc_read_fdm
	movl	4(%r15), %edi
	movl	(%r12), %ecx
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	callq	_dma_unmap_single
	movq	_NFI_CON@GOTPCREL(%rip), %rbx
LBB0_16:
	movq	%r14, %r12
	movq	%r15, %r14
	movl	(%r15), %edi
	callq	_mtk_ecc_disable
	movq	-112(%rbp), %r15                ## 8-byte Reload
	movq	8(%r15), %rdi
	movl	-52(%rbp), %esi                 ## 4-byte Reload
	movl	-84(%rbp), %edx                 ## 4-byte Reload
	callq	_clamp
	cmpq	8(%r15), %rax
	jne	LBB0_18
## %bb.17:
	movq	-104(%rbp), %rdi                ## 8-byte Reload
	movq	%r13, %rsi
	xorl	%edx, %edx
	callq	*16(%r15)
LBB0_18:
	movq	%r14, %r15
	movq	%r12, %r14
LBB0_19:
	movl	(%rbx), %edx
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_nfi_writel
LBB0_20:
	movl	%r14d, %eax
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DMA_FROM_DEVICE,4,2            ## @DMA_FROM_DEVICE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"dma mapping error\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_NFI_CNFG,4,2                   ## @NFI_CNFG
	.comm	_CNFG_READ_EN,4,2               ## @CNFG_READ_EN
	.comm	_CNFG_DMA_BURST_EN,4,2          ## @CNFG_DMA_BURST_EN
	.comm	_CNFG_AHB,4,2                   ## @CNFG_AHB
	.comm	_CNFG_AUTO_FMT_EN,4,2           ## @CNFG_AUTO_FMT_EN
	.comm	_CNFG_HW_ECC_EN,4,2             ## @CNFG_HW_ECC_EN
	.comm	_ECC_NFI_MODE,4,2               ## @ECC_NFI_MODE
	.comm	_ECC_DECODE,4,2                 ## @ECC_DECODE
L_.str.1:                               ## @.str.1
	.asciz	"ecc enable\n"

	.comm	_CON_SEC_SHIFT,4,2              ## @CON_SEC_SHIFT
	.comm	_NFI_CON,4,2                    ## @NFI_CON
	.comm	_INTR_AHB_DONE_EN,4,2           ## @INTR_AHB_DONE_EN
	.comm	_NFI_INTR_EN,4,2                ## @NFI_INTR_EN
	.comm	_NFI_STRADDR,4,2                ## @NFI_STRADDR
	.comm	_CON_BRD,4,2                    ## @CON_BRD
	.comm	_STAR_EN,4,2                    ## @STAR_EN
	.comm	_NFI_STRDATA,4,2                ## @NFI_STRDATA
L_.str.2:                               ## @.str.2
	.asciz	"read ahb/dma done timeout\n"

	.comm	_NFI_BYTELEN,8,3                ## @NFI_BYTELEN
	.comm	_MTK_TIMEOUT,4,2                ## @MTK_TIMEOUT
L_.str.3:                               ## @.str.3
	.asciz	"subpage done timeout\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.no_dead_strip	_mtk_nfc_read_subpage
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_nfc_read_subpage
_mtk_nfc_read_subpage:                  ; @mtk_nfc_read_subpage
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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	x27, x6
	mov	x24, x5
	mov	x25, x4
	mov	x20, x3
	mov	x21, x2
	mov	x19, x1
	str	x0, [sp, #48]                   ; 8-byte Folded Spill
	mov	x0, x1
	bl	_nand_get_controller_data
	mov	x23, x0
	mov	x0, x19
	bl	_to_mtk_nand
	mov	x28, x0
	ldr	w22, [x0]
	ldr	w1, [x19]
	add	w0, w20, w21
	sdiv	w21, w21, w1
	bl	_DIV_ROUND_UP
	mov	x20, x0
	sub	w26, w0, w21
	ldr	w8, [x19]
	add	w9, w8, w22
	mul	w2, w9, w21
	mul	w9, w26, w22
	str	w27, [sp, #60]                  ; 4-byte Folded Spill
	cmp	w27, #0
	csel	w9, wzr, w9, eq
	madd	w9, w26, w8, w9
	sxtw	x22, w9
	mul	w8, w8, w21
	add	x27, x25, w8, sxtw #2
	mov	x0, x19
	mov	x1, x24
	mov	x3, #0
	mov	w4, #0
	bl	_nand_read_page_op
	ldr	w0, [x23, #4]
Lloh0:
	adrp	x8, _DMA_FROM_DEVICE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DMA_FROM_DEVICE@GOTPAGEOFF]
Lloh2:
	ldr	w3, [x8]
	mov	x1, x27
	mov	x2, x22
	bl	_dma_map_single
	mov	x24, x0
	ldr	w0, [x23, #4]
	mov	x1, x24
	bl	_dma_mapping_error
	cbz	w0, LBB0_2
; %bb.1:
	ldr	w0, [x23, #4]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh5:
	adrp	x8, _EINVAL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_19
LBB0_2:
	stp	x19, x28, [sp, #8]              ; 16-byte Folded Spill
	stp	w26, w24, [sp, #40]             ; 8-byte Folded Spill
	stp	w20, w21, [sp, #24]             ; 8-byte Folded Spill
	str	x22, [sp, #32]                  ; 8-byte Folded Spill
Lloh8:
	adrp	x22, _NFI_CNFG@GOTPAGE
Lloh9:
	ldr	x22, [x22, _NFI_CNFG@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x23
	bl	_nfi_readw
Lloh10:
	adrp	x8, _CNFG_READ_EN@GOTPAGE
Lloh11:
	ldr	x8, [x8, _CNFG_READ_EN@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
Lloh13:
	adrp	x9, _CNFG_DMA_BURST_EN@GOTPAGE
Lloh14:
	ldr	x9, [x9, _CNFG_DMA_BURST_EN@GOTPAGEOFF]
Lloh15:
	ldr	w9, [x9]
Lloh16:
	adrp	x10, _CNFG_AHB@GOTPAGE
Lloh17:
	ldr	x10, [x10, _CNFG_AHB@GOTPAGEOFF]
Lloh18:
	ldr	w10, [x10]
	orr	w8, w8, w0
	orr	w8, w8, w9
	orr	w1, w8, w10
	ldr	w8, [sp, #60]                   ; 4-byte Folded Reload
	mov	x28, x8
	cbz	w8, LBB0_9
; %bb.3:
	ldr	w2, [x22]
	mov	x0, x23
	bl	_nfi_writew
Lloh19:
	adrp	x20, _DMA_FROM_DEVICE@GOTPAGE
Lloh20:
	ldr	x20, [x20, _DMA_FROM_DEVICE@GOTPAGEOFF]
	mov	x26, x23
	ldr	w21, [sp, #40]                  ; 4-byte Folded Reload
LBB0_4:
Lloh21:
	adrp	x8, _CON_SEC_SHIFT@GOTPAGE
Lloh22:
	ldr	x8, [x8, _CON_SEC_SHIFT@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	lsl	w1, w21, w8
Lloh24:
	adrp	x23, _NFI_CON@GOTPAGE
Lloh25:
	ldr	x23, [x23, _NFI_CON@GOTPAGEOFF]
	ldr	w2, [x23]
	mov	x0, x26
	bl	_nfi_writel
Lloh26:
	adrp	x8, _INTR_AHB_DONE_EN@GOTPAGE
Lloh27:
	ldr	x8, [x8, _INTR_AHB_DONE_EN@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
Lloh29:
	adrp	x8, _NFI_INTR_EN@GOTPAGE
Lloh30:
	ldr	x8, [x8, _NFI_INTR_EN@GOTPAGEOFF]
Lloh31:
	ldr	w2, [x8]
	mov	x0, x26
	bl	_nfi_writew
	ldr	w0, [sp, #44]                   ; 4-byte Folded Reload
	bl	_lower_32_bits
	mov	x1, x0
Lloh32:
	adrp	x8, _NFI_STRADDR@GOTPAGE
Lloh33:
	ldr	x8, [x8, _NFI_STRADDR@GOTPAGEOFF]
Lloh34:
	ldr	w2, [x8]
	mov	x0, x26
	bl	_nfi_writel
	add	x22, x26, #16
	mov	x0, x22
	bl	_init_completion
	ldr	w1, [x23]
	mov	x0, x26
	bl	_nfi_readl
Lloh35:
	adrp	x8, _CON_BRD@GOTPAGE
Lloh36:
	ldr	x8, [x8, _CON_BRD@GOTPAGEOFF]
Lloh37:
	ldr	w8, [x8]
	orr	w24, w8, w0
	ldr	w2, [x23]
	mov	x0, x26
	mov	x1, x24
	bl	_nfi_writel
Lloh38:
	adrp	x8, _STAR_EN@GOTPAGE
Lloh39:
	ldr	x8, [x8, _STAR_EN@GOTPAGEOFF]
Lloh40:
	ldr	w1, [x8]
Lloh41:
	adrp	x8, _NFI_STRDATA@GOTPAGE
Lloh42:
	ldr	x8, [x8, _NFI_STRDATA@GOTPAGEOFF]
Lloh43:
	ldr	w2, [x8]
	mov	x0, x26
	bl	_nfi_writew
	mov	w0, #500
	bl	_msecs_to_jiffies
	mov	x1, x0
	mov	x0, x22
	bl	_wait_for_completion_timeout
	cbnz	w0, LBB0_6
; %bb.5:
	ldr	w0, [x26, #4]
Lloh44:
	adrp	x1, l_.str.2@PAGE
Lloh45:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_warn
LBB0_6:
	ldr	x8, [x26, #8]
Lloh46:
	adrp	x9, _NFI_BYTELEN@GOTPAGE
Lloh47:
	ldr	x9, [x9, _NFI_BYTELEN@GOTPAGEOFF]
Lloh48:
	ldr	x9, [x9]
	add	x22, x9, x8
	mov	x0, x24
	bl	_ADDRCNTR_SEC
	cmp	w0, w21
	cset	w2, ge
Lloh49:
	adrp	x8, _MTK_TIMEOUT@GOTPAGE
Lloh50:
	ldr	x8, [x8, _MTK_TIMEOUT@GOTPAGEOFF]
Lloh51:
	ldr	w4, [x8]
	mov	x0, x22
	mov	x1, x24
	mov	w3, #10
	bl	_readl_poll_timeout_atomic
	tbnz	w0, #31, LBB0_11
; %bb.7:
	cbz	w28, LBB0_12
; %bb.8:
	ldr	w0, [x26, #4]
	ldr	w3, [x20]
	ldr	w1, [sp, #44]                   ; 4-byte Folded Reload
	ldr	x2, [sp, #32]                   ; 8-byte Folded Reload
	bl	_dma_unmap_single
	mov	w24, #0
Lloh52:
	adrp	x20, _NFI_CON@GOTPAGE
Lloh53:
	ldr	x20, [x20, _NFI_CON@GOTPAGEOFF]
	b	LBB0_18
LBB0_9:
Lloh54:
	adrp	x8, _CNFG_AUTO_FMT_EN@GOTPAGE
Lloh55:
	ldr	x8, [x8, _CNFG_AUTO_FMT_EN@GOTPAGEOFF]
Lloh56:
	ldr	w8, [x8]
Lloh57:
	adrp	x9, _CNFG_HW_ECC_EN@GOTPAGE
Lloh58:
	ldr	x9, [x9, _CNFG_HW_ECC_EN@GOTPAGEOFF]
Lloh59:
	ldr	w9, [x9]
	orr	w8, w8, w1
	orr	w1, w8, w9
	ldr	w2, [x22]
	mov	x0, x23
	mov	x19, x1
	bl	_nfi_writew
Lloh60:
	adrp	x8, _ECC_NFI_MODE@GOTPAGE
Lloh61:
	ldr	x8, [x8, _ECC_NFI_MODE@GOTPAGEOFF]
Lloh62:
	ldr	w8, [x8]
	mov	x1, x23
	mov	x26, x23
	ldr	w21, [sp, #40]                  ; 4-byte Folded Reload
	str	w21, [x1, #20]!
Lloh63:
	adrp	x9, _ECC_DECODE@GOTPAGE
Lloh64:
	ldr	x9, [x9, _ECC_DECODE@GOTPAGEOFF]
Lloh65:
	ldr	w9, [x9]
	stp	w9, w8, [x23, #24]
	ldr	w0, [x23]
	bl	_mtk_ecc_enable
Lloh66:
	adrp	x20, _DMA_FROM_DEVICE@GOTPAGE
Lloh67:
	ldr	x20, [x20, _DMA_FROM_DEVICE@GOTPAGEOFF]
	cbz	w0, LBB0_4
; %bb.10:
	mov	x24, x0
	ldr	w0, [x26, #4]
Lloh68:
	adrp	x1, l_.str.1@PAGE
Lloh69:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
Lloh70:
	adrp	x8, _CNFG_DMA_BURST_EN@GOTPAGE
Lloh71:
	ldr	x8, [x8, _CNFG_DMA_BURST_EN@GOTPAGEOFF]
Lloh72:
	ldr	w8, [x8]
Lloh73:
	adrp	x9, _CNFG_AHB@GOTPAGE
Lloh74:
	ldr	x9, [x9, _CNFG_AHB@GOTPAGEOFF]
Lloh75:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh76:
	adrp	x9, _CNFG_READ_EN@GOTPAGE
Lloh77:
	ldr	x9, [x9, _CNFG_READ_EN@GOTPAGEOFF]
Lloh78:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh79:
	adrp	x9, _CNFG_AUTO_FMT_EN@GOTPAGE
Lloh80:
	ldr	x9, [x9, _CNFG_AUTO_FMT_EN@GOTPAGEOFF]
Lloh81:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh82:
	adrp	x9, _CNFG_HW_ECC_EN@GOTPAGE
Lloh83:
	ldr	x9, [x9, _CNFG_HW_ECC_EN@GOTPAGEOFF]
Lloh84:
	ldr	w9, [x9]
	orr	w8, w8, w9
	bic	w1, w19, w8
	ldr	w2, [x22]
	mov	x0, x26
	bl	_nfi_writew
	ldr	w0, [x26, #4]
	ldr	w3, [x20]
	ldr	w1, [sp, #44]                   ; 4-byte Folded Reload
	ldr	x2, [sp, #32]                   ; 8-byte Folded Reload
	bl	_dma_unmap_single
	b	LBB0_19
LBB0_11:
	ldr	w0, [x26, #4]
Lloh85:
	adrp	x1, l_.str.3@PAGE
Lloh86:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_err
Lloh87:
	adrp	x8, _EIO@GOTPAGE
Lloh88:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh89:
	ldr	w8, [x8]
	neg	w24, w8
	ldr	w0, [x26, #4]
	ldr	w3, [x20]
	ldr	w1, [sp, #44]                   ; 4-byte Folded Reload
	ldr	x2, [sp, #32]                   ; 8-byte Folded Reload
	bl	_dma_unmap_single
	ldr	x22, [sp, #48]                  ; 8-byte Folded Reload
	ldr	w23, [sp, #28]                  ; 4-byte Folded Reload
Lloh90:
	adrp	x20, _NFI_CON@GOTPAGE
Lloh91:
	ldr	x20, [x20, _NFI_CON@GOTPAGEOFF]
	cbnz	w28, LBB0_18
	b	LBB0_16
LBB0_12:
	ldr	w0, [x26]
Lloh92:
	adrp	x8, _ECC_DECODE@GOTPAGE
Lloh93:
	ldr	x8, [x8, _ECC_DECODE@GOTPAGEOFF]
Lloh94:
	ldr	w1, [x8]
	bl	_mtk_ecc_wait_done
	tbnz	w0, #31, LBB0_14
; %bb.13:
	ldr	x22, [sp, #48]                  ; 8-byte Folded Reload
	mov	x0, x22
	mov	x1, x27
	ldr	w23, [sp, #28]                  ; 4-byte Folded Reload
	mov	x2, x23
	mov	x3, x21
	bl	_mtk_nfc_update_ecc_stats
	mov	x24, x0
	b	LBB0_15
LBB0_14:
Lloh95:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh96:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
Lloh97:
	ldr	w8, [x8]
	neg	w24, w8
	ldr	x22, [sp, #48]                  ; 8-byte Folded Reload
	ldr	w23, [sp, #28]                  ; 4-byte Folded Reload
LBB0_15:
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
	mov	x1, x23
	mov	x2, x21
	bl	_mtk_nfc_read_fdm
	ldr	w0, [x26, #4]
	ldr	w3, [x20]
	ldr	w1, [sp, #44]                   ; 4-byte Folded Reload
	ldr	x2, [sp, #32]                   ; 8-byte Folded Reload
	bl	_dma_unmap_single
Lloh98:
	adrp	x20, _NFI_CON@GOTPAGE
Lloh99:
	ldr	x20, [x20, _NFI_CON@GOTPAGEOFF]
LBB0_16:
	ldr	w0, [x26]
	bl	_mtk_ecc_disable
	ldr	x28, [sp, #16]                  ; 8-byte Folded Reload
	ldr	x0, [x28, #8]
	mov	x1, x23
	ldr	w2, [sp, #24]                   ; 4-byte Folded Reload
	bl	_clamp
	ldr	x8, [x28, #8]
	cmp	x0, x8
	b.ne	LBB0_18
; %bb.17:
	ldr	x8, [x28, #16]
	mov	x0, x22
	mov	x1, x25
	mov	w2, #0
	blr	x8
LBB0_18:
	ldr	w2, [x20]
	mov	x0, x26
	mov	w1, #0
	bl	_nfi_writel
LBB0_19:
	mov	x0, x24
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh44, Lloh45
	.loh AdrpLdrGotLdr	Lloh49, Lloh50, Lloh51
	.loh AdrpLdrGotLdr	Lloh46, Lloh47, Lloh48
	.loh AdrpLdrGot	Lloh52, Lloh53
	.loh AdrpLdrGot	Lloh66, Lloh67
	.loh AdrpLdrGotLdr	Lloh63, Lloh64, Lloh65
	.loh AdrpLdrGotLdr	Lloh60, Lloh61, Lloh62
	.loh AdrpLdrGotLdr	Lloh57, Lloh58, Lloh59
	.loh AdrpLdrGotLdr	Lloh54, Lloh55, Lloh56
	.loh AdrpLdrGotLdr	Lloh82, Lloh83, Lloh84
	.loh AdrpLdrGotLdr	Lloh79, Lloh80, Lloh81
	.loh AdrpLdrGotLdr	Lloh76, Lloh77, Lloh78
	.loh AdrpLdrGotLdr	Lloh73, Lloh74, Lloh75
	.loh AdrpLdrGotLdr	Lloh70, Lloh71, Lloh72
	.loh AdrpAdd	Lloh68, Lloh69
	.loh AdrpLdrGot	Lloh90, Lloh91
	.loh AdrpLdrGotLdr	Lloh87, Lloh88, Lloh89
	.loh AdrpAdd	Lloh85, Lloh86
	.loh AdrpLdrGotLdr	Lloh92, Lloh93, Lloh94
	.loh AdrpLdrGotLdr	Lloh95, Lloh96, Lloh97
	.loh AdrpLdrGot	Lloh98, Lloh99
	.cfi_endproc
                                        ; -- End function
	.comm	_DMA_FROM_DEVICE,4,2            ; @DMA_FROM_DEVICE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"dma mapping error\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_NFI_CNFG,4,2                   ; @NFI_CNFG
	.comm	_CNFG_READ_EN,4,2               ; @CNFG_READ_EN
	.comm	_CNFG_DMA_BURST_EN,4,2          ; @CNFG_DMA_BURST_EN
	.comm	_CNFG_AHB,4,2                   ; @CNFG_AHB
	.comm	_CNFG_AUTO_FMT_EN,4,2           ; @CNFG_AUTO_FMT_EN
	.comm	_CNFG_HW_ECC_EN,4,2             ; @CNFG_HW_ECC_EN
	.comm	_ECC_NFI_MODE,4,2               ; @ECC_NFI_MODE
	.comm	_ECC_DECODE,4,2                 ; @ECC_DECODE
l_.str.1:                               ; @.str.1
	.asciz	"ecc enable\n"

	.comm	_CON_SEC_SHIFT,4,2              ; @CON_SEC_SHIFT
	.comm	_NFI_CON,4,2                    ; @NFI_CON
	.comm	_INTR_AHB_DONE_EN,4,2           ; @INTR_AHB_DONE_EN
	.comm	_NFI_INTR_EN,4,2                ; @NFI_INTR_EN
	.comm	_NFI_STRADDR,4,2                ; @NFI_STRADDR
	.comm	_CON_BRD,4,2                    ; @CON_BRD
	.comm	_STAR_EN,4,2                    ; @STAR_EN
	.comm	_NFI_STRDATA,4,2                ; @NFI_STRDATA
l_.str.2:                               ; @.str.2
	.asciz	"read ahb/dma done timeout\n"

	.comm	_NFI_BYTELEN,8,3                ; @NFI_BYTELEN
	.comm	_MTK_TIMEOUT,4,2                ; @MTK_TIMEOUT
l_.str.3:                               ; @.str.3
	.asciz	"subpage done timeout\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.no_dead_strip	_mtk_nfc_read_subpage
.subsections_via_symbols
