	.file	"extr_b1dma.c_b1dma_detect.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	b1dma_detect, @function
b1dma_detect:
.LFB0:
	.cfi_startproc
	endbr64
	push	r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xor	esi, esi
	mov	r12d, 1
	push	rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	mov	rbx, rdi
	sub	rsp, 8
	.cfi_def_cfa_offset 32
	mov	edx, DWORD PTR AMCC_MCSR[rip]
	call	b1dma_writel@PLT
	mov	edi, 10
	call	mdelay@PLT
	mov	edx, DWORD PTR AMCC_MCSR[rip]
	mov	esi, 251658240
	mov	rdi, rbx
	call	b1dma_writel@PLT
	mov	edi, 10
	call	mdelay@PLT
	mov	edx, DWORD PTR AMCC_MCSR[rip]
	xor	esi, esi
	mov	rdi, rbx
	call	b1dma_writel@PLT
	mov	edi, 42
	call	mdelay@PLT
	mov	edx, DWORD PTR AMCC_RXLEN[rip]
	xor	esi, esi
	mov	rdi, rbx
	call	b1dma_writel@PLT
	mov	edx, DWORD PTR AMCC_TXLEN[rip]
	xor	esi, esi
	mov	rdi, rbx
	call	b1dma_writel@PLT
	mov	DWORD PTR [rbx], 0
	xor	esi, esi
	mov	rdi, rbx
	mov	edx, DWORD PTR AMCC_INTCSR[rip]
	call	b1dma_writel@PLT
	mov	esi, DWORD PTR AMCC_MCSR[rip]
	mov	rdi, rbx
	call	b1dma_readl@PLT
	cmp	eax, 230
	je	.L16
.L1:
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	mov	eax, r12d
	pop	rbx
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	mov	edx, DWORD PTR AMCC_RXPTR[rip]
	mov	esi, -1
	mov	rdi, rbx
	call	b1dma_writel@PLT
	mov	edx, DWORD PTR AMCC_TXPTR[rip]
	mov	esi, -1
	mov	rdi, rbx
	call	b1dma_writel@PLT
	mov	esi, DWORD PTR AMCC_RXPTR[rip]
	mov	rdi, rbx
	call	b1dma_readl@PLT
	cmp	eax, -4
	je	.L3
.L4:
	mov	r12d, 2
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	mov	eax, r12d
	pop	rbx
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L3:
	.cfi_restore_state
	mov	esi, DWORD PTR AMCC_TXPTR[rip]
	mov	rdi, rbx
	call	b1dma_readl@PLT
	cmp	eax, -4
	jne	.L4
	mov	edx, DWORD PTR AMCC_RXPTR[rip]
	xor	esi, esi
	mov	rdi, rbx
	call	b1dma_writel@PLT
	mov	edx, DWORD PTR AMCC_TXPTR[rip]
	xor	esi, esi
	mov	rdi, rbx
	call	b1dma_writel@PLT
	mov	esi, DWORD PTR AMCC_RXPTR[rip]
	mov	rdi, rbx
	call	b1dma_readl@PLT
	test	eax, eax
	jne	.L6
	mov	esi, DWORD PTR AMCC_TXPTR[rip]
	mov	rdi, rbx
	call	b1dma_readl@PLT
	test	eax, eax
	jne	.L6
	mov	edi, DWORD PTR 4[rbx]
	xor	edx, edx
	mov	esi, 16
	call	t1outp@PLT
	mov	edi, DWORD PTR 4[rbx]
	xor	edx, edx
	mov	esi, 7
	call	t1outp@PLT
	mov	edi, DWORD PTR 4[rbx]
	mov	edx, 2
	mov	esi, 2
	call	t1outp@PLT
	mov	edi, DWORD PTR 4[rbx]
	mov	edx, 2
	mov	esi, 3
	call	t1outp@PLT
	mov	edi, DWORD PTR 4[rbx]
	mov	esi, 2
	call	t1inp@PLT
	and	eax, 254
	cmp	eax, 2
	jne	.L8
	mov	edi, DWORD PTR 4[rbx]
	mov	esi, 3
	call	t1inp@PLT
	cmp	eax, 3
	jne	.L8
	mov	edi, DWORD PTR 4[rbx]
	xor	edx, edx
	mov	esi, 2
	call	t1outp@PLT
	mov	edi, DWORD PTR 4[rbx]
	xor	edx, edx
	mov	esi, 3
	call	t1outp@PLT
	mov	edi, DWORD PTR 4[rbx]
	mov	esi, 2
	call	t1inp@PLT
	and	eax, 254
	mov	r12d, eax
	jne	.L9
	mov	edi, DWORD PTR 4[rbx]
	mov	esi, 3
	call	t1inp@PLT
	cmp	eax, 1
	je	.L1
.L9:
	mov	r12d, 5
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L6:
	mov	r12d, 3
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L8:
	mov	r12d, 4
	jmp	.L1
	.cfi_endproc
.LFE0:
	.size	b1dma_detect, .-b1dma_detect
	.comm	AMCC_TXPTR,4,4
	.comm	AMCC_TXLEN,4,4
	.comm	AMCC_RXPTR,4,4
	.comm	AMCC_RXLEN,4,4
	.comm	AMCC_MCSR,4,4
	.comm	AMCC_INTCSR,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_b1dma.c_b1dma_detect.c"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	b1dma_detect, %function
b1dma_detect:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	mov	r6, #0
	mov	r4, r0
	ldr	r5, .L17
	mov	r1, r6
	ldr	r2, [r5]
	bl	b1dma_writel
	mov	r0, #10
	bl	mdelay
	ldr	r2, [r5]
	mov	r1, #251658240
	mov	r0, r4
	bl	b1dma_writel
	mov	r0, #10
	bl	mdelay
	ldr	r2, [r5]
	mov	r1, r6
	mov	r0, r4
	bl	b1dma_writel
	mov	r0, #42
	bl	mdelay
	ldr	r3, .L17+4
	mov	r1, r6
	ldr	r2, [r3]
	mov	r0, r4
	bl	b1dma_writel
	ldr	r3, .L17+8
	mov	r1, r6
	ldr	r2, [r3]
	mov	r0, r4
	bl	b1dma_writel
	ldr	r3, .L17+12
	mov	r1, r6
	ldr	r2, [r3]
	mov	r0, r4
	str	r6, [r4]
	bl	b1dma_writel
	ldr	r1, [r5]
	mov	r0, r4
	bl	b1dma_readl
	cmp	r0, #230
	movne	r5, #1
	beq	.L16
.L1:
	mov	r0, r5
	pop	{r4, r5, r6, r7, r8, pc}
.L16:
	ldr	r5, .L17+16
	ldr	r7, .L17+20
	mvn	r1, #0
	ldr	r2, [r5]
	mov	r0, r4
	bl	b1dma_writel
	mvn	r1, #0
	ldr	r2, [r7]
	mov	r0, r4
	bl	b1dma_writel
	mov	r0, r4
	ldr	r1, [r5]
	bl	b1dma_readl
	cmn	r0, #4
	beq	.L3
.L4:
	mov	r5, #2
	mov	r0, r5
	pop	{r4, r5, r6, r7, r8, pc}
.L3:
	mov	r0, r4
	ldr	r1, [r7]
	bl	b1dma_readl
	cmn	r0, #4
	bne	.L4
	mov	r1, r6
	ldr	r2, [r5]
	mov	r0, r4
	bl	b1dma_writel
	mov	r1, r6
	ldr	r2, [r7]
	mov	r0, r4
	bl	b1dma_writel
	mov	r0, r4
	ldr	r1, [r5]
	bl	b1dma_readl
	cmp	r0, #0
	bne	.L6
	mov	r0, r4
	ldr	r1, [r7]
	bl	b1dma_readl
	subs	r5, r0, #0
	bne	.L6
	mov	r2, r5
	mov	r1, #16
	ldr	r0, [r4, #4]
	bl	t1outp
	mov	r2, r5
	mov	r1, #7
	ldr	r0, [r4, #4]
	bl	t1outp
	mov	r2, #2
	ldr	r0, [r4, #4]
	mov	r1, r2
	bl	t1outp
	mov	r2, #2
	mov	r1, #3
	ldr	r0, [r4, #4]
	bl	t1outp
	mov	r1, #2
	ldr	r0, [r4, #4]
	bl	t1inp
	and	r6, r0, #254
	cmp	r6, #2
	bne	.L8
	mov	r1, #3
	ldr	r0, [r4, #4]
	bl	t1inp
	cmp	r0, #3
	mov	r7, r0
	bne	.L8
	mov	r2, r5
	mov	r1, r6
	ldr	r0, [r4, #4]
	bl	t1outp
	mov	r2, r5
	mov	r1, r7
	ldr	r0, [r4, #4]
	bl	t1outp
	mov	r1, r6
	ldr	r0, [r4, #4]
	bl	t1inp
	ands	r5, r0, #254
	bne	.L9
	mov	r1, r7
	ldr	r0, [r4, #4]
	bl	t1inp
	cmp	r0, #1
	beq	.L1
.L9:
	mov	r5, #5
	b	.L1
.L6:
	mov	r5, #3
	b	.L1
.L8:
	mov	r5, #4
	b	.L1
.L18:
	.align	2
.L17:
	.word	AMCC_MCSR
	.word	AMCC_RXLEN
	.word	AMCC_TXLEN
	.word	AMCC_INTCSR
	.word	AMCC_RXPTR
	.word	AMCC_TXPTR
	.size	b1dma_detect, .-b1dma_detect
	.comm	AMCC_TXPTR,4,4
	.comm	AMCC_TXLEN,4,4
	.comm	AMCC_RXPTR,4,4
	.comm	AMCC_RXLEN,4,4
	.comm	AMCC_MCSR,4,4
	.comm	AMCC_INTCSR,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
