[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220628124441.2385023-8-martin.blumenstingl@googlemail.com>
Date: Tue, 28 Jun 2022 14:44:39 +0200
From: Martin Blumenstingl <martin.blumenstingl@...glemail.com>
To: linux-phy@...ts.infradead.org, devicetree@...r.kernel.org,
p.zabel@...gutronix.de
Cc: linux-kernel@...r.kernel.org, linux-mips@...r.kernel.org,
vkoul@...nel.org, kishon@...com, rtanwar@...linear.com,
Martin Blumenstingl <martin.blumenstingl@...glemail.com>
Subject: [PATCH v1 7/9] reset: intel: Use syscon_node_to_regmap on legacy SoCs
Older Lantiq (called "legacy") SoCs the RCU registers have more than
just the reset controller registers. It additionally contains boot
media selection information, up to two USB2 PHYs and configuration for
various other peripherals (such as the PCIe PHY). use
syscon_node_to_regmap() to obtain the regmap on these SoCs.
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@...glemail.com>
---
drivers/reset/Kconfig | 3 ++-
drivers/reset/reset-intel-gw.c | 29 +++++++++++++++++++----------
2 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index 68a5ea44612e..fb49c465078f 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -86,7 +86,8 @@ config RESET_INTEL_GW
bool "Intel Reset Controller Driver"
depends on X86 || LANTIQ || COMPILE_TEST
depends on OF && HAS_IOMEM
- select REGMAP_MMIO
+ select REGMAP_MMIO if X86
+ select MFD_SYSCON if LANTIQ
help
This enables the reset controller driver for Intel Gateway SoCs.
Say Y to control the reset signals provided by reset controller.
diff --git a/drivers/reset/reset-intel-gw.c b/drivers/reset/reset-intel-gw.c
index 46ed7a693666..0bf7fe4e77ae 100644
--- a/drivers/reset/reset-intel-gw.c
+++ b/drivers/reset/reset-intel-gw.c
@@ -5,6 +5,7 @@
*/
#include <linux/bitfield.h>
+#include <linux/mfd/syscon.h>
#include <linux/init.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
@@ -170,7 +171,6 @@ static int intel_reset_probe(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node;
struct device *dev = &pdev->dev;
struct intel_reset_data *data;
- void __iomem *base;
u32 rb_id[3];
int ret;
@@ -182,15 +182,24 @@ static int intel_reset_probe(struct platform_device *pdev)
if (!data->soc_data)
return -ENODEV;
- base = devm_platform_ioremap_resource(pdev, 0);
- if (IS_ERR(base))
- return PTR_ERR(base);
-
- data->regmap = devm_regmap_init_mmio(dev, base,
- &intel_rcu_regmap_config);
- if (IS_ERR(data->regmap)) {
- dev_err(dev, "regmap initialization failed\n");
- return PTR_ERR(data->regmap);
+ if (data->soc_data->legacy) {
+ data->regmap = syscon_node_to_regmap(dev->of_node);
+ if (IS_ERR(data->regmap))
+ return dev_err_probe(dev, PTR_ERR(data->regmap),
+ "Failed to get regmap from syscon node\n");
+ } else {
+ void __iomem *base;
+
+ base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(base))
+ return PTR_ERR(base);
+
+ data->regmap = devm_regmap_init_mmio(dev, base,
+ &intel_rcu_regmap_config);
+ if (IS_ERR(data->regmap)) {
+ dev_err(dev, "regmap initialization failed\n");
+ return PTR_ERR(data->regmap);
+ }
}
ret = device_property_read_u32_array(dev, "intel,global-reset", rb_id,
--
2.36.1
Powered by blists - more mailing lists