[PATCH] openrisc: dts: litex: Enable GPIO LED controller

58 views
Skip to first unread message

Joel Stanley

unread,
Nov 14, 2017, 9:40:44 AM11/14/17
to linux...@googlegroups.com
- LD4 indicates CPU activity

- LD5 is the 'panic indicator', which will turn on when the kernel
crashes

The other two are under GPIO control. Due to limitations of the driver, we get
8 GPIOs exposed when really only four of them are valid.

Signed-off-by: Joel Stanley <jo...@jms.id.au>
---
arch/openrisc/boot/dts/or1klitex.dts | 29 +++++++++++++++++++++++++++++
arch/openrisc/configs/litex_defconfig | 13 ++++++++++---
2 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/arch/openrisc/boot/dts/or1klitex.dts b/arch/openrisc/boot/dts/or1klitex.dts
index 25c556da9a7b..36916f60026e 100644
--- a/arch/openrisc/boot/dts/or1klitex.dts
+++ b/arch/openrisc/boot/dts/or1klitex.dts
@@ -1,4 +1,7 @@
/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+
/ {
compatible = "opencores,or1ksim";
#address-cells = <1>;
@@ -41,4 +44,30 @@
reg = <0xe0001000 0x100>;
interrupts = <2>;
};
+
+ leds {
+ compatible = "gpio-leds";
+
+ ld4 {
+ label = "arty:green:ld4";
+ linux,default-trigger = "heartbeat";
+ gpios = <&green_led_gpios 0 GPIO_ACTIVE_HIGH>;
+ };
+
+ ld5 {
+ label = "arty:green:ld5";
+ gpios = <&green_led_gpios 1 GPIO_ACTIVE_HIGH>;
+ panic-indicator;
+ };
+ };
+
+ green_led_gpios: gpio@e0006800 {
+ compatible = "wd,mbl-gpio", "basic-mmio-gpio";
+ reg = <0xe0006800 0x1>;
+ reg-names = "dat";
+
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-line-names = "ld4", "ld5", "ld6", "ld7", "", "", "", "";
+ };
};
diff --git a/arch/openrisc/configs/litex_defconfig b/arch/openrisc/configs/litex_defconfig
index dfe06b2dcd44..e20b3981a0aa 100644
--- a/arch/openrisc/configs/litex_defconfig
+++ b/arch/openrisc/configs/litex_defconfig
@@ -108,10 +108,8 @@ CONFIG_SPI=y
CONFIG_SPI_DEBUG=y
CONFIG_SPI_GPIO=y
CONFIG_DEBUG_GPIO=y
-CONFIG_GPIO_74XX_MMIO=y
+CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_GENERIC_PLATFORM=y
-CONFIG_GPIO_MOCKUP=y
-CONFIG_GPIO_PISOSR=y
# CONFIG_HWMON is not set
# CONFIG_RC_CORE is not set
# CONFIG_USB_SUPPORT is not set
@@ -119,6 +117,15 @@ CONFIG_MMC=y
CONFIG_MMC_DEBUG=y
CONFIG_MMC_SPI=y
CONFIG_NEW_LEDS=y
+CONFIG_LEDS_CLASS=y
+CONFIG_LEDS_GPIO=y
+CONFIG_LEDS_TRIGGERS=y
+CONFIG_LEDS_TRIGGER_TIMER=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+CONFIG_LEDS_TRIGGER_CPU=y
+CONFIG_LEDS_TRIGGER_GPIO=y
+CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
+CONFIG_LEDS_TRIGGER_PANIC=y
CONFIG_DMADEVICES=y
# CONFIG_FILE_LOCKING is not set
# CONFIG_DNOTIFY is not set
--
2.14.1

Reply all
Reply to author
Forward
0 new messages