linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure
@ 2012-07-25 11:44 Daniel Mack
       [not found] ` <1343216652-1463-1-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Mack @ 2012-07-25 11:44 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Daniel Mack

The spi-gpio driver currently assumes the chipselect gpio number is
stored in ->controller_data of the device's static board information.

In devicetree environments, this information is unavailable and has to
be derived from the DT node.

This patch moves the gpio storage to the controller's private data so
the DT bindings can easily build upon the driver.

Signed-off-by: Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/spi/spi-gpio.c |   34 ++++++++++++++++++++++++----------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index 0094c64..e79e311 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -46,6 +46,7 @@ struct spi_gpio {
 	struct spi_bitbang		bitbang;
 	struct spi_gpio_platform_data	pdata;
 	struct platform_device		*pdev;
+	int				cs_gpios[0];
 };
 
 /*----------------------------------------------------------------------*/
@@ -89,15 +90,21 @@ struct spi_gpio {
 
 /*----------------------------------------------------------------------*/
 
-static inline const struct spi_gpio_platform_data * __pure
-spi_to_pdata(const struct spi_device *spi)
+static inline struct spi_gpio * __pure
+spi_to_spi_gpio(const struct spi_device *spi)
 {
 	const struct spi_bitbang	*bang;
-	const struct spi_gpio		*spi_gpio;
+	struct spi_gpio			*spi_gpio;
 
 	bang = spi_master_get_devdata(spi->master);
 	spi_gpio = container_of(bang, struct spi_gpio, bitbang);
-	return &spi_gpio->pdata;
+	return spi_gpio;
+}
+
+static inline struct spi_gpio_platform_data * __pure
+spi_to_pdata(const struct spi_device *spi)
+{
+	return &spi_to_spi_gpio(spi)->pdata;
 }
 
 /* this is #defined to avoid unused-variable warnings when inlining */
@@ -210,7 +217,8 @@ static u32 spi_gpio_spec_txrx_word_mode3(struct spi_device *spi,
 
 static void spi_gpio_chipselect(struct spi_device *spi, int is_active)
 {
-	unsigned long cs = (unsigned long) spi->controller_data;
+	struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi);
+	unsigned int cs = spi_gpio->cs_gpios[spi->chip_select];
 
 	/* set initial clock polarity */
 	if (is_active)
@@ -224,8 +232,9 @@ static void spi_gpio_chipselect(struct spi_device *spi, int is_active)
 
 static int spi_gpio_setup(struct spi_device *spi)
 {
-	unsigned long	cs = (unsigned long) spi->controller_data;
-	int		status = 0;
+	unsigned int		cs = (unsigned int) spi->controller_data;
+	int			status = 0;
+	struct spi_gpio		*spi_gpio = spi_to_spi_gpio(spi);
 
 	if (spi->bits_per_word > 32)
 		return -EINVAL;
@@ -238,8 +247,11 @@ static int spi_gpio_setup(struct spi_device *spi)
 			status = gpio_direction_output(cs, spi->mode & SPI_CS_HIGH);
 		}
 	}
-	if (!status)
+	if (!status) {
 		status = spi_bitbang_setup(spi);
+		spi_gpio->cs_gpios[spi->chip_select] = cs;
+	}
+
 	if (status) {
 		if (!spi->controller_state && cs != SPI_GPIO_NO_CHIPSELECT)
 			gpio_free(cs);
@@ -249,7 +261,8 @@ static int spi_gpio_setup(struct spi_device *spi)
 
 static void spi_gpio_cleanup(struct spi_device *spi)
 {
-	unsigned long	cs = (unsigned long) spi->controller_data;
+	struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi);
+	unsigned int cs = spi_gpio->cs_gpios[spi->chip_select];
 
 	if (cs != SPI_GPIO_NO_CHIPSELECT)
 		gpio_free(cs);
@@ -330,7 +343,8 @@ static int __devinit spi_gpio_probe(struct platform_device *pdev)
 	if (status < 0)
 		return status;
 
-	master = spi_alloc_master(&pdev->dev, sizeof *spi_gpio);
+	master = spi_alloc_master(&pdev->dev, sizeof(*spi_gpio) +
+					(sizeof(int) * SPI_N_CHIPSEL));
 	if (!master) {
 		status = -ENOMEM;
 		goto gpio_free;
-- 
1.7.10.4


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/2] SPI: spi-gpio: Add DT bindings
       [not found] ` <1343216652-1463-1-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-07-25 11:44   ` Daniel Mack
       [not found]     ` <20120725121131.GA2628@pengutronix.de>
  2012-07-25 19:33   ` [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure Mark Brown
  2012-08-01 20:45   ` Daniel Mack
  2 siblings, 1 reply; 13+ messages in thread
From: Daniel Mack @ 2012-07-25 11:44 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, Daniel Mack

This patch adds DT bindings to the spi-gpio driver and some
documentation about how to use it.

Signed-off-by: Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 Documentation/devicetree/bindings/spi/spi-gpio.txt |   29 ++++++
 drivers/spi/spi-gpio.c                             |   99 +++++++++++++++++++-
 2 files changed, 125 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/spi/spi-gpio.txt

diff --git a/Documentation/devicetree/bindings/spi/spi-gpio.txt b/Documentation/devicetree/bindings/spi/spi-gpio.txt
new file mode 100644
index 0000000..8a824be
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/spi-gpio.txt
@@ -0,0 +1,29 @@
+SPI-GPIO devicetree bindings
+
+Required properties:
+
+ - compatible: should be set to "spi-gpio"
+ - #address-cells: should be set to <0x1>
+ - ranges
+ - gpio-sck: GPIO spec for the SCK line to use
+ - gpio-miso: GPIO spec for the MISO line to use
+ - gpio-mosi: GPIO spec for the MOSI line to use
+ - cs-gpios: GPIOs to use for chipselect lines
+ - num-chipselects: number of chipselect lines
+
+Example:
+
+	spi {
+		compatible = "spi-gpio";
+		#address-cells = <0x1>;
+		ranges;
+
+		gpio-sck = <&gpio 95 0>;
+		gpio-miso = <&gpio 98 0>;
+		gpio-mosi = <&gpio 97 0>;
+		cs-gpios = <&gpio 125 0>;
+		num-chipselects = <1>;
+
+		/* clients */
+	};
+
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index e79e311..c57a267 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -22,6 +22,8 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
 
 #include <linux/spi/spi.h>
 #include <linux/spi/spi_bitbang.h>
@@ -232,13 +234,27 @@ static void spi_gpio_chipselect(struct spi_device *spi, int is_active)
 
 static int spi_gpio_setup(struct spi_device *spi)
 {
-	unsigned int		cs = (unsigned int) spi->controller_data;
+	unsigned int		cs;
 	int			status = 0;
 	struct spi_gpio		*spi_gpio = spi_to_spi_gpio(spi);
+	struct device_node	*np = spi->master->dev.of_node;
 
 	if (spi->bits_per_word > 32)
 		return -EINVAL;
 
+	if (np) {
+		/*
+		 * In DT environments, the CS GPIOs have already been
+		 * initialized from the "cs-gpios" property of the node.
+		 */
+		cs = spi_gpio->cs_gpios[spi->chip_select];
+	} else {
+		/*
+		 * ... otherwise, take it from spi->controller_data
+		 */
+		cs = (unsigned int) spi->controller_data;
+	}
+
 	if (!spi->controller_state) {
 		if (cs != SPI_GPIO_NO_CHIPSELECT) {
 			status = gpio_request(cs, dev_name(&spi->dev));
@@ -249,6 +265,7 @@ static int spi_gpio_setup(struct spi_device *spi)
 	}
 	if (!status) {
 		status = spi_bitbang_setup(spi);
+		/* in case it was initialized from static board data */
 		spi_gpio->cs_gpios[spi->chip_select] = cs;
 	}
 
@@ -325,6 +342,55 @@ done:
 	return value;
 }
 
+#ifdef CONFIG_OF
+static struct of_device_id spi_gpio_dt_ids[] = {
+	{ .compatible = "spi-gpio" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, spi_gpio_dt_ids);
+
+static int spi_gpio_probe_dt(struct platform_device *pdev)
+{
+	int ret;
+	u32 tmp;
+	struct spi_gpio_platform_data	*pdata;
+	struct device_node *np = pdev->dev.of_node;
+	const struct of_device_id *of_id =
+			of_match_device(spi_gpio_dt_ids, &pdev->dev);
+
+	if (!of_id)
+		return 0;
+
+	pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		return -ENOMEM;
+
+	pdata->sck = of_get_named_gpio(np, "gpio-sck", 0);
+	pdata->miso = of_get_named_gpio(np, "gpio-miso", 0);
+	pdata->mosi = of_get_named_gpio(np, "gpio-mosi", 0);
+
+	ret = of_property_read_u32(np, "num-chipselects", &tmp);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "num-chipselects property not found\n");
+		goto error_free;
+	}
+
+	pdata->num_chipselect = tmp;
+	pdev->dev.platform_data = pdata;
+
+	return 1;
+
+error_free:
+	devm_kfree(&pdev->dev, pdata);
+	return ret;
+}
+#else
+static inline int spi_probe_dt(struct platform_device *)
+{
+	return 0;
+}
+#endif
+
 static int __devinit spi_gpio_probe(struct platform_device *pdev)
 {
 	int				status;
@@ -332,6 +398,13 @@ static int __devinit spi_gpio_probe(struct platform_device *pdev)
 	struct spi_gpio			*spi_gpio;
 	struct spi_gpio_platform_data	*pdata;
 	u16 master_flags = 0;
+	bool use_of = 0;
+
+	status = spi_gpio_probe_dt(pdev);
+	if (status < 0)
+		return status;
+	if (status > 0)
+		use_of = 1;
 
 	pdata = pdev->dev.platform_data;
 #ifdef GENERIC_BITBANG
@@ -361,6 +434,23 @@ static int __devinit spi_gpio_probe(struct platform_device *pdev)
 	master->num_chipselect = SPI_N_CHIPSEL;
 	master->setup = spi_gpio_setup;
 	master->cleanup = spi_gpio_cleanup;
+#ifdef CONFIG_OF
+	master->dev.of_node = pdev->dev.of_node;
+
+	if (use_of) {
+		int i;
+		struct device_node *np = pdev->dev.of_node;
+
+		/*
+		 * In DT environments, take the CS GPIO from the "cs-gpios"
+		 * property of the node.
+		 */
+
+		for (i = 0; i < SPI_N_CHIPSEL; i++)
+			spi_gpio->cs_gpios[i] =
+				of_get_named_gpio(np, "cs-gpios", i);
+	}
+#endif
 
 	spi_gpio->bitbang.master = spi_master_get(master);
 	spi_gpio->bitbang.chipselect = spi_gpio_chipselect;
@@ -421,8 +511,11 @@ static int __devexit spi_gpio_remove(struct platform_device *pdev)
 MODULE_ALIAS("platform:" DRIVER_NAME);
 
 static struct platform_driver spi_gpio_driver = {
-	.driver.name	= DRIVER_NAME,
-	.driver.owner	= THIS_MODULE,
+	.driver = {
+		.name	= DRIVER_NAME,
+		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(spi_gpio_dt_ids),
+	},
 	.probe		= spi_gpio_probe,
 	.remove		= __devexit_p(spi_gpio_remove),
 };
-- 
1.7.10.4


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] SPI: spi-gpio: Add DT bindings
       [not found]       ` <20120725121131.GA2628-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2012-07-25 12:17         ` Daniel Mack
       [not found]           ` <20120725123244.GB2628@pengutronix.de>
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Mack @ 2012-07-25 12:17 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On 25.07.2012 14:11, Wolfram Sang wrote:
> On Wed, Jul 25, 2012 at 01:44:12PM +0200, Daniel Mack wrote:
>> This patch adds DT bindings to the spi-gpio driver and some
>> documentation about how to use it.
>>
>> Signed-off-by: Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> ---
>>  Documentation/devicetree/bindings/spi/spi-gpio.txt |   29 ++++++
>>  drivers/spi/spi-gpio.c                             |   99 +++++++++++++++++++-
>>  2 files changed, 125 insertions(+), 3 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/spi/spi-gpio.txt
>>
>> diff --git a/Documentation/devicetree/bindings/spi/spi-gpio.txt b/Documentation/devicetree/bindings/spi/spi-gpio.txt
>> new file mode 100644
>> index 0000000..8a824be
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/spi/spi-gpio.txt
>> @@ -0,0 +1,29 @@
>> +SPI-GPIO devicetree bindings
>> +
>> +Required properties:
>> +
>> + - compatible: should be set to "spi-gpio"
>> + - #address-cells: should be set to <0x1>
>> + - ranges
>> + - gpio-sck: GPIO spec for the SCK line to use
>> + - gpio-miso: GPIO spec for the MISO line to use
>> + - gpio-mosi: GPIO spec for the MOSI line to use
>> + - cs-gpios: GPIOs to use for chipselect lines
>> + - num-chipselects: number of chipselect lines
>> +
>> +Example:
>> +
>> +	spi {
>> +		compatible = "spi-gpio";
>> +		#address-cells = <0x1>;
>> +		ranges;
>> +
>> +		gpio-sck = <&gpio 95 0>;
>> +		gpio-miso = <&gpio 98 0>;
>> +		gpio-mosi = <&gpio 97 0>;
>> +		cs-gpios = <&gpio 125 0>;
>> +		num-chipselects = <1>;
> 
> Can't we use of_gpio_named_count() instead of this property?

I thought so too, but it's probably also a good idea to keep this driver
in line to what other drivers do, no? Anyway, I can of course change it
if desired.

>> +
>> +		/* clients */
> 
> Minor: A simple example is helpful for people new to devicetree as I
> experienced in the last days.

Hmm, aren't there enough examples in a) the full dts files in the kernel
and b) in the documenation of spi clients?


Thanks,
Daniel


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/2] SPI: spi-gpio: Add DT bindings
       [not found]             ` <20120725123244.GB2628-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2012-07-25 12:35               ` Daniel Mack
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Mack @ 2012-07-25 12:35 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Shawn Guo,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On 25.07.2012 14:32, Wolfram Sang wrote:
> 
>>>> +Example:
>>>> +
>>>> +	spi {
>>>> +		compatible = "spi-gpio";
>>>> +		#address-cells = <0x1>;
>>>> +		ranges;
>>>> +
>>>> +		gpio-sck = <&gpio 95 0>;
>>>> +		gpio-miso = <&gpio 98 0>;
>>>> +		gpio-mosi = <&gpio 97 0>;
>>>> +		cs-gpios = <&gpio 125 0>;
>>>> +		num-chipselects = <1>;
>>>
>>> Can't we use of_gpio_named_count() instead of this property?
>>
>> I thought so too, but it's probably also a good idea to keep this driver
>> in line to what other drivers do, no?
> 
> I'd prefer to drop it unless there is a real need for it. CCing Shawn to
> ask why "fsl,spi-num-chipselects" was added to the spi-imx driver
> instead of using of_gpio_{named_}count(). Was there a reason?
> 
>>>> +
>>>> +		/* clients */
>>>
>>> Minor: A simple example is helpful for people new to devicetree as I
>>> experienced in the last days.
>>
>> Hmm, aren't there enough examples in a) the full dts files in the kernel
>> and b) in the documenation of spi clients?
> 
> Many, yes; enough, don't know :) I just experienced that people
> missed this information in some of the i2c host controller binding
> descriptions, despite it was available elsewhere.

I would rather say specific examples in the documenation for generic bus
drivers cause more confusion than they clear :)


Daniel


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure
       [not found] ` <1343216652-1463-1-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2012-07-25 11:44   ` [PATCH 2/2] SPI: spi-gpio: Add DT bindings Daniel Mack
@ 2012-07-25 19:33   ` Mark Brown
       [not found]     ` <20120725193359.GB9792-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
  2012-08-01 20:45   ` Daniel Mack
  2 siblings, 1 reply; 13+ messages in thread
From: Mark Brown @ 2012-07-25 19:33 UTC (permalink / raw)
  To: Daniel Mack
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On Wed, Jul 25, 2012 at 01:44:11PM +0200, Daniel Mack wrote:
> The spi-gpio driver currently assumes the chipselect gpio number is
> stored in ->controller_data of the device's static board information.

Always CC maintainers on things...  you've not CCed Grant or Linus W,
and for now I'm handling SPI patches (though I'm not in MAINTAINERS so
missing me is less surprising).

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure
       [not found]     ` <20120725193359.GB9792-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2012-07-25 19:38       ` Daniel Mack
       [not found]         ` <50104B52.7090509-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Mack @ 2012-07-25 19:38 UTC (permalink / raw)
  To: Mark Brown
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On 25.07.2012 21:33, Mark Brown wrote:
> On Wed, Jul 25, 2012 at 01:44:11PM +0200, Daniel Mack wrote:
>> The spi-gpio driver currently assumes the chipselect gpio number is
>> stored in ->controller_data of the device's static board information.
> 
> Always CC maintainers on things...  you've not CCed Grant or Linus W,
> and for now I'm handling SPI patches (though I'm not in MAINTAINERS so
> missing me is less surprising).

I *did* Cc: Grant and all other people that get_maintainer.pl listed.
For some reason, Grant was dropped from the list on Wolfram's reply, and
I just did't see that.

$ scripts/get_maintainer.pl -f drivers/spi/spi-gpio.c

                                                         (0) [21:35:24]
Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> (maintainer:SPI SUBSYSTEM)
Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> (maintainer:OPEN FIRMWARE AND...)
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org (open list:SPI SUBSYSTEM)
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org (open list)
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org (moderated list:OPEN FIRMWARE AND...)

And I didn't know about you being in charge for SPI (saw that only today
when you sent your pull request to lkml). So, sorry.

Anyway - let's rather discuss about the patchset :)


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure
       [not found]         ` <50104B52.7090509-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-07-25 19:52           ` Mark Brown
       [not found]             ` <20120725195203.GC9792-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Brown @ 2012-07-25 19:52 UTC (permalink / raw)
  To: Daniel Mack
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On Wed, Jul 25, 2012 at 09:38:58PM +0200, Daniel Mack wrote:
> On 25.07.2012 21:33, Mark Brown wrote:

> > Always CC maintainers on things...  you've not CCed Grant or Linus W,
> > and for now I'm handling SPI patches (though I'm not in MAINTAINERS so
> > missing me is less surprising).

> I *did* Cc: Grant and all other people that get_maintainer.pl listed.
> For some reason, Grant was dropped from the list on Wolfram's reply, and
> I just did't see that.

Grant's not in the CCs for the message I replied to which was one of
your patches.

> Anyway - let's rather discuss about the patchset :)

Part of the reason I'm being grumpy is I'm not likely to look at it
right now and my workflow is heavily based on things hitting my inbox
(I use a totally different account for generic list mail I'm not CCed on
and it's annoying to move stuff from one to the other).

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure
       [not found]             ` <20120725195203.GC9792-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2012-07-25 20:00               ` Daniel Mack
       [not found]                 ` <50105052.4000603-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Daniel Mack @ 2012-07-25 20:00 UTC (permalink / raw)
  To: Mark Brown
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On 25.07.2012 21:52, Mark Brown wrote:
> On Wed, Jul 25, 2012 at 09:38:58PM +0200, Daniel Mack wrote:
>> On 25.07.2012 21:33, Mark Brown wrote:
> 
>>> Always CC maintainers on things...  you've not CCed Grant or Linus W,
>>> and for now I'm handling SPI patches (though I'm not in MAINTAINERS so
>>> missing me is less surprising).
> 
>> I *did* Cc: Grant and all other people that get_maintainer.pl listed.
>> For some reason, Grant was dropped from the list on Wolfram's reply, and
>> I just did't see that.
> 
> Grant's not in the CCs for the message I replied to which was one of
> your patches.

I don't know what's wrong here, but clearly, the message in my inbox has

To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Cc: grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

And I sent them off with git "send-email --to
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org --cc grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org ..."

Sorry if that's my mistake, I just don't see it.

>> Anyway - let's rather discuss about the patchset :)
> 
> Part of the reason I'm being grumpy is I'm not likely to look at it
> right now and my workflow is heavily based on things hitting my inbox
> (I use a totally different account for generic list mail I'm not CCed on
> and it's annoying to move stuff from one to the other).

Ok, no hurries. I'm aware that it was a bad time to publish the patches
just after the merge window opened. I'll ping you next week.



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure
       [not found]                 ` <50105052.4000603-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-07-25 20:12                   ` Mark Brown
       [not found]                     ` <20120725201227.GE9792-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Brown @ 2012-07-25 20:12 UTC (permalink / raw)
  To: Daniel Mack
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On Wed, Jul 25, 2012 at 10:00:18PM +0200, Daniel Mack wrote:

> I don't know what's wrong here, but clearly, the message in my inbox has

> To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> Cc: grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org,
> 	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org,
> 	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
> 	Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

> And I sent them off with git "send-email --to
> spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org --cc grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org ..."

> Sorry if that's my mistake, I just don't see it.

I forwarded <1343216652-1463-1-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> to you
under separate cover.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure
       [not found]                     ` <20120725201227.GE9792-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
@ 2012-07-25 20:22                       ` Daniel Mack
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Mack @ 2012-07-25 20:22 UTC (permalink / raw)
  To: Mark Brown
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On 25.07.2012 22:12, Mark Brown wrote:
> On Wed, Jul 25, 2012 at 10:00:18PM +0200, Daniel Mack wrote:
> 
>> I don't know what's wrong here, but clearly, the message in my inbox has
> 
>> To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>> Cc: grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org,
>> 	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org,
>> 	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
>> 	Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
>> And I sent them off with git "send-email --to
>> spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org --cc grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org ..."
> 
>> Sorry if that's my mistake, I just don't see it.
> 
> I forwarded <1343216652-1463-1-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> to you
> under separate cover.
> 

Yes, you're right - I also saw that on the devicetree-discuss archives.
Still, I can't see the reason. My MTA's log states:

Jul 25 13:44:18 rambrand postfix/smtp[17884]: 84613C0081:
to=<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>, relay=127.0.0.1[127.0.0.1]:10024,
delay=0.7, delays=0.35/0/0.01/0.34, dsn=2.0.0, status=sent (250 2.0.0
from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as ED410C029D)
Jul 25 13:44:19 rambrand postfix/smtp[17898]: ED410C029D:
to=<grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>,
relay=aspmx.l.google.com[173.194.78.26]:25, delay=1.3,
delays=0.06/0.19/0.5/0.57, dsn=2.0.0, status=sent (250 2.0.0 OK
1343216659 e19si24125620wec.111)

(Each queue ID matches one of the two original patches' Message-ID)

As you appearantly received the mail via spi-devel-general, is it
possible that that list dropped it? Must be.



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure
       [not found] ` <1343216652-1463-1-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2012-07-25 11:44   ` [PATCH 2/2] SPI: spi-gpio: Add DT bindings Daniel Mack
  2012-07-25 19:33   ` [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure Mark Brown
@ 2012-08-01 20:45   ` Daniel Mack
       [not found]     ` <5019955F.3030108-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2 siblings, 1 reply; 13+ messages in thread
From: Daniel Mack @ 2012-08-01 20:45 UTC (permalink / raw)
  To: Mark Brown
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

Mark,

could you have another look at these patches maybe? They aren't urgent,
I just want to avoid the get lost.

Thanks for your time,
Daniel


On 25.07.2012 13:44, Daniel Mack wrote:
> The spi-gpio driver currently assumes the chipselect gpio number is
> stored in ->controller_data of the device's static board information.
> 
> In devicetree environments, this information is unavailable and has to
> be derived from the DT node.
> 
> This patch moves the gpio storage to the controller's private data so
> the DT bindings can easily build upon the driver.
> 
> Signed-off-by: Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/spi/spi-gpio.c |   34 ++++++++++++++++++++++++----------
>  1 file changed, 24 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
> index 0094c64..e79e311 100644
> --- a/drivers/spi/spi-gpio.c
> +++ b/drivers/spi/spi-gpio.c
> @@ -46,6 +46,7 @@ struct spi_gpio {
>  	struct spi_bitbang		bitbang;
>  	struct spi_gpio_platform_data	pdata;
>  	struct platform_device		*pdev;
> +	int				cs_gpios[0];
>  };
>  
>  /*----------------------------------------------------------------------*/
> @@ -89,15 +90,21 @@ struct spi_gpio {
>  
>  /*----------------------------------------------------------------------*/
>  
> -static inline const struct spi_gpio_platform_data * __pure
> -spi_to_pdata(const struct spi_device *spi)
> +static inline struct spi_gpio * __pure
> +spi_to_spi_gpio(const struct spi_device *spi)
>  {
>  	const struct spi_bitbang	*bang;
> -	const struct spi_gpio		*spi_gpio;
> +	struct spi_gpio			*spi_gpio;
>  
>  	bang = spi_master_get_devdata(spi->master);
>  	spi_gpio = container_of(bang, struct spi_gpio, bitbang);
> -	return &spi_gpio->pdata;
> +	return spi_gpio;
> +}
> +
> +static inline struct spi_gpio_platform_data * __pure
> +spi_to_pdata(const struct spi_device *spi)
> +{
> +	return &spi_to_spi_gpio(spi)->pdata;
>  }
>  
>  /* this is #defined to avoid unused-variable warnings when inlining */
> @@ -210,7 +217,8 @@ static u32 spi_gpio_spec_txrx_word_mode3(struct spi_device *spi,
>  
>  static void spi_gpio_chipselect(struct spi_device *spi, int is_active)
>  {
> -	unsigned long cs = (unsigned long) spi->controller_data;
> +	struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi);
> +	unsigned int cs = spi_gpio->cs_gpios[spi->chip_select];
>  
>  	/* set initial clock polarity */
>  	if (is_active)
> @@ -224,8 +232,9 @@ static void spi_gpio_chipselect(struct spi_device *spi, int is_active)
>  
>  static int spi_gpio_setup(struct spi_device *spi)
>  {
> -	unsigned long	cs = (unsigned long) spi->controller_data;
> -	int		status = 0;
> +	unsigned int		cs = (unsigned int) spi->controller_data;
> +	int			status = 0;
> +	struct spi_gpio		*spi_gpio = spi_to_spi_gpio(spi);
>  
>  	if (spi->bits_per_word > 32)
>  		return -EINVAL;
> @@ -238,8 +247,11 @@ static int spi_gpio_setup(struct spi_device *spi)
>  			status = gpio_direction_output(cs, spi->mode & SPI_CS_HIGH);
>  		}
>  	}
> -	if (!status)
> +	if (!status) {
>  		status = spi_bitbang_setup(spi);
> +		spi_gpio->cs_gpios[spi->chip_select] = cs;
> +	}
> +
>  	if (status) {
>  		if (!spi->controller_state && cs != SPI_GPIO_NO_CHIPSELECT)
>  			gpio_free(cs);
> @@ -249,7 +261,8 @@ static int spi_gpio_setup(struct spi_device *spi)
>  
>  static void spi_gpio_cleanup(struct spi_device *spi)
>  {
> -	unsigned long	cs = (unsigned long) spi->controller_data;
> +	struct spi_gpio *spi_gpio = spi_to_spi_gpio(spi);
> +	unsigned int cs = spi_gpio->cs_gpios[spi->chip_select];
>  
>  	if (cs != SPI_GPIO_NO_CHIPSELECT)
>  		gpio_free(cs);
> @@ -330,7 +343,8 @@ static int __devinit spi_gpio_probe(struct platform_device *pdev)
>  	if (status < 0)
>  		return status;
>  
> -	master = spi_alloc_master(&pdev->dev, sizeof *spi_gpio);
> +	master = spi_alloc_master(&pdev->dev, sizeof(*spi_gpio) +
> +					(sizeof(int) * SPI_N_CHIPSEL));
>  	if (!master) {
>  		status = -ENOMEM;
>  		goto gpio_free;
> 


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure
       [not found]     ` <5019955F.3030108-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-08-01 20:51       ` Mark Brown
       [not found]         ` <20120801205135.GA29157-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Brown @ 2012-08-01 20:51 UTC (permalink / raw)
  To: Daniel Mack
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On Wed, Aug 01, 2012 at 10:45:19PM +0200, Daniel Mack wrote:

> could you have another look at these patches maybe? They aren't urgent,
> I just want to avoid the get lost.

Can you please resend them with me in the CCs?  My process for handling
patches is very heavily based on my inbox.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure
       [not found]         ` <20120801205135.GA29157-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
@ 2012-08-01 20:58           ` Daniel Mack
  0 siblings, 0 replies; 13+ messages in thread
From: Daniel Mack @ 2012-08-01 20:58 UTC (permalink / raw)
  To: Mark Brown
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	rob.herring-bsGFqQB8/DxBDgjK7y7TUQ

On 01.08.2012 22:51, Mark Brown wrote:
> On Wed, Aug 01, 2012 at 10:45:19PM +0200, Daniel Mack wrote:
> 
>> could you have another look at these patches maybe? They aren't urgent,
>> I just want to avoid the get lost.
> 
> Can you please resend them with me in the CCs?  My process for handling
> patches is very heavily based on my inbox.
> 

Sure. This time, I added you, Grant and Linus W to the patch using Cc:
lines. Let's see if that works better :)


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2012-08-01 20:58 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-25 11:44 [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure Daniel Mack
     [not found] ` <1343216652-1463-1-git-send-email-zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-07-25 11:44   ` [PATCH 2/2] SPI: spi-gpio: Add DT bindings Daniel Mack
     [not found]     ` <20120725121131.GA2628@pengutronix.de>
     [not found]       ` <20120725121131.GA2628-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-07-25 12:17         ` Daniel Mack
     [not found]           ` <20120725123244.GB2628@pengutronix.de>
     [not found]             ` <20120725123244.GB2628-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-07-25 12:35               ` Daniel Mack
2012-07-25 19:33   ` [PATCH 1/2] SPI: spi-gpio: store chipselect information in private structure Mark Brown
     [not found]     ` <20120725193359.GB9792-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2012-07-25 19:38       ` Daniel Mack
     [not found]         ` <50104B52.7090509-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-07-25 19:52           ` Mark Brown
     [not found]             ` <20120725195203.GC9792-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2012-07-25 20:00               ` Daniel Mack
     [not found]                 ` <50105052.4000603-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-07-25 20:12                   ` Mark Brown
     [not found]                     ` <20120725201227.GE9792-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2012-07-25 20:22                       ` Daniel Mack
2012-08-01 20:45   ` Daniel Mack
     [not found]     ` <5019955F.3030108-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-08-01 20:51       ` Mark Brown
     [not found]         ` <20120801205135.GA29157-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-08-01 20:58           ` Daniel Mack

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).