Skip to contentSkip to conversation

AM57xx: PRU ICSS Support

PATCH In review Roger Quadros 4 participants 13 messages Feb 4, 2019 – Apr 1, 2019

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

cover AM57xx: PRU ICSS Support

Hi,

This series adds PRU-ICSS support for AM57xx IDK.

PRU-ICSS is not present only on AM57xx SoCs so the PRUSS nodes are left disabled in dra7.dtsi. The board that uses a AM57xx SoC will have to enable them if required.

PRU-ICSS has a SYSC register but it requires custom handling. So we add a new "ti,sysc-pruss" type to the ti-sysc bus driver.

This series depends on

[1] - PRU ICSS support v2
https://lkml.org/lkml/2019/2/4/677

cheers,
-roger

Roger Quadros (2):
dt-binding: bus: ti-sysc: Add support for PRUSS SYSC type
bus: ti-sysc: Add support for PRUSS SYSC type

Suman Anna (2):
ARM: dts: dra7: add PRU-ICSS modules
ARM: dts: am57xx-idk-common: Enable PRU-ICSS nodes

 Documentation/devicetree/bindings/bus/ti-sysc.txt |   1 +
 arch/arm/boot/dts/am57xx-idk-common.dtsi          |   8 +
 arch/arm/boot/dts/dra7.dtsi                       | 194 ++++++++++++++++++++++
 drivers/bus/ti-sysc.c                             |  77 +++++++++
 include/linux/platform_data/ti-sysc.h             |   1 +
 5 files changed, 281 insertions(+)
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#1 lore raw

PATCH 1/4 dt-binding: bus: ti-sysc: Add support for PRUSS SYSC type

The PRUSS module has a SYSCFG which is unique. Add support for it.

---
 Documentation/devicetree/bindings/bus/ti-sysc.txt |  1 +
 include/dt-bindings/bus/ti-sysc.h                 | 11 +++++++++++
 2 files changed, 12 insertions(+)
Documentation/devicetree/bindings/bus/ti-sysc.txt +1 -0
index 85a23f5..fe1dfb1 100644
@@ -38,6 +38,7 @@ Required standard properties:
 		"ti,sysc-dra7-mcasp"
 		"ti,sysc-usb-host-fs"
 		"ti,sysc-dra7-mcan"
+		"ti,sysc-pruss"
 
 - reg		shall have register areas implemented for the interconnect
 		target module in question such as revision, sysc and syss
include/dt-bindings/bus/ti-sysc.h +11 -0
index 7138384..8ec78e8 100644
@@ -17,6 +17,17 @@
 
 #define SYSC_DRA7_MCAN_ENAWAKEUP	(1 << 4)
 
+/* SYSCONFIG specific to PRUSS */
+#define SYSC_PRUSS_SUB_MWAIT		(1 << 5)
+#define SYSC_PRUSS_STANDBY_INIT		(1 << 4)
+
+#define SYSC_PRUSS_STANDBY_FORCE	(0 << 2)
+#define SYSC_PRUSS_STANDBY_NO		(1 << 2)
+#define SYSC_PRUSS_STANDBY_SMART	(2 << 2)
+#define SYSC_PRUSS_STANDBY_MASK		(3 << 2)
+
+#define SYSC_PRUSS_IDLE_MASK		3
+
 /* SYSCONFIG STANDBYMODE/MIDLEMODE/SIDLEMODE supported by hardware */
 #define SYSC_IDLE_FORCE			0
 #define SYSC_IDLE_NO			1
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#2 lore raw

PATCH 2/4 bus: ti-sysc: Add support for PRUSS SYSC type

In reply to Roger Quadros

The PRUSS module has a SYSCFG which is unique. Add support for it.

---
 drivers/bus/ti-sysc.c                 | 77 +++++++++++++++++++++++++++++++++++
 include/dt-bindings/bus/ti-sysc.h     | 11 -----
 include/linux/platform_data/ti-sysc.h |  1 +
 3 files changed, 78 insertions(+), 11 deletions(-)
drivers/bus/ti-sysc.c +77 -0
index f94d335..5b9c81a 100644
@@ -622,6 +622,50 @@ static void sysc_show_registers(struct sysc *ddata)
 		buf);
 }
 
