	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ar8229_hw_init
_ar8229_hw_init:                        ## @ar8229_hw_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	xorl	%eax, %eax
	cmpl	$0, (%rdi)
	jne	LBB0_8
## %bb.1:
	movq	%rdi, %rbx
	movq	_AR8216_REG_CTRL@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	movq	_AR8216_CTRL_RESET@GOTPCREL(%rip), %r15
	movl	(%r15), %edx
	callq	_ar8xxx_write
	movl	(%r14), %esi
	movl	(%r15), %edx
	movq	%rbx, %rdi
	xorl	%ecx, %ecx
	movl	$1000, %r8d                     ## imm = 0x3E8
	callq	_ar8xxx_reg_wait
	movq	16(%rbx), %rax
	movl	(%rax), %edi
	callq	_of_get_phy_mode
	movq	_PHY_INTERFACE_MODE_GMII@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_3
## %bb.2:
	movq	_AR8229_OPER_MODE0_MAC_GMII_EN@GOTPCREL(%rip), %rax
	jmp	LBB0_5
LBB0_3:
	movq	_PHY_INTERFACE_MODE_MII@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_9
## %bb.4:
	movq	_AR8229_OPER_MODE0_PHY_MII_EN@GOTPCREL(%rip), %rax
LBB0_5:
	movq	_AR8229_REG_OPER_MODE0@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_ar8xxx_write
	cmpq	$0, 8(%rbx)
	je	LBB0_7
## %bb.6:
	movq	_AR8229_REG_OPER_MODE1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_AR8229_REG_OPER_MODE1_PHY4_MII_EN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	callq	_ar8xxx_write
	movl	$5, %edi
	callq	_AR8216_REG_PORT_STATUS
	movq	%rbx, %rdi
	movl	%eax, %esi
	xorl	%edx, %edx
	callq	_ar8xxx_write
LBB0_7:
	movq	%rbx, %rdi
	callq	_ar8xxx_phy_init
	movl	$1, (%rbx)
	xorl	%eax, %eax
	jmp	LBB0_8
LBB0_9:
	leaq	L_.str(%rip), %rdi
	callq	_pr_err
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_AR8216_REG_CTRL,4,2            ## @AR8216_REG_CTRL
	.comm	_AR8216_CTRL_RESET,4,2          ## @AR8216_CTRL_RESET
	.comm	_PHY_INTERFACE_MODE_GMII,4,2    ## @PHY_INTERFACE_MODE_GMII
	.comm	_AR8229_REG_OPER_MODE0,4,2      ## @AR8229_REG_OPER_MODE0
	.comm	_AR8229_OPER_MODE0_MAC_GMII_EN,4,2 ## @AR8229_OPER_MODE0_MAC_GMII_EN
	.comm	_PHY_INTERFACE_MODE_MII,4,2     ## @PHY_INTERFACE_MODE_MII
	.comm	_AR8229_OPER_MODE0_PHY_MII_EN,4,2 ## @AR8229_OPER_MODE0_PHY_MII_EN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ar8229: unsupported mii mode\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_AR8229_REG_OPER_MODE1,4,2      ## @AR8229_REG_OPER_MODE1
	.comm	_AR8229_REG_OPER_MODE1_PHY4_MII_EN,4,2 ## @AR8229_REG_OPER_MODE1_PHY4_MII_EN
	.no_dead_strip	_ar8229_hw_init
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ar8229_hw_init
_ar8229_hw_init:                        ; @ar8229_hw_init
	.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	w8, [x0]
	cbz	w8, LBB0_2
; %bb.1:
	mov	w0, #0
	b	LBB0_10
LBB0_2:
	mov	x19, x0
Lloh0:
	adrp	x20, _AR8216_REG_CTRL@GOTPAGE
Lloh1:
	ldr	x20, [x20, _AR8216_REG_CTRL@GOTPAGEOFF]
	ldr	w1, [x20]
Lloh2:
	adrp	x21, _AR8216_CTRL_RESET@GOTPAGE
Lloh3:
	ldr	x21, [x21, _AR8216_CTRL_RESET@GOTPAGEOFF]
	ldr	w2, [x21]
	bl	_ar8xxx_write
	ldr	w1, [x20]
	ldr	w2, [x21]
	mov	x0, x19
	mov	w3, #0
	mov	w4, #1000
	bl	_ar8xxx_reg_wait
	ldr	x8, [x19, #16]
	ldr	w0, [x8]
	bl	_of_get_phy_mode
Lloh4:
	adrp	x8, _PHY_INTERFACE_MODE_GMII@GOTPAGE
Lloh5:
	ldr	x8, [x8, _PHY_INTERFACE_MODE_GMII@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_4
; %bb.3:
Lloh7:
	adrp	x8, _AR8229_OPER_MODE0_MAC_GMII_EN@GOTPAGE
Lloh8:
	ldr	x8, [x8, _AR8229_OPER_MODE0_MAC_GMII_EN@GOTPAGEOFF]
	b	LBB0_6
LBB0_4:
Lloh9:
	adrp	x8, _PHY_INTERFACE_MODE_MII@GOTPAGE
Lloh10:
	ldr	x8, [x8, _PHY_INTERFACE_MODE_MII@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_9
; %bb.5:
Lloh12:
	adrp	x8, _AR8229_OPER_MODE0_PHY_MII_EN@GOTPAGE
Lloh13:
	ldr	x8, [x8, _AR8229_OPER_MODE0_PHY_MII_EN@GOTPAGEOFF]
LBB0_6:
Lloh14:
	adrp	x9, _AR8229_REG_OPER_MODE0@GOTPAGE
Lloh15:
	ldr	x9, [x9, _AR8229_REG_OPER_MODE0@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x9]
	ldr	w2, [x8]
	mov	x0, x19
	bl	_ar8xxx_write
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_8
; %bb.7:
Lloh17:
	adrp	x8, _AR8229_REG_OPER_MODE1@GOTPAGE
Lloh18:
	ldr	x8, [x8, _AR8229_REG_OPER_MODE1@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
Lloh20:
	adrp	x8, _AR8229_REG_OPER_MODE1_PHY4_MII_EN@GOTPAGE
Lloh21:
	ldr	x8, [x8, _AR8229_REG_OPER_MODE1_PHY4_MII_EN@GOTPAGEOFF]
Lloh22:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_ar8xxx_write
	mov	w0, #5
	bl	_AR8216_REG_PORT_STATUS
	mov	x1, x0
	mov	x0, x19
	mov	w2, #0
	bl	_ar8xxx_write
LBB0_8:
	mov	x0, x19
	bl	_ar8xxx_phy_init
	mov	w0, #0
	mov	w8, #1
	str	w8, [x19]
	b	LBB0_10
LBB0_9:
Lloh23:
	adrp	x0, l_.str@PAGE
Lloh24:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
Lloh25:
	adrp	x8, _EINVAL@GOTPAGE
Lloh26:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	neg	w0, w8
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	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_AR8216_REG_CTRL,4,2            ; @AR8216_REG_CTRL
	.comm	_AR8216_CTRL_RESET,4,2          ; @AR8216_CTRL_RESET
	.comm	_PHY_INTERFACE_MODE_GMII,4,2    ; @PHY_INTERFACE_MODE_GMII
	.comm	_AR8229_REG_OPER_MODE0,4,2      ; @AR8229_REG_OPER_MODE0
	.comm	_AR8229_OPER_MODE0_MAC_GMII_EN,4,2 ; @AR8229_OPER_MODE0_MAC_GMII_EN
	.comm	_PHY_INTERFACE_MODE_MII,4,2     ; @PHY_INTERFACE_MODE_MII
	.comm	_AR8229_OPER_MODE0_PHY_MII_EN,4,2 ; @AR8229_OPER_MODE0_PHY_MII_EN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ar8229: unsupported mii mode\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_AR8229_REG_OPER_MODE1,4,2      ; @AR8229_REG_OPER_MODE1
	.comm	_AR8229_REG_OPER_MODE1_PHY4_MII_EN,4,2 ; @AR8229_REG_OPER_MODE1_PHY4_MII_EN
	.no_dead_strip	_ar8229_hw_init
.subsections_via_symbols
