aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/vexpress.h
diff options
context:
space:
mode:
authorPawel Moll <pawel.moll@arm.com>2012-09-24 09:55:40 -0400
committerPawel Moll <pawel.moll@arm.com>2012-11-05 12:09:49 -0500
commit3ecbf05be159a95e1d23ba9b3b21c5bc2941ba6b (patch)
treeed954cbeedfc693751a76630310b36374572338d /include/linux/vexpress.h
parentbcd6f569e87471d7f104bd9497f0b516a3b12e32 (diff)
mfd: Versatile Express config infrastructure
Versatile Express platform has an elaborated configuration system, consisting of microcontrollers residing on the mother- and daughterboards known as Motherboard/Daughterboard Configuration Controller (MCC and DCC). The controllers are responsible for the platform initialization (reset generation, flash programming, FPGA bitfiles loading etc.) but also control clock generators, voltage regulators, gather environmental data like temperature, power consumption etc. Even the video output switch (FPGA) is controlled that way. Those devices are _not_ visible in the main address space and the usual communication channel uses some kind of a bridge in the peripheral block sending commands (requests) to the controllers and receiving responses. It can take up to 500 microseconds for a transaction to be completed, therefore it is important to provide a non-blocking interface to it. This patch adds an abstraction of this infrastructure. Bridge drivers can register themselves with the framework. Then, a driver of a device can request an abstract "function" - the request will be redirected to a bridge referred by thedd "arm,vexpress,config-bridge" property of the device tree node. Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Diffstat (limited to 'include/linux/vexpress.h')
-rw-r--r--include/linux/vexpress.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/include/linux/vexpress.h b/include/linux/vexpress.h
new file mode 100644
index 000000000000..c2d877a7b691
--- /dev/null
+++ b/include/linux/vexpress.h
@@ -0,0 +1,85 @@
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.
5 *
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.
10 *
11 * Copyright (C) 2012 ARM Limited
12 */
13
14#ifndef _LINUX_VEXPRESS_H
15#define _LINUX_VEXPRESS_H
16
17#include <linux/device.h>
18
19#define VEXPRESS_SITE_MB 0
20#define VEXPRESS_SITE_DB1 1
21#define VEXPRESS_SITE_DB2 2
22#define VEXPRESS_SITE_MASTER 0xf
23
24#define VEXPRESS_CONFIG_STATUS_DONE 0
25#define VEXPRESS_CONFIG_STATUS_WAIT 1
26
27/* Config bridge API */
28
29/**
30 * struct vexpress_config_bridge_info - description of the platform
31 * configuration infrastructure bridge.
32 *
33 * @name: Bridge name
34 *
35 * @func_get: Obtains pointer to a configuration function for a given
36 * device or a Device Tree node, to be used with @func_put
37 * and @func_exec. The node pointer should take precedence
38 * over device pointer when both are passed.
39 *
40 * @func_put: Tells the bridge that the function will not be used any
41 * more, so all allocated resources can be released.
42 *
43 * @func_exec: Executes a configuration function read or write operation.
44 * The offset selects a 32 bit word of the value accessed.
45 * Must return VEXPRESS_CONFIG_STATUS_DONE when operation
46 * is finished immediately, VEXPRESS_CONFIG_STATUS_WAIT when
47 * will be completed in some time or negative value in case
48 * of error.
49 */
50struct vexpress_config_bridge_info {
51 const char *name;
52 void *(*func_get)(struct device *dev, struct device_node *node);
53 void (*func_put)(void *func);
54 int (*func_exec)(void *func, int offset, bool write, u32 *data);
55};
56
57struct vexpress_config_bridge;
58
59struct vexpress_config_bridge *vexpress_config_bridge_register(
60 struct device_node *node,
61 struct vexpress_config_bridge_info *info);
62void vexpress_config_bridge_unregister(struct vexpress_config_bridge *bridge);
63
64void vexpress_config_complete(struct vexpress_config_bridge *bridge,
65 int status);
66
67/* Config function API */
68
69struct vexpress_config_func;
70
71struct vexpress_config_func *__vexpress_config_func_get(struct device *dev,
72 struct device_node *node);
73#define vexpress_config_func_get_by_dev(dev) \
74 __vexpress_config_func_get(dev, NULL)
75#define vexpress_config_func_get_by_node(node) \
76 __vexpress_config_func_get(NULL, node)
77void vexpress_config_func_put(struct vexpress_config_func *func);
78
79/* Both may sleep! */
80int vexpress_config_read(struct vexpress_config_func *func, int offset,
81 u32 *data);
82int vexpress_config_write(struct vexpress_config_func *func, int offset,
83 u32 data);
84
85#endif