Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
reform-boundary-uboot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jack Humbert
reform-boundary-uboot
Commits
af366c4a
Commit
af366c4a
authored
6 years ago
by
Troy Kisky
Browse files
Options
Downloads
Patches
Plain Diff
arm: imx8m: soc: add ft_add_optee_node for imx8mm
Signed-off-by:
Troy Kisky
<
troy.kisky@boundarydevices.com
>
parent
bc2b46b2
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
arch/arm/mach-imx/imx8m/soc.c
+138
-3
138 additions, 3 deletions
arch/arm/mach-imx/imx8m/soc.c
with
138 additions
and
3 deletions
arch/arm/mach-imx/imx8m/soc.c
+
138
−
3
View file @
af366c4a
...
...
@@ -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_in
it
*/
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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment