MAX7301 GPIO: Do not force SPI speed when using OF Platform
Hi,
commit 047b93a35961f7a6561e6f5dcb040738f822b892 introduced the following to gpio-max7301.c:
/* bits_per_word cannot be configured in platform data */
- spi->bits_per_word = 16;
+ if (spi->dev.platform_data)
+ spi->bits_per_word = 16;
ret = spi_setup(spi);
Comment is: "The bit_per_word can be set in the OF Device tree, so no need to force it as with the platform_data when using OF Platform"
Can you please point me to the respective OF option? I couldn't find it under drivers/spi/spi* or Documentation/devicetree/bindings/spi/*.
Thanks in advance,
Roland
Hi,
You have to add the following in your dts:
spi-bits = <16>;
Regards
Christophe
Le 24/07/2013 12:19, Roland Stigge a ?crit :
Quoted 21 lines
Hi,
commit
047b93a35961f7a6561e6f5dcb040738f822b892introduced the following togpio-max7301.c:/* bits_per_word cannot be configured in platform data */(quoted diff) +2
-1- spi->bits_per_word = 16; + if (spi->dev.platform_data) + spi->bits_per_word = 16; ret = spi_setup(spi);Comment is: "The
bit_per_wordcan be set in the OF Device tree, so no need to force it as with theplatform_datawhen using OF Platform"Can you please point me to the respective OF option? I couldn't find it under
drivers/spi/spi*orDocumentation/devicetree/bindings/spi/*.Thanks in advance,
Roland
Hi,
Quoted 13 lines · leroy christophe
Le 24/07/2013 12:19, Roland Stigge a ?crit :
Quoted 12 lines
commit
047b93a35961f7a6561e6f5dcb040738f822b892introduced the following togpio-max7301.c:/* bits_per_word cannot be configured in platform data */(quoted diff) +2
-1- spi->bits_per_word = 16; + if (spi->dev.platform_data) + spi->bits_per_word = 16; ret = spi_setup(spi);Comment is: "The
bit_per_wordcan be set in the OF Device tree, so no need to force it as with theplatform_datawhen using OF Platform"
Quoted 6 lines
Quoted 2 lines
Can you please point me to the respective OF option? I couldn't find it under
drivers/spi/spi*orDocumentation/devicetree/bindings/spi/*.You have to add the following in your dts:
spi-bits = <16>;
I tried this, both in the device's and in the controller's node. But it didn't work. However, as described, I didn't expect it to work, because there is no code present to handle "spi-bits". At least not in 3.10.
Am I missing something? Otherwise, maybe something of the tree that you are talking about is missing from mainline still?
Thanks in advance,
Roland
Le 07/08/2013 14:17, Roland Stigge a ?crit :
Quoted 25 lines
Hi,
Quoted 10 lines · leroy christophe
Le 24/07/2013 12:19, Roland Stigge a ?crit :
Quoted 9 lines
commit
047b93a35961f7a6561e6f5dcb040738f822b892introduced the following togpio-max7301.c:/* bits_per_word cannot be configured in platform data */(quoted diff) +2
-1- spi->bits_per_word = 16; + if (spi->dev.platform_data) + spi->bits_per_word = 16; ret = spi_setup(spi);Quoted 8 lines
Quoted 5 lines
Comment is: "The
bit_per_wordcan be set in the OF Device tree, so no need to force it as with theplatform_datawhen using OF Platform"Can you please point me to the respective OF option? I couldn't find it under
drivers/spi/spi*orDocumentation/devicetree/bindings/spi/*.You have to add the following in your dts:
spi-bits = <16>;
I tried this, both in the device's and in the controller's node. But it didn't work. However, as described, I didn't expect it to work, because there is no code present to handle "spi-bits". At least not in 3.10.
Quoted 7 lines
Am I missing something? Otherwise, maybe something of the tree that you are talking about is missing from mainline still?
Thanks in advance,
Roland
Strange. I'm using 3.8.13
I have it handled in drivers/spi/spi.c in function of_register_spi_devices()
Christophe
Hi,
Quoted 5 lines · leroy christophe
Quoted 5 lines
Quoted 1 line
spi-bits = <16>;
I tried this, both in the device's and in the controller's node. But it didn't work. However, as described, I didn't expect it to work, because there is no code present to handle "spi-bits". At least not in 3.10.
Quoted 7 lines
Quoted 4 lines
Am I missing something? Otherwise, maybe something of the tree that you are talking about is missing from mainline still?
Strange. I'm using 3.8.13
I have it handled indrivers/spi/spi.cin functionof_register_spi_devices()
3.8.13's (as well as newer ones') drivers/spi/spi.c doesn't handle "spi-bits", see also
Maybe you have additional patches that are not in mainline, yet?
Thanks,
Roland
Hi,
Le 07/08/2013 14:46, Roland Stigge a ?crit :
Quoted 18 lines
Hi,
Quoted 5 lines · leroy christophe
Quoted 5 lines
Quoted 1 line
spi-bits = <16>;
I tried this, both in the device's and in the controller's node. But it didn't work. However, as described, I didn't expect it to work, because there is no code present to handle "spi-bits". At least not in 3.10.
Quoted 7 lines
Quoted 4 lines
Am I missing something? Otherwise, maybe something of the tree that you are talking about is missing from mainline still?
Strange. I'm using 3.8.13
I have it handled indrivers/spi/spi.cin functionof_register_spi_devices()3.8.13's (as well as newer ones')
drivers/spi/spi.cdoesn't handle "spi-bits", see also
Quoted 8 lines
Maybe you have additional patches that are not in mainline, yet?
Thanks,
Roland
Yes you are right, I have the attached patch in addition which have been in our code for long time and which has never been submitted for inclusion in the mainline kernel.
Sorry about that, I will submit it.
Regards
Christophe
-------------- next part --------------
drivers/spi/spi.c +5 -0
@@ -870,6 +870,11 @@if (of_find_property (nc,"spi-3wire" ,NULL )) spi->mode |=SPI_3WIRE ; +/* Bits per word */ + prop =of_get_property (nc,"spi-bits" , &len); +if (prop && len >=sizeof (*prop)) { + spi->bits_per_word = prop[0 ]; + }/* Device speed */ prop =of_get_property (nc,"spi-max-frequency" , &len);if (!prop || len <sizeof (*prop)) {