The patch was born from the need to change the slew rate of the LCD pins
of a custom AM335x board during EMC tests. The AM335x, as described in a
note in section 9.1 of its reference manual [1], is unable to write
pinmux registers from user space. The series now makes it possible to
write these registers from the pins debug file.
[1] https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf
Changes in v2:
- Remove CONFIG_SOC_AM33XX dependency.
Dario Binacchi (2):
pinctrl: core: configure pinmux from pins debug file
pinctrl: single: set pinmux from pins debug file
drivers/pinctrl/core.c | 56 ++++++++++++++++++++++++++++++--
drivers/pinctrl/pinctrl-single.c | 20 ++++++++++++
include/linux/pinctrl/pinctrl.h | 2 ++
3 files changed, 76 insertions(+), 2 deletions(-)
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
As described in section 9.1 of the TI reference manual for AM335x [1],
"For writing to the control module registers, the MPU will need to be in
privileged mode of operation and writes will not work from user mode".
By adding the pin_dbg_set helper to pcs_pinctrl_ops it will be possible
to write these registers from the pins debug:
cd /sys/kernel/debug/pinctrl/44e10800.pinmux-pinctrl-single/
echo <pin-number> <reg-value> >pins
[1] https://www.ti.com/lit/ug/spruh73q/spruh73q.pdf
Signed-off-by: Dario Binacchi <redacted>
---
Changes in v2:
- Remove CONFIG_SOC_AM33XX dependency.
drivers/pinctrl/pinctrl-single.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
It might be better to always have the .pin_dbg_set around to
avoid the IS_ENABLED(CONFIG_DEVMEM).
Does the new interface need something under Documentation too?
Regards,
Tony
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Il 18/05/2021 08:05 Tony Lindgren [off-list ref] ha scritto:
Hi,
I noticed few more things I started to wonder about after
looking at this again.
* Dario Binacchi [off-list ref] [210517 20:00]:
Since you're adding a new interface, how about pass unsigned
int val instead of char *buf?
I thought about passing char *buf because it seemed more generic
to me. As the output of pin_dbg_show() depends on the platform
driver, perhaps pin_dbg_set() may need driver-dependent data.
Is it possible that only the value to be set in the register
(unsigned int) is required?
It might be better to always have the .pin_dbg_set around to
avoid the IS_ENABLED(CONFIG_DEVMEM).
Ok, I'll remove the CONFIG_DEVMEM dependency
Does the new interface need something under Documentation too?
Yes, the description of `pins` in Documentation/driver-api/pin-control.rst
needs to be updated. I'll add another patch to the series.
Thanks and regards,
Dario
From: Andy Shevchenko <hidden> Date: 2021-05-19 11:31:58
On Wed, May 19, 2021 at 3:58 AM Dario Binacchi [off-list ref] wrote:
The patch was born from the need to change the slew rate of the LCD pins
of a custom AM335x board during EMC tests. The AM335x, as described in a
note in section 9.1 of its reference manual [1], is unable to write
pinmux registers from user space. The series now makes it possible to
write these registers from the pins debug file.
Even for debugfs it would be nice to have a piece of documentation.
Because pin control is a quite sensitive area and if something goes
wrong, it may damage the hardware.
From: Tony Lindgren <tony@atomide.com> Date: 2021-05-21 09:26:11
* Dario Binacchi [off-list ref] [210518 08:57]:
I thought about passing char *buf because it seemed more generic
to me. As the output of pin_dbg_show() depends on the platform
driver, perhaps pin_dbg_set() may need driver-dependent data.
Is it possible that only the value to be set in the register
(unsigned int) is required?