Re: [PATCH 2/2] introduce spi command

Alexander Shiyan shc_work at mail.ru
Fri Nov 2 12:26:00 EDT 2012


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.

---


More information about the barebox mailing list