diff mbox series

[RFC,V2,3/4] pinctrl: bcm2835: activate strict mux mode

Message ID 1548054685-3781-4-git-send-email-stefan.wahren@i2se.com
State New
Headers show
Series pinctrl: bcm2835: improve libgpiod output | expand

Commit Message

Stefan Wahren Jan. 21, 2019, 7:11 a.m. UTC
This activates strict mode muxing for the bcm2835 pin controller,
as the GPIO Function Select Registers do not allow GPIO and functions
at the same time.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 drivers/pinctrl/bcm/pinctrl-bcm2835.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Lukas Wunner Jan. 21, 2019, 7:34 a.m. UTC | #1
On Mon, Jan 21, 2019 at 08:11:24AM +0100, Stefan Wahren wrote:
> This activates strict mode muxing for the bcm2835 pin controller,
> as the GPIO Function Select Registers do not allow GPIO and functions
> at the same time.

bcm2835_spi_setup() in spi-bcm2835.c converts a native chip select
to a gpio chip select.  So pins 7+8 and/or 35+36 may be set to
function alt0 but in reality the pins are requested and driven as
generic output gpio pins.

I'm not sure but doesn't this break in strict mode?

Thanks,

Lukas

> 
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
> ---
>  drivers/pinctrl/bcm/pinctrl-bcm2835.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
> index 183d1ff..452e734 100644
> --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
> +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
> @@ -894,6 +894,7 @@ static const struct pinmux_ops bcm2835_pmx_ops = {
>  	.set_mux = bcm2835_pmx_set,
>  	.gpio_disable_free = bcm2835_pmx_gpio_disable_free,
>  	.gpio_set_direction = bcm2835_pmx_gpio_set_direction,
> +	.strict = true,
>  };
>  
>  static int bcm2835_pinconf_get(struct pinctrl_dev *pctldev,
> -- 
> 2.7.4
Stefan Wahren Jan. 21, 2019, 9:57 a.m. UTC | #2
Am 21.01.19 um 08:34 schrieb Lukas Wunner:
> On Mon, Jan 21, 2019 at 08:11:24AM +0100, Stefan Wahren wrote:
>> This activates strict mode muxing for the bcm2835 pin controller,
>> as the GPIO Function Select Registers do not allow GPIO and functions
>> at the same time.
> bcm2835_spi_setup() in spi-bcm2835.c converts a native chip select
> to a gpio chip select.  So pins 7+8 and/or 35+36 may be set to
> function alt0 but in reality the pins are requested and driven as
> generic output gpio pins.
>
> I'm not sure but doesn't this break in strict mode?

That's a good point. I hope that isn't a problem because owner should be
the same.

But i didn't test this scenario. Do you mind to give this series a try?

The only issue i found so far was a unnecessary pinctrl on the Raspberry
Pi Zero W, which should be fixed with this [1].

At the end we need to switch to strict mode, because currently a simple
gpioset can "destroy" the mux setting for I2C or SPI.

[1] - https://marc.info/?l=linux-arm-kernel&m=154800402627578

>
> Thanks,
>
> Lukas
>
diff mbox series

Patch

diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
index 183d1ff..452e734 100644
--- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c
+++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c
@@ -894,6 +894,7 @@  static const struct pinmux_ops bcm2835_pmx_ops = {
 	.set_mux = bcm2835_pmx_set,
 	.gpio_disable_free = bcm2835_pmx_gpio_disable_free,
 	.gpio_set_direction = bcm2835_pmx_gpio_set_direction,
+	.strict = true,
 };
 
 static int bcm2835_pinconf_get(struct pinctrl_dev *pctldev,