summaryrefslogtreecommitdiff
path: root/drivers/spi/kirkwood_spi.c
diff options
context:
space:
mode:
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>2013-01-09 16:57:03 +0100
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2013-01-09 16:57:03 +0100
commitea33fb1a32e8e3f408b311823cabbb7453148f80 (patch)
treea81f26a32a32e33c2a25a82423d0bcc8ad48973a /drivers/spi/kirkwood_spi.c
parent61bdb9133593f0f881a57232039296f64bd662ed (diff)
parentbfbfab94fd0b38ca780e6dda99657b0c848c9bb9 (diff)
downloadu-boot-imx-ea33fb1a32e8e3f408b311823cabbb7453148f80.zip
u-boot-imx-ea33fb1a32e8e3f408b311823cabbb7453148f80.tar.gz
u-boot-imx-ea33fb1a32e8e3f408b311823cabbb7453148f80.tar.bz2
Merge branch 'u-boot-marvell/master' into 'u-boot-arm/master'
Diffstat (limited to 'drivers/spi/kirkwood_spi.c')
-rw-r--r--drivers/spi/kirkwood_spi.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c
index a7cda75..de81064 100644
--- a/drivers/spi/kirkwood_spi.c
+++ b/drivers/spi/kirkwood_spi.c
@@ -41,7 +41,10 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
{
struct spi_slave *slave;
u32 data;
- u32 kwspi_mpp_config[] = { 0, 0 };
+ static const u32 kwspi_mpp_config[2][2] = {
+ { MPP0_SPI_SCn, 0 }, /* if cs == 0 */
+ { MPP7_SPI_SCn, 0 } /* if cs != 0 */
+ };
if (!spi_cs_is_valid(bus, cs))
return NULL;
@@ -68,12 +71,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
writel(KWSPI_IRQMASK, &spireg->irq_mask);
/* program mpp registers to select SPI_CSn */
- if (cs) {
- kwspi_mpp_config[0] = MPP7_SPI_SCn;
- } else {
- kwspi_mpp_config[0] = MPP0_SPI_SCn;
- }
- kirkwood_mpp_conf(kwspi_mpp_config, cs_spi_mpp_back);
+ kirkwood_mpp_conf(kwspi_mpp_config[cs ? 1 : 0], cs_spi_mpp_back);
return slave;
}