lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y+S2qES83S4pZKOb@orome>
Date:   Thu, 9 Feb 2023 10:02:32 +0100
From:   Thierry Reding <thierry.reding@...il.com>
To:     Dipen Patel <dipenp@...dia.com>
Cc:     jonathanh@...dia.com, linux-kernel@...r.kernel.org,
        linux-tegra@...r.kernel.org, linux-gpio@...r.kernel.org,
        linus.walleij@...aro.org, devicetree@...r.kernel.org,
        linux-doc@...r.kernel.org, robh+dt@...nel.org,
        timestamp@...ts.linux.dev
Subject: Re: [PATCH 2/7] hte: Add Tegra234 provider

On Tue, Dec 27, 2022 at 04:43:48PM -0800, Dipen Patel wrote:
> On 11/29/22 7:00 PM, Dipen Patel wrote:
> > On 11/11/22 8:01 AM, Thierry Reding wrote:
> >> On Thu, Nov 03, 2022 at 10:45:18AM -0700, Dipen Patel wrote:
> >>> The Tegra234 AON GPIO instance and LIC IRQ support HTE. For the GPIO
> >>> HTE support, it requires to add mapping between GPIO and HTE framework.
> >>>
> >>> Signed-off-by: Dipen Patel <dipenp@...dia.com>
> >>> ---
> >>>  drivers/hte/hte-tegra194-test.c |   2 +-
> >>>  drivers/hte/hte-tegra194.c      | 124 ++++++++++++++++++++++++++++++--
> >>>  2 files changed, 121 insertions(+), 5 deletions(-)
> >>>
> >>> diff --git a/drivers/hte/hte-tegra194-test.c b/drivers/hte/hte-tegra194-test.c
> >>> index 5d776a185bd6..d79c28a80517 100644
> >>> --- a/drivers/hte/hte-tegra194-test.c
> >>> +++ b/drivers/hte/hte-tegra194-test.c
> >>> @@ -16,7 +16,7 @@
> >>>  #include <linux/hte.h>
> >>>  
> <snip>
> >>>  MODULE_DEVICE_TABLE(of, tegra_hte_of_match);
> >>> @@ -635,8 +742,17 @@ static int tegra_hte_probe(struct platform_device *pdev)
> >>>  
> >>>  		gc->match_from_linedata = tegra_hte_match_from_linedata;
> >>>  
> >>> -		hte_dev->c = gpiochip_find("tegra194-gpio-aon",
> >>> -					   tegra_get_gpiochip_from_name);
> >>> +		if (of_device_is_compatible(dev->of_node,
> >>> +					    "nvidia,tegra194-gte-aon"))
> >>> +			hte_dev->c = gpiochip_find("tegra194-gpio-aon",
> >>> +						tegra_get_gpiochip_from_name);
> >>> +		else if (of_device_is_compatible(dev->of_node,
> >>> +						 "nvidia,tegra234-gte-aon"))
> >>> +			hte_dev->c = gpiochip_find("tegra234-gpio-aon",
> >>> +						tegra_get_gpiochip_from_name);
> >>> +		else
> >>> +			return -ENODEV;
> >>
> >> I'm wondering: instead of doing this cumbersome lookup, perhaps it would
> >> be easier to create a direct link to the right GPIO controller with a
> >> phandle?
> > Possible, need to see if gpiod framework has API exposed to get the gpiochip from
> > the phandle.
> 
> Thierry, I can not find any API which can help retrieve gpio_chip from the GPIO controller
> phandle. I need gpio_chip->base to map GPIO line to GTE mapping.

gpiochip_find() should allow you to implement that. So instead of
tegra_get_gpiochip_from_name() you could implement a function that
matches on the phandle that you've read from the HTE node.

You could probably add such a helper to the GPIO core, since it seems to
me like it would be universally helpful.

Actually there's of_find_gpiochip_by_node() in gpiolib-of.c already, so
you could propose to export it for external users.

Thierry

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