ARM: i.MX8MQ: Add code to report HDMI/eDP firmware version
Subsystems (3)
PATCH 1/1 ARM: i.MX8MQ: Add code to report HDMI/eDP firmware version
Port code found in cdn_dp_load_firmware() in Linux kernel to check if HDMI firmware is running and, if so, report its version.
--- arch/arm/mach-imx/imx8mq.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
arch/arm/mach-imx/imx8mq.c +37 -0
@@ -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,39 @@ 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; + +/* 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 ("HDMI 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 ("HDMI firmware ver: %d ver_lib: %d\n" , ver, ver_lib); + +return 0 ; +} +console_initcall (imx8mq_report_hdmi_firmware);
Signature · 7 lines
2.20.1 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Am Montag, den 11.02.2019, 18:36 -0800 schrieb Andrey Smirnov:
Quoted 34 lines
Port code found in
cdn_dp_load_firmware()in Linux kernel to check if HDMI firmware is running and, if so, report its version.Quoted 1 line
Signed-off-by Andrey Smirnov <[email protected]>---
arch/arm/mach-imx/imx8mq.c | 37 +++++++++++++++++++++++++++++++++++++1 file changed, 37 insertions(+)arch/arm/mach-imx/imx8mq.c +0
-0@@ -21,6 +21,7 @@ #include <mach/imx8mq.h> #include <mach/reset-reason.h>
+#include <linux/iopoll.h>
#include <linux/arm-smccc.h>Quoted 1 line
#define
FSL_SIP_BUILDINFO0xC2000003arch/arm/mach-imx/imx8mq.c +0
-0@@ -81,3 +82,39 @@ int imx8mq_init(void)Quoted 1 line
return 0;
}
+Quoted 6 lines
arch/arm/mach-imx/imx8mq.c +6
-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 100000arch/arm/mach-imx/imx8mq.c +3
-0+ +static int imx8mq_report_hdmi_firmware (void ) +{
Quoted 5 lines
arch/arm/mach-imx/imx8mq.c int imx8mq_init(void) · line 98
Quoted 4 lines
arch/arm/mach-imx/imx8mq.c +4
-0+void __iomem *hdmi =IOMEM (MX8MQ_HDMI_CTRL_BASE_ADDR ); +u16 ver_lib, ver; +u32 reg; +int ret;+
This is missing a check to bail out if we aren't running on a i.MX8MQ.
Quoted 15 lines
arch/arm/mach-imx/imx8mq.c +1
-0+/* check the keep alive register to make sure fw working */ arch/arm/mach-imx/imx8mq.c int imx8mq_init(void) · line 106
Quoted 6 lines
arch/arm/mach-imx/imx8mq.c +6
-0+ ret =readl_poll_timeout (hdmi +KEEP_ALIVE , + reg, reg, FW_ALIVE_TIMEOUT_US); +if (ret <0 ) { +pr_info ("HDMI firmware is not running\n" ); +return 0 ; + }+
arch/arm/mach-imx/imx8mq.c int imx8mq_init(void) · line 110
Quoted 3 lines
arch/arm/mach-imx/imx8mq.c +3
-0+ ver =readl (hdmi +VER_H ) &0xff ; + ver <<=8 ; + ver |=readl (hdmi +VER_L ) &0xff ;+
Quoted 3 lines
arch/arm/mach-imx/imx8mq.c +3
-0+ ver_lib =readl (hdmi +VER_LIB_H_ADDR ) &0xff ; + ver_lib <<=8 ; + ver_lib |=readl (hdmi +VER_LIB_L_ADDR ) &0xff ;
arch/arm/mach-imx/imx8mq.c
Quoted 2 lines
arch/arm/mach-imx/imx8mq.c +2
-0+ +pr_info ("HDMI firmware ver: %d ver_lib: %d\n" , ver, ver_lib);
Maybe "HDMI TX" or "HDP" here, as this should equally apply to eDP firmware, right?
Regards,
Lucas
arch/arm/mach-imx/imx8mq.c
Quoted 4 lines
+
Quoted 1 line
(quoted diff) +1
-0+ return 0;arch/arm/mach-imx/imx8mq.c +2
-0+} +console_initcall (imx8mq_report_hdmi_firmware);
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 36 lines · Lucas Stach
Am Montag, den 11.02.2019, 18:36 -0800 schrieb Andrey Smirnov:
Quoted 34 lines
Port code found in
cdn_dp_load_firmware()in Linux kernel to check if HDMI firmware is running and, if so, report its version.Quoted 1 line
Signed-off-by Andrey Smirnov <[email protected]>--- arch/arm/mach-imx/imx8mq.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)arch/arm/mach-imx/imx8mq.c +1
-0@@ -21,6 +21,7 @@#include <mach/imx8mq.h> #include <mach/reset-reason.h> +#include <linux/iopoll.h> #include <linux/arm-smccc.h> Quoted 1 line
#define
FSL_SIP_BUILDINFO0xC2000003arch/arm/mach-imx/imx8mq.c +1
-0@@ -81,3 +82,39 @@ int imx8mq_init(void) > return 0; } +Quoted 6 lines
arch/arm/mach-imx/imx8mq.c +6
-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 100000arch/arm/mach-imx/imx8mq.c +3
-0+ +static int imx8mq_report_hdmi_firmware (void ) +{
Quoted 8 lines
Quoted 5 lines
arch/arm/mach-imx/imx8mq.c int imx8mq_init(void) · line 98
Quoted 4 lines
arch/arm/mach-imx/imx8mq.c +4
-0+void __iomem *hdmi =IOMEM (MX8MQ_HDMI_CTRL_BASE_ADDR ); +u16 ver_lib, ver; +u32 reg; +int ret;+
This is missing a check to bail out if we aren't running on a i.MX8MQ.
Ugh, missed this one. Thanks for noticing!
Quoted 12 lines
Quoted 12 lines
+ /* check the keep alive register to make sure fw working */
arch/arm/mach-imx/imx8mq.c int imx8mq_init(void) · line 106
Quoted 6 lines
arch/arm/mach-imx/imx8mq.c +6
-0+ ret =readl_poll_timeout (hdmi +KEEP_ALIVE , + reg, reg,FW_ALIVE_TIMEOUT_US ); +if (ret <0 ) { +pr_info ("HDMI firmware is not running\n" ); +return 0 ; + }+
arch/arm/mach-imx/imx8mq.c int imx8mq_init(void) · line 110
Quoted 3 lines
arch/arm/mach-imx/imx8mq.c +3
-0+ ver =readl (hdmi +VER_H ) &0xff ; + ver <<=8 ; + ver |=readl (hdmi +VER_L ) &0xff ;+
Quoted 9 lines
arch/arm/mach-imx/imx8mq.c
Quoted 5 lines
Quoted 3 lines
arch/arm/mach-imx/imx8mq.c +3
-0+ ver_lib =readl (hdmi +VER_LIB_H_ADDR ) &0xff ; + ver_lib <<=8 ; + ver_lib |=readl (hdmi +VER_LIB_L_ADDR ) &0xff ;arch/arm/mach-imx/imx8mq.c +2
-0+ +pr_info ("HDMI firmware ver: %d ver_lib: %d\n" , ver, ver_lib);Maybe "HDMI TX" or "HDP" here, as this should equally apply to eDP firmware, right?
Yeah, it should work for both. Will change to "HDP" in v2.
Thanks,
Andrey Smirnov
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox