	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bcm47xxnflash_ops_bcm4706_init ## -- Begin function bcm47xxnflash_ops_bcm4706_init
	.p2align	4, 0x90
_bcm47xxnflash_ops_bcm4706_init:        ## @bcm47xxnflash_ops_bcm4706_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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	leaq	8(%rdi), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movq	_bcm47xxnflash_ops_bcm4706_dev_ready@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%rdi)
	movq	_bcm47xxnflash_ops_bcm4706_cmdfunc@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 52(%rdi)
	movq	_bcm47xxnflash_ops_bcm4706_read_byte@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 48(%rdi)
	movq	_bcm47xxnflash_ops_bcm4706_read_buf@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 44(%rdi)
	movq	_bcm47xxnflash_ops_bcm4706_write_buf@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 40(%rdi)
	movq	_nand_get_set_features_notsupp@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 32(%rdi)
	movq	%rax, 24(%rdi)
	movl	$50, 8(%rdi)
	movq	_NAND_BBT_USE_FLASH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%rdi)
	movq	_NAND_ECC_NONE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 16(%rdi)
	movq	(%rdi), %rdi
	movq	_BCMA_CC_4706_FLASHSCFG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_BCMA_CC_4706_FLASHSCFG_NF1@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_bcma_cc_set32
	movq	(%r15), %rdi
	movq	_BCMA_CC_CHIPST_4706_PKG_OPTION@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	$100, %r13d
	testl	%eax, (%rdi)
	jne	LBB0_2
## %bb.1:
	movl	$4, %esi
	callq	_bcma_chipco_pll_read
	shrl	$3, %eax
	andl	$511, %eax                      ## imm = 0x1FF
	imull	$3125000, %eax, %eax            ## imm = 0x2FAF08
	imulq	$1125899907, %rax, %r13         ## imm = 0x431BDE83
	shrq	$50, %r13
LBB0_2:
	movl	$15, %edi
	movl	%r13d, %esi
	callq	_bcm47xxnflash_ops_bcm4706_ns_to_cycle
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	$20, %edi
	movl	%r13d, %esi
	callq	_bcm47xxnflash_ops_bcm4706_ns_to_cycle
	movl	%eax, %ebx
	movl	$10, %edi
	movl	%r13d, %esi
	callq	_bcm47xxnflash_ops_bcm4706_ns_to_cycle
	movl	%eax, %r14d
	movl	$10, %edi
	movl	%r13d, %esi
	callq	_bcm47xxnflash_ops_bcm4706_ns_to_cycle
	movl	%eax, %r12d
	movl	$100, %edi
	movl	%r13d, %esi
	callq	_bcm47xxnflash_ops_bcm4706_ns_to_cycle
	movq	(%r15), %rdi
	movq	_BCMA_CC_NFLASH_WAITCNT0@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	shll	$24, %eax
	shll	$18, %r12d
	shll	$12, %r14d
	orl	%r12d, %r14d
	shll	$6, %ebx
	orl	-44(%rbp), %ebx                 ## 4-byte Folded Reload
	orl	%r14d, %ebx
	orl	%eax, %ebx
	movl	%ebx, %edx
	callq	_bcma_cc_write32
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	$1, %esi
	callq	_nand_scan
	testl	%eax, %eax
	je	LBB0_4
## %bb.3:
	movl	%eax, %r14d
	movslq	%eax, %rsi
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	jmp	LBB0_9
LBB0_4:
	leaq	12(%r15), %rdi
	callq	_nanddev_target_size
	movl	%eax, %ecx
	sarl	$20, %ecx
	movslq	%ecx, %r12
	bsfq	%r12, %rbx
	incl	%ebx
	xorl	%r14d, %r14d
	cmpl	$1048576, %eax                  ## imm = 0x100000
	cmovbl	%r14d, %ebx
	jb	LBB0_7
## %bb.5:
	movq	%r12, %rdi
	callq	_fls
	cmpl	%eax, %ebx
	jne	LBB0_7
## %bb.6:
	movl	8(%r15), %eax
	leal	8(%rax), %ecx
	leal	15(%rax), %edx
	testl	%ecx, %ecx
	cmovnsl	%ecx, %edx
	andl	$-8, %edx
	subl	%eax, %ebx
	leal	26(%rbx), %eax
	addl	$33, %ebx
	testl	%eax, %eax
	cmovnsl	%eax, %ebx
	andl	$-8, %ebx
	leal	-64(,%rbx,8), %eax
	addl	%edx, %edx
	addl	$-16, %edx
	orl	%eax, %edx
	orl	$2, %edx
	movq	(%r15), %rdi
	movq	_BCMA_CC_NFLASH_CONF@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_bcma_cc_write32
	xorl	%r14d, %r14d
	jmp	LBB0_10
