Re: [U-Boot] [PATCH] ARM: mxs: Add mx28evk_auart_console target
Dear Marek I wonder, why dont you add support for the TQ SoM in the first place? I have plans to do it but I only have access to the board at work and I currently am very busy so have limited time testing the board setup, so I don't know when in time I will be able to submit such a patch. Regards Andreas ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH] ARM: mxs: Add mx28evk_auart_console target
The target uses AUART 3 instead of the DUART for console output. Signed-off-by: Andreas Wass andreas.w...@dalelven.com Cc: Fabio Estevam fabio.este...@freescale.com Cc: Marek Vasut ma...@denx.de --- boards.cfg| 1 + include/configs/mxs.h | 7 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/boards.cfg b/boards.cfg index 454da7f..79d6cd8 100644 --- a/boards.cfg +++ b/boards.cfg @@ -203,6 +203,7 @@ mx23evk arm arm926ejs mx23evk freesca m28evk arm arm926ejs m28evk denx mxsm28evk mx28evk arm arm926ejs mx28evk freescale mxsmx28evk:ENV_IS_IN_MMC mx28evk_nand arm arm926ejs mx28evk freescale mxsmx28evk:ENV_IS_IN_NAND +mx28evk_auart_consolearm arm926ejs mx28evk freescale mxs mx28evk:MXS_AUART,MXS_AUART_BASE=MXS_UARTAPP3_BASE,ENV_IS_IN_MMC sc_sps_1 arm arm926ejs sc_sps_1 schulercontrol mxs nhk8815 arm arm926ejs nhk8815 st nomadik nhk8815_onenand arm arm926ejs nhk8815 st nomadik nhk8815:BOOT_ONENAND diff --git a/include/configs/mxs.h b/include/configs/mxs.h index a684166..124dc1e 100644 --- a/include/configs/mxs.h +++ b/include/configs/mxs.h @@ -119,11 +119,16 @@ /* GPIO */ #define CONFIG_MXS_GPIO -/* DUART Serial Driver */ +/* + * DUART Serial Driver. + * Conflicts with AUART driver which can be set by board. + */ +#ifndef CONFIG_MXS_AUART #define CONFIG_PL011_SERIAL #define CONFIG_PL011_CLOCK 2400 #define CONFIG_PL01x_PORTS { (void *)MXS_UARTDBG_BASE } #define CONFIG_CONS_INDEX 0 +#endif /* Default baudrate can be overriden by board! */ #ifndef CONFIG_BAUDRATE #define CONFIG_BAUDRATE115200 -- 1.8.1.4 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH] ARM: mxs: Add mx28evk_auart_console target
Dear Otavio, Some boards don't have the DUART easily available (see STKa28 by TQ-group for instance) while a regular rs232 port is easily accessed. The purpose of this patch is more of a demonstration how to use the AUART driver and was requested by Fabio during the submission of the AUART driver. Best regards Andreas Wass 16 aug 2013 kl. 19:00 skrev Otavio Salvador ota...@ossystems.com.br: On Fri, Aug 16, 2013 at 1:24 PM, Andreas Wass andreas.w...@dalelven.com wrote: The target uses AUART 3 instead of the DUART for console output. Signed-off-by: Andreas Wass andreas.w...@dalelven.com Cc: Fabio Estevam fabio.este...@freescale.com Cc: Marek Vasut ma...@denx.de Why to use AUART for console? can you elaborate it a little more? -- Otavio Salvador O.S. Systems http://www.ossystems.com.brhttp://projetos.ossystems.com.br Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [RFC][PATCH v3] ARM: mxs: Added application UART driver
The driver makes it possible to use an application UART as the U-Boot output console for Freescale i.MX23/i.MX28 devices. Signed-off-by: Andreas Wass andreas.w...@dalelven.com Cc: Fabio Estevam fabio.este...@freescale.com Cc: Marek Vasut ma...@denx.de --- Changes for v2: - Added comment that regs-uartapp.h is pulled from LTIB - BM_ prefixes removed and _MASK suffixes added instead - BP_ prefixes removed and _OFFSET suffixes added instead - BF_ defines removed altogether - CONFIG_MXS_AUART_CLK renamed to MXS_AUART_CLK and guarding ifndef removed - Added comments describing what is set and unset during init of driver - Added newline that was accidently removed from serial.c Changes for v3: - All BV_ values are now on the form (value something) - BV_ prefix removed and double underscore substituted with a single - File comment of mxs_auart.c now attributes what the driver is based on - Uses gd-baudrate instead of CONFIG_BAUDRATE - If gd-baudrate is 0 it reverts back to CONFIG_BAUDRATE - Checks the validity of the div value calculated when setting the baudrate - Magic numbers are now defines instead - Cleanup of comments - Cleanup of commit message arch/arm/include/asm/arch-mxs/regs-uartapp.h | 249 +++ drivers/serial/Makefile | 1 + drivers/serial/mxs_auart.c | 151 drivers/serial/serial.c | 2 + 4 files changed, 403 insertions(+) create mode 100644 arch/arm/include/asm/arch-mxs/regs-uartapp.h create mode 100644 drivers/serial/mxs_auart.c diff --git a/arch/arm/include/asm/arch-mxs/regs-uartapp.h b/arch/arm/include/asm/arch-mxs/regs-uartapp.h new file mode 100644 index 000..1288d18 --- /dev/null +++ b/arch/arm/include/asm/arch-mxs/regs-uartapp.h @@ -0,0 +1,249 @@ +/* + * Freescale MXS UARTAPP Register Definitions + * + * Copyright (C) 2013 Andreas Wass andreas.w...@dalelven.com + * + * Based on code from LTIB: + * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved. + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#ifndef __ARCH_ARM___MXS_UARTAPP_H +#define __ARCH_ARM___MXS_UARTAPP_H + +#include asm/imx-common/regs-common.h + +#ifndef __ASSEMBLY__ +struct mxs_uartapp_regs { + mxs_reg_32(hw_uartapp_ctrl0) + mxs_reg_32(hw_uartapp_ctrl1) + mxs_reg_32(hw_uartapp_ctrl2) + mxs_reg_32(hw_uartapp_linectrl) + mxs_reg_32(hw_uartapp_linectrl2) + mxs_reg_32(hw_uartapp_intr) + mxs_reg_32(hw_uartapp_data) + mxs_reg_32(hw_uartapp_stat) + mxs_reg_32(hw_uartapp_debug) + mxs_reg_32(hw_uartapp_version) + mxs_reg_32(hw_uartapp_autobaud) +}; +#endif + + +#define UARTAPP_CTRL0_SFTRST_MASK (1 31) +#define UARTAPP_CTRL0_CLKGATE_MASK (1 30) +#define UARTAPP_CTRL0_RUN_MASK (1 29) +#define UARTAPP_CTRL0_RX_SOURCE_MASK (1 28) +#define UARTAPP_CTRL0_RXTO_ENABLE_MASK (1 27) +#define UARTAPP_CTRL0_RXTIMEOUT_OFFSET (1 4) +#define UARTAPP_CTRL0_RXTIMEOUT_MASK 0x07FF +#define UARTAPP_CTRL0_XFER_COUNT_OFFSET0 +#define UARTAPP_CTRL0_XFER_COUNT_MASK 0x + +#define UARTAPP_CTRL1_RSVD2_OFFSET 29 +#define UARTAPP_CTRL1_RSVD2_MASK 0xE000 + +#define UARTAPP_CTRL1_RUN_MASK (1 28) +#define UARTAPP_CTRL1_RSVD1_OFFSET 16 +#define UARTAPP_CTRL1_RSVD1_MASK 0x0FFF + +#define UARTAPP_CTRL1_XFER_COUNT_OFFSET0 +#define UARTAPP_CTRL1_XFER_COUNT_MASK 0x + +#define UARTAPP_CTRL2_INVERT_RTS_MASK (1 31) +#define UARTAPP_CTRL2_INVERT_CTS_MASK (1 30) +#define UARTAPP_CTRL2_INVERT_TX_MASK (1 29) +#define UARTAPP_CTRL2_INVERT_RX_MASK (1 28) +#define UARTAPP_CTRL2_RTS_SEMAPHORE_MASK (1 27) +#define UARTAPP_CTRL2_DMAONERR_MASK(1 26) +#define UARTAPP_CTRL2_TXDMAE_MASK (1 25) +#define UARTAPP_CTRL2_RXDMAE_MASK (1 24) +#define UARTAPP_CTRL2_RSVD2_MASK (1 23) +#define UARTAPP_CTRL2_RXIFLSEL_OFFSET 20 +#define UARTAPP_CTRL2_RXIFLSEL_MASK0x0070 + +#define UARTAPP_CTRL2_RXIFLSEL_NOT_EMPTY (0x0 20) +#define UARTAPP_CTRL2_RXIFLSEL_ONE_QUARTER (0x1 20) +#define UARTAPP_CTRL2_RXIFLSEL_ONE_HALF(0x2 20) +#define UARTAPP_CTRL2_RXIFLSEL_THREE_QUARTERS (0x3 20) +#define UARTAPP_CTRL2_RXIFLSEL_SEVEN_EIGHTHS (0x4 20) +#define UARTAPP_CTRL2_RXIFLSEL_INVALID5(0x5 20) +#define UARTAPP_CTRL2_RXIFLSEL_INVALID6
[U-Boot] [RFC][PATCH v4] ARM: mxs: Added application UART driver
The driver makes it possible to use an application UART as the U-Boot output console for Freescale i.MX23/i.MX28 devices. Signed-off-by: Andreas Wass andreas.w...@dalelven.com Cc: Fabio Estevam fabio.este...@freescale.com Cc: Marek Vasut ma...@denx.de --- Changes for v2: - Added comment that regs-uartapp.h is pulled from LTIB - BM_ prefixes removed and _MASK suffixes added instead - BP_ prefixes removed and _OFFSET suffixes added instead - BF_ defines removed altogether - CONFIG_MXS_AUART_CLK renamed to MXS_AUART_CLK and guarding ifndef removed - Added comments describing what is set and unset during init of driver - Added newline that was accidently removed from serial.c Changes for v3: - All BV_ values are now on the form (value something) - BV_ prefix removed and double underscore substituted with a single - File comment of mxs_auart.c now attributes what the driver is based on - Uses gd-baudrate instead of CONFIG_BAUDRATE - If gd-baudrate is 0 it reverts back to CONFIG_BAUDRATE - Checks the validity of the div value calculated when setting the baudrate - Magic numbers are now defines instead - Cleanup of comments - Cleanup of commit message Changes for v4: - Fixed UARTAPP_LINECTRL2_WLEN_*BITS values drivers/serial/Makefile | 1 + drivers/serial/mxs_auart.c | 151 drivers/serial/serial.c | 2 + 4 files changed, 403 insertions(+) create mode 100644 arch/arm/include/asm/arch-mxs/regs-uartapp.h create mode 100644 drivers/serial/mxs_auart.c diff --git a/arch/arm/include/asm/arch-mxs/regs-uartapp.h b/arch/arm/include/asm/arch-mxs/regs-uartapp.h new file mode 100644 index 000..abd62c2 --- /dev/null +++ b/arch/arm/include/asm/arch-mxs/regs-uartapp.h @@ -0,0 +1,249 @@ +/* + * Freescale MXS UARTAPP Register Definitions + * + * Copyright (C) 2013 Andreas Wass andreas.w...@dalelven.com + * + * Based on code from LTIB: + * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved. + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#ifndef __ARCH_ARM___MXS_UARTAPP_H +#define __ARCH_ARM___MXS_UARTAPP_H + +#include asm/imx-common/regs-common.h + +#ifndef __ASSEMBLY__ +struct mxs_uartapp_regs { + mxs_reg_32(hw_uartapp_ctrl0) + mxs_reg_32(hw_uartapp_ctrl1) + mxs_reg_32(hw_uartapp_ctrl2) + mxs_reg_32(hw_uartapp_linectrl) + mxs_reg_32(hw_uartapp_linectrl2) + mxs_reg_32(hw_uartapp_intr) + mxs_reg_32(hw_uartapp_data) + mxs_reg_32(hw_uartapp_stat) + mxs_reg_32(hw_uartapp_debug) + mxs_reg_32(hw_uartapp_version) + mxs_reg_32(hw_uartapp_autobaud) +}; +#endif + + +#define UARTAPP_CTRL0_SFTRST_MASK (1 31) +#define UARTAPP_CTRL0_CLKGATE_MASK (1 30) +#define UARTAPP_CTRL0_RUN_MASK (1 29) +#define UARTAPP_CTRL0_RX_SOURCE_MASK (1 28) +#define UARTAPP_CTRL0_RXTO_ENABLE_MASK (1 27) +#define UARTAPP_CTRL0_RXTIMEOUT_OFFSET (1 4) +#define UARTAPP_CTRL0_RXTIMEOUT_MASK 0x07FF +#define UARTAPP_CTRL0_XFER_COUNT_OFFSET0 +#define UARTAPP_CTRL0_XFER_COUNT_MASK 0x + +#define UARTAPP_CTRL1_RSVD2_OFFSET 29 +#define UARTAPP_CTRL1_RSVD2_MASK 0xE000 + +#define UARTAPP_CTRL1_RUN_MASK (1 28) +#define UARTAPP_CTRL1_RSVD1_OFFSET 16 +#define UARTAPP_CTRL1_RSVD1_MASK 0x0FFF + +#define UARTAPP_CTRL1_XFER_COUNT_OFFSET0 +#define UARTAPP_CTRL1_XFER_COUNT_MASK 0x + +#define UARTAPP_CTRL2_INVERT_RTS_MASK (1 31) +#define UARTAPP_CTRL2_INVERT_CTS_MASK (1 30) +#define UARTAPP_CTRL2_INVERT_TX_MASK (1 29) +#define UARTAPP_CTRL2_INVERT_RX_MASK (1 28) +#define UARTAPP_CTRL2_RTS_SEMAPHORE_MASK (1 27) +#define UARTAPP_CTRL2_DMAONERR_MASK(1 26) +#define UARTAPP_CTRL2_TXDMAE_MASK (1 25) +#define UARTAPP_CTRL2_RXDMAE_MASK (1 24) +#define UARTAPP_CTRL2_RSVD2_MASK (1 23) +#define UARTAPP_CTRL2_RXIFLSEL_OFFSET 20 +#define UARTAPP_CTRL2_RXIFLSEL_MASK0x0070 + +#define UARTAPP_CTRL2_RXIFLSEL_NOT_EMPTY (0x0 20) +#define UARTAPP_CTRL2_RXIFLSEL_ONE_QUARTER (0x1 20) +#define UARTAPP_CTRL2_RXIFLSEL_ONE_HALF(0x2 20) +#define UARTAPP_CTRL2_RXIFLSEL_THREE_QUARTERS (0x3 20) +#define UARTAPP_CTRL2_RXIFLSEL_SEVEN_EIGHTHS (0x4 20) +#define UARTAPP_CTRL2_RXIFLSEL_INVALID5(0x5 20) +#define UARTAPP_CTRL2_RXIFLSEL_INVALID6(0x6 20
[U-Boot] [PATCH v5] ARM: mxs: Added application UART driver
The driver makes it possible to use an application UART as the U-Boot output console for Freescale i.MX23/i.MX28 devices. Signed-off-by: Andreas Wass andreas.w...@dalelven.com Cc: Fabio Estevam fabio.este...@freescale.com Cc: Marek Vasut ma...@denx.de --- Changes for v2: - Added comment that regs-uartapp.h is pulled from LTIB - BM_ prefixes removed and _MASK suffixes added instead - BP_ prefixes removed and _OFFSET suffixes added instead - BF_ defines removed altogether - CONFIG_MXS_AUART_CLK renamed to MXS_AUART_CLK and guarding ifndef removed - Added comments describing what is set and unset during init of driver - Added newline that was accidently removed from serial.c Changes for v3: - All BV_ values are now on the form (value something) - BV_ prefix removed and double underscore substituted with a single - File comment of mxs_auart.c now attributes what the driver is based on - Uses gd-baudrate instead of CONFIG_BAUDRATE - If gd-baudrate is 0 it reverts back to CONFIG_BAUDRATE - Checks the validity of the div value calculated when setting the baudrate - Magic numbers are now defines instead - Cleanup of comments - Cleanup of commit message Changes for v4: - Fixed UARTAPP_LINECTRL2_WLEN_*BITS values Changes for v5: - Removed all RSVD values from regs-uartapp.h - 0x (and similar) turned into 0x (and similar) - Removed all bitshifts by 0 - All masks with non-zero shifting are now on the form (value shift) arch/arm/include/asm/arch-mxs/regs-uartapp.h | 220 +++ drivers/serial/Makefile | 1 + drivers/serial/mxs_auart.c | 151 ++ drivers/serial/serial.c | 2 + 4 files changed, 374 insertions(+) create mode 100644 arch/arm/include/asm/arch-mxs/regs-uartapp.h create mode 100644 drivers/serial/mxs_auart.c diff --git a/arch/arm/include/asm/arch-mxs/regs-uartapp.h b/arch/arm/include/asm/arch-mxs/regs-uartapp.h new file mode 100644 index 000..7ceb810 --- /dev/null +++ b/arch/arm/include/asm/arch-mxs/regs-uartapp.h @@ -0,0 +1,220 @@ +/* + * Freescale MXS UARTAPP Register Definitions + * + * Copyright (C) 2013 Andreas Wass andreas.w...@dalelven.com + * + * Based on code from LTIB: + * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved. + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#ifndef __ARCH_ARM___MXS_UARTAPP_H +#define __ARCH_ARM___MXS_UARTAPP_H + +#include asm/imx-common/regs-common.h + +#ifndef __ASSEMBLY__ +struct mxs_uartapp_regs { + mxs_reg_32(hw_uartapp_ctrl0) + mxs_reg_32(hw_uartapp_ctrl1) + mxs_reg_32(hw_uartapp_ctrl2) + mxs_reg_32(hw_uartapp_linectrl) + mxs_reg_32(hw_uartapp_linectrl2) + mxs_reg_32(hw_uartapp_intr) + mxs_reg_32(hw_uartapp_data) + mxs_reg_32(hw_uartapp_stat) + mxs_reg_32(hw_uartapp_debug) + mxs_reg_32(hw_uartapp_version) + mxs_reg_32(hw_uartapp_autobaud) +}; +#endif + +#define UARTAPP_CTRL0_SFTRST_MASK (1 31) +#define UARTAPP_CTRL0_CLKGATE_MASK (1 30) +#define UARTAPP_CTRL0_RUN_MASK (1 29) +#define UARTAPP_CTRL0_RX_SOURCE_MASK (1 28) +#define UARTAPP_CTRL0_RXTO_ENABLE_MASK (1 27) +#define UARTAPP_CTRL0_RXTIMEOUT_OFFSET 16 +#define UARTAPP_CTRL0_RXTIMEOUT_MASK (0x7FF 16) +#define UARTAPP_CTRL0_XFER_COUNT_OFFSET0 +#define UARTAPP_CTRL0_XFER_COUNT_MASK 0x + +#define UARTAPP_CTRL1_RUN_MASK (1 28) + +#define UARTAPP_CTRL1_XFER_COUNT_OFFSET0 +#define UARTAPP_CTRL1_XFER_COUNT_MASK 0x + +#define UARTAPP_CTRL2_INVERT_RTS_MASK (1 31) +#define UARTAPP_CTRL2_INVERT_CTS_MASK (1 30) +#define UARTAPP_CTRL2_INVERT_TX_MASK (1 29) +#define UARTAPP_CTRL2_INVERT_RX_MASK (1 28) +#define UARTAPP_CTRL2_RTS_SEMAPHORE_MASK (1 27) +#define UARTAPP_CTRL2_DMAONERR_MASK(1 26) +#define UARTAPP_CTRL2_TXDMAE_MASK (1 25) +#define UARTAPP_CTRL2_RXDMAE_MASK (1 24) +#define UARTAPP_CTRL2_RXIFLSEL_OFFSET 20 +#define UARTAPP_CTRL2_RXIFLSEL_MASK(0x7 20) + +#define UARTAPP_CTRL2_RXIFLSEL_NOT_EMPTY (0x0 20) +#define UARTAPP_CTRL2_RXIFLSEL_ONE_QUARTER (0x1 20) +#define UARTAPP_CTRL2_RXIFLSEL_ONE_HALF(0x2 20) +#define UARTAPP_CTRL2_RXIFLSEL_THREE_QUARTERS (0x3 20) +#define UARTAPP_CTRL2_RXIFLSEL_SEVEN_EIGHTHS (0x4 20) +#define UARTAPP_CTRL2_RXIFLSEL_INVALID5(0x5 20) +#define UARTAPP_CTRL2_RXIFLSEL_INVALID6(0x6 20) +#define UARTAPP_CTRL2_RXIFLSEL_INVALID7(0x7
[U-Boot] [RFC][PATCH] ARM: mxs: Added application UART driver
The driver is ported from a driver that was implemented using u-boot 2009. The driver makes it possible to use a regular application UART as the U-Boot output console for MXS CPUs. Signed-off-by: Andreas Wass andreas.w...@dalelven.com Cc: Fabio Estevam fabio.este...@freescale.com Cc: Marek Vasut ma...@denx.de --- arch/arm/include/asm/arch-mxs/regs-uartapp.h | 321 +++ drivers/serial/Makefile | 1 + drivers/serial/mxs_auart.c | 118 ++ drivers/serial/serial.c | 3 +- 4 files changed, 442 insertions(+), 1 deletion(-) create mode 100644 arch/arm/include/asm/arch-mxs/regs-uartapp.h create mode 100644 drivers/serial/mxs_auart.c diff --git a/arch/arm/include/asm/arch-mxs/regs-uartapp.h b/arch/arm/include/asm/arch-mxs/regs-uartapp.h new file mode 100644 index 000..5e871b6 --- /dev/null +++ b/arch/arm/include/asm/arch-mxs/regs-uartapp.h @@ -0,0 +1,321 @@ +/* + * Freescale MXS UARTAPP Register Definitions + * + * Copyright (C) 2013 Andreas Wass andreas.w...@dalelven.com + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#ifndef __ARCH_ARM___MXS_UARTAPP_H +#define __ARCH_ARM___MXS_UARTAPP_H + +#include asm/imx-common/regs-common.h + +#ifndef __ASSEMBLY__ +struct mxs_uartapp_regs { + mxs_reg_32(hw_uartapp_ctrl0) + mxs_reg_32(hw_uartapp_ctrl1) + mxs_reg_32(hw_uartapp_ctrl2) + mxs_reg_32(hw_uartapp_linectrl) + mxs_reg_32(hw_uartapp_linectrl2) + mxs_reg_32(hw_uartapp_intr) + mxs_reg_32(hw_uartapp_data) + mxs_reg_32(hw_uartapp_stat) + mxs_reg_32(hw_uartapp_debug) + mxs_reg_32(hw_uartapp_version) + mxs_reg_32(hw_uartapp_autobaud) +}; +#endif + + +#define BM_UARTAPP_CTRL0_SFTRST(1 31) +#define BM_UARTAPP_CTRL0_CLKGATE (1 30) +#define BM_UARTAPP_CTRL0_RUN (1 29) +#define BM_UARTAPP_CTRL0_RX_SOURCE (1 28) +#define BM_UARTAPP_CTRL0_RXTO_ENABLE (1 27) +#define BP_UARTAPP_CTRL0_RXTIMEOUT (1 4) +#define BM_UARTAPP_CTRL0_RXTIMEOUT 0x07FF +#define BF_UARTAPP_CTRL0_RXTIMEOUT(v) \ + (((v) 16) BM_UARTAPP_CTRL0_RXTIMEOUT) +#define BP_UARTAPP_CTRL0_XFER_COUNT0 +#define BM_UARTAPP_CTRL0_XFER_COUNT0x +#define BF_UARTAPP_CTRL0_XFER_COUNT(v) \ + (((v) BP_UARTAPP_CTRL0_XFER_COUNT) \ +BM_UARTAPP_CTRL0_XFER_COUNT) + +#define BP_UARTAPP_CTRL1_RSVD2 29 +#define BM_UARTAPP_CTRL1_RSVD2 0xE000 +#define BF_UARTAPP_CTRL1_RSVD2(v) \ + (((v) BP_UARTAPP_CTRL1_RSVD2) \ +BM_UARTAPP_CTRL1_RSVD2) + +#define BM_UARTAPP_CTRL1_RUN (1 28) +#define BP_UARTAPP_CTRL1_RSVD1 16 +#define BM_UARTAPP_CTRL1_RSVD1 0x0FFF +#define BF_UARTAPP_CTRL1_RSVD1(v) \ + (((v) BP_UARTAPP_CTRL1_RSVD1) \ +BM_UARTAPP_CTRL1_RSVD1) + +#define BP_UARTAPP_CTRL1_XFER_COUNT0 +#define BM_UARTAPP_CTRL1_XFER_COUNT0x +#define BF_UARTAPP_CTRL1_XFER_COUNT(v) \ + (((v) BP_UARTAPP_CTRL1_XFER_COUNT) \ +BM_UARTAPP_CTRL1_XFER_COUNT) + +#define BM_UARTAPP_CTRL2_INVERT_RTS(1 31) +#define BM_UARTAPP_CTRL2_INVERT_CTS(1 30) +#define BM_UARTAPP_CTRL2_INVERT_TX (1 29) +#define BM_UARTAPP_CTRL2_INVERT_RX (1 28) +#define BM_UARTAPP_CTRL2_RTS_SEMAPHORE (1 27) +#define BM_UARTAPP_CTRL2_DMAONERR (1 26) +#define BM_UARTAPP_CTRL2_TXDMAE(1 25) +#define BM_UARTAPP_CTRL2_RXDMAE(1 24) +#define BM_UARTAPP_CTRL2_RSVD2 (1 23) +#define BP_UARTAPP_CTRL2_RXIFLSEL 20 +#define BM_UARTAPP_CTRL2_RXIFLSEL 0x0070 +#define BF_UARTAPP_CTRL2_RXIFLSEL(v) \ + (((v) BP_UARTAPP_CTRL2_RXIFLSEL) \ +BM_UARTAPP_CTRL2_RXIFLSEL) + +#define BV_UARTAPP_CTRL2_RXIFLSEL__NOT_EMPTY 0x0 +#define BV_UARTAPP_CTRL2_RXIFLSEL__ONE_QUARTER 0x1 +#define BV_UARTAPP_CTRL2_RXIFLSEL__ONE_HALF0x2 +#define BV_UARTAPP_CTRL2_RXIFLSEL__THREE_QUARTERS 0x3 +#define BV_UARTAPP_CTRL2_RXIFLSEL__SEVEN_EIGHTHS 0x4 +#define BV_UARTAPP_CTRL2_RXIFLSEL__INVALID50x5 +#define BV_UARTAPP_CTRL2_RXIFLSEL__INVALID60x6 +#define BV_UARTAPP_CTRL2_RXIFLSEL__INVALID70x7 +#define BM_UARTAPP_CTRL2_RSVD3 (1 19) +#define BP_UARTAPP_CTRL2_TXIFLSEL 16 +#define BM_UARTAPP_CTRL2_TXIFLSEL 0x0007 +#define BF_UARTAPP_CTRL2_TXIFLSEL(v) \ + (((v) BP_UARTAPP_CTRL2_TXIFLSEL) \ +BM_UARTAPP_CTRL2_TXIFLSEL) +#define
[U-Boot] [RFC][PATCH v2] ARM: mxs: Added application UART driver
The driver is ported from a driver that was implemented using u-boot 2009. The driver makes it possible to use a regular application UART as the U-Boot output console for MXS CPUs. Signed-off-by: Andreas Wass andreas.w...@dalelven.com Cc: Fabio Estevam fabio.este...@freescale.com Cc: Marek Vasut ma...@denx.de --- Changes for v2: - Added comment that regs-uartapp.h is pulled from LTIB - BM_ prefixes removed and _MASK suffixes added instead - BP_ prefixes removed and _OFFSET suffixes added instead - BF_ defines removed altogether - CONFIG_MXS_AUART_CLK renamed to MXS_AUART_CLK and guarding ifndef removed - Added comments describing what is set and unset during init of driver - Added newline that was accidently removed from serial.c arch/arm/include/asm/arch-mxs/regs-uartapp.h | 236 +++ drivers/serial/Makefile | 1 + drivers/serial/mxs_auart.c | 139 drivers/serial/serial.c | 2 + 4 files changed, 378 insertions(+) create mode 100644 arch/arm/include/asm/arch-mxs/regs-uartapp.h create mode 100644 drivers/serial/mxs_auart.c diff --git a/arch/arm/include/asm/arch-mxs/regs-uartapp.h b/arch/arm/include/asm/arch-mxs/regs-uartapp.h new file mode 100644 index 000..60a0812 --- /dev/null +++ b/arch/arm/include/asm/arch-mxs/regs-uartapp.h @@ -0,0 +1,236 @@ +/* + * Freescale MXS UARTAPP Register Definitions + * + * Copyright (C) 2013 Andreas Wass andreas.w...@dalelven.com + * + * Based on code from LTIB: + * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved. + * + * SPDX-License-Identifier:GPL-2.0+ + */ + +#ifndef __ARCH_ARM___MXS_UARTAPP_H +#define __ARCH_ARM___MXS_UARTAPP_H + +#include asm/imx-common/regs-common.h + +#ifndef __ASSEMBLY__ +struct mxs_uartapp_regs { + mxs_reg_32(hw_uartapp_ctrl0) + mxs_reg_32(hw_uartapp_ctrl1) + mxs_reg_32(hw_uartapp_ctrl2) + mxs_reg_32(hw_uartapp_linectrl) + mxs_reg_32(hw_uartapp_linectrl2) + mxs_reg_32(hw_uartapp_intr) + mxs_reg_32(hw_uartapp_data) + mxs_reg_32(hw_uartapp_stat) + mxs_reg_32(hw_uartapp_debug) + mxs_reg_32(hw_uartapp_version) + mxs_reg_32(hw_uartapp_autobaud) +}; +#endif + + +#define UARTAPP_CTRL0_SFTRST_MASK (1 31) +#define UARTAPP_CTRL0_CLKGATE_MASK (1 30) +#define UARTAPP_CTRL0_RUN_MASK (1 29) +#define UARTAPP_CTRL0_RX_SOURCE_MASK (1 28) +#define UARTAPP_CTRL0_RXTO_ENABLE_MASK (1 27) +#define UARTAPP_CTRL0_RXTIMEOUT_OFFSET (1 4) +#define UARTAPP_CTRL0_RXTIMEOUT_MASK 0x07FF +#define UARTAPP_CTRL0_XFER_COUNT_OFFSET0 +#define UARTAPP_CTRL0_XFER_COUNT_MASK 0x + +#define UARTAPP_CTRL1_RSVD2_OFFSET 29 +#define UARTAPP_CTRL1_RSVD2_MASK 0xE000 + +#define UARTAPP_CTRL1_RUN_MASK (1 28) +#define UARTAPP_CTRL1_RSVD1_OFFSET 16 +#define UARTAPP_CTRL1_RSVD1_MASK 0x0FFF + +#define UARTAPP_CTRL1_XFER_COUNT_OFFSET0 +#define UARTAPP_CTRL1_XFER_COUNT_MASK 0x + +#define UARTAPP_CTRL2_INVERT_RTS_MASK (1 31) +#define UARTAPP_CTRL2_INVERT_CTS_MASK (1 30) +#define UARTAPP_CTRL2_INVERT_TX_MASK (1 29) +#define UARTAPP_CTRL2_INVERT_RX_MASK (1 28) +#define UARTAPP_CTRL2_RTS_SEMAPHORE_MASK (1 27) +#define UARTAPP_CTRL2_DMAONERR_MASK(1 26) +#define UARTAPP_CTRL2_TXDMAE_MASK (1 25) +#define UARTAPP_CTRL2_RXDMAE_MASK (1 24) +#define UARTAPP_CTRL2_RSVD2_MASK (1 23) +#define UARTAPP_CTRL2_RXIFLSEL_OFFSET 20 +#define UARTAPP_CTRL2_RXIFLSEL_MASK0x0070 + +#define BV_UARTAPP_CTRL2_RXIFLSEL__NOT_EMPTY 0x0 +#define BV_UARTAPP_CTRL2_RXIFLSEL__ONE_QUARTER 0x1 +#define BV_UARTAPP_CTRL2_RXIFLSEL__ONE_HALF0x2 +#define BV_UARTAPP_CTRL2_RXIFLSEL__THREE_QUARTERS 0x3 +#define BV_UARTAPP_CTRL2_RXIFLSEL__SEVEN_EIGHTHS 0x4 +#define BV_UARTAPP_CTRL2_RXIFLSEL__INVALID50x5 +#define BV_UARTAPP_CTRL2_RXIFLSEL__INVALID60x6 +#define BV_UARTAPP_CTRL2_RXIFLSEL__INVALID70x7 +#define UARTAPP_CTRL2_RSVD3_MASK (1 19) +#define UARTAPP_CTRL2_TXIFLSEL_OFFSET 16 +#define UARTAPP_CTRL2_TXIFLSEL_MASK0x0007 +#define BV_UARTAPP_CTRL2_TXIFLSEL__EMPTY 0x0 +#define BV_UARTAPP_CTRL2_TXIFLSEL__ONE_QUARTER 0x1 +#define BV_UARTAPP_CTRL2_TXIFLSEL__ONE_HALF0x2 +#define
Re: [U-Boot] Implement AUART for i.MX28
Hi Sorry for not responding, work and vacation came in the way. No further work has been done, ill see if i can do some next week. Kind regards Andreas 3 aug 2013 kl. 20:35 skrev Marek Vasut ma...@denx.de: Hi Andreas, I have tried to implement an AUART driver for i.MX28. However for it to work I must print 1 character to the debug UART via the serial_pl01x driver. If I do this the AUART will start working. If I don't nothing will be printed to the AUART. Anybody can see any obvious errors? Signed-off-by: Andreas Wass andreas.w...@dalelven.com I have to wonder, is the AUART no standard UART IP ? Probably not as Linux also has a separate driver for this ... Lots of rambling follows below, but please dont be put off by it. Make sure to CC me and Fabio on the next submission. I can help you debugging the driver if you clean it up a bit. Bump, is there any progress here? Best regards, Marek Vasut ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] Implement AUART for i.MX28
I have tried to implement an AUART driver for i.MX28. However for it to work I must print 1 character to the debug UART via the serial_pl01x driver. If I do this the AUART will start working. If I don't nothing will be printed to the AUART. Anybody can see any obvious errors? Signed-off-by: Andreas Wass andreas.w...@dalelven.com --- drivers/serial/Makefile |1 + drivers/serial/mxs-regs-uartapp.h | 307 + drivers/serial/mxs_auart.c| 161 +++ drivers/serial/serial.c | 11 +- drivers/serial/serial_pl01x.c | 19 ++- 5 files changed, 492 insertions(+), 7 deletions(-) create mode 100644 drivers/serial/mxs-regs-uartapp.h create mode 100644 drivers/serial/mxs_auart.c diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index fbc4e97..f4e0d45 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile @@ -52,6 +52,7 @@ COBJS-$(CONFIG_XILINX_UARTLITE) += serial_xuartlite.o COBJS-$(CONFIG_SANDBOX_SERIAL) += sandbox.o COBJS-$(CONFIG_SCIF_CONSOLE) += serial_sh.o COBJS-$(CONFIG_ZYNQ_SERIAL) += serial_zynq.o +COBJS-$(CONFIG_MXS_AUART) += mxs_auart.o ifndef CONFIG_SPL_BUILD COBJS-$(CONFIG_USB_TTY) += usbtty.o diff --git a/drivers/serial/mxs-regs-uartapp.h b/drivers/serial/mxs-regs-uartapp.h new file mode 100644 index 000..aad9a78 --- /dev/null +++ b/drivers/serial/mxs-regs-uartapp.h @@ -0,0 +1,307 @@ +/* + * Freescale UARTAPP Register Definitions + * + * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * This file is created by xml file. Don't Edit it. + * + * Xml Revision: 1.42 + * Template revision: 26195 + */ + +#ifndef __ARCH_ARM___UARTAPP_H +#define __ARCH_ARM___UARTAPP_H + + +#define HW_UARTAPP_CTRL0 (0x) +#define HW_UARTAPP_CTRL0_SET (0x0004) +#define HW_UARTAPP_CTRL0_CLR (0x0008) +#define HW_UARTAPP_CTRL0_TOG (0x000c) + +#define BM_UARTAPP_CTRL0_SFTRST0x8000 +#define BM_UARTAPP_CTRL0_CLKGATE 0x4000 +#define BM_UARTAPP_CTRL0_RUN 0x2000 +#define BM_UARTAPP_CTRL0_RX_SOURCE 0x1000 +#define BM_UARTAPP_CTRL0_RXTO_ENABLE 0x0800 +#define BP_UARTAPP_CTRL0_RXTIMEOUT 16 +#define BM_UARTAPP_CTRL0_RXTIMEOUT 0x07FF +#define BF_UARTAPP_CTRL0_RXTIMEOUT(v) \ + (((v) 16) BM_UARTAPP_CTRL0_RXTIMEOUT) +#define BP_UARTAPP_CTRL0_XFER_COUNT0 +#define BM_UARTAPP_CTRL0_XFER_COUNT0x +#define BF_UARTAPP_CTRL0_XFER_COUNT(v) \ + (((v) 0) BM_UARTAPP_CTRL0_XFER_COUNT) + +#define HW_UARTAPP_CTRL1 (0x0010) +#define HW_UARTAPP_CTRL1_SET (0x0014) +#define HW_UARTAPP_CTRL1_CLR (0x0018) +#define HW_UARTAPP_CTRL1_TOG (0x001c) + +#define BP_UARTAPP_CTRL1_RSVD2 29 +#define BM_UARTAPP_CTRL1_RSVD2 0xE000 +#define BF_UARTAPP_CTRL1_RSVD2(v) \ + (((v) 29) BM_UARTAPP_CTRL1_RSVD2) +#define BM_UARTAPP_CTRL1_RUN 0x1000 +#define BP_UARTAPP_CTRL1_RSVD1 16 +#define BM_UARTAPP_CTRL1_RSVD1 0x0FFF +#define BF_UARTAPP_CTRL1_RSVD1(v) \ + (((v) 16) BM_UARTAPP_CTRL1_RSVD1) +#define BP_UARTAPP_CTRL1_XFER_COUNT0 +#define BM_UARTAPP_CTRL1_XFER_COUNT0x +#define BF_UARTAPP_CTRL1_XFER_COUNT(v) \ + (((v) 0) BM_UARTAPP_CTRL1_XFER_COUNT) + +#define HW_UARTAPP_CTRL2 (0x0020) +#define HW_UARTAPP_CTRL2_SET (0x0024) +#define HW_UARTAPP_CTRL2_CLR (0x0028) +#define HW_UARTAPP_CTRL2_TOG (0x002c) + +#define BM_UARTAPP_CTRL2_INVERT_RTS0x8000 +#define BM_UARTAPP_CTRL2_INVERT_CTS0x4000 +#define BM_UARTAPP_CTRL2_INVERT_TX 0x2000 +#define BM_UARTAPP_CTRL2_INVERT_RX 0x1000 +#define BM_UARTAPP_CTRL2_RTS_SEMAPHORE 0x0800 +#define BM_UARTAPP_CTRL2_DMAONERR 0x0400 +#define BM_UARTAPP_CTRL2_TXDMAE0x0200 +#define BM_UARTAPP_CTRL2_RXDMAE0x0100 +#define BM_UARTAPP_CTRL2_RSVD2 0x0080 +#define BP_UARTAPP_CTRL2_RXIFLSEL 20 +#define BM_UARTAPP_CTRL2_RXIFLSEL 0x0070 +#define BF_UARTAPP_CTRL2_RXIFLSEL(v) \ + (((v) 20) BM_UARTAPP_CTRL2_RXIFLSEL) +#define BV_UARTAPP_CTRL2_RXIFLSEL__NOT_EMPTY 0x0 +#define BV_UARTAPP_CTRL2_RXIFLSEL__ONE_QUARTER0x1 +#define