diff mbox

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

Message ID 1360785828-32767-4-git-send-email-ks.giri@samsung.com
State Superseded, archived
Headers show

Commit Message

girishks2000@gmail.com Feb. 13, 2013, 8:03 p.m. UTC
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>
---
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(+)

Comments

Grant Likely March 2, 2013, 10:56 p.m. UTC | #1
On Wed, 13 Feb 2013 12:03:46 -0800, Girish K S <girishks2000@gmail.com> wrote:
> 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>
> ---
> changes in v2:
> 		Removed the gpio quirk. Parse the "gpios" property
> 		to decide whether  gpio / dedicated i/o lines should
> 		be used.

It is perfectly valid to support both at the same time. The gpios
property can be 'sparse' in that when a gpio is specified, use that for
the CS control, but use a dedicated line with it is not. Instead of
doing this it would be better off to switch this driver to use the new
cs_gpios parsing in driver/spi/spi.c

g.



------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
girishks2000@gmail.com March 12, 2013, 5:30 a.m. UTC | #2
On Sun, Mar 3, 2013 at 4:26 AM, Grant Likely <grant.likely@secretlab.ca> wrote:
> On Wed, 13 Feb 2013 12:03:46 -0800, Girish K S <girishks2000@gmail.com> wrote:
>> 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>
>> ---
>> changes in v2:
>>               Removed the gpio quirk. Parse the "gpios" property
>>               to decide whether  gpio / dedicated i/o lines should
>>               be used.
>
> It is perfectly valid to support both at the same time. The gpios
> property can be 'sparse' in that when a gpio is specified, use that for
> the CS control, but use a dedicated line with it is not. Instead of
> doing this it would be better off to switch this driver to use the new
> cs_gpios parsing in driver/spi/spi.c
what i understand from you comment is, you want me to use "cs-gpios"
property for cs control. correct me if i am wrong.
This particular patch is applicable only for MISO/MSIO/CLK. The CS pin
is handled as you mentioned in the next patch of this series.
>
> g.
>
>

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
diff mbox

Patch

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]);
 }