	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function bcma_mdio_phy_write
_bcma_mdio_phy_write:                   ## @bcma_mdio_phy_write
	.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
	movl	%ecx, %ebx
	movl	%esi, %r13d
	movq	%rdi, %r14
	movq	(%rdi), %r12
	movq	16(%r12), %rax
	movq	_BCMA_CORE_4706_MAC_GBIT@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movl	%edx, -52(%rbp)                 ## 4-byte Spill
	jne	LBB0_1
## %bb.2:
	movq	8(%r12), %rax
	movq	(%rax), %r12
	movq	_BCMA_GMAC_CMN_PHY_CTL@GOTPCREL(%rip), %rax
	movq	_BCMA_GMAC_CMN_PHY_ACCESS@GOTPCREL(%rip), %rcx
	jmp	LBB0_3
LBB0_1:
	movq	_BGMAC_PHY_CNTL@GOTPCREL(%rip), %rax
	movq	_BGMAC_PHY_ACCESS@GOTPCREL(%rip), %rcx
LBB0_3:
	movl	(%rax), %r15d
	movl	(%rcx), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_bcma_read32
	movq	_BGMAC_PC_EPA_MASK@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	notl	%edx
	andl	%eax, %edx
	movl	%r13d, -44(%rbp)                ## 4-byte Spill
	orl	%r13d, %edx
	movq	%r12, %rdi
	movl	%r15d, %esi
	callq	_bcma_write32
	movq	(%r14), %rdi
	movq	_BGMAC_INT_STATUS@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	movq	_BGMAC_IS_MDIO@GOTPCREL(%rip), %r13
	movl	(%r13), %edx
	callq	_bcma_write32
	movq	(%r14), %rdi
	movl	(%r15), %esi
	callq	_bcma_read32
	testl	%eax, (%r13)
	je	LBB0_5
## %bb.4:
	leaq	L_.str(%rip), %rsi
	movq	%r12, %rdi
	callq	_dev_warn
LBB0_5:
	movq	_BGMAC_PA_ADDR_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	shll	%cl, %eax
	movq	_BGMAC_PA_REG_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	-52(%rbp), %r15d                ## 4-byte Reload
	movl	%r15d, %edx
	shll	%cl, %edx
	movq	_BGMAC_PA_START@GOTPCREL(%rip), %r14
	movq	_BGMAC_PA_WRITE@GOTPCREL(%rip), %rcx
	orl	(%r14), %ebx
	orl	(%rcx), %ebx
	orl	%eax, %ebx
	orl	%edx, %ebx
	movq	%r12, %rdi
	movl	-48(%rbp), %r13d                ## 4-byte Reload
	movl	%r13d, %esi
	movl	%ebx, %edx
	callq	_bcma_write32
	movl	(%r14), %edx
	xorl	%ebx, %ebx
	movq	%r12, %rdi
	movl	%r13d, %esi
	xorl	%ecx, %ecx
	movl	$1000, %r8d                     ## imm = 0x3E8
	callq	_bcma_mdio_wait_value
	testl	%eax, %eax
	jne	LBB0_7
## %bb.6:
	leaq	L_.str.1(%rip), %rsi
	movq	%r12, %rdi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	movl	%r15d, %ecx
	callq	_dev_err
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_7:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_BCMA_CORE_4706_MAC_GBIT,8,3    ## @BCMA_CORE_4706_MAC_GBIT
	.comm	_BCMA_GMAC_CMN_PHY_ACCESS,4,2   ## @BCMA_GMAC_CMN_PHY_ACCESS
	.comm	_BCMA_GMAC_CMN_PHY_CTL,4,2      ## @BCMA_GMAC_CMN_PHY_CTL
	.comm	_BGMAC_PHY_ACCESS,4,2           ## @BGMAC_PHY_ACCESS
	.comm	_BGMAC_PHY_CNTL,4,2             ## @BGMAC_PHY_CNTL
	.comm	_BGMAC_PC_EPA_MASK,4,2          ## @BGMAC_PC_EPA_MASK
	.comm	_BGMAC_INT_STATUS,4,2           ## @BGMAC_INT_STATUS
	.comm	_BGMAC_IS_MDIO,4,2              ## @BGMAC_IS_MDIO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Error setting MDIO int\n"

	.comm	_BGMAC_PA_START,4,2             ## @BGMAC_PA_START
	.comm	_BGMAC_PA_WRITE,4,2             ## @BGMAC_PA_WRITE
	.comm	_BGMAC_PA_ADDR_SHIFT,4,2        ## @BGMAC_PA_ADDR_SHIFT
	.comm	_BGMAC_PA_REG_SHIFT,4,2         ## @BGMAC_PA_REG_SHIFT
L_.str.1:                               ## @.str.1
	.asciz	"Writing to PHY %d register 0x%X failed\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.no_dead_strip	_bcma_mdio_phy_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function bcma_mdio_phy_write
