diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-25 15:04:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-25 15:04:17 -0400 |
commit | 702c0b04978ce316ec05f4d0a9c148fac124335b (patch) | |
tree | 3908c5821221d950a6b1a7e2e898899e63e7d437 /Documentation | |
parent | c19eb8f0d1bd442ed1aff0b413dd822620771c29 (diff) | |
parent | bf6a67ee3427ab142136e03e90d0b67ecbca5ff2 (diff) |
Merge branch 'next-spi' of git://git.secretlab.ca/git/linux-2.6
* 'next-spi' of git://git.secretlab.ca/git/linux-2.6:
spi/xilinx: Fix compile error
spi/davinci: Fix clock prescale factor computation
spi: move bitbang txrx utility functions to private header
spi/mpc5121: Add SPI master driver for MPC5121 PSC
powerpc/mpc5121: move PSC FIFO memory init to platform code
spi/ep93xx: implemented driver for Cirrus EP93xx SPI controller
Documentation/spi/* compile warning fix
spi/omap2_mcspi: Check params before dereference or use
spi/omap2_mcspi: add turbo mode support
spi/omap2_mcspi: change default DMA_MIN_BYTES value to 160
spi/pl022: fix stop queue procedure
spi/pl022: add support for the PL023 derivate
spi/pl022: fix up differences between ARM and ST versions
spi/spi_mpc8xxx: Do not use map_tx_dma to unmap rx_dma
spi/spi_mpc8xxx: Fix QE mode Litte Endian
spi/spi_mpc8xxx: fix potential memory corruption.
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/spi/ep93xx_spi | 95 | ||||
-rw-r--r-- | Documentation/spi/spidev_fdx.c | 4 |
2 files changed, 97 insertions, 2 deletions
diff --git a/Documentation/spi/ep93xx_spi b/Documentation/spi/ep93xx_spi new file mode 100644 index 000000000000..6325f5b48635 --- /dev/null +++ b/Documentation/spi/ep93xx_spi | |||
@@ -0,0 +1,95 @@ | |||
1 | Cirrus EP93xx SPI controller driver HOWTO | ||
2 | ========================================= | ||
3 | |||
4 | ep93xx_spi driver brings SPI master support for EP93xx SPI controller. Chip | ||
5 | selects are implemented with GPIO lines. | ||
6 | |||
7 | NOTE: If possible, don't use SFRMOUT (SFRM1) signal as a chip select. It will | ||
8 | not work correctly (it cannot be controlled by software). Use GPIO lines | ||
9 | instead. | ||
10 | |||
11 | Sample configuration | ||
12 | ==================== | ||
13 | |||
14 | Typically driver configuration is done in platform board files (the files under | ||
15 | arch/arm/mach-ep93xx/*.c). In this example we configure MMC over SPI through | ||
16 | this driver on TS-7260 board. You can adapt the code to suit your needs. | ||
17 | |||
18 | This example uses EGPIO9 as SD/MMC card chip select (this is wired in DIO1 | ||
19 | header on the board). | ||
20 | |||
21 | You need to select CONFIG_MMC_SPI to use mmc_spi driver. | ||
22 | |||
23 | arch/arm/mach-ep93xx/ts72xx.c: | ||
24 | |||
25 | ... | ||
26 | #include <linux/gpio.h> | ||
27 | #include <linux/spi/spi.h> | ||
28 | |||
29 | #include <mach/ep93xx_spi.h> | ||
30 | |||
31 | /* this is our GPIO line used for chip select */ | ||
32 | #define MMC_CHIP_SELECT_GPIO EP93XX_GPIO_LINE_EGPIO9 | ||
33 | |||
34 | static int ts72xx_mmc_spi_setup(struct spi_device *spi) | ||
35 | { | ||
36 | int err; | ||
37 | |||
38 | err = gpio_request(MMC_CHIP_SELECT_GPIO, spi->modalias); | ||
39 | if (err) | ||
40 | return err; | ||
41 | |||
42 | gpio_direction_output(MMC_CHIP_SELECT_GPIO, 1); | ||
43 | |||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | static void ts72xx_mmc_spi_cleanup(struct spi_device *spi) | ||
48 | { | ||
49 | gpio_set_value(MMC_CHIP_SELECT_GPIO, 1); | ||
50 | gpio_direction_input(MMC_CHIP_SELECT_GPIO); | ||
51 | gpio_free(MMC_CHIP_SELECT_GPIO); | ||
52 | } | ||
53 | |||
54 | static void ts72xx_mmc_spi_cs_control(struct spi_device *spi, int value) | ||
55 | { | ||
56 | gpio_set_value(MMC_CHIP_SELECT_GPIO, value); | ||
57 | } | ||
58 | |||
59 | static struct ep93xx_spi_chip_ops ts72xx_mmc_spi_ops = { | ||
60 | .setup = ts72xx_mmc_spi_setup, | ||
61 | .cleanup = ts72xx_mmc_spi_cleanup, | ||
62 | .cs_control = ts72xx_mmc_spi_cs_control, | ||
63 | }; | ||
64 | |||
65 | static struct spi_board_info ts72xx_spi_devices[] __initdata = { | ||
66 | { | ||
67 | .modalias = "mmc_spi", | ||
68 | .controller_data = &ts72xx_mmc_spi_ops, | ||
69 | /* | ||
70 | * We use 10 MHz even though the maximum is 7.4 MHz. The driver | ||
71 | * will limit it automatically to max. frequency. | ||
72 | */ | ||
73 | .max_speed_hz = 10 * 1000 * 1000, | ||
74 | .bus_num = 0, | ||
75 | .chip_select = 0, | ||
76 | .mode = SPI_MODE_0, | ||
77 | }, | ||
78 | }; | ||
79 | |||
80 | static struct ep93xx_spi_info ts72xx_spi_info = { | ||
81 | .num_chipselect = ARRAY_SIZE(ts72xx_spi_devices), | ||
82 | }; | ||
83 | |||
84 | static void __init ts72xx_init_machine(void) | ||
85 | { | ||
86 | ... | ||
87 | ep93xx_register_spi(&ts72xx_spi_info, ts72xx_spi_devices, | ||
88 | ARRAY_SIZE(ts72xx_spi_devices)); | ||
89 | } | ||
90 | |||
91 | Thanks to | ||
92 | ========= | ||
93 | Martin Guy, H. Hartley Sweeten and others who helped me during development of | ||
94 | the driver. Simplemachines.it donated me a Sim.One board which I used testing | ||
95 | the driver on EP9307. | ||
diff --git a/Documentation/spi/spidev_fdx.c b/Documentation/spi/spidev_fdx.c index fc354f760384..36ec0774ca0b 100644 --- a/Documentation/spi/spidev_fdx.c +++ b/Documentation/spi/spidev_fdx.c | |||
@@ -58,10 +58,10 @@ static void do_msg(int fd, int len) | |||
58 | len = sizeof buf; | 58 | len = sizeof buf; |
59 | 59 | ||
60 | buf[0] = 0xaa; | 60 | buf[0] = 0xaa; |
61 | xfer[0].tx_buf = (__u64) buf; | 61 | xfer[0].tx_buf = (unsigned long)buf; |
62 | xfer[0].len = 1; | 62 | xfer[0].len = 1; |
63 | 63 | ||
64 | xfer[1].rx_buf = (__u64) buf; | 64 | xfer[1].rx_buf = (unsigned long) buf; |
65 | xfer[1].len = len; | 65 | xfer[1].len = len; |
66 | 66 | ||
67 | status = ioctl(fd, SPI_IOC_MESSAGE(2), xfer); | 67 | status = ioctl(fd, SPI_IOC_MESSAGE(2), xfer); |