add spi command
Subsystems (2)
v3 cover add spi command
HI,
v3:
call setup before accesing the device
This was working properly on at91 as the driver is wrong. It call setup for every transfer. I will fix the atmel_spi.
v2:
add default return usage
use memory_display
while debugging a spi issue I found we have a i2c commands but no spi command
So introduce one
The following changes since commit 56371f4e8446d04d2a5608dd5890fd87a50f888e:
iomux-imx35: add missing comma in pad definition (2012-11-01 16:32:12 +0100)
are available in the git repository at:
git://git.jcrosoft.org/barebox.git delivery/command_spi
for you to fetch changes up to da7ef46034f3f0344a8fbbd3ce2bde70c9ec4685:
introduce spi command (2012-11-05 02:18:14 +0800)
----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (2):
spi: introduce spi_get_master
introduce spi command
commands/Kconfig | 6 ++++++ commands/Makefile | 1 + commands/spi.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ drivers/spi/atmel_spi.c | 1 + drivers/spi/spi.c | 12 ++++++++++++ include/spi/spi.h | 2 ++ 6 files changed, 154 insertions(+) create mode 100644 commands/spi.c
Best Regards,
J.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 1/2 spi: introduce spi_get_master
so we can request a master usefull for the spi command
--- drivers/spi/spi.c | 12 ++++++++++++ include/spi/spi.h | 2 ++ 2 files changed, 14 insertions(+)
drivers/spi/spi.c +12 -0
@@ -219,6 +219,18 @@ int spi_register_master(struct spi_master *master) }EXPORT_SYMBOL (spi_register_master); +struct spi_master *spi_get_master (int bus) +{ +struct spi_master * m; + +list_for_each_entry (m, &spi_master_list, list) { +if (m->bus_num == bus) +return m; + } + +return NULL ; +} +int spi_sync (struct spi_device *spi,struct spi_message *message) {return spi->master->transfer (spi, message);
include/spi/spi.h +2 -0
@@ -432,6 +432,8 @@ static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd)extern struct bus_type spi_bus; +struct spi_master *spi_get_master (int bus); +static inline int spi_register_driver (struct driver_d *drv) { drv->bus = &spi_bus;
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH v3 2/2 introduce spi command
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
--- commands/Kconfig | 6 +++ commands/Makefile | 1 + commands/spi.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/spi/atmel_spi.c | 1 + 4 files changed, 140 insertions(+) create mode 100644 commands/spi.c
commands/Kconfig +6 -0
@@ -597,6 +597,12 @@ config CMD_I2C include i2c_probe, i2c_read and i2c_write commands to communicate on i2c bus. +config CMD_SPI + bool + depends on SPI + prompt "spi command" + help + config CMD_LED bool depends on LED
commands/Makefile +1 -0
@@ -55,6 +55,7 @@ obj-$(CONFIG_USB_GADGET_SERIAL) += usbserial.o obj-$(CONFIG_CMD_GPIO) += gpio.o obj-$(CONFIG_CMD_UNCOMPRESS) += uncompress.o obj-$(CONFIG_CMD_I2C) += i2c.o +obj-$(CONFIG_CMD_SPI) += spi.o obj-$(CONFIG_CMD_UBI) += ubi.o obj-$(CONFIG_CMD_MENU) += menu.o obj-$(CONFIG_CMD_PASSWD) += passwd.o
commands/spi.c new file +132 -0
132 lines not on this page · raw message
drivers/spi/atmel_spi.c +1 -0
@@ -21,6 +21,7 @@* * */ +#define DEBUG #include <common.h> #include <init.h>
Signature · 7 lines
1.7.10.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox