Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost
[cris-mirror.git] / include / linux / platform_data / gpio-davinci.h
blob90ae19ca828f70927a13cb593aba39d52cf188cf
1 /*
2 * DaVinci GPIO Platform Related Defines
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #ifndef __DAVINCI_GPIO_PLATFORM_H
17 #define __DAVINCI_GPIO_PLATFORM_H
19 #include <linux/io.h>
20 #include <linux/spinlock.h>
22 #include <asm-generic/gpio.h>
24 #define MAX_REGS_BANKS 5
26 struct davinci_gpio_platform_data {
27 u32 ngpio;
28 u32 gpio_unbanked;
31 struct davinci_gpio_irq_data {
32 void __iomem *regs;
33 struct davinci_gpio_controller *chip;
34 int bank_num;
37 struct davinci_gpio_controller {
38 struct gpio_chip chip;
39 struct irq_domain *irq_domain;
40 /* Serialize access to GPIO registers */
41 spinlock_t lock;
42 void __iomem *regs[MAX_REGS_BANKS];
43 int gpio_unbanked;
44 unsigned int base_irq;
45 unsigned int base;
49 * basic gpio routines
51 #define GPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
53 /* Convert GPIO signal to GPIO pin number */
54 #define GPIO_TO_PIN(bank, gpio) (16 * (bank) + (gpio))
56 static inline u32 __gpio_mask(unsigned gpio)
58 return 1 << (gpio % 32);
60 #endif