i.MX6 Add more debug instrumentation; Fix setting of CCM register.

This commit is contained in:
Gregory Nutt 2016-03-31 10:49:35 -06:00
parent 756e6050e4
commit 9a9566faba
5 changed files with 80 additions and 3 deletions

View File

@ -398,12 +398,14 @@ void up_boot(void)
*/
imx_setupmappings();
imx_lowputc('A');
/* Provide a special mapping for the OCRAM interrupt vector positioned in
* high memory.
*/
imx_vectormapping();
imx_lowputc('B');
#ifdef CONFIG_ARCH_RAMFUNCS
/* Copy any necessary code sections from FLASH to RAM. The correct
@ -417,11 +419,14 @@ void up_boot(void)
*dest++ = *src++;
}
imx_lowputc('C');
/* Flush the copied RAM functions into physical RAM so that will
* be available when fetched into the I-Cache.
*/
arch_clean_dcache((uintptr_t)&_sramfuncs, (uintptr_t)&_eramfuncs)
imx_lowputc('D');
#endif
/* Setup up vector block. _vector_start and _vector_end are exported from
@ -429,19 +434,23 @@ void up_boot(void)
*/
imx_copyvectorblock();
imx_lowputc('E');
/* Disable the watchdog timer */
imx_wdtdisable();
imx_lowputc('F');
/* Initialize clocking to settings provided by board-specific logic */
imx_clockconfig();
imx_lowputc('G');
#ifdef CONFIG_ARCH_FPU
/* Initialize the FPU */
arm_fpuconfig();
imx_lowputc('H');
#endif
/* Perform board-specific initialization, This must include:
@ -455,6 +464,7 @@ void up_boot(void)
*/
imx_board_initialize();
imx_lowputc('I');
#ifdef NEED_SDRAM_REMAPPING
/* SDRAM was configured in a temporary state to support low-level
@ -463,6 +473,7 @@ void up_boot(void)
*/
imx_remap();
imx_lowputc('J');
#endif
#ifdef CONFIG_BOOT_SDRAM_DATA
@ -471,11 +482,13 @@ void up_boot(void)
*/
arm_data_initialize();
imx_lowputc('K');
#endif
/* Perform common, low-level chip initialization (might do nothing) */
imx_lowsetup();
imx_lowputc('L');
#ifdef USE_EARLYSERIALINIT
/* Perform early serial initialization if we are going to use the serial
@ -483,5 +496,7 @@ void up_boot(void)
*/
imx_earlyserialinit();
imx_lowputc('M');
#endif
imx_lowputc('\n');
}

View File

@ -81,7 +81,7 @@ void imx_clockconfig(void)
/* Make certain that the ipg_clk is enabled */
regval = getreg32(IMX_CCM_CCGR5);
regval &= (CCM_CCGR5_CG12_MASK);
regval &= ~(CCM_CCGR5_CG12_MASK);
regval |= CCM_CCGR5_CG12(CCM_CCGR_ALLMODES);
putreg32(regval, IMX_CCM_CCGR5);
}

View File

@ -53,6 +53,8 @@
#include "imx_gpio.h"
#include "imx_lowputc.h"
#include "up_internal.h"
#include <arch/board/board.h> /* Include last: has dependencies */
/****************************************************************************
@ -158,6 +160,7 @@ static const struct uart_config_s g_console_config =
void imx_lowsetup(void)
{
#ifndef CONFIG_SUPPRESS_UART_CONFIG
#ifdef IMX_HAVE_UART
uint32_t regval;
@ -287,6 +290,7 @@ void imx_lowsetup(void)
(void)imx_uart_configure(IMX_CONSOLE_VBASE, &g_console_config);
#endif
#endif /* IMX_HAVE_UART */
#endif /* CONFIG_SUPPRESS_UART_CONFIG */
}
/************************************************************************************
@ -566,4 +570,48 @@ int imx_uart_configure(uint32_t base, FAR const struct uart_config_s *config)
return OK;
}
#endif /* IMX_HAVE_UART */
#endif /* IMX_HAVE_UART */
/************************************************************************************
* Name: imx_lowputc
*
* Description:
* Output a byte with as few system dependencies as possible
*
************************************************************************************/
#if defined(IMX_HAVE_UART) && defined(CONFIG_DEBUG)
void imx_lowputc(int ch)
{
/* Poll the TX fifo trigger level bit of the UART status register. When the TXFE
* bit is non-zero, the TX Buffer FIFO is empty.
*/
while ((getreg32(IMX_CONSOLE_VBASE + UART_USR2_OFFSET) & UART_USR2_TXFE) == 0);
/* If the character to output is a newline, then pre-pend a carriage return */
if (ch == '\n')
{
/* Send the carrage return by writing it into the UART_TXD register. */
putreg32((uint32_t)'\r', IMX_CONSOLE_VBASE + UART_TXD_OFFSET);
/* Wait for the tranmsit regiser to be emptied. When the TXFE bit is non-zero,
* the TX Buffer FIFO is empty.
*/
while ((getreg32(IMX_CONSOLE_VBASE + UART_USR2_OFFSET) & UART_USR2_TXFE) == 0);
}
/* Send the character by writing it into the UART_TXD register. */
putreg32((uint32_t)ch, IMX_CONSOLE_VBASE + UART_TXD_OFFSET);
/* Wait for the tranmsit regiser to be emptied. When the TXFE bit is non-zero,
* the TX Buffer FIFO is empty.
*/
while ((getreg32(IMX_CONSOLE_VBASE + UART_USR2_OFFSET) & UART_USR2_TXFE) == 0);
}
#endif

View File

@ -95,4 +95,18 @@ void imx_lowsetup(void);
int imx_uart_configure(uint32_t base, FAR const struct uart_config_s *config);
#endif
/************************************************************************************
* Name: imx_lowputc
*
* Description:
* Output a byte with as few system dependencies as possible
*
************************************************************************************/
#if defined(IMX_HAVE_UART) && defined(CONFIG_DEBUG)
void imx_lowputc(int ch);
#else
# define imx_lowputc(ch)
#endif
#endif /* __ARCH_ARM_SRC_IMX6_IMX_LOWPUTC_H */

View File

@ -540,8 +540,8 @@ static inline void imx_waittxready(struct imx_uart_s *priv)
static int imx_setup(struct uart_dev_s *dev)
{
#ifndef CONFIG_SUPPRESS_UART_CONFIG
struct imx_uart_s *priv = (struct imx_uart_s *)dev->priv;
#ifndef CONFIG_SUPPRESS_UART_CONFIG
struct uart_config_s config;
int ret;