Skip to contentSkip to conversation

Remove "spi-cs-high" property for GPIO-based chipselects

RFC PATCH In review Alexander Shiyan 4 participants 17 messages Dec 1, 2013 – Dec 3, 2013 14 messages not in the archive SPI

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Remove "spi-cs-high" property for GPIO-based chipselects

This patch takes the CS active level from the GPIO bindings, so we remove the special property "spi-cs-high" for chipselects that use GPIO.

---
 drivers/spi/spi.c       | 28 ++++++++++++++++++----------
 include/linux/spi/spi.h |  2 ++
 2 files changed, 20 insertions(+), 10 deletions(-)
drivers/spi/spi.c +18 -10
index 98f4b77..d2ba1ec 100644
@@ -413,8 +413,12 @@ int spi_add_device(struct spi_device *spi)
 		goto done;
 	}
 
-	if (master->cs_gpios)
+	if (master->cs_gpios) {
 		spi->cs_gpio = master->cs_gpios[spi->chip_select];
+		if (!(master->cs_gpios_flags[spi->chip_select] &
+		      OF_GPIO_ACTIVE_LOW))
+			spi->mode |= SPI_CS_HIGH;
+	}
 
 	/* Drivers may modify this initial i/o setup, but will
 	 * normally rely on the device being setup.  Devices
@@ -1027,10 +1031,14 @@ static void of_register_spi_devices(struct spi_master *master)
 			spi->mode |= SPI_CPHA;
 		if (of_find_property(nc, "spi-cpol", NULL))
 			spi->mode |= SPI_CPOL;
-		if (of_find_property(nc, "spi-cs-high", NULL))
-			spi->mode |= SPI_CS_HIGH;
 		if (of_find_property(nc, "spi-3wire", NULL))
 			spi->mode |= SPI_3WIRE;
+		if (of_find_property(nc, "spi-cs-high", NULL)) {
+			if (master->cs_gpios)
+				dev_notice(&master->dev,
+					"\"spi-cs-high\" property is obsolete.\n");
+			spi->mode |= SPI_CS_HIGH;
+		}
 
 		/* Device DUAL/QUAD mode */
 		if (!of_property_read_u32(nc, "spi-tx-bus-width", &value)) {
@@ -1260,7 +1268,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master);
 #ifdef CONFIG_OF
 static int of_spi_register_master(struct spi_master *master)
 {
-	int nb, i, *cs;
+	int nb, i;
 	struct device_node *np = master->dev.of_node;
 
 	if (!np)
@@ -1275,19 +1283,19 @@ static int of_spi_register_master(struct spi_master *master)
 	else if (nb < 0)
 		return nb;
 
-	cs = devm_kzalloc(&master->dev,
-			  sizeof(int) * master->num_chipselect,
-			  GFP_KERNEL);
-	master->cs_gpios = cs;
+	master->cs_gpios = devm_kzalloc(&master->dev, master->num_chipselect *
+		(sizeof(int) + sizeof(enum of_gpio_flags)), GFP_KERNEL);
 
 	if (!master->cs_gpios)
 		return -ENOMEM;
 
 	for (i = 0; i < master->num_chipselect; i++)
-		cs[i] = -ENOENT;
+		master->cs_gpios[i] = -ENOENT;
 
 	for (i = 0; i < nb; i++)
-		cs[i] = of_get_named_gpio(np, "cs-gpios", i);
+		master->cs_gpios[i] =
+			of_get_named_gpio_flags(np, "cs-gpios", i,
+						&master->cs_gpios_flags[i]);
 
 	return 0;
 }
include/linux/spi/spi.h +2 -0
index 8c62ba7..c0cade2 100644
@@ -423,6 +423,8 @@ struct spi_master {
 
 	/* gpio chip select */
 	int			*cs_gpios;
+	/* GPIO flags */
+	enum of_gpio_flags	*cs_gpios_flags;
 };
 
 static inline void *spi_master_get_devdata(struct spi_master *master)
Signature · 6 lines
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1385884756-31373-1-git-send-email-shc_work-JGs/[email protected]

#2 lore raw
Quoted 3 lines · Alexander Shiyan

This patch takes the CS active level from the GPIO bindings, so we remove the special property "spi-cs-high" for chipselects that use GPIO.

Unfortuantely this would introduce an incompatible change in the DT bindings so we can't do this. Updating the documentation to deprecate the old binding would be OK, though I'm not sure it's a great advantage since it means you wouldn't be able to use the same binding with GPIOs as you could with controller integrated chip selects.

Adding support for using the GPIO binding information is fine but removing the old method (especially without a binding update) doesn't seem great.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

PiBPbiBTdW4sIERlYy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1DUyB1c2VycyB0aGF0IGl0IGlzIGJldHRlciB0byB1c2UgR1BJTy1iaW5kaW5ncy4K Q29kZSBpcyBjb25zdHJ1Y3RlZCBzbyB0aGF0IHRoZXJlIGlzIG5vIGluY29tcGF0aWJpbGl0eSBi ZXR3ZWVuIHRoZQp1c2Ugb2Ygb2xkIGFuZCBuZXcgbWV0aG9kcy4KCi0tLQo=
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 4 lines · Alexander Shiyan

Old method still remains (especially for integrated CS), we just warn the GPIO-CS users that it is better to use GPIO-bindings.
Code is constructed so that there is no incompatibility between the use of old and new methods.

My point is that I don't think it's especially useful to deprecate the existing method - telling people that they are using a deprecated method is a kind of incompatibility and it suggests an intention to remove in the future.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#8 lore raw

PiBPbiBNb24sIERlYyAwMiwgMjAxMyBhdCAwMzo1ODozM1BNICswNDAwLCBBbGV4YW5kZXIgU2hp eWFuIHdyb3RlOgo+IAo+ID4gT2xkIG1ldGhvZCBzdGlsbCByZW1haW5zIChlc3BlY2lhbGx5IGZv ciBpbnRlZ3JhdGVkIENTKSwgd2UganVzdCB3YXJuIHRoZQo+ID4gR1BJTy1DUyB1c2VycyB0aGF0 IGl0IGlzIGJldHRlciB0byB1c2UgR1BJTy1iaW5kaW5ncy4KPiA+IENvZGUgaXMgY29uc3RydWN0 ZWQgc28gdGhhdCB0aGVyZSBpcyBubyBpbmNvbXBhdGliaWxpdHkgYmV0d2VlbiB0aGUKPiA+IHVz ZSBvZiBvbGQgYW5kIG5ldyBtZXRob2RzLgo+IAo+IE15IHBvaW50IGlzIHRoYXQgSSBkb24ndCB0 aGluayBpdCdzIGVzcGVjaWFsbHkgdXNlZnVsIHRvIGRlcHJlY2F0ZSB0aGUKPiBleGlzdGluZyBt ZXRob2QgLSB0ZWxsaW5nIHBlb3BsZSB0aGF0IHRoZXkgYXJlIHVzaW5nIGEgZGVwcmVjYXRlZAo+ IG1ldGhvZCBpcyBhIGtpbmQgb2YgaW5jb21wYXRpYmlsaXR5IGFuZCBpdCBzdWdnZXN0cyBhbiBp bnRlbnRpb24gdG8KPiByZW1vdmUgaW4gdGhlIGZ1dHVyZS4KCk9LLiBXaGF0IGFib3V0ICJBZGQg cG9zc2liaWxpdHkgdG8gdXNlIEdQSU8tYmluZGluZ3MgZm9yIGRlZmluZSBjaGlwc2VsZWN0CmFj dGl2ZSBsZXZlbCIgaW4gdGhlIHBhdGNoIG5hbWUgYW5kIHJlbW92ZSB3YXJuaW5nIGluIHRoZSBw YXRjaD8KT2YgY291cnNlIHdlIG5lZWQgdG8gbWFrZSBzb21lIGNoYW5nZXMgaW4gdGhlIGRvY3Vt ZW50YXRpb24gYWxzby4KCi0tLQo=
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw
Quoted 3 lines · Alexander Shiyan

OK. What about "Add possibility to use GPIO-bindings for define chipselect active level" in the patch name and remove warning in the patch? Of course we need to make some changes in the documentation also.

Yes, that sounds good.

#11 lore raw
In reply to a message not in the archive
Quoted 67 lines · Alexander Shiyan

This patch takes the CS active level from the GPIO bindings, so we remove the special property "spi-cs-high" for chipselects that use GPIO.

---
 drivers/spi/spi.c       | 28 ++++++++++++++++++----------
 include/linux/spi/spi.h |  2 ++
 2 files changed, 20 insertions(+), 10 deletions(-)
drivers/spi/spi.c +14 -8
index 98f4b77..d2ba1ec 100644
@@ -413,8 +413,12 @@ int spi_add_device(struct spi_device *spi)
                goto done;
        }
 
-       if (master->cs_gpios)
+       if (master->cs_gpios) {
                spi->cs_gpio = master->cs_gpios[spi->chip_select];
+               if (!(master->cs_gpios_flags[spi->chip_select] &
+                     OF_GPIO_ACTIVE_LOW))
+                       spi->mode |= SPI_CS_HIGH;
+       }
 
        /* Drivers may modify this initial i/o setup, but will
         * normally rely on the device being setup.  Devices
@@ -1027,10 +1031,14 @@ static void of_register_spi_devices(struct spi_master *master)
                        spi->mode |= SPI_CPHA;
                if (of_find_property(nc, "spi-cpol", NULL))
                        spi->mode |= SPI_CPOL;
-               if (of_find_property(nc, "spi-cs-high", NULL))
-                       spi->mode |= SPI_CS_HIGH;
                if (of_find_property(nc, "spi-3wire", NULL))
                        spi->mode |= SPI_3WIRE;
+               if (of_find_property(nc, "spi-cs-high", NULL)) {
+                       if (master->cs_gpios)
+                               dev_notice(&master->dev,
+                                       "\"spi-cs-high\" property is obsolete.\n");
+                       spi->mode |= SPI_CS_HIGH;
+               }
 
                /* Device DUAL/QUAD mode */
                if (!of_property_read_u32(nc, "spi-tx-bus-width", &value)) {
@@ -1260,7 +1268,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master);
 #ifdef CONFIG_OF
 static int of_spi_register_master(struct spi_master *master)
 {
-       int nb, i, *cs;
+       int nb, i;
        struct device_node *np = master->dev.of_node;
 
        if (!np)
@@ -1275,19 +1283,19 @@ static int of_spi_register_master(struct spi_master *master)
        else if (nb < 0)
                return nb;
 
-       cs = devm_kzalloc(&master->dev,
-                         sizeof(int) * master->num_chipselect,
-                         GFP_KERNEL);
-       master->cs_gpios = cs;
+       master->cs_gpios = devm_kzalloc(&master->dev, master->num_chipselect *
+               (sizeof(int) + sizeof(enum of_gpio_flags)), GFP_KERNEL);
 
        if (!master->cs_gpios)
                return -ENOMEM;

drivers/spi/spi.c static int of_spi_register_master(struct spi_master *master) · line 1298

Quoted 10 lines
drivers/spi/spi.c +4 -2
 
        for (i = 0; i < master->num_chipselect; i++)
-               cs[i] = -ENOENT;
+               master->cs_gpios[i] = -ENOENT;
 
        for (i = 0; i < nb; i++)
-               cs[i] = of_get_named_gpio(np, "cs-gpios", i);
+               master->cs_gpios[i] =
+                       of_get_named_gpio_flags(np, "cs-gpios", i,
+                                               &master->cs_gpios_flags[i]);

I don't see you initializing master->cs_gpio_flags anywhere, so won't this cause a null/unitialized pointer access?

Regards
Jonas
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CAOiHx=nAcGdk7QgKPrbmkbQYzWL6qNb2cnJj3c_A+9++RrLoeA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#13 lore raw

PiBPbiBTdW4sIERlYyAxLCAyMDEzIGF0IDg6NTkgQU0sIEFsZXhhbmRlciBTaGl5YW4gPHNoY193 b3JrQG1haWwucnU+IHdyb3RlOgo+ID4gVGhpcyBwYXRjaCB0YWtlcyB0aGUgQ1MgYWN0aXZlIGxl dmVsIGZyb20gdGhlIEdQSU8gYmluZGluZ3MsCj4gPiBzbyB3ZSByZW1vdmUgdGhlIHNwZWNpYWwg cHJvcGVydHkgInNwaS1jcy1oaWdoIiBmb3IgY2hpcHNlbGVjdHMKPiA+IHRoYXQgdXNlIEdQSU8u Ci4uLgoKPiA+IC0gICAgICAgY3MgPSBkZXZtX2t6YWxsb2MoJm1hc3Rlci0+ZGV2LAo+ID4gLSAg ICAgICAgICAgICAgICAgICAgICAgICBzaXplb2YoaW50KSAqIG1hc3Rlci0+bnVtX2NoaXBzZWxl Y3QsCj4gPiAtICAgICAgICAgICAgICAgICAgICAgICAgIEdGUF9LRVJORUwpOwo+ID4gLSAgICAg ICBtYXN0ZXItPmNzX2dwaW9zID0gY3M7Cj4gPiArICAgICAgIG1hc3Rlci0+Y3NfZ3Bpb3MgPSBk ZXZtX2t6YWxsb2MoJm1hc3Rlci0+ZGV2LCBtYXN0ZXItPm51bV9jaGlwc2VsZWN0ICoKPiA+ICsg ICAgICAgICAgICAgICAoc2l6ZW9mKGludCkgKyBzaXplb2YoZW51bSBvZl9ncGlvX2ZsYWdzKSks IEdGUF9LRVJORUwpOwo+ID4KPiA+ICAgICAgICAgaWYgKCFtYXN0ZXItPmNzX2dwaW9zKQo+ID4g ICAgICAgICAgICAgICAgIHJldHVybiAtRU5PTUVNOwo+ID4KPiA+ICAgICAgICAgZm9yIChpID0g MDsgaSA8IG1hc3Rlci0+bnVtX2NoaXBzZWxlY3Q7IGkrKykKPiA+IC0gICAgICAgICAgICAgICBj c1tpXSA9IC1FTk9FTlQ7Cj4gPiArICAgICAgICAgICAgICAgbWFzdGVyLT5jc19ncGlvc1tpXSA9 IC1FTk9FTlQ7Cj4gPgo+ID4gICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbmI7IGkrKykKPiA+IC0g ICAgICAgICAgICAgICBjc1tpXSA9IG9mX2dldF9uYW1lZF9ncGlvKG5wLCAiY3MtZ3Bpb3MiLCBp KTsKPiA+ICsgICAgICAgICAgICAgICBtYXN0ZXItPmNzX2dwaW9zW2ldID0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgIG9mX2dldF9uYW1lZF9ncGlvX2ZsYWdzKG5wLCAiY3MtZ3Bpb3MiLCBp LAo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJm1h c3Rlci0+Y3NfZ3Bpb3NfZmxhZ3NbaV0pOwo+IAo+IEkgZG9uJ3Qgc2VlIHlvdSBpbml0aWFsaXpp bmcgbWFzdGVyLT5jc19ncGlvX2ZsYWdzIGFueXdoZXJlLCBzbyB3b24ndAo+IHRoaXMgY2F1c2Ug YSBudWxsL3VuaXRpYWxpemVkIHBvaW50ZXIgYWNjZXNzPwoKQSBmZXcgbGluZXMgYWJvdmUuIE1l bW9yeSBpcyBiZWluZyBhbGxvY2F0ZWQgdG9nZXRoZXIgd2l0aCBjc19ncGlvcy4KCi0tLQo= --
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1385996099.869286515-/[email protected]

#15 lore raw
Quoted 26 lines · Alexander Shiyan
Quoted 4 lines · Alexander Shiyan
Quoted 3 lines

This patch takes the CS active level from the GPIO bindings, so we remove the special property "spi-cs-high" for chipselects that use GPIO.

...

Quoted 20 lines
Quoted 19 lines
drivers/spi/spi.c +6 -6
-       cs = devm_kzalloc(&master->dev,
-                         sizeof(int) * master->num_chipselect,
-                         GFP_KERNEL);
-       master->cs_gpios = cs;
+       master->cs_gpios = devm_kzalloc(&master->dev, master->num_chipselect *
+               (sizeof(int) + sizeof(enum of_gpio_flags)), GFP_KERNEL);
 
        if (!master->cs_gpios)
                return -ENOMEM;
 
        for (i = 0; i < master->num_chipselect; i++)
-               cs[i] = -ENOENT;
+               master->cs_gpios[i] = -ENOENT;
 
        for (i = 0; i < nb; i++)
-               cs[i] = of_get_named_gpio(np, "cs-gpios", i);
+               master->cs_gpios[i] =
+                       of_get_named_gpio_flags(np, "cs-gpios", i,
+                                               &master->cs_gpios_flags[i]);
Quoted 4 lines
Quoted 2 lines

I don't see you initializing master->cs_gpio_flags anywhere, so won't this cause a null/unitialized pointer access?

A few lines above. Memory is being allocated together with cs_gpios.

I see the allocation, but I don't see the assignment of master->cs_gpios_flags. Only master->cs_gpios gets assigned.

Jonas
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CAOiHx=kLkiWjnuUV_1-rVrO-EDQw=Ut0eZE5egYrmiVK9wmxfw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#17 lore raw
Quoted 28 lines · Jonas Gorski
Quoted 26 lines · Alexander Shiyan
Quoted 4 lines · Alexander Shiyan
Quoted 3 lines

This patch takes the CS active level from the GPIO bindings, so we remove the special property "spi-cs-high" for chipselects that use GPIO.

...

Quoted 20 lines
Quoted 19 lines
(quoted diff) +6 -6
-       cs = devm_kzalloc(&master->dev,
-                         sizeof(int) * master->num_chipselect,
-                         GFP_KERNEL);
-       master->cs_gpios = cs;
+       master->cs_gpios = devm_kzalloc(&master->dev, master->num_chipselect *
+               (sizeof(int) + sizeof(enum of_gpio_flags)), GFP_KERNEL);
 
        if (!master->cs_gpios)
                return -ENOMEM;
 
        for (i = 0; i < master->num_chipselect; i++)
-               cs[i] = -ENOENT;
+               master->cs_gpios[i] = -ENOENT;
 
        for (i = 0; i < nb; i++)
-               cs[i] = of_get_named_gpio(np, "cs-gpios", i);
+               master->cs_gpios[i] =
+                       of_get_named_gpio_flags(np, "cs-gpios", i,
+                                               &master->cs_gpios_flags[i]);
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I don't see you initializing master->cs_gpio_flags anywhere, so won't this cause a null/unitialized pointer access?

A few lines above. Memory is being allocated together with cs_gpios.

I see the allocation, but I don't see the assignment of master->cs_gpios_flags. Only master->cs_gpios gets assigned.

It's a side effect of the of_get_named_gpio_flags() call (passing the variable by reference).

Don't worry, I felt the same when I read the patch. Took me a while to spot that everything was still in place. :)

virtually yours
Gerhard Sittig

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20131202201722.GZ2982-kDjWylLy9wD0K7fsECOQyeGNnDKD8DIp@public.gmane.org

#19 lore raw
Quoted 34 lines · Gerhard Sittig
Quoted 33 lines · Jonas Gorski
Quoted 30 lines · Alexander Shiyan
Quoted 4 lines · Alexander Shiyan
Quoted 3 lines

This patch takes the CS active level from the GPIO bindings, so we remove the special property "spi-cs-high" for chipselects that use GPIO.

...

Quoted 14 lines
Quoted 14 lines
(quoted diff) +3 -5
-       cs = devm_kzalloc(&master->dev,
-                         sizeof(int) * master->num_chipselect,
-                         GFP_KERNEL);
-       master->cs_gpios = cs;
+       master->cs_gpios = devm_kzalloc(&master->dev, master->num_chipselect *
+               (sizeof(int) + sizeof(enum of_gpio_flags)), GFP_KERNEL);
 
        if (!master->cs_gpios)
                return -ENOMEM;
 
        for (i = 0; i < master->num_chipselect; i++)
-               cs[i] = -ENOENT;
+               master->cs_gpios[i] = -ENOENT;
Quoted 8 lines

Review

Quoted 5 lines
        for (i = 0; i < nb; i++)
(quoted diff) +3 -1
-               cs[i] = of_get_named_gpio(np, "cs-gpios", i);
+               master->cs_gpios[i] =
+                       of_get_named_gpio_flags(np, "cs-gpios", i,
+                                               &master->cs_gpios_flags[i]);

I don't see you initializing master->cs_gpio_flags anywhere, so won't this cause a null/unitialized pointer access?

A few lines above. Memory is being allocated together with cs_gpios.

Quoted 8 lines
Quoted 2 lines

I see the allocation, but I don't see the assignment of master->cs_gpios_flags. Only master->cs_gpios gets assigned.

It's a side effect of the of_get_named_gpio_flags() call (passing the variable by reference).

Don't worry, I felt the same when I read the patch. Took me a while to spot that everything was still in place. :)

I still don't see it. The patch adds an additional pointer member:

Review

Quoted 6 lines
struct spi_master {
       (...)
       /* gpio chip select */
       int                     *cs_gpios;
(quoted diff) +2 -0
+       /* GPIO flags */
+       enum of_gpio_flags      *cs_gpios_flags;

};

Then it changes the memory allocation to allocate additional memory for it:

Review

Quoted 6 lines
(quoted diff) +2 -4
-       cs = devm_kzalloc(&master->dev,
-                         sizeof(int) * master->num_chipselect,
-                         GFP_KERNEL);
-       master->cs_gpios = cs;
+       master->cs_gpios = devm_kzalloc(&master->dev, master->num_chipselect *
+               (sizeof(int) + sizeof(enum of_gpio_flags)), GFP_KERNEL);

But it only assigns the memory pointer to master->cs_gpios, but master->cs_gpios_flags will still point to whatever it was initialized to (likely 0), and is never actually set.

Then

Review

Quoted 4 lines
(quoted diff) +3 -1
-               cs[i] = of_get_named_gpio(np, "cs-gpios", i);
+               master->cs_gpios[i] =
+                       of_get_named_gpio_flags(np, "cs-gpios", i,
+                                               &master->cs_gpios_flags[i]);

will pass the address of the i-th element of the "array" pointed to by master->cs_gpio_flags, so basically 0 + (i * sizeof(enum of_gpio_flags), and not the intended value of (master->cs_gpios + master->num_chipselect * sizeof(int)) + (i * sizeof(enum of_gpio_flags).

Unless there is some serious black magic in of_get_named_gpio_flags(), but I doubt that would be allowed in the kernel ;)

So as far as I can tell there's missing something along

master->cs_gpios_flags = (enum of_gpio_flags
*)&master->cs_gpios[master->num_chipselect];

Regards
Jonas
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): CAOiHx=krrM+NZ7detAv9_UsB+bUXtKL0m4=pDHO30uduJsDdFg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#21 lore raw
Quoted 32 lines · Jonas Gorski
Quoted 10 lines · Gerhard Sittig
Quoted 3 lines · Jonas Gorski

I see the allocation, but I don't see the assignment of master->cs_gpios_flags. Only master->cs_gpios gets assigned.

It's a side effect of the of_get_named_gpio_flags() call (passing the variable by reference).

Don't worry, I felt the same when I read the patch. Took me a while to spot that everything was still in place. :)

I still don't see it. The patch adds an additional pointer member:

Review

Quoted 6 lines
struct spi_master {
       (...)
       /* gpio chip select */
       int                     *cs_gpios;
(quoted diff) +2 -0
+       /* GPIO flags */
+       enum of_gpio_flags      *cs_gpios_flags;

};

Then it changes the memory allocation to allocate additional memory for it:

Review

Quoted 6 lines
(quoted diff) +2 -4
-       cs = devm_kzalloc(&master->dev,
-                         sizeof(int) * master->num_chipselect,
-                         GFP_KERNEL);
-       master->cs_gpios = cs;
+       master->cs_gpios = devm_kzalloc(&master->dev, master->num_chipselect *
+               (sizeof(int) + sizeof(enum of_gpio_flags)), GFP_KERNEL);
Quoted 3 lines

But it only assigns the memory pointer to master->cs_gpios, but master->cs_gpios_flags will still point to whatever it was initialized to (likely 0), and is never actually set.

You are right, I misread the code.

The assignment of "&cs_gpios[master->num_chipselect]" to the cs_gpio_flags "start address" is missing. Which involves dirty casts that may be considered ugly.

Alternatively the two arrays could get allocated separately (don't know what the overhead would be, and if that is considered bad practise or wasteful although it's cleaner).

Quoted 6 lines

Unless there is some serious black magic in of_get_named_gpio_flags(), but I doubt that would be allowed in the kernel ;)

So as far as I can tell there's missing something along

master->cs_gpios_flags = (enum of_gpio_flags *)&master->cs_gpios[master->num_chipselect];

Right! This kind of assignment is "the standin" for the black magic that is not expected here. :)

virtually yours
Gerhard Sittig

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20131202223632.GA2982-kDjWylLy9wD0K7fsECOQyeGNnDKD8DIp@public.gmane.org

#23 lore raw

PiA+IE9uIE1vbiwgRGVjIDIsIDIwMTMgYXQgOToxNyBQTSwgR2VyaGFyZCBTaXR0aWcgPGdzaUBk ZW54LmRlPiB3cm90ZToKPiA+ID4gT24gTW9uLCBEZWMgMDIsIDIwMTMgYXQgMTk6MDMgKzAxMDAs IEpvbmFzIEdvcnNraSB3cm90ZToKPiA+ID4+Cj4gPiA+PiBJIHNlZSB0aGUgYWxsb2NhdGlvbiwg YnV0IEkgZG9uJ3Qgc2VlIHRoZSBhc3NpZ25tZW50IG9mCj4gPiA+PiBtYXN0ZXItPmNzX2dwaW9z X2ZsYWdzLiBPbmx5IG1hc3Rlci0+Y3NfZ3Bpb3MgZ2V0cyBhc3NpZ25lZC4KPiA+ID4KPiA+ID4g SXQncyBhIHNpZGUgZWZmZWN0IG9mIHRoZSBvZl9nZXRfbmFtZWRfZ3Bpb19mbGFncygpIGNhbGwg KHBhc3NpbmcKPiA+ID4gdGhlIHZhcmlhYmxlIGJ5IHJlZmVyZW5jZSkuCj4gPiA+Cj4gPiA+IERv bid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g OykKPiA+IAo+ID4gU28gYXMgZmFyIGFzIEkgY2FuIHRlbGwgdGhlcmUncyBtaXNzaW5nIHNvbWV0 aGluZyBhbG9uZwo+ID4gCj4gPiBtYXN0ZXItPmNzX2dwaW9zX2ZsYWdzID0gKGVudW0gb2ZfZ3Bp b19mbGFncyAqKSZtYXN0ZXItPmNzX2dwaW9zW21hc3Rlci0+bnVtX2NoaXBzZWxlY3RdOwo+IAo+ IFJpZ2h0ISAgVGhpcyBraW5kIG9mIGFzc2lnbm1lbnQgaXMgInRoZSBzdGFuZGluIiBmb3IgdGhl IGJsYWNrCj4gbWFnaWMgdGhhdCBpcyBub3QgZXhwZWN0ZWQgaGVyZS4gOikKCkFoaCwgSSBzZWUu IFRoZSAiY3NfZ3Bpb19mbGFncyIgbWVtYmVyIGRvIG5vdCBrbm93IGFueXRoaW5nIGFib3V0ICJj c19ncGlvcyIgc2l6ZS4KVGhhbmtzLgoKLS0tCg==
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#24 lore raw
In reply to a message not in the archive
Quoted 4 lines · Alexander Shiyan

