ALSA: hda - Fix power-saving during playing beep sound
[linux-2.6.git] / include / linux / vexpress.h
blob75818744ab5998bdb3f88de62ff87e319548272d
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
11 * Copyright (C) 2012 ARM Limited
14 #ifndef _LINUX_VEXPRESS_H
15 #define _LINUX_VEXPRESS_H
17 #include <linux/device.h>
19 #define VEXPRESS_SITE_MB 0
20 #define VEXPRESS_SITE_DB1 1
21 #define VEXPRESS_SITE_DB2 2
22 #define VEXPRESS_SITE_MASTER 0xf
24 #define VEXPRESS_CONFIG_STATUS_DONE 0
25 #define VEXPRESS_CONFIG_STATUS_WAIT 1
27 #define VEXPRESS_GPIO_MMC_CARDIN 0
28 #define VEXPRESS_GPIO_MMC_WPROT 1
29 #define VEXPRESS_GPIO_FLASH_WPn 2
30 #define VEXPRESS_GPIO_LED0 3
31 #define VEXPRESS_GPIO_LED1 4
32 #define VEXPRESS_GPIO_LED2 5
33 #define VEXPRESS_GPIO_LED3 6
34 #define VEXPRESS_GPIO_LED4 7
35 #define VEXPRESS_GPIO_LED5 8
36 #define VEXPRESS_GPIO_LED6 9
37 #define VEXPRESS_GPIO_LED7 10
39 #define VEXPRESS_RES_FUNC(_site, _func) \
40 { \
41 .start = (_site), \
42 .end = (_func), \
43 .flags = IORESOURCE_BUS, \
46 /* Config bridge API */
48 /**
49 * struct vexpress_config_bridge_info - description of the platform
50 * configuration infrastructure bridge.
52 * @name: Bridge name
54 * @func_get: Obtains pointer to a configuration function for a given
55 * device or a Device Tree node, to be used with @func_put
56 * and @func_exec. The node pointer should take precedence
57 * over device pointer when both are passed.
59 * @func_put: Tells the bridge that the function will not be used any
60 * more, so all allocated resources can be released.
62 * @func_exec: Executes a configuration function read or write operation.
63 * The offset selects a 32 bit word of the value accessed.
64 * Must return VEXPRESS_CONFIG_STATUS_DONE when operation
65 * is finished immediately, VEXPRESS_CONFIG_STATUS_WAIT when
66 * will be completed in some time or negative value in case
67 * of error.
69 struct vexpress_config_bridge_info {
70 const char *name;
71 void *(*func_get)(struct device *dev, struct device_node *node);
72 void (*func_put)(void *func);
73 int (*func_exec)(void *func, int offset, bool write, u32 *data);
76 struct vexpress_config_bridge;
78 struct vexpress_config_bridge *vexpress_config_bridge_register(
79 struct device_node *node,
80 struct vexpress_config_bridge_info *info);
81 void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge);
83 void vexpress_config_complete(struct vexpress_config_bridge *bridge,
84 int status);
86 /* Config function API */
88 struct vexpress_config_func;
90 struct vexpress_config_func *__vexpress_config_func_get(struct device *dev,
91 struct device_node *node);
92 #define vexpress_config_func_get_by_dev(dev) \
93 __vexpress_config_func_get(dev, NULL)
94 #define vexpress_config_func_get_by_node(node) \
95 __vexpress_config_func_get(NULL, node)
96 void vexpress_config_func_put(struct vexpress_config_func *func);
98 /* Both may sleep! */
99 int vexpress_config_read(struct vexpress_config_func *func, int offset,
100 u32 *data);
101 int vexpress_config_write(struct vexpress_config_func *func, int offset,
102 u32 data);
104 /* Platform control */
106 u32 vexpress_get_procid(int site);
107 u32 vexpress_get_hbi(int site);
108 void *vexpress_get_24mhz_clock_base(void);
109 void vexpress_flags_set(u32 data);
111 #define vexpress_get_site_by_node(node) __vexpress_get_site(NULL, node)
112 #define vexpress_get_site_by_dev(dev) __vexpress_get_site(dev, NULL)
113 unsigned __vexpress_get_site(struct device *dev, struct device_node *node);
115 void vexpress_sysreg_early_init(void __iomem *base);
116 void vexpress_sysreg_of_early_init(void);
118 void vexpress_power_off(void);
119 void vexpress_restart(char str, const char *cmd);
121 /* Clocks */
123 struct clk *vexpress_osc_setup(struct device *dev);
124 void vexpress_osc_of_setup(struct device_node *node);
126 void vexpress_clk_init(void __iomem *sp810_base);
127 void vexpress_clk_of_init(void);
129 #endif