mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Subject: [PATCH v1 1/2] ARM: i.MX8MP: skov: add fallback for unsupported HW
Date: Mon, 18 Mar 2024 10:45:32 +0100	[thread overview]
Message-ID: <20240318094533.1553713-1-o.rempel@pengutronix.de> (raw)

Add fallback support for currently not supported HW. Instead of
completely fail, it is better to use some kind of basic devicetree with
reduced functionality.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 arch/arm/boards/skov-imx8mp/board.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boards/skov-imx8mp/board.c b/arch/arm/boards/skov-imx8mp/board.c
index 5424c3b9ab..a45fe8517f 100644
--- a/arch/arm/boards/skov-imx8mp/board.c
+++ b/arch/arm/boards/skov-imx8mp/board.c
@@ -83,6 +83,12 @@ static const struct board_description imx8mp_variants[] = {
 		.dts_compatible_hdmi = "skov,imx8mp-skov-revb-hdmi",
 		.flags = SKOV_IMX8MP_HAS_HDMI,
 	},
+	/* Keep this entry always on the last place. It will be used
+	 * as fallback variant if not supported variant is detected.
+	 */
+	{
+		.dts_compatible = "skov,imx8mp-skov-basic",
+	},
 };
 
 static int skov_imx8mp_fixup(struct device_node *root, void *data)
@@ -168,13 +174,14 @@ static int skov_imx8mp_init_variant(struct skov_imx8mp_priv *priv)
 	if (ret)
 		return ret;
 
-	priv->variant_id = v;
 
 	if (v >= ARRAY_SIZE(imx8mp_variants)) {
-		dev_err(dev, "Invalid variant %u\n", v);
-		return -EINVAL;
+		dev_warn(dev, "Unsuported variant %u. Fall back to basic variant\n", v);
+		v = ARRAY_SIZE(imx8mp_variants) - 1;
 	}
 
+	priv->variant_id = v;
+
 	variant = &imx8mp_variants[v];
 
 	if (variant->flags & SKOV_IMX8MP_HAS_HDMI) {
-- 
2.39.2




             reply	other threads:[~2024-03-18  9:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18  9:45 Oleksij Rempel [this message]
2024-03-18  9:45 ` [PATCH v1 2/2] ARM: i.MX8MP: skov: add new bd500 variant support Oleksij Rempel
2024-03-18 12:39 ` [PATCH v1 1/2] ARM: i.MX8MP: skov: add fallback for unsupported HW Sascha Hauer

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=20240318094533.1553713-1-o.rempel@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox