[PATCH 2/2] introduce spi command

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Fri Nov 2 12:45:31 EDT 2012


On 20:26 Fri 02 Nov     , Alexander Shiyan wrote:
> Fri,  2 Nov 2012 17:17:40 +0100 от Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>:
> > usefull to debug spi
> > 
> > The command allow to read/write on a spi device
> > 
> > Usage: spi [OPTION] [data to write 0xXX]
> > write/read spi device.
> >   -b <bus_num>  spi bus number (default = 0)
> >   -r <count>    to read
> >   -c <cs>       chip select (default = 0)
> >   -m <mode>     spi mode (default = 0)
> >   -f <hz>       max_speed_hz (default = 1MHz)
> >   -w <bit>      bits_per_word (default = 8)
> >   -v            verbose
> ...
> > +static int do_spi(int argc, char *argv[])
> > +{
> > +	struct spi_device spi;
> > +	int bus = 0;
> > +	int read = 0;
> > +	int verbose = 0;
> > +	int opt, count, i, ret;
> > +
> > +	u8 *tx_buf, *rx_buf;
> > +
> > +	memset(&spi, 0, sizeof(struct spi_device));
> > +
> > +	spi.max_speed_hz = 1 * 1000 * 1000;
> > +	spi.bits_per_word = 8;
> 
> I suggest using the default data from master for these parameters.
no otherwise we can not write the help and bits_et_word it's default value at
spi framework level is 8

and thh max_speed_hz is slow already

and it has always been the device to control it no the master

Best Regards,
J.



More information about the barebox mailing list