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: <mrhi42z4bnswba4vls3shkrvls3wfqn5wwgb5tm5gvzspysz5h@k65xzhumzhuv>
Date: Mon, 9 Dec 2024 15:24:06 +0100
From: Thierry Reding <thierry.reding@...il.com>
To: Prathamesh Shete <pshete@...dia.com>
Cc: linus.walleij@...aro.org, peng.fan@....com, linux-gpio@...r.kernel.org, 
	linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] pinctrl-tegra: Add config property GPIO mode

On Mon, Dec 09, 2024 at 03:43:14PM +0530, Prathamesh Shete wrote:
> The SFIO/GPIO select bit is a crucial part of Tegra's pin multiplexing
> system:
> - When set to 1, the pin operates in SFIO mode, controlled by the
>   pin's assigned special function.
> - When set to 0, the pin operates as a general-purpose GPIO.
> 
> This SFIO/GPIO select bit that is set for a given pin is not displayed,
> adding the support to retrieve this information from the
> pinmux set for each pin.
> 
> Signed-off-by: Prathamesh Shete <pshete@...dia.com>
> ---
>  drivers/pinctrl/tegra/pinctrl-tegra.c | 11 +++++++++++
>  drivers/pinctrl/tegra/pinctrl-tegra.h |  2 ++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c
> index 9523b93008d0..b3501c78b5b6 100644
> --- a/drivers/pinctrl/tegra/pinctrl-tegra.c
> +++ b/drivers/pinctrl/tegra/pinctrl-tegra.c
> @@ -96,6 +96,7 @@ static const struct cfg_param {
>  	{"nvidia,slew-rate-falling",	TEGRA_PINCONF_PARAM_SLEW_RATE_FALLING},
>  	{"nvidia,slew-rate-rising",	TEGRA_PINCONF_PARAM_SLEW_RATE_RISING},
>  	{"nvidia,drive-type",		TEGRA_PINCONF_PARAM_DRIVE_TYPE},
> +	{"nvidia,gpio-mode",		TEGRA_PINCONF_PARAM_GPIO_MODE},
>  };
>  
>  static int tegra_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
> @@ -476,6 +477,16 @@ static int tegra_pinconf_reg(struct tegra_pmx *pmx,
>  		*bit = g->drvtype_bit;
>  		*width = 2;
>  		break;
> +	case TEGRA_PINCONF_PARAM_GPIO_MODE:
> +		if (pmx->soc->sfsel_in_mux) {
> +			*bank = g->mux_bank;
> +			*reg = g->mux_reg;
> +			*bit = g->sfsel_bit;
> +			*width = 1;
> +		} else {
> +			*reg = -ENODEV;

I think this should be either -EINVAL or -ENOTSUPP. If you look at
pinconf_generic_dump_one() where this function is ultimately called, it
will ignore those errors as "legal" but print out an error for all other
error codes. Since this code will potentially execute on chips that
don't support SFSEL in the mux register, leaving -ENODEV here might spam
the output with error messages.

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