From akpm@osdl.org Sun Jan 8 13:39:13 2006 From: akpm@osdl.org Message-Id: <200601082134.k08LYfjI004588@shell0.pdx.osdl.net> Subject: [patch 10/10] spi: misc fixes To: greg@kroah.com Cc: akpm@osdl.org, david-b@pacbell.net, dbrownell@users.sourceforge.net Date: Sun, 08 Jan 2006 13:34:29 -0800 From: David Brownell This collects some small SPI patches that seem to be missing from the MM tree: - spi_butterfly kbuild hooks got dropped somehow; this restores them - quick fix for a (theoretical?) m25p80_write() oops noted by Andrew - quick fix for a potential config-specific oops for mtd_dataflash() - minor doc tweaks Signed-off-by: David Brownell Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- Documentation/spi/spi-summary | 13 +++++++++++++ drivers/mtd/devices/m25p80.c | 4 +++- drivers/mtd/devices/mtd_dataflash.c | 2 +- drivers/spi/Kconfig | 10 ++++++++++ drivers/spi/Makefile | 1 + 5 files changed, 28 insertions(+), 2 deletions(-) --- gregkh-2.6.orig/Documentation/spi/spi-summary +++ gregkh-2.6/Documentation/spi/spi-summary @@ -115,6 +115,9 @@ shows up in sysfs in several locations: /sys/devices/.../CTLR/spiB.C ... spi_device for on bus "B", chipselect C, accessed through CTLR. + /sys/devices/.../CTLR/spiB.C/modalias ... identifies the driver + that should be used with this device (for hotplug/coldplug) + /sys/bus/spi/devices/spiB.C ... symlink to the physical spiB-C device @@ -247,6 +250,12 @@ driver is registered: Like with other static board-specific setup, you won't unregister those. +The widely used "card" style computers bundle memory, cpu, and little else +onto a card that's maybe just thirty square centimeters. On such systems, +your arch/.../mach-.../board-*.c file would primarily provide information +about the devices on the mainboard into which such a card is plugged. That +certainly includes SPI devices hooked up through the card connectors! + NON-STATIC CONFIGURATIONS @@ -258,6 +267,10 @@ up the spi bus master, and will likely n board info based on the board that was hotplugged. Of course, you'd later call at least spi_unregister_device() when that board is removed. +When Linux includes support for MMC/SD/SDIO/DataFlash cards through SPI, those +configurations will also be dynamic. Fortunately, those devices all support +basic device identification probes, so that support should hotplug normally. + How do I write an "SPI Protocol Driver"? ---------------------------------------- --- gregkh-2.6.orig/drivers/mtd/devices/m25p80.c +++ gregkh-2.6/drivers/mtd/devices/m25p80.c @@ -378,7 +378,9 @@ static int m25p80_write(struct mtd_info spi_sync(flash->spi, &m); - *retlen += m.actual_length - sizeof(flash->command); + if (retlen) + *retlen += m.actual_length + - sizeof(flash->command); } } --- gregkh-2.6.orig/drivers/mtd/devices/mtd_dataflash.c +++ gregkh-2.6/drivers/mtd/devices/mtd_dataflash.c @@ -508,7 +508,7 @@ add_dataflash(struct spi_device *spi, ch priv->partitioned = 1; return add_mtd_partitions(device, parts, nr_parts); } - } else if (pdata->nr_parts) + } else if (pdata && pdata->nr_parts) dev_warn(&spi->dev, "ignoring %d default partitions on %s\n", pdata->nr_parts, device->name); --- gregkh-2.6.orig/drivers/spi/Kconfig +++ gregkh-2.6/drivers/spi/Kconfig @@ -65,6 +65,16 @@ config SPI_BITBANG need it. You only need to select this explicitly to support driver modules that aren't part of this kernel tree. +config SPI_BUTTERFLY + tristate "Parallel port adapter for AVR Butterfly (DEVELOPMENT)" + depends on SPI_MASTER && PARPORT && EXPERIMENTAL + select SPI_BITBANG + help + This uses a custom parallel port cable to connect to an AVR + Butterfly , an + inexpensive battery powered microcontroller evaluation board. + This same cable can be used to flash new firmware. + # # Add new SPI master controllers in alphabetical order above this line # --- gregkh-2.6.orig/drivers/spi/Makefile +++ gregkh-2.6/drivers/spi/Makefile @@ -12,6 +12,7 @@ obj-$(CONFIG_SPI_MASTER) += spi.o # SPI master controller drivers (bus) obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o +obj-$(CONFIG_SPI_BUTTERFLY) += spi_butterfly.o # ... add above this line ... # SPI protocol drivers (device/link on bus)