	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stm32_fmc2_attach_chip
_stm32_fmc2_attach_chip:                ## @stm32_fmc2_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, %r12
	movl	24(%rdi), %edi
	callq	_to_stm32_nfc
	movq	%rax, %r14
	movq	%r12, %rdi
	callq	_nand_to_mtd
	movq	%rax, %r15
	movq	8(%r12), %rax
	movq	_NAND_ECC_HW@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_1
## %bb.3:
	movq	8(%r15), %rdx
	movq	_FMC2_BBM_LEN@GOTPCREL(%rip), %rax
	subq	(%rax), %rdx
	movq	_stm32_fmc2_ecc_caps@GOTPCREL(%rip), %rsi
	movq	%r12, %rdi
	callq	_nand_ecc_choose_conf
	testl	%eax, %eax
	je	LBB0_5
## %bb.4:
	movl	%eax, %ebx
	movl	(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	callq	_dev_err
	jmp	LBB0_11
LBB0_1:
	movl	(%r14), %edi
	leaq	L_.str(%rip), %rsi
LBB0_2:
	callq	_dev_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_11:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movl	(%r15), %eax
	cltd
	idivl	16(%r12)
	movq	_FMC2_MAX_SG@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jle	LBB0_7
## %bb.6:
	movl	(%r14), %edi
	leaq	L_.str.2(%rip), %rsi
	jmp	LBB0_2
LBB0_7:
	movl	(%r12), %eax
	movq	_NAND_BBT_USE_FLASH@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_9
## %bb.8:
	movq	_NAND_BBT_NO_OOB@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	%eax, (%r12)
LBB0_9:
	movq	%r12, %rdi
	callq	_stm32_fmc2_nand_callbacks_setup
	movq	_stm32_fmc2_nand_ooblayout_ops@GOTPCREL(%rip), %rsi
	movq	%r15, %rdi
	callq	_mtd_set_ooblayout
	movq	_NAND_BUSWIDTH_16@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%ebx, %ebx
	testl	%eax, 4(%r12)
	je	LBB0_11
## %bb.10:
	movq	%r14, %rdi
	movl	$1, %esi
	callq	_stm32_fmc2_set_buswidth_16
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.comm	_NAND_ECC_HW,8,3                ## @NAND_ECC_HW
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"nand_ecc_mode is not well defined in the DT\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_stm32_fmc2_ecc_caps,4,2        ## @stm32_fmc2_ecc_caps
	.comm	_FMC2_BBM_LEN,8,3               ## @FMC2_BBM_LEN
L_.str.1:                               ## @.str.1
	.asciz	"no valid ECC settings set\n"

	.comm	_FMC2_MAX_SG,4,2                ## @FMC2_MAX_SG
L_.str.2:                               ## @.str.2
	.asciz	"nand page size is not supported\n"

	.comm	_NAND_BBT_USE_FLASH,4,2         ## @NAND_BBT_USE_FLASH
	.comm	_NAND_BBT_NO_OOB,4,2            ## @NAND_BBT_NO_OOB
	.comm	_stm32_fmc2_nand_ooblayout_ops,4,2 ## @stm32_fmc2_nand_ooblayout_ops
	.comm	_NAND_BUSWIDTH_16,4,2           ## @NAND_BUSWIDTH_16
	.no_dead_strip	_stm32_fmc2_attach_chip
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stm32_fmc2_attach_chip
_stm32_fmc2_attach_chip:                ; @stm32_fmc2_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	x20, x0
	ldr	w0, [x0, #24]
	bl	_to_stm32_nfc
	mov	x19, x0
	mov	x0, x20
	bl	_nand_to_mtd
	ldr	x8, [x20, #8]
Lloh0:
	adrp	x9, _NAND_ECC_HW@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NAND_ECC_HW@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.1:
	mov	x21, x0
	ldr	x8, [x0, #8]
Lloh3:
	adrp	x9, _FMC2_BBM_LEN@GOTPAGE
Lloh4:
	ldr	x9, [x9, _FMC2_BBM_LEN@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	sub	x2, x8, x9
Lloh6:
	adrp	x1, _stm32_fmc2_ecc_caps@GOTPAGE
Lloh7:
	ldr	x1, [x1, _stm32_fmc2_ecc_caps@GOTPAGEOFF]
	mov	x0, x20
	bl	_nand_ecc_choose_conf
	cbz	w0, LBB0_6
; %bb.2:
	mov	x22, x0
	ldr	w0, [x19]
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
	b	LBB0_5
LBB0_3:
	ldr	w0, [x19]
Lloh10:
	adrp	x1, l_.str@PAGE
Lloh11:
	add	x1, x1, l_.str@PAGEOFF
LBB0_4:
	bl	_dev_err
Lloh12:
	adrp	x8, _EINVAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_5:
	mov	x0, x22
	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
LBB0_6:
	ldr	w8, [x21]
	ldr	w9, [x20, #16]
	sdiv	w8, w8, w9
Lloh15:
	adrp	x9, _FMC2_MAX_SG@GOTPAGE
Lloh16:
	ldr	x9, [x9, _FMC2_MAX_SG@GOTPAGEOFF]
Lloh17:
	ldr	w9, [x9]
	cmp	w8, w9
	b.le	LBB0_8
; %bb.7:
	ldr	w0, [x19]
Lloh18:
	adrp	x1, l_.str.2@PAGE
Lloh19:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_4
LBB0_8:
	ldr	w8, [x20]
Lloh20:
	adrp	x9, _NAND_BBT_USE_FLASH@GOTPAGE
Lloh21:
	ldr	x9, [x9, _NAND_BBT_USE_FLASH@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_10
; %bb.9:
Lloh23:
	adrp	x9, _NAND_BBT_NO_OOB@GOTPAGE
Lloh24:
	ldr	x9, [x9, _NAND_BBT_NO_OOB@GOTPAGEOFF]
Lloh25:
	ldr	w9, [x9]
	orr	w8, w9, w8
	str	w8, [x20]
LBB0_10:
	mov	x0, x20
	bl	_stm32_fmc2_nand_callbacks_setup
Lloh26:
	adrp	x1, _stm32_fmc2_nand_ooblayout_ops@GOTPAGE
Lloh27:
	ldr	x1, [x1, _stm32_fmc2_nand_ooblayout_ops@GOTPAGEOFF]
	mov	x0, x21
	bl	_mtd_set_ooblayout
	ldr	w8, [x20, #4]
Lloh28:
	adrp	x9, _NAND_BUSWIDTH_16@GOTPAGE
Lloh29:
	ldr	x9, [x9, _NAND_BUSWIDTH_16@GOTPAGEOFF]
Lloh30:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_12
; %bb.11:
	mov	x0, x19
	mov	w1, #1
	bl	_stm32_fmc2_set_buswidth_16
LBB0_12:
	mov	w22, #0
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_NAND_ECC_HW,8,3                ; @NAND_ECC_HW
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"nand_ecc_mode is not well defined in the DT\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_stm32_fmc2_ecc_caps,4,2        ; @stm32_fmc2_ecc_caps
	.comm	_FMC2_BBM_LEN,8,3               ; @FMC2_BBM_LEN
l_.str.1:                               ; @.str.1
	.asciz	"no valid ECC settings set\n"

	.comm	_FMC2_MAX_SG,4,2                ; @FMC2_MAX_SG
l_.str.2:                               ; @.str.2
	.asciz	"nand page size is not supported\n"

	.comm	_NAND_BBT_USE_FLASH,4,2         ; @NAND_BBT_USE_FLASH
	.comm	_NAND_BBT_NO_OOB,4,2            ; @NAND_BBT_NO_OOB
	.comm	_stm32_fmc2_nand_ooblayout_ops,4,2 ; @stm32_fmc2_nand_ooblayout_ops
	.comm	_NAND_BUSWIDTH_16,4,2           ; @NAND_BUSWIDTH_16
	.no_dead_strip	_stm32_fmc2_attach_chip
.subsections_via_symbols
