diff options
| -rw-r--r-- | arch/avr32/mach-at32ap/include/mach/portmux.h | 1 | ||||
| -rw-r--r-- | arch/avr32/mach-at32ap/pio.c | 19 |
2 files changed, 20 insertions, 0 deletions
diff --git a/arch/avr32/mach-at32ap/include/mach/portmux.h b/arch/avr32/mach-at32ap/include/mach/portmux.h index b1abe6b4e4ef..4bbf99ec2c43 100644 --- a/arch/avr32/mach-at32ap/include/mach/portmux.h +++ b/arch/avr32/mach-at32ap/include/mach/portmux.h | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | void at32_select_periph(unsigned int pin, unsigned int periph, | 24 | void at32_select_periph(unsigned int pin, unsigned int periph, |
| 25 | unsigned long flags); | 25 | unsigned long flags); |
| 26 | void at32_select_gpio(unsigned int pin, unsigned long flags); | 26 | void at32_select_gpio(unsigned int pin, unsigned long flags); |
| 27 | void at32_deselect_pin(unsigned int pin); | ||
| 27 | void at32_reserve_pin(unsigned int pin); | 28 | void at32_reserve_pin(unsigned int pin); |
| 28 | 29 | ||
| 29 | #endif /* __ASM_ARCH_PORTMUX_H__ */ | 30 | #endif /* __ASM_ARCH_PORTMUX_H__ */ |
diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c index 405ee6bad4ce..90ef538ae547 100644 --- a/arch/avr32/mach-at32ap/pio.c +++ b/arch/avr32/mach-at32ap/pio.c | |||
| @@ -134,6 +134,25 @@ fail: | |||
| 134 | dump_stack(); | 134 | dump_stack(); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | /* | ||
| 138 | * Undo a previous pin reservation. Will not affect the hardware | ||
| 139 | * configuration. | ||
| 140 | */ | ||
| 141 | void at32_deselect_pin(unsigned int pin) | ||
| 142 | { | ||
| 143 | struct pio_device *pio; | ||
| 144 | unsigned int pin_index = pin & 0x1f; | ||
| 145 | |||
| 146 | pio = gpio_to_pio(pin); | ||
| 147 | if (unlikely(!pio)) { | ||
| 148 | printk("pio: invalid pin %u\n", pin); | ||
| 149 | dump_stack(); | ||
| 150 | return; | ||
| 151 | } | ||
| 152 | |||
| 153 | clear_bit(pin_index, &pio->pinmux_mask); | ||
| 154 | } | ||
| 155 | |||
| 137 | /* Reserve a pin, preventing anyone else from changing its configuration. */ | 156 | /* Reserve a pin, preventing anyone else from changing its configuration. */ |
| 138 | void __init at32_reserve_pin(unsigned int pin) | 157 | void __init at32_reserve_pin(unsigned int pin) |
| 139 | { | 158 | { |
