Date:2010-09-06 02:18:56 (13 years 6 months ago)
Author:Werner Almesberger
Commit:b25cbd812068fb79c56b655a0ea526ab2c0b7382
Message: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
Files: tools/atspi-id/atspi-id.c (1 diff)
tools/lib/atusd.c (5 diffs)

Change Details

tools/atspi-id/atspi-id.c
144144
145145    show_info(dsc);
146146
147    atspi_close(dsc);
148
147149    return 0;
148150}
tools/lib/atusd.c
6868/* ----- Reset functions --------------------------------------------------- */
6969
7070
71static void wait_for_power(void)
72{
73    /*
74     * Give power time to stabilize and the chip time to reset.
75     * Experiments show that even usleep(0) is long enough.
76     */
77    usleep(10*1000);
78}
79
80
7181static void atusd_cycle(struct atusd_dsc *dsc)
7282{
7383    /* stop the MMC bus clock */
...... 
97107    /* start MMC clock output */
98108    MSC_STRPCL = 2;
99109
100    /*
101     * Give power time to stabilize and the chip time to reset.
102     * Experiments show that even usleep(0) is long enough.
103     */
104    usleep(10*1000);
110    wait_for_power();
105111}
106112
107113
...... 
205211/* ----- Driver operations ------------------------------------------------- */
206212
207213
214static void atusd_reset_rf(void *handle)
215{
216    struct atusd_dsc *dsc = handle;
217
218    atusd_cycle(dsc);
219}
220
221
208222static void *atusd_open(void)
209223{
210224    struct atusd_dsc *dsc;
...... 
254268    /* start MMC clock output */
255269    MSC_STRPCL = 2;
256270
257    atusd_cycle(dsc);
271    wait_for_power();
272    atusd_reset_rf(dsc);
258273
259274    return dsc;
260275}
...... 
275290}
276291
277292
278static void atusd_reset_rf(void *handle)
279{
280    struct atusd_dsc *dsc = handle;
281
282    atusd_cycle(dsc);
283}
284
285
286293static void atusd_reg_write(void *handle, uint8_t reg, uint8_t v)
287294{
288295    struct atusd_dsc *dsc = handle;

Archive Download the corresponding diff file



interactive