arm: vt8500: Add support for pinctrl/gpio module
Subsystems (7)
v5 cover arm: vt8500: Add support for pinctrl/gpio module
v5 changes:
Changed as requested by Rob Herring:
Added of_find_property_value_of_size() to drivers/of/base.c to remove some code that was being duplicated.
Changed as requested by Stephen Warren:
Redid the kfree(maps) code as devm_kzalloc would cause issues. We now kzalloc maps all at once, and configs as required. A call to wmt_pctl_dt_free_map() is used to kfree the allocated blocks if we fail early.
v4 changes:
Changed as requested by Stephen Warren:
Corrected the range checking in of_property_read_u32_index(). Fix configs[0] assignment in wmt_pctl_dt_node_to_map_pull(). Remove the kfree(maps) call, and use devm_kzalloc to simplify the fail path. Drop the custom .of_xlate function and use the default of_gpio_simple_xlate. Move the platform memory mapping from per-soc to common init.
v3 changes:
Rebased onto v3.9-rc4
Added the missing interrupt-controller info to the relevant dtsi files. Removed the gpio-vt8500.txt binding along with the gpio driver.
Changes made as requested by Linux Walleij:
Removed the wm,pinmux property which has caused too much confusion, and left the
open-coded version in arm/arch-vt8500/vt8500.c until a proper solution is sorted out.
Changes made as requested by Stephen Warren:
Defined an active-low flag for gpio since its useful and we will have a use-case
for it with our LCD power-on/off.
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.
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 required for the new driver to function properly. Patch 2 is independant, but required for the driver to function properly. Patches 3-4 are pinctrl/gpio patches.
Patch 5-6 remove the old gpio code which is no longer required.
Patch 2 could go via arm-soc if necessary.
Regards
Tony Prisk
Tony Prisk (7):
of: Add support for reading a u32 from a multi-value property.
of: Remove duplicated code for validating property and value
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
.../devicetree/bindings/gpio/gpio-vt8500.txt | 24 - .../devicetree/bindings/pinctrl/pinctrl-vt8500.txt | 57 ++ arch/arm/Kconfig | 3 +- arch/arm/boot/dts/vt8500.dtsi | 10 +- arch/arm/boot/dts/wm8505.dtsi | 10 +- arch/arm/boot/dts/wm8650.dtsi | 10 +- arch/arm/boot/dts/wm8850.dtsi | 10 +- arch/arm/mach-vt8500/Kconfig | 1 + drivers/gpio/Kconfig | 6 - drivers/gpio/Makefile | 1 - drivers/gpio/gpio-vt8500.c | 355 ----------- drivers/of/base.c | 111 ++-- drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/vt8500/Kconfig | 52 ++ drivers/pinctrl/vt8500/Makefile | 8 + drivers/pinctrl/vt8500/pinctrl-vt8500.c | 501 ++++++++++++++++ drivers/pinctrl/vt8500/pinctrl-wm8505.c | 532 ++++++++++++++++ drivers/pinctrl/vt8500/pinctrl-wm8650.c | 370 ++++++++++++ drivers/pinctrl/vt8500/pinctrl-wm8750.c | 409 +++++++++++++ drivers/pinctrl/vt8500/pinctrl-wm8850.c | 388 ++++++++++++ drivers/pinctrl/vt8500/pinctrl-wmt.c | 632 ++++++++++++++++++++ drivers/pinctrl/vt8500/pinctrl-wmt.h | 79 +++ include/linux/of.h | 9 + 24 files changed, 3142 insertions(+), 438 deletions(-) delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-vt8500.txt 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
PATCH v5 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.
--- drivers/of/base.c | 33 +++++++++++++++++++++++++++++++++ include/linux/of.h | 9 +++++++++ 2 files changed, 42 insertions(+)
drivers/of/base.c +33 -0
@@ -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 +1 ) *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
@@ -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
PATCH v5 2/7 of: Remove duplicated code for validating property and value
In reply to Tony PriskSeveral functions in of/base.c have the same code duplicated for finding and validating a property and value.
struct property *prop = of_find_property(np, propname, NULL); if (!prop)
return -EINVAL; if (!prop->value) return -ENODATA; if (<some length> > prop->length) return -EOVERFLOW;
This patch adds of_find_property_value_of_size() which performs the equivalent of the above code and removes the instances where it was duplicated in several functions.
--- drivers/of/base.c | 94 +++++++++++++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 43 deletions(-)
drivers/of/base.c +51 -43
@@ -746,6 +746,34 @@ struct device_node *of_find_node_by_phandle(phandle handle)EXPORT_SYMBOL (of_find_node_by_phandle);/** +* of_find_property_value_of_size +* +* @np: device node from which the property value is to be read. +* @propname: name of the property to be searched. +* @len: requested length of property value +* +* Search for a property in a device node and valid the requested size. +* Returns the property value 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. +* +*/ +static void *of_find_property_value_of_size (const struct device_node *np, +const char *propname,u32 len) +{ +struct property *prop =of_find_property (np, propname,NULL ); + +if (!prop) +return ERR_PTR (-EINVAL ); +if (!prop->value) +return ERR_PTR (-ENODATA ); +if (len > prop->length) +return ERR_PTR (-EOVERFLOW ); + +return prop->value; +} + +/** * 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.
@@ -764,16 +792,13 @@ 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); + const u32 *val = of_find_property_value_of_size(np, propname, + ((index +1 ) *sizeof (*out_value))); -if (!prop) -return -EINVAL ; -if (!prop->value) -return -ENODATA ; -if (((index +1 ) *sizeof (*out_value)) > prop->length) -return -EOVERFLOW ; +if (IS_ERR (val)) +return PTR_ERR (val); - *out_value =be32_to_cpup (((__be32 *)prop->value) + index); + *out_value =be32_to_cpup (((__be32 *)val) + index);return 0 ; }EXPORT_SYMBOL_GPL (of_property_read_u32_index);
@@ -799,17 +824,12 @@ EXPORT_SYMBOL_GPL(of_property_read_u32_index);int of_property_read_u8_array (const struct device_node *np,const char *propname,u8 *out_values,size_t sz) { -struct property *prop =of_find_property (np, propname,NULL ); -const u8 *val; +const u8 *val =of_find_property_value_of_size (np, propname, + (sz *sizeof (*out_values))); -if (!prop) -return -EINVAL ; -if (!prop->value) -return -ENODATA ; -if ((sz *sizeof (*out_values)) > prop->length) -return -EOVERFLOW ; +if (IS_ERR (val)) +return PTR_ERR (val); - val = prop->value;while (sz--) *out_values++ = *val++;return 0 ;
@@ -837,17 +857,12 @@ EXPORT_SYMBOL_GPL(of_property_read_u8_array);int of_property_read_u16_array (const struct device_node *np,const char *propname,u16 *out_values,size_t sz) { -struct property *prop =of_find_property (np, propname,NULL ); -const __be16 *val; +const __be16 *val =of_find_property_value_of_size (np, propname, + (sz *sizeof (*out_values))); -if (!prop) -return -EINVAL ; -if (!prop->value) -return -ENODATA ; -if ((sz *sizeof (*out_values)) > prop->length) -return -EOVERFLOW ; +if (IS_ERR (val)) +return PTR_ERR (val); - val = prop->value;while (sz--) *out_values++ =be16_to_cpup (val++);return 0 ;
@@ -874,17 +889,12 @@ int of_property_read_u32_array(const struct device_node *np, const char *propname, u32 *out_values, size_t sz) { - struct property *prop = of_find_property(np, propname, NULL); -const __be32 *val; + const __be32 *val = of_find_property_value_of_size(np, propname, + (sz *sizeof (*out_values))); -if (!prop) -return -EINVAL ; -if (!prop->value) -return -ENODATA ; -if ((sz *sizeof (*out_values)) > prop->length) -return -EOVERFLOW ; +if (IS_ERR (val)) +return PTR_ERR (val); - val = prop->value;while (sz--) *out_values++ =be32_to_cpup (val++);return 0 ;
@@ -907,15 +917,13 @@ EXPORT_SYMBOL_GPL(of_property_read_u32_array);int of_property_read_u64 (const struct device_node *np,const char *propname,u64 *out_value) { -struct property *prop =of_find_property (np, propname,NULL ); +const __be32 *val =of_find_property_value_of_size (np, propname, +sizeof (*out_value)); -if (!prop) -return -EINVAL ; -if (!prop->value) -return -ENODATA ; -if (sizeof (*out_value) > prop->length) -return -EOVERFLOW ; - *out_value =of_read_number (prop->value,2 ); +if (IS_ERR (val)) +return PTR_ERR (val); + + *out_value =of_read_number (val,2 );return 0 ; }EXPORT_SYMBOL_GPL (of_property_read_u64);
Signature · 1 line
1.7.9.5
Re: [PATCHv5 2/7] of: Remove duplicated code for validating property and value
Quoted 11 lines · Tony Prisk
Several functions in
of/base.chave the same code duplicated for finding and validating a property and value.struct property *prop =
of_find_property(np, propname, NULL); if (!prop)return -EINVAL; if (!prop->value) return -ENODATA; if (<some length> > prop->length) return -EOVERFLOW;
Quoted 7 lines
This patch adds
of_find_property_value_of_size()which performs the equivalent of the above code and removes the instances where it was duplicated in several functions.Reported-by Rob Herring <[email protected]>Signed-off-by Tony Prisk <[email protected]>---
I'd prefer the first 2 patches in reverse order, but its not a big deal. So for both:
Quoted 153 lines
drivers/of/base.c | 94 +++++++++++++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 43 deletions(-)drivers/of/base.c +51
-43@@ -746,6 +746,34 @@ struct device_node *of_find_node_by_phandle(phandle handle)EXPORT_SYMBOL (of_find_node_by_phandle);/** +* of_find_property_value_of_size +* +* @np: device node from which the property value is to be read. +* @propname: name of the property to be searched. +* @len: requested length of property value +* +* Search for a property in a device node and valid the requested size. +* Returns the property value 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. +* +*/ +static void *of_find_property_value_of_size (const struct device_node *np, +const char *propname,u32 len) +{ +struct property *prop =of_find_property (np, propname,NULL ); + +if (!prop) +return ERR_PTR (-EINVAL ); +if (!prop->value) +return ERR_PTR (-ENODATA ); +if (len > prop->length) +return ERR_PTR (-EOVERFLOW ); + +return prop->value; +} + +/** * 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. @@ -764,16 +792,13 @@ 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); + const u32 *val = of_find_property_value_of_size(np, propname, + ((index +1 ) *sizeof (*out_value))); -if (!prop) -return -EINVAL ; -if (!prop->value) -return -ENODATA ; -if (((index +1 ) *sizeof (*out_value)) > prop->length) -return -EOVERFLOW ; +if (IS_ERR (val)) +return PTR_ERR (val); - *out_value =be32_to_cpup (((__be32 *)prop->value) + index); + *out_value =be32_to_cpup (((__be32 *)val) + index);return 0 ; }EXPORT_SYMBOL_GPL (of_property_read_u32_index);@@ -799,17 +824,12 @@ EXPORT_SYMBOL_GPL(of_property_read_u32_index);int of_property_read_u8_array (const struct device_node *np,const char *propname,u8 *out_values,size_t sz) { -struct property *prop =of_find_property (np, propname,NULL ); -const u8 *val; +const u8 *val =of_find_property_value_of_size (np, propname, + (sz *sizeof (*out_values))); -if (!prop) -return -EINVAL ; -if (!prop->value) -return -ENODATA ; -if ((sz *sizeof (*out_values)) > prop->length) -return -EOVERFLOW ; +if (IS_ERR (val)) +return PTR_ERR (val); - val = prop->value;while (sz--) *out_values++ = *val++;return 0 ;@@ -837,17 +857,12 @@ EXPORT_SYMBOL_GPL(of_property_read_u8_array);int of_property_read_u16_array (const struct device_node *np,const char *propname,u16 *out_values,size_t sz) { -struct property *prop =of_find_property (np, propname,NULL ); -const __be16 *val; +const __be16 *val =of_find_property_value_of_size (np, propname, + (sz *sizeof (*out_values))); -if (!prop) -return -EINVAL ; -if (!prop->value) -return -ENODATA ; -if ((sz *sizeof (*out_values)) > prop->length) -return -EOVERFLOW ; +if (IS_ERR (val)) +return PTR_ERR (val); - val = prop->value;while (sz--) *out_values++ =be16_to_cpup (val++);return 0 ;@@ -874,17 +889,12 @@ int of_property_read_u32_array(const struct device_node *np, const char *propname, u32 *out_values, size_t sz) { - struct property *prop = of_find_property(np, propname, NULL); -const __be32 *val; + const __be32 *val = of_find_property_value_of_size(np, propname, + (sz *sizeof (*out_values))); -if (!prop) -return -EINVAL ; -if (!prop->value) -return -ENODATA ; -if ((sz *sizeof (*out_values)) > prop->length) -return -EOVERFLOW ; +if (IS_ERR (val)) +return PTR_ERR (val); - val = prop->value;while (sz--) *out_values++ =be32_to_cpup (val++);return 0 ;@@ -907,15 +917,13 @@ EXPORT_SYMBOL_GPL(of_property_read_u32_array);int of_property_read_u64 (const struct device_node *np,const char *propname,u64 *out_value) { -struct property *prop =of_find_property (np, propname,NULL ); +const __be32 *val =of_find_property_value_of_size (np, propname, +sizeof (*out_value)); -if (!prop) -return -EINVAL ; -if (!prop->value) -return -ENODATA ; -if (sizeof (*out_value) > prop->length) -return -EOVERFLOW ; - *out_value =of_read_number (prop->value,2 ); +if (IS_ERR (val)) +return PTR_ERR (val); + + *out_value =of_read_number (val,2 );return 0 ; }EXPORT_SYMBOL_GPL (of_property_read_u64);
PATCH v5 3/7 arm: vt8500: Increase available GPIOs on arch-vt8500
In reply to Tony PriskWith 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
@@ -1661,7 +1661,8 @@ config ARCH_NR_GPIO default 1024 if ARCH_SHMOBILE || ARCH_TEGRA default 512 if SOC_OMAP5 default 355 if ARCH_U8500 - default 288 if ARCH_VT8500 || ARCH_SUNXI + default 352 if ARCH_VT8500 + default 288 if ARCH_SUNXI default 264 if MACH_H4700 default 0 help
Signature · 1 line
1.7.9.5
PATCH v5 4/7 pinctrl: gpio: vt8500: Add pincontrol driver for arch-vt8500
In reply to Tony PriskThis 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 | 57 ++ 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 | 501 ++++++++++++++++ drivers/pinctrl/vt8500/pinctrl-wm8505.c | 532 ++++++++++++++++ drivers/pinctrl/vt8500/pinctrl-wm8650.c | 370 ++++++++++++ drivers/pinctrl/vt8500/pinctrl-wm8750.c | 409 +++++++++++++ drivers/pinctrl/vt8500/pinctrl-wm8850.c | 388 ++++++++++++ drivers/pinctrl/vt8500/pinctrl-wmt.c | 632 ++++++++++++++++++++ drivers/pinctrl/vt8500/pinctrl-wmt.h | 79 +++ 13 files changed, 3031 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 +57 -0
@@ -0,0 +1,57 @@ +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. + bit 0 - active low + +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>; + interrupt-controller; + #interrupt-cells = <2>; + gpio-controller; + #gpio-cells = <2>; + };
arch/arm/mach-vt8500/Kconfig +1 -0
@@ -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
@@ -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
@@ -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
@@ -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 +501 -0
501 lines not on this page · raw message
drivers/pinctrl/vt8500/pinctrl-wm8505.c new file +532 -0
532 lines not on this page · raw message
drivers/pinctrl/vt8500/pinctrl-wm8650.c new file +370 -0
370 lines not on this page · raw message
drivers/pinctrl/vt8500/pinctrl-wm8750.c new file +409 -0
409 lines not on this page · raw message
drivers/pinctrl/vt8500/pinctrl-wm8850.c new file +388 -0
388 lines not on this page · raw message
drivers/pinctrl/vt8500/pinctrl-wmt.c new file +632 -0
632 lines not on this page · raw message
drivers/pinctrl/vt8500/pinctrl-wmt.h new file +79 -0
33 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.
Re: [PATCHv5 4/7] pinctrl: gpio: vt8500: Add pincontrol driver for arch-vt8500
Quoted 7 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.
Quoted 5 lines
All currently supported SoCs are included: VT8500, WM8505, WM8650, WM8750 and WM8850.
Signed-off-by Tony Prisk <[email protected]>Reviewed-by Stephen Warren <[email protected]>
At a quick glance, the alloc/free stuff looks good in this patch, so I re-affirm the reviewed-by above.
PATCH v5 5/7 arm: dts: vt8500: Update Wondermedia SoC dtsi files for pinctrl driver
In reply to Tony PriskThis patch adds pinctrl nodes to the VIA VT8500 and Wondermedia SoC dtsi files to support the pinctrl driver.
--- arch/arm/boot/dts/vt8500.dtsi | 9 +++++++++ arch/arm/boot/dts/wm8505.dtsi | 9 +++++++++ arch/arm/boot/dts/wm8650.dtsi | 9 +++++++++ arch/arm/boot/dts/wm8850.dtsi | 9 +++++++++ 4 files changed, 36 insertions(+)
arch/arm/boot/dts/vt8500.dtsi +9 -0
@@ -32,6 +32,15 @@ #gpio-cells = <3>; }; + pinctrl: pinctrl at d8110000 { + compatible = "via,vt8500-pinctrl"; + reg = <0xd8110000 0x10000>; + interrupt-controller; + #interrupt-cells = <2>; + gpio-controller; + #gpio-cells = <2>; + }; + pmc at d8130000 { compatible = "via,vt8500-pmc"; reg = <0xd8130000 0x1000>;
arch/arm/boot/dts/wm8505.dtsi +9 -0
@@ -47,6 +47,15 @@ #gpio-cells = <3>; }; + pinctrl: pinctrl at d8110000 { + compatible = "wm,wm8505-pinctrl"; + reg = <0xd8110000 0x10000>; + interrupt-controller; + #interrupt-cells = <2>; + gpio-controller; + #gpio-cells = <2>; + }; + pmc at d8130000 { compatible = "via,vt8500-pmc"; reg = <0xd8130000 0x1000>;
arch/arm/boot/dts/wm8650.dtsi +9 -0
@@ -41,6 +41,15 @@ #gpio-cells = <3>; }; + pinctrl: pinctrl at d8110000 { + compatible = "wm,wm8650-pinctrl"; + reg = <0xd8110000 0x10000>; + interrupt-controller; + #interrupt-cells = <2>; + gpio-controller; + #gpio-cells = <2>; + }; + pmc at d8130000 { compatible = "via,vt8500-pmc"; reg = <0xd8130000 0x1000>;
arch/arm/boot/dts/wm8850.dtsi +9 -0
@@ -48,6 +48,15 @@ #gpio-cells = <3>; }; + pinctrl: pinctrl at d8110000 { + compatible = "wm,wm8850-pinctrl"; + reg = <0xd8110000 0x10000>; + interrupt-controller; + #interrupt-cells = <2>; + gpio-controller; + #gpio-cells = <2>; + }; + pmc at d8130000 { compatible = "via,vt8500-pmc"; reg = <0xd8130000 0x1000>;
Signature · 1 line
1.7.9.5
PATCH v5 6/7 arm: vt8500: Remove gpio devicetree nodes
In reply to Tony PriskRemove 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
@@ -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"; reg = <0xd8110000 0x10000>;
arch/arm/boot/dts/wm8505.dtsi +0 -7
@@ -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"; reg = <0xd8110000 0x10000>;
arch/arm/boot/dts/wm8650.dtsi +0 -7
@@ -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"; reg = <0xd8110000 0x10000>;
arch/arm/boot/dts/wm8850.dtsi +0 -7
@@ -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"; reg = <0xd8110000 0x10000>;
Signature · 1 line
1.7.9.5
PATCH v5 7/7 gpio: vt8500: Remove arch-vt8500 gpio driver
In reply to Tony PriskWith the move to a combined pinctrl/gpio driver, the arch-vt8500 gpio driver is no longer required.
--- .../devicetree/bindings/gpio/gpio-vt8500.txt | 24 -- drivers/gpio/Kconfig | 6 - drivers/gpio/Makefile | 1 - drivers/gpio/gpio-vt8500.c | 355 -------------------- 4 files changed, 386 deletions(-) delete mode 100644 Documentation/devicetree/bindings/gpio/gpio-vt8500.txt delete mode 100644 drivers/gpio/gpio-vt8500.c
Documentation/devicetree/bindings/gpio/gpio-vt8500.txt deleted +0 -24
@@ -1,24 +0,0 @@ -VIA/Wondermedia VT8500 GPIO Controller ------------------------------------------------------ - -Required properties: -- compatible : "via,vt8500-gpio", "wm,wm8505-gpio" - or "wm,wm8650-gpio" depending on your SoC -- reg : Should contain 1 register range (address and length) -- #gpio-cells : should be <3>. - 1) bank - 2) pin number - 3) flags - should be 0 - -Example: - - gpio: gpio-controller at d8110000 { - compatible = "via,vt8500-gpio"; - gpio-controller; - reg = <0xd8110000 0x10000>; - #gpio-cells = <3>; - }; - - vibrate { - gpios = <&gpio 0 1 0>; /* Bank 0, Pin 1, No flags */ - };
drivers/gpio/Kconfig +0 -6
@@ -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
@@ -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
Quoted 9 lines · Tony Prisk
v5 changes:
Changed as requested by Rob Herring:
Addedof_find_property_value_of_size()todrivers/of/base.cto remove some code that was being duplicated.Changed as requested by Stephen Warren:
Redid the kfree(maps) code asdevm_kzallocwould cause issues. We now kzalloc maps all at once, and configs as required. A call towmt_pctl_dt_free_map()is used to kfree the allocated blocks if we fail early.
This v5 series:
I guess it will go in through the VT8500 tree eventually?
Maybe you could put Stephen's BCMring patch on top when sending it in (also Acked-by) so we can avoid having that dangling.
Yours,
Linus Walleij
Quoted 14 lines · Linus Walleij
Quoted 9 lines · Tony Prisk
v5 changes:
Changed as requested by Rob Herring:
Addedof_find_property_value_of_size()todrivers/of/base.cto remove some code that was being duplicated.Changed as requested by Stephen Warren:
Redid the kfree(maps) code asdevm_kzallocwould cause issues. We now kzalloc maps all at once, and configs as required. A call towmt_pctl_dt_free_map()is used to kfree the allocated blocks if we fail early.This v5 series:
Acked-by Linus Walleij <[email protected]>
Quoted 7 lines
I guess it will go in through the VT8500 tree eventually?
Maybe you could put Stephen's BCMring patch on top when sending it in (also Acked-by) so we can avoid having that dangling.
Yours,
Linus Walleij
We don't have a VT8500 tree. Originally I planned for it to go through you, but it could go through arm-soc if they want to take it.
Regards
Tony P
Quoted 7 lines · Tony Prisk
Quoted 5 lines · Linus Walleij
This v5 series:
Acked-by Linus Walleij <[email protected]>I guess it will go in through the VT8500 tree eventually?
Quoted 8 lines
Quoted 5 lines
Maybe you could put Stephen's BCMring patch on top when sending it in (also Acked-by) so we can avoid having that dangling.
Yours,
Linus WalleijWe don't have a VT8500 tree. Originally I planned for it to go through you, but it could go through arm-soc if they want to take it.
You should definately be sending VT8500 series like this through ARM SoC. Prepare a pull request or patch series and send to arm at kernel.org.
Thanks,
Linus Walleij
Quoted 12 lines · Linus Walleij
Quoted 9 lines · Tony Prisk
v5 changes:
Changed as requested by Rob Herring:
Addedof_find_property_value_of_size()todrivers/of/base.cto remove some code that was being duplicated.Changed as requested by Stephen Warren:
Redid the kfree(maps) code asdevm_kzallocwould cause issues. We now kzalloc maps all at once, and configs as required. A call towmt_pctl_dt_free_map()is used to kfree the allocated blocks if we fail early.
Quoted 7 lines
This v5 series:
Acked-by Linus Walleij <[email protected]>I guess it will go in through the VT8500 tree eventually?
Maybe you could put Stephen's BCMring patch on top when sending it in (also Acked-by) so we can avoid having that dangling.
s/bcmring/bcm2835/ :-)
Quoted 12 lines · Stephen Warren
Quoted 11 lines · Linus Walleij
Quoted 9 lines · Tony Prisk
v5 changes:
Changed as requested by Rob Herring:
Addedof_find_property_value_of_size()todrivers/of/base.cto remove some code that was being duplicated.Changed as requested by Stephen Warren:
Redid the kfree(maps) code asdevm_kzallocwould cause issues. We now kzalloc maps all at once, and configs as required. A call towmt_pctl_dt_free_map()is used to kfree the allocated blocks if we fail early.
Quoted 8 lines
Quoted 7 lines
This v5 series:
Acked-by Linus Walleij <[email protected]>I guess it will go in through the VT8500 tree eventually?
Maybe you could put Stephen's BCMring patch on top when sending it in (also Acked-by) so we can avoid having that dangling.
s/bcmring/bcm2835/ :-)
Stephen,
Can you just confirm you want:
pinctrl: bcm2835: make use of of_property_read_u32_index()
to be included in the pull with this series. I'll get it sent out once you let me know.
Regards
Tony P
Tony Prisk <[email protected]> wrote:
...
Quoted 6 lines
Can you just confirm you want:
pinctrl: bcm2835: make use of
of_property_read_u32_index()to be included in the pull with this series. I'll get it sent out once you let me know.
That sounds fine, thanks.
Signature · 1 line
Sent from my Android phone with K-9 Mail. Please excuse my brevity.