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/mmc/gpiommc.h>
15 +#include <linux/platform_device.h>
16 +#include <linux/list.h>
17 +#include <linux/mutex.h>
18 +#include <linux/spi/spi_gpio_old.h>
19 +#include <linux/configfs.h>
20 +#include <linux/gpio.h>
21 +#include <asm/atomic.h>
24 +#define PFX "gpio-mmc: "
27 +struct gpiommc_device {
28 + struct platform_device *pdev;
29 + struct platform_device *spi_pdev;
30 + struct spi_board_info boardinfo;
34 +MODULE_DESCRIPTION("GPIO based MMC driver");
35 +MODULE_AUTHOR("Michael Buesch");
36 +MODULE_LICENSE("GPL");
39 +static int gpiommc_boardinfo_setup(struct spi_board_info *bi,
40 + struct spi_master *master,
43 + struct gpiommc_device *d = data;
44 + struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data;
46 + /* Bind the SPI master to the MMC-SPI host driver. */
47 + strlcpy(bi->modalias, "mmc_spi", sizeof(bi->modalias));
49 + bi->max_speed_hz = pdata->max_bus_speed;
50 + bi->bus_num = master->bus_num;
51 + bi->mode = pdata->mode;
56 +static int gpiommc_probe(struct platform_device *pdev)
58 + struct gpiommc_platform_data *mmc_pdata = pdev->dev.platform_data;
59 + struct spi_gpio_platform_data spi_pdata;
60 + struct gpiommc_device *d;
67 +#ifdef CONFIG_MMC_SPI_MODULE
68 + err = request_module("mmc_spi");
70 + printk(KERN_WARNING PFX
71 + "Failed to request mmc_spi module.\n");
73 +#endif /* CONFIG_MMC_SPI_MODULE */
75 + /* Allocate the GPIO-MMC device */
77 + d = kzalloc(sizeof(*d), GFP_KERNEL);
82 + /* Create the SPI-GPIO device */
83 + d->spi_pdev = platform_device_alloc(SPI_GPIO_PLATDEV_NAME,
84 + spi_gpio_next_id());
88 + memset(&spi_pdata, 0, sizeof(spi_pdata));
89 + spi_pdata.pin_clk = mmc_pdata->pins.gpio_clk;
90 + spi_pdata.pin_miso = mmc_pdata->pins.gpio_do;
91 + spi_pdata.pin_mosi = mmc_pdata->pins.gpio_di;
92 + spi_pdata.pin_cs = mmc_pdata->pins.gpio_cs;
93 + spi_pdata.cs_activelow = mmc_pdata->pins.cs_activelow;
94 + spi_pdata.no_spi_delay = mmc_pdata->no_spi_delay;
95 + spi_pdata.boardinfo_setup = gpiommc_boardinfo_setup;
96 + spi_pdata.boardinfo_setup_data = d;
98 + err = platform_device_add_data(d->spi_pdev, &spi_pdata,
101 + goto err_free_pdev;
102 + err = platform_device_add(d->spi_pdev);
104 + goto err_free_pdata;
105 + platform_set_drvdata(pdev, d);
107 + printk(KERN_INFO PFX "MMC-Card \"%s\" "
108 + "attached to GPIO pins di=%u, do=%u, clk=%u, cs=%u\n",
109 + mmc_pdata->name, mmc_pdata->pins.gpio_di,
110 + mmc_pdata->pins.gpio_do,
111 + mmc_pdata->pins.gpio_clk,
112 + mmc_pdata->pins.gpio_cs);
117 + kfree(d->spi_pdev->dev.platform_data);
118 + d->spi_pdev->dev.platform_data = NULL;
120 + platform_device_put(d->spi_pdev);
127 +static int gpiommc_remove(struct platform_device *pdev)
129 + struct gpiommc_device *d = platform_get_drvdata(pdev);
130 + struct gpiommc_platform_data *pdata = d->pdev->dev.platform_data;
132 + platform_device_unregister(d->spi_pdev);
133 + printk(KERN_INFO PFX "GPIO based MMC-Card \"%s\" removed\n",
135 + platform_device_put(d->spi_pdev);
140 +#ifdef CONFIG_GPIOMMC_CONFIGFS
142 +/* A device that was created through configfs */
143 +struct gpiommc_configfs_device {
144 + struct config_item item;
145 + /* The platform device, after registration. */
146 + struct platform_device *pdev;
147 + /* The configuration */
148 + struct gpiommc_platform_data pdata;
151 +#define GPIO_INVALID -1
153 +static inline bool gpiommc_is_registered(struct gpiommc_configfs_device *dev)
155 + return (dev->pdev != NULL);
158 +static inline struct gpiommc_configfs_device *ci_to_gpiommc(struct config_item *item)
160 + return item ? container_of(item, struct gpiommc_configfs_device, item) : NULL;
163 +static struct configfs_attribute gpiommc_attr_DI = {
164 + .ca_owner = THIS_MODULE,
165 + .ca_name = "gpio_data_in",
166 + .ca_mode = S_IRUGO | S_IWUSR,
169 +static struct configfs_attribute gpiommc_attr_DO = {
170 + .ca_owner = THIS_MODULE,
171 + .ca_name = "gpio_data_out",
172 + .ca_mode = S_IRUGO | S_IWUSR,
175 +static struct configfs_attribute gpiommc_attr_CLK = {
176 + .ca_owner = THIS_MODULE,
177 + .ca_name = "gpio_clock",
178 + .ca_mode = S_IRUGO | S_IWUSR,
181 +static struct configfs_attribute gpiommc_attr_CS = {
182 + .ca_owner = THIS_MODULE,
183 + .ca_name = "gpio_chipselect",
184 + .ca_mode = S_IRUGO | S_IWUSR,
187 +static struct configfs_attribute gpiommc_attr_CS_activelow = {
188 + .ca_owner = THIS_MODULE,
189 + .ca_name = "gpio_chipselect_activelow",
190 + .ca_mode = S_IRUGO | S_IWUSR,
193 +static struct configfs_attribute gpiommc_attr_spimode = {
194 + .ca_owner = THIS_MODULE,
195 + .ca_name = "spi_mode",
196 + .ca_mode = S_IRUGO | S_IWUSR,
199 +static struct configfs_attribute gpiommc_attr_spidelay = {
200 + .ca_owner = THIS_MODULE,
201 + .ca_name = "spi_delay",
202 + .ca_mode = S_IRUGO | S_IWUSR,
205 +static struct configfs_attribute gpiommc_attr_max_bus_speed = {
206 + .ca_owner = THIS_MODULE,
207 + .ca_name = "max_bus_speed",
208 + .ca_mode = S_IRUGO | S_IWUSR,
211 +static struct configfs_attribute gpiommc_attr_register = {
212 + .ca_owner = THIS_MODULE,
213 + .ca_name = "register",
214 + .ca_mode = S_IRUGO | S_IWUSR,
217 +static struct configfs_attribute *gpiommc_config_attrs[] = {
222 + &gpiommc_attr_CS_activelow,
223 + &gpiommc_attr_spimode,
224 + &gpiommc_attr_spidelay,
225 + &gpiommc_attr_max_bus_speed,
226 + &gpiommc_attr_register,
230 +static ssize_t gpiommc_config_attr_show(struct config_item *item,
231 + struct configfs_attribute *attr,
234 + struct gpiommc_configfs_device *dev = ci_to_gpiommc(item);
239 + if (attr == &gpiommc_attr_DI) {
240 + gpio = dev->pdata.pins.gpio_di;
241 + if (gpio == GPIO_INVALID)
242 + count = snprintf(page, PAGE_SIZE, "not configured\n");
244 + count = snprintf(page, PAGE_SIZE, "%u\n", gpio);
247 + if (attr == &gpiommc_attr_DO) {
248 + gpio = dev->pdata.pins.gpio_do;
249 + if (gpio == GPIO_INVALID)
250 + count = snprintf(page, PAGE_SIZE, "not configured\n");
252 + count = snprintf(page, PAGE_SIZE, "%u\n", gpio);
255 + if (attr == &gpiommc_attr_CLK) {
256 + gpio = dev->pdata.pins.gpio_clk;
257 + if (gpio == GPIO_INVALID)
258 + count = snprintf(page, PAGE_SIZE, "not configured\n");
260 + count = snprintf(page, PAGE_SIZE, "%u\n", gpio);
263 + if (attr == &gpiommc_attr_CS) {
264 + gpio = dev->pdata.pins.gpio_cs;
265 + if (gpio == GPIO_INVALID)
266 + count = snprintf(page, PAGE_SIZE, "not configured\n");
268 + count = snprintf(page, PAGE_SIZE, "%u\n", gpio);
271 + if (attr == &gpiommc_attr_CS_activelow) {
272 + count = snprintf(page, PAGE_SIZE, "%u\n",
273 + dev->pdata.pins.cs_activelow);
276 + if (attr == &gpiommc_attr_spimode) {
277 + count = snprintf(page, PAGE_SIZE, "%u\n",
281 + if (attr == &gpiommc_attr_spidelay) {
282 + count = snprintf(page, PAGE_SIZE, "%u\n",
283 + !dev->pdata.no_spi_delay);
286 + if (attr == &gpiommc_attr_max_bus_speed) {
287 + count = snprintf(page, PAGE_SIZE, "%u\n",
288 + dev->pdata.max_bus_speed);
291 + if (attr == &gpiommc_attr_register) {
292 + count = snprintf(page, PAGE_SIZE, "%u\n",
293 + gpiommc_is_registered(dev));
299 + return err ? err : count;
302 +static int gpiommc_do_register(struct gpiommc_configfs_device *dev,
307 + if (gpiommc_is_registered(dev))
310 + if (!gpio_is_valid(dev->pdata.pins.gpio_di) ||
311 + !gpio_is_valid(dev->pdata.pins.gpio_do) ||
312 + !gpio_is_valid(dev->pdata.pins.gpio_clk) ||
313 + !gpio_is_valid(dev->pdata.pins.gpio_cs)) {
314 + printk(KERN_ERR PFX
315 + "configfs: Invalid GPIO pin number(s)\n");
319 + strlcpy(dev->pdata.name, name,
320 + sizeof(dev->pdata.name));
322 + dev->pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME,
323 + gpiommc_next_id());
326 + err = platform_device_add_data(dev->pdev, &dev->pdata,
327 + sizeof(dev->pdata));
329 + platform_device_put(dev->pdev);
332 + err = platform_device_add(dev->pdev);
334 + platform_device_put(dev->pdev);
341 +static void gpiommc_do_unregister(struct gpiommc_configfs_device *dev)
343 + if (!gpiommc_is_registered(dev))
346 + platform_device_unregister(dev->pdev);
350 +static ssize_t gpiommc_config_attr_store(struct config_item *item,
351 + struct configfs_attribute *attr,
352 + const char *page, size_t count)
354 + struct gpiommc_configfs_device *dev = ci_to_gpiommc(item);
356 + unsigned long data;
358 + if (attr == &gpiommc_attr_register) {
359 + err = strict_strtoul(page, 10, &data);
364 + err = gpiommc_do_register(dev, item->ci_name);
366 + gpiommc_do_unregister(dev);
372 + if (gpiommc_is_registered(dev)) {
373 + /* The rest of the config parameters can only be set
374 + * as long as the device is not registered, yet. */
379 + if (attr == &gpiommc_attr_DI) {
380 + err = strict_strtoul(page, 10, &data);
384 + if (!gpio_is_valid(data))
386 + dev->pdata.pins.gpio_di = data;
390 + if (attr == &gpiommc_attr_DO) {
391 + err = strict_strtoul(page, 10, &data);
395 + if (!gpio_is_valid(data))
397 + dev->pdata.pins.gpio_do = data;
401 + if (attr == &gpiommc_attr_CLK) {
402 + err = strict_strtoul(page, 10, &data);
406 + if (!gpio_is_valid(data))
408 + dev->pdata.pins.gpio_clk = data;
412 + if (attr == &gpiommc_attr_CS) {
413 + err = strict_strtoul(page, 10, &data);
417 + if (!gpio_is_valid(data))
419 + dev->pdata.pins.gpio_cs = data;
423 + if (attr == &gpiommc_attr_CS_activelow) {
424 + err = strict_strtoul(page, 10, &data);
428 + if (data != 0 && data != 1)
430 + dev->pdata.pins.cs_activelow = data;
434 + if (attr == &gpiommc_attr_spimode) {
435 + err = strict_strtoul(page, 10, &data);
441 + dev->pdata.mode = SPI_MODE_0;
444 + dev->pdata.mode = SPI_MODE_1;
447 + dev->pdata.mode = SPI_MODE_2;
450 + dev->pdata.mode = SPI_MODE_3;
458 + if (attr == &gpiommc_attr_spidelay) {
459 + err = strict_strtoul(page, 10, &data);
463 + if (data != 0 && data != 1)
465 + dev->pdata.no_spi_delay = !data;
469 + if (attr == &gpiommc_attr_max_bus_speed) {
470 + err = strict_strtoul(page, 10, &data);
474 + if (data > UINT_MAX)
476 + dev->pdata.max_bus_speed = data;
483 + return err ? err : count;
486 +static void gpiommc_config_item_release(struct config_item *item)
488 + struct gpiommc_configfs_device *dev = ci_to_gpiommc(item);
493 +static struct configfs_item_operations gpiommc_config_item_ops = {
494 + .release = gpiommc_config_item_release,
495 + .show_attribute = gpiommc_config_attr_show,
496 + .store_attribute = gpiommc_config_attr_store,
499 +static struct config_item_type gpiommc_dev_ci_type = {
500 + .ct_item_ops = &gpiommc_config_item_ops,
501 + .ct_attrs = gpiommc_config_attrs,
502 + .ct_owner = THIS_MODULE,
505 +static struct config_item *gpiommc_make_item(struct config_group *group,
508 + struct gpiommc_configfs_device *dev;
510 + if (strlen(name) > GPIOMMC_MAX_NAMELEN) {
511 + printk(KERN_ERR PFX "configfs: device name too long\n");
515 + dev = kzalloc(sizeof(*dev), GFP_KERNEL);
519 + config_item_init_type_name(&dev->item, name,
520 + &gpiommc_dev_ci_type);
522 + /* Assign default configuration */
523 + dev->pdata.pins.gpio_di = GPIO_INVALID;
524 + dev->pdata.pins.gpio_do = GPIO_INVALID;
525 + dev->pdata.pins.gpio_clk = GPIO_INVALID;
526 + dev->pdata.pins.gpio_cs = GPIO_INVALID;
527 + dev->pdata.pins.cs_activelow = 1;
528 + dev->pdata.mode = SPI_MODE_0;
529 + dev->pdata.no_spi_delay = 0;
530 + dev->pdata.max_bus_speed = 5000000; /* 5 MHz */
532 + return &(dev->item);
535 +static void gpiommc_drop_item(struct config_group *group,
536 + struct config_item *item)
538 + struct gpiommc_configfs_device *dev = ci_to_gpiommc(item);
540 + gpiommc_do_unregister(dev);
544 +static struct configfs_group_operations gpiommc_ct_group_ops = {
545 + .make_item = gpiommc_make_item,
546 + .drop_item = gpiommc_drop_item,
549 +static struct config_item_type gpiommc_ci_type = {
550 + .ct_group_ops = &gpiommc_ct_group_ops,
551 + .ct_owner = THIS_MODULE,
554 +static struct configfs_subsystem gpiommc_subsys = {
557 + .ci_namebuf = GPIOMMC_PLATDEV_NAME,
558 + .ci_type = &gpiommc_ci_type,
561 + .su_mutex = __MUTEX_INITIALIZER(gpiommc_subsys.su_mutex),
564 +#endif /* CONFIG_GPIOMMC_CONFIGFS */
566 +static struct platform_driver gpiommc_plat_driver = {
567 + .probe = gpiommc_probe,
568 + .remove = gpiommc_remove,
570 + .name = GPIOMMC_PLATDEV_NAME,
571 + .owner = THIS_MODULE,
575 +int gpiommc_next_id(void)
577 + static atomic_t counter = ATOMIC_INIT(-1);
579 + return atomic_inc_return(&counter);
581 +EXPORT_SYMBOL(gpiommc_next_id);
583 +static int __init gpiommc_modinit(void)
587 + err = platform_driver_register(&gpiommc_plat_driver);
591 +#ifdef CONFIG_GPIOMMC_CONFIGFS
592 + config_group_init(&gpiommc_subsys.su_group);
593 + err = configfs_register_subsystem(&gpiommc_subsys);
595 + platform_driver_unregister(&gpiommc_plat_driver);
598 +#endif /* CONFIG_GPIOMMC_CONFIGFS */
602 +module_init(gpiommc_modinit);
604 +static void __exit gpiommc_modexit(void)
606 +#ifdef CONFIG_GPIOMMC_CONFIGFS
607 + configfs_unregister_subsystem(&gpiommc_subsys);
609 + platform_driver_unregister(&gpiommc_plat_driver);
611 +module_exit(gpiommc_modexit);
612 --- a/drivers/mmc/host/Kconfig
613 +++ b/drivers/mmc/host/Kconfig
614 @@ -458,6 +458,31 @@ config MMC_SDHI
615 This provides support for the SDHI SD/SDIO controller found in
616 SuperH and ARM SH-Mobile SoCs
619 + tristate "MMC/SD over GPIO-based SPI"
620 + depends on MMC && MMC_SPI && SPI_GPIO_OLD
622 + This driver hooks up the mmc_spi and spi_gpio modules so that
623 + MMC/SD cards can be used on a GPIO based bus by bitbanging
624 + the SPI protocol in software.
626 + This driver provides a configfs interface to dynamically create
627 + and destroy GPIO-based MMC/SD card devices. It also provides
628 + a platform device interface API.
629 + See Documentation/gpiommc.txt for details.
631 + The module will be called gpiommc.
635 +config GPIOMMC_CONFIGFS
637 + depends on GPIOMMC && CONFIGFS_FS
640 + This option automatically enables configfs support for gpiommc
641 + if configfs is available.
644 tristate "ENE CB710 MMC/SD Interface support"
646 --- a/drivers/mmc/host/Makefile
647 +++ b/drivers/mmc/host/Makefile
648 @@ -37,6 +37,7 @@ endif
649 obj-$(CONFIG_MMC_SDHI) += sh_mobile_sdhi.o
650 obj-$(CONFIG_MMC_CB710) += cb710-mmc.o
651 obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o
652 +obj-$(CONFIG_GPIOMMC) += gpiommc.o
653 obj-$(CONFIG_SDH_BFIN) += bfin_sdh.o
654 obj-$(CONFIG_MMC_DW) += dw_mmc.o
655 obj-$(CONFIG_MMC_SH_MMCIF) += sh_mmcif.o
657 +++ b/include/linux/mmc/gpiommc.h
660 + * Device driver for MMC/SD cards driven over a GPIO bus.
662 + * Copyright (c) 2008 Michael Buesch
664 + * Licensed under the GNU/GPL version 2.
666 +#ifndef LINUX_GPIOMMC_H_
667 +#define LINUX_GPIOMMC_H_
669 +#include <linux/types.h>
672 +#define GPIOMMC_MAX_NAMELEN 15
673 +#define GPIOMMC_MAX_NAMELEN_STR __stringify(GPIOMMC_MAX_NAMELEN)
676 + * struct gpiommc_pins - Hardware pin assignments
678 + * @gpio_di: The GPIO number of the DATA IN pin
679 + * @gpio_do: The GPIO number of the DATA OUT pin
680 + * @gpio_clk: The GPIO number of the CLOCK pin
681 + * @gpio_cs: The GPIO number of the CHIPSELECT pin
682 + * @cs_activelow: If true, the chip is considered selected if @gpio_cs is low.
684 +struct gpiommc_pins {
685 + unsigned int gpio_di;
686 + unsigned int gpio_do;
687 + unsigned int gpio_clk;
688 + unsigned int gpio_cs;
693 + * struct gpiommc_platform_data - Platform data for a MMC-over-SPI-GPIO device.
695 + * @name: The unique name string of the device.
696 + * @pins: The hardware pin assignments.
697 + * @mode: The hardware mode. This is either SPI_MODE_0,
698 + * SPI_MODE_1, SPI_MODE_2 or SPI_MODE_3. See the SPI documentation.
699 + * @no_spi_delay: Do not use delays in the lowlevel SPI bitbanging code.
700 + * This is not standards compliant, but may be required for some
701 + * embedded machines to gain reasonable speed.
702 + * @max_bus_speed: The maximum speed of the SPI bus, in Hertz.
704 +struct gpiommc_platform_data {
705 + char name[GPIOMMC_MAX_NAMELEN + 1];
706 + struct gpiommc_pins pins;
709 + unsigned int max_bus_speed;
713 + * GPIOMMC_PLATDEV_NAME - The platform device name string.
715 + * The name string that has to be used for platform_device_alloc
716 + * when allocating a gpiommc device.
718 +#define GPIOMMC_PLATDEV_NAME "gpiommc"
721 + * gpiommc_next_id - Get another platform device ID number.
723 + * This returns the next platform device ID number that has to be used
724 + * for platform_device_alloc. The ID is opaque and should not be used for
727 +int gpiommc_next_id(void);
729 +#endif /* LINUX_GPIOMMC_H_ */
731 +++ b/Documentation/gpiommc.txt
733 +GPIOMMC - Driver for an MMC/SD card on a bitbanging GPIO SPI bus
734 +================================================================
736 +The gpiommc module hooks up the mmc_spi and spi_gpio modules for running an
737 +MMC or SD card on GPIO pins.
739 +Two interfaces for registering a new MMC/SD card device are provided:
740 +A static platform-device based mechanism and a dynamic configfs based interface.
743 +Registering devices via platform-device
744 +=======================================
746 +The platform-device interface is used for registering MMC/SD devices that are
747 +part of the hardware platform. This is most useful only for embedded machines
748 +with MMC/SD devices statically connected to the platform GPIO bus.
750 +The data structures are declared in <linux/mmc/gpiommc.h>.
752 +To register a new device, define an instance of struct gpiommc_platform_data.
753 +This structure holds any information about how the device is hooked up to the
754 +GPIO pins and what hardware modes the device supports. See the docbook-style
755 +documentation in the header file for more information on the struct fields.
757 +Then allocate a new instance of a platform device by doing:
759 + pdev = platform_device_alloc(GPIOMMC_PLATDEV_NAME, gpiommc_next_id());
761 +This will allocate the platform device data structures and hook it up to the
763 +Then add the gpiommc_platform_data to the platform device.
765 + err = platform_device_add_data(pdev, pdata, sizeof(struct gpiommc_platform_data));
767 +You may free the local instance of struct gpiommc_platform_data now. (So the
768 +struct may be allocated on the stack, too).
769 +Now simply register the platform device.
771 + err = platform_device_add(pdev);
773 +Done. The gpiommc probe routine will be invoked now and you should see a kernel
774 +log message for the added device.
777 +Registering devices via configfs
778 +================================
780 +MMC/SD cards connected via GPIO often are a pretty dynamic thing, as for example
781 +selfmade hacks for soldering an MMC/SD card to standard GPIO pins on embedded
782 +hardware are a common situation.
783 +So we provide a dynamic interface to conveniently handle adding and removing
784 +devices from userspace, without the need to recompile the kernel.
786 +The "gpiommc" subdirectory at the configfs mountpoint is used for handling
787 +the dynamic configuration.
789 +To create a new device, it must first be allocated with mkdir.
790 +The following command will allocate a device named "my_mmc":
791 + mkdir /config/gpiommc/my_mmc
793 +There are several configuration files available in the new
794 +/config/gpiommc/my_mmc/ directory:
796 +gpio_data_in = The SPI data-IN GPIO pin number.
797 +gpio_data_out = The SPI data-OUT GPIO pin number.
798 +gpio_clock = The SPI Clock GPIO pin number.
799 +gpio_chipselect = The SPI Chipselect GPIO pin number.
800 +gpio_chipselect_activelow = Boolean. If 0, Chipselect is active-HIGH.
801 + If 1, Chipselect is active-LOW.
802 +spi_mode = The SPI data mode. Can be 0-3.
803 +spi_delay = Enable all delays in the lowlevel bitbanging.
804 +max_bus_speed = The maximum SPI bus speed. In Hertz.
806 +register = Not a configuration parameter.
807 + Used to register the configured card
810 +The device must first get configured and then registered by writing "1" to
811 +the "register" file.
812 +The configuration parameters "gpio_data_in", "gpio_data_out", "gpio_clock"
813 +and "gpio_chipselect" are essential and _must_ be configured before writing
814 +"1" to the "register" file. The registration will fail, otherwise.
816 +The default values for the other parameters are:
817 +gpio_chipselect_activelow = 1 (CS active-LOW)
818 +spi_mode = 0 (SPI_MODE_0)
819 +spi_delay = 1 (enabled)
820 +max_bus_speed = 5000000 (5 Mhz)
822 +Configuration values can not be changed after registration. To unregister
823 +the device, write a "0" to the "register" file. The configuration can be
824 +changed again after unregistering.
826 +To completely remove the device, simply rmdir the directory
827 +(/config/gpiommc/my_mmc in this example).
828 +There's no need to first unregister the device before removing it. That will
829 +be done automatically.
832 @@ -2901,6 +2901,11 @@ L: linuxppc-dev@lists.ozlabs.org
842 M: Jean Delvare <khali@linux-fr.org>
843 M: Guenter Roeck <guenter.roeck@ericsson.com>