I can take a peek at /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
and see the pin I am interested in:
pin 38 (44e10898.0) 00000037 pinctrl-single
This corresponds to GPIO[2]4
, or P8.10
.
I'm using Fedora 21, with kernel 3.17.7-300.fc21.armv7hl
.
I would like to change the mux to 0x27
. In words, this would configure the pin to have an internal pull-down resistor (before, it was pull up).
The desired output would be:
pin 38 (44e10898.0) 00000027 pinctrl-single
What can be done?
Note: There is no /sys/devices/bone_capemgr.*
, as this is not on Angstrom. The typical DTO approach exports the changes by modifying the cape manager. This is not an option.
Edit: Following exploration from tad
's line of thought, I did:
dtc -I dtb -O dts -o ~/am335x-boneblack.dts /boot/dtb-3.17.7-300.fc21.armv7hl/am335x-boneblack.dtb
. I edited this file to have:
...
pinmux@44e10800 {
...
example {
pinctrl-single,pins = <0x898 0x27>;
};
};
...
Then, I compiled it again with dtc
, stuck it in /boot/dtb-3.17.7-300.fc21.armv7hl/
, and rebooted. However, nothing changed. What's happening?
Edit:
As indicated by Charles Steinkuehler, the 0x800
needs to be subtracted from the offset, and "something" needs to reference "example".
If I add 0x098 0x27
to my entry for user_leds_s0
, the desired behavior is observed:
...
user_leds_s0 {
pinctrl-single,pins = <0x54 0x7 0x58 0x17 0x5c 0x7 0x60 0x170 0x098 0x27>;
linux,phandle = <0x3f>;
phandle = <0x3f>;
};
...
Now, this is all fine and gets me where I need to go. However, that pin isn't really a user_led. It should be in a separate field of some kind. So, what is the "something" I need to do to get the "example" field or similar to work?
I believe the cape manager stuff has not been ported past the 3.8 kernel. Not sure if it is planned to be or not, but in the mean time, you can edit the flat device tree instead. The easiest way I have found (and I'm still looking for the best way) is to grab the repository at
https://github.com/RobertCNelson/dtb-rebuilder
In the src/arm directory, edit the am335x-bone-common-pinmux.dtsi file. In it, you can search for "P8_10_default_pin:". This section tell the pinmux to use 0x37 as its default setting. Change this to 0x27 and save.
Now, build the new compiled device tree (.dtb) file by running make. On ubuntu, "make install" puts all of the files in the correct place. I'm not sure on fedora where they go, but digging around in /boot/ should prove interesting. On ubuntu, the correct spot is
/boot/dtbs/`uname -r`/
In my case, I am running 3.14.26-ti-r43. After reboot (and exporting the pin), the above change enables the pulldown on the receiver and the open state (value) reads as 0.
root@arm:~# grep 898 /sys/kernel/debug/pinctrl/44e10800.pinmux/pins
pin 38 (44e10898.0) 00000027 pinctrl-single
root@arm:~# echo 36 > /sys/class/gpio/export
root@arm:~# cat /sys/class/gpio/gpio36/value
0
I'm sure there is a more elegant way to accomplish the goal, but this works for me.