Hi Drew,

On Wed, Feb 17, 2021 at 11:15 PM Drew Fustini <d...@beagleboard.org> wrote:
> Add "pinmux-select" to debugfs which will activate a function and group:
>
>   echo "<function-name group-name>" > pinmux-select
>
> The write operation pinmux_select() handles this by checking that the
> names map to valid selectors and then calling ops->set_mux().
>
> The existing "pinmux-functions" debugfs file lists the pin functions
> registered for the pin controller. For example:
>
>   function: pinmux-uart0, groups = [ pinmux-uart0-pins ]
>   function: pinmux-mmc0, groups = [ pinmux-mmc0-pins ]
>   function: pinmux-mmc1, groups = [ pinmux-mmc1-pins ]
>   function: pinmux-i2c0, groups = [ pinmux-i2c0-pins ]
>   function: pinmux-i2c1, groups = [ pinmux-i2c1-pins ]
>   function: pinmux-spi1, groups = [ pinmux-spi1-pins ]
>
> To activate function pinmux-i2c1 and group pinmux-i2c1-pins:
>
>   echo "pinmux-i2c1 pinmux-i2c1-pins" > pinmux-select
>
> Reviewed-by: Andy Shevchenko <andy.shevche...@gmail.com>
> Reviewed-by: Tony Lindgren <t...@atomide.com>
> Signed-off-by: Drew Fustini <d...@beagleboard.org>

Thanks for your patch!

On R-Car M2-W, which does not use pinctrl-single, I have:

    # cat pinmux-functions
    ...
    function 14: i2c2, groups = [ i2c2 i2c2_b i2c2_c i2c2_d ]
    ...
    function 51: ssi, groups = [ ssi0_data ssi0_data_b ssi0129_ctrl
ssi0129_ctrl_b ssi1_data ssi1_data_b ssi1_ctrl ssi1_ctrl_b ssi2_data
ssi2_ctrl ssi3_data ssi34_ctrl ssi4_data ssi4_ctrl ssi5_data ssi5_ctrl
ssi6_data ssi6_ctrl ssi7_data ssi7_data_b ssi78_ctrl ssi78_ctrl_b
ssi8_data ssi8_data_b ssi9_data ssi9_data_b ssi9_ctrl ssi9_ctrl_b ]
    ...

On the Koelsch board:

    # cd /sys/kernel/debug/pinctrl/e6060000.pinctrl-sh-pfc/
    # echo ssi ssi2_ctrl > pinmux-select # Configure i2c2 pins for ssi
    # i2cdetect -y -a 2                  # Fails
    # echo i2c2 i2c2 > pinmux-select     # Restore i2c2
    # i2cdetect -y -a 2                  # Works again

The order of the 2 parameters looks a bit odd to me, as the operation
configures the pins from "group" to be used for "function".
See also arch/arm/boot/dts/r8a7791-koelsch.dts
For the i2c2 example it's not that obvious, but for ssi it is.
Might feel different for pinctrl-single, and perhaps I just need to get
used to it ;-)

Anyway:
Reviewed-by: Geert Uytterhoeven <geert+rene...@glider.be>
Tested-by: Geert Uytterhoeven <geert+rene...@glider.be>

Gr{oetje,eeting}s,

                        Geert


--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Reply via email to