gpio: davinci: Move driver local definitions to driver
These defines, structs and inline functions are used only internally by the driver, they do not belong in platform_data. Move them. Signed-off-by: Andrew F. Davis <afd@ti.com> Tested-by: Keerthy <j-keerthy@ti.com> Acked-by: Keerthy <j-keerthy@ti.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>hifive-unleashed-5.1
parent
c36219d9d8
commit
79b73ff9b2
|
@ -9,6 +9,7 @@
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/gpio/driver.h>
|
#include <linux/gpio/driver.h>
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
@ -24,6 +25,12 @@
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/platform_data/gpio-davinci.h>
|
#include <linux/platform_data/gpio-davinci.h>
|
||||||
#include <linux/irqchip/chained_irq.h>
|
#include <linux/irqchip/chained_irq.h>
|
||||||
|
#include <linux/spinlock.h>
|
||||||
|
|
||||||
|
#include <asm-generic/gpio.h>
|
||||||
|
|
||||||
|
#define MAX_REGS_BANKS 5
|
||||||
|
#define MAX_INT_PER_BANK 32
|
||||||
|
|
||||||
struct davinci_gpio_regs {
|
struct davinci_gpio_regs {
|
||||||
u32 dir;
|
u32 dir;
|
||||||
|
@ -45,6 +52,27 @@ typedef struct irq_chip *(*gpio_get_irq_chip_cb_t)(unsigned int irq);
|
||||||
static void __iomem *gpio_base;
|
static void __iomem *gpio_base;
|
||||||
static unsigned int offset_array[5] = {0x10, 0x38, 0x60, 0x88, 0xb0};
|
static unsigned int offset_array[5] = {0x10, 0x38, 0x60, 0x88, 0xb0};
|
||||||
|
|
||||||
|
struct davinci_gpio_irq_data {
|
||||||
|
void __iomem *regs;
|
||||||
|
struct davinci_gpio_controller *chip;
|
||||||
|
int bank_num;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct davinci_gpio_controller {
|
||||||
|
struct gpio_chip chip;
|
||||||
|
struct irq_domain *irq_domain;
|
||||||
|
/* Serialize access to GPIO registers */
|
||||||
|
spinlock_t lock;
|
||||||
|
void __iomem *regs[MAX_REGS_BANKS];
|
||||||
|
int gpio_unbanked;
|
||||||
|
int irqs[MAX_INT_PER_BANK];
|
||||||
|
};
|
||||||
|
|
||||||
|
static inline u32 __gpio_mask(unsigned gpio)
|
||||||
|
{
|
||||||
|
return 1 << (gpio % 32);
|
||||||
|
}
|
||||||
|
|
||||||
static inline struct davinci_gpio_regs __iomem *irq2regs(struct irq_data *d)
|
static inline struct davinci_gpio_regs __iomem *irq2regs(struct irq_data *d)
|
||||||
{
|
{
|
||||||
struct davinci_gpio_regs __iomem *g;
|
struct davinci_gpio_regs __iomem *g;
|
||||||
|
|
|
@ -16,40 +16,12 @@
|
||||||
#ifndef __DAVINCI_GPIO_PLATFORM_H
|
#ifndef __DAVINCI_GPIO_PLATFORM_H
|
||||||
#define __DAVINCI_GPIO_PLATFORM_H
|
#define __DAVINCI_GPIO_PLATFORM_H
|
||||||
|
|
||||||
#include <linux/io.h>
|
|
||||||
#include <linux/spinlock.h>
|
|
||||||
|
|
||||||
#include <asm-generic/gpio.h>
|
|
||||||
|
|
||||||
#define MAX_REGS_BANKS 5
|
|
||||||
#define MAX_INT_PER_BANK 32
|
|
||||||
|
|
||||||
struct davinci_gpio_platform_data {
|
struct davinci_gpio_platform_data {
|
||||||
u32 ngpio;
|
u32 ngpio;
|
||||||
u32 gpio_unbanked;
|
u32 gpio_unbanked;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct davinci_gpio_irq_data {
|
|
||||||
void __iomem *regs;
|
|
||||||
struct davinci_gpio_controller *chip;
|
|
||||||
int bank_num;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct davinci_gpio_controller {
|
|
||||||
struct gpio_chip chip;
|
|
||||||
struct irq_domain *irq_domain;
|
|
||||||
/* Serialize access to GPIO registers */
|
|
||||||
spinlock_t lock;
|
|
||||||
void __iomem *regs[MAX_REGS_BANKS];
|
|
||||||
int gpio_unbanked;
|
|
||||||
int irqs[MAX_INT_PER_BANK];
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Convert GPIO signal to GPIO pin number */
|
/* Convert GPIO signal to GPIO pin number */
|
||||||
#define GPIO_TO_PIN(bank, gpio) (16 * (bank) + (gpio))
|
#define GPIO_TO_PIN(bank, gpio) (16 * (bank) + (gpio))
|
||||||
|
|
||||||
static inline u32 __gpio_mask(unsigned gpio)
|
|
||||||
{
|
|
||||||
return 1 << (gpio % 32);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue