diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-21 19:42:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-21 19:42:32 -0400 |
commit | b5153163ed580e00c67bdfecb02b2e3843817b3e (patch) | |
tree | b8c878601f07f5df8f694435857a5f3dcfd75482 /drivers | |
parent | a8cbf22559ceefdcdfac00701e8e6da7518b7e8e (diff) | |
parent | 6451d7783ba5ff24eb1a544eaa6665b890f30466 (diff) |
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (278 commits)
arm: remove machine_desc.io_pg_offst and .phys_io
arm: use addruart macro to establish debug mappings
arm: return both physical and virtual addresses from addruart
arm/debug: consolidate addruart macros for CONFIG_DEBUG_ICEDCC
ARM: make struct machine_desc definition coherent with its comment
eukrea_mbimxsd-baseboard: Pass the correct GPIO to gpio_free
cpuimx27: fix compile when ULPI is selected
mach-pcm037_eet: fix compile errors
Fixing ethernet driver compilation error for i.MX31 ADS board
cpuimx51: update board support
mx5: add cpuimx51sd module and its baseboard
iomux-mx51: fix GPIO_1_xx 's IOMUX configuration
imx-esdhc: update devices registration
mx51: add resources for SD/MMC on i.MX51
iomux-mx51: fix SD1 and SD2's iomux configuration
clock-mx51: rename CLOCK1 to CLOCK_CCGR for better readability
clock-mx51: factorize clk_set_parent and clk_get_rate
eukrea_mbimxsd: add support for DVI displays
cpuimx25 & cpuimx35: fix OTG port registration in host mode
i.MX31 and i.MX35 : fix errate TLSbo65953 and ENGcm09472
...
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/amba/bus.c | 2 | ||||
-rw-r--r-- | drivers/gpio/tc35892-gpio.c | 8 | ||||
-rw-r--r-- | drivers/input/keyboard/Kconfig | 2 | ||||
-rw-r--r-- | drivers/input/keyboard/pxa27x_keypad.c | 12 | ||||
-rw-r--r-- | drivers/leds/Kconfig | 11 | ||||
-rw-r--r-- | drivers/leds/Makefile | 1 | ||||
-rw-r--r-- | drivers/leds/leds-netxbig.c | 449 | ||||
-rw-r--r-- | drivers/leds/leds-ns2.c | 9 | ||||
-rw-r--r-- | drivers/mmc/host/mmci.c | 62 | ||||
-rw-r--r-- | drivers/mmc/host/mmci.h | 22 | ||||
-rw-r--r-- | drivers/net/Kconfig | 5 | ||||
-rw-r--r-- | drivers/serial/Kconfig | 7 | ||||
-rw-r--r-- | drivers/serial/samsung.c | 2 | ||||
-rw-r--r-- | drivers/spi/Kconfig | 16 | ||||
-rw-r--r-- | drivers/spi/spi_imx.c | 402 | ||||
-rw-r--r-- | drivers/usb/host/ohci-pxa27x.c | 7 | ||||
-rw-r--r-- | drivers/video/pxa168fb.c | 47 |
17 files changed, 965 insertions, 99 deletions
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index d31590e7011b..2737b9752205 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c | |||
@@ -298,7 +298,7 @@ int amba_device_register(struct amba_device *dev, struct resource *parent) | |||
298 | 298 | ||
299 | amba_put_disable_pclk(dev); | 299 | amba_put_disable_pclk(dev); |
300 | 300 | ||
301 | if (cid == 0xb105f00d) | 301 | if (cid == AMBA_CID) |
302 | dev->periphid = pid; | 302 | dev->periphid = pid; |
303 | 303 | ||
304 | if (!dev->periphid) | 304 | if (!dev->periphid) |
diff --git a/drivers/gpio/tc35892-gpio.c b/drivers/gpio/tc35892-gpio.c index 1be6288780de..7e10c935a047 100644 --- a/drivers/gpio/tc35892-gpio.c +++ b/drivers/gpio/tc35892-gpio.c | |||
@@ -322,6 +322,9 @@ static int __devinit tc35892_gpio_probe(struct platform_device *pdev) | |||
322 | goto out_freeirq; | 322 | goto out_freeirq; |
323 | } | 323 | } |
324 | 324 | ||
325 | if (pdata->setup) | ||
326 | pdata->setup(tc35892, tc35892_gpio->chip.base); | ||
327 | |||
325 | platform_set_drvdata(pdev, tc35892_gpio); | 328 | platform_set_drvdata(pdev, tc35892_gpio); |
326 | 329 | ||
327 | return 0; | 330 | return 0; |
@@ -338,9 +341,14 @@ out_free: | |||
338 | static int __devexit tc35892_gpio_remove(struct platform_device *pdev) | 341 | static int __devexit tc35892_gpio_remove(struct platform_device *pdev) |
339 | { | 342 | { |
340 | struct tc35892_gpio *tc35892_gpio = platform_get_drvdata(pdev); | 343 | struct tc35892_gpio *tc35892_gpio = platform_get_drvdata(pdev); |
344 | struct tc35892 *tc35892 = tc35892_gpio->tc35892; | ||
345 | struct tc35892_gpio_platform_data *pdata = tc35892->pdata->gpio; | ||
341 | int irq = platform_get_irq(pdev, 0); | 346 | int irq = platform_get_irq(pdev, 0); |
342 | int ret; | 347 | int ret; |
343 | 348 | ||
349 | if (pdata->remove) | ||
350 | pdata->remove(tc35892, tc35892_gpio->chip.base); | ||
351 | |||
344 | ret = gpiochip_remove(&tc35892_gpio->chip); | 352 | ret = gpiochip_remove(&tc35892_gpio->chip); |
345 | if (ret < 0) { | 353 | if (ret < 0) { |
346 | dev_err(tc35892_gpio->dev, | 354 | dev_err(tc35892_gpio->dev, |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 9cc488d21490..aa037fec2f86 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -338,7 +338,7 @@ config KEYBOARD_OPENCORES | |||
338 | 338 | ||
339 | config KEYBOARD_PXA27x | 339 | config KEYBOARD_PXA27x |
340 | tristate "PXA27x/PXA3xx keypad support" | 340 | tristate "PXA27x/PXA3xx keypad support" |
341 | depends on PXA27x || PXA3xx | 341 | depends on PXA27x || PXA3xx || ARCH_MMP |
342 | help | 342 | help |
343 | Enable support for PXA27x/PXA3xx keypad controller. | 343 | Enable support for PXA27x/PXA3xx keypad controller. |
344 | 344 | ||
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c index f32404f99189..4b0ec35259a1 100644 --- a/drivers/input/keyboard/pxa27x_keypad.c +++ b/drivers/input/keyboard/pxa27x_keypad.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <asm/mach/map.h> | 32 | #include <asm/mach/map.h> |
33 | 33 | ||
34 | #include <mach/hardware.h> | 34 | #include <mach/hardware.h> |
35 | #include <mach/pxa27x_keypad.h> | 35 | #include <plat/pxa27x_keypad.h> |
36 | /* | 36 | /* |
37 | * Keypad Controller registers | 37 | * Keypad Controller registers |
38 | */ | 38 | */ |
@@ -330,11 +330,21 @@ static void pxa27x_keypad_scan_direct(struct pxa27x_keypad *keypad) | |||
330 | keypad->direct_key_state = new_state; | 330 | keypad->direct_key_state = new_state; |
331 | } | 331 | } |
332 | 332 | ||
333 | static void clear_wakeup_event(struct pxa27x_keypad *keypad) | ||
334 | { | ||
335 | struct pxa27x_keypad_platform_data *pdata = keypad->pdata; | ||
336 | |||
337 | if (pdata->clear_wakeup_event) | ||
338 | (pdata->clear_wakeup_event)(); | ||
339 | } | ||
340 | |||
333 | static irqreturn_t pxa27x_keypad_irq_handler(int irq, void *dev_id) | 341 | static irqreturn_t pxa27x_keypad_irq_handler(int irq, void *dev_id) |
334 | { | 342 | { |
335 | struct pxa27x_keypad *keypad = dev_id; | 343 | struct pxa27x_keypad *keypad = dev_id; |
336 | unsigned long kpc = keypad_readl(KPC); | 344 | unsigned long kpc = keypad_readl(KPC); |
337 | 345 | ||
346 | clear_wakeup_event(keypad); | ||
347 | |||
338 | if (kpc & KPC_DI) | 348 | if (kpc & KPC_DI) |
339 | pxa27x_keypad_scan_direct(keypad); | 349 | pxa27x_keypad_scan_direct(keypad); |
340 | 350 | ||
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index e4112622e5a2..cc2a88d5192f 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -304,13 +304,22 @@ config LEDS_MC13783 | |||
304 | 304 | ||
305 | config LEDS_NS2 | 305 | config LEDS_NS2 |
306 | tristate "LED support for Network Space v2 GPIO LEDs" | 306 | tristate "LED support for Network Space v2 GPIO LEDs" |
307 | depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || MACH_NETSPACE_MAX_V2 | 307 | depends on MACH_NETSPACE_V2 || MACH_INETSPACE_V2 || MACH_NETSPACE_MAX_V2 || D2NET_V2 |
308 | default y | 308 | default y |
309 | help | 309 | help |
310 | This option enable support for the dual-GPIO LED found on the | 310 | This option enable support for the dual-GPIO LED found on the |
311 | Network Space v2 board (and parents). This include Internet Space v2, | 311 | Network Space v2 board (and parents). This include Internet Space v2, |
312 | Network Space (Max) v2 and d2 Network v2 boards. | 312 | Network Space (Max) v2 and d2 Network v2 boards. |
313 | 313 | ||
314 | config LEDS_NETXBIG | ||
315 | tristate "LED support for Big Network series LEDs" | ||
316 | depends on MACH_NET2BIG_V2 || MACH_NET5BIG_V2 | ||
317 | default y | ||
318 | help | ||
319 | This option enable support for LEDs found on the LaCie 2Big | ||
320 | and 5Big Network v2 boards. The LEDs are wired to a CPLD and are | ||
321 | controlled through a GPIO extension bus. | ||
322 | |||
314 | config LEDS_TRIGGERS | 323 | config LEDS_TRIGGERS |
315 | bool "LED Trigger support" | 324 | bool "LED Trigger support" |
316 | help | 325 | help |
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index 7d6b95831f8e..9c96db40ef6d 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile | |||
@@ -38,6 +38,7 @@ obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o | |||
38 | obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell-led.o | 38 | obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell-led.o |
39 | obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o | 39 | obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o |
40 | obj-$(CONFIG_LEDS_NS2) += leds-ns2.o | 40 | obj-$(CONFIG_LEDS_NS2) += leds-ns2.o |
41 | obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o | ||
41 | 42 | ||
42 | # LED SPI Drivers | 43 | # LED SPI Drivers |
43 | obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o | 44 | obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o |
diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c new file mode 100644 index 000000000000..f2e51c134399 --- /dev/null +++ b/drivers/leds/leds-netxbig.c | |||
@@ -0,0 +1,449 @@ | |||
1 | /* | ||
2 | * leds-netxbig.c - Driver for the 2Big and 5Big Network series LEDs | ||
3 | * | ||
4 | * Copyright (C) 2010 LaCie | ||
5 | * | ||
6 | * Author: Simon Guinot <sguinot@lacie.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/module.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/irq.h> | ||
26 | #include <linux/slab.h> | ||
27 | #include <linux/spinlock.h> | ||
28 | #include <linux/platform_device.h> | ||
29 | #include <linux/gpio.h> | ||
30 | #include <linux/leds.h> | ||
31 | #include <mach/leds-netxbig.h> | ||
32 | |||
33 | /* | ||
34 | * GPIO extension bus. | ||
35 | */ | ||
36 | |||
37 | static DEFINE_SPINLOCK(gpio_ext_lock); | ||
38 | |||
39 | static void gpio_ext_set_addr(struct netxbig_gpio_ext *gpio_ext, int addr) | ||
40 | { | ||
41 | int pin; | ||
42 | |||
43 | for (pin = 0; pin < gpio_ext->num_addr; pin++) | ||
44 | gpio_set_value(gpio_ext->addr[pin], (addr >> pin) & 1); | ||
45 | } | ||
46 | |||
47 | static void gpio_ext_set_data(struct netxbig_gpio_ext *gpio_ext, int data) | ||
48 | { | ||
49 | int pin; | ||
50 | |||
51 | for (pin = 0; pin < gpio_ext->num_data; pin++) | ||
52 | gpio_set_value(gpio_ext->data[pin], (data >> pin) & 1); | ||
53 | } | ||
54 | |||
55 | static void gpio_ext_enable_select(struct netxbig_gpio_ext *gpio_ext) | ||
56 | { | ||
57 | /* Enable select is done on the raising edge. */ | ||
58 | gpio_set_value(gpio_ext->enable, 0); | ||
59 | gpio_set_value(gpio_ext->enable, 1); | ||
60 | } | ||
61 | |||
62 | static void gpio_ext_set_value(struct netxbig_gpio_ext *gpio_ext, | ||
63 | int addr, int value) | ||
64 | { | ||
65 | unsigned long flags; | ||
66 | |||
67 | spin_lock_irqsave(&gpio_ext_lock, flags); | ||
68 | gpio_ext_set_addr(gpio_ext, addr); | ||
69 | gpio_ext_set_data(gpio_ext, value); | ||
70 | gpio_ext_enable_select(gpio_ext); | ||
71 | spin_unlock_irqrestore(&gpio_ext_lock, flags); | ||
72 | } | ||
73 | |||
74 | static int __devinit gpio_ext_init(struct netxbig_gpio_ext *gpio_ext) | ||
75 | { | ||
76 | int err; | ||
77 | int i; | ||
78 | |||
79 | if (unlikely(!gpio_ext)) | ||
80 | return -EINVAL; | ||
81 | |||
82 | /* Configure address GPIOs. */ | ||
83 | for (i = 0; i < gpio_ext->num_addr; i++) { | ||
84 | err = gpio_request(gpio_ext->addr[i], "GPIO extension addr"); | ||
85 | if (err) | ||
86 | goto err_free_addr; | ||
87 | err = gpio_direction_output(gpio_ext->addr[i], 0); | ||
88 | if (err) { | ||
89 | gpio_free(gpio_ext->addr[i]); | ||
90 | goto err_free_addr; | ||
91 | } | ||
92 | } | ||
93 | /* Configure data GPIOs. */ | ||
94 | for (i = 0; i < gpio_ext->num_data; i++) { | ||
95 | err = gpio_request(gpio_ext->data[i], "GPIO extension data"); | ||
96 | if (err) | ||
97 | goto err_free_data; | ||
98 | err = gpio_direction_output(gpio_ext->data[i], 0); | ||
99 | if (err) { | ||
100 | gpio_free(gpio_ext->data[i]); | ||
101 | goto err_free_data; | ||
102 | } | ||
103 | } | ||
104 | /* Configure "enable select" GPIO. */ | ||
105 | err = gpio_request(gpio_ext->enable, "GPIO extension enable"); | ||
106 | if (err) | ||
107 | goto err_free_data; | ||
108 | err = gpio_direction_output(gpio_ext->enable, 0); | ||
109 | if (err) { | ||
110 | gpio_free(gpio_ext->enable); | ||
111 | goto err_free_data; | ||
112 | } | ||
113 | |||
114 | return 0; | ||
115 | |||
116 | err_free_data: | ||
117 | for (i = i - 1; i >= 0; i--) | ||
118 | gpio_free(gpio_ext->data[i]); | ||
119 | i = gpio_ext->num_addr; | ||
120 | err_free_addr: | ||
121 | for (i = i - 1; i >= 0; i--) | ||
122 | gpio_free(gpio_ext->addr[i]); | ||
123 | |||
124 | return err; | ||
125 | } | ||
126 | |||
127 | static void __devexit gpio_ext_free(struct netxbig_gpio_ext *gpio_ext) | ||
128 | { | ||
129 | int i; | ||
130 | |||
131 | gpio_free(gpio_ext->enable); | ||
132 | for (i = gpio_ext->num_addr - 1; i >= 0; i--) | ||
133 | gpio_free(gpio_ext->addr[i]); | ||
134 | for (i = gpio_ext->num_data - 1; i >= 0; i--) | ||
135 | gpio_free(gpio_ext->data[i]); | ||
136 | } | ||
137 | |||
138 | /* | ||
139 | * Class LED driver. | ||
140 | */ | ||
141 | |||
142 | struct netxbig_led_data { | ||
143 | struct netxbig_gpio_ext *gpio_ext; | ||
144 | struct led_classdev cdev; | ||
145 | int mode_addr; | ||
146 | int *mode_val; | ||
147 | int bright_addr; | ||
148 | int bright_max; | ||
149 | struct netxbig_led_timer *timer; | ||
150 | int num_timer; | ||
151 | enum netxbig_led_mode mode; | ||
152 | int sata; | ||
153 | spinlock_t lock; | ||
154 | }; | ||
155 | |||
156 | static int netxbig_led_get_timer_mode(enum netxbig_led_mode *mode, | ||
157 | unsigned long delay_on, | ||
158 | unsigned long delay_off, | ||
159 | struct netxbig_led_timer *timer, | ||
160 | int num_timer) | ||
161 | { | ||
162 | int i; | ||
163 | |||
164 | for (i = 0; i < num_timer; i++) { | ||
165 | if (timer[i].delay_on == delay_on && | ||
166 | timer[i].delay_off == delay_off) { | ||
167 | *mode = timer[i].mode; | ||
168 | return 0; | ||
169 | } | ||
170 | } | ||
171 | return -EINVAL; | ||
172 | } | ||
173 | |||
174 | static int netxbig_led_blink_set(struct led_classdev *led_cdev, | ||
175 | unsigned long *delay_on, | ||
176 | unsigned long *delay_off) | ||
177 | { | ||
178 | struct netxbig_led_data *led_dat = | ||
179 | container_of(led_cdev, struct netxbig_led_data, cdev); | ||
180 | enum netxbig_led_mode mode; | ||
181 | int mode_val; | ||
182 | int ret; | ||
183 | |||
184 | /* Look for a LED mode with the requested timer frequency. */ | ||
185 | ret = netxbig_led_get_timer_mode(&mode, *delay_on, *delay_off, | ||
186 | led_dat->timer, led_dat->num_timer); | ||
187 | if (ret < 0) | ||
188 | return ret; | ||
189 | |||
190 | mode_val = led_dat->mode_val[mode]; | ||
191 | if (mode_val == NETXBIG_LED_INVALID_MODE) | ||
192 | return -EINVAL; | ||
193 | |||
194 | spin_lock_irq(&led_dat->lock); | ||
195 | |||
196 | gpio_ext_set_value(led_dat->gpio_ext, led_dat->mode_addr, mode_val); | ||
197 | led_dat->mode = mode; | ||
198 | |||
199 | spin_unlock_irq(&led_dat->lock); | ||
200 | |||
201 | return 0; | ||
202 | } | ||
203 | |||
204 | static void netxbig_led_set(struct led_classdev *led_cdev, | ||
205 | enum led_brightness value) | ||
206 | { | ||
207 | struct netxbig_led_data *led_dat = | ||
208 | container_of(led_cdev, struct netxbig_led_data, cdev); | ||
209 | enum netxbig_led_mode mode; | ||
210 | int mode_val, bright_val; | ||
211 | int set_brightness = 1; | ||
212 | unsigned long flags; | ||
213 | |||
214 | spin_lock_irqsave(&led_dat->lock, flags); | ||
215 | |||
216 | if (value == LED_OFF) { | ||
217 | mode = NETXBIG_LED_OFF; | ||
218 | set_brightness = 0; | ||
219 | } else { | ||
220 | if (led_dat->sata) | ||
221 | mode = NETXBIG_LED_SATA; | ||
222 | else if (led_dat->mode == NETXBIG_LED_OFF) | ||
223 | mode = NETXBIG_LED_ON; | ||
224 | else /* Keep 'timer' mode. */ | ||
225 | mode = led_dat->mode; | ||
226 | } | ||
227 | mode_val = led_dat->mode_val[mode]; | ||
228 | |||
229 | gpio_ext_set_value(led_dat->gpio_ext, led_dat->mode_addr, mode_val); | ||
230 | led_dat->mode = mode; | ||
231 | /* | ||
232 | * Note that the brightness register is shared between all the | ||
233 | * SATA LEDs. So, change the brightness setting for a single | ||
234 | * SATA LED will affect all the others. | ||
235 | */ | ||
236 | if (set_brightness) { | ||
237 | bright_val = DIV_ROUND_UP(value * led_dat->bright_max, | ||
238 | LED_FULL); | ||
239 | gpio_ext_set_value(led_dat->gpio_ext, | ||
240 | led_dat->bright_addr, bright_val); | ||
241 | } | ||
242 | |||
243 | spin_unlock_irqrestore(&led_dat->lock, flags); | ||
244 | } | ||
245 | |||
246 | static ssize_t netxbig_led_sata_store(struct device *dev, | ||
247 | struct device_attribute *attr, | ||
248 | const char *buff, size_t count) | ||
249 | { | ||
250 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | ||
251 | struct netxbig_led_data *led_dat = | ||
252 | container_of(led_cdev, struct netxbig_led_data, cdev); | ||
253 | unsigned long enable; | ||
254 | enum netxbig_led_mode mode; | ||
255 | int mode_val; | ||
256 | int ret; | ||
257 | |||
258 | ret = strict_strtoul(buff, 10, &enable); | ||
259 | if (ret < 0) | ||
260 | return ret; | ||
261 | |||
262 | enable = !!enable; | ||
263 | |||
264 | spin_lock_irq(&led_dat->lock); | ||
265 | |||
266 | if (led_dat->sata == enable) { | ||
267 | ret = count; | ||
268 | goto exit_unlock; | ||
269 | } | ||
270 | |||
271 | if (led_dat->mode != NETXBIG_LED_ON && | ||
272 | led_dat->mode != NETXBIG_LED_SATA) | ||
273 | mode = led_dat->mode; /* Keep modes 'off' and 'timer'. */ | ||
274 | else if (enable) | ||
275 | mode = NETXBIG_LED_SATA; | ||
276 | else | ||
277 | mode = NETXBIG_LED_ON; | ||
278 | |||
279 | mode_val = led_dat->mode_val[mode]; | ||
280 | if (mode_val == NETXBIG_LED_INVALID_MODE) { | ||
281 | ret = -EINVAL; | ||
282 | goto exit_unlock; | ||
283 | } | ||
284 | |||
285 | gpio_ext_set_value(led_dat->gpio_ext, led_dat->mode_addr, mode_val); | ||
286 | led_dat->mode = mode; | ||
287 | led_dat->sata = enable; | ||
288 | |||
289 | ret = count; | ||
290 | |||
291 | exit_unlock: | ||
292 | spin_unlock_irq(&led_dat->lock); | ||
293 | |||
294 | return ret; | ||
295 | } | ||
296 | |||
297 | static ssize_t netxbig_led_sata_show(struct device *dev, | ||
298 | struct device_attribute *attr, char *buf) | ||
299 | { | ||
300 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | ||
301 | struct netxbig_led_data *led_dat = | ||
302 | container_of(led_cdev, struct netxbig_led_data, cdev); | ||
303 | |||
304 | return sprintf(buf, "%d\n", led_dat->sata); | ||
305 | } | ||
306 | |||
307 | static DEVICE_ATTR(sata, 0644, netxbig_led_sata_show, netxbig_led_sata_store); | ||
308 | |||
309 | static void __devexit delete_netxbig_led(struct netxbig_led_data *led_dat) | ||
310 | { | ||
311 | if (led_dat->mode_val[NETXBIG_LED_SATA] != NETXBIG_LED_INVALID_MODE) | ||
312 | device_remove_file(led_dat->cdev.dev, &dev_attr_sata); | ||
313 | led_classdev_unregister(&led_dat->cdev); | ||
314 | } | ||
315 | |||
316 | static int __devinit | ||
317 | create_netxbig_led(struct platform_device *pdev, | ||
318 | struct netxbig_led_data *led_dat, | ||
319 | const struct netxbig_led *template) | ||
320 | { | ||
321 | struct netxbig_led_platform_data *pdata = pdev->dev.platform_data; | ||
322 | int ret; | ||
323 | |||
324 | spin_lock_init(&led_dat->lock); | ||
325 | led_dat->gpio_ext = pdata->gpio_ext; | ||
326 | led_dat->cdev.name = template->name; | ||
327 | led_dat->cdev.default_trigger = template->default_trigger; | ||
328 | led_dat->cdev.blink_set = netxbig_led_blink_set; | ||
329 | led_dat->cdev.brightness_set = netxbig_led_set; | ||
330 | /* | ||
331 | * Because the GPIO extension bus don't allow to read registers | ||
332 | * value, there is no way to probe the LED initial state. | ||
333 | * So, the initial sysfs LED value for the "brightness" and "sata" | ||
334 | * attributes are inconsistent. | ||
335 | * | ||
336 | * Note that the initial LED state can't be reconfigured. | ||
337 | * The reason is that the LED behaviour must stay uniform during | ||
338 | * the whole boot process (bootloader+linux). | ||
339 | */ | ||
340 | led_dat->sata = 0; | ||
341 | led_dat->cdev.brightness = LED_OFF; | ||
342 | led_dat->cdev.flags |= LED_CORE_SUSPENDRESUME; | ||
343 | led_dat->mode_addr = template->mode_addr; | ||
344 | led_dat->mode_val = template->mode_val; | ||
345 | led_dat->bright_addr = template->bright_addr; | ||
346 | led_dat->bright_max = (1 << pdata->gpio_ext->num_data) - 1; | ||
347 | led_dat->timer = pdata->timer; | ||
348 | led_dat->num_timer = pdata->num_timer; | ||
349 | |||
350 | ret = led_classdev_register(&pdev->dev, &led_dat->cdev); | ||
351 | if (ret < 0) | ||
352 | return ret; | ||
353 | |||
354 | /* | ||
355 | * If available, expose the SATA activity blink capability through | ||
356 | * a "sata" sysfs attribute. | ||
357 | */ | ||
358 | if (led_dat->mode_val[NETXBIG_LED_SATA] != NETXBIG_LED_INVALID_MODE) { | ||
359 | ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata); | ||
360 | if (ret) | ||
361 | led_classdev_unregister(&led_dat->cdev); | ||
362 | } | ||
363 | |||
364 | return ret; | ||
365 | } | ||
366 | |||
367 | static int __devinit netxbig_led_probe(struct platform_device *pdev) | ||
368 | { | ||
369 | struct netxbig_led_platform_data *pdata = pdev->dev.platform_data; | ||
370 | struct netxbig_led_data *leds_data; | ||
371 | int i; | ||
372 | int ret; | ||
373 | |||
374 | if (!pdata) | ||
375 | return -EINVAL; | ||
376 | |||
377 | leds_data = kzalloc(sizeof(struct netxbig_led_data) * pdata->num_leds, | ||
378 | GFP_KERNEL); | ||
379 | if (!leds_data) | ||
380 | return -ENOMEM; | ||
381 | |||
382 | ret = gpio_ext_init(pdata->gpio_ext); | ||
383 | if (ret < 0) | ||
384 | goto err_free_data; | ||
385 | |||
386 | for (i = 0; i < pdata->num_leds; i++) { | ||
387 | ret = create_netxbig_led(pdev, &leds_data[i], &pdata->leds[i]); | ||
388 | if (ret < 0) | ||
389 | goto err_free_leds; | ||
390 | } | ||
391 | |||
392 | platform_set_drvdata(pdev, leds_data); | ||
393 | |||
394 | return 0; | ||
395 | |||
396 | err_free_leds: | ||
397 | for (i = i - 1; i >= 0; i--) | ||
398 | delete_netxbig_led(&leds_data[i]); | ||
399 | |||
400 | gpio_ext_free(pdata->gpio_ext); | ||
401 | err_free_data: | ||
402 | kfree(leds_data); | ||
403 | |||
404 | return ret; | ||
405 | } | ||
406 | |||
407 | static int __devexit netxbig_led_remove(struct platform_device *pdev) | ||
408 | { | ||
409 | struct netxbig_led_platform_data *pdata = pdev->dev.platform_data; | ||
410 | struct netxbig_led_data *leds_data; | ||
411 | int i; | ||
412 | |||
413 | leds_data = platform_get_drvdata(pdev); | ||
414 | |||
415 | for (i = 0; i < pdata->num_leds; i++) | ||
416 | delete_netxbig_led(&leds_data[i]); | ||
417 | |||
418 | gpio_ext_free(pdata->gpio_ext); | ||
419 | kfree(leds_data); | ||
420 | |||
421 | return 0; | ||
422 | } | ||
423 | |||
424 | static struct platform_driver netxbig_led_driver = { | ||
425 | .probe = netxbig_led_probe, | ||
426 | .remove = __devexit_p(netxbig_led_remove), | ||
427 | .driver = { | ||
428 | .name = "leds-netxbig", | ||
429 | .owner = THIS_MODULE, | ||
430 | }, | ||
431 | }; | ||
432 | MODULE_ALIAS("platform:leds-netxbig"); | ||
433 | |||
434 | static int __init netxbig_led_init(void) | ||
435 | { | ||
436 | return platform_driver_register(&netxbig_led_driver); | ||
437 | } | ||
438 | |||
439 | static void __exit netxbig_led_exit(void) | ||
440 | { | ||
441 | platform_driver_unregister(&netxbig_led_driver); | ||
442 | } | ||
443 | |||
444 | module_init(netxbig_led_init); | ||
445 | module_exit(netxbig_led_exit); | ||
446 | |||
447 | MODULE_AUTHOR("Simon Guinot <sguinot@lacie.com>"); | ||
448 | MODULE_DESCRIPTION("LED driver for LaCie xBig Network boards"); | ||
449 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/leds/leds-ns2.c b/drivers/leds/leds-ns2.c index 350eb34f049c..f77d48d0b3e4 100644 --- a/drivers/leds/leds-ns2.c +++ b/drivers/leds/leds-ns2.c | |||
@@ -141,10 +141,12 @@ static ssize_t ns2_led_sata_store(struct device *dev, | |||
141 | struct device_attribute *attr, | 141 | struct device_attribute *attr, |
142 | const char *buff, size_t count) | 142 | const char *buff, size_t count) |
143 | { | 143 | { |
144 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | ||
145 | struct ns2_led_data *led_dat = | ||
146 | container_of(led_cdev, struct ns2_led_data, cdev); | ||
144 | int ret; | 147 | int ret; |
145 | unsigned long enable; | 148 | unsigned long enable; |
146 | enum ns2_led_modes mode; | 149 | enum ns2_led_modes mode; |
147 | struct ns2_led_data *led_dat = dev_get_drvdata(dev); | ||
148 | 150 | ||
149 | ret = strict_strtoul(buff, 10, &enable); | 151 | ret = strict_strtoul(buff, 10, &enable); |
150 | if (ret < 0) | 152 | if (ret < 0) |
@@ -172,7 +174,9 @@ static ssize_t ns2_led_sata_store(struct device *dev, | |||
172 | static ssize_t ns2_led_sata_show(struct device *dev, | 174 | static ssize_t ns2_led_sata_show(struct device *dev, |
173 | struct device_attribute *attr, char *buf) | 175 | struct device_attribute *attr, char *buf) |
174 | { | 176 | { |
175 | struct ns2_led_data *led_dat = dev_get_drvdata(dev); | 177 | struct led_classdev *led_cdev = dev_get_drvdata(dev); |
178 | struct ns2_led_data *led_dat = | ||
179 | container_of(led_cdev, struct ns2_led_data, cdev); | ||
176 | 180 | ||
177 | return sprintf(buf, "%d\n", led_dat->sata); | 181 | return sprintf(buf, "%d\n", led_dat->sata); |
178 | } | 182 | } |
@@ -234,7 +238,6 @@ create_ns2_led(struct platform_device *pdev, struct ns2_led_data *led_dat, | |||
234 | if (ret < 0) | 238 | if (ret < 0) |
235 | goto err_free_slow; | 239 | goto err_free_slow; |
236 | 240 | ||
237 | dev_set_drvdata(led_dat->cdev.dev, led_dat); | ||
238 | ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata); | 241 | ret = device_create_file(led_dat->cdev.dev, &dev_attr_sata); |
239 | if (ret < 0) | 242 | if (ret < 0) |
240 | goto err_free_cdev; | 243 | goto err_free_cdev; |
diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 840b301b5671..f2e02d7d9f3d 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c | |||
@@ -41,23 +41,35 @@ static unsigned int fmax = 515633; | |||
41 | * @clkreg: default value for MCICLOCK register | 41 | * @clkreg: default value for MCICLOCK register |
42 | * @clkreg_enable: enable value for MMCICLOCK register | 42 | * @clkreg_enable: enable value for MMCICLOCK register |
43 | * @datalength_bits: number of bits in the MMCIDATALENGTH register | 43 | * @datalength_bits: number of bits in the MMCIDATALENGTH register |
44 | * @fifosize: number of bytes that can be written when MMCI_TXFIFOEMPTY | ||
45 | * is asserted (likewise for RX) | ||
46 | * @fifohalfsize: number of bytes that can be written when MCI_TXFIFOHALFEMPTY | ||
47 | * is asserted (likewise for RX) | ||
44 | */ | 48 | */ |
45 | struct variant_data { | 49 | struct variant_data { |
46 | unsigned int clkreg; | 50 | unsigned int clkreg; |
47 | unsigned int clkreg_enable; | 51 | unsigned int clkreg_enable; |
48 | unsigned int datalength_bits; | 52 | unsigned int datalength_bits; |
53 | unsigned int fifosize; | ||
54 | unsigned int fifohalfsize; | ||
49 | }; | 55 | }; |
50 | 56 | ||
51 | static struct variant_data variant_arm = { | 57 | static struct variant_data variant_arm = { |
58 | .fifosize = 16 * 4, | ||
59 | .fifohalfsize = 8 * 4, | ||
52 | .datalength_bits = 16, | 60 | .datalength_bits = 16, |
53 | }; | 61 | }; |
54 | 62 | ||
55 | static struct variant_data variant_u300 = { | 63 | static struct variant_data variant_u300 = { |
64 | .fifosize = 16 * 4, | ||
65 | .fifohalfsize = 8 * 4, | ||
56 | .clkreg_enable = 1 << 13, /* HWFCEN */ | 66 | .clkreg_enable = 1 << 13, /* HWFCEN */ |
57 | .datalength_bits = 16, | 67 | .datalength_bits = 16, |
58 | }; | 68 | }; |
59 | 69 | ||
60 | static struct variant_data variant_ux500 = { | 70 | static struct variant_data variant_ux500 = { |
71 | .fifosize = 30 * 4, | ||
72 | .fifohalfsize = 8 * 4, | ||
61 | .clkreg = MCI_CLK_ENABLE, | 73 | .clkreg = MCI_CLK_ENABLE, |
62 | .clkreg_enable = 1 << 14, /* HWFCEN */ | 74 | .clkreg_enable = 1 << 14, /* HWFCEN */ |
63 | .datalength_bits = 24, | 75 | .datalength_bits = 24, |
@@ -138,6 +150,7 @@ static void mmci_init_sg(struct mmci_host *host, struct mmc_data *data) | |||
138 | 150 | ||
139 | static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) | 151 | static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) |
140 | { | 152 | { |
153 | struct variant_data *variant = host->variant; | ||
141 | unsigned int datactrl, timeout, irqmask; | 154 | unsigned int datactrl, timeout, irqmask; |
142 | unsigned long long clks; | 155 | unsigned long long clks; |
143 | void __iomem *base; | 156 | void __iomem *base; |
@@ -173,7 +186,7 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) | |||
173 | * If we have less than a FIFOSIZE of bytes to transfer, | 186 | * If we have less than a FIFOSIZE of bytes to transfer, |
174 | * trigger a PIO interrupt as soon as any data is available. | 187 | * trigger a PIO interrupt as soon as any data is available. |
175 | */ | 188 | */ |
176 | if (host->size < MCI_FIFOSIZE) | 189 | if (host->size < variant->fifosize) |
177 | irqmask |= MCI_RXDATAAVLBLMASK; | 190 | irqmask |= MCI_RXDATAAVLBLMASK; |
178 | } else { | 191 | } else { |
179 | /* | 192 | /* |
@@ -332,13 +345,15 @@ static int mmci_pio_read(struct mmci_host *host, char *buffer, unsigned int rema | |||
332 | 345 | ||
333 | static int mmci_pio_write(struct mmci_host *host, char *buffer, unsigned int remain, u32 status) | 346 | static int mmci_pio_write(struct mmci_host *host, char *buffer, unsigned int remain, u32 status) |
334 | { | 347 | { |
348 | struct variant_data *variant = host->variant; | ||
335 | void __iomem *base = host->base; | 349 | void __iomem *base = host->base; |
336 | char *ptr = buffer; | 350 | char *ptr = buffer; |
337 | 351 | ||
338 | do { | 352 | do { |
339 | unsigned int count, maxcnt; | 353 | unsigned int count, maxcnt; |
340 | 354 | ||
341 | maxcnt = status & MCI_TXFIFOEMPTY ? MCI_FIFOSIZE : MCI_FIFOHALFSIZE; | 355 | maxcnt = status & MCI_TXFIFOEMPTY ? |
356 | variant->fifosize : variant->fifohalfsize; | ||
342 | count = min(remain, maxcnt); | 357 | count = min(remain, maxcnt); |
343 | 358 | ||
344 | writesl(base + MMCIFIFO, ptr, count >> 2); | 359 | writesl(base + MMCIFIFO, ptr, count >> 2); |
@@ -362,6 +377,7 @@ static irqreturn_t mmci_pio_irq(int irq, void *dev_id) | |||
362 | { | 377 | { |
363 | struct mmci_host *host = dev_id; | 378 | struct mmci_host *host = dev_id; |
364 | struct sg_mapping_iter *sg_miter = &host->sg_miter; | 379 | struct sg_mapping_iter *sg_miter = &host->sg_miter; |
380 | struct variant_data *variant = host->variant; | ||
365 | void __iomem *base = host->base; | 381 | void __iomem *base = host->base; |
366 | unsigned long flags; | 382 | unsigned long flags; |
367 | u32 status; | 383 | u32 status; |
@@ -420,7 +436,7 @@ static irqreturn_t mmci_pio_irq(int irq, void *dev_id) | |||
420 | * If we're nearing the end of the read, switch to | 436 | * If we're nearing the end of the read, switch to |
421 | * "any data available" mode. | 437 | * "any data available" mode. |
422 | */ | 438 | */ |
423 | if (status & MCI_RXACTIVE && host->size < MCI_FIFOSIZE) | 439 | if (status & MCI_RXACTIVE && host->size < variant->fifosize) |
424 | writel(MCI_RXDATAAVLBLMASK, base + MMCIMASK1); | 440 | writel(MCI_RXDATAAVLBLMASK, base + MMCIMASK1); |
425 | 441 | ||
426 | /* | 442 | /* |
@@ -564,18 +580,23 @@ static int mmci_get_ro(struct mmc_host *mmc) | |||
564 | if (host->gpio_wp == -ENOSYS) | 580 | if (host->gpio_wp == -ENOSYS) |
565 | return -ENOSYS; | 581 | return -ENOSYS; |
566 | 582 | ||
567 | return gpio_get_value(host->gpio_wp); | 583 | return gpio_get_value_cansleep(host->gpio_wp); |
568 | } | 584 | } |
569 | 585 | ||
570 | static int mmci_get_cd(struct mmc_host *mmc) | 586 | static int mmci_get_cd(struct mmc_host *mmc) |
571 | { | 587 | { |
572 | struct mmci_host *host = mmc_priv(mmc); | 588 | struct mmci_host *host = mmc_priv(mmc); |
589 | struct mmci_platform_data *plat = host->plat; | ||
573 | unsigned int status; | 590 | unsigned int status; |
574 | 591 | ||
575 | if (host->gpio_cd == -ENOSYS) | 592 | if (host->gpio_cd == -ENOSYS) { |
576 | status = host->plat->status(mmc_dev(host->mmc)); | 593 | if (!plat->status) |
577 | else | 594 | return 1; /* Assume always present */ |
578 | status = !gpio_get_value(host->gpio_cd); | 595 | |
596 | status = plat->status(mmc_dev(host->mmc)); | ||
597 | } else | ||
598 | status = !!gpio_get_value_cansleep(host->gpio_cd) | ||
599 | ^ plat->cd_invert; | ||
579 | 600 | ||
580 | /* | 601 | /* |
581 | * Use positive logic throughout - status is zero for no card, | 602 | * Use positive logic throughout - status is zero for no card, |
@@ -584,6 +605,15 @@ static int mmci_get_cd(struct mmc_host *mmc) | |||
584 | return status; | 605 | return status; |
585 | } | 606 | } |
586 | 607 | ||
608 | static irqreturn_t mmci_cd_irq(int irq, void *dev_id) | ||
609 | { | ||
610 | struct mmci_host *host = dev_id; | ||
611 | |||
612 | mmc_detect_change(host->mmc, msecs_to_jiffies(500)); | ||
613 | |||
614 | return IRQ_HANDLED; | ||
615 | } | ||
616 | |||
587 | static const struct mmc_host_ops mmci_ops = { | 617 | static const struct mmc_host_ops mmci_ops = { |
588 | .request = mmci_request, | 618 | .request = mmci_request, |
589 | .set_ios = mmci_set_ios, | 619 | .set_ios = mmci_set_ios, |
@@ -620,6 +650,7 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
620 | 650 | ||
621 | host->gpio_wp = -ENOSYS; | 651 | host->gpio_wp = -ENOSYS; |
622 | host->gpio_cd = -ENOSYS; | 652 | host->gpio_cd = -ENOSYS; |
653 | host->gpio_cd_irq = -1; | ||
623 | 654 | ||
624 | host->hw_designer = amba_manf(dev); | 655 | host->hw_designer = amba_manf(dev); |
625 | host->hw_revision = amba_rev(dev); | 656 | host->hw_revision = amba_rev(dev); |
@@ -699,7 +730,6 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
699 | if (host->vcc == NULL) | 730 | if (host->vcc == NULL) |
700 | mmc->ocr_avail = plat->ocr_mask; | 731 | mmc->ocr_avail = plat->ocr_mask; |
701 | mmc->caps = plat->capabilities; | 732 | mmc->caps = plat->capabilities; |
702 | mmc->caps |= MMC_CAP_NEEDS_POLL; | ||
703 | 733 | ||
704 | /* | 734 | /* |
705 | * We can do SGIO | 735 | * We can do SGIO |
@@ -744,6 +774,12 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
744 | host->gpio_cd = plat->gpio_cd; | 774 | host->gpio_cd = plat->gpio_cd; |
745 | else if (ret != -ENOSYS) | 775 | else if (ret != -ENOSYS) |
746 | goto err_gpio_cd; | 776 | goto err_gpio_cd; |
777 | |||
778 | ret = request_any_context_irq(gpio_to_irq(plat->gpio_cd), | ||
779 | mmci_cd_irq, 0, | ||
780 | DRIVER_NAME " (cd)", host); | ||
781 | if (ret >= 0) | ||
782 | host->gpio_cd_irq = gpio_to_irq(plat->gpio_cd); | ||
747 | } | 783 | } |
748 | if (gpio_is_valid(plat->gpio_wp)) { | 784 | if (gpio_is_valid(plat->gpio_wp)) { |
749 | ret = gpio_request(plat->gpio_wp, DRIVER_NAME " (wp)"); | 785 | ret = gpio_request(plat->gpio_wp, DRIVER_NAME " (wp)"); |
@@ -755,6 +791,10 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
755 | goto err_gpio_wp; | 791 | goto err_gpio_wp; |
756 | } | 792 | } |
757 | 793 | ||
794 | if ((host->plat->status || host->gpio_cd != -ENOSYS) | ||
795 | && host->gpio_cd_irq < 0) | ||
796 | mmc->caps |= MMC_CAP_NEEDS_POLL; | ||
797 | |||
758 | ret = request_irq(dev->irq[0], mmci_irq, IRQF_SHARED, DRIVER_NAME " (cmd)", host); | 798 | ret = request_irq(dev->irq[0], mmci_irq, IRQF_SHARED, DRIVER_NAME " (cmd)", host); |
759 | if (ret) | 799 | if (ret) |
760 | goto unmap; | 800 | goto unmap; |
@@ -781,6 +821,8 @@ static int __devinit mmci_probe(struct amba_device *dev, struct amba_id *id) | |||
781 | if (host->gpio_wp != -ENOSYS) | 821 | if (host->gpio_wp != -ENOSYS) |
782 | gpio_free(host->gpio_wp); | 822 | gpio_free(host->gpio_wp); |
783 | err_gpio_wp: | 823 | err_gpio_wp: |
824 | if (host->gpio_cd_irq >= 0) | ||
825 | free_irq(host->gpio_cd_irq, host); | ||
784 | if (host->gpio_cd != -ENOSYS) | 826 | if (host->gpio_cd != -ENOSYS) |
785 | gpio_free(host->gpio_cd); | 827 | gpio_free(host->gpio_cd); |
786 | err_gpio_cd: | 828 | err_gpio_cd: |
@@ -819,6 +861,8 @@ static int __devexit mmci_remove(struct amba_device *dev) | |||
819 | 861 | ||
820 | if (host->gpio_wp != -ENOSYS) | 862 | if (host->gpio_wp != -ENOSYS) |
821 | gpio_free(host->gpio_wp); | 863 | gpio_free(host->gpio_wp); |
864 | if (host->gpio_cd_irq >= 0) | ||
865 | free_irq(host->gpio_cd_irq, host); | ||
822 | if (host->gpio_cd != -ENOSYS) | 866 | if (host->gpio_cd != -ENOSYS) |
823 | gpio_free(host->gpio_cd); | 867 | gpio_free(host->gpio_cd); |
824 | 868 | ||
diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h index 68970cfb81e1..4ae887fc0189 100644 --- a/drivers/mmc/host/mmci.h +++ b/drivers/mmc/host/mmci.h | |||
@@ -54,10 +54,16 @@ | |||
54 | #define MCI_DPSM_MODE (1 << 2) | 54 | #define MCI_DPSM_MODE (1 << 2) |
55 | #define MCI_DPSM_DMAENABLE (1 << 3) | 55 | #define MCI_DPSM_DMAENABLE (1 << 3) |
56 | #define MCI_DPSM_BLOCKSIZE (1 << 4) | 56 | #define MCI_DPSM_BLOCKSIZE (1 << 4) |
57 | #define MCI_DPSM_RWSTART (1 << 8) | 57 | /* Control register extensions in the ST Micro U300 and Ux500 versions */ |
58 | #define MCI_DPSM_RWSTOP (1 << 9) | 58 | #define MCI_ST_DPSM_RWSTART (1 << 8) |
59 | #define MCI_DPSM_RWMOD (1 << 10) | 59 | #define MCI_ST_DPSM_RWSTOP (1 << 9) |
60 | #define MCI_DPSM_SDIOEN (1 << 11) | 60 | #define MCI_ST_DPSM_RWMOD (1 << 10) |
61 | #define MCI_ST_DPSM_SDIOEN (1 << 11) | ||
62 | /* Control register extensions in the ST Micro Ux500 versions */ | ||
63 | #define MCI_ST_DPSM_DMAREQCTL (1 << 12) | ||
64 | #define MCI_ST_DPSM_DBOOTMODEEN (1 << 13) | ||
65 | #define MCI_ST_DPSM_BUSYMODE (1 << 14) | ||
66 | #define MCI_ST_DPSM_DDRMODE (1 << 15) | ||
61 | 67 | ||
62 | #define MMCIDATACNT 0x030 | 68 | #define MMCIDATACNT 0x030 |
63 | #define MMCISTATUS 0x034 | 69 | #define MMCISTATUS 0x034 |
@@ -133,13 +139,6 @@ | |||
133 | MCI_DATATIMEOUTMASK|MCI_TXUNDERRUNMASK|MCI_RXOVERRUNMASK| \ | 139 | MCI_DATATIMEOUTMASK|MCI_TXUNDERRUNMASK|MCI_RXOVERRUNMASK| \ |
134 | MCI_CMDRESPENDMASK|MCI_CMDSENTMASK|MCI_DATABLOCKENDMASK) | 140 | MCI_CMDRESPENDMASK|MCI_CMDSENTMASK|MCI_DATABLOCKENDMASK) |
135 | 141 | ||
136 | /* | ||
137 | * The size of the FIFO in bytes. | ||
138 | */ | ||
139 | #define MCI_FIFOSIZE (16*4) | ||
140 | |||
141 | #define MCI_FIFOHALFSIZE (MCI_FIFOSIZE / 2) | ||
142 | |||
143 | #define NR_SG 16 | 142 | #define NR_SG 16 |
144 | 143 | ||
145 | struct clk; | 144 | struct clk; |
@@ -154,6 +153,7 @@ struct mmci_host { | |||
154 | struct clk *clk; | 153 | struct clk *clk; |
155 | int gpio_cd; | 154 | int gpio_cd; |
156 | int gpio_wp; | 155 | int gpio_wp; |
156 | int gpio_cd_irq; | ||
157 | 157 | ||
158 | unsigned int data_xfered; | 158 | unsigned int data_xfered; |
159 | 159 | ||
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 5db667c0b371..77efe462b921 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -2,6 +2,9 @@ | |||
2 | # Network device configuration | 2 | # Network device configuration |
3 | # | 3 | # |
4 | 4 | ||
5 | config HAVE_NET_MACB | ||
6 | bool | ||
7 | |||
5 | menuconfig NETDEVICES | 8 | menuconfig NETDEVICES |
6 | default y if UML | 9 | default y if UML |
7 | depends on NET | 10 | depends on NET |
@@ -221,7 +224,7 @@ config MII | |||
221 | 224 | ||
222 | config MACB | 225 | config MACB |
223 | tristate "Atmel MACB support" | 226 | tristate "Atmel MACB support" |
224 | depends on AVR32 || ARCH_AT91SAM9260 || ARCH_AT91SAM9263 || ARCH_AT91SAM9G20 || ARCH_AT91SAM9G45 || ARCH_AT91CAP9 | 227 | depends on HAVE_NET_MACB |
225 | select PHYLIB | 228 | select PHYLIB |
226 | help | 229 | help |
227 | The Atmel MACB ethernet interface is found on many AT32 and AT91 | 230 | The Atmel MACB ethernet interface is found on many AT32 and AT91 |
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index 12900f7083b0..3198c5335f0b 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -458,6 +458,7 @@ config SERIAL_SAMSUNG_UARTS | |||
458 | int | 458 | int |
459 | depends on ARM && PLAT_SAMSUNG | 459 | depends on ARM && PLAT_SAMSUNG |
460 | default 2 if ARCH_S3C2400 | 460 | default 2 if ARCH_S3C2400 |
461 | default 6 if ARCH_S5P6450 | ||
461 | default 4 if SERIAL_SAMSUNG_UARTS_4 | 462 | default 4 if SERIAL_SAMSUNG_UARTS_4 |
462 | default 3 | 463 | default 3 |
463 | help | 464 | help |
@@ -526,12 +527,12 @@ config SERIAL_S3C24A0 | |||
526 | Serial port support for the Samsung S3C24A0 SoC | 527 | Serial port support for the Samsung S3C24A0 SoC |
527 | 528 | ||
528 | config SERIAL_S3C6400 | 529 | config SERIAL_S3C6400 |
529 | tristate "Samsung S3C6400/S3C6410/S5P6440/S5PC100 Serial port support" | 530 | tristate "Samsung S3C6400/S3C6410/S5P6440/S5P6450/S5PC100 Serial port support" |
530 | depends on SERIAL_SAMSUNG && (CPU_S3C6400 || CPU_S3C6410 || CPU_S5P6440 || CPU_S5PC100) | 531 | depends on SERIAL_SAMSUNG && (CPU_S3C6400 || CPU_S3C6410 || CPU_S5P6440 || CPU_S5P6450 || CPU_S5PC100) |
531 | select SERIAL_SAMSUNG_UARTS_4 | 532 | select SERIAL_SAMSUNG_UARTS_4 |
532 | default y | 533 | default y |
533 | help | 534 | help |
534 | Serial port support for the Samsung S3C6400, S3C6410, S5P6440 | 535 | Serial port support for the Samsung S3C6400, S3C6410, S5P6440, S5P6450 |
535 | and S5PC100 SoCs | 536 | and S5PC100 SoCs |
536 | 537 | ||
537 | config SERIAL_S5PV210 | 538 | config SERIAL_S5PV210 |
diff --git a/drivers/serial/samsung.c b/drivers/serial/samsung.c index b1156ba8ad14..7ac2bf5167cd 100644 --- a/drivers/serial/samsung.c +++ b/drivers/serial/samsung.c | |||
@@ -1101,7 +1101,7 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport, | |||
1101 | dbg("resource %p (%lx..%lx)\n", res, res->start, res->end); | 1101 | dbg("resource %p (%lx..%lx)\n", res, res->start, res->end); |
1102 | 1102 | ||
1103 | port->mapbase = res->start; | 1103 | port->mapbase = res->start; |
1104 | port->membase = S3C_VA_UART + res->start - (S3C_PA_UART & 0xfff00000); | 1104 | port->membase = S3C_VA_UART + (res->start & 0xfffff); |
1105 | ret = platform_get_irq(platdev, 0); | 1105 | ret = platform_get_irq(platdev, 0); |
1106 | if (ret < 0) | 1106 | if (ret < 0) |
1107 | port->irq = 0; | 1107 | port->irq = 0; |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index 9949c252c23d..4b9eec68fad6 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -143,10 +143,26 @@ config SPI_GPIO | |||
143 | GPIO operations, you should be able to leverage that for better | 143 | GPIO operations, you should be able to leverage that for better |
144 | speed with a custom version of this driver; see the source code. | 144 | speed with a custom version of this driver; see the source code. |
145 | 145 | ||
146 | config SPI_IMX_VER_IMX1 | ||
147 | def_bool y if SOC_IMX1 | ||
148 | |||
149 | config SPI_IMX_VER_0_0 | ||
150 | def_bool y if SOC_IMX21 || SOC_IMX27 | ||
151 | |||
152 | config SPI_IMX_VER_0_4 | ||
153 | def_bool y if ARCH_MX31 | ||
154 | |||
155 | config SPI_IMX_VER_0_7 | ||
156 | def_bool y if ARCH_MX25 || ARCH_MX35 || ARCH_MX51 | ||
157 | |||
158 | config SPI_IMX_VER_2_3 | ||
159 | def_bool y if ARCH_MX51 | ||
160 | |||
146 | config SPI_IMX | 161 | config SPI_IMX |
147 | tristate "Freescale i.MX SPI controllers" | 162 | tristate "Freescale i.MX SPI controllers" |
148 | depends on ARCH_MXC | 163 | depends on ARCH_MXC |
149 | select SPI_BITBANG | 164 | select SPI_BITBANG |
165 | default m if IMX_HAVE_PLATFORM_SPI_IMX | ||
150 | help | 166 | help |
151 | This enables using the Freescale i.MX SPI controllers in master | 167 | This enables using the Freescale i.MX SPI controllers in master |
152 | mode. | 168 | mode. |
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index 7972e9077473..55a38e2c6c13 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c | |||
@@ -56,7 +56,28 @@ struct spi_imx_config { | |||
56 | unsigned int speed_hz; | 56 | unsigned int speed_hz; |
57 | unsigned int bpw; | 57 | unsigned int bpw; |
58 | unsigned int mode; | 58 | unsigned int mode; |
59 | int cs; | 59 | u8 cs; |
60 | }; | ||
61 | |||
62 | enum spi_imx_devtype { | ||
63 | SPI_IMX_VER_IMX1, | ||
64 | SPI_IMX_VER_0_0, | ||
65 | SPI_IMX_VER_0_4, | ||
66 | SPI_IMX_VER_0_5, | ||
67 | SPI_IMX_VER_0_7, | ||
68 | SPI_IMX_VER_2_3, | ||
69 | SPI_IMX_VER_AUTODETECT, | ||
70 | }; | ||
71 | |||
72 | struct spi_imx_data; | ||
73 | |||
74 | struct spi_imx_devtype_data { | ||
75 | void (*intctrl)(struct spi_imx_data *, int); | ||
76 | int (*config)(struct spi_imx_data *, struct spi_imx_config *); | ||
77 | void (*trigger)(struct spi_imx_data *); | ||
78 | int (*rx_available)(struct spi_imx_data *); | ||
79 | void (*reset)(struct spi_imx_data *); | ||
80 | unsigned int fifosize; | ||
60 | }; | 81 | }; |
61 | 82 | ||
62 | struct spi_imx_data { | 83 | struct spi_imx_data { |
@@ -76,11 +97,7 @@ struct spi_imx_data { | |||
76 | const void *tx_buf; | 97 | const void *tx_buf; |
77 | unsigned int txfifo; /* number of words pushed in tx FIFO */ | 98 | unsigned int txfifo; /* number of words pushed in tx FIFO */ |
78 | 99 | ||
79 | /* SoC specific functions */ | 100 | struct spi_imx_devtype_data devtype_data; |
80 | void (*intctrl)(struct spi_imx_data *, int); | ||
81 | int (*config)(struct spi_imx_data *, struct spi_imx_config *); | ||
82 | void (*trigger)(struct spi_imx_data *); | ||
83 | int (*rx_available)(struct spi_imx_data *); | ||
84 | }; | 101 | }; |
85 | 102 | ||
86 | #define MXC_SPI_BUF_RX(type) \ | 103 | #define MXC_SPI_BUF_RX(type) \ |
@@ -140,7 +157,7 @@ static unsigned int spi_imx_clkdiv_1(unsigned int fin, | |||
140 | return max; | 157 | return max; |
141 | } | 158 | } |
142 | 159 | ||
143 | /* MX1, MX31, MX35 */ | 160 | /* MX1, MX31, MX35, MX51 CSPI */ |
144 | static unsigned int spi_imx_clkdiv_2(unsigned int fin, | 161 | static unsigned int spi_imx_clkdiv_2(unsigned int fin, |
145 | unsigned int fspi) | 162 | unsigned int fspi) |
146 | { | 163 | { |
@@ -155,6 +172,128 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin, | |||
155 | return 7; | 172 | return 7; |
156 | } | 173 | } |
157 | 174 | ||
175 | #define SPI_IMX2_3_CTRL 0x08 | ||
176 | #define SPI_IMX2_3_CTRL_ENABLE (1 << 0) | ||
177 | #define SPI_IMX2_3_CTRL_XCH (1 << 2) | ||
178 | #define SPI_IMX2_3_CTRL_MODE(cs) (1 << ((cs) + 4)) | ||
179 | #define SPI_IMX2_3_CTRL_POSTDIV_OFFSET 8 | ||
180 | #define SPI_IMX2_3_CTRL_PREDIV_OFFSET 12 | ||
181 | #define SPI_IMX2_3_CTRL_CS(cs) ((cs) << 18) | ||
182 | #define SPI_IMX2_3_CTRL_BL_OFFSET 20 | ||
183 | |||
184 | #define SPI_IMX2_3_CONFIG 0x0c | ||
185 | #define SPI_IMX2_3_CONFIG_SCLKPHA(cs) (1 << ((cs) + 0)) | ||
186 | #define SPI_IMX2_3_CONFIG_SCLKPOL(cs) (1 << ((cs) + 4)) | ||
187 | #define SPI_IMX2_3_CONFIG_SBBCTRL(cs) (1 << ((cs) + 8)) | ||
188 | #define SPI_IMX2_3_CONFIG_SSBPOL(cs) (1 << ((cs) + 12)) | ||
189 | |||
190 | #define SPI_IMX2_3_INT 0x10 | ||
191 | #define SPI_IMX2_3_INT_TEEN (1 << 0) | ||
192 | #define SPI_IMX2_3_INT_RREN (1 << 3) | ||
193 | |||
194 | #define SPI_IMX2_3_STAT 0x18 | ||
195 | #define SPI_IMX2_3_STAT_RR (1 << 3) | ||
196 | |||
197 | /* MX51 eCSPI */ | ||
198 | static unsigned int spi_imx2_3_clkdiv(unsigned int fin, unsigned int fspi) | ||
199 | { | ||
200 | /* | ||
201 | * there are two 4-bit dividers, the pre-divider divides by | ||
202 | * $pre, the post-divider by 2^$post | ||
203 | */ | ||
204 | unsigned int pre, post; | ||
205 | |||
206 | if (unlikely(fspi > fin)) | ||
207 | return 0; | ||
208 | |||
209 | post = fls(fin) - fls(fspi); | ||
210 | if (fin > fspi << post) | ||
211 | post++; | ||
212 | |||
213 | /* now we have: (fin <= fspi << post) with post being minimal */ | ||
214 | |||
215 | post = max(4U, post) - 4; | ||
216 | if (unlikely(post > 0xf)) { | ||
217 | pr_err("%s: cannot set clock freq: %u (base freq: %u)\n", | ||
218 | __func__, fspi, fin); | ||
219 | return 0xff; | ||
220 | } | ||
221 | |||
222 | pre = DIV_ROUND_UP(fin, fspi << post) - 1; | ||
223 | |||
224 | pr_debug("%s: fin: %u, fspi: %u, post: %u, pre: %u\n", | ||
225 | __func__, fin, fspi, post, pre); | ||
226 | return (pre << SPI_IMX2_3_CTRL_PREDIV_OFFSET) | | ||
227 | (post << SPI_IMX2_3_CTRL_POSTDIV_OFFSET); | ||
228 | } | ||
229 | |||
230 | static void __maybe_unused spi_imx2_3_intctrl(struct spi_imx_data *spi_imx, int enable) | ||
231 | { | ||
232 | unsigned val = 0; | ||
233 | |||
234 | if (enable & MXC_INT_TE) | ||
235 | val |= SPI_IMX2_3_INT_TEEN; | ||
236 | |||
237 | if (enable & MXC_INT_RR) | ||
238 | val |= SPI_IMX2_3_INT_RREN; | ||
239 | |||
240 | writel(val, spi_imx->base + SPI_IMX2_3_INT); | ||
241 | } | ||
242 | |||
243 | static void __maybe_unused spi_imx2_3_trigger(struct spi_imx_data *spi_imx) | ||
244 | { | ||
245 | u32 reg; | ||
246 | |||
247 | reg = readl(spi_imx->base + SPI_IMX2_3_CTRL); | ||
248 | reg |= SPI_IMX2_3_CTRL_XCH; | ||
249 | writel(reg, spi_imx->base + SPI_IMX2_3_CTRL); | ||
250 | } | ||
251 | |||
252 | static int __maybe_unused spi_imx2_3_config(struct spi_imx_data *spi_imx, | ||
253 | struct spi_imx_config *config) | ||
254 | { | ||
255 | u32 ctrl = SPI_IMX2_3_CTRL_ENABLE, cfg = 0; | ||
256 | |||
257 | /* set master mode */ | ||
258 | ctrl |= SPI_IMX2_3_CTRL_MODE(config->cs); | ||
259 | |||
260 | /* set clock speed */ | ||
261 | ctrl |= spi_imx2_3_clkdiv(spi_imx->spi_clk, config->speed_hz); | ||
262 | |||
263 | /* set chip select to use */ | ||
264 | ctrl |= SPI_IMX2_3_CTRL_CS(config->cs); | ||
265 | |||
266 | ctrl |= (config->bpw - 1) << SPI_IMX2_3_CTRL_BL_OFFSET; | ||
267 | |||
268 | cfg |= SPI_IMX2_3_CONFIG_SBBCTRL(config->cs); | ||
269 | |||
270 | if (config->mode & SPI_CPHA) | ||
271 | cfg |= SPI_IMX2_3_CONFIG_SCLKPHA(config->cs); | ||
272 | |||
273 | if (config->mode & SPI_CPOL) | ||
274 | cfg |= SPI_IMX2_3_CONFIG_SCLKPOL(config->cs); | ||
275 | |||
276 | if (config->mode & SPI_CS_HIGH) | ||
277 | cfg |= SPI_IMX2_3_CONFIG_SSBPOL(config->cs); | ||
278 | |||
279 | writel(ctrl, spi_imx->base + SPI_IMX2_3_CTRL); | ||
280 | writel(cfg, spi_imx->base + SPI_IMX2_3_CONFIG); | ||
281 | |||
282 | return 0; | ||
283 | } | ||
284 | |||
285 | static int __maybe_unused spi_imx2_3_rx_available(struct spi_imx_data *spi_imx) | ||
286 | { | ||
287 | return readl(spi_imx->base + SPI_IMX2_3_STAT) & SPI_IMX2_3_STAT_RR; | ||
288 | } | ||
289 | |||
290 | static void __maybe_unused spi_imx2_3_reset(struct spi_imx_data *spi_imx) | ||
291 | { | ||
292 | /* drain receive buffer */ | ||
293 | while (spi_imx2_3_rx_available(spi_imx)) | ||
294 | readl(spi_imx->base + MXC_CSPIRXDATA); | ||
295 | } | ||
296 | |||
158 | #define MX31_INTREG_TEEN (1 << 0) | 297 | #define MX31_INTREG_TEEN (1 << 0) |
159 | #define MX31_INTREG_RREN (1 << 3) | 298 | #define MX31_INTREG_RREN (1 << 3) |
160 | 299 | ||
@@ -178,7 +317,7 @@ static unsigned int spi_imx_clkdiv_2(unsigned int fin, | |||
178 | * the i.MX35 has a slightly different register layout for bits | 317 | * the i.MX35 has a slightly different register layout for bits |
179 | * we do not use here. | 318 | * we do not use here. |
180 | */ | 319 | */ |
181 | static void mx31_intctrl(struct spi_imx_data *spi_imx, int enable) | 320 | static void __maybe_unused mx31_intctrl(struct spi_imx_data *spi_imx, int enable) |
182 | { | 321 | { |
183 | unsigned int val = 0; | 322 | unsigned int val = 0; |
184 | 323 | ||
@@ -190,7 +329,7 @@ static void mx31_intctrl(struct spi_imx_data *spi_imx, int enable) | |||
190 | writel(val, spi_imx->base + MXC_CSPIINT); | 329 | writel(val, spi_imx->base + MXC_CSPIINT); |
191 | } | 330 | } |
192 | 331 | ||
193 | static void mx31_trigger(struct spi_imx_data *spi_imx) | 332 | static void __maybe_unused mx31_trigger(struct spi_imx_data *spi_imx) |
194 | { | 333 | { |
195 | unsigned int reg; | 334 | unsigned int reg; |
196 | 335 | ||
@@ -199,20 +338,16 @@ static void mx31_trigger(struct spi_imx_data *spi_imx) | |||
199 | writel(reg, spi_imx->base + MXC_CSPICTRL); | 338 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
200 | } | 339 | } |
201 | 340 | ||
202 | static int mx31_config(struct spi_imx_data *spi_imx, | 341 | static int __maybe_unused spi_imx0_4_config(struct spi_imx_data *spi_imx, |
203 | struct spi_imx_config *config) | 342 | struct spi_imx_config *config) |
204 | { | 343 | { |
205 | unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER; | 344 | unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER; |
345 | int cs = spi_imx->chipselect[config->cs]; | ||
206 | 346 | ||
207 | reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, config->speed_hz) << | 347 | reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, config->speed_hz) << |
208 | MX31_CSPICTRL_DR_SHIFT; | 348 | MX31_CSPICTRL_DR_SHIFT; |
209 | 349 | ||
210 | if (cpu_is_mx31()) | 350 | reg |= (config->bpw - 1) << MX31_CSPICTRL_BC_SHIFT; |
211 | reg |= (config->bpw - 1) << MX31_CSPICTRL_BC_SHIFT; | ||
212 | else if (cpu_is_mx25() || cpu_is_mx35()) { | ||
213 | reg |= (config->bpw - 1) << MX35_CSPICTRL_BL_SHIFT; | ||
214 | reg |= MX31_CSPICTRL_SSCTL; | ||
215 | } | ||
216 | 351 | ||
217 | if (config->mode & SPI_CPHA) | 352 | if (config->mode & SPI_CPHA) |
218 | reg |= MX31_CSPICTRL_PHA; | 353 | reg |= MX31_CSPICTRL_PHA; |
@@ -220,23 +355,52 @@ static int mx31_config(struct spi_imx_data *spi_imx, | |||
220 | reg |= MX31_CSPICTRL_POL; | 355 | reg |= MX31_CSPICTRL_POL; |
221 | if (config->mode & SPI_CS_HIGH) | 356 | if (config->mode & SPI_CS_HIGH) |
222 | reg |= MX31_CSPICTRL_SSPOL; | 357 | reg |= MX31_CSPICTRL_SSPOL; |
223 | if (config->cs < 0) { | 358 | if (cs < 0) |
224 | if (cpu_is_mx31()) | 359 | reg |= (cs + 32) << MX31_CSPICTRL_CS_SHIFT; |
225 | reg |= (config->cs + 32) << MX31_CSPICTRL_CS_SHIFT; | 360 | |
226 | else if (cpu_is_mx25() || cpu_is_mx35()) | 361 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
227 | reg |= (config->cs + 32) << MX35_CSPICTRL_CS_SHIFT; | 362 | |
228 | } | 363 | return 0; |
364 | } | ||
365 | |||
366 | static int __maybe_unused spi_imx0_7_config(struct spi_imx_data *spi_imx, | ||
367 | struct spi_imx_config *config) | ||
368 | { | ||
369 | unsigned int reg = MX31_CSPICTRL_ENABLE | MX31_CSPICTRL_MASTER; | ||
370 | int cs = spi_imx->chipselect[config->cs]; | ||
371 | |||
372 | reg |= spi_imx_clkdiv_2(spi_imx->spi_clk, config->speed_hz) << | ||
373 | MX31_CSPICTRL_DR_SHIFT; | ||
374 | |||
375 | reg |= (config->bpw - 1) << MX35_CSPICTRL_BL_SHIFT; | ||
376 | reg |= MX31_CSPICTRL_SSCTL; | ||
377 | |||
378 | if (config->mode & SPI_CPHA) | ||
379 | reg |= MX31_CSPICTRL_PHA; | ||
380 | if (config->mode & SPI_CPOL) | ||
381 | reg |= MX31_CSPICTRL_POL; | ||
382 | if (config->mode & SPI_CS_HIGH) | ||
383 | reg |= MX31_CSPICTRL_SSPOL; | ||
384 | if (cs < 0) | ||
385 | reg |= (cs + 32) << MX35_CSPICTRL_CS_SHIFT; | ||
229 | 386 | ||
230 | writel(reg, spi_imx->base + MXC_CSPICTRL); | 387 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
231 | 388 | ||
232 | return 0; | 389 | return 0; |
233 | } | 390 | } |
234 | 391 | ||
235 | static int mx31_rx_available(struct spi_imx_data *spi_imx) | 392 | static int __maybe_unused mx31_rx_available(struct spi_imx_data *spi_imx) |
236 | { | 393 | { |
237 | return readl(spi_imx->base + MX31_CSPISTATUS) & MX31_STATUS_RR; | 394 | return readl(spi_imx->base + MX31_CSPISTATUS) & MX31_STATUS_RR; |
238 | } | 395 | } |
239 | 396 | ||
397 | static void __maybe_unused spi_imx0_4_reset(struct spi_imx_data *spi_imx) | ||
398 | { | ||
399 | /* drain receive buffer */ | ||
400 | while (readl(spi_imx->base + MX3_CSPISTAT) & MX3_CSPISTAT_RR) | ||
401 | readl(spi_imx->base + MXC_CSPIRXDATA); | ||
402 | } | ||
403 | |||
240 | #define MX27_INTREG_RR (1 << 4) | 404 | #define MX27_INTREG_RR (1 << 4) |
241 | #define MX27_INTREG_TEEN (1 << 9) | 405 | #define MX27_INTREG_TEEN (1 << 9) |
242 | #define MX27_INTREG_RREN (1 << 13) | 406 | #define MX27_INTREG_RREN (1 << 13) |
@@ -250,7 +414,7 @@ static int mx31_rx_available(struct spi_imx_data *spi_imx) | |||
250 | #define MX27_CSPICTRL_DR_SHIFT 14 | 414 | #define MX27_CSPICTRL_DR_SHIFT 14 |
251 | #define MX27_CSPICTRL_CS_SHIFT 19 | 415 | #define MX27_CSPICTRL_CS_SHIFT 19 |
252 | 416 | ||
253 | static void mx27_intctrl(struct spi_imx_data *spi_imx, int enable) | 417 | static void __maybe_unused mx27_intctrl(struct spi_imx_data *spi_imx, int enable) |
254 | { | 418 | { |
255 | unsigned int val = 0; | 419 | unsigned int val = 0; |
256 | 420 | ||
@@ -262,7 +426,7 @@ static void mx27_intctrl(struct spi_imx_data *spi_imx, int enable) | |||
262 | writel(val, spi_imx->base + MXC_CSPIINT); | 426 | writel(val, spi_imx->base + MXC_CSPIINT); |
263 | } | 427 | } |
264 | 428 | ||
265 | static void mx27_trigger(struct spi_imx_data *spi_imx) | 429 | static void __maybe_unused mx27_trigger(struct spi_imx_data *spi_imx) |
266 | { | 430 | { |
267 | unsigned int reg; | 431 | unsigned int reg; |
268 | 432 | ||
@@ -271,10 +435,11 @@ static void mx27_trigger(struct spi_imx_data *spi_imx) | |||
271 | writel(reg, spi_imx->base + MXC_CSPICTRL); | 435 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
272 | } | 436 | } |
273 | 437 | ||
274 | static int mx27_config(struct spi_imx_data *spi_imx, | 438 | static int __maybe_unused mx27_config(struct spi_imx_data *spi_imx, |
275 | struct spi_imx_config *config) | 439 | struct spi_imx_config *config) |
276 | { | 440 | { |
277 | unsigned int reg = MX27_CSPICTRL_ENABLE | MX27_CSPICTRL_MASTER; | 441 | unsigned int reg = MX27_CSPICTRL_ENABLE | MX27_CSPICTRL_MASTER; |
442 | int cs = spi_imx->chipselect[config->cs]; | ||
278 | 443 | ||
279 | reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, config->speed_hz) << | 444 | reg |= spi_imx_clkdiv_1(spi_imx->spi_clk, config->speed_hz) << |
280 | MX27_CSPICTRL_DR_SHIFT; | 445 | MX27_CSPICTRL_DR_SHIFT; |
@@ -286,19 +451,24 @@ static int mx27_config(struct spi_imx_data *spi_imx, | |||
286 | reg |= MX27_CSPICTRL_POL; | 451 | reg |= MX27_CSPICTRL_POL; |
287 | if (config->mode & SPI_CS_HIGH) | 452 | if (config->mode & SPI_CS_HIGH) |
288 | reg |= MX27_CSPICTRL_SSPOL; | 453 | reg |= MX27_CSPICTRL_SSPOL; |
289 | if (config->cs < 0) | 454 | if (cs < 0) |
290 | reg |= (config->cs + 32) << MX27_CSPICTRL_CS_SHIFT; | 455 | reg |= (cs + 32) << MX27_CSPICTRL_CS_SHIFT; |
291 | 456 | ||
292 | writel(reg, spi_imx->base + MXC_CSPICTRL); | 457 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
293 | 458 | ||
294 | return 0; | 459 | return 0; |
295 | } | 460 | } |
296 | 461 | ||
297 | static int mx27_rx_available(struct spi_imx_data *spi_imx) | 462 | static int __maybe_unused mx27_rx_available(struct spi_imx_data *spi_imx) |
298 | { | 463 | { |
299 | return readl(spi_imx->base + MXC_CSPIINT) & MX27_INTREG_RR; | 464 | return readl(spi_imx->base + MXC_CSPIINT) & MX27_INTREG_RR; |
300 | } | 465 | } |
301 | 466 | ||
467 | static void __maybe_unused spi_imx0_0_reset(struct spi_imx_data *spi_imx) | ||
468 | { | ||
469 | writel(1, spi_imx->base + MXC_RESET); | ||
470 | } | ||
471 | |||
302 | #define MX1_INTREG_RR (1 << 3) | 472 | #define MX1_INTREG_RR (1 << 3) |
303 | #define MX1_INTREG_TEEN (1 << 8) | 473 | #define MX1_INTREG_TEEN (1 << 8) |
304 | #define MX1_INTREG_RREN (1 << 11) | 474 | #define MX1_INTREG_RREN (1 << 11) |
@@ -310,7 +480,7 @@ static int mx27_rx_available(struct spi_imx_data *spi_imx) | |||
310 | #define MX1_CSPICTRL_MASTER (1 << 10) | 480 | #define MX1_CSPICTRL_MASTER (1 << 10) |
311 | #define MX1_CSPICTRL_DR_SHIFT 13 | 481 | #define MX1_CSPICTRL_DR_SHIFT 13 |
312 | 482 | ||
313 | static void mx1_intctrl(struct spi_imx_data *spi_imx, int enable) | 483 | static void __maybe_unused mx1_intctrl(struct spi_imx_data *spi_imx, int enable) |
314 | { | 484 | { |
315 | unsigned int val = 0; | 485 | unsigned int val = 0; |
316 | 486 | ||
@@ -322,7 +492,7 @@ static void mx1_intctrl(struct spi_imx_data *spi_imx, int enable) | |||
322 | writel(val, spi_imx->base + MXC_CSPIINT); | 492 | writel(val, spi_imx->base + MXC_CSPIINT); |
323 | } | 493 | } |
324 | 494 | ||
325 | static void mx1_trigger(struct spi_imx_data *spi_imx) | 495 | static void __maybe_unused mx1_trigger(struct spi_imx_data *spi_imx) |
326 | { | 496 | { |
327 | unsigned int reg; | 497 | unsigned int reg; |
328 | 498 | ||
@@ -331,7 +501,7 @@ static void mx1_trigger(struct spi_imx_data *spi_imx) | |||
331 | writel(reg, spi_imx->base + MXC_CSPICTRL); | 501 | writel(reg, spi_imx->base + MXC_CSPICTRL); |
332 | } | 502 | } |
333 | 503 | ||
334 | static int mx1_config(struct spi_imx_data *spi_imx, | 504 | static int __maybe_unused mx1_config(struct spi_imx_data *spi_imx, |
335 | struct spi_imx_config *config) | 505 | struct spi_imx_config *config) |
336 | { | 506 | { |
337 | unsigned int reg = MX1_CSPICTRL_ENABLE | MX1_CSPICTRL_MASTER; | 507 | unsigned int reg = MX1_CSPICTRL_ENABLE | MX1_CSPICTRL_MASTER; |
@@ -350,11 +520,73 @@ static int mx1_config(struct spi_imx_data *spi_imx, | |||
350 | return 0; | 520 | return 0; |
351 | } | 521 | } |
352 | 522 | ||
353 | static int mx1_rx_available(struct spi_imx_data *spi_imx) | 523 | static int __maybe_unused mx1_rx_available(struct spi_imx_data *spi_imx) |
354 | { | 524 | { |
355 | return readl(spi_imx->base + MXC_CSPIINT) & MX1_INTREG_RR; | 525 | return readl(spi_imx->base + MXC_CSPIINT) & MX1_INTREG_RR; |
356 | } | 526 | } |
357 | 527 | ||
528 | static void __maybe_unused mx1_reset(struct spi_imx_data *spi_imx) | ||
529 | { | ||
530 | writel(1, spi_imx->base + MXC_RESET); | ||
531 | } | ||
532 | |||
533 | /* | ||
534 | * These version numbers are taken from the Freescale driver. Unfortunately it | ||
535 | * doesn't support i.MX1, so this entry doesn't match the scheme. :-( | ||
536 | */ | ||
537 | static struct spi_imx_devtype_data spi_imx_devtype_data[] __devinitdata = { | ||
538 | #ifdef CONFIG_SPI_IMX_VER_IMX1 | ||
539 | [SPI_IMX_VER_IMX1] = { | ||
540 | .intctrl = mx1_intctrl, | ||
541 | .config = mx1_config, | ||
542 | .trigger = mx1_trigger, | ||
543 | .rx_available = mx1_rx_available, | ||
544 | .reset = mx1_reset, | ||
545 | .fifosize = 8, | ||
546 | }, | ||
547 | #endif | ||
548 | #ifdef CONFIG_SPI_IMX_VER_0_0 | ||
549 | [SPI_IMX_VER_0_0] = { | ||
550 | .intctrl = mx27_intctrl, | ||
551 | .config = mx27_config, | ||
552 | .trigger = mx27_trigger, | ||
553 | .rx_available = mx27_rx_available, | ||
554 | .reset = spi_imx0_0_reset, | ||
555 | .fifosize = 8, | ||
556 | }, | ||
557 | #endif | ||
558 | #ifdef CONFIG_SPI_IMX_VER_0_4 | ||
559 | [SPI_IMX_VER_0_4] = { | ||
560 | .intctrl = mx31_intctrl, | ||
561 | .config = spi_imx0_4_config, | ||
562 | .trigger = mx31_trigger, | ||
563 | .rx_available = mx31_rx_available, | ||
564 | .reset = spi_imx0_4_reset, | ||
565 | .fifosize = 8, | ||
566 | }, | ||
567 | #endif | ||
568 | #ifdef CONFIG_SPI_IMX_VER_0_7 | ||
569 | [SPI_IMX_VER_0_7] = { | ||
570 | .intctrl = mx31_intctrl, | ||
571 | .config = spi_imx0_7_config, | ||
572 | .trigger = mx31_trigger, | ||
573 | .rx_available = mx31_rx_available, | ||
574 | .reset = spi_imx0_4_reset, | ||
575 | .fifosize = 8, | ||
576 | }, | ||
577 | #endif | ||
578 | #ifdef CONFIG_SPI_IMX_VER_2_3 | ||
579 | [SPI_IMX_VER_2_3] = { | ||
580 | .intctrl = spi_imx2_3_intctrl, | ||
581 | .config = spi_imx2_3_config, | ||
582 | .trigger = spi_imx2_3_trigger, | ||
583 | .rx_available = spi_imx2_3_rx_available, | ||
584 | .reset = spi_imx2_3_reset, | ||
585 | .fifosize = 64, | ||
586 | }, | ||
587 | #endif | ||
588 | }; | ||
589 | |||
358 | static void spi_imx_chipselect(struct spi_device *spi, int is_active) | 590 | static void spi_imx_chipselect(struct spi_device *spi, int is_active) |
359 | { | 591 | { |
360 | struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); | 592 | struct spi_imx_data *spi_imx = spi_master_get_devdata(spi->master); |
@@ -370,21 +602,21 @@ static void spi_imx_chipselect(struct spi_device *spi, int is_active) | |||
370 | 602 | ||
371 | static void spi_imx_push(struct spi_imx_data *spi_imx) | 603 | static void spi_imx_push(struct spi_imx_data *spi_imx) |
372 | { | 604 | { |
373 | while (spi_imx->txfifo < 8) { | 605 | while (spi_imx->txfifo < spi_imx->devtype_data.fifosize) { |
374 | if (!spi_imx->count) | 606 | if (!spi_imx->count) |
375 | break; | 607 | break; |
376 | spi_imx->tx(spi_imx); | 608 | spi_imx->tx(spi_imx); |
377 | spi_imx->txfifo++; | 609 | spi_imx->txfifo++; |
378 | } | 610 | } |
379 | 611 | ||
380 | spi_imx->trigger(spi_imx); | 612 | spi_imx->devtype_data.trigger(spi_imx); |
381 | } | 613 | } |
382 | 614 | ||
383 | static irqreturn_t spi_imx_isr(int irq, void *dev_id) | 615 | static irqreturn_t spi_imx_isr(int irq, void *dev_id) |
384 | { | 616 | { |
385 | struct spi_imx_data *spi_imx = dev_id; | 617 | struct spi_imx_data *spi_imx = dev_id; |
386 | 618 | ||
387 | while (spi_imx->rx_available(spi_imx)) { | 619 | while (spi_imx->devtype_data.rx_available(spi_imx)) { |
388 | spi_imx->rx(spi_imx); | 620 | spi_imx->rx(spi_imx); |
389 | spi_imx->txfifo--; | 621 | spi_imx->txfifo--; |
390 | } | 622 | } |
@@ -398,11 +630,12 @@ static irqreturn_t spi_imx_isr(int irq, void *dev_id) | |||
398 | /* No data left to push, but still waiting for rx data, | 630 | /* No data left to push, but still waiting for rx data, |
399 | * enable receive data available interrupt. | 631 | * enable receive data available interrupt. |
400 | */ | 632 | */ |
401 | spi_imx->intctrl(spi_imx, MXC_INT_RR); | 633 | spi_imx->devtype_data.intctrl( |
634 | spi_imx, MXC_INT_RR); | ||
402 | return IRQ_HANDLED; | 635 | return IRQ_HANDLED; |
403 | } | 636 | } |
404 | 637 | ||
405 | spi_imx->intctrl(spi_imx, 0); | 638 | spi_imx->devtype_data.intctrl(spi_imx, 0); |
406 | complete(&spi_imx->xfer_done); | 639 | complete(&spi_imx->xfer_done); |
407 | 640 | ||
408 | return IRQ_HANDLED; | 641 | return IRQ_HANDLED; |
@@ -417,7 +650,7 @@ static int spi_imx_setupxfer(struct spi_device *spi, | |||
417 | config.bpw = t ? t->bits_per_word : spi->bits_per_word; | 650 | config.bpw = t ? t->bits_per_word : spi->bits_per_word; |
418 | config.speed_hz = t ? t->speed_hz : spi->max_speed_hz; | 651 | config.speed_hz = t ? t->speed_hz : spi->max_speed_hz; |
419 | config.mode = spi->mode; | 652 | config.mode = spi->mode; |
420 | config.cs = spi_imx->chipselect[spi->chip_select]; | 653 | config.cs = spi->chip_select; |
421 | 654 | ||
422 | if (!config.speed_hz) | 655 | if (!config.speed_hz) |
423 | config.speed_hz = spi->max_speed_hz; | 656 | config.speed_hz = spi->max_speed_hz; |
@@ -439,7 +672,7 @@ static int spi_imx_setupxfer(struct spi_device *spi, | |||
439 | } else | 672 | } else |
440 | BUG(); | 673 | BUG(); |
441 | 674 | ||
442 | spi_imx->config(spi_imx, &config); | 675 | spi_imx->devtype_data.config(spi_imx, &config); |
443 | 676 | ||
444 | return 0; | 677 | return 0; |
445 | } | 678 | } |
@@ -458,7 +691,7 @@ static int spi_imx_transfer(struct spi_device *spi, | |||
458 | 691 | ||
459 | spi_imx_push(spi_imx); | 692 | spi_imx_push(spi_imx); |
460 | 693 | ||
461 | spi_imx->intctrl(spi_imx, MXC_INT_TE); | 694 | spi_imx->devtype_data.intctrl(spi_imx, MXC_INT_TE); |
462 | 695 | ||
463 | wait_for_completion(&spi_imx->xfer_done); | 696 | wait_for_completion(&spi_imx->xfer_done); |
464 | 697 | ||
@@ -485,6 +718,39 @@ static void spi_imx_cleanup(struct spi_device *spi) | |||
485 | { | 718 | { |
486 | } | 719 | } |
487 | 720 | ||
721 | static struct platform_device_id spi_imx_devtype[] = { | ||
722 | { | ||
723 | .name = DRIVER_NAME, | ||
724 | .driver_data = SPI_IMX_VER_AUTODETECT, | ||
725 | }, { | ||
726 | .name = "imx1-cspi", | ||
727 | .driver_data = SPI_IMX_VER_IMX1, | ||
728 | }, { | ||
729 | .name = "imx21-cspi", | ||
730 | .driver_data = SPI_IMX_VER_0_0, | ||
731 | }, { | ||
732 | .name = "imx25-cspi", | ||
733 | .driver_data = SPI_IMX_VER_0_7, | ||
734 | }, { | ||
735 | .name = "imx27-cspi", | ||
736 | .driver_data = SPI_IMX_VER_0_0, | ||
737 | }, { | ||
738 | .name = "imx31-cspi", | ||
739 | .driver_data = SPI_IMX_VER_0_4, | ||
740 | }, { | ||
741 | .name = "imx35-cspi", | ||
742 | .driver_data = SPI_IMX_VER_0_7, | ||
743 | }, { | ||
744 | .name = "imx51-cspi", | ||
745 | .driver_data = SPI_IMX_VER_0_7, | ||
746 | }, { | ||
747 | .name = "imx51-ecspi", | ||
748 | .driver_data = SPI_IMX_VER_2_3, | ||
749 | }, { | ||
750 | /* sentinel */ | ||
751 | } | ||
752 | }; | ||
753 | |||
488 | static int __devinit spi_imx_probe(struct platform_device *pdev) | 754 | static int __devinit spi_imx_probe(struct platform_device *pdev) |
489 | { | 755 | { |
490 | struct spi_imx_master *mxc_platform_info; | 756 | struct spi_imx_master *mxc_platform_info; |
@@ -536,6 +802,31 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) | |||
536 | 802 | ||
537 | init_completion(&spi_imx->xfer_done); | 803 | init_completion(&spi_imx->xfer_done); |
538 | 804 | ||
805 | if (pdev->id_entry->driver_data == SPI_IMX_VER_AUTODETECT) { | ||
806 | if (cpu_is_mx25() || cpu_is_mx35()) | ||
807 | spi_imx->devtype_data = | ||
808 | spi_imx_devtype_data[SPI_IMX_VER_0_7]; | ||
809 | else if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35()) | ||
810 | spi_imx->devtype_data = | ||
811 | spi_imx_devtype_data[SPI_IMX_VER_0_4]; | ||
812 | else if (cpu_is_mx27() || cpu_is_mx21()) | ||
813 | spi_imx->devtype_data = | ||
814 | spi_imx_devtype_data[SPI_IMX_VER_0_0]; | ||
815 | else if (cpu_is_mx1()) | ||
816 | spi_imx->devtype_data = | ||
817 | spi_imx_devtype_data[SPI_IMX_VER_IMX1]; | ||
818 | else | ||
819 | BUG(); | ||
820 | } else | ||
821 | spi_imx->devtype_data = | ||
822 | spi_imx_devtype_data[pdev->id_entry->driver_data]; | ||
823 | |||
824 | if (!spi_imx->devtype_data.intctrl) { | ||
825 | dev_err(&pdev->dev, "no support for this device compiled in\n"); | ||
826 | ret = -ENODEV; | ||
827 | goto out_gpio_free; | ||
828 | } | ||
829 | |||
539 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 830 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
540 | if (!res) { | 831 | if (!res) { |
541 | dev_err(&pdev->dev, "can't get platform resource\n"); | 832 | dev_err(&pdev->dev, "can't get platform resource\n"); |
@@ -567,24 +858,6 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) | |||
567 | goto out_iounmap; | 858 | goto out_iounmap; |
568 | } | 859 | } |
569 | 860 | ||
570 | if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35()) { | ||
571 | spi_imx->intctrl = mx31_intctrl; | ||
572 | spi_imx->config = mx31_config; | ||
573 | spi_imx->trigger = mx31_trigger; | ||
574 | spi_imx->rx_available = mx31_rx_available; | ||
575 | } else if (cpu_is_mx27() || cpu_is_mx21()) { | ||
576 | spi_imx->intctrl = mx27_intctrl; | ||
577 | spi_imx->config = mx27_config; | ||
578 | spi_imx->trigger = mx27_trigger; | ||
579 | spi_imx->rx_available = mx27_rx_available; | ||
580 | } else if (cpu_is_mx1()) { | ||
581 | spi_imx->intctrl = mx1_intctrl; | ||
582 | spi_imx->config = mx1_config; | ||
583 | spi_imx->trigger = mx1_trigger; | ||
584 | spi_imx->rx_available = mx1_rx_available; | ||
585 | } else | ||
586 | BUG(); | ||
587 | |||
588 | spi_imx->clk = clk_get(&pdev->dev, NULL); | 861 | spi_imx->clk = clk_get(&pdev->dev, NULL); |
589 | if (IS_ERR(spi_imx->clk)) { | 862 | if (IS_ERR(spi_imx->clk)) { |
590 | dev_err(&pdev->dev, "unable to get clock\n"); | 863 | dev_err(&pdev->dev, "unable to get clock\n"); |
@@ -595,15 +868,9 @@ static int __devinit spi_imx_probe(struct platform_device *pdev) | |||
595 | clk_enable(spi_imx->clk); | 868 | clk_enable(spi_imx->clk); |
596 | spi_imx->spi_clk = clk_get_rate(spi_imx->clk); | 869 | spi_imx->spi_clk = clk_get_rate(spi_imx->clk); |
597 | 870 | ||
598 | if (cpu_is_mx1() || cpu_is_mx21() || cpu_is_mx27()) | 871 | spi_imx->devtype_data.reset(spi_imx); |
599 | writel(1, spi_imx->base + MXC_RESET); | ||
600 | |||
601 | /* drain receive buffer */ | ||
602 | if (cpu_is_mx25() || cpu_is_mx31() || cpu_is_mx35()) | ||
603 | while (readl(spi_imx->base + MX3_CSPISTAT) & MX3_CSPISTAT_RR) | ||
604 | readl(spi_imx->base + MXC_CSPIRXDATA); | ||
605 | 872 | ||
606 | spi_imx->intctrl(spi_imx, 0); | 873 | spi_imx->devtype_data.intctrl(spi_imx, 0); |
607 | 874 | ||
608 | ret = spi_bitbang_start(&spi_imx->bitbang); | 875 | ret = spi_bitbang_start(&spi_imx->bitbang); |
609 | if (ret) { | 876 | if (ret) { |
@@ -668,6 +935,7 @@ static struct platform_driver spi_imx_driver = { | |||
668 | .name = DRIVER_NAME, | 935 | .name = DRIVER_NAME, |
669 | .owner = THIS_MODULE, | 936 | .owner = THIS_MODULE, |
670 | }, | 937 | }, |
938 | .id_table = spi_imx_devtype, | ||
671 | .probe = spi_imx_probe, | 939 | .probe = spi_imx_probe, |
672 | .remove = __devexit_p(spi_imx_remove), | 940 | .remove = __devexit_p(spi_imx_remove), |
673 | }; | 941 | }; |
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 418163894775..afef7b0a4195 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
26 | #include <mach/ohci.h> | 26 | #include <mach/ohci.h> |
27 | #include <mach/pxa3xx-u2d.h> | ||
27 | 28 | ||
28 | /* | 29 | /* |
29 | * UHC: USB Host Controller (OHCI-like) register definitions | 30 | * UHC: USB Host Controller (OHCI-like) register definitions |
@@ -235,6 +236,9 @@ static int pxa27x_start_hc(struct pxa27x_ohci *ohci, struct device *dev) | |||
235 | if (retval < 0) | 236 | if (retval < 0) |
236 | return retval; | 237 | return retval; |
237 | 238 | ||
239 | if (cpu_is_pxa3xx()) | ||
240 | pxa3xx_u2d_start_hc(&ohci_to_hcd(&ohci->ohci)->self); | ||
241 | |||
238 | uhchr = __raw_readl(ohci->mmio_base + UHCHR) & ~UHCHR_SSE; | 242 | uhchr = __raw_readl(ohci->mmio_base + UHCHR) & ~UHCHR_SSE; |
239 | __raw_writel(uhchr, ohci->mmio_base + UHCHR); | 243 | __raw_writel(uhchr, ohci->mmio_base + UHCHR); |
240 | __raw_writel(UHCHIE_UPRIE | UHCHIE_RWIE, ohci->mmio_base + UHCHIE); | 244 | __raw_writel(UHCHIE_UPRIE | UHCHIE_RWIE, ohci->mmio_base + UHCHIE); |
@@ -251,6 +255,9 @@ static void pxa27x_stop_hc(struct pxa27x_ohci *ohci, struct device *dev) | |||
251 | 255 | ||
252 | inf = dev->platform_data; | 256 | inf = dev->platform_data; |
253 | 257 | ||
258 | if (cpu_is_pxa3xx()) | ||
259 | pxa3xx_u2d_stop_hc(&ohci_to_hcd(&ohci->ohci)->self); | ||
260 | |||
254 | if (inf->exit) | 261 | if (inf->exit) |
255 | inf->exit(dev); | 262 | inf->exit(dev); |
256 | 263 | ||
diff --git a/drivers/video/pxa168fb.c b/drivers/video/pxa168fb.c index a31a77ff6f3d..cea6403ae71c 100644 --- a/drivers/video/pxa168fb.c +++ b/drivers/video/pxa168fb.c | |||
@@ -784,12 +784,53 @@ failed: | |||
784 | return ret; | 784 | return ret; |
785 | } | 785 | } |
786 | 786 | ||
787 | static int __devexit pxa168fb_remove(struct platform_device *pdev) | ||
788 | { | ||
789 | struct pxa168fb_info *fbi = platform_get_drvdata(pdev); | ||
790 | struct fb_info *info; | ||
791 | int irq; | ||
792 | unsigned int data; | ||
793 | |||
794 | if (!fbi) | ||
795 | return 0; | ||
796 | |||
797 | /* disable DMA transfer */ | ||
798 | data = readl(fbi->reg_base + LCD_SPU_DMA_CTRL0); | ||
799 | data &= ~CFG_GRA_ENA_MASK; | ||
800 | writel(data, fbi->reg_base + LCD_SPU_DMA_CTRL0); | ||
801 | |||
802 | info = fbi->info; | ||
803 | |||
804 | unregister_framebuffer(info); | ||
805 | |||
806 | writel(GRA_FRAME_IRQ0_ENA(0x0), fbi->reg_base + SPU_IRQ_ENA); | ||
807 | |||
808 | if (info->cmap.len) | ||
809 | fb_dealloc_cmap(&info->cmap); | ||
810 | |||
811 | irq = platform_get_irq(pdev, 0); | ||
812 | free_irq(irq, fbi); | ||
813 | |||
814 | dma_free_writecombine(fbi->dev, PAGE_ALIGN(info->fix.smem_len), | ||
815 | info->screen_base, info->fix.smem_start); | ||
816 | |||
817 | iounmap(fbi->reg_base); | ||
818 | |||
819 | clk_disable(fbi->clk); | ||
820 | clk_put(fbi->clk); | ||
821 | |||
822 | framebuffer_release(info); | ||
823 | |||
824 | return 0; | ||
825 | } | ||
826 | |||
787 | static struct platform_driver pxa168fb_driver = { | 827 | static struct platform_driver pxa168fb_driver = { |
788 | .driver = { | 828 | .driver = { |
789 | .name = "pxa168-fb", | 829 | .name = "pxa168-fb", |
790 | .owner = THIS_MODULE, | 830 | .owner = THIS_MODULE, |
791 | }, | 831 | }, |
792 | .probe = pxa168fb_probe, | 832 | .probe = pxa168fb_probe, |
833 | .remove = __devexit_p(pxa168fb_remove), | ||
793 | }; | 834 | }; |
794 | 835 | ||
795 | static int __init pxa168fb_init(void) | 836 | static int __init pxa168fb_init(void) |
@@ -798,6 +839,12 @@ static int __init pxa168fb_init(void) | |||
798 | } | 839 | } |
799 | module_init(pxa168fb_init); | 840 | module_init(pxa168fb_init); |
800 | 841 | ||
842 | static void __exit pxa168fb_exit(void) | ||
843 | { | ||
844 | platform_driver_unregister(&pxa168fb_driver); | ||
845 | } | ||
846 | module_exit(pxa168fb_exit); | ||
847 | |||
801 | MODULE_AUTHOR("Lennert Buytenhek <buytenh@marvell.com> " | 848 | MODULE_AUTHOR("Lennert Buytenhek <buytenh@marvell.com> " |
802 | "Green Wan <gwan@marvell.com>"); | 849 | "Green Wan <gwan@marvell.com>"); |
803 | MODULE_DESCRIPTION("Framebuffer driver for PXA168/910"); | 850 | MODULE_DESCRIPTION("Framebuffer driver for PXA168/910"); |