diff options
Diffstat (limited to 'include/linux/vexpress.h')
-rw-r--r-- | include/linux/vexpress.h | 94 |
1 files changed, 20 insertions, 74 deletions
diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h index 617c01b8f74a..a4c9547aae64 100644 --- a/include/linux/vexpress.h +++ b/include/linux/vexpress.h | |||
@@ -15,28 +15,15 @@ | |||
15 | #define _LINUX_VEXPRESS_H | 15 | #define _LINUX_VEXPRESS_H |
16 | 16 | ||
17 | #include <linux/device.h> | 17 | #include <linux/device.h> |
18 | #include <linux/platform_device.h> | ||
18 | #include <linux/reboot.h> | 19 | #include <linux/reboot.h> |
20 | #include <linux/regmap.h> | ||
19 | 21 | ||
20 | #define VEXPRESS_SITE_MB 0 | 22 | #define VEXPRESS_SITE_MB 0 |
21 | #define VEXPRESS_SITE_DB1 1 | 23 | #define VEXPRESS_SITE_DB1 1 |
22 | #define VEXPRESS_SITE_DB2 2 | 24 | #define VEXPRESS_SITE_DB2 2 |
23 | #define VEXPRESS_SITE_MASTER 0xf | 25 | #define VEXPRESS_SITE_MASTER 0xf |
24 | 26 | ||
25 | #define VEXPRESS_CONFIG_STATUS_DONE 0 | ||
26 | #define VEXPRESS_CONFIG_STATUS_WAIT 1 | ||
27 | |||
28 | #define VEXPRESS_GPIO_MMC_CARDIN 0 | ||
29 | #define VEXPRESS_GPIO_MMC_WPROT 1 | ||
30 | #define VEXPRESS_GPIO_FLASH_WPn 2 | ||
31 | #define VEXPRESS_GPIO_LED0 3 | ||
32 | #define VEXPRESS_GPIO_LED1 4 | ||
33 | #define VEXPRESS_GPIO_LED2 5 | ||
34 | #define VEXPRESS_GPIO_LED3 6 | ||
35 | #define VEXPRESS_GPIO_LED4 7 | ||
36 | #define VEXPRESS_GPIO_LED5 8 | ||
37 | #define VEXPRESS_GPIO_LED6 9 | ||
38 | #define VEXPRESS_GPIO_LED7 10 | ||
39 | |||
40 | #define VEXPRESS_RES_FUNC(_site, _func) \ | 27 | #define VEXPRESS_RES_FUNC(_site, _func) \ |
41 | { \ | 28 | { \ |
42 | .start = (_site), \ | 29 | .start = (_site), \ |
@@ -44,84 +31,43 @@ | |||
44 | .flags = IORESOURCE_BUS, \ | 31 | .flags = IORESOURCE_BUS, \ |
45 | } | 32 | } |
46 | 33 | ||
47 | /* Config bridge API */ | 34 | /* Config infrastructure */ |
48 | 35 | ||
49 | /** | 36 | void vexpress_config_set_master(u32 site); |
50 | * struct vexpress_config_bridge_info - description of the platform | 37 | u32 vexpress_config_get_master(void); |
51 | * configuration infrastructure bridge. | ||
52 | * | ||
53 | * @name: Bridge name | ||
54 | * | ||
55 | * @func_get: Obtains pointer to a configuration function for a given | ||
56 | * device or a Device Tree node, to be used with @func_put | ||
57 | * and @func_exec. The node pointer should take precedence | ||
58 | * over device pointer when both are passed. | ||
59 | * | ||
60 | * @func_put: Tells the bridge that the function will not be used any | ||
61 | * more, so all allocated resources can be released. | ||
62 | * | ||
63 | * @func_exec: Executes a configuration function read or write operation. | ||
64 | * The offset selects a 32 bit word of the value accessed. | ||
65 | * Must return VEXPRESS_CONFIG_STATUS_DONE when operation | ||
66 | * is finished immediately, VEXPRESS_CONFIG_STATUS_WAIT when | ||
67 | * will be completed in some time or negative value in case | ||
68 | * of error. | ||
69 | */ | ||
70 | struct vexpress_config_bridge_info { | ||
71 | const char *name; | ||
72 | void *(*func_get)(struct device *dev, struct device_node *node); | ||
73 | void (*func_put)(void *func); | ||
74 | int (*func_exec)(void *func, int offset, bool write, u32 *data); | ||
75 | }; | ||
76 | 38 | ||
77 | struct vexpress_config_bridge; | 39 | void vexpress_config_lock(void *arg); |
40 | void vexpress_config_unlock(void *arg); | ||
78 | 41 | ||
79 | struct vexpress_config_bridge *vexpress_config_bridge_register( | 42 | int vexpress_config_get_topo(struct device_node *node, u32 *site, |
80 | struct device_node *node, | 43 | u32 *position, u32 *dcc); |
81 | struct vexpress_config_bridge_info *info); | ||
82 | void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge); | ||
83 | 44 | ||
84 | void vexpress_config_complete(struct vexpress_config_bridge *bridge, | 45 | /* Config bridge API */ |
85 | int status); | ||
86 | 46 | ||
87 | /* Config function API */ | 47 | struct vexpress_config_bridge_ops { |
48 | struct regmap * (*regmap_init)(struct device *dev, void *context); | ||
49 | void (*regmap_exit)(struct regmap *regmap, void *context); | ||
50 | }; | ||
88 | 51 | ||
89 | struct vexpress_config_func; | 52 | struct device *vexpress_config_bridge_register(struct device *parent, |
53 | struct vexpress_config_bridge_ops *ops, void *context); | ||
90 | 54 | ||
91 | struct vexpress_config_func *__vexpress_config_func_get(struct device *dev, | 55 | /* Config regmap API */ |
92 | struct device_node *node); | ||
93 | #define vexpress_config_func_get_by_dev(dev) \ | ||
94 | __vexpress_config_func_get(dev, NULL) | ||
95 | #define vexpress_config_func_get_by_node(node) \ | ||
96 | __vexpress_config_func_get(NULL, node) | ||
97 | void vexpress_config_func_put(struct vexpress_config_func *func); | ||
98 | 56 | ||
99 | /* Both may sleep! */ | 57 | struct regmap *devm_regmap_init_vexpress_config(struct device *dev); |
100 | int vexpress_config_read(struct vexpress_config_func *func, int offset, | ||
101 | u32 *data); | ||
102 | int vexpress_config_write(struct vexpress_config_func *func, int offset, | ||
103 | u32 data); | ||
104 | 58 | ||
105 | /* Platform control */ | 59 | /* Platform control */ |
106 | 60 | ||
61 | unsigned int vexpress_get_mci_cardin(struct device *dev); | ||
107 | u32 vexpress_get_procid(int site); | 62 | u32 vexpress_get_procid(int site); |
108 | u32 vexpress_get_hbi(int site); | ||
109 | void *vexpress_get_24mhz_clock_base(void); | 63 | void *vexpress_get_24mhz_clock_base(void); |
110 | void vexpress_flags_set(u32 data); | 64 | void vexpress_flags_set(u32 data); |
111 | 65 | ||
112 | #define vexpress_get_site_by_node(node) __vexpress_get_site(NULL, node) | ||
113 | #define vexpress_get_site_by_dev(dev) __vexpress_get_site(dev, NULL) | ||
114 | unsigned __vexpress_get_site(struct device *dev, struct device_node *node); | ||
115 | |||
116 | void vexpress_sysreg_early_init(void __iomem *base); | 66 | void vexpress_sysreg_early_init(void __iomem *base); |
117 | void vexpress_sysreg_of_early_init(void); | 67 | int vexpress_syscfg_device_register(struct platform_device *pdev); |
118 | 68 | ||
119 | /* Clocks */ | 69 | /* Clocks */ |
120 | 70 | ||
121 | struct clk *vexpress_osc_setup(struct device *dev); | ||
122 | void vexpress_osc_of_setup(struct device_node *node); | ||
123 | |||
124 | void vexpress_clk_init(void __iomem *sp810_base); | 71 | void vexpress_clk_init(void __iomem *sp810_base); |
125 | void vexpress_clk_of_init(void); | ||
126 | 72 | ||
127 | #endif | 73 | #endif |