linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFT] spi: bcm2835: Remove unnecessary workaround to call gpio_set_value
@ 2016-02-13 16:19 Axel Lin
       [not found] ` <1455380347.25581.1.camel-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Axel Lin @ 2016-02-13 16:19 UTC (permalink / raw)
  To: Mark Brown; +Cc: Martin Sperl, linux-spi-u79uwXL29TY76Z2rM5mHXA

This should be fixed by commit 4c02cba18cc9
("pinctrl: bcm2835: Fix initial value for direction_output")

Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
---
 drivers/spi/spi-bcm2835.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index cf04960..f35cc10 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -727,11 +727,6 @@ static int bcm2835_spi_setup(struct spi_device *spi)
 			spi->chip_select, spi->cs_gpio, err);
 		return err;
 	}
-	/* the implementation of pinctrl-bcm2835 currently does not
-	 * set the GPIO value when using gpio_direction_output
-	 * so we are setting it here explicitly
-	 */
-	gpio_set_value(spi->cs_gpio, (spi->mode & SPI_CS_HIGH) ? 0 : 1);
 
 	return 0;
 }
-- 
2.1.4



--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH RFT] spi: bcm2835: Remove unnecessary workaround to call gpio_set_value
       [not found] ` <1455380347.25581.1.camel-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
@ 2016-02-13 17:08   ` Martin Sperl
       [not found]     ` <67B70D1B-7FA5-48A6-8719-490FA484BFF6-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
  2016-02-15 20:59   ` Applied "spi: bcm2835: Remove unnecessary workaround to call gpio_set_value" to the spi tree Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Martin Sperl @ 2016-02-13 17:08 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, linux-spi, linux-rpi-kernel


> On 13.02.2016, at 17:19, Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org> wrote:
> 
> This should be fixed by commit 4c02cba18cc9
> ("pinctrl: bcm2835: Fix initial value for direction_output")
> 
> Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>

Actually this also solves the situation when the DT is configured
badly - and it is likely that old DTs are configured badly,
because it did not matter before (it was always wrong anyway).

This change would break those old DTs in this respect and can
result in unexpected behavior and undetected devices.

In this case it would be better to add a warning that the
GPIO is not configured in the DT correctly, so that it is
clear that the DT needs to change.

But then maybe a more generalized approach implemented
in the framework would be better...

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH RFT] spi: bcm2835: Remove unnecessary workaround to call gpio_set_value
       [not found]     ` <67B70D1B-7FA5-48A6-8719-490FA484BFF6-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
@ 2016-02-14  3:41       ` Axel Lin
       [not found]         ` <CAFRkauCaq+4Rs_MaApZmqdZ=SiBG2GViZkm1VnjY9j-ftFsXZg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Axel Lin @ 2016-02-14  3:41 UTC (permalink / raw)
  To: Martin Sperl; +Cc: Mark Brown, linux-spi, linux-rpi-kernel

2016-02-14 1:08 GMT+08:00 Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>:
>
>> On 13.02.2016, at 17:19, Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org> wrote:
>>
>> This should be fixed by commit 4c02cba18cc9
>> ("pinctrl: bcm2835: Fix initial value for direction_output")
>>
>> Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
>
> Actually this also solves the situation when the DT is configured
> badly - and it is likely that old DTs are configured badly,
> because it did not matter before (it was always wrong anyway).
>
> This change would break those old DTs in this respect and can
> result in unexpected behavior and undetected devices.

Hi Martin,
I don't understand why this patch breaks old DTs.

Before 4c02cba18cc9:
gpio_direction_output(spi->cs_gpio, (spi->mode & SPI_CS_HIGH) ? 0 : 1);
gpio_set_value(spi->cs_gpio, (spi->mode & SPI_CS_HIGH) ? 0 : 1);

is equivalent to

After 4c02cba18cc9: (Already in Linus' tree)
gpio_direction_output(spi->cs_gpio, (spi->mode & SPI_CS_HIGH) ? 0 : 1);

Axel
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH RFT] spi: bcm2835: Remove unnecessary workaround to call gpio_set_value
       [not found]         ` <CAFRkauCaq+4Rs_MaApZmqdZ=SiBG2GViZkm1VnjY9j-ftFsXZg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-02-14 11:28           ` Martin Sperl
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Sperl @ 2016-02-14 11:28 UTC (permalink / raw)
  To: Axel Lin; +Cc: Mark Brown, linux-spi, linux-rpi-kernel


> On 14.02.2016, at 04:41, Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org> wrote:
> 
> 2016-02-14 1:08 GMT+08:00 Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>:
>> 
>>> On 13.02.2016, at 17:19, Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org> wrote:
>>> 
>>> This should be fixed by commit 4c02cba18cc9
>>> ("pinctrl: bcm2835: Fix initial value for direction_output")
>>> 
>>> Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
>> 
>> Actually this also solves the situation when the DT is configured
>> badly - and it is likely that old DTs are configured badly,
>> because it did not matter before (it was always wrong anyway).
>> 
>> This change would break those old DTs in this respect and can
>> result in unexpected behavior and undetected devices.
> 
> Hi Martin,
> I don't understand why this patch breaks old DTs.
> 
> Before 4c02cba18cc9:
> gpio_direction_output(spi->cs_gpio, (spi->mode & SPI_CS_HIGH) ? 0 : 1);
> gpio_set_value(spi->cs_gpio, (spi->mode & SPI_CS_HIGH) ? 0 : 1);
> 
> is equivalent to
> 
> After 4c02cba18cc9: (Already in Linus' tree)
> gpio_direction_output(spi->cs_gpio, (spi->mode & SPI_CS_HIGH) ? 0 : 1);

Looking thru the bigger context now.

I thought it also impacted the GPIO-cs case, where
  cs-gpios = <&gpio x 1>, <&gpio y 1>;
would just define the GPIOs - as the 3rd value was always ignored
and resulted in a “low” level on the GPIO via pinctrl initially - 
at least there was a time when this has happened.
A change here would have had an impact on “old” DT.

Now I see that this only impacts the native-cs case
and that should be fine.

Acked-by: Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>


--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Applied "spi: bcm2835: Remove unnecessary workaround to call gpio_set_value" to the spi tree
       [not found] ` <1455380347.25581.1.camel-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
  2016-02-13 17:08   ` Martin Sperl
@ 2016-02-15 20:59   ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2016-02-15 20:59 UTC (permalink / raw)
  To: Axel Lin, Martin Sperl, Mark Brown; +Cc: linux-spi-u79uwXL29TY76Z2rM5mHXA

The patch

   spi: bcm2835: Remove unnecessary workaround to call gpio_set_value

has been applied to the spi tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 763dedfcda5f6c9294c4a5d048f5261f442cc1e8 Mon Sep 17 00:00:00 2001
From: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
Date: Sun, 14 Feb 2016 00:19:07 +0800
Subject: [PATCH] spi: bcm2835: Remove unnecessary workaround to call
 gpio_set_value

This should be fixed by commit 4c02cba18cc9
("pinctrl: bcm2835: Fix initial value for direction_output")

Signed-off-by: Axel Lin <axel.lin-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
Acked-by: Martin Sperl <kernel-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/spi/spi-bcm2835.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index cf04960..f35cc10 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -727,11 +727,6 @@ static int bcm2835_spi_setup(struct spi_device *spi)
 			spi->chip_select, spi->cs_gpio, err);
 		return err;
 	}
-	/* the implementation of pinctrl-bcm2835 currently does not
-	 * set the GPIO value when using gpio_direction_output
-	 * so we are setting it here explicitly
-	 */
-	gpio_set_value(spi->cs_gpio, (spi->mode & SPI_CS_HIGH) ? 0 : 1);
 
 	return 0;
 }
-- 
2.7.0

--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2016-02-15 20:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-13 16:19 [PATCH RFT] spi: bcm2835: Remove unnecessary workaround to call gpio_set_value Axel Lin
     [not found] ` <1455380347.25581.1.camel-8E1dMatC8ynQT0dZR+AlfA@public.gmane.org>
2016-02-13 17:08   ` Martin Sperl
     [not found]     ` <67B70D1B-7FA5-48A6-8719-490FA484BFF6-TqfNSX0MhmxHKSADF0wUEw@public.gmane.org>
2016-02-14  3:41       ` Axel Lin
     [not found]         ` <CAFRkauCaq+4Rs_MaApZmqdZ=SiBG2GViZkm1VnjY9j-ftFsXZg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-02-14 11:28           ` Martin Sperl
2016-02-15 20:59   ` Applied "spi: bcm2835: Remove unnecessary workaround to call gpio_set_value" to the spi tree Mark Brown

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).