	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bcma_core_mips_flash_detect
_bcma_core_mips_flash_detect:           ## @bcma_core_mips_flash_detect
	.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), %rax
	movq	(%rax), %rbx
	leaq	8(%rbx), %r14
	movq	_BCMA_CC_CAP_FLASHT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	8(%rbx), %eax
	cmpl	$130, %eax
	je	LBB0_3
## %bb.1:
	cmpl	$129, %eax
	je	LBB0_4
## %bb.2:
	cmpl	$128, %eax
	jne	LBB0_5
LBB0_3:
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdi
	callq	_bcma_debug
	movq	%r14, %rdi
	callq	_bcma_sflash_init
	jmp	LBB0_6
LBB0_4:
	leaq	L_.str.1(%rip), %rsi
	movq	%rbx, %rdi
	callq	_bcma_debug
	movl	$1, 24(%rbx)
	movq	_BCMA_SOC_FLASH2@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 40(%rbx)
	movq	_BCMA_SOC_FLASH2_SZ@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, 32(%rbx)
	movq	16(%rbx), %rdi
	movq	_BCMA_CC_FLASH_CFG@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_bcma_read32
	movq	_BCMA_CC_FLASH_CFG_DS@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	cmpl	$1, %eax
	movl	$2, %eax
	sbbl	$0, %eax
	movl	%eax, 28(%rbx)
	movq	_bcma_pflash_data@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	movq	40(%rbx), %rax
	movq	_bcma_pflash_resource@GOTPCREL(%rip), %rcx
	movq	%rax, 8(%rcx)
	addq	32(%rbx), %rax
	movq	%rax, (%rcx)
	jmp	LBB0_6
LBB0_5:
	leaq	L_.str.2(%rip), %rsi
	movq	%rbx, %rdi
	callq	_bcma_err
LBB0_6:
	movq	16(%rbx), %rax
	cmpl	$38, (%rax)
	je	LBB0_8
## %bb.7:
	movq	(%rbx), %rax
	movq	_BCMA_CHIP_ID_BCM4706@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_9
LBB0_8:
	movq	_BCMA_CC_CAP_NFLASH@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r14)
	je	LBB0_9
## %bb.10:
	leaq	L_.str.3(%rip), %rsi
	movq	%rbx, %rdi
	callq	_bcma_debug
	movq	%r14, %rdi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_bcma_nflash_init               ## TAILCALL
LBB0_9:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BCMA_CC_CAP_FLASHT,4,2         ## @BCMA_CC_CAP_FLASHT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Found serial flash\n"

L_.str.1:                               ## @.str.1
	.asciz	"Found parallel flash\n"

	.comm	_BCMA_SOC_FLASH2,8,3            ## @BCMA_SOC_FLASH2
	.comm	_BCMA_SOC_FLASH2_SZ,8,3         ## @BCMA_SOC_FLASH2_SZ
	.comm	_BCMA_CC_FLASH_CFG,4,2          ## @BCMA_CC_FLASH_CFG
	.comm	_BCMA_CC_FLASH_CFG_DS,4,2       ## @BCMA_CC_FLASH_CFG_DS
	.comm	_bcma_pflash_data,4,2           ## @bcma_pflash_data
	.comm	_bcma_pflash_resource,16,3      ## @bcma_pflash_resource
L_.str.2:                               ## @.str.2
	.asciz	"Flash type not supported\n"

	.comm	_BCMA_CHIP_ID_BCM4706,8,3       ## @BCMA_CHIP_ID_BCM4706
	.comm	_BCMA_CC_CAP_NFLASH,4,2         ## @BCMA_CC_CAP_NFLASH
L_.str.3:                               ## @.str.3
	.asciz	"Found NAND flash\n"

	.no_dead_strip	_bcma_core_mips_flash_detect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bcma_core_mips_flash_detect
_bcma_core_mips_flash_detect:           ; @bcma_core_mips_flash_detect
	.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
	ldr	x8, [x0]
	ldr	x20, [x8]
	mov	x19, x20
	ldr	w8, [x19, #8]!
Lloh0:
	adrp	x9, _BCMA_CC_CAP_FLASHT@GOTPAGE
Lloh1:
	ldr	x9, [x9, _BCMA_CC_CAP_FLASHT@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	and	w8, w9, w8
	cmp	w8, #130
	b.eq	LBB0_3
; %bb.1:
	cmp	w8, #129
	b.eq	LBB0_4
; %bb.2:
	cmp	w8, #128
	b.ne	LBB0_5
LBB0_3:
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_bcma_debug
	mov	x0, x19
	bl	_bcma_sflash_init
	b	LBB0_6
LBB0_4:
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_bcma_debug
	mov	w21, #1
	str	w21, [x20, #24]
Lloh7:
	adrp	x8, _BCMA_SOC_FLASH2@GOTPAGE
Lloh8:
	ldr	x8, [x8, _BCMA_SOC_FLASH2@GOTPAGEOFF]
Lloh9:
	ldr	x8, [x8]
Lloh10:
	adrp	x9, _BCMA_SOC_FLASH2_SZ@GOTPAGE
Lloh11:
	ldr	x9, [x9, _BCMA_SOC_FLASH2_SZ@GOTPAGEOFF]
Lloh12:
	ldr	x9, [x9]
	stp	x9, x8, [x20, #32]
	ldr	x0, [x20, #16]
Lloh13:
	adrp	x8, _BCMA_CC_FLASH_CFG@GOTPAGE
Lloh14:
	ldr	x8, [x8, _BCMA_CC_FLASH_CFG@GOTPAGEOFF]
Lloh15:
	ldr	w1, [x8]
	bl	_bcma_read32
Lloh16:
	adrp	x8, _BCMA_CC_FLASH_CFG_DS@GOTPAGE
Lloh17:
	ldr	x8, [x8, _BCMA_CC_FLASH_CFG_DS@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	tst	w8, w0
	cinc	w8, w21, ne
	str	w8, [x20, #28]
Lloh19:
	adrp	x9, _bcma_pflash_data@GOTPAGE
Lloh20:
	ldr	x9, [x9, _bcma_pflash_data@GOTPAGEOFF]
Lloh21:
	adrp	x10, _bcma_pflash_resource@GOTPAGE
Lloh22:
	ldr	x10, [x10, _bcma_pflash_resource@GOTPAGEOFF]
Lloh23:
	str	w8, [x9]
	ldp	x9, x8, [x20, #32]
	add	x9, x9, x8
	stp	x9, x8, [x10]
	b	LBB0_6
LBB0_5:
Lloh24:
	adrp	x1, l_.str.2@PAGE
Lloh25:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x20
	bl	_bcma_err
LBB0_6:
	ldr	x8, [x20, #16]
	ldr	w8, [x8]
	cmp	w8, #38
	b.eq	LBB0_8
; %bb.7:
	ldr	x8, [x20]
Lloh26:
	adrp	x9, _BCMA_CHIP_ID_BCM4706@GOTPAGE
Lloh27:
	ldr	x9, [x9, _BCMA_CHIP_ID_BCM4706@GOTPAGEOFF]
Lloh28:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_10
LBB0_8:
	ldr	w8, [x19]
Lloh29:
	adrp	x9, _BCMA_CC_CAP_NFLASH@GOTPAGE
Lloh30:
	ldr	x9, [x9, _BCMA_CC_CAP_NFLASH@GOTPAGEOFF]
Lloh31:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_10
; %bb.9:
Lloh32:
	adrp	x1, l_.str.3@PAGE
Lloh33:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x20
	bl	_bcma_debug
	mov	x0, x19
	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
	b	_bcma_nflash_init
LBB0_10:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotStr	Lloh19, Lloh20, Lloh23
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.cfi_endproc
                                        ; -- End function
	.comm	_BCMA_CC_CAP_FLASHT,4,2         ; @BCMA_CC_CAP_FLASHT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Found serial flash\n"

l_.str.1:                               ; @.str.1
	.asciz	"Found parallel flash\n"

	.comm	_BCMA_SOC_FLASH2,8,3            ; @BCMA_SOC_FLASH2
	.comm	_BCMA_SOC_FLASH2_SZ,8,3         ; @BCMA_SOC_FLASH2_SZ
	.comm	_BCMA_CC_FLASH_CFG,4,2          ; @BCMA_CC_FLASH_CFG
	.comm	_BCMA_CC_FLASH_CFG_DS,4,2       ; @BCMA_CC_FLASH_CFG_DS
	.comm	_bcma_pflash_data,4,2           ; @bcma_pflash_data
	.comm	_bcma_pflash_resource,16,3      ; @bcma_pflash_resource
l_.str.2:                               ; @.str.2
	.asciz	"Flash type not supported\n"

	.comm	_BCMA_CHIP_ID_BCM4706,8,3       ; @BCMA_CHIP_ID_BCM4706
	.comm	_BCMA_CC_CAP_NFLASH,4,2         ; @BCMA_CC_CAP_NFLASH
l_.str.3:                               ; @.str.3
	.asciz	"Found NAND flash\n"

	.no_dead_strip	_bcma_core_mips_flash_detect
.subsections_via_symbols
