diff options
author | Olof Johansson <olof@lixom.net> | 2017-06-18 22:03:45 -0400 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2017-06-18 22:03:45 -0400 |
commit | f44a12dcd9b8490bf520b6c3bd3982761fc7fdad (patch) | |
tree | aa6ef233b191e50f76e8ac5bfd1158821de9f517 | |
parent | 8b4a35876d7fadc6138ee0b12342cab622981dbd (diff) | |
parent | 28df169b9afa121153ef2a3ef4ceae72512cde6d (diff) |
Merge tag 'reset-for-4.13-2' of git://git.pengutronix.de/git/pza/linux into next/drivers
Reset controller changes for v4.13, part 2
- Add reset manager offsets for Stratix10
- Use kref for reset contol reference counting
- Add new TI SCI reset driver for TI Keystone SoCs
* tag 'reset-for-4.13-2' of git://git.pengutronix.de/git/pza/linux:
reset: Add the TI SCI reset driver
dt-bindings: reset: Add TI SCI reset binding
reset: use kref for reference counting
dt-bindings: reset: Add reset manager offsets for Stratix10
Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r-- | Documentation/devicetree/bindings/reset/ti,sci-reset.txt | 62 | ||||
-rw-r--r-- | MAINTAINERS | 2 | ||||
-rw-r--r-- | drivers/reset/Kconfig | 8 | ||||
-rw-r--r-- | drivers/reset/Makefile | 1 | ||||
-rw-r--r-- | drivers/reset/core.c | 23 | ||||
-rw-r--r-- | drivers/reset/reset-ti-sci.c | 269 | ||||
-rw-r--r-- | include/dt-bindings/reset/altr,rst-mgr-s10.h | 108 |
7 files changed, 465 insertions, 8 deletions
diff --git a/Documentation/devicetree/bindings/reset/ti,sci-reset.txt b/Documentation/devicetree/bindings/reset/ti,sci-reset.txt new file mode 100644 index 000000000000..8b1cf022f18a --- /dev/null +++ b/Documentation/devicetree/bindings/reset/ti,sci-reset.txt | |||
@@ -0,0 +1,62 @@ | |||
1 | Texas Instruments System Control Interface (TI-SCI) Reset Controller | ||
2 | ===================================================================== | ||
3 | |||
4 | Some TI SoCs contain a system controller (like the Power Management Micro | ||
5 | Controller (PMMC) on Keystone 66AK2G SoC) that are responsible for controlling | ||
6 | the state of the various hardware modules present on the SoC. Communication | ||
7 | between the host processor running an OS and the system controller happens | ||
8 | through a protocol called TI System Control Interface (TI-SCI protocol). | ||
9 | For TI SCI details, please refer to the document, | ||
10 | Documentation/devicetree/bindings/arm/keystone/ti,sci.txt | ||
11 | |||
12 | TI-SCI Reset Controller Node | ||
13 | ============================ | ||
14 | This reset controller node uses the TI SCI protocol to perform the reset | ||
15 | management of various hardware modules present on the SoC. Must be a child | ||
16 | node of the associated TI-SCI system controller node. | ||
17 | |||
18 | Required properties: | ||
19 | -------------------- | ||
20 | - compatible : Should be "ti,sci-reset" | ||
21 | - #reset-cells : Should be 2. Please see the reset consumer node below for | ||
22 | usage details. | ||
23 | |||
24 | TI-SCI Reset Consumer Nodes | ||
25 | =========================== | ||
26 | Each of the reset consumer nodes should have the following properties, | ||
27 | in addition to their own properties. | ||
28 | |||
29 | Required properties: | ||
30 | -------------------- | ||
31 | - resets : A phandle and reset specifier pair, one pair for each reset | ||
32 | signal that affects the device, or that the device manages. | ||
33 | The phandle should point to the TI-SCI reset controller node, | ||
34 | and the reset specifier should have 2 cell-values. The first | ||
35 | cell should contain the device ID. The second cell should | ||
36 | contain the reset mask value used by system controller. | ||
37 | Please refer to the protocol documentation for these values | ||
38 | to be used for different devices, | ||
39 | http://processors.wiki.ti.com/index.php/TISCI#66AK2G02_Data | ||
40 | |||
41 | Please also refer to Documentation/devicetree/bindings/reset/reset.txt for | ||
42 | common reset controller usage by consumers. | ||
43 | |||
44 | Example: | ||
45 | -------- | ||
46 | The following example demonstrates both a TI-SCI reset controller node and a | ||
47 | consumer (a DSP device) on the 66AK2G SoC. | ||
48 | |||
49 | pmmc: pmmc { | ||
50 | compatible = "ti,k2g-sci"; | ||
51 | |||
52 | k2g_reset: reset-controller { | ||
53 | compatible = "ti,sci-reset"; | ||
54 | #reset-cells = <2>; | ||
55 | }; | ||
56 | }; | ||
57 | |||
58 | dsp0: dsp@10800000 { | ||
59 | ... | ||
60 | resets = <&k2g_reset 0x0046 0x1>; | ||
61 | ... | ||
62 | }; | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 053c3bdd1fe5..378133ba441a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -12633,6 +12633,8 @@ F: include/linux/soc/ti/ti_sci_protocol.h | |||
12633 | F: Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt | 12633 | F: Documentation/devicetree/bindings/soc/ti/sci-pm-domain.txt |
12634 | F: include/dt-bindings/genpd/k2g.h | 12634 | F: include/dt-bindings/genpd/k2g.h |
12635 | F: drivers/soc/ti/ti_sci_pm_domains.c | 12635 | F: drivers/soc/ti/ti_sci_pm_domains.c |
12636 | F: Documentation/devicetree/bindings/reset/ti,sci-reset.txt | ||
12637 | F: drivers/reset/reset-ti-sci.c | ||
12636 | 12638 | ||
12637 | THANKO'S RAREMONO AM/FM/SW RADIO RECEIVER USB DRIVER | 12639 | THANKO'S RAREMONO AM/FM/SW RADIO RECEIVER USB DRIVER |
12638 | M: Hans Verkuil <hverkuil@xs4all.nl> | 12640 | M: Hans Verkuil <hverkuil@xs4all.nl> |
diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 61fabf6ddaec..608c071e4bbf 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig | |||
@@ -87,6 +87,14 @@ config RESET_SUNXI | |||
87 | help | 87 | help |
88 | This enables the reset driver for Allwinner SoCs. | 88 | This enables the reset driver for Allwinner SoCs. |
89 | 89 | ||
90 | config RESET_TI_SCI | ||
91 | tristate "TI System Control Interface (TI-SCI) reset driver" | ||
92 | depends on TI_SCI_PROTOCOL | ||
93 | help | ||
94 | This enables the reset driver support over TI System Control Interface | ||
95 | available on some new TI's SoCs. If you wish to use reset resources | ||
96 | managed by the TI System Controller, say Y here. Otherwise, say N. | ||
97 | |||
90 | config RESET_TI_SYSCON | 98 | config RESET_TI_SYSCON |
91 | tristate "TI SYSCON Reset Driver" | 99 | tristate "TI SYSCON Reset Driver" |
92 | depends on HAS_IOMEM | 100 | depends on HAS_IOMEM |
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index e422a04f7b85..7081f9da2599 100644 --- a/drivers/reset/Makefile +++ b/drivers/reset/Makefile | |||
@@ -14,6 +14,7 @@ obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o | |||
14 | obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o | 14 | obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o |
15 | obj-$(CONFIG_RESET_STM32) += reset-stm32.o | 15 | obj-$(CONFIG_RESET_STM32) += reset-stm32.o |
16 | obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o | 16 | obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o |
17 | obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o | ||
17 | obj-$(CONFIG_RESET_TI_SYSCON) += reset-ti-syscon.o | 18 | obj-$(CONFIG_RESET_TI_SYSCON) += reset-ti-syscon.o |
18 | obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o | 19 | obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o |
19 | obj-$(CONFIG_RESET_ZX2967) += reset-zx2967.o | 20 | obj-$(CONFIG_RESET_ZX2967) += reset-zx2967.o |
diff --git a/drivers/reset/core.c b/drivers/reset/core.c index cd739d2fa160..0090784ff410 100644 --- a/drivers/reset/core.c +++ b/drivers/reset/core.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/err.h> | 13 | #include <linux/err.h> |
14 | #include <linux/export.h> | 14 | #include <linux/export.h> |
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/kref.h> | ||
16 | #include <linux/module.h> | 17 | #include <linux/module.h> |
17 | #include <linux/of.h> | 18 | #include <linux/of.h> |
18 | #include <linux/reset.h> | 19 | #include <linux/reset.h> |
@@ -40,7 +41,7 @@ struct reset_control { | |||
40 | struct reset_controller_dev *rcdev; | 41 | struct reset_controller_dev *rcdev; |
41 | struct list_head list; | 42 | struct list_head list; |
42 | unsigned int id; | 43 | unsigned int id; |
43 | unsigned int refcnt; | 44 | struct kref refcnt; |
44 | bool shared; | 45 | bool shared; |
45 | atomic_t deassert_count; | 46 | atomic_t deassert_count; |
46 | atomic_t triggered_count; | 47 | atomic_t triggered_count; |
@@ -288,7 +289,7 @@ static struct reset_control *__reset_control_get_internal( | |||
288 | if (WARN_ON(!rstc->shared || !shared)) | 289 | if (WARN_ON(!rstc->shared || !shared)) |
289 | return ERR_PTR(-EBUSY); | 290 | return ERR_PTR(-EBUSY); |
290 | 291 | ||
291 | rstc->refcnt++; | 292 | kref_get(&rstc->refcnt); |
292 | return rstc; | 293 | return rstc; |
293 | } | 294 | } |
294 | } | 295 | } |
@@ -302,18 +303,18 @@ static struct reset_control *__reset_control_get_internal( | |||
302 | rstc->rcdev = rcdev; | 303 | rstc->rcdev = rcdev; |
303 | list_add(&rstc->list, &rcdev->reset_control_head); | 304 | list_add(&rstc->list, &rcdev->reset_control_head); |
304 | rstc->id = index; | 305 | rstc->id = index; |
305 | rstc->refcnt = 1; | 306 | kref_init(&rstc->refcnt); |
306 | rstc->shared = shared; | 307 | rstc->shared = shared; |
307 | 308 | ||
308 | return rstc; | 309 | return rstc; |
309 | } | 310 | } |
310 | 311 | ||
311 | static void __reset_control_put_internal(struct reset_control *rstc) | 312 | static void __reset_control_release(struct kref *kref) |
312 | { | 313 | { |
313 | lockdep_assert_held(&reset_list_mutex); | 314 | struct reset_control *rstc = container_of(kref, struct reset_control, |
315 | refcnt); | ||
314 | 316 | ||
315 | if (--rstc->refcnt) | 317 | lockdep_assert_held(&reset_list_mutex); |
316 | return; | ||
317 | 318 | ||
318 | module_put(rstc->rcdev->owner); | 319 | module_put(rstc->rcdev->owner); |
319 | 320 | ||
@@ -321,6 +322,13 @@ static void __reset_control_put_internal(struct reset_control *rstc) | |||
321 | kfree(rstc); | 322 | kfree(rstc); |
322 | } | 323 | } |
323 | 324 | ||
325 | static void __reset_control_put_internal(struct reset_control *rstc) | ||
326 | { | ||
327 | lockdep_assert_held(&reset_list_mutex); | ||
328 | |||
329 | kref_put(&rstc->refcnt, __reset_control_release); | ||
330 | } | ||
331 | |||
324 | struct reset_control *__of_reset_control_get(struct device_node *node, | 332 | struct reset_control *__of_reset_control_get(struct device_node *node, |
325 | const char *id, int index, bool shared, | 333 | const char *id, int index, bool shared, |
326 | bool optional) | 334 | bool optional) |
@@ -400,7 +408,6 @@ EXPORT_SYMBOL_GPL(__reset_control_get); | |||
400 | * reset_control_put - free the reset controller | 408 | * reset_control_put - free the reset controller |
401 | * @rstc: reset controller | 409 | * @rstc: reset controller |
402 | */ | 410 | */ |
403 | |||
404 | void reset_control_put(struct reset_control *rstc) | 411 | void reset_control_put(struct reset_control *rstc) |
405 | { | 412 | { |
406 | if (IS_ERR_OR_NULL(rstc)) | 413 | if (IS_ERR_OR_NULL(rstc)) |
diff --git a/drivers/reset/reset-ti-sci.c b/drivers/reset/reset-ti-sci.c new file mode 100644 index 000000000000..bf68729ab729 --- /dev/null +++ b/drivers/reset/reset-ti-sci.c | |||
@@ -0,0 +1,269 @@ | |||
1 | /* | ||
2 | * Texas Instrument's System Control Interface (TI-SCI) reset driver | ||
3 | * | ||
4 | * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/ | ||
5 | * Andrew F. Davis <afd@ti.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
12 | * kind, whether express or implied; without even the implied warranty | ||
13 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | */ | ||
16 | |||
17 | #include <linux/idr.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/mutex.h> | ||
20 | #include <linux/of.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/reset-controller.h> | ||
23 | #include <linux/soc/ti/ti_sci_protocol.h> | ||
24 | |||
25 | /** | ||
26 | * struct ti_sci_reset_control - reset control structure | ||
27 | * @dev_id: SoC-specific device identifier | ||
28 | * @reset_mask: reset mask to use for toggling reset | ||
29 | * @lock: synchronize reset_mask read-modify-writes | ||
30 | */ | ||
31 | struct ti_sci_reset_control { | ||
32 | u32 dev_id; | ||
33 | u32 reset_mask; | ||
34 | struct mutex lock; | ||
35 | }; | ||
36 | |||
37 | /** | ||
38 | * struct ti_sci_reset_data - reset controller information structure | ||
39 | * @rcdev: reset controller entity | ||
40 | * @dev: reset controller device pointer | ||
41 | * @sci: TI SCI handle used for communication with system controller | ||
42 | * @idr: idr structure for mapping ids to reset control structures | ||
43 | */ | ||
44 | struct ti_sci_reset_data { | ||
45 | struct reset_controller_dev rcdev; | ||
46 | struct device *dev; | ||
47 | const struct ti_sci_handle *sci; | ||
48 | struct idr idr; | ||
49 | }; | ||
50 | |||
51 | #define to_ti_sci_reset_data(p) \ | ||
52 | container_of((p), struct ti_sci_reset_data, rcdev) | ||
53 | |||
54 | /** | ||
55 | * ti_sci_reset_set() - program a device's reset | ||
56 | * @rcdev: reset controller entity | ||
57 | * @id: ID of the reset to toggle | ||
58 | * @assert: boolean flag to indicate assert or deassert | ||
59 | * | ||
60 | * This is a common internal function used to assert or deassert a device's | ||
61 | * reset using the TI SCI protocol. The device's reset is asserted if the | ||
62 | * @assert argument is true, or deasserted if @assert argument is false. | ||
63 | * The mechanism itself is a read-modify-write procedure, the current device | ||
64 | * reset register is read using a TI SCI device operation, the new value is | ||
65 | * set or un-set using the reset's mask, and the new reset value written by | ||
66 | * using another TI SCI device operation. | ||
67 | * | ||
68 | * Return: 0 for successful request, else a corresponding error value | ||
69 | */ | ||
70 | static int ti_sci_reset_set(struct reset_controller_dev *rcdev, | ||
71 | unsigned long id, bool assert) | ||
72 | { | ||
73 | struct ti_sci_reset_data *data = to_ti_sci_reset_data(rcdev); | ||
74 | const struct ti_sci_handle *sci = data->sci; | ||
75 | const struct ti_sci_dev_ops *dev_ops = &sci->ops.dev_ops; | ||
76 | struct ti_sci_reset_control *control; | ||
77 | u32 reset_state; | ||
78 | int ret; | ||
79 | |||
80 | control = idr_find(&data->idr, id); | ||
81 | if (!control) | ||
82 | return -EINVAL; | ||
83 | |||
84 | mutex_lock(&control->lock); | ||
85 | |||
86 | ret = dev_ops->get_device_resets(sci, control->dev_id, &reset_state); | ||
87 | if (ret) | ||
88 | goto out; | ||
89 | |||
90 | if (assert) | ||
91 | reset_state |= control->reset_mask; | ||
92 | else | ||
93 | reset_state &= ~control->reset_mask; | ||
94 | |||
95 | ret = dev_ops->set_device_resets(sci, control->dev_id, reset_state); | ||
96 | out: | ||
97 | mutex_unlock(&control->lock); | ||
98 | |||
99 | return ret; | ||
100 | } | ||
101 | |||
102 | /** | ||
103 | * ti_sci_reset_assert() - assert device reset | ||
104 | * @rcdev: reset controller entity | ||
105 | * @id: ID of the reset to be asserted | ||
106 | * | ||
107 | * This function implements the reset driver op to assert a device's reset | ||
108 | * using the TI SCI protocol. This invokes the function ti_sci_reset_set() | ||
109 | * with the corresponding parameters as passed in, but with the @assert | ||
110 | * argument set to true for asserting the reset. | ||
111 | * | ||
112 | * Return: 0 for successful request, else a corresponding error value | ||
113 | */ | ||
114 | static int ti_sci_reset_assert(struct reset_controller_dev *rcdev, | ||
115 | unsigned long id) | ||
116 | { | ||
117 | return ti_sci_reset_set(rcdev, id, true); | ||
118 | } | ||
119 | |||
120 | /** | ||
121 | * ti_sci_reset_deassert() - deassert device reset | ||
122 | * @rcdev: reset controller entity | ||
123 | * @id: ID of the reset to be deasserted | ||
124 | * | ||
125 | * This function implements the reset driver op to deassert a device's reset | ||
126 | * using the TI SCI protocol. This invokes the function ti_sci_reset_set() | ||
127 | * with the corresponding parameters as passed in, but with the @assert | ||
128 | * argument set to false for deasserting the reset. | ||
129 | * | ||
130 | * Return: 0 for successful request, else a corresponding error value | ||
131 | */ | ||
132 | static int ti_sci_reset_deassert(struct reset_controller_dev *rcdev, | ||
133 | unsigned long id) | ||
134 | { | ||
135 | return ti_sci_reset_set(rcdev, id, false); | ||
136 | } | ||
137 | |||
138 | /** | ||
139 | * ti_sci_reset_status() - check device reset status | ||
140 | * @rcdev: reset controller entity | ||
141 | * @id: ID of reset to be checked | ||
142 | * | ||
143 | * This function implements the reset driver op to return the status of a | ||
144 | * device's reset using the TI SCI protocol. The reset register value is read | ||
145 | * by invoking the TI SCI device operation .get_device_resets(), and the | ||
146 | * status of the specific reset is extracted and returned using this reset's | ||
147 | * reset mask. | ||
148 | * | ||
149 | * Return: 0 if reset is deasserted, or a non-zero value if reset is asserted | ||
150 | */ | ||
151 | static int ti_sci_reset_status(struct reset_controller_dev *rcdev, | ||
152 | unsigned long id) | ||
153 | { | ||
154 | struct ti_sci_reset_data *data = to_ti_sci_reset_data(rcdev); | ||
155 | const struct ti_sci_handle *sci = data->sci; | ||
156 | const struct ti_sci_dev_ops *dev_ops = &sci->ops.dev_ops; | ||
157 | struct ti_sci_reset_control *control; | ||
158 | u32 reset_state; | ||
159 | int ret; | ||
160 | |||
161 | control = idr_find(&data->idr, id); | ||
162 | if (!control) | ||
163 | return -EINVAL; | ||
164 | |||
165 | ret = dev_ops->get_device_resets(sci, control->dev_id, &reset_state); | ||
166 | if (ret) | ||
167 | return ret; | ||
168 | |||
169 | return reset_state & control->reset_mask; | ||
170 | } | ||
171 | |||
172 | static const struct reset_control_ops ti_sci_reset_ops = { | ||
173 | .assert = ti_sci_reset_assert, | ||
174 | .deassert = ti_sci_reset_deassert, | ||
175 | .status = ti_sci_reset_status, | ||
176 | }; | ||
177 | |||
178 | /** | ||
179 | * ti_sci_reset_of_xlate() - translate a set of OF arguments to a reset ID | ||
180 | * @rcdev: reset controller entity | ||
181 | * @reset_spec: OF reset argument specifier | ||
182 | * | ||
183 | * This function performs the translation of the reset argument specifier | ||
184 | * values defined in a reset consumer device node. The function allocates a | ||
185 | * reset control structure for that device reset, and will be used by the | ||
186 | * driver for performing any reset functions on that reset. An idr structure | ||
187 | * is allocated and used to map to the reset control structure. This idr | ||
188 | * is used by the driver to do reset lookups. | ||
189 | * | ||
190 | * Return: 0 for successful request, else a corresponding error value | ||
191 | */ | ||
192 | static int ti_sci_reset_of_xlate(struct reset_controller_dev *rcdev, | ||
193 | const struct of_phandle_args *reset_spec) | ||
194 | { | ||
195 | struct ti_sci_reset_data *data = to_ti_sci_reset_data(rcdev); | ||
196 | struct ti_sci_reset_control *control; | ||
197 | |||
198 | if (WARN_ON(reset_spec->args_count != rcdev->of_reset_n_cells)) | ||
199 | return -EINVAL; | ||
200 | |||
201 | control = devm_kzalloc(data->dev, sizeof(*control), GFP_KERNEL); | ||
202 | if (!control) | ||
203 | return -ENOMEM; | ||
204 | |||
205 | control->dev_id = reset_spec->args[0]; | ||
206 | control->reset_mask = reset_spec->args[1]; | ||
207 | mutex_init(&control->lock); | ||
208 | |||
209 | return idr_alloc(&data->idr, control, 0, 0, GFP_KERNEL); | ||
210 | } | ||
211 | |||
212 | static const struct of_device_id ti_sci_reset_of_match[] = { | ||
213 | { .compatible = "ti,sci-reset", }, | ||
214 | { /* sentinel */ }, | ||
215 | }; | ||
216 | MODULE_DEVICE_TABLE(of, ti_sci_reset_of_match); | ||
217 | |||
218 | static int ti_sci_reset_probe(struct platform_device *pdev) | ||
219 | { | ||
220 | struct ti_sci_reset_data *data; | ||
221 | |||
222 | if (!pdev->dev.of_node) | ||
223 | return -ENODEV; | ||
224 | |||
225 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); | ||
226 | if (!data) | ||
227 | return -ENOMEM; | ||
228 | |||
229 | data->sci = devm_ti_sci_get_handle(&pdev->dev); | ||
230 | if (IS_ERR(data->sci)) | ||
231 | return PTR_ERR(data->sci); | ||
232 | |||
233 | data->rcdev.ops = &ti_sci_reset_ops; | ||
234 | data->rcdev.owner = THIS_MODULE; | ||
235 | data->rcdev.of_node = pdev->dev.of_node; | ||
236 | data->rcdev.of_reset_n_cells = 2; | ||
237 | data->rcdev.of_xlate = ti_sci_reset_of_xlate; | ||
238 | data->dev = &pdev->dev; | ||
239 | idr_init(&data->idr); | ||
240 | |||
241 | platform_set_drvdata(pdev, data); | ||
242 | |||
243 | return reset_controller_register(&data->rcdev); | ||
244 | } | ||
245 | |||
246 | static int ti_sci_reset_remove(struct platform_device *pdev) | ||
247 | { | ||
248 | struct ti_sci_reset_data *data = platform_get_drvdata(pdev); | ||
249 | |||
250 | reset_controller_unregister(&data->rcdev); | ||
251 | |||
252 | idr_destroy(&data->idr); | ||
253 | |||
254 | return 0; | ||
255 | } | ||
256 | |||
257 | static struct platform_driver ti_sci_reset_driver = { | ||
258 | .probe = ti_sci_reset_probe, | ||
259 | .remove = ti_sci_reset_remove, | ||
260 | .driver = { | ||
261 | .name = "ti-sci-reset", | ||
262 | .of_match_table = ti_sci_reset_of_match, | ||
263 | }, | ||
264 | }; | ||
265 | module_platform_driver(ti_sci_reset_driver); | ||
266 | |||
267 | MODULE_AUTHOR("Andrew F. Davis <afd@ti.com>"); | ||
268 | MODULE_DESCRIPTION("TI System Control Interface (TI SCI) Reset driver"); | ||
269 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/include/dt-bindings/reset/altr,rst-mgr-s10.h b/include/dt-bindings/reset/altr,rst-mgr-s10.h new file mode 100644 index 000000000000..7978c21e4fad --- /dev/null +++ b/include/dt-bindings/reset/altr,rst-mgr-s10.h | |||
@@ -0,0 +1,108 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2016 Intel Corporation. All rights reserved | ||
3 | * Copyright (C) 2016 Altera Corporation. All rights reserved | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms and conditions of the GNU General Public License, | ||
7 | * version 2, as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | * | ||
17 | * derived from Steffen Trumtrar's "altr,rst-mgr-a10.h" | ||
18 | */ | ||
19 | |||
20 | #ifndef _DT_BINDINGS_RESET_ALTR_RST_MGR_S10_H | ||
21 | #define _DT_BINDINGS_RESET_ALTR_RST_MGR_S10_H | ||
22 | |||
23 | /* MPUMODRST */ | ||
24 | #define CPU0_RESET 0 | ||
25 | #define CPU1_RESET 1 | ||
26 | #define CPU2_RESET 2 | ||
27 | #define CPU3_RESET 3 | ||
28 | |||
29 | /* PER0MODRST */ | ||
30 | #define EMAC0_RESET 32 | ||
31 | #define EMAC1_RESET 33 | ||
32 | #define EMAC2_RESET 34 | ||
33 | #define USB0_RESET 35 | ||
34 | #define USB1_RESET 36 | ||
35 | #define NAND_RESET 37 | ||
36 | /* 38 is empty */ | ||
37 | #define SDMMC_RESET 39 | ||
38 | #define EMAC0_OCP_RESET 40 | ||
39 | #define EMAC1_OCP_RESET 41 | ||
40 | #define EMAC2_OCP_RESET 42 | ||
41 | #define USB0_OCP_RESET 43 | ||
42 | #define USB1_OCP_RESET 44 | ||
43 | #define NAND_OCP_RESET 45 | ||
44 | /* 46 is empty */ | ||
45 | #define SDMMC_OCP_RESET 47 | ||
46 | #define DMA_RESET 48 | ||
47 | #define SPIM0_RESET 49 | ||
48 | #define SPIM1_RESET 50 | ||
49 | #define SPIS0_RESET 51 | ||
50 | #define SPIS1_RESET 52 | ||
51 | #define DMA_OCP_RESET 53 | ||
52 | #define EMAC_PTP_RESET 54 | ||
53 | /* 55 is empty*/ | ||
54 | #define DMAIF0_RESET 56 | ||
55 | #define DMAIF1_RESET 57 | ||
56 | #define DMAIF2_RESET 58 | ||
57 | #define DMAIF3_RESET 59 | ||
58 | #define DMAIF4_RESET 60 | ||
59 | #define DMAIF5_RESET 61 | ||
60 | #define DMAIF6_RESET 62 | ||
61 | #define DMAIF7_RESET 63 | ||
62 | |||
63 | /* PER1MODRST */ | ||
64 | #define WATCHDOG0_RESET 64 | ||
65 | #define WATCHDOG1_RESET 65 | ||
66 | #define WATCHDOG2_RESET 66 | ||
67 | #define WATCHDOG3_RESET 67 | ||
68 | #define L4SYSTIMER0_RESET 68 | ||
69 | #define L4SYSTIMER1_RESET 69 | ||
70 | #define SPTIMER0_RESET 70 | ||
71 | #define SPTIMER1_RESET 71 | ||
72 | #define I2C0_RESET 72 | ||
73 | #define I2C1_RESET 73 | ||
74 | #define I2C2_RESET 74 | ||
75 | #define I2C3_RESET 75 | ||
76 | #define I2C4_RESET 76 | ||
77 | /* 77-79 is empty */ | ||
78 | #define UART0_RESET 80 | ||
79 | #define UART1_RESET 81 | ||
80 | /* 82-87 is empty */ | ||
81 | #define GPIO0_RESET 88 | ||
82 | #define GPIO1_RESET 89 | ||
83 | |||
84 | /* BRGMODRST */ | ||
85 | #define SOC2FPGA_RESET 96 | ||
86 | #define LWHPS2FPGA_RESET 97 | ||
87 | #define FPGA2SOC_RESET 98 | ||
88 | #define F2SSDRAM0_RESET 99 | ||
89 | #define F2SSDRAM1_RESET 100 | ||
90 | #define F2SSDRAM2_RESET 101 | ||
91 | #define DDRSCH_RESET 102 | ||
92 | |||
93 | /* COLDMODRST */ | ||
94 | #define CPUPO0_RESET 160 | ||
95 | #define CPUPO1_RESET 161 | ||
96 | #define CPUPO2_RESET 162 | ||
97 | #define CPUPO3_RESET 163 | ||
98 | /* 164-167 is empty */ | ||
99 | #define L2_RESET 168 | ||
100 | |||
101 | /* DBGMODRST */ | ||
102 | #define DBG_RESET 224 | ||
103 | #define CSDAP_RESET 225 | ||
104 | |||
105 | /* TAPMODRST */ | ||
106 | #define TAP_RESET 256 | ||
107 | |||
108 | #endif | ||