2 +++ b/drivers/mmc/host/gpiommc.c
5 + * Driver an MMC/SD card on a bitbanging GPIO SPI bus.
6 + * This module hooks up the mmc_spi and spi_gpio modules and also
7 + * provides a configfs interface.
9 + * Copyright 2008 Michael Buesch <mb@bu3sch.de>
11 + * Licensed under the GNU/GPL. See COPYING for details.
14 +#include <linux/module.h>
15 +#include <linux/mmc/gpiommc.h>
16 +#include <linux/platform_device.h>
17 +#include <linux/list.h>
18 +#include <linux/mutex.h>
19 +#include <linux/spi/spi_gpio_old.h>
20 +#include <linux/configfs.h>
21 +#include <linux/gpio.h>
22 +#include <asm/atomic.h>
25 +#define PFX "gpio-mmc: "
28 +struct gpiommc_device {
29 + struct platform_device *pdev;
30 + struct platform_device *spi_pdev;
31 + struct spi_board_info boardinfo;
35 +MODULE_DESCRIPTION("GPIO based MMC driver");
36 +MODULE_AUTHOR("Michael Buesch");
37 +MODULE_LICENSE("GPL");
40 +static int gpiommc_boardinfo_setup(struct spi_board_info *bi,
41 + struct spi_master *master,
44 + struct gpiommc_device *d = data;
45 + struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data;
47 + /* Bind the SPI master to the MMC-SPI host driver. */
48 + strlcpy(bi->modalias, "mmc_spi", sizeof(bi->modalias));
50 + bi->max_speed_hz = pdata->max_bus_speed;
51 + bi->bus_num = master->bus_num;
52 + bi->mode = pdata->mode;
57 +static int gpiommc_probe(struct platform_device *pdev)
59 + struct gpiommc_platform_data *mmc_pdata = pdev->dev.platform_data;
60 + struct spi_gpio_platform_data spi_pdata;
61 + struct gpiommc_device *d;
68 +#ifdef CONFIG_MMC_SPI_MODULE
69 + err = request_module("mmc_spi");
71 + printk(KERN_WARNING PFX
72 + "Failed to request mmc_spi module.\n");
74 +#endif /* CONFIG_MMC_SPI_MODULE */
76 + /* Allocate the GPIO-MMC device */
78 + d = kzalloc(sizeof(*d), GFP_KERNEL);
83 + /* Create the SPI-GPIO device */
84 + d->spi_pdev = platform_device_alloc(SPI_GPIO_PLATDEV_NAME,
85 + spi_gpio_next_id());
89 + memset(&spi_pdata, 0, sizeof(spi_pdata));
90 + spi_pdata.pin_clk = mmc_pdata->pins.gpio_clk;
91 + spi_pdata.pin_miso = mmc_pdata->pins.gpio_do;
92 + spi_pdata.pin_mosi = mmc_pdata->pins.gpio_di;
93 + spi_pdata.pin_cs = mmc_pdata->pins.gpio_cs;
94 + spi_pdata.cs_activelow = mmc_pdata->pins.cs_activelow;
95 + spi_pdata.no_spi_delay = mmc_pdata->no_spi_delay;
96 + spi_pdata.boardinfo_setup = gpiommc_boardinfo_setup;
97 + spi_pdata.boardinfo_setup_data = d;
99 + err = platform_device_add_data(d->spi_pdev, &spi_pdata,
100 + sizeof(spi_pdata));
102 + goto err_free_pdev;
103 + err = platform_device_add(d->spi_pdev);
105 + goto err_free_pdata;
106 + platform_set_drvdata(pdev, d);
108 + printk(KERN_INFO PFX "MMC-Card \"%s\" "
109 + "attached to GPIO pins di=%u, do=%u, clk=%u, cs=%u\n",
110 + mmc_pdata->name, mmc_pdata->pins.gpio_di,
111 + mmc_pdata->pins.gpio_do,
112 + mmc_pdata->pins.gpio_clk,
113 + mmc_pdata->pins.gpio_cs);
118 + kfree(d->spi_pdev->dev.platform_data);
119 + d->spi_pdev->dev.platform_data = NULL;
121 + platform_device_put(d->spi_pdev);
128 +static int gpiommc_remove(struct platform_device *pdev)
130 + struct gpiommc_device *d = platform_get_drvdata(pdev);
131 + struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data;
133 + platform_device_unregister(d->spi_pdev);
134 + printk(KERN_INFO PFX "GPIO based MMC-Card \"%s\" removed\n",
136 + platform_device_put(d->spi_pdev);
141 +#ifdef CONFIG_GPIOMMC_CONFIGFS
143 +/* A device that was created through configfs */
144 +struct gpiommc_configfs_device {
145 + struct config_item item;
146 + /* The platform device, after registration. */
147 + struct platform_device *pdev;
148 + /* The configuration */
149 + struct gpiommc_platform_data pdata;
152 +#define GPIO_INVALID -1
154 +static inline bool gpiommc_is_registered(struct gpiommc_configfs_device *dev)
156 + return (dev->pdev != NULL);
159 +static inline struct gpiommc_configfs_device *ci_to_gpiommc(struct config_item *item)
161 + return item ? container_of(item, struct gpiommc_configfs_device, item) : NULL;
164 +static struct configfs_attribute gpiommc_attr_DI = {
165 + .ca_owner = THIS_MODULE,
166 + .ca_name = "gpio_data_in",
167 + .ca_mode = S_IRUGO | S_IWUSR,
170 +static struct configfs_attribute gpiommc_attr_DO = {
171 + .ca_owner = THIS_MODULE,
172 + .ca_name = "gpio_data_out",
173 + .ca_mode = S_IRUGO | S_IWUSR,
176 +static struct configfs_attribute gpiommc_attr_CLK = {
177 + .ca_owner = THIS_MODULE,
178 + .ca_name = "gpio_clock",
179 + .ca_mode = S_IRUGO | S_IWUSR,
182 +static struct configfs_attribute gpiommc_attr_CS = {
183 + .ca_owner = THIS_MODULE,
184 + .ca_name = "gpio_chipselect",
185 + .ca_mode = S_IRUGO | S_IWUSR,
188 +static struct configfs_attribute gpiommc_attr_CS_activelow = {
189 + .ca_owner = THIS_MODULE,
190 + .ca_name = "gpio_chipselect_activelow",
191 + .ca_mode = S_IRUGO | S_IWUSR,
194 +static struct configfs_attribute gpiommc_attr_spimode = {
195 + .ca_owner = THIS_MODULE,
196 + .ca_name = "spi_mode",
197 + .ca_mode = S_IRUGO | S_IWUSR,
200 +static struct configfs_attribute gpiommc_attr_spidelay = {
201 + .ca_owner = THIS_MODULE,
202 + .ca_name = "spi_delay",
203 + .ca_mode = S_IRUGO | S_IWUSR,
206 +static struct configfs_attribute gpiommc_attr_max_bus_speed = {
207 + .ca_owner = THIS_MODULE,
208 + .ca_name = "max_bus_speed",
209 + .ca_mode = S_IRUGO | S_IWUSR,
212 +static struct configfs_attribute gpiommc_attr_register = {
213 + .ca_owner = THIS_MODULE,
214 + .ca_name = "register",
215 + .ca_mode = S_IRUGO | S_IWUSR,
218 +static struct configfs_attribute *gpiommc_config_attrs[] = {
223 + &gpiommc_attr_CS_activelow,
224 + &gpiommc_attr_spimode,
225 + &gpiommc_attr_spidelay,
226 + &gpiommc_attr_max_bus_speed,
227 + &gpiommc_attr_register,
231 +static ssize_t gpiommc_config_attr_show(struct config_item *item,
232 + struct configfs_attribute *attr,
235 + struct gpiommc_configfs_device *dev = ci_to_gpiommc(item);
240 + if (attr == &gpiommc_attr_DI) {
241 + gpio = dev->pdata.pins.gpio_di;
242 + if (gpio == GPIO_INVALID)
243 + count = snprintf(page, PAGE_SIZE, "not configured\n");
245 + count = snprintf(page, PAGE_SIZE, "%u\n", gpio);
248 + if (attr == &gpiommc_attr_DO) {
249 + gpio = dev->pdata.pins.gpio_do;
250 + if (gpio == GPIO_INVALID)
251 + count = snprintf(page, PAGE_SIZE, "not configured\n");
253 + count = snprintf(page, PAGE_SIZE, "%u\n", gpio);
256 + if (attr == &gpiommc_attr_CLK) {
257 + gpio = dev->pdata.pins.gpio_clk;
258 + if (gpio == GPIO_INVALID)
259 + count = snprintf(page, PAGE_SIZE, "not configured\n");
261 + count = snprintf(page, PAGE_SIZE, "%u\n", gpio);
264 + if (attr == &gpiommc_attr_CS) {
265 + gpio = dev->pdata.pins.gpio_cs;
266 + if (gpio == GPIO_INVALID)
267 + count = snprintf(page, PAGE_SIZE, "not configured\n");
269 + count = snprintf(page, PAGE_SIZE, "%u\n", gpio);
272 + if (attr == &gpiommc_attr_CS_activelow) {
273 + count = snprintf(page, PAGE_SIZE, "%u\n",
274 + dev->pdata.pins.cs_activelow);
277 + if (attr == &gpiommc_attr_spimode) {
278 + count = snprintf(page, PAGE_SIZE, "%u\n",
282 + if (attr == &gpiommc_attr_spidelay) {
283 + count = snprintf(page, PAGE_SIZE, "%u\n",
284 + !dev->pdata.no_spi_delay);
287 + if (attr == &gpiommc_attr_max_bus_speed) {
288 + count = snprintf(page, PAGE_SIZE, "%u\n",
289 + dev->pdata.max_bus_speed);
292 + if (attr == &gpiommc_attr_register) {
293 + count = snprintf(page, PAGE_SIZE, "%u\n",
294 + gpiommc_is_registered(dev));
300 + return err ? err : count;
303 +static int gpiommc_do_register(struct gpiommc_configfs_device *dev,
308 + if (gpiommc_is_registered(dev))
311 + if (!gpio_is_valid(dev->pdata.pins.gpio_di) ||
312 + !gpio_is_valid(dev->pdata.pins.gpio_do) ||
313 + !gpio_is_valid(dev->pdata.pins.gpio_clk) ||
314 + !gpio_is_valid(dev->pdata.pins.gpio_cs)) {
315 + printk(KERN_ERR PFX
316 + "configfs: Invalid GPIO pin number(s)\n");
320 + strlcpy(dev->pdata.name, name,
321 + sizeof(dev->pdata.name));
323 + dev->pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME,
324 + gpiommc_next_id());
327 + err = platform_device_add_data(dev->pdev, &dev->pdata,
328 + sizeof(dev->pdata));
330 + platform_device_put(dev->pdev);
333 + err = platform_device_add(dev->pdev);
335 + platform_device_put(dev->pdev);
342 +static void gpiommc_do_unregister(struct gpiommc_configfs_device *dev)
344 + if (!gpiommc_is_registered(dev))
347 + platform_device_unregister(dev->pdev);
351 +static ssize_t gpiommc_config_attr_store(struct config_item *item,
352 + struct configfs_attribute *attr,
353 + const char *page, size_t count)
355 + struct gpiommc_configfs_device *dev = ci_to_gpiommc(item);
357 + unsigned long data;
359 + if (attr == &gpiommc_attr_register) {
360 + err = strict_strtoul(page, 10, &data);
365 + err = gpiommc_do_register(dev, item->ci_name);
367 + gpiommc_do_unregister(dev);
373 + if (gpiommc_is_registered(dev)) {
374 + /* The rest of the config parameters can only be set
375 + * as long as the device is not registered, yet. */
380 + if (attr == &gpiommc_attr_DI) {
381 + err = strict_strtoul(page, 10, &data);
385 + if (!gpio_is_valid(data))
387 + dev->pdata.pins.gpio_di = data;
391 + if (attr == &gpiommc_attr_DO) {
392 + err = strict_strtoul(page, 10, &data);
396 + if (!gpio_is_valid(data))
398 + dev->pdata.pins.gpio_do = data;
402 + if (attr == &gpiommc_attr_CLK) {
403 + err = strict_strtoul(page, 10, &data);
407 + if (!gpio_is_valid(data))
409 + dev->pdata.pins.gpio_clk = data;
413 + if (attr == &gpiommc_attr_CS) {
414 + err = strict_strtoul(page, 10, &data);
418 + if (!gpio_is_valid(data))
420 + dev->pdata.pins.gpio_cs = data;
424 + if (attr == &gpiommc_attr_CS_activelow) {
425 + err = strict_strtoul(page, 10, &data);
429 + if (data != 0 && data != 1)
431 + dev->pdata.pins.cs_activelow = data;
435 + if (attr == &gpiommc_attr_spimode) {
436 + err = strict_strtoul(page, 10, &data);
442 + dev->pdata.mode = SPI_MODE_0;
445 + dev->pdata.mode = SPI_MODE_1;
448 + dev->pdata.mode = SPI_MODE_2;
451 + dev->pdata.mode = SPI_MODE_3;
459 + if (attr == &gpiommc_attr_spidelay) {
460 + err = strict_strtoul(page, 10, &data);
464 + if (data != 0 && data != 1)
466 + dev->pdata.no_spi_delay = !data;
470 + if (attr == &gpiommc_attr_max_bus_speed) {
471 + err = strict_strtoul(page, 10, &data);
475 + if (data > UINT_MAX)
477 + dev->pdata.max_bus_speed = data;
484 + return err ? err : count;
487 +static void gpiommc_config_item_release(struct config_item *item)
489 + struct gpiommc_configfs_device *dev = ci_to_gpiommc(item);
494 +static struct configfs_item_operations gpiommc_config_item_ops = {
495 + .release = gpiommc_config_item_release,
496 + .show_attribute = gpiommc_config_attr_show,
497 + .store_attribute = gpiommc_config_attr_store,
500 +static struct config_item_type gpiommc_dev_ci_type = {
501 + .ct_item_ops = &gpiommc_config_item_ops,
502 + .ct_attrs = gpiommc_config_attrs,
503 + .ct_owner = THIS_MODULE,
506 +static struct config_item *gpiommc_make_item(struct config_group *group,
509 + struct gpiommc_configfs_device *dev;
511 + if (strlen(name) > GPIOMMC_MAX_NAMELEN) {
512 + printk(KERN_ERR PFX "configfs: device name too long\n");
516 + dev = kzalloc(sizeof(*dev), GFP_KERNEL);
520 + config_item_init_type_name(&dev->item, name,
521 + &gpiommc_dev_ci_type);
523 + /* Assign default configuration */
524 + dev->pdata.pins.gpio_di = GPIO_INVALID;
525 + dev->pdata.pins.gpio_do = GPIO_INVALID;
526 + dev->pdata.pins.gpio_clk = GPIO_INVALID;
527 + dev->pdata.pins.gpio_cs = GPIO_INVALID;
528 + dev->pdata.pins.cs_activelow = 1;
529 + dev->pdata.mode = SPI_MODE_0;
530 + dev->pdata.no_spi_delay = 0;
531 + dev->pdata.max_bus_speed = 5000000; /* 5 MHz */
533 + return &(dev->item);
536 +static void gpiommc_drop_item(struct config_group *group,
537 + struct config_item *item)
539 + struct gpiommc_configfs_device *dev = ci_to_gpiommc(item);
541 + gpiommc_do_unregister(dev);
545 +static struct configfs_group_operations gpiommc_ct_group_ops = {
546 + .make_item = gpiommc_make_item,
547 + .drop_item = gpiommc_drop_item,
550 +static struct config_item_type gpiommc_ci_type = {
551 + .ct_group_ops = &gpiommc_ct_group_ops,
552 + .ct_owner = THIS_MODULE,
555 +static struct configfs_subsystem gpiommc_subsys = {
558 + .ci_namebuf = GPIOMMC_PLATDEV_NAME,
559 + .ci_type = &gpiommc_ci_type,
562 + .su_mutex = __MUTEX_INITIALIZER(gpiommc_subsys.su_mutex),
565 +#endif /* CONFIG_GPIOMMC_CONFIGFS */
567 +static struct platform_driver gpiommc_plat_driver = {
568 + .probe = gpiommc_probe,
569 + .remove = gpiommc_remove,
571 + .name = GPIOMMC_PLATDEV_NAME,
572 + .owner = THIS_MODULE,
576 +int gpiommc_next_id(void)
578 + static atomic_t counter = ATOMIC_INIT(-1);
580 + return atomic_inc_return(&counter);
582 +EXPORT_SYMBOL(gpiommc_next_id);
584 +static int __init gpiommc_modinit(void)
588 + err = platform_driver_register(&gpiommc_plat_driver);
592 +#ifdef CONFIG_GPIOMMC_CONFIGFS
593 + config_group_init(&gpiommc_subsys.su_group);
594 + err = configfs_register_subsystem(&gpiommc_subsys);
596 + platform_driver_unregister(&gpiommc_plat_driver);
599 +#endif /* CONFIG_GPIOMMC_CONFIGFS */
603 +module_init(gpiommc_modinit);
605 +static void __exit gpiommc_modexit(void)
607 +#ifdef CONFIG_GPIOMMC_CONFIGFS
608 + configfs_unregister_subsystem(&gpiommc_subsys);
610 + platform_driver_unregister(&gpiommc_plat_driver);
612 +module_exit(gpiommc_modexit);
613 --- a/drivers/mmc/host/Kconfig
614 +++ b/drivers/mmc/host/Kconfig
615 @@ -459,6 +459,31 @@ config MMC_SDHI
616 This provides support for the SDHI SD/SDIO controller found in
617 SuperH and ARM SH-Mobile SoCs
620 + tristate "MMC/SD over GPIO-based SPI"
621 + depends on MMC && MMC_SPI && SPI_GPIO_OLD
623 + This driver hooks up the mmc_spi and spi_gpio modules so that
624 + MMC/SD cards can be used on a GPIO based bus by bitbanging
625 + the SPI protocol in software.
627 + This driver provides a configfs interface to dynamically create
628 + and destroy GPIO-based MMC/SD card devices. It also provides
629 + a platform device interface API.
630 + See Documentation/gpiommc.txt for details.
632 + The module will be called gpiommc.
636 +config GPIOMMC_CONFIGFS
638 + depends on GPIOMMC && CONFIGFS_FS
641 + This option automatically enables configfs support for gpiommc
642 + if configfs is available.
645 tristate "ENE CB710 MMC/SD Interface support"
647 --- a/drivers/mmc/host/Makefile
648 +++ b/drivers/mmc/host/Makefile
649 @@ -36,6 +36,7 @@ tmio_mmc_core-$(subst m,y,$(CONFIG_MMC_S
650 obj-$(CONFIG_MMC_SDHI) += sh_mobile_sdhi.o
651 obj-$(CONFIG_MMC_CB710) += cb710-mmc.o
652 obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o
653 +obj-$(CONFIG_GPIOMMC) += gpiommc.o
654 obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o
655 obj-$(CONFIG_MMC_DW) += dw_mmc.o
656 obj-$(CONFIG_MMC_DW_PLTFM) += dw_mmc-pltfm.o
658 +++ b/include/linux/mmc/gpiommc.h
661 + * Device driver for MMC/SD cards driven over a GPIO bus.
663 + * Copyright (c) 2008 Michael Buesch
665 + * Licensed under the GNU/GPL version 2.
667 +#ifndef LINUX_GPIOMMC_H_
668 +#define LINUX_GPIOMMC_H_
670 +#include <linux/types.h>
673 +#define GPIOMMC_MAX_NAMELEN 15
674 +#define GPIOMMC_MAX_NAMELEN_STR __stringify(GPIOMMC_MAX_NAMELEN)
677 + * struct gpiommc_pins - Hardware pin assignments
679 + * @gpio_di: The GPIO number of the DATA IN pin
680 + * @gpio_do: The GPIO number of the DATA OUT pin
681 + * @gpio_clk: The GPIO number of the CLOCK pin
682 + * @gpio_cs: The GPIO number of the CHIPSELECT pin
683 + * @cs_activelow: If true, the chip is considered selected if @gpio_cs is low.
685 +struct gpiommc_pins {
686 + unsigned int gpio_di;
687 + unsigned int gpio_do;
688 + unsigned int gpio_clk;
689 + unsigned int gpio_cs;
694 + * struct gpiommc_platform_data - Platform data for a MMC-over-SPI-GPIO device.
696 + * @name: The unique name string of the device.
697 + * @pins: The hardware pin assignments.
698 + * @mode: The hardware mode. This is either SPI_MODE_0,
699 + * SPI_MODE_1, SPI_MODE_2 or SPI_MODE_3. See the SPI documentation.
700 + * @no_spi_delay: Do not use delays in the lowlevel SPI bitbanging code.
701 + * This is not standards compliant, but may be required for some
702 + * embedded machines to gain reasonable speed.
703 + * @max_bus_speed: The maximum speed of the SPI bus, in Hertz.
705 +struct gpiommc_platform_data {
706 + char name[GPIOMMC_MAX_NAMELEN + 1];
707 + struct gpiommc_pins pins;
710 + unsigned int max_bus_speed;
714 + * GPIOMMC_PLATDEV_NAME - The platform device name string.
716 + * The name string that has to be used for platform_device_alloc
717 + * when allocating a gpiommc device.
719 +#define GPIOMMC_PLATDEV_NAME "gpiommc"
722 + * gpiommc_next_id - Get another platform device ID number.
724 + * This returns the next platform device ID number that has to be used
725 + * for platform_device_alloc. The ID is opaque and should not be used for
728 +int gpiommc_next_id(void);
730 +#endif /* LINUX_GPIOMMC_H_ */
732 +++ b/Documentation/gpiommc.txt
734 +GPIOMMC - Driver for an MMC/SD card on a bitbanging GPIO SPI bus
735 +================================================================
737 +The gpiommc module hooks up the mmc_spi and spi_gpio modules for running an
738 +MMC or SD card on GPIO pins.
740 +Two interfaces for registering a new MMC/SD card device are provided:
741 +A static platform-device based mechanism and a dynamic configfs based interface.
744 +Registering devices via platform-device
745 +=======================================
747 +The platform-device interface is used for registering MMC/SD devices that are
748 +part of the hardware platform. This is most useful only for embedded machines
749 +with MMC/SD devices statically connected to the platform GPIO bus.
751 +The data structures are declared in <linux/mmc/gpiommc.h>.
753 +To register a new device, define an instance of struct gpiommc_platform_data.
754 +This structure holds any information about how the device is hooked up to the
755 +GPIO pins and what hardware modes the device supports. See the docbook-style
756 +documentation in the header file for more information on the struct fields.
758 +Then allocate a new instance of a platform device by doing:
760 + pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME, gpiommc_next_id());
762 +This will allocate the platform device data structures and hook it up to the
764 +Then add the gpiommc_platform_data to the platform device.
766 + err = platform_device_add_data(pdev, pdata, sizeof(struct gpiommc_platform_data));
768 +You may free the local instance of struct gpiommc_platform_data now. (So the
769 +struct may be allocated on the stack, too).
770 +Now simply register the platform device.
772 + err = platform_device_add(pdev);
774 +Done. The gpiommc probe routine will be invoked now and you should see a kernel
775 +log message for the added device.
778 +Registering devices via configfs
779 +================================
781 +MMC/SD cards connected via GPIO often are a pretty dynamic thing, as for example
782 +selfmade hacks for soldering an MMC/SD card to standard GPIO pins on embedded
783 +hardware are a common situation.
784 +So we provide a dynamic interface to conveniently handle adding and removing
785 +devices from userspace, without the need to recompile the kernel.
787 +The "gpiommc" subdirectory at the configfs mountpoint is used for handling
788 +the dynamic configuration.
790 +To create a new device, it must first be allocated with mkdir.
791 +The following command will allocate a device named "my_mmc":
792 + mkdir /config/gpiommc/my_mmc
794 +There are several configuration files available in the new
795 +/config/gpiommc/my_mmc/ directory:
797 +gpio_data_in = The SPI data-IN GPIO pin number.
798 +gpio_data_out = The SPI data-OUT GPIO pin number.
799 +gpio_clock = The SPI Clock GPIO pin number.
800 +gpio_chipselect = The SPI Chipselect GPIO pin number.
801 +gpio_chipselect_activelow = Boolean. If 0, Chipselect is active-HIGH.
802 + If 1, Chipselect is active-LOW.
803 +spi_mode = The SPI data mode. Can be 0-3.
804 +spi_delay = Enable all delays in the lowlevel bitbanging.
805 +max_bus_speed = The maximum SPI bus speed. In Hertz.
807 +register = Not a configuration parameter.
808 + Used to register the configured card
811 +The device must first get configured and then registered by writing "1" to
812 +the "register" file.
813 +The configuration parameters "gpio_data_in", "gpio_data_out", "gpio_clock"
814 +and "gpio_chipselect" are essential and _must_ be configured before writing
815 +"1" to the "register" file. The registration will fail, otherwise.
817 +The default values for the other parameters are:
818 +gpio_chipselect_activelow = 1 (CS active-LOW)
819 +spi_mode = 0 (SPI_MODE_0)
820 +spi_delay = 1 (enabled)
821 +max_bus_speed = 5000000 (5 Mhz)
823 +Configuration values can not be changed after registration. To unregister
824 +the device, write a "0" to the "register" file. The configuration can be
825 +changed again after unregistering.
827 +To completely remove the device, simply rmdir the directory
828 +(/config/gpiommc/my_mmc in this example).
829 +There's no need to first unregister the device before removing it. That will
830 +be done automatically.
833 @@ -3478,6 +3478,11 @@ L: linuxppc-dev@lists.ozlabs.org
843 M: Jean Delvare <khali@linux-fr.org>
844 M: Guenter Roeck <linux@roeck-us.net>