	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function atmel_nand_pmecc_init
_atmel_nand_pmecc_init:                 ## @atmel_nand_pmecc_init
	.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	%rdi, %r13
	callq	_nand_to_mtd
	movq	%rax, %r14
	movq	%r13, %rdi
	callq	_to_atmel_nand
	movq	%rax, %r15
	movl	56(%r13), %edi
	callq	_to_nand_controller
	movq	%rax, %r12
	cmpl	$0, (%rax)
	je	LBB0_1
## %bb.2:
	movq	16(%r12), %rax
	cmpq	$0, (%rax)
	je	LBB0_7
## %bb.3:
	movq	8(%r12), %rax
	movl	(%rax), %edi
	leaq	L_.str.1(%rip), %rsi
	leaq	-80(%rbp), %rdx
	callq	_of_property_read_u32
	testl	%eax, %eax
	jne	LBB0_5
## %bb.4:
	movq	-80(%rbp), %rax
	movq	%rax, 16(%r13)
LBB0_5:
	movq	8(%r12), %rax
	movl	(%rax), %edi
	leaq	L_.str.2(%rip), %rsi
	leaq	-80(%rbp), %rdx
	callq	_of_property_read_u32
	testl	%eax, %eax
	jne	LBB0_7
## %bb.6:
	movq	-80(%rbp), %rax
	movq	%rax, 24(%r13)
LBB0_7:
	movq	_NAND_ECC_MAXIMIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 8(%r13)
	je	LBB0_8
LBB0_10:
	movq	_ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	jmp	LBB0_11
LBB0_1:
	movq	8(%r12), %rdi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
	movq	_ENOTSUPP@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_17
LBB0_8:
	movq	16(%r13), %rax
	testq	%rax, %rax
	jne	LBB0_11
## %bb.9:
	movq	48(%r13), %rax
	testq	%rax, %rax
	je	LBB0_10
LBB0_11:
	movq	%rax, -64(%rbp)
	movq	24(%r13), %rax
	testq	%rax, %rax
	jne	LBB0_14
## %bb.12:
	movq	40(%r13), %rax
	testq	%rax, %rax
	jne	LBB0_14
## %bb.13:
	movq	_ATMEL_PMECC_SECTOR_SIZE_AUTO@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
LBB0_14:
	movq	%rax, -56(%rbp)
	movl	(%r14), %eax
	movl	%eax, -80(%rbp)
	movl	4(%r14), %ecx
	movl	%ecx, -76(%rbp)
	addl	$-2, %ecx
	xorl	%ebx, %ebx
	cmpl	$513, %eax                      ## imm = 0x201
	movl	$4, %eax
	cmovgel	%ecx, %eax
	movq	_ATMEL_PMECC_OOBOFFSET_AUTO@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmovlq	%rbx, %rcx
	movl	%eax, -72(%rbp)
	movq	%rcx, -48(%rbp)
	movl	(%r12), %edi
	leaq	-80(%rbp), %rsi
	callq	_atmel_pmecc_create_user
	movl	%eax, (%r15)
	movl	%eax, %edi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_16
## %bb.15:
	movl	(%r15), %edi
	callq	_PTR_ERR
	movl	%eax, %ebx
	jmp	LBB0_17
LBB0_16:
	movq	_NAND_ECC_BCH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%r13)
	movl	-72(%rbp), %eax
	cltd
	idivl	-68(%rbp)
	movl	%eax, 12(%r13)
	movups	-64(%rbp), %xmm0
	movups	%xmm0, 16(%r13)
	movq	_NAND_NO_SUBPAGE_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	orl	%eax, (%r13)
	movq	_nand_ooblayout_lp_ops@GOTPCREL(%rip), %rsi
	movq	%r14, %rdi
	callq	_mtd_set_ooblayout
LBB0_17:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"HW ECC not supported\n"

	.comm	_ENOTSUPP,4,2                   ## @ENOTSUPP
L_.str.1:                               ## @.str.1
	.asciz	"atmel,pmecc-cap"

L_.str.2:                               ## @.str.2
	.asciz	"atmel,pmecc-sector-size"

	.comm	_NAND_ECC_MAXIMIZE,4,2          ## @NAND_ECC_MAXIMIZE
	.comm	_ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH,8,3 ## @ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH
	.comm	_ATMEL_PMECC_SECTOR_SIZE_AUTO,8,3 ## @ATMEL_PMECC_SECTOR_SIZE_AUTO
	.comm	_ATMEL_PMECC_OOBOFFSET_AUTO,8,3 ## @ATMEL_PMECC_OOBOFFSET_AUTO
	.comm	_NAND_ECC_BCH,4,2               ## @NAND_ECC_BCH
	.comm	_NAND_NO_SUBPAGE_WRITE,4,2      ## @NAND_NO_SUBPAGE_WRITE
	.comm	_nand_ooblayout_lp_ops,4,2      ## @nand_ooblayout_lp_ops
	.no_dead_strip	_atmel_nand_pmecc_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function atmel_nand_pmecc_init
