1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
Index: linux-2.6.35/arch/arm/mach-at91/gpio.c
===================================================================
--- linux-2.6.35.orig/arch/arm/mach-at91/gpio.c 2011-09-27 14:36:06.587267689 -0500
+++ linux-2.6.35/arch/arm/mach-at91/gpio.c 2011-09-27 14:42:50.997576753 -0500
@@ -202,6 +202,26 @@
}
EXPORT_SYMBOL(at91_set_gpio_output);
+/*
+ * configure pin for output and enable/disable pullup
+ */
+int __init_or_module at91_set_gpio_output_with_pullup(unsigned pin, int value, int use_pullup)
+{
+ void __iomem *pio = pin_to_controller(pin);
+ unsigned mask = pin_to_mask(pin);
+
+ if (!pio)
+ return -EINVAL;
+
+ __raw_writel(mask, pio + PIO_IDR);
+ __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
+ __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR));
+ __raw_writel(mask, pio + PIO_OER);
+ __raw_writel(mask, pio + PIO_PER);
+ return 0;
+}
+EXPORT_SYMBOL(at91_set_gpio_output_with_pullup);
+
/*
* enable/disable the glitch filter; mostly used with IRQ handling.
Index: linux-2.6.35/arch/arm/mach-at91/include/mach/gpio.h
===================================================================
--- linux-2.6.35.orig/arch/arm/mach-at91/include/mach/gpio.h
+++ linux-2.6.35/arch/arm/mach-at91/include/mach/gpio.h
@@ -194,6 +194,7 @@ extern int __init_or_module at91_set_A_p
extern int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup);
extern int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup);
extern int __init_or_module at91_set_gpio_output(unsigned pin, int value);
+extern int __init_or_module at91_set_gpio_output_with_pullup(unsigned pin, int value, int use_pullup);
extern int __init_or_module at91_set_deglitch(unsigned pin, int is_on);
extern int __init_or_module at91_set_multi_drive(unsigned pin, int is_on);
|