Skip to contentSkip to conversation

arm: vt8500: Add support for pinctrl/gpio module

PATCH Superseded Tony Prisk 4 participants 19 messages Mar 23, 2013 – Apr 15, 2013

Subsystems (7)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Tony Prisk

author
#0 lore raw

v2 cover arm: vt8500: Add support for pinctrl/gpio module

v2 changes:
Rebased onto v3.9-rc2

Changes made as requested by Linus Walleij:
Moved the files into drivers/pinctrl/vt8500/ to keep them tidy. Changed readl/writel to *_relaxed variants.
Comment indentation corrected and remove additional whitespace. Changed wmt_pctl_find_group_by_pin() error code from -1 to -EINVAL. Removed OF read indexed-u32 function to OF subsystem. General code tidy up as requested.

Changes made as requested by Stephen Warren:
Add binding information for interrupt generation. Move optional properties to correct location in document.

This patch series removes the existing GPIO driver and replaces it with a combined pinctrl+gpio driver.

Patch 1 - Add an OF function to read the nth u32 value from a property
listing multiple values.

Patch 2 - Increase the available GPIO space for the newly added gpios.
Because there is no hardware documentation from Wondermedia we don't know how many GPIO's there actually are. New gpio pins have been located since the original GPIO driver was written, hence the increase.

Patch 3 - The main pinctrl/gpio driver and the data for the 5 supported SoCs.
Each SoC is different, and therefore has its own data. This design was borrowed from the Tegra pinctrl driver. The pin numbering is based on a bank+pin encoding so that when other pin functions are found later on we can add them without having to renumber existing pins.

Patch 4 - Update the SoC dts(i) files to support the new pinctrl driver.

Patch 5 - Remove the existing GPIO driver nodes from the dtsi's.

Patch 6 - Remove the existing GPIO driver.

Patch 7 - Remove the pinmux configuration code from mach-vt8500/vt8500.c that
was used to configure the graphics hardware at boot time. This is now done in the pinctrl node of the dtsi.

I suspect this series may need to be broken up since there are two arm-soc patches, and 4 pinctrl/gpio patches.

Patch 1 is fairly independant, but is required for the new driver to function properly.
Patches 2-5 are pinctrl/gpio patches.
Patch 6 relies on all the previous patches being available or the graphics hardware will be non-functional.

Let me know how you want to handle this and I'll break it up if necessary.

Regards
Tony Prisk

Tony Prisk (7):
of: Add support for reading a u32 from a multi-value property.
arm: vt8500: Increase available GPIOs on arch-vt8500
pinctrl: gpio: vt8500: Add pincontrol driver for arch-vt8500
arm: dts: vt8500: Update Wondermedia SoC dtsi files for pinctrl
driver
arm: vt8500: Remove gpio devicetree nodes
gpio: vt8500: Remove arch-vt8500 gpio driver
arm: vt8500: Remove pinmux configuration from mach-vt8500/vt8500.c

 .../devicetree/bindings/pinctrl/pinctrl-vt8500.txt |   56 ++
 arch/arm/Kconfig                                   |    3 +-
 arch/arm/boot/dts/vt8500.dtsi                      |    7 +-
 arch/arm/boot/dts/wm8505.dtsi                      |    7 +-
 arch/arm/boot/dts/wm8650.dtsi                      |    7 +-
 arch/arm/boot/dts/wm8850.dtsi                      |    7 +-
 arch/arm/mach-vt8500/Kconfig                       |    1 +
 arch/arm/mach-vt8500/vt8500.c                      |   70 +--
 drivers/gpio/Kconfig                               |    6 -
 drivers/gpio/Makefile                              |    1 -
 drivers/gpio/gpio-vt8500.c                         |  355 -----------
 drivers/of/base.c                                  |   33 +
 drivers/pinctrl/Kconfig                            |    1 +
 drivers/pinctrl/Makefile                           |    1 +
 drivers/pinctrl/vt8500/Kconfig                     |   52 ++
 drivers/pinctrl/vt8500/Makefile                    |    8 +
 drivers/pinctrl/vt8500/pinctrl-vt8500.c            |  509 ++++++++++++++++
 drivers/pinctrl/vt8500/pinctrl-wm8505.c            |  540 +++++++++++++++++
 drivers/pinctrl/vt8500/pinctrl-wm8650.c            |  378 ++++++++++++
 drivers/pinctrl/vt8500/pinctrl-wm8750.c            |  417 +++++++++++++
 drivers/pinctrl/vt8500/pinctrl-wm8850.c            |  396 ++++++++++++
 drivers/pinctrl/vt8500/pinctrl-wmt.c               |  635 ++++++++++++++++++++
 drivers/pinctrl/vt8500/pinctrl-wmt.h               |   79 +++
 include/linux/of.h                                 |    9 +
 24 files changed, 3134 insertions(+), 444 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt
 delete mode 100644 drivers/gpio/gpio-vt8500.c
 create mode 100644 drivers/pinctrl/vt8500/Kconfig
 create mode 100644 drivers/pinctrl/vt8500/Makefile
 create mode 100644 drivers/pinctrl/vt8500/pinctrl-vt8500.c
 create mode 100644 drivers/pinctrl/vt8500/pinctrl-wm8505.c
 create mode 100644 drivers/pinctrl/vt8500/pinctrl-wm8650.c
 create mode 100644 drivers/pinctrl/vt8500/pinctrl-wm8750.c
 create mode 100644 drivers/pinctrl/vt8500/pinctrl-wm8850.c
 create mode 100644 drivers/pinctrl/vt8500/pinctrl-wmt.c
 create mode 100644 drivers/pinctrl/vt8500/pinctrl-wmt.h
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH v2 1/7 of: Add support for reading a u32 from a multi-value property.

This patch adds an of_property_read_u32_index() function to allow reading a single indexed u32 value from a property containing multiple u32 values.

---
cc: Grant Likely <[email protected]>
cc: Rob Herring <[email protected]>
cc: devicetree-discuss at lists.ozlabs.org

Hi Rob/Grant,
After a review of my pinctrl driver, it was suggested that one of the helper functions be moved into the OF subsystem. Could you review and ack this patch if you're happy with it.
Regards
Tony P

 drivers/of/base.c  |   33 +++++++++++++++++++++++++++++++++
 include/linux/of.h |    9 +++++++++
 2 files changed, 42 insertions(+)
drivers/of/base.c +33 -0
index 321d3ef..7dc001e 100644
@@ -746,6 +746,39 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 EXPORT_SYMBOL(of_find_node_by_phandle);
 
 /**
+ * of_property_read_u32_index - Find and read a u32 from a multi-value property.
+ *
+ * @np:		device node from which the property value is to be read.
+ * @propname:	name of the property to be searched.
+ * @index:	index of the u32 in the list of values
+ * @out_value:	pointer to return value, modified only if no error.
+ *
+ * Search for a property in a device node and read nth 32-bit value from
+ * it. Returns 0 on success, -EINVAL if the property does not exist,
+ * -ENODATA if property does not have a value, and -EOVERFLOW if the
+ * property data isn't large enough.
+ *
+ * The out_value is modified only if a valid u32 value can be decoded.
+ */
+int of_property_read_u32_index(const struct device_node *np,
+				       const char *propname,
+				       u32 index, u32 *out_value)
+{
+	struct property *prop = of_find_property(np, propname, NULL);
+
+	if (!prop)
+		return -EINVAL;
+	if (!prop->value)
+		return -ENODATA;
+	if ((index * sizeof(*out_value)) > prop->length)
+		return -EOVERFLOW;
+
+	*out_value = be32_to_cpup(((__be32 *)prop->value) + index);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(of_property_read_u32_index);
+
+/**
  * of_property_read_u8_array - Find and read an array of u8 from a property.
  *
  * @np:		device node from which the property value is to be read.
include/linux/of.h +9 -0
index a0f1292..c0747a4 100644
@@ -235,6 +235,9 @@ extern struct device_node *of_find_node_with_property(
 extern struct property *of_find_property(const struct device_node *np,
 					 const char *name,
 					 int *lenp);
+extern int of_property_read_u32_index(const struct device_node *np,
+				       const char *propname,
+				       u32 index, u32 *out_value);
 extern int of_property_read_u8_array(const struct device_node *np,
 			const char *propname, u8 *out_values, size_t sz);
 extern int of_property_read_u16_array(const struct device_node *np,
@@ -394,6 +397,12 @@ static inline struct device_node *of_find_compatible_node(
 	return NULL;
 }
 
+static inline int of_property_read_u32_index(const struct device_node *np,
+			const char *propname, u32 index, u32 *out_value)
+{
+	return -ENOSYS;
+}
+
 static inline int of_property_read_u8_array(const struct device_node *np,
 			const char *propname, u8 *out_values, size_t sz)
 {
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 1/7 of: Add support for reading a u32 from a multi-value property.

Quoted 10 lines · Tony Prisk

This patch adds an of_property_read_u32_index() function to allow reading a single indexed u32 value from a property containing multiple u32 values.

---
cc: Grant Likely <[email protected]>
cc: Rob Herring <[email protected]>
cc: devicetree-discuss at lists.ozlabs.org

Quoted 4 lines

Hi Rob/Grant,
After a review of my pinctrl driver, it was suggested that one of the helper functions be moved into the OF subsystem. Could you review and ack this patch if you're happy with it.

Hey Tony,

Instead of implementing this as a sparate function, this should be done as an extension to the of_proprety_read_u32_array() interface, just like how of_property_read_u32() is implemented. It will result in less code that way. So, rename of_property_read_u32_array() to __of_property_read_u32() and add a 'index' argument to it. Then of_property_read_u32_index() can be implemented as:

static inline int of_property_read_u32_index(const struct device_node *np,
const char *propname, int index, u32 *out_value)

{
	return __of_property_read_u32(np, propname, index, 1, out_value);
}

And the new of_property_read_u32_array() becomes:

static inline int of_property_read_u32_array(const struct device_node *np,

					     const char *propname,
					     int sz, u32 *out_value)
{
	return __of_property_read_u32(np, propname, 0, sz, out_value);
}

g.

Quoted 81 lines

Regards
Tony P

 drivers/of/base.c  |   33 +++++++++++++++++++++++++++++++++
 include/linux/of.h |    9 +++++++++
 2 files changed, 42 insertions(+)
drivers/of/base.c +33 -0
index 321d3ef..7dc001e 100644
@@ -746,6 +746,39 @@ struct device_node *of_find_node_by_phandle(phandle handle)
 EXPORT_SYMBOL(of_find_node_by_phandle);
 
 /**
+ * of_property_read_u32_index - Find and read a u32 from a multi-value property.
+ *
+ * @np:		device node from which the property value is to be read.
+ * @propname:	name of the property to be searched.
+ * @index:	index of the u32 in the list of values
+ * @out_value:	pointer to return value, modified only if no error.
+ *
+ * Search for a property in a device node and read nth 32-bit value from
+ * it. Returns 0 on success, -EINVAL if the property does not exist,
+ * -ENODATA if property does not have a value, and -EOVERFLOW if the
+ * property data isn't large enough.
+ *
+ * The out_value is modified only if a valid u32 value can be decoded.
+ */
+int of_property_read_u32_index(const struct device_node *np,
+				       const char *propname,
+				       u32 index, u32 *out_value)
+{
+	struct property *prop = of_find_property(np, propname, NULL);
+
+	if (!prop)
+		return -EINVAL;
+	if (!prop->value)
+		return -ENODATA;
+	if ((index * sizeof(*out_value)) > prop->length)
+		return -EOVERFLOW;
+
+	*out_value = be32_to_cpup(((__be32 *)prop->value) + index);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(of_property_read_u32_index);
+
+/**
  * of_property_read_u8_array - Find and read an array of u8 from a property.
  *
  * @np:		device node from which the property value is to be read.
include/linux/of.h +9 -0
index a0f1292..c0747a4 100644
@@ -235,6 +235,9 @@ extern struct device_node *of_find_node_with_property(
 extern struct property *of_find_property(const struct device_node *np,
 					 const char *name,
 					 int *lenp);
+extern int of_property_read_u32_index(const struct device_node *np,
+				       const char *propname,
+				       u32 index, u32 *out_value);
 extern int of_property_read_u8_array(const struct device_node *np,
 			const char *propname, u8 *out_values, size_t sz);
 extern int of_property_read_u16_array(const struct device_node *np,
@@ -394,6 +397,12 @@ static inline struct device_node *of_find_compatible_node(
 	return NULL;
 }
 
+static inline int of_property_read_u32_index(const struct device_node *np,
+			const char *propname, u32 index, u32 *out_value)
+{
+	return -ENOSYS;
+}
+
 static inline int of_property_read_u8_array(const struct device_node *np,
 			const char *propname, u8 *out_values, size_t sz)
 {
Signature · 1 line
1.7.9.5
Signature · 2 lines
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.
author
#3 lore raw

PATCH v2 2/7 arm: vt8500: Increase available GPIOs on arch-vt8500

In reply to Tony Prisk

With the inclusion of the pin control driver, more GPIO pins have been identified on the arch-vt8500 SoCs requiring an increase in the available GPIOs.

---
 arch/arm/Kconfig |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/Kconfig +2 -1
index 5b71469..c5dd0c2 100644
@@ -1661,9 +1661,10 @@ config ARCH_NR_GPIO
 	int
 	default 1024 if ARCH_SHMOBILE || ARCH_TEGRA
 	default 355 if ARCH_U8500
+	default 352 if ARCH_VT8500
 	default 264 if MACH_H4700
 	default 512 if SOC_OMAP5
-	default 288 if ARCH_VT8500 || ARCH_SUNXI
+	default 288 if ARCH_SUNXI
 	default 0
 	help
 	  Maximum number of GPIOs in the system.
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v2 2/7 arm: vt8500: Increase available GPIOs on arch-vt8500

Quoted 14 lines · Tony Prisk

With the inclusion of the pin control driver, more GPIO pins have been identified on the arch-vt8500 SoCs requiring an increase in the available GPIOs.

---
 arch/arm/Kconfig |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/Kconfig +0 -0
index 5b71469..c5dd0c2 100644

arch/arm/Kconfig config ARCH_NR_GPIO · line 1667

Quoted 8 lines
arch/arm/Kconfig +2 -1
@@ -1661,9 +1661,10 @@ config ARCH_NR_GPIO
 	int
 	default 1024 if ARCH_SHMOBILE || ARCH_TEGRA
 	default 355 if ARCH_U8500
+	default 352 if ARCH_VT8500
 	default 264 if MACH_H4700
 	default 512 if SOC_OMAP5
-	default 288 if ARCH_VT8500 || ARCH_SUNXI
+	default 288 if ARCH_SUNXI

Note that the ordering of this has been fixed in -rc, so the above will cause a merge conflict. You may wish to consider basing your patch set on a later kernel version.

author
#5 lore raw

PATCH v2 2/7 arm: vt8500: Increase available GPIOs on arch-vt8500

Quoted 19 lines · Russell King - ARM Linux
Quoted 18 lines · Tony Prisk

With the inclusion of the pin control driver, more GPIO pins have been identified on the arch-vt8500 SoCs requiring an increase in the available GPIOs.

---
 arch/arm/Kconfig |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/Kconfig +1 -0
index 5b71469..c5dd0c2 100644
@@ -1661,9 +1661,10 @@ config ARCH_NR_GPIO
 	int
 	default 1024 if ARCH_SHMOBILE || ARCH_TEGRA
 	default 355 if ARCH_U8500
+	default 352 if ARCH_VT8500
Quoted 8 lines

arch/arm/Kconfig config ARCH_NR_GPIO · line 1667

Quoted 4 lines
arch/arm/Kconfig +1 -1
 	default 264 if MACH_H4700
 	default 512 if SOC_OMAP5
-	default 288 if ARCH_VT8500 || ARCH_SUNXI
+	default 288 if ARCH_SUNXI

Note that the ordering of this has been fixed in -rc, so the above will cause a merge conflict. You may wish to consider basing your patch set on a later kernel version.

Thanks Russell,

I didn't think to check for -rc3 just yet. My bad. Will rebase to -rc3+ before I post the next version.

Regards
Tony P

author
#6 lore raw

PATCH v2 3/7 pinctrl: gpio: vt8500: Add pincontrol driver for arch-vt8500

In reply to Tony Prisk

This patch adds support for the GPIO/pinmux controller found on the VIA VT8500 and Wondermedia WM8xxx-series SoCs.

Each pin within the controller is capable of operating as a GPIO or as an alternate function. The pins are numbered according to their control bank/bit so that if new pins are added, the existing numbering is maintained.

All currently supported SoCs are included: VT8500, WM8505, WM8650, WM8750 and WM8850.

---
 .../devicetree/bindings/pinctrl/pinctrl-vt8500.txt |   59 ++
 arch/arm/mach-vt8500/Kconfig                       |    1 +
 drivers/pinctrl/Kconfig                            |    1 +
 drivers/pinctrl/Makefile                           |    1 +
 drivers/pinctrl/vt8500/Kconfig                     |   52 ++
 drivers/pinctrl/vt8500/Makefile                    |    8 +
 drivers/pinctrl/vt8500/pinctrl-vt8500.c            |  509 ++++++++++++++++
 drivers/pinctrl/vt8500/pinctrl-wm8505.c            |  540 +++++++++++++++++
 drivers/pinctrl/vt8500/pinctrl-wm8650.c            |  378 ++++++++++++
 drivers/pinctrl/vt8500/pinctrl-wm8750.c            |  417 +++++++++++++
 drivers/pinctrl/vt8500/pinctrl-wm8850.c            |  396 ++++++++++++
 drivers/pinctrl/vt8500/pinctrl-wmt.c               |  635 ++++++++++++++++++++
 drivers/pinctrl/vt8500/pinctrl-wmt.h               |   79 +++
 13 files changed, 3076 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt
 create mode 100644 drivers/pinctrl/vt8500/Kconfig
 create mode 100644 drivers/pinctrl/vt8500/Makefile
 create mode 100644 drivers/pinctrl/vt8500/pinctrl-vt8500.c
 create mode 100644 drivers/pinctrl/vt8500/pinctrl-wm8505.c
 create mode 100644 drivers/pinctrl/vt8500/pinctrl-wm8650.c
 create mode 100644 drivers/pinctrl/vt8500/pinctrl-wm8750.c
 create mode 100644 drivers/pinctrl/vt8500/pinctrl-wm8850.c
 create mode 100644 drivers/pinctrl/vt8500/pinctrl-wmt.c
 create mode 100644 drivers/pinctrl/vt8500/pinctrl-wmt.h
Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt new file +59 -0
new file mode 100644
index 0000000..20600e3
@@ -0,0 +1,59 @@
+VIA VT8500 and Wondermedia WM8xxx-series pinmux/gpio controller
+
+These SoCs contain a combined Pinmux/GPIO module. Each pin may operate as
+either a GPIO in, GPIO out or as an alternate function (I2C, SPI etc).
+
+Required properties:
+- compatible: "via,vt8500-pinctrl", "wm,wm8505-pinctrl", "wm,wm8650-pinctrl",
+	"wm8750-pinctrl" or "wm,wm8850-pinctrl"
+- reg: Should contain the physical address of the module's registers.
+- interrupt-controller: Marks the device node as an interrupt controller.
+- #interrupt-cells: Should be two.
+- gpio-controller: Marks the device node as a GPIO controller.
+- #gpio-cells : Should be two. The first cell is the pin number and the
+  second cell is used to specify optional parameters.
+
+Optional properties:
+- wm,pinmux: A value and mask pair describing the configuration changes to
+  the pinmux register. Only bits marked 1 in the mask will be changed.
+
+Please refer to ../gpio/gpio.txt for a general description of GPIO bindings.
+
+Please refer to pinctrl-bindings.txt in this directory for details of the
+common pinctrl bindings used by client devices, including the meaning of the
+phrase "pin configuration node".
+
+Each pin configuration node lists the pin(s) to which it applies, and one or
+more of the mux functions to select on those pin(s), and pull-up/down
+configuration. Each subnode only affects those parameters that are explicitly
+listed. In other words, a subnode that lists only a mux function implies no
+information about any pull configuration. Similarly, a subnode that lists only
+a pull parameter implies no information about the mux function.
+
+Required subnode-properties:
+- wm,pins: An array of cells. Each cell contains the ID of a pin.
+
+Optional subnode-properties:
+- wm,function: Integer, containing the function to mux to the pin(s):
+  0: GPIO in
+  1: GPIO out
+  2: alternate
+
+- wm,pull: Integer, representing the pull-down/up to apply to the pin(s):
+  0: none
+  1: down
+  2: up
+
+Each of wm,function and wm,pull may contain either a single value which
+will be applied to all pins in wm,pins, or one value for each entry in
+wm,pins.
+
+Example:
+
+	pinctrl: pinctrl {
+		compatible = "wm,wm8505-pinctrl";
+		reg = <0xD8110000 0x10000>;
+		wm,pinmux = <0x80000004 0x80000006>;
+		gpio-controller;
+		#gpio-cells = <2>;
+	};
arch/arm/mach-vt8500/Kconfig +1 -0
index e3e94b2..9b25293 100644
@@ -7,6 +7,7 @@ config ARCH_VT8500
 	select GENERIC_CLOCKEVENTS
 	select HAVE_CLK
 	select VT8500_TIMER
+	select PINCTRL
 	help
 	  Support for VIA/WonderMedia VT8500/WM85xx System-on-Chip.
 
drivers/pinctrl/Kconfig +1 -0
index 34f51d2..35e9400 100644
@@ -229,6 +229,7 @@ config PINCTRL_EXYNOS5440
 source "drivers/pinctrl/mvebu/Kconfig"
 source "drivers/pinctrl/sh-pfc/Kconfig"
 source "drivers/pinctrl/spear/Kconfig"
+source "drivers/pinctrl/vt8500/Kconfig"
 
 config PINCTRL_XWAY
 	bool
drivers/pinctrl/Makefile +1 -0
index f82cc5b..a5a52c8 100644
@@ -52,3 +52,4 @@ obj-$(CONFIG_PLAT_ORION)        += mvebu/
 obj-$(CONFIG_ARCH_SHMOBILE)	+= sh-pfc/
 obj-$(CONFIG_SUPERH)		+= sh-pfc/
 obj-$(CONFIG_PLAT_SPEAR)	+= spear/
+obj-$(CONFIG_ARCH_VT8500)	+= vt8500/
drivers/pinctrl/vt8500/Kconfig new file +52 -0

52 lines not on this page · raw message

drivers/pinctrl/vt8500/Makefile new file +8 -0
new file mode 100644
index 0000000..24ec45d
@@ -0,0 +1,8 @@
+# VIA/Wondermedia pinctrl support
+
+obj-$(CONFIG_PINCTRL_WMT)	+= pinctrl-wmt.o
+obj-$(CONFIG_PINCTRL_VT8500)	+= pinctrl-vt8500.o
+obj-$(CONFIG_PINCTRL_WM8505)	+= pinctrl-wm8505.o
+obj-$(CONFIG_PINCTRL_WM8650)	+= pinctrl-wm8650.o
+obj-$(CONFIG_PINCTRL_WM8750)	+= pinctrl-wm8750.o
+obj-$(CONFIG_PINCTRL_WM8850)	+= pinctrl-wm8850.o
drivers/pinctrl/vt8500/pinctrl-vt8500.c new file +509 -0

509 lines not on this page · raw message

drivers/pinctrl/vt8500/pinctrl-wm8505.c new file +540 -0

540 lines not on this page · raw message

drivers/pinctrl/vt8500/pinctrl-wm8650.c new file +378 -0

378 lines not on this page · raw message

drivers/pinctrl/vt8500/pinctrl-wm8750.c new file +417 -0

417 lines not on this page · raw message

drivers/pinctrl/vt8500/pinctrl-wm8850.c new file +396 -0

396 lines not on this page · raw message

drivers/pinctrl/vt8500/pinctrl-wmt.c new file +635 -0

623 lines not on this page · raw message

drivers/pinctrl/vt8500/pinctrl-wmt.h new file +79 -0

79 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.9.5

Part of the diff is not shown here. View the raw message.

#7 lore raw

PATCH v2 3/7 pinctrl: gpio: vt8500: Add pincontrol driver for arch-vt8500

Quoted 11 lines · Tony Prisk

This patch adds support for the GPIO/pinmux controller found on the VIA VT8500 and Wondermedia WM8xxx-series SoCs.

Each pin within the controller is capable of operating as a GPIO or as an alternate function. The pins are numbered according to their control bank/bit so that if new pins are added, the existing numbering is maintained.

All currently supported SoCs are included: VT8500, WM8505, WM8650, WM8750 and WM8850.

Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt line 14

Quoted 6 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt +4 -0
 
+Required properties:
 
+- gpio-controller: Marks the device node as a GPIO controller.
+- #gpio-cells : Should be two. The first cell is the pin number and the
+  second cell is used to specify optional parameters.

What are those optional parameters? This binding should define them.

Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt line 18

Quoted 3 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt +3 -0
+Optional properties:
+- wm,pinmux: A value and mask pair describing the configuration changes to
+  the pinmux register. Only bits marked 1 in the mask will be changed.

This needs more explanation. What does this do and why is it needed?

Other than that, this binding looks fine.

author
#8 lore raw

PATCH v2 3/7 pinctrl: gpio: vt8500: Add pincontrol driver for arch-vt8500

Quoted 13 lines · Stephen Warren
Quoted 11 lines · Tony Prisk

This patch adds support for the GPIO/pinmux controller found on the VIA VT8500 and Wondermedia WM8xxx-series SoCs.

Each pin within the controller is capable of operating as a GPIO or as an alternate function. The pins are numbered according to their control bank/bit so that if new pins are added, the existing numbering is maintained.

All currently supported SoCs are included: VT8500, WM8505, WM8650, WM8750 and WM8850.

Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt +0 -0
Quoted 7 lines

Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt line 14

Quoted 5 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt +4 -0
+Required properties:
 
+- gpio-controller: Marks the device node as a GPIO controller.
+- #gpio-cells : Should be two. The first cell is the pin number and the
+  second cell is used to specify optional parameters.

What are those optional parameters? This binding should define them.

There are actually no optional parameters at the moment - but there will be at some point. In our original GPIO driver binding it was suggested that a flags cell be added. When moving it to the pinctrl driver binding, the bank + pin number cells were combined as we have linear numbering now, and the flags property was retained.

- #gpio-cells : should be <3>.
1) bank
2) pin number
3) flags - should be 0

I will clarify this in the next version.

Quoted 6 lines

Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt line 18

Quoted 4 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt +3 -0
+Optional properties:
+- wm,pinmux: A value and mask pair describing the configuration changes to
+  the pinmux register. Only bits marked 1 in the mask will be changed.

This needs more explanation. What does this do and why is it needed?

This is the bit that is causing most of the trouble with this patchset.

This binding exposes a 32-bit register which is basically a mux register, but a messy one at that.

The bit values seem to change on each of the different SoCs, we have no hardware docs for most of the later SoCs so it's very much guess-work. Because we don't have the doc's, we don't know which pins are function-swapped when changing bits in this register so writing a proper pinmux driver is impossible.

We currently only use this register to ensure the DVO/LCD output is enabled for the framebuffer driver. On the vt8500 SoC, this is bit 0 - all later SoCs use bit 31.

I exposed it this was so that we don't need to change anything in the future as new functions are found. The DTS can be modified to enable/disable the functions directly. It would make even more sense once we get a C header or similar with #define's to describe what each bit does.

Given the confusion/hesitation around this one property, I am tempted to drop it from the patchset and leave the original code in arch/arm/vt8500.c to enable the LCD output.

Quoted 1 line

Other than that, this binding looks fine.

Regards

Tony Prisk

#9 lore raw

PATCH v2 3/7 pinctrl: gpio: vt8500: Add pincontrol driver for arch-vt8500

Quoted 28 lines · Tony Prisk
Quoted 13 lines · Stephen Warren
Quoted 11 lines · Tony Prisk

This patch adds support for the GPIO/pinmux controller found on the VIA VT8500 and Wondermedia WM8xxx-series SoCs.

Each pin within the controller is capable of operating as a GPIO or as an alternate function. The pins are numbered according to their control bank/bit so that if new pins are added, the existing numbering is maintained.

All currently supported SoCs are included: VT8500, WM8505, WM8650, WM8750 and WM8850.

Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt +0 -0
Quoted 7 lines

Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt line 14

Quoted 5 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt +4 -0
+Required properties:
 
+- gpio-controller: Marks the device node as a GPIO controller.
+- #gpio-cells : Should be two. The first cell is the pin number and the
+  second cell is used to specify optional parameters.

What are those optional parameters? This binding should define them.

There are actually no optional parameters at the moment - but there will be at some point. In our original GPIO driver binding it was suggested that a flags cell be added. When moving it to the pinctrl driver binding, the bank + pin number cells were combined as we have linear numbering now, and the flags property was retained.

Quoted 6 lines

- #gpio-cells : should be <3>.
1) bank
2) pin number
3) flags - should be 0

I will clarify this in the next version.

I think you should define a flag for inverted or active-low. This is typically bit 0 in the flags cell.

Quoted 27 lines
Quoted 5 lines

Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt line 18

Quoted 3 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt +3 -0
+Optional properties:
+- wm,pinmux: A value and mask pair describing the configuration changes to
+  the pinmux register. Only bits marked 1 in the mask will be changed.

This needs more explanation. What does this do and why is it needed?

This is the bit that is causing most of the trouble with this patchset.

This binding exposes a 32-bit register which is basically a mux register, but a messy one at that.

The bit values seem to change on each of the different SoCs, we have no hardware docs for most of the later SoCs so it's very much guess-work. Because we don't have the doc's, we don't know which pins are function-swapped when changing bits in this register so writing a proper pinmux driver is impossible.

We currently only use this register to ensure the DVO/LCD output is enabled for the framebuffer driver. On the vt8500 SoC, this is bit 0 - all later SoCs use bit 31.

I exposed it this was so that we don't need to change anything in the future as new functions are found. The DTS can be modified to enable/disable the functions directly. It would make even more sense once we get a C header or similar with #define's to describe what each bit does.

Quoted 3 lines

Given the confusion/hesitation around this one property, I am tempted to drop it from the patchset and leave the original code in arch/arm/vt8500.c to enable the LCD output.

Oh yes, this doesn't sound very good.

Why can't you write a driver without complete knowledge? That driver would simply only support 1 pin/pingroup, and 1 (or I guess 2?) functions that can be mux'd onto it. If more is discovered about the HW later, can't more pins/groups/functions be added in a backwards-compatible fashion?

If you take that approach, you can define a regular driver from the start without the need for any unusual DT properties.

If you want the DT itself to describe the legal set of pins/groups/functions and combinations thereof, so that only DT edits and not driver changes are required once future HW knowledge becomes available, I think you'd want some far more complete and generic DT binding than a single "wm,pinmux" property, which has a rather generic name, but rather specific usage.

author
#10 lore raw

PATCH v2 3/7 pinctrl: gpio: vt8500: Add pincontrol driver for arch-vt8500

Quoted 66 lines · Stephen Warren
Quoted 28 lines · Tony Prisk
Quoted 13 lines · Stephen Warren
Quoted 11 lines · Tony Prisk

This patch adds support for the GPIO/pinmux controller found on the VIA VT8500 and Wondermedia WM8xxx-series SoCs.

Each pin within the controller is capable of operating as a GPIO or as an alternate function. The pins are numbered according to their control bank/bit so that if new pins are added, the existing numbering is maintained.

All currently supported SoCs are included: VT8500, WM8505, WM8650, WM8750 and WM8850.

Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt +0 -0
Quoted 7 lines

Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt line 14

Quoted 5 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt +4 -0
+Required properties:
 
+- gpio-controller: Marks the device node as a GPIO controller.
+- #gpio-cells : Should be two. The first cell is the pin number and the
+  second cell is used to specify optional parameters.

What are those optional parameters? This binding should define them.

There are actually no optional parameters at the moment - but there will be at some point. In our original GPIO driver binding it was suggested that a flags cell be added. When moving it to the pinctrl driver binding, the bank + pin number cells were combined as we have linear numbering now, and the flags property was retained.

Quoted 6 lines

- #gpio-cells : should be <3>.
1) bank
2) pin number
3) flags - should be 0

I will clarify this in the next version.

I think you should define a flag for inverted or active-low. This is typically bit 0 in the flags cell.

Quoted 27 lines
Quoted 5 lines

Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt line 18

Quoted 3 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt +3 -0
+Optional properties:
+- wm,pinmux: A value and mask pair describing the configuration changes to
+  the pinmux register. Only bits marked 1 in the mask will be changed.

This needs more explanation. What does this do and why is it needed?

This is the bit that is causing most of the trouble with this patchset.

This binding exposes a 32-bit register which is basically a mux register, but a messy one at that.

The bit values seem to change on each of the different SoCs, we have no hardware docs for most of the later SoCs so it's very much guess-work. Because we don't have the doc's, we don't know which pins are function-swapped when changing bits in this register so writing a proper pinmux driver is impossible.

We currently only use this register to ensure the DVO/LCD output is enabled for the framebuffer driver. On the vt8500 SoC, this is bit 0 - all later SoCs use bit 31.

I exposed it this was so that we don't need to change anything in the future as new functions are found. The DTS can be modified to enable/disable the functions directly. It would make even more sense once we get a C header or similar with #define's to describe what each bit does.

Quoted 5 lines
Quoted 3 lines

Given the confusion/hesitation around this one property, I am tempted to drop it from the patchset and leave the original code in arch/arm/vt8500.c to enable the LCD output.

Oh yes, this doesn't sound very good.

Will look at this before the next version.

Quoted 7 lines

Why can't you write a driver without complete knowledge? That driver would simply only support 1 pin/pingroup, and 1 (or I guess 2?) functions that can be mux'd onto it. If more is discovered about the HW later, can't more pins/groups/functions be added in a backwards-compatible fashion?

This is what we have now - we have 1 pin/pingroup, and 1 alt func.

The problem is, using the LCD example above, we don't specifically know which pins are affected when we set the 'DVO enable' bit on the pinmux register, but if we don't set the bit, the LCD output is disabled.

When we set bit 31 of pinmux, the DVO output pins are changed to make the LCD work. If we clear bit 31, some of those pins become the CCIR function, and other's become something else.

I couldn't add it as a 2nd alt func, because it can't be set per-pin, it applies to a group of pins.

To complicate matters, some of the bits in the pinmux register are simple dis(en)able bits, others are alt-func type bits (0=CCIR, 1=DVO) etc.

If I knew which pins were affected for each function I would have written it as a proper pinmux driver with pin groups, but I couldn't see how to apply the pinmux function around what this register does.

Quoted 9 lines

If you take that approach, you can define a regular driver from the start without the need for any unusual DT properties.

If you want the DT itself to describe the legal set of pins/groups/functions and combinations thereof, so that only DT edits and not driver changes are required once future HW knowledge becomes available, I think you'd want some far more complete and generic DT binding than a single "wm,pinmux" property, which has a rather generic name, but rather specific usage.

Regards
Tony P

#11 lore raw

PATCH v2 3/7 pinctrl: gpio: vt8500: Add pincontrol driver for arch-vt8500

Quoted 52 lines · Tony Prisk
Quoted 42 lines · Stephen Warren
Quoted 41 lines · Tony Prisk
Quoted 11 lines · Stephen Warren
Quoted 9 lines · Tony Prisk

This patch adds support for the GPIO/pinmux controller found on the VIA VT8500 and Wondermedia WM8xxx-series SoCs.

Each pin within the controller is capable of operating as a GPIO or as an alternate function. The pins are numbered according to their control bank/bit so that if new pins are added, the existing numbering is maintained.

All currently supported SoCs are included: VT8500, WM8505, WM8650, WM8750 and WM8850.

Quoted 7 lines

Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt line 18

Quoted 5 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt +3 -0
 
+Optional properties:
+- wm,pinmux: A value and mask pair describing the configuration changes to
+  the pinmux register. Only bits marked 1 in the mask will be changed.

This needs more explanation. What does this do and why is it needed?

This is the bit that is causing most of the trouble with this patchset.

This binding exposes a 32-bit register which is basically a mux register, but a messy one at that.

The bit values seem to change on each of the different SoCs, we have no hardware docs for most of the later SoCs so it's very much guess-work. Because we don't have the doc's, we don't know which pins are function-swapped when changing bits in this register so writing a proper pinmux driver is impossible.

We currently only use this register to ensure the DVO/LCD output is enabled for the framebuffer driver. On the vt8500 SoC, this is bit 0 - all later SoCs use bit 31.

I exposed it this was so that we don't need to change anything in the future as new functions are found. The DTS can be modified to enable/disable the functions directly. It would make even more sense once we get a C header or similar with #define's to describe what each bit does.

Quoted 5 lines
Quoted 3 lines

Given the confusion/hesitation around this one property, I am tempted to drop it from the patchset and leave the original code in arch/arm/vt8500.c to enable the LCD output.

Oh yes, this doesn't sound very good.

Will look at this before the next version.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

Why can't you write a driver without complete knowledge? That driver would simply only support 1 pin/pingroup, and 1 (or I guess 2?) functions that can be mux'd onto it. If more is discovered about the HW later, can't more pins/groups/functions be added in a backwards-compatible fashion?

This is what we have now - we have 1 pin/pingroup, and 1 alt func.

Given the description below, I think there are two functions; LCD and CCIR?

Quoted 3 lines

The problem is, using the LCD example above, we don't specifically know which pins are affected when we set the 'DVO enable' bit on the pinmux register, but if we don't set the bit, the LCD output is disabled.

It almost sounds as if there isn't enough information to even know that the HW module is a pinmux rather than something else?

Quoted 6 lines

When we set bit 31 of pinmux, the DVO output pins are changed to make the LCD work. If we clear bit 31, some of those pins become the CCIR function, and other's become something else.

I couldn't add it as a 2nd alt func, because it can't be set per-pin, it applies to a group of pins.

The pinctrl subsystem certainly supports muxing on groups of pins at once. I don't think that should be an issue.

Quoted 3 lines

To complicate matters, some of the bits in the pinmux register are simple dis(en)able bits, others are alt-func type bits (0=CCIR, 1=DVO) etc.

I think that's an internal detail of the HW that the driver can hide quite easily.

Quoted 3 lines

If I knew which pins were affected for each function I would have written it as a proper pinmux driver with pin groups, but I couldn't see how to apply the pinmux function around what this register does.

I think you can define just pins/groups/functions in the driver that are currently known about. Certainly you must know at least some of the pins that are affected by that CCIR/DVO bit, simply because they are the pins that you care about working. So, include just those pins in the group definition for the LCD/CCIR group for now. The set of known pins/groups/functions, and the set of pins within each group, can easily be added to later without affecting the DT binding; it's simply that additional values might be valid in the DT later, but not now, right?

author
#12 lore raw

PATCH v2 3/7 pinctrl: gpio: vt8500: Add pincontrol driver for arch-vt8500

In reply to Stephen Warren
Quoted 34 lines · Stephen Warren
Quoted 33 lines · Tony Prisk
Quoted 13 lines · Stephen Warren
Quoted 11 lines · Tony Prisk

This patch adds support for the GPIO/pinmux controller found on the VIA VT8500 and Wondermedia WM8xxx-series SoCs.

Each pin within the controller is capable of operating as a GPIO or as an alternate function. The pins are numbered according to their control bank/bit so that if new pins are added, the existing numbering is maintained.

All currently supported SoCs are included: VT8500, WM8505, WM8650, WM8750 and WM8850.

Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt +0 -0
Quoted 7 lines

Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt line 14

Quoted 5 lines
Documentation/devicetree/bindings/pinctrl/pinctrl-vt8500.txt +4 -0
+Required properties:
 
+- gpio-controller: Marks the device node as a GPIO controller.
+- #gpio-cells : Should be two. The first cell is the pin number and the
+  second cell is used to specify optional parameters.

What are those optional parameters? This binding should define them.

There are actually no optional parameters at the moment - but there will be at some point. In our original GPIO driver binding it was suggested that a flags cell be added. When moving it to the pinctrl driver binding, the bank + pin number cells were combined as we have linear numbering now, and the flags property was retained.

- #gpio-cells : should be <3>.
1) bank
2) pin number
3) flags - should be 0

Quoted 5 lines
Quoted 1 line

I will clarify this in the next version.

I think you should define a flag for inverted or active-low. This is typically bit 0 in the flags cell.
...

Stephen,

Do you know if there is an example of this somewhere I can look at?

I did a quick search through the documentation for pinctrl and gpio, but I can't find any code for defining active-low in the gpio flags. There seems to be plenty for defining interrupt 'modes' but nothing for setting active-low.

I also couldn't see anywhere where it was possible to interpret the flags that are passed in. Assuming I add an .of_xlate, and pass, for example, *flags = gpiospec[2] I can't see anywhere later on where I get the chance to 'decode' the flags to perform the specific configurations.

Any advice appreciated.

Regards
Tony P

#13 lore raw

PATCH v2 3/7 pinctrl: gpio: vt8500: Add pincontrol driver for arch-vt8500

Quoted 2 lines · Tony Prisk
Quoted 1 line · Stephen Warren

On 03/25/2013 12:51 PM, Tony Prisk wrote:

...

Quoted 11 lines
Quoted 10 lines
Quoted 6 lines

- #gpio-cells : should be <3>.
1) bank
2) pin number
3) flags - should be 0

I will clarify this in the next version.

I think you should define a flag for inverted or active-low. This is typically bit 0 in the flags cell.
...

Quoted 8 lines

Stephen,

Do you know if there is an example of this somewhere I can look at?

I did a quick search through the documentation for pinctrl and gpio, but I can't find any code for defining active-low in the gpio flags. There seems to be plenty for defining interrupt 'modes' but nothing for setting active-low.

Interrupt modes would be for the IRQ binding, not the GPIO binding.

For an example, see:

Documentation/devicetree/bindings/gpio/

Quoted 5 lines

grep -i polarity *

gpio-74x164.txt:  the second cell is used to specify the gpio polarity:
gpio-adnp.txt:  - bit 0: polarity (0: normal, 1: inverted)
gpio_lpc32xx.txt:      - bit 0 specifies polarity (0 for normal, 1 for inverted)
gpio-mxs.txt:  the second cell is used to specify the gpio polarity:
Quoted 7 lines

nvidia,tegra20-gpio.txt: - bit 0 specifies polarity (0 for normal, 1 for inverted) pl061-gpio.txt: - bit 0 specifies polarity (0 for normal, 1 for inverted)

I also couldn't see anywhere where it was possible to interpret the flags that are passed in. Assuming I add an .of_xlate, and pass, for example, *flags = gpiospec[2] I can't see anywhere later on where I get the chance to 'decode' the flags to perform the specific configurations.

of_get_named_gpio_flags() will return the flags.

For an example usage, see:

Quoted 1 line

drivers/mmc/core/host.c:369: gpio = of_get_named_gpio_flags(np, "cd-gpios", 0, &flags);

(it's at that line in next-20130325 at least)

author
#14 lore raw

PATCH v2 3/7 pinctrl: gpio: vt8500: Add pincontrol driver for arch-vt8500

Quoted 43 lines · Stephen Warren
Quoted 2 lines · Tony Prisk
Quoted 1 line · Stephen Warren

On 03/25/2013 12:51 PM, Tony Prisk wrote:

...

Quoted 11 lines
Quoted 10 lines
Quoted 6 lines

- #gpio-cells : should be <3>.
1) bank
2) pin number
3) flags - should be 0

I will clarify this in the next version.

I think you should define a flag for inverted or active-low. This is typically bit 0 in the flags cell.
...

Quoted 8 lines

Stephen,

Do you know if there is an example of this somewhere I can look at?

I did a quick search through the documentation for pinctrl and gpio, but I can't find any code for defining active-low in the gpio flags. There seems to be plenty for defining interrupt 'modes' but nothing for setting active-low.

Interrupt modes would be for the IRQ binding, not the GPIO binding.

For an example, see:

Documentation/devicetree/bindings/gpio/

Quoted 5 lines

grep -i polarity *

gpio-74x164.txt:  the second cell is used to specify the gpio polarity:
gpio-adnp.txt:  - bit 0: polarity (0: normal, 1: inverted)
gpio_lpc32xx.txt:      - bit 0 specifies polarity (0 for normal, 1 for inverted)
gpio-mxs.txt:  the second cell is used to specify the gpio polarity:
Quoted 7 lines

nvidia,tegra20-gpio.txt: - bit 0 specifies polarity (0 for normal, 1 for inverted) pl061-gpio.txt: - bit 0 specifies polarity (0 for normal, 1 for inverted)

I also couldn't see anywhere where it was possible to interpret the flags that are passed in. Assuming I add an .of_xlate, and pass, for example, *flags = gpiospec[2] I can't see anywhere later on where I get the chance to 'decode' the flags to perform the specific configurations.

Quoted 8 lines

of_get_named_gpio_flags() will return the flags.

For an example usage, see:

Quoted 1 line

drivers/mmc/core/host.c:369: gpio = of_get_named_gpio_flags(np, "cd-gpios", 0, &flags);

(it's at that line in next-20130325 at least)

Thanks Stephen, I will take a look at this and get it sorted for the next version.

Regards
Tony P

author
#15 lore raw

PATCH v2 4/7 arm: dts: vt8500: Update Wondermedia SoC dtsi files for pinctrl driver

In reply to Tony Prisk

This patch adds pinctrl nodes to the VIA VT8500 and Wondermedia SoC dtsi files to support the pinctrl driver.

---
 arch/arm/boot/dts/vt8500.dtsi |    8 ++++++++
 arch/arm/boot/dts/wm8505.dtsi |    8 ++++++++
 arch/arm/boot/dts/wm8650.dtsi |    8 ++++++++
 arch/arm/boot/dts/wm8850.dtsi |    8 ++++++++
 4 files changed, 32 insertions(+)
arch/arm/boot/dts/vt8500.dtsi +8 -0
index cf31ced..16388c2 100644
@@ -32,6 +32,14 @@
 			#gpio-cells = <3>;
 		};
 
+		pinctrl: pinctrl at d8110000 {
+			compatible = "via,vt8500-pinctrl";
+			gpio-controller;
+			reg = <0xd8110000 0x10000>;
+			#gpio-cells = <2>;
+			wm,pinmux = <0x00000001 0x00000001>;
+		};
+
 		pmc at d8130000 {
 			compatible = "via,vt8500-pmc";
 			reg = <0xd8130000 0x1000>;
arch/arm/boot/dts/wm8505.dtsi +8 -0
index e74a1c0..c5aa4c9 100644
@@ -47,6 +47,14 @@
 			#gpio-cells = <3>;
 		};
 
+		pinctrl: pinctrl at d8110000 {
+			compatible = "wm,wm8505-pinctrl";
+			gpio-controller;
+			reg = <0xd8110000 0x10000>;
+			#gpio-cells = <2>;
+			wm,pinmux = <0x80000000 0x80000000>;
+		};
+
 		pmc at d8130000 {
 			compatible = "via,vt8500-pmc";
 			reg = <0xd8130000 0x1000>;
arch/arm/boot/dts/wm8650.dtsi +8 -0
index db3c0a1..99c45e5 100644
@@ -41,6 +41,14 @@
 			#gpio-cells = <3>;
 		};
 
+		pinctrl: pinctrl at d8110000 {
+			compatible = "wm,wm8650-pinctrl";
+			gpio-controller;
+			reg = <0xd8110000 0x10000>;
+			#gpio-cells = <2>;
+			wm,pinmux = <0x80000000 0x80000000>;
+		};
+
 		pmc at d8130000 {
 			compatible = "via,vt8500-pmc";
 			reg = <0xd8130000 0x1000>;
arch/arm/boot/dts/wm8850.dtsi +8 -0
index e8cbfdc..60094cd 100644
@@ -48,6 +48,14 @@
 			#gpio-cells = <3>;
 		};
 
+		pinctrl: pinctrl at d8110000 {
+			compatible = "wm,wm8850-pinctrl";
+			gpio-controller;
+			reg = <0xd8110000 0x10000>;
+			#gpio-cells = <2>;
+			wm,pinmux = <0x80000000 0x80000000>;
+		};
+
 		pmc at d8130000 {
 			compatible = "via,vt8500-pmc";
 			reg = <0xd8130000 0x1000>;
Signature · 1 line
1.7.9.5
author
#16 lore raw

PATCH v2 5/7 arm: vt8500: Remove gpio devicetree nodes

In reply to Tony Prisk

Remove the gpio related devicetree nodes as these are no longer required with the move to a combined pinctrl/gpio driver.

---
 arch/arm/boot/dts/vt8500.dtsi |    7 -------
 arch/arm/boot/dts/wm8505.dtsi |    7 -------
 arch/arm/boot/dts/wm8650.dtsi |    7 -------
 arch/arm/boot/dts/wm8850.dtsi |    7 -------
 4 files changed, 28 deletions(-)
arch/arm/boot/dts/vt8500.dtsi +0 -7
index 16388c2..e0ce0b9 100644
@@ -25,13 +25,6 @@
 			#interrupt-cells = <1>;
 		};
 
-		gpio: gpio-controller at d8110000 {
-			compatible = "via,vt8500-gpio";
-			gpio-controller;
-			reg = <0xd8110000 0x10000>;
-			#gpio-cells = <3>;
-		};
-
 		pinctrl: pinctrl at d8110000 {
 			compatible = "via,vt8500-pinctrl";
 			gpio-controller;
arch/arm/boot/dts/wm8505.dtsi +0 -7
index c5aa4c9..5c7ad12 100644
@@ -40,13 +40,6 @@
 			interrupts = <56 57 58 59 60 61 62 63>;
 		};
 
-		gpio: gpio-controller at d8110000 {
-			compatible = "wm,wm8505-gpio";
-			gpio-controller;
-			reg = <0xd8110000 0x10000>;
-			#gpio-cells = <3>;
-		};
-
 		pinctrl: pinctrl at d8110000 {
 			compatible = "wm,wm8505-pinctrl";
 			gpio-controller;
arch/arm/boot/dts/wm8650.dtsi +0 -7
index 99c45e5..984d0ed 100644
@@ -34,13 +34,6 @@
 			interrupts = <56 57 58 59 60 61 62 63>;
 		};
 
-		gpio: gpio-controller at d8110000 {
-			compatible = "wm,wm8650-gpio";
-			gpio-controller;
-			reg = <0xd8110000 0x10000>;
-			#gpio-cells = <3>;
-		};
-
 		pinctrl: pinctrl at d8110000 {
 			compatible = "wm,wm8650-pinctrl";
 			gpio-controller;
arch/arm/boot/dts/wm8850.dtsi +0 -7
index 60094cd..01d67bf 100644
@@ -41,13 +41,6 @@
 			interrupts = <56 57 58 59 60 61 62 63>;
 		};
 
-		gpio: gpio-controller at d8110000 {
-			compatible = "wm,wm8650-gpio";
-			gpio-controller;
-			reg = <0xd8110000 0x10000>;
-			#gpio-cells = <3>;
-		};
-
 		pinctrl: pinctrl at d8110000 {
 			compatible = "wm,wm8850-pinctrl";
 			gpio-controller;
Signature · 1 line
1.7.9.5
author
#17 lore raw

PATCH v2 6/7 gpio: vt8500: Remove arch-vt8500 gpio driver

In reply to Tony Prisk

With the move to a combined pinctrl/gpio driver, the arch-vt8500 gpio driver is no longer required.

---
 drivers/gpio/Kconfig       |    6 -
 drivers/gpio/Makefile      |    1 -
 drivers/gpio/gpio-vt8500.c |  355 --------------------------------------------
 3 files changed, 362 deletions(-)
 delete mode 100644 drivers/gpio/gpio-vt8500.c
drivers/gpio/Kconfig +0 -6
index 93aaadf..b166e30 100644
@@ -227,12 +227,6 @@ config GPIO_TS5500
 	  blocks of the TS-5500: DIO1, DIO2 and the LCD port, and the TS-5600
 	  LCD port.
 
-config GPIO_VT8500
-	bool "VIA/Wondermedia SoC GPIO Support"
-	depends on ARCH_VT8500
-	help
-	  Say yes here to support the VT8500/WM8505/WM8650 GPIO controller.
-
 config GPIO_XILINX
 	bool "Xilinx GPIO support"
 	depends on PPC_OF || MICROBLAZE
drivers/gpio/Makefile +0 -1
index 22e07bc..a274d7d 100644
@@ -80,7 +80,6 @@ obj-$(CONFIG_GPIO_TWL6040)	+= gpio-twl6040.o
 obj-$(CONFIG_GPIO_UCB1400)	+= gpio-ucb1400.o
 obj-$(CONFIG_GPIO_VIPERBOARD)	+= gpio-viperboard.o
 obj-$(CONFIG_GPIO_VR41XX)	+= gpio-vr41xx.o
-obj-$(CONFIG_GPIO_VT8500)	+= gpio-vt8500.o
 obj-$(CONFIG_GPIO_VX855)	+= gpio-vx855.o
 obj-$(CONFIG_GPIO_WM831X)	+= gpio-wm831x.o
 obj-$(CONFIG_GPIO_WM8350)	+= gpio-wm8350.o
drivers/gpio/gpio-vt8500.c deleted +0 -355

355 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author
#18 lore raw

PATCH v2 7/7 arm: vt8500: Remove pinmux configuration from mach-vt8500/vt8500.c

In reply to Tony Prisk

With the new pinctrl driver and wm,pinmux property the configuration code required for initializing the framebuffer hardware can be removed from vt8500.c and configured in devicetree with pinctrl driver properties.

---
 arch/arm/mach-vt8500/vt8500.c |   70 +----------------------------------------
 1 file changed, 1 insertion(+), 69 deletions(-)
arch/arm/mach-vt8500/vt8500.c +1 -69
index 49e8005..b06b7fc 100644
@@ -34,12 +34,8 @@
 
 #include "common.h"
 
-#define LEGACY_GPIO_BASE	0xD8110000
 #define LEGACY_PMC_BASE		0xD8130000
 
-/* Registers in GPIO Controller */
-#define VT8500_GPIO_MUX_REG	0x200
-
 /* Registers in Power Management Controller */
 #define VT8500_HCR_REG		0x12
 #define VT8500_PMSR_REG		0x60
@@ -77,71 +73,6 @@ static void vt8500_power_off(void)
 void __init vt8500_init(void)
 {
 	struct device_node *np;
-#if defined(CONFIG_FB_VT8500) || defined(CONFIG_FB_WM8505)
-	struct device_node *fb;
-	void __iomem *gpio_base;
-#endif
-
-#ifdef CONFIG_FB_VT8500
-	fb = of_find_compatible_node(NULL, NULL, "via,vt8500-fb");
-	if (fb) {
-		np = of_find_compatible_node(NULL, NULL, "via,vt8500-gpio");
-		if (np) {
-			gpio_base = of_iomap(np, 0);
-
-			if (!gpio_base)
-				pr_err("%s: of_iomap(gpio_mux) failed\n",
-								__func__);
-
-			of_node_put(np);
-		} else {
-			gpio_base = ioremap(LEGACY_GPIO_BASE, 0x1000);
-			if (!gpio_base)
-				pr_err("%s: ioremap(legacy_gpio_mux) failed\n",
-								__func__);
-		}
-		if (gpio_base) {
-			writel(readl(gpio_base + VT8500_GPIO_MUX_REG) | 1,
-				gpio_base + VT8500_GPIO_MUX_REG);
-			iounmap(gpio_base);
-		} else
-			pr_err("%s: Could not remap GPIO mux\n", __func__);
-
-		of_node_put(fb);
-	}
-#endif
-
-#ifdef CONFIG_FB_WM8505
-	fb = of_find_compatible_node(NULL, NULL, "wm,wm8505-fb");
-	if (fb) {
-		np = of_find_compatible_node(NULL, NULL, "wm,wm8505-gpio");
-		if (!np)
-			np = of_find_compatible_node(NULL, NULL,
-							"wm,wm8650-gpio");
-		if (np) {
-			gpio_base = of_iomap(np, 0);
-
-			if (!gpio_base)
-				pr_err("%s: of_iomap(gpio_mux) failed\n",
-								__func__);
-
-			of_node_put(np);
-		} else {
-			gpio_base = ioremap(LEGACY_GPIO_BASE, 0x1000);
-			if (!gpio_base)
-				pr_err("%s: ioremap(legacy_gpio_mux) failed\n",
-								__func__);
-		}
-		if (gpio_base) {
-			writel(readl(gpio_base + VT8500_GPIO_MUX_REG) |
-				0x80000000, gpio_base + VT8500_GPIO_MUX_REG);
-			iounmap(gpio_base);
-		} else
-			pr_err("%s: Could not remap GPIO mux\n", __func__);
-
-		of_node_put(fb);
-	}
-#endif
 
 	np = of_find_compatible_node(NULL, NULL, "via,vt8500-pmc");
 	if (np) {
@@ -156,6 +87,7 @@ void __init vt8500_init(void)
 		if (!pmc_base)
 			pr_err("%s:ioremap(power_off) failed\n", __func__);
 	}
+
 	if (pmc_base)
 		pm_power_off = &vt8500_power_off;
 	else
Signature · 1 line
1.7.9.5