	.file	"extr_b53_common.c_b53_switch_reset.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Failed to enable switch!\n"
	.text
	.p2align 4
	.type	b53_switch_reset, @function
b53_switch_reset:
.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
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	sub	rsp, 16
	.cfi_def_cfa_offset 48
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 8[rsp], rax
	xor	eax, eax
	call	b53_switch_reset_gpio@PLT
	mov	rdi, rbp
	call	is539x@PLT
	test	rax, rax
	jne	.L16
.L2:
	mov	rax, QWORD PTR 0[rbp]
	cmp	rax, QWORD PTR BCM58XX_DEVICE_ID[rip]
	je	.L3
	cmp	rax, QWORD PTR BCM583XX_DEVICE_ID[rip]
	je	.L3
.L4:
	mov	edx, DWORD PTR B53_SWITCH_MODE[rip]
	mov	esi, DWORD PTR B53_CTRL_PAGE[rip]
	mov	r12, rsp
	mov	rdi, rbp
	mov	rcx, r12
	call	b53_read8@PLT
	mov	edx, DWORD PTR [rsp]
	mov	eax, DWORD PTR SM_SW_FWD_EN[rip]
	test	edx, eax
	je	.L17
.L8:
	mov	rdi, rbp
	call	b53_enable_mib@PLT
	mov	esi, DWORD PTR FAST_AGE_STATIC[rip]
	mov	rdi, rbp
	call	b53_flush_arl@PLT
.L1:
	mov	rdx, QWORD PTR 8[rsp]
	xor	rdx, QWORD PTR fs:40
	jne	.L18
	add	rsp, 16
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	pop	rbx
	.cfi_def_cfa_offset 24
	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	ecx, DWORD PTR SM_SW_FWD_MODE[rip]
	mov	esi, DWORD PTR B53_CTRL_PAGE[rip]
	mov	rdi, rbp
	not	ecx
	and	ecx, edx
	mov	edx, DWORD PTR B53_SWITCH_MODE[rip]
	or	ecx, eax
	mov	DWORD PTR [rsp], ecx
	call	b53_write8@PLT
	mov	edx, DWORD PTR B53_SWITCH_MODE[rip]
	mov	rcx, r12
	mov	rdi, rbp
	mov	esi, DWORD PTR B53_CTRL_PAGE[rip]
	call	b53_read8@PLT
	mov	eax, DWORD PTR [rsp]
	test	DWORD PTR SM_SW_FWD_EN[rip], eax
	jne	.L8
	mov	edi, DWORD PTR 8[rbp]
	lea	rsi, .LC0[rip]
	call	dev_err@PLT
	mov	eax, DWORD PTR EINVAL[rip]
	neg	eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L3:
	mov	edx, DWORD PTR B53_SOFTRESET[rip]
	lea	r12, 4[rsp]
	mov	rdi, rbp
	mov	ebx, 1000
	mov	esi, DWORD PTR B53_CTRL_PAGE[rip]
	mov	rcx, r12
	call	b53_read8@PLT
	mov	edx, DWORD PTR B53_SOFTRESET[rip]
	mov	esi, DWORD PTR B53_CTRL_PAGE[rip]
	mov	rdi, rbp
	mov	ecx, DWORD PTR SW_RST[rip]
	or	ecx, DWORD PTR EN_SW_RST[rip]
	or	ecx, DWORD PTR EN_CH_RST[rip]
	or	ecx, DWORD PTR 4[rsp]
	mov	DWORD PTR 4[rsp], ecx
	call	b53_write8@PLT
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L19:
	mov	esi, 2000
	mov	edi, 1000
	sub	ebx, 1
	call	usleep_range@PLT
	cmp	ebx, -1
	je	.L4
.L6:
	mov	edx, DWORD PTR B53_SOFTRESET[rip]
	mov	esi, DWORD PTR B53_CTRL_PAGE[rip]
	mov	rcx, r12
	mov	rdi, rbp
	call	b53_read8@PLT
	mov	eax, DWORD PTR 4[rsp]
	test	DWORD PTR SW_RST[rip], eax
	jne	.L19
	test	ebx, ebx
	jne	.L4
	mov	eax, DWORD PTR ETIMEDOUT[rip]
	neg	eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L16:
	mov	edx, DWORD PTR B53_SOFTRESET[rip]
	mov	esi, DWORD PTR B53_CTRL_PAGE[rip]
	mov	rdi, rbp
	mov	ecx, 131
	call	b53_write8@PLT
	mov	edx, DWORD PTR B53_SOFTRESET[rip]
	xor	ecx, ecx
	mov	rdi, rbp
	mov	esi, DWORD PTR B53_CTRL_PAGE[rip]
	call	b53_write8@PLT
	jmp	.L2
.L18:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	b53_switch_reset, .-b53_switch_reset
	.comm	SW_RST,4,4
	.comm	SM_SW_FWD_MODE,4,4
	.comm	SM_SW_FWD_EN,4,4
	.comm	FAST_AGE_STATIC,4,4
	.comm	ETIMEDOUT,4,4
	.comm	EN_SW_RST,4,4
	.comm	EN_CH_RST,4,4
	.comm	EINVAL,4,4
	.comm	BCM58XX_DEVICE_ID,8,8
	.comm	BCM583XX_DEVICE_ID,8,8
	.comm	B53_SWITCH_MODE,4,4
	.comm	B53_SOFTRESET,4,4
	.comm	B53_CTRL_PAGE,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_b53_common.c_b53_switch_reset.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Failed to enable switch!\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	b53_switch_reset, %function
b53_switch_reset:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	mov	r5, r0
	ldr	r3, .L19
	sub	sp, sp, #16
	ldr	r3, [r3]
	str	r3, [sp, #12]
	mov	r3,#0
	bl	b53_switch_reset_gpio
	mov	r0, r5
	bl	is539x
	cmp	r0, #0
	bne	.L13
	ldr	r6, .L19+4
.L2:
	ldr	r2, .L19+8
	ldr	r3, [r5]
	ldr	r2, [r2]
	cmp	r3, r2
	beq	.L3
	ldr	r2, .L19+12
	ldr	r2, [r2]
	cmp	r3, r2
	beq	.L3
.L4:
	ldr	r4, .L19+16
	ldr	r7, .L19+20
	add	r3, sp, #4
	mov	r0, r5
	ldr	r2, [r4]
	ldr	r1, [r6]
	bl	b53_read8
	ldr	r3, [r7]
	ldr	r0, [sp, #4]
	tst	r0, r3
	beq	.L16
.L8:
	mov	r0, r5
	bl	b53_enable_mib
	ldr	r3, .L19+24
	mov	r0, r5
	ldr	r1, [r3]
	bl	b53_flush_arl
.L1:
	ldr	r3, .L19
	ldr	r2, [r3]
	ldr	r3, [sp, #12]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L17
	add	sp, sp, #16
	@ sp needed
	pop	{r4, r5, r6, r7, r8, pc}
.L16:
	ldr	r1, .L19+28
	ldr	r2, [r4]
	ldr	ip, [r1]
	ldr	r1, [r6]
	bic	r0, r0, ip
	orr	r3, r0, r3
	mov	r0, r5
	str	r3, [sp, #4]
	bl	b53_write8
	ldr	r2, [r4]
	add	r3, sp, #4
	mov	r0, r5
	ldr	r1, [r6]
	bl	b53_read8
	ldr	r3, [r7]
	ldr	r2, [sp, #4]
	tst	r2, r3
	bne	.L8
	ldr	r0, [r5, #4]
	ldr	r1, .L19+32
	bl	dev_err
	ldr	r3, .L19+36
	ldr	r0, [r3]
	rsb	r0, r0, #0
	b	.L1
.L3:
	ldr	r7, .L19+40
	ldr	r1, [r6]
	ldr	r2, [r7]
	add	r3, sp, #8
	mov	r0, r5
	bl	b53_read8
	ldr	r8, .L19+44
	ldr	r2, .L19+48
	ldr	r1, .L19+52
	ldr	r2, [r2]
	ldr	r3, [r8]
	ldr	r1, [r1]
	orr	r3, r3, r2
	ldr	r2, [sp, #8]
	orr	r3, r3, r1
	orr	r3, r3, r2
	mov	r0, r5
	ldr	r2, [r7]
	ldr	r1, [r6]
	str	r3, [sp, #8]
	mov	r4, #1000
	bl	b53_write8
	b	.L6
.L18:
	mov	r1, #2000
	mov	r0, #1000
	sub	r4, r4, #1
	bl	usleep_range
	cmn	r4, #1
	beq	.L4
.L6:
	ldr	r2, [r7]
	add	r3, sp, #8
	mov	r0, r5
	ldr	r1, [r6]
	bl	b53_read8
	ldr	r2, [sp, #8]
	ldr	r3, [r8]
	tst	r2, r3
	bne	.L18
	cmp	r4, #0
	bne	.L4
	ldr	r3, .L19+56
	ldr	r0, [r3]
	rsb	r0, r0, #0
	b	.L1
.L13:
	ldr	r4, .L19+40
	ldr	r6, .L19+4
	ldr	r2, [r4]
	ldr	r1, [r6]
	mov	r3, #131
	mov	r0, r5
	bl	b53_write8
	mov	r3, #0
	mov	r0, r5
	ldr	r2, [r4]
	ldr	r1, [r6]
	bl	b53_write8
	b	.L2
.L17:
	bl	__stack_chk_fail
.L20:
	.align	2
.L19:
	.word	.LC1
	.word	B53_CTRL_PAGE
	.word	BCM58XX_DEVICE_ID
	.word	BCM583XX_DEVICE_ID
	.word	B53_SWITCH_MODE
	.word	SM_SW_FWD_EN
	.word	FAST_AGE_STATIC
	.word	SM_SW_FWD_MODE
	.word	.LC0
	.word	EINVAL
	.word	B53_SOFTRESET
	.word	SW_RST
	.word	EN_SW_RST
	.word	EN_CH_RST
	.word	ETIMEDOUT
	.size	b53_switch_reset, .-b53_switch_reset
	.comm	SW_RST,4,4
	.comm	SM_SW_FWD_MODE,4,4
	.comm	SM_SW_FWD_EN,4,4
	.comm	FAST_AGE_STATIC,4,4
	.comm	ETIMEDOUT,4,4
	.comm	EN_SW_RST,4,4
	.comm	EN_CH_RST,4,4
	.comm	EINVAL,4,4
	.comm	BCM58XX_DEVICE_ID,4,4
	.comm	BCM583XX_DEVICE_ID,4,4
	.comm	B53_SWITCH_MODE,4,4
	.comm	B53_SOFTRESET,4,4
	.comm	B53_CTRL_PAGE,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
