From 010a73d3b68602a0d4af51a88922b3b50fe3ba82 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 20 Dec 2015 17:55:21 -0600 Subject: [PATCH] TMS570: A little more selftest structure --- arch/arm/src/tms570/chip/tms570_pbist.h | 40 ++++++++++++++++- arch/arm/src/tms570/tms570_boot.c | 35 ++++++++++++--- arch/arm/src/tms570/tms570_selftest.c | 58 +++++++++++++++++++++++++ arch/arm/src/tms570/tms570_selftest.h | 54 +++++++++++++++++++++-- 4 files changed, 176 insertions(+), 11 deletions(-) diff --git a/arch/arm/src/tms570/chip/tms570_pbist.h b/arch/arm/src/tms570/chip/tms570_pbist.h index 666e71de8b7..1cc8387428b 100644 --- a/arch/arm/src/tms570/chip/tms570_pbist.h +++ b/arch/arm/src/tms570/chip/tms570_pbist.h @@ -52,6 +52,31 @@ /**************************************************************************************************** * Pre-processor Definitions ****************************************************************************************************/ +/* PBIST RAM Groups */ + +#define PBIST_PBIST_ROM_GROUP 1 /* ROM */ +#define PBIST_STC_ROM_GROUP 2 /* ROM */ +#define PBIST_DCAN1_RAM_GROUP 3 /* Dual-port */ +#define PBIST_DCAN2_RAM_GROUP 4 /* Dual-port */ +#define PBIST_ESRAM1_RAM_GROUP 6 /* Single-port */ +#define PBIST_MIBSPI1_RAM_GROUP 7 /* Dual-port */ +#define PBIST_VIM_RAM_GROUP 10 /* Dual-port */ +#define PBIST_MIBADC_RAM_GROUP 11 /* Dual-port */ +#define PBIST_N2HET_RAM_GROUP 13 /* Dual-port */ +#define PBIST_HET_TU_RAM_GROUP 14 /* Dual-port */ + +/* RAM Group Select */ + +#define PBIST_PBIST_ROM_RGS 1 /* ROM */ +#define PBIST_STC_ROM_RGS 2 /* ROM */ +#define PBIST_DCAN1_RAM_RGS 3 /* Dual-port */ +#define PBIST_DCAN2_RAM_RGS 4 /* Dual-port */ +#define PBIST_ESRAM1_RAM_RGS 6 /* Single-port */ +#define PBIST_MIBSPI1_RAM_RGS 7 /* Dual-port */ +#define PBIST_VIM_RAM_RGS 8 /* Dual-port */ +#define PBIST_MIBADC_RAM_RGS 9 /* Dual-port */ +#define PBIST_N2HET_RAM_RGS 11 /* Dual-port */ +#define PBIST_HET_TU_RAM_RGS 12 /* Dual-port */ /* Register Offsets *********************************************************************************/ @@ -125,8 +150,21 @@ #define PBIST_ROM_ /* ROM Algorithm Mask Register */ #define PBIST_ALGO_ + /* RAM Info Mask Lower Register */ -#define PBIST_RINFOL_ + +#define PBIST_RINFOL(n) (1 << ((n)-1)) /* Bit n: Select RAM group n+1 */ +# define PBIST_RINFOL_PBIST_ROM PBIST_RINFOL(PBIST_PBIST_ROM_GROUP) +# define PBIST_RINFOL_STC_ROM PBIST_RINFOL(PBIST_STC_ROM_GROUP) +# define PBIST_RINFOL_DCAN1_RAM PBIST_RINFOL(PBIST_DCAN1_RAM_GROUP) +# define PBIST_RINFOL_DCAN2_RAM PBIST_RINFOL(PBIST_DCAN2_RAM_GROUP) +# define PBIST_RINFOL_ESRAM1_RAM PBIST_RINFOL(PBIST_ESRAM1_RAM_GROUP) +# define PBIST_RINFOL_MIBSPI1_RAM PBIST_RINFOL(PBIST_MIBSPI1_RAM_GROUP) +# define PBIST_RINFOL_VIM_RAM PBIST_RINFOL(PBIST_VIM_RAM_GROUP) +# define PBIST_RINFOL_MIBADC_RAM PBIST_RINFOL(PBIST_MIBADC_RAM_GROUP) +# define PBIST_RINFOL_N2HET_RAM PBIST_RINFOL(PBIST_N2HET_RAM_GROUP) +# define PBIST_RINFOL_HET_TU_RAM PBIST_RINFOL(PBIST_HET_TU_RAM_GROUP) + /* RAM Info Mask Upper Register */ #define PBIST_RINFOU_ diff --git a/arch/arm/src/tms570/tms570_boot.c b/arch/arm/src/tms570/tms570_boot.c index 593c2432131..b1c51f46bef 100644 --- a/arch/arm/src/tms570/tms570_boot.c +++ b/arch/arm/src/tms570/tms570_boot.c @@ -225,13 +225,13 @@ void arm_boot(void) #ifdef CONFIG_TMS570_SELFTEST /* Run a diagnostic check on the memory self-test controller. */ -# warning Missing logic - /* Run PBIST on CPU RAM. */ -# warning Missing logic + tms570_memtest_selftest(); - /* Disable PBIST clocks and disable memory self-test mode */ -# warning Missing logic + /* Run the memory selftest on CPU RAM. */ + + tms570_memtest_start(PBIST_RINFOL_ESRAM1_RAM) + ASSERT(tms570_memtest_complete() == 0); #endif /* CONFIG_TMS570_SELFTEST */ /* Initialize CPU RAM. */ @@ -244,11 +244,34 @@ void arm_boot(void) #ifdef CONFIG_TMS570_SELFTEST /* Perform PBIST on all dual-port memories */ -#warning Missing logic + + tms570_memtest_start(PBIST_RINFOL_ESRAM1_RAM) + + tms570_memtest_start(PBIST_RINFOL_VIM_RAM +#ifdef CONFIG_TMS570_DCAN1 + | PBIST_RINFOL_DCAN1_RAM +#endif +#ifdef CONFIG_TMS570_DCAN2 + | PBIST_RINFOL_DCAN2_RAM +#endif +#ifdef CONFIG_TMS570_MIBASPI1 + | PBIST_RINFOL_MIBSPI1_RAM +#endif +#ifdef CONFIG_TMS570_MIBASPI1 + | PBIST_RINFOL_MIBADC_RAM +#endif +#ifdef CONFIG_TMS570_N2HET + | PBIST_RINFOL_N2HET_RAM + | PBIST_RINFOL_HET_TU_RAM +#endif + ); /* Test the CPU ECC mechanism for RAM accesses. */ #warning Missing logic + /* Wait for the memory test to complete */ + + ASSERT(tms570_memtest_complete() == 0); #endif /* CONFIG_TMS570_SELFTEST */ /* Release the MibSPI1 modules from local reset. */ diff --git a/arch/arm/src/tms570/tms570_selftest.c b/arch/arm/src/tms570/tms570_selftest.c index a3f0b906f44..16cee512115 100644 --- a/arch/arm/src/tms570/tms570_selftest.c +++ b/arch/arm/src/tms570/tms570_selftest.c @@ -57,6 +57,60 @@ * Public Functions ****************************************************************************/ +/**************************************************************************** + * Name: tms570_memtest_selftest + * + * Description: + * Run a diagnostic check on the memory self-test controller. + * + * This function chooses a RAM test algorithm and runs it on an on-chip + * ROM. The memory self-test is expected to fail. The function ensures + * that the PBIST controller is capable of detecting and indicating a + * memory self-test failure. + * + ****************************************************************************/ + +void tms570_memtest_selftest(void) +{ +#warning Missing Logic +} + +/**************************************************************************** + * Name: tms570_memtest_start + * + * Description: + * Start the memory test on the selecte set of RAMs. This test does not + * return until the memory test is completed. + * + * Input Paramters: + * rinfol - The OR of each RAM grouping bit. See the PBIST_RINFOL* + * definitions in chip/tms570_pbist.h + * + ****************************************************************************/ + +void tms570_memtest_start(uint32_t rinfol) +{ +#warning Missing Logic +} + +/**************************************************************************** + * Name: tms570_memtest_complete + * + * Description: + * Wait for memory self-test to complete and return the result. + * + * Returned Value: + * Zero (OK) if the test passed; A negated errno value is returned on + * any failure. + * + ****************************************************************************/ + +int tms570_memtest_complete(void) +{ +#warning Missing Logic + return 0; +} + /**************************************************************************** * Name: tms570_efc_selftest_start * @@ -78,6 +132,10 @@ void tms570_efc_selftest_start(void) * Description: * Wait for eFuse controller self-test to complete and return the result. * + * Returned Value: + * Zero (OK) if the test passed; A negated errno value is returned on + * any failure. + * ****************************************************************************/ int tms570_efc_selftest_complete(void) diff --git a/arch/arm/src/tms570/tms570_selftest.h b/arch/arm/src/tms570/tms570_selftest.h index 6d4a8f64539..783928043f3 100644 --- a/arch/arm/src/tms570/tms570_selftest.h +++ b/arch/arm/src/tms570/tms570_selftest.h @@ -42,6 +42,8 @@ #include +#ifdef CONFIG_TMS570_SELFTEST + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -65,6 +67,49 @@ extern "C" * Public Function Prototypes ****************************************************************************/ +/**************************************************************************** + * Name: tms570_memtest_selftest + * + * Description: + * Run a diagnostic check on the memory self-test controller. + * + * This function chooses a RAM test algorithm and runs it on an on-chip + * ROM. The memory self-test is expected to fail. The function ensures + * that the PBIST controller is capable of detecting and indicating a + * memory self-test failure. + * + ****************************************************************************/ + +void tms570_memtest_selftest(void); + +/**************************************************************************** + * Name: tms570_memtest_start + * + * Description: + * Start the memory test on the selected set of RAMs. + * + * Input Paramters: + * rinfol - The OR of each RAM grouping bit. See the PBIST_RINFOL* + * definitions in chip/tms570_pbist.h + * + ****************************************************************************/ + +void tms570_memtest_start(uint32_t rinfol); + +/**************************************************************************** + * Name: tms570_memtest_complete + * + * Description: + * Wait for memory self-test to complete and return the result. + * + * Returned Value: + * Zero (OK) if the test passed; A negated errno value is returned on + * any failure. + * + ****************************************************************************/ + +int tms570_memtest_complete(void); + /**************************************************************************** * Name: tms570_efc_selftest_start * @@ -75,9 +120,7 @@ extern "C" * ****************************************************************************/ -#ifdef CONFIG_TMS570_SELFTEST void tms570_efc_selftest_start(void); -#endif /**************************************************************************** * Name: tms570_efc_selftest_complete @@ -85,11 +128,13 @@ void tms570_efc_selftest_start(void); * Description: * Wait for eFuse controller self-test to complete and return the result. * + * Returned Value: + * Zero (OK) if the test passed; A negated errno value is returned on + * any failure. + * ****************************************************************************/ -#ifdef CONFIG_TMS570_SELFTEST int tms570_efc_selftest_complete(void); -#endif #undef EXTERN #if defined(__cplusplus) @@ -97,4 +142,5 @@ int tms570_efc_selftest_complete(void); #endif #endif /* __ASSEMBLY__ */ +#endif /* CONFIG_TMS570_SELFTEST */ #endif /* __ARCH_ARM_SRC_TMS570_TMS570_SELFTEST_H */