_bcma_mdio_phy_write:                   ; @bcma_mdio_phy_write
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x22, x3
	mov	x19, x2
	mov	x20, x1
	mov	x24, x0
	ldr	x21, [x0]
	ldr	x8, [x21, #16]
Lloh0:
	adrp	x9, _BCMA_CORE_4706_MAC_GBIT@GOTPAGE
Lloh1:
	ldr	x9, [x9, _BCMA_CORE_4706_MAC_GBIT@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_2
; %bb.1:
	ldr	x8, [x21, #8]
	ldr	x21, [x8]
Lloh3:
	adrp	x8, _BCMA_GMAC_CMN_PHY_CTL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _BCMA_GMAC_CMN_PHY_CTL@GOTPAGEOFF]
Lloh5:
	adrp	x9, _BCMA_GMAC_CMN_PHY_ACCESS@GOTPAGE
Lloh6:
	ldr	x9, [x9, _BCMA_GMAC_CMN_PHY_ACCESS@GOTPAGEOFF]
	b	LBB0_3
LBB0_2:
Lloh7:
	adrp	x8, _BGMAC_PHY_CNTL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _BGMAC_PHY_CNTL@GOTPAGEOFF]
Lloh9:
	adrp	x9, _BGMAC_PHY_ACCESS@GOTPAGE
Lloh10:
	ldr	x9, [x9, _BGMAC_PHY_ACCESS@GOTPAGEOFF]
LBB0_3:
	ldr	w25, [x8]
	ldr	w23, [x9]
	mov	x0, x21
	mov	x1, x25
	bl	_bcma_read32
Lloh11:
	adrp	x8, _BGMAC_PC_EPA_MASK@GOTPAGE
Lloh12:
	ldr	x8, [x8, _BGMAC_PC_EPA_MASK@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	bic	w8, w0, w8
	orr	w2, w8, w20
	mov	x0, x21
	mov	x1, x25
	bl	_bcma_write32
	ldr	x0, [x24]
Lloh14:
	adrp	x25, _BGMAC_INT_STATUS@GOTPAGE
Lloh15:
	ldr	x25, [x25, _BGMAC_INT_STATUS@GOTPAGEOFF]
	ldr	w1, [x25]
Lloh16:
	adrp	x26, _BGMAC_IS_MDIO@GOTPAGE
Lloh17:
	ldr	x26, [x26, _BGMAC_IS_MDIO@GOTPAGEOFF]
	ldr	w2, [x26]
	bl	_bcma_write32
	ldr	x0, [x24]
	ldr	w1, [x25]
	bl	_bcma_read32
	ldr	w8, [x26]
	tst	w8, w0
	b.eq	LBB0_5
; %bb.4:
Lloh18:
	adrp	x1, l_.str@PAGE
Lloh19:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	bl	_dev_warn
LBB0_5:
Lloh20:
	adrp	x24, _BGMAC_PA_START@GOTPAGE
Lloh21:
	ldr	x24, [x24, _BGMAC_PA_START@GOTPAGEOFF]
	ldr	w8, [x24]
Lloh22:
	adrp	x9, _BGMAC_PA_WRITE@GOTPAGE
Lloh23:
	ldr	x9, [x9, _BGMAC_PA_WRITE@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
Lloh25:
	adrp	x10, _BGMAC_PA_ADDR_SHIFT@GOTPAGE
Lloh26:
	ldr	x10, [x10, _BGMAC_PA_ADDR_SHIFT@GOTPAGEOFF]
Lloh27:
	ldr	w10, [x10]
	lsl	w10, w20, w10
Lloh28:
	adrp	x11, _BGMAC_PA_REG_SHIFT@GOTPAGE
Lloh29:
	ldr	x11, [x11, _BGMAC_PA_REG_SHIFT@GOTPAGEOFF]
Lloh30:
	ldr	w11, [x11]
	lsl	w11, w19, w11
	orr	w8, w8, w22
	orr	w8, w8, w9
	orr	w8, w8, w10
	orr	w2, w8, w11
	mov	x0, x21
	mov	x1, x23
	bl	_bcma_write32
	ldr	w2, [x24]
	mov	x0, x21
	mov	x1, x23
	mov	w3, #0
	mov	w4, #1000
	bl	_bcma_mdio_wait_value
	mov	x8, x0
	mov	w0, #0
	cbnz	w8, LBB0_7
; %bb.6:
Lloh31:
	adrp	x1, l_.str.1@PAGE
Lloh32:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x21
	mov	x2, x20
	mov	x3, x19
	bl	_dev_err
Lloh33:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh34:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
Lloh35:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_7:
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpAdd	Lloh31, Lloh32
	.cfi_endproc
                                        ; -- End function
	.comm	_BCMA_CORE_4706_MAC_GBIT,8,3    ; @BCMA_CORE_4706_MAC_GBIT
	.comm	_BCMA_GMAC_CMN_PHY_ACCESS,4,2   ; @BCMA_GMAC_CMN_PHY_ACCESS
	.comm	_BCMA_GMAC_CMN_PHY_CTL,4,2      ; @BCMA_GMAC_CMN_PHY_CTL
	.comm	_BGMAC_PHY_ACCESS,4,2           ; @BGMAC_PHY_ACCESS
	.comm	_BGMAC_PHY_CNTL,4,2             ; @BGMAC_PHY_CNTL
	.comm	_BGMAC_PC_EPA_MASK,4,2          ; @BGMAC_PC_EPA_MASK
	.comm	_BGMAC_INT_STATUS,4,2           ; @BGMAC_INT_STATUS
	.comm	_BGMAC_IS_MDIO,4,2              ; @BGMAC_IS_MDIO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Error setting MDIO int\n"

	.comm	_BGMAC_PA_START,4,2             ; @BGMAC_PA_START
	.comm	_BGMAC_PA_WRITE,4,2             ; @BGMAC_PA_WRITE
	.comm	_BGMAC_PA_ADDR_SHIFT,4,2        ; @BGMAC_PA_ADDR_SHIFT
	.comm	_BGMAC_PA_REG_SHIFT,4,2         ; @BGMAC_PA_REG_SHIFT
l_.str.1:                               ; @.str.1
	.asciz	"Writing to PHY %d register 0x%X failed\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.no_dead_strip	_bcma_mdio_phy_write
.subsections_via_symbols
