	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mtk_nfc_setup_data_interface
_mtk_nfc_setup_data_interface:          ## @mtk_nfc_setup_data_interface
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %rbx
	movl	%esi, %r15d
	callq	_nand_get_controller_data
	movq	%rax, %r13
	movq	%rbx, %rdi
	callq	_nand_get_sdr_timings
	movq	%rax, %r12
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	_ENOTSUPP@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
	jmp	LBB0_9
LBB0_2:
	movq	_NAND_DATA_IFACE_CHECK_ONLY@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	cmpl	%r15d, (%rax)
	je	LBB0_9
## %bb.3:
	movl	8(%r13), %edi
	callq	_clk_get_rate
	movq	%r13, -48(%rbp)                 ## 8-byte Spill
	movq	(%r13), %rcx
	cltd
	idivl	(%rcx)
	cltq
	imulq	$274877907, %rax, %rbx          ## imm = 0x10624DD3
	movq	%rbx, %rax
	shrq	$63, %rax
	shrq	$32, %rbx
	sarl	$6, %ebx
	addl	%eax, %ebx
	movl	(%r12), %edi
	movl	4(%r12), %esi
	callq	_max
	cltq
	imulq	$274877907, %rax, %rdi          ## imm = 0x10624DD3
	movq	%rdi, %rax
	shrq	$63, %rax
	shrq	$32, %rdi
	sarl	$6, %edi
	addl	%eax, %edi
	imull	%ebx, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$1000000, %esi                  ## imm = 0xF4240
	callq	_DIV_ROUND_UP
	andl	$15, %eax
	movl	%eax, -68(%rbp)                 ## 4-byte Spill
	movl	8(%r12), %edi
	movl	12(%r12), %esi
	callq	_max
	cltq
	imulq	$274877907, %rax, %rdi          ## imm = 0x10624DD3
	movq	%rdi, %rax
	shrq	$63, %rax
	shrq	$32, %rdi
	sarl	$6, %edi
	addl	%eax, %edi
	imull	%ebx, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$1000000, %esi                  ## imm = 0xF4240
	callq	_DIV_ROUND_UP
	andl	$63, %eax
	movl	%eax, -64(%rbp)                 ## 4-byte Spill
	movslq	16(%r12), %rax
	imulq	$274877907, %rax, %rdi          ## imm = 0x10624DD3
	movq	%rdi, %rax
	shrq	$63, %rax
	shrq	$32, %rdi
	sarl	$6, %edi
	addl	%eax, %edi
	imull	%ebx, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$1000000, %esi                  ## imm = 0xF4240
	callq	_DIV_ROUND_UP
                                        ## kill: def $eax killed $eax def $rax
	leal	-1(%rax), %edi
	movl	$2, %esi
	callq	_DIV_ROUND_UP
	andl	$15, %eax
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movl	20(%r12), %edi
	movl	24(%r12), %esi
	callq	_max
	cltq
	imulq	$274877907, %rax, %rdi          ## imm = 0x10624DD3
	movq	%rdi, %rax
	shrq	$63, %rax
	shrq	$32, %rdi
	sarl	$6, %edi
	addl	%eax, %edi
	imull	%ebx, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$1000000, %esi                  ## imm = 0xF4240
	callq	_DIV_ROUND_UP
	decl	%eax
	andl	$15, %eax
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	imull	$1000000, %eax, %eax            ## imm = 0xF4240
	addl	$1000000, %eax                  ## imm = 0xF4240
	xorl	%r14d, %r14d
	xorl	%edx, %edx
	idivl	%ebx
	imull	$1000, %eax, %r15d              ## imm = 0x3E8
	movl	28(%r12), %esi
	movl	32(%r12), %edi
	subl	%r15d, %esi
	cmovlel	%r14d, %esi
	callq	_max
	cltq
	imulq	$274877907, %rax, %rdi          ## imm = 0x10624DD3
	movq	%rdi, %rax
	shrq	$63, %rax
	shrq	$32, %rdi
	sarl	$6, %edi
	addl	%eax, %edi
	imull	%ebx, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$1000000, %esi                  ## imm = 0xF4240
	callq	_DIV_ROUND_UP
	decl	%eax
	andl	$15, %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movl	36(%r12), %edi
	movl	40(%r12), %esi
	subl	%r15d, %edi
	cmovlel	%r14d, %edi
	callq	_max
	cltq
	imulq	$274877907, %rax, %rdi          ## imm = 0x10624DD3
	movq	%rdi, %rax
	shrq	$63, %rax
	shrq	$32, %rdi
	sarl	$6, %edi
	addl	%eax, %edi
	imull	%ebx, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$1000000, %esi                  ## imm = 0xF4240
	callq	_DIV_ROUND_UP
	movl	%eax, %r15d
	decl	%r15d
	andl	$15, %r15d
	leal	1(%r15), %r13d
	imull	$1000000, %r13d, %eax           ## imm = 0xF4240
	xorl	%edx, %edx
	idivl	%ebx
	imull	$1000, %eax, %ecx               ## imm = 0x3E8
	movl	44(%r12), %eax
	cmpl	%eax, %ecx
	jge	LBB0_4
