cdsteinkuehler / beaglebone-universal-io

Device tree overlay and support scripts for using most available hardware I/O on the BeagleBone without editing dts files or rebuilding the kernel
GNU General Public License v2.0
127 stars 54 forks source link

Elaborate on 3.14+ support #28

Closed ToBeReplaced closed 9 years ago

ToBeReplaced commented 9 years ago

The README states:

If using a 3.14 or newer kernel, make sure your device tree inclues the pinmux helper entries required for the pins you want to use. If you're using an RCN built kernel (if you don't know, you probably are), these should be present by default.

What are the "pinmux helper entries"?

I came to this repository while researching an answer to a question I posted on Stack Overflow:

https://stackoverflow.com/questions/27892485/how-can-i-edit-a-pinmux-for-beaglebone-black-on-linux-kernel-3-17

cdsteinkuehler commented 9 years ago

The pinmux helper is a driver that takes control of the pinmux and makes the value changable via sysfs at runtime. The normal kernel pinmux logic only supports what's listed in the flattened device tree so unless you've got a specific BeagleBone kernel with the cape manager or a very new kernel with device-tree changeset support, once the pinmux is set it's set for good.

An example of the pinmux helper usage can be found in the device tree for the BeagleBone 3.14 kernel. Here's the pinmux helper for the I2C pins (P9 pins 19 & 20): https://github.com/beagleboard/linux/blob/3.14/arch/arm/boot/dts/am335x-bone-common-pinmux.dtsi#L1903-L1925

...and here's where the cape EEPROM I2C bus is defined using a default mode via the pinmux helper (rather than explicitly specifying a pinmux mode): https://github.com/beagleboard/linux/blob/3.14/arch/arm/boot/dts/am335x-bone-i2c2-cape-eeprom.dtsi#L9-L17

If the I2C bus directly called out a pinmux value, the kernel wouldn't let anything else change it, but since it's just setting the default mode for the pin, it's possible to switch these pins to GPIO or other functions at run time WITHOUT having device tree overlays. Look at the config-pin script for examples of playing with the sysfs entries, and holler if you have any questions.