* MAX7301 GPIO: Do not force SPI speed when using OF Platform @ 2013-07-24 10:19 Roland Stigge 2013-08-07 11:31 ` leroy christophe 0 siblings, 1 reply; 6+ messages in thread From: Roland Stigge @ 2013-07-24 10:19 UTC (permalink / raw) To: linux-arm-kernel 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* MAX7301 GPIO: Do not force SPI speed when using OF Platform 2013-07-24 10:19 MAX7301 GPIO: Do not force SPI speed when using OF Platform Roland Stigge @ 2013-08-07 11:31 ` leroy christophe 2013-08-07 12:17 ` Roland Stigge 0 siblings, 1 reply; 6+ messages in thread From: leroy christophe @ 2013-08-07 11:31 UTC (permalink / raw) To: linux-arm-kernel 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 : > 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 > ^ permalink raw reply [flat|nested] 6+ messages in thread
* MAX7301 GPIO: Do not force SPI speed when using OF Platform 2013-08-07 11:31 ` leroy christophe @ 2013-08-07 12:17 ` Roland Stigge 2013-08-07 12:35 ` leroy christophe 0 siblings, 1 reply; 6+ messages in thread From: Roland Stigge @ 2013-08-07 12:17 UTC (permalink / raw) To: linux-arm-kernel Hi, On 08/07/2013 01:31 PM, leroy christophe wrote: > Le 24/07/2013 12:19, Roland Stigge a ?crit : >> 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/*. > > 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 ^ permalink raw reply [flat|nested] 6+ messages in thread
* MAX7301 GPIO: Do not force SPI speed when using OF Platform 2013-08-07 12:17 ` Roland Stigge @ 2013-08-07 12:35 ` leroy christophe 2013-08-07 12:46 ` Roland Stigge 0 siblings, 1 reply; 6+ messages in thread From: leroy christophe @ 2013-08-07 12:35 UTC (permalink / raw) To: linux-arm-kernel Le 07/08/2013 14:17, Roland Stigge a ?crit : > Hi, > > On 08/07/2013 01:31 PM, leroy christophe wrote: >> Le 24/07/2013 12:19, Roland Stigge a ?crit : >>> 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/*. >> 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 > Strange. I'm using 3.8.13 I have it handled in drivers/spi/spi.c in function of_register_spi_devices() Christophe ^ permalink raw reply [flat|nested] 6+ messages in thread
* MAX7301 GPIO: Do not force SPI speed when using OF Platform 2013-08-07 12:35 ` leroy christophe @ 2013-08-07 12:46 ` Roland Stigge 2013-08-07 15:20 ` leroy christophe 0 siblings, 1 reply; 6+ messages in thread From: Roland Stigge @ 2013-08-07 12:46 UTC (permalink / raw) To: linux-arm-kernel Hi, On 08/07/2013 02:35 PM, leroy christophe wrote: >>> 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? >> >> > Strange. I'm using 3.8.13 > I have it handled in drivers/spi/spi.c in function > of_register_spi_devices() 3.8.13's (as well as newer ones') drivers/spi/spi.c doesn't handle "spi-bits", see also https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/spi/spi.c?h=linux-3.8.y Maybe you have additional patches that are not in mainline, yet? Thanks, Roland ^ permalink raw reply [flat|nested] 6+ messages in thread
* MAX7301 GPIO: Do not force SPI speed when using OF Platform 2013-08-07 12:46 ` Roland Stigge @ 2013-08-07 15:20 ` leroy christophe 0 siblings, 0 replies; 6+ messages in thread From: leroy christophe @ 2013-08-07 15:20 UTC (permalink / raw) To: linux-arm-kernel Hi, Le 07/08/2013 14:46, Roland Stigge a ?crit : > Hi, > > On 08/07/2013 02:35 PM, leroy christophe wrote: >>>> 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? >>> >>> >> Strange. I'm using 3.8.13 >> I have it handled in drivers/spi/spi.c in function >> of_register_spi_devices() > 3.8.13's (as well as newer ones') drivers/spi/spi.c doesn't handle > "spi-bits", see also > > https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/drivers/spi/spi.c?h=linux-3.8.y > > 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 -------------- --- linux-3.8.13/drivers/spi/spi.c 2013-05-11 22:57:46.000000000 +0200 +++ linux/drivers/spi/spi.c 2013-08-06 18:15:34.000000000 +0200 @@ -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)) { ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-08-07 15:20 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-07-24 10:19 MAX7301 GPIO: Do not force SPI speed when using OF Platform Roland Stigge 2013-08-07 11:31 ` leroy christophe 2013-08-07 12:17 ` Roland Stigge 2013-08-07 12:35 ` leroy christophe 2013-08-07 12:46 ` Roland Stigge 2013-08-07 15:20 ` leroy christophe
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).