summaryrefslogtreecommitdiffstats
path: root/nuttx/arch/arm
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/arch/arm')
-rw-r--r--nuttx/arch/arm/src/kinetis/Make.defs6
-rw-r--r--nuttx/arch/arm/src/kinetis/kinetis_clockconfig.c373
-rwxr-xr-xnuttx/arch/arm/src/kinetis/kinetis_config.h168
-rw-r--r--nuttx/arch/arm/src/kinetis/kinetis_internal.h26
-rwxr-xr-xnuttx/arch/arm/src/kinetis/kinetis_lowputc.c263
-rw-r--r--nuttx/arch/arm/src/kinetis/kinetis_mcg.c139
-rw-r--r--nuttx/arch/arm/src/kinetis/kinetis_mcg.h8
-rwxr-xr-xnuttx/arch/arm/src/kinetis/kinetis_start.c42
-rw-r--r--nuttx/arch/arm/src/kinetis/kinetis_uart.h4
9 files changed, 850 insertions, 179 deletions
diff --git a/nuttx/arch/arm/src/kinetis/Make.defs b/nuttx/arch/arm/src/kinetis/Make.defs
index 8f2c67aa1f..d0c9d94b61 100644
--- a/nuttx/arch/arm/src/kinetis/Make.defs
+++ b/nuttx/arch/arm/src/kinetis/Make.defs
@@ -57,10 +57,10 @@ endif
# Required Kinetis files
CHIP_ASRCS =
-#CHIP_CSRCS = kinetis_allocateheap.c kinetis_can.c kinetis_gpio.c kinetis_lowputc.c \
+#CHIP_CSRCS = kinetis_allocateheap.c kinetis_can.c kinetis_gpio.c \
# kinetis_serial.c kinetis_spi.c kinetis_ssp.c kinetis_timerisr.c
-CHIP_CSRCS = kinetis_clrpend.c kinetis_idle.c kinetis_irq.c kinetis_mcg.c kinetis_start.c \
- kinetis_wdog.c
+CHIP_CSRCS = kinetis_clockconfig.c kinetis_clrpend.c kinetis_idle.c kinetis_irq.c \
+ kinetis_lowputc.c kinetis_start.c kinetis_wdog.c
# Configuration-dependent Kinetis files
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_clockconfig.c b/nuttx/arch/arm/src/kinetis/kinetis_clockconfig.c
new file mode 100644
index 0000000000..11e5af48fb
--- /dev/null
+++ b/nuttx/arch/arm/src/kinetis/kinetis_clockconfig.c
@@ -0,0 +1,373 @@
+/****************************************************************************
+ * arch/arm/src/kinetis/kinetis_clockconfig.c
+ * arch/arm/src/chip/kinetis_clockconfig.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * 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 <nuttx/config.h>
+
+#include <arch/board/board.h>
+
+#include "up_arch.h"
+
+#include "kinetis_internal.h"
+#include "kinetis_mcg.h"
+#include "kinetis_sim.h"
+#include "kinetis_fmc.h"
+#include "kinetis_llwu.h"
+
+/****************************************************************************
+ * Private Definitions
+ ****************************************************************************/
+
+#ifndef CONFIG_BOOT_RAMFUNCS
+# error "CONFIG_BOOT_RAMFUNCS must be defined for this logic"
+#endif
+
+/****************************************************************************
+ * Private Function Prototypes
+ ****************************************************************************/
+
+static void __ramfunc__
+kinesis_setdividers(uint32_t div1, uint32_t div2, uint32_t div3, uint32_t div4);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Public Data
+ ****************************************************************************/
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: kinesis_portclocks
+ *
+ * Description:
+ * Enable all of the port clocks
+ *
+ ****************************************************************************/
+
+static inline void kinesis_portclocks(void)
+{
+ uint32_t regval;
+
+ /* Enable all of the port clocks */
+
+ regval = getreg32(KINETIS_SIM_SCGC5);
+ regval |= (SIM_SCGC5_PORTA | SIM_SCGC5_PORTB | SIM_SCGC5_PORTC |
+ SIM_SCGC5_PORTD | SIM_SCGC5_PORTE);
+ putreg32(regval, KINETIS_SIM_SCGC5);
+}
+
+/****************************************************************************
+ * Name: kinesis_setdividers
+ *
+ * Description:
+ * "This routine must be placed in RAM. It is a workaround for errata e2448.
+ * Flash prefetch must be disabled when the flash clock divider is changed.
+ * This cannot be performed while executing out of flash. There must be a
+ * short delay after the clock dividers are changed before prefetch can be
+ * re-enabled."
+ *
+ ****************************************************************************/
+
+static void __ramfunc__
+kinesis_setdividers(uint32_t div1, uint32_t div2, uint32_t div3, uint32_t div4)
+{
+ uint32_t regval;
+ int i;
+
+ /* Save the current value of the Flash Access Protection Register */
+
+ regval = getreg32(KINETIS_FMC_PFAPR);
+
+ /* Set M0PFD through M7PFD to 1 to disable prefetch */
+
+ putreg32(FMC_PFAPR_M7PFD | FMC_PFAPR_M6PFD | FMC_PFAPR_M5PFD |
+ FMC_PFAPR_M4PFD | FMC_PFAPR_M3PFD | FMC_PFAPR_M2PFD |
+ FMC_PFAPR_M1PFD | FMC_PFAPR_M0PFD,
+ KINETIS_FMC_PFAPR);
+
+ /* Set clock dividers to desired value */
+
+ putreg32(SIM_CLKDIV1_OUTDIV1(div1) | SIM_CLKDIV1_OUTDIV2(div2) |
+ SIM_CLKDIV1_OUTDIV3(div3) | SIM_CLKDIV1_OUTDIV4(div4),
+ KINETIS_SIM_CLKDIV1);
+
+ /* Wait for dividers to change */
+
+ for (i = 0 ; i < div4 ; i++);
+
+ /* Re-store the saved value of FMC_PFAPR */
+
+ putreg32(regval, KINETIS_FMC_PFAPR);
+}
+
+/****************************************************************************
+ * Name: kinetis_pllconfig
+ *
+ * Description:
+ * Initialize the PLL using the settings in board.h. This assumes that
+ * the MCG is in default FLL Engaged Internal (FEI mode) out of reset.
+ *
+ ****************************************************************************/
+
+void kinetis_pllconfig(void)
+{
+ uint32_t regval32;
+ uint8_t regval8;
+
+ /* Transition to FLL Bypassed External (FBE) mode */
+
+#ifdef BOARD_EXTCLOCK
+ /* IRCS = 0 (Internal Reference Clock Select)
+ * LP = 0 (Low Power Select)
+ * EREFS = 0 (External Reference Select)
+ * HGO = 0 (High Gain Oscillator Select)
+ * RANGE = 0 (Oscillator of 32 kHz to 40 kHz)
+ */
+
+ putreg8(0, KINETIS_MCG_C2);
+#else
+ /* Enable external oscillator:
+ *
+ * IRCS = 0 (Internal Reference Clock Select)
+ * LP = 0 (Low Power Select)
+ * EREFS = 1 (External Reference Select)
+ * HGO = 1 (High Gain Oscillator Select)
+ * RANGE = 2 (Oscillator of 8 MHz to 32 MHz)
+ */
+
+ putreg8(MCG_C2_EREFS | MCG_C2_HGO | MCG_C2_RANGE_VHIGH, KINETIS_MCG_C2);
+#endif
+
+ /* Released latched state of oscillator and GPIO */
+
+ regval32 = getreg32(KINETIS_SIM_SCGC4);
+ regval32 |= SIM_SCGC4_LLWU;
+ putreg32(regval32, KINETIS_SIM_SCGC4);
+
+ regval8 = getreg8(KINETIS_LLWU_CS);
+ regval8 |= LLWU_CS_ACKISO;
+ putreg8(regval8, KINETIS_LLWU_CS);
+
+ /* Select external oscillator and Reference Divider and clear IREFS to
+ * start the external oscillator.
+ *
+ * IREFSTEN = 0 (Internal Reference Stop Enable)
+ * IRCLKEN = 0 (Internal Reference Clock Enable)
+ * IREFS = 0 (Internal Reference Select)
+ * FRDIV = 3 (FLL External Reference Divider, RANGE!=0 divider=256)
+ * CLKS = 2 (Clock Source Select, External reference clock)
+ */
+
+ putreg8(MCG_C1_FRDIV_DIV256 | MCG_C1_CLKS_EXTREF, KINETIS_MCG_C1);
+
+ /* If we aren't using an oscillator input we don't need to wait for the
+ * oscillator to initialize
+ */
+
+#ifndef BOARD_EXTCLOCK
+ while ((getreg8(KINETIS_MCG_S) & MCG_S_OSCINIT) == 0);
+#endif
+
+ /* Wait for Reference clock Status bit to clear */
+
+ while ((getreg8(KINETIS_MCG_S) & MCG_S_IREFST) != 0);
+
+ /* Wait for clock status bits to show that the clock source is the
+ * external reference clock.
+ */
+
+ while ((getreg8(KINETIS_MCG_S) & MCG_S_CLKST_MASK) != MCG_S_CLKST_EXTREF);
+
+ /* We are now in FLL Bypassed External (FBE) mode. Configure PLL
+ * reference clock divider:
+ *
+ * PLLCLKEN = 0
+ * PLLSTEN = 0
+ * PRDIV = Determined by PLL reference clock frequency
+ *
+ * Either the external clock or crystal frequency is used to select the
+ * PRDIV value. Only reference clock frequencies are supported that will
+ * produce a 2MHz reference clock to the PLL.
+ */
+
+ putreg8(MCG_C5_PRDIV(BOARD_PRDIV), KINETIS_MCG_C5);
+
+ /* Ensure that MCG_C6 is at the reset default of 0: LOLIE disabled, PLL
+ * disabled, clk monitor disabled, PLL VCO divider cleared.
+ */
+
+ putreg8(0, KINETIS_MCG_C6);
+
+ /* Set system options dividers based on settings from the board.h file.
+ *
+ * MCG = PLL
+ * Core = MCG / BOARD_OUTDIV1
+ * bus = MCG / BOARD_OUTDIV1
+ * FlexBus = MCG / BOARD_OUTDIV1
+ * Flash clock = MCG/2 / BOARD_OUTDIV1
+ */
+
+ kinesis_setdividers(BOARD_OUTDIV1, BOARD_OUTDIV2, BOARD_OUTDIV3, BOARD_OUTDIV4);
+
+ /* Set the VCO divider, VDIV, is defined in the board.h file. VDIV
+ * selects the amount to divide the VCO output of the PLL. The VDIV bits
+ * establish the multiplication factor applied to the reference clock
+ * frequency. Also set
+ *
+ * LOLIE = 0 (Loss of Lock Interrrupt Enable)
+ * PLLS = 1 (PLL Select)
+ * CME = 0 (Clock Monitor Enable)
+ */
+
+ putreg8(MCG_C6_PLLS | MCG_C6_VDIV(BOARD_VDIV), KINETIS_MCG_C6);
+
+ /* Wait for the PLL status bit to set */
+
+ while ((getreg8(KINETIS_MCG_S) & MCG_S_PLLST) == 0);
+
+ /* Wait for the PLL LOCK bit to set */
+
+ while ((getreg8(KINETIS_MCG_S) & MCG_S_LOCK) == 0);
+
+ /* We are now running in PLL Bypassed External (PBE) mode. Transition to
+ * PLL Engaged External (PEE) mode by setting CLKS to 0
+ */
+
+ regval8 = getreg8(KINETIS_MCG_C1);
+ regval8 &= ~MCG_C1_CLKS_MASK;
+ putreg8(regval8, KINETIS_MCG_C1);
+
+ /* Wait for clock status bits to update */
+
+ while ((getreg8(KINETIS_MCG_S) & MCG_S_CLKST_MASK) != MCG_S_CLKST_PLL);
+
+ /* We are now running in PLL Engaged External (PEE) mode. */
+}
+
+/****************************************************************************
+ * Name: kinetis_traceconfig
+ *
+ * Description:
+ * Enable trace clocks.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_KINETIS_TRACE
+static inline void kinetis_traceconfig(void)
+{
+ uint32_t regval;
+
+ /* Set the trace clock to the core clock frequency in the SIM SOPT2 register */
+
+ regval = getreg32(KINETIS_SIM_SOPT2);
+ regval |= SIM_SOPT2_TRACECLKSEL;
+ putreg32(regval, KINETIS_SIM_SOPT2);
+
+ /* Enable the TRACE_CLKOUT pin function on PTA6 (alt7 function) */
+
+ kinetis_gpioconfig(GPIO_TRACE);
+}
+#else
+# define kinetis_traceconfig()
+#endif
+
+/****************************************************************************
+ * Name: kinetis_fbconfig
+ *
+ * Description:
+ * Enable FlexBus clocking.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_KINETIS_FLEXBUS
+static inline void kinetis_fbconfig(void)
+{
+ uint32_t regval;
+
+ /* Enable the clock to the FlexBus module */
+
+ regval = getreg32(KINETIS_SIM_SCGC7);
+ regval |= SIM_SCGC7_FLEXBUS;
+ putreg32(regval, KINETIS_SIM_SCGC7);
+
+ /* Enable the FB_CLKOUT function on PTC3 (alt5 function) */
+
+ kinetis_gpioconfig(GPIO_FBCLKOUT);
+}
+#else
+# define kinetis_fbconfig()
+#endif
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: kinetis_clockconfig
+ *
+ * Description:
+ * Called to initialize the Kinetis chip. This does whatever setup is
+ * needed to put the MCU in a usable state. This includes the
+ * initialization of clocking using the settings in board.h.
+ *
+ ****************************************************************************/
+
+void kinetis_clockconfig(void)
+{
+ /* Enable all of the port clocks */
+
+ kinesis_portclocks();
+
+ /* Configure the PLL based on settings in the board.h file */
+
+ kinetis_pllconfig();
+
+ /* For debugging, we will normally want to enable the trace clock and/or
+ * the FlexBus clock.
+ */
+
+ kinetis_traceconfig();
+ kinetis_fbconfig();
+}
+
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_config.h b/nuttx/arch/arm/src/kinetis/kinetis_config.h
new file mode 100755
index 0000000000..aa05e8fda1
--- /dev/null
+++ b/nuttx/arch/arm/src/kinetis/kinetis_config.h
@@ -0,0 +1,168 @@
+/************************************************************************************
+ * arch/arm/src/kinetis/kinetis_config.h
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * 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_KINETISXX_KINETIS_CONFIG_H
+#define __ARCH_ARM_SRC_KINETISXX_KINETIS_CONFIG_H
+
+/************************************************************************************
+ * Included Files
+ ************************************************************************************/
+
+#include <nuttx/config.h>
+#include <arch/board/board.h>
+
+#include "chip.h"
+
+/************************************************************************************
+ * Pre-processor Definitions
+ ************************************************************************************/
+
+/* Configuration *********************************************************************/
+/* Make that no unsupport UARTs are enabled */
+
+#ifndef KINETIS_NISO7816
+# define KINETIS_NISO7816 0
+#endif
+
+#if (KINETIS_NISO7816 + KINETIS_NUART) < 6
+# undef CONFIG_KINETIS_UART5
+# if (KINETIS_NISO7816 + KINETIS_NUART) < 5
+# undef CONFIG_KINETIS_UART4
+# if (KINETIS_NISO7816 + KINETIS_NUART) < 4
+# undef CONFIG_KINETIS_UART3
+# if (KINETIS_NISO7816 + KINETIS_NUART) < 3
+# undef CONFIG_KINETIS_UART2
+# if (KINETIS_NISO7816 + KINETIS_NUART) < 2
+# undef CONFIG_KINETIS_UART1
+# if (KINETIS_NISO7816 + KINETIS_NUART) < 1
+# undef CONFIG_KINETIS_UART0
+# endif
+# endif
+# endif
+# endif
+# endif
+#endif
+
+/* Are any UARTs enabled? */
+
+#undef HAVE_UART
+#if defined(CONFIG_KINETIS_UART0) || defined(CONFIG_KINETIS_UART1) || \
+ defined(CONFIG_KINETIS_UART2) || defined(CONFIG_KINETIS_UART3) || \
+ defined(CONFIG_KINETIS_UART5)
+# define HAVE_UART 1
+#endif
+
+/* Is there a serial console? There should be at most one defined. It could be on
+ * any UARTn, n=0,1,2,3,4,5
+ */
+
+#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_KINETIS_UART0)
+# undef CONFIG_UART1_SERIAL_CONSOLE
+# undef CONFIG_UART2_SERIAL_CONSOLE
+# undef CONFIG_UART3_SERIAL_CONSOLE
+# undef CONFIG_UART4_SERIAL_CONSOLE
+# undef CONFIG_UART5_SERIAL_CONSOLE
+# define HAVE_CONSOLE 1
+#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_KINETIS_UART1)
+# undef CONFIG_UART0_SERIAL_CONSOLE
+# undef CONFIG_UART2_SERIAL_CONSOLE
+# undef CONFIG_UART3_SERIAL_CONSOLE
+# undef CONFIG_UART4_SERIAL_CONSOLE
+# undef CONFIG_UART5_SERIAL_CONSOLE
+# define HAVE_CONSOLE 1
+#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_KINETIS_UART2)
+# undef CONFIG_UART0_SERIAL_CONSOLE
+# undef CONFIG_UART1_SERIAL_CONSOLE
+# undef CONFIG_UART3_SERIAL_CONSOLE
+# undef CONFIG_UART4_SERIAL_CONSOLE
+# undef CONFIG_UART5_SERIAL_CONSOLE
+# define HAVE_CONSOLE 1
+#elif defined(CONFIG_UART3_SERIAL_CONSOLE) && defined(CONFIG_KINETIS_UART3)
+# undef CONFIG_UART0_SERIAL_CONSOLE
+# undef CONFIG_UART1_SERIAL_CONSOLE
+# undef CONFIG_UART2_SERIAL_CONSOLE
+# undef CONFIG_UART4_SERIAL_CONSOLE
+# undef CONFIG_UART5_SERIAL_CONSOLE
+# define HAVE_CONSOLE 1
+#elif defined(CONFIG_UART4_SERIAL_CONSOLE) && defined(CONFIG_KINETIS_UART4)
+# undef CONFIG_UART0_SERIAL_CONSOLE
+# undef CONFIG_UART1_SERIAL_CONSOLE
+# undef CONFIG_UART2_SERIAL_CONSOLE
+# undef CONFIG_UART3_SERIAL_CONSOLE
+# undef CONFIG_UART5_SERIAL_CONSOLE
+# define HAVE_CONSOLE 1
+#elif defined(CONFIG_UART5_SERIAL_CONSOLE) && defined(CONFIG_KINETIS_UART5)
+# undef CONFIG_UART0_SERIAL_CONSOLE
+# undef CONFIG_UART1_SERIAL_CONSOLE
+# undef CONFIG_UART2_SERIAL_CONSOLE
+# undef CONFIG_UART3_SERIAL_CONSOLE
+# undef CONFIG_UART4_SERIAL_CONSOLE
+# define HAVE_CONSOLE 1
+#else
+# undef CONFIG_UART0_SERIAL_CONSOLE
+# undef CONFIG_UART1_SERIAL_CONSOLE
+# undef CONFIG_UART2_SERIAL_CONSOLE
+# undef CONFIG_UART3_SERIAL_CONSOLE
+# undef CONFIG_UART4_SERIAL_CONSOLE
+# undef CONFIG_UART5_SERIAL_CONSOLE
+# undef HAVE_CONSOLE
+#endif
+
+/* Check UART flow control (Not yet supported) */
+
+# undef CONFIG_UART0_FLOWCONTROL
+# undef CONFIG_UART1_FLOWCONTROL
+# undef CONFIG_UART2_FLOWCONTROL
+# undef CONFIG_UART3_FLOWCONTROL
+# undef CONFIG_UART4_FLOWCONTROL
+# undef CONFIG_UART5_FLOWCONTROL
+
+/************************************************************************************
+ * Public Types
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Data
+ ************************************************************************************/
+
+/************************************************************************************
+ * Inline Functions
+ ************************************************************************************/
+
+/************************************************************************************
+ * Public Functions
+ ************************************************************************************/
+
+#endif /* __ARCH_ARM_SRC_KINETISXX_KINETIS_CONFIG_H */
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_internal.h b/nuttx/arch/arm/src/kinetis/kinetis_internal.h
index 8f6a911a3c..7b0383cdf0 100644
--- a/nuttx/arch/arm/src/kinetis/kinetis_internal.h
+++ b/nuttx/arch/arm/src/kinetis/kinetis_internal.h
@@ -310,6 +310,32 @@ EXTERN void kinetis_clockconfig(void);
EXTERN void kinetis_lowsetup(void);
+/******************************************************************************
+ * Name: kinetis_uartreset
+ *
+ * Description:
+ * Reset a UART.
+ *
+ ******************************************************************************/
+
+#ifdef HAVE_UART_DEVICE
+EXTERN void kinetis_uartreset(uintptr_t uart_base);
+#endif
+
+/******************************************************************************
+ * Name: kinetis_uartconfigure
+ *
+ * Description:
+ * Configure a UART as a RS-232 UART.
+ *
+ ******************************************************************************/
+
+#ifdef HAVE_UART_DEVICE
+EXTERN void kinetis_uartconfigure(uintptr_t uart_base, uint32_t baudrate,
+ unsigned int parity, unsigned int nbits,
+ bool stop2);
+#endif
+
/************************************************************************************
* Name: kinetis_wddisable
*
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_lowputc.c b/nuttx/arch/arm/src/kinetis/kinetis_lowputc.c
new file mode 100755
index 0000000000..e403d4706d
--- /dev/null
+++ b/nuttx/arch/arm/src/kinetis/kinetis_lowputc.c
@@ -0,0 +1,263 @@
+/**************************************************************************
+ * arch/arm/src/kinetis/kinetis_lowputc.c
+ *
+ * Copyright (C) 2011 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ *
+ * 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 <nuttx/config.h>
+
+#include <stdint.h>
+
+#include <arch/irq.h>
+#include <arch/board/board.h>
+
+#include "up_internal.h"
+#include "up_arch.h"
+
+#include "kinetis_config.h"
+#include "kinetis_internal.h"
+#include "kinetis_uart.h"
+
+/**************************************************************************
+ * Private Definitions
+ **************************************************************************/
+
+/* Select UART parameters for the selected console */
+
+#if defined(CONFIG_UART0_SERIAL_CONSOLE)
+# define CONSOLE_BASE KINETIS_UART0_BASE
+# define CONSOLE_BAUD CONFIG_UART0_BAUD
+# define CONSOLE_BITS CONFIG_UART0_BITS
+# define CONSOLE_PARITY CONFIG_UART0_PARITY
+# define CONSOLE_2STOP CONFIG_UART0_2STOP
+#elif defined(CONFIG_UART1_SERIAL_CONSOLE)
+# define CONSOLE_BASE KINETIS_UART1_BASE
+# define CONSOLE_BAUD CONFIG_UART1_BAUD
+# define CONSOLE_BITS CONFIG_UART1_BITS
+# define CONSOLE_PARITY CONFIG_UART1_PARITY
+# define CONSOLE_2STOP CONFIG_UART1_2STOP
+#elif defined(CONFIG_UART2_SERIAL_CONSOLE)
+# define CONSOLE_BASE KINETIS_UART2_BASE
+# define CONSOLE_BAUD CONFIG_UART2_BAUD
+# define CONSOLE_BITS CONFIG_UART2_BITS
+# define CONSOLE_PARITY CONFIG_UART2_PARITY
+# define CONSOLE_2STOP CONFIG_UART2_2STOP
+#elif defined(CONFIG_UART3_SERIAL_CONSOLE)
+# define CONSOLE_BASE KINETIS_UART3_BASE
+# define CONSOLE_BAUD CONFIG_UART3_BAUD
+# define CONSOLE_BITS CONFIG_UART3_BITS
+# define CONSOLE_PARITY CONFIG_UART3_PARITY
+# define CONSOLE_2STOP CONFIG_UART3_2STOP
+#elif defined(CONFIG_UART4_SERIAL_CONSOLE)
+# define CONSOLE_BASE KINETIS_UART4_BASE
+# define CONSOLE_BAUD CONFIG_UART4_BAUD
+# define CONSOLE_BITS CONFIG_UART4_BITS
+# define CONSOLE_PARITY CONFIG_UART4_PARITY
+# define CONSOLE_2STOP CONFIG_UART4_2STOP
+#elif defined(CONFIG_UART5_SERIAL_CONSOLE)
+# define CONSOLE_BASE KINETIS_UART5_BASE
+# define CONSOLE_BAUD CONFIG_UART5_BAUD
+# define CONSOLE_BITS CONFIG_UART5_BITS
+# define CONSOLE_PARITY CONFIG_UART5_PARITY
+# define CONSOLE_2STOP CONFIG_UART5_2STOP
+#elif defined(HAVE_CONSOLE)
+# error "No CONFIG_UARTn_SERIAL_CONSOLE Setting"
+#endif
+
+/* Get word length setting for the console */
+# warning "Missing logic"
+
+/* Get parity setting for the console */
+# warning "Missing logic"
+
+/* Get stop-bit setting for the console and UART0-3 */
+# warning "Missing logic"
+
+/* Select a divider to produce the UART CLK */
+# warning "Missing logic"
+
+/**************************************************************************
+ * Private Types
+ **************************************************************************/
+
+/**************************************************************************
+ * Private Function Prototypes
+ **************************************************************************/
+
+/**************************************************************************
+ * Global Variables
+ **************************************************************************/
+
+/**************************************************************************
+ * Private Variables
+ **************************************************************************/
+
+/**************************************************************************
+ * Private Functions
+ **************************************************************************/
+
+/**************************************************************************
+ * Public Functions
+ **************************************************************************/
+
+/**************************************************************************
+ * Name: up_lowputc
+ *
+ * Description:
+ * Output one byte on the serial console
+ *
+ **************************************************************************/
+
+void up_lowputc(char ch)
+{
+#if defined HAVE_UART && defined HAVE_CONSOLE
+# warning "Missing logic"
+#endif
+}
+
+/**************************************************************************
+ * Name: kinetis_lowsetup
+ *
+ * Description:
+ * This performs basic initialization of the UART used for the serial
+ * console. Its purpose is to get the console output availabe as soon
+ * as possible.
+ *
+ * The UART0/1/2/3 peripherals are configured using the following registers:
+ * 1. Power: In the PCONP register, set bits PCUART0/1/2/3.
+ * On reset, UART0 and UART 1 are enabled (PCUART0 = 1 and PCUART1 = 1)
+ * and UART2/3 are disabled (PCUART1 = 0 and PCUART3 = 0).
+ * 2. Peripheral clock: In the PCLKSEL0 register, select PCLK_UART0 and
+ * PCLK_UART1; in the PCLKSEL1 register, select PCLK_UART2 and PCLK_UART3.
+ * 3. Baud rate: In the LCR register, set bit DLAB = 1. This enables access
+ * to registers DLL and DLM for setting the baud rate. Also, if needed,
+ * set the fractional baud rate in the fractional divider
+ * 4. UART FIFO: Use bit FIFO enable (bit 0) in FCR register to
+ * enable FIFO.
+ * 5. Pins: Select UART pins through the PINSEL registers and pin modes
+ * through the PINMODE registers. UART receive pins should not have
+ * pull-down resistors enabled.
+ * 6. Interrupts: To enable UART interrupts set bit DLAB = 0 in the LCRF
+ * register. This enables access to IER. Interrupts are enabled
+ * in the NVIC using the appropriate Interrupt Set Enable register.
+ * 7. DMA: UART transmit and receive functions can operate with the
+ * GPDMA controller.
+ *
+ **************************************************************************/
+
+void kinetis_lowsetup(void)
+{
+#ifdef HAVE_UART
+ uint32_t regval;
+
+ /* Step 1: Enable power for all console UART and disable power for
+ * other UARTs
+ */
+
+# warning "Missing logic"
+
+ /* Step 2: Enable peripheral clocking for the console UART and disable
+ * clocking for all other UARTs
+ */
+
+# warning "Missing logic"
+
+ /* Configure UART pins for the selected CONSOLE */
+
+#if defined(CONFIG_UART0_SERIAL_CONSOLE)
+ kinetis_configgpio(GPIO_UART0_TXD);
+ kinetis_configgpio(GPIO_UART0_RXD);
+#elif defined(CONFIG_UART1_SERIAL_CONSOLE)
+ kinetis_configgpio(GPIO_UART1_TXD);
+ kinetis_configgpio(GPIO_UART1_RXD);
+#elif defined(CONFIG_UART2_SERIAL_CONSOLE)
+ kinetis_configgpio(GPIO_UART2_TXD);
+ kinetis_configgpio(GPIO_UART2_RXD);
+#elif defined(CONFIG_UART3_SERIAL_CONSOLE)
+ kinetis_configgpio(GPIO_UART3_TXD);
+ kinetis_configgpio(GPIO_UART3_RXD);
+#elif defined(CONFIG_UART4_SERIAL_CONSOLE)
+ kinetis_configgpio(GPIO_UART3_TXD);
+ kinetis_configgpio(GPIO_UART3_RXD);
+#elif defined(CONFIG_UART5_SERIAL_CONSOLE)
+ kinetis_configgpio(GPIO_UART3_TXD);
+ kinetis_configgpio(GPIO_UART3_RXD);
+#endif
+
+ /* Configure the console (only) */
+
+#if defined(HAVE_CONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG)
+
+ kinetis_uartconfigure(CONSOLE_BASE, CONSOLE_BAUD, CONSOLE_PARITY,
+ CONSOLE_BITS, CONSOLE_2STOP);
+#endif
+#endif /* HAVE_UART */
+}
+
+/******************************************************************************
+ * Name: kinetis_uartreset
+ *
+ * Description:
+ * Reset a UART.
+ *
+ ******************************************************************************/
+
+#ifdef HAVE_UART_DEVICE
+void kinetis_uartreset(uintptr_t uart_base)
+{
+# warning "Missing logic"
+}
+#endif
+
+/******************************************************************************
+ * Name: kinetis_uartconfigure
+ *
+ * Description:
+ * Configure a UART as a RS-232 UART.
+ *
+ ******************************************************************************/
+
+#ifdef HAVE_UART_DEVICE
+void kinetis_uartconfigure(uintptr_t uart_base, uint32_t baudrate,
+ unsigned int parity, unsigned int nbits,
+ bool stop2)
+{
+# warning "Missing logic"
+}
+#endif
+
+
+
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_mcg.c b/nuttx/arch/arm/src/kinetis/kinetis_mcg.c
deleted file mode 100644
index c02b0a49c1..0000000000
--- a/nuttx/arch/arm/src/kinetis/kinetis_mcg.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/****************************************************************************
- * arch/arm/src/kinetis/kinetis_mcg.c
- * arch/arm/src/chip/kinetis_mcg.c
- *
- * Copyright (C) 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
- *
- * 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 <nuttx/config.h>
-
-#include "up_arch.h"
-
-#include "kinetis_internal.h"
-#include "kinetis_mcg.h"
-#include "kinetis_sim.h"
-#include "kinetis_fmc.h"
-
-/****************************************************************************
- * Private Definitions
- ****************************************************************************/
-
-#ifndef CONFIG_BOOT_RAMFUNCS
-# error "CONFIG_BOOT_RAMFUNCS must be defined for this logic"
-#endif
-
-/****************************************************************************
- * Private Function Prototypes
- ****************************************************************************/
-
-static void __ramfunc__
-kinesis_setdividers(uint32_t div1, uint32_t div2, uint32_t div3, uint32_t div4);
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Public Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: kinesis_setdividers
- *
- * Description:
- * "This routine must be placed in RAM. It is a workaround for errata e2448.
- * Flash prefetch must be disabled when the flash clock divider is changed.
- * This cannot be performed while executing out of flash. There must be a
- * short delay after the clock dividers are changed before prefetch can be
- * re-enabled."
- *
- ****************************************************************************/
-
-static void __ramfunc__
-kinesis_setdividers(uint32_t div1, uint32_t div2, uint32_t div3, uint32_t div4)
-{
- uint32_t regval;
- int i;
-
- /* Save the current value of the Flash Access Protection Register */
-
- regval = getreg32(KINETIS_FMC_PFAPR);
-
- /* Set M0PFD through M7PFD to 1 to disable prefetch */
-
- putreg32(FMC_PFAPR_M7PFD | FMC_PFAPR_M6PFD | FMC_PFAPR_M5PFD |
- FMC_PFAPR_M4PFD | FMC_PFAPR_M3PFD | FMC_PFAPR_M2PFD |
- FMC_PFAPR_M1PFD | FMC_PFAPR_M0PFD,
- KINETIS_FMC_PFAPR);
-
- /* Set clock dividers to desired value */
-
- putreg32(SIM_CLKDIV1_OUTDIV1(div1) | SIM_CLKDIV1_OUTDIV2(div2) |
- SIM_CLKDIV1_OUTDIV3(div3) | SIM_CLKDIV1_OUTDIV4(div4),
- KINETIS_SIM_CLKDIV1);
-
- /* Wait for dividers to change */
-
- for (i = 0 ; i < div4 ; i++);
-
- /* Re-store saved value of FMC_PFAPR */
-
- putreg32(regval, KINETIS_FMC_PFAPR);
-}
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/************************************************************************************
- * Name: kinetis_clockconfig
- *
- * Description:
- * Called to initialize the Kinetis chip. This does whatever setup is needed to
- * put the MCU in a usable state. This includes the initialization of clocking
- * using the settings in board.h.
- *
- ************************************************************************************/
-
-void kinetis_clockconfig(void)
-{
-#warning "Missing logic"
-}
-
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_mcg.h b/nuttx/arch/arm/src/kinetis/kinetis_mcg.h
index cb6d22c4ae..6f0ba652cc 100644
--- a/nuttx/arch/arm/src/kinetis/kinetis_mcg.h
+++ b/nuttx/arch/arm/src/kinetis/kinetis_mcg.h
@@ -133,8 +133,8 @@
/* MCG Control 5 Register */
#define MCG_C5_PRDIV_SHIFT (0) /* Bits 0-4: PLL External Reference Divider */
-#define MCG_C5_PRDIV_MASK (31 << PRDIV_SHIFT)
-# define MCG_C5_PRDIV(n) (((n)-1) << PRDIV_SHIFT) /* Divide factor n=1..25 */
+#define MCG_C5_PRDIV_MASK (31 << MCG_C5_PRDIV_SHIFT)
+# define MCG_C5_PRDIV(n) (((n)-1) << MCG_C5_PRDIV_SHIFT) /* Divide factor n=1..25 */
#define MCG_C5_PLLSTEN (1 << 5) /* Bit 5: PLL Stop Enable */
#define MCG_C5_PLLCLKEN (1 << 6) /* Bit 6: PLL Clock Enable */
/* Bit 7: Reserved */
@@ -142,8 +142,8 @@
/* MCG Control 6 Register */
#define MCG_C6_VDIV_SHIFT (0) /* Bits 0-4: VCO Divider */
-#define MCG_C6_VDIV_MASK (31 << PRDIV_SHIFT)
-# define MCG_C6_VDIV(n) (((n)-24) << PRDIV_SHIFT) /* Divide factor n=24..55 */
+#define MCG_C6_VDIV_MASK (31 << MCG_C6_VDIV_SHIFT)
+# define MCG_C6_VDIV(n) (((n)-24) << MCG_C6_VDIV_SHIFT) /* Divide factor n=24..55 */
#define MCG_C6_CME (1 << 5) /* Bit 5: Clock Monitor Enable */
#define MCG_C6_PLLS (1 << 6) /* Bit 6: PLL Select */
#define MCG_C6_LOLIE (1 << 7) /* Bit 7: Loss of Lock Interrrupt Enable */
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_start.c b/nuttx/arch/arm/src/kinetis/kinetis_start.c
index 403424da2d..1baa5e6260 100755
--- a/nuttx/arch/arm/src/kinetis/kinetis_start.c
+++ b/nuttx/arch/arm/src/kinetis/kinetis_start.c
@@ -69,20 +69,6 @@
****************************************************************************/
/****************************************************************************
- * Name: showprogress
- *
- * Description:
- * Print a character on the UART to show boot status.
- *
- ****************************************************************************/
-
-#ifdef CONFIG_DEBUG
-# define showprogress(c) up_lowputc(c)
-#else
-# define showprogress(c)
-#endif
-
-/****************************************************************************
* Public Functions
****************************************************************************/
@@ -103,12 +89,6 @@ void __start(void)
kinetis_wddisable();
- /* Configure the uart so that we can get debug output as soon as possible */
-
- kinetis_clockconfig();
- kinetis_lowsetup();
- showprogress('A');
-
/* Clear .bss. We'll do this inline (vs. calling memset) just to be
* certain that there are no issues with the state of global variables.
*/
@@ -117,7 +97,6 @@ void __start(void)
{
*dest++ = 0;
}
- showprogress('B');
/* Move the intialized data section from his temporary holding spot in
* FLASH into the correct place in SRAM. The correct place in SRAM is
@@ -129,7 +108,6 @@ void __start(void)
{
*dest++ = *src++;
}
- showprogress('C');
/* Copy any necessary code sections from FLASH to RAM. The correct
* destination in SRAM is geive by _sramfuncs and _eramfuncs. The
@@ -143,26 +121,28 @@ void __start(void)
*dest++ = *src++;
}
#endif
- showprogress('E');
-
- /* Perform early serial initialization */
+ /* Perform clock and Kinetis module initialization */
+
+ kinetis_clockconfig();
+
+ /* Configure the uart and perform early serial initialization so that we
+ * can get debug output as soon as possible.
+ */
+ kinetis_lowsetup();
#ifdef CONFIG_USE_EARLYSERIALINIT
up_earlyserialinit();
#endif
- showprogress('F');
- /* Initialize onboard resources */
+ /* Initialize other on-board resources */
kinetis_boardinitialize();
- showprogress('G');
- showprogress('\r');
- showprogress('\n');
/* Show reset status */
- dbg("Reset status: %02x:%02x\n", getreg8(KINETIS_SMC_SRSH), getreg8(KINETIS_SMC_SRSL));
+ dbg("Reset status: %02x:%02x\n",
+ getreg8(KINETIS_SMC_SRSH), getreg8(KINETIS_SMC_SRSL));
/* Then start NuttX */
diff --git a/nuttx/arch/arm/src/kinetis/kinetis_uart.h b/nuttx/arch/arm/src/kinetis/kinetis_uart.h
index af28dcbfcb..f407bb7de7 100644
--- a/nuttx/arch/arm/src/kinetis/kinetis_uart.h
+++ b/nuttx/arch/arm/src/kinetis/kinetis_uart.h
@@ -408,7 +408,7 @@
# define UART_PFIFO_RXFIFOSIZE_8 (2 << UART_PFIFO_RXFIFOSIZE_SHIFT) /* 8 */
# define UART_PFIFO_RXFIFOSIZE_16 (3 << UART_PFIFO_RXFIFOSIZE_SHIFT) /* 16 */
# define UART_PFIFO_RXFIFOSIZE_32 (4 << UART_PFIFO_RXFIFOSIZE_SHIFT) /* 32 */
-# define UART_PFIFO_RXFIFOSIZE_16 (5 << UART_PFIFO_RXFIFOSIZE_SHIFT) /* 64 */
+# define UART_PFIFO_RXFIFOSIZE_64 (5 << UART_PFIFO_RXFIFOSIZE_SHIFT) /* 64 */
# define UART_PFIFO_RXFIFOSIZE_128 (6 << UART_PFIFO_RXFIFOSIZE_SHIFT) /* 128 */
#define UART_PFIFO_RXFE (1 << 3) /* Bit 3: Receive FIFO Enable */
#define UART_PFIFO_TXFIFOSIZE_SHIFT (4) /* Bits 4-6: Transmit FIFO. Buffer Depth */
@@ -418,7 +418,7 @@
# define UART_PFIFO_TXFIFOSIZE_8 (2 << UART_PFIFO_TXFIFOSIZE_SHIFT) /* 8 */
# define UART_PFIFO_TXFIFOSIZE_16 (3 << UART_PFIFO_TXFIFOSIZE_SHIFT) /* 16 */
# define UART_PFIFO_TXFIFOSIZE_32 (4 << UART_PFIFO_TXFIFOSIZE_SHIFT) /* 32 */
-# define UART_PFIFO_TXFIFOSIZE_16 (5 << UART_PFIFO_TXFIFOSIZE_SHIFT) /* 64 */
+# define UART_PFIFO_TXFIFOSIZE_64 (5 << UART_PFIFO_TXFIFOSIZE_SHIFT) /* 64 */
# define UART_PFIFO_TXFIFOSIZE_128 (6 << UART_PFIFO_TXFIFOSIZE_SHIFT) /* 128 */
#define UART_PFIFO_TXFE (1 << 7) /* Bit 7: Transmit FIFO Enable */