diff mbox

gpio: 74x164: add dt support for nxp's 74x594

Message ID 1457998330-8070-1-git-send-email-nicolassaenzj@gmail.com
State New
Headers show

Commit Message

Nicolas Saenz Julienne March 14, 2016, 11:32 p.m. UTC
The chip is also an 8 bit shift register which works out of the box as a GPO
expander with this patch

Signed-off-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com>
---
 Documentation/devicetree/bindings/gpio/gpio-74x164.txt | 4 +++-
 drivers/gpio/gpio-74x164.c                             | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Geert Uytterhoeven March 15, 2016, 3:27 p.m. UTC | #1
On Tue, Mar 15, 2016 at 12:32 AM, Nicolas Saenz Julienne
<nicolassaenzj@gmail.com> wrote:
> The chip is also an 8 bit shift register which works out of the box as a GPO
> expander with this patch
>
> Signed-off-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com>
> ---
>  Documentation/devicetree/bindings/gpio/gpio-74x164.txt | 4 +++-
>  drivers/gpio/gpio-74x164.c                             | 1 +
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/gpio/gpio-74x164.txt b/Documentation/devicetree/bindings/gpio/gpio-74x164.txt
> index cc26080..ce1b223 100644
> --- a/Documentation/devicetree/bindings/gpio/gpio-74x164.txt
> +++ b/Documentation/devicetree/bindings/gpio/gpio-74x164.txt
> @@ -1,7 +1,9 @@
>  * Generic 8-bits shift register GPIO driver
>
>  Required properties:
> -- compatible : Should be "fairchild,74hc595"
> +- compatible: Should contain one of the following:
> +    "fairchild,74hc595"
> +    "nxp,74lvc594"

Why did you choose the "lvc" variant?

Ideally, you want to put the oldest "manuf,74x594" variant here.
I once read it was Motorola who invented the 7459x parts, to interface with
SPI.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Rob Herring (Arm) March 18, 2016, 8:26 p.m. UTC | #2
On Mon, Mar 14, 2016 at 11:32:10PM +0000, Nicolas Saenz Julienne wrote:
> The chip is also an 8 bit shift register which works out of the box as a GPO
> expander with this patch
> 
> Signed-off-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com>
> ---
>  Documentation/devicetree/bindings/gpio/gpio-74x164.txt | 4 +++-
>  drivers/gpio/gpio-74x164.c                             | 1 +
>  2 files changed, 4 insertions(+), 1 deletion(-)

Acked-by: Rob Herring <robh@kernel.org>

> 
> diff --git a/Documentation/devicetree/bindings/gpio/gpio-74x164.txt b/Documentation/devicetree/bindings/gpio/gpio-74x164.txt
> index cc26080..ce1b223 100644
> --- a/Documentation/devicetree/bindings/gpio/gpio-74x164.txt
> +++ b/Documentation/devicetree/bindings/gpio/gpio-74x164.txt
> @@ -1,7 +1,9 @@
>  * Generic 8-bits shift register GPIO driver
>  
>  Required properties:
> -- compatible : Should be "fairchild,74hc595"
> +- compatible: Should contain one of the following:
> +    "fairchild,74hc595"
> +    "nxp,74lvc594"
>  - reg : chip select number
>  - gpio-controller : Marks the device node as a gpio controller.
>  - #gpio-cells : Should be two.  The first cell is the pin number and
> diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c
> index c81224f..ebd0d1a 100644
> --- a/drivers/gpio/gpio-74x164.c
> +++ b/drivers/gpio/gpio-74x164.c
> @@ -153,6 +153,7 @@ static int gen_74x164_remove(struct spi_device *spi)
>  
>  static const struct of_device_id gen_74x164_dt_ids[] = {
>  	{ .compatible = "fairchild,74hc595" },
> +	{ .compatible = "nxp,74lvc594" },
>  	{},
>  };
>  MODULE_DEVICE_TABLE(of, gen_74x164_dt_ids);
> -- 
> 2.5.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nicolas Saenz Julienne March 22, 2016, 10:42 a.m. UTC | #3
Hi sorry for the late response but I was on vacation.
> 
> Why did you choose the "lvc" variant?
Well to be honest the HW people did and it's all I could test with.  I don't
know much about these naming schemes, apart from the intuition it has to do
with frequency and line levels.

> Ideally, you want to put the oldest "manuf,74x594" variant here.
What do you mean by oldest? What would you suggest? it's funny because the chip
is going to be used on a new product that is meant to be produced for years.

> I once read it was Motorola who invented the 7459x parts, to interface with
> SPI.
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
Thanks for your comments!
	Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven March 22, 2016, 10:56 a.m. UTC | #4
Hi Nicolas,

On Tue, Mar 22, 2016 at 11:42 AM, nicolas saenz julienne
<nicolassaenzj@gmail.com> wrote:
>> Why did you choose the "lvc" variant?
> Well to be honest the HW people did and it's all I could test with.  I don't
> know much about these naming schemes, apart from the intuition it has to do
> with frequency and line levels.
>
>> Ideally, you want to put the oldest "manuf,74x594" variant here.
> What do you mean by oldest? What would you suggest? it's funny because the chip
> is going to be used on a new product that is meant to be produced for years.

For DT bindings, it doesn't matter who manufactured the part, or which
technology was used (TTL, HC, LVC, ...).

Logically, the shiny new parts are compatible with the old ones, from as early
as the 1960s.

Especially for standard logic glue, where you can source parts from several
manufacturers, and which are available in many different technologies, it
doesn't make much sense to have all combinations in the DT bindings.

https://en.wikipedia.org/wiki/7400_series

Now, which one to pick?
Given the precedence set by the existing compatible value "fairchild,74hc595",
perhaps the most logical one to add is "fairchild,74hc594"?

Or can we just drop the manufacturer?

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Nicolas Saenz Julienne March 22, 2016, 11:16 p.m. UTC | #5
Hi Geert, thanks for your reply.

On Tue, Mar 22, 2016 at 11:56:51AM +0100, Geert Uytterhoeven wrote:
[..]
> For DT bindings, it doesn't matter who manufactured the part, or which
> technology was used (TTL, HC, LVC, ...).
> 
> Logically, the shiny new parts are compatible with the old ones, from as early
> as the 1960s.
> 
> Especially for standard logic glue, where you can source parts from several
> manufacturers, and which are available in many different technologies, it
> doesn't make much sense to have all combinations in the DT bindings.
> 
> https://en.wikipedia.org/wiki/7400_series
That did the trick.

> 
> Now, which one to pick?
> Given the precedence set by the existing compatible value "fairchild,74hc595",
> perhaps the most logical one to add is "fairchild,74hc594"?
> 
> Or can we just drop the manufacturer?
Well as you say DT doesn't care for technology nor manufacturer. I'd go for
dropping the manufacturer and adding an "x" for the technology (i.e. 74x595).
I saw that the binding is being used on some boards is there any rule against
changing bindings that are already being used?

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
I'll happily do a new version of the patch if the idea is worth it.

	Nicolas
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij March 31, 2016, 8:26 a.m. UTC | #6
On Tue, Mar 15, 2016 at 12:32 AM, Nicolas Saenz Julienne
<nicolassaenzj@gmail.com> wrote:

> The chip is also an 8 bit shift register which works out of the box as a GPO
> expander with this patch
>
> Signed-off-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com>

Patch applied.

I'm not a compatible-string minimalist. Add as many as you
like.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/gpio/gpio-74x164.txt b/Documentation/devicetree/bindings/gpio/gpio-74x164.txt
index cc26080..ce1b223 100644
--- a/Documentation/devicetree/bindings/gpio/gpio-74x164.txt
+++ b/Documentation/devicetree/bindings/gpio/gpio-74x164.txt
@@ -1,7 +1,9 @@ 
 * Generic 8-bits shift register GPIO driver
 
 Required properties:
-- compatible : Should be "fairchild,74hc595"
+- compatible: Should contain one of the following:
+    "fairchild,74hc595"
+    "nxp,74lvc594"
 - reg : chip select number
 - gpio-controller : Marks the device node as a gpio controller.
 - #gpio-cells : Should be two.  The first cell is the pin number and
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c
index c81224f..ebd0d1a 100644
--- a/drivers/gpio/gpio-74x164.c
+++ b/drivers/gpio/gpio-74x164.c
@@ -153,6 +153,7 @@  static int gen_74x164_remove(struct spi_device *spi)
 
 static const struct of_device_id gen_74x164_dt_ids[] = {
 	{ .compatible = "fairchild,74hc595" },
+	{ .compatible = "nxp,74lvc594" },
 	{},
 };
 MODULE_DEVICE_TABLE(of, gen_74x164_dt_ids);