On Tue, 2013-06-18 at 15:15 +0200, Teresa Gámez wrote: > AM33xx has only 2 McSPI busses and 2 CS for each bus. > Added comment and the check. > > Signed-off-by: Teresa Gámez <t.gamez@xxxxxxxxx> > --- > drivers/spi/omap3_spi.c | 20 +++++++++++++++++--- > 1 files changed, 17 insertions(+), 3 deletions(-) > > diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c > index e6581df..1eb0e6a 100644 > --- a/drivers/spi/omap3_spi.c > +++ b/drivers/spi/omap3_spi.c > @@ -326,11 +326,17 @@ 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; > + int is_not_valid; > > - if (((master->bus_num == 1) && (spi->chip_select > 3)) || > + if (IS_ENABLED(CONFIG_ARCH_OMAP3)) > + is_not_valid = ((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))) { > + ((master->bus_num == 4) && (spi->chip_select > 0)); > + else > + is_not_valid = (spi->chip_select > 1); > + > + if (is_not_valid) { > printf("SPI error: unsupported chip select %i \ > on bus %i\n", spi->chip_select, master->bus_num); > return -EINVAL; > @@ -368,12 +374,20 @@ 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; By now, I think we should just drop the CS/bus checks in the driver. We don't need to protect against wrong device setup from the board file of later from DT. Regards, Jan -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox