You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[AVR32] GPIO API implementation
Arch-neutral GPIO calls for AVR32. GPIO IRQ support written by David Brownell. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
#ifndef __ASM_AVR32_ARCH_GPIO_H
|
||||
#define __ASM_AVR32_ARCH_GPIO_H
|
||||
|
||||
#include <linux/compiler.h>
|
||||
#include <asm/irq.h>
|
||||
|
||||
|
||||
/* Arch-neutral GPIO API */
|
||||
int __must_check gpio_request(unsigned int gpio, const char *label);
|
||||
void gpio_free(unsigned int gpio);
|
||||
|
||||
int gpio_direction_input(unsigned int gpio);
|
||||
int gpio_direction_output(unsigned int gpio);
|
||||
int gpio_get_value(unsigned int gpio);
|
||||
void gpio_set_value(unsigned int gpio, int value);
|
||||
|
||||
static inline int gpio_to_irq(unsigned int gpio)
|
||||
{
|
||||
return gpio + GPIO_IRQ_BASE;
|
||||
}
|
||||
|
||||
static inline int irq_to_gpio(unsigned int irq)
|
||||
{
|
||||
return irq - GPIO_IRQ_BASE;
|
||||
}
|
||||
|
||||
#endif /* __ASM_AVR32_ARCH_GPIO_H */
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef __ASM_AVR32_ARCH_IRQ_H
|
||||
#define __ASM_AVR32_ARCH_IRQ_H
|
||||
|
||||
#define EIM_IRQ_BASE NR_INTERNAL_IRQS
|
||||
#define NR_EIM_IRQS 32
|
||||
|
||||
#define AT32_EXTINT(n) (EIM_IRQ_BASE + (n))
|
||||
|
||||
#define GPIO_IRQ_BASE (EIM_IRQ_BASE + NR_EIM_IRQS)
|
||||
#define NR_GPIO_IRQS (4 * 32)
|
||||
|
||||
#define NR_IRQS (GPIO_IRQ_BASE + NR_GPIO_IRQS)
|
||||
|
||||
#endif /* __ASM_AVR32_ARCH_IRQ_H */
|
||||
@@ -15,9 +15,10 @@
|
||||
*
|
||||
* The following flags determine the initial state of the pin.
|
||||
*/
|
||||
#define AT32_GPIOF_PULLUP 0x00000001 /* Enable pull-up */
|
||||
#define AT32_GPIOF_OUTPUT 0x00000002 /* Enable output driver */
|
||||
#define AT32_GPIOF_HIGH 0x00000004 /* Set output high */
|
||||
#define AT32_GPIOF_PULLUP 0x00000001 /* (not-OUT) Enable pull-up */
|
||||
#define AT32_GPIOF_OUTPUT 0x00000002 /* (OUT) Enable output driver */
|
||||
#define AT32_GPIOF_HIGH 0x00000004 /* (OUT) Set output high */
|
||||
#define AT32_GPIOF_DEGLITCH 0x00000008 /* (IN) Filter glitches */
|
||||
|
||||
void at32_select_periph(unsigned int pin, unsigned int periph,
|
||||
unsigned long flags);
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef __ASM_AVR32_GPIO_H
|
||||
#define __ASM_AVR32_GPIO_H
|
||||
|
||||
#include <asm/arch/gpio.h>
|
||||
|
||||
#endif /* __ASM_AVR32_GPIO_H */
|
||||
@@ -2,8 +2,12 @@
|
||||
#define __ASM_AVR32_IRQ_H
|
||||
|
||||
#define NR_INTERNAL_IRQS 64
|
||||
#define NR_EXTERNAL_IRQS 64
|
||||
#define NR_IRQS (NR_INTERNAL_IRQS + NR_EXTERNAL_IRQS)
|
||||
|
||||
#include <asm/arch/irq.h>
|
||||
|
||||
#ifndef NR_IRQS
|
||||
#define NR_IRQS (NR_INTERNAL_IRQS)
|
||||
#endif
|
||||
|
||||
#define irq_canonicalize(i) (i)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user