	.file	"extr_sm501.c_sm501_init_dev.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"incorrect device id %08lx\n"
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC1:
	.string	"SM501 At %p: Version %08lx, %ld Mb, IRQ %d\n"
	.align 8
.LC2:
	.string	"failed to create debug regs file\n"
	.align 8
.LC3:
	.string	"no gpio available for i2c gpio.\n"
	.align 8
.LC4:
	.string	"M1X and M clocks sourced from different PLLs\n"
	.text
	.p2align 4
	.type	sm501_init_dev, @function
sm501_init_dev:
.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
	add	rdi, 48
	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	mutex_init@PLT
	lea	rdi, 44[rbp]
	call	spin_lock_init@PLT
	lea	rdi, 40[rbp]
	call	INIT_LIST_HEAD@PLT
	mov	rdi, QWORD PTR SM501_DEVICEID[rip]
	add	rdi, QWORD PTR 32[rbp]
	call	smc501_readl@PLT
	mov	r12, rax
	and	rax, QWORD PTR SM501_DEVICEID_IDMASK[rip]
	cmp	rax, QWORD PTR SM501_DEVICEID_SM501[rip]
	je	.L2
	mov	edi, DWORD PTR 8[rbp]
	mov	rdx, r12
	lea	rsi, .LC0[rip]
	xor	eax, eax
	call	dev_err@PLT
	mov	r12d, DWORD PTR EINVAL[rip]
	neg	r12d
.L1:
	mov	rax, QWORD PTR 8[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L33
	add	rsp, 16
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	mov	eax, r12d
	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
.L2:
	.cfi_restore_state
	xor	edi, edi
	mov	rsi, QWORD PTR SM501_IRQ_MASK[rip]
	add	rsi, QWORD PTR 32[rbp]
	call	smc501_writel@PLT
	mov	rdi, QWORD PTR SM501_DRAM_CONTROL[rip]
	add	rdi, QWORD PTR 32[rbp]
	call	smc501_readl@PLT
	mov	edi, DWORD PTR 8[rbp]
	mov	r9d, DWORD PTR 24[rbp]
	mov	rcx, r12
	mov	rdx, QWORD PTR sm501_mem_local[rip]
	shr	rax, 13
	lea	rsi, .LC1[rip]
	and	eax, 7
	mov	r8, QWORD PTR [rdx+rax*8]
	mov	rdx, QWORD PTR 32[rbp]
	mov	QWORD PTR [rsp], r8
	shr	r8, 20
	call	dev_info@PLT
	and	r12, QWORD PTR SM501_DEVICEID_REVMASK[rip]
	mov	rdi, rbp
	mov	QWORD PTR 0[rbp], r12
	call	sm501_dump_gate@PLT
	mov	edi, DWORD PTR 8[rbp]
	lea	rsi, dev_attr_dbg_regs[rip]
	call	device_create_file@PLT
	test	eax, eax
	jne	.L34
.L4:
	mov	rdi, rbp
	call	sm501_dump_clk@PLT
	mov	r12, QWORD PTR 16[rbp]
	test	r12, r12
	je	.L6
	mov	rbx, QWORD PTR 16[r12]
	test	rbx, rbx
	je	.L10
	mov	rsi, rbx
	mov	rdi, rbp
	call	sm501_init_regs@PLT
	mov	esi, DWORD PTR [rbx]
	test	DWORD PTR SM501_USE_USB_HOST[rip], esi
	jne	.L35
.L8:
	mov	eax, DWORD PTR SM501_USE_UART0[rip]
	or	eax, DWORD PTR SM501_USE_UART1[rip]
	test	eax, esi
	jne	.L36
.L9:
	test	DWORD PTR SM501_USE_GPIO[rip], esi
	je	.L10
	mov	rdi, rbp
	call	sm501_register_gpio@PLT
	.p2align 4,,10
	.p2align 3
.L10:
	cmp	QWORD PTR 8[r12], 0
	je	.L6
	cmp	QWORD PTR [r12], 0
	jle	.L6
	mov	rdi, rbp
	call	sm501_gpio_isregistered@PLT
	test	eax, eax
	jne	.L12
	mov	edi, DWORD PTR 8[rbp]
	lea	rsi, .LC3[rip]
	call	dev_err@PLT
	.p2align 4,,10
	.p2align 3
.L6:
	mov	rdi, rbp
	call	sm501_check_clocks@PLT
	mov	r12d, eax
	test	eax, eax
	jne	.L37
	mov	rsi, rsp
	mov	rdi, rbp
	call	sm501_register_display@PLT
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L37:
	mov	edi, DWORD PTR 8[rbp]
	lea	rsi, .LC4[rip]
	xor	eax, eax
	call	dev_err@PLT
	mov	r12d, DWORD PTR EINVAL[rip]
	neg	r12d
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L34:
	mov	edi, DWORD PTR 8[rbp]
	lea	rsi, .LC2[rip]
	xor	eax, eax
	call	dev_err@PLT
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L36:
	mov	rdi, rbp
	call	sm501_register_uart@PLT
	mov	esi, DWORD PTR [rbx]
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L35:
	mov	rsi, rsp
	mov	rdi, rbp
	call	sm501_register_usbhost@PLT
	mov	esi, DWORD PTR [rbx]
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L12:
	mov	rsi, r12
	mov	rdi, rbp
	call	sm501_register_gpio_i2c@PLT
	jmp	.L6
.L33:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	sm501_init_dev, .-sm501_init_dev
	.comm	sm501_mem_local,8,8
	.comm	dev_attr_dbg_regs,4,4
	.comm	SM501_USE_USB_HOST,4,4
	.comm	SM501_USE_UART1,4,4
	.comm	SM501_USE_UART0,4,4
	.comm	SM501_USE_GPIO,4,4
	.comm	SM501_IRQ_MASK,8,8
	.comm	SM501_DRAM_CONTROL,8,8
	.comm	SM501_DEVICEID_SM501,8,8
	.comm	SM501_DEVICEID_REVMASK,8,8
	.comm	SM501_DEVICEID_IDMASK,8,8
	.comm	SM501_DEVICEID,8,8
	.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_sm501.c_sm501_init_dev.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"incorrect device id %08lx\012\000"
	.align	2
.LC1:
	.ascii	"SM501 At %p: Version %08lx, %ld Mb, IRQ %d\012\000"
	.align	2
.LC2:
	.ascii	"failed to create debug regs file\012\000"
	.align	2
.LC3:
	.ascii	"no gpio available for i2c gpio.\012\000"
	.align	2
.LC4:
	.ascii	"M1X and M clocks sourced from different PLLs\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC5:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	sm501_init_dev, %function
sm501_init_dev:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, lr}
	mov	r4, r0
	ldr	r3, .L38
	sub	sp, sp, #16
	add	r0, r0, #28
	ldr	r3, [r3]
	str	r3, [sp, #12]
	mov	r3,#0
	bl	mutex_init
	add	r0, r4, #24
	bl	spin_lock_init
	add	r0, r4, #20
	bl	INIT_LIST_HEAD
	ldr	r3, .L38+4
	ldr	r0, [r4, #16]
	ldr	r3, [r3]
	add	r0, r0, r3
	bl	smc501_readl
	ldr	r3, .L38+8
	ldr	r2, .L38+12
	ldr	r3, [r3]
	ldr	r2, [r2]
	and	r3, r3, r0
	cmp	r3, r2
	mov	r5, r0
	beq	.L2
	mov	r2, r0
	ldr	r1, .L38+16
	ldr	r0, [r4, #4]
	bl	dev_err
	ldr	r3, .L38+20
	ldr	r5, [r3]
	rsb	r5, r5, #0
.L1:
	ldr	r3, .L38
	ldr	r2, [r3]
	ldr	r3, [sp, #12]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L33
	mov	r0, r5
	add	sp, sp, #16
	@ sp needed
	pop	{r4, r5, r6, pc}
.L2:
	ldr	r3, .L38+24
	ldr	r1, [r4, #16]
	ldr	r3, [r3]
	mov	r0, #0
	add	r1, r1, r3
	bl	smc501_writel
	ldr	r3, .L38+28
	ldr	r0, [r4, #16]
	ldr	r3, [r3]
	add	r0, r0, r3
	bl	smc501_readl
	ldr	r3, .L38+32
	lsr	r0, r0, #13
	ldr	r3, [r3]
	and	r0, r0, #7
	ldr	ip, [r3, r0, lsl #2]
	ldr	r3, [r4, #12]
	lsr	r2, ip, #20
	stm	sp, {r2, r3}
	ldr	r1, .L38+36
	ldr	r2, [r4, #16]
	mov	r3, r5
	ldr	r0, [r4, #4]
	str	ip, [sp, #8]
	bl	dev_info
	ldr	r3, .L38+40
	mov	r0, r4
	ldr	r3, [r3]
	and	r3, r3, r5
	str	r3, [r4]
	bl	sm501_dump_gate
	ldr	r1, .L38+44
	ldr	r0, [r4, #4]
	bl	device_create_file
	cmp	r0, #0
	bne	.L34
.L4:
	mov	r0, r4
	bl	sm501_dump_clk
	ldr	r5, [r4, #8]
	cmp	r5, #0
	beq	.L6
	ldr	r6, [r5, #8]
	cmp	r6, #0
	beq	.L10
	mov	r1, r6
	mov	r0, r4
	bl	sm501_init_regs
	ldr	r3, .L38+48
	ldr	r1, [r6]
	ldr	r3, [r3]
	tst	r1, r3
	bne	.L35
.L8:
	ldr	r3, .L38+52
	ldr	r2, .L38+56
	ldr	r3, [r3]
	ldr	r2, [r2]
	orr	r3, r3, r2
	tst	r3, r1
	bne	.L36
.L9:
	ldr	r3, .L38+60
	ldr	r3, [r3]
	tst	r1, r3
	beq	.L10
	mov	r0, r4
	bl	sm501_register_gpio
.L10:
	ldr	r3, [r5, #4]
	cmp	r3, #0
	beq	.L6
	ldr	r3, [r5]
	cmp	r3, #0
	ble	.L6
	mov	r0, r4
	bl	sm501_gpio_isregistered
	cmp	r0, #0
	bne	.L12
	ldr	r1, .L38+64
	ldr	r0, [r4, #4]
	bl	dev_err
.L6:
	mov	r0, r4
	bl	sm501_check_clocks
	subs	r5, r0, #0
	bne	.L37
	mov	r0, r4
	add	r1, sp, #8
	bl	sm501_register_display
	b	.L1
.L37:
	ldr	r0, [r4, #4]
	ldr	r1, .L38+68
	bl	dev_err
	ldr	r3, .L38+20
	ldr	r5, [r3]
	rsb	r5, r5, #0
	b	.L1
.L34:
	ldr	r1, .L38+72
	ldr	r0, [r4, #4]
	bl	dev_err
	b	.L4
.L36:
	mov	r0, r4
	bl	sm501_register_uart
	ldr	r1, [r6]
	b	.L9
.L35:
	add	r1, sp, #8
	mov	r0, r4
	bl	sm501_register_usbhost
	ldr	r1, [r6]
	b	.L8
.L12:
	mov	r1, r5
	mov	r0, r4
	bl	sm501_register_gpio_i2c
	b	.L6
.L33:
	bl	__stack_chk_fail
.L39:
	.align	2
.L38:
	.word	.LC5
	.word	SM501_DEVICEID
	.word	SM501_DEVICEID_IDMASK
	.word	SM501_DEVICEID_SM501
	.word	.LC0
	.word	EINVAL
	.word	SM501_IRQ_MASK
	.word	SM501_DRAM_CONTROL
	.word	sm501_mem_local
	.word	.LC1
	.word	SM501_DEVICEID_REVMASK
	.word	dev_attr_dbg_regs
	.word	SM501_USE_USB_HOST
	.word	SM501_USE_UART0
	.word	SM501_USE_UART1
	.word	SM501_USE_GPIO
	.word	.LC3
	.word	.LC4
	.word	.LC2
	.size	sm501_init_dev, .-sm501_init_dev
	.comm	sm501_mem_local,4,4
	.comm	dev_attr_dbg_regs,4,4
	.comm	SM501_USE_USB_HOST,4,4
	.comm	SM501_USE_UART1,4,4
	.comm	SM501_USE_UART0,4,4
	.comm	SM501_USE_GPIO,4,4
	.comm	SM501_IRQ_MASK,4,4
	.comm	SM501_DRAM_CONTROL,4,4
	.comm	SM501_DEVICEID_SM501,4,4
	.comm	SM501_DEVICEID_REVMASK,4,4
	.comm	SM501_DEVICEID_IDMASK,4,4
	.comm	SM501_DEVICEID,4,4
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
