	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function spear_smi_setup_banks
_spear_smi_setup_banks:                 ## @spear_smi_setup_banks
	.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	%rdx, %rbx
	movl	%esi, %r14d
	movq	%rdi, %r12
	callq	_platform_get_drvdata
	movq	%rax, %r13
	movq	%r12, %rdi
	callq	_dev_get_platdata
	cmpl	%r14d, (%rax)
	jle	LBB0_1
## %bb.3:
	movq	8(%rax), %r15
	testq	%r15, %r15
	je	LBB0_4
## %bb.5:
	movq	%rbx, -80(%rbp)                 ## 8-byte Spill
	movq	_GFP_ATOMIC@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	movl	$96, %esi
	callq	_devm_kzalloc
	testq	%rax, %rax
	je	LBB0_6
## %bb.7:
	movslq	%r14d, %rbx
	movl	%ebx, (%rax)
	leaq	(%rbx,%rbx,4), %rdx
	xorl	%ecx, %ecx
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	cmpq	$0, 32(%r15,%rdx,8)
	setne	%cl
	movl	%ecx, 4(%rax)
	movq	%rax, %r15
	leaq	88(%rax), %rdi
	callq	_mutex_init
	movq	%r13, %rdi
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movl	%ebx, %esi
	callq	_spear_smi_probe_flash
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_8
## %bb.9:
	movq	%r13, -48(%rbp)                 ## 8-byte Spill
	movq	-72(%rbp), %r13                 ## 8-byte Reload
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movl	(%r13,%r14,8), %edx
	movl	24(%r13,%r14,8), %esi
	movq	%r12, %rdi
	callq	_devm_ioremap
	movl	%eax, 84(%r15)
	testl	%eax, %eax
	je	LBB0_10
## %bb.11:
	movq	%r14, %rax
	movq	%r14, %rdx
	leaq	(,%rax,8), %r14
	addq	%r13, %r14
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	8(%rcx), %rax
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	%r15, (%rax,%rsi,8)
	movq	%r15, %rsi
	addq	$8, %rsi
	movq	%rcx, 64(%r15)
	movq	16(%r13,%rdx,8), %rax
	testq	%rax, %rax
	je	LBB0_13
## %bb.12:
	movl	%ebx, %ebx
	jmp	LBB0_14
LBB0_1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_4:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_6:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_8:
	movq	(%r13), %rdi
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_dev_info
	jmp	LBB0_18
LBB0_10:
	movq	_EIO@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_18:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_13:
	movq	_flash_devices@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%ebx, %ebx
	leaq	(%rbx,%rbx,2), %rcx
	movq	16(%rax,%rcx,8), %rax
LBB0_14:
	movq	%rax, 24(%r15)
	movq	%r12, 56(%r15)
	movq	%rsi, %r12
	movq	%rsi, %rdi
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	callq	_mtd_set_of_node
	movq	_MTD_NORFLASH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 52(%r15)
	movl	$1, 8(%r15)
	movq	_MTD_CAP_NORFLASH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 48(%r15)
	movl	(%r14), %ecx
	movl	%ecx, 12(%r15)
	movq	_flash_devices@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	leaq	(%rbx,%rbx,2), %rdx
	movl	(%rax,%rdx,8), %esi
	movl	%esi, 16(%r15)
	movl	12(%rax,%rdx,8), %esi
	movl	%esi, 80(%r15)
	movl	%esi, 44(%r15)
	movl	8(%rax,%rdx,8), %esi
	movl	%esi, 76(%r15)
	movq	_spear_mtd_erase@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	movl	%esi, 40(%r15)
	movq	_spear_mtd_read@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	movl	%esi, 36(%r15)
	movq	_spear_mtd_write@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	movl	%esi, 32(%r15)
	movl	4(%rax,%rdx,8), %eax
	movl	%eax, 72(%r15)
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	(%r14), %rdi
	movl	24(%r15), %edx
	leal	1048575(%rcx), %r8d
	testl	%ecx, %ecx
	cmovnsl	%ecx, %r8d
	sarl	$20, %r8d
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
                                        ## kill: def $ecx killed $ecx killed $rcx
	xorl	%eax, %eax
	callq	_dev_info
	movq	(%r14), %rdi
	movl	16(%r15), %edx
	leal	1023(%rdx), %ecx
	testl	%edx, %edx
	cmovnsl	%edx, %ecx
	sarl	$10, %ecx
	leaq	L_.str.2(%rip), %rsi
                                        ## kill: def $edx killed $edx killed $rdx
	xorl	%eax, %eax
	callq	_dev_info
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	8(%r13,%rax,8), %rsi
	movl	$0, %edx
	testq	%rsi, %rsi
	je	LBB0_16
