summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorOliver Brown <oliver.brown@nxp.com>2019-02-14 08:13:34 -0600
committerOliver Brown <oliver.brown@nxp.com>2019-02-15 11:55:25 -0600
commit6c0246888012c50127b40f1ab6fa6d581f725f7a (patch)
tree6dc92102243b338629c2088be5c201f948df3ed7 /drivers
parent745f2e597613e96f1ac630e842faafdc060ee029 (diff)
MLK-17405 iMX8QM: Add athentication for HDMI/DP firmware
Add firmware athentication to the hdp and hdprx load functions. If hdp_authenticate_fw is set to yes, the hdp tx firmware is athenticated. If hdprx_authenticate_fw is set to yes, the hdp rx firmware is athenticated. Signed-off-by: Oliver Brown <oliver.brown@nxp.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/imx/hdp_load.c49
-rw-r--r--drivers/video/imx/hdprx_load.c35
-rw-r--r--drivers/video/imx/scfw_utils.h18
3 files changed, 69 insertions, 33 deletions
diff --git a/drivers/video/imx/hdp_load.c b/drivers/video/imx/hdp_load.c
index 6352eff2ac..a27112c653 100644
--- a/drivers/video/imx/hdp_load.c
+++ b/drivers/video/imx/hdp_load.c
@@ -17,44 +17,44 @@ DECLARE_GLOBAL_DATA_PTR;
static void display_set_power(int onoff)
{
- sc_ipc_t ipcHndl = gd->arch.ipc_channel_handle;
+ sc_ipc_t ipch = gd->arch.ipc_channel_handle;
- SC_PM_SET_RESOURCE_POWER_MODE(ipcHndl, SC_R_DC_0, onoff);
- SC_PM_SET_RESOURCE_POWER_MODE(ipcHndl, SC_R_HDMI, onoff);
+ SC_PM_SET_RESOURCE_POWER_MODE(ipch, SC_R_DC_0, onoff);
+ SC_PM_SET_RESOURCE_POWER_MODE(ipch, SC_R_HDMI, onoff);
}
static void display_set_clocks(void)
{
- sc_ipc_t ipcHndl = gd->arch.ipc_channel_handle;
+ sc_ipc_t ipch = gd->arch.ipc_channel_handle;
const sc_pm_clock_rate_t pll = 1188000000;
const sc_pm_clock_rate_t hdmi_core_clock = pll / 10;
const sc_pm_clock_rate_t hdmi_bus_clock = pll / 14;
- SC_PM_SET_RESOURCE_POWER_MODE(ipcHndl,
+ SC_PM_SET_RESOURCE_POWER_MODE(ipch,
SC_R_HDMI_PLL_0, SC_PM_PW_MODE_OFF);
- SC_PM_SET_CLOCK_RATE(ipcHndl,
+ SC_PM_SET_CLOCK_RATE(ipch,
SC_R_HDMI_PLL_0, SC_PM_CLK_PLL, pll);
- SC_PM_SET_RESOURCE_POWER_MODE(ipcHndl,
+ SC_PM_SET_RESOURCE_POWER_MODE(ipch,
SC_R_HDMI_PLL_0, SC_PM_PW_MODE_ON);
/* HDMI DI Bus Clock */
- SC_PM_SET_CLOCK_RATE(ipcHndl,
+ SC_PM_SET_CLOCK_RATE(ipch,
SC_R_HDMI, SC_PM_CLK_MISC4, hdmi_bus_clock);
/* HDMI DI Core Clock */
- SC_PM_SET_CLOCK_RATE(ipcHndl,
+ SC_PM_SET_CLOCK_RATE(ipch,
SC_R_HDMI, SC_PM_CLK_MISC2, hdmi_core_clock);
}
static void display_enable_clocks(int enable)
{
- sc_ipc_t ipcHndl = gd->arch.ipc_channel_handle;
+ sc_ipc_t ipch = gd->arch.ipc_channel_handle;
- SC_PM_CLOCK_ENABLE(ipcHndl, SC_R_HDMI_PLL_0, SC_PM_CLK_PLL, enable);
- SC_PM_CLOCK_ENABLE(ipcHndl, SC_R_HDMI, SC_PM_CLK_MISC2, enable);
- SC_PM_CLOCK_ENABLE(ipcHndl, SC_R_HDMI, SC_PM_CLK_MISC4, enable);
+ SC_PM_CLOCK_ENABLE(ipch, SC_R_HDMI_PLL_0, SC_PM_CLK_PLL, enable);
+ SC_PM_CLOCK_ENABLE(ipch, SC_R_HDMI, SC_PM_CLK_MISC2, enable);
+ SC_PM_CLOCK_ENABLE(ipch, SC_R_HDMI, SC_PM_CLK_MISC4, enable);
if (enable == OFF)
- SC_PM_SET_RESOURCE_POWER_MODE(ipcHndl,
- SC_R_HDMI_PLL_0, SC_PM_PW_MODE_OFF);
+ SC_PM_SET_RESOURCE_POWER_MODE(ipch, SC_R_HDMI_PLL_0,
+ SC_PM_PW_MODE_OFF);
}
int do_hdp(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
@@ -70,16 +70,19 @@ int do_hdp(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
unsigned long offset = 0x2000;
const int iram_size = 0x10000;
const int dram_size = 0x8000;
+ const char *s;
+ sc_ipc_t ipch = gd->arch.ipc_channel_handle;
if (argc > 2) {
address = simple_strtoul(argv[2], NULL, 0);
if (argc > 3)
offset = simple_strtoul(argv[3], NULL, 0);
- } else
+ } else {
printf("Missing address\n");
+ }
printf("Loading hdp firmware from 0x%016lx offset 0x%016lx\n",
- address, offset);
+ address, offset);
display_set_power(SC_PM_PW_MODE_ON);
display_set_clocks();
display_enable_clocks(ON);
@@ -88,8 +91,14 @@ int do_hdp(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
(unsigned char *)(address + offset +
iram_size),
dram_size);
+
+ s = env_get("hdp_authenticate_fw");
+ if (s && !strcmp(s, "yes"))
+ SC_MISC_AUTH(ipch, SC_MISC_SECO_AUTH_HDMI_TX_FW, 0);
+
display_enable_clocks(OFF);
printf("Loading hdp firmware Complete\n");
+
/* do not turn off hdmi power or firmware load will be lost */
} else {
printf("test error argc %d\n", argc);
@@ -97,8 +106,8 @@ int do_hdp(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
return 0;
}
-/***************************************************/
+/***************************************************/
U_BOOT_CMD(
hdp, CONFIG_SYS_MAXARGS, 1, do_hdp,
"load hdmi firmware ",
@@ -106,5 +115,9 @@ U_BOOT_CMD(
"hdpload [address] [<offset>]\n"
" address - address where the binary image starts\n"
" <offset> - IRAM offset in the binary image (8192 default)\n"
+ "\n"
+ " if \"hdp_authenticate_fw\" is set to \"yes\", the seco\n"
+ " will authenticate the firmware and load HDCP keys.\n"
+ "\n"
"tracescfw - Trace SCFW API calls for video commands\n"
);
diff --git a/drivers/video/imx/hdprx_load.c b/drivers/video/imx/hdprx_load.c
index 268dd85d84..028693441b 100644
--- a/drivers/video/imx/hdprx_load.c
+++ b/drivers/video/imx/hdprx_load.c
@@ -17,11 +17,11 @@ DECLARE_GLOBAL_DATA_PTR;
static void hdmi_rx_set_power(int onoff)
{
- sc_ipc_t ipcHndl = gd->arch.ipc_channel_handle;
+ sc_ipc_t ipch = gd->arch.ipc_channel_handle;
- SC_PM_SET_RESOURCE_POWER_MODE(ipcHndl, SC_R_ISI_CH0, onoff);
- SC_PM_SET_RESOURCE_POWER_MODE(ipcHndl, SC_R_HDMI_RX, onoff);
- SC_PM_SET_RESOURCE_POWER_MODE(ipcHndl, SC_R_HDMI_RX_BYPASS, onoff);
+ SC_PM_SET_RESOURCE_POWER_MODE(ipch, SC_R_ISI_CH0, onoff);
+ SC_PM_SET_RESOURCE_POWER_MODE(ipch, SC_R_HDMI_RX, onoff);
+ SC_PM_SET_RESOURCE_POWER_MODE(ipch, SC_R_HDMI_RX_BYPASS, onoff);
}
int do_hdprx(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
@@ -37,22 +37,29 @@ int do_hdprx(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
unsigned long offset = 0x2000;
const int iram_size = 0x10000;
const int dram_size = 0x8000;
+ const char *s;
+ sc_ipc_t ipch = gd->arch.ipc_channel_handle;
if (argc > 2) {
address = simple_strtoul(argv[2], NULL, 0);
if (argc > 3)
offset = simple_strtoul(argv[3], NULL, 0);
- } else
+ } else {
printf("Missing address\n");
+ }
- printf("Loading hdp rx firmware from 0x%016lx offset 0x%016lx\n",
- address, offset);
+ printf("Loading hdprx firmware from 0x%016lx offset 0x%016lx\n",
+ address, offset);
hdmi_rx_set_power(SC_PM_PW_MODE_ON);
hdp_rx_loadfirmware((unsigned char *)(address + offset),
- iram_size,
- (unsigned char *)(address + offset +
- iram_size),
- dram_size);
+ iram_size,
+ (unsigned char *)(address + offset +
+ iram_size),
+ dram_size);
+
+ s = env_get("hdprx_authenticate_fw");
+ if (s && !strcmp(s, "yes"))
+ SC_MISC_AUTH(ipch, SC_MISC_SECO_AUTH_HDMI_RX_FW, 0);
printf("Loading hdp rx firmware Complete\n");
/* do not turn off hdmi power or firmware load will be lost */
} else {
@@ -61,8 +68,8 @@ int do_hdprx(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
return 0;
}
-/***************************************************/
+/***************************************************/
U_BOOT_CMD(
hdprx, CONFIG_SYS_MAXARGS, 1, do_hdprx,
"load hdmi rx firmware ",
@@ -70,5 +77,9 @@ U_BOOT_CMD(
"hdpload [address] [<offset>]\n"
" address - address where the binary image starts\n"
" <offset> - IRAM offset in the binary image (8192 default)\n"
+ "\n"
+ " if \"hdprx_authenticate_fw\" is set to \"yes\", the seco\n"
+ " will authenticate the firmware and load HDCP keys.\n"
+ "\n"
"tracescfw - Trace SCFW API calls for video commands\n"
);
diff --git a/drivers/video/imx/scfw_utils.h b/drivers/video/imx/scfw_utils.h
index 6a9d541d71..d8764e8105 100644
--- a/drivers/video/imx/scfw_utils.h
+++ b/drivers/video/imx/scfw_utils.h
@@ -52,7 +52,7 @@ do { \
if (g_debug_scfw) \
printf("(%4d) sc_pm_clock_enable %s:%s -> %d\n",\
__LINE__, _res_str, _clk_str, __enable__);\
- _ret = sc_pm_clock_enable(ipcHndl,\
+ _ret = sc_pm_clock_enable(__ipcHndl__,\
__res__, __clk__, __enable__, false);\
if (_ret != SC_ERR_NONE)\
printf("(%4d)>> sc_pm_clock_enable failed! %s:%s -> %d (error = %d)\n",\
@@ -67,7 +67,7 @@ do { \
if (g_debug_scfw) \
printf("(%4d) sc_misc_set_control %s:%s -> %d\n",\
__LINE__, _res_str, _clk_str, __value__);\
- _ret = sc_misc_set_control(ipcHndl, \
+ _ret = sc_misc_set_control(__ipcHndl__, \
__res__, __clk__, __value__); \
if (_ret != SC_ERR_NONE) \
printf("(%4d)>> sc_misc_set_control failed! %s:%s -> %d (error = %d)\n", \
@@ -81,10 +81,22 @@ do { \
if (g_debug_scfw) \
printf("(%4d) sc_pm_set_resource_power_mode %s -> %d\n",\
__LINE__, _res_str, __enable__);\
- _ret = sc_pm_set_resource_power_mode(ipcHndl, __res__, __enable__);\
+ _ret = sc_pm_set_resource_power_mode(__ipcHndl__, __res__, __enable__);\
if (_ret != SC_ERR_NONE) \
printf("(%4d)>> sc_pm_set_resource_power_mode failed! %s -> %d (error = %d)\n", \
__LINE__, _res_str, __enable__, _ret);\
} while (0)
+#define SC_MISC_AUTH(__ipcHndl__, __cmd__, __addr__) \
+do { \
+ sc_err_t _ret; \
+ if (g_debug_scfw) \
+ printf("(%4d) sc_misc_seco_authenticate -> cmd %d addr %d\n",\
+ __LINE__, __cmd__, __addr__);\
+ _ret = sc_misc_seco_authenticate(__ipcHndl__, __cmd__, __addr__); \
+ if (_ret != SC_ERR_NONE) \
+ printf("(%4d)>> sc_misc_seco_authenticate cmd %d addr %d (error = %d)\n", \
+ __LINE__, __cmd__, __addr__, _ret); \
+} while (0)
+
#endif /*_SCFW_UTILS_H_ */