Skip to content

Commit 85a03fe

Browse files
committed
Merge tag 'reset-for-4.19' of git://git.pengutronix.de/git/pza/linux into next/drivers
Reset controller changes for v4.19 This adds new drivers and bindings for the SDM845 AOSS (always on subsystem) reset controller and for the Uniphier USB3 core reset. SPI controller resets are added to the Uniphier reset driver. * tag 'reset-for-4.19' of git://git.pengutronix.de/git/pza/linux: reset: uniphier: add reset control support for SPI reset: uniphier: add USB3 core reset control dt-bindings: reset: uniphier: add USB3 core reset support reset: simple: export reset_simple_ops to be referred from modules reset: qcom: AOSS (always on subsystem) reset controller dt-bindings: reset: Add AOSS reset bindings for SDM845 SoCs Signed-off-by: Olof Johansson <olof@lixom.net>
2 parents 4726245 + 6b39fd5 commit 85a03fe

9 files changed

Lines changed: 460 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
Qualcomm AOSS Reset Controller
2+
======================================
3+
4+
This binding describes a reset-controller found on AOSS-CC (always on subsystem)
5+
for Qualcomm SDM845 SoCs.
6+
7+
Required properties:
8+
- compatible:
9+
Usage: required
10+
Value type: <string>
11+
Definition: must be:
12+
"qcom,sdm845-aoss-cc"
13+
14+
- reg:
15+
Usage: required
16+
Value type: <prop-encoded-array>
17+
Definition: must specify the base address and size of the register
18+
space.
19+
20+
- #reset-cells:
21+
Usage: required
22+
Value type: <uint>
23+
Definition: must be 1; cell entry represents the reset index.
24+
25+
Example:
26+
27+
aoss_reset: reset-controller@c2a0000 {
28+
compatible = "qcom,sdm845-aoss-cc";
29+
reg = <0xc2a0000 0x31000>;
30+
#reset-cells = <1>;
31+
};
32+
33+
Specifying reset lines connected to IP modules
34+
==============================================
35+
36+
Device nodes that need access to reset lines should
37+
specify them as a reset phandle in their corresponding node as
38+
specified in reset.txt.
39+
40+
For list of all valid reset indicies see
41+
<dt-bindings/reset/qcom,sdm845-aoss.h>
42+
43+
Example:
44+
45+
modem-pil@4080000 {
46+
...
47+
48+
resets = <&aoss_reset AOSS_CC_MSS_RESTART>;
49+
reset-names = "mss_restart";
50+
51+
...
52+
};

‎Documentation/devicetree/bindings/reset/uniphier-reset.txt‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,59 @@ Example:
118118

119119
other nodes ...
120120
};
121+
122+
123+
USB3 core reset
124+
---------------
125+
126+
USB3 core reset belongs to USB3 glue layer. Before using the core reset,
127+
it is necessary to control the clocks and resets to enable this layer.
128+
These clocks and resets should be described in each property.
129+
130+
Required properties:
131+
- compatible: Should be
132+
"socionext,uniphier-pro4-usb3-reset" - for Pro4 SoC
133+
"socionext,uniphier-pxs2-usb3-reset" - for PXs2 SoC
134+
"socionext,uniphier-ld20-usb3-reset" - for LD20 SoC
135+
"socionext,uniphier-pxs3-usb3-reset" - for PXs3 SoC
136+
- #reset-cells: Should be 1.
137+
- reg: Specifies offset and length of the register set for the device.
138+
- clocks: A list of phandles to the clock gate for USB3 glue layer.
139+
According to the clock-names, appropriate clocks are required.
140+
- clock-names: Should contain
141+
"gio", "link" - for Pro4 SoC
142+
"link" - for others
143+
- resets: A list of phandles to the reset control for USB3 glue layer.
144+
According to the reset-names, appropriate resets are required.
145+
- reset-names: Should contain
146+
"gio", "link" - for Pro4 SoC
147+
"link" - for others
148+
149+
Example:
150+
151+
usb-glue@65b00000 {
152+
compatible = "socionext,uniphier-ld20-dwc3-glue",
153+
"simple-mfd";
154+
#address-cells = <1>;
155+
#size-cells = <1>;
156+
ranges = <0 0x65b00000 0x400>;
157+
158+
usb_rst: reset@0 {
159+
compatible = "socionext,uniphier-ld20-usb3-reset";
160+
reg = <0x0 0x4>;
161+
#reset-cells = <1>;
162+
clock-names = "link";
163+
clocks = <&sys_clk 14>;
164+
reset-names = "link";
165+
resets = <&sys_rst 14>;
166+
};
167+
168+
regulator {
169+
...
170+
};
171+
172+
phy {
173+
...
174+
};
175+
...
176+
};

‎drivers/reset/Kconfig‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ config RESET_PISTACHIO
8282
help
8383
This enables the reset driver for ImgTec Pistachio SoCs.
8484

85+
config RESET_QCOM_AOSS
86+
bool "Qcom AOSS Reset Driver"
87+
depends on ARCH_QCOM || COMPILE_TEST
88+
help
89+
This enables the AOSS (always on subsystem) reset driver
90+
for Qualcomm SDM845 SoCs. Say Y if you want to control
91+
reset signals provided by AOSS for Modem, Venus, ADSP,
92+
GPU, Camera, Wireless, Display subsystem. Otherwise, say N.
93+
8594
config RESET_SIMPLE
8695
bool "Simple Reset Controller Driver" if COMPILE_TEST
8796
default ARCH_SOCFPGA || ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || ARCH_ZX || ARCH_ASPEED
@@ -138,6 +147,16 @@ config RESET_UNIPHIER
138147
Say Y if you want to control reset signals provided by System Control
139148
block, Media I/O block, Peripheral Block.
140149

150+
config RESET_UNIPHIER_USB3
151+
tristate "USB3 reset driver for UniPhier SoCs"
152+
depends on (ARCH_UNIPHIER || COMPILE_TEST) && OF
153+
default ARCH_UNIPHIER
154+
select RESET_SIMPLE
155+
help
156+
Support for the USB3 core reset on UniPhier SoCs.
157+
Say Y if you want to control reset signals provided by
158+
USB3 glue layer.
159+
141160
config RESET_ZYNQ
142161
bool "ZYNQ Reset Driver" if COMPILE_TEST
143162
default ARCH_ZYNQ

‎drivers/reset/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o
1414
obj-$(CONFIG_RESET_MESON) += reset-meson.o
1515
obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o
1616
obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o
17+
obj-$(CONFIG_RESET_QCOM_AOSS) += reset-qcom-aoss.o
1718
obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o
1819
obj-$(CONFIG_RESET_STM32MP157) += reset-stm32mp1.o
1920
obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
2021
obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o
2122
obj-$(CONFIG_RESET_TI_SYSCON) += reset-ti-syscon.o
2223
obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o
24+
obj-$(CONFIG_RESET_UNIPHIER_USB3) += reset-uniphier-usb3.o
2325
obj-$(CONFIG_RESET_ZYNQ) += reset-zynq.o
2426

‎drivers/reset/reset-qcom-aoss.c‎

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Copyright (C) 2018 The Linux Foundation. All rights reserved.
4+
*/
5+
6+
#include <linux/module.h>
7+
#include <linux/platform_device.h>
8+
#include <linux/reset-controller.h>
9+
#include <linux/delay.h>
10+
#include <linux/io.h>
11+
#include <linux/of_device.h>
12+
#include <dt-bindings/reset/qcom,sdm845-aoss.h>
13+
14+
struct qcom_aoss_reset_map {
15+
unsigned int reg;
16+
};
17+
18+
struct qcom_aoss_desc {
19+
const struct qcom_aoss_reset_map *resets;
20+
size_t num_resets;
21+
};
22+
23+
struct qcom_aoss_reset_data {
24+
struct reset_controller_dev rcdev;
25+
void __iomem *base;
26+
const struct qcom_aoss_desc *desc;
27+
};
28+
29+
static const struct qcom_aoss_reset_map sdm845_aoss_resets[] = {
30+
[AOSS_CC_MSS_RESTART] = {0x10000},
31+
[AOSS_CC_CAMSS_RESTART] = {0x11000},
32+
[AOSS_CC_VENUS_RESTART] = {0x12000},
33+
[AOSS_CC_GPU_RESTART] = {0x13000},
34+
[AOSS_CC_DISPSS_RESTART] = {0x14000},
35+
[AOSS_CC_WCSS_RESTART] = {0x20000},
36+
[AOSS_CC_LPASS_RESTART] = {0x30000},
37+
};
38+
39+
static const struct qcom_aoss_desc sdm845_aoss_desc = {
40+
.resets = sdm845_aoss_resets,
41+
.num_resets = ARRAY_SIZE(sdm845_aoss_resets),
42+
};
43+
44+
static inline struct qcom_aoss_reset_data *to_qcom_aoss_reset_data(
45+
struct reset_controller_dev *rcdev)
46+
{
47+
return container_of(rcdev, struct qcom_aoss_reset_data, rcdev);
48+
}
49+
50+
static int qcom_aoss_control_assert(struct reset_controller_dev *rcdev,
51+
unsigned long idx)
52+
{
53+
struct qcom_aoss_reset_data *data = to_qcom_aoss_reset_data(rcdev);
54+
const struct qcom_aoss_reset_map *map = &data->desc->resets[idx];
55+
56+
writel(1, data->base + map->reg);
57+
/* Wait 6 32kHz sleep cycles for reset */
58+
usleep_range(200, 300);
59+
return 0;
60+
}
61+
62+
static int qcom_aoss_control_deassert(struct reset_controller_dev *rcdev,
63+
unsigned long idx)
64+
{
65+
struct qcom_aoss_reset_data *data = to_qcom_aoss_reset_data(rcdev);
66+
const struct qcom_aoss_reset_map *map = &data->desc->resets[idx];
67+
68+
writel(0, data->base + map->reg);
69+
/* Wait 6 32kHz sleep cycles for reset */
70+
usleep_range(200, 300);
71+
return 0;
72+
}
73+
74+
static int qcom_aoss_control_reset(struct reset_controller_dev *rcdev,
75+
unsigned long idx)
76+
{
77+
qcom_aoss_control_assert(rcdev, idx);
78+
79+
return qcom_aoss_control_deassert(rcdev, idx);
80+
}
81+
82+
static const struct reset_control_ops qcom_aoss_reset_ops = {
83+
.reset = qcom_aoss_control_reset,
84+
.assert = qcom_aoss_control_assert,
85+
.deassert = qcom_aoss_control_deassert,
86+
};
87+
88+
static int qcom_aoss_reset_probe(struct platform_device *pdev)
89+
{
90+
struct qcom_aoss_reset_data *data;
91+
struct device *dev = &pdev->dev;
92+
const struct qcom_aoss_desc *desc;
93+
struct resource *res;
94+
95+
desc = of_device_get_match_data(dev);
96+
if (!desc)
97+
return -EINVAL;
98+
99+
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
100+
if (!data)
101+
return -ENOMEM;
102+
103+
data->desc = desc;
104+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
105+
data->base = devm_ioremap_resource(dev, res);
106+
if (IS_ERR(data->base))
107+
return PTR_ERR(data->base);
108+
109+
data->rcdev.owner = THIS_MODULE;
110+
data->rcdev.ops = &qcom_aoss_reset_ops;
111+
data->rcdev.nr_resets = desc->num_resets;
112+
data->rcdev.of_node = dev->of_node;
113+
114+
return devm_reset_controller_register(dev, &data->rcdev);
115+
}
116+
117+
static const struct of_device_id qcom_aoss_reset_of_match[] = {
118+
{ .compatible = "qcom,sdm845-aoss-cc", .data = &sdm845_aoss_desc },
119+
{}
120+
};
121+
122+
static struct platform_driver qcom_aoss_reset_driver = {
123+
.probe = qcom_aoss_reset_probe,
124+
.driver = {
125+
.name = "qcom_aoss_reset",
126+
.of_match_table = qcom_aoss_reset_of_match,
127+
},
128+
};
129+
130+
builtin_platform_driver(qcom_aoss_reset_driver);
131+
132+
MODULE_DESCRIPTION("Qualcomm AOSS Reset Driver");
133+
MODULE_LICENSE("GPL v2");

‎drivers/reset/reset-simple.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ const struct reset_control_ops reset_simple_ops = {
8787
.deassert = reset_simple_deassert,
8888
.status = reset_simple_status,
8989
};
90+
EXPORT_SYMBOL_GPL(reset_simple_ops);
9091

9192
/**
9293
* struct reset_simple_devdata - simple reset controller properties

0 commit comments

Comments
 (0)