]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
[ARM] 3325/2: GPIO function to control multi-drive (open collector) capability
authorAndrew Victor <andrew@sanpeople.com>
Wed, 22 Feb 2006 21:23:35 +0000 (21:23 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 22 Feb 2006 21:23:35 +0000 (21:23 +0000)
Patch from Andrew Victor

This patch adds the at91_set_multi_drive() function to enable/disable
the multi-drive (open collector) pin capability on the AT91RM9200
processor.

This is necessary to fix the UDC (USB Gadget) driver for the AT91RM9200
board as it will not allow the board reset line to be pulled low if the
pullup is not driven as an open collector output as the boards are wired
to the USB connector on both the DK/EK.

This version of the patch updates it to 2.6.16-rc4.
Orignal patch by Jeff Warren.

Signed-off-by: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-at91rm9200/devices.c
arch/arm/mach-at91rm9200/gpio.c
include/asm-arm/arch-at91rm9200/gpio.h

index 8df3e5245651b6b6fe742a41ebdb31f54edc8c48..57eedd5beaf6412c1b152843babf7536ee4c8486 100644 (file)
@@ -100,8 +100,10 @@ void __init at91_add_device_udc(struct at91_udc_data *data)
                at91_set_gpio_input(data->vbus_pin, 0);
                at91_set_deglitch(data->vbus_pin, 1);
        }
-       if (data->pullup_pin)
+       if (data->pullup_pin) {
                at91_set_gpio_output(data->pullup_pin, 0);
+               at91_set_multi_drive(data->pullup_pin, 1);
+       }
 
        udc_data = *data;
        platform_device_register(&at91rm9200_udc_device);
index 2fd2ef583e4d4f596e43fac999f31f445276b6d7..a9f718bf8ba873f064d4f58c10a8884378670ddf 100644 (file)
@@ -159,6 +159,23 @@ int __init_or_module at91_set_deglitch(unsigned pin, int is_on)
 }
 EXPORT_SYMBOL(at91_set_deglitch);
 
+/*
+ * enable/disable the multi-driver; This is only valid for output and
+ * allows the output pin to run as an open collector output.
+ */
+int __init_or_module at91_set_multi_drive(unsigned pin, int is_on)
+{
+       void __iomem    *pio = pin_to_controller(pin);
+       unsigned        mask = pin_to_mask(pin);
+
+       if (!pio)
+               return -EINVAL;
+
+       __raw_writel(mask, pio + (is_on ? PIO_MDER : PIO_MDDR));
+       return 0;
+}
+EXPORT_SYMBOL(at91_set_multi_drive);
+
 /*--------------------------------------------------------------------------*/
 
 
index 0f0a61e2f1294067b5394ca09c7bf46ac7b03769..6176ab2dc4179229c28f2a9ffdad897fa3852870 100644 (file)
@@ -183,6 +183,7 @@ extern int at91_set_B_periph(unsigned pin, int use_pullup);
 extern int at91_set_gpio_input(unsigned pin, int use_pullup);
 extern int at91_set_gpio_output(unsigned pin, int value);
 extern int at91_set_deglitch(unsigned pin, int is_on);
+extern int at91_set_multi_drive(unsigned pin, int is_on);
 
 /* callable at any time */
 extern int at91_set_gpio_value(unsigned pin, int value);