	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bcma_sflash_init               ## -- Begin function bcma_sflash_init
	.p2align	4, 0x90
_bcma_sflash_init:                      ## @bcma_sflash_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	movq	24(%rdi), %rax
	movq	(%rax), %r14
	movq	_BCMA_CC_CAP_FLASHT@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	(%rdi), %eax
	cmpl	$129, %eax
	je	LBB0_13
## %bb.1:
	cmpl	$128, %eax
	jne	LBB0_17
## %bb.2:
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	_BCMA_CC_FLASHCTL_ST_DP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_bcma_sflash_cmd
	movq	_BCMA_CC_FLASHADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%r12d, %r12d
	movq	%rbx, %rdi
	xorl	%edx, %edx
	callq	_bcma_cc_write32
	movq	_BCMA_CC_FLASHCTL_ST_RES@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_bcma_sflash_cmd
	movq	_BCMA_CC_FLASHDATA@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	movq	%rbx, %rdi
	callq	_bcma_cc_read32
	movl	%eax, %r15d
	movq	_BCMA_CC_FLASHADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	movl	$1, %edx
	callq	_bcma_cc_write32
	movl	(%r14), %esi
	movq	%rbx, %rdi
	callq	_bcma_sflash_cmd
	movl	(%r13), %esi
	movq	%rbx, %rdi
	callq	_bcma_cc_read32
	cmpl	$19, %r15d
	je	LBB0_18
## %bb.3:
	cmpl	$191, %r15d
	jne	LBB0_7
## %bb.4:
	movq	_bcma_sflash_sst_tbl@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpl	$0, 12(%rcx)
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_11
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	%eax, (%rcx)
	je	LBB0_11
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	leaq	16(%rcx), %rdx
	cmpl	$0, 28(%rcx)
	movq	%rdx, %rcx
	jne	LBB0_5
	jmp	LBB0_10
LBB0_13:
	movq	_BCMA_CC_FLASHCTL_AT_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_bcma_sflash_cmd
	movq	_BCMA_CC_FLASHDATA@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_bcma_cc_read32
	andl	$60, %eax
	movq	_bcma_sflash_at_tbl@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpl	$0, 12(%rcx)
	je	LBB0_16
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	cmpl	%eax, (%rcx)
	je	LBB0_19
## %bb.15:                              ##   in Loop: Header=BB0_14 Depth=1
	cmpl	$0, 28(%rcx)
	leaq	16(%rcx), %rcx
	jne	LBB0_14
LBB0_16:
	leaq	L_.str.1(%rip), %rsi
	xorl	%r12d, %r12d
	movq	%r14, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_bcma_err
	jmp	LBB0_18
LBB0_17:
	leaq	L_.str.2(%rip), %rsi
	xorl	%r12d, %r12d
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_bcma_err
	jmp	LBB0_18
LBB0_7:
	movq	_bcma_sflash_st_tbl@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	cmpl	$0, 12(%rcx)
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	je	LBB0_11
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	%r15d, (%rcx)
	je	LBB0_11
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	leaq	16(%rcx), %rdx
	cmpl	$0, 28(%rcx)
	movq	%rdx, %rcx
	jne	LBB0_8
LBB0_10:
	movq	%rdx, %rcx
LBB0_11:
	movl	12(%rcx), %edx
	testl	%edx, %edx
	jne	LBB0_20
## %bb.12:
	leaq	L_.str(%rip), %rsi
	xorl	%r12d, %r12d
	movq	%r14, %rdi
	movl	%r15d, %edx
	movl	%eax, %ecx
	xorl	%eax, %eax
	callq	_bcma_err
LBB0_18:
	movq	_ENOTSUPP@GOTPCREL(%rip), %rax
	subl	(%rax), %r12d
	jmp	LBB0_21
LBB0_19:
	movl	12(%rcx), %edx
LBB0_20:
	leaq	4(%rbx), %r15
	movq	_BCMA_SOC_FLASH2@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 20(%rbx)
	movl	4(%rcx), %r8d
	movl	%r8d, 4(%rbx)
	movl	8(%rcx), %r9d
	movl	%r9d, 8(%rbx)
	movl	%r9d, %eax
	imull	%r8d, %eax
	movl	%eax, 12(%rbx)
	movl	$1, 16(%rbx)
	leal	1023(%rax), %ecx
	testl	%eax, %eax
	cmovnsl	%eax, %ecx
	sarl	$10, %ecx
	leaq	L_.str.3(%rip), %rsi
	movq	%r14, %rdi
	callq	_bcma_info
	movq	_bcma_sflash_dev@GOTPCREL(%rip), %rax
	movq	8(%rax), %rcx
	movslq	12(%rbx), %rdx
	addq	(%rcx), %rdx
	movq	%rdx, 8(%rcx)
	movq	%r15, (%rax)
	xorl	%r12d, %r12d
LBB0_21:
	movl	%r12d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BCMA_CC_CAP_FLASHT,4,2         ## @BCMA_CC_CAP_FLASHT
	.comm	_BCMA_CC_FLASHCTL_ST_DP,4,2     ## @BCMA_CC_FLASHCTL_ST_DP
	.comm	_BCMA_CC_FLASHADDR,4,2          ## @BCMA_CC_FLASHADDR
	.comm	_BCMA_CC_FLASHCTL_ST_RES,4,2    ## @BCMA_CC_FLASHCTL_ST_RES
	.comm	_BCMA_CC_FLASHDATA,4,2          ## @BCMA_CC_FLASHDATA
	.comm	_bcma_sflash_sst_tbl,8,3        ## @bcma_sflash_sst_tbl
	.comm	_ENOTSUPP,4,2                   ## @ENOTSUPP
	.comm	_bcma_sflash_st_tbl,8,3         ## @bcma_sflash_st_tbl
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Unsupported ST serial flash (id: 0x%X, id2: 0x%X)\n"

	.comm	_BCMA_CC_FLASHCTL_AT_STATUS,4,2 ## @BCMA_CC_FLASHCTL_AT_STATUS
	.comm	_bcma_sflash_at_tbl,8,3         ## @bcma_sflash_at_tbl
L_.str.1:                               ## @.str.1
	.asciz	"Unsupported Atmel serial flash (id: 0x%X)\n"

L_.str.2:                               ## @.str.2
	.asciz	"Unsupported flash type\n"

	.comm	_BCMA_SOC_FLASH2,4,2            ## @BCMA_SOC_FLASH2
L_.str.3:                               ## @.str.3
	.asciz	"Found %s serial flash (size: %dKiB, blocksize: 0x%X, blocks: %d)\n"

	.comm	_bcma_sflash_dev,16,3           ## @bcma_sflash_dev
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bcma_sflash_init               ; -- Begin function bcma_sflash_init
	.p2align	2
_bcma_sflash_init:                      ; @bcma_sflash_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x20, x0
	ldr	x8, [x0, #24]
	ldr	x19, [x8]
	ldr	w8, [x0]
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, #129
	b.eq	LBB0_7
; %bb.1:
	cmp	w8, #128
	b.ne	LBB0_11
; %bb.2:
Lloh3:
	adrp	x8, _BCMA_CC_FLASHCTL_ST_DP@GOTPAGE
Lloh4:
	ldr	x8, [x8, _BCMA_CC_FLASHCTL_ST_DP@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_bcma_sflash_cmd
Lloh6:
	adrp	x22, _BCMA_CC_FLASHADDR@GOTPAGE
Lloh7:
	ldr	x22, [x22, _BCMA_CC_FLASHADDR@GOTPAGEOFF]
	ldr	w1, [x22]
	mov	x0, x20
	mov	w2, #0
	bl	_bcma_cc_write32
Lloh8:
	adrp	x23, _BCMA_CC_FLASHCTL_ST_RES@GOTPAGE
Lloh9:
	ldr	x23, [x23, _BCMA_CC_FLASHCTL_ST_RES@GOTPAGEOFF]
	ldr	w1, [x23]
	mov	x0, x20
	bl	_bcma_sflash_cmd
Lloh10:
	adrp	x24, _BCMA_CC_FLASHDATA@GOTPAGE
Lloh11:
	ldr	x24, [x24, _BCMA_CC_FLASHDATA@GOTPAGEOFF]
	ldr	w1, [x24]
	mov	x0, x20
	bl	_bcma_cc_read32
	mov	x21, x0
	ldr	w1, [x22]
	mov	x0, x20
	mov	w2, #1
	bl	_bcma_cc_write32
	ldr	w1, [x23]
	mov	x0, x20
	bl	_bcma_sflash_cmd
	ldr	w1, [x24]
	mov	x0, x20
	bl	_bcma_cc_read32
                                        ; kill: def $w0 killed $w0 def $x0
	cmp	w21, #19
	b.eq	LBB0_19
; %bb.3:
	cmp	w21, #191
	b.ne	LBB0_12
; %bb.4:
Lloh12:
	adrp	x8, _bcma_sflash_sst_tbl@GOTPAGE
Lloh13:
	ldr	x8, [x8, _bcma_sflash_sst_tbl@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	ldr	w9, [x8, #12]
	cbz	w9, LBB0_16
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w9, [x8]
	cmp	w9, w0
	b.eq	LBB0_16
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	add	x9, x8, #16
	ldr	w10, [x8, #28]
	mov	x8, x9
	cbnz	w10, LBB0_5
	b	LBB0_15
LBB0_7:
Lloh15:
	adrp	x8, _BCMA_CC_FLASHCTL_AT_STATUS@GOTPAGE
Lloh16:
	ldr	x8, [x8, _BCMA_CC_FLASHCTL_AT_STATUS@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_bcma_sflash_cmd
Lloh18:
	adrp	x8, _BCMA_CC_FLASHDATA@GOTPAGE
Lloh19:
	ldr	x8, [x8, _BCMA_CC_FLASHDATA@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	mov	x0, x20
	bl	_bcma_cc_read32
	and	w9, w0, #0x3c
Lloh21:
	adrp	x8, _bcma_sflash_at_tbl@GOTPAGE
Lloh22:
	ldr	x8, [x8, _bcma_sflash_at_tbl@GOTPAGEOFF]
Lloh23:
	ldr	x8, [x8]
	ldr	w10, [x8, #12]
	cbz	w10, LBB0_10
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x8]
	cmp	w10, w9
	b.eq	LBB0_20
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	ldr	w10, [x8, #28]
	add	x8, x8, #16
	cbnz	w10, LBB0_8
LBB0_10:
	str	x9, [sp]
Lloh24:
	adrp	x1, l_.str.1@PAGE
Lloh25:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_18
LBB0_11:
Lloh26:
	adrp	x1, l_.str.2@PAGE
Lloh27:
	add	x1, x1, l_.str.2@PAGEOFF
	b	LBB0_18
LBB0_12:
Lloh28:
	adrp	x8, _bcma_sflash_st_tbl@GOTPAGE
Lloh29:
	ldr	x8, [x8, _bcma_sflash_st_tbl@GOTPAGEOFF]
Lloh30:
	ldr	x8, [x8]
	ldr	w9, [x8, #12]
	cbz	w9, LBB0_16
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	w9, [x8]
	cmp	w9, w21
	b.eq	LBB0_16
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	add	x9, x8, #16
	ldr	w10, [x8, #28]
	mov	x8, x9
	cbnz	w10, LBB0_13
LBB0_15:
	mov	x8, x9
LBB0_16:
	ldr	w2, [x8, #12]
	cbnz	w2, LBB0_21
; %bb.17:
	stp	x21, x0, [sp]
Lloh31:
	adrp	x1, l_.str@PAGE
Lloh32:
	add	x1, x1, l_.str@PAGEOFF
LBB0_18:
	mov	x0, x19
	bl	_bcma_err
LBB0_19:
Lloh33:
	adrp	x8, _ENOTSUPP@GOTPAGE
Lloh34:
	ldr	x8, [x8, _ENOTSUPP@GOTPAGEOFF]
Lloh35:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_22
LBB0_20:
	ldr	w2, [x8, #12]
LBB0_21:
	add	x21, x20, #4
Lloh36:
	adrp	x9, _BCMA_SOC_FLASH2@GOTPAGE
Lloh37:
	ldr	x9, [x9, _BCMA_SOC_FLASH2@GOTPAGEOFF]
Lloh38:
	ldr	w9, [x9]
	str	w9, [x20, #20]
	ldp	w4, w5, [x8, #4]
	stp	w4, w5, [x20, #4]
	mul	w8, w5, w4
	mov	w9, #1
	stp	w8, w9, [x20, #12]
	add	w9, w8, #1023
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w3, w8, #10
Lloh39:
	adrp	x1, l_.str.3@PAGE
Lloh40:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_bcma_info
	mov	w0, #0
Lloh41:
	adrp	x8, _bcma_sflash_dev@GOTPAGE
Lloh42:
	ldr	x8, [x8, _bcma_sflash_dev@GOTPAGEOFF]
	ldr	x9, [x8, #8]
	ldr	x10, [x9]
	ldrsw	x11, [x20, #12]
	add	x10, x10, x11
	str	x10, [x9, #8]
	str	x21, [x8]
LBB0_22:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGot	Lloh41, Lloh42
	.loh AdrpAdd	Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.cfi_endproc
                                        ; -- End function
	.comm	_BCMA_CC_CAP_FLASHT,4,2         ; @BCMA_CC_CAP_FLASHT
	.comm	_BCMA_CC_FLASHCTL_ST_DP,4,2     ; @BCMA_CC_FLASHCTL_ST_DP
	.comm	_BCMA_CC_FLASHADDR,4,2          ; @BCMA_CC_FLASHADDR
	.comm	_BCMA_CC_FLASHCTL_ST_RES,4,2    ; @BCMA_CC_FLASHCTL_ST_RES
	.comm	_BCMA_CC_FLASHDATA,4,2          ; @BCMA_CC_FLASHDATA
	.comm	_bcma_sflash_sst_tbl,8,3        ; @bcma_sflash_sst_tbl
	.comm	_ENOTSUPP,4,2                   ; @ENOTSUPP
	.comm	_bcma_sflash_st_tbl,8,3         ; @bcma_sflash_st_tbl
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Unsupported ST serial flash (id: 0x%X, id2: 0x%X)\n"

	.comm	_BCMA_CC_FLASHCTL_AT_STATUS,4,2 ; @BCMA_CC_FLASHCTL_AT_STATUS
	.comm	_bcma_sflash_at_tbl,8,3         ; @bcma_sflash_at_tbl
l_.str.1:                               ; @.str.1
	.asciz	"Unsupported Atmel serial flash (id: 0x%X)\n"

l_.str.2:                               ; @.str.2
	.asciz	"Unsupported flash type\n"

	.comm	_BCMA_SOC_FLASH2,4,2            ; @BCMA_SOC_FLASH2
l_.str.3:                               ; @.str.3
	.asciz	"Found %s serial flash (size: %dKiB, blocksize: 0x%X, blocks: %d)\n"

	.comm	_bcma_sflash_dev,16,3           ; @bcma_sflash_dev
.subsections_via_symbols
