public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jagan Teki <jagan@amarulasolutions.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 5/9] spi: sun4i: Support fifo_depth via drvdata
Date: Wed, 27 Feb 2019 20:02:09 +0530	[thread overview]
Message-ID: <20190227143213.8963-6-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20190227143213.8963-1-jagan@amarulasolutions.com>

Support fifo_depth via drvdata instead of macro definition, this would
eventually reduce another macro definition for new SPI controller fifo
depth support addition.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
---
 drivers/spi/sun4i_spi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/spi/sun4i_spi.c b/drivers/spi/sun4i_spi.c
index be026e6554..82e69a6b6a 100644
--- a/drivers/spi/sun4i_spi.c
+++ b/drivers/spi/sun4i_spi.c
@@ -33,8 +33,6 @@
 
 #include <linux/iopoll.h>
 
-#define SUN4I_FIFO_DEPTH	64
-
 #define SUN4I_RXDATA_REG	0x00
 
 #define SUN4I_TXDATA_REG	0x04
@@ -131,6 +129,7 @@ enum sun4i_spi_bits {
 struct sun4i_spi_variant {
 	const unsigned long *regs;
 	const u32 *bits;
+	u32 fifo_depth;
 };
 
 struct sun4i_spi_platdata {
@@ -359,7 +358,7 @@ static int sun4i_spi_xfer(struct udevice *dev, unsigned int bitlen,
 
 	while (len) {
 		/* Setup the transfer now... */
-		nbytes = min(len, (u32)(SUN4I_FIFO_DEPTH - 1));
+		nbytes = min(len, (priv->variant->fifo_depth - 1));
 
 		/* Setup the counters */
 		writel(SUN4I_BURST_CNT(nbytes), SPI_REG(priv, SPI_BC));
@@ -503,6 +502,7 @@ static const u32 sun4i_spi_bits[] = {
 static const struct sun4i_spi_variant sun4i_a10_spi_variant = {
 	.regs			= sun4i_spi_regs,
 	.bits			= sun4i_spi_bits,
+	.fifo_depth		= 64,
 };
 
 static const struct udevice_id sun4i_spi_ids[] = {
-- 
2.18.0.321.gffc6fa0e3

  parent reply	other threads:[~2019-02-27 14:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27 14:32 [U-Boot] [PATCH v3 0/9] spi: Add Allwinner A31 SPI driver Jagan Teki
2019-02-27 14:32 ` [U-Boot] [PATCH v3 1/9] spi: sun4i: Poll for rxfifo to be filled up Jagan Teki
2019-02-27 14:32 ` [U-Boot] [PATCH v3 2/9] clk: sunxi: Implement SPI clocks, resets Jagan Teki
2019-02-27 14:32 ` [U-Boot] [PATCH v3 3/9] spi: sun4i: Simplify reg writes using set/clrbits_le32 Jagan Teki
2019-02-27 14:32 ` [U-Boot] [PATCH v3 4/9] spi: sun4i: Access registers and bits via enum offsets Jagan Teki
2019-02-27 14:32 ` Jagan Teki [this message]
2019-02-27 14:32 ` [U-Boot] [PATCH v3 6/9] spi: sun4i: Add CLK support Jagan Teki
2019-02-27 14:32 ` [U-Boot] [PATCH v3 7/9] spi: sun4: Add A31 spi controller support Jagan Teki
2019-02-27 14:32 ` [U-Boot] [PATCH v3 8/9] spi: sun4i: Driver cleanup Jagan Teki
2019-02-27 14:32 ` [U-Boot] [PATCH v3 9/9] spi: Rename sun4i_spi.c into spi-sunxi.c Jagan Teki
2019-03-06 16:24 ` [U-Boot] [PATCH v3 0/9] spi: Add Allwinner A31 SPI driver Jagan Teki

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=20190227143213.8963-6-jagan@amarulasolutions.com \
    --to=jagan@amarulasolutions.com \
    --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