Replies: 3 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
-
You can take the I2C recovery case (not all platforms implement this), where pins are switched from pinctrl to GPIO and back to pinctrl. |
Beta Was this translation helpful? Give feedback.
-
@nylnx I'd love to continue this discussion, here are my initial thoughts. For context, the product uses UART over USBC pins and therefore needs to initialize UART in the "sleep" state - otherwise, the product could damage USBC peers that aren't expecting the pullup on the pins we're using. The STM32 implementation MUST be patched to solve this critical issue. pinctrl's assumption of a "default" and "sleep" state is causing device drivers to assume certain behavior and take important control away from the designer. Where the authors of a driver have implemented pinctrl in driver initialization, they initialize to the "default" state. The name "default" incorrectly assumes that this initial state is a "functional", rather than a "sleep", state. I feel like I heard something about a new API for dynamic driver initialization. It would solve my problem if I could initialize the UART device only once the USBC negotiation has occurred. Of course, I'd need to be able to deinit as well, sending the UART pins back into high-impedance. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have a use case where I want to temporarily take over the GPIO pins from a device driver (in my case UART) and control these pins like a normal GPIO and also give control back to the UART driver afterwards. I'm on STM32 hardware and switching from GPIO to device GPIO needs setting the "alternate function" and therefore only the pin control API could do this. I also know about different
pin-ctrl
s, but only "default" and "sleep" is supported and obviously doesn't match my use case.The only solutions I could come up so far are:
pinctrl-0
in the UART devicetree definition and have a second custom uart-pin-handle-driver that provides more control to the pin management: Don't know if this would work, a lot of work for something "small" and also feels kind of wrong.I would be very curious about other (better) ideas on how to approach this problem and what others might have done to solve it. It seems like a relatively pedestrian problem, since especially in embedded, there can be many reasons to share a pin for very different purposes, but I could not find any documentation or even discussions about this.
Thanks in advance :)
Beta Was this translation helpful? Give feedback.
All reactions