Skip to content

Commit 9e586c8

Browse files
committed
Merge tag 'reset-for-v5.9' of git://git.pengutronix.de/pza/linux into arm/drivers
Reset controller updates for v5.9 This tag moves the reset-simple header out of drivers/reset for use by drivers outside of drivers/reset, adds a .reset() callback to reset-simple, converts i.MX reset bindings to json-schema, fixes a compile warning in the reset-intel-gw driver, and replaces some HTTP links with HTTPS ones in comments. * tag 'reset-for-v5.9' of git://git.pengutronix.de/pza/linux: reset: Replace HTTP links with HTTPS ones reset: intel: fix a compile warning about REG_OFFSET redefined dt-bindings: reset: Convert i.MX7 reset to json-schema dt-bindings: reset: Convert i.MX reset to json-schema reset: simple: Add reset callback reset: Move reset-simple header out of drivers/reset Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents 00067ca + ffebbec commit 9e586c8

File tree

12 files changed

+185
-127
lines changed

12 files changed

+185
-127
lines changed

Documentation/devicetree/bindings/reset/fsl,imx-src.txt

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/reset/fsl,imx-src.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Freescale i.MX System Reset Controller
8+
9+
maintainers:
10+
- Philipp Zabel <[email protected]>
11+
12+
description: |
13+
The system reset controller can be used to reset the GPU, VPU,
14+
IPU, and OpenVG IP modules on i.MX5 and i.MX6 ICs. Those device
15+
nodes should specify the reset line on the SRC in their resets
16+
property, containing a phandle to the SRC device node and a
17+
RESET_INDEX specifying which module to reset, as described in
18+
reset.txt
19+
20+
The following RESET_INDEX values are valid for i.MX5:
21+
GPU_RESET 0
22+
VPU_RESET 1
23+
IPU1_RESET 2
24+
OPEN_VG_RESET 3
25+
The following additional RESET_INDEX value is valid for i.MX6:
26+
IPU2_RESET 4
27+
28+
properties:
29+
compatible:
30+
oneOf:
31+
- const: "fsl,imx51-src"
32+
- items:
33+
- const: "fsl,imx50-src"
34+
- const: "fsl,imx51-src"
35+
- items:
36+
- const: "fsl,imx53-src"
37+
- const: "fsl,imx51-src"
38+
- items:
39+
- const: "fsl,imx6q-src"
40+
- const: "fsl,imx51-src"
41+
- items:
42+
- const: "fsl,imx6sx-src"
43+
- const: "fsl,imx51-src"
44+
- items:
45+
- const: "fsl,imx6sl-src"
46+
- const: "fsl,imx51-src"
47+
- items:
48+
- const: "fsl,imx6ul-src"
49+
- const: "fsl,imx51-src"
50+
- items:
51+
- const: "fsl,imx6sll-src"
52+
- const: "fsl,imx51-src"
53+
54+
reg:
55+
maxItems: 1
56+
57+
interrupts:
58+
items:
59+
- description: SRC interrupt
60+
- description: CPU WDOG interrupts out of SRC
61+
minItems: 1
62+
maxItems: 2
63+
64+
'#reset-cells':
65+
const: 1
66+
67+
required:
68+
- compatible
69+
- reg
70+
- interrupts
71+
- '#reset-cells'
72+
73+
additionalProperties: false
74+
75+
examples:
76+
- |
77+
reset-controller@73fd0000 {
78+
compatible = "fsl,imx51-src";
79+
reg = <0x73fd0000 0x4000>;
80+
interrupts = <75>;
81+
#reset-cells = <1>;
82+
};

Documentation/devicetree/bindings/reset/fsl,imx7-src.txt

