From: Jagan Teki <jagan@amarulasolutions.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 01/14] spi: atmel: Add ifdef for DM_GPIO code
Date: Wed, 14 Mar 2018 18:46:31 +0530 [thread overview]
Message-ID: <20180314131644.9508-2-jagan@amarulasolutions.com> (raw)
In-Reply-To: <20180314131644.9508-1-jagan@amarulasolutions.com>
Few boards are configuring gpio directly from board instead
using drivers/gpio so add ifdef for DM_GPIO to compatible
for both the cases.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
drivers/spi/atmel_spi.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 8010ab434c..3cdfd366ab 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -236,7 +236,9 @@ struct atmel_spi_priv {
unsigned int freq; /* Default frequency */
unsigned int mode;
ulong bus_clk_rate;
+#ifdef CONFIG_DM_GPIO
struct gpio_desc cs_gpios[MAX_CS_COUNT];
+#endif
};
static int atmel_spi_claim_bus(struct udevice *dev)
@@ -291,6 +293,7 @@ static int atmel_spi_release_bus(struct udevice *dev)
static void atmel_spi_cs_activate(struct udevice *dev)
{
+#ifdef CONFIG_DM_GPIO
struct udevice *bus = dev_get_parent(dev);
struct atmel_spi_priv *priv = dev_get_priv(bus);
struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
@@ -300,10 +303,12 @@ static void atmel_spi_cs_activate(struct udevice *dev)
return;
dm_gpio_set_value(&priv->cs_gpios[cs], 0);
+#endif
}
static void atmel_spi_cs_deactivate(struct udevice *dev)
{
+#ifdef CONFIG_DM_GPIO
struct udevice *bus = dev_get_parent(dev);
struct atmel_spi_priv *priv = dev_get_priv(bus);
struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
@@ -313,6 +318,7 @@ static void atmel_spi_cs_deactivate(struct udevice *dev)
return;
dm_gpio_set_value(&priv->cs_gpios[cs], 1);
+#endif
}
static int atmel_spi_xfer(struct udevice *dev, unsigned int bitlen,
@@ -462,8 +468,7 @@ static int atmel_spi_enable_clk(struct udevice *bus)
static int atmel_spi_probe(struct udevice *bus)
{
struct atmel_spi_platdata *bus_plat = dev_get_platdata(bus);
- struct atmel_spi_priv *priv = dev_get_priv(bus);
- int i, ret;
+ int ret;
ret = atmel_spi_enable_clk(bus);
if (ret)
@@ -471,6 +476,10 @@ static int atmel_spi_probe(struct udevice *bus)
bus_plat->regs = (struct at91_spi *)devfdt_get_addr(bus);
+#ifdef CONFIG_DM_GPIO
+ struct atmel_spi_priv *priv = dev_get_priv(bus);
+ int i;
+
ret = gpio_request_list_by_name(bus, "cs-gpios", priv->cs_gpios,
ARRAY_SIZE(priv->cs_gpios), 0);
if (ret < 0) {
@@ -485,6 +494,7 @@ static int atmel_spi_probe(struct udevice *bus)
dm_gpio_set_dir_flags(&priv->cs_gpios[i],
GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
}
+#endif
writel(ATMEL_SPI_CR_SWRST, &bus_plat->regs->cr);
--
2.14.3
next prev parent reply other threads:[~2018-03-14 13:16 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 13:16 [U-Boot] [PATCH 00/14] at91: Add boards with OF_CONTROL/DM/DM_SPI Jagan Teki
2018-03-14 13:16 ` Jagan Teki [this message]
2018-03-21 4:08 ` [U-Boot] [PATCH 01/14] spi: atmel: Add ifdef for DM_GPIO code Wenyou Yang
2018-04-06 20:28 ` [U-Boot] [U-Boot,01/14] " Tom Rini
2018-03-14 13:16 ` [U-Boot] [PATCH 02/14] at91: gurnard: Enable DM_SPI Jagan Teki
2018-04-06 20:28 ` [U-Boot] [U-Boot,02/14] " Tom Rini
2018-03-14 13:16 ` [U-Boot] [PATCH 03/14] configs: gurnard: Move CONFIG_ATMEL_SPI to defconfigs Jagan Teki
2018-03-21 4:09 ` Wenyou Yang
2018-04-06 20:29 ` [U-Boot] [U-Boot, " Tom Rini
2018-03-14 13:16 ` [U-Boot] [PATCH 04/14] at91: taurus: Enable DM_SPI Jagan Teki
2018-04-06 20:29 ` [U-Boot] [U-Boot,04/14] " Tom Rini
2018-03-14 13:16 ` [U-Boot] [PATCH 05/14] at91: vinco: Enable DM Jagan Teki
2018-04-06 20:29 ` [U-Boot] [U-Boot,05/14] " Tom Rini
2018-03-14 13:16 ` [U-Boot] [PATCH 06/14] at91: vinco: Add FDT support Jagan Teki
2018-04-06 20:29 ` [U-Boot] [U-Boot,06/14] " Tom Rini
2018-03-14 13:16 ` [U-Boot] [PATCH 07/14] at91: vinco: Enable DM_SPI Jagan Teki
2018-04-06 20:29 ` [U-Boot] [U-Boot,07/14] " Tom Rini
2018-03-14 13:16 ` [U-Boot] [PATCH 08/14] at91: ma5d4evk: Enable DM Jagan Teki
2018-04-06 20:29 ` [U-Boot] [U-Boot,08/14] " Tom Rini
2018-03-14 13:16 ` [U-Boot] [PATCH 09/14] at91: ma5d4evk: Add FDT support Jagan Teki
2018-04-06 20:29 ` [U-Boot] [U-Boot,09/14] " Tom Rini
2018-03-14 13:16 ` [U-Boot] [PATCH 10/14] at91: ma5d4evk: Enable DM_SPI Jagan Teki
2018-04-06 20:29 ` [U-Boot] [U-Boot,10/14] " Tom Rini
2018-03-14 13:16 ` [U-Boot] [PATCH 11/14] at91: ma5d4evk: Enable SPL_DM and SPL_OF_CONTROL Jagan Teki
2018-04-06 20:29 ` [U-Boot] [U-Boot, " Tom Rini
2018-03-14 13:16 ` [U-Boot] [PATCH 12/14] spi: atmel: Drop non-dm code Jagan Teki
2018-03-21 4:10 ` Wenyou Yang
2018-04-06 20:29 ` [U-Boot] [U-Boot,12/14] " Tom Rini
2018-04-07 13:24 ` Tom Rini
2018-03-14 13:16 ` [U-Boot] [PATCH 13/14] spi: atmel: Drop atmel_spi.h Jagan Teki
2018-03-21 4:11 ` Wenyou Yang
2018-04-06 20:29 ` [U-Boot] [U-Boot,13/14] " Tom Rini
2018-04-07 13:24 ` Tom Rini
2018-03-14 13:16 ` [U-Boot] [PATCH 14/14] spi: atmel: default y if DM_SPI && ARCH_AT91 Jagan Teki
2018-03-21 4:13 ` Wenyou Yang
2018-04-06 20:29 ` [U-Boot] [U-Boot, " Tom Rini
2018-03-15 9:43 ` [U-Boot] [PATCH 00/14] at91: Add boards with OF_CONTROL/DM/DM_SPI 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=20180314131644.9508-2-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