All of lore.kernel.org
 help / color / mirror / Atom feed
From: Fabien Dessenne <fabien.dessenne@st.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 6/6] remoteproc: stm32: load resource table from firmware
Date: Wed, 30 Oct 2019 14:38:33 +0100	[thread overview]
Message-ID: <1572442713-26353-7-git-send-email-fabien.dessenne@st.com> (raw)
In-Reply-To: <1572442713-26353-1-git-send-email-fabien.dessenne@st.com>

Load the optional resource table from the firmware, and write its
address in the dedicated backup register.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
---
 drivers/remoteproc/stm32_copro.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/remoteproc/stm32_copro.c b/drivers/remoteproc/stm32_copro.c
index dcafa54..c25488f 100644
--- a/drivers/remoteproc/stm32_copro.c
+++ b/drivers/remoteproc/stm32_copro.c
@@ -22,12 +22,14 @@
  * @hold_boot_regmap:	regmap for remote processor reset hold boot
  * @hold_boot_offset:	offset of the register controlling the hold boot setting
  * @hold_boot_mask:	bitmask of the register for the hold boot field
+ * @rsc_table_addr:	resource table address
  */
 struct stm32_copro_privdata {
 	struct reset_ctl reset_ctl;
 	struct regmap *hold_boot_regmap;
 	uint hold_boot_offset;
 	uint hold_boot_mask;
+	ulong rsc_table_addr;
 };
 
 /**
@@ -139,6 +141,7 @@ static void *stm32_copro_device_to_virt(struct udevice *dev, ulong da,
 static int stm32_copro_load(struct udevice *dev, ulong addr, ulong size)
 {
 	struct stm32_copro_privdata *priv;
+	ulong rsc_table_size;
 	int ret;
 
 	priv = dev_get_priv(dev);
@@ -153,6 +156,12 @@ static int stm32_copro_load(struct udevice *dev, ulong addr, ulong size)
 		return ret;
 	}
 
+	if (rproc_elf32_load_rsc_table(dev, addr, size, &priv->rsc_table_addr,
+				       &rsc_table_size)) {
+		priv->rsc_table_addr = 0;
+		dev_warn(dev, "No valid resource table for this firmware\n");
+	}
+
 	return rproc_elf32_load_image(dev, addr, size);
 }
 
@@ -163,8 +172,11 @@ static int stm32_copro_load(struct udevice *dev, ulong addr, ulong size)
  */
 static int stm32_copro_start(struct udevice *dev)
 {
+	struct stm32_copro_privdata *priv;
 	int ret;
 
+	priv = dev_get_priv(dev);
+
 	/* move hold boot from true to false start the copro */
 	ret = stm32_copro_set_hold_boot(dev, false);
 	if (ret)
@@ -177,6 +189,10 @@ static int stm32_copro_start(struct udevice *dev)
 	ret = stm32_copro_set_hold_boot(dev, true);
 	writel(ret ? TAMP_COPRO_STATE_OFF : TAMP_COPRO_STATE_CRUN,
 	       TAMP_COPRO_STATE);
+	if (!ret)
+		/* Store rsc_address in bkp register */
+		writel(priv->rsc_table_addr, TAMP_COPRO_RSC_TBL_ADDRESS);
+
 	return ret;
 }
 
-- 
2.7.4

  parent reply	other threads:[~2019-10-30 13:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30 13:38 [U-Boot] [PATCH v2 0/6] remoteproc: add elf resource table loader Fabien Dessenne
2019-10-30 13:38 ` [U-Boot] [PATCH v2 1/6] remoteproc: elf_loader: Add elf resource table load support Fabien Dessenne
2019-11-25 17:04   ` Patrick DELAUNAY
2019-11-26  3:14   ` Lokesh Vutla
2020-01-08 20:11   ` Tom Rini
2019-10-30 13:38 ` [U-Boot] [PATCH v2 2/6] stm32mp1: declare backup registers for coprocessor Fabien Dessenne
2019-11-25 16:54   ` Patrick DELAUNAY
2020-01-08 20:11   ` Tom Rini
2019-10-30 13:38 ` [U-Boot] [PATCH v2 3/6] stm32mp1: reset coprocessor status at cold boot Fabien Dessenne
2019-11-25 16:55   ` Patrick DELAUNAY
2020-01-08 20:11   ` Tom Rini
2019-10-30 13:38 ` [U-Boot] [PATCH v2 4/6] remoteproc: stm32: track the coprocessor state in a backup register Fabien Dessenne
2019-11-25 16:56   ` Patrick DELAUNAY
2020-01-08 20:12   ` Tom Rini
2019-10-30 13:38 ` [U-Boot] [PATCH v2 5/6] stm32mp1: remove copro_state environment variable Fabien Dessenne
2019-11-25 16:56   ` Patrick DELAUNAY
2020-01-08 20:12   ` Tom Rini
2019-10-30 13:38 ` Fabien Dessenne [this message]
2019-11-25 16:56   ` [U-Boot] [PATCH v2 6/6] remoteproc: stm32: load resource table from firmware Patrick DELAUNAY
2020-01-08 20:12   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1572442713-26353-7-git-send-email-fabien.dessenne@st.com \
    --to=fabien.dessenne@st.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.