Skip to contentSkip to conversation

Add support for imx8ulp's SIM

PATCH Superseded Laurentiu Mihalcea 2 participants 6 messages Jun 9, 2024 – Jun 10, 2024

Subsystems (3)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add support for imx8ulp's SIM

From: Laurentiu Mihalcea <[email protected]>

i.MX8ULP's SIM (System Integration Module) allows control and configuration of certain components form the domain it's assigned to. Add DT node and schema for it. Its child shall also be included.

---
Changes in v2:
- Reset controller is now also a syscon provider.
- Changed vendor prefix to nxp.
- Link to v1: https://lore.kernel.org/all/[email protected]/

---
Laurentiu Mihalcea (3):
dt-bindings: reset: add schema for imx8ulp SIM reset
reset: add driver for imx8ulp SIM reset controller
arm64: dts: imx8ulp: add AVD-SIM node

 .../bindings/reset/nxp,imx8ulp-sim-reset.yaml |  68 ++++++++++++
 arch/arm64/boot/dts/freescale/imx8ulp.dtsi    |  13 +++
 drivers/reset/Kconfig                         |   7 ++
 drivers/reset/Makefile                        |   1 +
 drivers/reset/reset-imx8ulp-sim.c             | 103 ++++++++++++++++++
 include/dt-bindings/reset/imx8ulp-sim-reset.h |  16 +++
 6 files changed, 208 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml
 create mode 100644 drivers/reset/reset-imx8ulp-sim.c
 create mode 100644 include/dt-bindings/reset/imx8ulp-sim-reset.h

---
base-commit: fec32ea96dd90bf0af97e001f380d4a240013aa0

#1 lore raw

PATCH v2 1/3 dt-bindings: reset: add schema for imx8ulp SIM reset

From: Laurentiu Mihalcea <[email protected]>

Add schema for imx8ulp's SIM reset controller.

---
 .../bindings/reset/nxp,imx8ulp-sim-reset.yaml | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml
Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml new file +68 -0
new file mode 100644
index 000000000000..e7faec55ff36
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/reset/nxp,imx8ulp-sim-reset.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP i.MX8ULP System Integration Module Reset Controller
+
+maintainers:
+  - Liu Ying <[email protected]>
+
+description: |
+  Some instances of i.MX8ULP's SIM may offer control
+  over the reset of some components of a certain domain
+  (e.g: AVD-SIM).
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - nxp,imx8ulp-avd-sim-reset
+      - const: syscon
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  '#reset-cells':
+    const: 1
+
+  mux-controller:
+    $ref: ../mux/reg-mux.yaml
+
+required:
+  - compatible
+  - reg
+  - '#reset-cells'
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nxp,imx8ulp-avd-sim-reset
+    then:
+      required:
+        - mux-controller
+        - clocks
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/imx8ulp-clock.h>
+    syscon@2da50000 {
+      compatible = "nxp,imx8ulp-avd-sim-reset", "syscon";
+      reg = <0x2da50000 0x38>;
+      clocks = <&pcc5 IMX8ULP_CLK_AVD_SIM>;
+      #reset-cells = <1>;
+
+      mux-controller {
+        compatible = "mmio-mux";
+        #mux-control-cells = <1>;
+        mux-reg-masks = <0x8 0x00000200>;
+      };
+    };
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH v2 1/3] dt-bindings: reset: add schema for imx8ulp SIM reset

Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml

Quoted 17 lines · Laurentiu Mihalcea

From: Laurentiu Mihalcea <[email protected]>

Add schema for imx8ulp's SIM reset controller.

---
 .../bindings/reset/nxp,imx8ulp-sim-reset.yaml | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml
Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml new file +0 -0
new file mode 100644
index 000000000000..e7faec55ff36

Use compatible as filename.

Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml line 12

Quoted 13 lines
Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml new file +12 -0
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/reset/nxp,imx8ulp-sim-reset.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP i.MX8ULP System Integration Module Reset Controller
+
+maintainers:
+  - Liu Ying <[email protected]>
+
+description: |

Do not need '|' unless you need to preserve formatting.

Quoted 12 lines
Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml new file +12 -0
+  Some instances of i.MX8ULP's SIM may offer control
+  over the reset of some components of a certain domain
+  (e.g: AVD-SIM).
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - nxp,imx8ulp-avd-sim-reset
+      - const: syscon
+
+  reg:

Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml line 34

Quoted 10 lines
Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml new file +10 -0
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  '#reset-cells':
+    const: 1
+
+  mux-controller:
+    $ref: ../mux/reg-mux.yaml

Full path, so /schemas/mux/reg-mux.yaml#

Quoted 6 lines
Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml new file +6 -0
+
+required:
+  - compatible
+  - reg
+  - '#reset-cells'
+

Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml line 50

Quoted 10 lines
Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml new file +10 -0
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: nxp,imx8ulp-avd-sim-reset
+    then:
+      required:
+        - mux-controller
+        - clocks

This does not make much sense. You do not have other variants.

Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml line 52

Quoted 2 lines
Documentation/devicetree/bindings/reset/nxp,imx8ulp-sim-reset.yaml new file +2 -0
+
+additionalProperties: false

Best regards,
Krzysztof

#3 lore raw

PATCH v2 2/3 reset: add driver for imx8ulp SIM reset controller

In reply to Laurentiu Mihalcea

From: Laurentiu Mihalcea <[email protected]>

Certain components can be reset via the SIM module. Add reset controller driver for the SIM module to allow drivers for said components to control the reset signal(s).

---
 drivers/reset/Kconfig                         |   7 ++
 drivers/reset/Makefile                        |   1 +
 drivers/reset/reset-imx8ulp-sim.c             | 103 ++++++++++++++++++
 include/dt-bindings/reset/imx8ulp-sim-reset.h |  16 +++
 4 files changed, 127 insertions(+)
 create mode 100644 drivers/reset/reset-imx8ulp-sim.c
 create mode 100644 include/dt-bindings/reset/imx8ulp-sim-reset.h
drivers/reset/Kconfig +7 -0
index 7112f5932609..9b3574a4f1c6 100644
@@ -91,6 +91,13 @@ config RESET_IMX7
 	help
 	  This enables the reset controller driver for i.MX7 SoCs.
 
+config RESET_IMX8ULP_SIM
+	tristate "i.MX8ULP SIM Reset Driver"
+	depends on ARCH_MXC
+	help
+	  This enables the SIM (System Integration Module) reset driver
+	  for i.MX8ULP SoC.
+
 config RESET_INTEL_GW
 	bool "Intel Reset Controller Driver"
 	depends on X86 || COMPILE_TEST
drivers/reset/Makefile +1 -0
index fd8b49fa46fc..f257d6a41f1e 100644
@@ -42,3 +42,4 @@ obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o
 obj-$(CONFIG_RESET_UNIPHIER_GLUE) += reset-uniphier-glue.o
 obj-$(CONFIG_RESET_ZYNQ) += reset-zynq.o
 obj-$(CONFIG_ARCH_ZYNQMP) += reset-zynqmp.o
+obj-$(CONFIG_RESET_IMX8ULP_SIM) += reset-imx8ulp-sim.o
drivers/reset/reset-imx8ulp-sim.c new file +103 -0

103 lines not on this page · raw message

include/dt-bindings/reset/imx8ulp-sim-reset.h new file +16 -0
new file mode 100644
index 000000000000..9f8fb8680a5e
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause */
+
+/*
+ * Copyright 2024 NXP
+ */
+
+#ifndef DT_BINDINGS_RESET_IMX8ULP_SIM_H
+#define DT_BINDINGS_RESET_IMX8ULP_SIM_H
+
+#define IMX8ULP_SIM_RESET_MIPI_DSI_RST_DPI_N    0
+#define IMX8ULP_SIM_RESET_MIPI_DSI_RST_ESC_N    1
+#define IMX8ULP_SIM_RESET_MIPI_DSI_RST_BYTE_N   2
+
+#define IMX8ULP_SIM_RESET_NUM                   3
+
+#endif /* DT_BINDINGS_RESET_IMX8ULP_SIM_H */
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH v2 2/3] reset: add driver for imx8ulp SIM reset controller

Quoted 7 lines · Laurentiu Mihalcea

From: Laurentiu Mihalcea <[email protected]>

Certain components can be reset via the SIM module. Add reset controller driver for the SIM module to allow drivers for said components to control the reset signal(s).

Quoted 7 lines
---
 drivers/reset/Kconfig                         |   7 ++
 drivers/reset/Makefile                        |   1 +
 drivers/reset/reset-imx8ulp-sim.c             | 103 ++++++++++++++++++
 include/dt-bindings/reset/imx8ulp-sim-reset.h |  16 +++

That's a binding, not driver. Keep it *always* with binding.

Quoted 11 lines
 4 files changed, 127 insertions(+)
 create mode 100644 drivers/reset/reset-imx8ulp-sim.c
 create mode 100644 include/dt-bindings/reset/imx8ulp-sim-reset.h
drivers/reset/reset-imx8ulp-sim.c new file +5 -0
+static int imx8ulp_sim_reset_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct imx8ulp_sim_reset *simr;
+	int ret;

drivers/reset/reset-imx8ulp-sim.c line 77

Quoted 10 lines
drivers/reset/reset-imx8ulp-sim.c new file +10 -0
+
+	simr = devm_kzalloc(dev, sizeof(*simr), GFP_KERNEL);
+	if (!simr)
+		return -ENOMEM;
+
+	simr->regmap = syscon_node_to_regmap(dev->of_node);
+	if (IS_ERR(simr->regmap)) {
+		ret = PTR_ERR(simr->regmap);
+		dev_err(dev, "failed to get regmap: %d\n", ret);
+		return ret;

syntax is return dev_err_probe()

Quoted 17 lines
drivers/reset/reset-imx8ulp-sim.c new file +5 -0
+	}
 
 
+
+MODULE_AUTHOR("Liu Ying <[email protected]>");
+MODULE_DESCRIPTION("NXP i.MX8ULP System Integration Module Reset driver");
+MODULE_LICENSE("GPL");
include/dt-bindings/reset/imx8ulp-sim-reset.h new file +4 -0
new file mode 100644
index 000000000000..9f8fb8680a5e
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-only OR BSD-3-Clause */
+
+/*
+ * Copyright 2024 NXP

include/dt-bindings/reset/imx8ulp-sim-reset.h line 14

Quoted 10 lines
include/dt-bindings/reset/imx8ulp-sim-reset.h new file +10 -0
+ */
+
+#ifndef DT_BINDINGS_RESET_IMX8ULP_SIM_H
+#define DT_BINDINGS_RESET_IMX8ULP_SIM_H
+
+#define IMX8ULP_SIM_RESET_MIPI_DSI_RST_DPI_N    0
+#define IMX8ULP_SIM_RESET_MIPI_DSI_RST_ESC_N    1
+#define IMX8ULP_SIM_RESET_MIPI_DSI_RST_BYTE_N   2
+
+#define IMX8ULP_SIM_RESET_NUM                   3

Drop, not suitable for bindings.

include/dt-bindings/reset/imx8ulp-sim-reset.h line 16

Quoted 2 lines
include/dt-bindings/reset/imx8ulp-sim-reset.h new file +2 -0
+
+#endif /* DT_BINDINGS_RESET_IMX8ULP_SIM_H */

Best regards,
Krzysztof

#5 lore raw

PATCH v2 3/3 arm64: dts: imx8ulp: add AVD-SIM node

In reply to Laurentiu Mihalcea

From: Laurentiu Mihalcea <[email protected]>

Add node for imx8ulp's AVD-SIM module. This also
includes its children.

---
 arch/arm64/boot/dts/freescale/imx8ulp.dtsi | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm64/boot/dts/freescale/imx8ulp.dtsi +13 -0
index e32d5afcf4a9..1ffa4da23042 100644
@@ -614,6 +614,19 @@ per_bridge5: bus@2d800000 {
 			#size-cells = <1>;
 			ranges;
 
+			avd_sim: syscon@2da50000 {
+				compatible = "nxp,imx8ulp-avd-sim-reset", "syscon";
+				reg = <0x2da50000 0x38>;
+				clocks = <&pcc5 IMX8ULP_CLK_AVD_SIM>;
+				#reset-cells = <1>;
+
+				mux: mux-controller {
+					compatible = "mmio-mux";
+					#mux-control-cells = <1>;
+					mux-reg-masks = <0x8 0x00000200>;
+				};
+			};
+
 			cgc2: clock-controller@2da60000 {
 				compatible = "fsl,imx8ulp-cgc2";
 				reg = <0x2da60000 0x10000>;
Signature · 1 line
2.34.1