Skip to contentSkip to conversation

soc/tegra: Implement Tegra186 PMC support

PATCH In review Thierry Reding 4 participants 9 messages Nov 17, 2016 – Nov 18, 2016 6 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc/tegra: Implement Tegra186 PMC support

From: Thierry Reding <[email protected]>

The power management controller on Tegra186 has changed in backwards- incompatible ways with respect to earlier generations. This implements a new driver that supports inversion of the PMU interrupt as well as the "recovery", "bootloader" and "forced-recovery" reboot commands.

---
 .../bindings/arm/tegra/nvidia,tegra186-pmc.txt     |  34 +++++
 drivers/soc/tegra/Makefile                         |   2 +-
 drivers/soc/tegra/pmc-tegra186.c                   | 169 +++++++++++++++++++++
 3 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.txt
 create mode 100644 drivers/soc/tegra/pmc-tegra186.c
Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.txt new file +34 -0
new file mode 100644
index 000000000000..078a58b0302f
@@ -0,0 +1,34 @@
+NVIDIA Tegra Power Management Controller (PMC)
+
+Required properties:
+- compatible: Should contain one of the following:
+  - "nvidia,tegra186-pmc": for Tegra186
+- reg: Must contain an (offset, length) pair of the register set for each
+  entry in reg-names.
+- reg-names: Must include the following entries:
+  - "pmc"
+  - "wake"
+  - "aotag"
+  - "scratch"
+
+Optional properties:
+- nvidia,invert-interrupt: If present, inverts the PMU interrupt signal.
+
+Example:
+
+SoC DTSI:
+
+	pmc@c3600000 {
+		compatible = "nvidia,tegra186-pmc";
+		reg = <0 0x0c360000 0 0x10000>,
+		      <0 0x0c370000 0 0x10000>,
+		      <0 0x0c380000 0 0x10000>,
+		      <0 0x0c390000 0 0x10000>;
+		reg-names = "pmc", "wake", "aotag", "scratch";
+	};
+
+Board DTS:
+
+	pmc@c360000 {
+		nvidia,invert-interrupt;
+	};
drivers/soc/tegra/Makefile +1 -1
index ae857ff7d53d..9976a0de1927 100644
@@ -1,4 +1,4 @@
 obj-y += fuse/
 
 obj-y += common.o
-obj-y += pmc.o
+obj-y += pmc.o pmc-tegra186.o
drivers/soc/tegra/pmc-tegra186.c new file +169 -0

169 lines not on this page · raw message

Signature · 1 line
2.10.2
#2 lore raw
In reply to a message not in the archive
Quoted 16 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The power management controller on Tegra186 has changed in backwards- incompatible ways with respect to earlier generations. This implements a new driver that supports inversion of the PMU interrupt as well as the "recovery", "bootloader" and "forced-recovery" reboot commands.

---
 .../bindings/arm/tegra/nvidia,tegra186-pmc.txt     |  34 +++++
 drivers/soc/tegra/Makefile                         |   2 +-
 drivers/soc/tegra/pmc-tegra186.c                   | 169 +++++++++++++++++++++
 3 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.txt
 create mode 100644 drivers/soc/tegra/pmc-tegra186.c

[...]

Quoted 5 lines
drivers/soc/tegra/pmc-tegra186.c new file +0 -0
new file mode 100644
index 000000000000..ee28eddd8e3c

[...]

drivers/soc/tegra/pmc-tegra186.c line 81

Quoted 10 lines
drivers/soc/tegra/pmc-tegra186.c new file +10 -0
+
+	/*
+	 * If available, call the system restart implementation that was
+	 * registered earlier (typically PSCI).
+	 */
+	if (pmc->system_restart) {
+		pmc->system_restart(reboot_mode, cmd);
+		return NOTIFY_DONE;
+	}
+

IIUC, Tegra186 implements PSCI v1.0 and it always takes above path. So what other platforms does this driver support ? The name is pmc-tegra186.c, hence the confusion.

Signature · 2 lines
Regards,
Sudeep
#4 lore raw
In reply to a message not in the archive
Quoted 30 lines · Sudeep Holla
Quoted 16 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The power management controller on Tegra186 has changed in backwards- incompatible ways with respect to earlier generations. This implements a new driver that supports inversion of the PMU interrupt as well as the "recovery", "bootloader" and "forced-recovery" reboot commands.

---
 .../bindings/arm/tegra/nvidia,tegra186-pmc.txt     |  34 +++++
 drivers/soc/tegra/Makefile                         |   2 +-
 drivers/soc/tegra/pmc-tegra186.c                   | 169 +++++++++++++++++++++
 3 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.txt
 create mode 100644 drivers/soc/tegra/pmc-tegra186.c

