[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20080718152358.3d514b73.randy.dunlap@oracle.com>
Date: Fri, 18 Jul 2008 15:23:58 -0700
From: Randy Dunlap <randy.dunlap@...cle.com>
To: Michael Buesch <mb@...sch.de>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Stephen Rothwell <sfr@...b.auug.org.au>,
"linux-kernel" <linux-kernel@...r.kernel.org>,
David Brownell <david-b@...bell.net>,
Piot Skamruk <piotr.skamruk@...il.com>,
openwrt-devel@...ts.openwrt.org
Subject: Re: [PATCH v2] Add SPI over GPIO driver
On Fri, 18 Jul 2008 21:59:03 +0200 Michael Buesch wrote:
> This adds a driver that lets you drive an SPI bus over
> generic GPIO pins.
>
> Signed-off-by: Michael Buesch <mb@...sch.de>
>
> ---
>
> This driver is used in OpenWrt since quite some time, so please
> consider for inclusion in mainline.
diffstat here, please.
> Index: linux-next/include/linux/spi/spi_gpio.h
> ===================================================================
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ linux-next/include/linux/spi/spi_gpio.h 2008-07-15 20:44:30.000000000 +0200
> @@ -0,0 +1,67 @@
> +/*
> + * spi_gpio interface to platform code
> + *
> + * Copyright (c) 2008 Piotr Skamruk
> + * Copyright (c) 2008 Michael Buesch
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +#ifndef _LINUX_SPI_SPI_GPIO
> +#define _LINUX_SPI_SPI_GPIO
> +
> +#include <linux/types.h>
> +#include <linux/spi/spi.h>
> +
> +
> +/** struct spi_gpio_platform_data - Data definitions for a SPI-GPIO device.
> + * This structure holds information about a GPIO-based SPI device.
kernel-doc blocks begin with /** on a line by itself. E.g.:
/**
* struct spi_gpio_platform_data - blah
> + *
> + * @pin_clk: The GPIO pin number of the CLOCK pin.
> + *
> + * @pin_miso: The GPIO pin number of the MISO pin.
> + *
> + * @pin_mosi: The GPIO pin number of the MOSI pin.
> + *
> + * @pin_cs: The GPIO pin number of the CHIPSELECT pin.
> + *
> + * @cs_activelow: If true, the chip is selected when the CS line is low.
> + *
> + * @no_spi_delay: If true, no delay is done in the lowlevel bitbanging.
> + * Note that doing no delay is not standards compliant,
> + * but it might be needed to speed up transfers on some
> + * slow embedded machines.
> + *
> + * @boardinfo_setup: This callback is called after the
> + * SPI master device was registered, but before the
> + * device is registered.
> + * @boardinfo_setup_data: Data argument passed to boardinfo_setup().
> + */
> +struct spi_gpio_platform_data {
> + unsigned int pin_clk;
> + unsigned int pin_miso;
> + unsigned int pin_mosi;
> + unsigned int pin_cs;
> + bool cs_activelow;
> + bool no_spi_delay;
> + int (*boardinfo_setup)(struct spi_board_info *bi,
> + struct spi_master *master,
> + void *data);
> + void *boardinfo_setup_data;
> +};
> +
> +/** SPI_GPIO_PLATDEV_NAME - The platform device name string.
> + * The name string that has to be used for platform_device_alloc
> + * when allocating a spi-gpio device.
> + */
> +#define SPI_GPIO_PLATDEV_NAME "spi-gpio"
> +
> +/** spi_gpio_next_id - Get another platform device ID number.
> + * This returns the next platform device ID number that has to be used
> + * for platform_device_alloc. The ID is opaque and should not be used for
> + * anything else.
> + */
> +int spi_gpio_next_id(void);
> +
> +#endif /* _LINUX_SPI_SPI_GPIO */
> Index: linux-next/drivers/spi/Kconfig
> ===================================================================
> --- linux-next.orig/drivers/spi/Kconfig 2008-07-14 20:52:44.000000000 +0200
> +++ linux-next/drivers/spi/Kconfig 2008-07-14 20:52:48.000000000 +0200
> @@ -100,6 +100,19 @@ config SPI_BUTTERFLY
> inexpensive battery powered microcontroller evaluation board.
> This same cable can be used to flash new firmware.
>
> +config SPI_GPIO
> + tristate "GPIO API based bitbanging SPI controller"
> + depends on SPI_MASTER && GENERIC_GPIO
> + select SPI_BITBANG
> + help
> + This is a platform driver that can be used for bitbanging
> + an SPI bus over GPIO pins.
> + Select this, if you have any SPI device that is connected via
No comma.
> + GPIO pins.
> + The module will be called spi_gpio.
> +
> + If unsure, say N.
> +
> config SPI_IMX
> tristate "Freescale iMX SPI controller"
> depends on SPI_MASTER && ARCH_IMX && EXPERIMENTAL
---
~Randy
Linux Plumbers Conference, 17-19 September 2008, Portland, Oregon USA
http://linuxplumbersconf.org/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists