diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-04-15 01:31:30 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-04-17 20:23:47 +0000 |
commit | e123c5d2f27e9efbef8b4264f1576e4e10ba7b82 (patch) | |
tree | 5d74406151cc56087bf9985d45cf1957168f6e29 /firmware/target/mips | |
parent | b41d53792c4c4e4abd6d810b2765d865775f5104 (diff) | |
download | rockbox-e123c5d2f27e9efbef8b4264f1576e4e10ba7b82.tar.gz rockbox-e123c5d2f27e9efbef8b4264f1576e4e10ba7b82.zip |
x1000: don't reset all GPIOs at boot
What we really want is to avoid any interrupts being generated
before the drivers which handle them are properly initialized.
Intead of trashing all GPIOs, search for the problem pins and
fix them, leaving the others alone.
This fixes the M3K's button light flickering on boot and should
stop the M3K from entering a potentially confusing "dead" state
where all the lights are off but the CPU is still on.
Change-Id: I13a6da0f0950190396bff5d6e8c343c668e8fea1
Diffstat (limited to 'firmware/target/mips')
-rw-r--r-- | firmware/target/mips/ingenic_x1000/gpio-x1000.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/firmware/target/mips/ingenic_x1000/gpio-x1000.c b/firmware/target/mips/ingenic_x1000/gpio-x1000.c index a47865e397..8e93f865bf 100644 --- a/firmware/target/mips/ingenic_x1000/gpio-x1000.c +++ b/firmware/target/mips/ingenic_x1000/gpio-x1000.c | |||
@@ -32,19 +32,15 @@ void gpio_init(void) | |||
32 | mutex_init(&gpio_z_mutex); | 32 | mutex_init(&gpio_z_mutex); |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | /* Set all pins to input state */ | 35 | /* Any GPIO pins left in an IRQ trigger state need to be switched off, |
36 | * because the drivers won't be ready to handle the interrupts until they | ||
37 | * get initialized later in the boot. */ | ||
36 | for(int i = 0; i < 4; ++i) { | 38 | for(int i = 0; i < 4; ++i) { |
37 | jz_clr(GPIO_INT(GPIO_Z), 0xffffffff); | 39 | uint32_t intbits = REG_GPIO_INT(i); |
38 | jz_set(GPIO_MSK(GPIO_Z), 0xffffffff); | 40 | if(intbits) { |
39 | jz_set(GPIO_PAT1(GPIO_Z), 0xffffffff); | 41 | gpio_config(i, intbits, GPIO_INPUT); |
40 | jz_clr(GPIO_PAT0(GPIO_Z), 0xffffffff); | 42 | jz_clr(GPIO_FLAG(i), intbits); |
41 | REG_GPIO_Z_GID2LD = i; | 43 | } |
42 | } | ||
43 | |||
44 | /* Clear flag and disable pull resistor */ | ||
45 | for(int i = 0; i < 4; ++i) { | ||
46 | jz_clr(GPIO_FLAG(i), 0xffffffff); | ||
47 | jz_set(GPIO_PULL(i), 0xffffffff); | ||
48 | } | 44 | } |
49 | } | 45 | } |
50 | 46 | ||