## %bb.5:
	cltq
	imulq	$274877907, %rax, %rdi          ## imm = 0x10624DD3
	movq	%rdi, %rax
	shrq	$63, %rax
	sarq	$38, %rdi
	addl	%eax, %edi
	imull	%ebx, %edi
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$1000000, %esi                  ## imm = 0xF4240
	callq	_DIV_ROUND_UP
	subl	%r13d, %eax
	movq	_MAX_STROBE_DLY@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	cmpl	%ebx, %eax
	jle	LBB0_6
## %bb.7:
	subl	%ebx, %r15d
	addl	%eax, %r15d
	jmp	LBB0_8
LBB0_4:
	xorl	%ebx, %ebx
	jmp	LBB0_8
LBB0_6:
	movl	%eax, %ebx
LBB0_8:
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	movq	_NFI_DEBUG_CON1@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	movq	%r13, %rdi
	callq	_nfi_readl
	movq	_STROBE_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movq	_STROBE_MASK@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	shll	%cl, %ebx
	notl	%edx
	andl	%eax, %edx
	orl	%edx, %ebx
	movl	(%r12), %edx
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_nfi_writel
	movl	%r15d, (%rsp)
	movl	-68(%rbp), %edi                 ## 4-byte Reload
	movl	-64(%rbp), %esi                 ## 4-byte Reload
	xorl	%edx, %edx
	movl	-60(%rbp), %ecx                 ## 4-byte Reload
	movl	-56(%rbp), %r8d                 ## 4-byte Reload
	movl	-52(%rbp), %r9d                 ## 4-byte Reload
	callq	_ACCTIMING
	movq	_NFI_ACCCON@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_nfi_writel
LBB0_9:
	movl	%r14d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENOTSUPP,4,2                   ## @ENOTSUPP
	.comm	_NAND_DATA_IFACE_CHECK_ONLY,4,2 ## @NAND_DATA_IFACE_CHECK_ONLY
	.comm	_MAX_STROBE_DLY,4,2             ## @MAX_STROBE_DLY
	.comm	_NFI_DEBUG_CON1,4,2             ## @NFI_DEBUG_CON1
	.comm	_STROBE_MASK,4,2                ## @STROBE_MASK
	.comm	_STROBE_SHIFT,4,2               ## @STROBE_SHIFT
	.comm	_NFI_ACCCON,4,2                 ## @NFI_ACCCON
	.no_dead_strip	_mtk_nfc_setup_data_interface
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mtk_nfc_setup_data_interface
_mtk_nfc_setup_data_interface:          ; @mtk_nfc_setup_data_interface
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x21, x2
	mov	x20, x1
	bl	_nand_get_controller_data
	mov	x19, x0
	mov	x0, x21
	bl	_nand_get_sdr_timings
	mov	x21, x0
	bl	_IS_ERR
	cbz	x0, LBB0_2
; %bb.1:
Lloh0:
	adrp	x8, _ENOTSUPP@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ENOTSUPP@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_9
LBB0_2:
Lloh3:
	adrp	x8, _NAND_DATA_IFACE_CHECK_ONLY@GOTPAGE
