Skip to contentSkip to conversation

Amlogic Meson8b pinctrl driver support

PATCH Superseded Carlo Caione 3 participants 9 messages Mar 11, 2015 – Mar 19, 2015

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Amlogic Meson8b pinctrl driver support

From: Carlo Caione <[email protected]>

Two patches to extend the pinctrl driver to support AmLogic Meson8b SoCs fixing the existing documentation.

Changelog:

v2: * fix holes in GPIOs numbering
v1: * initial version

Carlo Caione (2):
pinctrl: Add support for Meson8b
documentation: Fix pinctrl docs for Meson8b

 .../devicetree/bindings/pinctrl/meson,pinctrl.txt  |    2 +-
 drivers/pinctrl/meson/Makefile                     |    2 +-
 drivers/pinctrl/meson/pinctrl-meson.c              |    4 +
 drivers/pinctrl/meson/pinctrl-meson.h              |    1 +
 drivers/pinctrl/meson/pinctrl-meson8b.c            | 1013 ++++++++++++++++++++
 include/dt-bindings/gpio/meson8b-gpio.h            |   31 +
 6 files changed, 1051 insertions(+), 2 deletions(-)
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson8b.c
 create mode 100644 include/dt-bindings/gpio/meson8b-gpio.h
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 1/2 pinctrl: Add support for Meson8b

From: Carlo Caione <[email protected]>

This patch adds support for the AmLogic Meson8b SoC.

---
 drivers/pinctrl/meson/Makefile          |    2 +-
 drivers/pinctrl/meson/pinctrl-meson.c   |    4 +
 drivers/pinctrl/meson/pinctrl-meson.h   |    1 +
 drivers/pinctrl/meson/pinctrl-meson8b.c | 1013 +++++++++++++++++++++++++++++++
 include/dt-bindings/gpio/meson8b-gpio.h |   31 +
 5 files changed, 1050 insertions(+), 1 deletion(-)
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson8b.c
 create mode 100644 include/dt-bindings/gpio/meson8b-gpio.h
drivers/pinctrl/meson/Makefile +1 -1
index eafc216..c751d22 100644
@@ -1,2 +1,2 @@
-obj-y	+= pinctrl-meson8.o
+obj-y	+= pinctrl-meson8.o pinctrl-meson8b.o
 obj-y	+= pinctrl-meson.o
drivers/pinctrl/meson/pinctrl-meson.c +4 -0
index a2bf49c..79f35f3 100644
@@ -544,6 +544,10 @@ static const struct of_device_id meson_pinctrl_dt_match[] = {
 		.compatible = "amlogic,meson8-pinctrl",
 		.data = &meson8_pinctrl_data,
 	},
+	{
+		.compatible = "amlogic,meson8b-pinctrl",
+		.data = &meson8b_pinctrl_data,
+	},
 	{ },
 };
 MODULE_DEVICE_TABLE(of, meson_pinctrl_dt_match);
drivers/pinctrl/meson/pinctrl-meson.h +1 -0
index bfea8ad..c06d9d0 100644
@@ -207,3 +207,4 @@ struct meson_pinctrl {
 #define MESON_PIN(x) PINCTRL_PIN(PIN_ ## x, #x)
 
 extern struct meson_pinctrl_data meson8_pinctrl_data;
+extern struct meson_pinctrl_data meson8b_pinctrl_data;
drivers/pinctrl/meson/pinctrl-meson8b.c new file +1013 -0

1,013 lines not on this page · raw message

include/dt-bindings/gpio/meson8b-gpio.h new file +31 -0
new file mode 100644
index 0000000..0d6b7f1
@@ -0,0 +1,31 @@
+/*
+ * GPIO definitions for Amlogic Meson8b SoCs
+ *
+ * Copyright (C) 2015 Endless Mobile, Inc.
+ * Author: Carlo Caione <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _DT_BINDINGS_MESON8B_GPIO_H
+#define _DT_BINDINGS_MESON8B_GPIO_H
+
+#include <dt-bindings/gpio/meson8-gpio.h>
+
+#define DIF_0_P		0
+#define DIF_0_N		1
+#define DIF_1_P		2
+#define DIF_1_N		3
+#define DIF_2_P		4
+#define DIF_2_N		5
+#define DIF_3_P		6
+#define DIF_3_N		7
+#define DIF_4_P		8
+#define DIF_4_N		9
+
+#endif /* _DT_BINDINGS_MESON8B_GPIO_H */
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 1/2 pinctrl: Add support for Meson8b

Quoted 175 lines · Carlo Caione

From: Carlo Caione <[email protected]>

This patch adds support for the AmLogic Meson8b SoC.

---
 drivers/pinctrl/meson/Makefile          |    2 +-
 drivers/pinctrl/meson/pinctrl-meson.c   |    4 +
 drivers/pinctrl/meson/pinctrl-meson.h   |    1 +
 drivers/pinctrl/meson/pinctrl-meson8b.c | 1013 +++++++++++++++++++++++++++++++
 include/dt-bindings/gpio/meson8b-gpio.h |   31 +
 5 files changed, 1050 insertions(+), 1 deletion(-)
 create mode 100644 drivers/pinctrl/meson/pinctrl-meson8b.c
 create mode 100644 include/dt-bindings/gpio/meson8b-gpio.h
drivers/pinctrl/meson/Makefile +1 -1
index eafc216..c751d22 100644
@@ -1,2 +1,2 @@
-obj-y	+= pinctrl-meson8.o
+obj-y	+= pinctrl-meson8.o pinctrl-meson8b.o
 obj-y	+= pinctrl-meson.o
drivers/pinctrl/meson/pinctrl-meson.c +4 -0
index a2bf49c..79f35f3 100644
@@ -544,6 +544,10 @@ static const struct of_device_id meson_pinctrl_dt_match[] = {
 		.compatible = "amlogic,meson8-pinctrl",
 		.data = &meson8_pinctrl_data,
 	},
+	{
+		.compatible = "amlogic,meson8b-pinctrl",
+		.data = &meson8b_pinctrl_data,
+	},
 	{ },
 };
 MODULE_DEVICE_TABLE(of, meson_pinctrl_dt_match);
drivers/pinctrl/meson/pinctrl-meson.h +1 -0
index bfea8ad..c06d9d0 100644
@@ -207,3 +207,4 @@ struct meson_pinctrl {
 #define MESON_PIN(x) PINCTRL_PIN(PIN_ ## x, #x)
 
 extern struct meson_pinctrl_data meson8_pinctrl_data;
+extern struct meson_pinctrl_data meson8b_pinctrl_data;
drivers/pinctrl/meson/pinctrl-meson8b.c new file +122 -0
new file mode 100644
index 0000000..8a91e59
@@ -0,0 +1,1013 @@
+/*
+ * Pin controller and GPIO driver for Amlogic Meson8b.
+ *
+ * Copyright (C) 2015 Endless Mobile, Inc.
+ * Author: Carlo Caione <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <dt-bindings/gpio/meson8b-gpio.h>
+#include "pinctrl-meson.h"
+
+#define AO_OFFSET	120
+#define DIF_OFFSET	135
+
+#define PIN_GPIOX_0	GPIOX_0
+#define PIN_GPIOX_1	GPIOX_1
+#define PIN_GPIOX_2	GPIOX_2
+#define PIN_GPIOX_3	GPIOX_3
+#define PIN_GPIOX_4	GPIOX_4
+#define PIN_GPIOX_5	GPIOX_5
+#define PIN_GPIOX_6	GPIOX_6
+#define PIN_GPIOX_7	GPIOX_7
+#define PIN_GPIOX_8	GPIOX_8
+#define PIN_GPIOX_9	GPIOX_9
+#define PIN_GPIOX_10	GPIOX_10
+#define PIN_GPIOX_11	GPIOX_11
+/* hole */
+#define PIN_GPIOX_16	GPIOX_16
+#define PIN_GPIOX_17	GPIOX_17
+#define PIN_GPIOX_18	GPIOX_18
+#define PIN_GPIOX_19	GPIOX_19
+#define PIN_GPIOX_20	GPIOX_20
+#define PIN_GPIOX_21	GPIOX_21
+
+#define PIN_GPIOY_0	GPIOY_0
+#define PIN_GPIOY_1	GPIOY_1
+/* hole */
+#define PIN_GPIOY_3	GPIOY_3
+/* hole */
+#define PIN_GPIOY_6	GPIOY_6
+#define PIN_GPIOY_7	GPIOY_7
+#define PIN_GPIOY_8	GPIOY_8
+#define PIN_GPIOY_9	GPIOY_9
+#define PIN_GPIOY_10	GPIOY_10
+#define PIN_GPIOY_11	GPIOY_11
+#define PIN_GPIOY_12	GPIOY_12
+#define PIN_GPIOY_13	GPIOY_13
+#define PIN_GPIOY_14	GPIOY_14
+
+/* hole */
+#define PIN_GPIODV_9	GPIODV_9
+/* hole */
+#define PIN_GPIODV_24	GPIODV_24
+#define PIN_GPIODV_25	GPIODV_25
+#define PIN_GPIODV_26	GPIODV_26
+#define PIN_GPIODV_27	GPIODV_27
+#define PIN_GPIODV_28	GPIODV_28
+#define PIN_GPIODV_29	GPIODV_29
+
+#define PIN_GPIOH_0	GPIOH_0
+#define PIN_GPIOH_1	GPIOH_1
+#define PIN_GPIOH_2	GPIOH_2
+#define PIN_GPIOH_3	GPIOH_3
+#define PIN_GPIOH_4	GPIOH_4
+#define PIN_GPIOH_5	GPIOH_5
+#define PIN_GPIOH_6	GPIOH_6
+#define PIN_GPIOH_7	GPIOH_7
+#define PIN_GPIOH_8	GPIOH_8
+#define PIN_GPIOH_9	GPIOH_9
+
+#define PIN_CARD_0	CARD_0
+#define PIN_CARD_1	CARD_1
+#define PIN_CARD_2	CARD_2
+#define PIN_CARD_3	CARD_3
+#define PIN_CARD_4	CARD_4
+#define PIN_CARD_5	CARD_5
+#define PIN_CARD_6	CARD_6
+
+#define PIN_BOOT_0	BOOT_0
+#define PIN_BOOT_1	BOOT_1
+#define PIN_BOOT_2	BOOT_2
+#define PIN_BOOT_3	BOOT_3
+#define PIN_BOOT_4	BOOT_4
+#define PIN_BOOT_5	BOOT_5
+#define PIN_BOOT_6	BOOT_6
+#define PIN_BOOT_7	BOOT_7
+#define PIN_BOOT_8	BOOT_8
+#define PIN_BOOT_9	BOOT_9
+#define PIN_BOOT_10	BOOT_10
+#define PIN_BOOT_11	BOOT_11
+#define PIN_BOOT_12	BOOT_12
+#define PIN_BOOT_13	BOOT_13
+#define PIN_BOOT_14	BOOT_14
+#define PIN_BOOT_15	BOOT_15
+#define PIN_BOOT_16	BOOT_16
+#define PIN_BOOT_17	BOOT_17
+#define PIN_BOOT_18	BOOT_18
+
+#define PIN_DIF_0_P	(DIF_OFFSET + DIF_0_P)
+#define PIN_DIF_0_N	(DIF_OFFSET + DIF_0_N)
+#define PIN_DIF_1_P	(DIF_OFFSET + DIF_1_P)
+#define PIN_DIF_1_N	(DIF_OFFSET + DIF_1_N)
+#define PIN_DIF_2_P	(DIF_OFFSET + DIF_2_P)
+#define PIN_DIF_2_N	(DIF_OFFSET + DIF_2_N)
+#define PIN_DIF_3_P	(DIF_OFFSET + DIF_3_P)
+#define PIN_DIF_3_N	(DIF_OFFSET + DIF_3_N)
+#define PIN_DIF_4_P	(DIF_OFFSET + DIF_4_P)
+#define PIN_DIF_4_N	(DIF_OFFSET + DIF_4_N)
+
+#define PIN_GPIOAO_0	(AO_OFFSET + GPIOAO_0)
+#define PIN_GPIOAO_1	(AO_OFFSET + GPIOAO_1)
+#define PIN_GPIOAO_2	(AO_OFFSET + GPIOAO_2)
+#define PIN_GPIOAO_3	(AO_OFFSET + GPIOAO_3)
+#define PIN_GPIOAO_4	(AO_OFFSET + GPIOAO_4)
+#define PIN_GPIOAO_5	(AO_OFFSET + GPIOAO_5)
+#define PIN_GPIOAO_6	(AO_OFFSET + GPIOAO_6)

drivers/pinctrl/meson/pinctrl-meson8b.c line 132

Quoted 10 lines
drivers/pinctrl/meson/pinctrl-meson8b.c new file +10 -0
+#define PIN_GPIOAO_7	(AO_OFFSET + GPIOAO_7)
+#define PIN_GPIOAO_8	(AO_OFFSET + GPIOAO_8)
+#define PIN_GPIOAO_9	(AO_OFFSET + GPIOAO_9)
+#define PIN_GPIOAO_10	(AO_OFFSET + GPIOAO_10)
+#define PIN_GPIOAO_11	(AO_OFFSET + GPIOAO_11)
+#define PIN_GPIOAO_12	(AO_OFFSET + GPIOAO_12)
+#define PIN_GPIOAO_13	(AO_OFFSET + GPIOAO_13)
+
+#define PIN_GPIO_BSD_EN	(AO_OFFSET + GPIO_BSD_EN)
+#define PIN_GPIO_TEST_N	(AO_OFFSET + GPIO_TEST_N)

Could we just have sets of PIN_GPIOAO(x) there's a lot of code in here which could be compressed.

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#3 lore raw

PATCH v2 1/2 pinctrl: Add support for Meson8b

In reply to Carlo Caione
Quoted 5 lines · Carlo Caione

From: Carlo Caione <[email protected]>

This patch adds support for the AmLogic Meson8b SoC.

(...)

include/dt-bindings/gpio/meson8b-gpio.h

Quoted 5 lines
include/dt-bindings/gpio/meson8b-gpio.h new file +0 -0
new file mode 100644
index 0000000..0d6b7f1

Why is this not in <dt-bindings/pinctrl/*> ?

Quoted 9 lines
include/dt-bindings/gpio/meson8b-gpio.h new file +8 -0
@@ -0,0 +1,31 @@
+/*
+ * GPIO definitions for Amlogic Meson8b SoCs
+ *
+ * Copyright (C) 2015 Endless Mobile, Inc.
+ * Author: Carlo Caione <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License

include/dt-bindings/gpio/meson8b-gpio.h line 18

Quoted 10 lines
include/dt-bindings/gpio/meson8b-gpio.h new file +10 -0
+ * version 2 as published by the Free Software Foundation.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _DT_BINDINGS_MESON8B_GPIO_H
+#define _DT_BINDINGS_MESON8B_GPIO_H
+
+#include <dt-bindings/gpio/meson8-gpio.h>

Why is this file including itself?

include/dt-bindings/gpio/meson8b-gpio.h line 29

Quoted 11 lines
include/dt-bindings/gpio/meson8b-gpio.h new file +11 -0
+
+#define DIF_0_P                0
+#define DIF_0_N                1
+#define DIF_1_P                2
+#define DIF_1_N                3
+#define DIF_2_P                4
+#define DIF_2_N                5
+#define DIF_3_P                6
+#define DIF_3_N                7
+#define DIF_4_P                8
+#define DIF_4_N                9

Moreover, *what* is this DIF stuff and why is there no binding document for it?

Yours,
Linus Walleij

#4 lore raw

PATCH v2 1/2 pinctrl: Add support for Meson8b

Quoted 10 lines · Linus Walleij
Quoted 5 lines · Carlo Caione

From: Carlo Caione <[email protected]>

This patch adds support for the AmLogic Meson8b SoC.

(...)

Quoted 7 lines

include/dt-bindings/gpio/meson8b-gpio.h

Quoted 5 lines
include/dt-bindings/gpio/meson8b-gpio.h new file +0 -0
new file mode 100644
index 0000000..0d6b7f1

Why is this not in <dt-bindings/pinctrl/*> ?

Because meson8-gpio.h was already in <dt-bindings/gpio/*>

Quoted 13 lines
Quoted 13 lines
include/dt-bindings/gpio/meson8b-gpio.h new file +12 -0
@@ -0,0 +1,31 @@
+/*
+ * GPIO definitions for Amlogic Meson8b SoCs
+ *
+ * Copyright (C) 2015 Endless Mobile, Inc.
+ * Author: Carlo Caione <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
Quoted 8 lines

include/dt-bindings/gpio/meson8b-gpio.h line 18

Quoted 6 lines
include/dt-bindings/gpio/meson8b-gpio.h new file +6 -0
+ */
+
+#ifndef _DT_BINDINGS_MESON8B_GPIO_H
+#define _DT_BINDINGS_MESON8B_GPIO_H
+
+#include <dt-bindings/gpio/meson8-gpio.h>

Why is this file including itself?

It's not, the file is called meson8b-gpio.h and it's including meson8-gpio.h

Quoted 6 lines
Quoted 6 lines
include/dt-bindings/gpio/meson8b-gpio.h new file +6 -0
+
+#define DIF_0_P                0
+#define DIF_0_N                1
+#define DIF_1_P                2
+#define DIF_1_N                3
+#define DIF_2_P                4
Quoted 8 lines

include/dt-bindings/gpio/meson8b-gpio.h line 29

Quoted 5 lines
include/dt-bindings/gpio/meson8b-gpio.h new file +5 -0
+#define DIF_2_N                5
+#define DIF_3_P                6
+#define DIF_3_N                7
+#define DIF_4_P                8
+#define DIF_4_N                9

Moreover, *what* is this DIF stuff and why is there no binding document for it?

DIF is another GPIO bank that we have only on Meson8b.

Thanks,

Signature · 1 line
Carlo Caione
#5 lore raw

PATCH v2 1/2 pinctrl: Add support for Meson8b

Quoted 11 lines · Carlo Caione
Quoted 6 lines · Linus Walleij

include/dt-bindings/gpio/meson8b-gpio.h line 18

Quoted 4 lines
include/dt-bindings/gpio/meson8b-gpio.h new file +4 -0
+#ifndef _DT_BINDINGS_MESON8B_GPIO_H
+#define _DT_BINDINGS_MESON8B_GPIO_H
+
+#include <dt-bindings/gpio/meson8-gpio.h>

Why is this file including itself?

It's not, the file is called meson8b-gpio.h and it's including meson8-gpio.h

Aha I was totally lost, sorry...

Yours,
Linus Walleij

#6 lore raw

PATCH v2 2/2 documentation: Fix pinctrl docs for Meson8b

In reply to Carlo Caione

From: Carlo Caione <[email protected]>

Add the compatible string for Meson8b in Meson pinctrl documentation.

---
 Documentation/devicetree/bindings/pinctrl/meson,pinctrl.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/pinctrl/meson,pinctrl.txt +1 -1
index 17e7240..3f6a524 100644
@@ -1,7 +1,7 @@
 == Amlogic Meson pinmux controller ==
 
 Required properties for the root node:
- - compatible: "amlogic,meson8-pinctrl"
+ - compatible: "amlogic,meson8-pinctrl" or "amlogic,meson8b-pinctrl"
  - reg: address and size of registers controlling irq functionality
 
 === GPIO sub-nodes ===
Signature · 1 line
1.9.1
#7 lore raw

PATCH v2 2/2 documentation: Fix pinctrl docs for Meson8b

Quoted 5 lines · Carlo Caione

From: Carlo Caione <[email protected]>

Add the compatible string for Meson8b in Meson pinctrl documentation.

Change the subject of this patch. It is not a fix, it is new functionality.

Consider documenting that DIF stuff.

Yours,
Linus Walleij

#8 lore raw

PATCH v2 2/2 documentation: Fix pinctrl docs for Meson8b

Quoted 11 lines · Linus Walleij
Quoted 5 lines · Carlo Caione

From: Carlo Caione <[email protected]>

Add the compatible string for Meson8b in Meson pinctrl documentation.

Change the subject of this patch. It is not a fix, it is new functionality.

Consider documenting that DIF stuff.

I'll do in v3.

Thanks,

Signature · 1 line
Carlo Caione