summaryrefslogtreecommitdiffstats
path: root/arch/avr32/mach-at32ap/pio.c
diff options
context:
space:
mode:
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-09-19 17:13:28 +0200
committerHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-09-22 09:51:02 +0200
commitece2678c62ce13ef11a8b43526ccc5db8d711ed3 (patch)
tree9b9cc045839f0f2485e6bd2b1af05590805157e8 /arch/avr32/mach-at32ap/pio.c
parent96706600de83966812b01a3cb310a13da2a1a4e9 (diff)
downloadlinux-ece2678c62ce13ef11a8b43526ccc5db8d711ed3.tar.gz
linux-ece2678c62ce13ef11a8b43526ccc5db8d711ed3.tar.bz2
linux-ece2678c62ce13ef11a8b43526ccc5db8d711ed3.zip
avr32: Provide a way to deselect pins in the portmux
Currently, setting up the portmux is completely one-shot: Once a pin is muxed, the portmux driver will complain loudly and refuse to do anything if you try to set up the same pin again. Sometimes, it may be necessary to change the configuration of a pin after it has been set up initially. This patch adds a way to undo the previous configuration, allowing the pin to be reconfigured. Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32/mach-at32ap/pio.c')
-rw-r--r--arch/avr32/mach-at32ap/pio.c19
1 files changed, 19 insertions, 0 deletions
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:
dump_stack();
}
+/*
+ * Undo a previous pin reservation. Will not affect the hardware
+ * configuration.
+ */
+void at32_deselect_pin(unsigned int pin)
+{
+ struct pio_device *pio;
+ unsigned int pin_index = pin & 0x1f;
+
+ pio = gpio_to_pio(pin);
+ if (unlikely(!pio)) {
+ printk("pio: invalid pin %u\n", pin);
+ dump_stack();
+ return;
+ }
+
+ clear_bit(pin_index, &pio->pinmux_mask);
+}
+
/* Reserve a pin, preventing anyone else from changing its configuration. */
void __init at32_reserve_pin(unsigned int pin)
{