Lines changed: 0 additions & 56 deletions
This file was deleted.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/reset/fsl,imx7-src.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Freescale i.MX7 System Reset Controller
8+
9+
maintainers:
10+
- Andrey Smirnov <[email protected]>
11+
12+
description: |
13+
The system reset controller can be used to reset various set of
14+
peripherals. Device nodes that need access to reset lines should
15+
specify them as a reset phandle in their corresponding node as
16+
specified in reset.txt.
17+
18+
For list of all valid reset indices see
19+
<dt-bindings/reset/imx7-reset.h> for i.MX7,
20+
<dt-bindings/reset/imx8mq-reset.h> for i.MX8MQ, i.MX8MM and i.MX8MN,
21+
<dt-bindings/reset/imx8mp-reset.h> for i.MX8MP.
22+
23+
properties:
24+
compatible:
25+
items:
26+
- enum:
27+
- fsl,imx7d-src
28+
- fsl,imx8mq-src
29+
- fsl,imx8mp-src
30+
- const: syscon
31+
32+
reg:
33+
maxItems: 1
34+
35+
interrupts:
36+
maxItems: 1
37+
38+
'#reset-cells':
39+
const: 1
40+
41+
required:
42+
- compatible
43+
- reg
44+
- interrupts
45+
- '#reset-cells'
46+
47+
additionalProperties: false
48+
49+
examples:
50+
- |
51+
#include <dt-bindings/interrupt-controller/arm-gic.h>
52+
53+
reset-controller@30390000 {
54+
compatible = "fsl,imx7d-src", "syscon";
55+
reg = <0x30390000 0x2000>;
56+
interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
57+
#reset-cells = <1>;
58+
};

drivers/reset/reset-intel-gw.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
#define RCU_RST_STAT 0x0024
1616
#define RCU_RST_REQ 0x0048
1717

18-
#define REG_OFFSET GENMASK(31, 16)
19-
#define BIT_OFFSET GENMASK(15, 8)
20-
#define STAT_BIT_OFFSET GENMASK(7, 0)
18+
#define REG_OFFSET_MASK GENMASK(31, 16)
19+
#define BIT_OFFSET_MASK GENMASK(15, 8)
20+
#define STAT_BIT_OFFSET_MASK GENMASK(7, 0)
2121

2222
#define to_reset_data(x) container_of(x, struct intel_reset_data, rcdev)
2323

@@ -51,11 +51,11 @@ static u32 id_to_reg_and_bit_offsets(struct intel_reset_data *data,
5151
unsigned long id, u32 *rst_req,
5252
u32 *req_bit, u32 *stat_bit)
5353
{
54-
*rst_req = FIELD_GET(REG_OFFSET, id);
55-
*req_bit = FIELD_GET(BIT_OFFSET, id);
54+
*rst_req = FIELD_GET(REG_OFFSET_MASK, id);
55+
*req_bit = FIELD_GET(BIT_OFFSET_MASK, id);
5656

5757
if (data->soc_data->legacy)
58-
*stat_bit = FIELD_GET(STAT_BIT_OFFSET, id);
58+
*stat_bit = FIELD_GET(STAT_BIT_OFFSET_MASK, id);
5959
else
6060
*stat_bit = *req_bit;
6161

@@ -141,14 +141,14 @@ static int intel_reset_xlate(struct reset_controller_dev *rcdev,
141141
if (spec->args[1] > 31)
142142
return -EINVAL;
143143

144-
id = FIELD_PREP(REG_OFFSET, spec->args[0]);
145-
id |= FIELD_PREP(BIT_OFFSET, spec->args[1]);
144+
id = FIELD_PREP(REG_OFFSET_MASK, spec->args[0]);
145+
id |= FIELD_PREP(BIT_OFFSET_MASK, spec->args[1]);
146146

147147
if (data->soc_data->legacy) {
148148
if (spec->args[2] > 31)
149149
return -EINVAL;
150150

151-
id |= FIELD_PREP(STAT_BIT_OFFSET, spec->args[2]);
151+
id |= FIELD_PREP(STAT_BIT_OFFSET_MASK, spec->args[2]);
152152
}
153153

154154
return id;
@@ -210,11 +210,11 @@ static int intel_reset_probe(struct platform_device *pdev)
210210
if (ret)
211211
return ret;
212212

213-
data->reboot_id = FIELD_PREP(REG_OFFSET, rb_id[0]);
214-
data->reboot_id |= FIELD_PREP(BIT_OFFSET, rb_id[1]);
213+
data->reboot_id = FIELD_PREP(REG_OFFSET_MASK, rb_id[0]);
214+
data->reboot_id |= FIELD_PREP(BIT_OFFSET_MASK, rb_id[1]);
215215

216216
if (data->soc_data->legacy)
217-
data->reboot_id |= FIELD_PREP(STAT_BIT_OFFSET, rb_id[2]);
217+
data->reboot_id |= FIELD_PREP(STAT_BIT_OFFSET_MASK, rb_id[2]);
218218

219219
data->restart_nb.notifier_call = intel_reset_restart_handler;
220220
data->restart_nb.priority = 128;

drivers/reset/reset-simple.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
* Maxime Ripard <[email protected]>
1212
*/
1313

14+
#include <linux/delay.h>
1415
#include <linux/device.h>
1516
#include <linux/err.h>
1617
#include <linux/io.h>
1718
#include <linux/of.h>
1819
#include <linux/of_device.h>
1920
#include <linux/platform_device.h>
2021
#include <linux/reset-controller.h>
22+
#include <linux/reset/reset-simple.h>
2123
#include <linux/spinlock.h>
2224

23-
#include "reset-simple.h"
24-
2525
static inline struct reset_simple_data *
2626
to_reset_simple_data(struct reset_controller_dev *rcdev)
2727
{
@@ -64,6 +64,24 @@ static int reset_simple_deassert(struct reset_controller_dev *rcdev,
6464
return reset_simple_update(rcdev, id, false);
6565
}
6666

67+
static int reset_simple_reset(struct reset_controller_dev *rcdev,
68+
unsigned long id)
69+
{
70+
struct reset_simple_data *data = to_reset_simple_data(rcdev);
71+
int ret;
72+
73+
if (!data->reset_us)
74+
return -ENOTSUPP;
75+
76+
ret = reset_simple_assert(rcdev, id);
77+
if (ret)
78+
return ret;
79+
80+
usleep_range(data->reset_us, data->reset_us * 2);
81+
82+
return reset_simple_deassert(rcdev, id);
83+
}
84+
6785
static int reset_simple_status(struct reset_controller_dev *rcdev,
6886
unsigned long id)
6987
{
@@ -81,6 +99,7 @@ static int reset_simple_status(struct reset_controller_dev *rcdev,
8199
const struct reset_control_ops reset_simple_ops = {
82100
.assert = reset_simple_assert,
83101
.deassert = reset_simple_deassert,
102+
.reset = reset_simple_reset,
84103
.status = reset_simple_status,
85104
};
86105
EXPORT_SYMBOL_GPL(reset_simple_ops);

drivers/reset/reset-socfpga.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
#include <linux/of_address.h>
1212
#include <linux/platform_device.h>
1313
#include <linux/reset-controller.h>
14+
#include <linux/reset/reset-simple.h>
1415
#include <linux/reset/socfpga.h>
1516
#include <linux/slab.h>
1617
#include <linux/spinlock.h>
1718
#include <linux/types.h>
1819

19-
#include "reset-simple.h"
20-
2120
#define SOCFPGA_NR_BANKS 8
2221

2322
static int a10_reset_init(struct device_node *np)

drivers/reset/reset-sunxi.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414
#include <linux/of_address.h>
1515
#include <linux/platform_device.h>
1616
#include <linux/reset-controller.h>
17+
#include <linux/reset/reset-simple.h>
1718
#include <linux/reset/sunxi.h>
1819
#include <linux/slab.h>
1920
#include <linux/spinlock.h>
2021
#include <linux/types.h>
2122

22-
#include "reset-simple.h"
23-
2423
static int sunxi_reset_init(struct device_node *np)
2524
{
2625
struct reset_simple_data *data;

0 commit comments

Comments
 (0)