+static int sysc_enable_pruss(struct sysc *sysc)
+{
+	int i;
+	u32 reg;
+	bool ready;
+
+	/* configure for Smart Idle & Smart Standby */
+	reg = sysc_read(sysc, sysc->offsets[SYSC_SYSCONFIG]);
+	reg &= ~(SYSC_PRUSS_STANDBY_MASK | SYSC_PRUSS_IDLE_MASK);
+	reg |= SYSC_PRUSS_STANDBY_SMART | SYSC_IDLE_SMART;
+	sysc_write(sysc, sysc->offsets[SYSC_SYSCONFIG], reg);
+
+	/* bring out of Standby */
+	reg = sysc_read(sysc, sysc->offsets[SYSC_SYSCONFIG]);
+	reg &= ~SYSC_PRUSS_STANDBY_INIT;
+	sysc_write(sysc, sysc->offsets[SYSC_SYSCONFIG], reg);
+
+	/* wait till we are ready for transactions - delay is arbitrary */
+	for (i = 0; i < 10; i++) {
+		reg = sysc_read(sysc, sysc->offsets[SYSC_SYSCONFIG]);
+		ready = !(reg & SYSC_PRUSS_SUB_MWAIT);
+		if (ready)
+			break;
+		udelay(5);
+	}
+
+	if (!ready) {
+		dev_err(sysc->dev, "not ready for transaction\n");
+		return -ETIMEDOUT;
+	}
+
+	return 0;
+}
+
+static void sysc_disable_pruss(struct sysc *sysc)
+{
+	u32 reg;
+
+	/* initiate Standby */
+	reg = sysc_read(sysc, sysc->offsets[SYSC_SYSCONFIG]);
+	reg |= SYSC_PRUSS_STANDBY_INIT;
+	sysc_write(sysc, sysc->offsets[SYSC_SYSCONFIG], reg);
+}
+
 static int __maybe_unused sysc_runtime_suspend(struct device *dev)
 {
 	struct ti_sysc_platform_data *pdata;
@@ -649,6 +693,9 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev)
 		goto idled;
 	}
 
+	if (ddata->cap->type == TI_SYSC_PRUSS)
+		sysc_disable_pruss(ddata);
+
 	for (i = 0; i < ddata->nr_clocks; i++) {
 		if (IS_ERR_OR_NULL(ddata->clocks[i]))
 			continue;
@@ -704,6 +751,9 @@ static int __maybe_unused sysc_runtime_resume(struct device *dev)
 			return error;
 	}
 
+	if (ddata->cap->type == TI_SYSC_PRUSS)
+		sysc_enable_pruss(ddata);
+
 awake:
 	ddata->enabled = true;
 
@@ -1573,6 +1623,26 @@ static const struct sysc_capabilities sysc_dra7_mcan = {
 	.regbits = &sysc_regbits_dra7_mcan,
 };
 
