aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32/mach-at32ap/pio.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/avr32/mach-at32ap/pio.c')
-rw-r--r--arch/avr32/mach-at32ap/pio.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c
index c3f596ce5267..9ba5654cde11 100644
--- a/arch/avr32/mach-at32ap/pio.c
+++ b/arch/avr32/mach-at32ap/pio.c
@@ -135,7 +135,28 @@ fail:
135 dump_stack(); 135 dump_stack();
136} 136}
137 137
138/*--------------------------------------------------------------------------*/ 138/* Reserve a pin, preventing anyone else from changing its configuration. */
139void __init at32_reserve_pin(unsigned int pin)
140{
141 struct pio_device *pio;
142 unsigned int pin_index = pin & 0x1f;
143
144 pio = gpio_to_pio(pin);
145 if (unlikely(!pio)) {
146 printk("pio: invalid pin %u\n", pin);
147 goto fail;
148 }
149
150 if (unlikely(test_and_set_bit(pin_index, &pio->pinmux_mask))) {
151 printk("%s: pin %u is busy\n", pio->name, pin_index);
152 goto fail;
153 }
154
155 return;
156
157fail:
158 dump_stack();
159}
139 160
140/*--------------------------------------------------------------------------*/ 161/*--------------------------------------------------------------------------*/
141 162