-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arm: imx: add i.MX7D support #1639
Conversation
Why not set (most of) the Edit: To clarify: |
@jforissier yeah, that could simplify the build command. I'll add it in next version after collecting more comments. Hope this patch could catch up 2.5.0 release. |
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#ifndef CFG_TEE_CORE_NB_CORE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#ifndef
not needed unless it makes sense to allow override at build time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i.MX7Dual has two cores, but i.MX7Solo only has one core. So allow override at build time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see. IMO this should be addressed via $(PLATFORM) (more specifically, the platform "flavor"), because relying on a proper combination of command line parameters is error-prone, and setting the right values in conf.mk
based on $(PLATORM_xyz) is easy enough. This applies to CFG_DDR_SIZE
below, too.
#endif | ||
|
||
#ifndef CFG_DDR_SIZE | ||
#error "DRAM0_SIZE not defined" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that should be #define CFG_DDR_SIZE 0x40000000
.
Same as above re. #ifndef
, OK if it makes sense to override it from e.g., the command line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll correct the "error" message. I could move this conf.mk. Orignally I want to use one code base to support all i.MX7 boards, using different command line parameter to generate different image for different boards, but still needs some work to do.
@@ -0,0 +1,90 @@ | |||
/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to put this under core/drivers/
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually is not a driver, no driver framework. This is just to handle gpc registers and directly provide functions for imx psci code. I prefer keep it in plat-imx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, fair enough.
core/arch/arm/plat-imx/gpcv2.c
Outdated
#include <mm/core_memprot.h> | ||
#include <platform_config.h> | ||
#include <imx.h> | ||
#include <stdint.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several includes are not used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will clean up.
core/arch/arm/plat-imx/imx-common.c
Outdated
{ | ||
imx_soc_type(); | ||
|
||
return soc_type == SOC_MX6UL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return imx_soc_type() == SOC_MX6UL;
and same below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix in next version.
core/arch/arm/plat-imx/imx-common.c
Outdated
static uint32_t soc_type; | ||
static uint32_t soc_rev; | ||
static uint32_t soc_rev_major; | ||
static uint32_t soc_rev_minor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather cache only the register value and have helper functions like so:
static uint32_t imx_digproc()
{
static uint32_t reg;
if (!reg) {
/* ... read register value ... */
}
return reg;
}
uint32_t imx_soc_type()
{
return (imx_digproc() >> 16) & 0xff;
}
/* Etc. */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll check to use your proposed way.
core/arch/arm/plat-imx/imx-common.c
Outdated
|
||
bool soc_is_imx7s(void) | ||
{ | ||
int val = core_mmu_get_va(OCOTP_BASE + 0x450, MEM_AREA_IO_SEC); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
core_mmu_get_va()
returns a vaddr_t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix in next version
core/arch/arm/plat-imx/imx-common.c
Outdated
int val = core_mmu_get_va(OCOTP_BASE + 0x450, MEM_AREA_IO_SEC); | ||
|
||
if (soc_is_imx7ds()) { | ||
if (val & 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing read32()
or something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh. yeah. Thanks. Fix in next version.
core/arch/arm/plat-imx/imx-common.c
Outdated
} | ||
|
||
bool soc_is_imx7d(void) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comments as for soc_is_imx7s()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix in next version
@jforissier Updated with most CFG_xx into conf.mk, following your comments to detect soc type, cleanup including files in gpc code, fix a bug when detecting 7d/s soc as you pointed. |
@MrVan thanks, LGTM. Three minor things:
|
@jforissier Updated. README.md, MAINTAINERS.md updated, .travis.yml updated, tags applied, I did not add backslash in commit log. |
README.md
Outdated
@@ -50,6 +50,7 @@ platforms have different sub-maintainers, please refer to the file | |||
| [FSL i.MX6 Quad SABRE Lite Board](https://boundarydevices.com/product/sabre-lite-imx6-sbc/) |`PLATFORM=imx`| Yes | | |||
| [FSL i.MX6 Quad SABRE SD Board](http://www.nxp.com/products/software-and-tools/hardware-development-tools/sabre-development-system/sabre-board-for-smart-devices-based-on-the-i.mx-6quad-applications-processors:RD-IMX6Q-SABRE) |`PLATFORM=imx`| Yes | | |||
| [FSL i.MX6 UltraLite EVK Board](http://www.freescale.com/products/arm-processors/i.mx-applications-processors-based-on-arm-cores/i.mx-6-processors/i.mx6qp/i.mx6ultralite-evaluation-kit:MCIMX6UL-EVK) |`PLATFORM=imx`| Yes | | |||
| [NXP i.MX7Dual SabreSD Board](http://www.nxp.com/products/software-and-tools/hardware-development-tools/sabre-development-system/sabre-board-for-smart-devices-based-on-the-i.mx-7dual-applications-processors:MCIMX7SABRE) |`PLATFORM=imx`| Yes | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PLATFORM=imx-mx7dsabresd
(other i.MX6 platforms are incomplete but that should be fixed in a separate patch, I'll take care of that).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jforissier ok. I'll resend this patch to use PLATFROM=imx-mx7dsabresd.
It could be worth mentioning how far the soc runtime detection reaches. For instance if it's possible to support both i.MX6 and i.MX7 based socs with the same image, etc. |
@jenswi-linaro Currently still need build different images for different platforms. Finally I would like to support the i.MX family in one image, or support i.MX6 using one image, support i.MX7 using one image. Now we do not have a good framework to get information from dtb. |
Please elaborate on "Introduce soc runtime detection" in the commit message. What can it be used for? |
@jenswi-linaro How about adding the following: |
|
Add i.MX7D support. - Add register definition - Add gpcv2 to powerup and powerdown cpu - Introduce soc runtime detection, the final goal is to support i.MX family using one image, but still far from it. Now using the runtime detection, we could remove the CFG_MX[6,7][x] to simplify the code, such as in imx psci cpu on/off using one function to support 6Q/7D without CFG_[X]. - Add PSCI cpu/off/affinity The scripts to build 7dsdb image. make PLATFORM=imx-mx7dsabresd \ mkimage -A arm -O linux -C none -a 0xbdffffe4 -e 0xbe000000 \ -d out/arm-plat-imx/core/tee.bin uTee-7d Signed-off-by: Peng Fan <peng.fan@nxp.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
Per @jenswi-linaro comments, add more commits log and tags applied |
Thanks @MrVan! |
@WANGAlfred English only, please. |
Add i.MX7D support.
The scripts to build 7dsdb image.
make PLATFORM=imx-mx7dsabresd ARCH=arm CFG_PAGEABLE_ADDR=0
CFG_NS_ENTRY_ADDR=0x80800000 CFG_DT=y DEBUG=y CFG_TEE_CORE_LOG_LEVEL=4
CFG_PSCI_ARM32=y CFG_MX7=y CFG_DDR_SIZE=0x40000000
CFG_TZC380=y
./mkimage -A arm -O linux -C none -a 0xbdffffe4 -e 0xbe000000
-d out/arm-plat-imx/core/tee.bin uTee-7d
Signed-off-by: Peng Fan
<peng.fan@nxp.com>