	.file	"extr_cassini.c_cas_mii_link_check.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"Got link after fallback, retrying autoneg once...\n"
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"Link down\n"
	.text
	.p2align 4
	.type	cas_mii_link_check, @function
cas_mii_link_check:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	push	rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	mov	rbp, rdi
	sub	rsp, 8
	.cfi_def_cfa_offset 32
	mov	rax, QWORD PTR [rdi]
	and	esi, DWORD PTR BMSR_LSTATUS[rip]
	jne	.L16
	cmp	QWORD PTR link_up[rip], rax
	je	.L17
	mov	eax, DWORD PTR 16[rdi]
	add	eax, 1
	mov	DWORD PTR 16[rdi], eax
	cmp	eax, 10
	jg	.L18
.L14:
	xor	r12d, r12d
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	mov	eax, r12d
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	cmp	QWORD PTR link_force_try[rip], rax
	je	.L19
.L3:
	mov	rdx, QWORD PTR link_up[rip]
	cmp	rdx, rax
	je	.L14
	mov	eax, DWORD PTR LINK_TRANSITION_LINK_UP[rip]
	cmp	QWORD PTR 24[rbp], 0
	mov	QWORD PTR 0[rbp], rdx
	mov	DWORD PTR 32[rbp], eax
	je	.L14
	mov	rdi, rbp
	call	cas_set_link_modes@PLT
	mov	edi, DWORD PTR 20[rbp]
	call	netif_carrier_on@PLT
	jmp	.L14
	.p2align 4,,10
	.p2align 3
.L18:
	mov	r12d, esi
	call	cas_mdio_link_not_up@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	mov	eax, r12d
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	mov	rax, QWORD PTR link_down[rip]
	mov	r12d, 1
	mov	QWORD PTR [rdi], rax
	mov	eax, DWORD PTR LINK_TRANSITION_LINK_DOWN[rip]
	mov	DWORD PTR 32[rdi], eax
	mov	edi, DWORD PTR 20[rdi]
	call	netif_carrier_off@PLT
	cmp	QWORD PTR 24[rbp], 0
	je	.L1
	mov	edx, DWORD PTR 20[rbp]
	mov	esi, DWORD PTR link[rip]
	lea	rcx, .LC1[rip]
	mov	rdi, rbp
	call	netif_info@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L19:
	mov	edx, DWORD PTR 8[rdi]
	test	DWORD PTR BMCR_ANENABLE[rip], edx
	je	.L3
	mov	rax, QWORD PTR link_force_ret[rip]
	xor	esi, esi
	mov	QWORD PTR [rdi], rax
	mov	eax, DWORD PTR LINK_TRANSITION_LINK_CONFIG[rip]
	mov	DWORD PTR 32[rdi], eax
	call	cas_mif_poll@PLT
	mov	esi, DWORD PTR MII_BMCR[rip]
	mov	rdi, rbp
	call	cas_phy_read@PLT
	cmp	QWORD PTR 24[rbp], 0
	mov	DWORD PTR 16[rbp], 5
	mov	DWORD PTR 12[rbp], eax
	jne	.L20
.L4:
	mov	edx, DWORD PTR BMCR_ANENABLE[rip]
	mov	esi, DWORD PTR MII_BMCR[rip]
	mov	rdi, rbp
	xor	r12d, r12d
	or	edx, DWORD PTR BMCR_ANRESTART[rip]
	or	edx, eax
	call	cas_phy_write@PLT
	mov	esi, 1
	mov	rdi, rbp
	call	cas_mif_poll@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L20:
	mov	edx, DWORD PTR 20[rbp]
	mov	esi, DWORD PTR link[rip]
	lea	rcx, .LC0[rip]
	mov	rdi, rbp
	call	netif_info@PLT
	mov	eax, DWORD PTR 12[rbp]
	jmp	.L4
	.cfi_endproc
.LFE0:
	.size	cas_mii_link_check, .-cas_mii_link_check
	.comm	link_up,8,8
	.comm	link_force_try,8,8
	.comm	link_force_ret,8,8
	.comm	link_down,8,8
	.comm	link,4,4
	.comm	MII_BMCR,4,4
	.comm	LINK_TRANSITION_LINK_UP,4,4
	.comm	LINK_TRANSITION_LINK_DOWN,4,4
	.comm	LINK_TRANSITION_LINK_CONFIG,4,4
	.comm	BMSR_LSTATUS,4,4
	.comm	BMCR_ANRESTART,4,4
	.comm	BMCR_ANENABLE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_cassini.c_cas_mii_link_check.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Got link after fallback, retrying autoneg once...\012"
	.ascii	"\000"
	.align	2
.LC1:
	.ascii	"Link down\012\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	cas_mii_link_check, %function
cas_mii_link_check:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	ldr	r2, .L27
	push	{r4, r5, r6, lr}
	ldr	r5, [r2]
	mov	r4, r0
	ands	r5, r1, r5
	ldr	r3, [r0]
	bne	.L22
	ldr	r2, .L27+4
	ldr	r2, [r2]
	cmp	r2, r3
	beq	.L23
	ldr	r3, [r0, #12]
	add	r3, r3, #1
	cmp	r3, #10
	str	r3, [r0, #12]
	bgt	.L24
.L20:
	mov	r5, #0
.L1:
	mov	r0, r5
	pop	{r4, r5, r6, pc}
.L22:
	ldr	r2, .L27+8
	ldr	r2, [r2]
	cmp	r2, r3
	beq	.L25
.L3:
	ldr	r2, .L27+4
	ldr	r2, [r2]
	cmp	r2, r3
	beq	.L20
	ldr	r3, .L27+12
	ldr	r1, [r4, #20]
	ldr	r3, [r3]
	cmp	r1, #0
	str	r2, [r4]
	str	r3, [r4, #24]
	beq	.L20
	mov	r0, r4
	bl	cas_set_link_modes
	ldr	r0, [r4, #16]
	bl	netif_carrier_on
	b	.L20
.L24:
	bl	cas_mdio_link_not_up
	mov	r0, r5
	pop	{r4, r5, r6, pc}
.L23:
	ldr	r2, .L27+16
	ldr	r3, .L27+20
	ldr	r2, [r2]
	ldr	r3, [r3]
	str	r2, [r0]
	str	r3, [r0, #24]
	ldr	r0, [r0, #16]
	bl	netif_carrier_off
	ldr	r3, [r4, #20]
	cmp	r3, #0
	moveq	r5, #1
	beq	.L1
	ldr	r2, .L27+24
	mov	r0, r4
	ldr	r1, [r2]
	ldr	r3, .L27+28
	ldr	r2, [r4, #16]
	bl	netif_info
	mov	r5, #1
	b	.L1
.L25:
	ldr	r5, .L27+32
	ldr	r1, [r0, #4]
	ldr	r2, [r5]
	tst	r1, r2
	beq	.L3
	ldr	r2, .L27+36
	ldr	r3, .L27+40
	ldr	r2, [r2]
	ldr	r3, [r3]
	ldr	r6, .L27+44
	str	r2, [r0]
	str	r3, [r0, #24]
	mov	r1, #0
	bl	cas_mif_poll
	mov	r0, r4
	ldr	r1, [r6]
	bl	cas_phy_read
	mov	r3, #5
	ldr	r2, [r4, #20]
	str	r0, [r4, #8]
	cmp	r2, #0
	str	r3, [r4, #12]
	bne	.L26
.L4:
	ldr	r3, .L27+48
	ldr	r2, [r5]
	ldr	r3, [r3]
	ldr	r1, [r6]
	orr	r2, r2, r3
	orr	r2, r2, r0
	mov	r0, r4
	bl	cas_phy_write
	mov	r0, r4
	mov	r1, #1
	bl	cas_mif_poll
	mov	r5, #0
	b	.L1
.L26:
	ldr	r2, .L27+24
	mov	r0, r4
	ldr	r1, [r2]
	ldr	r3, .L27+52
	ldr	r2, [r4, #16]
	bl	netif_info
	ldr	r0, [r4, #8]
	b	.L4
.L28:
	.align	2
.L27:
	.word	BMSR_LSTATUS
	.word	link_up
	.word	link_force_try
	.word	LINK_TRANSITION_LINK_UP
	.word	link_down
	.word	LINK_TRANSITION_LINK_DOWN
	.word	link
	.word	.LC1
	.word	BMCR_ANENABLE
	.word	link_force_ret
	.word	LINK_TRANSITION_LINK_CONFIG
	.word	MII_BMCR
	.word	BMCR_ANRESTART
	.word	.LC0
	.size	cas_mii_link_check, .-cas_mii_link_check
	.comm	link_up,4,4
	.comm	link_force_try,4,4
	.comm	link_force_ret,4,4
	.comm	link_down,4,4
	.comm	link,4,4
	.comm	MII_BMCR,4,4
	.comm	LINK_TRANSITION_LINK_UP,4,4
	.comm	LINK_TRANSITION_LINK_DOWN,4,4
	.comm	LINK_TRANSITION_LINK_CONFIG,4,4
	.comm	BMSR_LSTATUS,4,4
	.comm	BMCR_ANRESTART,4,4
	.comm	BMCR_ANENABLE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