## %bb.15:
	movl	4(%r13,%rax,8), %edx
LBB0_16:
	movq	%r12, %rdi
	callq	_mtd_device_register
	testl	%eax, %eax
	je	LBB0_18
## %bb.17:
	movl	%eax, %r14d
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rdi
	leaq	L_.str.3(%rip), %rsi
	movl	%r14d, %edx
	callq	_dev_err
	movl	%r14d, %ebx
	jmp	LBB0_18
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_GFP_ATOMIC,4,2                 ## @GFP_ATOMIC
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"smi-nor%d not found\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_flash_devices,8,3              ## @flash_devices
	.comm	_MTD_NORFLASH,4,2               ## @MTD_NORFLASH
	.comm	_MTD_CAP_NORFLASH,4,2           ## @MTD_CAP_NORFLASH
	.comm	_spear_mtd_erase,4,2            ## @spear_mtd_erase
	.comm	_spear_mtd_read,4,2             ## @spear_mtd_read
	.comm	_spear_mtd_write,4,2            ## @spear_mtd_write
L_.str.1:                               ## @.str.1
	.asciz	"mtd .name=%s .size=%llx(%lluM)\n"

L_.str.2:                               ## @.str.2
	.asciz	".erasesize = 0x%x(%uK)\n"

L_.str.3:                               ## @.str.3
	.asciz	"Err MTD partition=%d\n"

	.no_dead_strip	_spear_smi_setup_banks
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function spear_smi_setup_banks
_spear_smi_setup_banks:                 ; @spear_smi_setup_banks
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x22, x2
	mov	x21, x1
	mov	x23, x0
	bl	_platform_get_drvdata
	mov	x19, x0
	mov	x0, x23
	bl	_dev_get_platdata
	ldr	w8, [x0]
	cmp	w8, w21
	b.le	LBB0_7
; %bb.1:
	ldr	x25, [x0, #8]
	cbz	x25, LBB0_8
; %bb.2:
Lloh0:
	adrp	x8, _GFP_ATOMIC@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_ATOMIC@GOTPAGEOFF]
Lloh2:
	ldr	w2, [x8]
	mov	x0, x23
	mov	w1, #96
	bl	_devm_kzalloc
	cbz	x0, LBB0_9
