diff mbox

[V3,RESEND,3/5] spi: s3c64xx: Added provision for non-gpio i/o's

Message ID 1366015230-18243-2-git-send-email-ks.giri@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

girishks2000@gmail.com April 15, 2013, 8:40 a.m. UTC
From: Girish K S <girishks2000@gmail.com>

Currently the drivers supports only the GPIO based i/o pins.
But there are Exynos SoC's that use the same controller with
dedicated i/o pins.

This patch  provides provision to support gpio/dedicated pins.
The decision is made by parsing the "gpios" property in the spi
node.

Signed-off-by: Girish K S <ks.giri@samsung.com>
---
 drivers/spi/spi-s3c64xx.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

Comments

Mark Brown April 16, 2013, 3:58 p.m. UTC | #1
On Mon, Apr 15, 2013 at 02:10:28PM +0530, Girish K S wrote:
> From: Girish K S <girishks2000@gmail.com>
> 
> Currently the drivers supports only the GPIO based i/o pins.
> But there are Exynos SoC's that use the same controller with
> dedicated i/o pins.
> 
> This patch  provides provision to support gpio/dedicated pins.
> The decision is made by parsing the "gpios" property in the spi
> node.

This has some conflicts with my SPI -next branch, I think it's all due
to Arnd's changes to support multi-platform boot on Exynos but there may
be some other stuff.  Can you please rebase against

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc.git spi-next

and make sure everything is OK?
diff mbox

Patch

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index a6fdc71..79de18f 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1111,6 +1111,9 @@  static int s3c64xx_spi_parse_dt_gpio(struct s3c64xx_spi_driver_data *sdd)
 	struct device *dev = &sdd->pdev->dev;
 	int idx, gpio, ret;
 
+	if (!of_find_property(dev->of_node, "gpios", NULL))
+		return 0;
+
 	/* find gpios for mosi, miso and clock lines */
 	for (idx = 0; idx < 3; idx++) {
 		gpio = of_get_gpio(dev->of_node, idx);
@@ -1137,6 +1140,11 @@  free_gpio:
 static void s3c64xx_spi_dt_gpio_free(struct s3c64xx_spi_driver_data *sdd)
 {
 	unsigned int idx;
+	struct device *dev = &sdd->pdev->dev;
+
+	if (!of_find_property(dev->of_node, "gpios", NULL))
+		return;
+
 	for (idx = 0; idx < 3; idx++)
 		gpio_free(sdd->gpios[idx]);
 }