* adds spi driver, thx daniel
[openwrt/staging/wigyori.git] / target / linux / lantiq / patches / 942-spi3.patch
1 From: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
2 Date: Thu, 3 Mar 2011 20:42:26 +0000 (+0100)
3 Subject: MIPS: lantiq: Add device register helper for SPI controller and devices
4 X-Git-Url: http://nbd.name/gitweb.cgi?p=lantiq.git;a=commitdiff_plain;h=b35b07062b718ece9b9cb7b23b12d83a087eafb0;hp=653c95b8b9066c9c6ac08bd64d0ceee439e9fd90
5
6 MIPS: lantiq: Add device register helper for SPI controller and devices
7
8 Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@googlemail.com>
9 ---
10
11 --- a/arch/mips/lantiq/xway/devices.c
12 +++ b/arch/mips/lantiq/xway/devices.c
13 @@ -22,6 +22,7 @@
14 #include <linux/gpio.h>
15 #include <linux/gpio_buttons.h>
16 #include <linux/leds.h>
17 +#include <linux/spi/spi.h>
18
19 #include <asm/bootinfo.h>
20 #include <asm/irq.h>
21 @@ -332,5 +333,27 @@
22 lantiq_emulate_madwifi_eep = 1;
23 }
24
25 +static struct resource lq_spi_resources[] = {
26 + {
27 + .start = LQ_SSC_BASE_ADDR,
28 + .end = LQ_SSC_BASE_ADDR + LQ_SSC_SIZE - 1,
29 + .flags = IORESOURCE_MEM,
30 + },
31 + IRQ_RES(spi_tx, LQ_SSC_TIR),
32 + IRQ_RES(spi_rx, LQ_SSC_RIR),
33 + IRQ_RES(spi_err, LQ_SSC_EIR),
34 +};
35
36 +static struct platform_device lq_spi = {
37 + .name = "ltq-spi",
38 + .resource = lq_spi_resources,
39 + .num_resources = ARRAY_SIZE(lq_spi_resources),
40 +};
41
42 +void __init lq_register_spi(struct lq_spi_platform_data *pdata,
43 + struct spi_board_info const *info, unsigned n)
44 +{
45 + spi_register_board_info(info, n);
46 + lq_spi.dev.platform_data = pdata;
47 + platform_device_register(&lq_spi);
48 +}
49 --- a/arch/mips/lantiq/xway/devices.h
50 +++ b/arch/mips/lantiq/xway/devices.h
51 @@ -11,6 +11,7 @@
52
53 #include <lantiq_platform.h>
54 #include <xway_irq.h>
55 +#include <linux/spi/spi.h>
56
57 extern void __init lq_register_gpio(void);
58 extern void __init lq_register_gpio_stp(void);
59 @@ -25,5 +26,7 @@
60 extern void __init lq_register_asc(int port);
61 extern void __init lq_register_gpio_buttons(struct gpio_button *buttons, int cnt);
62 extern void __init lq_register_crypto(const char *name);
63 +extern void lq_register_spi(struct lq_spi_platform_data *pdata,
64 + struct spi_board_info const *info, unsigned n);
65
66 #endif