* [PATCH v1 0/2] of: property: Add fw_devlink support for more props @ 2021-01-20 8:05 Saravana Kannan 2021-01-20 8:05 ` [PATCH v1 1/2] of: property: Add fw_devlink support for "gpio" and "gpios" binding Saravana Kannan 2021-01-20 8:05 ` [PATCH v1 2/2] of: property: Add fw_devlink support for interrupts Saravana Kannan 0 siblings, 2 replies; 10+ messages in thread From: Saravana Kannan @ 2021-01-20 8:05 UTC (permalink / raw) To: Rob Herring, Frank Rowand, Greg Kroah-Hartman Cc: Saravana Kannan, linux-tegra, devicetree, linux-kernel, Linus Walleij, Bartosz Golaszewski, Geert Uytterhoeven, Jon Hunter, Marc Zyngier, Kevin Hilman, kernel-team This series combines two patches [1] [2] that'd conflict. Rob/Greg, I think this should go into driver-core-next since Patch 1/2 fixes issues caused by a patch in driver-core-next. Patch 2/2 also touches the same locations. So, combining both into a series. Marc, I'll add support for interrupt-map separately. It'll probably need to be its own series because it'll need some refactor. I don't want to block Patch 2/2 on that. -Saravana [1] - https://lore.kernel.org/lkml/20210115210159.3090203-1-saravanak@google.com/ [2] - https://lore.kernel.org/lkml/20201218210750.3455872-1-saravanak@google.com/ Individual -> Series: Patch 1/2: Addressed Geert's gpio-hog problem with gpio[s] property Patch 2/2: Switched to using of_irq_find_parent() Saravana Kannan (2): of: property: Add fw_devlink support for "gpio" and "gpios" binding of: property: Add fw_devlink support for interrupts drivers/of/property.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) -- 2.30.0.284.gd98b1dd5eaa7-goog ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v1 1/2] of: property: Add fw_devlink support for "gpio" and "gpios" binding 2021-01-20 8:05 [PATCH v1 0/2] of: property: Add fw_devlink support for more props Saravana Kannan @ 2021-01-20 8:05 ` Saravana Kannan 2021-01-20 15:40 ` Rob Herring ` (2 more replies) 2021-01-20 8:05 ` [PATCH v1 2/2] of: property: Add fw_devlink support for interrupts Saravana Kannan 1 sibling, 3 replies; 10+ messages in thread From: Saravana Kannan @ 2021-01-20 8:05 UTC (permalink / raw) To: Rob Herring, Frank Rowand, Greg Kroah-Hartman, Saravana Kannan Cc: linux-tegra, devicetree, linux-kernel, Linus Walleij, Bartosz Golaszewski, Geert Uytterhoeven, Jon Hunter, Marc Zyngier, Kevin Hilman, kernel-team To provide backward compatibility for boards that use deprecated DT bindings, we need to add fw_devlink support for "gpio" and "gpios". Cc: linux-tegra <linux-tegra@vger.kernel.org> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default") Tested-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Saravana Kannan <saravanak@google.com> --- drivers/of/property.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 5f9eed79a8aa..0b256ce9d7d5 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -1271,6 +1271,24 @@ static struct device_node *parse_iommu_maps(struct device_node *np, return of_parse_phandle(np, prop_name, (index * 4) + 1); } +static struct device_node *parse_gpio_compat(struct device_node *np, + const char *prop_name, int index) +{ + struct of_phandle_args sup_args; + + if (strcmp(prop_name, "gpio") && strcmp(prop_name, "gpios")) + return NULL; + + if (of_find_property(np, "gpio-hog", NULL)) + return NULL; + + if (of_parse_phandle_with_args(np, prop_name, "#gpio-cells", index, + &sup_args)) + return NULL; + + return sup_args.np; +} + static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_clocks, }, { .parse_prop = parse_interconnects, }, @@ -1296,6 +1314,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_pinctrl6, }, { .parse_prop = parse_pinctrl7, }, { .parse_prop = parse_pinctrl8, }, + { .parse_prop = parse_gpio_compat, }, { .parse_prop = parse_regulators, }, { .parse_prop = parse_gpio, }, { .parse_prop = parse_gpios, }, -- 2.30.0.284.gd98b1dd5eaa7-goog ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v1 1/2] of: property: Add fw_devlink support for "gpio" and "gpios" binding 2021-01-20 8:05 ` [PATCH v1 1/2] of: property: Add fw_devlink support for "gpio" and "gpios" binding Saravana Kannan @ 2021-01-20 15:40 ` Rob Herring 2021-01-20 17:24 ` Thierry Reding 2021-01-21 13:11 ` Linus Walleij 2 siblings, 0 replies; 10+ messages in thread From: Rob Herring @ 2021-01-20 15:40 UTC (permalink / raw) To: Saravana Kannan Cc: Frank Rowand, Greg Kroah-Hartman, linux-tegra, devicetree, linux-kernel, Linus Walleij, Bartosz Golaszewski, Geert Uytterhoeven, Jon Hunter, Marc Zyngier, Kevin Hilman, Android Kernel Team On Wed, Jan 20, 2021 at 2:05 AM Saravana Kannan <saravanak@google.com> wrote: > > To provide backward compatibility for boards that use deprecated DT > bindings, we need to add fw_devlink support for "gpio" and "gpios". > > Cc: linux-tegra <linux-tegra@vger.kernel.org> > Cc: Linus Walleij <linus.walleij@linaro.org> > Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: Geert Uytterhoeven <geert@linux-m68k.org> > Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default") > Tested-by: Jon Hunter <jonathanh@nvidia.com> > Signed-off-by: Saravana Kannan <saravanak@google.com> > --- > drivers/of/property.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) Reviewed-by: Rob Herring <robh@kernel.org> ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v1 1/2] of: property: Add fw_devlink support for "gpio" and "gpios" binding 2021-01-20 8:05 ` [PATCH v1 1/2] of: property: Add fw_devlink support for "gpio" and "gpios" binding Saravana Kannan 2021-01-20 15:40 ` Rob Herring @ 2021-01-20 17:24 ` Thierry Reding 2021-01-21 13:11 ` Linus Walleij 2 siblings, 0 replies; 10+ messages in thread From: Thierry Reding @ 2021-01-20 17:24 UTC (permalink / raw) To: Saravana Kannan Cc: Rob Herring, Frank Rowand, Greg Kroah-Hartman, linux-tegra, devicetree, linux-kernel, Linus Walleij, Bartosz Golaszewski, Geert Uytterhoeven, Jon Hunter, Marc Zyngier, Kevin Hilman, kernel-team [-- Attachment #1: Type: text/plain, Size: 789 bytes --] On Wed, Jan 20, 2021 at 12:05:20AM -0800, Saravana Kannan wrote: > To provide backward compatibility for boards that use deprecated DT > bindings, we need to add fw_devlink support for "gpio" and "gpios". > > Cc: linux-tegra <linux-tegra@vger.kernel.org> > Cc: Linus Walleij <linus.walleij@linaro.org> > Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Cc: Geert Uytterhoeven <geert@linux-m68k.org> > Fixes: e590474768f1 ("driver core: Set fw_devlink=on by default") > Tested-by: Jon Hunter <jonathanh@nvidia.com> > Signed-off-by: Saravana Kannan <saravanak@google.com> > --- > drivers/of/property.c | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) Reviewed-by: Thierry Reding <treding@nvidia.com> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v1 1/2] of: property: Add fw_devlink support for "gpio" and "gpios" binding 2021-01-20 8:05 ` [PATCH v1 1/2] of: property: Add fw_devlink support for "gpio" and "gpios" binding Saravana Kannan 2021-01-20 15:40 ` Rob Herring 2021-01-20 17:24 ` Thierry Reding @ 2021-01-21 13:11 ` Linus Walleij 2021-01-21 18:29 ` Saravana Kannan 2 siblings, 1 reply; 10+ messages in thread From: Linus Walleij @ 2021-01-21 13:11 UTC (permalink / raw) To: Saravana Kannan Cc: Rob Herring, Frank Rowand, Greg Kroah-Hartman, linux-tegra, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, linux-kernel, Bartosz Golaszewski, Geert Uytterhoeven, Jon Hunter, Marc Zyngier, Kevin Hilman, Android Kernel Team On Wed, Jan 20, 2021 at 9:05 AM Saravana Kannan <saravanak@google.com> wrote: > To provide backward compatibility for boards that use deprecated DT > bindings, we need to add fw_devlink support for "gpio" and "gpios". You do some more stuff in the patch so describe that too. Especially the check for hogs and #gpio-cells. Describe why you do that. Maybe even with a comment in the code because I don't think everyone will understand. > + if (strcmp(prop_name, "gpio") && strcmp(prop_name, "gpios")) > + return NULL; This part is easy to understand. > + if (of_find_property(np, "gpio-hog", NULL)) > + return NULL; > + > + if (of_parse_phandle_with_args(np, prop_name, "#gpio-cells", index, > + &sup_args)) > + return NULL; This part is hard to understand. Insert comments and tell the reader of the code what is going on and why. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v1 1/2] of: property: Add fw_devlink support for "gpio" and "gpios" binding 2021-01-21 13:11 ` Linus Walleij @ 2021-01-21 18:29 ` Saravana Kannan 0 siblings, 0 replies; 10+ messages in thread From: Saravana Kannan @ 2021-01-21 18:29 UTC (permalink / raw) To: Linus Walleij Cc: Rob Herring, Frank Rowand, Greg Kroah-Hartman, linux-tegra, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, linux-kernel, Bartosz Golaszewski, Geert Uytterhoeven, Jon Hunter, Marc Zyngier, Kevin Hilman, Android Kernel Team On Thu, Jan 21, 2021 at 5:11 AM Linus Walleij <linus.walleij@linaro.org> wrote: > > On Wed, Jan 20, 2021 at 9:05 AM Saravana Kannan <saravanak@google.com> wrote: > > > To provide backward compatibility for boards that use deprecated DT > > bindings, we need to add fw_devlink support for "gpio" and "gpios". > > You do some more stuff in the patch so describe that too. > Especially the check for hogs and #gpio-cells. > Describe why you do that. Maybe even with a comment in > the code because I don't think everyone will understand. Ack > > > + if (strcmp(prop_name, "gpio") && strcmp(prop_name, "gpios")) > > + return NULL; > > This part is easy to understand. > > > + if (of_find_property(np, "gpio-hog", NULL)) > > + return NULL; > > + > > + if (of_parse_phandle_with_args(np, prop_name, "#gpio-cells", index, > > + &sup_args)) > > + return NULL; > > This part is hard to understand. Insert comments and tell the reader > of the code what is going on and why. I assume the "hard to understand" part is the gpio-hog part? Because the last line is pretty straightforward -- it's returning the index-th phandle. Also, it's a copy-paste from the DEFINE_SIMPLE_PROP macro. -Saravana ^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v1 2/2] of: property: Add fw_devlink support for interrupts 2021-01-20 8:05 [PATCH v1 0/2] of: property: Add fw_devlink support for more props Saravana Kannan 2021-01-20 8:05 ` [PATCH v1 1/2] of: property: Add fw_devlink support for "gpio" and "gpios" binding Saravana Kannan @ 2021-01-20 8:05 ` Saravana Kannan 2021-01-20 15:40 ` Rob Herring ` (2 more replies) 1 sibling, 3 replies; 10+ messages in thread From: Saravana Kannan @ 2021-01-20 8:05 UTC (permalink / raw) To: Rob Herring, Frank Rowand, Greg Kroah-Hartman Cc: Saravana Kannan, linux-tegra, devicetree, linux-kernel, Linus Walleij, Bartosz Golaszewski, Geert Uytterhoeven, Jon Hunter, Marc Zyngier, Kevin Hilman, kernel-team This allows fw_devlink to create device links between consumers of an interrupt and the supplier of the interrupt. Cc: Marc Zyngier <maz@kernel.org> Cc: Kevin Hilman <khilman@baylibre.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Saravana Kannan <saravanak@google.com> --- drivers/of/property.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/of/property.c b/drivers/of/property.c index 0b256ce9d7d5..9dd9cc50e65a 100644 --- a/drivers/of/property.c +++ b/drivers/of/property.c @@ -24,6 +24,7 @@ #include <linux/of.h> #include <linux/of_device.h> #include <linux/of_graph.h> +#include <linux/of_irq.h> #include <linux/string.h> #include <linux/moduleparam.h> @@ -1289,6 +1290,15 @@ static struct device_node *parse_gpio_compat(struct device_node *np, return sup_args.np; } +static struct device_node *parse_interrupts(struct device_node *np, + const char *prop_name, int index) +{ + if (strcmp(prop_name, "interrupts") || index) + return NULL; + + return of_irq_find_parent(np); +} + static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_clocks, }, { .parse_prop = parse_interconnects, }, @@ -1315,6 +1325,7 @@ static const struct supplier_bindings of_supplier_bindings[] = { { .parse_prop = parse_pinctrl7, }, { .parse_prop = parse_pinctrl8, }, { .parse_prop = parse_gpio_compat, }, + { .parse_prop = parse_interrupts, }, { .parse_prop = parse_regulators, }, { .parse_prop = parse_gpio, }, { .parse_prop = parse_gpios, }, -- 2.30.0.284.gd98b1dd5eaa7-goog ^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v1 2/2] of: property: Add fw_devlink support for interrupts 2021-01-20 8:05 ` [PATCH v1 2/2] of: property: Add fw_devlink support for interrupts Saravana Kannan @ 2021-01-20 15:40 ` Rob Herring 2021-01-20 17:24 ` Thierry Reding 2021-01-21 13:12 ` Linus Walleij 2 siblings, 0 replies; 10+ messages in thread From: Rob Herring @ 2021-01-20 15:40 UTC (permalink / raw) To: Saravana Kannan Cc: Frank Rowand, Greg Kroah-Hartman, linux-tegra, devicetree, linux-kernel, Linus Walleij, Bartosz Golaszewski, Geert Uytterhoeven, Jon Hunter, Marc Zyngier, Kevin Hilman, Android Kernel Team On Wed, Jan 20, 2021 at 2:05 AM Saravana Kannan <saravanak@google.com> wrote: > > This allows fw_devlink to create device links between consumers of an > interrupt and the supplier of the interrupt. > > Cc: Marc Zyngier <maz@kernel.org> > Cc: Kevin Hilman <khilman@baylibre.com> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Signed-off-by: Saravana Kannan <saravanak@google.com> > --- > drivers/of/property.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) Reviewed-by: Rob Herring <robh@kernel.org> ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v1 2/2] of: property: Add fw_devlink support for interrupts 2021-01-20 8:05 ` [PATCH v1 2/2] of: property: Add fw_devlink support for interrupts Saravana Kannan 2021-01-20 15:40 ` Rob Herring @ 2021-01-20 17:24 ` Thierry Reding 2021-01-21 13:12 ` Linus Walleij 2 siblings, 0 replies; 10+ messages in thread From: Thierry Reding @ 2021-01-20 17:24 UTC (permalink / raw) To: Saravana Kannan Cc: Rob Herring, Frank Rowand, Greg Kroah-Hartman, linux-tegra, devicetree, linux-kernel, Linus Walleij, Bartosz Golaszewski, Geert Uytterhoeven, Jon Hunter, Marc Zyngier, Kevin Hilman, kernel-team [-- Attachment #1: Type: text/plain, Size: 522 bytes --] On Wed, Jan 20, 2021 at 12:05:21AM -0800, Saravana Kannan wrote: > This allows fw_devlink to create device links between consumers of an > interrupt and the supplier of the interrupt. > > Cc: Marc Zyngier <maz@kernel.org> > Cc: Kevin Hilman <khilman@baylibre.com> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Signed-off-by: Saravana Kannan <saravanak@google.com> > --- > drivers/of/property.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) Reviewed-by: Thierry Reding <treding@nvidia.com> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v1 2/2] of: property: Add fw_devlink support for interrupts 2021-01-20 8:05 ` [PATCH v1 2/2] of: property: Add fw_devlink support for interrupts Saravana Kannan 2021-01-20 15:40 ` Rob Herring 2021-01-20 17:24 ` Thierry Reding @ 2021-01-21 13:12 ` Linus Walleij 2 siblings, 0 replies; 10+ messages in thread From: Linus Walleij @ 2021-01-21 13:12 UTC (permalink / raw) To: Saravana Kannan Cc: Rob Herring, Frank Rowand, Greg Kroah-Hartman, linux-tegra, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, linux-kernel, Bartosz Golaszewski, Geert Uytterhoeven, Jon Hunter, Marc Zyngier, Kevin Hilman, Android Kernel Team On Wed, Jan 20, 2021 at 9:05 AM Saravana Kannan <saravanak@google.com> wrote: > This allows fw_devlink to create device links between consumers of an > interrupt and the supplier of the interrupt. > > Cc: Marc Zyngier <maz@kernel.org> > Cc: Kevin Hilman <khilman@baylibre.com> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> > Signed-off-by: Saravana Kannan <saravanak@google.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-01-21 18:37 UTC | newest] Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-01-20 8:05 [PATCH v1 0/2] of: property: Add fw_devlink support for more props Saravana Kannan 2021-01-20 8:05 ` [PATCH v1 1/2] of: property: Add fw_devlink support for "gpio" and "gpios" binding Saravana Kannan 2021-01-20 15:40 ` Rob Herring 2021-01-20 17:24 ` Thierry Reding 2021-01-21 13:11 ` Linus Walleij 2021-01-21 18:29 ` Saravana Kannan 2021-01-20 8:05 ` [PATCH v1 2/2] of: property: Add fw_devlink support for interrupts Saravana Kannan 2021-01-20 15:40 ` Rob Herring 2021-01-20 17:24 ` Thierry Reding 2021-01-21 13:12 ` Linus Walleij
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).