From: Clement LE GOFFIC <clement.legoffic@foss.st.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre Torgue <alexandre.torgue@foss.st.com>,
Bartosz Golaszewski <brgl@bgdev.pl>,
<linux-kernel@vger.kernel.org>, <linux-gpio@vger.kernel.org>,
<devicetree@vger.kernel.org>,
<linux-stm32@st-md-mailman.stormreply.com>,
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2 2/8] pinctrl: stm32: Introduce HDP driver
Date: Wed, 21 May 2025 11:49:47 +0200 [thread overview]
Message-ID: <94795d0c-0c73-41eb-ada6-9a01b2ac5892@foss.st.com> (raw)
In-Reply-To: <CACRpkdZp6D-duzyVRLv5+PURb3Nu69njJx_33D-2aYS4DjmsoQ@mail.gmail.com>
On 5/21/25 00:34, Linus Walleij wrote:
> Hi Clément,
>
> thanks for your patch!
>
> On Tue, May 20, 2025 at 5:04 PM Clément Le Goffic
> <clement.legoffic@foss.st.com> wrote:
>
>> This patch introduce the driver for the Hardware Debug Port available on
>> STM32MP platforms. The HDP allows the observation of internal SoC
>> signals by using multiplexers. Each HDP port can provide up to 16
>> internal signals (one of them can be software controlled as a GPO).
>>
>> Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
>
> (...)
>> +static int stm32_hdp_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)
>> +{
>> + return GPIO_LINE_DIRECTION_OUT;
>> +}
>
> That's reasonable.
>
>> +static int stm32_hdp_gpio_get(struct gpio_chip *gc, unsigned int offset)
>> +{
>> + struct stm32_hdp *hdp = gpiochip_get_data(gc);
>> +
>> + if (((hdp->mux_conf & HDP_MUX_MASK(offset))) == HDP_MUX_GPOVAL(offset))
>> + return !!(readl_relaxed(hdp->base + HDP_GPOVAL) & BIT(offset));
>> + else
>> + return !!(readl_relaxed(hdp->base + HDP_VAL) & BIT(offset));
>> +}
>
> ...but you still make it possible to read the value of the line
> if it's not muxed as GPO?
>
> Should it not stm32_hdp_gpio_get_direction() return
> GPIO_LINE_DIRECTION_IN if HDP_MUX_MASK(offset))) != HDP_MUX_GPOVAL(offset)?
Hi, oops, you're right !
>
>> +static void stm32_hdp_gpio_set(struct gpio_chip *gc, unsigned int offset, int value)
>> +{
>> + struct stm32_hdp *hdp = gpiochip_get_data(gc);
>> +
>> + if (value)
>> + writel_relaxed(BIT(offset), hdp->base + HDP_GPOSET);
>> + else
>> + writel_relaxed(BIT(offset), hdp->base + HDP_GPOCLR);
>> +}
>
> Can't you just use GPIO_GENERIC for this?
>
> bgpio_init(gc, dev, ARRAY_SIZE(stm32_hdp_pins), // == 8
> hdp->base + HDP_VAL,
> hdp->base + HDP_GPOSET,
> hdp->base + HDP_GPOCLR,
> NULL,
> NULL,
> 0);
>
> The default behaviour of GPIO MMIO is to read the output register
> for the value if the line is in output mode.
>
> You may wanna override the .get_direction() callback after bgpio_init()
> and before registering the chip, either with what you have or what
> I described above.
I didn't know about it, I'll take a look and provide a V3.
Thank you,
Clément
> Yours,
> Linus Walleij
next prev parent reply other threads:[~2025-05-21 9:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-20 15:02 [PATCH v2 0/8] Introduce HDP support for STM32MP platforms Clément Le Goffic
2025-05-20 15:02 ` [PATCH v2 1/8] dt-bindings: pinctrl: stm32: Introduce HDP Clément Le Goffic
2025-05-20 19:25 ` Rob Herring (Arm)
2025-05-20 19:37 ` Rob Herring
2025-05-21 8:55 ` Clement LE GOFFIC
2025-05-21 10:31 ` [Linux-stm32] " Amelie Delaunay
2025-05-20 15:02 ` [PATCH v2 2/8] pinctrl: stm32: Introduce HDP driver Clément Le Goffic
2025-05-20 22:34 ` Linus Walleij
2025-05-21 9:49 ` Clement LE GOFFIC [this message]
2025-05-21 10:14 ` Clement LE GOFFIC
2025-05-21 21:34 ` kernel test robot
2025-05-20 15:02 ` [PATCH v2 3/8] MAINTAINERS: Add Clément Le Goffic as STM32 HDP maintainer Clément Le Goffic
2025-05-20 15:02 ` [PATCH v2 4/8] ARM: dts: stm32: add Hardware debug port (HDP) on stm32mp13 Clément Le Goffic
2025-05-20 15:02 ` [PATCH v2 5/8] ARM: dts: stm32: add Hardware debug port (HDP) on stm32mp15 Clément Le Goffic
2025-05-20 15:02 ` [PATCH v2 6/8] ARM: dts: stm32: add Hardware debug port (HDP) on stm32mp25 Clément Le Goffic
2025-05-20 15:02 ` [PATCH v2 7/8] ARM: dts: stm32: add alternate pinmux for HDP pin and add HDP pinctrl node Clément Le Goffic
2025-05-20 15:02 ` [PATCH v2 8/8] ARM: dts: stm32: add Hardware debug port (HDP) on stm32mp157c-dk2 board Clément Le Goffic
2025-05-20 21:09 ` [PATCH v2 0/8] Introduce HDP support for STM32MP platforms Rob Herring (Arm)
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=94795d0c-0c73-41eb-ada6-9a01b2ac5892@foss.st.com \
--to=clement.legoffic@foss.st.com \
--cc=alexandre.torgue@foss.st.com \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=robh@kernel.org \
/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).