summaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/Kconfig2
-rw-r--r--drivers/spi/omap3_spi.c23
2 files changed, 11 insertions, 14 deletions
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index f14e28f545..c279c2160f 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -40,7 +40,7 @@ config DRIVER_SPI_MXS
config DRIVER_SPI_OMAP3
bool "OMAP3 McSPI Master driver"
- depends on ARCH_OMAP3
+ depends on ARCH_OMAP3 || ARCH_AM33XX
endif
diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c
index e6581dfd32..5c8cc8882a 100644
--- a/drivers/spi/omap3_spi.c
+++ b/drivers/spi/omap3_spi.c
@@ -325,17 +325,6 @@ static int omap3_spi_transfer(struct spi_device *spi, struct spi_message *mesg)
static int omap3_spi_setup(struct spi_device *spi)
{
- struct spi_master *master = spi->master;
-
- if (((master->bus_num == 1) && (spi->chip_select > 3)) ||
- ((master->bus_num == 2) && (spi->chip_select > 1)) ||
- ((master->bus_num == 3) && (spi->chip_select > 1)) ||
- ((master->bus_num == 4) && (spi->chip_select > 0))) {
- printf("SPI error: unsupported chip select %i \
- on bus %i\n", spi->chip_select, master->bus_num);
- return -EINVAL;
- }
-
if (spi->max_speed_hz > OMAP3_MCSPI_MAX_FREQ) {
printf("SPI error: unsupported frequency %i Hz. \
Max frequency is 48 Mhz\n", spi->max_speed_hz);
@@ -368,16 +357,24 @@ static int omap3_spi_probe(struct device_d *dev)
* McSPI3 has 2 CS (bus 3, cs 0 - 1)
* McSPI4 has 1 CS (bus 4, cs 0)
*
+ * AM335x McSPI has 2 busses with 2 chip selects:
+ * McSPI0 has 2 CS (bus 0, cs 0 - 1)
+ * McSPI1 has 2 CS (bus 1, cs 0 - 1)
+ *
* The board code has to make sure that it does not use
* invalid buses or chip selects.
*/
master->bus_num = dev->id;
- master->num_chipselect = 4;
+
+ if (IS_ENABLED(CONFIG_ARCH_OMAP3))
+ master->num_chipselect = 4;
+ else
+ master->num_chipselect = 2;
master->setup = omap3_spi_setup;
master->transfer = omap3_spi_transfer;
- omap3_master->regs = dev_request_mem_region(dev, 0);;
+ omap3_master->regs = dev_request_mem_region(dev, 0);
spi_reset(master);