	.file	"extr_spi-bcm2835.c_bcm2835_spi_transfer_one.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	bcm2835_spi_transfer_one, @function
bcm2835_spi_transfer_one:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	mov	r15, rdi
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	mov	r12, rdx
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rsi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 24
	.cfi_def_cfa_offset 80
	call	spi_controller_get_devdata@PLT
	mov	rsi, QWORD PTR [r12]
	mov	rdx, QWORD PTR 0[rbp]
	mov	rbx, rax
	mov	rax, QWORD PTR 32[rax]
	mov	edi, DWORD PTR 28[rbx]
	mov	QWORD PTR 8[rsp], rsi
	mov	r14d, DWORD PTR [rax+rdx*4]
	call	clk_get_rate@PLT
	mov	rsi, QWORD PTR 8[rsp]
	mov	r13, rax
	shr	rax
	cmp	rax, rsi
	jbe	.L10
	test	rsi, rsi
	jne	.L27
	shr	r13, 16
	xor	r8d, r8d
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L10:
	mov	r8d, 2
.L2:
	mov	rax, r13
	xor	edx, edx
	div	r8
	mov	r13, rax
.L4:
	mov	esi, DWORD PTR BCM2835_SPI_CLK[rip]
	mov	rdx, r8
	mov	rdi, rbx
	call	bcm2835_wr@PLT
	mov	eax, DWORD PTR 8[rbp]
	test	DWORD PTR SPI_3WIRE[rip], eax
	mov	rax, QWORD PTR 16[r12]
	je	.L6
	test	rax, rax
	jne	.L28
.L6:
	mov	edx, DWORD PTR 24[r12]
	mov	rcx, QWORD PTR 8[r12]
	mov	QWORD PTR 16[rbx], rax
	mov	r8d, 1
	mov	edi, DWORD PTR polling_limit_us[rip]
	mov	DWORD PTR 24[rbx], edx
	mov	QWORD PTR [rbx], rcx
	mov	QWORD PTR 8[rbx], rcx
	test	edi, edi
	je	.L7
	mov	eax, 9000000
	cdq
	idiv	edi
	movsx	rsi, eax
	test	rsi, rsi
	jne	.L29
.L7:
	cmp	rcx, r8
	jb	.L30
.L8:
	cmp	QWORD PTR [r15], 0
	je	.L9
	mov	rdx, r12
	mov	rsi, rbp
	mov	rdi, r15
	call	bcm2835_spi_can_dma@PLT
	test	rax, rax
	jne	.L31
.L9:
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	ecx, r14d
	mov	rdx, r12
	mov	rsi, rbp
	pop	rbx
	.cfi_def_cfa_offset 48
	mov	rdi, r15
	pop	rbp
	.cfi_def_cfa_offset 40
	mov	r8d, 1
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	jmp	bcm2835_spi_transfer_one_irq@PLT
	.p2align 4,,10
	.p2align 3
.L29:
	.cfi_restore_state
	mov	rax, r13
	xor	edx, edx
	div	rsi
	mov	r8, rax
	cmp	rcx, r8
	jnb	.L8
.L30:
	add	rsp, 24
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	ecx, r14d
	mov	rdx, r12
	mov	rsi, rbp
	pop	rbx
	.cfi_def_cfa_offset 48
	mov	rdi, r15
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	jmp	bcm2835_spi_transfer_one_poll@PLT
	.p2align 4,,10
	.p2align 3
.L28:
	.cfi_restore_state
	or	r14d, DWORD PTR BCM2835_SPI_CS_REN[rip]
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L27:
	mov	rdi, r13
	call	DIV_ROUND_UP@PLT
	lea	r8, 1[rax]
	and	r8, -2
	lea	rax, -1[r8]
	cmp	rax, 65534
	jbe	.L2
	shr	r13, 16
	xor	r8d, r8d
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L31:
	add	rsp, 24
	.cfi_def_cfa_offset 56
	mov	ecx, r14d
	mov	rdx, r12
	mov	rsi, rbp
	pop	rbx
	.cfi_def_cfa_offset 48
	mov	rdi, r15
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	jmp	bcm2835_spi_transfer_one_dma@PLT
	.cfi_endproc
.LFE0:
	.size	bcm2835_spi_transfer_one, .-bcm2835_spi_transfer_one
	.comm	polling_limit_us,4,4
	.comm	SPI_3WIRE,4,4
	.comm	BCM2835_SPI_CS_REN,4,4
	.comm	BCM2835_SPI_CLK,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_spi-bcm2835.c_bcm2835_spi_transfer_one.c"
	.text
	.global	__aeabi_uidiv
	.global	__aeabi_idiv
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	bcm2835_spi_transfer_one, %function
bcm2835_spi_transfer_one:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	sub	sp, sp, #8
	mov	r7, r1
	mov	r5, r2
	mov	r8, r0
	bl	spi_controller_get_devdata
	ldr	r2, [r7]
	ldr	r3, [r0, #20]
	mov	r4, r0
	ldr	r0, [r0, #16]
	ldr	r9, [r5]
	ldr	r10, [r3, r2, lsl #2]
	bl	clk_get_rate
	cmp	r9, r0, lsr #1
	mov	r6, r0
	bcs	.L10
	cmp	r9, #0
	bne	.L28
	mov	r9, #0
	lsr	r6, r6, #16
	b	.L4
.L10:
	mov	r9, #2
.L2:
	mov	r0, r6
	mov	r1, r9
	bl	__aeabi_uidiv
	mov	r6, r0
.L4:
	ldr	r3, .L32
	mov	r2, r9
	ldr	r1, [r3]
	mov	r0, r4
	bl	bcm2835_wr
	ldr	r3, .L32+4
	ldr	r2, [r7, #4]
	ldr	r3, [r3]
	tst	r2, r3
	ldr	r3, [r5, #8]
	beq	.L6
	cmp	r3, #0
	ldrne	r2, .L32+8
	ldrne	r2, [r2]
	orrne	r10, r10, r2
.L6:
	ldr	r1, .L32+12
	ldr	r2, [r5, #12]
	ldr	r1, [r1]
	ldr	r9, [r5, #4]
	cmp	r1, #0
	str	r2, [r4, #12]
	str	r3, [r4, #8]
	str	r9, [r4]
	str	r9, [r4, #4]
	beq	.L12
	ldr	r0, .L32+16
	bl	__aeabi_idiv
	subs	r1, r0, #0
	bne	.L29
.L12:
	mov	r0, #1
	cmp	r9, r0
	bcc	.L30
.L8:
	ldr	r3, [r8]
	cmp	r3, #0
	beq	.L9
	mov	r2, r5
	mov	r1, r7
	mov	r0, r8
	bl	bcm2835_spi_can_dma
	cmp	r0, #0
	bne	.L31
.L9:
	mov	ip, #1
	mov	r3, r10
	mov	r2, r5
	mov	r1, r7
	mov	r0, r8
	str	ip, [sp]
	bl	bcm2835_spi_transfer_one_irq
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L29:
	mov	r0, r6
	bl	__aeabi_uidiv
	cmp	r9, r0
	bcs	.L8
.L30:
	mov	r3, r10
	mov	r2, r5
	mov	r1, r7
	mov	r0, r8
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, lr}
	b	bcm2835_spi_transfer_one_poll
.L28:
	mov	r1, r9
	bl	DIV_ROUND_UP
	add	r9, r0, #1
	ldr	r3, .L32+20
	bic	r9, r9, #1
	sub	r2, r9, #1
	cmp	r2, r3
	bls	.L2
	mov	r9, #0
	lsr	r6, r6, #16
	b	.L4
.L31:
	mov	r3, r10
	mov	r2, r5
	mov	r1, r7
	mov	r0, r8
	add	sp, sp, #8
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, lr}
	b	bcm2835_spi_transfer_one_dma
.L33:
	.align	2
.L32:
	.word	BCM2835_SPI_CLK
	.word	SPI_3WIRE
	.word	BCM2835_SPI_CS_REN
	.word	polling_limit_us
	.word	9000000
	.word	65534
	.size	bcm2835_spi_transfer_one, .-bcm2835_spi_transfer_one
	.comm	polling_limit_us,4,4
	.comm	SPI_3WIRE,4,4
	.comm	BCM2835_SPI_CS_REN,4,4
	.comm	BCM2835_SPI_CLK,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
