mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: Barebox List <barebox@lists.infradead.org>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 07/23] ARM: zii-common: Support rave_switch_reset on ZII Ultra
Date: Tue, 31 Mar 2020 11:47:06 -0700	[thread overview]
Message-ID: <20200331184722.22707-8-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20200331184722.22707-1-andrew.smirnov@gmail.com>

ZII Ultra boards implement switch watchdog the same way as ZII
RDU2. Add necessary code to make rave_switch_reset availible.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 arch/arm/boards/zii-common/switch-cmd.c              | 12 +++++++++++-
 arch/arm/boards/zii-imx8mq-dev/board.c               |  9 +++++++++
 .../defaultenv-imx8mq-zii-dev/network/eth0-discover  |  4 ++++
 arch/arm/dts/imx8mq-zii-ultra.dtsi                   |  1 -
 4 files changed, 24 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/boards/zii-imx8mq-dev/defaultenv-imx8mq-zii-dev/network/eth0-discover

diff --git a/arch/arm/boards/zii-common/switch-cmd.c b/arch/arm/boards/zii-common/switch-cmd.c
index 02802ff86..cf5554e2e 100644
--- a/arch/arm/boards/zii-common/switch-cmd.c
+++ b/arch/arm/boards/zii-common/switch-cmd.c
@@ -29,6 +29,15 @@ static int do_rdu2_switch_reset(void)
 		return -ENODEV;
 	}
 
+	if (!of_device_is_available(np)) {
+		/*
+		 * If switch watchdog device is not available assume
+		 * it was removed for a reason and switch reset
+		 * command should be a no-op
+		 */
+		return 0;
+	}
+
 	client = of_find_i2c_device_by_node(np);
 	if (!client) {
 		pr_err("No switch watchdog I2C device found\n");
@@ -78,7 +87,8 @@ static int do_rdu1_switch_reset(void)
 static int do_rave_switch_reset(int argc, char *argv[])
 {
 	if (of_machine_is_compatible("zii,imx6q-zii-rdu2") ||
-	    of_machine_is_compatible("zii,imx6qp-zii-rdu2"))
+	    of_machine_is_compatible("zii,imx6qp-zii-rdu2") ||
+	    of_machine_is_compatible("zii,imx8mq-ultra"))
 		return do_rdu2_switch_reset();
 
 	if (of_machine_is_compatible("zii,imx51-rdu1"))
diff --git a/arch/arm/boards/zii-imx8mq-dev/board.c b/arch/arm/boards/zii-imx8mq-dev/board.c
index ac455990b..7591841fe 100644
--- a/arch/arm/boards/zii-imx8mq-dev/board.c
+++ b/arch/arm/boards/zii-imx8mq-dev/board.c
@@ -110,6 +110,15 @@ static int zii_imx8mq_dev_fixup_deb_internal(void)
 	/* Refresh the internal aliases list from the patched DT */
 	of_alias_scan();
 
+	/*
+	 * Disable switch watchdog to make rave_reset_switch a no-op
+	 */
+	np = of_find_compatible_node(NULL, NULL, "zii,rave-wdt");
+	if (!np)
+		return -ENODEV;
+
+	of_device_disable(np);
+
 	return 0;
 }
 
diff --git a/arch/arm/boards/zii-imx8mq-dev/defaultenv-imx8mq-zii-dev/network/eth0-discover b/arch/arm/boards/zii-imx8mq-dev/defaultenv-imx8mq-zii-dev/network/eth0-discover
new file mode 100644
index 000000000..00f312011
--- /dev/null
+++ b/arch/arm/boards/zii-imx8mq-dev/defaultenv-imx8mq-zii-dev/network/eth0-discover
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# reset switch to clear DSA config
+rave_reset_switch
diff --git a/arch/arm/dts/imx8mq-zii-ultra.dtsi b/arch/arm/dts/imx8mq-zii-ultra.dtsi
index 50bad9b1a..2df87d07a 100644
--- a/arch/arm/dts/imx8mq-zii-ultra.dtsi
+++ b/arch/arm/dts/imx8mq-zii-ultra.dtsi
@@ -114,4 +114,3 @@
 		reg = <0xe0000 0x20000>;
 	};
 };
-
-- 
2.21.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2020-03-31 18:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31 18:46 [PATCH 00/23] A number of ZII related fixes Andrey Smirnov
2020-03-31 18:47 ` [PATCH 01/23] ARM: zii-common: Gate rdu_i210_invm() call with CONFIG_PCI_IMX6 Andrey Smirnov
2020-04-01  5:20   ` Sascha Hauer
2020-04-01 19:47     ` Andrey Smirnov
2020-04-02  6:46       ` Sascha Hauer
2020-03-31 18:47 ` [PATCH 02/23] ARM: imx7d-zii-rpu2: Drop redundant chosen node Andrey Smirnov
2020-03-31 18:47 ` [PATCH 03/23] ARM: zii-imx7d-dev: Fix compatible name Andrey Smirnov
2020-03-31 18:47 ` [PATCH 04/23] ARM: zii-common: Check for I2C errors in do_rdu2_switch_reset() Andrey Smirnov
2020-04-01  5:23   ` Sascha Hauer
2020-03-31 18:47 ` [PATCH 05/23] i2c: Port of_find_i2c_device_by_node() from Linux Andrey Smirnov
2020-04-01  5:29   ` Sascha Hauer
2020-04-01  5:46     ` Sascha Hauer
2020-03-31 18:47 ` [PATCH 06/23] ARM: zii-common: Find switch watchdog via DT Andrey Smirnov
2020-03-31 18:47 ` Andrey Smirnov [this message]
2020-03-31 18:47 ` [PATCH 08/23] ARM: zii-imx6q-rdu2: Differentiate between RDU2 and RDU2+ Andrey Smirnov
2020-03-31 18:47 ` [PATCH 09/23] ARM: zii-imx7d-dev: Differentiate between RPU2 and RMU2 Andrey Smirnov
2020-03-31 18:47 ` [PATCH 10/23] ARM: zii-imx8mq-dev: Differentiate between Zest and RMB3 Andrey Smirnov
2020-03-31 18:47 ` [PATCH 11/23] ARM: zii-common: Add common environment directory Andrey Smirnov
2020-04-02  6:49   ` Sascha Hauer
2020-04-02 22:27     ` Andrey Smirnov
2020-04-03  7:58       ` Sascha Hauer
2020-03-31 18:47 ` [PATCH 12/23] ARM: zii-imx6q-rdu2: Register SD card slot with BBU Andrey Smirnov
2020-03-31 18:47 ` [PATCH 13/23] ARM: zii-vf610-dev: " Andrey Smirnov
2020-03-31 18:47 ` [PATCH 14/23] ARM: zii-imx8mq-dev: " Andrey Smirnov
2020-03-31 18:47 ` [PATCH 15/23] ARM: zii-vf610-dev: Add newline to end of board.c Andrey Smirnov
2020-03-31 18:47 ` [PATCH 16/23] ARM: rdu2: Drop redundant USB GPIO hog nodes Andrey Smirnov
2020-03-31 18:47 ` [PATCH 17/23] ARM: imx8mq: Drop trailing whitespace Andrey Smirnov
2020-03-31 18:47 ` [PATCH 18/23] ARM: imx8mq: Drop redundant DT nodes Andrey Smirnov
2020-03-31 18:47 ` [PATCH 19/23] ARM: zii-imx8mq-dev: Add boot source info Andrey Smirnov
2020-03-31 18:47 ` [PATCH 20/23] ARM: zii-imx8mq-dev: Drop redundant "stdout-path" Andrey Smirnov
2020-03-31 18:47 ` [PATCH 21/23] ARM: zii-imx7d-dev: Drop redundant RMU2 .dtsi Andrey Smirnov
2020-03-31 18:47 ` [PATCH 22/23] ARM: zii-imx7d-rmu2: Add SPI NOR partition info Andrey Smirnov
2020-03-31 18:47 ` [PATCH 23/23] ARM: zii-imx7d-rmu2: Add boot source info Andrey Smirnov
2020-04-01  6:10 ` [PATCH 00/23] A number of ZII related fixes 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=20200331184722.22707-8-andrew.smirnov@gmail.com \
    --to=andrew.smirnov@gmail.com \
    --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