mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v2] ARM: i.MX8MQ: Add code to report HDMI/eDP firmware version
@ 2019-02-13  1:09 Andrey Smirnov
  2019-02-18  8:56 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Andrey Smirnov @ 2019-02-13  1:09 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Port code found in cdn_dp_load_firmware() in Linux kernel to check if
HDMI firmware is running and, if so, report its version.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---

Changes since [v1]:

    - Added CPU type check to prevent execution on non-i.MX8MQ SoCs.

    - Changes messages to say "HDP" instead of "HDMI", to clarify that
      the check covers both HDMI _and_ eDP firmware.

[v1] http://lists.infradead.org/pipermail/barebox/2019-February/037059.html

 arch/arm/mach-imx/imx8mq.c | 40 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/arch/arm/mach-imx/imx8mq.c b/arch/arm/mach-imx/imx8mq.c
index 4d00da5f0..d887092ce 100644
--- a/arch/arm/mach-imx/imx8mq.c
+++ b/arch/arm/mach-imx/imx8mq.c
@@ -21,6 +21,7 @@
 #include <mach/imx8mq.h>
 #include <mach/reset-reason.h>
 
+#include <linux/iopoll.h>
 #include <linux/arm-smccc.h>
 
 #define FSL_SIP_BUILDINFO			0xC2000003
@@ -81,3 +82,42 @@ int imx8mq_init(void)
 
 	return 0;
 }
+
+#define KEEP_ALIVE			0x18
+#define VER_L				0x1c
+#define VER_H				0x20
+#define VER_LIB_L_ADDR			0x24
+#define VER_LIB_H_ADDR			0x28
+#define FW_ALIVE_TIMEOUT_US		100000
+
+static int imx8mq_report_hdmi_firmware(void)
+{
+	void __iomem *hdmi = IOMEM(MX8MQ_HDMI_CTRL_BASE_ADDR);
+	u16 ver_lib, ver;
+	u32 reg;
+	int ret;
+
+	if (!cpu_is_mx8mq())
+		return 0;
+
+	/* check the keep alive register to make sure fw working */
+	ret = readl_poll_timeout(hdmi + KEEP_ALIVE,
+				 reg, reg, FW_ALIVE_TIMEOUT_US);
+	if (ret < 0) {
+		pr_info("HDP firmware is not running\n");
+		return 0;
+	}
+
+	ver = readl(hdmi + VER_H) & 0xff;
+	ver <<= 8;
+	ver |= readl(hdmi + VER_L) & 0xff;
+
+	ver_lib = readl(hdmi + VER_LIB_H_ADDR) & 0xff;
+	ver_lib <<= 8;
+	ver_lib |= readl(hdmi + VER_LIB_L_ADDR) & 0xff;
+
+	pr_info("HDP firmware ver: %d ver_lib: %d\n", ver, ver_lib);
+
+	return 0;
+}
+console_initcall(imx8mq_report_hdmi_firmware);
-- 
2.20.1


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

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

* Re: [PATCH v2] ARM: i.MX8MQ: Add code to report HDMI/eDP firmware version
  2019-02-13  1:09 [PATCH v2] ARM: i.MX8MQ: Add code to report HDMI/eDP firmware version Andrey Smirnov
@ 2019-02-18  8:56 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2019-02-18  8:56 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox

On Tue, Feb 12, 2019 at 05:09:07PM -0800, Andrey Smirnov wrote:
> Port code found in cdn_dp_load_firmware() in Linux kernel to check if
> HDMI firmware is running and, if so, report its version.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
> 
> Changes since [v1]:
> 
>     - Added CPU type check to prevent execution on non-i.MX8MQ SoCs.
> 
>     - Changes messages to say "HDP" instead of "HDMI", to clarify that
>       the check covers both HDMI _and_ eDP firmware.
> 
> [v1] http://lists.infradead.org/pipermail/barebox/2019-February/037059.html
> 
>  arch/arm/mach-imx/imx8mq.c | 40 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

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

end of thread, other threads:[~2019-02-18  8:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-13  1:09 [PATCH v2] ARM: i.MX8MQ: Add code to report HDMI/eDP firmware version Andrey Smirnov
2019-02-18  8:56 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox