[PATCH V2 3/5] spi: s3c64xx: Added provision for non-gpio i/o's

2013-02-13 Thread Girish K S
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 
---
changes in v2:
Removed the gpio quirk. Parse the "gpios" property
to decide whether  gpio / dedicated i/o lines should
be used.

 drivers/spi/spi-s3c64xx.c |8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 45bad5d..a8fe876 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1157,6 +1157,9 @@ static int s3c64xx_spi_parse_dt_gpio(struct 
s3c64xx_spi_driver_data *sdd)
struct device *dev = >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);
@@ -1183,6 +1186,11 @@ free_gpio:
 static void s3c64xx_spi_dt_gpio_free(struct s3c64xx_spi_driver_data *sdd)
 {
unsigned int idx;
+   struct device *dev = >pdev->dev;
+
+   if (!of_find_property(dev->of_node, "gpios", NULL))
+   return;
+
for (idx = 0; idx < 3; idx++)
gpio_free(sdd->gpios[idx]);
 }
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 3/5] spi: s3c64xx: Added provision for non-gpio i/o's

2013-02-13 Thread Girish K S
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.g...@samsung.com
---
changes in v2:
Removed the gpio quirk. Parse the gpios property
to decide whether  gpio / dedicated i/o lines should
be used.

 drivers/spi/spi-s3c64xx.c |8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index 45bad5d..a8fe876 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -1157,6 +1157,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);
@@ -1183,6 +1186,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]);
 }
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/