	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function fsmc_nand_attach_chip
_fsmc_nand_attach_chip:                 ## @fsmc_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	callq	_nand_to_mtd
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_nand_to_fsmc
	movq	%rax, %r15
	movl	4(%rax), %edi
	callq	_AMBA_REV_BITS
	cmpl	$8, %eax
	jl	LBB0_10
## %bb.1:
	movl	(%r14), %edx
	cmpl	$127, %edx
	jle	LBB0_2
## %bb.6:
	cmpl	$128, %edx
	je	LBB0_9
## %bb.7:
	cmpl	$224, %edx
	je	LBB0_9
## %bb.8:
	cmpl	$256, %edx                      ## imm = 0x100
	je	LBB0_9
	jmp	LBB0_4
LBB0_10:
	movl	(%rbx), %eax
	xorl	%r12d, %r12d
	cmpl	$128, %eax
	je	LBB0_14
## %bb.11:
	cmpl	$129, %eax
	je	LBB0_21
## %bb.12:
	cmpl	$130, %eax
	jne	LBB0_22
## %bb.13:
	movl	(%r15), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_info
	movq	_fsmc_read_hwecc_ecc1@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%rbx)
	movq	_nand_correct_data@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%rbx)
	movabsq	$4294967299, %rax               ## imm = 0x100000003
	movq	%rax, 4(%rbx)
	movq	_NAND_ECC_SOFT_HAMMING_SM_ORDER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, 16(%rbx)
	jmp	LBB0_16
LBB0_2:
	cmpl	$16, %edx
	je	LBB0_9
## %bb.3:
	cmpl	$64, %edx
	jne	LBB0_4
LBB0_9:
	movq	_fsmc_ecc4_ooblayout_ops@GOTPCREL(%rip), %rsi
	movq	%r14, %rdi
	callq	_mtd_set_ooblayout
	xorl	%r12d, %r12d
	jmp	LBB0_21
LBB0_14:
	movl	12(%rbx), %eax
	movq	_NAND_ECC_BCH@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_16
## %bb.15:
	movl	(%r15), %edi
	leaq	L_.str.2(%rip), %rsi
	callq	_dev_info
LBB0_16:
	cmpl	$130, (%rbx)
	jne	LBB0_21
## %bb.17:
	movl	(%r14), %edx
	cmpl	$16, %edx
	je	LBB0_20
## %bb.18:
	cmpl	$128, %edx
	je	LBB0_20
## %bb.19:
	cmpl	$64, %edx
	jne	LBB0_4
LBB0_20:
	movq	_fsmc_ecc1_ooblayout_ops@GOTPCREL(%rip), %rsi
	movq	%r14, %rdi
	callq	_mtd_set_ooblayout
	jmp	LBB0_21
LBB0_22:
	movl	(%r15), %edi
	leaq	L_.str.3(%rip), %rsi
	callq	_dev_err
	movq	_ENOTSUPP@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_4:
	movl	(%r15), %edi
	leaq	L_.str(%rip), %rsi
	callq	_dev_warn
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_5:
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
LBB0_21:
	movl	%r12d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"No oob scheme defined for oobsize %d\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_fsmc_ecc4_ooblayout_ops,4,2    ## @fsmc_ecc4_ooblayout_ops
L_.str.1:                               ## @.str.1
	.asciz	"Using 1-bit HW ECC scheme\n"

	.comm	_fsmc_read_hwecc_ecc1,4,2       ## @fsmc_read_hwecc_ecc1
	.comm	_nand_correct_data,4,2          ## @nand_correct_data
	.comm	_NAND_ECC_SOFT_HAMMING_SM_ORDER,4,2 ## @NAND_ECC_SOFT_HAMMING_SM_ORDER
	.comm	_NAND_ECC_BCH,4,2               ## @NAND_ECC_BCH
L_.str.2:                               ## @.str.2
	.asciz	"Using 4-bit SW BCH ECC scheme\n"