This patch takes the CS active level from the GPIO bindings, so we remove the special property "spi-cs-high" for chipselects that use GPIO.

I'm afraid this description does not reflect what the patch does. This is not saying that the patch is wrong, but suggests that the description may be in need of an update.

Whether there is some gain in the change is a different matter, see below.

Quoted 14 lines
---
 drivers/spi/spi.c       | 28 ++++++++++++++++++----------
 include/linux/spi/spi.h |  2 ++
 2 files changed, 20 insertions(+), 10 deletions(-)
drivers/spi/spi.c +0 -0
index 98f4b77..d2ba1ec 100644
@@ -413,8 +413,12 @@ int spi_add_device(struct spi_device *spi)
 		goto done;
 	}
 

drivers/spi/spi.c int spi_add_device(struct spi_device *spi) · line 424

Quoted 10 lines
drivers/spi/spi.c +5 -1
-	if (master->cs_gpios)
+	if (master->cs_gpios) {
 		spi->cs_gpio = master->cs_gpios[spi->chip_select];
+		if (!(master->cs_gpios_flags[spi->chip_select] &
+		      OF_GPIO_ACTIVE_LOW))
+			spi->mode |= SPI_CS_HIGH;
+	}
 
 	/* Drivers may modify this initial i/o setup, but will
 	 * normally rely on the device being setup.  Devices

OK, so you accept GPIO flags as an _additional_ source of information, to derive "CS high" attributes in the SPI subsystem in the (potential) absence of explicit specs in the device tree.

I'm not quite certain whether the GPIO pin's "not being inverted" (not being low-active, the de-facto default for a GPIO pin) and the SPI chip select's being high-active really are the same thing. Unless I'm missing something, this is quite a change in semantics. (Should this automatic deriving attributes emit a message as well, to raise awareness? Are we spamming users then, or do these go unnoticed und ignored?)

Does this patch _force_ those who use GPIOs for SPI CS to adjust their GPIO configuration in device trees? Or make SPI communication fail if the device tree won't get adjusted? Should you adjust users as well, and put a big fat remark into the documentation?

A quick 'git grep spi-cs-high' reveals just one in-tree user, but I'd expect quite a lot out-of-tree users which assume "regular, straight semantics".

Quoted 7 lines
drivers/spi/spi.c +0 -2
@@ -1027,10 +1031,14 @@ static void of_register_spi_devices(struct spi_master *master)
 			spi->mode |= SPI_CPHA;
 		if (of_find_property(nc, "spi-cpol", NULL))
 			spi->mode |= SPI_CPOL;
-		if (of_find_property(nc, "spi-cs-high", NULL))
-			spi->mode |= SPI_CS_HIGH;
 		if (of_find_property(nc, "spi-3wire", NULL))

drivers/spi/spi.c static void of_register_spi_devices(struct spi_master *master) · line 1044

Quoted 10 lines
drivers/spi/spi.c +6 -0
 			spi->mode |= SPI_3WIRE;
+		if (of_find_property(nc, "spi-cs-high", NULL)) {
+			if (master->cs_gpios)
+				dev_notice(&master->dev,
+					"\"spi-cs-high\" property is obsolete.\n");
+			spi->mode |= SPI_CS_HIGH;
+		}
 
 		/* Device DUAL/QUAD mode */
 		if (!of_property_read_u32(nc, "spi-tx-bus-width", &value)) {

Here you keep the evaluation of the 'spi-cs-high' property. Which is a good thing, and should not go away as Mark has suggested, at least not without proper period of migration.

You introduce a diagnostic message if SPI CS is high-active (and this spec comes from the SPI node) and the CS is backed by a GPIO pin.

Considering that you cannot remove the "CS high-active" attribute in general, and need to keep the 'spi-cs-high' property for those cases where the signal is not driven by means of GPIO, and keep backwards compatibility for GPIO backed signals -- is there really any gain in the change?

I'm afraid that forcing users to specify the same "this SPI slave's CS is high-active" information in different ways depending on whether the signal is generated by GPIO or by other means is not a good thing. I'm even questioning the benefit of introducing the optional second source of this information by deriving it from the GPIO flags. Am I missing something?

[ it's just a nit that hou move the 'spi-cs-high' evaluation in the patch while I fail to see the motivation of the move, it's neither logical grouping nor alphabetical sorting ]

virtually yours
Gerhard Sittig

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20131202145911.GT2982-kDjWylLy9wD0K7fsECOQyeGNnDKD8DIp@public.gmane.org

#26 lore raw

CgoK0J/QvtC90LXQtNC10LvRjNC90LjQuiwgIDIg0LTQtdC60LDQsdGA0Y8gMjAxMywgMTU6NTkg KzAxOjAwINC+0YIgR2VyaGFyZCBTaXR0aWcgPGdzaUBkZW54LmRlPjoKPiBPbiBTdW4sIERlYyAw MSwgMjAxMyBhdCAxMTo1OSArMDQwMCwgQWxleGFuZGVyIFNoaXlhbiB3cm90ZToKPiA+IAo+ID4g VGhpcyBwYXRjaCB0YWtlcyB0aGUgQ1MgYWN0aXZlIGxldmVsIGZyb20gdGhlIEdQSU8gYmluZGlu Z3MsCj4gPiBzbyB3ZSByZW1vdmUgdGhlIHNwZWNpYWwgcHJvcGVydHkgInNwaS1jcy1oaWdoIiBm b3IgY2hpcHNlbGVjdHMKPiA+IHRoYXQgdXNlIEdQSU8uCj4gCj4gSSdtIGFmcmFpZCB0aGlzIGRl c2NyaXB0aW9uIGRvZXMg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WFnaW5lIHRoYXQg dG9tb3Jyb3cgd2UgbWF5IHdhbnQgdGhlIG9wdGlvbiB0byBkZWZpbmUgb3Blbi1kcmFpbgpvdXRw dXQgb24gdGhlIENTIHBpbi4gU3BlY2lmaWMgcHVsbHVwIG9yIHB1bGxkb3duLgpBbm90aGVyIHNl cGFyYXRlIHByb3BlcnRpZXM/CgotLS0K
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 1385997862.727371043-/[email protected]

#28 lore raw
Quoted 5 lines · Alexander Shiyan

Using GPIO flags is basically better.
Imagine that tomorrow we may want the option to define open-drain output on the CS pin. Specific pullup or pulldown. Another separate properties?

This does not answer the actual concerns raised. Do you change the semantics without making users notice it? Do you fragment configuration by putting the same piece of information that is specific to the SPI slave into totally different properties in rather distant locations depending on how the CS signal gets generated? Shouldn't you update users when you change the service?

Can you please address those concerns I raised, or clarify where I'm wrong in my interpretation and why there is no issue? A mere "but it's better" is not convincing to me. (Note that I trimmed the above quotation because I feel that your response should be a direct followup of the concerns raised, not buried here deep in several response levels.)

virtually yours
Gerhard Sittig

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: [email protected]
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20131202163124.GW2982-kDjWylLy9wD0K7fsECOQyeGNnDKD8DIp@public.gmane.org

#30 lore raw

SGVsbG8uCgrQn9C+0L3QtdC00LXQu9GM0L3QuNC6LCAgMiDQtNC10LrQsNCx0YDRjyAyMDEzLCAx NzozMSArMDE6MDAg0L7RgiBHZXJoYXJkIFNpdHRpZyA8Z3NpQGRlbnguZGU+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zIG5vIGlzc3VlPyAgQSBtZXJlCj4g ImJ1dCBpdCdzIGJldHRlciIgaXMgbm90IGNvbnZpbmNpbmcgdG8gbWUuICAoTm90ZSB0aGF0IEkg dHJpbW1lZAo+IHRoZSBhYm92ZSBxdW90YXRpb24gYmVjYXVzZSBJIGZlZWwgdGhhdCB5b3VyIHJl c3BvbnNlIHNob3VsZCBiZSBhCj4gZGlyZWN0IGZvbGxvd3VwIG9mIHRoZSBjb25jZXJucyByYWlz ZWQsIG5vdCBidXJpZWQgaGVyZSBkZWVwIGluCj4gc2V2ZXJhbCByZXNwb25zZSBsZXZlbHMuKQoK U1BJIERULWJpbmRpbmdzIGZvciBHUElPIENTIGFuZCBEVFMgdXNlcnMgd2lsbCBiZSB1cGRhdGVk LgpBdCB0aGlzIHN0YWdlIEkgcHJlc2VudCBvbmx5IGJhc2ljIGNvbmNlcHQgb2YgY2hhbmdlLgpE byBub3QgcXVpdGUgdW5kZXJzdGFuZCB0aGUgc3ViamVjdCBvZiB0aGUgZGlzcHV0ZSwgYnV0IEkg aG9wZQpJIGFuc3dlcmVkIGNvcnJlY3RseS4KVGhhbmtzLgoKLS0tCg==
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html