Skip to content

Commit e08672c

Browse files
Anson-HuangpH5
authored andcommitted
reset: imx7: Add support for i.MX8MP SoC
i.MX8MP is a new SoC of i.MX8M family, it has same src IP inside but with different module layout, add support for it. Signed-off-by: Anson Huang <[email protected]> Signed-off-by: Philipp Zabel <[email protected]>
1 parent c4e181d commit e08672c

File tree

1 file changed

+101
-0
lines changed

1 file changed

+101
-0
lines changed

drivers/reset/reset-imx7.c

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/regmap.h>
1616
#include <dt-bindings/reset/imx7-reset.h>
1717
#include <dt-bindings/reset/imx8mq-reset.h>
18+
#include <dt-bindings/reset/imx8mp-reset.h>
1819

1920
struct imx7_src_signal {
2021
unsigned int offset, bit;
@@ -145,6 +146,18 @@ enum imx8mq_src_registers {
145146
SRC_DDRC2_RCR = 0x1004,
146147
};
147148

149+
enum imx8mp_src_registers {
150+
SRC_SUPERMIX_RCR = 0x0018,
151+
SRC_AUDIOMIX_RCR = 0x001c,
152+
SRC_MLMIX_RCR = 0x0028,
153+
SRC_GPU2D_RCR = 0x0038,
154+
SRC_GPU3D_RCR = 0x003c,
155+
SRC_VPU_G1_RCR = 0x0048,
156+
SRC_VPU_G2_RCR = 0x004c,
157+
SRC_VPUVC8KE_RCR = 0x0050,
158+
SRC_NOC_RCR = 0x0054,
159+
};
160+
148161
static const struct imx7_src_signal imx8mq_src_signals[IMX8MQ_RESET_NUM] = {
149162
[IMX8MQ_RESET_A53_CORE_POR_RESET0] = { SRC_A53RCR0, BIT(0) },
150163
[IMX8MQ_RESET_A53_CORE_POR_RESET1] = { SRC_A53RCR0, BIT(1) },
@@ -253,6 +266,93 @@ static const struct imx7_src_variant variant_imx8mq = {
253266
},
254267
};
255268

269+
static const struct imx7_src_signal imx8mp_src_signals[IMX8MP_RESET_NUM] = {
270+
[IMX8MP_RESET_A53_CORE_POR_RESET0] = { SRC_A53RCR0, BIT(0) },
271+
[IMX8MP_RESET_A53_CORE_POR_RESET1] = { SRC_A53RCR0, BIT(1) },
272+
[IMX8MP_RESET_A53_CORE_POR_RESET2] = { SRC_A53RCR0, BIT(2) },
273+
[IMX8MP_RESET_A53_CORE_POR_RESET3] = { SRC_A53RCR0, BIT(3) },
274+
[IMX8MP_RESET_A53_CORE_RESET0] = { SRC_A53RCR0, BIT(4) },
275+
[IMX8MP_RESET_A53_CORE_RESET1] = { SRC_A53RCR0, BIT(5) },
276+
[IMX8MP_RESET_A53_CORE_RESET2] = { SRC_A53RCR0, BIT(6) },
277+
[IMX8MP_RESET_A53_CORE_RESET3] = { SRC_A53RCR0, BIT(7) },
278+
[IMX8MP_RESET_A53_DBG_RESET0] = { SRC_A53RCR0, BIT(8) },
279+
[IMX8MP_RESET_A53_DBG_RESET1] = { SRC_A53RCR0, BIT(9) },
280+
[IMX8MP_RESET_A53_DBG_RESET2] = { SRC_A53RCR0, BIT(10) },
281+
[IMX8MP_RESET_A53_DBG_RESET3] = { SRC_A53RCR0, BIT(11) },
282+
[IMX8MP_RESET_A53_ETM_RESET0] = { SRC_A53RCR0, BIT(12) },
283+
[IMX8MP_RESET_A53_ETM_RESET1] = { SRC_A53RCR0, BIT(13) },
284+
[IMX8MP_RESET_A53_ETM_RESET2] = { SRC_A53RCR0, BIT(14) },
285+
[IMX8MP_RESET_A53_ETM_RESET3] = { SRC_A53RCR0, BIT(15) },
286+
[IMX8MP_RESET_A53_SOC_DBG_RESET] = { SRC_A53RCR0, BIT(20) },
287+
[IMX8MP_RESET_A53_L2RESET] = { SRC_A53RCR0, BIT(21) },
288+
[IMX8MP_RESET_SW_NON_SCLR_M7C_RST] = { SRC_M4RCR, BIT(0) },
289+
[IMX8MP_RESET_OTG1_PHY_RESET] = { SRC_USBOPHY1_RCR, BIT(0) },
290+
[IMX8MP_RESET_OTG2_PHY_RESET] = { SRC_USBOPHY2_RCR, BIT(0) },
291+
[IMX8MP_RESET_SUPERMIX_RESET] = { SRC_SUPERMIX_RCR, BIT(0) },
292+
[IMX8MP_RESET_AUDIOMIX_RESET] = { SRC_AUDIOMIX_RCR, BIT(0) },
293+
[IMX8MP_RESET_MLMIX_RESET] = { SRC_MLMIX_RCR, BIT(0) },
294+
[IMX8MP_RESET_PCIEPHY] = { SRC_PCIEPHY_RCR, BIT(2) },
295+
[IMX8MP_RESET_PCIEPHY_PERST] = { SRC_PCIEPHY_RCR, BIT(3) },
296+
[IMX8MP_RESET_PCIE_CTRL_APPS_EN] = { SRC_PCIEPHY_RCR, BIT(6) },
297+
[IMX8MP_RESET_PCIE_CTRL_APPS_TURNOFF] = { SRC_PCIEPHY_RCR, BIT(11) },
298+
[IMX8MP_RESET_HDMI_PHY_APB_RESET] = { SRC_HDMI_RCR, BIT(0) },
299+
[IMX8MP_RESET_MEDIA_RESET] = { SRC_DISP_RCR, BIT(0) },
300+
[IMX8MP_RESET_GPU2D_RESET] = { SRC_GPU2D_RCR, BIT(0) },
301+
[IMX8MP_RESET_GPU3D_RESET] = { SRC_GPU3D_RCR, BIT(0) },
302+
[IMX8MP_RESET_GPU_RESET] = { SRC_GPU_RCR, BIT(0) },
303+
[IMX8MP_RESET_VPU_RESET] = { SRC_VPU_RCR, BIT(0) },
304+
[IMX8MP_RESET_VPU_G1_RESET] = { SRC_VPU_G1_RCR, BIT(0) },
305+
[IMX8MP_RESET_VPU_G2_RESET] = { SRC_VPU_G2_RCR, BIT(0) },
306+
[IMX8MP_RESET_VPUVC8KE_RESET] = { SRC_VPUVC8KE_RCR, BIT(0) },
307+
[IMX8MP_RESET_NOC_RESET] = { SRC_NOC_RCR, BIT(0) },
308+
};
309+
310+
static int imx8mp_reset_set(struct reset_controller_dev *rcdev,
311+
unsigned long id, bool assert)
312+
{
313+
struct imx7_src *imx7src = to_imx7_src(rcdev);
314+
const unsigned int bit = imx7src->signals[id].bit;
315+
unsigned int value = assert ? bit : 0;
316+
317+
switch (id) {
318+
case IMX8MP_RESET_PCIEPHY:
319+
/*
320+
* wait for more than 10us to release phy g_rst and
321+
* btnrst
322+
*/
323+
if (!assert)
324+
udelay(10);
325+
break;
326+
327+
case IMX8MP_RESET_PCIE_CTRL_APPS_EN:
328+
value = assert ? 0 : bit;
329+
break;
330+
}
331+
332+
return imx7_reset_update(imx7src, id, value);
333+
}
334+
335+
static int imx8mp_reset_assert(struct reset_controller_dev *rcdev,
336+
unsigned long id)
337+
{
338+
return imx8mp_reset_set(rcdev, id, true);
339+
}
340+
341+
static int imx8mp_reset_deassert(struct reset_controller_dev *rcdev,
342+
unsigned long id)
343+
{
344+
return imx8mp_reset_set(rcdev, id, false);
345+
}
346+
347+
static const struct imx7_src_variant variant_imx8mp = {
348+
.signals = imx8mp_src_signals,
349+
.signals_num = ARRAY_SIZE(imx8mp_src_signals),
350+
.ops = {
351+
.assert = imx8mp_reset_assert,
352+
.deassert = imx8mp_reset_deassert,
353+
},
354+
};
355+
256356
static int imx7_reset_probe(struct platform_device *pdev)
257357
{
258358
struct imx7_src *imx7src;
@@ -283,6 +383,7 @@ static int imx7_reset_probe(struct platform_device *pdev)
283383
static const struct of_device_id imx7_reset_dt_ids[] = {
284384
{ .compatible = "fsl,imx7d-src", .data = &variant_imx7 },
285385
{ .compatible = "fsl,imx8mq-src", .data = &variant_imx8mq },
386+
{ .compatible = "fsl,imx8mp-src", .data = &variant_imx8mp },
286387
{ /* sentinel */ },
287388
};
288389

0 commit comments

Comments
 (0)