From: Vitaly W. <vw...@ru...> - 2005-12-20 18:01:50
|
Hi David -- just a cuple of notes here and below... General one: how is it supposed to set SPI bus clock in this model? I guess that the only option is to set it in txrx_*. That is not optimal since it means setting clock for each transfer which is not an optimal solution, better have a function (bitbang->set_clock or whatever) )to set clock per message. > if (!spi->max_speed_hz) > spi->max_speed_hz = 500 * 1000; > > /* nsecs = max(50, (clock period)/2), be optimistic */ > cs->nsecs = (1000000000/2) / (spi->max_speed_hz); > if (cs->nsecs < 50) > cs->nsecs = 50; > > Suggest not to hardcode values here. > /* set up default clock polarity, and activate chip */ > if (!chipselect) { > bitbang->chipselect(spi, 1); > ndelay(nsecs); > > Suggest special enum/define for chipselect value. > /* protocol tweaks before next transfer */ > if (t->delay_usecs) > udelay(t->delay_usecs); > > Suggest nsecs here as well. Generic note: haven't tested that with DMA, will have more comments prolly... Another one: I just feel comfortabel with using 'bitbang' term for the variety of SPI stuff which this library suits. Vitaly |