fc05d0c516f33e5e286d04e762a3edb84cf41aa4
[deliverable/linux.git] / drivers / pinctrl / sh-pfc / core.h
1 /*
2 * SuperH Pin Function Controller support.
3 *
4 * Copyright (C) 2012 Renesas Solutions Corp.
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10 #ifndef __SH_PFC_CORE_H__
11 #define __SH_PFC_CORE_H__
12
13 #include <linux/compiler.h>
14 #include <linux/spinlock.h>
15 #include <linux/types.h>
16
17 #include "sh_pfc.h"
18
19 struct sh_pfc_window {
20 phys_addr_t phys;
21 void __iomem *virt;
22 unsigned long size;
23 };
24
25 struct sh_pfc_chip;
26 struct sh_pfc_pinctrl;
27
28 struct sh_pfc_pin_range {
29 u16 start;
30 u16 end;
31 };
32
33 struct sh_pfc {
34 struct device *dev;
35 const struct sh_pfc_soc_info *info;
36 spinlock_t lock;
37
38 unsigned int num_windows;
39 struct sh_pfc_window *windows;
40 unsigned int num_irqs;
41 unsigned int *irqs;
42
43 struct sh_pfc_pin_range *ranges;
44 unsigned int nr_ranges;
45
46 unsigned int nr_gpio_pins;
47
48 struct sh_pfc_chip *gpio;
49 #ifdef CONFIG_SUPERH
50 struct sh_pfc_chip *func;
51 #endif
52
53 struct sh_pfc_pinctrl *pinctrl;
54 };
55
56 int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
57 int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
58
59 int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
60 int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc);
61
62 u32 sh_pfc_read_raw_reg(void __iomem *mapped_reg, unsigned int reg_width);
63 void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned int reg_width,
64 u32 data);
65 u32 sh_pfc_read_reg(struct sh_pfc *pfc, u32 reg, unsigned int width);
66 void sh_pfc_write_reg(struct sh_pfc *pfc, u32 reg, unsigned int width,
67 u32 data);
68
69 int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin);
70 int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type);
71
72 extern const struct sh_pfc_soc_info emev2_pinmux_info;
73 extern const struct sh_pfc_soc_info r8a73a4_pinmux_info;
74 extern const struct sh_pfc_soc_info r8a7740_pinmux_info;
75 extern const struct sh_pfc_soc_info r8a7778_pinmux_info;
76 extern const struct sh_pfc_soc_info r8a7779_pinmux_info;
77 extern const struct sh_pfc_soc_info r8a7790_pinmux_info;
78 extern const struct sh_pfc_soc_info r8a7791_pinmux_info;
79 extern const struct sh_pfc_soc_info r8a7793_pinmux_info;
80 extern const struct sh_pfc_soc_info r8a7794_pinmux_info;
81 extern const struct sh_pfc_soc_info r8a7795_pinmux_info;
82 extern const struct sh_pfc_soc_info sh7203_pinmux_info;
83 extern const struct sh_pfc_soc_info sh7264_pinmux_info;
84 extern const struct sh_pfc_soc_info sh7269_pinmux_info;
85 extern const struct sh_pfc_soc_info sh73a0_pinmux_info;
86 extern const struct sh_pfc_soc_info sh7720_pinmux_info;
87 extern const struct sh_pfc_soc_info sh7722_pinmux_info;
88 extern const struct sh_pfc_soc_info sh7723_pinmux_info;
89 extern const struct sh_pfc_soc_info sh7724_pinmux_info;
90 extern const struct sh_pfc_soc_info sh7734_pinmux_info;
91 extern const struct sh_pfc_soc_info sh7757_pinmux_info;
92 extern const struct sh_pfc_soc_info sh7785_pinmux_info;
93 extern const struct sh_pfc_soc_info sh7786_pinmux_info;
94 extern const struct sh_pfc_soc_info shx3_pinmux_info;
95
96 #endif /* __SH_PFC_CORE_H__ */
This page took 0.032853 seconds and 4 git commands to generate.