diff options
author | Arnd Bergmann <arnd@arndb.de> | 2019-02-15 11:21:04 -0500 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2019-02-15 11:21:32 -0500 |
commit | 6f2185f8e345c9023bdd030d7dae4affd6bea539 (patch) | |
tree | f504a5e0b2f964818a02096e4647f686ef1b9d92 /drivers/reset | |
parent | 1d03f187f6f9b14852d3b5d7cfe14578e3c0b7cc (diff) | |
parent | dbfc54534dfcaee004d54137d9b34d000f847e41 (diff) |
Merge tag 'reset-for-5.1' of git://git.pengutronix.de/git/pza/linux into arm/drivers
Reset controller changes for v5.1
This adds the include/linux/reset directory to MAINTAINERS for reset
specific headers and adds headers for sunxi and socfpga in there to
get rid of a few extern function declarations.
There is a new reset driver for the Broadcom STB reset controller and
the i.MX7 system reset controller driver is extended to support i.MX8MQ
as well. Finally, there is a new header with reset id constants for
the Meson G12A SoC, which has a reset controller identical to Meson AXG
and thus can reuse its driver and DT bindings.
* tag 'reset-for-5.1' of git://git.pengutronix.de/git/pza/linux:
dt-bindings: reset: meson: add g12a bindings
reset: imx7: Add support for i.MX8MQ IP block variant
reset: imx7: Add plubming to support multiple IP variants
reset: Add Broadcom STB SW_INIT reset controller driver
dt-bindings: reset: Add document for Broadcom STB reset controller
reset: socfpga: declare socfpga_reset_init in a header file
reset: sunxi: declare sun6i_reset_init in a header file
MAINTAINERS: use include/linux/reset for reset controller related headers
dt-bindings: reset: imx7: Document usage on i.MX8MQ SoCs
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/reset')
-rw-r--r-- | drivers/reset/Kconfig | 12 | ||||
-rw-r--r-- | drivers/reset/Makefile | 1 | ||||
-rw-r--r-- | drivers/reset/reset-brcmstb.c | 132 | ||||
-rw-r--r-- | drivers/reset/reset-imx7.c | 172 | ||||
-rw-r--r-- | drivers/reset/reset-socfpga.c | 2 | ||||
-rw-r--r-- | drivers/reset/reset-sunxi.c | 1 |
6 files changed, 303 insertions, 17 deletions
diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig index 2e01bd833ffd..2c8c23db92fb 100644 --- a/drivers/reset/Kconfig +++ b/drivers/reset/Kconfig | |||
@@ -40,6 +40,14 @@ config RESET_BERLIN | |||
40 | help | 40 | help |
41 | This enables the reset controller driver for Marvell Berlin SoCs. | 41 | This enables the reset controller driver for Marvell Berlin SoCs. |
42 | 42 | ||
43 | config RESET_BRCMSTB | ||
44 | tristate "Broadcom STB reset controller" | ||
45 | depends on ARCH_BRCMSTB || COMPILE_TEST | ||
46 | default ARCH_BRCMSTB | ||
47 | help | ||
48 | This enables the reset controller driver for Broadcom STB SoCs using | ||
49 | a SUN_TOP_CTRL_SW_INIT style controller. | ||
50 | |||
43 | config RESET_HSDK | 51 | config RESET_HSDK |
44 | bool "Synopsys HSDK Reset Driver" | 52 | bool "Synopsys HSDK Reset Driver" |
45 | depends on HAS_IOMEM | 53 | depends on HAS_IOMEM |
@@ -48,9 +56,9 @@ config RESET_HSDK | |||
48 | This enables the reset controller driver for HSDK board. | 56 | This enables the reset controller driver for HSDK board. |
49 | 57 | ||
50 | config RESET_IMX7 | 58 | config RESET_IMX7 |
51 | bool "i.MX7 Reset Driver" if COMPILE_TEST | 59 | bool "i.MX7/8 Reset Driver" if COMPILE_TEST |
52 | depends on HAS_IOMEM | 60 | depends on HAS_IOMEM |
53 | default SOC_IMX7D | 61 | default SOC_IMX7D || (ARM64 && ARCH_MXC) |
54 | select MFD_SYSCON | 62 | select MFD_SYSCON |
55 | help | 63 | help |
56 | This enables the reset controller driver for i.MX7 SoCs. | 64 | This enables the reset controller driver for i.MX7 SoCs. |
diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile index 573b8386d901..61456b8f659c 100644 --- a/drivers/reset/Makefile +++ b/drivers/reset/Makefile | |||
@@ -7,6 +7,7 @@ obj-$(CONFIG_RESET_A10SR) += reset-a10sr.o | |||
7 | obj-$(CONFIG_RESET_ATH79) += reset-ath79.o | 7 | obj-$(CONFIG_RESET_ATH79) += reset-ath79.o |
8 | obj-$(CONFIG_RESET_AXS10X) += reset-axs10x.o | 8 | obj-$(CONFIG_RESET_AXS10X) += reset-axs10x.o |
9 | obj-$(CONFIG_RESET_BERLIN) += reset-berlin.o | 9 | obj-$(CONFIG_RESET_BERLIN) += reset-berlin.o |
10 | obj-$(CONFIG_RESET_BRCMSTB) += reset-brcmstb.o | ||
10 | obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o | 11 | obj-$(CONFIG_RESET_HSDK) += reset-hsdk.o |
11 | obj-$(CONFIG_RESET_IMX7) += reset-imx7.o | 12 | obj-$(CONFIG_RESET_IMX7) += reset-imx7.o |
12 | obj-$(CONFIG_RESET_LANTIQ) += reset-lantiq.o | 13 | obj-$(CONFIG_RESET_LANTIQ) += reset-lantiq.o |
diff --git a/drivers/reset/reset-brcmstb.c b/drivers/reset/reset-brcmstb.c new file mode 100644 index 000000000000..a608f445dad6 --- /dev/null +++ b/drivers/reset/reset-brcmstb.c | |||
@@ -0,0 +1,132 @@ | |||
1 | // SPDX-License-Identifier: GPL-2.0 | ||
2 | /* | ||
3 | * Broadcom STB generic reset controller for SW_INIT style reset controller | ||
4 | * | ||
5 | * Author: Florian Fainelli <f.fainelli@gmail.com> | ||
6 | * Copyright (C) 2018 Broadcom | ||
7 | */ | ||
8 | #include <linux/delay.h> | ||
9 | #include <linux/device.h> | ||
10 | #include <linux/io.h> | ||
11 | #include <linux/module.h> | ||
12 | #include <linux/of.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/reset-controller.h> | ||
15 | #include <linux/types.h> | ||
16 | |||
17 | struct brcmstb_reset { | ||
18 | void __iomem *base; | ||
19 | struct reset_controller_dev rcdev; | ||
20 | }; | ||
21 | |||
22 | #define SW_INIT_SET 0x00 | ||
23 | #define SW_INIT_CLEAR 0x04 | ||
24 | #define SW_INIT_STATUS 0x08 | ||
25 | |||
26 | #define SW_INIT_BIT(id) BIT((id) & 0x1f) | ||
27 | #define SW_INIT_BANK(id) ((id) >> 5) | ||
28 | |||
29 | /* A full bank contains extra registers that we are not utilizing but still | ||
30 | * qualify as a single bank. | ||
31 | */ | ||
32 | #define SW_INIT_BANK_SIZE 0x18 | ||
33 | |||
34 | static inline | ||
35 | struct brcmstb_reset *to_brcmstb(struct reset_controller_dev *rcdev) | ||
36 | { | ||
37 | return container_of(rcdev, struct brcmstb_reset, rcdev); | ||
38 | } | ||
39 | |||
40 | static int brcmstb_reset_assert(struct reset_controller_dev *rcdev, | ||
41 | unsigned long id) | ||
42 | { | ||
43 | unsigned int off = SW_INIT_BANK(id) * SW_INIT_BANK_SIZE; | ||
44 | struct brcmstb_reset *priv = to_brcmstb(rcdev); | ||
45 | |||
46 | writel_relaxed(SW_INIT_BIT(id), priv->base + off + SW_INIT_SET); | ||
47 | |||
48 | return 0; | ||
49 | } | ||
50 | |||
51 | static int brcmstb_reset_deassert(struct reset_controller_dev *rcdev, | ||
52 | unsigned long id) | ||
53 | { | ||
54 | unsigned int off = SW_INIT_BANK(id) * SW_INIT_BANK_SIZE; | ||
55 | struct brcmstb_reset *priv = to_brcmstb(rcdev); | ||
56 | |||
57 | writel_relaxed(SW_INIT_BIT(id), priv->base + off + SW_INIT_CLEAR); | ||
58 | /* Maximum reset delay after de-asserting a line and seeing block | ||
59 | * operation is typically 14us for the worst case, build some slack | ||
60 | * here. | ||
61 | */ | ||
62 | usleep_range(100, 200); | ||
63 | |||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static int brcmstb_reset_status(struct reset_controller_dev *rcdev, | ||
68 | unsigned long id) | ||
69 | { | ||
70 | unsigned int off = SW_INIT_BANK(id) * SW_INIT_BANK_SIZE; | ||
71 | struct brcmstb_reset *priv = to_brcmstb(rcdev); | ||
72 | |||
73 | return readl_relaxed(priv->base + off + SW_INIT_STATUS) & | ||
74 | SW_INIT_BIT(id); | ||
75 | } | ||
76 | |||
77 | static const struct reset_control_ops brcmstb_reset_ops = { | ||
78 | .assert = brcmstb_reset_assert, | ||
79 | .deassert = brcmstb_reset_deassert, | ||
80 | .status = brcmstb_reset_status, | ||
81 | }; | ||
82 | |||
83 | static int brcmstb_reset_probe(struct platform_device *pdev) | ||
84 | { | ||
85 | struct device *kdev = &pdev->dev; | ||
86 | struct brcmstb_reset *priv; | ||
87 | struct resource *res; | ||
88 | |||
89 | priv = devm_kzalloc(kdev, sizeof(*priv), GFP_KERNEL); | ||
90 | if (!priv) | ||
91 | return -ENOMEM; | ||
92 | |||
93 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
94 | if (!IS_ALIGNED(res->start, SW_INIT_BANK_SIZE) || | ||
95 | !IS_ALIGNED(resource_size(res), SW_INIT_BANK_SIZE)) { | ||
96 | dev_err(kdev, "incorrect register range\n"); | ||
97 | return -EINVAL; | ||
98 | } | ||
99 | |||
100 | priv->base = devm_ioremap_resource(kdev, res); | ||
101 | if (IS_ERR(priv->base)) | ||
102 | return PTR_ERR(priv->base); | ||
103 | |||
104 | dev_set_drvdata(kdev, priv); | ||
105 | |||
106 | priv->rcdev.owner = THIS_MODULE; | ||
107 | priv->rcdev.nr_resets = DIV_ROUND_DOWN_ULL(resource_size(res), | ||
108 | SW_INIT_BANK_SIZE) * 32; | ||
109 | priv->rcdev.ops = &brcmstb_reset_ops; | ||
110 | priv->rcdev.of_node = kdev->of_node; | ||
111 | /* Use defaults: 1 cell and simple xlate function */ | ||
112 | |||
113 | return devm_reset_controller_register(kdev, &priv->rcdev); | ||
114 | } | ||
115 | |||
116 | static const struct of_device_id brcmstb_reset_of_match[] = { | ||
117 | { .compatible = "brcm,brcmstb-reset" }, | ||
118 | { /* sentinel */ } | ||
119 | }; | ||
120 | |||
121 | static struct platform_driver brcmstb_reset_driver = { | ||
122 | .probe = brcmstb_reset_probe, | ||
123 | .driver = { | ||
124 | .name = "brcmstb-reset", | ||
125 | .of_match_table = brcmstb_reset_of_match, | ||
126 | }, | ||
127 | }; | ||
128 | module_platform_driver(brcmstb_reset_driver); | ||
129 | |||
130 | MODULE_AUTHOR("Broadcom"); | ||
131 | MODULE_DESCRIPTION("Broadcom STB reset controller"); | ||
132 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/reset/reset-imx7.c b/drivers/reset/reset-imx7.c index 77911fa8f31d..aed76e33a0a9 100644 --- a/drivers/reset/reset-imx7.c +++ b/drivers/reset/reset-imx7.c | |||
@@ -17,14 +17,27 @@ | |||
17 | 17 | ||
18 | #include <linux/mfd/syscon.h> | 18 | #include <linux/mfd/syscon.h> |
19 | #include <linux/mod_devicetable.h> | 19 | #include <linux/mod_devicetable.h> |
20 | #include <linux/of_device.h> | ||
20 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
21 | #include <linux/reset-controller.h> | 22 | #include <linux/reset-controller.h> |
22 | #include <linux/regmap.h> | 23 | #include <linux/regmap.h> |
23 | #include <dt-bindings/reset/imx7-reset.h> | 24 | #include <dt-bindings/reset/imx7-reset.h> |
25 | #include <dt-bindings/reset/imx8mq-reset.h> | ||
26 | |||
27 | struct imx7_src_signal { | ||
28 | unsigned int offset, bit; | ||
29 | }; | ||
30 | |||
31 | struct imx7_src_variant { | ||
32 | const struct imx7_src_signal *signals; | ||
33 | unsigned int signals_num; | ||
34 | struct reset_control_ops ops; | ||
35 | }; | ||
24 | 36 | ||
25 | struct imx7_src { | 37 | struct imx7_src { |
26 | struct reset_controller_dev rcdev; | 38 | struct reset_controller_dev rcdev; |
27 | struct regmap *regmap; | 39 | struct regmap *regmap; |
40 | const struct imx7_src_signal *signals; | ||
28 | }; | 41 | }; |
29 | 42 | ||
30 | enum imx7_src_registers { | 43 | enum imx7_src_registers { |
@@ -39,9 +52,14 @@ enum imx7_src_registers { | |||
39 | SRC_DDRC_RCR = 0x1000, | 52 | SRC_DDRC_RCR = 0x1000, |
40 | }; | 53 | }; |
41 | 54 | ||
42 | struct imx7_src_signal { | 55 | static int imx7_reset_update(struct imx7_src *imx7src, |
43 | unsigned int offset, bit; | 56 | unsigned long id, unsigned int value) |
44 | }; | 57 | { |
58 | const struct imx7_src_signal *signal = &imx7src->signals[id]; | ||
59 | |||
60 | return regmap_update_bits(imx7src->regmap, | ||
61 | signal->offset, signal->bit, value); | ||
62 | } | ||
45 | 63 | ||
46 | static const struct imx7_src_signal imx7_src_signals[IMX7_RESET_NUM] = { | 64 | static const struct imx7_src_signal imx7_src_signals[IMX7_RESET_NUM] = { |
47 | [IMX7_RESET_A7_CORE_POR_RESET0] = { SRC_A7RCR0, BIT(0) }, | 65 | [IMX7_RESET_A7_CORE_POR_RESET0] = { SRC_A7RCR0, BIT(0) }, |
@@ -81,8 +99,8 @@ static int imx7_reset_set(struct reset_controller_dev *rcdev, | |||
81 | unsigned long id, bool assert) | 99 | unsigned long id, bool assert) |
82 | { | 100 | { |
83 | struct imx7_src *imx7src = to_imx7_src(rcdev); | 101 | struct imx7_src *imx7src = to_imx7_src(rcdev); |
84 | const struct imx7_src_signal *signal = &imx7_src_signals[id]; | 102 | const unsigned int bit = imx7src->signals[id].bit; |
85 | unsigned int value = assert ? signal->bit : 0; | 103 | unsigned int value = assert ? bit : 0; |
86 | 104 | ||
87 | switch (id) { | 105 | switch (id) { |
88 | case IMX7_RESET_PCIEPHY: | 106 | case IMX7_RESET_PCIEPHY: |
@@ -95,12 +113,11 @@ static int imx7_reset_set(struct reset_controller_dev *rcdev, | |||
95 | break; | 113 | break; |
96 | 114 | ||
97 | case IMX7_RESET_PCIE_CTRL_APPS_EN: | 115 | case IMX7_RESET_PCIE_CTRL_APPS_EN: |
98 | value = (assert) ? 0 : signal->bit; | 116 | value = assert ? 0 : bit; |
99 | break; | 117 | break; |
100 | } | 118 | } |
101 | 119 | ||
102 | return regmap_update_bits(imx7src->regmap, | 120 | return imx7_reset_update(imx7src, id, value); |
103 | signal->offset, signal->bit, value); | ||
104 | } | 121 | } |
105 | 122 | ||
106 | static int imx7_reset_assert(struct reset_controller_dev *rcdev, | 123 | static int imx7_reset_assert(struct reset_controller_dev *rcdev, |
@@ -115,9 +132,133 @@ static int imx7_reset_deassert(struct reset_controller_dev *rcdev, | |||
115 | return imx7_reset_set(rcdev, id, false); | 132 | return imx7_reset_set(rcdev, id, false); |
116 | } | 133 | } |
117 | 134 | ||
118 | static const struct reset_control_ops imx7_reset_ops = { | 135 | static const struct imx7_src_variant variant_imx7 = { |
119 | .assert = imx7_reset_assert, | 136 | .signals = imx7_src_signals, |
120 | .deassert = imx7_reset_deassert, | 137 | .signals_num = ARRAY_SIZE(imx7_src_signals), |
138 | .ops = { | ||
139 | .assert = imx7_reset_assert, | ||
140 | .deassert = imx7_reset_deassert, | ||
141 | }, | ||
142 | }; | ||
143 | |||
144 | enum imx8mq_src_registers { | ||
145 | SRC_A53RCR0 = 0x0004, | ||
146 | SRC_HDMI_RCR = 0x0030, | ||
147 | SRC_DISP_RCR = 0x0034, | ||
148 | SRC_GPU_RCR = 0x0040, | ||
149 | SRC_VPU_RCR = 0x0044, | ||
150 | SRC_PCIE2_RCR = 0x0048, | ||
151 | SRC_MIPIPHY1_RCR = 0x004c, | ||
152 | SRC_MIPIPHY2_RCR = 0x0050, | ||
153 | SRC_DDRC2_RCR = 0x1004, | ||
154 | }; | ||
155 | |||
156 | static const struct imx7_src_signal imx8mq_src_signals[IMX8MQ_RESET_NUM] = { | ||
157 | [IMX8MQ_RESET_A53_CORE_POR_RESET0] = { SRC_A53RCR0, BIT(0) }, | ||
158 | [IMX8MQ_RESET_A53_CORE_POR_RESET1] = { SRC_A53RCR0, BIT(1) }, | ||
159 | [IMX8MQ_RESET_A53_CORE_POR_RESET2] = { SRC_A53RCR0, BIT(2) }, | ||
160 | [IMX8MQ_RESET_A53_CORE_POR_RESET3] = { SRC_A53RCR0, BIT(3) }, | ||
161 | [IMX8MQ_RESET_A53_CORE_RESET0] = { SRC_A53RCR0, BIT(4) }, | ||
162 | [IMX8MQ_RESET_A53_CORE_RESET1] = { SRC_A53RCR0, BIT(5) }, | ||
163 | [IMX8MQ_RESET_A53_CORE_RESET2] = { SRC_A53RCR0, BIT(6) }, | ||
164 | [IMX8MQ_RESET_A53_CORE_RESET3] = { SRC_A53RCR0, BIT(7) }, | ||
165 | [IMX8MQ_RESET_A53_DBG_RESET0] = { SRC_A53RCR0, BIT(8) }, | ||
166 | [IMX8MQ_RESET_A53_DBG_RESET1] = { SRC_A53RCR0, BIT(9) }, | ||
167 | [IMX8MQ_RESET_A53_DBG_RESET2] = { SRC_A53RCR0, BIT(10) }, | ||
168 | [IMX8MQ_RESET_A53_DBG_RESET3] = { SRC_A53RCR0, BIT(11) }, | ||
169 | [IMX8MQ_RESET_A53_ETM_RESET0] = { SRC_A53RCR0, BIT(12) }, | ||
170 | [IMX8MQ_RESET_A53_ETM_RESET1] = { SRC_A53RCR0, BIT(13) }, | ||
171 | [IMX8MQ_RESET_A53_ETM_RESET2] = { SRC_A53RCR0, BIT(14) }, | ||
172 | [IMX8MQ_RESET_A53_ETM_RESET3] = { SRC_A53RCR0, BIT(15) }, | ||
173 | [IMX8MQ_RESET_A53_SOC_DBG_RESET] = { SRC_A53RCR0, BIT(20) }, | ||
174 | [IMX8MQ_RESET_A53_L2RESET] = { SRC_A53RCR0, BIT(21) }, | ||
175 | [IMX8MQ_RESET_SW_NON_SCLR_M4C_RST] = { SRC_M4RCR, BIT(0) }, | ||
176 | [IMX8MQ_RESET_OTG1_PHY_RESET] = { SRC_USBOPHY1_RCR, BIT(0) }, | ||
177 | [IMX8MQ_RESET_OTG2_PHY_RESET] = { SRC_USBOPHY2_RCR, BIT(0) }, | ||
178 | [IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N] = { SRC_MIPIPHY_RCR, BIT(1) }, | ||
179 | [IMX8MQ_RESET_MIPI_DSI_RESET_N] = { SRC_MIPIPHY_RCR, BIT(2) }, | ||
180 | [IMX8MQ_RESET_MIPI_DIS_DPI_RESET_N] = { SRC_MIPIPHY_RCR, BIT(3) }, | ||
181 | [IMX8MQ_RESET_MIPI_DIS_ESC_RESET_N] = { SRC_MIPIPHY_RCR, BIT(4) }, | ||
182 | [IMX8MQ_RESET_MIPI_DIS_PCLK_RESET_N] = { SRC_MIPIPHY_RCR, BIT(5) }, | ||
183 | [IMX8MQ_RESET_PCIEPHY] = { SRC_PCIEPHY_RCR, | ||
184 | BIT(2) | BIT(1) }, | ||
185 | [IMX8MQ_RESET_PCIEPHY_PERST] = { SRC_PCIEPHY_RCR, BIT(3) }, | ||
186 | [IMX8MQ_RESET_PCIE_CTRL_APPS_EN] = { SRC_PCIEPHY_RCR, BIT(6) }, | ||
187 | [IMX8MQ_RESET_PCIE_CTRL_APPS_TURNOFF] = { SRC_PCIEPHY_RCR, BIT(11) }, | ||
188 | [IMX8MQ_RESET_HDMI_PHY_APB_RESET] = { SRC_HDMI_RCR, BIT(0) }, | ||
189 | [IMX8MQ_RESET_DISP_RESET] = { SRC_DISP_RCR, BIT(0) }, | ||
190 | [IMX8MQ_RESET_GPU_RESET] = { SRC_GPU_RCR, BIT(0) }, | ||
191 | [IMX8MQ_RESET_VPU_RESET] = { SRC_VPU_RCR, BIT(0) }, | ||
192 | [IMX8MQ_RESET_PCIEPHY2] = { SRC_PCIE2_RCR, | ||
193 | BIT(2) | BIT(1) }, | ||
194 | [IMX8MQ_RESET_PCIEPHY2_PERST] = { SRC_PCIE2_RCR, BIT(3) }, | ||
195 | [IMX8MQ_RESET_PCIE2_CTRL_APPS_EN] = { SRC_PCIE2_RCR, BIT(6) }, | ||
196 | [IMX8MQ_RESET_PCIE2_CTRL_APPS_TURNOFF] = { SRC_PCIE2_RCR, BIT(11) }, | ||
197 | [IMX8MQ_RESET_MIPI_CSI1_CORE_RESET] = { SRC_MIPIPHY1_RCR, BIT(0) }, | ||
198 | [IMX8MQ_RESET_MIPI_CSI1_PHY_REF_RESET] = { SRC_MIPIPHY1_RCR, BIT(1) }, | ||
199 | [IMX8MQ_RESET_MIPI_CSI1_ESC_RESET] = { SRC_MIPIPHY1_RCR, BIT(2) }, | ||
200 | [IMX8MQ_RESET_MIPI_CSI2_CORE_RESET] = { SRC_MIPIPHY2_RCR, BIT(0) }, | ||
201 | [IMX8MQ_RESET_MIPI_CSI2_PHY_REF_RESET] = { SRC_MIPIPHY2_RCR, BIT(1) }, | ||
202 | [IMX8MQ_RESET_MIPI_CSI2_ESC_RESET] = { SRC_MIPIPHY2_RCR, BIT(2) }, | ||
203 | [IMX8MQ_RESET_DDRC1_PRST] = { SRC_DDRC_RCR, BIT(0) }, | ||
204 | [IMX8MQ_RESET_DDRC1_CORE_RESET] = { SRC_DDRC_RCR, BIT(1) }, | ||
205 | [IMX8MQ_RESET_DDRC1_PHY_RESET] = { SRC_DDRC_RCR, BIT(2) }, | ||
206 | [IMX8MQ_RESET_DDRC2_PHY_RESET] = { SRC_DDRC2_RCR, BIT(0) }, | ||
207 | [IMX8MQ_RESET_DDRC2_CORE_RESET] = { SRC_DDRC2_RCR, BIT(1) }, | ||
208 | [IMX8MQ_RESET_DDRC2_PRST] = { SRC_DDRC2_RCR, BIT(2) }, | ||
209 | }; | ||
210 | |||
211 | static int imx8mq_reset_set(struct reset_controller_dev *rcdev, | ||
212 | unsigned long id, bool assert) | ||
213 | { | ||
214 | struct imx7_src *imx7src = to_imx7_src(rcdev); | ||
215 | const unsigned int bit = imx7src->signals[id].bit; | ||
216 | unsigned int value = assert ? bit : 0; | ||
217 | |||
218 | switch (id) { | ||
219 | case IMX8MQ_RESET_PCIEPHY: | ||
220 | case IMX8MQ_RESET_PCIEPHY2: /* fallthrough */ | ||
221 | /* | ||
222 | * wait for more than 10us to release phy g_rst and | ||
223 | * btnrst | ||
224 | */ | ||
225 | if (!assert) | ||
226 | udelay(10); | ||
227 | break; | ||
228 | |||
229 | case IMX8MQ_RESET_PCIE_CTRL_APPS_EN: | ||
230 | case IMX8MQ_RESET_PCIE2_CTRL_APPS_EN: /* fallthrough */ | ||
231 | case IMX8MQ_RESET_MIPI_DIS_PCLK_RESET_N: /* fallthrough */ | ||
232 | case IMX8MQ_RESET_MIPI_DIS_ESC_RESET_N: /* fallthrough */ | ||
233 | case IMX8MQ_RESET_MIPI_DIS_DPI_RESET_N: /* fallthrough */ | ||
234 | case IMX8MQ_RESET_MIPI_DSI_RESET_N: /* fallthrough */ | ||
235 | case IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N: /* fallthrough */ | ||
236 | value = assert ? 0 : bit; | ||
237 | break; | ||
238 | } | ||
239 | |||
240 | return imx7_reset_update(imx7src, id, value); | ||
241 | } | ||
242 | |||
243 | static int imx8mq_reset_assert(struct reset_controller_dev *rcdev, | ||
244 | unsigned long id) | ||
245 | { | ||
246 | return imx8mq_reset_set(rcdev, id, true); | ||
247 | } | ||
248 | |||
249 | static int imx8mq_reset_deassert(struct reset_controller_dev *rcdev, | ||
250 | unsigned long id) | ||
251 | { | ||
252 | return imx8mq_reset_set(rcdev, id, false); | ||
253 | } | ||
254 | |||
255 | static const struct imx7_src_variant variant_imx8mq = { | ||
256 | .signals = imx8mq_src_signals, | ||
257 | .signals_num = ARRAY_SIZE(imx8mq_src_signals), | ||
258 | .ops = { | ||
259 | .assert = imx8mq_reset_assert, | ||
260 | .deassert = imx8mq_reset_deassert, | ||
261 | }, | ||
121 | }; | 262 | }; |
122 | 263 | ||
123 | static int imx7_reset_probe(struct platform_device *pdev) | 264 | static int imx7_reset_probe(struct platform_device *pdev) |
@@ -125,11 +266,13 @@ static int imx7_reset_probe(struct platform_device *pdev) | |||
125 | struct imx7_src *imx7src; | 266 | struct imx7_src *imx7src; |
126 | struct device *dev = &pdev->dev; | 267 | struct device *dev = &pdev->dev; |
127 | struct regmap_config config = { .name = "src" }; | 268 | struct regmap_config config = { .name = "src" }; |
269 | const struct imx7_src_variant *variant = of_device_get_match_data(dev); | ||
128 | 270 | ||
129 | imx7src = devm_kzalloc(dev, sizeof(*imx7src), GFP_KERNEL); | 271 | imx7src = devm_kzalloc(dev, sizeof(*imx7src), GFP_KERNEL); |
130 | if (!imx7src) | 272 | if (!imx7src) |
131 | return -ENOMEM; | 273 | return -ENOMEM; |
132 | 274 | ||
275 | imx7src->signals = variant->signals; | ||
133 | imx7src->regmap = syscon_node_to_regmap(dev->of_node); | 276 | imx7src->regmap = syscon_node_to_regmap(dev->of_node); |
134 | if (IS_ERR(imx7src->regmap)) { | 277 | if (IS_ERR(imx7src->regmap)) { |
135 | dev_err(dev, "Unable to get imx7-src regmap"); | 278 | dev_err(dev, "Unable to get imx7-src regmap"); |
@@ -138,15 +281,16 @@ static int imx7_reset_probe(struct platform_device *pdev) | |||
138 | regmap_attach_dev(dev, imx7src->regmap, &config); | 281 | regmap_attach_dev(dev, imx7src->regmap, &config); |
139 | 282 | ||
140 | imx7src->rcdev.owner = THIS_MODULE; | 283 | imx7src->rcdev.owner = THIS_MODULE; |
141 | imx7src->rcdev.nr_resets = IMX7_RESET_NUM; | 284 | imx7src->rcdev.nr_resets = variant->signals_num; |
142 | imx7src->rcdev.ops = &imx7_reset_ops; | 285 | imx7src->rcdev.ops = &variant->ops; |
143 | imx7src->rcdev.of_node = dev->of_node; | 286 | imx7src->rcdev.of_node = dev->of_node; |
144 | 287 | ||
145 | return devm_reset_controller_register(dev, &imx7src->rcdev); | 288 | return devm_reset_controller_register(dev, &imx7src->rcdev); |
146 | } | 289 | } |
147 | 290 | ||
148 | static const struct of_device_id imx7_reset_dt_ids[] = { | 291 | static const struct of_device_id imx7_reset_dt_ids[] = { |
149 | { .compatible = "fsl,imx7d-src", }, | 292 | { .compatible = "fsl,imx7d-src", .data = &variant_imx7 }, |
293 | { .compatible = "fsl,imx8mq-src", .data = &variant_imx8mq }, | ||
150 | { /* sentinel */ }, | 294 | { /* sentinel */ }, |
151 | }; | 295 | }; |
152 | 296 | ||
diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c index 318cfc51c441..96953992c2bb 100644 --- a/drivers/reset/reset-socfpga.c +++ b/drivers/reset/reset-socfpga.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/of_address.h> | 11 | #include <linux/of_address.h> |
12 | #include <linux/platform_device.h> | 12 | #include <linux/platform_device.h> |
13 | #include <linux/reset-controller.h> | 13 | #include <linux/reset-controller.h> |
14 | #include <linux/reset/socfpga.h> | ||
14 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
15 | #include <linux/spinlock.h> | 16 | #include <linux/spinlock.h> |
16 | #include <linux/types.h> | 17 | #include <linux/types.h> |
@@ -18,7 +19,6 @@ | |||
18 | #include "reset-simple.h" | 19 | #include "reset-simple.h" |
19 | 20 | ||
20 | #define SOCFPGA_NR_BANKS 8 | 21 | #define SOCFPGA_NR_BANKS 8 |
21 | void __init socfpga_reset_init(void); | ||
22 | 22 | ||
23 | static int a10_reset_init(struct device_node *np) | 23 | static int a10_reset_init(struct device_node *np) |
24 | { | 24 | { |
diff --git a/drivers/reset/reset-sunxi.c b/drivers/reset/reset-sunxi.c index db9a1a75523f..b06d724d8f21 100644 --- a/drivers/reset/reset-sunxi.c +++ b/drivers/reset/reset-sunxi.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/of_address.h> | 18 | #include <linux/of_address.h> |
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/reset-controller.h> | 20 | #include <linux/reset-controller.h> |
21 | #include <linux/reset/sunxi.h> | ||
21 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
22 | #include <linux/spinlock.h> | 23 | #include <linux/spinlock.h> |
23 | #include <linux/types.h> | 24 | #include <linux/types.h> |