[LEDE-DEV] [PATCH 2/3] ramips-mt7621: add GPIO-config for Ubiquiti-EdgeRouterX(-SFP)

Mathias Kresin dev at kresin.me
Fri May 5 05:32:12 PDT 2017


2017-05-04 1:41 GMT+02:00 Sven Roederer <devel-sven at geroedel.de>:
> define GPIOs for ubnt-erx and ubnt-erx-sfp
> ---
>  .../ramips/base-files/etc/board.d/03_gpio_switches | 28 ++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>  create mode 100755 target/linux/ramips/base-files/etc/board.d/03_gpio_switches
>
> diff --git a/target/linux/ramips/base-files/etc/board.d/03_gpio_switches b/target/linux/ramips/base-files/etc/board.d/03_gpio_switches
> new file mode 100755
> index 0000000..21d1aa2
> --- /dev/null
> +++ b/target/linux/ramips/base-files/etc/board.d/03_gpio_switches
> @@ -0,0 +1,28 @@
> +#!/bin/sh
> +#
> +# Copyright (C) 2017 LEDE-project.org
> +#
> +
> +. /lib/functions/uci-defaults.sh
> +. /lib/ramips.sh
> +
> +board_config_update
> +
> +board=$(ramips_board_name)
> +
> +case "$board" in
> +ubnt-erx)
> +       ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "4"
> +       ;;
> +ubnt-erx-sfp)
> +       ucidef_add_gpio_switch "poe_power_port0" "PoE Power Port0" "496"
> +       ucidef_add_gpio_switch "poe_power_port1" "PoE Power Port1" "497"
> +       ucidef_add_gpio_switch "poe_power_port2" "PoE Power Port2" "498"
> +       ucidef_add_gpio_switch "poe_power_port3" "PoE Power Port3" "499"
> +       ucidef_add_gpio_switch "poe_power_port4" "PoE Power Port4" "500"
> +       ;;
> +esac
> +
> +board_config_flush

Is it necessary to control the GPIOs from userspace/via config files?
If not, add a gpio_export node to the dts and set the output value
this way [0].

Mathias

[0] https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/ramips/dts/A5-V11.dts;hb=ddbb036bbb8a1030dd8f6fae0004d390b5f2b8a5#l38



More information about the Lede-dev mailing list