Commit c06564713c792cff80674d02d24bbb7873c56367
1 parent
606469c948
Exists in
smarc_8mm-imx_v2019.04_4.19.35_1.1.0
and in
1 other branch
MLK-22279-3 imx8mn: override env_get_offset and env_get_location
To use one defconfig for all boot device, we have to runtime set env offset and return env medium according to the boot device. This patch overrides the env_get_offset and env_get_location to implement the feature. Signed-off-by: Ye Li <ye.li@nxp.com> (cherry picked from commit c25239a695feaad68051bab3ef098eef31d07f09)
Showing 1 changed file with 58 additions and 0 deletions Side-by-side Diff
arch/arm/mach-imx/imx8m/soc.c
... | ... | @@ -24,6 +24,7 @@ |
24 | 24 | #ifdef CONFIG_IMX_SEC_INIT |
25 | 25 | #include <fsl_caam.h> |
26 | 26 | #endif |
27 | +#include <environment.h> | |
27 | 28 | |
28 | 29 | DECLARE_GLOBAL_DATA_PTR; |
29 | 30 | |
... | ... | @@ -904,4 +905,61 @@ |
904 | 905 | writel((tca_en << 31) |(tca_hr <<16) | tca_rt, (ulong)reg_base + 0x30); |
905 | 906 | } |
906 | 907 | } |
908 | + | |
909 | +#if defined(CONFIG_IMX8MN) | |
910 | +enum env_location env_get_location(enum env_operation op, int prio) | |
911 | +{ | |
912 | + enum boot_device dev = get_boot_device(); | |
913 | + enum env_location env_loc = ENVL_UNKNOWN; | |
914 | + | |
915 | + if (prio) | |
916 | + return env_loc; | |
917 | + | |
918 | + switch (dev) { | |
919 | +#ifdef CONFIG_ENV_IS_IN_SPI_FLASH | |
920 | + case QSPI_BOOT: | |
921 | + env_loc = ENVL_SPI_FLASH; | |
922 | + break; | |
923 | +#endif | |
924 | +#ifdef CONFIG_ENV_IS_IN_NAND | |
925 | + case NAND_BOOT: | |
926 | + env_loc = ENVL_NAND; | |
927 | + break; | |
928 | +#endif | |
929 | +#ifdef CONFIG_ENV_IS_IN_MMC | |
930 | + case SD1_BOOT: | |
931 | + case SD2_BOOT: | |
932 | + case SD3_BOOT: | |
933 | + case MMC1_BOOT: | |
934 | + case MMC2_BOOT: | |
935 | + case MMC3_BOOT: | |
936 | + env_loc = ENVL_MMC; | |
937 | + break; | |
938 | +#endif | |
939 | + default: | |
940 | +#ifdef CONFIG_ENV_DEFAULT_NOWHERE | |
941 | + env_loc = ENVL_NOWHERE; | |
942 | +#endif | |
943 | + break; | |
944 | + } | |
945 | + | |
946 | + return env_loc; | |
947 | +} | |
948 | + | |
949 | +#ifndef ENV_IS_EMBEDDED | |
950 | +long long env_get_offset(long long defautl_offset) | |
951 | +{ | |
952 | + enum boot_device dev = get_boot_device(); | |
953 | + | |
954 | + switch (dev) { | |
955 | + case NAND_BOOT: | |
956 | + return (60 << 20); /* 60MB offset for NAND */ | |
957 | + default: | |
958 | + break; | |
959 | + } | |
960 | + | |
961 | + return defautl_offset; | |
962 | +} | |
963 | +#endif | |
964 | +#endif |