From: Ben Levinsky <ben.levinsky@amd.com>
To: <jassisinghbrar@gmail.com>, <andersson@kernel.org>,
<mathieu.poirier@linaro.org>, <robh@kernel.org>,
<krzk+dt@kernel.org>, <conor+dt@kernel.org>
Cc: <michal.simek@amd.com>, <linux-remoteproc@vger.kernel.org>,
<devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <ben.levinsky@amd.com>,
<tanmay.shah@amd.com>
Subject: [PATCH 2/6] remoteproc: amd_mbv_bram: Restore reset GPIO direction after PL reconfig
Date: Wed, 14 Oct 2026 14:34:22 -0700 [thread overview]
Message-ID: <20261014213426.2957480-3-ben.levinsky@amd.com> (raw)
In-Reply-To: <20261014213426.2957480-1-ben.levinsky@amd.com>
Partial reconfiguration of the programmable logic restores the AXI GPIO
that drives the soft-core reset to its hardware default direction, but
gpiolib keeps its cached output direction. gpiod_set_value_cansleep()
then only updates the data register, so the processor never sees a
reset transition: remoteproc reports it as running while the newly
loaded firmware never starts.
Use gpiod_direction_output() for every reset transition so the output
direction is re-established, and assert reset briefly before releasing
it so each start produces a clean reset pulse after the firmware has
been loaded.
Fixes: f87b4998994e ("remoteproc: Add AMD MicroBlaze/V BRAM-based remote processor driver")
Assisted-by: LLM sparse
Signed-off-by: Ben Levinsky <ben.levinsky@amd.com>
---
drivers/remoteproc/amd_mbv_bram_rproc.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/remoteproc/amd_mbv_bram_rproc.c b/drivers/remoteproc/amd_mbv_bram_rproc.c
index 6cf33c7b7e64..da621f62f7df 100644
--- a/drivers/remoteproc/amd_mbv_bram_rproc.c
+++ b/drivers/remoteproc/amd_mbv_bram_rproc.c
@@ -16,6 +16,7 @@
*/
#include <linux/clk.h>
+#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/gpio/consumer.h>
#include <linux/module.h>
@@ -94,8 +95,24 @@ static int amd_bram_rproc_start(struct rproc *rproc)
return ret;
}
+ /*
+ * Partial reconfiguration restores the PL GPIO hardware defaults but
+ * leaves gpiolib's cached direction unchanged. Re-establish the output
+ * direction and generate a reset pulse after firmware has been loaded.
+ * gpiod_set_value_cansleep() is insufficient here because it changes the
+ * value without restoring an output direction lost during DFX.
+ */
+ ret = gpiod_direction_output(priv->reset, 1);
+ if (ret) {
+ dev_err(priv->dev, "failed to assert reset: %d\n", ret);
+ clk_disable_unprepare(priv->clk);
+ return ret;
+ }
+ /* Hold reset asserted long enough to provide a clean reset pulse. */
+ usleep_range(10, 20);
+
/* Deassert reset and let the processor run. */
- ret = gpiod_set_value_cansleep(priv->reset, 0);
+ ret = gpiod_direction_output(priv->reset, 0);
if (ret) {
dev_err(priv->dev, "failed to deassert reset: %d\n", ret);
clk_disable_unprepare(priv->clk);
@@ -110,8 +127,8 @@ static int amd_bram_rproc_stop(struct rproc *rproc)
struct amd_bram_rproc *priv = rproc->priv;
int ret;
- /* Assert reset before disabling the processor clock. */
- ret = gpiod_set_value_cansleep(priv->reset, 1);
+ /* Restore the output direction after DFX and assert reset. */
+ ret = gpiod_direction_output(priv->reset, 1);
if (ret) {
dev_err(priv->dev, "failed to assert reset: %d\n", ret);
return ret;
--
2.34.1
next prev parent reply other threads:[~2026-10-14 21:34 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 21:34 [PATCH 0/6] Add AMD PL Mailbox and RPMsg support for the AMD BRAM remoteproc Ben Levinsky
2026-10-14 21:34 ` [PATCH 1/6] remoteproc: amd_mbv_bram: Bound device name formatting Ben Levinsky
2026-10-14 21:48 ` sashiko-bot
2026-10-14 21:34 ` Ben Levinsky [this message]
2026-10-14 21:44 ` [PATCH 2/6] remoteproc: amd_mbv_bram: Restore reset GPIO direction after PL reconfig sashiko-bot
2026-10-14 21:34 ` [PATCH 3/6] dt-bindings: mailbox: Add AMD PL Mailbox IP Ben Levinsky
2026-10-15 9:46 ` Krzysztof Kozlowski
2026-10-14 21:34 ` [PATCH 4/6] mailbox: Add AMD PL Mailbox soft IP controller Ben Levinsky
2026-10-14 21:41 ` sashiko-bot
2026-10-15 9:48 ` Krzysztof Kozlowski
2026-10-14 21:34 ` [PATCH 5/6] dt-bindings: remoteproc: Add RPMsg resources to AMD BRAM rproc Ben Levinsky
2026-10-15 9:49 ` Krzysztof Kozlowski
2026-10-14 21:34 ` [PATCH 6/6] remoteproc: amd_mbv_bram: Add RPMsg support Ben Levinsky
2026-10-14 21:45 ` sashiko-bot
2026-10-15 9:51 ` Krzysztof Kozlowski
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=20261014213426.2957480-3-ben.levinsky@amd.com \
--to=ben.levinsky@amd.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jassisinghbrar@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=michal.simek@amd.com \
--cc=robh@kernel.org \
--cc=tanmay.shah@amd.com \
/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.