aboutsummaryrefslogtreecommitdiffstats
path: root/package/mmc_over_gpio
diff options
context:
space:
mode:
authorMichael Büsch <mb@bu3sch.de>2008-03-21 17:38:16 +0000
committerMichael Büsch <mb@bu3sch.de>2008-03-21 17:38:16 +0000
commite3f95b61643277cf14c8a428a4724f59b0e450ad (patch)
tree9d6108bfdf1071ba0a658d787dbb01c7420ac947 /package/mmc_over_gpio
parentab0e4b6ce3d2d0542058dbe6c348ed38576e52dd (diff)
downloadupstream-e3f95b61643277cf14c8a428a4724f59b0e450ad.tar.gz
upstream-e3f95b61643277cf14c8a428a4724f59b0e450ad.tar.bz2
upstream-e3f95b61643277cf14c8a428a4724f59b0e450ad.zip
mmc_over_gpio: Add initscript that will create a device
Note that we should use a config file where we can define an arbitrary number of devices. git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10638 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/mmc_over_gpio')
-rw-r--r--package/mmc_over_gpio/Makefile7
-rw-r--r--package/mmc_over_gpio/files/mmc_over_gpio.init25
2 files changed, 30 insertions, 2 deletions
diff --git a/package/mmc_over_gpio/Makefile b/package/mmc_over_gpio/Makefile
index 9076525b03..d38fa416e5 100644
--- a/package/mmc_over_gpio/Makefile
+++ b/package/mmc_over_gpio/Makefile
@@ -3,8 +3,6 @@
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
-#
-# $Id: Makefile 10138 2008-01-06 19:28:26Z nbd $
#XXX This package will go away once the stuff is merged into the kernel.
@@ -44,4 +42,9 @@ define Build/Compile
modules
endef
+define KernelPackage/mmc-over-gpio/install
+ $(INSTALL_DIR) $(1)/etc/init.d
+ $(INSTALL_BIN) ./files/mmc_over_gpio.init $(1)/etc/init.d/mmc_over_gpio
+endef
+
$(eval $(call KernelPackage,mmc-over-gpio))
diff --git a/package/mmc_over_gpio/files/mmc_over_gpio.init b/package/mmc_over_gpio/files/mmc_over_gpio.init
new file mode 100644
index 0000000000..88d9e41027
--- /dev/null
+++ b/package/mmc_over_gpio/files/mmc_over_gpio.init
@@ -0,0 +1,25 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008 OpenWrt.org
+START=90
+
+SYSFS="/sys"
+SYSFS_DRIVERDIR="$SYSFS/bus/platform/drivers/spi-gpio-mmc"
+
+# add_device(name, DI_pin, DO_pin, CLK_pin, CS_pin, mode)
+add_device() {
+ echo -n "$1" "$2","$3","$4","$5" "$6" > $SYSFS_DRIVERDIR/add
+}
+
+# remove_device(name)
+remove_device() {
+ echo -n "$1" > $SYSFS_DRIVERDIR/remove
+}
+
+start() {
+ #FIXME we should use a config file, but I dunno how that parser works.
+ add_device "default" 5 4 3 7 0
+}
+
+stop() {
+ remove_device "default"
+}