LBB0_7:
	leaq	L_.str.1(%rip), %rdi
	movq	%r12, %rsi
	callq	_pr_err
	movq	_ENOTSUPP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	je	LBB0_10
## %bb.8:
	negl	%eax
	movl	%eax, %r14d
LBB0_9:
	movq	_BCMA_CC_4706_FLASHSCFG@GOTPCREL(%rip), %rax
	movq	_BCMA_CC_4706_FLASHSCFG_NF1@GOTPCREL(%rip), %rcx
	movq	(%r15), %rdi
	movl	(%rax), %esi
	movl	(%rcx), %edx
	notl	%edx
	callq	_bcma_cc_mask32
LBB0_10:
	movl	%r14d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_bcm47xxnflash_ops_bcm4706_select_chip,4,2 ## @bcm47xxnflash_ops_bcm4706_select_chip
	.comm	_bcm47xxnflash_ops_bcm4706_cmd_ctrl,4,2 ## @bcm47xxnflash_ops_bcm4706_cmd_ctrl
	.comm	_bcm47xxnflash_ops_bcm4706_dev_ready,4,2 ## @bcm47xxnflash_ops_bcm4706_dev_ready
	.comm	_bcm47xxnflash_ops_bcm4706_cmdfunc,4,2 ## @bcm47xxnflash_ops_bcm4706_cmdfunc
	.comm	_bcm47xxnflash_ops_bcm4706_read_byte,4,2 ## @bcm47xxnflash_ops_bcm4706_read_byte
	.comm	_bcm47xxnflash_ops_bcm4706_read_buf,4,2 ## @bcm47xxnflash_ops_bcm4706_read_buf
	.comm	_bcm47xxnflash_ops_bcm4706_write_buf,4,2 ## @bcm47xxnflash_ops_bcm4706_write_buf
	.comm	_nand_get_set_features_notsupp,8,3 ## @nand_get_set_features_notsupp
	.comm	_NAND_BBT_USE_FLASH,4,2         ## @NAND_BBT_USE_FLASH
	.comm	_NAND_ECC_NONE,4,2              ## @NAND_ECC_NONE
	.comm	_BCMA_CC_4706_FLASHSCFG,4,2     ## @BCMA_CC_4706_FLASHSCFG
	.comm	_BCMA_CC_4706_FLASHSCFG_NF1,4,2 ## @BCMA_CC_4706_FLASHSCFG_NF1
	.comm	_BCMA_CC_CHIPST_4706_PKG_OPTION,4,2 ## @BCMA_CC_CHIPST_4706_PKG_OPTION
	.comm	_BCMA_CC_NFLASH_WAITCNT0,4,2    ## @BCMA_CC_NFLASH_WAITCNT0
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Could not scan NAND flash: %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"Invalid flash size: 0x%lX\n"

	.comm	_ENOTSUPP,4,2                   ## @ENOTSUPP
	.comm	_BCMA_CC_NFLASH_CONF,4,2        ## @BCMA_CC_NFLASH_CONF
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bcm47xxnflash_ops_bcm4706_init ; -- Begin function bcm47xxnflash_ops_bcm4706_init
	.p2align	2