; %bb.3:
	mov	x20, x0
	sxtw	x26, w21
	mov	w8, #40
	madd	x8, x26, x8, x25
	ldr	x8, [x8, #32]
	cmp	x8, #0
	cset	w8, ne
	stp	w21, w8, [x0], #88
	bl	_mutex_init
	mov	x0, x19
	mov	x1, x21
	bl	_spear_smi_probe_flash
	mov	x24, x0
	tbnz	w0, #31, LBB0_10
; %bb.4:
	mov	w8, #40
	madd	x27, x26, x8, x25
	ldr	w1, [x27, #24]
	ldr	w2, [x27]
	mov	x0, x23
	bl	_devm_ioremap
	str	w0, [x20, #84]
	cbz	w0, LBB0_11
; %bb.5:
	ldr	x8, [x19, #8]
	str	x20, [x8, x26, lsl #3]
	add	x0, x20, #8
	str	x19, [x20, #64]
	mov	w8, #40
	madd	x8, x26, x8, x25
	ldr	x8, [x8, #16]
Lloh3:
	adrp	x21, _flash_devices@GOTPAGE
Lloh4:
	ldr	x21, [x21, _flash_devices@GOTPAGEOFF]
	cbz	x8, LBB0_14
; %bb.6:
	mov	w28, w24
	b	LBB0_15
LBB0_7:
Lloh5:
	adrp	x8, _EINVAL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_12
LBB0_8:
Lloh7:
	adrp	x8, _ENODEV@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
	b	LBB0_12
LBB0_9:
Lloh9:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_12
LBB0_10:
	ldr	x0, [x19]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x21
	bl	_dev_info
	b	LBB0_13
LBB0_11:
Lloh13:
	adrp	x8, _EIO@GOTPAGE
Lloh14:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_12:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_13:
	mov	x0, x24
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_14:
	ldr	x8, [x21]
	mov	w28, w24
	mov	w9, #24
	umaddl	x8, w24, w9, x8
	ldr	x8, [x8, #16]
LBB0_15:
	str	x8, [x20, #24]
	str	x23, [x20, #56]
	mov	x23, x0
	mov	x1, x22
	bl	_mtd_set_of_node
Lloh15:
	adrp	x8, _MTD_NORFLASH@GOTPAGE
Lloh16:
	ldr	x8, [x8, _MTD_NORFLASH@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
Lloh18:
	adrp	x9, _MTD_CAP_NORFLASH@GOTPAGE
Lloh19:
	ldr	x9, [x9, _MTD_CAP_NORFLASH@GOTPAGEOFF]
Lloh20:
	ldr	w9, [x9]
	stp	w9, w8, [x20, #48]
	mov	w8, #1
	ldr	w9, [x27]
	stp	w8, w9, [x20, #8]
	ldr	x8, [x21]
	mov	w10, #24
	madd	x8, x28, x10, x8
	ldr	w10, [x8]
	str	w10, [x20, #16]
	ldr	w10, [x8, #12]
	str	w10, [x20, #80]
Lloh21:
	adrp	x11, _spear_mtd_erase@GOTPAGE
Lloh22:
	ldr	x11, [x11, _spear_mtd_erase@GOTPAGEOFF]
Lloh23:
	ldr	w11, [x11]
	stp	w11, w10, [x20, #40]
Lloh24:
	adrp	x10, _spear_mtd_read@GOTPAGE
Lloh25:
	ldr	x10, [x10, _spear_mtd_read@GOTPAGEOFF]
Lloh26:
	ldr	w10, [x10]
Lloh27:
	adrp	x11, _spear_mtd_write@GOTPAGE
Lloh28:
	ldr	x11, [x11, _spear_mtd_write@GOTPAGEOFF]
Lloh29:
	ldr	w11, [x11]
	stp	w11, w10, [x20, #32]
	ldur	d0, [x8, #4]
	str	d0, [x20, #72]
	ldr	x0, [x19]
	ldr	w2, [x20, #24]
	mov	w8, #1048575
	add	w8, w9, w8
	cmp	w9, #0
	csel	w8, w8, w9, lt
	asr	w8, w8, #20
	stp	x9, x8, [sp]
Lloh30:
	adrp	x1, l_.str.1@PAGE
Lloh31:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_info
	ldr	x0, [x19]
	ldr	w2, [x20, #16]
	add	w8, w2, #1023
	cmp	w2, #0
	csel	w8, w8, w2, lt
	asr	w8, w8, #10
	str	x8, [sp]
Lloh32:
	adrp	x1, l_.str.2@PAGE
Lloh33:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_info
	mov	w8, #40
	madd	x8, x26, x8, x25
	ldr	x1, [x8, #8]
	cbz	x1, LBB0_17
; %bb.16:
	mov	w8, #40
	madd	x8, x26, x8, x25
	ldr	w2, [x8, #4]
	b	LBB0_18
LBB0_17:
	mov	w2, #0
LBB0_18:
	mov	x0, x23
	bl	_mtd_device_register
	mov	x24, x0
	cbz	w0, LBB0_13
; %bb.19:
	ldr	x0, [x19]
Lloh34:
	adrp	x1, l_.str.3@PAGE
Lloh35:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x2, x24
	bl	_dev_err
	b	LBB0_13
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_GFP_ATOMIC,4,2                 ; @GFP_ATOMIC
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"smi-nor%d not found\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_flash_devices,8,3              ; @flash_devices
	.comm	_MTD_NORFLASH,4,2               ; @MTD_NORFLASH
	.comm	_MTD_CAP_NORFLASH,4,2           ; @MTD_CAP_NORFLASH
	.comm	_spear_mtd_erase,4,2            ; @spear_mtd_erase
	.comm	_spear_mtd_read,4,2             ; @spear_mtd_read
	.comm	_spear_mtd_write,4,2            ; @spear_mtd_write
l_.str.1:                               ; @.str.1
	.asciz	"mtd .name=%s .size=%llx(%lluM)\n"

l_.str.2:                               ; @.str.2
	.asciz	".erasesize = 0x%x(%uK)\n"

l_.str.3:                               ; @.str.3
	.asciz	"Err MTD partition=%d\n"

	.no_dead_strip	_spear_smi_setup_banks
.subsections_via_symbols
