Skip to content

Commit c895251

Browse files
committed
Merge tag 'reset-for-v5.10' of git://git.pengutronix.de/pza/linux into arm/drivers
Reset controller updates for v5.10 This tag allows to build reset-imx7 as a module, and adds support to reset the Cortex-M4 processor on i.MX8MQ to it, adds support for the Versal platform to the reset-zynqmp driver, and fixes some kerneldoc comments in the core and in sti/reset-syscfg. * tag 'reset-for-v5.10' of git://git.pengutronix.de/pza/linux: reset: sti: reset-syscfg: fix struct description warnings reset: imx7: add the cm4 reset for i.MX8MQ dt-bindings: reset: imx8mq: add m4 reset reset: Fix and extend kerneldoc reset: reset-zynqmp: Added support for Versal platform dt-bindings: reset: Updated binding for Versal reset driver reset: imx7: Support module build Link: https://lore.kernel.org/r/2b77c90d2b970eb8fa09000b9ecb564bffa76374.camel@pengutronix.de Signed-off-by: Olof Johansson <olof@lixom.net>
2 parents e863e45 + 68a2151 commit c895251

8 files changed

Lines changed: 180 additions & 19 deletions

File tree

Documentation/devicetree/bindings/reset/xlnx,zynqmp-reset.txt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--------------------------------------------------------------------------
2-
= Zynq UltraScale+ MPSoC reset driver binding =
2+
= Zynq UltraScale+ MPSoC and Versal reset driver binding =
33
--------------------------------------------------------------------------
4-
The Zynq UltraScale+ MPSoC has several different resets.
4+
The Zynq UltraScale+ MPSoC and Versal has several different resets.
55

66
See Chapter 36 of the Zynq UltraScale+ MPSoC TRM (UG) for more information
77
about zynqmp resets.
@@ -10,7 +10,8 @@ Please also refer to reset.txt in this directory for common reset
1010
controller binding usage.
1111

1212
Required Properties:
13-
- compatible: "xlnx,zynqmp-reset"
13+
- compatible: "xlnx,zynqmp-reset" for Zynq UltraScale+ MPSoC platform
14+
"xlnx,versal-reset" for Versal platform
1415
- #reset-cells: Specifies the number of cells needed to encode reset
1516
line, should be 1
1617

@@ -37,8 +38,10 @@ Device nodes that need access to reset lines should
3738
specify them as a reset phandle in their corresponding node as
3839
specified in reset.txt.
3940

40-
For list of all valid reset indicies see
41+
For list of all valid reset indices for Zynq UltraScale+ MPSoC see
4142
<dt-bindings/reset/xlnx-zynqmp-resets.h>
43+
For list of all valid reset indices for Versal see
44+
<dt-bindings/reset/xlnx-versal-resets.h>
4245

4346
Example:
4447

drivers/reset/Kconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ config RESET_HSDK
6565
This enables the reset controller driver for HSDK board.
6666

6767
config RESET_IMX7
68-
bool "i.MX7/8 Reset Driver" if COMPILE_TEST
68+
tristate "i.MX7/8 Reset Driver"
6969
depends on HAS_IOMEM
70-
default SOC_IMX7D || (ARM64 && ARCH_MXC)
70+
depends on SOC_IMX7D || (ARM64 && ARCH_MXC) || COMPILE_TEST
71+
default y if SOC_IMX7D
7172
select MFD_SYSCON
7273
help
7374
This enables the reset controller driver for i.MX7 SoCs.

drivers/reset/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ static LIST_HEAD(reset_lookup_list);
3232
* @refcnt: Number of gets of this reset_control
3333
* @acquired: Only one reset_control may be acquired for a given rcdev and id.
3434
* @shared: Is this a shared (1), or an exclusive (0) reset_control?
35-
* @deassert_cnt: Number of times this reset line has been deasserted
35+
* @array: Is this an array of reset controls (1)?
36+
* @deassert_count: Number of times this reset line has been deasserted
3637
* @triggered_count: Number of times this reset line has been reset. Currently
3738
* only used for shared resets, which means that the value
3839
* will be either 0 or 1.

drivers/reset/reset-imx7.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
#include <linux/mfd/syscon.h>
11-
#include <linux/mod_devicetable.h>
11+
#include <linux/module.h>
1212
#include <linux/of_device.h>
1313
#include <linux/platform_device.h>
1414
#include <linux/reset-controller.h>
@@ -178,6 +178,9 @@ static const struct imx7_src_signal imx8mq_src_signals[IMX8MQ_RESET_NUM] = {
178178
[IMX8MQ_RESET_A53_SOC_DBG_RESET] = { SRC_A53RCR0, BIT(20) },
179179
[IMX8MQ_RESET_A53_L2RESET] = { SRC_A53RCR0, BIT(21) },
180180
[IMX8MQ_RESET_SW_NON_SCLR_M4C_RST] = { SRC_M4RCR, BIT(0) },
181+
[IMX8MQ_RESET_SW_M4C_RST] = { SRC_M4RCR, BIT(1) },
182+
[IMX8MQ_RESET_SW_M4P_RST] = { SRC_M4RCR, BIT(2) },
183+
[IMX8MQ_RESET_M4_ENABLE] = { SRC_M4RCR, BIT(3) },
181184
[IMX8MQ_RESET_OTG1_PHY_RESET] = { SRC_USBOPHY1_RCR, BIT(0) },
182185
[IMX8MQ_RESET_OTG2_PHY_RESET] = { SRC_USBOPHY2_RCR, BIT(0) },
183186
[IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N] = { SRC_MIPIPHY_RCR, BIT(1) },
@@ -238,6 +241,7 @@ static int imx8mq_reset_set(struct reset_controller_dev *rcdev,
238241
case IMX8MQ_RESET_MIPI_DSI_DPI_RESET_N: /* fallthrough */
239242
case IMX8MQ_RESET_MIPI_DSI_RESET_N: /* fallthrough */
240243
case IMX8MQ_RESET_MIPI_DSI_RESET_BYTE_N: /* fallthrough */
244+
case IMX8MQ_RESET_M4_ENABLE:
241245
value = assert ? 0 : bit;
242246
break;
243247
}
@@ -386,6 +390,7 @@ static const struct of_device_id imx7_reset_dt_ids[] = {
386390
{ .compatible = "fsl,imx8mp-src", .data = &variant_imx8mp },
387391
{ /* sentinel */ },
388392
};
393+
MODULE_DEVICE_TABLE(of, imx7_reset_dt_ids);
389394

390395
static struct platform_driver imx7_reset_driver = {
391396
.probe = imx7_reset_probe,
@@ -394,4 +399,8 @@ static struct platform_driver imx7_reset_driver = {
394399
.of_match_table = imx7_reset_dt_ids,
395400
},
396401
};
397-
builtin_platform_driver(imx7_reset_driver);
402+
module_platform_driver(imx7_reset_driver);
403+
404+
MODULE_AUTHOR("Andrey Smirnov <andrew.smirnov@gmail.com>");
405+
MODULE_DESCRIPTION("NXP i.MX7 reset driver");
406+
MODULE_LICENSE("GPL v2");

drivers/reset/reset-zynqmp.c

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,20 @@
99
#include <linux/platform_device.h>
1010
#include <linux/reset-controller.h>
1111
#include <linux/firmware/xlnx-zynqmp.h>
12+
#include <linux/of_device.h>
1213

1314
#define ZYNQMP_NR_RESETS (ZYNQMP_PM_RESET_END - ZYNQMP_PM_RESET_START)
1415
#define ZYNQMP_RESET_ID ZYNQMP_PM_RESET_START
16+
#define VERSAL_NR_RESETS 95
17+
18+
struct zynqmp_reset_soc_data {
19+
u32 reset_id;
20+
u32 num_resets;
21+
};
1522

1623
struct zynqmp_reset_data {
1724
struct reset_controller_dev rcdev;
25+
const struct zynqmp_reset_soc_data *data;
1826
};
1927

2028
static inline struct zynqmp_reset_data *
@@ -26,23 +34,28 @@ to_zynqmp_reset_data(struct reset_controller_dev *rcdev)
2634
static int zynqmp_reset_assert(struct reset_controller_dev *rcdev,
2735
unsigned long id)
2836
{
29-
return zynqmp_pm_reset_assert(ZYNQMP_RESET_ID + id,
37+
struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev);
38+
39+
return zynqmp_pm_reset_assert(priv->data->reset_id + id,
3040
PM_RESET_ACTION_ASSERT);
3141
}
3242

3343
static int zynqmp_reset_deassert(struct reset_controller_dev *rcdev,
3444
unsigned long id)
3545
{
36-
return zynqmp_pm_reset_assert(ZYNQMP_RESET_ID + id,
46+
struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev);
47+
48+
return zynqmp_pm_reset_assert(priv->data->reset_id + id,
3749
PM_RESET_ACTION_RELEASE);
3850
}
3951

4052
static int zynqmp_reset_status(struct reset_controller_dev *rcdev,
4153
unsigned long id)
4254
{
55+
struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev);
4356
int val, err;
4457

45-
err = zynqmp_pm_reset_get_status(ZYNQMP_RESET_ID + id, &val);
58+
err = zynqmp_pm_reset_get_status(priv->data->reset_id + id, &val);
4659
if (err)
4760
return err;
4861

@@ -52,10 +65,28 @@ static int zynqmp_reset_status(struct reset_controller_dev *rcdev,
5265
static int zynqmp_reset_reset(struct reset_controller_dev *rcdev,
5366
unsigned long id)
5467
{
55-
return zynqmp_pm_reset_assert(ZYNQMP_RESET_ID + id,
68+
struct zynqmp_reset_data *priv = to_zynqmp_reset_data(rcdev);
69+
70+
return zynqmp_pm_reset_assert(priv->data->reset_id + id,
5671
PM_RESET_ACTION_PULSE);
5772
}
5873

74+
static int zynqmp_reset_of_xlate(struct reset_controller_dev *rcdev,
75+
const struct of_phandle_args *reset_spec)
76+
{
77+
return reset_spec->args[0];
78+
}
79+
80+
static const struct zynqmp_reset_soc_data zynqmp_reset_data = {
81+
.reset_id = ZYNQMP_RESET_ID,
82+
.num_resets = ZYNQMP_NR_RESETS,
83+
};
84+
85+
static const struct zynqmp_reset_soc_data versal_reset_data = {
86+
.reset_id = 0,
87+
.num_resets = VERSAL_NR_RESETS,
88+
};
89+
5990
static const struct reset_control_ops zynqmp_reset_ops = {
6091
.reset = zynqmp_reset_reset,
6192
.assert = zynqmp_reset_assert,
@@ -71,18 +102,25 @@ static int zynqmp_reset_probe(struct platform_device *pdev)
71102
if (!priv)
72103
return -ENOMEM;
73104

105+
priv->data = of_device_get_match_data(&pdev->dev);
106+
if (!priv->data)
107+
return -EINVAL;
108+
74109
platform_set_drvdata(pdev, priv);
75110

76111
priv->rcdev.ops = &zynqmp_reset_ops;
77112
priv->rcdev.owner = THIS_MODULE;
78113
priv->rcdev.of_node = pdev->dev.of_node;
79-
priv->rcdev.nr_resets = ZYNQMP_NR_RESETS;
114+
priv->rcdev.nr_resets = priv->data->num_resets;
115+
priv->rcdev.of_reset_n_cells = 1;
116+
priv->rcdev.of_xlate = zynqmp_reset_of_xlate;
80117

81118
return devm_reset_controller_register(&pdev->dev, &priv->rcdev);
82119
}
83120

84121
static const struct of_device_id zynqmp_reset_dt_ids[] = {
85-
{ .compatible = "xlnx,zynqmp-reset", },
122+
{ .compatible = "xlnx,zynqmp-reset", .data = &zynqmp_reset_data, },
123+
{ .compatible = "xlnx,versal-reset", .data = &versal_reset_data, },
86124
{ /* sentinel */ },
87125
};
88126

drivers/reset/sti/reset-syscfg.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "reset-syscfg.h"
1818

1919
/**
20-
* Reset channel regmap configuration
20+
* struct syscfg_reset_channel - Reset channel regmap configuration
2121
*
2222
* @reset: regmap field for the channel's reset bit.
2323
* @ack: regmap field for the channel's ack bit (optional).
@@ -28,8 +28,9 @@ struct syscfg_reset_channel {
2828
};
2929

3030
/**
31-
* A reset controller which groups together a set of related reset bits, which
32-
* may be located in different system configuration registers.
31+
* struct syscfg_reset_controller - A reset controller which groups together
32+
* a set of related reset bits, which may be located in different system
33+
* configuration registers.
3334
*
3435
* @rst: base reset controller structure.
3536
* @active_low: are the resets in this controller active low, i.e. clearing

include/dt-bindings/reset/imx8mq-reset.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@
5858
#define IMX8MQ_RESET_DDRC2_PRST 47 /* i.MX8MM/i.MX8MN does NOT support */
5959
#define IMX8MQ_RESET_DDRC2_CORE_RESET 48 /* i.MX8MM/i.MX8MN does NOT support */
6060
#define IMX8MQ_RESET_DDRC2_PHY_RESET 49 /* i.MX8MM/i.MX8MN does NOT support */
61+
#define IMX8MQ_RESET_SW_M4C_RST 50
62+
#define IMX8MQ_RESET_SW_M4P_RST 51
63+
#define IMX8MQ_RESET_M4_ENABLE 52
6164

62-
#define IMX8MQ_RESET_NUM 50
65+
#define IMX8MQ_RESET_NUM 53
6366

6467
#endif
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* Copyright (C) 2020 Xilinx, Inc.
4+
*/
5+
6+
#ifndef _DT_BINDINGS_VERSAL_RESETS_H
7+
#define _DT_BINDINGS_VERSAL_RESETS_H
8+
9+
#define VERSAL_RST_PMC_POR (0xc30c001U)
10+
#define VERSAL_RST_PMC (0xc410002U)
11+
#define VERSAL_RST_PS_POR (0xc30c003U)
12+
#define VERSAL_RST_PL_POR (0xc30c004U)
13+
#define VERSAL_RST_NOC_POR (0xc30c005U)
14+
#define VERSAL_RST_FPD_POR (0xc30c006U)
15+
#define VERSAL_RST_ACPU_0_POR (0xc30c007U)
16+
#define VERSAL_RST_ACPU_1_POR (0xc30c008U)
17+
#define VERSAL_RST_OCM2_POR (0xc30c009U)
18+
#define VERSAL_RST_PS_SRST (0xc41000aU)
19+
#define VERSAL_RST_PL_SRST (0xc41000bU)
20+
#define VERSAL_RST_NOC (0xc41000cU)
21+
#define VERSAL_RST_NPI (0xc41000dU)
22+
#define VERSAL_RST_SYS_RST_1 (0xc41000eU)
23+
#define VERSAL_RST_SYS_RST_2 (0xc41000fU)
24+
#define VERSAL_RST_SYS_RST_3 (0xc410010U)
25+
#define VERSAL_RST_FPD (0xc410011U)
26+
#define VERSAL_RST_PL0 (0xc410012U)
27+
#define VERSAL_RST_PL1 (0xc410013U)
28+
#define VERSAL_RST_PL2 (0xc410014U)
29+
#define VERSAL_RST_PL3 (0xc410015U)
30+
#define VERSAL_RST_APU (0xc410016U)
31+
#define VERSAL_RST_ACPU_0 (0xc410017U)
32+
#define VERSAL_RST_ACPU_1 (0xc410018U)
33+
#define VERSAL_RST_ACPU_L2 (0xc410019U)
34+
#define VERSAL_RST_ACPU_GIC (0xc41001aU)
35+
#define VERSAL_RST_RPU_ISLAND (0xc41001bU)
36+
#define VERSAL_RST_RPU_AMBA (0xc41001cU)
37+
#define VERSAL_RST_R5_0 (0xc41001dU)
38+
#define VERSAL_RST_R5_1 (0xc41001eU)
39+
#define VERSAL_RST_SYSMON_PMC_SEQ_RST (0xc41001fU)
40+
#define VERSAL_RST_SYSMON_PMC_CFG_RST (0xc410020U)
41+
#define VERSAL_RST_SYSMON_FPD_CFG_RST (0xc410021U)
42+
#define VERSAL_RST_SYSMON_FPD_SEQ_RST (0xc410022U)
43+
#define VERSAL_RST_SYSMON_LPD (0xc410023U)
44+
#define VERSAL_RST_PDMA_RST1 (0xc410024U)
45+
#define VERSAL_RST_PDMA_RST0 (0xc410025U)
46+
#define VERSAL_RST_ADMA (0xc410026U)
47+
#define VERSAL_RST_TIMESTAMP (0xc410027U)
48+
#define VERSAL_RST_OCM (0xc410028U)
49+
#define VERSAL_RST_OCM2_RST (0xc410029U)
50+
#define VERSAL_RST_IPI (0xc41002aU)
51+
#define VERSAL_RST_SBI (0xc41002bU)
52+
#define VERSAL_RST_LPD (0xc41002cU)
53+
#define VERSAL_RST_QSPI (0xc10402dU)
54+
#define VERSAL_RST_OSPI (0xc10402eU)
55+
#define VERSAL_RST_SDIO_0 (0xc10402fU)
56+
#define VERSAL_RST_SDIO_1 (0xc104030U)
57+
#define VERSAL_RST_I2C_PMC (0xc104031U)
58+
#define VERSAL_RST_GPIO_PMC (0xc104032U)
59+
#define VERSAL_RST_GEM_0 (0xc104033U)
60+
#define VERSAL_RST_GEM_1 (0xc104034U)
61+
#define VERSAL_RST_SPARE (0xc104035U)
62+
#define VERSAL_RST_USB_0 (0xc104036U)
63+
#define VERSAL_RST_UART_0 (0xc104037U)
64+
#define VERSAL_RST_UART_1 (0xc104038U)
65+
#define VERSAL_RST_SPI_0 (0xc104039U)
66+
#define VERSAL_RST_SPI_1 (0xc10403aU)
67+
#define VERSAL_RST_CAN_FD_0 (0xc10403bU)
68+
#define VERSAL_RST_CAN_FD_1 (0xc10403cU)
69+
#define VERSAL_RST_I2C_0 (0xc10403dU)
70+
#define VERSAL_RST_I2C_1 (0xc10403eU)
71+
#define VERSAL_RST_GPIO_LPD (0xc10403fU)
72+
#define VERSAL_RST_TTC_0 (0xc104040U)
73+
#define VERSAL_RST_TTC_1 (0xc104041U)
74+
#define VERSAL_RST_TTC_2 (0xc104042U)
75+
#define VERSAL_RST_TTC_3 (0xc104043U)
76+
#define VERSAL_RST_SWDT_FPD (0xc104044U)
77+
#define VERSAL_RST_SWDT_LPD (0xc104045U)
78+
#define VERSAL_RST_USB (0xc104046U)
79+
#define VERSAL_RST_DPC (0xc208047U)
80+
#define VERSAL_RST_PMCDBG (0xc208048U)
81+
#define VERSAL_RST_DBG_TRACE (0xc208049U)
82+
#define VERSAL_RST_DBG_FPD (0xc20804aU)
83+
#define VERSAL_RST_DBG_TSTMP (0xc20804bU)
84+
#define VERSAL_RST_RPU0_DBG (0xc20804cU)
85+
#define VERSAL_RST_RPU1_DBG (0xc20804dU)
86+
#define VERSAL_RST_HSDP (0xc20804eU)
87+
#define VERSAL_RST_DBG_LPD (0xc20804fU)
88+
#define VERSAL_RST_CPM_POR (0xc30c050U)
89+
#define VERSAL_RST_CPM (0xc410051U)
90+
#define VERSAL_RST_CPMDBG (0xc208052U)
91+
#define VERSAL_RST_PCIE_CFG (0xc410053U)
92+
#define VERSAL_RST_PCIE_CORE0 (0xc410054U)
93+
#define VERSAL_RST_PCIE_CORE1 (0xc410055U)
94+
#define VERSAL_RST_PCIE_DMA (0xc410056U)
95+
#define VERSAL_RST_CMN (0xc410057U)
96+
#define VERSAL_RST_L2_0 (0xc410058U)
97+
#define VERSAL_RST_L2_1 (0xc410059U)
98+
#define VERSAL_RST_ADDR_REMAP (0xc41005aU)
99+
#define VERSAL_RST_CPI0 (0xc41005bU)
100+
#define VERSAL_RST_CPI1 (0xc41005cU)
101+
#define VERSAL_RST_XRAM (0xc30c05dU)
102+
#define VERSAL_RST_AIE_ARRAY (0xc10405eU)
103+
#define VERSAL_RST_AIE_SHIM (0xc10405fU)
104+
105+
#endif

0 commit comments

Comments
 (0)