+/*
+ * PRUSS on AM33x and later
+ */
+static const struct sysc_regbits sysc_regbits_pruss = {
+	.midle_shift = -ENODEV,
+	.clkact_shift = -ENODEV,
+	.sidle_shift = -ENODEV,
+	.enwkup_shift = -ENODEV,
+	.srst_shift = -ENODEV,
+	.autoidle_shift = -ENODEV,
+	.dmadisable_shift = -ENODEV,
+	.emufree_shift = -ENODEV,
+};
+
+static const struct sysc_capabilities sysc_pruss = {
+	.type = TI_SYSC_PRUSS,
+	.sysc_mask = SYSC_PRUSS_STANDBY_INIT | SYSC_PRUSS_SUB_MWAIT,
+	.regbits = &sysc_regbits_pruss,
+};
+
 static int sysc_init_pdata(struct sysc *ddata)
 {
 	struct ti_sysc_platform_data *pdata = dev_get_platdata(ddata->dev);
@@ -1702,6 +1772,10 @@ static int sysc_probe(struct platform_device *pdev)
 
 	INIT_DELAYED_WORK(&ddata->idle_work, ti_sysc_idle);
 
+	/* FIXME: how to ensure PRUSS stays enabled? */
+	if (ddata->cap->type == TI_SYSC_PRUSS)
+		goto skip_pm_put;
+
 	/* At least earlycon won't survive without deferred idle */
 	if (ddata->cfg.quirks & (SYSC_QUIRK_NO_IDLE_ON_INIT |
 				 SYSC_QUIRK_NO_RESET_ON_INIT)) {
@@ -1710,6 +1784,8 @@ static int sysc_probe(struct platform_device *pdev)
 		pm_runtime_put(&pdev->dev);
 	}
 
+skip_pm_put:
+
 	if (!of_get_available_child_count(ddata->dev->of_node))
 		reset_control_assert(ddata->rsts);
 
@@ -1766,6 +1842,7 @@ static const struct of_device_id sysc_match[] = {
 	{ .compatible = "ti,sysc-usb-host-fs",
 	  .data = &sysc_omap4_usb_host_fs, },
 	{ .compatible = "ti,sysc-dra7-mcan", .data = &sysc_dra7_mcan, },
+	{ .compatible = "ti,sysc-pruss", .data = &sysc_pruss, },
 	{  },
 };
 MODULE_DEVICE_TABLE(of, sysc_match);
include/dt-bindings/bus/ti-sysc.h +0 -11
index 8ec78e8..7138384 100644
@@ -17,17 +17,6 @@
 
 #define SYSC_DRA7_MCAN_ENAWAKEUP	(1 << 4)
 
-/* SYSCONFIG specific to PRUSS */
-#define SYSC_PRUSS_SUB_MWAIT		(1 << 5)
-#define SYSC_PRUSS_STANDBY_INIT		(1 << 4)
-
-#define SYSC_PRUSS_STANDBY_FORCE	(0 << 2)
-#define SYSC_PRUSS_STANDBY_NO		(1 << 2)
-#define SYSC_PRUSS_STANDBY_SMART	(2 << 2)
-#define SYSC_PRUSS_STANDBY_MASK		(3 << 2)
-
-#define SYSC_PRUSS_IDLE_MASK		3
-
 /* SYSCONFIG STANDBYMODE/MIDLEMODE/SIDLEMODE supported by hardware */
 #define SYSC_IDLE_FORCE			0
 #define SYSC_IDLE_NO			1
include/linux/platform_data/ti-sysc.h +1 -0
index 1ea3aab..56098e7 100644
@@ -15,6 +15,7 @@ enum ti_sysc_module_type {
 	TI_SYSC_OMAP4_MCASP,
 	TI_SYSC_OMAP4_USB_HOST_FS,
 	TI_SYSC_DRA7_MCAN,
+	TI_SYSC_PRUSS,
 };
 
 struct ti_sysc_cookie {
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
maintainer
#3 lore raw

Re: [PATCH 2/4] bus: ti-sysc: Add support for PRUSS SYSC type

drivers/bus/ti-sysc.c static void sysc_show_registers(struct sysc *ddata) · line 635

Quoted 11 lines · Roger Quadros
drivers/bus/ti-sysc.c +11 -0
+static int sysc_enable_pruss(struct sysc *sysc)
+{
+	int i;
+	u32 reg;
+	bool ready;
+
+	/* configure for Smart Idle & Smart Standby */
+	reg = sysc_read(sysc, sysc->offsets[SYSC_SYSCONFIG]);
+	reg &= ~(SYSC_PRUSS_STANDBY_MASK | SYSC_PRUSS_IDLE_MASK);
+	reg |= SYSC_PRUSS_STANDBY_SMART | SYSC_IDLE_SMART;
+	sysc_write(sysc, sysc->offsets[SYSC_SYSCONFIG], reg);

I think you can get rid of the SYSC_PRUSS_ defines here if you define the bits for it in struct sysc_regbits. The idle modes are SYSC_IDLE_* defines we already have in include/dt-bindings/bus/ti-sysc.h.

My guess is these will just become generic sysc_enable() and sysc_disable() functions :)

If you need module specific handling, you could add function pointers for enable and disable to struct sysc_capabilities.

drivers/bus/ti-sysc.c static int __maybe_unused sysc_runtime_suspend(struct device *dev) · line 701

Quoted 10 lines
drivers/bus/ti-sysc.c +3 -0
@@ -649,6 +693,9 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev)
 		goto idled;
 	}
 
