Thread (22 messages) 22 messages, 5 authors, 2024-10-02
STALE646d
Revisions (10)
  1. v1 [diff vs current]
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]
  5. v5 [diff vs current]
  6. v6 current
  7. v7 [diff vs current]
  8. v8 [diff vs current]
  9. v9 [diff vs current]
  10. v10 [diff vs current]

[PATCH v6 2/7] reset: mchp: sparx5: Use the second reg item when cpu-syscon is not present

From: Herve Codina <herve.codina@bootlin.com>
Date: 2024-09-30 12:16:13
Also in: linux-arm-kernel, linux-devicetree, linux-pci, lkml
Subsystem: reset controller framework, the rest · Maintainers: Philipp Zabel, Linus Torvalds

In the LAN966x PCI device use case, syscon cannot be used as syscon
devices do not support removal [1]. A syscon device is a core "system"
device and not a device available in some addon boards and so, it is not
supposed to be removed.

In order to remove the syscon usage, use a local mapping of a reg
address range when cpu-syscon is not present.

Link: https://lore.kernel.org/all/20240923100741.11277439@bootlin.com/ (local) [1]
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
 drivers/reset/reset-microchip-sparx5.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/reset/reset-microchip-sparx5.c b/drivers/reset/reset-microchip-sparx5.c
index 636e85c388b0..1c095fa41d69 100644
--- a/drivers/reset/reset-microchip-sparx5.c
+++ b/drivers/reset/reset-microchip-sparx5.c
@@ -114,8 +114,22 @@ static int mchp_sparx5_reset_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	err = mchp_sparx5_map_syscon(pdev, "cpu-syscon", &ctx->cpu_ctrl);
-	if (err)
+	switch (err) {
+	case 0:
+		break;
+	case -ENODEV:
+		/*
+		 * The cpu-syscon device is not available.
+		 * Fall back with IO mapping (i.e. mapping from reg property).
+		 */
+		err = mchp_sparx5_map_io(pdev, 1, &ctx->cpu_ctrl);
+		if (err)
+			return err;
+		break;
+	default:
 		return err;
+	}
+
 	err = mchp_sparx5_map_io(pdev, 0, &ctx->gcb_ctrl);
 	if (err)
 		return err;
-- 
2.46.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help