aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-04-06 01:13:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-04-06 01:13:39 -0400
commit314489bd4c7780fde6a069783d5128f6cef52919 (patch)
tree1f4ddd3f09525b6f6b05a1f96e6aef4842702c3e /drivers
parent43e347a1c451ff61ac16cc0e88ea9f48bbc6351d (diff)
parenta8f5b6e5ef0faf64997bfa87698aaabc989e64c4 (diff)
Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull "ARM: SoC fixes: from Olof Johansson: "A bunch of fixes for regressions (and a few other problems) in 3.4-rc1: - Fix for regression of mach/io.h cleanup on platforms with PCI or PCMCIA (adding back the include file on those for now) - AT91 fixes for usb and spi - smsc911x ethernet fixes for i.MX - smsc911x fixes for OMAP - gpio fixes for Tegra - A handful of build error and warning fixes for various platforms - cpufreq kconfig dependencies, build and lowlevel debug fixes for Samsung platforms In other words, more or less the regular collection of -rc1/2 type material. A few of them, in particular the smsc911x for OMAP series, aren't technically regressions for 3.4, but they're valid fixes and we're still relatively early in the rc cycle so it seems appropriate to include them." * tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (60 commits) ARM: fix __io macro for PCMCIA ARM: EXYNOS: Fix compiler warning in dma.c file ARM: EXYNOS: fix ISO C90 warning ARM: OMAP2+: hwmod: Fix wrong SYSC_TYPE1_XXX_MASK bit definitions ARM: OMAP2+: hwmod: Make omap_hwmod_softreset wait for reset status ARM: OMAP2+: hwmod: Restore sysc after a reset ARM: OMAP2+: omap_hwmod: Allow io_ring wakeup configuration for all modules ARM: OMAP3: clock data: fill in some missing clockdomains ARM: OMAP4: clock data: Force a DPLL clkdm/pwrdm ON before a relock ARM: OMAP4: clock data: fix mult and div mask for USB_DPLL ARM: OMAP2+: powerdomain: Wait for powerdomain transition in pwrdm_state_switch() gpio: tegra: Iterate over the correct number of banks gpio: tegra: fix register address calculations for Tegra30 EXYNOS: fix dependency for EXYNOS_CPUFREQ ARM: at91: dt: remove unit-address part for memory nodes ARM: at91: fix check of valid GPIO for SPI and USB USB: ehci-atmel: add needed of.h header file ARM: at91/NAND DT bindings: add comments ARM: at91/at91sam9x5.dtsi: fix NAND ale/cle in DT file USB: ohci-at91: trivial return code name change ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cpufreq/Kconfig.arm10
-rw-r--r--drivers/gpio/gpio-tegra.c59
-rw-r--r--drivers/usb/host/ehci-atmel.c1
-rw-r--r--drivers/usb/host/ohci-at91.c163
-rw-r--r--drivers/video/backlight/locomolcd.c9
5 files changed, 135 insertions, 107 deletions
diff --git a/drivers/cpufreq/Kconfig.arm b/drivers/cpufreq/Kconfig.arm
index 32d790dd8180..ffbb44685915 100644
--- a/drivers/cpufreq/Kconfig.arm
+++ b/drivers/cpufreq/Kconfig.arm
@@ -51,9 +51,6 @@ config ARM_S5PV210_CPUFREQ
51config ARM_EXYNOS_CPUFREQ 51config ARM_EXYNOS_CPUFREQ
52 bool "SAMSUNG EXYNOS SoCs" 52 bool "SAMSUNG EXYNOS SoCs"
53 depends on ARCH_EXYNOS 53 depends on ARCH_EXYNOS
54 select ARM_EXYNOS4210_CPUFREQ if CPU_EXYNOS4210
55 select ARM_EXYNOS4X12_CPUFREQ if (SOC_EXYNOS4212 || SOC_EXYNOS4412)
56 select ARM_EXYNOS5250_CPUFREQ if SOC_EXYNOS5250
57 default y 54 default y
58 help 55 help
59 This adds the CPUFreq driver common part for Samsung 56 This adds the CPUFreq driver common part for Samsung
@@ -62,20 +59,19 @@ config ARM_EXYNOS_CPUFREQ
62 If in doubt, say N. 59 If in doubt, say N.
63 60
64config ARM_EXYNOS4210_CPUFREQ 61config ARM_EXYNOS4210_CPUFREQ
65 bool "Samsung EXYNOS4210" 62 def_bool CPU_EXYNOS4210
66 depends on ARCH_EXYNOS
67 help 63 help
68 This adds the CPUFreq driver for Samsung EXYNOS4210 64 This adds the CPUFreq driver for Samsung EXYNOS4210
69 SoC (S5PV310 or S5PC210). 65 SoC (S5PV310 or S5PC210).
70 66
71config ARM_EXYNOS4X12_CPUFREQ 67config ARM_EXYNOS4X12_CPUFREQ
72 bool "Samsung EXYNOS4X12" 68 def_bool (SOC_EXYNOS4212 || SOC_EXYNOS4412)
73 help 69 help
74 This adds the CPUFreq driver for Samsung EXYNOS4X12 70 This adds the CPUFreq driver for Samsung EXYNOS4X12
75 SoC (EXYNOS4212 or EXYNOS4412). 71 SoC (EXYNOS4212 or EXYNOS4412).
76 72
77config ARM_EXYNOS5250_CPUFREQ 73config ARM_EXYNOS5250_CPUFREQ
78 bool "Samsung EXYNOS5250" 74 def_bool SOC_EXYNOS5250
79 help 75 help
80 This adds the CPUFreq driver for Samsung EXYNOS5250 76 This adds the CPUFreq driver for Samsung EXYNOS5250
81 SoC. 77 SoC.
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 32de6707e3c4..12f349b3830d 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -22,7 +22,7 @@
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/gpio.h> 24#include <linux/gpio.h>
25#include <linux/of.h> 25#include <linux/of_device.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/irqdomain.h> 28#include <linux/irqdomain.h>
@@ -37,7 +37,8 @@
37#define GPIO_PORT(x) (((x) >> 3) & 0x3) 37#define GPIO_PORT(x) (((x) >> 3) & 0x3)
38#define GPIO_BIT(x) ((x) & 0x7) 38#define GPIO_BIT(x) ((x) & 0x7)
39 39
40#define GPIO_REG(x) (GPIO_BANK(x) * 0x80 + GPIO_PORT(x) * 4) 40#define GPIO_REG(x) (GPIO_BANK(x) * tegra_gpio_bank_stride + \
41 GPIO_PORT(x) * 4)
41 42
42#define GPIO_CNF(x) (GPIO_REG(x) + 0x00) 43#define GPIO_CNF(x) (GPIO_REG(x) + 0x00)
43#define GPIO_OE(x) (GPIO_REG(x) + 0x10) 44#define GPIO_OE(x) (GPIO_REG(x) + 0x10)
@@ -48,12 +49,12 @@
48#define GPIO_INT_LVL(x) (GPIO_REG(x) + 0x60) 49#define GPIO_INT_LVL(x) (GPIO_REG(x) + 0x60)
49#define GPIO_INT_CLR(x) (GPIO_REG(x) + 0x70) 50#define GPIO_INT_CLR(x) (GPIO_REG(x) + 0x70)
50 51
51#define GPIO_MSK_CNF(x) (GPIO_REG(x) + 0x800) 52#define GPIO_MSK_CNF(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x00)
52#define GPIO_MSK_OE(x) (GPIO_REG(x) + 0x810) 53#define GPIO_MSK_OE(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x10)
53#define GPIO_MSK_OUT(x) (GPIO_REG(x) + 0X820) 54#define GPIO_MSK_OUT(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0X20)
54#define GPIO_MSK_INT_STA(x) (GPIO_REG(x) + 0x840) 55#define GPIO_MSK_INT_STA(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x40)
55#define GPIO_MSK_INT_ENB(x) (GPIO_REG(x) + 0x850) 56#define GPIO_MSK_INT_ENB(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x50)
56#define GPIO_MSK_INT_LVL(x) (GPIO_REG(x) + 0x860) 57#define GPIO_MSK_INT_LVL(x) (GPIO_REG(x) + tegra_gpio_upper_offset + 0x60)
57 58
58#define GPIO_INT_LVL_MASK 0x010101 59#define GPIO_INT_LVL_MASK 0x010101
59#define GPIO_INT_LVL_EDGE_RISING 0x000101 60#define GPIO_INT_LVL_EDGE_RISING 0x000101
@@ -78,6 +79,8 @@ struct tegra_gpio_bank {
78static struct irq_domain *irq_domain; 79static struct irq_domain *irq_domain;
79static void __iomem *regs; 80static void __iomem *regs;
80static u32 tegra_gpio_bank_count; 81static u32 tegra_gpio_bank_count;
82static u32 tegra_gpio_bank_stride;
83static u32 tegra_gpio_upper_offset;
81static struct tegra_gpio_bank *tegra_gpio_banks; 84static struct tegra_gpio_bank *tegra_gpio_banks;
82 85
83static inline void tegra_gpio_writel(u32 val, u32 reg) 86static inline void tegra_gpio_writel(u32 val, u32 reg)
@@ -333,6 +336,26 @@ static struct irq_chip tegra_gpio_irq_chip = {
333#endif 336#endif
334}; 337};
335 338
339struct tegra_gpio_soc_config {
340 u32 bank_stride;
341 u32 upper_offset;
342};
343
344static struct tegra_gpio_soc_config tegra20_gpio_config = {
345 .bank_stride = 0x80,
346 .upper_offset = 0x800,
347};
348
349static struct tegra_gpio_soc_config tegra30_gpio_config = {
350 .bank_stride = 0x100,
351 .upper_offset = 0x80,
352};
353
354static struct of_device_id tegra_gpio_of_match[] __devinitdata = {
355 { .compatible = "nvidia,tegra30-gpio", .data = &tegra30_gpio_config },
356 { .compatible = "nvidia,tegra20-gpio", .data = &tegra20_gpio_config },
357 { },
358};
336 359
337/* This lock class tells lockdep that GPIO irqs are in a different 360/* This lock class tells lockdep that GPIO irqs are in a different
338 * category than their parents, so it won't report false recursion. 361 * category than their parents, so it won't report false recursion.
@@ -341,6 +364,8 @@ static struct lock_class_key gpio_lock_class;
341 364
342static int __devinit tegra_gpio_probe(struct platform_device *pdev) 365static int __devinit tegra_gpio_probe(struct platform_device *pdev)
343{ 366{
367 const struct of_device_id *match;
368 struct tegra_gpio_soc_config *config;
344 int irq_base; 369 int irq_base;
345 struct resource *res; 370 struct resource *res;
346 struct tegra_gpio_bank *bank; 371 struct tegra_gpio_bank *bank;
@@ -348,6 +373,15 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev)
348 int i; 373 int i;
349 int j; 374 int j;
350 375
376 match = of_match_device(tegra_gpio_of_match, &pdev->dev);
377 if (match)
378 config = (struct tegra_gpio_soc_config *)match->data;
379 else
380 config = &tegra20_gpio_config;
381
382 tegra_gpio_bank_stride = config->bank_stride;
383 tegra_gpio_upper_offset = config->upper_offset;
384
351 for (;;) { 385 for (;;) {
352 res = platform_get_resource(pdev, IORESOURCE_IRQ, tegra_gpio_bank_count); 386 res = platform_get_resource(pdev, IORESOURCE_IRQ, tegra_gpio_bank_count);
353 if (!res) 387 if (!res)
@@ -402,7 +436,7 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev)
402 return -ENODEV; 436 return -ENODEV;
403 } 437 }
404 438
405 for (i = 0; i < 7; i++) { 439 for (i = 0; i < tegra_gpio_bank_count; i++) {
406 for (j = 0; j < 4; j++) { 440 for (j = 0; j < 4; j++) {
407 int gpio = tegra_gpio_compose(i, j, 0); 441 int gpio = tegra_gpio_compose(i, j, 0);
408 tegra_gpio_writel(0x00, GPIO_INT_ENB(gpio)); 442 tegra_gpio_writel(0x00, GPIO_INT_ENB(gpio));
@@ -441,11 +475,6 @@ static int __devinit tegra_gpio_probe(struct platform_device *pdev)
441 return 0; 475 return 0;
442} 476}
443 477
444static struct of_device_id tegra_gpio_of_match[] __devinitdata = {
445 { .compatible = "nvidia,tegra20-gpio", },
446 { },
447};
448
449static struct platform_driver tegra_gpio_driver = { 478static struct platform_driver tegra_gpio_driver = {
450 .driver = { 479 .driver = {
451 .name = "tegra-gpio", 480 .name = "tegra-gpio",
@@ -485,7 +514,7 @@ static int dbg_gpio_show(struct seq_file *s, void *unused)
485 int i; 514 int i;
486 int j; 515 int j;
487 516
488 for (i = 0; i < 7; i++) { 517 for (i = 0; i < tegra_gpio_bank_count; i++) {
489 for (j = 0; j < 4; j++) { 518 for (j = 0; j < 4; j++) {
490 int gpio = tegra_gpio_compose(i, j, 0); 519 int gpio = tegra_gpio_compose(i, j, 0);
491 seq_printf(s, 520 seq_printf(s,
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 19f318ababa2..cf14c95a6700 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/of.h>
16#include <linux/of_platform.h> 17#include <linux/of_platform.h>
17 18
18/* interface and function clocks */ 19/* interface and function clocks */
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index db8963f5fbce..09f597ad6e00 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -27,6 +27,10 @@
27#error "CONFIG_ARCH_AT91 must be defined." 27#error "CONFIG_ARCH_AT91 must be defined."
28#endif 28#endif
29 29
30#define valid_port(index) ((index) >= 0 && (index) < AT91_MAX_USBH_PORTS)
31#define at91_for_each_port(index) \
32 for ((index) = 0; (index) < AT91_MAX_USBH_PORTS; (index)++)
33
30/* interface and function clocks; sometimes also an AHB clock */ 34/* interface and function clocks; sometimes also an AHB clock */
31static struct clk *iclk, *fclk, *hclk; 35static struct clk *iclk, *fclk, *hclk;
32static int clocked; 36static int clocked;
@@ -240,26 +244,26 @@ ohci_at91_start (struct usb_hcd *hcd)
240 244
241static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable) 245static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable)
242{ 246{
243 if (port < 0 || port >= 2) 247 if (!valid_port(port))
244 return; 248 return;
245 249
246 if (!gpio_is_valid(pdata->vbus_pin[port])) 250 if (!gpio_is_valid(pdata->vbus_pin[port]))
247 return; 251 return;
248 252
249 gpio_set_value(pdata->vbus_pin[port], 253 gpio_set_value(pdata->vbus_pin[port],
250 !pdata->vbus_pin_active_low[port] ^ enable); 254 pdata->vbus_pin_active_low[port] ^ enable);
251} 255}
252 256
253static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port) 257static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
254{ 258{
255 if (port < 0 || port >= 2) 259 if (!valid_port(port))
256 return -EINVAL; 260 return -EINVAL;
257 261
258 if (!gpio_is_valid(pdata->vbus_pin[port])) 262 if (!gpio_is_valid(pdata->vbus_pin[port]))
259 return -EINVAL; 263 return -EINVAL;
260 264
261 return gpio_get_value(pdata->vbus_pin[port]) ^ 265 return gpio_get_value(pdata->vbus_pin[port]) ^
262 !pdata->vbus_pin_active_low[port]; 266 pdata->vbus_pin_active_low[port];
263} 267}
264 268
265/* 269/*
@@ -271,9 +275,9 @@ static int ohci_at91_hub_status_data(struct usb_hcd *hcd, char *buf)
271 int length = ohci_hub_status_data(hcd, buf); 275 int length = ohci_hub_status_data(hcd, buf);
272 int port; 276 int port;
273 277
274 for (port = 0; port < ARRAY_SIZE(pdata->overcurrent_pin); port++) { 278 at91_for_each_port(port) {
275 if (pdata->overcurrent_changed[port]) { 279 if (pdata->overcurrent_changed[port]) {
276 if (! length) 280 if (!length)
277 length = 1; 281 length = 1;
278 buf[0] |= 1 << (port + 1); 282 buf[0] |= 1 << (port + 1);
279 } 283 }
@@ -297,11 +301,17 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
297 "ohci_at91_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n", 301 "ohci_at91_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n",
298 hcd, typeReq, wValue, wIndex, buf, wLength); 302 hcd, typeReq, wValue, wIndex, buf, wLength);
299 303
304 wIndex--;
305
300 switch (typeReq) { 306 switch (typeReq) {
301 case SetPortFeature: 307 case SetPortFeature:
302 if (wValue == USB_PORT_FEAT_POWER) { 308 if (wValue == USB_PORT_FEAT_POWER) {
303 dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n"); 309 dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
304 ohci_at91_usb_set_power(pdata, wIndex - 1, 1); 310 if (valid_port(wIndex)) {
311 ohci_at91_usb_set_power(pdata, wIndex, 1);
312 ret = 0;
313 }
314
305 goto out; 315 goto out;
306 } 316 }
307 break; 317 break;
@@ -312,9 +322,9 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
312 dev_dbg(hcd->self.controller, 322 dev_dbg(hcd->self.controller,
313 "ClearPortFeature: C_OVER_CURRENT\n"); 323 "ClearPortFeature: C_OVER_CURRENT\n");
314 324
315 if (wIndex == 1 || wIndex == 2) { 325 if (valid_port(wIndex)) {
316 pdata->overcurrent_changed[wIndex-1] = 0; 326 pdata->overcurrent_changed[wIndex] = 0;
317 pdata->overcurrent_status[wIndex-1] = 0; 327 pdata->overcurrent_status[wIndex] = 0;
318 } 328 }
319 329
320 goto out; 330 goto out;
@@ -323,9 +333,8 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
323 dev_dbg(hcd->self.controller, 333 dev_dbg(hcd->self.controller,
324 "ClearPortFeature: OVER_CURRENT\n"); 334 "ClearPortFeature: OVER_CURRENT\n");
325 335
326 if (wIndex == 1 || wIndex == 2) { 336 if (valid_port(wIndex))
327 pdata->overcurrent_status[wIndex-1] = 0; 337 pdata->overcurrent_status[wIndex] = 0;
328 }
329 338
330 goto out; 339 goto out;
331 340
@@ -333,15 +342,15 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
333 dev_dbg(hcd->self.controller, 342 dev_dbg(hcd->self.controller,
334 "ClearPortFeature: POWER\n"); 343 "ClearPortFeature: POWER\n");
335 344
336 if (wIndex == 1 || wIndex == 2) { 345 if (valid_port(wIndex)) {
337 ohci_at91_usb_set_power(pdata, wIndex - 1, 0); 346 ohci_at91_usb_set_power(pdata, wIndex, 0);
338 return 0; 347 return 0;
339 } 348 }
340 } 349 }
341 break; 350 break;
342 } 351 }
343 352
344 ret = ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength); 353 ret = ohci_hub_control(hcd, typeReq, wValue, wIndex + 1, buf, wLength);
345 if (ret) 354 if (ret)
346 goto out; 355 goto out;
347 356
@@ -377,18 +386,15 @@ static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
377 386
378 dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex); 387 dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex);
379 388
380 if (wIndex == 1 || wIndex == 2) { 389 if (valid_port(wIndex)) {
381 if (! ohci_at91_usb_get_power(pdata, wIndex-1)) { 390 if (!ohci_at91_usb_get_power(pdata, wIndex))
382 *data &= ~cpu_to_le32(RH_PS_PPS); 391 *data &= ~cpu_to_le32(RH_PS_PPS);
383 }
384 392
385 if (pdata->overcurrent_changed[wIndex-1]) { 393 if (pdata->overcurrent_changed[wIndex])
386 *data |= cpu_to_le32(RH_PS_OCIC); 394 *data |= cpu_to_le32(RH_PS_OCIC);
387 }
388 395
389 if (pdata->overcurrent_status[wIndex-1]) { 396 if (pdata->overcurrent_status[wIndex])
390 *data |= cpu_to_le32(RH_PS_POCI); 397 *data |= cpu_to_le32(RH_PS_POCI);
391 }
392 } 398 }
393 } 399 }
394 400
@@ -450,14 +456,14 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data)
450 456
451 /* From the GPIO notifying the over-current situation, find 457 /* From the GPIO notifying the over-current situation, find
452 * out the corresponding port */ 458 * out the corresponding port */
453 for (port = 0; port < ARRAY_SIZE(pdata->overcurrent_pin); port++) { 459 at91_for_each_port(port) {
454 if (gpio_to_irq(pdata->overcurrent_pin[port]) == irq) { 460 if (gpio_to_irq(pdata->overcurrent_pin[port]) == irq) {
455 gpio = pdata->overcurrent_pin[port]; 461 gpio = pdata->overcurrent_pin[port];
456 break; 462 break;
457 } 463 }
458 } 464 }
459 465
460 if (port == ARRAY_SIZE(pdata->overcurrent_pin)) { 466 if (port == AT91_MAX_USBH_PORTS) {
461 dev_err(& pdev->dev, "overcurrent interrupt from unknown GPIO\n"); 467 dev_err(& pdev->dev, "overcurrent interrupt from unknown GPIO\n");
462 return IRQ_HANDLED; 468 return IRQ_HANDLED;
463 } 469 }
@@ -467,7 +473,7 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data)
467 /* When notified of an over-current situation, disable power 473 /* When notified of an over-current situation, disable power
468 on the corresponding port, and mark this port in 474 on the corresponding port, and mark this port in
469 over-current. */ 475 over-current. */
470 if (! val) { 476 if (!val) {
471 ohci_at91_usb_set_power(pdata, port, 0); 477 ohci_at91_usb_set_power(pdata, port, 0);
472 pdata->overcurrent_status[port] = 1; 478 pdata->overcurrent_status[port] = 1;
473 pdata->overcurrent_changed[port] = 1; 479 pdata->overcurrent_changed[port] = 1;
@@ -492,7 +498,7 @@ static u64 at91_ohci_dma_mask = DMA_BIT_MASK(32);
492static int __devinit ohci_at91_of_init(struct platform_device *pdev) 498static int __devinit ohci_at91_of_init(struct platform_device *pdev)
493{ 499{
494 struct device_node *np = pdev->dev.of_node; 500 struct device_node *np = pdev->dev.of_node;
495 int i, ret, gpio; 501 int i, gpio;
496 enum of_gpio_flags flags; 502 enum of_gpio_flags flags;
497 struct at91_usbh_data *pdata; 503 struct at91_usbh_data *pdata;
498 u32 ports; 504 u32 ports;
@@ -514,48 +520,17 @@ static int __devinit ohci_at91_of_init(struct platform_device *pdev)
514 if (!of_property_read_u32(np, "num-ports", &ports)) 520 if (!of_property_read_u32(np, "num-ports", &ports))
515 pdata->ports = ports; 521 pdata->ports = ports;
516 522
517 for (i = 0; i < 2; i++) { 523 at91_for_each_port(i) {
518 gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i, &flags); 524 gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i, &flags);
519 pdata->vbus_pin[i] = gpio; 525 pdata->vbus_pin[i] = gpio;
520 if (!gpio_is_valid(gpio)) 526 if (!gpio_is_valid(gpio))
521 continue; 527 continue;
522 pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW; 528 pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW;
523 ret = gpio_request(gpio, "ohci_vbus");
524 if (ret) {
525 dev_warn(&pdev->dev, "can't request vbus gpio %d", gpio);
526 continue;
527 }
528 ret = gpio_direction_output(gpio, !(flags & OF_GPIO_ACTIVE_LOW) ^ 1);
529 if (ret)
530 dev_warn(&pdev->dev, "can't put vbus gpio %d as output %d",
531 !(flags & OF_GPIO_ACTIVE_LOW) ^ 1, gpio);
532 } 529 }
533 530
534 for (i = 0; i < 2; i++) { 531 at91_for_each_port(i)
535 gpio = of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags); 532 pdata->overcurrent_pin[i] =
536 pdata->overcurrent_pin[i] = gpio; 533 of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);
537 if (!gpio_is_valid(gpio))
538 continue;
539 ret = gpio_request(gpio, "ohci_overcurrent");
540 if (ret) {
541 dev_err(&pdev->dev, "can't request overcurrent gpio %d", gpio);
542 continue;
543 }
544
545 ret = gpio_direction_input(gpio);
546 if (ret) {
547 dev_err(&pdev->dev, "can't configure overcurrent gpio %d as input", gpio);
548 continue;
549 }
550
551 ret = request_irq(gpio_to_irq(gpio),
552 ohci_hcd_at91_overcurrent_irq,
553 IRQF_SHARED, "ohci_overcurrent", pdev);
554 if (ret) {
555 gpio_free(gpio);
556 dev_warn(& pdev->dev, "cannot get GPIO IRQ for overcurrent\n");
557 }
558 }
559 534
560 pdev->dev.platform_data = pdata; 535 pdev->dev.platform_data = pdata;
561 536
@@ -574,35 +549,69 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
574{ 549{
575 struct at91_usbh_data *pdata; 550 struct at91_usbh_data *pdata;
576 int i; 551 int i;
552 int gpio;
553 int ret;
577 554
578 i = ohci_at91_of_init(pdev); 555 ret = ohci_at91_of_init(pdev);
579 556 if (ret)
580 if (i) 557 return ret;
581 return i;
582 558
583 pdata = pdev->dev.platform_data; 559 pdata = pdev->dev.platform_data;
584 560
585 if (pdata) { 561 if (pdata) {
586 for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { 562 at91_for_each_port(i) {
587 if (!gpio_is_valid(pdata->vbus_pin[i])) 563 if (!gpio_is_valid(pdata->vbus_pin[i]))
588 continue; 564 continue;
589 gpio_request(pdata->vbus_pin[i], "ohci_vbus"); 565 gpio = pdata->vbus_pin[i];
566
567 ret = gpio_request(gpio, "ohci_vbus");
568 if (ret) {
569 dev_err(&pdev->dev,
570 "can't request vbus gpio %d\n", gpio);
571 continue;
572 }
573 ret = gpio_direction_output(gpio,
574 !pdata->vbus_pin_active_low[i]);
575 if (ret) {
576 dev_err(&pdev->dev,
577 "can't put vbus gpio %d as output %d\n",
578 gpio, !pdata->vbus_pin_active_low[i]);
579 gpio_free(gpio);
580 continue;
581 }
582
590 ohci_at91_usb_set_power(pdata, i, 1); 583 ohci_at91_usb_set_power(pdata, i, 1);
591 } 584 }
592 585
593 for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) { 586 at91_for_each_port(i) {
594 int ret;
595
596 if (!gpio_is_valid(pdata->overcurrent_pin[i])) 587 if (!gpio_is_valid(pdata->overcurrent_pin[i]))
597 continue; 588 continue;
598 gpio_request(pdata->overcurrent_pin[i], "ohci_overcurrent"); 589 gpio = pdata->overcurrent_pin[i];
590
591 ret = gpio_request(gpio, "ohci_overcurrent");
592 if (ret) {
593 dev_err(&pdev->dev,
594 "can't request overcurrent gpio %d\n",
595 gpio);
596 continue;
597 }
598
599 ret = gpio_direction_input(gpio);
600 if (ret) {
601 dev_err(&pdev->dev,
602 "can't configure overcurrent gpio %d as input\n",
603 gpio);
604 gpio_free(gpio);
605 continue;
606 }
599 607
600 ret = request_irq(gpio_to_irq(pdata->overcurrent_pin[i]), 608 ret = request_irq(gpio_to_irq(gpio),
601 ohci_hcd_at91_overcurrent_irq, 609 ohci_hcd_at91_overcurrent_irq,
602 IRQF_SHARED, "ohci_overcurrent", pdev); 610 IRQF_SHARED, "ohci_overcurrent", pdev);
603 if (ret) { 611 if (ret) {
604 gpio_free(pdata->overcurrent_pin[i]); 612 gpio_free(gpio);
605 dev_warn(& pdev->dev, "cannot get GPIO IRQ for overcurrent\n"); 613 dev_err(&pdev->dev,
614 "can't get gpio IRQ for overcurrent\n");
606 } 615 }
607 } 616 }
608 } 617 }
@@ -617,14 +626,14 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *pdev)
617 int i; 626 int i;
618 627
619 if (pdata) { 628 if (pdata) {
620 for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { 629 at91_for_each_port(i) {
621 if (!gpio_is_valid(pdata->vbus_pin[i])) 630 if (!gpio_is_valid(pdata->vbus_pin[i]))
622 continue; 631 continue;
623 ohci_at91_usb_set_power(pdata, i, 0); 632 ohci_at91_usb_set_power(pdata, i, 0);
624 gpio_free(pdata->vbus_pin[i]); 633 gpio_free(pdata->vbus_pin[i]);
625 } 634 }
626 635
627 for (i = 0; i < ARRAY_SIZE(pdata->overcurrent_pin); i++) { 636 at91_for_each_port(i) {
628 if (!gpio_is_valid(pdata->overcurrent_pin[i])) 637 if (!gpio_is_valid(pdata->overcurrent_pin[i]))
629 continue; 638 continue;
630 free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev); 639 free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev);
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c
index be20b5cbe26c..3a6d5419e3e3 100644
--- a/drivers/video/backlight/locomolcd.c
+++ b/drivers/video/backlight/locomolcd.c
@@ -229,14 +229,7 @@ static struct locomo_driver poodle_lcd_driver = {
229 229
230static int __init locomolcd_init(void) 230static int __init locomolcd_init(void)
231{ 231{
232 int ret = locomo_driver_register(&poodle_lcd_driver); 232 return locomo_driver_register(&poodle_lcd_driver);
233 if (ret)
234 return ret;
235
236#ifdef CONFIG_SA1100_COLLIE
237 sa1100fb_lcd_power = locomolcd_power;
238#endif
239 return 0;
240} 233}
241 234
242static void __exit locomolcd_exit(void) 235static void __exit locomolcd_exit(void)