Skip to content
Snippets Groups Projects
Commit af366c4a authored by Troy Kisky's avatar Troy Kisky
Browse files

arm: imx8m: soc: add ft_add_optee_node for imx8mm

parent bc2b46b2
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,6 @@
#include <errno.h>
#include <fdt_support.h>
#include <fsl_wdog.h>
#include <imx_sip.h>
#include <generated/version_autogenerated.h>
DECLARE_GLOBAL_DATA_PTR;
......@@ -191,9 +190,11 @@ static void imx_set_wdog_powerdown(bool enable)
int arch_cpu_init(void)
{
/*
* Init timer at very early state, because sscg pll setting
* will use it
* Init timer at very early state, because pll setting will use it,
* Rom Turnned off SCTR, enable it before timer_init
*/
clock_enable(CCGR_SCTR, 1);
timer_init();
if (IS_ENABLED(CONFIG_SPL_BUILD)) {
......@@ -201,12 +202,144 @@ int arch_cpu_init(void)
imx_set_wdog_powerdown(false);
}
#if defined(CONFIG_ANDROID_SUPPORT)
/* Enable RTC */
writel(0x21, 0x30370038);
#endif
return 0;
}
#ifdef CONFIG_SERIAL_TAG
void get_board_serial(struct tag_serialnr *serialnr)
{
struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
struct fuse_bank *bank = &ocotp->bank[0];
struct fuse_bank0_regs *fuse =
(struct fuse_bank0_regs *)bank->fuse_regs;
serialnr->low = fuse->uid_low;
serialnr->high = fuse->uid_high;
}
#endif
#ifdef CONFIG_OF_SYSTEM_SETUP
static int ft_add_optee_node(void *fdt, bd_t *bd)
{
const char *path, *subpath;
int offs;
/*
* No TEE space allocated indicating no TEE running, so no
* need to add optee node in dts
*/
if (!rom_pointer[1])
return 0;
offs = fdt_increase_size(fdt, 512);
if (offs) {
printf("No Space for dtb\n");
return 1;
}
path = "/firmware";
offs = fdt_path_offset(fdt, path);
if (offs < 0) {
path = "/";
offs = fdt_path_offset(fdt, path);
if (offs < 0) {
printf("Could not find root node.\n");
return 1;
}
subpath = "firmware";
offs = fdt_add_subnode(fdt, offs, subpath);
if (offs < 0) {
printf("Could not create %s node.\n", subpath);
}
}
subpath = "optee";
offs = fdt_add_subnode(fdt, offs, subpath);
if (offs < 0) {
printf("Could not create %s node.\n", subpath);
}
fdt_setprop_string(fdt, offs, "compatible", "linaro,optee-tz");
fdt_setprop_string(fdt, offs, "method", "smc");
return 0;
}
int ft_system_setup(void *blob, bd_t *bd)
{
#ifndef CONFIG_IMX8MM
if (get_boot_device() == USB_BOOT) {
const char *nodes_path[] = {
"/dcss@32e00000",
"/hdmi@32c00000",
"/hdmi_cec@32c33800",
"/hdmi_drm@32c00000",
"/display-subsystem",
"/sound-hdmi"
};
int i = 0;
int rc;
int nodeoff;
const char *status = "disabled";
for (i = 0; i < ARRAY_SIZE(nodes_path); i++) {
nodeoff = fdt_path_offset(blob, nodes_path[i]);
if (nodeoff < 0)
continue; /* Not found, skip it */
printf("Found %s node\n", nodes_path[i]);
add_status:
rc = fdt_setprop(blob, nodeoff, "status", status, strlen(status) + 1);
if (rc) {
if (rc == -FDT_ERR_NOSPACE) {
rc = fdt_increase_size(blob, 512);
if (!rc)
goto add_status;
}
printf("Unable to update property %s:%s, err=%s\n",
nodes_path[i], "status", fdt_strerror(rc));
return rc;
} else {
printf("Modify %s:%s disabled\n",
nodes_path[i], "status");
}
}
const char *usb_dwc3_path = "/usb@38100000/dwc3";
nodeoff = fdt_path_offset(blob, usb_dwc3_path);
if (nodeoff >= 0) {
const char *speed = "high-speed";
printf("Found %s node\n", usb_dwc3_path);
usb_modify_speed:
rc = fdt_setprop(blob, nodeoff, "maximum-speed", speed, strlen(speed) + 1);
if (rc) {
if (rc == -FDT_ERR_NOSPACE) {
rc = fdt_increase_size(blob, 512);
if (!rc)
goto usb_modify_speed;
}
printf("Unable to set property %s:%s, err=%s\n",
usb_dwc3_path, "maximum-speed", fdt_strerror(rc));
} else {
printf("Modify %s:%s = %s\n",
usb_dwc3_path, "maximum-speed", speed);
}
}else {
printf("Can't found %s node\n", usb_dwc3_path);
}
}
/* Disable the CPU idle for A0 chip since the HW does not support it */
if (is_soc_rev(CHIP_REV_1_0)) {
static const char * const nodes_path[] = {
......@@ -240,6 +373,8 @@ int ft_system_setup(void *blob, bd_t *bd)
}
return 0;
#endif
return ft_add_optee_node(blob, bd);
}
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment