diff options
Diffstat (limited to 'drivers/net/wireless/cw1200/cw1200_sagrad.c')
-rw-r--r-- | drivers/net/wireless/cw1200/cw1200_sagrad.c | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/drivers/net/wireless/cw1200/cw1200_sagrad.c b/drivers/net/wireless/cw1200/cw1200_sagrad.c new file mode 100644 index 000000000000..a5ada0eda1dd --- /dev/null +++ b/drivers/net/wireless/cw1200/cw1200_sagrad.c | |||
@@ -0,0 +1,145 @@ | |||
1 | /* | ||
2 | * Platform glue data for ST-Ericsson CW1200 driver | ||
3 | * | ||
4 | * Copyright (c) 2013, Sagrad, Inc | ||
5 | * Author: Solomon Peachy <speachy@sagrad.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/cw1200_platform.h> | ||
14 | |||
15 | MODULE_AUTHOR("Solomon Peachy <speachy@sagrad.com>"); | ||
16 | MODULE_DESCRIPTION("ST-Ericsson CW1200 Platform glue driver"); | ||
17 | MODULE_LICENSE("GPL"); | ||
18 | |||
19 | /* Define just one of these. Feel free to customize as needed */ | ||
20 | #define SAGRAD_1091_1098_EVK_SDIO | ||
21 | /* #define SAGRAD_1091_1098_EVK_SPI */ | ||
22 | |||
23 | #ifdef SAGRAD_1091_1098_EVK_SDIO | ||
24 | #if 0 | ||
25 | static struct resource cw1200_href_resources[] = { | ||
26 | { | ||
27 | .start = 215, /* fix me as appropriate */ | ||
28 | .end = 215, /* ditto */ | ||
29 | .flags = IORESOURCE_IO, | ||
30 | .name = "cw1200_wlan_reset", | ||
31 | }, | ||
32 | { | ||
33 | .start = 216, /* fix me as appropriate */ | ||
34 | .end = 216, /* ditto */ | ||
35 | .flags = IORESOURCE_IO, | ||
36 | .name = "cw1200_wlan_powerup", | ||
37 | }, | ||
38 | { | ||
39 | .start = NOMADIK_GPIO_TO_IRQ(216), /* fix me as appropriate */ | ||
40 | .end = NOMADIK_GPIO_TO_IRQ(216), /* ditto */ | ||
41 | .flags = IORESOURCE_IRQ, | ||
42 | .name = "cw1200_wlan_irq", | ||
43 | }, | ||
44 | }; | ||
45 | #endif | ||
46 | |||
47 | static int cw1200_power_ctrl(const struct cw1200_platform_data_sdio *pdata, | ||
48 | bool enable) | ||
49 | { | ||
50 | /* Control 3v3 and 1v8 to hardware as appropriate */ | ||
51 | /* Note this is not needed if it's controlled elsewhere or always on */ | ||
52 | |||
53 | /* May require delay for power to stabilize */ | ||
54 | return 0; | ||
55 | } | ||
56 | |||
57 | static int cw1200_clk_ctrl(const struct cw1200_platform_data_sdio *pdata, | ||
58 | bool enable) | ||
59 | { | ||
60 | /* Turn CLK_32K off and on as appropriate. */ | ||
61 | /* Note this is not needed if it's always on */ | ||
62 | |||
63 | /* May require delay for clock to stabilize */ | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static struct cw1200_platform_data_sdio cw1200_platform_data = { | ||
68 | .ref_clk = 38400, | ||
69 | .have_5ghz = false, | ||
70 | #if 0 | ||
71 | .reset = &cw1200_href_resources[0], | ||
72 | .powerup = &cw1200_href_resources[1], | ||
73 | .irq = &cw1200_href_resources[2], | ||
74 | #endif | ||
75 | .power_ctrl = cw1200_power_ctrl, | ||
76 | .clk_ctrl = cw1200_clk_ctrl, | ||
77 | /* .macaddr = ??? */ | ||
78 | .sdd_file = "sdd_sagrad_1091_1098.bin", | ||
79 | }; | ||
80 | #endif | ||
81 | |||
82 | #ifdef SAGRAD_1091_1098_EVK_SPI | ||
83 | /* Note that this is an example of integrating into your board support file */ | ||
84 | static struct resource cw1200_href_resources[] = { | ||
85 | { | ||
86 | .start = GPIO_RF_RESET, | ||
87 | .end = GPIO_RF_RESET, | ||
88 | .flags = IORESOURCE_IO, | ||
89 | .name = "cw1200_wlan_reset", | ||
90 | }, | ||
91 | { | ||
92 | .start = GPIO_RF_POWERUP, | ||
93 | .end = GPIO_RF_POWERUP, | ||
94 | .flags = IORESOURCE_IO, | ||
95 | .name = "cw1200_wlan_powerup", | ||
96 | }, | ||
97 | }; | ||
98 | |||
99 | static int cw1200_power_ctrl(const struct cw1200_platform_data_spi *pdata, | ||
100 | bool enable) | ||
101 | { | ||
102 | /* Control 3v3 and 1v8 to hardware as appropriate */ | ||
103 | /* Note this is not needed if it's controlled elsewhere or always on */ | ||
104 | |||
105 | /* May require delay for power to stabilize */ | ||
106 | return 0; | ||
107 | } | ||
108 | static int cw1200_clk_ctrl(const struct cw1200_platform_data_spi *pdata, | ||
109 | bool enable) | ||
110 | { | ||
111 | /* Turn CLK_32K off and on as appropriate. */ | ||
112 | /* Note this is not needed if it's always on */ | ||
113 | |||
114 | /* May require delay for clock to stabilize */ | ||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | static struct cw1200_platform_data_spi cw1200_platform_data = { | ||
119 | .ref_clk = 38400, | ||
120 | .spi_bits_per_word = 16, | ||
121 | .reset = &cw1200_href_resources[0], | ||
122 | .powerup = &cw1200_href_resources[1], | ||
123 | .power_ctrl = cw1200_power_ctrl, | ||
124 | .clk_ctrl = cw1200_clk_ctrl, | ||
125 | /* .macaddr = ??? */ | ||
126 | .sdd_file = "sdd_sagrad_1091_1098.bin", | ||
127 | }; | ||
128 | static struct spi_board_info myboard_spi_devices[] __initdata = { | ||
129 | { | ||
130 | .modalias = "cw1200_wlan_spi", | ||
131 | .max_speed_hz = 10000000, /* 52MHz Max */ | ||
132 | .bus_num = 0, | ||
133 | .irq = WIFI_IRQ, | ||
134 | .platform_data = &cw1200_platform_data, | ||
135 | .chip_select = 0, | ||
136 | }, | ||
137 | }; | ||
138 | #endif | ||
139 | |||
140 | |||
141 | const void *cw1200_get_platform_data(void) | ||
142 | { | ||
143 | return &cw1200_platform_data; | ||
144 | } | ||
145 | EXPORT_SYMBOL_GPL(cw1200_get_platform_data); | ||