All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx
@ 2022-07-27 19:27 Greg Leonberg
  2022-07-27 19:27 ` [U-Boot] [PATCH 01/10] arm: Add omap5 pruss1 and pruss2 to prcm structure Greg Leonberg
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Greg Leonberg @ 2022-07-27 19:27 UTC (permalink / raw)
  To: u-boot; +Cc: Greg Leonberg

This series adds support for the pruss/pru_rproc drivers on am33xx and
am57xx SoCs.

All PRU interfaces pru0 and pru1 are supported on am33xx.
All PRU interfaces pru0, pru1, pru2, and pru3 are supported on am57xx.

Testing is done via the "rproc" U-Boot command.

This patch series is based on ti-u-boot-2020.01 branch on ti-u-boot
repository located at: https://git.ti.com/cgit/ti-u-boot/ti-u-boot/
and commit 2781231a33c3
("arm: mach-k3: j721e_init: probe clock node after sci node is probed")

From looking at the master branch of the main u-boot repository, there does
not appear to be significant effort required to merge it into the master
branch.

Greg Leonberg (10):
  arm: Add omap5 pruss1 and pruss2 to prcm structure
  arm: arch-am33xx: Add prm_per definition
  arm: arch-am33xx: Add pru_icss clkctrl
  soc: ti: pruss: Add support for am33xx
  soc: ti: pruss: Add support for am57xx
  remoteproc: pru_rproc: Add support for am33xx
  remoteproc: pru_rproc: Add support for am57xx
  remoteproc: pru_rproc: Add is_running support
  arm: dts: am33xx: Add pruss and pru
  arm: dts: dra7: Add pruss and pru

 arch/arm/dts/am33xx.dtsi                           | 105 +++++++++++
 arch/arm/dts/dra7.dtsi                             | 198 ++++++++++++++++++++
 arch/arm/include/asm/arch-am33xx/cpu.h             |  13 +-
 arch/arm/include/asm/arch-am33xx/hardware_am33xx.h |   1 +
 arch/arm/include/asm/omap_common.h                 |   2 +
 arch/arm/mach-omap2/omap5/prcm-regs.c              |   2 +
 drivers/remoteproc/Kconfig                         |   6 +-
 drivers/remoteproc/Makefile                        |   6 +
 drivers/remoteproc/pru_rproc.c                     | 200 +++++++++++++++------
 drivers/soc/ti/Kconfig                             |  10 +-
 drivers/soc/ti/Makefile                            |   6 +
 drivers/soc/ti/pruss.c                             | 102 ++++++++++-
 12 files changed, 582 insertions(+), 69 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH 01/10] arm: Add omap5 pruss1 and pruss2 to prcm structure
  2022-07-27 19:27 [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Greg Leonberg
@ 2022-07-27 19:27 ` Greg Leonberg
  2022-07-27 19:27 ` [U-Boot] [PATCH 02/10] arm: arch-am33xx: Add prm_per definition Greg Leonberg
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Greg Leonberg @ 2022-07-27 19:27 UTC (permalink / raw)
  To: u-boot; +Cc: Greg Leonberg

The pruss1_clkctrl and pruss2_clkctrl registers need to be added to the 
prcm register structure in order to allow the pruss driver to enable the 
clock for each of them during the pruss probe function calls for am57xx

Signed-off-by: Greg Leonberg <greg.leonberg@sunhillo.com>
---
 arch/arm/include/asm/omap_common.h    | 2 ++
 arch/arm/mach-omap2/omap5/prcm-regs.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 40c4411..bd17295 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -241,6 +241,8 @@ struct prcm_regs {
 	u32 cm_l4per_clkstctrl;
 	u32 cm_l4per_dynamicdep;
 	u32 cm_l4per_adc_clkctrl;
+	u32 cm_l4per2_pruss1_clkctrl;
+	u32 cm_l4per2_pruss2_clkctrl;
 	u32 cm_l4per_gptimer10_clkctrl;
 	u32 cm_l4per_gptimer11_clkctrl;
 	u32 cm_l4per_gptimer2_clkctrl;
diff --git a/arch/arm/mach-omap2/omap5/prcm-regs.c b/arch/arm/mach-omap2/omap5/prcm-regs.c
index 164b747..d6fa9ce 100644
--- a/arch/arm/mach-omap2/omap5/prcm-regs.c
+++ b/arch/arm/mach-omap2/omap5/prcm-regs.c
@@ -940,6 +940,8 @@ struct prcm_regs const dra7xx_prcm = {
 	/* cm2.l4per */
 	.cm_l4per_clkstctrl			= 0x4a009700,
 	.cm_l4per_dynamicdep			= 0x4a009708,
+	.cm_l4per2_pruss1_clkctrl       = 0x4a009718,
+	.cm_l4per2_pruss2_clkctrl       = 0x4a009720,
 	.cm_l4per_gptimer10_clkctrl		= 0x4a009728,
 	.cm_l4per_gptimer11_clkctrl		= 0x4a009730,
 	.cm_l4per_gptimer2_clkctrl		= 0x4a009738,
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH 02/10] arm: arch-am33xx: Add prm_per definition
  2022-07-27 19:27 [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Greg Leonberg
  2022-07-27 19:27 ` [U-Boot] [PATCH 01/10] arm: Add omap5 pruss1 and pruss2 to prcm structure Greg Leonberg
@ 2022-07-27 19:27 ` Greg Leonberg
  2022-07-27 19:27 ` [U-Boot] [PATCH 03/10] arm: arch-am33xx: Add pru_icss clkctrl Greg Leonberg
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Greg Leonberg @ 2022-07-27 19:27 UTC (permalink / raw)
  To: u-boot; +Cc: Greg Leonberg

The PRM_PER structure needs to be defined in order to allow the pruss
driver to bring the pru subsystem out of reset during the pruss
driver probe

Signed-off-by: Greg Leonberg <greg.leonberg@sunhillo.com>
---
 arch/arm/include/asm/arch-am33xx/cpu.h             | 7 +++++++
 arch/arm/include/asm/arch-am33xx/hardware_am33xx.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/arch/arm/include/asm/arch-am33xx/cpu.h b/arch/arm/include/asm/arch-am33xx/cpu.h
index 9b819b0..b713418 100644
--- a/arch/arm/include/asm/arch-am33xx/cpu.h
+++ b/arch/arm/include/asm/arch-am33xx/cpu.h
@@ -65,6 +65,7 @@
 					| BIT(3) | BIT(4))
 
 #define PRM_RSTCTRL_RESET		0x01
+#define PRM_PER_RSTCTRL_RESET		0x00000002
 #define PRM_RSTST_WARM_RESET_MASK	0x232
 
 /* EMIF Control register bits */
@@ -210,6 +211,12 @@ struct prm_device_inst {
 	unsigned int prm_rsttime;
 	unsigned int prm_rstst;
 };
+
+struct prm_per {
+	unsigned int prm_per_rstctrl;
+	unsigned int prm_per_pwrstst;
+	unsigned int prm_per_pwrstctrl;
+};
 #else
 /* Encapsulating core pll registers */
 struct cm_wkuppll {
diff --git a/arch/arm/include/asm/arch-am33xx/hardware_am33xx.h b/arch/arm/include/asm/arch-am33xx/hardware_am33xx.h
index 878ef3e..b8d2140 100644
--- a/arch/arm/include/asm/arch-am33xx/hardware_am33xx.h
+++ b/arch/arm/include/asm/arch-am33xx/hardware_am33xx.h
@@ -36,6 +36,7 @@
 #define CM_WKUP				0x44E00400
 #define CM_DPLL				0x44E00500
 #define CM_RTC				0x44E00800
+#define PRM_PER				0x44E00C00
 
 #define PRM_RSTCTRL			(PRCM_BASE + 0x0F00)
 #define PRM_RSTST			(PRM_RSTCTRL + 8)
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH 03/10] arm: arch-am33xx: Add pru_icss clkctrl
  2022-07-27 19:27 [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Greg Leonberg
  2022-07-27 19:27 ` [U-Boot] [PATCH 01/10] arm: Add omap5 pruss1 and pruss2 to prcm structure Greg Leonberg
  2022-07-27 19:27 ` [U-Boot] [PATCH 02/10] arm: arch-am33xx: Add prm_per definition Greg Leonberg
@ 2022-07-27 19:27 ` Greg Leonberg
  2022-07-27 19:27 ` [U-Boot] [PATCH 04/10] soc: ti: pruss: Add support for am33xx Greg Leonberg
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Greg Leonberg @ 2022-07-27 19:27 UTC (permalink / raw)
  To: u-boot; +Cc: Greg Leonberg

The pruicssclkctrl register needs to be added to the cm_perpll register
structure in order to allow the pruss driver to enable the clock for it
during the pruss probe function call on am33xx

This patch depends on patch 0002 of this patch series.

Signed-off-by: Greg Leonberg <greg.leonberg@sunhillo.com>
---
 arch/arm/include/asm/arch-am33xx/cpu.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/arch-am33xx/cpu.h b/arch/arm/include/asm/arch-am33xx/cpu.h
index b713418..0af680e 100644
--- a/arch/arm/include/asm/arch-am33xx/cpu.h
+++ b/arch/arm/include/asm/arch-am33xx/cpu.h
@@ -177,7 +177,8 @@ struct cm_perpll {
 	unsigned int epwmss2clkctrl;	/* offset 0xD8 */
 	unsigned int l3instrclkctrl;	/* offset 0xDC */
 	unsigned int l3clkctrl;		/* Offset 0xE0 */
-	unsigned int resv8[2];
+	unsigned int resv8[1];
+	unsigned int pruicssclkctrl;	/* offset 0xE8 */
 	unsigned int timer5clkctrl;	/* offset 0xEC */
 	unsigned int timer6clkctrl;	/* offset 0xF0 */
 	unsigned int mmc1clkctrl;	/* offset 0xF4 */
@@ -185,7 +186,8 @@ struct cm_perpll {
 	unsigned int resv9[8];
 	unsigned int l4hsclkstctrl;	/* offset 0x11C */
 	unsigned int l4hsclkctrl;	/* offset 0x120 */
-	unsigned int resv10[8];
+	unsigned int resv10[7];
+	unsigned int pruicssclkstctrl;	/* offset 0x140 */
 	unsigned int cpswclkstctrl;	/* offset 0x144 */
 	unsigned int lcdcclkstctrl;	/* offset 0x148 */
 };
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH 04/10] soc: ti: pruss: Add support for am33xx
  2022-07-27 19:27 [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Greg Leonberg
                   ` (2 preceding siblings ...)
  2022-07-27 19:27 ` [U-Boot] [PATCH 03/10] arm: arch-am33xx: Add pru_icss clkctrl Greg Leonberg
@ 2022-07-27 19:27 ` Greg Leonberg
  2022-07-27 19:27 ` [U-Boot] [PATCH 05/10] soc: ti: pruss: Add support for am57xx Greg Leonberg
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Greg Leonberg @ 2022-07-27 19:27 UTC (permalink / raw)
  To: u-boot; +Cc: Greg Leonberg

In order to support the am33xx pruss, the KConfig needed to have the
depends updated to support either ARCH_K3 or ARCH_OMAP2PLUS. The
Makefile needed to be tweaked because when building for am33xx, the
SPL will not fit into SRAM if the pruss driver is built into it.

Logic was added to the pruss driver to bring the pruss out of reset on
am33xx and enable the clock to it during the probe.

This patch depends on patch 0003 of this patch series.

Signed-off-by: Greg Leonberg <greg.leonberg@sunhillo.com>
---
 drivers/soc/ti/Kconfig  | 10 +++---
 drivers/soc/ti/Makefile |  6 ++++
 drivers/soc/ti/pruss.c  | 84 +++++++++++++++++++++++++++++++++++++++++++------
 3 files changed, 86 insertions(+), 14 deletions(-)

diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
index 46e2d14..f8d448b 100644
--- a/drivers/soc/ti/Kconfig
+++ b/drivers/soc/ti/Kconfig
@@ -32,16 +32,16 @@ config TI_KEYSTONE_SERDES
 	 K2 platforms.
 
 config TI_PRUSS
-	bool "Support for TI's K3 based Pruss driver"
+	bool "Support for TI's Pruss driver"
 	depends on DM
-	depends on ARCH_K3
+	depends on ARCH_K3 || ARCH_OMAP2PLUS
 	depends on OF_CONTROL
 	depends on SYSCON
 	help
 
-	  Support for TI PRU-ICSSG subsystem.
+	  Support for TI PRU-ICSS(G) subsystem.
 
-          Currently supported on AM65xx SoCs Say Y here to support the
-	  Programmable Realtime Unit (PRU).
+	  Currently supported on AM65xx and AM33xx SoCs
+	  Say Y here to support the Programmable Realtime Unit (PRU).
 
 endif # SOC_TI
diff --git a/drivers/soc/ti/Makefile b/drivers/soc/ti/Makefile
index 34f80aa..582c9ae 100644
--- a/drivers/soc/ti/Makefile
+++ b/drivers/soc/ti/Makefile
@@ -2,4 +2,10 @@
 
 obj-$(CONFIG_TI_K3_NAVSS_RINGACC)	+= k3-navss-ringacc.o
 obj-$(CONFIG_TI_KEYSTONE_SERDES)	+= keystone_serdes.o
+ifndef CONFIG_AM33XX
 obj-$(CONFIG_TI_PRUSS)	+= pruss.o
+else
+ifndef CONFIG_SPL_BUILD
+obj-$(CONFIG_TI_PRUSS)	+= pruss.o
+endif
+endif
\ No newline at end of file
diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index cbd659a..f02efea 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <dm/device.h>
 #include <dm/of_access.h>
 #include <errno.h>
 #include <clk.h>
@@ -17,10 +18,19 @@
 #include <asm/io.h>
 #include <power-domain.h>
 #include <ti-pruss.h>
+#ifdef CONFIG_AM33XX
+#include <asm/omap_common.h>
+#include <asm/arch-am33xx/clock.h>
+#include <asm/arch-am33xx/hardware_am33xx.h>
+#include <asm/arch-am33xx/cpu.h>
+#endif
 
 #define PRUSS_CFG_IEPCLK	0x30
 #define ICSSG_CFG_CORE_SYNC	0x3c
 
+#define SYSCFG_STANDBY_INIT	BIT(4)
+#define SYSCFG_SUB_MWAIT_READY	BIT(5)
+
 #define ICSSG_TASK_MGR_OFFSET	0x2a000
 
 /* PRUSS_IEPCLK register bits */
@@ -29,6 +39,14 @@
 /* ICSSG CORE_SYNC register bits */
 #define ICSSG_CORE_VBUSP_SYNC_EN		BIT(0)
 
+/**
+ * struct pruss_private_data - PRUSS driver private data
+ * @is_icssg: flag to indicate if icss is icss or icssg
+ */
+struct pruss_private_data {
+	bool is_icssg;
+};
+
 /*
  * pruss_request_tm_region() - Request pruss for task manager region
  * @dev:	corresponding k3 device
@@ -44,6 +62,9 @@ int pruss_request_tm_region(struct udevice *dev, phys_addr_t *loc)
 	if (!priv || !priv->mem_regions[PRUSS_MEM_DRAM0].pa)
 		return -EINVAL;
 
+	if (!device_is_compatible(dev, "ti,am654-icssg"))
+		return -1;
+
 	*loc = priv->mem_regions[PRUSS_MEM_DRAM0].pa + ICSSG_TASK_MGR_OFFSET;
 
 	return 0;
@@ -64,7 +85,7 @@ int pruss_request_tm_region(struct udevice *dev, phys_addr_t *loc)
  * error otherwise
  */
 int pruss_request_mem_region(struct udevice *dev, enum pruss_mem mem_id,
-			     struct pruss_mem_region *region)
+				struct pruss_mem_region *region)
 {
 	struct pruss *pruss;
 
@@ -96,7 +117,7 @@ int pruss_request_mem_region(struct udevice *dev, enum pruss_mem mem_id,
  * Returns 0 on success, an error code otherwise
  */
 int pruss_release_mem_region(struct udevice *dev,
-			     struct pruss_mem_region *region)
+				struct pruss_mem_region *region)
 {
 	int id;
 	struct pruss *pruss;
@@ -131,7 +152,7 @@ int pruss_release_mem_region(struct udevice *dev,
  * Returns 0 on success, or an error code otherwise
  */
 int pruss_cfg_update(struct udevice *dev, unsigned int reg,
-		     unsigned int mask, unsigned int val)
+			unsigned int mask, unsigned int val)
 {
 	struct pruss *pruss;
 
@@ -156,6 +177,16 @@ static int pruss_probe(struct udevice *dev)
 	struct udevice *syscon;
 	const char *mem_names[PRUSS_MEM_MAX] = { "dram0", "dram1", "shrdram2" };
 	int i;
+	const struct pruss_private_data *data;
+#ifdef CONFIG_AM33XX
+	struct prm_per *prmper;
+#endif
+
+	data = (const struct pruss_private_data *)dev_get_driver_data(dev);
+	if (IS_ERR(data)) {
+		dev_err(dev, "missing private data\n");
+		return -ENODEV;
+	}
 
 	priv = dev_get_priv(dev);
 	node = dev_ofnode(dev);
@@ -163,14 +194,16 @@ static int pruss_probe(struct udevice *dev)
 	memories = ofnode_find_subnode(node, "memories");
 
 	for (i = 0; i < ARRAY_SIZE(mem_names); i++) {
-		idx = ofnode_stringlist_search(memories, "reg-names", mem_names[i]);
-		priv->mem_regions[i].pa = ofnode_get_addr_size_index(memories, idx,
-						       (u64 *)&priv->mem_regions[i].size);
+		idx = ofnode_stringlist_search(memories, "reg-names",
+					       mem_names[i]);
+		priv->mem_regions[i].pa = ofnode_get_addr_size_index(memories,
+								     idx,
+				(fdt_size_t *)(&priv->mem_regions[i].size));
 	}
 
 	sub_node = ofnode_find_subnode(node, "cfg");
 	ret = uclass_get_device_by_ofnode(UCLASS_SYSCON, sub_node,
-					  &syscon);
+						&syscon);
 
 	priv->cfg = syscon_get_regmap(syscon);
 	if (IS_ERR(priv->cfg)) {
@@ -179,6 +212,27 @@ static int pruss_probe(struct udevice *dev)
 		return -ENODEV;
 	}
 
+#ifdef CONFIG_AM33XX
+	prmper = (struct prm_per *)PRM_PER;
+	writel(readl(&prmper->prm_per_rstctrl) | PRM_PER_RSTCTRL_RESET,
+	       &prmper->prm_per_rstctrl);
+	writel(readl(&prmper->prm_per_rstctrl) & ~PRM_PER_RSTCTRL_RESET,
+	       &prmper->prm_per_rstctrl);
+#endif
+
+	if (!data->is_icssg) {
+		u32 *const clk_domains[] = { 0 };
+		u32 *const clk_modules_specific_am33xx[] = {
+		#ifdef CONFIG_AM33XX
+			&(((struct cm_perpll *)CM_PER)->pruicssclkctrl),
+		#endif
+			0
+		};
+
+		do_enable_clocks(clk_domains, clk_modules_specific_am33xx, 1);
+		goto skip_coreclk_mux;
+	}
+
 	/*
 	 * The CORE block uses two multiplexers to allow software to
 	 * select one of three source clocks (ICSSGn_CORE_CLK, ICSSGn_ICLK or
@@ -192,19 +246,31 @@ static int pruss_probe(struct udevice *dev)
 				 ICSSG_CORE_VBUSP_SYNC_EN);
 	if (ret)
 		return ret;
+
 	ret = regmap_update_bits(priv->cfg, PRUSS_CFG_IEPCLK,
 				 PRUSS_IEPCLK_IEP_OCP_CLK_EN,
 				 PRUSS_IEPCLK_IEP_OCP_CLK_EN);
 	if (ret)
 		return ret;
 
+skip_coreclk_mux:
 	dev_dbg(dev, "pruss successfully probed %s\n", dev->name);
-
 	return 0;
 }
 
+static const struct pruss_private_data am33xx_priv_data = {
+	.is_icssg = false
+};
+
+static const struct pruss_private_data k2g_am65x_j7_priv_data = {
+	.is_icssg = true
+};
+
 static const struct udevice_id pruss_ids[] = {
-	{ .compatible = "ti,am654-icssg"},
+	{	.compatible = "ti,am654-icssg",
+		.data = (unsigned long)&k2g_am65x_j7_priv_data},
+	{	.compatible = "ti,am3356-pruss",
+		.data = (unsigned long)&am33xx_priv_data},
 	{}
 };
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH 05/10] soc: ti: pruss: Add support for am57xx
  2022-07-27 19:27 [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Greg Leonberg
                   ` (3 preceding siblings ...)
  2022-07-27 19:27 ` [U-Boot] [PATCH 04/10] soc: ti: pruss: Add support for am33xx Greg Leonberg
@ 2022-07-27 19:27 ` Greg Leonberg
  2022-07-27 19:27 ` [U-Boot] [PATCH 06/10] remoteproc: pru_rproc: Add support for am33xx Greg Leonberg
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Greg Leonberg @ 2022-07-27 19:27 UTC (permalink / raw)
  To: u-boot; +Cc: Greg Leonberg

The KConfig file was updated to indicate support for am57xx SoCs.

Logic was added to the pruss driver to enable the clock for am57xx pruss
during the driver probe function. 

This patch depends on patches 0001 and 0004 of this patch series.

Signed-off-by: Greg Leonberg <greg.leonberg@sunhillo.com>
---
 drivers/soc/ti/Kconfig |  2 +-
 drivers/soc/ti/pruss.c | 26 ++++++++++++++++++++++----
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/soc/ti/Kconfig b/drivers/soc/ti/Kconfig
index f8d448b..359b346 100644
--- a/drivers/soc/ti/Kconfig
+++ b/drivers/soc/ti/Kconfig
@@ -41,7 +41,7 @@ config TI_PRUSS
 
 	  Support for TI PRU-ICSS(G) subsystem.
 
-	  Currently supported on AM65xx and AM33xx SoCs
+	  Currently supported on AM65xx, AM57xx, and AM33xx SoCs
 	  Say Y here to support the Programmable Realtime Unit (PRU).
 
 endif # SOC_TI
diff --git a/drivers/soc/ti/pruss.c b/drivers/soc/ti/pruss.c
index f02efea..9c5c67a 100644
--- a/drivers/soc/ti/pruss.c
+++ b/drivers/soc/ti/pruss.c
@@ -18,8 +18,10 @@
 #include <asm/io.h>
 #include <power-domain.h>
 #include <ti-pruss.h>
-#ifdef CONFIG_AM33XX
+#if defined(CONFIG_AM33XX) || defined(CONFIG_OMAP54XX)
 #include <asm/omap_common.h>
+#endif
+#ifdef CONFIG_AM33XX
 #include <asm/arch-am33xx/clock.h>
 #include <asm/arch-am33xx/hardware_am33xx.h>
 #include <asm/arch-am33xx/cpu.h>
@@ -222,14 +224,28 @@ static int pruss_probe(struct udevice *dev)
 
 	if (!data->is_icssg) {
 		u32 *const clk_domains[] = { 0 };
-		u32 *const clk_modules_specific_am33xx[] = {
+		__maybe_unused u32 const clk_modules_hw_auto[] = { 0 };
+		__maybe_unused u32 *const clk_modules_specific_am33xx[] = {
 		#ifdef CONFIG_AM33XX
 			&(((struct cm_perpll *)CM_PER)->pruicssclkctrl),
 		#endif
 			0
 		};
+		__maybe_unused u32 const clk_modules_specific[] = {
+		#ifdef CONFIG_OMAP54XX
+			(*prcm)->cm_l4per2_pruss1_clkctrl,
+			(*prcm)->cm_l4per2_pruss2_clkctrl,
+		#endif
+			0
+		};
 
+	#ifdef CONFIG_AM33XX
 		do_enable_clocks(clk_domains, clk_modules_specific_am33xx, 1);
+	#else
+		do_enable_clocks((u32 const *)clk_domains,
+				 clk_modules_hw_auto,
+				 clk_modules_specific, 1);
+	#endif
 		goto skip_coreclk_mux;
 	}
 
@@ -258,7 +274,7 @@ skip_coreclk_mux:
 	return 0;
 }
 
-static const struct pruss_private_data am33xx_priv_data = {
+static const struct pruss_private_data am33xx_am57xx_priv_data = {
 	.is_icssg = false
 };
 
@@ -270,7 +286,9 @@ static const struct udevice_id pruss_ids[] = {
 	{	.compatible = "ti,am654-icssg",
 		.data = (unsigned long)&k2g_am65x_j7_priv_data},
 	{	.compatible = "ti,am3356-pruss",
-		.data = (unsigned long)&am33xx_priv_data},
+		.data = (unsigned long)&am33xx_am57xx_priv_data},
+	{	.compatible = "ti,am5728-pruss",
+		.data = (unsigned long)&am33xx_am57xx_priv_data},
 	{}
 };
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH 06/10] remoteproc: pru_rproc: Add support for am33xx
  2022-07-27 19:27 [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Greg Leonberg
                   ` (4 preceding siblings ...)
  2022-07-27 19:27 ` [U-Boot] [PATCH 05/10] soc: ti: pruss: Add support for am57xx Greg Leonberg
@ 2022-07-27 19:27 ` Greg Leonberg
  2022-07-27 19:27 ` [U-Boot] [PATCH 07/10] remoteproc: pru_rproc: Add support for am57xx Greg Leonberg
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Greg Leonberg @ 2022-07-27 19:27 UTC (permalink / raw)
  To: u-boot; +Cc: Greg Leonberg

In order to support the am33xx pru_rproc, the KConfig needed to have the
depends updated to support either ARCH_K3 or ARCH_OMAP2PLUS. The Makefile
needed to be tweaked because when building for am33xx, the SPL will not fit
into SRAM if the pru_rproc driver is built into it.

The pru_rproc struct udevice_id was modified in line with how it is in the
Linux kernel driver to add support for other devices via checking the .data
structure contents during the probe for flags and platform-specific data.
Additionally, the memory address reading from the DT "reg" property was
modified to use the "reg-names" property similar to how it is done in the
Linux kernel driver.

Signed-off-by: Greg Leonberg <greg.leonberg@sunhillo.com>
---
 drivers/remoteproc/Kconfig     |   6 +-
 drivers/remoteproc/Makefile    |   6 ++
 drivers/remoteproc/pru_rproc.c | 173 +++++++++++++++++++++++++++++------------
 3 files changed, 132 insertions(+), 53 deletions(-)

diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
index d9aa17a..beb42bf 100644
--- a/drivers/remoteproc/Kconfig
+++ b/drivers/remoteproc/Kconfig
@@ -83,14 +83,14 @@ config REMOTEPROC_TI_POWER
 	  found on certain TI keystone and OMAP generation SoCs.
 
 config REMOTEPROC_TI_PRU
-	bool "Support for TI's K3 based PRU remoteproc driver"
+	bool "Support for TI's PRU remoteproc driver"
 	select REMOTEPROC
 	depends on DM
 	depends on TI_PRUSS
-	depends on ARCH_K3
+	depends on ARCH_K3 || ARCH_OMAP2PLUS
 	depends on OF_CONTROL
 	help
-	  Say 'y' here to add support for TI' K3 remoteproc driver.
+	  Say 'y' here to add support for TI pru remoteproc driver.
 
 config REMOTEPROC_TI_IPU
 	bool "Support for TI's K3 based IPU remoteproc driver"
diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
index fbe9c17..0639acc 100644
--- a/drivers/remoteproc/Makefile
+++ b/drivers/remoteproc/Makefile
@@ -14,5 +14,11 @@ obj-$(CONFIG_REMOTEPROC_TI_K3_ARM64) += ti_k3_arm64_rproc.o
 obj-$(CONFIG_REMOTEPROC_TI_K3_DSP) += ti_k3_dsp_rproc.o
 obj-$(CONFIG_REMOTEPROC_TI_K3_R5F) += ti_k3_r5f_rproc.o
 obj-$(CONFIG_REMOTEPROC_TI_POWER) += ti_power_proc.o
+ifndef CONFIG_AM33XX
 obj-$(CONFIG_REMOTEPROC_TI_PRU) += pru_rproc.o
+else
+ifndef CONFIG_SPL_BUILD
+obj-$(CONFIG_REMOTEPROC_TI_PRU) += pru_rproc.o
+endif
+endif
 obj-$(CONFIG_REMOTEPROC_TI_IPU) += ipu_rproc.o
diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c
index 657d8e3..296a9c9 100644
--- a/drivers/remoteproc/pru_rproc.c
+++ b/drivers/remoteproc/pru_rproc.c
@@ -44,23 +44,60 @@
 #define RPROC_FLAGS_ELF_PHDR	BIT(0 + RPROC_FLAGS_SHIFT)
 #define RPROC_FLAGS_ELF_SHDR	BIT(1 + RPROC_FLAGS_SHIFT)
 
+/* PRU/RTU Core IRAM address masks */
+#define PRU0_IRAM_ADDR_MASK	0x34000
+#define PRU1_IRAM_ADDR_MASK	0x38000
+#define RTU0_IRAM_ADDR_MASK	0x4000
+#define RTU1_IRAM_ADDR_MASK	0x6000
+#define TX_PRU0_IRAM_ADDR_MASK	0xa000
+#define TX_PRU1_IRAM_ADDR_MASK	0xc000
+
 /**
- * enum pru_mem - PRU core memory range identifiers
+ * enum pru_iomem - PRU core memory range identifiers
  */
-enum pru_mem {
+enum pru_iomem {
 	PRU_MEM_IRAM = 0,
 	PRU_MEM_CTRL,
 	PRU_MEM_DEBUG,
 	PRU_MEM_MAX,
 };
 
-struct pru_privdata {
-	phys_addr_t pru_iram;
-	phys_addr_t pru_ctrl;
-	phys_addr_t pru_debug;
-	fdt_size_t pru_iramsz;
-	fdt_size_t pru_ctrlsz;
-	fdt_size_t pru_debugsz;
+/**
+ * enum pru_type - PRU core type identifier
+ */
+enum pru_type {
+	PRU_TYPE_PRU = 0,
+	PRU_TYPE_RTU,
+	PRU_TYPE_TX_PRU,
+	PRU_TYPE_MAX,
+};
+
+/**
+ * struct pru_private_data - device data for a PRU core
+ * @mask1: address mask1 used to identify PRU core id
+ * @mask2: address mask2 used to identify PRU core id
+ * @type: type of the PRU core (PRU, RTU, Tx_PRU)
+ * @is_k3: flag used to identify the need for special load & event handling
+ */
+struct pru_private_data {
+	u32 mask1;
+	u32 mask2;
+	enum pru_type type;
+	unsigned int is_k3 : 1;
+};
+
+/**
+ * struct pru_mem_region - PRU memory region structure
+ * @pa: physical (bus) address of the PRU memory region
+ * @size: size of the PRU memory region
+ */
+struct pru_mem_region {
+	phys_addr_t pa;
+	fdt_size_t size;
+};
+
+struct pru {
+	struct pru_mem_region mem_regions[3];
 	const char *fw_name;
 	u32 iram_da;
 	u32 pdram_da;
@@ -69,21 +106,22 @@ struct pru_privdata {
 	u32 bootaddr;
 	int id;
 	struct pruss *prusspriv;
+	const struct pru_private_data *data;
 };
 
-static inline u32 pru_control_read_reg(struct pru_privdata *pru, unsigned int reg)
+static inline u32 pru_control_read_reg(struct pru *pru, unsigned int reg)
 {
-	return readl(pru->pru_ctrl + reg);
+	return readl(pru->mem_regions[PRU_MEM_CTRL].pa + reg);
 }
 
 static inline
-void pru_control_write_reg(struct pru_privdata *pru, unsigned int reg, u32 val)
+void pru_control_write_reg(struct pru *pru, unsigned int reg, u32 val)
 {
-	writel(val, pru->pru_ctrl + reg);
+	writel(val, pru->mem_regions[PRU_MEM_CTRL].pa + reg);
 }
 
 static inline
-void pru_control_set_reg(struct pru_privdata *pru, unsigned int reg,
+void pru_control_set_reg(struct pru *pru, unsigned int reg,
 			 u32 mask, u32 set)
 {
 	u32 val;
@@ -100,7 +138,7 @@ void pru_control_set_reg(struct pru_privdata *pru, unsigned int reg,
  * @c: constant table index to set
  * @addr: physical address to set it to
  */
-static int pru_rproc_set_ctable(struct pru_privdata *pru, enum pru_ctable_idx c, u32 addr)
+static int pru_rproc_set_ctable(struct pru *pru, enum pru_ctable_idx c, u32 addr)
 {
 	unsigned int reg;
 	u32 mask, set;
@@ -131,7 +169,7 @@ static int pru_rproc_set_ctable(struct pru_privdata *pru, enum pru_ctable_idx c,
  */
 static int pru_start(struct udevice *dev)
 {
-	struct pru_privdata *priv;
+	struct pru *priv;
 	int val = 0;
 
 	priv = dev_get_priv(dev);
@@ -139,7 +177,7 @@ static int pru_start(struct udevice *dev)
 	pru_rproc_set_ctable(priv, PRU_C28, 0x100 << 8);
 
 	val = CTRL_CTRL_EN | ((priv->bootaddr >> 2) << 16);
-	writel(val, priv->pru_ctrl + PRU_CTRL_CTRL);
+	writel(val, priv->mem_regions[PRU_MEM_CTRL].pa + PRU_CTRL_CTRL);
 
 	return 0;
 }
@@ -152,14 +190,14 @@ static int pru_start(struct udevice *dev)
  */
 static int pru_stop(struct udevice *dev)
 {
-	struct pru_privdata *priv;
+	struct pru *priv;
 	int val = 0;
 
 	priv = dev_get_priv(dev);
 
-	val = readl(priv->pru_ctrl + PRU_CTRL_CTRL);
+	val = readl(priv->mem_regions[PRU_MEM_CTRL].pa + PRU_CTRL_CTRL);
 	val &= ~CTRL_CTRL_EN;
-	writel(val, priv->pru_ctrl + PRU_CTRL_CTRL);
+	writel(val, priv->mem_regions[PRU_MEM_CTRL].pa + PRU_CTRL_CTRL);
 
 	return 0;
 }
@@ -184,7 +222,7 @@ static int pru_init(struct udevice *dev)
  * kernel virtual address. Data RAM0 is primary Data RAM for PRU0 and Data
  * RAM1 is primary Data RAM for PRU1.
  */
-static void *pru_d_da_to_pa(struct pru_privdata *priv, u32 da, int len)
+static void *pru_d_da_to_pa(struct pru *priv, u32 da, int len)
 {
 	u32 offset;
 	void *pa = NULL;
@@ -233,7 +271,7 @@ static void *pru_d_da_to_pa(struct pru_privdata *priv, u32 da, int len)
  * private Instruction RAM, and its device address is identical to that of
  * its primary Data RAM device address.
  */
-static void *pru_i_da_to_pa(struct pru_privdata *priv, u32 da, int len)
+static void *pru_i_da_to_pa(struct pru *priv, u32 da, int len)
 {
 	u32 offset;
 	void *pa = NULL;
@@ -242,16 +280,17 @@ static void *pru_i_da_to_pa(struct pru_privdata *priv, u32 da, int len)
 		return NULL;
 
 	if (da >= priv->iram_da &&
-	    da + len <= priv->iram_da + priv->pru_iramsz) {
+	    da + len <= priv->iram_da + priv->mem_regions[PRU_MEM_IRAM].size) {
 		offset = da - priv->iram_da;
-		pa = (__force void *)(priv->pru_iram + offset);
+		pa = (__force void *)(priv->mem_regions[PRU_MEM_IRAM].pa +
+				      offset);
 	}
 
 	return pa;
 }
 
 /* PRU-specific address translator */
-static void *pru_da_to_pa(struct pru_privdata *priv, u64 da, int len, u32 flags)
+static void *pru_da_to_pa(struct pru *priv, u64 da, int len, u32 flags)
 {
 	void *pa;
 	u32 exec_flag;
@@ -322,7 +361,7 @@ static int pru_rproc_memcpy(void *dest, void *src, size_t count)
  */
 static int pru_load(struct udevice *dev, ulong addr, ulong size)
 {
-	struct pru_privdata *priv;
+	struct pru *priv;
 	Elf32_Ehdr *ehdr;
 	Elf32_Phdr *phdr;
 	int i, ret = 0;
@@ -355,7 +394,7 @@ static int pru_load(struct udevice *dev, ulong addr, ulong size)
 
 		if (offset + filesz > size) {
 			dev_dbg(dev, "truncated fw: need 0x%x avail 0x%zx\n",
-				offset + filesz, size);
+				offset + filesz, (size_t)size);
 			ret = -EINVAL;
 			break;
 		}
@@ -374,7 +413,7 @@ static int pru_load(struct udevice *dev, ulong addr, ulong size)
 			continue;
 
 		ret = pru_rproc_memcpy(ptr,
-				       (void *)addr + phdr->p_offset, filesz);
+					(void *)addr + phdr->p_offset, filesz);
 		if (ret) {
 			dev_dbg(dev, "PRU custom memory copy failed for da 0x%x memsz 0x%x\n",
 				da, memsz);
@@ -394,17 +433,10 @@ static const struct dm_rproc_ops pru_ops = {
 	.load = pru_load,
 };
 
-static void pru_set_id(struct pru_privdata *priv, struct udevice *dev)
+static void pru_set_id(struct pru *priv, struct udevice *dev)
 {
-	u32 mask2 = 0x38000;
-
-	if (device_is_compatible(dev, "ti,am654-rtu"))
-		mask2 = 0x6000;
-
-	if (device_is_compatible(dev, "ti,am654-tx-pru"))
-		mask2 = 0xc000;
-
-	if ((priv->pru_iram & mask2) == mask2)
+	if ((priv->mem_regions[PRU_MEM_IRAM].pa & priv->data->mask2) ==
+	     priv->data->mask2)
 		priv->id = 1;
 	else
 		priv->id = 0;
@@ -418,21 +450,23 @@ static void pru_set_id(struct pru_privdata *priv, struct udevice *dev)
  */
 static int pru_probe(struct udevice *dev)
 {
-	struct pru_privdata *priv;
-	int lenp;
+	struct pru *priv;
+	int lenp, i, idx;
 	ofnode node;
+	const struct pru_private_data *data;
+	const char *mem_names[PRU_MEM_MAX] = { "iram", "control", "debug" };
 
 	node = dev_ofnode(dev);
 
 	priv = dev_get_priv(dev);
 	priv->prusspriv = dev_get_priv(dev->parent);
 
-	priv->pru_iram = devfdt_get_addr_size_index(dev, PRU_MEM_IRAM,
-						    &priv->pru_iramsz);
-	priv->pru_ctrl = devfdt_get_addr_size_index(dev, PRU_MEM_CTRL,
-						    &priv->pru_ctrlsz);
-	priv->pru_debug = devfdt_get_addr_size_index(dev, PRU_MEM_DEBUG,
-						     &priv->pru_debugsz);
+	for (i = 0; i < ARRAY_SIZE(mem_names); i++) {
+		idx = ofnode_stringlist_search(node, "reg-names", mem_names[i]);
+		priv->mem_regions[i].pa = ofnode_get_addr_size_index(node, idx,
+						    &priv->mem_regions[i].size);
+	}
+
 
 	priv->fw_name = ofnode_get_property(node, "firmware-name", &lenp);
 
@@ -441,15 +475,54 @@ static int pru_probe(struct udevice *dev)
 	priv->sdram_da = 0x2000;
 	priv->shrdram_da = 0x10000;
 
+	data = (const struct pru_private_data *)dev_get_driver_data(dev);
+	if (!data) {
+		dev_err(dev, "Non-DT platform devices not supported\n");
+		return -ENODEV;
+	}
+	priv->data = data;
+
 	pru_set_id(priv, dev);
 
 	return 0;
 }
 
+static const struct pru_private_data pru_data = {
+	.mask1 = PRU0_IRAM_ADDR_MASK,
+	.mask2 = PRU1_IRAM_ADDR_MASK,
+	.type = PRU_TYPE_PRU,
+};
+
+static const struct pru_private_data k3_pru_data = {
+	.mask1 = PRU0_IRAM_ADDR_MASK,
+	.mask2 = PRU1_IRAM_ADDR_MASK,
+	.type = PRU_TYPE_PRU,
+	.is_k3 = 1,
+};
+
+static const struct pru_private_data k3_rtu_data = {
+	.mask1 = RTU0_IRAM_ADDR_MASK,
+	.mask2 = RTU1_IRAM_ADDR_MASK,
+	.type = PRU_TYPE_RTU,
+	.is_k3 = 1,
+};
+
+static const struct pru_private_data k3_tx_pru_data = {
+	.mask1 = TX_PRU0_IRAM_ADDR_MASK,
+	.mask2 = TX_PRU1_IRAM_ADDR_MASK,
+	.type = PRU_TYPE_TX_PRU,
+	.is_k3 = 1,
+};
+
 static const struct udevice_id pru_ids[] = {
-	{ .compatible = "ti,am654-pru"},
-	{ .compatible = "ti,am654-rtu"},
-	{ .compatible = "ti,am654-tx-pru" },
+	{	.compatible = "ti,am654-pru",
+		.data = (unsigned long)&k3_pru_data, },
+	{	.compatible = "ti,am654-rtu",
+		.data = (unsigned long)&k3_rtu_data, },
+	{	.compatible = "ti,am654-tx-pru",
+		.data = (unsigned long)&k3_tx_pru_data, },
+	{	.compatible = "ti,am3356-pru",
+		.data = (unsigned long)&pru_data, },
 	{}
 };
 
@@ -459,5 +532,5 @@ U_BOOT_DRIVER(pru) = {
 	.id = UCLASS_REMOTEPROC,
 	.ops = &pru_ops,
 	.probe = pru_probe,
-	.priv_auto_alloc_size = sizeof(struct pru_privdata),
+	.priv_auto_alloc_size = sizeof(struct pru),
 };
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH 07/10] remoteproc: pru_rproc: Add support for am57xx
  2022-07-27 19:27 [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Greg Leonberg
                   ` (5 preceding siblings ...)
  2022-07-27 19:27 ` [U-Boot] [PATCH 06/10] remoteproc: pru_rproc: Add support for am33xx Greg Leonberg
@ 2022-07-27 19:27 ` Greg Leonberg
  2022-07-27 19:27 ` [U-Boot] [PATCH 08/10] remoteproc: pru_rproc: Add is_running support Greg Leonberg
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Greg Leonberg @ 2022-07-27 19:27 UTC (permalink / raw)
  To: u-boot; +Cc: Greg Leonberg

The am57xx pru uses the same logic as the am33xx so it just needed to have
the struct udevice_id updated.

This patch depends on patch 0006 of this patch series.

Signed-off-by: Greg Leonberg <greg.leonberg@sunhillo.com>
---
 drivers/remoteproc/pru_rproc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c
index 296a9c9..d9b6cc2 100644
--- a/drivers/remoteproc/pru_rproc.c
+++ b/drivers/remoteproc/pru_rproc.c
@@ -523,6 +523,8 @@ static const struct udevice_id pru_ids[] = {
 		.data = (unsigned long)&k3_tx_pru_data, },
 	{	.compatible = "ti,am3356-pru",
 		.data = (unsigned long)&pru_data, },
+	{	.compatible = "ti,am5728-pru",
+		.data = (unsigned long)&pru_data, },
 	{}
 };
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH 08/10] remoteproc: pru_rproc: Add is_running support
  2022-07-27 19:27 [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Greg Leonberg
                   ` (6 preceding siblings ...)
  2022-07-27 19:27 ` [U-Boot] [PATCH 07/10] remoteproc: pru_rproc: Add support for am57xx Greg Leonberg
@ 2022-07-27 19:27 ` Greg Leonberg
  2022-07-27 19:27 ` [U-Boot] [PATCH 09/10] arm: dts: am33xx: Add pruss and pru Greg Leonberg
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Greg Leonberg @ 2022-07-27 19:27 UTC (permalink / raw)
  To: u-boot; +Cc: Greg Leonberg

An integer flag in the private data structure for the udev was added to
indicate run-state. A function was also added to return that flag in order
for the driver to support the is_running driver function.

This patch depends on patch 0007 of this patch series.

Signed-off-by: Greg Leonberg <greg.leonberg@sunhillo.com>
---
 drivers/remoteproc/pru_rproc.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c
index d9b6cc2..94cdbf7 100644
--- a/drivers/remoteproc/pru_rproc.c
+++ b/drivers/remoteproc/pru_rproc.c
@@ -107,6 +107,7 @@ struct pru {
 	int id;
 	struct pruss *prusspriv;
 	const struct pru_private_data *data;
+	int isRunning;
 };
 
 static inline u32 pru_control_read_reg(struct pru *pru, unsigned int reg)
@@ -162,6 +163,23 @@ static int pru_rproc_set_ctable(struct pru *pru, enum pru_ctable_idx c, u32 addr
 }
 
 /**
+ * pru_is_running() - check if the pru is running
+ * @dev:	corresponding remote processor device
+ *
+ * Return: 0 if the pru is running, else 1.
+ */
+static int pru_is_running(struct udevice *dev)
+{
+	struct pru *priv;
+
+	priv = dev_get_priv(dev);
+	if (!priv)
+		return 0;
+
+	return priv->isRunning;
+}
+
+/**
  * pru_start() - start the pru processor
  * @dev:	corresponding k3 remote processor device
  *
@@ -179,6 +197,8 @@ static int pru_start(struct udevice *dev)
 	val = CTRL_CTRL_EN | ((priv->bootaddr >> 2) << 16);
 	writel(val, priv->mem_regions[PRU_MEM_CTRL].pa + PRU_CTRL_CTRL);
 
+	priv->isRunning = 0;
+
 	return 0;
 }
 
@@ -199,6 +219,8 @@ static int pru_stop(struct udevice *dev)
 	val &= ~CTRL_CTRL_EN;
 	writel(val, priv->mem_regions[PRU_MEM_CTRL].pa + PRU_CTRL_CTRL);
 
+	priv->isRunning = 1;
+
 	return 0;
 }
 
@@ -431,6 +453,7 @@ static const struct dm_rproc_ops pru_ops = {
 	.start = pru_start,
 	.stop = pru_stop,
 	.load = pru_load,
+	.is_running = pru_is_running,
 };
 
 static void pru_set_id(struct pru *priv, struct udevice *dev)
@@ -482,6 +505,8 @@ static int pru_probe(struct udevice *dev)
 	}
 	priv->data = data;
 
+	priv->isRunning = 1;
+
 	pru_set_id(priv, dev);
 
 	return 0;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH 09/10] arm: dts: am33xx: Add pruss and pru
  2022-07-27 19:27 [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Greg Leonberg
                   ` (7 preceding siblings ...)
  2022-07-27 19:27 ` [U-Boot] [PATCH 08/10] remoteproc: pru_rproc: Add is_running support Greg Leonberg
@ 2022-07-27 19:27 ` Greg Leonberg
  2022-07-27 19:27 ` [U-Boot] [PATCH 10/10] arm: dts: dra7: " Greg Leonberg
  2022-08-26 14:56 ` [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Tom Rini
  10 siblings, 0 replies; 12+ messages in thread
From: Greg Leonberg @ 2022-07-27 19:27 UTC (permalink / raw)
  To: u-boot; +Cc: Greg Leonberg

Added the pruss subsystem to the device tree based on the device tree info
from the Linux kernel.

Signed-off-by: Greg Leonberg <greg.leonberg@sunhillo.com>
---
 arch/arm/dts/am33xx.dtsi | 105 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 105 insertions(+)

diff --git a/arch/arm/dts/am33xx.dtsi b/arch/arm/dts/am33xx.dtsi
index d3dd6a1..e8d0047 100644
--- a/arch/arm/dts/am33xx.dtsi
+++ b/arch/arm/dts/am33xx.dtsi
@@ -401,6 +401,111 @@
 			status = "disabled";
 		};
 
+		pruss: pruss@4a300000 {
+			compatible = "ti,am3356-pruss";
+			reg = <0x0 0x80000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0x0 0x4a300000 0x80000>;
+			dma-ranges;
+
+			pruss_mem: memories@0 {
+				reg = <0x0 0x2000>,
+					<0x2000 0x2000>,
+					<0x10000 0x3000>;
+				reg-names = "dram0", "dram1",
+						"shrdram2";
+			};
+
+			pruss_cfg: cfg@26000 {
+				compatible = "syscon";
+				reg = <0x26000 0x2000>;
+			};
+
+			pruss_iepclk_mux: iepclk-mux {
+				#clock-cells = <0>;
+				clocks = <&l3_gclk>,
+					<&pruss_ocp_gclk>;
+			};
+
+			pruss_iep: iep@2e000 {
+				compatible = "ti,am3356-icss-iep";
+				reg = <0x2e000 0x31c>;
+				clocks = <&pruss_iepclk_mux>;
+			};
+
+			pruss_ecap: ecap@30000 {
+				compatible = "ti,pruss-ecap";
+				reg = <0x30000 0x60>;
+			};
+
+			pruss_uart: serial@28000 {
+				compatible = "ti,pruss-uart";
+				reg = <0x28000 0x38>;
+				clocks = <&dpll_per_m2_ck>;
+				interrupt-parent = <&pruss_intc>;
+				interrupts = <6>;
+				status = "disabled";
+			};
+
+			pruss_mii_rt: mii-rt@32000 {
+				compatible = "syscon";
+				reg = <0x32000 0x58>;
+			};
+
+			pruss_intc: interrupt-controller@20000 {
+				compatible = "ti,pruss-intc";
+				reg = <0x20000 0x2000>;
+				interrupts = <20 21 22 23 24 25 26 27>;
+				interrupt-names = "host_intr0", "host_intr1",
+						"host_intr2", "host_intr3",
+						"host_intr4", "host_intr5",
+						"host_intr6", "host_intr7";
+				interrupt-controller;
+				#interrupt-cells = <1>;
+				ti,irqs-shared = /bits/ 8 <0 6 7>;
+			};
+
+			pru0: pru@34000 {
+				compatible = "ti,am3356-pru";
+				#address-cells = <3>;
+				reg = <0x34000 0x2000>,
+					<0x22000 0x400>,
+					<0x22400 0x100>;
+				reg-names = "iram", "control", "debug";
+				firmware-name = "am335x-pru0-fw";
+				interrupt-parent = <&pruss_intc>;
+				interrupts = <16>, <17>;
+				interrupt-names = "vring", "kick";
+				remoteproc-name = "pru0";
+			};
+
+			pru1: pru@38000 {
+				compatible = "ti,am3356-pru";
+				#address-cells = <3>;
+				reg = <0x38000 0x2000>,
+					<0x24000 0x400>,
+					<0x24400 0x100>;
+				reg-names = "iram", "control", "debug";
+				firmware-name = "am335x-pru1-fw";
+				interrupt-parent = <&pruss_intc>;
+				interrupts = <18>, <19>;
+				interrupt-names = "vring", "kick";
+				remoteproc-name = "pru1";
+			};
+
+			pruss_mdio: mdio@32400 {
+				compatible = "ti,davinci_mdio";
+				reg = <0x32400 0x90>;
+				clocks = <&dpll_core_m4_ck>;
+				clock-names = "fck";
+				bus_freq = <1000000>;
+				#address-cells = <1>;
+				#size-cells = <0>;
+				status = "disabled";
+			};
+		};
+
 		i2c0: i2c@44e0b000 {
 			compatible = "ti,omap4-i2c";
 			#address-cells = <1>;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH 10/10] arm: dts: dra7: Add pruss and pru
  2022-07-27 19:27 [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Greg Leonberg
                   ` (8 preceding siblings ...)
  2022-07-27 19:27 ` [U-Boot] [PATCH 09/10] arm: dts: am33xx: Add pruss and pru Greg Leonberg
@ 2022-07-27 19:27 ` Greg Leonberg
  2022-08-26 14:56 ` [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Tom Rini
  10 siblings, 0 replies; 12+ messages in thread
From: Greg Leonberg @ 2022-07-27 19:27 UTC (permalink / raw)
  To: u-boot; +Cc: Greg Leonberg

Added the pruss subsystem to the device tree based on the device tree info
from the Linux kernel.

Signed-off-by: Greg Leonberg <greg.leonberg@sunhillo.com>
---
 arch/arm/dts/dra7.dtsi | 198 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 198 insertions(+)

diff --git a/arch/arm/dts/dra7.dtsi b/arch/arm/dts/dra7.dtsi
index e2e958b..5bcdb51 100644
--- a/arch/arm/dts/dra7.dtsi
+++ b/arch/arm/dts/dra7.dtsi
@@ -517,6 +517,204 @@
 			interrupt-names = "edma3_tcerrint";
 		};
 
+		pruss1: pruss@4b200000 {
+			compatible = "ti,am5728-pruss";
+			reg = <0x0 0x80000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0x0 0x4b200000 0x80000>;
+			dma-ranges;
+
+			pruss1_mem: memories@0 {
+				reg = <0x0 0x2000>,
+					<0x2000 0x2000>,
+					<0x10000 0x8000>;
+				reg-names = "dram0", "dram1",
+						"shrdram2";
+			};
+
+			pruss1_cfg: cfg@26000 {
+				compatible = "syscon";
+				reg = <0x26000 0x2000>;
+			};
+
+			pruss1_iepclk_mux: iepclk-mux {
+				#clock-cells = <0>;
+				clocks = <&dpll_gmac_m3x2_ck>,
+					<&dpll_gmac_h13x2_ck>;
+			};
+
+			pruss1_iep: iep@2e000 {
+				compatible = "ti,am5728-icss-iep";
+				reg = <0x2e000 0x31c>;
+				clocks = <&pruss1_iepclk_mux>;
+			};
+
+			pruss1_ecap: ecap@30000 {
+				compatible = "ti,pruss-ecap";
+				reg = <0x30000 0x60>;
+			};
+
+			pruss1_mii_rt: mii-rt@32000 {
+				compatible = "syscon";
+				reg = <0x32000 0x58>;
+			};
+
+			pruss1_intc: interrupt-controller@20000 {
+				compatible = "ti,pruss-intc";
+				reg = <0x20000 0x2000>;
+				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 = "host_intr0", "host_intr1",
+						"host_intr2", "host_intr3",
+						"host_intr4", "host_intr5",
+						"host_intr6", "host_intr7";
+				ti,irqs-shared = /bits/ 8 <6 7>;
+			};
+
+			pru1_0: pru1_0@34000 {
+				compatible = "ti,am5728-pru";
+				reg = <0x34000 0x3000>,
+					<0x22000 0x400>,
+					<0x22400 0x100>;
+				reg-names = "iram", "control", "debug";
+				firmware-name = "am57xx-pru1_0-fw";
+				interrupt-parent = <&pruss1_intc>;
+				interrupts = <16>, <17>;
+				interrupt-names = "vring", "kick";
+			};
+
+			pru1_1: pru1_1@38000 {
+				compatible = "ti,am5728-pru";
+				reg = <0x38000 0x3000>,
+					<0x24000 0x400>,
+					<0x24400 0x100>;
+				reg-names = "iram", "control", "debug";
+				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";
+				#address-cells = <1>;
+				#size-cells = <0>;
+				clocks = <&dpll_gmac_h13x2_ck>;
+				clock-names = "fck";
+				bus_freq = <1000000>;
+				reg = <0x32400 0x90>;
+				status = "disabled";
+			};
+		};
+
+		pruss2: pruss@4b280000 {
+			compatible = "ti,am5728-pruss";
+			reg = <0x0 0x80000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0x0 0x4b280000 0x80000>;
+			dma-ranges;
+
+			pruss2_mem: memories@0 {
+				reg = <0x0 0x2000>,
+					<0x2000 0x2000>,
+					<0x10000 0x8000>;
+				reg-names = "dram0", "dram1",
+						"shrdram2";
+			};
+
+			pruss2_cfg: cfg@26000 {
+				compatible = "syscon";
+				reg = <0x26000 0x2000>;
+			};
+
+			pruss2_iepclk_mux: iepclk-mux {
+				#clock-cells = <0>;
+				clocks = <&dpll_gmac_m3x2_ck>,
+					<&dpll_gmac_h13x2_ck>;
+			};
+
+			pruss2_iep: iep@2e000 {
+				compatible = "ti,am5728-icss-iep";
+				reg = <0x2e000 0x31c>;
+				clocks = <&pruss2_iepclk_mux>;
+			};
+
+			pruss2_ecap: ecap@30000 {
+				compatible = "ti,pruss-ecap";
+				reg = <0x30000 0x60>;
+			};
+
+			pruss2_mii_rt: mii-rt@32000 {
+				compatible = "syscon";
+				reg = <0x32000 0x58>;
+			};
+
+			pruss2_intc: interrupt-controller@20000 {
+				compatible = "ti,pruss-intc";
+				reg = <0x20000 0x2000>;
+				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 = "host_intr0", "host_intr1",
+						"host_intr2", "host_intr3",
+						"host_intr4", "host_intr5",
+						"host_intr6", "host_intr7";
+				ti,irqs-shared = /bits/ 8 <6 7>;
+			};
+
+			pru2_0: pru2_0@34000 {
+				compatible = "ti,am5728-pru";
+				reg = <0x34000 0x3000>,
+					<0x22000 0x400>,
+					<0x22400 0x100>;
+				reg-names = "iram", "control", "debug";
+				firmware-name = "am57xx-pru2_0-fw";
+				interrupt-parent = <&pruss2_intc>;
+				interrupts = <16>, <17>;
+				interrupt-names = "vring", "kick";
+			};
+
+			pru2_1: pru2_1@38000 {
+				compatible = "ti,am5728-pru";
+				reg = <0x38000 0x3000>,
+					<0x24000 0x400>,
+					<0x24400 0x100>;
+				reg-names = "iram", "control", "debug";
+				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";
+				#address-cells = <1>;
+				#size-cells = <0>;
+				clocks = <&dpll_gmac_h13x2_ck>;
+				clock-names = "fck";
+				bus_freq = <1000000>;
+				reg = <0x32400 0x90>;
+				status = "disabled";
+			};
+		};
+
 		gpio1: gpio@4ae10000 {
 			compatible = "ti,omap4-gpio";
 			reg = <0x4ae10000 0x200>;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx
  2022-07-27 19:27 [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Greg Leonberg
                   ` (9 preceding siblings ...)
  2022-07-27 19:27 ` [U-Boot] [PATCH 10/10] arm: dts: dra7: " Greg Leonberg
@ 2022-08-26 14:56 ` Tom Rini
  10 siblings, 0 replies; 12+ messages in thread
From: Tom Rini @ 2022-08-26 14:56 UTC (permalink / raw)
  To: Greg Leonberg; +Cc: u-boot

[-- Attachment #1: Type: text/plain, Size: 935 bytes --]

On Wed, Jul 27, 2022 at 03:27:47PM -0400, Greg Leonberg wrote:

> This series adds support for the pruss/pru_rproc drivers on am33xx and
> am57xx SoCs.
> 
> All PRU interfaces pru0 and pru1 are supported on am33xx.
> All PRU interfaces pru0, pru1, pru2, and pru3 are supported on am57xx.
> 
> Testing is done via the "rproc" U-Boot command.
> 
> This patch series is based on ti-u-boot-2020.01 branch on ti-u-boot
> repository located at: https://git.ti.com/cgit/ti-u-boot/ti-u-boot/
> and commit 2781231a33c3
> ("arm: mach-k3: j721e_init: probe clock node after sci node is probed")
> 
> From looking at the master branch of the main u-boot repository, there does
> not appear to be significant effort required to merge it into the master
> branch.

Please note that there is some effort required however, for upstream. If
you intend for this to be merged upstream, please rebase and resend,
thanks.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-08-26 14:56 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-27 19:27 [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Greg Leonberg
2022-07-27 19:27 ` [U-Boot] [PATCH 01/10] arm: Add omap5 pruss1 and pruss2 to prcm structure Greg Leonberg
2022-07-27 19:27 ` [U-Boot] [PATCH 02/10] arm: arch-am33xx: Add prm_per definition Greg Leonberg
2022-07-27 19:27 ` [U-Boot] [PATCH 03/10] arm: arch-am33xx: Add pru_icss clkctrl Greg Leonberg
2022-07-27 19:27 ` [U-Boot] [PATCH 04/10] soc: ti: pruss: Add support for am33xx Greg Leonberg
2022-07-27 19:27 ` [U-Boot] [PATCH 05/10] soc: ti: pruss: Add support for am57xx Greg Leonberg
2022-07-27 19:27 ` [U-Boot] [PATCH 06/10] remoteproc: pru_rproc: Add support for am33xx Greg Leonberg
2022-07-27 19:27 ` [U-Boot] [PATCH 07/10] remoteproc: pru_rproc: Add support for am57xx Greg Leonberg
2022-07-27 19:27 ` [U-Boot] [PATCH 08/10] remoteproc: pru_rproc: Add is_running support Greg Leonberg
2022-07-27 19:27 ` [U-Boot] [PATCH 09/10] arm: dts: am33xx: Add pruss and pru Greg Leonberg
2022-07-27 19:27 ` [U-Boot] [PATCH 10/10] arm: dts: dra7: " Greg Leonberg
2022-08-26 14:56 ` [U-Boot] [PATCH 00/10] Add pruss and pru support for am33xx and am57xx Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.