diff --git a/arch/arm/src/tms570/Make.defs b/arch/arm/src/tms570/Make.defs index c1e97b9aa8..b713324ba5 100644 --- a/arch/arm/src/tms570/Make.defs +++ b/arch/arm/src/tms570/Make.defs @@ -106,3 +106,7 @@ CHIP_CSRCS = tms570_boot.c tms570_clockconfig.c tms570_irq.c ifneq ($(CONFIG_SCHED_TICKLESS),y) CHIP_CSRCS += tms570_timerisr.c endif + +ifneq ($(CONFIG_TMS570_SELFTEST),y) +CHIP_CSRCS += tms570_selftest.c +endif diff --git a/arch/arm/src/tms570/chip/tms570_iomm.h b/arch/arm/src/tms570/chip/tms570_iomm.h index cbf38a3d86..bafd17420a 100644 --- a/arch/arm/src/tms570/chip/tms570_iomm.h +++ b/arch/arm/src/tms570/chip/tms570_iomm.h @@ -153,10 +153,17 @@ #define IOMM_REVISION_ /* Boot Mode Register */ #define IOMM_BOOT_ + /* Kicker Register 0 */ -#define IOMM_KICK0_ + +#define IOMM_KICK0_UNLOCK 0x83e70b13 /* Unlock value */ +#define IOMM_KICK0_LOCK 0x00000000 /* Any other value locks */ + /* Kicker Register 1 */ -#define IOMM_KICK1_ + +#define IOMM_KICK1_UNLOCK 0x95a4f1e0 /* Unlock value */ +#define IOMM_KICK1_LOCK 0x00000000 /* Any other value locks */ + /* Error Raw Status / Set Register */ #define IOMM_ERRRAWSTATUS_ /* Error Enabled Status / Clear Register */ diff --git a/arch/arm/src/tms570/tms570_clockconfig.c b/arch/arm/src/tms570/tms570_clockconfig.c index ec5206d8e5..8408f08579 100644 --- a/arch/arm/src/tms570/tms570_clockconfig.c +++ b/arch/arm/src/tms570/tms570_clockconfig.c @@ -46,6 +46,7 @@ #include #include +#include #include "up_arch.h" @@ -54,6 +55,8 @@ #include "chip/tms570_flash.h" #include "chip/tms570_iomm.h" #include "chip/tms570_pinmux.h" + +#include "tms570_selftest.h" #include "tms570_clockconfig.h" #include @@ -253,10 +256,22 @@ static void tms570_io_multiplex(void) { int i; + /* Enable access to pin multiplexing registers */ + + putreg32(IOMM_KICK0_UNLOCK, TMS570_IOMM_KICK0); + putreg32(IOMM_KICK1_UNLOCK, TMS570_IOMM_KICK1); + + /* Configure each pin selected by the board-specific logic */ + for (i = 0; i < NPINMUX; i++) { tms570_pin_multiplex(&g_pinmux_table[i]); } + + /* Disable access to pin multiplexing registers */ + + putreg32(IOMM_KICK0_LOCK, TMS570_IOMM_KICK0); + putreg32(IOMM_KICK1_LOCK, TMS570_IOMM_KICK1); } /**************************************************************************** @@ -496,11 +511,9 @@ void tms570_clockconfig(void) #ifdef CONFIG_TMS570_SELFTEST /* Run eFuse controller start-up checks and start eFuse controller ECC - * self-test. This includes a check for the eFuse controller error - * outputs to be stuck-at-zero. - */ + * self-test.*/ -# warning Missing Logic + tms570_efc_selftest_start(); #endif /* CONFIG_TMS570_SELFTEST */ /* Enable clocks to peripherals and release peripheral reset */ @@ -513,8 +526,8 @@ void tms570_clockconfig(void) #ifdef CONFIG_TMS570_SELFTEST /* Wait for eFuse controller self-test to complete and check results */ -# warning Missing Logic + ASSERT(tms570_efc_selftest_complete() == 0); #endif /* Set up flash address and data wait states. */ diff --git a/arch/arm/src/tms570/tms570_clockconfig.h b/arch/arm/src/tms570/tms570_clockconfig.h index b7c1c664f5..40255154bd 100644 --- a/arch/arm/src/tms570/tms570_clockconfig.h +++ b/arch/arm/src/tms570/tms570_clockconfig.h @@ -1,4 +1,4 @@ -/************************************************************************************ +/**************************************************************************** * arch/arm/src/tms570/tms570_clockconfig.h * * Copyright (C) 2015 Gregory Nutt. All rights reserved. @@ -31,35 +31,23 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ #ifndef __ARCH_ARM_SRC_TMS570_TMS570_CLOCKCONFIG_H #define __ARCH_ARM_SRC_TMS570_TMS570_CLOCKCONFIG_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -/************************************************************************************ - * Inline Functions - ************************************************************************************/ +/**************************************************************************** + * Public Data + ****************************************************************************/ #ifndef __ASSEMBLY__ -/************************************************************************************ - * Public Data - ************************************************************************************/ - #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" @@ -69,11 +57,11 @@ extern "C" #define EXTERN extern #endif -/************************************************************************************ +/**************************************************************************** * Public Function Prototypes - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Name: tms570_clockconfig * * Description: @@ -81,7 +69,7 @@ extern "C" * put the SoC in a usable state. This includes, but is not limited to, the * initialization of clocking using the settings in the board.h header file. * - ************************************************************************************/ + ****************************************************************************/ void tms570_clockconfig(void); diff --git a/arch/arm/src/tms570/tms570_selftest.c b/arch/arm/src/tms570/tms570_selftest.c new file mode 100644 index 0000000000..a3f0b906f4 --- /dev/null +++ b/arch/arm/src/tms570/tms570_selftest.c @@ -0,0 +1,89 @@ +/**************************************************************************** + * arch/arm/src/tms570/tms570_selftest.c + * + * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Most logic in this file was leveraged from TI's Project0 which has a + * compatible BSD license: + * + * Copyright (c) 2012, Texas Instruments Incorporated + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include "tms570_selftest.h" + +#ifdef CONFIG_TMS570_SELFTEST + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: tms570_efc_selftest_start + * + * Description: + * Run eFuse controller start-up checks and start eFuse controller ECC + * self-test. This includes a check for the eFuse controller error + * outputs to be stuck-at-zero. + * + ****************************************************************************/ + +void tms570_efc_selftest_start(void) +{ +#warning Missing Logic +} + +/**************************************************************************** + * Name: tms570_efc_selftest_complete + * + * Description: + * Wait for eFuse controller self-test to complete and return the result. + * + ****************************************************************************/ + +int tms570_efc_selftest_complete(void) +{ +#warning Missing Logic + return 0; +} + +#endif /* CONFIG_TMS570_SELFTEST */ diff --git a/arch/arm/src/tms570/tms570_selftest.h b/arch/arm/src/tms570/tms570_selftest.h new file mode 100644 index 0000000000..6d4a8f6453 --- /dev/null +++ b/arch/arm/src/tms570/tms570_selftest.h @@ -0,0 +1,100 @@ +/**************************************************************************** + * arch/arm/src/tms570/tms570_selftest.h + * + * Copyright (C) 2015 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_TMS570_TMS570_SELFTEST_H +#define __ARCH_ARM_SRC_TMS570_TMS570_SELFTEST_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#ifndef __ASSEMBLY__ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: tms570_efc_selftest_start + * + * Description: + * Run eFuse controller start-up checks and start eFuse controller ECC + * self-test. This includes a check for the eFuse controller error + * outputs to be stuck-at-zero. + * + ****************************************************************************/ + +#ifdef CONFIG_TMS570_SELFTEST +void tms570_efc_selftest_start(void); +#endif + +/**************************************************************************** + * Name: tms570_efc_selftest_complete + * + * Description: + * Wait for eFuse controller self-test to complete and return the result. + * + ****************************************************************************/ + +#ifdef CONFIG_TMS570_SELFTEST +int tms570_efc_selftest_complete(void); +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __ARCH_ARM_SRC_TMS570_TMS570_SELFTEST_H */