	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cpmac_init                     ## -- Begin function cpmac_init
	.p2align	4, 0x90
_cpmac_init:                            ## @cpmac_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_mdiobus_alloc
	movq	_cpmac_mii@GOTPCREL(%rip), %r14
	movq	%rax, (%r14)
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	leaq	L_.str(%rip), %rcx
	movq	%rcx, (%rax)
	movq	_cpmac_mdio_read@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	(%r14), %rcx
	movl	%eax, 36(%rcx)
	movq	_cpmac_mdio_write@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 32(%rcx)
	movq	_cpmac_mdio_reset@GOTPCREL(%rip), %rax
	movq	%rax, 24(%rcx)
	movq	_AR7_REGS_MDIO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	$256, %esi                      ## imm = 0x100
	callq	_ioremap
	movq	(%r14), %rcx
	movl	%eax, 12(%rcx)
	testl	%eax, %eax
	je	LBB0_3
## %bb.4:
	movl	$26, %edi
	callq	_ar7_gpio_disable
	movl	$27, %edi
	callq	_ar7_gpio_disable
	movq	_AR7_RESET_BIT_CPMAC_LO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ar7_device_reset
	movq	_AR7_RESET_BIT_CPMAC_HI@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ar7_device_reset
	movq	_AR7_RESET_BIT_EPHY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ar7_device_reset
	movq	(%r14), %rdi
	callq	*24(%rdi)
	movl	$300, %ebx                      ## imm = 0x12C
	movq	_CPMAC_MDIO_ALIVE@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r14), %rax
	movl	12(%rax), %edi
	movl	(%r12), %esi
	callq	_cpmac_read
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	$10, %edi
	callq	_msleep
	decl	%ebx
	jne	LBB0_5
LBB0_7:
	andl	$2147483647, %r15d              ## imm = 0x7FFFFFFF
	leal	-1(%r15), %eax
	testl	%eax, %r15d
	je	LBB0_9
## %bb.8:
	movq	_external_switch@GOTPCREL(%rip), %rax
	movl	$1, (%rax)
	xorl	%r15d, %r15d
LBB0_9:
	xorl	$2147483647, %r15d              ## imm = 0x7FFFFFFF
	movq	(%r14), %rax
	movl	%r15d, 8(%rax)
	movl	16(%rax), %edi
	movq	_MII_BUS_ID_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.2(%rip), %rdx
	callq	_snprintf
	movq	(%r14), %rdi
	callq	_mdiobus_register
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_13
## %bb.10:
	movq	_cpmac_driver@GOTPCREL(%rip), %rdi
	callq	_platform_driver_register
	testl	%eax, %eax
	je	LBB0_11
## %bb.12:
	movl	%eax, %ebx
	movq	(%r14), %rdi
	callq	_mdiobus_unregister
LBB0_13:
	movq	(%r14), %rax
	movl	12(%rax), %edi
	callq	_iounmap
	jmp	LBB0_14
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_15
LBB0_3:
	leaq	L_.str.1(%rip), %rdi
	callq	_pr_err
	movq	_ENXIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_14:
	movq	(%r14), %rdi
	callq	_mdiobus_free
LBB0_15:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	xorl	%ebx, %ebx
	jmp	LBB0_15
	.cfi_endproc
                                        ## -- End function
	.comm	_cpmac_mii,8,3                  ## @cpmac_mii
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"cpmac-mii"

	.comm	_cpmac_mdio_read,4,2            ## @cpmac_mdio_read
	.comm	_cpmac_mdio_write,4,2           ## @cpmac_mdio_write
	.comm	_AR7_REGS_MDIO,4,2              ## @AR7_REGS_MDIO
L_.str.1:                               ## @.str.1
	.asciz	"Can't ioremap mdio registers\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_AR7_RESET_BIT_CPMAC_LO,4,2     ## @AR7_RESET_BIT_CPMAC_LO
	.comm	_AR7_RESET_BIT_CPMAC_HI,4,2     ## @AR7_RESET_BIT_CPMAC_HI
	.comm	_AR7_RESET_BIT_EPHY,4,2         ## @AR7_RESET_BIT_EPHY
	.comm	_CPMAC_MDIO_ALIVE,4,2           ## @CPMAC_MDIO_ALIVE
	.comm	_external_switch,4,2            ## @external_switch
	.comm	_MII_BUS_ID_SIZE,4,2            ## @MII_BUS_ID_SIZE
L_.str.2:                               ## @.str.2
	.asciz	"cpmac-1"

	.comm	_cpmac_driver,4,2               ## @cpmac_driver
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_cpmac_init                     ; -- Begin function cpmac_init
	.p2align	2
_cpmac_init:                            ; @cpmac_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
	bl	_mdiobus_alloc
Lloh0:
	adrp	x20, _cpmac_mii@GOTPAGE
Lloh1:
	ldr	x20, [x20, _cpmac_mii@GOTPAGEOFF]
	str	x0, [x20]
	cbz	x0, LBB0_11
; %bb.1:
Lloh2:
	adrp	x8, l_.str@PAGE
Lloh3:
	add	x8, x8, l_.str@PAGEOFF
	str	x8, [x0]
Lloh4:
	adrp	x8, _cpmac_mdio_read@GOTPAGE
Lloh5:
	ldr	x8, [x8, _cpmac_mdio_read@GOTPAGEOFF]
Lloh6:
	ldr	w8, [x8]
	ldr	x9, [x20]
Lloh7:
	adrp	x10, _cpmac_mdio_write@GOTPAGE
Lloh8:
	ldr	x10, [x10, _cpmac_mdio_write@GOTPAGEOFF]
Lloh9:
	ldr	w10, [x10]
	stp	w10, w8, [x9, #32]
Lloh10:
	adrp	x8, _cpmac_mdio_reset@GOTPAGE
Lloh11:
	ldr	x8, [x8, _cpmac_mdio_reset@GOTPAGEOFF]
	str	x8, [x9, #24]
Lloh12:
	adrp	x8, _AR7_REGS_MDIO@GOTPAGE
Lloh13:
	ldr	x8, [x8, _AR7_REGS_MDIO@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
	mov	w1, #256
	bl	_ioremap
	ldr	x8, [x20]
	str	w0, [x8, #12]
	cbz	w0, LBB0_12
; %bb.2:
	mov	w0, #26
	bl	_ar7_gpio_disable
	mov	w0, #27
	bl	_ar7_gpio_disable
Lloh15:
	adrp	x8, _AR7_RESET_BIT_CPMAC_LO@GOTPAGE
Lloh16:
	ldr	x8, [x8, _AR7_RESET_BIT_CPMAC_LO@GOTPAGEOFF]
Lloh17:
	ldr	w0, [x8]
	bl	_ar7_device_reset
Lloh18:
	adrp	x8, _AR7_RESET_BIT_CPMAC_HI@GOTPAGE
Lloh19:
	ldr	x8, [x8, _AR7_RESET_BIT_CPMAC_HI@GOTPAGEOFF]
Lloh20:
	ldr	w0, [x8]
	bl	_ar7_device_reset
Lloh21:
	adrp	x8, _AR7_RESET_BIT_EPHY@GOTPAGE
Lloh22:
	ldr	x8, [x8, _AR7_RESET_BIT_EPHY@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
	bl	_ar7_device_reset
	ldr	x0, [x20]
	ldr	x8, [x0, #24]
	blr	x8
	mov	w21, #300
Lloh24:
	adrp	x22, _CPMAC_MDIO_ALIVE@GOTPAGE
Lloh25:
	ldr	x22, [x22, _CPMAC_MDIO_ALIVE@GOTPAGEOFF]
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20]
	ldr	w0, [x8, #12]
	ldr	w1, [x22]
	bl	_cpmac_read
	mov	x19, x0
	cbnz	w0, LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w0, #10
	bl	_msleep
	subs	w21, w21, #1
	b.ne	LBB0_3
LBB0_5:
	and	w8, w19, #0x7fffffff
	sub	w9, w8, #1
	tst	w8, w9
	b.eq	LBB0_7
; %bb.6:
	mov	w8, #0
Lloh26:
	adrp	x9, _external_switch@GOTPAGE
Lloh27:
	ldr	x9, [x9, _external_switch@GOTPAGEOFF]
	mov	w10, #1
Lloh28:
	str	w10, [x9]
LBB0_7:
	eor	w8, w8, #0x7fffffff
	ldr	x9, [x20]
	str	w8, [x9, #8]
	ldr	w0, [x9, #16]
Lloh29:
	adrp	x8, _MII_BUS_ID_SIZE@GOTPAGE
Lloh30:
	ldr	x8, [x8, _MII_BUS_ID_SIZE@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
Lloh32:
	adrp	x2, l_.str.2@PAGE
Lloh33:
	add	x2, x2, l_.str.2@PAGEOFF
	bl	_snprintf
	ldr	x0, [x20]
	bl	_mdiobus_register
	mov	x19, x0
	cbnz	w0, LBB0_10
; %bb.8:
Lloh34:
	adrp	x0, _cpmac_driver@GOTPAGE
Lloh35:
	ldr	x0, [x0, _cpmac_driver@GOTPAGEOFF]
	bl	_platform_driver_register
	mov	x19, x0
	cbz	w0, LBB0_14
; %bb.9:
	ldr	x0, [x20]
	bl	_mdiobus_unregister
LBB0_10:
	ldr	x8, [x20]
	ldr	w0, [x8, #12]
	bl	_iounmap
	b	LBB0_13
LBB0_11:
Lloh36:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh37:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh38:
	ldr	w8, [x8]
	neg	w19, w8
	b	LBB0_14
LBB0_12:
Lloh39:
	adrp	x0, l_.str.1@PAGE
Lloh40:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_err
Lloh41:
	adrp	x8, _ENXIO@GOTPAGE
Lloh42:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh43:
	ldr	w8, [x8]
	neg	w19, w8
LBB0_13:
	ldr	x0, [x20]
	bl	_mdiobus_free
LBB0_14:
	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
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotStr	Lloh26, Lloh27, Lloh28
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGot	Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpAdd	Lloh39, Lloh40
	.cfi_endproc
                                        ; -- End function
	.comm	_cpmac_mii,8,3                  ; @cpmac_mii
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"cpmac-mii"

	.comm	_cpmac_mdio_read,4,2            ; @cpmac_mdio_read
	.comm	_cpmac_mdio_write,4,2           ; @cpmac_mdio_write
	.comm	_AR7_REGS_MDIO,4,2              ; @AR7_REGS_MDIO
l_.str.1:                               ; @.str.1
	.asciz	"Can't ioremap mdio registers\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_AR7_RESET_BIT_CPMAC_LO,4,2     ; @AR7_RESET_BIT_CPMAC_LO
	.comm	_AR7_RESET_BIT_CPMAC_HI,4,2     ; @AR7_RESET_BIT_CPMAC_HI
	.comm	_AR7_RESET_BIT_EPHY,4,2         ; @AR7_RESET_BIT_EPHY
	.comm	_CPMAC_MDIO_ALIVE,4,2           ; @CPMAC_MDIO_ALIVE
	.comm	_external_switch,4,2            ; @external_switch
	.comm	_MII_BUS_ID_SIZE,4,2            ; @MII_BUS_ID_SIZE
l_.str.2:                               ; @.str.2
	.asciz	"cpmac-1"

	.comm	_cpmac_driver,4,2               ; @cpmac_driver
.subsections_via_symbols
