at91: at91-ohci: configure overcurrent pins as input GPIOs
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Wed, 13 Jul 2011 09:29:18 +0000 (11:29 +0200)
committerArnd Bergmann <arnd@arndb.de>
Sat, 10 Sep 2011 21:03:13 +0000 (23:03 +0200)
As a new overcurrent_pin[] array has been added to the at91_usbh_data
structure, those pins must be muxed to work properly. This commit
implements this muxing for all AT91 SoCs that support the AT91 OHCI.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[nicolas.ferre@atmel.com: added i variable declaration for the loop]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
arch/arm/mach-at91/at91cap9_devices.c
arch/arm/mach-at91/at91rm9200_devices.c
arch/arm/mach-at91/at91sam9260_devices.c
arch/arm/mach-at91/at91sam9261_devices.c
arch/arm/mach-at91/at91sam9263_devices.c
arch/arm/mach-at91/at91sam9g45_devices.c

index dba0d8d..b46615a 100644 (file)
@@ -80,6 +80,12 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
                        at91_set_gpio_output(data->vbus_pin[i], 0);
        }
 
+       /* Enable overcurrent notification */
+       for (i = 0; i < data->ports; i++) {
+               if (data->overcurrent_pin[i])
+                       at91_set_gpio_input(data->overcurrent_pin[i], 1);
+       }
+
        usbh_data = *data;
        platform_device_register(&at91_usbh_device);
 }
index 7227755..3f27113 100644 (file)
@@ -60,9 +60,17 @@ static struct platform_device at91rm9200_usbh_device = {
 
 void __init at91_add_device_usbh(struct at91_usbh_data *data)
 {
+       int i;
+
        if (!data)
                return;
 
+       /* Enable overcurrent notification */
+       for (i = 0; i < data->ports; i++) {
+               if (data->overcurrent_pin[i])
+                       at91_set_gpio_input(data->overcurrent_pin[i], 1);
+       }
+
        usbh_data = *data;
        platform_device_register(&at91rm9200_usbh_device);
 }
index 39f81f4..344075f 100644 (file)
@@ -61,9 +61,17 @@ static struct platform_device at91_usbh_device = {
 
 void __init at91_add_device_usbh(struct at91_usbh_data *data)
 {
+       int i;
+
        if (!data)
                return;
 
+       /* Enable overcurrent notification */
+       for (i = 0; i < data->ports; i++) {
+               if (data->overcurrent_pin[i])
+                       at91_set_gpio_input(data->overcurrent_pin[i], 1);
+       }
+
        usbh_data = *data;
        platform_device_register(&at91_usbh_device);
 }
index 0f91792..3b8fb79 100644 (file)
@@ -64,9 +64,17 @@ static struct platform_device at91sam9261_usbh_device = {
 
 void __init at91_add_device_usbh(struct at91_usbh_data *data)
 {
+       int i;
+
        if (!data)
                return;
 
+       /* Enable overcurrent notification */
+       for (i = 0; i < data->ports; i++) {
+               if (data->overcurrent_pin[i])
+                       at91_set_gpio_input(data->overcurrent_pin[i], 1);
+       }
+
        usbh_data = *data;
        platform_device_register(&at91sam9261_usbh_device);
 }
index a050f41..d4aef76 100644 (file)
@@ -74,6 +74,12 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data)
                        at91_set_gpio_output(data->vbus_pin[i], 0);
        }
 
+       /* Enable overcurrent notification */
+       for (i = 0; i < data->ports; i++) {
+               if (data->overcurrent_pin[i])
+                       at91_set_gpio_input(data->overcurrent_pin[i], 1);
+       }
+
        usbh_data = *data;
        platform_device_register(&at91_usbh_device);
 }
index 600bffb..e4a9857 100644 (file)
@@ -124,6 +124,12 @@ void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data)
                        at91_set_gpio_output(data->vbus_pin[i], 0);
        }
 
+       /* Enable overcurrent notification */
+       for (i = 0; i < data->ports; i++) {
+               if (data->overcurrent_pin[i])
+                       at91_set_gpio_input(data->overcurrent_pin[i], 1);
+       }
+
        usbh_ohci_data = *data;
        platform_device_register(&at91_usbh_ohci_device);
 }