aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/reset/sti/reset-syscfg.h
diff options
context:
space:
mode:
authorStephen Gallimore <stephen.gallimore@st.com>2013-08-07 10:53:12 -0400
committerSrinivas Kandagatla <srinivas.kandagatla@st.com>2014-03-11 06:47:23 -0400
commite5d76075d9300a483619f7f308a693311af9c2cb (patch)
treefe4446092975d20cd1c259b491366fc7418c2e32 /drivers/reset/sti/reset-syscfg.h
parente063735f9155826ee96a9bbc5407a1ead192f295 (diff)
drivers: reset: STi SoC system configuration reset controller support
This patch adds a reset controller implementation for STMicroelectronics STi family SoCs; it allows a group of related reset like controls found in multiple system configuration registers to be represented by a single controller device. System configuration registers are accessed through the regmap framework and the mfd/syscon driver. The implementation optionally supports waiting for the reset action to be acknowledged in a separate status register and supports both active high and active low reset lines. These properties are common across all the reset channels in a specific reset controller instance, hence all channels in a paritcular controller are expected to behave in the same way. Signed-off-by: Stephen Gallimore <stephen.gallimore@st.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'drivers/reset/sti/reset-syscfg.h')
-rw-r--r--drivers/reset/sti/reset-syscfg.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/drivers/reset/sti/reset-syscfg.h b/drivers/reset/sti/reset-syscfg.h
new file mode 100644
index 000000000000..2cc2283bac40
--- /dev/null
+++ b/drivers/reset/sti/reset-syscfg.h
@@ -0,0 +1,69 @@
1/*
2 * Copyright (C) 2013 STMicroelectronics (R&D) Limited
3 * Author: Stephen Gallimore <stephen.gallimore@st.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 */
10#ifndef __STI_RESET_SYSCFG_H
11#define __STI_RESET_SYSCFG_H
12
13#include <linux/device.h>
14#include <linux/regmap.h>
15#include <linux/reset-controller.h>
16
17/**
18 * Reset channel description for a system configuration register based
19 * reset controller.
20 *
21 * @compatible: Compatible string of the syscon regmap containing this
22 * channel's control and ack (status) bits.
23 * @reset: Regmap field description of the channel's reset bit.
24 * @ack: Regmap field description of the channel's acknowledge bit.
25 */
26struct syscfg_reset_channel_data {
27 const char *compatible;
28 struct reg_field reset;
29 struct reg_field ack;
30};
31
32#define _SYSCFG_RST_CH(_c, _rr, _rb, _ar, _ab) \
33 { .compatible = _c, \
34 .reset = REG_FIELD(_rr, _rb, _rb), \
35 .ack = REG_FIELD(_ar, _ab, _ab), }
36
37#define _SYSCFG_RST_CH_NO_ACK(_c, _rr, _rb) \
38 { .compatible = _c, \
39 .reset = REG_FIELD(_rr, _rb, _rb), }
40
41/**
42 * Description of a system configuration register based reset controller.
43 *
44 * @wait_for_ack: The controller will wait for reset assert and de-assert to
45 * be "ack'd" in a channel's ack field.
46 * @active_low: Are the resets in this controller active low, i.e. clearing
47 * the reset bit puts the hardware into reset.
48 * @nr_channels: The number of reset channels in this controller.
49 * @channels: An array of reset channel descriptions.
50 */
51struct syscfg_reset_controller_data {
52 bool wait_for_ack;
53 bool active_low;
54 int nr_channels;
55 const struct syscfg_reset_channel_data *channels;
56};
57
58/**
59 * syscfg_reset_probe(): platform device probe function used by syscfg
60 * reset controller drivers. This registers a reset
61 * controller configured by the OF match data for
62 * the compatible device which should be of type
63 * "struct syscfg_reset_controller_data".
64 *
65 * @pdev: platform device
66 */
67int syscfg_reset_probe(struct platform_device *pdev);
68
69#endif /* __STI_RESET_SYSCFG_H */