* [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties
2012-12-27 21:54 [PATCH 0/2] ARM: cfa10036: Switch SPI to gpio bitbanging Maxime Ripard
@ 2012-12-27 21:54 ` Maxime Ripard
2013-01-09 8:37 ` Maxime Ripard
0 siblings, 1 reply; 9+ messages in thread
From: Maxime Ripard @ 2012-12-27 21:54 UTC (permalink / raw)
To: linux-arm-kernel
The bindings assumed that the gpios properties were always there, which
made the NO_TX and NO_RX mode not usable from device tree. Add extra
checks to make sure that the driver can work if either MOSI or MISO is
not used.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
drivers/spi/spi-gpio.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index c7cf0b7..9ddef55 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -365,9 +365,26 @@ static int spi_gpio_probe_dt(struct platform_device *pdev)
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_get_named_gpio(np, "gpio-sck", 0);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "gpio-sck property not found\n");
+ goto error_free;
+ }
+ pdata->sck = ret;
+
+ ret = of_get_named_gpio(np, "gpio-miso", 0);
+ if (ret < 0) {
+ dev_info(&pdev->dev, "gpio-miso property not found, switching to no-rx mode\n");
+ pdata->miso = SPI_GPIO_NO_MISO;
+ } else
+ pdata->miso = ret;
+
+ ret = of_get_named_gpio(np, "gpio-mosi", 0);
+ if (ret < 0) {
+ dev_info(&pdev->dev, "gpio-mosi property not found, switching to no-tx mode\n");
+ pdata->mosi = SPI_GPIO_NO_MOSI;
+ } else
+ pdata->mosi = ret;
ret = of_property_read_u32(np, "num-chipselects", &tmp);
if (ret < 0) {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties
2012-12-27 21:54 ` [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties Maxime Ripard
@ 2013-01-09 8:37 ` Maxime Ripard
2013-01-22 15:50 ` Maxime Ripard
0 siblings, 1 reply; 9+ messages in thread
From: Maxime Ripard @ 2013-01-09 8:37 UTC (permalink / raw)
To: linux-arm-kernel
Hi Grant,
On 27/12/2012 22:54, Maxime Ripard wrote:
> The bindings assumed that the gpios properties were always there, which
> made the NO_TX and NO_RX mode not usable from device tree. Add extra
> checks to make sure that the driver can work if either MOSI or MISO is
> not used.
Can you give me your Acked-by on this, or do you have any comments on this?
Thanks,
Maxime
--
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties
2013-01-09 8:37 ` Maxime Ripard
@ 2013-01-22 15:50 ` Maxime Ripard
2013-02-05 13:08 ` Grant Likely
0 siblings, 1 reply; 9+ messages in thread
From: Maxime Ripard @ 2013-01-22 15:50 UTC (permalink / raw)
To: linux-arm-kernel
On 09/01/2013 09:37, Maxime Ripard wrote:
> On 27/12/2012 22:54, Maxime Ripard wrote:
>> The bindings assumed that the gpios properties were always there, which
>> made the NO_TX and NO_RX mode not usable from device tree. Add extra
>> checks to make sure that the driver can work if either MOSI or MISO is
>> not used.
>
> Can you give me your Acked-by on this, or do you have any comments on this?
Ping?
--
Maxime Ripard, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH RESEND 0/2] CFA10036: Switch to SPI Bitbanging
@ 2013-01-25 8:39 Maxime Ripard
2013-01-25 8:39 ` [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties Maxime Ripard
2013-01-25 8:39 ` [PATCH 2/2] ARM: dts: cfa10049: Change the SPI3 bus to spi-gpio Maxime Ripard
0 siblings, 2 replies; 9+ messages in thread
From: Maxime Ripard @ 2013-01-25 8:39 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
Here is a patchset that moves the spi bus we use to bitbanging. This is needed
because the DAC found on this bus is actually using a 12 bits wordlength, while
the imx28 spi controler can only handle 4, 8 or 16 bits per words.
Thanks,
Maxime
Maxime Ripard (2):
spi: spi-gpio: Add checks for the dt properties
ARM: dts: cfa10049: Change the SPI3 bus to spi-gpio
arch/arm/boot/dts/imx28-cfa10049.dts | 78 ++++++++++++++++++----------------
drivers/spi/spi-gpio.c | 23 ++++++++--
2 files changed, 62 insertions(+), 39 deletions(-)
--
1.7.10.4
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties
2013-01-25 8:39 [PATCH RESEND 0/2] CFA10036: Switch to SPI Bitbanging Maxime Ripard
@ 2013-01-25 8:39 ` Maxime Ripard
2013-01-26 7:36 ` Mark Brown
2013-01-25 8:39 ` [PATCH 2/2] ARM: dts: cfa10049: Change the SPI3 bus to spi-gpio Maxime Ripard
1 sibling, 1 reply; 9+ messages in thread
From: Maxime Ripard @ 2013-01-25 8:39 UTC (permalink / raw)
To: linux-arm-kernel
The bindings assumed that the gpios properties were always there, which
made the NO_TX and NO_RX mode not usable from device tree. Add extra
checks to make sure that the driver can work if either MOSI or MISO is
not used.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/spi/spi-gpio.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-gpio.c b/drivers/spi/spi-gpio.c
index c7cf0b7..9ddef55 100644
--- a/drivers/spi/spi-gpio.c
+++ b/drivers/spi/spi-gpio.c
@@ -365,9 +365,26 @@ static int spi_gpio_probe_dt(struct platform_device *pdev)
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_get_named_gpio(np, "gpio-sck", 0);
+ if (ret < 0) {
+ dev_err(&pdev->dev, "gpio-sck property not found\n");
+ goto error_free;
+ }
+ pdata->sck = ret;
+
+ ret = of_get_named_gpio(np, "gpio-miso", 0);
+ if (ret < 0) {
+ dev_info(&pdev->dev, "gpio-miso property not found, switching to no-rx mode\n");
+ pdata->miso = SPI_GPIO_NO_MISO;
+ } else
+ pdata->miso = ret;
+
+ ret = of_get_named_gpio(np, "gpio-mosi", 0);
+ if (ret < 0) {
+ dev_info(&pdev->dev, "gpio-mosi property not found, switching to no-tx mode\n");
+ pdata->mosi = SPI_GPIO_NO_MOSI;
+ } else
+ pdata->mosi = ret;
ret = of_property_read_u32(np, "num-chipselects", &tmp);
if (ret < 0) {
--
1.7.10.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] ARM: dts: cfa10049: Change the SPI3 bus to spi-gpio
2013-01-25 8:39 [PATCH RESEND 0/2] CFA10036: Switch to SPI Bitbanging Maxime Ripard
2013-01-25 8:39 ` [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties Maxime Ripard
@ 2013-01-25 8:39 ` Maxime Ripard
2013-01-29 7:51 ` Shawn Guo
1 sibling, 1 reply; 9+ messages in thread
From: Maxime Ripard @ 2013-01-25 8:39 UTC (permalink / raw)
To: linux-arm-kernel
The DAC found on the last chip select requires a word length of 12 bits,
which is not supported by the SSP controller of the iMX28. Use
bitbanging for that bus to support such a length.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
arch/arm/boot/dts/imx28-cfa10049.dts | 78 ++++++++++++++++++----------------
1 file changed, 42 insertions(+), 36 deletions(-)
diff --git a/arch/arm/boot/dts/imx28-cfa10049.dts b/arch/arm/boot/dts/imx28-cfa10049.dts
index 7890acc..dd91244 100644
--- a/arch/arm/boot/dts/imx28-cfa10049.dts
+++ b/arch/arm/boot/dts/imx28-cfa10049.dts
@@ -52,48 +52,17 @@
spi3_pins_cfa10049: spi3-cfa10049 at 0 {
reg = <0>;
fsl,pinmux-ids = <
- 0x0181 /* MX28_PAD_GPMI_RDN__SSP3_SCK */
- 0x01c1 /* MX28_PAD_GPMI_RESETN__SSP3_CMD */
- 0x0111 /* MX28_PAD_GPMI_CE1N__SSP3_D3 */
- 0x01a2 /* MX28_PAD_GPMI_ALE__SSP3_D4 */
- 0x01b2 /* MX28_PAD_GPMI_CLE__SSP3_D5 */
+ 0x0183 /* MX28_PAD_GPMI_RDN__GPIO_0_24 */
+ 0x01c3 /* MX28_PAD_GPMI_RESETN__GPIO_0_28 */
+ 0x0113 /* MX28_PAD_GPMI_CE1N__GPIO_0_17 */
+ 0x01a3 /* MX28_PAD_GPMI_ALE__GPIO_0_26 */
+ 0x01b3 /* MX28_PAD_GPMI_CLE__GPIO_0_27 */
>;
fsl,drive-strength = <1>;
fsl,voltage = <1>;
fsl,pull-up = <1>;
};
};
-
- ssp3: ssp at 80016000 {
- compatible = "fsl,imx28-spi";
- pinctrl-names = "default";
- pinctrl-0 = <&spi3_pins_cfa10049>;
- status = "okay";
-
- gpio5: gpio5 at 0 {
- compatible = "fairchild,74hc595";
- gpio-controller;
- #gpio-cells = <2>;
- reg = <0>;
- registers-number = <2>;
- spi-max-frequency = <100000>;
- };
-
- gpio6: gpio6 at 1 {
- compatible = "fairchild,74hc595";
- gpio-controller;
- #gpio-cells = <2>;
- reg = <1>;
- registers-number = <4>;
- spi-max-frequency = <100000>;
- };
-
- dac0: dh2228 at 2 {
- compatible = "rohm,dh2228fv";
- reg = <2>;
- spi-max-frequency = <100000>;
- };
- };
};
apbx at 80040000 {
@@ -177,4 +146,41 @@
status = "okay";
};
};
+
+ spi3 {
+ compatible = "spi-gpio";
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi3_pins_cfa10049>;
+ status = "okay";
+ gpio-sck = <&gpio0 24 0>;
+ gpio-mosi = <&gpio0 28 0>;
+ cs-gpios = <&gpio0 17 0 &gpio0 26 0 &gpio0 27 0>;
+ num-chipselects = <3>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ gpio5: gpio5 at 0 {
+ compatible = "fairchild,74hc595";
+ gpio-controller;
+ #gpio-cells = <2>;
+ reg = <0>;
+ registers-number = <2>;
+ spi-max-frequency = <100000>;
+ };
+
+ gpio6: gpio6 at 1 {
+ compatible = "fairchild,74hc595";
+ gpio-controller;
+ #gpio-cells = <2>;
+ reg = <1>;
+ registers-number = <4>;
+ spi-max-frequency = <100000>;
+ };
+
+ dac0: dh2228 at 2 {
+ compatible = "rohm,dh2228fv";
+ reg = <2>;
+ spi-max-frequency = <100000>;
+ };
+ };
};
--
1.7.10.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties
2013-01-25 8:39 ` [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties Maxime Ripard
@ 2013-01-26 7:36 ` Mark Brown
0 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2013-01-26 7:36 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jan 25, 2013 at 09:39:34AM +0100, Maxime Ripard wrote:
> The bindings assumed that the gpios properties were always there, which
> made the NO_TX and NO_RX mode not usable from device tree. Add extra
> checks to make sure that the driver can work if either MOSI or MISO is
> not used.
Applied, thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130126/fa7e46d4/attachment.sig>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] ARM: dts: cfa10049: Change the SPI3 bus to spi-gpio
2013-01-25 8:39 ` [PATCH 2/2] ARM: dts: cfa10049: Change the SPI3 bus to spi-gpio Maxime Ripard
@ 2013-01-29 7:51 ` Shawn Guo
0 siblings, 0 replies; 9+ messages in thread
From: Shawn Guo @ 2013-01-29 7:51 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jan 25, 2013 at 09:39:35AM +0100, Maxime Ripard wrote:
> The DAC found on the last chip select requires a word length of 12 bits,
> which is not supported by the SSP controller of the iMX28. Use
> bitbanging for that bus to support such a length.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties
2013-01-22 15:50 ` Maxime Ripard
@ 2013-02-05 13:08 ` Grant Likely
0 siblings, 0 replies; 9+ messages in thread
From: Grant Likely @ 2013-02-05 13:08 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, 22 Jan 2013 16:50:30 +0100, Maxime Ripard <maxime.ripard@free-electrons.com> wrote:
> On 09/01/2013 09:37, Maxime Ripard wrote:
> > On 27/12/2012 22:54, Maxime Ripard wrote:
> >> The bindings assumed that the gpios properties were always there, which
> >> made the NO_TX and NO_RX mode not usable from device tree. Add extra
> >> checks to make sure that the driver can work if either MOSI or MISO is
> >> not used.
> >
> > Can you give me your Acked-by on this, or do you have any comments on this?
>
> Ping?
Mark has applied it and it is now in my tree.
g.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-02-05 13:08 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-25 8:39 [PATCH RESEND 0/2] CFA10036: Switch to SPI Bitbanging Maxime Ripard
2013-01-25 8:39 ` [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties Maxime Ripard
2013-01-26 7:36 ` Mark Brown
2013-01-25 8:39 ` [PATCH 2/2] ARM: dts: cfa10049: Change the SPI3 bus to spi-gpio Maxime Ripard
2013-01-29 7:51 ` Shawn Guo
-- strict thread matches above, loose matches on Subject: below --
2012-12-27 21:54 [PATCH 0/2] ARM: cfa10036: Switch SPI to gpio bitbanging Maxime Ripard
2012-12-27 21:54 ` [PATCH 1/2] spi: spi-gpio: Add checks for the dt properties Maxime Ripard
2013-01-09 8:37 ` Maxime Ripard
2013-01-22 15:50 ` Maxime Ripard
2013-02-05 13:08 ` Grant Likely
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).