Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 47022
b: refs/heads/master
c: e7f70b8
h: refs/heads/master
v: v3
  • Loading branch information
Haavard Skinnemoen committed Feb 9, 2007
1 parent 7bcdbf6 commit 80fd80d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dde251033f3e54619317269a908ce40e6f3a8d04
refs/heads/master: e7f70b8cc69b1bcc56ed8d70f8e3671ec3956374
23 changes: 22 additions & 1 deletion trunk/arch/avr32/mach-at32ap/pio.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,28 @@ void __init at32_select_gpio(unsigned int pin, unsigned long flags)
dump_stack();
}

/*--------------------------------------------------------------------------*/
/* Reserve a pin, preventing anyone else from changing its configuration. */
void __init at32_reserve_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);
goto fail;
}

if (unlikely(test_and_set_bit(pin_index, &pio->pinmux_mask))) {
printk("%s: pin %u is busy\n", pio->name, pin_index);
goto fail;
}

return;

fail:
dump_stack();
}

/*--------------------------------------------------------------------------*/

Expand Down
1 change: 1 addition & 0 deletions trunk/include/asm-avr32/arch-at32ap/portmux.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
void at32_select_periph(unsigned int pin, unsigned int periph,
unsigned long flags);
void at32_select_gpio(unsigned int pin, unsigned long flags);
void at32_reserve_pin(unsigned int pin);

#endif /* __ASM_ARCH_PORTMUX_H__ */

0 comments on commit 80fd80d

Please sign in to comment.