	.file	"extr_ti_i2c.c_ti_i2c_reset.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"Unknown TI SoC, unable to reset the i2c"
	.text
	.p2align 4
	.type	ti_i2c_reset, @function
ti_i2c_reset:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	xor	eax, eax
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	mov	r12d, esi
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	call	ti_chip@PLT
	lea	rdi, .LC0[rip]
	call	panic@PLT
	mov	rdi, QWORD PTR 16[rbp]
	mov	eax, 100000
	test	rdi, rdi
	je	.L2
	mov	esi, r12d
	call	IICBUS_GET_FREQUENCY@PLT
.L2:
	xor	r12d, r12d
	mov	edx, DWORD PTR 24[r12]
	cmp	eax, edx
	jge	.L16
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L18:
	mov	edx, DWORD PTR 48[r12]
	add	r12, 24
	cmp	edx, eax
	jg	.L3
.L16:
	test	edx, edx
	jne	.L18
.L3:
	mov	esi, DWORD PTR I2C_REG_CON[rip]
	xor	edx, edx
	mov	rdi, rbp
	mov	ebx, 102
	mov	DWORD PTR 0[rbp], 0
	call	ti_i2c_write_2@PLT
	mov	edi, DWORD PTR 8[rbp]
	mov	edx, DWORD PTR I2C_REG_SYSC_SRST[rip]
	mov	esi, DWORD PTR I2C_REG_SYSC[rip]
	call	bus_write_2@PLT
	mov	edx, DWORD PTR I2C_CON_I2C_EN[rip]
	mov	esi, DWORD PTR I2C_REG_CON[rip]
	mov	rdi, rbp
	call	ti_i2c_write_2@PLT
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L9:
	sub	ebx, 1
	je	.L19
	mov	edi, 100
	call	DELAY@PLT
.L6:
	mov	esi, DWORD PTR I2C_REG_SYSS[rip]
	mov	rdi, rbp
	call	ti_i2c_read_2@PLT
	test	DWORD PTR I2C_SYSS_RDONE[rip], eax
	je	.L9
	mov	edx, DWORD PTR 0[rbp]
	mov	esi, DWORD PTR I2C_REG_CON[rip]
	mov	rdi, rbp
	call	ti_i2c_write_2@PLT
	mov	edx, DWORD PTR 4[r12]
	mov	esi, DWORD PTR I2C_REG_PSC[rip]
	mov	rdi, rbp
	call	ti_i2c_write_2@PLT
	xor	eax, eax
	mov	r13d, DWORD PTR 8[r12]
	mov	r12d, DWORD PTR 12[r12]
	and	r13d, DWORD PTR I2C_SCLL_MASK[rip]
	and	r12d, DWORD PTR I2C_SCLH_MASK[rip]
	call	ti_chip@PLT
	mov	esi, DWORD PTR I2C_REG_SCLL[rip]
	mov	edx, r13d
	mov	rdi, rbp
	call	ti_i2c_write_2@PLT
	mov	esi, DWORD PTR I2C_REG_SCLH[rip]
	mov	edx, r12d
	mov	rdi, rbp
	call	ti_i2c_write_2@PLT
	mov	eax, DWORD PTR 4[rbp]
	mov	ecx, DWORD PTR I2C_BUF_RXTRSH_SHIFT[rip]
	mov	rdi, rbp
	mov	esi, DWORD PTR I2C_REG_BUF[rip]
	lea	edx, -1[rax]
	and	edx, DWORD PTR I2C_BUF_TRSH_MASK[rip]
	mov	eax, edx
	sal	eax, cl
	or	edx, eax
	call	ti_i2c_write_2@PLT
	mov	edx, DWORD PTR I2C_CON_I2C_EN[rip]
	or	edx, DWORD PTR I2C_CON_MST[rip]
	mov	rdi, rbp
	or	edx, DWORD PTR 0[rbp]
	mov	esi, DWORD PTR I2C_REG_CON[rip]
	mov	DWORD PTR 0[rbp], edx
	call	ti_i2c_write_2@PLT
	mov	esi, DWORD PTR I2C_REG_IRQENABLE_SET[rip]
	mov	edx, DWORD PTR I2C_IE_XDR[rip]
	mov	rdi, rbp
	or	edx, DWORD PTR I2C_IE_XRDY[rip]
	or	edx, DWORD PTR I2C_IE_RDR[rip]
	or	edx, DWORD PTR I2C_IE_RRDY[rip]
	or	edx, DWORD PTR I2C_IE_ARDY[rip]
	or	edx, DWORD PTR I2C_IE_NACK[rip]
	or	edx, DWORD PTR I2C_IE_AL[rip]
	call	ti_i2c_write_2@PLT
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xor	eax, eax
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
.L19:
	.cfi_restore_state
	mov	eax, DWORD PTR EBUSY[rip]
	add	rsp, 8
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	ti_i2c_reset, .-ti_i2c_reset
	.comm	ti_omap4_i2c_clock_configs,8,8
	.comm	ti_am335x_i2c_clock_configs,8,8
	.comm	I2C_SYSS_RDONE,4,4
	.comm	I2C_SCLL_MASK,4,4
	.comm	I2C_SCLH_MASK,4,4
	.comm	I2C_REG_SYSS,4,4
	.comm	I2C_REG_SYSC_SRST,4,4
	.comm	I2C_REG_SYSC,4,4
	.comm	I2C_REG_SCLL,4,4
	.comm	I2C_REG_SCLH,4,4
	.comm	I2C_REG_PSC,4,4
	.comm	I2C_REG_IRQENABLE_SET,4,4
	.comm	I2C_REG_CON,4,4
	.comm	I2C_REG_BUF,4,4
	.comm	I2C_IE_XRDY,4,4
	.comm	I2C_IE_XDR,4,4
	.comm	I2C_IE_RRDY,4,4
	.comm	I2C_IE_RDR,4,4
	.comm	I2C_IE_NACK,4,4
	.comm	I2C_IE_ARDY,4,4
	.comm	I2C_IE_AL,4,4
	.comm	I2C_HSSCLL_SHIFT,4,4
	.comm	I2C_HSSCLH_SHIFT,4,4
	.comm	I2C_CON_OPMODE_HS,4,4
	.comm	I2C_CON_MST,4,4
	.comm	I2C_CON_I2C_EN,4,4
	.comm	I2C_BUF_TRSH_MASK,4,4
	.comm	I2C_BUF_RXTRSH_SHIFT,4,4
	.comm	EBUSY,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_ti_i2c.c_ti_i2c_reset.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Unknown TI SoC, unable to reset the i2c\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	ti_i2c_reset, %function
ti_i2c_reset:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, lr}
	mov	r5, r0
	mov	r4, r1
	bl	ti_chip
	ldr	r0, .L15
	bl	panic
	ldr	r0, [r5, #12]
	cmp	r0, #0
	ldreq	r0, .L15+4
	beq	.L2
	mov	r1, r4
	bl	IICBUS_GET_FREQUENCY
.L2:
	mov	r6, #0
	ldr	r2, [r6, #24]
	clz	r3, r2
	lsr	r3, r3, #5
	cmp	r0, r2
	orrlt	r3, r3, #1
	cmp	r3, r6
	bne	.L3
.L4:
	ldr	r2, [r6, #48]
	add	r6, r6, #24
	clz	r3, r2
	lsr	r3, r3, #5
	cmp	r2, r0
	orrgt	r3, r3, #1
	cmp	r3, #0
	beq	.L4
.L3:
	mov	r2, #0
	ldr	r9, .L15+8
	str	r2, [r5]
	ldr	r1, [r9]
	mov	r0, r5
	bl	ti_i2c_write_2
	ldr	r3, .L15+12
	ldr	r2, .L15+16
	ldr	r10, .L15+20
	ldr	r1, [r3]
	ldr	r2, [r2]
	ldr	r0, [r5, #8]
	bl	bus_write_2
	mov	r0, r5
	ldr	r1, [r9]
	ldr	r2, [r10]
	bl	ti_i2c_write_2
	mov	r4, #102
	ldr	r8, .L15+24
	ldr	r7, .L15+28
	b	.L5
.L8:
	subs	r4, r4, #1
	beq	.L14
	mov	r0, #100
	bl	DELAY
.L5:
	mov	r0, r5
	ldr	r1, [r8]
	bl	ti_i2c_read_2
	ldr	r3, [r7]
	tst	r0, r3
	beq	.L8
	ldr	r2, [r5]
	ldr	r1, [r9]
	mov	r0, r5
	bl	ti_i2c_write_2
	ldr	r3, .L15+32
	ldr	r2, [r6, #4]
	ldr	r1, [r3]
	mov	r0, r5
	bl	ti_i2c_write_2
	ldr	r2, .L15+36
	ldr	r3, .L15+40
	ldr	r1, [r2]
	ldr	r4, [r6, #12]
	ldr	r2, [r6, #8]
	ldr	r3, [r3]
	and	r6, r2, r1
	and	r4, r4, r3
	bl	ti_chip
	ldr	r3, .L15+44
	mov	r2, r6
	ldr	r1, [r3]
	mov	r0, r5
	bl	ti_i2c_write_2
	ldr	r3, .L15+48
	mov	r2, r4
	ldr	r1, [r3]
	mov	r0, r5
	bl	ti_i2c_write_2
	ldr	r3, .L15+52
	ldr	r2, [r5, #4]
	ldr	r1, .L15+56
	ldr	ip, [r3]
	ldr	r0, [r1]
	sub	r3, r2, #1
	ldr	r1, .L15+60
	and	r2, r3, ip
	orr	r2, r2, r2, lsl r0
	ldr	r1, [r1]
	mov	r0, r5
	bl	ti_i2c_write_2
	ldr	r3, .L15+64
	ldr	r2, [r10]
	ldr	r1, [r3]
	ldr	r3, [r5]
	orr	r2, r2, r1
	orr	r2, r2, r3
	ldr	r1, [r9]
	mov	r0, r5
	str	r2, [r5]
	bl	ti_i2c_write_2
	ldr	r1, .L15+68
	ldr	r3, .L15+72
	ldr	r2, .L15+76
	ldr	ip, [r1]
	ldr	r3, [r3]
	ldr	r0, .L15+80
	ldr	r1, [r2]
	ldr	r2, .L15+84
	orr	r3, r3, ip
	ldr	ip, [r0]
	ldr	r0, .L15+88
	orr	r3, r3, r1
	ldr	r1, [r2]
	ldr	r2, .L15+92
	ldr	r0, [r0]
	orr	r3, r3, ip
	ldr	r2, [r2]
	orr	r3, r3, r1
	ldr	r1, .L15+96
	orr	r3, r3, r0
	ldr	r1, [r1]
	mov	r0, r5
	orr	r2, r3, r2
	bl	ti_i2c_write_2
	mov	r0, #0
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L14:
	ldr	r3, .L15+100
	ldr	r0, [r3]
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L16:
	.align	2
.L15:
	.word	.LC0
	.word	100000
	.word	I2C_REG_CON
	.word	I2C_REG_SYSC
	.word	I2C_REG_SYSC_SRST
	.word	I2C_CON_I2C_EN
	.word	I2C_REG_SYSS
	.word	I2C_SYSS_RDONE
	.word	I2C_REG_PSC
	.word	I2C_SCLL_MASK
	.word	I2C_SCLH_MASK
	.word	I2C_REG_SCLL
	.word	I2C_REG_SCLH
	.word	I2C_BUF_TRSH_MASK
	.word	I2C_BUF_RXTRSH_SHIFT
	.word	I2C_REG_BUF
	.word	I2C_CON_MST
	.word	I2C_IE_XRDY
	.word	I2C_IE_XDR
	.word	I2C_IE_RDR
	.word	I2C_IE_RRDY
	.word	I2C_IE_ARDY
	.word	I2C_IE_NACK
	.word	I2C_IE_AL
	.word	I2C_REG_IRQENABLE_SET
	.word	EBUSY
	.size	ti_i2c_reset, .-ti_i2c_reset
	.comm	ti_omap4_i2c_clock_configs,4,4
	.comm	ti_am335x_i2c_clock_configs,4,4
	.comm	I2C_SYSS_RDONE,4,4
	.comm	I2C_SCLL_MASK,4,4
	.comm	I2C_SCLH_MASK,4,4
	.comm	I2C_REG_SYSS,4,4
	.comm	I2C_REG_SYSC_SRST,4,4
	.comm	I2C_REG_SYSC,4,4
	.comm	I2C_REG_SCLL,4,4
	.comm	I2C_REG_SCLH,4,4
	.comm	I2C_REG_PSC,4,4
	.comm	I2C_REG_IRQENABLE_SET,4,4
	.comm	I2C_REG_CON,4,4
	.comm	I2C_REG_BUF,4,4
	.comm	I2C_IE_XRDY,4,4
	.comm	I2C_IE_XDR,4,4
	.comm	I2C_IE_RRDY,4,4
	.comm	I2C_IE_RDR,4,4
	.comm	I2C_IE_NACK,4,4
	.comm	I2C_IE_ARDY,4,4
	.comm	I2C_IE_AL,4,4
	.comm	I2C_HSSCLL_SHIFT,4,4
	.comm	I2C_HSSCLH_SHIFT,4,4
	.comm	I2C_CON_OPMODE_HS,4,4
	.comm	I2C_CON_MST,4,4
	.comm	I2C_CON_I2C_EN,4,4
	.comm	I2C_BUF_TRSH_MASK,4,4
	.comm	I2C_BUF_RXTRSH_SHIFT,4,4
	.comm	EBUSY,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
