linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Thomas Richard <thomas.richard@bootlin.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Kees Cook <kees@kernel.org>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	thomas.petazzoni@bootlin.com, DanieleCleri@aaeon.eu,
	GaryWang@aaeon.com.tw, linux-hardening@vger.kernel.org
Subject: Re: [PATCH v6 12/12] pinctrl: Add pin controller driver for AAEON UP boards
Date: Wed, 21 May 2025 18:32:57 +0300	[thread overview]
Message-ID: <aC3yKaCNZA8H2KPt@smile.fi.intel.com> (raw)
In-Reply-To: <20250520-aaeon-up-board-pinctrl-support-v6-12-dcb3756be3c6@bootlin.com>

On Tue, May 20, 2025 at 03:28:36PM +0200, Thomas Richard wrote:
> This enables the pin control support of the onboard FPGA on AAEON UP
> boards.
> 
> This FPGA acts as a level shifter between the Intel SoC pins and the pin
> header, and also as a mux or switch.
> 
> +---------+          +--------------+             +---+
>           |          |              |             |   |
>           | PWM0     |       \      |             | H |
>           |----------|------  \-----|-------------| E |
>           | I2C0_SDA |              |             | A |
> Intel SoC |----------|------\       |             | D |
>           | GPIO0    |       \------|-------------| E |
>           |----------|------        |             | R |
>           |          |     FPGA     |             |   |
> ----------+          +--------------+             +---+
> 
> For most of the pins, the FPGA opens/closes a switch to enable/disable
> the access to the SoC pin from a pin header.
> Each switch, has a direction flag that is set depending the status of the
> SoC pin.
> 
> For some other pins, the FPGA acts as a mux, and routes one pin (or the
> other one) to the header.
> 
> The driver also provides a GPIO chip. It requests SoC pins in GPIO mode,
> and drives them in tandem with FPGA pins (switch/mux direction).
> 
> This commit adds support only for UP Squared board.

...

> +static int upboard_pinctrl_pin_get_mode(struct pinctrl_dev *pctldev, unsigned int pin)
> +{
> +	struct upboard_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
> +	struct upboard_pin *p = &pctrl->pins[pin];
> +	unsigned int val;
> +	int ret;
> +
> +	if (p->funcbit) {
> +		ret = regmap_field_read(p->funcbit, &val);
> +		if (ret)
> +			return ret;
> +		if (val)
> +			return UPBOARD_PIN_MODE_FUNCTION;
> +	}
> +
> +	ret = regmap_field_read(p->enbit, &val);
> +	if (ret)
> +		return ret;
> +	if (!val)
> +		return UPBOARD_PIN_MODE_DISABLED;
> +
> +	ret = regmap_field_read(p->dirbit, &val);
> +	if (ret)
> +		return ret;
> +
> +	return val ? UPBOARD_PIN_MODE_GPIO_IN : UPBOARD_PIN_MODE_GPIO_OUT;
> +}
> +
> +static void upboard_pinctrl_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
> +				     unsigned int offset)
> +{
> +	int ret;
> +
> +	ret = upboard_pinctrl_pin_get_mode(pctldev, offset);
> +	if (ret == UPBOARD_PIN_MODE_FUNCTION)
> +		seq_puts(s, "mode function ");
> +	else if (ret == UPBOARD_PIN_MODE_DISABLED)
> +		seq_puts(s, "HIGH-Z ");

> +	else
> +		seq_printf(s, "GPIO (%s) ", str_input_output(ret == UPBOARD_PIN_MODE_GPIO_IN));

Actually this should be

	else if (ret < 0)
		seq_printf(s, "N/A "); // or similar text
	else
		seq_printf(s, "GPIO (%s) ", str_input_output(ret == UPBOARD_PIN_MODE_GPIO_IN));

as the above may return a negative error code which is not listed here.

> +}

With the above being addressed,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

...

Thanks for doing this driver, eventually we will have it working
out-of-the-box. Do you have any plans for enabling HSI and SIM card
slot on UP Squared 7000?

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-05-21 15:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-20 13:28 [PATCH v6 00/12] Add pinctrl support for the AAEON UP board FPGA Thomas Richard
2025-05-20 13:28 ` [PATCH v6 01/12] gpiolib: add support to register sparse pin range Thomas Richard
2025-05-20 13:28 ` [PATCH v6 02/12] pinctrl: remove extern specifier for functions in machine.h Thomas Richard
2025-05-20 13:28 ` [PATCH v6 03/12] pinctrl: core: add devm_pinctrl_register_mappings() Thomas Richard
2025-05-20 13:28 ` [PATCH v6 04/12] gpio: aggregator: move GPIO forwarder allocation in a dedicated function Thomas Richard
2025-05-20 13:28 ` [PATCH v6 05/12] gpio: aggregator: refactor the code to add GPIO desc in the forwarder Thomas Richard
2025-05-20 13:28 ` [PATCH v6 06/12] gpio: aggregator: refactor the forwarder registration part Thomas Richard
2025-05-20 13:28 ` [PATCH v6 07/12] gpio: aggregator: update gpiochip_fwd_setup_delay_line() parameters Thomas Richard
2025-05-20 13:28 ` [PATCH v6 08/12] gpio: aggregator: export symbols of the GPIO forwarder library Thomas Richard
2025-05-20 13:28 ` [PATCH v6 09/12] gpio: aggregator: handle runtime registration of gpio_desc in gpiochip_fwd Thomas Richard
2025-05-20 13:28 ` [PATCH v6 10/12] gpio: aggregator: add possibility to attach data to the forwarder Thomas Richard
2025-05-20 13:28 ` [PATCH v6 11/12] lib/string_choices: Add str_input_output() helper Thomas Richard
2025-05-20 13:28 ` [PATCH v6 12/12] pinctrl: Add pin controller driver for AAEON UP boards Thomas Richard
2025-05-21 15:32   ` Andy Shevchenko [this message]
2025-06-09  9:01     ` Thomas Richard
2025-05-20 17:01 ` [PATCH v6 00/12] Add pinctrl support for the AAEON UP board FPGA Bartosz Golaszewski
2025-05-21  8:11 ` Linus Walleij

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aC3yKaCNZA8H2KPt@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=DanieleCleri@aaeon.eu \
    --cc=GaryWang@aaeon.com.tw \
    --cc=brgl@bgdev.pl \
    --cc=geert+renesas@glider.be \
    --cc=kees@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=thomas.richard@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).