SH pinctrl DT support
Subsystems (7)
v6 cover SH pinctrl DT support
Hello,
Here's the sixth version of the SuperH and SH Mobile pin controllers (PFC) DT support patch set.
The patches are based on tags/renesas-next-20130613 from Simon's tree
(git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git). The result is available in my tree at
git://linuxtv.org/pinchartl/fbdev.git pinmux/3.10/dt
The series is pretty self-explanatory. DT bindings are added in patch 02/18, and the following patches gradually move SoC code and board code over to the device tree for the armadilla800eva-reference and marzen-reference boards. The code has been tested on the two boards, but armadillo800eva has received less testing as it can't be booted all the way to userspace with network support due to missing DT bindings.
Comments will be very appreciated on the DT bindings (02/18). Points I'm a bit unsure about include:
- Should the driver support pin configuration subnodes as currently implemented, or should the subnodes be promoted to regular pin configuration nodes, with clients referencing multiple nodes ?
I've dropped pinconf support from the DT bindings as the generic pinconf DT bindings are work in progress and might not make it to v3.11, which this patch set targets. Pinconf support will be added back later as follow-up patches. Linus, if you're fine with the result, could you please ack 02/18 ? I will then ask Simon to take the patches in his tree.
Changes since v5:
- Dropped generic pinconf support
- Dropped kzm9g-reference patches, as those require pinconf support
Changes since v4:
- Added generic pinconf bindings
- Use symbolic names for GPIO flags
Changes since v3:
- Fixed the GPIO flags description in the DT bindings documentation
- Mention the gpio-rcar driver in the DT bindings documentation for platforms that use it
- Removed unneeded #ifdef CONFIG_OF...#endif
- Removed unused support for platform data
- Simplified error path in sh_pfc_dt_node_to_map()
- Added gpio-ranges for r8a7778, r8a7779 and r8a7790
Changes since v2:
- Added pin configuration properties
- Rewrote all arch changes
Changes since v1:
- Fixed gpio cell number 2 documentation
- Added missing gpio-controller and #gpio-cells properties to r8a7740 DT
- Split kzm9g DT patch into SoC and board patches
- Dropped pinctrl mappings move to DT
Laurent Pinchart (18):
sh-pfc: Remove support for platform data
sh-pfc: Add DT support
ARM: shmobile: r8a73a4: Add pin control device to device tree
ARM: shmobile: r8a7740: Add pin control device to device tree
ARM: shmobile: r8a7778: Add pin control device to device tree
ARM: shmobile: r8a7778: Add GPIO controller devices to device tree
ARM: shmobile: r8a7779: Add pin control device to device tree
ARM: shmobile: r8a7779: Add GPIO controller devices to device tree
ARM: shmobile: r8a7790: Add pin control device to device tree
ARM: shmobile: r8a7790: Add GPIO controller devices to device tree
ARM: shmobile: sh7372: Add pin control device to device tree
ARM: shmobile: sh73a0: Add pin control device to device tree
ARM: shmobile: armadillo-reference: Move pinctrl mappings to device
tree
ARM: shmobile: armadillo-reference: Add st1232 pin mappings
ARM: shmobile: armadillo-reference: Move st1232 reset GPIO to DT
ARM: shmobile: armadillo-reference: Add LED1-LED4 to the device tree
ARM: shmobile: marzen-reference: Move pinctrl mappings to device tree
ARM: shmobile: marzen-reference: Add LED2-LED4 to the device tree
.../bindings/pinctrl/renesas,pfc-pinctrl.txt | 135 +++++++++++++++++++++ arch/arm/boot/dts/r8a73a4.dtsi | 7 ++ .../boot/dts/r8a7740-armadillo800eva-reference.dts | 34 ++++++ arch/arm/boot/dts/r8a7740.dtsi | 8 ++ arch/arm/boot/dts/r8a7778.dtsi | 56 +++++++++ arch/arm/boot/dts/r8a7779-marzen-reference.dts | 49 ++++++++ arch/arm/boot/dts/r8a7779.dtsi | 76 ++++++++++++ arch/arm/boot/dts/r8a7790.dtsi | 66 ++++++++++ arch/arm/boot/dts/sh7372.dtsi | 8 ++ arch/arm/boot/dts/sh73a0.dtsi | 8 ++ .../board-armadillo800eva-reference.c | 18 +-- arch/arm/mach-shmobile/board-kzm9g-reference.c | 27 ++--- arch/arm/mach-shmobile/board-marzen-reference.c | 28 ----- drivers/pinctrl/sh-pfc/core.c | 65 +++++++++- drivers/pinctrl/sh-pfc/pinctrl.c | 116 ++++++++++++++++++ 15 files changed, 640 insertions(+), 61 deletions(-) create mode 100644 Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v6 1/18 sh-pfc: Remove support for platform data
Platform data isn't used, support can thus be removed.
--- drivers/pinctrl/sh-pfc/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pinctrl/sh-pfc/core.c +1 -2
@@ -354,8 +354,7 @@ static int sh_pfc_probe(struct platform_device *pdev)struct sh_pfc *pfc;int ret; - info = pdev->id_entry->driver_data - ? (void *)pdev->id_entry->driver_data : pdev->dev.platform_data; + info = (void *)pdev->id_entry->driver_data;if (info ==NULL )return -ENODEV ;
Signature · 1 line
1.8.1.5
PATCH v6 2/18 sh-pfc: Add DT support
In reply to Laurent PinchartSupport device instantiation through the device tree. The compatible property is used to select the SoC pinmux information.
Set the gpio_chip device field to the PFC device to enable automatic GPIO OF support.
--- .../bindings/pinctrl/renesas,pfc-pinctrl.txt | 135 +++++++++++++++++++++ drivers/pinctrl/sh-pfc/core.c | 64 +++++++++- drivers/pinctrl/sh-pfc/pinctrl.c | 116 ++++++++++++++++++ 3 files changed, 314 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +135 -0
@@ -0,0 +1,135 @@ +* Renesas Pin Function Controller (GPIO and Pin Mux/Config) + +The Pin Function Controller (PFC) is a Pin Mux/Config controller. On SH7372, +SH73A0, R8A73A4 and R8A7740 it also acts as a GPIO controller. + + +Pin Control +----------- + +Required Properties: + + - compatible: should be one of the following. + - "renesas,pfc-r8a73a4": for R8A73A4 (R-Mobile APE6) compatible pin-controller. + - "renesas,pfc-r8a7740": for R8A7740 (R-Mobile A1) compatible pin-controller. + - "renesas,pfc-r8a7778": for R8A7778 (R-Mobile M1) compatible pin-controller. + - "renesas,pfc-r8a7779": for R8A7779 (R-Car H1) compatible pin-controller. + - "renesas,pfc-r8a7790": for R8A7790 (R-Car H2) compatible pin-controller. + - "renesas,pfc-sh7372": for SH7372 (SH-Mobile AP4) compatible pin-controller. + - "renesas,pfc-sh73a0": for SH73A0 (SH-Mobile AG5) compatible pin-controller. + + - reg: Base address and length of each memory resource used by the pin + controller hardware module. + +Optional properties: + + - #gpio-range-cells: Mandatory when the PFC doesn't handle GPIO, forbidden + otherwise. Should be 3. + +The PFC node also acts as a container for pin configuration nodes. Please refer +to pinctrl-bindings.txt in this directory for the definition of the term "pin +configuration node" and for the common pinctrl bindings used by client devices. + +Each pin configuration node represents desired functions to select on a pin +group or a list of pin groups. The functions and pin groups can be specified +directly in the pin configuration node, or grouped in child subnodes. Several +functions can thus be referenced as a single pin configuration node by client +devices. + +A configuration node or subnode must contain a function and reference at least +one pin group. + +All pin configuration nodes and subnodes names are ignored. All of those nodes +are parsed through phandles and processed purely based on their content. + +Pin Configuration Node Properties: + +- renesas,groups : An array of strings, each string containing the name of a pin + group. + +- renesas,function: A string containing the name of the function to mux to the + pin group(s) specified by the renesas,groups property + + Valid values for pin, group and function names can be found in the group and + function arrays of the PFC data file corresponding to the SoC + (drivers/pinctrl/sh-pfc/pfc-*.c) + + +GPIO +---- + +On SH7372, SH73A0, R8A73A4 and R8A7740 the PFC node is also a GPIO controller +node. + +Required Properties: + + - gpio-controller: Marks the device node as a gpio controller. + + - #gpio-cells: Should be 2. The first cell is the GPIO number and the second + cell specifies GPIO flags, as defined in <dt-bindings/gpio/gpio.h>. Only the + GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW flags are supported. + +The syntax of the gpio specifier used by client nodes should be the following +with values derived from the SoC user manual. + + <[phandle of the gpio controller node] + [pin number within the gpio controller] + [flags]> + +On other mach-shmobile platforms GPIO is handled by the gpio-rcar driver. +Please refer to Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt +for documentation of the GPIO device tree bindings on those platforms. + + +Examples +-------- + +Example 1: SH73A0 (SH-Mobile AG5) pin controller node + + pfc: pfc at e6050000 { + compatible = "renesas,pfc-sh73a0"; + reg = <0xe6050000 0x8000>, + <0xe605801c 0x1c>; + gpio-controller; + #gpio-cells = <2>; + }; + +Example 2: A GPIO LED node that references a GPIO + + #include <dt-bindings/gpio/gpio.h> + + leds { + compatible = "gpio-leds"; + led1 { + gpios = <&pfc 20 GPIO_ACTIVE_LOW>; + }; + }; + +Example 3: KZM-A9-GT (SH-Mobile AG5) default pin state hog and pin control maps + for the MMCIF and SCIFA4 devices + + &pfc { + pinctrl-0 = <&scifa4_pins>; + pinctrl-names = "default"; + + mmcif_pins: mmcif { + renesas,groups = "mmc0_data8_0", "mmc0_ctrl_0"; + renesas,function = "mmc0"; + }; + + scifa4_pins: scifa4 { + renesas,groups = "scifa4_data", "scifa4_ctrl"; + renesas,function = "scifa4"; + }; + }; + +Example 4: KZM-A9-GT (SH-Mobile AG5) default pin state for the MMCIF device + + &mmcif { + pinctrl-0 = <&mmcif_pins>; + pinctrl-names = "default"; + + bus-width = <8>; + vmmc-supply = <®_1p8v>; + status = "okay"; + };
drivers/pinctrl/sh-pfc/core.c +63 -1
88 lines not on this page · raw message
drivers/pinctrl/sh-pfc/pinctrl.c +116 -0
134 lines not on this page · raw message
Signature · 1 line
1.8.1.5
PATCH v6 2/18 sh-pfc: Add DT support
Hi Linus,
Would you be able to review this patch in the near future ? I'd like to push the series to v3.11.
Quoted 396 lines · On Friday 14 June 2013 01:45:47 Laurent Pinchart wrote:
Support device instantiation through the device tree. The compatible property is used to select the SoC pinmux information.
Set the
gpio_chipdevice field to the PFC device to enable automatic GPIO OF support.Cc devicetree-discuss at lists.ozlabs.orgSigned-off-by Laurent Pinchart <[email protected]>--- .../bindings/pinctrl/renesas,pfc-pinctrl.txt | 135 ++++++++++++++++++ drivers/pinctrl/sh-pfc/core.c | 64 +++++++++- drivers/pinctrl/sh-pfc/pinctrl.c | 116 ++++++++++++++++++ 3 files changed, 314 insertions(+), 1 deletion(-) create mode 100644
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txtdiff --git
a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txtb/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txtnew file mode 100644
index 0000000..8264cbcDocumentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +3
-0@@ -0,0 +1,135 @@ +* Renesas Pin Function Controller (GPIO and Pin Mux/Config) + +The Pin Function Controller (PFC) is a Pin Mux/Config controller. OnSH7372, +SH73A0, R8A73A4 and R8A7740 it also acts as a GPIO controller.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +9
-0+ + +Pin Control +----------- + +Required Properties: + + - compatible: should be one of the following. + - "renesas,pfc-r8a73a4": for R8A73A4 (R-Mobile APE6) compatiblepin-controller. + - "renesas,pfc-r8a7740": for R8A7740 (R-Mobile A1)
compatible pin-controller. + - "renesas,pfc-r8a7778": for R8A7778
(R-Mobile M1) compatible pin-controller. + - "renesas,pfc-r8a7779": for
R8A7779 (R-Car H1) compatible pin-controller. + - "renesas,pfc-r8a7790":
for R8A7790 (R-Car H2) compatible pin-controller. + -
"renesas,pfc-sh7372": for SH7372 (SH-Mobile AP4) compatible pin-controller.
+ - "renesas,pfc-sh73a0": for SH73A0 (SH-Mobile AG5) compatible
pin-controller. +Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +6
-0+ - reg: Base address and length of each memory resource used by the pin + controller hardware module. + +Optional properties: + + - #gpio-range-cells: Mandatory when the PFC doesn't handle GPIO,forbidden + otherwise. Should be 3.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ +The PFC node also acts as a container for pin configuration nodes. Pleaserefer +to pinctrl-bindings.txt in this directory for the definition of the term "pin +configuration node" and for the common pinctrl bindings used by client devices. +
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+Each pin configuration node represents desired functions to select on a pin +group or a list of pin groups. The functions and pin groups can bespecified +directly in the pin configuration node, or grouped in child subnodes. Several +functions can thus be referenced as a single pin configuration node by client +devices.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ +A configuration node or subnode must contain a function and reference atleast +one pin group.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ +All pin configuration nodes and subnodes names are ignored. All of thosenodes +are parsed through phandles and processed purely based on their content. +
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +3
-0+Pin Configuration Node Properties: + +- renesas,groups : An array of strings, each string containing the name ofa pin + group.
++- renesas,function: A string containing the name of the function to mux to the + pin group(s) specified by the renesas,groups propertyDocumentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ + Valid values for pin, group and function names can be found in the groupand + function arrays of the PFC data file corresponding to the SoC
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +7
-0+ (drivers/pinctrl/sh-pfc/pfc-*.c) + + +GPIO +---- + +On SH7372, SH73A0, R8A73A4 and R8A7740 the PFC node is also a GPIOcontroller +node.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +6
-0+ +Required Properties: + + - gpio-controller: Marks the device node as a gpio controller. + + - #gpio-cells: Should be 2. The first cell is the GPIO number and thesecond + cell specifies GPIO flags, as defined in
<dt-bindings/gpio/gpio.h>. Only the +GPIO_ACTIVE_HIGHandGPIO_ACTIVE_LOWflags are supported.Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ +The syntax of the gpio specifier used by client nodes should be thefollowing +with values derived from the SoC user manual.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +7
-0+ + <[phandle of the gpio controller node] + [pin number within the gpio controller] + [flags]> + +On other mach-shmobile platforms GPIO is handled by the gpio-rcar driver. +Please refer to
Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt+for documentation of the GPIO device tree bindings on those platforms. +Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +26
-0+ +Examples +-------- + +Example 1: SH73A0 (SH-Mobile AG5) pin controller node + + pfc: pfc at e6050000 { + compatible = "renesas,pfc-sh73a0"; + reg = <0xe6050000 0x8000>, + <0xe605801c 0x1c>; + gpio-controller; + #gpio-cells = <2>; + }; + +Example 2: A GPIO LED node that references a GPIO + + #include <dt-bindings/gpio/gpio.h> + + leds { + compatible = "gpio-leds"; + led1 { + gpios = <&pfc 20 GPIO_ACTIVE_LOW>; + }; + }; + +Example 3: KZM-A9-GT (SH-Mobile AG5) default pin state hog and pin controlmaps + for the MMCIF and SCIFA4 devices
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +26
-0+ + &pfc { + pinctrl-0 = <&scifa4_pins>; + pinctrl-names = "default"; + + mmcif_pins: mmcif { + renesas,groups = "mmc0_data8_0", "mmc0_ctrl_0"; + renesas,function = "mmc0"; + }; + + scifa4_pins: scifa4 { + renesas,groups = "scifa4_data", "scifa4_ctrl"; + renesas,function = "scifa4"; + }; + }; + +Example 4: KZM-A9-GT (SH-Mobile AG5) default pin state for the MMCIF device + + &mmcif { + pinctrl-0 = <&mmcif_pins>; + pinctrl-names = "default"; + + bus-width = <8>; + vmmc-supply = <®_1p8v>; + status = "okay"; + };drivers/pinctrl/sh-pfc/core.c +63
-1@@ -18,6 +18,8 @@#include <linux/ioport.h> #include <linux/kernel.h> #include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> #include <linux/pinctrl/machine.h> #include <linux/platform_device.h> #include <linux/slab.h> @@ -348,13 +350,72 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id sh_pfc_of_table[] = { +#ifdef CONFIG_PINCTRL_PFC_R8A73A4 + { + .compatible ="renesas,pfc-r8a73a4" , + .data = &r8a73a4_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_R8A7740 + { + .compatible ="renesas,pfc-r8a7740" , + .data = &r8a7740_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_R8A7778 + { + .compatible ="renesas,pfc-r8a7778" , + .data = &r8a7778_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_R8A7779 + { + .compatible ="renesas,pfc-r8a7779" , + .data = &r8a7779_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_R8A7790 + { + .compatible ="renesas,pfc-r8a7790" , + .data = &r8a7790_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_SH7372 + { + .compatible ="renesas,pfc-sh7372" , + .data = &sh7372_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_SH73A0 + { + .compatible ="renesas,pfc-sh73a0" , + .data = &sh73a0_pinmux_info, + }, +#endif + { }, +}; +MODULE_DEVICE_TABLE (of, sh_pfc_of_table); +#endif +static int sh_pfc_probe (struct platform_device *pdev) { +const struct platform_device_id *platid =platform_get_device_id (pdev); +#ifdef CONFIG_OF +struct device_node *np = pdev->dev.of_node; +#endif const struct sh_pfc_soc_info *info;struct sh_pfc *pfc;int ret; - info = (void *)pdev->id_entry->driver_data; +#ifdef CONFIG_OF +if (np) + info =of_match_device (sh_pfc_of_table, &pdev->dev)->data; + else +#endif + info = platid ? (const void *)platid->driver_data :NULL ; +if (info ==NULL )return -ENODEV ;@@ -500,6 +561,7 @@ static struct platform_driver sh_pfc_driver = { .driver = { .name = DRV_NAME, .owner = THIS_MODULE, + .of_match_table = of_match_ptr(sh_pfc_of_table), }, };(quoted diff) +0
-0
b/drivers/pinctrl/sh-pfc/pinctrl.cindex 3492ec9..7e32bb8 100644drivers/pinctrl/sh-pfc/pinctrl.c +115
-0@@ -14,7 +14,9 @@#include <linux/err.h> #include <linux/init.h> #include <linux/module.h> +#include <linux/of.h> #include <linux/pinctrl/consumer.h> +#include <linux/pinctrl/machine.h> #include <linux/pinctrl/pinconf.h> #include <linux/pinctrl/pinconf-generic.h> #include <linux/pinctrl/pinctrl.h> @@ -72,11 +74,125 @@ static void sh_pfc_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, seq_printf(s, "%s", DRV_NAME); } +static int sh_pfc_dt_subnode_to_map (struct device *dev,struct device_node *np, + struct pinctrl_map **map, +unsigned int *num_maps,unsigned int *index) +{ +struct pinctrl_map *maps = *map; +unsigned int nmaps = *num_maps; +unsigned int idx = *index; +const char *function =NULL ; +struct property *prop; +const char *group; +int ret; + +/* Parse the function and configuration properties. At least a function +* or one configuration must be specified. +*/ + ret =of_property_read_string (np,"renesas,function" , &function); +if (ret <0 && ret != -EINVAL ) { +dev_err (dev,"Invalid function in DT\n" ); +return ret; + } + +if (!function) { +dev_err (dev,"DT node must contain at least one function\n" ); + goto done; + } + +/* Count the number of groups and reallocate mappings. */ + ret =of_property_count_strings (np,"renesas,groups" ); +if (ret <0 && ret != -EINVAL ) { +dev_err (dev,"Invalid pin groups list in DT\n" ); + goto done; + } + +if (!ret) { +dev_err (dev,"No group provided in DT node\n" ); + ret = -ENODEV ; + goto done; + } + + nmaps += ret; + + maps =krealloc (maps,sizeof (*maps) * nmaps,GFP_KERNEL ); +if (maps ==NULL ) { + ret = -ENOMEM ; + goto done; + } + + *map = maps; + *num_maps = nmaps; + +/* Iterate over pins and groups and create the mappings. */ +of_property_for_each_string (np,"renesas,groups" , prop, group) { + maps[idx].type =PIN_MAP_TYPE_MUX_GROUP ; + maps[idx].data.mux.group = group; + maps[idx].data.mux.function = function; + idx++; + } + + ret =0 ; + +done: + *index = idx; +return ret; +} + +static void sh_pfc_dt_free_map (struct pinctrl_dev *pctldev, +struct pinctrl_map *map,unsigned num_maps) +{ +kfree (map); +} + +static int sh_pfc_dt_node_to_map (struct pinctrl_dev *pctldev, +struct device_node *np, +struct pinctrl_map **map,unsigned *num_maps) +{ +struct sh_pfc_pinctrl *pmx =pinctrl_dev_get_drvdata (pctldev); +struct device *dev = pmx->pfc->dev; +struct device_node *child; +unsigned int index; +int ret; + + *map =NULL ; + *num_maps =0 ; + index =0 ; + +for_each_child_of_node (np, child) { + ret =sh_pfc_dt_subnode_to_map (dev, child, map, num_maps, + &index); +if (ret <0 ) + goto done; + } + +/* If no mapping has been found in child nodes try the config node. */ +if (*num_maps ==0 ) { + ret =sh_pfc_dt_subnode_to_map (dev, np, map, num_maps, &index); +if (ret <0 ) + goto done; + } + +if (*num_maps) +return 0 ; + +dev_err (dev,"no mapping found in node %s\n" , np->full_name); + ret = -EINVAL ; + +done: +if (ret <0 ) +sh_pfc_dt_free_map (pctldev, *map, *num_maps); + +return ret; +} +static const struct pinctrl_ops sh_pfc_pinctrl_ops = { .get_groups_count = sh_pfc_get_groups_count, .get_group_name = sh_pfc_get_group_name, .get_group_pins = sh_pfc_get_group_pins, .pin_dbg_show = sh_pfc_pin_dbg_show, + .dt_node_to_map = sh_pfc_dt_node_to_map, + .dt_free_map = sh_pfc_dt_free_map, };static int sh_pfc_get_functions_count (struct pinctrl_dev *pctldev)
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v6 2/18 sh-pfc: Add DT support
Hi Laurent,
As 3.10-rc6 has been released it is probably now too late for me to take this series through the renesas tree for v3.11.
I am happy for Linus to take it if that is what he would like to do.
Otherwise I think we need to discuss how this should be handled for v3.12.
Quoted 412 lines · Laurent Pinchart
Hi Linus,
Would you be able to review this patch in the near future ? I'd like to push the series to v3.11.
Quoted 396 lines · On Friday 14 June 2013 01:45:47 Laurent Pinchart wrote:
Support device instantiation through the device tree. The compatible property is used to select the SoC pinmux information.
Set the
gpio_chipdevice field to the PFC device to enable automatic GPIO OF support.Cc devicetree-discuss at lists.ozlabs.orgSigned-off-by Laurent Pinchart <[email protected]>--- .../bindings/pinctrl/renesas,pfc-pinctrl.txt | 135 ++++++++++++++++++ drivers/pinctrl/sh-pfc/core.c | 64 +++++++++- drivers/pinctrl/sh-pfc/pinctrl.c | 116 ++++++++++++++++++ 3 files changed, 314 insertions(+), 1 deletion(-) create mode 100644
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txtdiff --git
a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txtb/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txtnew file mode 100644
index 0000000..8264cbcDocumentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +3
-0@@ -0,0 +1,135 @@ +* Renesas Pin Function Controller (GPIO and Pin Mux/Config) + +The Pin Function Controller (PFC) is a Pin Mux/Config controller. OnSH7372, +SH73A0, R8A73A4 and R8A7740 it also acts as a GPIO controller.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +9
-0+ + +Pin Control +----------- + +Required Properties: + + - compatible: should be one of the following. + - "renesas,pfc-r8a73a4": for R8A73A4 (R-Mobile APE6) compatiblepin-controller. + - "renesas,pfc-r8a7740": for R8A7740 (R-Mobile A1)
compatible pin-controller. + - "renesas,pfc-r8a7778": for R8A7778
(R-Mobile M1) compatible pin-controller. + - "renesas,pfc-r8a7779": for
R8A7779 (R-Car H1) compatible pin-controller. + - "renesas,pfc-r8a7790":
for R8A7790 (R-Car H2) compatible pin-controller. + -
"renesas,pfc-sh7372": for SH7372 (SH-Mobile AP4) compatible pin-controller.
+ - "renesas,pfc-sh73a0": for SH73A0 (SH-Mobile AG5) compatible
pin-controller. +Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +6
-0+ - reg: Base address and length of each memory resource used by the pin + controller hardware module. + +Optional properties: + + - #gpio-range-cells: Mandatory when the PFC doesn't handle GPIO,forbidden + otherwise. Should be 3.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ +The PFC node also acts as a container for pin configuration nodes. Pleaserefer +to pinctrl-bindings.txt in this directory for the definition of the term "pin +configuration node" and for the common pinctrl bindings used by client devices. +
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+Each pin configuration node represents desired functions to select on a pin +group or a list of pin groups. The functions and pin groups can bespecified +directly in the pin configuration node, or grouped in child subnodes. Several +functions can thus be referenced as a single pin configuration node by client +devices.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ +A configuration node or subnode must contain a function and reference atleast +one pin group.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ +All pin configuration nodes and subnodes names are ignored. All of thosenodes +are parsed through phandles and processed purely based on their content. +
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +3
-0+Pin Configuration Node Properties: + +- renesas,groups : An array of strings, each string containing the name ofa pin + group.
++- renesas,function: A string containing the name of the function to mux to the + pin group(s) specified by the renesas,groups propertyDocumentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ + Valid values for pin, group and function names can be found in the groupand + function arrays of the PFC data file corresponding to the SoC
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +7
-0+ (drivers/pinctrl/sh-pfc/pfc-*.c) + + +GPIO +---- + +On SH7372, SH73A0, R8A73A4 and R8A7740 the PFC node is also a GPIOcontroller +node.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +6
-0+ +Required Properties: + + - gpio-controller: Marks the device node as a gpio controller. + + - #gpio-cells: Should be 2. The first cell is the GPIO number and thesecond + cell specifies GPIO flags, as defined in
<dt-bindings/gpio/gpio.h>. Only the +GPIO_ACTIVE_HIGHandGPIO_ACTIVE_LOWflags are supported.Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ +The syntax of the gpio specifier used by client nodes should be thefollowing +with values derived from the SoC user manual.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +7
-0+ + <[phandle of the gpio controller node] + [pin number within the gpio controller] + [flags]> + +On other mach-shmobile platforms GPIO is handled by the gpio-rcar driver. +Please refer to
Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt+for documentation of the GPIO device tree bindings on those platforms. +Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +26
-0+ +Examples +-------- + +Example 1: SH73A0 (SH-Mobile AG5) pin controller node + + pfc: pfc at e6050000 { + compatible = "renesas,pfc-sh73a0"; + reg = <0xe6050000 0x8000>, + <0xe605801c 0x1c>; + gpio-controller; + #gpio-cells = <2>; + }; + +Example 2: A GPIO LED node that references a GPIO + + #include <dt-bindings/gpio/gpio.h> + + leds { + compatible = "gpio-leds"; + led1 { + gpios = <&pfc 20 GPIO_ACTIVE_LOW>; + }; + }; + +Example 3: KZM-A9-GT (SH-Mobile AG5) default pin state hog and pin controlmaps + for the MMCIF and SCIFA4 devices
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +26
-0+ + &pfc { + pinctrl-0 = <&scifa4_pins>; + pinctrl-names = "default"; + + mmcif_pins: mmcif { + renesas,groups = "mmc0_data8_0", "mmc0_ctrl_0"; + renesas,function = "mmc0"; + }; + + scifa4_pins: scifa4 { + renesas,groups = "scifa4_data", "scifa4_ctrl"; + renesas,function = "scifa4"; + }; + }; + +Example 4: KZM-A9-GT (SH-Mobile AG5) default pin state for the MMCIF device + + &mmcif { + pinctrl-0 = <&mmcif_pins>; + pinctrl-names = "default"; + + bus-width = <8>; + vmmc-supply = <®_1p8v>; + status = "okay"; + };drivers/pinctrl/sh-pfc/core.c +63
-1@@ -18,6 +18,8 @@#include <linux/ioport.h> #include <linux/kernel.h> #include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> #include <linux/pinctrl/machine.h> #include <linux/platform_device.h> #include <linux/slab.h> @@ -348,13 +350,72 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id sh_pfc_of_table[] = { +#ifdef CONFIG_PINCTRL_PFC_R8A73A4 + { + .compatible ="renesas,pfc-r8a73a4" , + .data = &r8a73a4_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_R8A7740 + { + .compatible ="renesas,pfc-r8a7740" , + .data = &r8a7740_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_R8A7778 + { + .compatible ="renesas,pfc-r8a7778" , + .data = &r8a7778_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_R8A7779 + { + .compatible ="renesas,pfc-r8a7779" , + .data = &r8a7779_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_R8A7790 + { + .compatible ="renesas,pfc-r8a7790" , + .data = &r8a7790_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_SH7372 + { + .compatible ="renesas,pfc-sh7372" , + .data = &sh7372_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_SH73A0 + { + .compatible ="renesas,pfc-sh73a0" , + .data = &sh73a0_pinmux_info, + }, +#endif + { }, +}; +MODULE_DEVICE_TABLE (of, sh_pfc_of_table); +#endif +static int sh_pfc_probe (struct platform_device *pdev) { +const struct platform_device_id *platid =platform_get_device_id (pdev); +#ifdef CONFIG_OF +struct device_node *np = pdev->dev.of_node; +#endif const struct sh_pfc_soc_info *info;struct sh_pfc *pfc;int ret; - info = (void *)pdev->id_entry->driver_data; +#ifdef CONFIG_OF +if (np) + info =of_match_device (sh_pfc_of_table, &pdev->dev)->data; + else +#endif + info = platid ? (const void *)platid->driver_data :NULL ; +if (info ==NULL )return -ENODEV ;@@ -500,6 +561,7 @@ static struct platform_driver sh_pfc_driver = { .driver = { .name = DRV_NAME, .owner = THIS_MODULE, + .of_match_table = of_match_ptr(sh_pfc_of_table), }, };(quoted diff) +0
-0
b/drivers/pinctrl/sh-pfc/pinctrl.cindex 3492ec9..7e32bb8 100644drivers/pinctrl/sh-pfc/pinctrl.c +115
-0@@ -14,7 +14,9 @@#include <linux/err.h> #include <linux/init.h> #include <linux/module.h> +#include <linux/of.h> #include <linux/pinctrl/consumer.h> +#include <linux/pinctrl/machine.h> #include <linux/pinctrl/pinconf.h> #include <linux/pinctrl/pinconf-generic.h> #include <linux/pinctrl/pinctrl.h> @@ -72,11 +74,125 @@ static void sh_pfc_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, seq_printf(s, "%s", DRV_NAME); } +static int sh_pfc_dt_subnode_to_map (struct device *dev,struct device_node *np, + struct pinctrl_map **map, +unsigned int *num_maps,unsigned int *index) +{ +struct pinctrl_map *maps = *map; +unsigned int nmaps = *num_maps; +unsigned int idx = *index; +const char *function =NULL ; +struct property *prop; +const char *group; +int ret; + +/* Parse the function and configuration properties. At least a function +* or one configuration must be specified. +*/ + ret =of_property_read_string (np,"renesas,function" , &function); +if (ret <0 && ret != -EINVAL ) { +dev_err (dev,"Invalid function in DT\n" ); +return ret; + } + +if (!function) { +dev_err (dev,"DT node must contain at least one function\n" ); + goto done; + } + +/* Count the number of groups and reallocate mappings. */ + ret =of_property_count_strings (np,"renesas,groups" ); +if (ret <0 && ret != -EINVAL ) { +dev_err (dev,"Invalid pin groups list in DT\n" ); + goto done; + } + +if (!ret) { +dev_err (dev,"No group provided in DT node\n" ); + ret = -ENODEV ; + goto done; + } + + nmaps += ret; + + maps =krealloc (maps,sizeof (*maps) * nmaps,GFP_KERNEL ); +if (maps ==NULL ) { + ret = -ENOMEM ; + goto done; + } + + *map = maps; + *num_maps = nmaps; + +/* Iterate over pins and groups and create the mappings. */ +of_property_for_each_string (np,"renesas,groups" , prop, group) { + maps[idx].type =PIN_MAP_TYPE_MUX_GROUP ; + maps[idx].data.mux.group = group; + maps[idx].data.mux.function = function; + idx++; + } + + ret =0 ; + +done: + *index = idx; +return ret; +} + +static void sh_pfc_dt_free_map (struct pinctrl_dev *pctldev, +struct pinctrl_map *map,unsigned num_maps) +{ +kfree (map); +} + +static int sh_pfc_dt_node_to_map (struct pinctrl_dev *pctldev, +struct device_node *np, +struct pinctrl_map **map,unsigned *num_maps) +{ +struct sh_pfc_pinctrl *pmx =pinctrl_dev_get_drvdata (pctldev); +struct device *dev = pmx->pfc->dev; +struct device_node *child; +unsigned int index; +int ret; + + *map =NULL ; + *num_maps =0 ; + index =0 ; + +for_each_child_of_node (np, child) { + ret =sh_pfc_dt_subnode_to_map (dev, child, map, num_maps, + &index); +if (ret <0 ) + goto done; + } + +/* If no mapping has been found in child nodes try the config node. */ +if (*num_maps ==0 ) { + ret =sh_pfc_dt_subnode_to_map (dev, np, map, num_maps, &index); +if (ret <0 ) + goto done; + } + +if (*num_maps) +return 0 ; + +dev_err (dev,"no mapping found in node %s\n" , np->full_name); + ret = -EINVAL ; + +done: +if (ret <0 ) +sh_pfc_dt_free_map (pctldev, *map, *num_maps); + +return ret; +} +static const struct pinctrl_ops sh_pfc_pinctrl_ops = { .get_groups_count = sh_pfc_get_groups_count, .get_group_name = sh_pfc_get_group_name, .get_group_pins = sh_pfc_get_group_pins, .pin_dbg_show = sh_pfc_pin_dbg_show, + .dt_node_to_map = sh_pfc_dt_node_to_map, + .dt_free_map = sh_pfc_dt_free_map, };static int sh_pfc_get_functions_count (struct pinctrl_dev *pctldev)Signature · 8 lines
Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v6 2/18 sh-pfc: Add DT support
Hi Simon,
Quoted 6 lines · On Monday 17 June 2013 16:03:16 Simon Horman wrote:
Hi Laurent,
As 3.10-rc6 has been released it is probably now too late for me to take this series through the renesas tree for v3.11.
I am happy for Linus to take it if that is what he would like to do.
OK.
Linus, would you like to take the series through your tree, or push it back to v3.12 ?
Quoted 413 lines
Otherwise I think we need to discuss how this should be handled for v3.12.
Quoted 410 lines · Laurent Pinchart
Hi Linus,
Would you be able to review this patch in the near future ? I'd like to push the series to v3.11.
Quoted 404 lines · On Friday 14 June 2013 01:45:47 Laurent Pinchart wrote:
Support device instantiation through the device tree. The compatible property is used to select the SoC pinmux information.
Set the
gpio_chipdevice field to the PFC device to enable automatic GPIO OF support.Cc: devicetree-discuss at lists.ozlabs.org
Signed-off-by: Laurent Pinchart
<[email protected]>
---.../bindings/pinctrl/renesas,pfc-pinctrl.txt | 135 ++++++++++++++++++ drivers/pinctrl/sh-pfc/core.c | 64 +++++++++- drivers/pinctrl/sh-pfc/pinctrl.c | 116 ++++++++++++++++++ 3 files changed, 314 insertions(+), 1 deletion(-) create mode 100644
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txtdiff --git
a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txtb/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txtnew file mode 100644
index 0000000..8264cbcDocumentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +3
-0@@ -0,0 +1,135 @@ +* Renesas Pin Function Controller (GPIO and Pin Mux/Config) + +The Pin Function Controller (PFC) is a Pin Mux/Config controller. OnSH7372, +SH73A0, R8A73A4 and R8A7740 it also acts as a GPIO controller.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +9
-0+ + +Pin Control +----------- + +Required Properties: + + - compatible: should be one of the following. + - "renesas,pfc-r8a73a4": for R8A73A4 (R-Mobile APE6) compatiblepin-controller. + - "renesas,pfc-r8a7740": for R8A7740 (R-Mobile A1)
compatible pin-controller. + - "renesas,pfc-r8a7778": for R8A7778
(R-Mobile M1) compatible pin-controller. + - "renesas,pfc-r8a7779":
for
R8A7779 (R-Car H1) compatible pin-controller. + -
"renesas,pfc-r8a7790":
for R8A7790 (R-Car H2) compatible pin-controller. + -
"renesas,pfc-sh7372": for SH7372 (SH-Mobile AP4) compatible pin-controller.
+ - "renesas,pfc-sh73a0": for SH73A0 (SH-Mobile AG5) compatible
pin-controller. +
+ - reg: Base address and length of each memory resource used by the pinDocumentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +5
-0+ controller hardware module. + +Optional properties: + + - #gpio-range-cells: Mandatory when the PFC doesn't handle GPIO,forbidden + otherwise. Should be 3.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ +The PFC node also acts as a container for pin configuration nodes.Please
refer +to pinctrl-bindings.txt in this directory for the definition of the
term "pin +configuration node" and for the common pinctrl bindings used by
client devices. +
+Each pin configuration node represents desired functions to select on a pin +group or a list of pin groups. The functions and pin groups can be specified +directly in the pin configuration node, or grouped in child subnodes. Several +functions can thus be referenced as a single pin configuration node by client +devices.Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ +A configuration node or subnode must contain a function and referenceat
least +one pin group.Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ +All pin configuration nodes and subnodes names are ignored. All ofthose
nodes +are parsed through phandles and processed purely based on their content. +Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +3
-0+Pin Configuration Node Properties: + +- renesas,groups : An array of strings, each string containing the nameof
a pin + group.
+
+- renesas,function: A string containing the name of the function to mux to
the + pin group(s) specified by the renesas,groups propertyDocumentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ + Valid values for pin, group and function names can be found in thegroup
and + function arrays of the PFC data file corresponding to the SoCDocumentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +7
-0+ (drivers/pinctrl/sh-pfc/pfc-*.c) + + +GPIO +---- + +On SH7372, SH73A0, R8A73A4 and R8A7740 the PFC node is also a GPIOcontroller +node.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +6
-0+ +Required Properties: + + - gpio-controller: Marks the device node as a gpio controller. + + - #gpio-cells: Should be 2. The first cell is the GPIO number and thesecond + cell specifies GPIO flags, as defined in
<dt-bindings/gpio/gpio.h>. Only the +GPIO_ACTIVE_HIGHandGPIO_ACTIVE_LOWflags are supported.Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +2
-0+ +The syntax of the gpio specifier used by client nodes should be thefollowing +with values derived from the SoC user manual.
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +6
-0+ + <[phandle of the gpio controller node] + [pin number within the gpio controller] + [flags]> + +On other mach-shmobile platforms GPIO is handled by the gpio-rcardriver.
+Please refer toDocumentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt+for documentation of the GPIO device tree bindings on those platforms. +Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +26
-0+ +Examples +-------- + +Example 1: SH73A0 (SH-Mobile AG5) pin controller node + + pfc: pfc at e6050000 { + compatible = "renesas,pfc-sh73a0"; + reg = <0xe6050000 0x8000>, + <0xe605801c 0x1c>; + gpio-controller; + #gpio-cells = <2>; + }; + +Example 2: A GPIO LED node that references a GPIO + + #include <dt-bindings/gpio/gpio.h> + + leds { + compatible = "gpio-leds"; + led1 { + gpios = <&pfc 20 GPIO_ACTIVE_LOW>; + }; + }; + +Example 3: KZM-A9-GT (SH-Mobile AG5) default pin state hog and pincontrol
maps + for the MMCIF and SCIFA4 devicesDocumentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +17
-0+ + &pfc { + pinctrl-0 = <&scifa4_pins>; + pinctrl-names = "default"; + + mmcif_pins: mmcif { + renesas,groups = "mmc0_data8_0", "mmc0_ctrl_0"; + renesas,function = "mmc0"; + }; + + scifa4_pins: scifa4 { + renesas,groups = "scifa4_data", "scifa4_ctrl"; + renesas,function = "scifa4"; + }; + }; + +Example 4: KZM-A9-GT (SH-Mobile AG5) default pin state for the MMCIFdevice +
Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt new file +8
-0+ &mmcif { + pinctrl-0 = <&mmcif_pins>; + pinctrl-names = "default"; + + bus-width = <8>; + vmmc-supply = <®_1p8v>; + status = "okay"; + };drivers/pinctrl/sh-pfc/core.c +2
-0@@ -18,6 +18,8 @@#include <linux/ioport.h> #include <linux/kernel.h> #include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> #include <
linux/pinctrl/machine.h>
#include <linux/platform_device.h>
#include <linux/slab.h>drivers/pinctrl/sh-pfc/core.c +61
-1@@ -348,13 +350,72 @@ int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type) return 0; } +#ifdef CONFIG_OF +static const struct of_device_id sh_pfc_of_table[] = { +#ifdef CONFIG_PINCTRL_PFC_R8A73A4 + { + .compatible ="renesas,pfc-r8a73a4" , + .data = &r8a73a4_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_R8A7740 + { + .compatible ="renesas,pfc-r8a7740" , + .data = &r8a7740_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_R8A7778 + { + .compatible ="renesas,pfc-r8a7778" , + .data = &r8a7778_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_R8A7779 + { + .compatible ="renesas,pfc-r8a7779" , + .data = &r8a7779_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_R8A7790 + { + .compatible ="renesas,pfc-r8a7790" , + .data = &r8a7790_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_SH7372 + { + .compatible ="renesas,pfc-sh7372" , + .data = &sh7372_pinmux_info, + }, +#endif +#ifdef CONFIG_PINCTRL_PFC_SH73A0 + { + .compatible ="renesas,pfc-sh73a0" , + .data = &sh73a0_pinmux_info, + }, +#endif + { }, +}; +MODULE_DEVICE_TABLE (of, sh_pfc_of_table); +#endif +static int sh_pfc_probe (struct platform_device *pdev) { +const struct platform_device_id *platid =platform_get_device_id (pdev); +#ifdef CONFIG_OF +struct device_node *np = pdev->dev.of_node; +#endif const struct sh_pfc_soc_info *info;struct sh_pfc *pfc;int ret; - info = (void *)pdev->id_entry->driver_data; +#ifdef CONFIG_OF +if (np) + info =of_match_device (sh_pfc_of_table, &pdev->dev)->data; + else +#endif + info = platid ? (const void *)platid->driver_data :NULL ; +if (info ==NULL )return -ENODEV ;@@ -500,6 +561,7 @@ static struct platform_driver sh_pfc_driver = { .driver = { .name = DRV_NAME, .owner = THIS_MODULE, + .of_match_table = of_match_ptr(sh_pfc_of_table),drivers/pinctrl/sh-pfc/core.c +0
-0}, };(quoted diff) +0
-0
b/drivers/pinctrl/sh-pfc/pinctrl.cindex 3492ec9..7e32bb8 100644drivers/pinctrl/sh-pfc/pinctrl.c +3
-0@@ -14,7 +14,9 @@#include <linux/err.h> #include <linux/init.h> #include <linux/module.h> +#include <linux/of.h> #include <linux/pinctrl/consumer.h> +#include <linux/pinctrl/machine.h> #include <linux/pinctrl/pinconf.h> #include <linux/pinctrl/pinconf-generic.h> #include <linux/pinctrl/pinctrl.h> @@ -72,11 +74,125 @@ static void sh_pfc_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, seq_printf(s, "%s", DRV_NAME); } +static int sh_pfc_dt_subnode_to_map(struct device *dev, struct
device_node
*np, + structpinctrl_map**map,drivers/pinctrl/sh-pfc/pinctrl.c +11
-0+ unsigned int *num_maps, unsigned int *index) +{ + struct pinctrl_map *maps = *map; +unsigned int nmaps = *num_maps; +unsigned int idx = *index; +const char *function =NULL ; +struct property *prop; +const char *group; +int ret; + +/* Parse the function and configuration properties. At least a function
drivers/pinctrl/sh-pfc/pinctrl.c +72
-0+* or one configuration must be specified. +*/ + ret =of_property_read_string (np,"renesas,function" , &function); +if (ret <0 && ret != -EINVAL ) { +dev_err (dev,"Invalid function in DT\n" ); +return ret; + } + +if (!function) { +dev_err (dev,"DT node must contain at least one function\n" ); + goto done; + } + +/* Count the number of groups and reallocate mappings. */ + ret =of_property_count_strings (np,"renesas,groups" ); +if (ret <0 && ret != -EINVAL ) { +dev_err (dev,"Invalid pin groups list in DT\n" ); + goto done; + } + +if (!ret) { +dev_err (dev,"No group provided in DT node\n" ); + ret = -ENODEV ; + goto done; + } + + nmaps += ret; + + maps =krealloc (maps,sizeof (*maps) * nmaps,GFP_KERNEL ); +if (maps ==NULL ) { + ret = -ENOMEM ; + goto done; + } + + *map = maps; + *num_maps = nmaps; + +/* Iterate over pins and groups and create the mappings. */ +of_property_for_each_string (np,"renesas,groups" , prop, group) { + maps[idx].type =PIN_MAP_TYPE_MUX_GROUP ; + maps[idx].data.mux.group = group; + maps[idx].data.mux.function = function; + idx++; + } + + ret =0 ; + +done: + *index = idx; +return ret; +} + +static void sh_pfc_dt_free_map (struct pinctrl_dev *pctldev, +struct pinctrl_map *map,unsigned num_maps) +{ +kfree (map); +} + +static int sh_pfc_dt_node_to_map (struct pinctrl_dev *pctldev, +struct device_node *np, +struct pinctrl_map **map,unsigned *num_maps) +{ +struct sh_pfc_pinctrl *pmx =pinctrl_dev_get_drvdata (pctldev); +struct device *dev = pmx->pfc->dev; +struct device_node *child; +unsigned int index; +int ret; + + *map =NULL ; + *num_maps =0 ; + index =0 ; +
Quoted 8 lines
Quoted 8 lines
drivers/pinctrl/sh-pfc/pinctrl.c static void sh_pfc_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
Quoted 8 lines
drivers/pinctrl/sh-pfc/pinctrl.c +8
-0+for_each_child_of_node (np, child) { + ret =sh_pfc_dt_subnode_to_map (dev, child, map, num_maps, + &index); +if (ret <0 ) + goto done; + } + +/* If no mapping has been found in child nodes try the config node.
*/
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
drivers/pinctrl/sh-pfc/pinctrl.c +21
-0+if (*num_maps ==0 ) { + ret =sh_pfc_dt_subnode_to_map (dev, np, map, num_maps, &index); +if (ret <0 ) + goto done; + } + +if (*num_maps) +return 0 ; + +dev_err (dev,"no mapping found in node %s\n" , np->full_name); + ret = -EINVAL ; + +done: +if (ret <0 ) +sh_pfc_dt_free_map (pctldev, *map, *num_maps); + +return ret; +} +static const struct pinctrl_ops sh_pfc_pinctrl_ops = { .get_groups_count = sh_pfc_get_groups_count, .get_group_name = sh_pfc_get_group_name, .get_group_pins = sh_pfc_get_group_pins, .pin_dbg_show = sh_pfc_pin_dbg_show, + .dt_node_to_map = sh_pfc_dt_node_to_map, + .dt_free_map = sh_pfc_dt_free_map, };static int sh_pfc_get_functions_count (struct pinctrl_dev *pctldev)
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v6 2/18 sh-pfc: Add DT support
Quoted 6 lines · Laurent Pinchart
Quoted 5 lines · On Monday 17 June 2013 16:03:16 Simon Horman wrote:
Hi Laurent,
As 3.10-rc6 has been released it is probably now too late for me to take this series through the renesas tree for v3.11.
Quoted 6 lines
Quoted 1 line
I am happy for Linus to take it if that is what he would like to do.
OK.
Linus, would you like to take the series through your tree, or push it back to v3.12 ?
Maybe a little bit of both?
I don't want to carry anything that will collide with the stuff harvested into ARM SoC through Simon.
Can you send a small set of self-contained patches that do not touch anything in arch/arm/* and which does not collide with anything already queued in ARM SoC for v3.11?
In that case I'd be happy to take it as some preparation for v3.12.
Yours,
Linus Walleij
PATCH v6 2/18 sh-pfc: Add DT support
Hi Linus,
Quoted 16 lines · On Monday 17 June 2013 13:28:52 Linus Walleij wrote:
Quoted 6 lines · Laurent Pinchart
Quoted 5 lines · On Monday 17 June 2013 16:03:16 Simon Horman wrote:
Hi Laurent,
As 3.10-rc6 has been released it is probably now too late for me to take this series through the renesas tree for v3.11.
Quoted 6 lines
Quoted 1 line
I am happy for Linus to take it if that is what he would like to do.
OK.
Linus, would you like to take the series through your tree, or push it back to v3.12 ?
Maybe a little bit of both?
Quoted 8 lines
I don't want to carry anything that will collide with the stuff harvested into ARM SoC through Simon.
Can you send a small set of self-contained patches that do not touch anything in
arch/arm/*and which does not collide with anything already queued in ARM SoC for v3.11?In that case I'd be happy to take it as some preparation for v3.12.
Thank you. Would it be possible in that case to also get generic pinconf DT support for the sh-pfc driver in v3.11 if I send the additional patch today ?
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v6 2/18 sh-pfc: Add DT support
Quoted 10 lines · Laurent Pinchart
Quoted 5 lines · On Monday 17 June 2013 13:28:52 Linus Walleij wrote:
Can you send a small set of self-contained patches that do not touch anything in
arch/arm/*and which does not collide with anything already queued in ARM SoC for v3.11?In that case I'd be happy to take it as some preparation for v3.12.
Thank you. Would it be possible in that case to also get generic pinconf DT support for the sh-pfc driver in v3.11 if I send the additional patch today ?
Sure.
Yours,
Linus Walleij
PATCH v6 3/18 ARM: shmobile: r8a73a4: Add pin control device to device tree
In reply to Laurent PinchartAdd a pfc node to the r8a73a4 device tree.
--- arch/arm/boot/dts/r8a73a4.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/r8a73a4.dtsi +7 -0
@@ -85,4 +85,11 @@ interrupt-parent = <&gic>; interrupts = <0 69 4>; }; + + pfc: pfc at e6050000 { + compatible = "renesas,pfc-r8a73a4"; + reg = <0xe6050000 0x9000>; + gpio-controller; + #gpio-cells = <2>; + }; };
Signature · 1 line
1.8.1.5
PATCH v6 4/18 ARM: shmobile: r8a7740: Add pin control device to device tree
In reply to Laurent PinchartAdd a pfc node to the r8a7740 device tree and remove manual pinmux initialization from the corresponding board files.
--- arch/arm/boot/dts/r8a7740.dtsi | 8 ++++++++ arch/arm/mach-shmobile/board-armadillo800eva-reference.c | 16 ++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-)
arch/arm/boot/dts/r8a7740.dtsi +8 -0
@@ -135,4 +135,12 @@ 0 72 0x4 0 73 0x4>; }; + + pfc: pfc at e6050000 { + compatible = "renesas,pfc-r8a7740"; + reg = <0xe6050000 0x8000>, + <0xe605800c 0x20>; + gpio-controller; + #gpio-cells = <2>; + }; };
arch/arm/mach-shmobile/board-armadillo800eva-reference.c +8 -8
@@ -121,7 +121,7 @@static const struct pinctrl_map eva_pinctrl_map[] = {/* SCIFA1 */ -PIN_MAP_MUX_GROUP_DEFAULT ("sh-sci.1" ,"pfc-r8a7740" , +PIN_MAP_MUX_GROUP_DEFAULT ("sh-sci.1" ,"e6050000.pfc" ,"scifa1_data" ,"scifa1" ), };
@@ -170,22 +170,22 @@ static void __init eva_init(void)eva_clock_init ();pinctrl_register_mappings (eva_pinctrl_map,ARRAY_SIZE (eva_pinctrl_map)); -r8a7740_pinmux_init ();r8a7740_meram_workaround (); -/* -* Touchscreen -* TODO: Move reset GPIO over to .dts when we can reference it -*/ -gpio_request_one (166 ,GPIOF_OUT_INIT_HIGH ,NULL );/* TP_RST_B */ -#ifdef CONFIG_CACHE_L2X0 /* Early BRESP enable, Shared attribute override enable, 32K*8way */ l2x0_init (IOMEM (0xf0002000 ),0x40440000 ,0x82000fff );#endif r8a7740_add_standard_devices_dt (); + +/* +* Touchscreen +* TODO: Move reset GPIO over to .dts when we can reference it +*/ +gpio_request_one (166 ,GPIOF_OUT_INIT_HIGH ,NULL );/* TP_RST_B */ +r8a7740_pm_init (); }
Signature · 1 line
1.8.1.5
PATCH v6 5/18 ARM: shmobile: r8a7778: Add pin control device to device tree
In reply to Laurent PinchartAdd a pfc node to the r8a7778 device tree.
--- arch/arm/boot/dts/r8a7778.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/boot/dts/r8a7778.dtsi +5 -0
@@ -32,4 +32,9 @@ reg = <0xfe438000 0x1000>, <0xfe430000 0x100>; }; + + pfc: pfc at fffc0000 { + compatible = "renesas,pfc-r8a7778"; + reg = <0xfffc000 0x118>; + }; };
Signature · 1 line
1.8.1.5
PATCH v6 6/18 ARM: shmobile: r8a7778: Add GPIO controller devices to device tree
In reply to Laurent PinchartAdd GPIO controller nodes to the r8a7778 core device tree.
--- arch/arm/boot/dts/r8a7778.dtsi | 51 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+)
arch/arm/boot/dts/r8a7778.dtsi +51 -0
@@ -33,8 +33,59 @@ <0xfe430000 0x100>; }; + gpio0: gpio at ffc40000 { + compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar"; + reg = <0xffc40000 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 103 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 0 32>; + }; + + gpio1: gpio at ffc41000 { + compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar"; + reg = <0xffc41000 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 103 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 32 32>; + }; + + gpio2: gpio at ffc42000 { + compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar"; + reg = <0xffc42000 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 103 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 64 32>; + }; + + gpio3: gpio at ffc43000 { + compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar"; + reg = <0xffc43000 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 103 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 96 32>; + }; + + gpio4: gpio at ffc44000 { + compatible = "renesas,gpio-r8a7778", "renesas,gpio-rcar"; + reg = <0xffc44000 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 103 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 128 27>; + }; + pfc: pfc at fffc0000 { compatible = "renesas,pfc-r8a7778"; reg = <0xfffc000 0x118>; + #gpio-range-cells = <3>; }; };
Signature · 1 line
1.8.1.5
PATCH v6 7/18 ARM: shmobile: r8a7779: Add pin control device to device tree
In reply to Laurent PinchartAdd a pfc node to the r8a7779 device tree and remove manual pinmux initialization from the corresponding board files.
--- arch/arm/boot/dts/r8a7779.dtsi | 5 +++++ arch/arm/mach-shmobile/board-marzen-reference.c | 17 ++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-)
arch/arm/boot/dts/r8a7779.dtsi +5 -0
@@ -101,6 +101,11 @@ interrupts = <0 81 0x4>; }; + pfc: pfc at fffc0000 { + compatible = "renesas,pfc-r8a7779"; + reg = <0xfffc0000 0x23c>; + }; + thermal at ffc48000 { compatible = "renesas,rcar-thermal"; reg = <0xffc48000 0x38>;
arch/arm/mach-shmobile/board-marzen-reference.c +8 -9
@@ -28,24 +28,24 @@static const struct pinctrl_map marzen_pinctrl_map[] = {/* SCIF2 (CN18: DEBUG0) */ -PIN_MAP_MUX_GROUP_DEFAULT ("sh-sci.2" ,"pfc-r8a7779" , +PIN_MAP_MUX_GROUP_DEFAULT ("sh-sci.2" ,"fffc0000.pfc" ,"scif2_data_c" ,"scif2" ),/* SCIF4 (CN19: DEBUG1) */ -PIN_MAP_MUX_GROUP_DEFAULT ("sh-sci.4" ,"pfc-r8a7779" , +PIN_MAP_MUX_GROUP_DEFAULT ("sh-sci.4" ,"fffc0000.pfc" ,"scif4_data" ,"scif4" ),/* SDHI0 */ -PIN_MAP_MUX_GROUP_DEFAULT ("sh_mobile_sdhi.0" ,"pfc-r8a7779" , +PIN_MAP_MUX_GROUP_DEFAULT ("sh_mobile_sdhi.0" ,"fffc0000.pfc" ,"sdhi0_data4" ,"sdhi0" ), -PIN_MAP_MUX_GROUP_DEFAULT ("sh_mobile_sdhi.0" ,"pfc-r8a7779" , +PIN_MAP_MUX_GROUP_DEFAULT ("sh_mobile_sdhi.0" ,"fffc0000.pfc" ,"sdhi0_ctrl" ,"sdhi0" ), -PIN_MAP_MUX_GROUP_DEFAULT ("sh_mobile_sdhi.0" ,"pfc-r8a7779" , +PIN_MAP_MUX_GROUP_DEFAULT ("sh_mobile_sdhi.0" ,"fffc0000.pfc" ,"sdhi0_cd" ,"sdhi0" ), -PIN_MAP_MUX_GROUP_DEFAULT ("sh_mobile_sdhi.0" ,"pfc-r8a7779" , +PIN_MAP_MUX_GROUP_DEFAULT ("sh_mobile_sdhi.0" ,"fffc0000.pfc" ,"sdhi0_wp" ,"sdhi0" ),/* SMSC */ -PIN_MAP_MUX_GROUP_DEFAULT ("smsc911x" ,"pfc-r8a7779" , +PIN_MAP_MUX_GROUP_DEFAULT ("smsc911x" ,"fffc0000.pfc" ,"intc_irq1_b" ,"intc" ), -PIN_MAP_MUX_GROUP_DEFAULT ("smsc911x" ,"pfc-r8a7779" , +PIN_MAP_MUX_GROUP_DEFAULT ("smsc911x" ,"fffc0000.pfc" ,"lbsc_ex_cs0" ,"lbsc" ), };
@@ -53,7 +53,6 @@ static void __init marzen_init(void) {pinctrl_register_mappings (marzen_pinctrl_map,ARRAY_SIZE (marzen_pinctrl_map)); -r8a7779_pinmux_init ();r8a7779_add_standard_devices_dt (); }
Signature · 1 line
1.8.1.5
PATCH v6 8/18 ARM: shmobile: r8a7779: Add GPIO controller devices to device tree
In reply to Laurent PinchartAdd GPIO controller nodes to the r8a7779 core device tree.
--- arch/arm/boot/dts/r8a7779.dtsi | 71 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+)
arch/arm/boot/dts/r8a7779.dtsi +71 -0
@@ -48,6 +48,76 @@ <0xf0000100 0x100>; }; + gpio0: gpio at ffc40000 { + compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; + reg = <0xffc40000 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 141 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 0 32>; + }; + + gpio1: gpio at ffc41000 { + compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; + reg = <0xffc41000 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 142 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 32 32>; + }; + + gpio2: gpio at ffc42000 { + compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; + reg = <0xffc42000 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 143 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 64 32>; + }; + + gpio3: gpio at ffc43000 { + compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; + reg = <0xffc43000 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 144 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 96 32>; + }; + + gpio4: gpio at ffc44000 { + compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; + reg = <0xffc44000 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 145 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 128 32>; + }; + + gpio5: gpio at ffc45000 { + compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; + reg = <0xffc45000 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 146 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 160 32>; + }; + + gpio6: gpio at ffc46000 { + compatible = "renesas,gpio-r8a7779", "renesas,gpio-rcar"; + reg = <0xffc46000 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 147 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 192 9>; + }; + irqpin0: irqpin at fe780010 { compatible = "renesas,intc-irqpin"; #interrupt-cells = <2>;
@@ -104,6 +174,7 @@ pfc: pfc at fffc0000 { compatible = "renesas,pfc-r8a7779"; reg = <0xfffc0000 0x23c>; + #gpio-range-cells = <3>; }; thermal at ffc48000 {
Signature · 1 line
1.8.1.5
PATCH v6 9/18 ARM: shmobile: r8a7790: Add pin control device to device tree
In reply to Laurent PinchartAdd a pfc node to the r8a7790 device tree.
--- arch/arm/boot/dts/r8a7790.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/boot/dts/r8a7790.dtsi +5 -0
@@ -54,4 +54,9 @@ interrupt-parent = <&gic>; interrupts = <0 0 4>, <0 1 4>, <0 2 4>, <0 3 4>; }; + + pfc: pfc at e6060000 { + compatible = "renesas,pfc-r8a7790"; + reg = <0 0xe6060000 0 0x250>; + }; };
Signature · 1 line
1.8.1.5
PATCH v6 10/18 ARM: shmobile: r8a7790: Add GPIO controller devices to device tree
In reply to Laurent PinchartAdd GPIO controller nodes to the r8a7790 core device tree.
--- arch/arm/boot/dts/r8a7790.dtsi | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+)
arch/arm/boot/dts/r8a7790.dtsi +61 -0
@@ -38,6 +38,66 @@ interrupts = <1 9 0xf04>; }; + gpio0: gpio at ffc40000 { + compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar"; + reg = <0 0xffc40000 0 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 4 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 0 32>; + }; + + gpio1: gpio at ffc41000 { + compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar"; + reg = <0 0xffc41000 0 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 5 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 32 32>; + }; + + gpio2: gpio at ffc42000 { + compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar"; + reg = <0 0xffc42000 0 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 6 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 64 32>; + }; + + gpio3: gpio at ffc43000 { + compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar"; + reg = <0 0xffc43000 0 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 7 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 96 32>; + }; + + gpio4: gpio at ffc44000 { + compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar"; + reg = <0 0xffc44000 0 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 8 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 128 32>; + }; + + gpio5: gpio at ffc45000 { + compatible = "renesas,gpio-r8a7790", "renesas,gpio-rcar"; + reg = <0 0xffc45000 0 0x2c>; + interrupt-parent = <&gic>; + interrupts = <0 9 0x4>; + #gpio-cells = <2>; + gpio-controller; + gpio-ranges = <&pfc 0 160 32>; + }; + timer { compatible = "arm,armv7-timer"; interrupts = <1 13 0xf08>,
@@ -58,5 +118,6 @@ pfc: pfc at e6060000 { compatible = "renesas,pfc-r8a7790"; reg = <0 0xe6060000 0 0x250>; + #gpio-range-cells = <3>; }; };
Signature · 1 line
1.8.1.5
PATCH v6 11/18 ARM: shmobile: sh7372: Add pin control device to device tree
In reply to Laurent PinchartAdd a pfc node to the sh7372 device tree.
--- arch/arm/boot/dts/sh7372.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/sh7372.dtsi +8 -0
@@ -18,4 +18,12 @@ compatible = "arm,cortex-a8"; }; }; + + pfc: pfc at e6050000 { + compatible = "renesas,pfc-sh7372"; + reg = <0xe6050000 0x8000>, + <0xe605801c 0x1c>; + gpio-controller; + #gpio-cells = <2>; + }; };
Signature · 1 line
1.8.1.5
PATCH v6 12/18 ARM: shmobile: sh73a0: Add pin control device to device tree
In reply to Laurent PinchartAdd a pfc node to the sh73a0 device tree and remove manual pinmux initialization from the corresponding board files.
--- arch/arm/boot/dts/sh73a0.dtsi | 8 ++++++++ arch/arm/mach-shmobile/board-kzm9g-reference.c | 27 +++++++++++++------------- 2 files changed, 21 insertions(+), 14 deletions(-)
arch/arm/boot/dts/sh73a0.dtsi +8 -0
@@ -222,4 +222,12 @@ cap-sd-highspeed; status = "disabled"; }; + + pfc: pfc at e6050000 { + compatible = "renesas,pfc-sh73a0"; + reg = <0xe6050000 0x8000>, + <0xe605801c 0x1c>; + gpio-controller; + #gpio-cells = <2>; + }; };
arch/arm/mach-shmobile/board-kzm9g-reference.c +13 -14
@@ -40,35 +40,35 @@ static unsigned long pin_pullup_conf[] = { };static const struct pinctrl_map kzm_pinctrl_map[] = { -PIN_MAP_MUX_GROUP_DEFAULT ("e6826000.i2c" ,"pfc-sh73a0" , +PIN_MAP_MUX_GROUP_DEFAULT ("e6826000.i2c" ,"e6050000.pfc" ,"i2c3_1" ,"i2c3" ),/* MMCIF */ -PIN_MAP_MUX_GROUP_DEFAULT ("e6bd0000.mmcif" ,"pfc-sh73a0" , +PIN_MAP_MUX_GROUP_DEFAULT ("e6bd0000.mmcif" ,"e6050000.pfc" ,"mmc0_data8_0" ,"mmc0" ), -PIN_MAP_MUX_GROUP_DEFAULT ("e6bd0000.mmcif" ,"pfc-sh73a0" , +PIN_MAP_MUX_GROUP_DEFAULT ("e6bd0000.mmcif" ,"e6050000.pfc" ,"mmc0_ctrl_0" ,"mmc0" ), -PIN_MAP_CONFIGS_PIN_DEFAULT ("e6bd0000.mmcif" ,"pfc-sh73a0" , +PIN_MAP_CONFIGS_PIN_DEFAULT ("e6bd0000.mmcif" ,"e6050000.pfc" ,"PORT279" , pin_pullup_conf), -PIN_MAP_CONFIGS_GROUP_DEFAULT ("e6bd0000.mmcif" ,"pfc-sh73a0" , +PIN_MAP_CONFIGS_GROUP_DEFAULT ("e6bd0000.mmcif" ,"e6050000.pfc" ,"mmc0_data8_0" , pin_pullup_conf),/* SCIFA4 */ -PIN_MAP_MUX_GROUP_DEFAULT ("sh-sci.4" ,"pfc-sh73a0" , +PIN_MAP_MUX_GROUP_DEFAULT ("sh-sci.4" ,"e6050000.pfc" ,"scifa4_data" ,"scifa4" ), -PIN_MAP_MUX_GROUP_DEFAULT ("sh-sci.4" ,"pfc-sh73a0" , +PIN_MAP_MUX_GROUP_DEFAULT ("sh-sci.4" ,"e6050000.pfc" ,"scifa4_ctrl" ,"scifa4" ),/* SDHI0 */ -PIN_MAP_MUX_GROUP_DEFAULT ("ee100000.sdhi" ,"pfc-sh73a0" , +PIN_MAP_MUX_GROUP_DEFAULT ("ee100000.sdhi" ,"e6050000.pfc" ,"sdhi0_data4" ,"sdhi0" ), -PIN_MAP_MUX_GROUP_DEFAULT ("ee100000.sdhi" ,"pfc-sh73a0" , +PIN_MAP_MUX_GROUP_DEFAULT ("ee100000.sdhi" ,"e6050000.pfc" ,"sdhi0_ctrl" ,"sdhi0" ), -PIN_MAP_MUX_GROUP_DEFAULT ("ee100000.sdhi" ,"pfc-sh73a0" , +PIN_MAP_MUX_GROUP_DEFAULT ("ee100000.sdhi" ,"e6050000.pfc" ,"sdhi0_cd" ,"sdhi0" ), -PIN_MAP_MUX_GROUP_DEFAULT ("ee100000.sdhi" ,"pfc-sh73a0" , +PIN_MAP_MUX_GROUP_DEFAULT ("ee100000.sdhi" ,"e6050000.pfc" ,"sdhi0_wp" ,"sdhi0" ),/* SDHI2 */ -PIN_MAP_MUX_GROUP_DEFAULT ("ee140000.sdhi" ,"pfc-sh73a0" , +PIN_MAP_MUX_GROUP_DEFAULT ("ee140000.sdhi" ,"e6050000.pfc" ,"sdhi2_data4" ,"sdhi2" ), -PIN_MAP_MUX_GROUP_DEFAULT ("ee140000.sdhi" ,"pfc-sh73a0" , +PIN_MAP_MUX_GROUP_DEFAULT ("ee140000.sdhi" ,"e6050000.pfc" ,"sdhi2_ctrl" ,"sdhi2" ), };
@@ -76,7 +76,6 @@ static void __init kzm_init(void) {sh73a0_add_standard_devices_dt ();pinctrl_register_mappings (kzm_pinctrl_map,ARRAY_SIZE (kzm_pinctrl_map)); -sh73a0_pinmux_init ();/* enable SD */ gpio_request_one (15 ,GPIOF_OUT_INIT_HIGH ,NULL );/* power */
Signature · 1 line
1.8.1.5
PATCH v6 13/18 ARM: shmobile: armadillo-reference: Move pinctrl mappings to device tree
In reply to Laurent PinchartReplace the pinctrl mappings in board code by device tree mappings. For devices that are still instantiated from board code reference the mappings as the default pin controller state to apply them at boot time.
--- arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts | 10 ++++++++++ arch/arm/mach-shmobile/board-armadillo800eva-reference.c | 9 --------- 2 files changed, 10 insertions(+), 9 deletions(-)
arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts +10 -0
@@ -43,3 +43,13 @@ interrupts = <2 0>; /* IRQ10: hwirq 2 on irqpin1 */ }; }; + +&pfc { + pinctrl-0 = <&scifa1_pins>; + pinctrl-names = "default"; + + scifa1_pins: scifa1 { + renesas,groups = "scifa1_data"; + renesas,function = "scifa1"; + }; +};
arch/arm/mach-shmobile/board-armadillo800eva-reference.c +0 -9
@@ -24,7 +24,6 @@#include <linux/kernel.h> #include <linux/gpio.h> #include <linux/io.h> -#include <linux/pinctrl/machine.h> #include <mach/common.h> #include <mach/r8a7740.h> #include <asm/mach/arch.h>
@@ -119,12 +118,6 @@* usbhsf_power_ctrl() */ -static const struct pinctrl_map eva_pinctrl_map[] = { -/* SCIFA1 */ -PIN_MAP_MUX_GROUP_DEFAULT ("sh-sci.1" ,"e6050000.pfc" , -"scifa1_data" ,"scifa1" ), -}; -static void __init eva_clock_init (void ) {struct clk *system =clk_get (NULL ,"system_clk" );
@@ -169,8 +162,6 @@ static void __init eva_init(void)r8a7740_clock_init (MD_CK0 |MD_CK2 );eva_clock_init (); -pinctrl_register_mappings (eva_pinctrl_map,ARRAY_SIZE (eva_pinctrl_map)); -r8a7740_meram_workaround ();#ifdef CONFIG_CACHE_L2X0
Signature · 1 line
1.8.1.5
PATCH v6 14/18 ARM: shmobile: armadillo-reference: Add st1232 pin mappings
In reply to Laurent PinchartAdd pin mappings for the st1232 device to the device tree and reference them as the default state for the device.
--- arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts +7 -0
@@ -41,6 +41,8 @@ reg = <0x55>; interrupt-parent = <&irqpin1>; interrupts = <2 0>; /* IRQ10: hwirq 2 on irqpin1 */ + pinctrl-0 = <&st1232_pins>; + pinctrl-names = "default"; }; };
@@ -52,4 +54,9 @@ renesas,groups = "scifa1_data"; renesas,function = "scifa1"; }; + + st1232_pins: st1232 { + renesas,groups = "intc_irq10"; + renesas,function = "intc"; + }; };
Signature · 1 line
1.8.1.5
PATCH v6 15/18 ARM: shmobile: armadillo-reference: Move st1232 reset GPIO to DT
In reply to Laurent PinchartReference the st1232 reset GPIO from the device tree and remove it from board code.
--- arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts | 2 ++ arch/arm/mach-shmobile/board-armadillo800eva-reference.c | 7 ------- 2 files changed, 2 insertions(+), 7 deletions(-)
arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts +2 -0
@@ -10,6 +10,7 @@ /dts-v1/; /include/ "r8a7740.dtsi" +#include <dt-bindings/gpio/gpio.h> / { model = "armadillo 800 eva reference";
@@ -43,6 +44,7 @@ interrupts = <2 0>; /* IRQ10: hwirq 2 on irqpin1 */ pinctrl-0 = <&st1232_pins>; pinctrl-names = "default"; + gpios = <&pfc 166 GPIO_ACTIVE_LOW>; }; };
arch/arm/mach-shmobile/board-armadillo800eva-reference.c +0 -7
@@ -158,7 +158,6 @@ clock_error:*/ static void __init eva_init (void ) { -r8a7740_clock_init (MD_CK0 |MD_CK2 );eva_clock_init ();
@@ -171,12 +170,6 @@ static void __init eva_init(void)r8a7740_add_standard_devices_dt (); -/* -* Touchscreen -* TODO: Move reset GPIO over to .dts when we can reference it -*/ -gpio_request_one (166 ,GPIOF_OUT_INIT_HIGH ,NULL );/* TP_RST_B */ -r8a7740_pm_init (); }
Signature · 1 line
1.8.1.5
PATCH v6 16/18 ARM: shmobile: armadillo-reference: Add LED1-LED4 to the device tree
In reply to Laurent PinchartLED1 to LED4 are GPIO LEDs. Add corresponding DT nodes.
--- arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts +15 -0
@@ -34,6 +34,21 @@ regulator-boot-on; }; + leds { + compatible = "gpio-leds"; + led1 { + gpios = <&pfc 102 GPIO_ACTIVE_HIGH>; + }; + led2 { + gpios = <&pfc 111 GPIO_ACTIVE_HIGH>; + }; + led3 { + gpios = <&pfc 110 GPIO_ACTIVE_HIGH>; + }; + led4 { + gpios = <&pfc 177 GPIO_ACTIVE_HIGH>; + }; + }; }; &i2c0 {
Signature · 1 line
1.8.1.5
PATCH v6 17/18 ARM: shmobile: marzen-reference: Move pinctrl mappings to device tree
In reply to Laurent PinchartReplace the pinctrl mappings in board code by device tree mappings. For devices that are still instantiated from board code reference the mappings as the default pin controller state to apply them at boot time.
--- arch/arm/boot/dts/r8a7779-marzen-reference.dts | 35 +++++++++++++++++++++++++ arch/arm/mach-shmobile/board-marzen-reference.c | 27 ------------------- 2 files changed, 35 insertions(+), 27 deletions(-)
arch/arm/boot/dts/r8a7779-marzen-reference.dts +35 -0
@@ -37,6 +37,9 @@ lan0 at 18000000 { compatible = "smsc,lan9220", "smsc,lan9115"; reg = <0x18000000 0x100>; + pinctrl-0 = <&lan0_pins>; + pinctrl-names = "default"; + phy-mode = "mii"; interrupt-parent = <&gic>; interrupts = <0 28 0x4>;
@@ -45,3 +48,35 @@ vdd33a-supply = <&fixedregulator3v3>; }; }; + +&pfc { + pinctrl-0 = <&scif2_pins &scif4_pins &sdhi0_pins>; + pinctrl-names = "default"; + + lan0_pins: lan0 { + intc { + renesas,groups = "intc_irq1_b"; + renesas,function = "intc"; + }; + lbsc { + renesas,groups = "lbsc_ex_cs0"; + renesas,function = "lbsc"; + }; + }; + + scif2_pins: scif2 { + renesas,groups = "scif2_data_c"; + renesas,function = "scif2"; + }; + + scif4_pins: scif4 { + renesas,groups = "scif4_data"; + renesas,function = "scif4"; + }; + + sdhi0_pins: sdhi0 { + renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd", + "sdhi0_wp"; + renesas,function = "sdhi0"; + }; +};
arch/arm/mach-shmobile/board-marzen-reference.c +0 -27
@@ -19,41 +19,14 @@* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include <linux/pinctrl/machine.h> #include <mach/r8a7779.h> #include <mach/common.h> #include <mach/irqs.h> #include <asm/irq.h> #include <asm/mach/arch.h> -static const struct pinctrl_map marzen_pinctrl_map[] = { -/* SCIF2 (CN18: DEBUG0) */ -PIN_MAP_MUX_GROUP_DEFAULT ("sh-sci.2" ,"fffc0000.pfc" , -"scif2_data_c" ,"scif2" ), -/* SCIF4 (CN19: DEBUG1) */ -PIN_MAP_MUX_GROUP_DEFAULT ("sh-sci.4" ,"fffc0000.pfc" , -"scif4_data" ,"scif4" ), -/* SDHI0 */ -PIN_MAP_MUX_GROUP_DEFAULT ("sh_mobile_sdhi.0" ,"fffc0000.pfc" , -"sdhi0_data4" ,"sdhi0" ), -PIN_MAP_MUX_GROUP_DEFAULT ("sh_mobile_sdhi.0" ,"fffc0000.pfc" , -"sdhi0_ctrl" ,"sdhi0" ), -PIN_MAP_MUX_GROUP_DEFAULT ("sh_mobile_sdhi.0" ,"fffc0000.pfc" , -"sdhi0_cd" ,"sdhi0" ), -PIN_MAP_MUX_GROUP_DEFAULT ("sh_mobile_sdhi.0" ,"fffc0000.pfc" , -"sdhi0_wp" ,"sdhi0" ), -/* SMSC */ -PIN_MAP_MUX_GROUP_DEFAULT ("smsc911x" ,"fffc0000.pfc" , -"intc_irq1_b" ,"intc" ), -PIN_MAP_MUX_GROUP_DEFAULT ("smsc911x" ,"fffc0000.pfc" , -"lbsc_ex_cs0" ,"lbsc" ), -}; -static void __init marzen_init (void ) { -pinctrl_register_mappings (marzen_pinctrl_map, -ARRAY_SIZE (marzen_pinctrl_map)); -r8a7779_add_standard_devices_dt (); }
Signature · 1 line
1.8.1.5
PATCH v6 18/18 ARM: shmobile: marzen-reference: Add LED2-LED4 to the device tree
In reply to Laurent PinchartLED2 to LED4 are GPIO LEDs. Add corresponding DT nodes.
--- arch/arm/boot/dts/r8a7779-marzen-reference.dts | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm/boot/dts/r8a7779-marzen-reference.dts +14 -0
@@ -11,6 +11,7 @@ /dts-v1/; /include/ "r8a7779.dtsi" +#include <dt-bindings/gpio/gpio.h> / { model = "marzen";
@@ -47,6 +48,19 @@ vddvario-supply = <&fixedregulator3v3>; vdd33a-supply = <&fixedregulator3v3>; }; + + leds { + compatible = "gpio-leds"; + led2 { + gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>; + }; + led3 { + gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>; + }; + led4 { + gpios = <&gpio4 31 GPIO_ACTIVE_HIGH>; + }; + }; }; &pfc {
Signature · 1 line
1.8.1.5