aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-02-14 20:48:08 +0000
committerJohn Crispin <blogic@openwrt.org>2015-02-14 20:48:08 +0000
commitea8a989f3d06455b23999b283bdeb997f52f5ba3 (patch)
tree2ed311506be4561d689e028a61447fd5f2212f60 /target/linux
parent60759662cbc7fbf6f77066e118daa30ba22917ed (diff)
downloadupstream-ea8a989f3d06455b23999b283bdeb997f52f5ba3.tar.gz
upstream-ea8a989f3d06455b23999b283bdeb997f52f5ba3.tar.bz2
upstream-ea8a989f3d06455b23999b283bdeb997f52f5ba3.zip
brcm2708: add board detection and LED support
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@44447 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/brcm2708/base-files/etc/diag.sh25
-rw-r--r--target/linux/brcm2708/base-files/etc/uci-defaults/01_leds11
-rwxr-xr-xtarget/linux/brcm2708/base-files/lib/brcm2708.sh36
-rw-r--r--target/linux/brcm2708/base-files/lib/preinit/03_preinit_do_brcm2708.sh9
-rw-r--r--target/linux/brcm2708/config-3.182
5 files changed, 81 insertions, 2 deletions
diff --git a/target/linux/brcm2708/base-files/etc/diag.sh b/target/linux/brcm2708/base-files/etc/diag.sh
new file mode 100644
index 0000000000..55e68b1a00
--- /dev/null
+++ b/target/linux/brcm2708/base-files/etc/diag.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+
+. /lib/functions/leds.sh
+
+set_state() {
+ status_led="led0"
+
+ case "$1" in
+ preinit)
+ status_led_blink_preinit
+ ;;
+ failsafe)
+ status_led_blink_failsafe
+ ;;
+ preinit_regular)
+ status_led_blink_preinit_regular
+ ;;
+ done)
+ status_led_on
+ ;;
+ esac
+}
diff --git a/target/linux/brcm2708/base-files/etc/uci-defaults/01_leds b/target/linux/brcm2708/base-files/etc/uci-defaults/01_leds
new file mode 100644
index 0000000000..ad52c689e9
--- /dev/null
+++ b/target/linux/brcm2708/base-files/etc/uci-defaults/01_leds
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+
+. /lib/functions/uci-defaults.sh
+
+ucidef_set_led_mmc "mmc" "MMC" "led0" "mmc0"
+ucidef_commit_leds
+
+exit 0
diff --git a/target/linux/brcm2708/base-files/lib/brcm2708.sh b/target/linux/brcm2708/base-files/lib/brcm2708.sh
new file mode 100755
index 0000000000..76870c6a39
--- /dev/null
+++ b/target/linux/brcm2708/base-files/lib/brcm2708.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+
+brcm2708_board_detect() {
+ local machine
+ local name
+
+ machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /Hardware/ {print $2}' /proc/cpuinfo)
+
+ case "$machine" in
+ BCM2708)
+ name="Raspberry Pi"
+ ;;
+ BCM2709)
+ name="Raspberry Pi 2"
+ ;;
+ esac
+
+ [ -z "$name" ] && name="unknown"
+
+ [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
+
+ echo "$machine" > /tmp/sysinfo/board_name
+ echo "$name" > /tmp/sysinfo/model
+}
+
+brcm2708_board_name() {
+ local name
+
+ [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
+ [ -z "$name" ] && name="unknown"
+
+ echo "$name"
+}
diff --git a/target/linux/brcm2708/base-files/lib/preinit/03_preinit_do_brcm2708.sh b/target/linux/brcm2708/base-files/lib/preinit/03_preinit_do_brcm2708.sh
new file mode 100644
index 0000000000..e3cf56d317
--- /dev/null
+++ b/target/linux/brcm2708/base-files/lib/preinit/03_preinit_do_brcm2708.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+do_brcm2708() {
+ . /lib/brcm2708.sh
+
+ brcm2708_board_detect
+}
+
+boot_hook_add preinit_main do_brcm2708
diff --git a/target/linux/brcm2708/config-3.18 b/target/linux/brcm2708/config-3.18
index e75fb22fb3..908e74d731 100644
--- a/target/linux/brcm2708/config-3.18
+++ b/target/linux/brcm2708/config-3.18
@@ -175,9 +175,7 @@ CONFIG_KTIME_SCALAR=y
# CONFIG_LCD_TDO24M is not set
# CONFIG_LCD_VGG2432A4 is not set
CONFIG_LEDS_GPIO=y
-# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set
# CONFIG_LEDS_TRIGGER_INPUT is not set
-# CONFIG_LEDS_TRIGGER_TIMER is not set
CONFIG_LOGO=y
CONFIG_LOGO_LINUX_CLUT224=y
# CONFIG_LOGO_LINUX_MONO is not set