提交 df666b9c 编写于 作者: A Andrew Victor 提交者: Russell King

[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: NAndrew Victor <andrew@sanpeople.com>
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 43cc1981
...@@ -100,8 +100,10 @@ void __init at91_add_device_udc(struct at91_udc_data *data) ...@@ -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_gpio_input(data->vbus_pin, 0);
at91_set_deglitch(data->vbus_pin, 1); 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_gpio_output(data->pullup_pin, 0);
at91_set_multi_drive(data->pullup_pin, 1);
}
udc_data = *data; udc_data = *data;
platform_device_register(&at91rm9200_udc_device); platform_device_register(&at91rm9200_udc_device);
......
...@@ -159,6 +159,23 @@ int __init_or_module at91_set_deglitch(unsigned pin, int is_on) ...@@ -159,6 +159,23 @@ int __init_or_module at91_set_deglitch(unsigned pin, int is_on)
} }
EXPORT_SYMBOL(at91_set_deglitch); 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);
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
......
...@@ -183,6 +183,7 @@ extern int at91_set_B_periph(unsigned pin, int use_pullup); ...@@ -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_input(unsigned pin, int use_pullup);
extern int at91_set_gpio_output(unsigned pin, int value); extern int at91_set_gpio_output(unsigned pin, int value);
extern int at91_set_deglitch(unsigned pin, int is_on); 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 */ /* callable at any time */
extern int at91_set_gpio_value(unsigned pin, int value); extern int at91_set_gpio_value(unsigned pin, int value);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册