	.file	"extr_rtsx_card.c_rtsx_init_cards.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"Reset chip in polling thread!\n"
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"chip->need_release = 0x%x\n"
.LC2:
	.string	"chip->card_exist = 0x%x\n"
.LC3:
	.string	"chip->need_reset = 0x%x\n"
.LC4:
	.string	"chip->need_reinit = 0x%x\n"
	.text
	.p2align 4
	.globl	rtsx_init_cards
	.type	rtsx_init_cards, @function
rtsx_init_cards:
.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
	push	rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	call	RTSX_TST_DELINK@PLT
	test	rax, rax
	jne	.L42
.L3:
	mov	esi, DWORD PTR 0[rbp]
	test	esi, esi
	jne	.L43
.L6:
	mov	rbx, QWORD PTR 40[rbp]
	test	rbx, rbx
	jne	.L44
.L19:
	mov	rbx, QWORD PTR 32[rbp]
	test	rbx, rbx
	jne	.L45
.L1:
	pop	rbx
	.cfi_remember_state
	.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
.L42:
	.cfi_restore_state
	mov	rdi, rbp
	call	rtsx_get_stat@PLT
	cmp	rax, QWORD PTR RTSX_STAT_SS[rip]
	je	.L3
	mov	rdi, rbp
	call	rtsx_dev@PLT
	lea	rsi, .LC0[rip]
	mov	edi, eax
	xor	eax, eax
	call	dev_dbg@PLT
	mov	rdi, rbp
	call	rtsx_reset_chip@PLT
	mov	rdi, rbp
	call	RTSX_CLR_DELINK@PLT
	mov	esi, DWORD PTR 0[rbp]
	test	esi, esi
	je	.L6
	.p2align 4,,10
	.p2align 3
.L43:
	mov	esi, 21128
	mov	rdi, rbp
	call	CHECK_PID@PLT
	test	rax, rax
	jne	.L46
.L8:
	mov	eax, DWORD PTR 8[rbp]
	test	DWORD PTR SD_CARD[rip], eax
	je	.L47
.L10:
	test	DWORD PTR XD_CARD[rip], eax
	je	.L48
.L11:
	test	DWORD PTR MS_CARD[rip], eax
	je	.L49
.L12:
	mov	r12d, DWORD PTR 0[rbp]
	mov	rdi, rbp
	call	rtsx_dev@PLT
	lea	rsi, .LC1[rip]
	mov	edi, eax
	mov	edx, r12d
	xor	eax, eax
	call	dev_dbg@PLT
	mov	edx, DWORD PTR 0[rbp]
	test	edx, edx
	jne	.L50
.L13:
	mov	r12d, DWORD PTR 8[rbp]
	mov	rdi, rbp
	call	rtsx_dev@PLT
	lea	rsi, .LC2[rip]
	mov	edi, eax
	mov	edx, r12d
	xor	eax, eax
	call	dev_dbg@PLT
	mov	eax, DWORD PTR 8[rbp]
	test	eax, eax
	jne	.L6
	mov	esi, DWORD PTR LED_GPIO[rip]
	mov	rdi, rbp
	call	turn_off_led@PLT
	mov	rbx, QWORD PTR 40[rbp]
	test	rbx, rbx
	je	.L19
	.p2align 4,,10
	.p2align 3
.L44:
	mov	rdi, rbp
	call	rtsx_dev@PLT
	mov	edx, ebx
	lea	rsi, .LC3[rip]
	mov	edi, eax
	xor	eax, eax
	call	dev_dbg@PLT
	mov	rdi, rbp
	call	rtsx_reset_cards@PLT
	mov	rbx, QWORD PTR 32[rbp]
	test	rbx, rbx
	je	.L1
.L45:
	mov	rdi, rbp
	call	rtsx_dev@PLT
	mov	edx, ebx
	lea	rsi, .LC4[rip]
	mov	edi, eax
	xor	eax, eax
	call	dev_dbg@PLT
	pop	rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	mov	rdi, rbp
	xor	esi, esi
	pop	rbp
	.cfi_def_cfa_offset 16
	pop	r12
	.cfi_def_cfa_offset 8
	jmp	rtsx_reinit_cards@PLT
	.p2align 4,,10
	.p2align 3
.L47:
	.cfi_restore_state
	mov	ecx, DWORD PTR 60[rbp]
	test	ecx, ecx
	jne	.L10
	mov	edi, DWORD PTR SD_NR[rip]
	mov	rsi, rbp
	call	clear_bit@PLT
	mov	eax, DWORD PTR 8[rbp]
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L46:
	mov	esi, DWORD PTR QFN[rip]
	mov	rdi, rbp
	call	CHECK_BARO_PKG@PLT
	test	rax, rax
	je	.L8
	mov	eax, DWORD PTR 4[rbp]
	test	DWORD PTR XD_EXIST[rip], eax
	je	.L8
	mov	edi, DWORD PTR SD_NR[rip]
	mov	rsi, rbp
	call	clear_bit@PLT
	mov	edi, DWORD PTR MS_NR[rip]
	mov	rsi, rbp
	call	clear_bit@PLT
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L50:
	mov	esi, DWORD PTR RTSX_STAT_RUN[rip]
	mov	rdi, rbp
	call	rtsx_set_stat@PLT
	mov	esi, DWORD PTR SSC_PDCTL[rip]
	mov	rdi, rbp
	or	esi, DWORD PTR OC_PDCTL[rip]
	call	rtsx_force_power_on@PLT
	mov	eax, DWORD PTR 0[rbp]
	test	DWORD PTR SD_CARD[rip], eax
	je	.L14
	mov	edi, DWORD PTR SD_NR[rip]
	mov	rsi, rbp
	call	clear_bit@PLT
	movsx	rax, DWORD PTR SD_CARD[rip]
	mov	edi, DWORD PTR 56[rbp]
	mov	edx, eax
	not	edx
	and	DWORD PTR 8[rbp], edx
	and	DWORD PTR 16[rbp], edx
	and	DWORD PTR 20[rbp], edx
	mov	rdx, QWORD PTR 24[rbp]
	mov	rsi, QWORD PTR [rdx+rax*8]
	call	CLR_BIT@PLT
	mov	rax, QWORD PTR 24[rbp]
	movsx	rdx, DWORD PTR SD_CARD[rip]
	mov	rdi, rbp
	mov	esi, DWORD PTR RBCTL[rip]
	mov	rdx, QWORD PTR [rax+rdx*8]
	mov	rax, QWORD PTR 48[rbp]
	mov	QWORD PTR [rax+rdx*8], 0
	mov	edx, DWORD PTR RB_FLUSH[rip]
	mov	ecx, edx
	call	rtsx_write_register@PLT
	mov	rdi, rbp
	call	release_sdio@PLT
	mov	rdi, rbp
	call	release_sd_card@PLT
	mov	eax, DWORD PTR 0[rbp]
.L14:
	test	DWORD PTR XD_CARD[rip], eax
	je	.L15
	mov	edi, DWORD PTR XD_NR[rip]
	mov	rsi, rbp
	call	clear_bit@PLT
	movsx	rax, DWORD PTR XD_CARD[rip]
	mov	edi, DWORD PTR 56[rbp]
	mov	edx, eax
	not	edx
	and	DWORD PTR 8[rbp], edx
	and	DWORD PTR 16[rbp], edx
	and	DWORD PTR 20[rbp], edx
	mov	rdx, QWORD PTR 24[rbp]
	mov	rsi, QWORD PTR [rdx+rax*8]
	call	CLR_BIT@PLT
	mov	rax, QWORD PTR 24[rbp]
	movsx	rdx, DWORD PTR XD_CARD[rip]
	mov	rdi, rbp
	mov	rdx, QWORD PTR [rax+rdx*8]
	mov	rax, QWORD PTR 48[rbp]
	mov	QWORD PTR [rax+rdx*8], 0
	call	release_xd_card@PLT
	mov	esi, 21128
	mov	rdi, rbp
	call	CHECK_PID@PLT
	test	rax, rax
	jne	.L16
.L40:
	mov	eax, DWORD PTR 0[rbp]
.L15:
	test	DWORD PTR MS_CARD[rip], eax
	je	.L13
	mov	edi, DWORD PTR MS_NR[rip]
	mov	rsi, rbp
	call	clear_bit@PLT
	movsx	rax, DWORD PTR MS_CARD[rip]
	mov	edi, DWORD PTR 56[rbp]
	mov	edx, eax
	not	edx
	and	DWORD PTR 8[rbp], edx
	and	DWORD PTR 16[rbp], edx
	and	DWORD PTR 20[rbp], edx
	mov	rdx, QWORD PTR 24[rbp]
	mov	rsi, QWORD PTR [rdx+rax*8]
	call	CLR_BIT@PLT
	mov	rax, QWORD PTR 24[rbp]
	movsx	rdx, DWORD PTR MS_CARD[rip]
	mov	rdi, rbp
	mov	rdx, QWORD PTR [rax+rdx*8]
	mov	rax, QWORD PTR 48[rbp]
	mov	QWORD PTR [rax+rdx*8], 0
	call	release_ms_card@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L49:
	mov	edi, DWORD PTR MS_NR[rip]
	mov	rsi, rbp
	call	clear_bit@PLT
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L48:
	mov	edi, DWORD PTR XD_NR[rip]
	mov	rsi, rbp
	call	clear_bit@PLT
	mov	eax, DWORD PTR 8[rbp]
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L16:
	mov	esi, DWORD PTR QFN[rip]
	mov	rdi, rbp
	call	CHECK_BARO_PKG@PLT
	test	rax, rax
	je	.L40
	mov	esi, DWORD PTR HOST_SLEEP_STATE[rip]
	mov	ecx, 192
	mov	edx, 192
	mov	rdi, rbp
	call	rtsx_write_register@PLT
	jmp	.L40
	.cfi_endproc
.LFE0:
	.size	rtsx_init_cards, .-rtsx_init_cards
	.comm	XD_NR,4,4
	.comm	XD_EXIST,4,4
	.comm	XD_CARD,4,4
	.comm	SSC_PDCTL,4,4
	.comm	SD_NR,4,4
	.comm	SD_CARD,4,4
	.comm	RTSX_STAT_SS,8,8
	.comm	RTSX_STAT_RUN,4,4
	.comm	RB_FLUSH,4,4
	.comm	RBCTL,4,4
	.comm	QFN,4,4
	.comm	OC_PDCTL,4,4
	.comm	OCPCLR,4,4
	.comm	MS_NR,4,4
	.comm	MS_CARD,4,4
	.comm	LED_GPIO,4,4
	.comm	HOST_SLEEP_STATE,4,4
	.comm	CARD_OC_NOW,4,4
	.comm	CARD_OC_INT_CLR,4,4
	.comm	CARD_OC_EVER,4,4
	.comm	CARD_OC_CLR,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_rtsx_card.c_rtsx_init_cards.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Reset chip in polling thread!\012\000"
	.align	2
.LC1:
	.ascii	"chip->need_release = 0x%x\012\000"
	.align	2
.LC2:
	.ascii	"chip->card_exist = 0x%x\012\000"
	.align	2
.LC3:
	.ascii	"chip->need_reset = 0x%x\012\000"
	.align	2
.LC4:
	.ascii	"chip->need_reinit = 0x%x\012\000"
	.text
	.align	2
	.global	rtsx_init_cards
	.syntax unified
	.arm
	.fpu softvfp
	.type	rtsx_init_cards, %function
rtsx_init_cards:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	mov	r4, r0
	bl	RTSX_TST_DELINK
	cmp	r0, #0
	bne	.L45
.L3:
	ldr	r3, [r4]
	cmp	r3, #0
	bne	.L46
.L6:
	ldr	r3, [r4, #32]
	cmp	r3, #0
	bne	.L47
.L19:
	ldr	r3, [r4, #28]
	cmp	r3, #0
	popeq	{r4, r5, r6, r7, r8, pc}
	mov	r0, r4
	bl	rtsx_dev
	ldr	r2, [r4, #28]
	ldr	r1, .L53
	bl	dev_dbg
	mov	r0, r4
	pop	{r4, r5, r6, r7, r8, lr}
	mov	r1, #0
	b	rtsx_reinit_cards
.L47:
	mov	r0, r4
	bl	rtsx_dev
	ldr	r2, [r4, #32]
	ldr	r1, .L53+4
	bl	dev_dbg
	mov	r0, r4
	bl	rtsx_reset_cards
	b	.L19
.L46:
	mov	r0, r4
	ldr	r1, .L53+8
	bl	CHECK_PID
	cmp	r0, #0
	bne	.L48
.L8:
	ldr	r7, .L53+12
	ldr	r3, [r4, #8]
	ldr	r2, [r7]
	tst	r3, r2
	beq	.L49
.L10:
	ldr	r6, .L53+16
	ldr	r2, [r6]
	tst	r3, r2
	beq	.L50
.L11:
	ldr	r5, .L53+20
	ldr	r2, [r5]
	tst	r3, r2
	beq	.L51
.L12:
	mov	r0, r4
	bl	rtsx_dev
	ldr	r2, [r4]
	ldr	r1, .L53+24
	bl	dev_dbg
	ldr	r3, [r4]
	cmp	r3, #0
	bne	.L52
.L13:
	mov	r0, r4
	bl	rtsx_dev
	ldr	r2, [r4, #8]
	ldr	r1, .L53+28
	bl	dev_dbg
	ldr	r3, [r4, #8]
	cmp	r3, #0
	bne	.L6
	ldr	r3, .L53+32
	mov	r0, r4
	ldr	r1, [r3]
	bl	turn_off_led
	b	.L6
.L45:
	mov	r0, r4
	bl	rtsx_get_stat
	ldr	r3, .L53+36
	ldr	r3, [r3]
	cmp	r0, r3
	beq	.L3
	mov	r0, r4
	bl	rtsx_dev
	ldr	r1, .L53+40
	bl	dev_dbg
	mov	r0, r4
	bl	rtsx_reset_chip
	mov	r0, r4
	bl	RTSX_CLR_DELINK
	b	.L3
.L49:
	ldr	r2, [r4, #44]
	cmp	r2, #0
	bne	.L10
	ldr	r3, .L53+44
	mov	r1, r4
	ldr	r0, [r3]
	bl	clear_bit
	ldr	r3, [r4, #8]
	b	.L10
.L48:
	ldr	r3, .L53+48
	mov	r0, r4
	ldr	r1, [r3]
	bl	CHECK_BARO_PKG
	cmp	r0, #0
	beq	.L8
	ldr	r3, .L53+52
	ldr	r2, [r4, #4]
	ldr	r3, [r3]
	tst	r2, r3
	beq	.L8
	ldr	r3, .L53+44
	mov	r1, r4
	ldr	r0, [r3]
	bl	clear_bit
	ldr	r3, .L53+56
	mov	r1, r4
	ldr	r0, [r3]
	bl	clear_bit
	b	.L8
.L52:
	ldr	r3, .L53+60
	mov	r0, r4
	ldr	r1, [r3]
	bl	rtsx_set_stat
	ldr	r2, .L53+64
	ldr	r3, .L53+68
	ldr	r1, [r2]
	ldr	r3, [r3]
	mov	r0, r4
	orr	r1, r1, r3
	bl	rtsx_force_power_on
	ldr	r3, [r4]
	ldr	r2, [r7]
	tst	r3, r2
	beq	.L14
	ldr	r3, .L53+44
	mov	r1, r4
	ldr	r0, [r3]
	bl	clear_bit
	ldr	r3, [r7]
	ldr	r0, [r4, #8]
	ldr	r1, [r4, #16]
	bic	r0, r0, r3
	ldr	r2, [r4, #20]
	str	r0, [r4, #8]
	ldr	r0, [r4, #24]
	bic	r1, r1, r3
	bic	r2, r2, r3
	str	r1, [r4, #16]
	str	r2, [r4, #20]
	ldr	r1, [r0, r3, lsl #2]
	ldr	r0, [r4, #40]
	bl	CLR_BIT
	mov	ip, #0
	ldr	r1, [r7]
	ldr	r2, [r4, #24]
	ldr	r3, .L53+72
	ldr	r0, [r2, r1, lsl #2]
	ldr	r3, [r3]
	ldr	r2, [r4, #36]
	ldr	r1, .L53+76
	str	ip, [r2, r0, lsl #2]
	ldr	r1, [r1]
	mov	r2, r3
	mov	r0, r4
	bl	rtsx_write_register
	mov	r0, r4
	bl	release_sdio
	mov	r0, r4
	bl	release_sd_card
	ldr	r3, [r4]
.L14:
	ldr	r2, [r6]
	tst	r3, r2
	beq	.L15
	ldr	r3, .L53+80
	mov	r1, r4
	ldr	r0, [r3]
	bl	clear_bit
	ldr	r3, [r6]
	ldr	r1, [r4, #16]
	ldr	r0, [r4, #8]
	bic	r1, r1, r3
	ldr	r2, [r4, #20]
	str	r1, [r4, #16]
	ldr	r1, [r4, #24]
	bic	r0, r0, r3
	bic	r2, r2, r3
	ldr	r1, [r1, r3, lsl #2]
	str	r0, [r4, #8]
	str	r2, [r4, #20]
	ldr	r0, [r4, #40]
	bl	CLR_BIT
	mov	r1, #0
	ldr	r0, [r6]
	ldr	r2, [r4, #24]
	ldr	r3, [r4, #36]
	ldr	r2, [r2, r0, lsl #2]
	mov	r0, r4
	str	r1, [r3, r2, lsl #2]
	bl	release_xd_card
	mov	r0, r4
	ldr	r1, .L53+8
	bl	CHECK_PID
	cmp	r0, #0
	bne	.L16
.L43:
	ldr	r3, [r4]
.L15:
	ldr	r2, [r5]
	tst	r3, r2
	beq	.L13
	ldr	r3, .L53+56
	mov	r1, r4
	ldr	r0, [r3]
	bl	clear_bit
	ldr	r3, [r5]
	ldr	r0, [r4, #8]
	ldr	r1, [r4, #16]
	ldr	r2, [r4, #20]
	bic	r0, r0, r3
	str	r0, [r4, #8]
	ldr	r0, [r4, #24]
	bic	r1, r1, r3
	bic	r2, r2, r3
	str	r1, [r4, #16]
	str	r2, [r4, #20]
	ldr	r1, [r0, r3, lsl #2]
	ldr	r0, [r4, #40]
	bl	CLR_BIT
	mov	r1, #0
	ldr	r0, [r5]
	ldr	r2, [r4, #24]
	ldr	r3, [r4, #36]
	ldr	r2, [r2, r0, lsl #2]
	mov	r0, r4
	str	r1, [r3, r2, lsl #2]
	bl	release_ms_card
	b	.L13
.L51:
	ldr	r3, .L53+56
	mov	r1, r4
	ldr	r0, [r3]
	bl	clear_bit
	b	.L12
.L50:
	ldr	r3, .L53+80
	mov	r1, r4
	ldr	r0, [r3]
	bl	clear_bit
	ldr	r3, [r4, #8]
	b	.L11
.L16:
	ldr	r3, .L53+48
	mov	r0, r4
	ldr	r1, [r3]
	bl	CHECK_BARO_PKG
	cmp	r0, #0
	beq	.L43
	mov	r3, #192
	ldr	r1, .L53+84
	mov	r2, r3
	mov	r0, r4
	ldr	r1, [r1]
	bl	rtsx_write_register
	b	.L43
.L54:
	.align	2
.L53:
	.word	.LC4
	.word	.LC3
	.word	21128
	.word	SD_CARD
	.word	XD_CARD
	.word	MS_CARD
	.word	.LC1
	.word	.LC2
	.word	LED_GPIO
	.word	RTSX_STAT_SS
	.word	.LC0
	.word	SD_NR
	.word	QFN
	.word	XD_EXIST
	.word	MS_NR
	.word	RTSX_STAT_RUN
	.word	SSC_PDCTL
	.word	OC_PDCTL
	.word	RB_FLUSH
	.word	RBCTL
	.word	XD_NR
	.word	HOST_SLEEP_STATE
	.size	rtsx_init_cards, .-rtsx_init_cards
	.comm	XD_NR,4,4
	.comm	XD_EXIST,4,4
	.comm	XD_CARD,4,4
	.comm	SSC_PDCTL,4,4
	.comm	SD_NR,4,4
	.comm	SD_CARD,4,4
	.comm	RTSX_STAT_SS,4,4
	.comm	RTSX_STAT_RUN,4,4
	.comm	RB_FLUSH,4,4
	.comm	RBCTL,4,4
	.comm	QFN,4,4
	.comm	OC_PDCTL,4,4
	.comm	OCPCLR,4,4
	.comm	MS_NR,4,4
	.comm	MS_CARD,4,4
	.comm	LED_GPIO,4,4
	.comm	HOST_SLEEP_STATE,4,4
	.comm	CARD_OC_NOW,4,4
	.comm	CARD_OC_INT_CLR,4,4
	.comm	CARD_OC_EVER,4,4
	.comm	CARD_OC_CLR,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