[...]

Quoted 5 lines
drivers/soc/tegra/pmc-tegra186.c new file +0 -0
new file mode 100644
index 000000000000..ee28eddd8e3c

[...]

Quoted 14 lines

drivers/soc/tegra/pmc-tegra186.c line 81

Quoted 10 lines
drivers/soc/tegra/pmc-tegra186.c new file +10 -0
+
+	/*
+	 * If available, call the system restart implementation that was
+	 * registered earlier (typically PSCI).
+	 */
+	if (pmc->system_restart) {
+		pmc->system_restart(reboot_mode, cmd);
+		return NOTIFY_DONE;
+	}
+

IIUC, Tegra186 implements PSCI v1.0 and it always takes above path. So what other platforms does this driver support ? The name is pmc-tegra186.c, hence the confusion.

It's technically possible to run Tegra186 without PSCI enabled, or even boot it with firmware that doesn't implement PSCI. In such cases it would be nice to still be able to reboot via the PMC code above.

Thierry

#6 lore raw
In reply to a message not in the archive
Quoted 46 lines · Thierry Reding
Quoted 30 lines · Sudeep Holla
Quoted 16 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The power management controller on Tegra186 has changed in backwards- incompatible ways with respect to earlier generations. This implements a new driver that supports inversion of the PMU interrupt as well as the "recovery", "bootloader" and "forced-recovery" reboot commands.

---
 .../bindings/arm/tegra/nvidia,tegra186-pmc.txt     |  34 +++++
 drivers/soc/tegra/Makefile                         |   2 +-
 drivers/soc/tegra/pmc-tegra186.c                   | 169 +++++++++++++++++++++
 3 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.txt
 create mode 100644 drivers/soc/tegra/pmc-tegra186.c

[...]

Quoted 5 lines
drivers/soc/tegra/pmc-tegra186.c new file +0 -0
new file mode 100644
index 000000000000..ee28eddd8e3c

[...]

Quoted 14 lines

drivers/soc/tegra/pmc-tegra186.c line 81

Quoted 10 lines
drivers/soc/tegra/pmc-tegra186.c new file +10 -0
+
+	/*
+	 * If available, call the system restart implementation that was
+	 * registered earlier (typically PSCI).
+	 */
+	if (pmc->system_restart) {
+		pmc->system_restart(reboot_mode, cmd);
+		return NOTIFY_DONE;
+	}
+

IIUC, Tegra186 implements PSCI v1.0 and it always takes above path. So what other platforms does this driver support ? The name is pmc-tegra186.c, hence the confusion.

Quoted 2 lines

It's technically possible to run Tegra186 without PSCI enabled, or even boot it with firmware that doesn't implement PSCI. In such cases it

OK, with enable-method as "spin-table" I suppose ?

Quoted 1 line

would be nice to still be able to reboot via the PMC code above.

I assume it's only for development purposes as you won't have much CPU power management support without PSCI.

Signature · 2 lines
Regards,
Sudeep
#8 lore raw
In reply to a message not in the archive
Quoted 49 lines · Sudeep Holla
Quoted 46 lines · Thierry Reding
Quoted 44 lines · Sudeep Holla
Quoted 16 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The power management controller on Tegra186 has changed in backwards- incompatible ways with respect to earlier generations. This implements a new driver that supports inversion of the PMU interrupt as well as the "recovery", "bootloader" and "forced-recovery" reboot commands.

---
 .../bindings/arm/tegra/nvidia,tegra186-pmc.txt     |  34 +++++
 drivers/soc/tegra/Makefile                         |   2 +-
 drivers/soc/tegra/pmc-tegra186.c                   | 169 +++++++++++++++++++++
 3 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.txt
 create mode 100644 drivers/soc/tegra/pmc-tegra186.c

[...]

Quoted 5 lines
drivers/soc/tegra/pmc-tegra186.c new file +0 -0
new file mode 100644
index 000000000000..ee28eddd8e3c

[...]

drivers/soc/tegra/pmc-tegra186.c

Quoted 10 lines
drivers/soc/tegra/pmc-tegra186.c new file +10 -0
+
+	/*
+	 * If available, call the system restart implementation that was
+	 * registered earlier (typically PSCI).
+	 */
+	if (pmc->system_restart) {
+		pmc->system_restart(reboot_mode, cmd);
+		return NOTIFY_DONE;
+	}
+

IIUC, Tegra186 implements PSCI v1.0 and it always takes above path. So what other platforms does this driver support ? The name is pmc-tegra186.c, hence the confusion.

Quoted 4 lines
Quoted 2 lines

It's technically possible to run Tegra186 without PSCI enabled, or even boot it with firmware that doesn't implement PSCI. In such cases it

OK, with enable-method as "spin-table" I suppose ?

Yes, that would probably be the other choice for SMP.

Quoted 4 lines
Quoted 1 line

would be nice to still be able to reboot via the PMC code above.

I assume it's only for development purposes as you won't have much CPU power management support without PSCI.

This is what I had primarily in mind. Sometimes it might be useful to boot without PSCI at all (as a poor man's way of disable SMP), in which case this driver can still be used for reboot into the bootloader or recovery mode.

Thierry

#10 lore raw
In reply to a message not in the archive
Quoted 4 lines · Thierry Reding
Quoted 3 lines · Sudeep Holla

On 17/11/16 17:31, Thierry Reding wrote:

[...]

Quoted 10 lines
Quoted 4 lines
Quoted 1 line

would be nice to still be able to reboot via the PMC code above.

I assume it's only for development purposes as you won't have much CPU power management support without PSCI.

This is what I had primarily in mind. Sometimes it might be useful to boot without PSCI at all (as a poor man's way of disable SMP), in which case this driver can still be used for reboot into the bootloader or recovery mode.

Thanks for clarification.

Signature · 2 lines
Regards,
Sudeep
#11 lore raw
In reply to a message not in the archive
Quoted 15 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The power management controller on Tegra186 has changed in backwards- incompatible ways with respect to earlier generations. This implements a new driver that supports inversion of the PMU interrupt as well as the "recovery", "bootloader" and "forced-recovery" reboot commands.

---
 .../bindings/arm/tegra/nvidia,tegra186-pmc.txt     |  34 +++++
 drivers/soc/tegra/Makefile                         |   2 +-
 drivers/soc/tegra/pmc-tegra186.c                   | 169 +++++++++++++++++++++
 3 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.txt
 create mode 100644 drivers/soc/tegra/pmc-tegra186.c

...

drivers/soc/tegra/Makefile line 4

Quoted 10 lines
drivers/soc/tegra/Makefile +1 -1
index ae857ff7d53d..9976a0de1927 100644
@@ -1,4 +1,4 @@
 obj-y += fuse/
 
 obj-y += common.o
-obj-y += pmc.o
+obj-y += pmc.o pmc-tegra186.o

Do we want to enable this driver for all Tegra devices? Was not sure if this should be dependent on ARM64.

Cheers
Jon

Signature · 1 line
nvpublic
#13 lore raw
In reply to a message not in the archive
Quoted 27 lines · Jon Hunter
Quoted 15 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The power management controller on Tegra186 has changed in backwards- incompatible ways with respect to earlier generations. This implements a new driver that supports inversion of the PMU interrupt as well as the "recovery", "bootloader" and "forced-recovery" reboot commands.

---
 .../bindings/arm/tegra/nvidia,tegra186-pmc.txt     |  34 +++++
 drivers/soc/tegra/Makefile                         |   2 +-
 drivers/soc/tegra/pmc-tegra186.c                   | 169 +++++++++++++++++++++
 3 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.txt
 create mode 100644 drivers/soc/tegra/pmc-tegra186.c

...

Quoted 7 lines
drivers/soc/tegra/Makefile +0 -0
index ae857ff7d53d..9976a0de1927 100644
@@ -1,4 +1,4 @@
 obj-y += fuse/
 
Quoted 6 lines

drivers/soc/tegra/Makefile line 4

Quoted 3 lines
drivers/soc/tegra/Makefile +1 -1
 obj-y += common.o
-obj-y += pmc.o
+obj-y += pmc.o pmc-tegra186.o

Do we want to enable this driver for all Tegra devices? Was not sure if this should be dependent on ARM64.

Yeah, I think adding an non-user-visible Kconfig symbol for this might make sense. Then we can use Kconfig to encode the logic about where to enable this and simply use the Kconfig symbol in the Makefile.

Thierry

Acked-by
#14 lore raw
In reply to a message not in the archive
Quoted 10 lines · Thierry Reding

From: Thierry Reding <[email protected]>

The power management controller on Tegra186 has changed in backwards- incompatible ways with respect to earlier generations. This implements a new driver that supports inversion of the PMU interrupt as well as the "recovery", "bootloader" and "forced-recovery" reboot commands.

---
 .../bindings/arm/tegra/nvidia,tegra186-pmc.txt     |  34 +++++
Quoted 5 lines
 drivers/soc/tegra/Makefile                         |   2 +-
 drivers/soc/tegra/pmc-tegra186.c                   | 169 +++++++++++++++++++++
 3 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/arm/tegra/nvidia,tegra186-pmc.txt
 create mode 100644 drivers/soc/tegra/pmc-tegra186.c