+	if (ddata->cap->type == TI_SYSC_PRUSS)
+		sysc_disable_pruss(ddata);
+
 	for (i = 0; i < ddata->nr_clocks; i++) {
 		if (IS_ERR_OR_NULL(ddata->clocks[i]))
 			continue;

Ideally this would be just unconditional call to generic sysc_disable() here for non-legacy mode. Then if module specific enable and disable are there, sysc_enable() and disable() can call them.

drivers/bus/ti-sysc.c static const struct sysc_capabilities sysc_dra7_mcan = { · line 1638

Quoted 10 lines
drivers/bus/ti-sysc.c +10 -0
+static const struct sysc_regbits sysc_regbits_pruss = {
+	.midle_shift = -ENODEV,
+	.clkact_shift = -ENODEV,
+	.sidle_shift = -ENODEV,
+	.enwkup_shift = -ENODEV,
+	.srst_shift = -ENODEV,
+	.autoidle_shift = -ENODEV,
+	.dmadisable_shift = -ENODEV,
+	.emufree_shift = -ENODEV,
+};

So it seems you should populate at least midle_shift and sidle_shift bits here as in PRUSS_SYSCFG. I think STANDBY_MODE offset should go into the .midle_shift as it mentions initiator in TRM, and IDLE_MODE offset should go into .sidle_shift. So this might be really just using sysc_regbits_omap4_simple except it has an additional STANDBY_INIT bit which you could add for struct sysc_regbits if we don't have something similar already.

drivers/bus/ti-sysc.c static int sysc_probe(struct platform_device *pdev) · line 1781

Quoted 11 lines
drivers/bus/ti-sysc.c +4 -0
@@ -1702,6 +1772,10 @@ static int sysc_probe(struct platform_device *pdev)
 
 	INIT_DELAYED_WORK(&ddata->idle_work, ti_sysc_idle);
 
+	/* FIXME: how to ensure PRUSS stays enabled? */
+	if (ddata->cap->type == TI_SYSC_PRUSS)
+		goto skip_pm_put;
+
 	/* At least earlycon won't survive without deferred idle */
 	if (ddata->cfg.quirks & (SYSC_QUIRK_NO_IDLE_ON_INIT |
 				 SYSC_QUIRK_NO_RESET_ON_INIT)) {

Hmm so do you need to specify ti,no-idle-on-init or what's the logic needed here?

Quoted 12 lines
include/dt-bindings/bus/ti-sysc.h +0 -4
index 8ec78e8..7138384 100644
@@ -17,17 +17,6 @@
 
 #define SYSC_DRA7_MCAN_ENAWAKEUP	(1 << 4)
 
-/* SYSCONFIG specific to PRUSS */
-#define SYSC_PRUSS_SUB_MWAIT		(1 << 5)
-#define SYSC_PRUSS_STANDBY_INIT		(1 << 4)
-

include/dt-bindings/bus/ti-sysc.h line 22

Quoted 10 lines
include/dt-bindings/bus/ti-sysc.h +0 -7
-#define SYSC_PRUSS_STANDBY_FORCE	(0 << 2)
-#define SYSC_PRUSS_STANDBY_NO		(1 << 2)
-#define SYSC_PRUSS_STANDBY_SMART	(2 << 2)
-#define SYSC_PRUSS_STANDBY_MASK		(3 << 2)
-
-#define SYSC_PRUSS_IDLE_MASK		3
-
 /* SYSCONFIG STANDBYMODE/MIDLEMODE/SIDLEMODE supported by hardware */
 #define SYSC_IDLE_FORCE			0
 #define SYSC_IDLE_NO			1

I suggest you make this series independent of the rest of the PRUSS patches as we can add this separately. So no need to define these bits at all AFAIK.

Regards,

Tony

#4 lore raw

Re: [PATCH 2/4] bus: ti-sysc: Add support for PRUSS SYSC type

Tony,

Quoted 18 lines · Tony Lindgren

Review

Quoted 11 lines · Roger Quadros
(quoted diff) +11 -0
+static int sysc_enable_pruss(struct sysc *sysc)
+{
+	int i;
+	u32 reg;
+	bool ready;
+
+	/* configure for Smart Idle & Smart Standby */
+	reg = sysc_read(sysc, sysc->offsets[SYSC_SYSCONFIG]);
+	reg &= ~(SYSC_PRUSS_STANDBY_MASK | SYSC_PRUSS_IDLE_MASK);
+	reg |= SYSC_PRUSS_STANDBY_SMART | SYSC_IDLE_SMART;
+	sysc_write(sysc, sysc->offsets[SYSC_SYSCONFIG], reg);

I think you can get rid of the SYSC_PRUSS_ defines here if you define the bits for it in struct sysc_regbits. The idle modes are SYSC_IDLE_* defines we already have in include/dt-bindings/bus/ti-sysc.h.

Quoted 5 lines

My guess is these will just become generic sysc_enable() and sysc_disable() functions :)

If you need module specific handling, you could add function pointers for enable and disable to struct sysc_capabilities.

OK. I'll move all this to a generic handler then.

Quoted 5 lines
Quoted 5 lines
(quoted diff) +0 -0
@@ -649,6 +693,9 @@ static int __maybe_unused sysc_runtime_suspend(struct device *dev)
 		goto idled;
 	}
 
Quoted 11 lines

Review static int __maybe_unused sysc_runtime_suspend(struct device *dev) · line 701

Quoted 6 lines
(quoted diff) +3 -0
+	if (ddata->cap->type == TI_SYSC_PRUSS)
+		sysc_disable_pruss(ddata);
+
 	for (i = 0; i < ddata->nr_clocks; i++) {
 		if (IS_ERR_OR_NULL(ddata->clocks[i]))
 			continue;

Ideally this would be just unconditional call to generic sysc_disable() here for non-legacy mode. Then if module specific enable and disable are there, sysc_enable() and disable() can call them.

OK.

Quoted 12 lines

Review

Quoted 11 lines
(quoted diff) +10 -0
+static const struct sysc_regbits sysc_regbits_pruss = {
+	.midle_shift = -ENODEV,
+	.clkact_shift = -ENODEV,
+	.sidle_shift = -ENODEV,
+	.enwkup_shift = -ENODEV,
+	.srst_shift = -ENODEV,
+	.autoidle_shift = -ENODEV,
+	.dmadisable_shift = -ENODEV,
+	.emufree_shift = -ENODEV,
+};
Quoted 7 lines

So it seems you should populate at least midle_shift and sidle_shift bits here as in PRUSS_SYSCFG. I think STANDBY_MODE offset should go into the .midle_shift as it mentions initiator in TRM, and IDLE_MODE offset should go into .sidle_shift. So this might be really just using sysc_regbits_omap4_simple except it has an additional STANDBY_INIT bit which you could add for struct sysc_regbits if we don't have something similar already.

Got it.

Quoted 9 lines

Review static int sysc_probe(struct platform_device *pdev) · line 1778

Quoted 9 lines
(quoted diff) +4 -0
@@ -1702,6 +1772,10 @@ static int sysc_probe(struct platform_device *pdev)
 
 	INIT_DELAYED_WORK(&ddata->idle_work, ti_sysc_idle);
 
+	/* FIXME: how to ensure PRUSS stays enabled? */
+	if (ddata->cap->type == TI_SYSC_PRUSS)
+		goto skip_pm_put;
+

This was my bad. I forgot to move the pm_runtime_enable/get from the old pruss_soc_bus.c to pruss.c :). It work after than and this hack is not required.

Quoted 6 lines

Review static int sysc_probe(struct platform_device *pdev) · line 1781

Quoted 3 lines
(quoted diff) +0 -0
 	/* At least earlycon won't survive without deferred idle */
 	if (ddata->cfg.quirks & (SYSC_QUIRK_NO_IDLE_ON_INIT |
 				 SYSC_QUIRK_NO_RESET_ON_INIT)) {

Hmm so do you need to specify ti,no-idle-on-init or what's the logic needed here?

I was using "ti,no-reset-on-init" but that was because sysc_reset() was returning error due to missing syss mask. That can be fixed like so.

drivers/bus/ti-sysc.c +1 -0
index 5b9c81a..f5f2000 100644
@@ -941,6 +941,7 @@ static int sysc_reset(struct sysc *ddata)
 	int val;
 
 	if (ddata->legacy_mode || offset < 0 ||
+	    ddata->cap->regbits->srst_shift == -ENODEV ||
 	    ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT)
 		return 0;
 
Quoted 20 lines
Quoted 20 lines
include/dt-bindings/bus/ti-sysc.h +0 -11
index 8ec78e8..7138384 100644
@@ -17,17 +17,6 @@
 
 #define SYSC_DRA7_MCAN_ENAWAKEUP	(1 << 4)
 
-/* SYSCONFIG specific to PRUSS */
-#define SYSC_PRUSS_SUB_MWAIT		(1 << 5)
-#define SYSC_PRUSS_STANDBY_INIT		(1 << 4)
-
-#define SYSC_PRUSS_STANDBY_FORCE	(0 << 2)
-#define SYSC_PRUSS_STANDBY_NO		(1 << 2)
-#define SYSC_PRUSS_STANDBY_SMART	(2 << 2)
-#define SYSC_PRUSS_STANDBY_MASK		(3 << 2)
-
-#define SYSC_PRUSS_IDLE_MASK		3
-
Quoted 8 lines

include/dt-bindings/bus/ti-sysc.h line 22

Quoted 3 lines
include/dt-bindings/bus/ti-sysc.h +0 -0
 /* SYSCONFIG STANDBYMODE/MIDLEMODE/SIDLEMODE supported by hardware */
 #define SYSC_IDLE_FORCE			0
 #define SYSC_IDLE_NO			1

I suggest you make this series independent of the rest of the PRUSS patches as we can add this separately. So no need to define these bits at all AFAIK.

OK. Thanks.

cheers,
-roger

Quoted 5 lines

Regards,

Tony

Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
maintainer
#5 lore raw

Re: [PATCH 2/4] bus: ti-sysc: Add support for PRUSS SYSC type

In reply to Roger Quadros
Quoted 7 lines · Roger Quadros

The PRUSS module has a SYSCFG which is unique. Add support for it.

---
 drivers/bus/ti-sysc.c                 | 77 +++++++++++++++++++++++++++++++++++
 include/dt-bindings/bus/ti-sysc.h     | 11 -----

Did you intend to remove what you just added?

Quoted 2 lines
 include/linux/platform_data/ti-sysc.h |  1 +
 3 files changed, 78 insertions(+), 11 deletions(-)
#6 lore raw

Re: [PATCH 2/4] bus: ti-sysc: Add support for PRUSS SYSC type

Hi Rob,

Quoted 10 lines · Rob Herring
Quoted 7 lines · Roger Quadros

The PRUSS module has a SYSCFG which is unique. Add support for it.

---
 drivers/bus/ti-sysc.c                 | 77 +++++++++++++++++++++++++++++++++++
 include/dt-bindings/bus/ti-sysc.h     | 11 -----

Did you intend to remove what you just added?

This series is not complete, and we will submitting another version once the issues with AM335x and AM437x are sorted out. Please ignore this.

regards
Suman

Quoted 3 lines
Quoted 3 lines
 include/linux/platform_data/ti-sysc.h |  1 +
 3 files changed, 78 insertions(+), 11 deletions(-)
#7 lore raw

Re: [PATCH 2/4] bus: ti-sysc: Add support for PRUSS SYSC type

In reply to Rob Herring
Quoted 10 lines · Rob Herring
Quoted 7 lines · Roger Quadros

The PRUSS module has a SYSCFG which is unique. Add support for it.

---
 drivers/bus/ti-sysc.c                 | 77 +++++++++++++++++++++++++++++++++++
 include/dt-bindings/bus/ti-sysc.h     | 11 -----

Did you intend to remove what you just added?

Yes, it was a mistake.

Quoted 3 lines
Quoted 3 lines
 include/linux/platform_data/ti-sysc.h |  1 +
 3 files changed, 78 insertions(+), 11 deletions(-)

cheers,
-roger

Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
#8 lore raw

PATCH 3/4 ARM: dts: dra7: add PRU-ICSS modules

In reply to Roger Quadros

From: Suman Anna <[email protected]>

Add the DT nodes for the PRU-ICSS1 and PRU-ICSS2 processor subsystems that are present on AM57xx family of SoCs. Each PRU-ICSS instance is represented by a pruss-soc-bus node and a child PRUSS subsystem node. The two PRU-ICSSs are identical to each other. They are not supported on DRA7xx SoCs in general, so the nodes are added in disabled state to the common dra7 DTS file. They should be enabled only in the AM57xx related board files.

The PRU-ICSSs on AM57xx are very similar to the PRUSS in AM33xx and AM437x except for variations in the RAM sizes and the number of interrupts coming into the MPU INTC. The interrupt events into the PRU-ICSS also requires programming of the corresponding crossbars properly.

The default names for the firmware images for each PRU core are defined as follows (these can be adjusted either in derivative board dts files or through sysfs at runtime if required):
PRU-ICSS1 PRU0 Core: am57xx-pru1_0-fw
PRU-ICSS1 PRU1 Core: am57xx-pru1_1-fw
PRU-ICSS2 PRU0 Core: am57xx-pru2_0-fw
PRU-ICSS2 PRU1 Core: am57xx-pru2_1-fw

Two PRU system events "vring" and "kick" have been added to each PRU node in each of the PRU-ICSS1 and PRU-ICSS2 remote processor subsystems to enable the virtio/rpmsg communication between MPU and that PRU core.

The PRU system events is the preferred approach over using OMAP mailboxes, as it eliminates an external peripheral access from the PRU-side, and keeps the interrupt generation internal to the PRUSS. The difference from MPU would be minimal in using one versus the other.

Mailboxes can still be used if desired. Either approach would require that an appropriate firmware image is loaded/booted on the PRU.

---
 arch/arm/boot/dts/dra7.dtsi | 194 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 194 insertions(+)
arch/arm/boot/dts/dra7.dtsi +194 -0
index 2bc9add..2458e7a 100644
@@ -167,6 +167,200 @@
 		l4_per3: interconnect@48800000 {
 		};
 
+		pru_icss1: target-module@4b200000 {
+			compatible = "ti,sysc-pruss", "ti,sysc";
+			reg = <0x4b226000 0x4>,
+			      <0x4b226004 0x4>;
+			reg-names = "rev", "sysc";
+			ti,no-reset-on-init;
+			/* Domains (P, C): coreaon_pwrdm, l4per2_clkdm */
+			clocks = <&l4per2_clkctrl DRA7_L4PER2_PRUSS1_CLKCTRL 0>;
+			clock-names = "fck";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0x00000000 0x4b200000 0x20000000>;
+
+			pruss1: pruss@4b200000 {
+				compatible = "ti,am5728-pruss";
+				reg = <0x0000 0x2000>,
+				      <0x2000 0x2000>,
+				      <0x10000 0x8000>;
+				reg-names = "dram0", "dram1",
+					    "shrdram2";
+				#address-cells = <1>;
+				#size-cells = <1>;
+				ranges;
+
+				pruss1_cfg: cfg@26000 {
+					compatible = "syscon";
+					reg = <0x26000 0x2000>;
+				};
+
+				pruss1_iep: iep@2e000 {
+					compatible = "syscon";
+					reg = <0x2e000 0x31c>;
+				};
+
+				pruss1_mii_rt: mii_rt@32000 {
+					compatible = "syscon";
+					reg = <0x32000 0x58>;
+				};
+
+				pruss1_intc: intc@20000 {
+					compatible = "ti,am5728-pruss-intc";
+					reg = <0x20000 0x2000>;
+					reg-names = "intc";
+					interrupt-controller;
+					#interrupt-cells = <1>;
+					interrupts = <GIC_SPI 186 IRQ_TYPE_LEVEL_HIGH>,
+						     <GIC_SPI 187 IRQ_TYPE_LEVEL_HIGH>,
+						     <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>,
+						     <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>,
+						     <GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>,
+						     <GIC_SPI 191 IRQ_TYPE_LEVEL_HIGH>,
+						     <GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>,
+						     <GIC_SPI 193 IRQ_TYPE_LEVEL_HIGH>;
+					interrupt-names = "host2", "host3", "host4",
+							  "host5", "host6", "host7",
+							  "host8", "host9";
+				};
+
+				pru1_0: pru@34000 {
+					compatible = "ti,am5728-pru";
+					reg = <0x34000 0x3000>,
+					      <0x22000 0x400>,
+					      <0x22400 0x100>;
+					reg-names = "iram", "control", "debug";
+					gpcfg = <&pruss1_cfg 0x8>;
+					firmware-name = "am57xx-pru1_0-fw";
+					interrupt-parent = <&pruss1_intc>;
+					interrupts = <16>, <17>;
+					interrupt-names = "vring", "kick";
+				};
+
+				pru1_1: pru@38000 {
+					compatible = "ti,am5728-pru";
+					reg = <0x38000 0x3000>,
+					      <0x24000 0x400>,
+					      <0x24400 0x100>;
+					reg-names = "iram", "control", "debug";
+					gpcfg = <&pruss1_cfg 0xc>;
+					firmware-name = "am57xx-pru1_1-fw";
+					interrupt-parent = <&pruss1_intc>;
+					interrupts = <18>, <19>;
+					interrupt-names = "vring", "kick";
+				};
+
+				pruss1_mdio: mdio@32400 {
+					compatible = "ti,davinci_mdio";
+					reg = <0x32400 0x90>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					clocks = <&dpll_gmac_h13x2_ck>;
+					clock-names = "fck";
+					bus_freq = <1000000>;
+					status = "disabled";
+				};
+			};
+		};
+
+		pru_icss2: target_module@4b280000 {
+			compatible = "ti,sysc-pruss", "ti,sysc";
+			reg = <0x4b2a6000 0x4>,
+			      <0x4b2a6004 0x4>;
+			reg-names = "rev", "sysc";
+			ti,no-reset-on-init;
+			/* Domains (P, C): coreaon_pwrdm, l4per2_clkdm */
+			clocks = <&l4per2_clkctrl DRA7_L4PER2_PRUSS2_CLKCTRL 0>;
+			clock-names = "fck";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0x00000000 0x4b280000 0x20000000>;
+
+			pruss2: pruss@4b280000 {
+				compatible = "ti,am5728-pruss";
+				reg = <0 0x2000>,
+				      <0x2000 0x2000>,
+				      <0x10000 0x8000>;
+				reg-names = "dram0", "dram1",
+					    "shrdram2";
+				#address-cells = <1>;
+				#size-cells = <1>;
+				ranges;
+
+				pruss2_cfg: cfg@26000 {
+					compatible = "syscon";
+					reg = <0x26000 0x2000>;
+				};
+
+				pruss2_iep: iep@2e000 {
+					compatible = "syscon";
+					reg = <0x2e000 0x31c>;
+				};
+
+				pruss2_mii_rt: mii_rt@32000 {
+					compatible = "syscon";
+					reg = <0x32000 0x58>;
+				};
+
+				pruss2_intc: intc@20000 {
+					compatible = "ti,am5728-pruss-intc";
+					reg = <0x20000 0x2000>;
+					reg-names = "intc";
+					interrupt-controller;
+					#interrupt-cells = <1>;
+					interrupts = <GIC_SPI 196 IRQ_TYPE_LEVEL_HIGH>,
+						     <GIC_SPI 197 IRQ_TYPE_LEVEL_HIGH>,
+						     <GIC_SPI 198 IRQ_TYPE_LEVEL_HIGH>,
+						     <GIC_SPI 199 IRQ_TYPE_LEVEL_HIGH>,
+						     <GIC_SPI 200 IRQ_TYPE_LEVEL_HIGH>,
+						     <GIC_SPI 201 IRQ_TYPE_LEVEL_HIGH>,
+						     <GIC_SPI 202 IRQ_TYPE_LEVEL_HIGH>,
+						     <GIC_SPI 203 IRQ_TYPE_LEVEL_HIGH>;
+					interrupt-names = "host2", "host3", "host4",
+							  "host5", "host6", "host7",
+							  "host8", "host9";
+				};
+
+				pru2_0: pru@34000 {
+					compatible = "ti,am5728-pru";
+					reg = <0x34000 0x3000>,
+					      <0x22000 0x400>,
+					      <0x22400 0x100>;
+					reg-names = "iram", "control", "debug";
+					gpcfg = <&pruss2_cfg 0x8>;
+					firmware-name = "am57xx-pru2_0-fw";
+					interrupt-parent = <&pruss2_intc>;
+					interrupts = <16>, <17>;
+					interrupt-names = "vring", "kick";
+				};
+
+				pru2_1: pru@38000 {
+					compatible = "ti,am5728-pru";
+					reg = <0x38000 0x3000>,
+					      <0x24000 0x400>,
+					      <0x24400 0x100>;
+					reg-names = "iram", "control", "debug";
+					gpcfg = <&pruss2_cfg 0xc>;
+					firmware-name = "am57xx-pru2_1-fw";
+					interrupt-parent = <&pruss2_intc>;
+					interrupts = <18>, <19>;
+					interrupt-names = "vring", "kick";
+				};
+
+				pruss2_mdio: mdio@32400 {
+					compatible = "ti,davinci_mdio";
+					reg = <0x32400 0x90>;
+					#address-cells = <1>;
+					#size-cells = <0>;
+					clocks = <&dpll_gmac_h13x2_ck>;
+					clock-names = "fck";
+					bus_freq = <1000000>;
+					status = "disabled";
+				};
+			};
+		};
+
 		axi@0 {
 			compatible = "simple-bus";
 			#size-cells = <1>;
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
maintainer
#9 lore raw

Re: [PATCH 3/4] ARM: dts: dra7: add PRU-ICSS modules

arch/arm/boot/dts/dra7.dtsi line 170

Quoted 7 lines · Roger Quadros
arch/arm/boot/dts/dra7.dtsi +1 -0
@@ -167,6 +167,200 @@
 		l4_per3: interconnect@48800000 {
 		};
 
+		pru_icss1: target-module@4b200000 {

I suggest you add these into dra7-pruss.dtsi as they have internal interconnects. And eventually some of the *pruss.dtsi files might become shared :) And we avoid moving these around when we define the l3 interconnects and avoid a lot of extra long dtsi line lengths with the added nestedness later on.

Regards,

Tony

#10 lore raw

Re: [PATCH 3/4] ARM: dts: dra7: add PRU-ICSS modules

Hi Tony,

Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Roger Quadros
arch/arm/boot/dts/dra7.dtsi +0 -0
@@ -167,6 +167,200 @@
 		l4_per3: interconnect@48800000 {
 		};
 
Quoted 8 lines

arch/arm/boot/dts/dra7.dtsi line 170

Quoted 1 line
arch/arm/boot/dts/dra7.dtsi +1 -0
+		pru_icss1: target-module@4b200000 {

I suggest you add these into dra7-pruss.dtsi as they have internal interconnects. And eventually some of the *pruss.dtsi files might become shared :) And we avoid moving these around when we define the l3 interconnects and avoid a lot of extra long dtsi line lengths with the added nestedness later on.

PRUSS is only present on AM57x variants.
I will move this to am57x-pruss.dtsi.

This means all AM57x boards will have to include it.

Is this OK?

Signature · 5 lines
cheers,
-roger

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
maintainer
#11 lore raw

Re: [PATCH 3/4] ARM: dts: dra7: add PRU-ICSS modules

Quoted 19 lines · Roger Quadros

Hi Tony,

Quoted 7 lines · Tony Lindgren
Quoted 6 lines · Roger Quadros
arch/arm/boot/dts/dra7.dtsi +0 -0
@@ -167,6 +167,200 @@
 		l4_per3: interconnect@48800000 {
 		};
 
Quoted 8 lines

arch/arm/boot/dts/dra7.dtsi line 170

Quoted 1 line
arch/arm/boot/dts/dra7.dtsi +1 -0
+		pru_icss1: target-module@4b200000 {

I suggest you add these into dra7-pruss.dtsi as they have internal interconnects. And eventually some of the *pruss.dtsi files might become shared :) And we avoid moving these around when we define the l3 interconnects and avoid a lot of extra long dtsi line lengths with the added nestedness later on.

Quoted 6 lines

PRUSS is only present on AM57x variants.
I will move this to am57x-pruss.dtsi.

This means all AM57x boards will have to include it.

Is this OK?

Sure sounds good to me.

Regards,

Tony

#12 lore raw

PATCH 4/4 ARM: dts: am57xx-idk-common: Enable PRU-ICSS nodes

In reply to Roger Quadros

From: Suman Anna <[email protected]>

The two PRU-ICSS processor subsystem bus nodes and their corresponding subsystem nodes were left in disabled state in the base dra7.dts file. The PRU-ICSSs are supported on only the AM57xx SoCs, so enable these nodes (both PRU-ICSS1 and PRU-ICSS2 instances) to support them on all the AM571x, AM572x and AM574x IDK boards. The PRU nodes are already enabled in the base dts file, and so become effective automatically with the enabling of these PRU-ICSS nodes.

The corresponding PRU nodes can be disabled later on if there are no use-cases defined to use a particular PRU core or the whole PRU-ICSS subsystem itself if both its PRU cores are unused.

---
 arch/arm/boot/dts/am57xx-idk-common.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm/boot/dts/am57xx-idk-common.dtsi +8 -0
index f7bd264..6991412 100644
@@ -492,3 +492,11 @@
 &cpu0 {
 	vdd-supply = <&smps12_reg>;
 };
+
+&pruss1 {
+	status = "okay";
+};
+
+&pruss2 {
+	status = "okay";
+};
Signature · 2 lines
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki