Re: [PATCH/RFC] SPI: async message handing library update

From: Vitaly Wool
Date: Tue Dec 20 2005 - 13:00:59 EST


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/