Lemuntu

Guitar Pin Mux device tree

3 1175
Edited by balornt1 at Aug 30, 2016 12:21

I am trying to overlay some of the Device Tree entries to allow for a specific set of pin muxing options as I prepare to make a custom base board for the guitar. Unfortunately I am having difficulty figuring out how to do that. I would rather avoid a user space driver for all of my peripherals. I looked at the pinctrl section of the Guitar B+ baseboard device tree and I noticed that the pin mux options are set via Multi-Function Pin (mfp) groups, but I don't know which groups correspond to the desired pins. As an example, my custom baseboard will not have an ethernet port, so I want to change GPIO's 14-23 from Func6 (ethernet) to Func1 GPIO. I checked out the DTS for the Guitar B+ baseboard and it has the following pinctrl entries for ethernet:
  1. <blockquote>ethernet_state_default: ethernet_default {
Copy the Code


While I might be able to reverse engineer the source for the owl pinctrl to map Guitar pins to mfp groups, I would be grateful for some documentation on how to pin mux Lemaker Guitar pins in the device tree.
Well I reverse engineered the source and came up with an answer. I don't understand everything about it so documentation would still be appreciated, but essentially the Multi-Function Pin (MFP) system attempts to group pins and pin mux functionality in a (thoeretically) organized manner. There are numerous MFP "groups" which consist of one or more pins on the SOC. Each pin exists in exactly one group. Each group of pins will have one set of muxing options. For many groups that means the group has only one pin (because that pin has a unique set of pin muxing options) for some groups it can have multiple pins. For example, GPIOB10 through GPIOB19 can all be used as generic GPIO's (Func1), LVDS(Func2), or LCD0(Func4). The other functions are reserved and cannot be used at this time. Consequently they are part of the same MFP group (mfp1_22_21) and you can set the function for all the pins at the same time with a few lines in the device tree. Unfortunately there appeared to be no documentation of which pins belonged to which groups so the only way to know was to reverse engineer the code in the link above. I have done this and have made a document that maps the group name to the GPIO on the guitar as well as listing the possible strings that can be used to specify the function in the device tree.

In some cases you will find that there are multiple possible strings per function name. As an example, GPIOB04 can be used for PWM0 or PWM4 when muxed to FUNC1. You can specify which pwm channel you wish to use in the device tree using the string "pwm0" or "pwm4". In my document you will see both strings under the FUNC1 column separated by a '|' character.

You can check the mutual function for each pin from this doc http://www.lemaker.org/product-guitar-download-29.html

That is a good resource for checking the different functions of the pins, but it doesn't tell you anything about the mfp groups used by the device tree. Regardless I got most of what I needed from reverse engineering the source code.

You have to log in before you can reply Login | Sign Up

Points Rules