mirror of
git://projects.qi-hardware.com/ben-wpan.git
synced 2024-11-22 18:50:37 +02:00
Fix board initialization in uSD driver. atspi-id now works.
- tools/lib/atusd.c (atusd_cycle): we never turned power back on ? - tools/atspi-id/atspi-id.c (main): call atspi_close on exit - tools/lib/atusd.c (atusd_cycle, wait_for_power): moved power on delay to separate function - tools/lib/atusd.c (atusd_open): wait for power to stabilize - tools/lib/atusd.c (atusd_open): need to reset the board to bring it up properly
This commit is contained in:
parent
406517baa2
commit
b25cbd8120
@ -144,5 +144,7 @@ int main(int argc, const char **argv)
|
||||
|
||||
show_info(dsc);
|
||||
|
||||
atspi_close(dsc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -68,6 +68,16 @@ struct atusd_dsc {
|
||||
/* ----- Reset functions --------------------------------------------------- */
|
||||
|
||||
|
||||
static void wait_for_power(void)
|
||||
{
|
||||
/*
|
||||
* Give power time to stabilize and the chip time to reset.
|
||||
* Experiments show that even usleep(0) is long enough.
|
||||
*/
|
||||
usleep(10*1000);
|
||||
}
|
||||
|
||||
|
||||
static void atusd_cycle(struct atusd_dsc *dsc)
|
||||
{
|
||||
/* stop the MMC bus clock */
|
||||
@ -97,11 +107,7 @@ static void atusd_cycle(struct atusd_dsc *dsc)
|
||||
/* start MMC clock output */
|
||||
MSC_STRPCL = 2;
|
||||
|
||||
/*
|
||||
* Give power time to stabilize and the chip time to reset.
|
||||
* Experiments show that even usleep(0) is long enough.
|
||||
*/
|
||||
usleep(10*1000);
|
||||
wait_for_power();
|
||||
}
|
||||
|
||||
|
||||
@ -205,6 +211,14 @@ static void spi_send(struct atusd_dsc *dsc, uint8_t v)
|
||||
/* ----- Driver operations ------------------------------------------------- */
|
||||
|
||||
|
||||
static void atusd_reset_rf(void *handle)
|
||||
{
|
||||
struct atusd_dsc *dsc = handle;
|
||||
|
||||
atusd_cycle(dsc);
|
||||
}
|
||||
|
||||
|
||||
static void *atusd_open(void)
|
||||
{
|
||||
struct atusd_dsc *dsc;
|
||||
@ -254,7 +268,8 @@ static void *atusd_open(void)
|
||||
/* start MMC clock output */
|
||||
MSC_STRPCL = 2;
|
||||
|
||||
atusd_cycle(dsc);
|
||||
wait_for_power();
|
||||
atusd_reset_rf(dsc);
|
||||
|
||||
return dsc;
|
||||
}
|
||||
@ -275,14 +290,6 @@ static void atusd_close(void *arg)
|
||||
}
|
||||
|
||||
|
||||
static void atusd_reset_rf(void *handle)
|
||||
{
|
||||
struct atusd_dsc *dsc = handle;
|
||||
|
||||
atusd_cycle(dsc);
|
||||
}
|
||||
|
||||
|
||||
static void atusd_reg_write(void *handle, uint8_t reg, uint8_t v)
|
||||
{
|
||||
struct atusd_dsc *dsc = handle;
|
||||
|
Loading…
Reference in New Issue
Block a user