	.file	"extr_imx_gpt.c_imx_gpt_attach.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"could not allocate resources\n"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC1:
	.string	"Running on %dKHz clock, base freq %uHz CR=0x%08x, PR=0x%08x\n"
	.align 8
.LC2:
	.string	"Unable to setup the clock irq handler, err = %d\n"
	.section	.rodata.str1.1
.LC3:
	.string	"iMXGPT"
	.text
	.p2align 4
	.type	imx_gpt_attach, @function
imx_gpt_attach:
.LFB0:
	.cfi_startproc
	endbr64
	push	r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	push	r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	mov	r12d, edi
	push	rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	push	rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	sub	rsp, 8
	.cfi_def_cfa_offset 48
	call	device_get_softc@PLT
	mov	esi, DWORD PTR imx_gpt_spec[rip]
	mov	edi, r12d
	mov	rdx, QWORD PTR 56[rax]
	mov	rbp, rax
	call	bus_alloc_resources@PLT
	test	rax, rax
	jne	.L12
	mov	rax, QWORD PTR 56[rbp]
	mov	DWORD PTR 76[rbp], r12d
	mov	edi, DWORD PTR [rax]
	call	rman_get_bustag@PLT
	mov	DWORD PTR 72[rbp], eax
	mov	rax, QWORD PTR 56[rbp]
	mov	edi, DWORD PTR [rax]
	call	rman_get_bushandle@PLT
	mov	DWORD PTR 0[rbp], 130
	mov	DWORD PTR 68[rbp], eax
	xor	eax, eax
	call	imx_ccm_ipg_hz@PLT
	mov	esi, DWORD PTR IMX_GPT_CR[rip]
	xor	edx, edx
	mov	rdi, rbp
	mov	r13d, eax
	call	WRITE4@PLT
	mov	esi, DWORD PTR IMX_GPT_IR[rip]
	xor	edx, edx
	mov	rdi, rbp
	call	WRITE4@PLT
	mov	ebx, DWORD PTR GPT_CR_FRR[rip]
	mov	esi, DWORD PTR IMX_GPT_CR[rip]
	mov	rdi, rbp
	or	ebx, DWORD PTR GPT_CR_STOPEN[rip]
	or	ebx, DWORD PTR GPT_CR_DOZEEN[rip]
	or	ebx, DWORD PTR GPT_CR_WAITEN[rip]
	or	ebx, DWORD PTR GPT_CR_DBGEN[rip]
	or	ebx, DWORD PTR 0[rbp]
	mov	edx, ebx
	call	WRITE4@PLT
	mov	edx, DWORD PTR GPT_CR_SWR[rip]
	mov	esi, DWORD PTR IMX_GPT_CR[rip]
	mov	rdi, rbp
	or	edx, ebx
	call	WRITE4@PLT
.L4:
	mov	esi, DWORD PTR IMX_GPT_CR[rip]
	mov	rdi, rbp
	call	READ4@PLT
	and	eax, DWORD PTR GPT_CR_SWR[rip]
	mov	edx, eax
	jne	.L4
	mov	ecx, DWORD PTR TARGET_FREQUENCY[rip]
	mov	eax, r13d
	cmp	ecx, r13d
	jle	.L13
.L5:
	mov	DWORD PTR 4[rbp], eax
	mov	esi, DWORD PTR IMX_GPT_PR[rip]
	mov	rdi, rbp
	call	WRITE4@PLT
	mov	edx, DWORD PTR GPT_IR_ALL[rip]
	mov	esi, DWORD PTR IMX_GPT_SR[rip]
	mov	rdi, rbp
	call	WRITE4@PLT
	or	ebx, DWORD PTR GPT_CR_EN[rip]
	mov	esi, DWORD PTR IMX_GPT_CR[rip]
	mov	rdi, rbp
	mov	edx, ebx
	call	WRITE4@PLT
	cmp	QWORD PTR bootverbose[rip], 0
	jne	.L14
.L6:
	mov	rax, QWORD PTR 56[rbp]
	sub	rsp, 8
	.cfi_def_cfa_offset 56
	mov	r9, rbp
	xor	r8d, r8d
	mov	edx, DWORD PTR INTR_TYPE_CLK[rip]
	mov	ecx, DWORD PTR imx_gpt_intr[rip]
	mov	edi, r12d
	mov	esi, DWORD PTR 4[rax]
	lea	rax, 64[rbp]
	push	rax
	.cfi_def_cfa_offset 64
	call	bus_setup_intr@PLT
	mov	r13d, eax
	pop	rax
	.cfi_def_cfa_offset 56
	pop	rdx
	.cfi_def_cfa_offset 48
	test	r13d, r13d
	jne	.L15
	mov	esi, DWORD PTR IMX_GPT_CNT[rip]
	mov	rdi, rbp
	call	READ4@PLT
	mov	esi, DWORD PTR IMX_GPT_OCR3[rip]
	xor	edx, edx
	mov	rdi, rbp
	call	WRITE4@PLT
	mov	esi, DWORD PTR IMX_GPT_CNT[rip]
	mov	rdi, rbp
	call	READ4@PLT
	lea	rax, .LC3[rip]
	mov	DWORD PTR 20[rbp], 800
	lea	rdi, 8[rbp]
	mov	QWORD PTR 8[rbp], rax
	mov	eax, DWORD PTR ET_FLAGS_ONESHOT[rip]
	or	eax, DWORD PTR ET_FLAGS_PERIODIC[rip]
	mov	QWORD PTR 28[rbp], 0
	mov	DWORD PTR 16[rbp], eax
	mov	eax, DWORD PTR 4[rbp]
	mov	QWORD PTR 40[rbp], rbp
	mov	DWORD PTR 24[rbp], eax
	mov	eax, DWORD PTR imx_gpt_timer_start[rip]
	mov	DWORD PTR 52[rbp], eax
	mov	eax, DWORD PTR imx_gpt_timer_stop[rip]
	mov	DWORD PTR 48[rbp], eax
	call	et_register@PLT
	mov	eax, DWORD PTR 4[rbp]
	lea	rdi, imx_gpt_timecounter[rip]
	mov	QWORD PTR imx_gpt_timecounter[rip+8], rbp
	mov	DWORD PTR imx_gpt_timecounter[rip], eax
	call	tc_init@PLT
	mov	edi, r12d
	call	device_get_unit@PLT
	test	rax, rax
	je	.L16
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	mov	eax, r13d
	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
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	cdq
	idiv	ecx
	mov	ecx, eax
	mov	eax, r13d
	cdq
	idiv	ecx
	lea	edx, -1[rcx]
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L15:
	mov	rdx, QWORD PTR 56[rbp]
	mov	esi, DWORD PTR imx_gpt_spec[rip]
	mov	edi, r12d
	call	bus_release_resources@PLT
	mov	edx, r13d
	mov	edi, r12d
	xor	eax, eax
	lea	rsi, .LC2[rip]
	call	device_printf@PLT
	mov	r13d, DWORD PTR ENXIO[rip]
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	mov	eax, r13d
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	.cfi_restore_state
	mov	esi, DWORD PTR IMX_GPT_PR[rip]
	mov	rdi, rbp
	call	READ4@PLT
	mov	esi, DWORD PTR IMX_GPT_CR[rip]
	mov	rdi, rbp
	mov	ebx, eax
	call	READ4@PLT
	movsx	rdx, DWORD PTR 4[rbp]
	mov	r9d, ebx
	mov	edi, r12d
	mov	r8d, eax
	lea	rsi, .LC1[rip]
	xor	eax, eax
	mov	rcx, rdx
	imul	rdx, rdx, 274877907
	sar	ecx, 31
	sar	rdx, 38
	sub	edx, ecx
	mov	ecx, r13d
	call	device_printf@PLT
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L12:
	mov	edi, r12d
	lea	rsi, .LC0[rip]
	xor	eax, eax
	call	device_printf@PLT
	mov	r13d, DWORD PTR ENXIO[rip]
	add	rsp, 8
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	pop	rbx
	.cfi_def_cfa_offset 32
	pop	rbp
	.cfi_def_cfa_offset 24
	mov	eax, r13d
	pop	r12
	.cfi_def_cfa_offset 16
	pop	r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	.cfi_restore_state
	mov	edi, DWORD PTR imx_gpt_do_delay[rip]
	mov	rsi, rbp
	call	arm_set_delay@PLT
	add	rsp, 8
	.cfi_def_cfa_offset 40
	mov	eax, r13d
	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	imx_gpt_attach, .-imx_gpt_attach
	.comm	imx_gpt_timer_stop,4,4
	.comm	imx_gpt_timer_start,4,4
	.comm	imx_gpt_timecounter,16,16
	.comm	imx_gpt_spec,4,4
	.comm	imx_gpt_intr,4,4
	.comm	imx_gpt_do_delay,4,4
	.comm	bootverbose,8,8
	.comm	TARGET_FREQUENCY,4,4
	.comm	INTR_TYPE_CLK,4,4
	.comm	IMX_GPT_SR,4,4
	.comm	IMX_GPT_PR,4,4
	.comm	IMX_GPT_OCR3,4,4
	.comm	IMX_GPT_IR,4,4
	.comm	IMX_GPT_CR,4,4
	.comm	IMX_GPT_CNT,4,4
	.comm	GPT_IR_ALL,4,4
	.comm	GPT_CR_WAITEN,4,4
	.comm	GPT_CR_SWR,4,4
	.comm	GPT_CR_STOPEN,4,4
	.comm	GPT_CR_FRR,4,4
	.comm	GPT_CR_EN,4,4
	.comm	GPT_CR_DOZEEN,4,4
	.comm	GPT_CR_DBGEN,4,4
	.comm	GPT_CR_24MEN,4,4
	.comm	ET_FLAGS_PERIODIC,4,4
	.comm	ET_FLAGS_ONESHOT,4,4
	.comm	ENXIO,4,4
	.comm	EINVAL,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_imx_gpt.c_imx_gpt_attach.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"could not allocate resources\012\000"
	.global	__aeabi_idiv
	.align	2
.LC1:
	.ascii	"Running on %dKHz clock, base freq %uHz CR=0x%08x, P"
	.ascii	"R=0x%08x\012\000"
	.align	2
.LC2:
	.ascii	"Unable to setup the clock irq handler, err = %d\012"
	.ascii	"\000"
	.align	2
.LC3:
	.ascii	"iMXGPT\000"
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	imx_gpt_attach, %function
imx_gpt_attach:
	@ 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, #16
	mov	r6, r0
	bl	device_get_softc
	ldr	r9, .L20
	ldr	r2, [r0, #44]
	mov	r4, r0
	ldr	r1, [r9]
	mov	r0, r6
	bl	bus_alloc_resources
	subs	r5, r0, #0
	bne	.L15
	ldr	r3, [r4, #44]
	str	r6, [r4, #60]
	ldr	r0, [r3]
	bl	rman_get_bustag
	ldr	r3, [r4, #44]
	str	r0, [r4, #56]
	ldr	r0, [r3]
	bl	rman_get_bushandle
	mov	r3, #130
	str	r0, [r4, #52]
	str	r3, [r4]
	bl	imx_ccm_ipg_hz
	ldr	r7, .L20+4
	mov	r2, r5
	ldr	r1, [r7]
	mov	r8, r0
	mov	r0, r4
	bl	WRITE4
	ldr	r3, .L20+8
	mov	r2, r5
	ldr	r1, [r3]
	mov	r0, r4
	bl	WRITE4
	ldr	r1, .L20+12
	ldr	r3, .L20+16
	ldr	r2, .L20+20
	ldr	r0, [r3]
	ldr	r5, [r1]
	ldr	r3, .L20+24
	ldr	r1, [r2]
	ldr	r2, .L20+28
	ldr	r3, [r3]
	orr	r5, r5, r0
	ldr	r2, [r2]
	orr	r5, r5, r1
	orr	r5, r5, r3
	ldr	r3, [r4]
	orr	r5, r5, r2
	orr	r5, r5, r3
	ldr	r10, .L20+32
	mov	r2, r5
	ldr	r1, [r7]
	mov	r0, r4
	bl	WRITE4
	ldr	r2, [r10]
	mov	r0, r4
	ldr	r1, [r7]
	orr	r2, r5, r2
	bl	WRITE4
.L4:
	mov	r0, r4
	ldr	r1, [r7]
	bl	READ4
	ldr	r2, [r10]
	ands	r2, r0, r2
	bne	.L4
	ldr	r3, .L20+36
	mov	r0, r8
	ldr	r1, [r3]
	cmp	r1, r8
	ble	.L16
.L5:
	ldr	r10, .L20+40
	str	r0, [r4, #4]
	ldr	r1, [r10]
	mov	r0, r4
	bl	WRITE4
	ldr	r3, .L20+44
	ldr	r2, .L20+48
	ldr	r1, [r3]
	ldr	r2, [r2]
	mov	r0, r4
	bl	WRITE4
	ldr	r3, .L20+52
	mov	r0, r4
	ldr	r2, [r3]
	ldr	r1, [r7]
	orr	r2, r5, r2
	bl	WRITE4
	ldr	r3, .L20+56
	ldr	r3, [r3]
	cmp	r3, #0
	bne	.L17
.L6:
	mov	ip, #0
	ldr	r2, [r4, #44]
	ldr	r3, .L20+60
	ldr	r1, [r2, #4]
	ldr	r2, .L20+64
	str	r4, [sp, #4]
	str	ip, [sp]
	add	r0, r4, #48
	ldr	r3, [r3]
	ldr	r2, [r2]
	str	r0, [sp, #8]
	mov	r0, r6
	bl	bus_setup_intr
	subs	r5, r0, #0
	bne	.L18
	ldr	r7, .L20+68
	mov	r0, r4
	ldr	r1, [r7]
	bl	READ4
	ldr	r3, .L20+72
	mov	r2, r5
	ldr	r1, [r3]
	mov	r0, r4
	bl	WRITE4
	ldr	r1, [r7]
	mov	r0, r4
	bl	READ4
	mov	r1, #800
	ldr	r3, .L20+76
	ldr	r2, .L20+80
	ldr	r3, [r3]
	ldr	r2, [r2]
	ldr	ip, .L20+84
	ldr	r0, .L20+88
	orr	r3, r3, r2
	ldr	ip, [ip]
	ldr	r2, .L20+92
	ldr	r0, [r0]
	str	r3, [r4, #12]
	ldr	r3, [r4, #4]
	str	ip, [r4, #40]
	str	r1, [r4, #16]
	str	r2, [r4, #8]
	str	r0, [r4, #36]
	str	r3, [r4, #20]
	str	r5, [r4, #24]
	str	r5, [r4, #28]
	str	r4, [r4, #32]
	add	r0, r4, #8
	bl	et_register
	ldr	r3, [r4, #4]
	ldr	r0, .L20+96
	stm	r0, {r3, r4}
	bl	tc_init
	mov	r0, r6
	bl	device_get_unit
	cmp	r0, #0
	beq	.L19
	mov	r0, r5
	add	sp, sp, #16
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L16:
	bl	__aeabi_idiv
	mov	r10, r0
	mov	r0, r8
	mov	r1, r10
	bl	__aeabi_idiv
	sub	r2, r10, #1
	b	.L5
.L18:
	ldr	r2, [r4, #44]
	ldr	r1, [r9]
	mov	r0, r6
	bl	bus_release_resources
	mov	r2, r5
	mov	r0, r6
	ldr	r1, .L20+100
	bl	device_printf
	ldr	r3, .L20+104
	ldr	r5, [r3]
	mov	r0, r5
	add	sp, sp, #16
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L17:
	ldr	r3, [r4, #4]
	ldr	r5, .L20+108
	ldr	r1, [r7]
	smull	r2, r5, r3, r5
	mov	r0, r4
	asr	r3, r3, #31
	rsb	r5, r3, r5, asr #6
	bl	READ4
	ldr	r1, [r10]
	mov	r7, r0
	mov	r0, r4
	bl	READ4
	mov	r2, r5
	str	r0, [sp, #4]
	mov	r3, r8
	mov	r0, r6
	ldr	r1, .L20+112
	str	r7, [sp]
	bl	device_printf
	b	.L6
.L15:
	mov	r0, r6
	ldr	r1, .L20+116
	bl	device_printf
	ldr	r3, .L20+104
	ldr	r5, [r3]
	mov	r0, r5
	add	sp, sp, #16
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L19:
	ldr	r3, .L20+120
	mov	r1, r4
	ldr	r0, [r3]
	bl	arm_set_delay
	mov	r0, r5
	add	sp, sp, #16
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, pc}
.L21:
	.align	2
.L20:
	.word	imx_gpt_spec
	.word	IMX_GPT_CR
	.word	IMX_GPT_IR
	.word	GPT_CR_FRR
	.word	GPT_CR_STOPEN
	.word	GPT_CR_DOZEEN
	.word	GPT_CR_WAITEN
	.word	GPT_CR_DBGEN
	.word	GPT_CR_SWR
	.word	TARGET_FREQUENCY
	.word	IMX_GPT_PR
	.word	IMX_GPT_SR
	.word	GPT_IR_ALL
	.word	GPT_CR_EN
	.word	bootverbose
	.word	imx_gpt_intr
	.word	INTR_TYPE_CLK
	.word	IMX_GPT_CNT
	.word	IMX_GPT_OCR3
	.word	ET_FLAGS_ONESHOT
	.word	ET_FLAGS_PERIODIC
	.word	imx_gpt_timer_start
	.word	imx_gpt_timer_stop
	.word	.LC3
	.word	imx_gpt_timecounter
	.word	.LC2
	.word	ENXIO
	.word	274877907
	.word	.LC1
	.word	.LC0
	.word	imx_gpt_do_delay
	.size	imx_gpt_attach, .-imx_gpt_attach
	.comm	imx_gpt_timer_stop,4,4
	.comm	imx_gpt_timer_start,4,4
	.comm	imx_gpt_timecounter,8,4
	.comm	imx_gpt_spec,4,4
	.comm	imx_gpt_intr,4,4
	.comm	imx_gpt_do_delay,4,4
	.comm	bootverbose,4,4
	.comm	TARGET_FREQUENCY,4,4
	.comm	INTR_TYPE_CLK,4,4
	.comm	IMX_GPT_SR,4,4
	.comm	IMX_GPT_PR,4,4
	.comm	IMX_GPT_OCR3,4,4
	.comm	IMX_GPT_IR,4,4
	.comm	IMX_GPT_CR,4,4
	.comm	IMX_GPT_CNT,4,4
	.comm	GPT_IR_ALL,4,4
	.comm	GPT_CR_WAITEN,4,4
	.comm	GPT_CR_SWR,4,4
	.comm	GPT_CR_STOPEN,4,4
	.comm	GPT_CR_FRR,4,4
	.comm	GPT_CR_EN,4,4
	.comm	GPT_CR_DOZEEN,4,4
	.comm	GPT_CR_DBGEN,4,4
	.comm	GPT_CR_24MEN,4,4
	.comm	ET_FLAGS_PERIODIC,4,4
	.comm	ET_FLAGS_ONESHOT,4,4
	.comm	ENXIO,4,4
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
