Message ID | 1422390694-12389-1-git-send-email-laurent.pinchart+renesas@ideasonboard.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | Geert Uytterhoeven |
Headers | show |
On Tue, Jan 27, 2015 at 9:31 PM, Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> wrote: > + if (of_find_property(np, "groups", NULL) || > + of_find_property(np, "pins", NULL)) { > + pmx->func_prop_name = "function"; > + pmx->groups_prop_name = "groups"; > + pmx->pins_prop_name = "pins"; > + } else { > + pmx->func_prop_name = "renesas,function"; > + pmx->groups_prop_name = "renesas,groups"; > + pmx->pins_prop_name = "renesas,pins"; > + } Do we want to be clever and save memory? pmx->func_prop_name = "renesas,function"; pmx->groups_prop_name = "renesas,groups"; pmx->pins_prop_name = "renesas,pins"; if (of_find_property(np, "groups", NULL) || of_find_property(np, "pins", NULL)) { pmx->func_prop_name += strlen("renesas,"); pmx->groups_prop_name += strlen("renesas,"); pmx->pins_prop_name += strlen("renesas,"); } Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Jan 27, 2015 at 9:31 PM, Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> wrote: > The "function", "pins" and "groups" pinmux and pinctrl properties have > been standardized. Support them in addition to the custom "renesas,*" > properties. New-style and old-style properties can't be mixed in DT. > > Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> (...) >> Would be nice if the PFC driver could be augmented to also accept the >> now standard bindings "groups" and "function" simply :) we're adding parse >> functions for those to the core. > > Something like this ? Yes :) > Please note two differences between the Renesas PFC bindings and the standard > bindings: > > - The standard bindings state that a pinctrl node must contain either a "pins" > property or a "groups" property, while the Renesas bindings allows for both > to coexist in the same node. Sascha also says this makes sense for him so I guess I'm getting a bit soft on the issue. > - The standard bindings don't allow a pinmux node to contain a "pins" property, > while the Renesas bindings do. Does that mean "pins" affect the muxing or that "pins" is about some per-pin config shoveled into the same node? The former is not OK, the latter is. > mmcif_pins: mmcif { > mux { > - renesas,groups = "mmc0_data8_0", "mmc0_ctrl_0"; > - renesas,function = "mmc0"; > + groups = "mmc0_data8_0", "mmc0_ctrl_0"; > + function = "mmc0"; > }; So that looks just very nice. > cfg { > - renesas,groups = "mmc0_data8_0"; > - renesas,pins = "PORT279"; > + groups = "mmc0_data8_0"; > + pins = "PORT279"; > bias-pull-up; And here I can't see the use of "groups" in this node since it doesn't match a function. It's a bit ambiguous what "groups" mean when you run into it like this. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Linus, On Wednesday 04 February 2015 09:40:48 Linus Walleij wrote: > On Tue, Jan 27, 2015 at 9:31 PM, Laurent Pinchart wrote: > > The "function", "pins" and "groups" pinmux and pinctrl properties have > > been standardized. Support them in addition to the custom "renesas,*" > > properties. New-style and old-style properties can't be mixed in DT. > > > > Signed-off-by: Laurent Pinchart > > <laurent.pinchart+renesas@ideasonboard.com> > > (...) > > >> Would be nice if the PFC driver could be augmented to also accept the > >> now standard bindings "groups" and "function" simply :) we're adding > >> parse functions for those to the core. > > > > Something like this ? > > Yes :) > > > Please note two differences between the Renesas PFC bindings and the > > standard bindings: > > > > - The standard bindings state that a pinctrl node must contain either a > > "pins" property or a "groups" property, while the Renesas bindings > > allows for both to coexist in the same node. > > Sascha also says this makes sense for him so I guess I'm getting a bit > soft on the issue. > > > - The standard bindings don't allow a pinmux node to contain a "pins" > > property, while the Renesas bindings do. > > Does that mean "pins" affect the muxing or that "pins" is about some per-pin > config shoveled into the same node? > > The former is not OK, the latter is. It means "pins" affect the muxing. The sh-pfc driver supports both muxing groups and muxing individual pins. > > mmcif_pins: mmcif { > > > > mux { > > - renesas,groups = "mmc0_data8_0", > > "mmc0_ctrl_0"; > > - renesas,function = "mmc0"; > > + groups = "mmc0_data8_0", "mmc0_ctrl_0"; > > + function = "mmc0"; > > }; > > So that looks just very nice. > > > cfg { > > - renesas,groups = "mmc0_data8_0"; > > - renesas,pins = "PORT279"; > > + groups = "mmc0_data8_0"; > > + pins = "PORT279"; > > bias-pull-up; > > And here I can't see the use of "groups" in this node since it > doesn't match a function. It's a bit ambiguous what "groups" > mean when you run into it like this. It means that the bias-pull-up configuration is applied to all pins of the "mmc0_data8_0" group, as well as to pin 279.
Hi Linus, I'd like to move forward with this patch, could you please comment on my reply ? On Wednesday 04 February 2015 11:53:34 Laurent Pinchart wrote: > On Wednesday 04 February 2015 09:40:48 Linus Walleij wrote: > > On Tue, Jan 27, 2015 at 9:31 PM, Laurent Pinchart wrote: > >> The "function", "pins" and "groups" pinmux and pinctrl properties have > >> been standardized. Support them in addition to the custom "renesas,*" > >> properties. New-style and old-style properties can't be mixed in DT. > >> > >> Signed-off-by: Laurent Pinchart > >> <laurent.pinchart+renesas@ideasonboard.com> > > > > (...) > > > >>> Would be nice if the PFC driver could be augmented to also accept the > >>> now standard bindings "groups" and "function" simply :) we're adding > >>> parse functions for those to the core. > >> > >> Something like this ? > > > > Yes :) > > > >> Please note two differences between the Renesas PFC bindings and the > >> standard bindings: > >> > >> - The standard bindings state that a pinctrl node must contain either a > >> "pins" property or a "groups" property, while the Renesas bindings > >> allows for both to coexist in the same node. > > > > Sascha also says this makes sense for him so I guess I'm getting a bit > > soft on the issue. > > > >> - The standard bindings don't allow a pinmux node to contain a "pins" > >> property, while the Renesas bindings do. > > > > Does that mean "pins" affect the muxing or that "pins" is about some > > per-pin config shoveled into the same node? > > > > The former is not OK, the latter is. > > It means "pins" affect the muxing. The sh-pfc driver supports both muxing > groups and muxing individual pins. > > >> mmcif_pins: mmcif { > >> > >> mux { > >> > >> - renesas,groups = "mmc0_data8_0", > >> "mmc0_ctrl_0"; > >> - renesas,function = "mmc0"; > >> + groups = "mmc0_data8_0", "mmc0_ctrl_0"; > >> + function = "mmc0"; > >> > >> }; > > > > So that looks just very nice. > > > >> cfg { > >> > >> - renesas,groups = "mmc0_data8_0"; > >> - renesas,pins = "PORT279"; > >> + groups = "mmc0_data8_0"; > >> + pins = "PORT279"; > >> > >> bias-pull-up; > > > > And here I can't see the use of "groups" in this node since it > > doesn't match a function. It's a bit ambiguous what "groups" > > mean when you run into it like this. > > It means that the bias-pull-up configuration is applied to all pins of the > "mmc0_data8_0" group, as well as to pin 279.
On Wed, Feb 4, 2015 at 10:53 AM, Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote: > On Wednesday 04 February 2015 09:40:48 Linus Walleij wrote: >> On Tue, Jan 27, 2015 at 9:31 PM, Laurent Pinchart wrote: >> > The "function", "pins" and "groups" pinmux and pinctrl properties have >> > been standardized. Support them in addition to the custom "renesas,*" >> > properties. New-style and old-style properties can't be mixed in DT. >> > >> > Signed-off-by: Laurent Pinchart >> > <laurent.pinchart+renesas@ideasonboard.com> >> >> (...) >> >> >> Would be nice if the PFC driver could be augmented to also accept the >> >> now standard bindings "groups" and "function" simply :) we're adding >> >> parse functions for those to the core. >> > >> > Something like this ? >> >> Yes :) >> >> > Please note two differences between the Renesas PFC bindings and the >> > standard bindings: >> > >> > - The standard bindings state that a pinctrl node must contain either a >> > "pins" property or a "groups" property, while the Renesas bindings >> > allows for both to coexist in the same node. >> >> Sascha also says this makes sense for him so I guess I'm getting a bit >> soft on the issue. >> >> > - The standard bindings don't allow a pinmux node to contain a "pins" >> > property, while the Renesas bindings do. >> >> Does that mean "pins" affect the muxing or that "pins" is about some per-pin >> config shoveled into the same node? >> >> The former is not OK, the latter is. > > It means "pins" affect the muxing. The sh-pfc driver supports both muxing > groups and muxing individual pins. OK. >> > mmcif_pins: mmcif { >> > >> > mux { >> > - renesas,groups = "mmc0_data8_0", >> > "mmc0_ctrl_0"; >> > - renesas,function = "mmc0"; >> > + groups = "mmc0_data8_0", "mmc0_ctrl_0"; >> > + function = "mmc0"; >> > }; >> >> So that looks just very nice. >> >> > cfg { >> > - renesas,groups = "mmc0_data8_0"; >> > - renesas,pins = "PORT279"; >> > + groups = "mmc0_data8_0"; >> > + pins = "PORT279"; >> > bias-pull-up; >> >> And here I can't see the use of "groups" in this node since it >> doesn't match a function. It's a bit ambiguous what "groups" >> mean when you run into it like this. > > It means that the bias-pull-up configuration is applied to all pins of the > "mmc0_data8_0" group, as well as to pin 279. OK. This looks good to me, is the patch applicable as it is, or will you rebase it and send out a non-RFC version? Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Laurent, On Fri, Mar 6, 2015 at 11:39 AM, Linus Walleij <linus.walleij@linaro.org> wrote: > On Wed, Feb 4, 2015 at 10:53 AM, Laurent Pinchart > <laurent.pinchart@ideasonboard.com> wrote: >> On Wednesday 04 February 2015 09:40:48 Linus Walleij wrote: >>> On Tue, Jan 27, 2015 at 9:31 PM, Laurent Pinchart wrote: >>> > The "function", "pins" and "groups" pinmux and pinctrl properties have >>> > been standardized. Support them in addition to the custom "renesas,*" >>> > properties. New-style and old-style properties can't be mixed in DT. >>> > >>> > Signed-off-by: Laurent Pinchart >>> > <laurent.pinchart+renesas@ideasonboard.com> >>> >>> (...) >>> >>> >> Would be nice if the PFC driver could be augmented to also accept the >>> >> now standard bindings "groups" and "function" simply :) we're adding >>> >> parse functions for those to the core. >>> > >>> > Something like this ? >>> >>> Yes :) >>> >>> > Please note two differences between the Renesas PFC bindings and the >>> > standard bindings: >>> > >>> > - The standard bindings state that a pinctrl node must contain either a >>> > "pins" property or a "groups" property, while the Renesas bindings >>> > allows for both to coexist in the same node. >>> >>> Sascha also says this makes sense for him so I guess I'm getting a bit >>> soft on the issue. >>> >>> > - The standard bindings don't allow a pinmux node to contain a "pins" >>> > property, while the Renesas bindings do. >>> >>> Does that mean "pins" affect the muxing or that "pins" is about some per-pin >>> config shoveled into the same node? >>> >>> The former is not OK, the latter is. >> >> It means "pins" affect the muxing. The sh-pfc driver supports both muxing >> groups and muxing individual pins. > > OK. > >>> > mmcif_pins: mmcif { >>> > >>> > mux { >>> > - renesas,groups = "mmc0_data8_0", >>> > "mmc0_ctrl_0"; >>> > - renesas,function = "mmc0"; >>> > + groups = "mmc0_data8_0", "mmc0_ctrl_0"; >>> > + function = "mmc0"; >>> > }; >>> >>> So that looks just very nice. >>> >>> > cfg { >>> > - renesas,groups = "mmc0_data8_0"; >>> > - renesas,pins = "PORT279"; >>> > + groups = "mmc0_data8_0"; >>> > + pins = "PORT279"; >>> > bias-pull-up; >>> >>> And here I can't see the use of "groups" in this node since it >>> doesn't match a function. It's a bit ambiguous what "groups" >>> mean when you run into it like this. >> >> It means that the bias-pull-up configuration is applied to all pins of the >> "mmc0_data8_0" group, as well as to pin 279. > > OK. > > This looks good to me, is the patch applicable as it is, or will you rebase > it and send out a non-RFC version? This seems to have fallen through the (ELC?) cracks... What's the status? Thanks! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Jun 9, 2015 at 4:35 PM, Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Fri, Mar 6, 2015 at 11:39 AM, Linus Walleij <linus.walleij@linaro.org> wrote: >> This looks good to me, is the patch applicable as it is, or will you rebase >> it and send out a non-RFC version? > > This seems to have fallen through the (ELC?) cracks... > What's the status? Me too. I guess it needs to be rebased by now... Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt index bfe72ec055e3..60d191911e80 100644 --- a/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/renesas,pfc-pinctrl.txt @@ -56,12 +56,12 @@ are parsed through phandles and processed purely based on their content. Pin Configuration Node Properties: -- renesas,pins : An array of strings, each string containing the name of a pin. -- renesas,groups : An array of strings, each string containing the name of a pin +- pins : An array of strings, each string containing the name of a pin. +- 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 +- function: A string containing the name of the function to mux to the pin + group(s) specified by the 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 @@ -139,19 +139,19 @@ Example 3: KZM-A9-GT (SH-Mobile AG5) default pin state hog and pin control maps mmcif_pins: mmcif { mux { - renesas,groups = "mmc0_data8_0", "mmc0_ctrl_0"; - renesas,function = "mmc0"; + groups = "mmc0_data8_0", "mmc0_ctrl_0"; + function = "mmc0"; }; cfg { - renesas,groups = "mmc0_data8_0"; - renesas,pins = "PORT279"; + groups = "mmc0_data8_0"; + pins = "PORT279"; bias-pull-up; }; }; scifa4_pins: scifa4 { - renesas,groups = "scifa4_data", "scifa4_ctrl"; - renesas,function = "scifa4"; + groups = "scifa4_data", "scifa4_ctrl"; + function = "scifa4"; }; }; diff --git a/drivers/pinctrl/sh-pfc/pinctrl.c b/drivers/pinctrl/sh-pfc/pinctrl.c index 072e7c62cab7..522909e74b2e 100644 --- a/drivers/pinctrl/sh-pfc/pinctrl.c +++ b/drivers/pinctrl/sh-pfc/pinctrl.c @@ -40,6 +40,10 @@ struct sh_pfc_pinctrl { struct pinctrl_pin_desc *pins; struct sh_pfc_pin_config *configs; + + const char *func_prop_name; + const char *groups_prop_name; + const char *pins_prop_name; }; static int sh_pfc_get_groups_count(struct pinctrl_dev *pctldev) @@ -96,10 +100,13 @@ static int sh_pfc_map_add_config(struct pinctrl_map *map, return 0; } -static int sh_pfc_dt_subnode_to_map(struct device *dev, struct device_node *np, +static int sh_pfc_dt_subnode_to_map(struct pinctrl_dev *pctldev, + struct device_node *np, struct pinctrl_map **map, unsigned int *num_maps, unsigned int *index) { + struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev); + struct device *dev = pmx->pfc->dev; struct pinctrl_map *maps = *map; unsigned int nmaps = *num_maps; unsigned int idx = *index; @@ -113,10 +120,27 @@ static int sh_pfc_dt_subnode_to_map(struct device *dev, struct device_node *np, const char *pin; int ret; + /* Support both the old Renesas-specific properties and the new standard + * properties. Mixing old and new properties isn't allowed, neither + * inside a subnode nor across subnodes. + */ + if (!pmx->func_prop_name) { + if (of_find_property(np, "groups", NULL) || + of_find_property(np, "pins", NULL)) { + pmx->func_prop_name = "function"; + pmx->groups_prop_name = "groups"; + pmx->pins_prop_name = "pins"; + } else { + pmx->func_prop_name = "renesas,function"; + pmx->groups_prop_name = "renesas,groups"; + pmx->pins_prop_name = "renesas,pins"; + } + } + /* 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); + ret = of_property_read_string(np, pmx->func_prop_name, &function); if (ret < 0 && ret != -EINVAL) { dev_err(dev, "Invalid function in DT\n"); return ret; @@ -129,11 +153,12 @@ static int sh_pfc_dt_subnode_to_map(struct device *dev, struct device_node *np, if (!function && num_configs == 0) { dev_err(dev, "DT node must contain at least a function or config\n"); + ret = -ENODEV; goto done; } /* Count the number of pins and groups and reallocate mappings. */ - ret = of_property_count_strings(np, "renesas,pins"); + ret = of_property_count_strings(np, pmx->pins_prop_name); if (ret == -EINVAL) { num_pins = 0; } else if (ret < 0) { @@ -143,7 +168,7 @@ static int sh_pfc_dt_subnode_to_map(struct device *dev, struct device_node *np, num_pins = ret; } - ret = of_property_count_strings(np, "renesas,groups"); + ret = of_property_count_strings(np, pmx->groups_prop_name); if (ret == -EINVAL) { num_groups = 0; } else if (ret < 0) { @@ -174,7 +199,7 @@ static int sh_pfc_dt_subnode_to_map(struct device *dev, struct device_node *np, *num_maps = nmaps; /* Iterate over pins and groups and create the mappings. */ - of_property_for_each_string(np, "renesas,groups", prop, group) { + of_property_for_each_string(np, pmx->groups_prop_name, prop, group) { if (function) { maps[idx].type = PIN_MAP_TYPE_MUX_GROUP; maps[idx].data.mux.group = group; @@ -198,7 +223,7 @@ static int sh_pfc_dt_subnode_to_map(struct device *dev, struct device_node *np, goto done; } - of_property_for_each_string(np, "renesas,pins", prop, pin) { + of_property_for_each_string(np, pmx->pins_prop_name, prop, pin) { ret = sh_pfc_map_add_config(&maps[idx], pin, PIN_MAP_TYPE_CONFIGS_PIN, configs, num_configs); @@ -246,7 +271,7 @@ static int sh_pfc_dt_node_to_map(struct pinctrl_dev *pctldev, index = 0; for_each_child_of_node(np, child) { - ret = sh_pfc_dt_subnode_to_map(dev, child, map, num_maps, + ret = sh_pfc_dt_subnode_to_map(pctldev, child, map, num_maps, &index); if (ret < 0) goto done; @@ -254,7 +279,7 @@ static int sh_pfc_dt_node_to_map(struct pinctrl_dev *pctldev, /* 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); + ret = sh_pfc_dt_subnode_to_map(pctldev, np, map, num_maps, &index); if (ret < 0) goto done; }