mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2025-12-10 07:44:53 +01:00
ipq806x: Fixed UART TX FIFO corruption
During serial init after relocation, if TX FIFO is not empty, clock init on-the-fly causes baudrate flucutation resulting in TX data corruption and outputs as garbage data on the console. This patch fixes this by waiting until TX FIFO gets flushed before serial initialization starts. Change-Id: I487c73fbfb4fdb80b20d8beb8daa111ee9bae34e Signed-off-by: Gokul Sriram Palanisamy <gokulsri@codeaurora.org>
This commit is contained in:
parent
fd56657921
commit
2e22dca77d
3 changed files with 29 additions and 1 deletions
|
|
@ -77,6 +77,11 @@ void ipq_uboot_fdt_fixup(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
__weak void uart_wait_tx_empty(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int board_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
|
@ -194,7 +199,11 @@ int board_init(void)
|
|||
aquantia_phy_reset_init();
|
||||
disable_audio_clks();
|
||||
ipq_uboot_fdt_fixup();
|
||||
|
||||
/*
|
||||
* Needed by ipq806x to avoid TX FIFO curruption during
|
||||
* serial init after relocation
|
||||
*/
|
||||
uart_wait_tx_empty();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include <asm/arch-qca-common/scm.h>
|
||||
#include <asm/arch-qca-common/iomap.h>
|
||||
#include <asm/io.h>
|
||||
#include <dm/device.h>
|
||||
|
||||
#define DLOAD_MAGIC_COOKIE_1 0xE47B337D
|
||||
#define DLOAD_MAGIC_COOKIE_2 0x0501CAB0
|
||||
|
|
@ -1116,3 +1117,8 @@ unsigned int get_dts_machid(unsigned int machid)
|
|||
return machid;
|
||||
}
|
||||
}
|
||||
|
||||
void uart_wait_tx_empty(void)
|
||||
{
|
||||
ipq_serial_wait_tx_empty();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -354,6 +354,19 @@ static void ipq_serial_init(struct ipq_serial_platdata *plat,
|
|||
msm_boot_uart_dm_init(base);
|
||||
}
|
||||
|
||||
/**
|
||||
* ipq_serial_wait_tx_empty - Wait until TX FIFO is empty
|
||||
*/
|
||||
void ipq_serial_wait_tx_empty(void)
|
||||
{
|
||||
struct udevice *dev = gd->cur_serial_dev;
|
||||
struct ipq_serial_platdata *plat = dev->platdata;
|
||||
unsigned long base = plat->reg_base;
|
||||
|
||||
while (!(readl(MSM_BOOT_UART_DM_SR(base)) & MSM_BOOT_UART_DM_SR_TXEMT))
|
||||
__udelay(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* serial_tstc - checks if data available for reading
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue