From 3abb7c5dd5be2ec6744bfc0a80967b20f1b59e30 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Tue, 13 Jul 2021 22:01:17 +0100 Subject: x1000: revamp MSC driver card detection logic Debounce logic now handles both removal and insertion and verifies the detection is stable for 100ms before taking any action. This solves the bootloader "file not found" issue on the Shanling Q1. It seems a false removal event was generated, causing the filesystem to be automatically unmounted. Probably this is due to some transient noise at boot. Delays didn't solve the problem, probably because the bogus hotplug event was queued, and normal mdelay() would simply delay event delivery. Change-Id: I8b03fb3550309f5a7ab4be0be7465a3dab2d3450 --- firmware/target/mips/ingenic_x1000/msc-x1000.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'firmware/target/mips/ingenic_x1000/msc-x1000.h') diff --git a/firmware/target/mips/ingenic_x1000/msc-x1000.h b/firmware/target/mips/ingenic_x1000/msc-x1000.h index 70f67a70d6..b7b05b859d 100644 --- a/firmware/target/mips/ingenic_x1000/msc-x1000.h +++ b/firmware/target/mips/ingenic_x1000/msc-x1000.h @@ -126,7 +126,8 @@ typedef struct msc_drv { unsigned iflag_done; volatile int req_running; - volatile int card_present; + volatile int card_present; /* Debounced status */ + volatile int card_present_last; /* Status when we last polled it */ struct mutex lock; struct semaphore cmd_done; -- cgit v1.2.3