Commit bef92e215d945cc574399c1a1b00a3a76d35aa03

Authored by Axel Beierlein
Committed by Wolfgang Denk
1 parent 0800707b6d
Exists in master and in 55 other branches 8qm-imx_v2020.04_5.4.70_2.3.0, emb_lf_v2022.04, emb_lf_v2023.04, imx_v2015.04_4.1.15_1.0.0_ga, pitx_8mp_lf_v2020.04, smarc-8m-android-10.0.0_2.6.0, smarc-8m-android-11.0.0_2.0.0, smarc-8mp-android-11.0.0_2.0.0, smarc-emmc-imx_v2014.04_3.10.53_1.1.0_ga, smarc-emmc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx-l5.0.0_1.0.0-ga, smarc-imx6_v2018.03_4.14.98_2.0.0_ga, smarc-imx7_v2017.03_4.9.11_1.0.0_ga, smarc-imx7_v2018.03_4.14.98_2.0.0_ga, smarc-imx_v2014.04_3.14.28_1.0.0_ga, smarc-imx_v2015.04_4.1.15_1.0.0_ga, smarc-imx_v2017.03_4.9.11_1.0.0_ga, smarc-imx_v2017.03_4.9.88_2.0.0_ga, smarc-imx_v2017.03_o8.1.0_1.3.0_8m, smarc-imx_v2018.03_4.14.78_1.0.0_ga, smarc-m6.0.1_2.1.0-ga, smarc-n7.1.2_2.0.0-ga, smarc-rel_imx_4.1.15_2.0.0_ga, smarc_8m-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8m-imx_v2019.04_4.19.35_1.1.0, smarc_8m_00d0-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga, smarc_8mm-imx_v2019.04_4.19.35_1.1.0, smarc_8mm-imx_v2020.04_5.4.24_2.1.0, smarc_8mp_lf_v2020.04, smarc_8mq-imx_v2020.04_5.4.24_2.1.0, smarc_8mq_lf_v2020.04, ti-u-boot-2015.07, u-boot-2013.01.y, v2013.10, v2013.10-smarct33, v2013.10-smartmen, v2014.01, v2014.04, v2014.04-smarct33, v2014.04-smarct33-emmc, v2014.04-smartmen, v2014.07, v2014.07-smarct33, v2014.07-smartmen, v2015.07-smarct33, v2015.07-smarct33-emmc, v2015.07-smarct4x, v2016.05-dlt, v2016.05-smarct3x, v2016.05-smarct3x-emmc, v2016.05-smarct4x, v2017.01-smarct3x, v2017.01-smarct3x-emmc, v2017.01-smarct4x

Adding bootlimit/bootcount feature for MPC5XXX on TQM5200 Boards

Tested with TQM5200S on STK52XX.200 Board

Signed-off-by: Axel Beierlein <belatronix@web.de>

Showing 3 changed files with 22 additions and 0 deletions Side-by-side Diff

... ... @@ -135,4 +135,24 @@
135 135 #endif
136 136 }
137 137 #endif
  138 +
  139 +#ifdef CONFIG_BOOTCOUNT_LIMIT
  140 +
  141 +void bootcount_store (ulong a)
  142 +{
  143 + volatile ulong *save_addr = (volatile ulong *)(MPC5XXX_CDM_BRDCRMB);
  144 +
  145 + *save_addr = (BOOTCOUNT_MAGIC & 0xffff0000) | a;
  146 +}
  147 +
  148 +ulong bootcount_load (void)
  149 +{
  150 + volatile ulong *save_addr = (volatile ulong *)(MPC5XXX_CDM_BRDCRMB);
  151 +
  152 + if ((*save_addr & 0xffff0000) != (BOOTCOUNT_MAGIC & 0xffff0000))
  153 + return 0;
  154 + else
  155 + return (*save_addr & 0x0000ffff);
  156 +}
  157 +#endif /* CONFIG_BOOTCOUNT_LIMIT */
include/configs/TQM5200.h
... ... @@ -55,6 +55,7 @@
55 55 #define CONFIG_PSC_CONSOLE 1 /* console is on PSC1 */
56 56 #define CONFIG_BAUDRATE 115200 /* ... at 115200 bps */
57 57 #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
  58 +#define CONFIG_BOOTCOUNT_LIMIT 1
58 59  
59 60 #ifdef CONFIG_FO300
60 61 #define CFG_DEVICE_NULLDEV 1 /* enable null device */
... ... @@ -137,6 +137,7 @@
137 137 /* Clock Distribution Module */
138 138 #define MPC5XXX_CDM_JTAGID (MPC5XXX_CDM + 0x0000)
139 139 #define MPC5XXX_CDM_PORCFG (MPC5XXX_CDM + 0x0004)
  140 +#define MPC5XXX_CDM_BRDCRMB (MPC5XXX_CDM + 0x0008)
140 141 #define MPC5XXX_CDM_CFG (MPC5XXX_CDM + 0x000c)
141 142 #define MPC5XXX_CDM_48_FDC (MPC5XXX_CDM + 0x0010)
142 143 #define MPC5XXX_CDM_SRESET (MPC5XXX_CDM + 0x0020)