_atmel_nand_pmecc_init:                 ; @atmel_nand_pmecc_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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	x19, x0
	bl	_nand_to_mtd
	mov	x20, x0
	mov	x0, x19
	bl	_to_atmel_nand
	mov	x21, x0
	ldr	w0, [x19, #56]
	bl	_to_nand_controller
	mov	x22, x0
	ldr	w8, [x0]
	cbz	w8, LBB0_8
; %bb.1:
	ldr	x8, [x22, #16]
	ldr	x8, [x8]
	cbz	x8, LBB0_6
; %bb.2:
	ldr	x8, [x22, #8]
	ldr	w0, [x8]
Lloh0:
	adrp	x1, l_.str.1@PAGE
Lloh1:
	add	x1, x1, l_.str.1@PAGEOFF
	add	x2, sp, #8
	bl	_of_property_read_u32
	cbnz	w0, LBB0_4
; %bb.3:
	ldr	x8, [sp, #8]
	str	x8, [x19, #16]
LBB0_4:
	ldr	x8, [x22, #8]
	ldr	w0, [x8]
Lloh2:
	adrp	x1, l_.str.2@PAGE
Lloh3:
	add	x1, x1, l_.str.2@PAGEOFF
	add	x2, sp, #8
	bl	_of_property_read_u32
	cbnz	w0, LBB0_6
; %bb.5:
	ldr	x8, [sp, #8]
	str	x8, [x19, #24]
LBB0_6:
	ldr	w8, [x19, #8]
Lloh4:
	adrp	x9, _NAND_ECC_MAXIMIZE@GOTPAGE
Lloh5:
	ldr	x9, [x9, _NAND_ECC_MAXIMIZE@GOTPAGEOFF]
Lloh6:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.7:
Lloh7:
	adrp	x8, _ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
	b	LBB0_11
LBB0_8:
	ldr	x0, [x22, #8]
Lloh10:
	adrp	x1, l_.str@PAGE
Lloh11:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
Lloh12:
	adrp	x8, _ENOTSUPP@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ENOTSUPP@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_16
LBB0_9:
	ldr	x8, [x19, #16]
	cbnz	x8, LBB0_11
; %bb.10:
	ldr	x8, [x19, #48]
Lloh15:
	adrp	x9, _ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH@GOTPAGE
Lloh16:
	ldr	x9, [x9, _ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	cmp	x8, #0
	csel	x8, x9, x8, eq
LBB0_11:
	str	x8, [sp, #24]
	ldr	x8, [x19, #24]
	cbnz	x8, LBB0_13
; %bb.12:
	ldr	x8, [x19, #40]
Lloh18:
	adrp	x9, _ATMEL_PMECC_SECTOR_SIZE_AUTO@GOTPAGE
Lloh19:
	ldr	x9, [x9, _ATMEL_PMECC_SECTOR_SIZE_AUTO@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	cmp	x8, #0
	csel	x8, x9, x8, eq
LBB0_13:
	str	x8, [sp, #32]
	ldp	w8, w9, [x20]
	stp	w8, w9, [sp, #8]
	sub	w9, w9, #2
Lloh21:
	adrp	x10, _ATMEL_PMECC_OOBOFFSET_AUTO@GOTPAGE
Lloh22:
	ldr	x10, [x10, _ATMEL_PMECC_OOBOFFSET_AUTO@GOTPAGEOFF]
Lloh23:
	ldr	x10, [x10]
	mov	w11, #4
	cmp	w8, #513
	csel	w8, w11, w9, lt
	csel	x9, xzr, x10, lt
	str	w8, [sp, #16]
	str	x9, [sp, #40]
	ldr	w0, [x22]
	add	x1, sp, #8
	bl	_atmel_pmecc_create_user
	str	w0, [x21]
	bl	_IS_ERR
	cbz	x0, LBB0_15
; %bb.14:
	ldr	w0, [x21]
	bl	_PTR_ERR
	b	LBB0_16
LBB0_15:
Lloh24:
	adrp	x8, _NAND_ECC_BCH@GOTPAGE
Lloh25:
	ldr	x8, [x8, _NAND_ECC_BCH@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	str	w8, [x19, #32]
	ldp	w8, w9, [sp, #16]
	sdiv	w8, w8, w9
	str	w8, [x19, #12]
	ldp	x9, x8, [sp, #24]
	stp	x9, x8, [x19, #16]
Lloh27:
	adrp	x8, _NAND_NO_SUBPAGE_WRITE@GOTPAGE
Lloh28:
	ldr	x8, [x8, _NAND_NO_SUBPAGE_WRITE@GOTPAGEOFF]
Lloh29:
	ldr	w8, [x8]
	ldr	w9, [x19]
	orr	w8, w9, w8
	str	w8, [x19]
Lloh30:
	adrp	x1, _nand_ooblayout_lp_ops@GOTPAGE
Lloh31:
	ldr	x1, [x1, _nand_ooblayout_lp_ops@GOTPAGEOFF]
	mov	x0, x20
	bl	_mtd_set_ooblayout
	mov	w0, #0
LBB0_16:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"HW ECC not supported\n"

	.comm	_ENOTSUPP,4,2                   ; @ENOTSUPP
l_.str.1:                               ; @.str.1
	.asciz	"atmel,pmecc-cap"

l_.str.2:                               ; @.str.2
	.asciz	"atmel,pmecc-sector-size"

	.comm	_NAND_ECC_MAXIMIZE,4,2          ; @NAND_ECC_MAXIMIZE
	.comm	_ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH,8,3 ; @ATMEL_PMECC_MAXIMIZE_ECC_STRENGTH
	.comm	_ATMEL_PMECC_SECTOR_SIZE_AUTO,8,3 ; @ATMEL_PMECC_SECTOR_SIZE_AUTO
	.comm	_ATMEL_PMECC_OOBOFFSET_AUTO,8,3 ; @ATMEL_PMECC_OOBOFFSET_AUTO
	.comm	_NAND_ECC_BCH,4,2               ; @NAND_ECC_BCH
	.comm	_NAND_NO_SUBPAGE_WRITE,4,2      ; @NAND_NO_SUBPAGE_WRITE
	.comm	_nand_ooblayout_lp_ops,4,2      ; @nand_ooblayout_lp_ops
	.no_dead_strip	_atmel_nand_pmecc_init
.subsections_via_symbols