_bcm47xxnflash_ops_bcm4706_init:        ; @bcm47xxnflash_ops_bcm4706_init
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	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
	.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	x19, x0
	mov	w8, #50
	mov	x21, x0
	str	w8, [x21, #8]!
Lloh0:
	adrp	x8, _bcm47xxnflash_ops_bcm4706_dev_ready@GOTPAGE
Lloh1:
	ldr	x8, [x8, _bcm47xxnflash_ops_bcm4706_dev_ready@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	mov	x20, x0
	str	w8, [x20, #12]!
Lloh3:
	adrp	x8, _bcm47xxnflash_ops_bcm4706_cmdfunc@GOTPAGE
Lloh4:
	ldr	x8, [x8, _bcm47xxnflash_ops_bcm4706_cmdfunc@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
Lloh6:
	adrp	x9, _bcm47xxnflash_ops_bcm4706_read_byte@GOTPAGE
Lloh7:
	ldr	x9, [x9, _bcm47xxnflash_ops_bcm4706_read_byte@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
	stp	w9, w8, [x0, #48]
Lloh9:
	adrp	x8, _bcm47xxnflash_ops_bcm4706_read_buf@GOTPAGE
Lloh10:
	ldr	x8, [x8, _bcm47xxnflash_ops_bcm4706_read_buf@GOTPAGEOFF]
Lloh11:
	adrp	x9, _bcm47xxnflash_ops_bcm4706_write_buf@GOTPAGE
Lloh12:
	ldr	x9, [x9, _bcm47xxnflash_ops_bcm4706_write_buf@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
Lloh14:
	ldr	w9, [x9]
	stp	w9, w8, [x0, #40]
Lloh15:
	adrp	x8, _nand_get_set_features_notsupp@GOTPAGE
Lloh16:
	ldr	x8, [x8, _nand_get_set_features_notsupp@GOTPAGEOFF]
Lloh17:
	ldr	x8, [x8]
	stp	x8, x8, [x0, #24]
Lloh18:
	adrp	x8, _NAND_BBT_USE_FLASH@GOTPAGE
Lloh19:
	ldr	x8, [x8, _NAND_BBT_USE_FLASH@GOTPAGEOFF]
Lloh20:
	ldr	w8, [x8]
Lloh21:
	adrp	x9, _NAND_ECC_NONE@GOTPAGE
Lloh22:
	ldr	x9, [x9, _NAND_ECC_NONE@GOTPAGEOFF]
Lloh23:
	ldr	w9, [x9]
	stp	w9, w8, [x0, #16]
	ldr	x0, [x0]
Lloh24:
	adrp	x27, _BCMA_CC_4706_FLASHSCFG@GOTPAGE
Lloh25:
	ldr	x27, [x27, _BCMA_CC_4706_FLASHSCFG@GOTPAGEOFF]
	ldr	w1, [x27]
Lloh26:
	adrp	x28, _BCMA_CC_4706_FLASHSCFG_NF1@GOTPAGE
Lloh27:
	ldr	x28, [x28, _BCMA_CC_4706_FLASHSCFG_NF1@GOTPAGEOFF]
	ldr	w2, [x28]
	bl	_bcma_cc_set32
	ldr	x0, [x19]
	ldr	w8, [x0]
Lloh28:
	adrp	x9, _BCMA_CC_CHIPST_4706_PKG_OPTION@GOTPAGE
Lloh29:
	ldr	x9, [x9, _BCMA_CC_CHIPST_4706_PKG_OPTION@GOTPAGEOFF]
Lloh30:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
	mov	w22, #100
	b	LBB0_3
LBB0_2:
	mov	w1, #4
	bl	_bcma_chipco_pll_read
	ubfx	w8, w0, #3, #9
	mov	w9, #44808
	movk	w9, #47, lsl #16
	mul	w8, w8, w9
	mov	w9, #56963
	movk	w9, #17179, lsl #16
	umull	x8, w8, w9
	lsr	x22, x8, #50
LBB0_3:
	mov	w0, #15
	mov	x1, x22
	bl	_bcm47xxnflash_ops_bcm4706_ns_to_cycle
	mov	x23, x0
	mov	w0, #20
	mov	x1, x22
	bl	_bcm47xxnflash_ops_bcm4706_ns_to_cycle
	mov	x24, x0
	mov	w0, #10
	mov	x1, x22
	bl	_bcm47xxnflash_ops_bcm4706_ns_to_cycle
	mov	x25, x0
	mov	w0, #10
	mov	x1, x22
	bl	_bcm47xxnflash_ops_bcm4706_ns_to_cycle
	mov	x26, x0
	mov	w0, #100
	mov	x1, x22
	bl	_bcm47xxnflash_ops_bcm4706_ns_to_cycle
Lloh31:
	adrp	x9, _BCMA_CC_NFLASH_WAITCNT0@GOTPAGE
Lloh32:
	ldr	x9, [x9, _BCMA_CC_NFLASH_WAITCNT0@GOTPAGEOFF]
	ldr	x8, [x19]
Lloh33:
	ldr	w1, [x9]
	orr	w9, w23, w24, lsl #6
	orr	w9, w9, w25, lsl #12
	orr	w9, w9, w26, lsl #18
	orr	w2, w9, w0, lsl #24
	mov	x0, x8
	bl	_bcma_cc_write32
	mov	x0, x21
	mov	w1, #1
	bl	_nand_scan
	cbz	w0, LBB0_5
; %bb.4:
	mov	x21, x0
	sxtw	x1, w21
Lloh34:
	adrp	x0, l_.str@PAGE
Lloh35:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
	b	LBB0_10
LBB0_5:
	mov	x0, x20
	bl	_nanddev_target_size
                                        ; kill: def $w0 killed $w0 def $x0
	sbfx	x20, x0, #20, #12
	rbit	x8, x20
	clz	x8, x8
	cmp	w0, #256, lsl #12               ; =1048576
	csinc	w21, wzr, w8, lo
	b.lo	LBB0_8
; %bb.6:
	mov	x0, x20
	bl	_fls
	cmp	w21, w0
	b.ne	LBB0_8
; %bb.7:
	ldr	w8, [x19, #8]
	add	w9, w8, #8
	add	w10, w8, #15
	cmp	w9, #0
	csel	w9, w10, w9, lt
	lsl	w9, w9, #1
	and	w9, w9, #0xfffffff0
	sub	w8, w21, w8
	add	w10, w8, #26
	add	w8, w8, #33
	cmp	w10, #0
	csel	w8, w8, w10, lt
	lsl	w8, w8, #3
	and	w8, w8, #0xffffffc0
	sub	w8, w8, #64
	sub	w9, w9, #16
	orr	w8, w9, w8
	orr	w2, w8, #0x2
	ldr	x0, [x19]
Lloh36:
	adrp	x8, _BCMA_CC_NFLASH_CONF@GOTPAGE
Lloh37:
	ldr	x8, [x8, _BCMA_CC_NFLASH_CONF@GOTPAGEOFF]
Lloh38:
	ldr	w1, [x8]
	bl	_bcma_cc_write32
	mov	w21, #0
	b	LBB0_11
LBB0_8:
Lloh39:
	adrp	x0, l_.str.1@PAGE
Lloh40:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x20
	bl	_pr_err
Lloh41:
	adrp	x8, _ENOTSUPP@GOTPAGE
Lloh42:
	ldr	x8, [x8, _ENOTSUPP@GOTPAGEOFF]
Lloh43:
	ldr	w8, [x8]
	cbz	w8, LBB0_12
; %bb.9:
	neg	w21, w8
LBB0_10:
	ldr	x0, [x19]
	ldr	w1, [x27]
	ldr	w8, [x28]
	mvn	w2, w8
	bl	_bcma_cc_mask32
LBB0_11:
	mov	x0, x21
	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
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_12:
	mov	w21, #0
	b	LBB0_11
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh13
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpAdd	Lloh39, Lloh40
	.cfi_endproc
                                        ; -- End function
	.comm	_bcm47xxnflash_ops_bcm4706_select_chip,4,2 ; @bcm47xxnflash_ops_bcm4706_select_chip
	.comm	_bcm47xxnflash_ops_bcm4706_cmd_ctrl,4,2 ; @bcm47xxnflash_ops_bcm4706_cmd_ctrl
	.comm	_bcm47xxnflash_ops_bcm4706_dev_ready,4,2 ; @bcm47xxnflash_ops_bcm4706_dev_ready
	.comm	_bcm47xxnflash_ops_bcm4706_cmdfunc,4,2 ; @bcm47xxnflash_ops_bcm4706_cmdfunc
	.comm	_bcm47xxnflash_ops_bcm4706_read_byte,4,2 ; @bcm47xxnflash_ops_bcm4706_read_byte
	.comm	_bcm47xxnflash_ops_bcm4706_read_buf,4,2 ; @bcm47xxnflash_ops_bcm4706_read_buf
	.comm	_bcm47xxnflash_ops_bcm4706_write_buf,4,2 ; @bcm47xxnflash_ops_bcm4706_write_buf
	.comm	_nand_get_set_features_notsupp,8,3 ; @nand_get_set_features_notsupp
	.comm	_NAND_BBT_USE_FLASH,4,2         ; @NAND_BBT_USE_FLASH
	.comm	_NAND_ECC_NONE,4,2              ; @NAND_ECC_NONE
	.comm	_BCMA_CC_4706_FLASHSCFG,4,2     ; @BCMA_CC_4706_FLASHSCFG
	.comm	_BCMA_CC_4706_FLASHSCFG_NF1,4,2 ; @BCMA_CC_4706_FLASHSCFG_NF1
	.comm	_BCMA_CC_CHIPST_4706_PKG_OPTION,4,2 ; @BCMA_CC_CHIPST_4706_PKG_OPTION
	.comm	_BCMA_CC_NFLASH_WAITCNT0,4,2    ; @BCMA_CC_NFLASH_WAITCNT0
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Could not scan NAND flash: %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"Invalid flash size: 0x%lX\n"

	.comm	_ENOTSUPP,4,2                   ; @ENOTSUPP
	.comm	_BCMA_CC_NFLASH_CONF,4,2        ; @BCMA_CC_NFLASH_CONF
.subsections_via_symbols