L_.str.3:                               ## @.str.3
	.asciz	"Unsupported ECC mode!\n"

	.comm	_ENOTSUPP,4,2                   ## @ENOTSUPP
	.comm	_fsmc_ecc1_ooblayout_ops,4,2    ## @fsmc_ecc1_ooblayout_ops
	.no_dead_strip	_fsmc_nand_attach_chip
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function fsmc_nand_attach_chip
lCPI0_0:
	.long	3                               ; 0x3
	.long	1                               ; 0x1
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_fsmc_nand_attach_chip:                 ; @fsmc_nand_attach_chip
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x21, x0
	bl	_nand_to_mtd
	mov	x19, x0
	mov	x0, x21
	bl	_nand_to_fsmc
	mov	x20, x0
	ldr	w0, [x0, #4]
	bl	_AMBA_REV_BITS
	cmp	w0, #8
	b.lt	LBB0_5
; %bb.1:
	ldr	w2, [x19]
	cmp	w2, #127
	b.le	LBB0_9
; %bb.2:
	cmp	w2, #128
	b.eq	LBB0_11
; %bb.3:
	cmp	w2, #224
	b.eq	LBB0_11
; %bb.4:
	cmp	w2, #256
	b.eq	LBB0_11
	b	LBB0_22
LBB0_5:
	ldr	w8, [x21]
	cmp	w8, #128
	b.eq	LBB0_14
; %bb.6:
	cmp	w8, #129
	b.eq	LBB0_13
; %bb.7:
	cmp	w8, #130
	b.ne	LBB0_21
; %bb.8:
	ldr	w0, [x20]
Lloh0:
	adrp	x1, l_.str.1@PAGE
Lloh1:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_info
Lloh2:
	adrp	x8, _fsmc_read_hwecc_ecc1@GOTPAGE
Lloh3:
	ldr	x8, [x8, _fsmc_read_hwecc_ecc1@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
Lloh5:
	adrp	x9, _nand_correct_data@GOTPAGE
Lloh6:
	ldr	x9, [x9, _nand_correct_data@GOTPAGEOFF]
	str	w8, [x21, #24]
Lloh7:
	ldr	w8, [x9]
Lloh8:
	adrp	x9, lCPI0_0@PAGE
Lloh9:
	ldr	d0, [x9, lCPI0_0@PAGEOFF]
Lloh10:
	adrp	x9, _NAND_ECC_SOFT_HAMMING_SM_ORDER@GOTPAGE
Lloh11:
	ldr	x9, [x9, _NAND_ECC_SOFT_HAMMING_SM_ORDER@GOTPAGEOFF]
	stur	d0, [x21, #4]
Lloh12:
	ldr	w9, [x9]
	ldr	w10, [x21, #16]
	orr	w9, w10, w9
	stp	w9, w8, [x21, #16]
	b	LBB0_16
LBB0_9:
	cmp	w2, #16
	b.eq	LBB0_11
; %bb.10:
	cmp	w2, #64
	b.ne	LBB0_22
LBB0_11:
Lloh13:
	adrp	x1, _fsmc_ecc4_ooblayout_ops@GOTPAGE
Lloh14:
	ldr	x1, [x1, _fsmc_ecc4_ooblayout_ops@GOTPAGEOFF]
LBB0_12:
	mov	x0, x19
	bl	_mtd_set_ooblayout
LBB0_13:
	mov	w0, #0
	b	LBB0_24
LBB0_14:
	ldr	w8, [x21, #12]
Lloh15:
	adrp	x9, _NAND_ECC_BCH@GOTPAGE
Lloh16:
	ldr	x9, [x9, _NAND_ECC_BCH@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	cmp	w8, w9
	b.ne	LBB0_16
; %bb.15:
	ldr	w0, [x20]
Lloh18:
	adrp	x1, l_.str.2@PAGE
Lloh19:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_info
LBB0_16:
	ldr	w8, [x21]
	cmp	w8, #130
	b.ne	LBB0_13
; %bb.17:
	ldr	w2, [x19]
	cmp	w2, #16
	b.eq	LBB0_20
; %bb.18:
	cmp	w2, #128
	b.eq	LBB0_20
; %bb.19:
	cmp	w2, #64
	b.ne	LBB0_22
LBB0_20:
Lloh20:
	adrp	x1, _fsmc_ecc1_ooblayout_ops@GOTPAGE
Lloh21:
	ldr	x1, [x1, _fsmc_ecc1_ooblayout_ops@GOTPAGEOFF]
	b	LBB0_12
LBB0_21:
	ldr	w0, [x20]
Lloh22:
	adrp	x1, l_.str.3@PAGE
Lloh23:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_err
Lloh24:
	adrp	x8, _ENOTSUPP@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ENOTSUPP@GOTPAGEOFF]
	b	LBB0_23
LBB0_22:
	ldr	w0, [x20]
Lloh26:
	adrp	x1, l_.str@PAGE
Lloh27:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_warn
Lloh28:
	adrp	x8, _EINVAL@GOTPAGE
Lloh29:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_23:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_24:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdrp	Lloh8, Lloh10
	.loh AdrpLdr	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh28, Lloh29
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"No oob scheme defined for oobsize %d\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_fsmc_ecc4_ooblayout_ops,4,2    ; @fsmc_ecc4_ooblayout_ops
l_.str.1:                               ; @.str.1
	.asciz	"Using 1-bit HW ECC scheme\n"

	.comm	_fsmc_read_hwecc_ecc1,4,2       ; @fsmc_read_hwecc_ecc1
	.comm	_nand_correct_data,4,2          ; @nand_correct_data
	.comm	_NAND_ECC_SOFT_HAMMING_SM_ORDER,4,2 ; @NAND_ECC_SOFT_HAMMING_SM_ORDER
	.comm	_NAND_ECC_BCH,4,2               ; @NAND_ECC_BCH
l_.str.2:                               ; @.str.2
	.asciz	"Using 4-bit SW BCH ECC scheme\n"

l_.str.3:                               ; @.str.3
	.asciz	"Unsupported ECC mode!\n"

	.comm	_ENOTSUPP,4,2                   ; @ENOTSUPP
	.comm	_fsmc_ecc1_ooblayout_ops,4,2    ; @fsmc_ecc1_ooblayout_ops
	.no_dead_strip	_fsmc_nand_attach_chip
.subsections_via_symbols
