summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2014-10-22 21:56:00 +0200
committerJagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>2014-10-27 22:37:03 +0530
commit37dcc130e0c804da6ad50bf273d0d737cfe9cf8f (patch)
tree7b9827a59ae04cb027f64b08a5955ef2580b04bb /drivers
parent2e13da13a9ebf528642e700e17e8068a3657fd71 (diff)
downloadu-boot-imx-37dcc130e0c804da6ad50bf273d0d737cfe9cf8f.zip
u-boot-imx-37dcc130e0c804da6ad50bf273d0d737cfe9cf8f.tar.gz
u-boot-imx-37dcc130e0c804da6ad50bf273d0d737cfe9cf8f.tar.bz2
spi: altera: Clean up most checkpatch issues
This patch just zaps most of the checkpatch cries present in the driver. There is one more left, which will be addressed separately. There is no functional change. This patch also adds a bunch of newlines all around the place, this is to make the code much more readable. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Chin Liang See <clsee@altera.com> Cc: Dinh Nguyen <dinguyen@altera.com> Cc: Albert Aribaud <albert.u.boot@aribaud.net> Cc: Pavel Machek <pavel@denx.de> Acked-by: Pavel Machek <pavel@denx.de> Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spi/altera_spi.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/spi/altera_spi.c b/drivers/spi/altera_spi.c
index 21f90fc..373ce30 100644
--- a/drivers/spi/altera_spi.c
+++ b/drivers/spi/altera_spi.c
@@ -47,22 +47,19 @@ struct altera_spi_slave {
};
#define to_altera_spi_slave(s) container_of(s, struct altera_spi_slave, slave)
-__attribute__((weak))
-int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+__weak int spi_cs_is_valid(unsigned int bus, unsigned int cs)
{
return bus < ARRAY_SIZE(altera_spi_base_list) && cs < 32;
}
-__attribute__((weak))
-void spi_cs_activate(struct spi_slave *slave)
+__weak void spi_cs_activate(struct spi_slave *slave)
{
struct altera_spi_slave *altspi = to_altera_spi_slave(slave);
writel(1 << slave->cs, &altspi->regs->slave_sel);
writel(ALTERA_SPI_CONTROL_SSO_MSK, &altspi->regs->control);
}
-__attribute__((weak))
-void spi_cs_deactivate(struct spi_slave *slave)
+__weak void spi_cs_deactivate(struct spi_slave *slave)
{
struct altera_spi_slave *altspi = to_altera_spi_slave(slave);
writel(0, &altspi->regs->control);
@@ -91,8 +88,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
return NULL;
altspi->regs = (struct altera_spi_regs *)altera_spi_base_list[bus];
- debug("%s: bus:%i cs:%i base:%p\n", __func__,
- bus, cs, altspi->regs);
+ debug("%s: bus:%i cs:%i base:%p\n", __func__, bus, cs, altspi->regs);
return &altspi->slave;
}
@@ -135,7 +131,8 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
uchar *rxp = din;
debug("%s: bus:%i cs:%i bitlen:%i bytes:%i flags:%lx\n", __func__,
- slave->bus, slave->cs, bitlen, bytes, flags);
+ slave->bus, slave->cs, bitlen, bytes, flags);
+
if (bitlen == 0)
goto done;
@@ -147,21 +144,27 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
/* empty read buffer */
if (readl(&altspi->regs->status) & ALTERA_SPI_STATUS_RRDY_MSK)
readl(&altspi->regs->rxdata);
+
if (flags & SPI_XFER_BEGIN)
spi_cs_activate(slave);
while (bytes--) {
uchar d = txp ? *txp++ : CONFIG_ALTERA_SPI_IDLE_VAL;
+
debug("%s: tx:%x ", __func__, d);
writel(d, &altspi->regs->txdata);
+
while (!(readl(&altspi->regs->status) & ALTERA_SPI_STATUS_RRDY_MSK))
;
+
d = readl(&altspi->regs->rxdata);
if (rxp)
*rxp++ = d;
+
debug("rx:%x\n", d);
}
- done:
+
+done:
if (flags & SPI_XFER_END)
spi_cs_deactivate(slave);