本文介绍了如何在Linux内核3.17上为BeagleBone Black编辑pinmux?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以窥视/sys/kernel/debug/pinctrl/44e10800.pinmux/pins并查看我感兴趣的图钉:

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

这对应于GPIO[2]4P8.10.

我正在使用Fedora 21,内核为3.17.7-300.fc21.armv7hl.

I'm using Fedora 21, with kernel 3.17.7-300.fc21.armv7hl.

我想将多路复用器更改为0x27.换句话说,这会将引脚配置为具​​有内部下拉电阻(之前是上拉电阻).

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).

所需的输出将是:

pin 38 (44e10898.0) 00000027 pinctrl-single

该怎么办?

注意:没有/sys/devices/bone_capemgr.*,因为这不在Angstrom上.典型的DTO方法是通过修改Cape Manager导出更改.这不是一个选择.

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.

tad的思路探索之后,我做到了:dtc -I dtb -O dts -o ~/am335x-boneblack.dts /boot/dtb-3.17.7-300.fc21.armv7hl/am335x-boneblack.dtb.我将此文件编辑为:

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>;
        };
    };
...

然后,我再次使用dtc对其进行编译,将其卡在/boot/dtb-3.17.7-300.fc21.armv7hl/中,然后重新启动.但是,什么都没有改变.发生什么事了?

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?

如Charles Steinkuehler所指出的,需要从偏移量中减去0x800,并且某物"需要引用示例".

As indicated by Charles Steinkuehler, the 0x800 needs to be subtracted from the offset, and "something" needs to reference "example".

如果将0x098 0x27添加到user_leds_s0的条目中,则会观察到所需的行为:

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>;
    };
...

现在,这一切都很好,可以将我带到需要去的地方.但是,该引脚实际上不是user_led的.它应该在某种单独的字段中.那么,要使示例"字段或类似的字段正常工作,我需要做些什么?

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?

推荐答案

我相信cape manager的内容尚未移植到3.8内核之上.不确定是否计划这样做,但是与此同时,您可以编辑平面设备树.我发现(而且我仍在寻找最佳方法)的最简单方法是在以下位置获取存储库

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

在src/arm目录中,编辑am335x-bone-common-pinmux.dtsi文件.在其中,您可以搜索"P8_10_default_pin:".本节告诉pinmux使用0x37作为其默认设置.将其更改为0x27并保存.

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.

现在,通过运行make来构建新的已编译设备树(.dtb)文件.在ubuntu上,"make install"将所有文件放在正确的位置.我不确定在fedora中它们会去哪里,但是在/boot/中进行挖掘应该很有趣.在ubuntu上,正确的位置是

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`/

就我而言,我正在运行3.14.26-ti-r43.重新启动(并导出引脚)后,上述更改将启用接收器上的下拉菜单,并且打开状态(值)显示为0.

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.

这篇关于如何在Linux内核3.17上为BeagleBone Black编辑pinmux?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 12:08