1 Index: linux-2.6.28.2/drivers/mmc/host/gpiommc.c
2 ===================================================================
3 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4 +++ linux-2.6.28.2/drivers/mmc/host/gpiommc.c 2009-02-10 17:16:16.000000000 +0100
7 + * Driver an MMC/SD card on a bitbanging GPIO SPI bus.
8 + * This module hooks up the mmc_spi and spi_gpio modules and also
9 + * provides a configfs interface.
11 + * Copyright 2008 Michael Buesch <mb@bu3sch.de>
13 + * Licensed under the GNU/GPL. See COPYING for details.
16 +#include <linux/mmc/gpiommc.h>
17 +#include <linux/platform_device.h>
18 +#include <linux/list.h>
19 +#include <linux/mutex.h>
20 +#include <linux/spi/spi_gpio_old.h>
21 +#include <linux/configfs.h>
22 +#include <linux/gpio.h>
23 +#include <asm/atomic.h>
26 +#define PFX "gpio-mmc: "
29 +struct gpiommc_device {
30 + struct platform_device *pdev;
31 + struct platform_device *spi_pdev;
32 + struct spi_board_info boardinfo;
36 +MODULE_DESCRIPTION("GPIO based MMC driver");
37 +MODULE_AUTHOR("Michael Buesch");
38 +MODULE_LICENSE("GPL");
41 +static int gpiommc_boardinfo_setup(struct spi_board_info *bi,
42 + struct spi_master *master,
45 + struct gpiommc_device *d = data;
46 + struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data;
48 + /* Bind the SPI master to the MMC-SPI host driver. */
49 + strlcpy(bi->modalias, "mmc_spi", sizeof(bi->modalias));
51 + bi->max_speed_hz = pdata->max_bus_speed;
52 + bi->bus_num = master->bus_num;
53 + bi->mode = pdata->mode;
58 +static int gpiommc_probe(struct platform_device *pdev)
60 + struct gpiommc_platform_data *mmc_pdata = pdev->dev.platform_data;
61 + struct spi_gpio_platform_data spi_pdata;
62 + struct gpiommc_device *d;
69 +#ifdef CONFIG_MMC_SPI_MODULE
70 + err = request_module("mmc_spi");
72 + printk(KERN_WARNING PFX
73 + "Failed to request mmc_spi module.\n");
75 +#endif /* CONFIG_MMC_SPI_MODULE */
77 + /* Allocate the GPIO-MMC device */
79 + d = kzalloc(sizeof(*d), GFP_KERNEL);
84 + /* Create the SPI-GPIO device */
85 + d->spi_pdev = platform_device_alloc(SPI_GPIO_PLATDEV_NAME,
86 + spi_gpio_next_id());
90 + memset(&spi_pdata, 0, sizeof(spi_pdata));
91 + spi_pdata.pin_clk = mmc_pdata->pins.gpio_clk;
92 + spi_pdata.pin_miso = mmc_pdata->pins.gpio_do;
93 + spi_pdata.pin_mosi = mmc_pdata->pins.gpio_di;
94 + spi_pdata.pin_cs = mmc_pdata->pins.gpio_cs;
95 + spi_pdata.cs_activelow = mmc_pdata->pins.cs_activelow;
96 + spi_pdata.no_spi_delay = mmc_pdata->no_spi_delay;
97 + spi_pdata.boardinfo_setup = gpiommc_boardinfo_setup;
98 + spi_pdata.boardinfo_setup_data = d;
100 + err = platform_device_add_data(d->spi_pdev, &spi_pdata,
101 + sizeof(spi_pdata));
103 + goto err_free_pdev;
104 + err = platform_device_add(d->spi_pdev);
106 + goto err_free_pdata;
107 + platform_set_drvdata(pdev, d);
109 + printk(KERN_INFO PFX "MMC-Card \"%s\" "
110 + "attached to GPIO pins di=%u, do=%u, clk=%u, cs=%u\n",
111 + mmc_pdata->name, mmc_pdata->pins.gpio_di,
112 + mmc_pdata->pins.gpio_do,
113 + mmc_pdata->pins.gpio_clk,
114 + mmc_pdata->pins.gpio_cs);
119 + kfree(d->spi_pdev->dev.platform_data);
120 + d->spi_pdev->dev.platform_data = NULL;
122 + platform_device_put(d->spi_pdev);
129 +static int gpiommc_remove(struct platform_device *pdev)
131 + struct gpiommc_device *d = platform_get_drvdata(pdev);
132 + struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data;
134 + platform_device_unregister(d->spi_pdev);
135 + printk(KERN_INFO PFX "GPIO based MMC-Card \"%s\" removed\n",
137 + platform_device_put(d->spi_pdev);
142 +#ifdef CONFIG_GPIOMMC_CONFIGFS
144 +/* A device that was created through configfs */
145 +struct gpiommc_configfs_device {
146 + struct config_item item;
147 + /* The platform device, after registration. */
148 + struct platform_device *pdev;
149 + /* The configuration */
150 + struct gpiommc_platform_data pdata;
153 +#define GPIO_INVALID -1
155 +static inline bool gpiommc_is_registered(struct gpiommc_configfs_device *dev)
157 + return (dev->pdev != NULL);
160 +static inline struct gpiommc_configfs_device *ci_to_gpiommc(struct config_item *item)
162 + return item ? container_of(item, struct gpiommc_configfs_device, item) : NULL;
165 +static struct configfs_attribute gpiommc_attr_DI = {
166 + .ca_owner = THIS_MODULE,
167 + .ca_name = "gpio_data_in",
168 + .ca_mode = S_IRUGO | S_IWUSR,
171 +static struct configfs_attribute gpiommc_attr_DO = {
172 + .ca_owner = THIS_MODULE,
173 + .ca_name = "gpio_data_out",
174 + .ca_mode = S_IRUGO | S_IWUSR,
177 +static struct configfs_attribute gpiommc_attr_CLK = {
178 + .ca_owner = THIS_MODULE,
179 + .ca_name = "gpio_clock",
180 + .ca_mode = S_IRUGO | S_IWUSR,
183 +static struct configfs_attribute gpiommc_attr_CS = {
184 + .ca_owner = THIS_MODULE,
185 + .ca_name = "gpio_chipselect",
186 + .ca_mode = S_IRUGO | S_IWUSR,
189 +static struct configfs_attribute gpiommc_attr_CS_activelow = {
190 + .ca_owner = THIS_MODULE,
191 + .ca_name = "gpio_chipselect_activelow",
192 + .ca_mode = S_IRUGO | S_IWUSR,
195 +static struct configfs_attribute gpiommc_attr_spimode = {
196 + .ca_owner = THIS_MODULE,
197 + .ca_name = "spi_mode",
198 + .ca_mode = S_IRUGO | S_IWUSR,
201 +static struct configfs_attribute gpiommc_attr_spidelay = {
202 + .ca_owner = THIS_MODULE,
203 + .ca_name = "spi_delay",
204 + .ca_mode = S_IRUGO | S_IWUSR,
207 +static struct configfs_attribute gpiommc_attr_max_bus_speed = {
208 + .ca_owner = THIS_MODULE,
209 + .ca_name = "max_bus_speed",
210 + .ca_mode = S_IRUGO | S_IWUSR,
213 +static struct configfs_attribute gpiommc_attr_register = {
214 + .ca_owner = THIS_MODULE,
215 + .ca_name = "register",
216 + .ca_mode = S_IRUGO | S_IWUSR,
219 +static struct configfs_attribute *gpiommc_config_attrs[] = {
224 + &gpiommc_attr_CS_activelow,
225 + &gpiommc_attr_spimode,
226 + &gpiommc_attr_spidelay,
227 + &gpiommc_attr_max_bus_speed,
228 + &gpiommc_attr_register,
232 +static ssize_t gpiommc_config_attr_show(struct config_item *item,
233 + struct configfs_attribute *attr,
236 + struct gpiommc_configfs_device *dev = ci_to_gpiommc(item);
241 + if (attr == &gpiommc_attr_DI) {
242 + gpio = dev->pdata.pins.gpio_di;
243 + if (gpio == GPIO_INVALID)
244 + count = snprintf(page, PAGE_SIZE, "not configured\n");
246 + count = snprintf(page, PAGE_SIZE, "%u\n", gpio);
249 + if (attr == &gpiommc_attr_DO) {
250 + gpio = dev->pdata.pins.gpio_do;
251 + if (gpio == GPIO_INVALID)
252 + count = snprintf(page, PAGE_SIZE, "not configured\n");
254 + count = snprintf(page, PAGE_SIZE, "%u\n", gpio);
257 + if (attr == &gpiommc_attr_CLK) {
258 + gpio = dev->pdata.pins.gpio_clk;
259 + if (gpio == GPIO_INVALID)
260 + count = snprintf(page, PAGE_SIZE, "not configured\n");
262 + count = snprintf(page, PAGE_SIZE, "%u\n", gpio);
265 + if (attr == &gpiommc_attr_CS) {
266 + gpio = dev->pdata.pins.gpio_cs;
267 + if (gpio == GPIO_INVALID)
268 + count = snprintf(page, PAGE_SIZE, "not configured\n");
270 + count = snprintf(page, PAGE_SIZE, "%u\n", gpio);
273 + if (attr == &gpiommc_attr_CS_activelow) {
274 + count = snprintf(page, PAGE_SIZE, "%u\n",
275 + dev->pdata.pins.cs_activelow);
278 + if (attr == &gpiommc_attr_spimode) {
279 + count = snprintf(page, PAGE_SIZE, "%u\n",
283 + if (attr == &gpiommc_attr_spidelay) {
284 + count = snprintf(page, PAGE_SIZE, "%u\n",
285 + !dev->pdata.no_spi_delay);
288 + if (attr == &gpiommc_attr_max_bus_speed) {
289 + count = snprintf(page, PAGE_SIZE, "%u\n",
290 + dev->pdata.max_bus_speed);
293 + if (attr == &gpiommc_attr_register) {
294 + count = snprintf(page, PAGE_SIZE, "%u\n",
295 + gpiommc_is_registered(dev));
301 + return err ? err : count;
304 +static int gpiommc_do_register(struct gpiommc_configfs_device *dev,
309 + if (gpiommc_is_registered(dev))
312 + if (!gpio_is_valid(dev->pdata.pins.gpio_di) ||
313 + !gpio_is_valid(dev->pdata.pins.gpio_do) ||
314 + !gpio_is_valid(dev->pdata.pins.gpio_clk) ||
315 + !gpio_is_valid(dev->pdata.pins.gpio_cs)) {
316 + printk(KERN_ERR PFX
317 + "configfs: Invalid GPIO pin number(s)\n");
321 + strlcpy(dev->pdata.name, name,
322 + sizeof(dev->pdata.name));
324 + dev->pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME,
325 + gpiommc_next_id());
328 + err = platform_device_add_data(dev->pdev, &dev->pdata,
329 + sizeof(dev->pdata));
331 + platform_device_put(dev->pdev);
334 + err = platform_device_add(dev->pdev);
336 + platform_device_put(dev->pdev);
343 +static void gpiommc_do_unregister(struct gpiommc_configfs_device *dev)
345 + if (!gpiommc_is_registered(dev))
348 + platform_device_unregister(dev->pdev);
352 +static ssize_t gpiommc_config_attr_store(struct config_item *item,
353 + struct configfs_attribute *attr,
354 + const char *page, size_t count)
356 + struct gpiommc_configfs_device *dev = ci_to_gpiommc(item);
358 + unsigned long data;
360 + if (attr == &gpiommc_attr_register) {
361 + err = strict_strtoul(page, 10, &data);
366 + err = gpiommc_do_register(dev, item->ci_name);
368 + gpiommc_do_unregister(dev);
374 + if (gpiommc_is_registered(dev)) {
375 + /* The rest of the config parameters can only be set
376 + * as long as the device is not registered, yet. */
381 + if (attr == &gpiommc_attr_DI) {
382 + err = strict_strtoul(page, 10, &data);
386 + if (!gpio_is_valid(data))
388 + dev->pdata.pins.gpio_di = data;
392 + if (attr == &gpiommc_attr_DO) {
393 + err = strict_strtoul(page, 10, &data);
397 + if (!gpio_is_valid(data))
399 + dev->pdata.pins.gpio_do = data;
403 + if (attr == &gpiommc_attr_CLK) {
404 + err = strict_strtoul(page, 10, &data);
408 + if (!gpio_is_valid(data))
410 + dev->pdata.pins.gpio_clk = data;
414 + if (attr == &gpiommc_attr_CS) {
415 + err = strict_strtoul(page, 10, &data);
419 + if (!gpio_is_valid(data))
421 + dev->pdata.pins.gpio_cs = data;
425 + if (attr == &gpiommc_attr_CS_activelow) {
426 + err = strict_strtoul(page, 10, &data);
430 + if (data != 0 && data != 1)
432 + dev->pdata.pins.cs_activelow = data;
436 + if (attr == &gpiommc_attr_spimode) {
437 + err = strict_strtoul(page, 10, &data);
443 + dev->pdata.mode = SPI_MODE_0;
446 + dev->pdata.mode = SPI_MODE_1;
449 + dev->pdata.mode = SPI_MODE_2;
452 + dev->pdata.mode = SPI_MODE_3;
460 + if (attr == &gpiommc_attr_spidelay) {
461 + err = strict_strtoul(page, 10, &data);
465 + if (data != 0 && data != 1)
467 + dev->pdata.no_spi_delay = !data;
471 + if (attr == &gpiommc_attr_max_bus_speed) {
472 + err = strict_strtoul(page, 10, &data);
476 + if (data > UINT_MAX)
478 + dev->pdata.max_bus_speed = data;
485 + return err ? err : count;
488 +static void gpiommc_config_item_release(struct config_item *item)
490 + struct gpiommc_configfs_device *dev = ci_to_gpiommc(item);
495 +static struct configfs_item_operations gpiommc_config_item_ops = {
496 + .release = gpiommc_config_item_release,
497 + .show_attribute = gpiommc_config_attr_show,
498 + .store_attribute = gpiommc_config_attr_store,
501 +static struct config_item_type gpiommc_dev_ci_type = {
502 + .ct_item_ops = &gpiommc_config_item_ops,
503 + .ct_attrs = gpiommc_config_attrs,
504 + .ct_owner = THIS_MODULE,
507 +static struct config_item *gpiommc_make_item(struct config_group *group,
510 + struct gpiommc_configfs_device *dev;
512 + if (strlen(name) > GPIOMMC_MAX_NAMELEN) {
513 + printk(KERN_ERR PFX "configfs: device name too long\n");
517 + dev = kzalloc(sizeof(*dev), GFP_KERNEL);
521 + config_item_init_type_name(&dev->item, name,
522 + &gpiommc_dev_ci_type);
524 + /* Assign default configuration */
525 + dev->pdata.pins.gpio_di = GPIO_INVALID;
526 + dev->pdata.pins.gpio_do = GPIO_INVALID;
527 + dev->pdata.pins.gpio_clk = GPIO_INVALID;
528 + dev->pdata.pins.gpio_cs = GPIO_INVALID;
529 + dev->pdata.pins.cs_activelow = 1;
530 + dev->pdata.mode = SPI_MODE_0;
531 + dev->pdata.no_spi_delay = 0;
532 + dev->pdata.max_bus_speed = 5000000; /* 5 MHz */
534 + return &(dev->item);
537 +static void gpiommc_drop_item(struct config_group *group,
538 + struct config_item *item)
540 + struct gpiommc_configfs_device *dev = ci_to_gpiommc(item);
542 + gpiommc_do_unregister(dev);
546 +static struct configfs_group_operations gpiommc_ct_group_ops = {
547 + .make_item = gpiommc_make_item,
548 + .drop_item = gpiommc_drop_item,
551 +static struct config_item_type gpiommc_ci_type = {
552 + .ct_group_ops = &gpiommc_ct_group_ops,
553 + .ct_owner = THIS_MODULE,
556 +static struct configfs_subsystem gpiommc_subsys = {
559 + .ci_namebuf = GPIOMMC_PLATDEV_NAME,
560 + .ci_type = &gpiommc_ci_type,
563 + .su_mutex = __MUTEX_INITIALIZER(gpiommc_subsys.su_mutex),
566 +#endif /* CONFIG_GPIOMMC_CONFIGFS */
568 +static struct platform_driver gpiommc_plat_driver = {
569 + .probe = gpiommc_probe,
570 + .remove = gpiommc_remove,
572 + .name = GPIOMMC_PLATDEV_NAME,
573 + .owner = THIS_MODULE,
577 +int gpiommc_next_id(void)
579 + static atomic_t counter = ATOMIC_INIT(-1);
581 + return atomic_inc_return(&counter);
583 +EXPORT_SYMBOL(gpiommc_next_id);
585 +static int __init gpiommc_modinit(void)
589 + err = platform_driver_register(&gpiommc_plat_driver);
593 +#ifdef CONFIG_GPIOMMC_CONFIGFS
594 + config_group_init(&gpiommc_subsys.su_group);
595 + err = configfs_register_subsystem(&gpiommc_subsys);
597 + platform_driver_unregister(&gpiommc_plat_driver);
600 +#endif /* CONFIG_GPIOMMC_CONFIGFS */
604 +module_init(gpiommc_modinit);
606 +static void __exit gpiommc_modexit(void)
608 +#ifdef CONFIG_GPIOMMC_CONFIGFS
609 + configfs_unregister_subsystem(&gpiommc_subsys);
611 + platform_driver_unregister(&gpiommc_plat_driver);
613 +module_exit(gpiommc_modexit);
614 Index: linux-2.6.28.2/drivers/mmc/host/Kconfig
615 ===================================================================
616 --- linux-2.6.28.2.orig/drivers/mmc/host/Kconfig 2009-02-10 17:16:15.000000000 +0100
617 +++ linux-2.6.28.2/drivers/mmc/host/Kconfig 2009-02-10 17:16:16.000000000 +0100
618 @@ -192,3 +192,28 @@ config MMC_TMIO
620 This provides support for the SD/MMC cell found in TC6393XB,
621 T7L66XB and also ipaq ASIC3
624 + tristate "MMC/SD over GPIO-based SPI"
625 + depends on MMC && MMC_SPI && SPI_GPIO
627 + This driver hooks up the mmc_spi and spi_gpio modules so that
628 + MMC/SD cards can be used on a GPIO based bus by bitbanging
629 + the SPI protocol in software.
631 + This driver provides a configfs interface to dynamically create
632 + and destroy GPIO-based MMC/SD card devices. It also provides
633 + a platform device interface API.
634 + See Documentation/gpiommc.txt for details.
636 + The module will be called gpiommc.
640 +config GPIOMMC_CONFIGFS
642 + depends on GPIOMMC && CONFIGFS_FS
645 + This option automatically enables configfs support for gpiommc
646 + if configfs is available.
647 Index: linux-2.6.28.2/drivers/mmc/host/Makefile
648 ===================================================================
649 --- linux-2.6.28.2.orig/drivers/mmc/host/Makefile 2009-02-10 17:16:15.000000000 +0100
650 +++ linux-2.6.28.2/drivers/mmc/host/Makefile 2009-02-10 17:16:16.000000000 +0100
651 @@ -22,4 +22,5 @@ obj-$(CONFIG_MMC_SPI) += mmc_spi.o
652 obj-$(CONFIG_MMC_S3C) += s3cmci.o
653 obj-$(CONFIG_MMC_SDRICOH_CS) += sdricoh_cs.o
654 obj-$(CONFIG_MMC_TMIO) += tmio_mmc.o
655 +obj-$(CONFIG_GPIOMMC) += gpiommc.o
657 Index: linux-2.6.28.2/include/linux/mmc/gpiommc.h
658 ===================================================================
659 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
660 +++ linux-2.6.28.2/include/linux/mmc/gpiommc.h 2009-02-10 17:16:16.000000000 +0100
663 + * Device driver for MMC/SD cards driven over a GPIO bus.
665 + * Copyright (c) 2008 Michael Buesch
667 + * Licensed under the GNU/GPL version 2.
669 +#ifndef LINUX_GPIOMMC_H_
670 +#define LINUX_GPIOMMC_H_
672 +#include <linux/types.h>
675 +#define GPIOMMC_MAX_NAMELEN 15
676 +#define GPIOMMC_MAX_NAMELEN_STR __stringify(GPIOMMC_MAX_NAMELEN)
679 + * struct gpiommc_pins - Hardware pin assignments
681 + * @gpio_di: The GPIO number of the DATA IN pin
682 + * @gpio_do: The GPIO number of the DATA OUT pin
683 + * @gpio_clk: The GPIO number of the CLOCK pin
684 + * @gpio_cs: The GPIO number of the CHIPSELECT pin
685 + * @cs_activelow: If true, the chip is considered selected if @gpio_cs is low.
687 +struct gpiommc_pins {
688 + unsigned int gpio_di;
689 + unsigned int gpio_do;
690 + unsigned int gpio_clk;
691 + unsigned int gpio_cs;
696 + * struct gpiommc_platform_data - Platform data for a MMC-over-SPI-GPIO device.
698 + * @name: The unique name string of the device.
699 + * @pins: The hardware pin assignments.
700 + * @mode: The hardware mode. This is either SPI_MODE_0,
701 + * SPI_MODE_1, SPI_MODE_2 or SPI_MODE_3. See the SPI documentation.
702 + * @no_spi_delay: Do not use delays in the lowlevel SPI bitbanging code.
703 + * This is not standards compliant, but may be required for some
704 + * embedded machines to gain reasonable speed.
705 + * @max_bus_speed: The maximum speed of the SPI bus, in Hertz.
707 +struct gpiommc_platform_data {
708 + char name[GPIOMMC_MAX_NAMELEN + 1];
709 + struct gpiommc_pins pins;
712 + unsigned int max_bus_speed;
716 + * GPIOMMC_PLATDEV_NAME - The platform device name string.
718 + * The name string that has to be used for platform_device_alloc
719 + * when allocating a gpiommc device.
721 +#define GPIOMMC_PLATDEV_NAME "gpiommc"
724 + * gpiommc_next_id - Get another platform device ID number.
726 + * This returns the next platform device ID number that has to be used
727 + * for platform_device_alloc. The ID is opaque and should not be used for
730 +int gpiommc_next_id(void);
732 +#endif /* LINUX_GPIOMMC_H_ */
733 Index: linux-2.6.28.2/Documentation/gpiommc.txt
734 ===================================================================
735 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
736 +++ linux-2.6.28.2/Documentation/gpiommc.txt 2009-02-10 17:16:16.000000000 +0100
738 +GPIOMMC - Driver for an MMC/SD card on a bitbanging GPIO SPI bus
739 +================================================================
741 +The gpiommc module hooks up the mmc_spi and spi_gpio modules for running an
742 +MMC or SD card on GPIO pins.
744 +Two interfaces for registering a new MMC/SD card device are provided:
745 +A static platform-device based mechanism and a dynamic configfs based interface.
748 +Registering devices via platform-device
749 +=======================================
751 +The platform-device interface is used for registering MMC/SD devices that are
752 +part of the hardware platform. This is most useful only for embedded machines
753 +with MMC/SD devices statically connected to the platform GPIO bus.
755 +The data structures are declared in <linux/mmc/gpiommc.h>.
757 +To register a new device, define an instance of struct gpiommc_platform_data.
758 +This structure holds any information about how the device is hooked up to the
759 +GPIO pins and what hardware modes the device supports. See the docbook-style
760 +documentation in the header file for more information on the struct fields.
762 +Then allocate a new instance of a platform device by doing:
764 + pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME, gpiommc_next_id());
766 +This will allocate the platform device data structures and hook it up to the
768 +Then add the gpiommc_platform_data to the platform device.
770 + err = platform_device_add_data(pdev, pdata, sizeof(struct gpiommc_platform_data));
772 +You may free the local instance of struct gpiommc_platform_data now. (So the
773 +struct may be allocated on the stack, too).
774 +Now simply register the platform device.
776 + err = platform_device_add(pdev);
778 +Done. The gpiommc probe routine will be invoked now and you should see a kernel
779 +log message for the added device.
782 +Registering devices via configfs
783 +================================
785 +MMC/SD cards connected via GPIO often are a pretty dynamic thing, as for example
786 +selfmade hacks for soldering an MMC/SD card to standard GPIO pins on embedded
787 +hardware are a common situation.
788 +So we provide a dynamic interface to conveniently handle adding and removing
789 +devices from userspace, without the need to recompile the kernel.
791 +The "gpiommc" subdirectory at the configfs mountpoint is used for handling
792 +the dynamic configuration.
794 +To create a new device, it must first be allocated with mkdir.
795 +The following command will allocate a device named "my_mmc":
796 + mkdir /config/gpiommc/my_mmc
798 +There are several configuration files available in the new
799 +/config/gpiommc/my_mmc/ directory:
801 +gpio_data_in = The SPI data-IN GPIO pin number.
802 +gpio_data_out = The SPI data-OUT GPIO pin number.
803 +gpio_clock = The SPI Clock GPIO pin number.
804 +gpio_chipselect = The SPI Chipselect GPIO pin number.
805 +gpio_chipselect_activelow = Boolean. If 0, Chipselect is active-HIGH.
806 + If 1, Chipselect is active-LOW.
807 +spi_mode = The SPI data mode. Can be 0-3.
808 +spi_delay = Enable all delays in the lowlevel bitbanging.
809 +max_bus_speed = The maximum SPI bus speed. In Hertz.
811 +register = Not a configuration parameter.
812 + Used to register the configured card
815 +The device must first get configured and then registered by writing "1" to
816 +the "register" file.
817 +The configuration parameters "gpio_data_in", "gpio_data_out", "gpio_clock"
818 +and "gpio_chipselect" are essential and _must_ be configured before writing
819 +"1" to the "register" file. The registration will fail, otherwise.
821 +The default values for the other parameters are:
822 +gpio_chipselect_activelow = 1 (CS active-LOW)
823 +spi_mode = 0 (SPI_MODE_0)
824 +spi_delay = 1 (enabled)
825 +max_bus_speed = 5000000 (5 Mhz)
827 +Configuration values can not be changed after registration. To unregister
828 +the device, write a "0" to the "register" file. The configuration can be
829 +changed again after unregistering.
831 +To completely remove the device, simply rmdir the directory
832 +(/config/gpiommc/my_mmc in this example).
833 +There's no need to first unregister the device before removing it. That will
834 +be done automatically.
835 Index: linux-2.6.28.2/MAINTAINERS
836 ===================================================================
837 --- linux-2.6.28.2.orig/MAINTAINERS 2009-02-10 17:16:15.000000000 +0100
838 +++ linux-2.6.28.2/MAINTAINERS 2009-02-10 17:16:16.000000000 +0100
839 @@ -1911,6 +1911,11 @@ W: http://moinejf.free.fr
840 L: video4linux-list@redhat.com
849 L: lm-sensors@lm-sensors.org
850 W: http://www.lm-sensors.org/