forked from len0rd/rockbox
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
This commit is contained in:
parent
b41d53792c
commit
e123c5d2f2
1 changed files with 8 additions and 12 deletions
|
|
@ -32,19 +32,15 @@ void gpio_init(void)
|
||||||
mutex_init(&gpio_z_mutex);
|
mutex_init(&gpio_z_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set all pins to input state */
|
/* Any GPIO pins left in an IRQ trigger state need to be switched off,
|
||||||
|
* because the drivers won't be ready to handle the interrupts until they
|
||||||
|
* get initialized later in the boot. */
|
||||||
for(int i = 0; i < 4; ++i) {
|
for(int i = 0; i < 4; ++i) {
|
||||||
jz_clr(GPIO_INT(GPIO_Z), 0xffffffff);
|
uint32_t intbits = REG_GPIO_INT(i);
|
||||||
jz_set(GPIO_MSK(GPIO_Z), 0xffffffff);
|
if(intbits) {
|
||||||
jz_set(GPIO_PAT1(GPIO_Z), 0xffffffff);
|
gpio_config(i, intbits, GPIO_INPUT);
|
||||||
jz_clr(GPIO_PAT0(GPIO_Z), 0xffffffff);
|
jz_clr(GPIO_FLAG(i), intbits);
|
||||||
REG_GPIO_Z_GID2LD = i;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Clear flag and disable pull resistor */
|
|
||||||
for(int i = 0; i < 4; ++i) {
|
|
||||||
jz_clr(GPIO_FLAG(i), 0xffffffff);
|
|
||||||
jz_set(GPIO_PULL(i), 0xffffffff);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue