	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hisi_nfc_ecc_probe
_hisi_nfc_ecc_probe:                    ## @hisi_nfc_ecc_probe
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	movq	24(%rdi), %r14
	callq	_nand_to_mtd
	movl	(%rbx), %edx
	cmpl	$1024, %edx                     ## imm = 0x400
	jne	LBB0_1
## %bb.4:
	movl	4(%rbx), %edx
	leal	-8(%rdx), %ecx
	roll	$29, %ecx
	cmpl	$4, %ecx
	ja	LBB0_6
## %bb.5:
	cmpl	$3, %ecx
	je	LBB0_6
## %bb.7:
	movq	_hisi_nand_read_page_hwecc@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 16(%rbx)
	movq	_hisi_nand_read_oob@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 12(%rbx)
	movq	_hisi_nand_write_page_hwecc@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, 8(%rbx)
	cmpl	$16, %edx
	jne	LBB0_12
## %bb.8:
	cmpl	$2048, (%rax)                   ## imm = 0x800
	jne	LBB0_10
## %bb.9:
	movq	_hisi_ooblayout_ops@GOTPCREL(%rip), %rsi
	movq	%rax, %rdi
	callq	_mtd_set_ooblayout
LBB0_10:
	movq	_HINFC504_CON@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_hinfc_read
	movq	_HINFC504_CON_ECCTYPE_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	andl	$6, %esi
	movq	_HINFC504_CON_ECCTYPE_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %esi
	orl	%eax, %esi
	movl	(%r14), %edx
	movq	%rbx, %rdi
	callq	_hinfc_write
	movq	_HINFC504_INTEN@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_hinfc_read
	andl	$4095, %eax                     ## imm = 0xFFF
	movq	_HINFC504_INTEN_UE@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movq	_HINFC504_INTEN_CE@GOTPCREL(%rip), %rcx
	orl	(%rcx), %eax
	movl	(%r14), %edx
	movq	%rbx, %rdi
	movl	%eax, %esi
	callq	_hinfc_write
	xorl	%ebx, %ebx
	jmp	LBB0_11
LBB0_1:
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	jmp	LBB0_2
LBB0_12:
	leaq	L_.str.2(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
                                        ## kill: def $edx killed $edx killed $rdx
LBB0_2:
	xorl	%eax, %eax
	callq	_dev_err
LBB0_3:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
LBB0_11:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_6:
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_3
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"error ecc size: %d\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"ecc size and strength do not match\n"

	.comm	_hisi_nand_read_page_hwecc,4,2  ## @hisi_nand_read_page_hwecc
	.comm	_hisi_nand_read_oob,4,2         ## @hisi_nand_read_oob
	.comm	_hisi_nand_write_page_hwecc,4,2 ## @hisi_nand_write_page_hwecc
	.comm	_hisi_ooblayout_ops,4,2         ## @hisi_ooblayout_ops
L_.str.2:                               ## @.str.2
	.asciz	"not support strength: %d\n"

	.comm	_HINFC504_CON,4,2               ## @HINFC504_CON
	.comm	_HINFC504_CON_ECCTYPE_MASK,4,2  ## @HINFC504_CON_ECCTYPE_MASK
	.comm	_HINFC504_CON_ECCTYPE_SHIFT,4,2 ## @HINFC504_CON_ECCTYPE_SHIFT
	.comm	_HINFC504_INTEN,4,2             ## @HINFC504_INTEN
	.comm	_HINFC504_INTEN_UE,4,2          ## @HINFC504_INTEN_UE
	.comm	_HINFC504_INTEN_CE,4,2          ## @HINFC504_INTEN_CE
	.no_dead_strip	_hisi_nfc_ecc_probe
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hisi_nfc_ecc_probe
_hisi_nfc_ecc_probe:                    ; @hisi_nfc_ecc_probe
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.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
	mov	x19, x0
	ldr	x20, [x0, #24]
	bl	_nand_to_mtd
	ldr	w8, [x19]
	cmp	w8, #1024
	b.ne	LBB0_6
; %bb.1:
	ldr	w8, [x19, #4]
	sub	w9, w8, #8
	ror	w9, w9, #3
	cmp	w9, #4
	ccmp	w9, #3, #4, ls
	b.eq	LBB0_8
; %bb.2:
Lloh0:
	adrp	x9, _hisi_nand_read_page_hwecc@GOTPAGE
Lloh1:
	ldr	x9, [x9, _hisi_nand_read_page_hwecc@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	str	w9, [x19, #16]
Lloh3:
	adrp	x9, _hisi_nand_read_oob@GOTPAGE
Lloh4:
	ldr	x9, [x9, _hisi_nand_read_oob@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
Lloh6:
	adrp	x10, _hisi_nand_write_page_hwecc@GOTPAGE
Lloh7:
	ldr	x10, [x10, _hisi_nand_write_page_hwecc@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	stp	w10, w9, [x19, #8]
	cmp	w8, #16
	b.ne	LBB0_7
; %bb.3:
	ldr	w8, [x0]
	cmp	w8, #2048
	b.ne	LBB0_5
; %bb.4:
Lloh9:
	adrp	x1, _hisi_ooblayout_ops@GOTPAGE
Lloh10:
	ldr	x1, [x1, _hisi_ooblayout_ops@GOTPAGEOFF]
	bl	_mtd_set_ooblayout
LBB0_5:
Lloh11:
	adrp	x20, _HINFC504_CON@GOTPAGE
Lloh12:
	ldr	x20, [x20, _HINFC504_CON@GOTPAGEOFF]
	ldr	w1, [x20]
	mov	x0, x19
	bl	_hinfc_read
Lloh13:
	adrp	x8, _HINFC504_CON_ECCTYPE_MASK@GOTPAGE
Lloh14:
	ldr	x8, [x8, _HINFC504_CON_ECCTYPE_MASK@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	and	w8, w8, #0x6
Lloh16:
	adrp	x9, _HINFC504_CON_ECCTYPE_SHIFT@GOTPAGE
Lloh17:
	ldr	x9, [x9, _HINFC504_CON_ECCTYPE_SHIFT@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	lsl	w8, w8, w9
	orr	w1, w8, w0
	ldr	w2, [x20]
	mov	x0, x19
	bl	_hinfc_write
Lloh19:
	adrp	x20, _HINFC504_INTEN@GOTPAGE
Lloh20:
	ldr	x20, [x20, _HINFC504_INTEN@GOTPAGEOFF]
	ldr	w1, [x20]
	mov	x0, x19
	bl	_hinfc_read
	and	w8, w0, #0xfff
Lloh21:
	adrp	x9, _HINFC504_INTEN_UE@GOTPAGE
Lloh22:
	ldr	x9, [x9, _HINFC504_INTEN_UE@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	orr	w8, w8, w9
Lloh24:
	adrp	x9, _HINFC504_INTEN_CE@GOTPAGE
Lloh25:
	ldr	x9, [x9, _HINFC504_INTEN_CE@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	orr	w1, w8, w9
	ldr	w2, [x20]
	mov	x0, x19
	bl	_hinfc_write
	mov	w0, #0
	b	LBB0_10
LBB0_6:
	str	x8, [sp]
Lloh27:
	adrp	x1, l_.str@PAGE
Lloh28:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_9
LBB0_7:
	str	x8, [sp]
Lloh29:
	adrp	x1, l_.str.2@PAGE
Lloh30:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_9
LBB0_8:
Lloh31:
	adrp	x1, l_.str.1@PAGE
Lloh32:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_9:
	mov	x0, x20
	bl	_dev_err
Lloh33:
	adrp	x8, _EINVAL@GOTPAGE
Lloh34:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh35:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_10:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"error ecc size: %d\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"ecc size and strength do not match\n"

	.comm	_hisi_nand_read_page_hwecc,4,2  ; @hisi_nand_read_page_hwecc
	.comm	_hisi_nand_read_oob,4,2         ; @hisi_nand_read_oob
	.comm	_hisi_nand_write_page_hwecc,4,2 ; @hisi_nand_write_page_hwecc
	.comm	_hisi_ooblayout_ops,4,2         ; @hisi_ooblayout_ops
l_.str.2:                               ; @.str.2
	.asciz	"not support strength: %d\n"

	.comm	_HINFC504_CON,4,2               ; @HINFC504_CON
	.comm	_HINFC504_CON_ECCTYPE_MASK,4,2  ; @HINFC504_CON_ECCTYPE_MASK
	.comm	_HINFC504_CON_ECCTYPE_SHIFT,4,2 ; @HINFC504_CON_ECCTYPE_SHIFT
	.comm	_HINFC504_INTEN,4,2             ; @HINFC504_INTEN
	.comm	_HINFC504_INTEN_UE,4,2          ; @HINFC504_INTEN_UE
	.comm	_HINFC504_INTEN_CE,4,2          ; @HINFC504_INTEN_CE
	.no_dead_strip	_hisi_nfc_ecc_probe
.subsections_via_symbols