Lloh4:
	ldr	x8, [x8, _NAND_DATA_IFACE_CHECK_ONLY@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w8, w20
	b.eq	LBB0_8
; %bb.3:
	mov	w20, #16960
	movk	w20, #15, lsl #16
	ldr	w0, [x19, #8]
	bl	_clk_get_rate
	ldr	x8, [x19]
	ldr	w8, [x8]
	sdiv	w8, w0, w8
	mov	w27, #19923
	movk	w27, #4194, lsl #16
	smull	x8, w8, w27
	lsr	x9, x8, #32
	lsr	x8, x8, #63
	add	w28, w8, w9, asr #6
	ldp	w0, w1, [x21]
	bl	_max
	smull	x8, w0, w27
	lsr	x9, x8, #32
	lsr	x8, x8, #63
	add	w8, w8, w9, asr #6
	mul	w0, w8, w28
	mov	w1, #16960
	movk	w1, #15, lsl #16
	bl	_DIV_ROUND_UP
	and	w8, w0, #0xf
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
	ldp	w0, w1, [x21, #8]
	bl	_max
	smull	x8, w0, w27
	lsr	x9, x8, #32
	lsr	x8, x8, #63
	add	w8, w8, w9, asr #6
	mul	w0, w8, w28
	mov	w1, #16960
	movk	w1, #15, lsl #16
	bl	_DIV_ROUND_UP
	and	w8, w0, #0x3f
	str	w8, [sp, #8]                    ; 4-byte Folded Spill
	ldrsw	x8, [x21, #16]
	mul	x8, x8, x27
	lsr	x9, x8, #32
	lsr	x8, x8, #63
	add	w8, w8, w9, asr #6
	mul	w0, w8, w28
	mov	w1, #16960
	movk	w1, #15, lsl #16
	bl	_DIV_ROUND_UP
	sub	w0, w0, #1
	mov	w1, #2
	bl	_DIV_ROUND_UP
	and	w8, w0, #0xf
	str	w8, [sp, #4]                    ; 4-byte Folded Spill
	ldp	w0, w1, [x21, #20]
	bl	_max
	smull	x8, w0, w27
	lsr	x9, x8, #32
	lsr	x8, x8, #63
	add	w8, w8, w9, asr #6
	mul	w0, w8, w28
	mov	w1, #16960
	movk	w1, #15, lsl #16
	bl	_DIV_ROUND_UP
	sub	w8, w0, #1
	and	w24, w8, #0xf
	madd	w8, w24, w20, w20
	sdiv	w8, w8, w28
	mov	w23, #1000
	mul	w20, w8, w23
	ldp	w8, w0, [x21, #28]
	subs	w8, w8, w20
	csel	w1, w8, wzr, gt
	bl	_max
	smull	x8, w0, w27
	lsr	x9, x8, #32
	lsr	x8, x8, #63
	add	w8, w8, w9, asr #6
	mul	w0, w8, w28
	mov	w1, #16960
	movk	w1, #15, lsl #16
	bl	_DIV_ROUND_UP
	sub	w8, w0, #1
	and	w25, w8, #0xf
	ldp	w8, w1, [x21, #36]
	subs	w8, w8, w20
	csel	w0, w8, wzr, gt
	bl	_max
	smull	x8, w0, w27
	lsr	x9, x8, #32
	lsr	x8, x8, #63
	add	w8, w8, w9, asr #6
	mul	w0, w8, w28
	mov	w1, #16960
	movk	w1, #15, lsl #16
	bl	_DIV_ROUND_UP
	sub	w8, w0, #1
	and	w26, w8, #0xf
	add	w22, w26, #1
	mov	w8, #16960
	movk	w8, #15, lsl #16
	mul	w8, w22, w8
	sdiv	w8, w8, w28
	mul	w9, w8, w23
	ldr	w8, [x21, #44]
	cmp	w9, w8
	b.ge	LBB0_6
; %bb.4:
	smull	x8, w8, w27
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w8, w8, w9
	mul	w0, w8, w28
	mov	w1, #16960
	movk	w1, #15, lsl #16
	bl	_DIV_ROUND_UP
Lloh6:
	adrp	x8, _MAX_STROBE_DLY@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MAX_STROBE_DLY@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	sub	w20, w0, w22
	cmp	w20, w8
	ldp	w23, w22, [sp, #8]              ; 8-byte Folded Reload
	ldr	w27, [sp, #4]                   ; 4-byte Folded Reload
	b.le	LBB0_7
; %bb.5:
	sub	w9, w26, w8
	add	w26, w9, w20
	mov	x20, x8
	b	LBB0_7
LBB0_6:
	mov	w20, #0
	ldp	w23, w22, [sp, #8]              ; 8-byte Folded Reload
	ldr	w27, [sp, #4]                   ; 4-byte Folded Reload
LBB0_7:
Lloh9:
	adrp	x21, _NFI_DEBUG_CON1@GOTPAGE
Lloh10:
	ldr	x21, [x21, _NFI_DEBUG_CON1@GOTPAGEOFF]
	ldr	w1, [x21]
	mov	x0, x19
	bl	_nfi_readl
Lloh11:
	adrp	x8, _STROBE_MASK@GOTPAGE
Lloh12:
	ldr	x8, [x8, _STROBE_MASK@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	bic	w8, w0, w8
Lloh14:
	adrp	x9, _STROBE_SHIFT@GOTPAGE
Lloh15:
	ldr	x9, [x9, _STROBE_SHIFT@GOTPAGEOFF]
Lloh16:
	ldr	w9, [x9]
	lsl	w9, w20, w9
	orr	w1, w9, w8
	ldr	w2, [x21]
	mov	x0, x19
	bl	_nfi_writel
	mov	x0, x22
	mov	x1, x23
	mov	w2, #0
	mov	x3, x27
	mov	x4, x24
	mov	x5, x25
	mov	x6, x26
	bl	_ACCTIMING
	mov	x1, x0
Lloh17:
	adrp	x8, _NFI_ACCCON@GOTPAGE
Lloh18:
	ldr	x8, [x8, _NFI_ACCCON@GOTPAGEOFF]
Lloh19:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_nfi_writel
LBB0_8:
	mov	w0, #0
LBB0_9:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_ENOTSUPP,4,2                   ; @ENOTSUPP
	.comm	_NAND_DATA_IFACE_CHECK_ONLY,4,2 ; @NAND_DATA_IFACE_CHECK_ONLY
	.comm	_MAX_STROBE_DLY,4,2             ; @MAX_STROBE_DLY
	.comm	_NFI_DEBUG_CON1,4,2             ; @NFI_DEBUG_CON1
	.comm	_STROBE_MASK,4,2                ; @STROBE_MASK
	.comm	_STROBE_SHIFT,4,2               ; @STROBE_SHIFT
	.comm	_NFI_ACCCON,4,2                 ; @NFI_ACCCON
	.no_dead_strip	_mtk_nfc_setup_data_interface
.subsections_via_symbols
