armv8: ls1046aqds: add lpuart support
PATCH 2/2 armv8: ls1046aqds: add lpuart support
From: Shaohui Xie <[email protected]>
LPUART0 is used by default, and it's using platform clock, if a different clock is preferred, user can define CONFIG_LPUART_CLK.
--- arch/arm/dts/Makefile | 1 + arch/arm/dts/fsl-ls1046a-qds-lpuart.dts | 16 ++++++++++ arch/arm/dts/fsl-ls1046a-qds.dtsi | 4 +++ arch/arm/dts/fsl-ls1046a.dtsi | 54 +++++++++++++++++++++++++++++++++ board/freescale/ls1046aqds/ls1046aqds.c | 21 +++++++++++++ configs/ls1046aqds_lpuart_defconfig | 29 ++++++++++++++++++ include/configs/ls1046aqds.h | 8 +++++ 7 files changed, 133 insertions(+) create mode 100644 arch/arm/dts/fsl-ls1046a-qds-lpuart.dts create mode 100644 configs/ls1046aqds_lpuart_defconfig
arch/arm/dts/Makefile +1 -0
@@ -144,6 +144,7 @@ dtb-$(CONFIG_FSL_LSCH2) += fsl-ls1043a-qds-duart.dtb \ fsl-ls1043a-qds-lpuart.dtb \ fsl-ls1043a-rdb.dtb \ fsl-ls1046a-qds-duart.dtb \ + fsl-ls1046a-qds-lpuart.dtb \ fsl-ls1046a-rdb.dtb \ fsl-ls1012a-qds.dtb \ fsl-ls1012a-rdb.dtb \
arch/arm/dts/fsl-ls1046a-qds-lpuart.dts new file +16 -0
@@ -0,0 +1,16 @@ +/* + * Device Tree file for Freescale Layerscape-1046A family SoC. + * + * Copyright (C) 2016, Freescale Semiconductor + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +/dts-v1/; +#include "fsl-ls1046a-qds.dtsi" + +/ { + chosen { + stdout-path = &lpuart0; + }; +};
arch/arm/dts/fsl-ls1046a-qds.dtsi +4 -0
@@ -75,3 +75,7 @@ &duart1 { status = "okay"; }; + +&lpuart0 { + status = "okay"; +};
arch/arm/dts/fsl-ls1046a.dtsi +54 -0
60 lines not on this page · raw message
board/freescale/ls1046aqds/ls1046aqds.c +21 -0
@@ -120,6 +120,16 @@ unsigned long get_board_ddr_clk(void)return 66666666 ; } +#ifdef CONFIG_LPUART +u32 get_lpuart_clk (void ) +{ +#ifdef CONFIG_LPUART_CLK +return CONFIG_LPUART_CLK ; +#endif +return gd->bus_clk; +} +#endif +int select_i2c_ch_pca9547 (u8 ch) {int ret;
@@ -157,6 +167,9 @@ int board_early_init_f(void)struct ccsr_scfg *scfg = (struct ccsr_scfg *)CONFIG_SYS_FSL_SCFG_ADDR ;u32 usb_pwrfault;#endif +#ifdef CONFIG_LPUART +u8 uart; +#endif #ifdef CONFIG_SYS_I2C_EARLY_INIT i2c_early_init_f ();
@@ -175,6 +188,14 @@ int board_early_init_f(void)out_be32 (&scfg->usbpwrfault_selcr, usb_pwrfault);#endif +#ifdef CONFIG_LPUART +/* We use lpuart0 as system console */ + uart =QIXIS_READ (brdcfg[14 ]); + uart &= ~CFG_UART_MUX_MASK ; + uart |=CFG_LPUART_EN <<CFG_UART_MUX_SHIFT ; +QIXIS_WRITE (brdcfg[14 ], uart); +#endif +return 0 ; }
configs/ls1046aqds_lpuart_defconfig new file +29 -0
@@ -0,0 +1,29 @@ +CONFIG_ARM=y +CONFIG_TARGET_LS1046AQDS=y +CONFIG_DEFAULT_DEVICE_TREE="fsl-ls1046a-qds-lpuart" +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y +CONFIG_OF_BOARD_SETUP=y +CONFIG_SYS_EXTRA_OPTIONS="SYS_FSL_DDR4,LPUART" +CONFIG_BOOTDELAY=10 +CONFIG_HUSH_PARSER=y +CONFIG_CMD_BOOTZ=y +CONFIG_CMD_GREPENV=y +CONFIG_CMD_MEMTEST=y +CONFIG_CMD_MEMINFO=y +CONFIG_CMD_MMC=y +CONFIG_CMD_SF=y +CONFIG_CMD_I2C=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y +CONFIG_CMD_CACHE=y +CONFIG_CMD_EXT2=y +CONFIG_CMD_FAT=y +CONFIG_OF_CONTROL=y +CONFIG_DM=y +CONFIG_DM_SPI=y +CONFIG_SPI_FLASH=y +CONFIG_FSL_DSPI=y +CONFIG_DM_SERIAL=y +CONFIG_FSL_LPUART=y
include/configs/ls1046aqds.h +8 -0
@@ -132,6 +132,14 @@ unsigned long get_board_ddr_clk(void);#endif #endif +/* LPUART */ +#ifdef CONFIG_LPUART +#define CONFIG_LPUART_32B_REG +#define CFG_UART_MUX_MASK 0x6 +#define CFG_UART_MUX_SHIFT 1 +#define CFG_LPUART_EN 0x2 +#endif +/* SATA */ #define CONFIG_LIBATA #define CONFIG_SCSI_AHCI
Signature · 1 line
2.1.0.27.g96db324
PATCH 2/2 armv8: ls1046aqds: add lpuart support
Quoted 4 lines · shh.xie at gmail.com
From: Shaohui Xie <[email protected]>
LPUART0 is used by default, and it's using platform clock, if a different clock is preferred, user can define
CONFIG_LPUART_CLK.
Shaohui,
You may have to choose another name for macro CONFIG_LPUART_CLK. We need to avoid using CONFIG_*. If this clock is fixed on the board, you can use SYS_FSL_* name space.
You can keep using CONFIG_LPUART for now, but eventually we will convert it to Kconfig option.
York
PATCH 2/2 armv8: ls1046aqds: add lpuart support
Hi York,
Thanks for reviewing!
Please see inline.
Quoted 10 lines
-----Original Message-----
From: york sun
Sent: Thursday, October 27, 2016 1:19 AM
To: shh.xie at gmail.com; u-boot at lists.denx.de
Cc: S.H. Xie <[email protected]>
Subject: Re: [PATCH 2/2] armv8: ls1046aqds: add lpuart supportQuoted 2 lines · shh.xie at gmail.com
From: Shaohui Xie <[email protected]>
Quoted 8 lines
Quoted 2 lines
LPUART0 is used by default, and it's using platform clock, if a different clock is preferred, user can define
CONFIG_LPUART_CLK.Shaohui,
You may have to choose another name for macro
CONFIG_LPUART_CLK. We need to avoid using CONFIG_*. If this clock is fixed on the board, you can use SYS_FSL_* name space.
[S.H] I can drop the CONFIG_LPUART_CLK, it's not used on the QDS, I was thinking about to help user if their board uses different clock for LPUART and they don't want add code to calculate the frequency, they can just use a define.
Quoted 3 lines
You can keep using
CONFIG_LPUARTfor now, but eventually we will convert it toKconfigoption.
[S.H] OK.
Thanks.
Shaohui