123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- #ifndef __PINCTRL_SAMSUNG_H
- #define __PINCTRL_SAMSUNG_H
- #include <linux/pinctrl/pinctrl.h>
- #include <linux/pinctrl/pinmux.h>
- #include <linux/pinctrl/pinconf.h>
- #include <linux/pinctrl/consumer.h>
- #include <linux/pinctrl/machine.h>
- #include <linux/gpio.h>
- #define FUNC_INPUT 0x0
- #define FUNC_OUTPUT 0x1
- enum pincfg_type {
- PINCFG_TYPE_FUNC,
- PINCFG_TYPE_DAT,
- PINCFG_TYPE_PUD,
- PINCFG_TYPE_DRV,
- PINCFG_TYPE_CON_PDN,
- PINCFG_TYPE_PUD_PDN,
- PINCFG_TYPE_NUM
- };
- #define PINCFG_TYPE_MASK 0xFF
- #define PINCFG_VALUE_SHIFT 8
- #define PINCFG_VALUE_MASK (0xFF << PINCFG_VALUE_SHIFT)
- #define PINCFG_PACK(type, value) (((value) << PINCFG_VALUE_SHIFT) | type)
- #define PINCFG_UNPACK_TYPE(cfg) ((cfg) & PINCFG_TYPE_MASK)
- #define PINCFG_UNPACK_VALUE(cfg) (((cfg) & PINCFG_VALUE_MASK) >> \
- PINCFG_VALUE_SHIFT)
- enum eint_type {
- EINT_TYPE_NONE,
- EINT_TYPE_GPIO,
- EINT_TYPE_WKUP,
- EINT_TYPE_WKUP_MUX,
- };
- #define PIN_NAME_LENGTH 10
- #define PIN_GROUP(n, p, f) \
- { \
- .name = n, \
- .pins = p, \
- .num_pins = ARRAY_SIZE(p), \
- .func = f \
- }
- #define PMX_FUNC(n, g) \
- { \
- .name = n, \
- .groups = g, \
- .num_groups = ARRAY_SIZE(g), \
- }
- struct samsung_pinctrl_drv_data;
- struct samsung_pin_bank_type {
- u8 fld_width[PINCFG_TYPE_NUM];
- u8 reg_offset[PINCFG_TYPE_NUM];
- };
- struct samsung_pin_bank_data {
- const struct samsung_pin_bank_type *type;
- u32 pctl_offset;
- u8 nr_pins;
- u8 eint_func;
- enum eint_type eint_type;
- u32 eint_mask;
- u32 eint_offset;
- const char *name;
- };
- struct samsung_pin_bank {
- const struct samsung_pin_bank_type *type;
- u32 pctl_offset;
- u8 nr_pins;
- u8 eint_func;
- enum eint_type eint_type;
- u32 eint_mask;
- u32 eint_offset;
- const char *name;
- u32 pin_base;
- void *soc_priv;
- struct device_node *of_node;
- struct samsung_pinctrl_drv_data *drvdata;
- struct irq_domain *irq_domain;
- struct gpio_chip gpio_chip;
- struct pinctrl_gpio_range grange;
- struct exynos_irq_chip *irq_chip;
- spinlock_t slock;
- u32 pm_save[PINCFG_TYPE_NUM + 1];
- };
- struct samsung_pin_ctrl {
- const struct samsung_pin_bank_data *pin_banks;
- u32 nr_banks;
- int (*eint_gpio_init)(struct samsung_pinctrl_drv_data *);
- int (*eint_wkup_init)(struct samsung_pinctrl_drv_data *);
- void (*suspend)(struct samsung_pinctrl_drv_data *);
- void (*resume)(struct samsung_pinctrl_drv_data *);
- };
- struct samsung_pinctrl_drv_data {
- struct list_head node;
- void __iomem *virt_base;
- struct device *dev;
- int irq;
- struct pinctrl_desc pctl;
- struct pinctrl_dev *pctl_dev;
- const struct samsung_pin_group *pin_groups;
- unsigned int nr_groups;
- const struct samsung_pmx_func *pmx_functions;
- unsigned int nr_functions;
- struct samsung_pin_bank *pin_banks;
- u32 nr_banks;
- unsigned int pin_base;
- unsigned int nr_pins;
- void (*suspend)(struct samsung_pinctrl_drv_data *);
- void (*resume)(struct samsung_pinctrl_drv_data *);
- };
- struct samsung_pin_group {
- const char *name;
- const unsigned int *pins;
- u8 num_pins;
- u8 func;
- };
- struct samsung_pmx_func {
- const char *name;
- const char **groups;
- u8 num_groups;
- u32 val;
- };
- extern const struct samsung_pin_ctrl exynos3250_pin_ctrl[];
- extern const struct samsung_pin_ctrl exynos4210_pin_ctrl[];
- extern const struct samsung_pin_ctrl exynos4x12_pin_ctrl[];
- extern const struct samsung_pin_ctrl exynos4415_pin_ctrl[];
- extern const struct samsung_pin_ctrl exynos5250_pin_ctrl[];
- extern const struct samsung_pin_ctrl exynos5260_pin_ctrl[];
- extern const struct samsung_pin_ctrl exynos5410_pin_ctrl[];
- extern const struct samsung_pin_ctrl exynos5420_pin_ctrl[];
- extern const struct samsung_pin_ctrl exynos5433_pin_ctrl[];
- extern const struct samsung_pin_ctrl exynos7_pin_ctrl[];
- extern const struct samsung_pin_ctrl s3c64xx_pin_ctrl[];
- extern const struct samsung_pin_ctrl s3c2412_pin_ctrl[];
- extern const struct samsung_pin_ctrl s3c2416_pin_ctrl[];
- extern const struct samsung_pin_ctrl s3c2440_pin_ctrl[];
- extern const struct samsung_pin_ctrl s3c2450_pin_ctrl[];
- extern const struct samsung_pin_ctrl s5pv210_pin_ctrl[];
- #endif
|