	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function meson_nand_attach_chip
_meson_nand_attach_chip:                ## @meson_nand_attach_chip
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	callq	_nand_get_controller_data
	movq	%rax, %r13
	movq	%rbx, %rdi
	callq	_to_meson_nand
	movq	%rax, %r12
	movq	%rbx, %rdi
	callq	_nand_to_mtd
	movq	%rax, %r15
	movl	(%rax), %eax
	leal	1023(%rax), %r14d
	testl	%eax, %eax
	cmovnsl	%eax, %r14d
	cmpq	$0, 16(%r15)
	jne	LBB0_2
## %bb.1:
	movq	%r12, -56(%rbp)                 ## 8-byte Spill
	movq	%r13, %r12
	movl	(%r13), %r13d
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	%r13d, %edi
	callq	_dev_name
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx), %rcx
	movl	(%rcx), %r8d
	leaq	L_.str(%rip), %rdx
	movl	%r13d, %edi
	movq	%r12, %r13
	movl	-44(%rbp), %esi                 ## 4-byte Reload
	movl	%eax, %ecx
	callq	_devm_kasprintf
	movq	%rax, 16(%r15)
	testq	%rax, %rax
	je	LBB0_12
LBB0_2:
	sarl	$10, %r14d
	movl	(%rbx), %eax
	movq	_NAND_BBT_USE_FLASH@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_4
## %bb.3:
	movq	_NAND_BBT_NO_OOB@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, (%rbx)
LBB0_4:
	movq	_NAND_NO_SUBPAGE_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 4(%rbx)
	movq	8(%r13), %rax
	movl	(%rax), %esi
	movq	8(%r15), %rdx
	addl	%r14d, %r14d
	movslq	%r14d, %rax
	subq	%rax, %rdx
	movq	%rbx, %rdi
	callq	_nand_ecc_choose_conf
	testl	%eax, %eax
	je	LBB0_7
## %bb.5:
	movl	(%r13), %edi
	leaq	L_.str.1(%rip), %rsi
LBB0_6:
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	jmp	LBB0_13
LBB0_7:
	movq	_meson_ooblayout_ops@GOTPCREL(%rip), %rsi
	movq	%r15, %rdi
	callq	_mtd_set_ooblayout
	movq	%rbx, %rdi
	callq	_meson_nand_bch_mode
	testl	%eax, %eax
	je	LBB0_9
## %bb.8:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	jmp	LBB0_13
LBB0_9:
	movq	_NAND_ECC_HW@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 48(%rbx)
	movq	_meson_nfc_write_page_raw@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 44(%rbx)
	movq	_meson_nfc_write_page_hwecc@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 40(%rbx)
	movq	_nand_write_oob_std@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 32(%rbx)
	movq	%rax, 24(%rbx)
	movq	_meson_nfc_read_page_raw@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%rbx)
	movq	_meson_nfc_read_page_hwecc@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%rbx)
	movq	_meson_nfc_read_oob_raw@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%rbx)
	movq	_meson_nfc_read_oob@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%rbx)
	movq	_NAND_BUSWIDTH_16@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 4(%rbx)
	je	LBB0_11
## %bb.10:
	movl	(%r13), %edi
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_6
LBB0_11:
	movq	%rbx, %rdi
	callq	_meson_chip_buffer_init
	testl	%eax, %eax
	je	LBB0_15
LBB0_12:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
LBB0_13:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_14:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_15:
	xorl	%eax, %eax
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%s:nand%d"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_NAND_BBT_USE_FLASH,4,2         ## @NAND_BBT_USE_FLASH
	.comm	_NAND_BBT_NO_OOB,4,2            ## @NAND_BBT_NO_OOB
	.comm	_NAND_NO_SUBPAGE_WRITE,4,2      ## @NAND_NO_SUBPAGE_WRITE
L_.str.1:                               ## @.str.1
	.asciz	"failed to ECC init\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_meson_ooblayout_ops,4,2        ## @meson_ooblayout_ops
	.comm	_NAND_ECC_HW,4,2                ## @NAND_ECC_HW
	.comm	_meson_nfc_write_page_raw,4,2   ## @meson_nfc_write_page_raw
	.comm	_meson_nfc_write_page_hwecc,4,2 ## @meson_nfc_write_page_hwecc
	.comm	_nand_write_oob_std,8,3         ## @nand_write_oob_std
	.comm	_meson_nfc_read_page_raw,4,2    ## @meson_nfc_read_page_raw
	.comm	_meson_nfc_read_page_hwecc,4,2  ## @meson_nfc_read_page_hwecc
	.comm	_meson_nfc_read_oob_raw,4,2     ## @meson_nfc_read_oob_raw
	.comm	_meson_nfc_read_oob,4,2         ## @meson_nfc_read_oob
	.comm	_NAND_BUSWIDTH_16,4,2           ## @NAND_BUSWIDTH_16
L_.str.2:                               ## @.str.2
	.asciz	"16bits bus width not supported"

	.no_dead_strip	_meson_nand_attach_chip
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function meson_nand_attach_chip
_meson_nand_attach_chip:                ; @meson_nand_attach_chip
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x0
	bl	_nand_get_controller_data
	mov	x20, x0
	mov	x0, x19
	bl	_to_meson_nand
	mov	x22, x0
	mov	x0, x19
	bl	_nand_to_mtd
	mov	x21, x0
	ldr	w8, [x0]
	add	w9, w8, #1023
	cmp	w8, #0
	csel	w25, w9, w8, lt
	ldr	x8, [x0, #16]
	cbnz	x8, LBB0_2
; %bb.1:
	ldr	w23, [x20]
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w24, [x8]
	mov	x0, x23
	bl	_dev_name
	mov	x3, x0
	ldr	x8, [x22]
	ldr	w4, [x8]
Lloh3:
	adrp	x2, l_.str@PAGE
Lloh4:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x23
	mov	x1, x24
	bl	_devm_kasprintf
	str	x0, [x21, #16]
	cbz	x0, LBB0_14
LBB0_2:
	asr	w8, w25, #10
	ldr	w9, [x19]
Lloh5:
	adrp	x10, _NAND_BBT_USE_FLASH@GOTPAGE
Lloh6:
	ldr	x10, [x10, _NAND_BBT_USE_FLASH@GOTPAGEOFF]
Lloh7:
	ldr	w10, [x10]
	tst	w10, w9
	b.eq	LBB0_4
; %bb.3:
Lloh8:
	adrp	x10, _NAND_BBT_NO_OOB@GOTPAGE
Lloh9:
	ldr	x10, [x10, _NAND_BBT_NO_OOB@GOTPAGEOFF]
Lloh10:
	ldr	w10, [x10]
	orr	w9, w10, w9
	str	w9, [x19]
LBB0_4:
Lloh11:
	adrp	x9, _NAND_NO_SUBPAGE_WRITE@GOTPAGE
Lloh12:
	ldr	x9, [x9, _NAND_NO_SUBPAGE_WRITE@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	ldr	w10, [x19, #4]
	orr	w9, w10, w9
	str	w9, [x19, #4]
	ldr	x9, [x20, #8]
	ldr	w1, [x9]
	ldr	x9, [x21, #8]
	lsl	w8, w8, #1
	sub	x2, x9, w8, sxtw
	mov	x0, x19
	bl	_nand_ecc_choose_conf
	cbz	w0, LBB0_7
; %bb.5:
	ldr	w0, [x20]
Lloh14:
	adrp	x1, l_.str.1@PAGE
Lloh15:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_6:
	bl	_dev_err
	b	LBB0_8
LBB0_7:
Lloh16:
	adrp	x1, _meson_ooblayout_ops@GOTPAGE
Lloh17:
	ldr	x1, [x1, _meson_ooblayout_ops@GOTPAGEOFF]
	mov	x0, x21
	bl	_mtd_set_ooblayout
	mov	x0, x19
	bl	_meson_nand_bch_mode
	cbz	w0, LBB0_11
LBB0_8:
Lloh18:
	adrp	x8, _EINVAL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_10:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_11:
Lloh20:
	adrp	x8, _NAND_ECC_HW@GOTPAGE
Lloh21:
	ldr	x8, [x8, _NAND_ECC_HW@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
	str	w8, [x19, #48]
Lloh23:
	adrp	x8, _meson_nfc_write_page_raw@GOTPAGE
Lloh24:
	ldr	x8, [x8, _meson_nfc_write_page_raw@GOTPAGEOFF]
Lloh25:
	adrp	x9, _meson_nfc_write_page_hwecc@GOTPAGE
Lloh26:
	ldr	x9, [x9, _meson_nfc_write_page_hwecc@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
Lloh28:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #40]
Lloh29:
	adrp	x8, _nand_write_oob_std@GOTPAGE
Lloh30:
	ldr	x8, [x8, _nand_write_oob_std@GOTPAGEOFF]
Lloh31:
	ldr	x8, [x8]
	stp	x8, x8, [x19, #24]
Lloh32:
	adrp	x8, _meson_nfc_read_page_raw@GOTPAGE
Lloh33:
	ldr	x8, [x8, _meson_nfc_read_page_raw@GOTPAGEOFF]
Lloh34:
	ldr	w8, [x8]
Lloh35:
	adrp	x9, _meson_nfc_read_page_hwecc@GOTPAGE
Lloh36:
	ldr	x9, [x9, _meson_nfc_read_page_hwecc@GOTPAGEOFF]
Lloh37:
	ldr	w9, [x9]
Lloh38:
	adrp	x10, _meson_nfc_read_oob_raw@GOTPAGE
Lloh39:
	ldr	x10, [x10, _meson_nfc_read_oob_raw@GOTPAGEOFF]
	stp	w9, w8, [x19, #16]
Lloh40:
	ldr	w8, [x10]
Lloh41:
	adrp	x9, _meson_nfc_read_oob@GOTPAGE
Lloh42:
	ldr	x9, [x9, _meson_nfc_read_oob@GOTPAGEOFF]
Lloh43:
	ldr	w9, [x9]
	stp	w9, w8, [x19, #8]
	ldr	w8, [x19, #4]
Lloh44:
	adrp	x9, _NAND_BUSWIDTH_16@GOTPAGE
Lloh45:
	ldr	x9, [x9, _NAND_BUSWIDTH_16@GOTPAGEOFF]
Lloh46:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_13
; %bb.12:
	ldr	w0, [x20]
Lloh47:
	adrp	x1, l_.str.2@PAGE
Lloh48:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_6
LBB0_13:
	mov	x0, x19
	bl	_meson_chip_buffer_init
	cbz	w0, LBB0_10
LBB0_14:
Lloh49:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh50:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_9
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.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	Lloh25, Lloh26, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh27
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpAdd	Lloh47, Lloh48
	.loh AdrpLdrGot	Lloh49, Lloh50
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%s:nand%d"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_NAND_BBT_USE_FLASH,4,2         ; @NAND_BBT_USE_FLASH
	.comm	_NAND_BBT_NO_OOB,4,2            ; @NAND_BBT_NO_OOB
	.comm	_NAND_NO_SUBPAGE_WRITE,4,2      ; @NAND_NO_SUBPAGE_WRITE
l_.str.1:                               ; @.str.1
	.asciz	"failed to ECC init\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_meson_ooblayout_ops,4,2        ; @meson_ooblayout_ops
	.comm	_NAND_ECC_HW,4,2                ; @NAND_ECC_HW
	.comm	_meson_nfc_write_page_raw,4,2   ; @meson_nfc_write_page_raw
	.comm	_meson_nfc_write_page_hwecc,4,2 ; @meson_nfc_write_page_hwecc
	.comm	_nand_write_oob_std,8,3         ; @nand_write_oob_std
	.comm	_meson_nfc_read_page_raw,4,2    ; @meson_nfc_read_page_raw
	.comm	_meson_nfc_read_page_hwecc,4,2  ; @meson_nfc_read_page_hwecc
	.comm	_meson_nfc_read_oob_raw,4,2     ; @meson_nfc_read_oob_raw
	.comm	_meson_nfc_read_oob,4,2         ; @meson_nfc_read_oob
	.comm	_NAND_BUSWIDTH_16,4,2           ; @NAND_BUSWIDTH_16
l_.str.2:                               ; @.str.2
	.asciz	"16bits bus width not supported"

	.no_dead_strip	_meson_nand_attach_chip
.subsections_via_symbols
