Released multiused GPIO and register gpio-leds

From WRTnode Wiki Site
Jump to: navigation, search
This page contains changes which are not marked for translation.

Other languages:
English 100% • ‎中文(中国大陆)‎ 100%

-: According mt7620 datasheet in GPIO pin share schemes and WRTnode gpio pins feature can be used to customize the gpio pin marked as shown below:



Note: The red box is a combination of WRTnode interface parameters obtained can be released gpio multiplexed pins.

二: mt7620n.dtsi in the registration of gpio

We assume that $(TOPDIR) for OpenWrt of compiler directory.

In the $(TOPDIR)/target/linux/ramips/dts/mt7620n.dtsi registered to gpio

Note: The combination of mt7620 datasheet in GPIO pin share schemes and in mt7620n.dtsi where we see the GPIO#0 to GPIO#72 (middle just do GPO or GPI's) are divided into four groups GPIO0-GPIO3;

GPIO0 is starting from the GPIO#0 to GPIO#23, a total of 24;

GPIO1 is starting from the GPIO#24 to GPIO#39, a total of 16;

GPIO2 is starting from the GPIO#40 to GPIO#71, a total of 32;

GPIO3 corresponds corresponding GPIO#72, only one.






三: Sign in WRTNODE.dts inside of led, keys, etc.

In the $(TOPDIR)/target/linux/ramips/dts/WRTNODE.dts where you can register through gpio interface control devices, such as led, keys, etc.

If you want to use the GPIO interface, you need to enable the GPIO and release the GPIO pin standby function:

Enable GPIO:


Release gpio pin alternate function:


Definition pin multiplexing in $(TOPDIR)/build_dir/target-mipsel_24kec+dsp_uClibc-

Note: The path is not necessarily for this, according to your own kernel version, linux-3.10.xx

For example, i2c_grp, from gpio#1 start, including gpio#1 and gpio#2, a total of two gpio;

spi refclk, from gpio#37 start, including gpio#37, gpio#38 and gpio#39, a total of three gpio.


Similarly, other reuse the same pin definitions.


Note: dts registered in the device is very simple, such as registration gpio-leds is, compatible with Led to drive leds-gpio.c in compatible correspondence, label is the name of the device, the device registration is successful, the file system will be under WRTnode there are /sys/class/leds/wrtnode:blue:wan, we can look commands to control the light off

$echo 1 > /sys/class/leds/wrtnode\:blue\:wan/brightness
$echo 0 > /sys/class/leds/wrtnode\:blue\:wan/brightness

gpios = <& gpio2 0 1>, which is designated corresponding gpio pins (GPIO#40)