2024-05-03 16:24:53

by Sean Anderson

[permalink] [raw]
Subject: [PATCH 0/2] pinctrl: zynqmp: Support muxing individual pins

This series adds support for muxing individual pins, instead of
requiring groups to be muxed together. See [1] for additional
discussion.

[1] https://lore.kernel.org/linux-arm-kernel/[email protected]/


Sean Anderson (2):
dt-bindings: pinctrl: xilinx: Add support for function with pins
pinctrl: zynqmp: Support muxing individual pins

.../bindings/pinctrl/xlnx,zynqmp-pinctrl.yaml | 344 +++++++++---------
drivers/pinctrl/pinctrl-zynqmp.c | 61 +++-
2 files changed, 219 insertions(+), 186 deletions(-)

--
2.35.1.1320.gc452695387.dirty



2024-05-06 06:44:29

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 0/2] pinctrl: zynqmp: Support muxing individual pins

On Fri, May 3, 2024 at 6:22 PM Sean Anderson <[email protected]> wrote:

> This series adds support for muxing individual pins, instead of
> requiring groups to be muxed together. See [1] for additional
> discussion.
>
> [1] https://lore.kernel.org/linux-arm-kernel/[email protected]/

The way I usually would recommend to solve this would be to
define new subgroups, so e.g. for a UARTS:

uart0_grp = pin_rx, pin_tx, pin_cts, pin_dts, pin_dcd;

And today this would be used like that:

mux0:
function = "uart0";
groups = "uart0_grp";

Then we realize that not everyone need all the modem
control signals provided. What to do. Well this:

uart0_rxtx_grp = pin_rx, pin_tx:
uart0_modem_grp = pin_cts, pin_dts, pin_dcd;

mux0:
function = "uart0";
groups = "uart0_rxtx_grp";

Now the CTS, DTS, DCD pins can be reused for something
else such as GPIO.

I *know* that this breaks ABI: the driver group definitions change
and the device tree needs to be changed too.

This only matters if the users have a habit of distributing the
kernel and DTB separately so a new kernel needs to support
and old DTB. This varies in how much control we have but I
think for Xilinx systems the kernel and DTB are always updated
in lockstep, so it really does not matter?

Yours,
Linus Walleij

2024-05-06 14:45:53

by Sean Anderson

[permalink] [raw]
Subject: Re: [PATCH 0/2] pinctrl: zynqmp: Support muxing individual pins

On 5/6/24 02:43, Linus Walleij wrote:
> On Fri, May 3, 2024 at 6:22 PM Sean Anderson <[email protected]> wrote:
>
>> This series adds support for muxing individual pins, instead of
>> requiring groups to be muxed together. See [1] for additional
>> discussion.
>>
>> [1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
>
> The way I usually would recommend to solve this would be to
> define new subgroups, so e.g. for a UARTS:
>
> uart0_grp = pin_rx, pin_tx, pin_cts, pin_dts, pin_dcd;
>
> And today this would be used like that:
>
> mux0:
> function = "uart0";
> groups = "uart0_grp";
>
> Then we realize that not everyone need all the modem
> control signals provided. What to do. Well this:
>
> uart0_rxtx_grp = pin_rx, pin_tx:
> uart0_modem_grp = pin_cts, pin_dts, pin_dcd;
>
> mux0:
> function = "uart0";
> groups = "uart0_rxtx_grp";
>
> Now the CTS, DTS, DCD pins can be reused for something
> else such as GPIO.
>
> I *know* that this breaks ABI: the driver group definitions change
> and the device tree needs to be changed too.
>
> This only matters if the users have a habit of distributing the
> kernel and DTB separately so a new kernel needs to support
> and old DTB. This varies in how much control we have but I
> think for Xilinx systems the kernel and DTB are always updated
> in lockstep, so it really does not matter?

Well, the pin groups are actually defined in the PMU firmware. And
frankly, I don't see the point of pin "groups" when there are not actual
pin groups at the hardware level. The pins can all be muxed
individually, so there's no point in adding artificial groups on top.
Just mux the pins like the hardware allows and everything is easy. Cuts
down on the absurd number of strings too.

--Sean

2024-05-08 11:55:20

by Michal Simek

[permalink] [raw]
Subject: Re: [PATCH 0/2] pinctrl: zynqmp: Support muxing individual pins



On 5/6/24 16:45, Sean Anderson wrote:
> On 5/6/24 02:43, Linus Walleij wrote:
>> On Fri, May 3, 2024 at 6:22 PM Sean Anderson <[email protected]> wrote:
>>
>>> This series adds support for muxing individual pins, instead of
>>> requiring groups to be muxed together. See [1] for additional
>>> discussion.
>>>
>>> [1] https://lore.kernel.org/linux-arm-kernel/[email protected]/
>>
>> The way I usually would recommend to solve this would be to
>> define new subgroups, so e.g. for a UARTS:
>>
>> uart0_grp = pin_rx, pin_tx, pin_cts, pin_dts, pin_dcd;
>>
>> And today this would be used like that:
>>
>> mux0:
>> function = "uart0";
>> groups = "uart0_grp";
>>
>> Then we realize that not everyone need all the modem
>> control signals provided. What to do. Well this:
>>
>> uart0_rxtx_grp = pin_rx, pin_tx:
>> uart0_modem_grp = pin_cts, pin_dts, pin_dcd;
>>
>> mux0:
>> function = "uart0";
>> groups = "uart0_rxtx_grp";
>>
>> Now the CTS, DTS, DCD pins can be reused for something
>> else such as GPIO.
>>
>> I *know* that this breaks ABI: the driver group definitions change
>> and the device tree needs to be changed too.
>>
>> This only matters if the users have a habit of distributing the
>> kernel and DTB separately so a new kernel needs to support
>> and old DTB. This varies in how much control we have but I
>> think for Xilinx systems the kernel and DTB are always updated
>> in lockstep, so it really does not matter?
>
> Well, the pin groups are actually defined in the PMU firmware. And
> frankly, I don't see the point of pin "groups" when there are not actual
> pin groups at the hardware level. The pins can all be muxed
> individually, so there's no point in adding artificial groups on top.
> Just mux the pins like the hardware allows and everything is easy. Cuts
> down on the absurd number of strings too.

That Linus example is split which would make sense but as Sean said HW is not
really working like this. Because you can actually take tx from group0 and rx
from group5. You can't configure it in design tools but you can configure via
registers and it will just work fine.

Thanks,
Michal