diff options
author | Andrew Victor <andrew@sanpeople.com> | 2006-02-22 16:23:35 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-02-22 16:23:35 -0500 |
commit | df666b9c510fd27fd3b1afd9ddfa1eaa62ce12b3 (patch) | |
tree | 825879502f74636641a86724514f2ea4e3c9c240 | |
parent | 43cc19816b3fc5286258e6f5e43ef4ead458f9a3 (diff) |
[ARM] 3325/2: GPIO function to control multi-drive (open collector) capability
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>
-rw-r--r-- | arch/arm/mach-at91rm9200/devices.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-at91rm9200/gpio.c | 17 | ||||
-rw-r--r-- | include/asm-arm/arch-at91rm9200/gpio.h | 1 |
3 files changed, 21 insertions, 1 deletions
diff --git a/arch/arm/mach-at91rm9200/devices.c b/arch/arm/mach-at91rm9200/devices.c index 8df3e5245651..57eedd5beaf6 100644 --- a/arch/arm/mach-at91rm9200/devices.c +++ b/arch/arm/mach-at91rm9200/devices.c | |||
@@ -100,8 +100,10 @@ void __init at91_add_device_udc(struct at91_udc_data *data) | |||
100 | at91_set_gpio_input(data->vbus_pin, 0); | 100 | at91_set_gpio_input(data->vbus_pin, 0); |
101 | at91_set_deglitch(data->vbus_pin, 1); | 101 | at91_set_deglitch(data->vbus_pin, 1); |
102 | } | 102 | } |
103 | if (data->pullup_pin) | 103 | if (data->pullup_pin) { |
104 | at91_set_gpio_output(data->pullup_pin, 0); | 104 | at91_set_gpio_output(data->pullup_pin, 0); |
105 | at91_set_multi_drive(data->pullup_pin, 1); | ||
106 | } | ||
105 | 107 | ||
106 | udc_data = *data; | 108 | udc_data = *data; |
107 | platform_device_register(&at91rm9200_udc_device); | 109 | platform_device_register(&at91rm9200_udc_device); |
diff --git a/arch/arm/mach-at91rm9200/gpio.c b/arch/arm/mach-at91rm9200/gpio.c index 2fd2ef583e4d..a9f718bf8ba8 100644 --- a/arch/arm/mach-at91rm9200/gpio.c +++ b/arch/arm/mach-at91rm9200/gpio.c | |||
@@ -159,6 +159,23 @@ int __init_or_module at91_set_deglitch(unsigned pin, int is_on) | |||
159 | } | 159 | } |
160 | EXPORT_SYMBOL(at91_set_deglitch); | 160 | EXPORT_SYMBOL(at91_set_deglitch); |
161 | 161 | ||
162 | /* | ||
163 | * enable/disable the multi-driver; This is only valid for output and | ||
164 | * allows the output pin to run as an open collector output. | ||
165 | */ | ||
166 | int __init_or_module at91_set_multi_drive(unsigned pin, int is_on) | ||
167 | { | ||
168 | void __iomem *pio = pin_to_controller(pin); | ||
169 | unsigned mask = pin_to_mask(pin); | ||
170 | |||
171 | if (!pio) | ||
172 | return -EINVAL; | ||
173 | |||
174 | __raw_writel(mask, pio + (is_on ? PIO_MDER : PIO_MDDR)); | ||
175 | return 0; | ||
176 | } | ||
177 | EXPORT_SYMBOL(at91_set_multi_drive); | ||
178 | |||
162 | /*--------------------------------------------------------------------------*/ | 179 | /*--------------------------------------------------------------------------*/ |
163 | 180 | ||
164 | 181 | ||
diff --git a/include/asm-arm/arch-at91rm9200/gpio.h b/include/asm-arm/arch-at91rm9200/gpio.h index 0f0a61e2f129..6176ab2dc417 100644 --- a/include/asm-arm/arch-at91rm9200/gpio.h +++ b/include/asm-arm/arch-at91rm9200/gpio.h | |||
@@ -183,6 +183,7 @@ extern int at91_set_B_periph(unsigned pin, int use_pullup); | |||
183 | extern int at91_set_gpio_input(unsigned pin, int use_pullup); | 183 | extern int at91_set_gpio_input(unsigned pin, int use_pullup); |
184 | extern int at91_set_gpio_output(unsigned pin, int value); | 184 | extern int at91_set_gpio_output(unsigned pin, int value); |
185 | extern int at91_set_deglitch(unsigned pin, int is_on); | 185 | extern int at91_set_deglitch(unsigned pin, int is_on); |
186 | extern int at91_set_multi_drive(unsigned pin, int is_on); | ||
186 | 187 | ||
187 | /* callable at any time */ | 188 | /* callable at any time */ |
188 | extern int at91_set_gpio_value(unsigned pin, int value); | 189 | extern int at91_set_gpio_value(unsigned pin, int value); |