aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorMichael Büsch <mb@bu3sch.de>2008-07-20 19:34:09 +0000
committerMichael Büsch <mb@bu3sch.de>2008-07-20 19:34:09 +0000
commit883f926360884e1bcb16dcde67e1e5f978874807 (patch)
tree6c86f34088ee1e6a4255b2454574c83cb9451cfa /package
parentda85c64a1c6d6b1a20e41de2e5e2b5083f2fb88d (diff)
downloadupstream-883f926360884e1bcb16dcde67e1e5f978874807.tar.gz
upstream-883f926360884e1bcb16dcde67e1e5f978874807.tar.bz2
upstream-883f926360884e1bcb16dcde67e1e5f978874807.zip
Update gpiommc to use configfs
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11887 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r--package/mmc_over_gpio/Makefile2
-rw-r--r--package/mmc_over_gpio/files/mmc_over_gpio.init47
2 files changed, 44 insertions, 5 deletions
diff --git a/package/mmc_over_gpio/Makefile b/package/mmc_over_gpio/Makefile
index 20b7b6ac42..954ccfa9cf 100644
--- a/package/mmc_over_gpio/Makefile
+++ b/package/mmc_over_gpio/Makefile
@@ -16,7 +16,7 @@ include $(INCLUDE_DIR)/package.mk
define KernelPackage/mmc-over-gpio
SUBMENU:=Other modules
DEPENDS:=@GPIO_SUPPORT +kmod-mmc-spi +kmod-spi-gpio
- KCONFIG:=CONFIG_GPIOMMC
+ KCONFIG:=CONFIG_GPIOMMC CONFIG_CONFIGFS_FS=y
TITLE:=MMC/SD card over GPIO support
FILES:=$(LINUX_DIR)/drivers/mmc/host/gpiommc.$(LINUX_KMOD_SUFFIX)
AUTOLOAD:=$(call AutoLoad,93,spi_gpio gpiommc)
diff --git a/package/mmc_over_gpio/files/mmc_over_gpio.init b/package/mmc_over_gpio/files/mmc_over_gpio.init
index 57c5695d19..e276dfd1ca 100644
--- a/package/mmc_over_gpio/files/mmc_over_gpio.init
+++ b/package/mmc_over_gpio/files/mmc_over_gpio.init
@@ -2,20 +2,59 @@
# Copyright (C) 2008 OpenWrt.org
START=90
-SYSFS="/sys"
-SYSFS_DRIVERDIR="$SYSFS/bus/platform/drivers/gpiommc"
+CONFIGFS_DIR="/config/gpiommc"
# 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
+ local dir="$CONFIGFS_DIR/$1"
+
+ mkdir $dir
+ [ $? -eq 0 ] || return 1
+ echo $2 > $dir/gpio_data_in
+ [ $? -eq 0 ] || return 1
+ echo $3 > $dir/gpio_data_out
+ [ $? -eq 0 ] || return 1
+ echo $4 > $dir/gpio_clock
+ [ $? -eq 0 ] || return 1
+ echo $5 > $dir/gpio_chipselect
+ [ $? -eq 0 ] || return 1
+ echo $6 > $dir/spi_mode
+ [ $? -eq 0 ] || return 1
+ # XXX We have more config options available. Use defaults for now.
+
+ echo 1 > $dir/register
+ [ $? -eq 0 ] || return 1
+
+ return 0
}
# remove_device(name)
remove_device() {
- echo -n "$1" > $SYSFS_DRIVERDIR/remove
+ local dir="$CONFIGFS_DIR/$1"
+
+ rmdir $dir
+}
+
+mount_configfs() {
+ # FIXME: This should probably be done somewhere else.
+ mount | grep configfs
+ if [ $? -eq 0 ]; then
+ # already mounted
+ return 0
+ fi
+ mkdir -p /config
+ [ $? -eq 0 ] || return 1
+ mount configfs -t configfs /config
+ [ $? -eq 0 ] || return 1
+
+ return 0
}
start() {
+ # Make sure configfs is mounted
+ mount_configfs
+ [ $? -eq 0 ] || return 1
+
#FIXME we should use a config file, but I dunno how that parser works.
add_device "default" 5 4 3 7 0
}