From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v1 03/25] spi: kirkwood_spi.c: Some fixes and cleanup
Date: Fri, 27 Jun 2014 11:54:49 +0200 [thread overview]
Message-ID: <1403862911-6138-4-git-send-email-sr@denx.de> (raw)
In-Reply-To: <1403862911-6138-1-git-send-email-sr@denx.de>
This patch introduces the clrsetbits_le32() accessor functions in the
kirkwood SPI driver. Note that it also includes a fix:
- writel(~KWSPI_CSN_ACT | KWSPI_SMEMRDY, &spireg->ctrl);
+ writel(KWSPI_SMEMRDY, &spireg->ctrl);
Here the bit KWSPI_CSN_ACT (0x1) should have been cleared. Instead
0xfffffffe is written into this control register. This is the main
reason to use the clrsetbits() functions now. As they make clearing
bits much less error prone.
Additionally KWSPI_IRQUNMASK is not used in spi_cs_activate() and
spi_cs_deactivate() any more. Its the wrong macro but has the same
value as the correct one (KWSPI_CSN_ACT).
This is in preparation for use of this driver on the Marvell Armada XP
platform as well.
Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
---
drivers/spi/kirkwood_spi.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c
index 942a208..449e9f8 100644
--- a/drivers/spi/kirkwood_spi.c
+++ b/drivers/spi/kirkwood_spi.c
@@ -37,7 +37,7 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
if (!slave)
return NULL;
- writel(~KWSPI_CSN_ACT | KWSPI_SMEMRDY, &spireg->ctrl);
+ writel(KWSPI_SMEMRDY, &spireg->ctrl);
/* calculate spi clock prescaller using max_hz */
data = ((CONFIG_SYS_TCLK / 2) / max_hz) + 0x10;
@@ -137,12 +137,12 @@ void spi_init(void)
void spi_cs_activate(struct spi_slave *slave)
{
- writel(readl(&spireg->ctrl) | KWSPI_IRQUNMASK, &spireg->ctrl);
+ setbits_le32(&spireg->ctrl, KWSPI_CSN_ACT);
}
void spi_cs_deactivate(struct spi_slave *slave)
{
- writel(readl(&spireg->ctrl) & KWSPI_IRQMASK, &spireg->ctrl);
+ clrbits_le32(&spireg->ctrl, KWSPI_CSN_ACT);
}
int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
@@ -161,8 +161,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
* handle data in 8-bit chunks
* TBD: 2byte xfer mode to be enabled
*/
- writel(((readl(&spireg->cfg) & ~KWSPI_XFERLEN_MASK) |
- KWSPI_XFERLEN_1BYTE), &spireg->cfg);
+ clrsetbits_le32(&spireg->cfg, KWSPI_XFERLEN_MASK, KWSPI_XFERLEN_1BYTE);
while (bitlen > 4) {
debug("loopstart bitlen %d\n", bitlen);
@@ -172,7 +171,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
if (dout)
tmpdout = *(u32 *) dout & 0x0ff;
- writel(~KWSPI_SMEMRDIRQ, &spireg->irq_cause);
+ clrbits_le32(&spireg->irq_cause, KWSPI_SMEMRDIRQ);
writel(tmpdout, &spireg->dout); /* Write the data out */
debug("*** spi_xfer: ... %08x written, bitlen %d\n",
tmpdout, bitlen);
--
2.0.1
next prev parent reply other threads:[~2014-06-27 9:54 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-27 9:54 [U-Boot] [PATCH v1 0/25] Add Marvell Armada XP MV78460 SoC support Stefan Roese
2014-06-27 9:54 ` [U-Boot] [PATCH v1 01/25] sf: Add M25PX64 SPI NOR flash ID Stefan Roese
2014-07-03 20:14 ` Jagan Teki
2014-07-13 16:20 ` Jagan Teki
2014-06-27 9:54 ` [U-Boot] [PATCH v1 02/25] arm: kirkwood: spi.h: Add some missing parenthesis Stefan Roese
2014-07-03 20:15 ` Jagan Teki
2014-06-27 9:54 ` Stefan Roese [this message]
2014-07-03 20:16 ` [U-Boot] [PATCH v1 03/25] spi: kirkwood_spi.c: Some fixes and cleanup Jagan Teki
2014-06-27 9:54 ` [U-Boot] [PATCH v1 04/25] spi: kirkwood_spi.c: Make global variable static Stefan Roese
2014-07-03 20:18 ` Jagan Teki
2014-06-27 9:54 ` [U-Boot] [PATCH v1 05/25] spi: kirkwood_spi.c: cosmetic: Fix minor coding style issues Stefan Roese
2014-07-03 20:18 ` Jagan Teki
2014-06-27 9:54 ` [U-Boot] [PATCH v1 06/25] arm: kirkwood: Move some SoC files into new arch/arm/mvebu-common Stefan Roese
2014-06-27 9:54 ` [U-Boot] [PATCH v1 07/25] arm: marvell: Move arch/kirkwood.h to arch/soc.h Stefan Roese
2014-06-27 9:54 ` [U-Boot] [PATCH v1 08/25] arm: marvell: Move arch-kirkwood/spi.h to arch-mvebu/spi.h Stefan Roese
2014-07-13 16:16 ` Jagan Teki
2014-06-27 9:54 ` [U-Boot] [PATCH v1 09/25] arm: marvell: Rework timer.c to make it usable for other MVEBU platforms Stefan Roese
2014-06-27 9:54 ` [U-Boot] [PATCH v1 10/25] arm: mvebu: Add common mbus functions to use on Marvell SoCs Stefan Roese
2014-06-27 9:54 ` [U-Boot] [PATCH v1 11/25] spi: kirkwood_spi.c: Compile MPP (pin-mux) only for kirkwood SoC's Stefan Roese
2014-07-13 16:18 ` Jagan Teki
2014-06-27 9:54 ` [U-Boot] [PATCH v1 12/25] arm: marvell: Extract kirkwood gpio functions into new common file gpio.c Stefan Roese
2014-06-27 9:54 ` [U-Boot] [PATCH v1 13/25] spi: kirkwood_spi.c: Change KW_SPI_BASE to MVEBU_SPI_BASE Stefan Roese
2014-07-13 16:18 ` Jagan Teki
2014-06-27 9:55 ` [U-Boot] [PATCH v1 14/25] arm: kirkwood: Change naming of dram functions from km_foo() to mvebu_foo() Stefan Roese
2014-06-27 9:55 ` [U-Boot] [PATCH v1 15/25] net: mvneta.c: Add support for the ethernet controller of the Marvell Armada XP SoC Stefan Roese
2014-06-27 9:55 ` [U-Boot] [PATCH v1 16/25] net: phy.h: Make PHY autonegotiation timeout configurable Stefan Roese
2014-06-27 9:55 ` [U-Boot] [PATCH v1 17/25] i2c: mvtwsi: Add support for Marvell Armada XP Stefan Roese
2014-07-01 5:48 ` Heiko Schocher
2014-06-27 9:55 ` [U-Boot] [PATCH v1 18/25] arm: armada-xp: Add basic support for Marvell Armada XP SoC Stefan Roese
2014-06-27 9:55 ` [U-Boot] [PATCH v1 19/25] arm: armada-xp: Add basic support for the Marvell DB-78460-BP board Stefan Roese
2014-06-27 9:55 ` [U-Boot] [PATCH v1 20/25] arm: kirkwood: Remove some dead code from cpu.c Stefan Roese
2014-07-01 23:45 ` Luka Perkov
2014-06-27 9:55 ` [U-Boot] [PATCH v1 21/25] arm: kirkwood: Use mvebu new common mbus API Stefan Roese
2014-06-27 9:55 ` [U-Boot] [PATCH v1 22/25] tools/kwboot: Sync with latest barebox version to support Armada XP Stefan Roese
2014-06-27 19:06 ` Luka Perkov
2014-06-28 1:25 ` Daniel Stodden
2014-06-28 7:43 ` Stefan Roese
2014-07-03 22:02 ` Luka Perkov
2014-07-28 6:47 ` Stefan Roese
2014-07-29 23:16 ` Luka Perkov
2014-07-30 8:53 ` Stefan Roese
2014-07-28 8:12 ` Wolfgang Denk
2014-06-27 9:55 ` [U-Boot] [PATCH v1 23/25] tools: Compile kwboot for Marvell Armada XP as those SoCs are now supported Stefan Roese
2014-07-03 22:03 ` Luka Perkov
2014-06-27 9:55 ` [U-Boot] [PATCH v1 24/25] tools: kwbimage: Add image version 1 support for Armada XP / 370 Stefan Roese
2014-07-03 22:03 ` Luka Perkov
2014-06-27 9:55 ` [U-Boot] [PATCH v1 25/25] Makefile: Add CONFIG_BUILD_TARGET to automatically build an special image Stefan Roese
2014-06-27 10:18 ` [U-Boot] [PATCH v1 0/25] Add Marvell Armada XP MV78460 SoC support Prafulla Wadaskar
2014-07-13 16:15 ` Jagan Teki
2014-07-14 14:51 ` Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1403862911-6138-4-git-send-email-sr@denx.de \
--to=sr@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox