Change Pin Function - Linux 4.9

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

igortf
Posts: 5
Joined: Tue Mar 27, 2018 8:27 pm

Change Pin Function - Linux 4.9

Wed Oct 24, 2018 4:19 pm

Hello,

I have a question about the Linux 4.9: is there a way to change the pin function in the Kernel? For example, in the SAMA5D2 Series Datasheet, the pin PA21 can be a TCLK0 (func D) or a IRQ (func A). Can I change the pin from TCLK0 to a IRQ in the kernel? I searched in the Google, in the Kernel documentation and in the topics of this community too and nothing.

Thank you in advance.
blue_z
Location: USA
Posts: 1785
Joined: Thu Apr 19, 2007 10:15 pm

Re: Change Pin Function - Linux 4.9

Wed Oct 24, 2018 11:09 pm

igortf wrote: is there a way to change the pin function in the Kernel?
Yes, but normally this is performed only one time during boot using the Device Tree.
The definition (in the board's Device Tree) of a pin-control group and pin attributes is normally all you have do to specify pin functionality for each peripheral.

igortf wrote: For example, in the SAMA5D2 Series Datasheet, the pin PA21 can be a TCLK0 (func D) or a IRQ (func A). Can I change the pin from TCLK0 to a IRQ in the kernel?
Is this hypothetical or supposed to be a real question?
If the pin was originally configured for one peripheral function, do you actually want to change the pin to a different function?
Does the connection to the board actually support either functionality?

igortf wrote: I searched in the Google, in the Kernel documentation and in the topics of this community too and nothing.
Study Documentation/pinctrl.txt,
Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt,
Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt , and
Documentation/devicetree/bindings/pinctrl/atmel,at91-pio4-pinctrl.txt.

Regards
igortf
Posts: 5
Joined: Tue Mar 27, 2018 8:27 pm

Re: Change Pin Function - Linux 4.9

Thu Oct 25, 2018 2:35 pm

Hello blue_z,

Thanks for your answer.
blue_z wrote: Is this hypothetical or supposed to be a real question?
If the pin was originally configured for one peripheral function, do you actually want to change the pin to a different function?
Does the connection to the board actually support either functionality?
It's a real question. I already try to change the pin function by register in the Linux using the "devmem" command. It works.
I read these documents already and they only show how to configure in Device Tree. I want to change the pin function during execution. So, I want to know if there is a API to do this or only by registers handling.

Best regards.
blue_z
Location: USA
Posts: 1785
Joined: Thu Apr 19, 2007 10:15 pm

Re: Change Pin Function - Linux 4.9

Thu Oct 25, 2018 10:08 pm

igortf wrote: I read these documents already and they only show how to configure in Device Tree.
Really??!!
In the first document, I see a section titled Pin control requests from drivers, and there's a list for the semantics of the pinctrl APIs .
Finally there's a section on Runtime pinmuxing with a code example.
Isn't that what you're asking for?


Regards
igortf
Posts: 5
Joined: Tue Mar 27, 2018 8:27 pm

Re: Change Pin Function - Linux 4.9

Thu Nov 01, 2018 7:19 pm

Hello blue_z
blue_z wrote:
Thu Oct 25, 2018 10:08 pm
igortf wrote: I read these documents already and they only show how to configure in Device Tree.
Really??!!
In the first document, I see a section titled Pin control requests from drivers, and there's a list for the semantics of the pinctrl APIs .
Finally there's a section on Runtime pinmuxing with a code example.
Isn't that what you're asking for?
I reread all the documents you mentioned a few times and still don't get how the Runtime Pinmuxing works. So, I searched one of the functions mentioned in the first document. I found the same doubt I have in the Stack Overflow (https://stackoverflow.com/questions/373 ... nux-kernel). I finally understand how it works.

Thank you very much for your support.

Best regards.

Return to “LINUX”

Who is online

Users browsing this forum: No registered users and 4 guests