mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
serial: Rename ns16550 functions to lower case
Lower case should be used for function names. Update this driver and its callers accordingly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
parent
d30c7209df
commit
2d6bf754ce
20 changed files with 54 additions and 53 deletions
|
@ -290,7 +290,7 @@ int arch_cpu_init(void)
|
||||||
board_gpio_init();
|
board_gpio_init();
|
||||||
|
|
||||||
#if !CONFIG_IS_ENABLED(DM_SERIAL)
|
#if !CONFIG_IS_ENABLED(DM_SERIAL)
|
||||||
NS16550_init((struct ns16550 *)(CONFIG_SYS_NS16550_COM1),
|
ns16550_init((struct ns16550 *)(CONFIG_SYS_NS16550_COM1),
|
||||||
CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
|
CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -27,9 +27,9 @@ void puts(const char *str)
|
||||||
void putc(char c)
|
void putc(char c)
|
||||||
{
|
{
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
NS16550_putc((struct ns16550 *)(CONFIG_SYS_NS16550_COM1), '\r');
|
ns16550_putc((struct ns16550 *)(CONFIG_SYS_NS16550_COM1), '\r');
|
||||||
|
|
||||||
NS16550_putc((struct ns16550 *)(CONFIG_SYS_NS16550_COM1), c);
|
ns16550_putc((struct ns16550 *)(CONFIG_SYS_NS16550_COM1), c);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */
|
#endif /* CONFIG_SPL_LIBCOMMON_SUPPORT */
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,7 @@ int arch_cpu_init(void)
|
||||||
* driver doesn't handle this.
|
* driver doesn't handle this.
|
||||||
*/
|
*/
|
||||||
#ifndef CONFIG_DM_SERIAL
|
#ifndef CONFIG_DM_SERIAL
|
||||||
NS16550_init((struct ns16550 *)(CONFIG_SYS_NS16550_COM2),
|
ns16550_init((struct ns16550 *)(CONFIG_SYS_NS16550_COM2),
|
||||||
CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
|
CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ void board_init_f(ulong bootflag)
|
||||||
bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
|
bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
|
||||||
gd->bus_clk = bus_clk;
|
gd->bus_clk = bus_clk;
|
||||||
|
|
||||||
NS16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
ns16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
||||||
bus_clk / 16 / CONFIG_BAUDRATE);
|
bus_clk / 16 / CONFIG_BAUDRATE);
|
||||||
#ifdef CONFIG_SPL_MMC_BOOT
|
#ifdef CONFIG_SPL_MMC_BOOT
|
||||||
puts("\nSD boot...\n");
|
puts("\nSD boot...\n");
|
||||||
|
|
|
@ -34,7 +34,7 @@ void board_init_f(ulong bootflag)
|
||||||
plat_ratio >>= 1;
|
plat_ratio >>= 1;
|
||||||
gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
|
gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
|
||||||
|
|
||||||
NS16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
ns16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
||||||
gd->bus_clk / 16 / CONFIG_BAUDRATE);
|
gd->bus_clk / 16 / CONFIG_BAUDRATE);
|
||||||
|
|
||||||
puts("\nNAND boot... ");
|
puts("\nNAND boot... ");
|
||||||
|
@ -55,9 +55,9 @@ void board_init_r(gd_t *gd, ulong dest_addr)
|
||||||
void putc(char c)
|
void putc(char c)
|
||||||
{
|
{
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
NS16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM1, '\r');
|
ns16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM1, '\r');
|
||||||
|
|
||||||
NS16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM1, c);
|
ns16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM1, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void puts(const char *str)
|
void puts(const char *str)
|
||||||
|
|
|
@ -108,8 +108,9 @@ void reset_misc(void)
|
||||||
|
|
||||||
b_d = ns16550_calc_divisor((struct ns16550 *)CONFIG_SYS_NS16550_COM2,
|
b_d = ns16550_calc_divisor((struct ns16550 *)CONFIG_SYS_NS16550_COM2,
|
||||||
CONFIG_SYS_NS16550_CLK, 9600);
|
CONFIG_SYS_NS16550_CLK, 9600);
|
||||||
NS16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM2, b_d);
|
ns16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM2, b_d);
|
||||||
NS16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM2, SOFTWARE_REBOOT);
|
ns16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM2,
|
||||||
|
SOFTWARE_REBOOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Support old kernels */
|
/* Support old kernels */
|
||||||
|
|
|
@ -132,7 +132,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)
|
||||||
void board_init_f(ulong bootflag)
|
void board_init_f(ulong bootflag)
|
||||||
{
|
{
|
||||||
board_early_init_f();
|
board_early_init_f();
|
||||||
NS16550_init((struct ns16550 *)(CONFIG_SYS_IMMR + 0x4500),
|
ns16550_init((struct ns16550 *)(CONFIG_SYS_IMMR + 0x4500),
|
||||||
CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
|
CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
|
||||||
puts("NAND boot... ");
|
puts("NAND boot... ");
|
||||||
timer_init();
|
timer_init();
|
||||||
|
@ -152,8 +152,8 @@ void putc(char c)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
NS16550_putc((struct ns16550 *)(CONFIG_SYS_IMMR + 0x4500), '\r');
|
ns16550_putc((struct ns16550 *)(CONFIG_SYS_IMMR + 0x4500), '\r');
|
||||||
|
|
||||||
NS16550_putc((struct ns16550 *)(CONFIG_SYS_IMMR + 0x4500), c);
|
ns16550_putc((struct ns16550 *)(CONFIG_SYS_IMMR + 0x4500), c);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -220,7 +220,7 @@ int checkboard(void)
|
||||||
void board_init_f(ulong bootflag)
|
void board_init_f(ulong bootflag)
|
||||||
{
|
{
|
||||||
board_early_init_f();
|
board_early_init_f();
|
||||||
NS16550_init((struct ns16550 *)(CONFIG_SYS_IMMR + 0x4500),
|
ns16550_init((struct ns16550 *)(CONFIG_SYS_IMMR + 0x4500),
|
||||||
CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
|
CONFIG_SYS_NS16550_CLK / 16 / CONFIG_BAUDRATE);
|
||||||
puts("NAND boot... ");
|
puts("NAND boot... ");
|
||||||
timer_init();
|
timer_init();
|
||||||
|
@ -240,9 +240,9 @@ void putc(char c)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
NS16550_putc((struct ns16550 *)(CONFIG_SYS_IMMR + 0x4500), '\r');
|
ns16550_putc((struct ns16550 *)(CONFIG_SYS_IMMR + 0x4500), '\r');
|
||||||
|
|
||||||
NS16550_putc((struct ns16550 *)(CONFIG_SYS_IMMR + 0x4500), c);
|
ns16550_putc((struct ns16550 *)(CONFIG_SYS_IMMR + 0x4500), c);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_NAND_SPL */
|
#endif /* CONFIG_NAND_SPL */
|
||||||
|
|
|
@ -44,7 +44,7 @@ void board_init_f(ulong bootflag)
|
||||||
plat_ratio >>= 1;
|
plat_ratio >>= 1;
|
||||||
gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
|
gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
|
||||||
|
|
||||||
NS16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
ns16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
||||||
gd->bus_clk / 16 / CONFIG_BAUDRATE);
|
gd->bus_clk / 16 / CONFIG_BAUDRATE);
|
||||||
|
|
||||||
#ifdef CONFIG_SPL_MMC_BOOT
|
#ifdef CONFIG_SPL_MMC_BOOT
|
||||||
|
|
|
@ -31,7 +31,7 @@ void board_init_f(ulong bootflag)
|
||||||
plat_ratio >>= 1;
|
plat_ratio >>= 1;
|
||||||
gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
|
gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
|
||||||
|
|
||||||
NS16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
ns16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
||||||
gd->bus_clk / 16 / CONFIG_BAUDRATE);
|
gd->bus_clk / 16 / CONFIG_BAUDRATE);
|
||||||
|
|
||||||
puts("\nNAND boot... ");
|
puts("\nNAND boot... ");
|
||||||
|
@ -53,9 +53,9 @@ void board_init_r(gd_t *gd, ulong dest_addr)
|
||||||
void putc(char c)
|
void putc(char c)
|
||||||
{
|
{
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
NS16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM1, '\r');
|
ns16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM1, '\r');
|
||||||
|
|
||||||
NS16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM1, c);
|
ns16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM1, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void puts(const char *str)
|
void puts(const char *str)
|
||||||
|
|
|
@ -50,7 +50,7 @@ void board_init_f(ulong bootflag)
|
||||||
bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
|
bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
|
||||||
gd->bus_clk = bus_clk;
|
gd->bus_clk = bus_clk;
|
||||||
|
|
||||||
NS16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
ns16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
||||||
bus_clk / 16 / CONFIG_BAUDRATE);
|
bus_clk / 16 / CONFIG_BAUDRATE);
|
||||||
#ifdef CONFIG_SPL_MMC_BOOT
|
#ifdef CONFIG_SPL_MMC_BOOT
|
||||||
puts("\nSD boot...\n");
|
puts("\nSD boot...\n");
|
||||||
|
|
|
@ -30,7 +30,7 @@ void board_init_f(ulong bootflag)
|
||||||
plat_ratio >>= 1;
|
plat_ratio >>= 1;
|
||||||
gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
|
gd->bus_clk = CONFIG_SYS_CLK_FREQ * plat_ratio;
|
||||||
|
|
||||||
NS16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
ns16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
||||||
gd->bus_clk / 16 / CONFIG_BAUDRATE);
|
gd->bus_clk / 16 / CONFIG_BAUDRATE);
|
||||||
|
|
||||||
puts("\nNAND boot... ");
|
puts("\nNAND boot... ");
|
||||||
|
@ -51,9 +51,9 @@ void board_init_r(gd_t *gd, ulong dest_addr)
|
||||||
void putc(char c)
|
void putc(char c)
|
||||||
{
|
{
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
NS16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM1, '\r');
|
ns16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM1, '\r');
|
||||||
|
|
||||||
NS16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM1, c);
|
ns16550_putc((struct ns16550 *)CONFIG_SYS_NS16550_COM1, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
void puts(const char *str)
|
void puts(const char *str)
|
||||||
|
|
|
@ -82,7 +82,7 @@ void board_init_f(ulong bootflag)
|
||||||
plat_ratio = (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
|
plat_ratio = (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
|
||||||
ccb_clk = sys_clk * plat_ratio / 2;
|
ccb_clk = sys_clk * plat_ratio / 2;
|
||||||
|
|
||||||
NS16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
ns16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
||||||
ccb_clk / 16 / CONFIG_BAUDRATE);
|
ccb_clk / 16 / CONFIG_BAUDRATE);
|
||||||
|
|
||||||
#if defined(CONFIG_SPL_MMC_BOOT)
|
#if defined(CONFIG_SPL_MMC_BOOT)
|
||||||
|
|
|
@ -81,7 +81,7 @@ void board_init_f(ulong bootflag)
|
||||||
plat_ratio = (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
|
plat_ratio = (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
|
||||||
uart_clk = sys_clk * plat_ratio / 2;
|
uart_clk = sys_clk * plat_ratio / 2;
|
||||||
|
|
||||||
NS16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
ns16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
||||||
uart_clk / 16 / CONFIG_BAUDRATE);
|
uart_clk / 16 / CONFIG_BAUDRATE);
|
||||||
|
|
||||||
relocate_code(CONFIG_SPL_RELOC_STACK, (gd_t *)CONFIG_SPL_GD_ADDR, 0x0);
|
relocate_code(CONFIG_SPL_RELOC_STACK, (gd_t *)CONFIG_SPL_GD_ADDR, 0x0);
|
||||||
|
|
|
@ -81,7 +81,7 @@ void board_init_f(ulong bootflag)
|
||||||
plat_ratio = (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
|
plat_ratio = (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
|
||||||
ccb_clk = sys_clk * plat_ratio / 2;
|
ccb_clk = sys_clk * plat_ratio / 2;
|
||||||
|
|
||||||
NS16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
ns16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
||||||
ccb_clk / 16 / CONFIG_BAUDRATE);
|
ccb_clk / 16 / CONFIG_BAUDRATE);
|
||||||
|
|
||||||
#if defined(CONFIG_SPL_MMC_BOOT)
|
#if defined(CONFIG_SPL_MMC_BOOT)
|
||||||
|
|
|
@ -51,7 +51,7 @@ void board_init_f(ulong bootflag)
|
||||||
plat_ratio = (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
|
plat_ratio = (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
|
||||||
ccb_clk = sys_clk * plat_ratio / 2;
|
ccb_clk = sys_clk * plat_ratio / 2;
|
||||||
|
|
||||||
NS16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
ns16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
||||||
ccb_clk / 16 / CONFIG_BAUDRATE);
|
ccb_clk / 16 / CONFIG_BAUDRATE);
|
||||||
|
|
||||||
#if defined(CONFIG_SPL_MMC_BOOT)
|
#if defined(CONFIG_SPL_MMC_BOOT)
|
||||||
|
|
|
@ -60,7 +60,7 @@ void board_init_f(ulong bootflag)
|
||||||
plat_ratio = (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
|
plat_ratio = (in_be32(&gur->rcwsr[0]) >> 25) & 0x1f;
|
||||||
ccb_clk = sys_clk * plat_ratio / 2;
|
ccb_clk = sys_clk * plat_ratio / 2;
|
||||||
|
|
||||||
NS16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
ns16550_init((struct ns16550 *)CONFIG_SYS_NS16550_COM1,
|
||||||
ccb_clk / 16 / CONFIG_BAUDRATE);
|
ccb_clk / 16 / CONFIG_BAUDRATE);
|
||||||
|
|
||||||
puts("\nSD boot...\n");
|
puts("\nSD boot...\n");
|
||||||
|
|
|
@ -212,7 +212,7 @@ int ns16550_calc_divisor(struct ns16550 *port, int clock, int baudrate)
|
||||||
return DIV_ROUND_CLOSEST(clock, mode_x_div * baudrate);
|
return DIV_ROUND_CLOSEST(clock, mode_x_div * baudrate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NS16550_setbrg(struct ns16550 *com_port, int baud_divisor)
|
static void ns16550_setbrg(struct ns16550 *com_port, int baud_divisor)
|
||||||
{
|
{
|
||||||
/* to keep serial format, read lcr before writing BKSE */
|
/* to keep serial format, read lcr before writing BKSE */
|
||||||
int lcr_val = serial_in(&com_port->lcr) & ~UART_LCR_BKSE;
|
int lcr_val = serial_in(&com_port->lcr) & ~UART_LCR_BKSE;
|
||||||
|
@ -223,7 +223,7 @@ static void NS16550_setbrg(struct ns16550 *com_port, int baud_divisor)
|
||||||
serial_out(lcr_val, &com_port->lcr);
|
serial_out(lcr_val, &com_port->lcr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NS16550_init(struct ns16550 *com_port, int baud_divisor)
|
void ns16550_init(struct ns16550 *com_port, int baud_divisor)
|
||||||
{
|
{
|
||||||
#if (defined(CONFIG_SPL_BUILD) && \
|
#if (defined(CONFIG_SPL_BUILD) && \
|
||||||
(defined(CONFIG_OMAP34XX) || defined(CONFIG_OMAP44XX)))
|
(defined(CONFIG_OMAP34XX) || defined(CONFIG_OMAP44XX)))
|
||||||
|
@ -235,13 +235,13 @@ void NS16550_init(struct ns16550 *com_port, int baud_divisor)
|
||||||
if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE))
|
if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE))
|
||||||
== UART_LSR_THRE) {
|
== UART_LSR_THRE) {
|
||||||
if (baud_divisor != -1)
|
if (baud_divisor != -1)
|
||||||
NS16550_setbrg(com_port, baud_divisor);
|
ns16550_setbrg(com_port, baud_divisor);
|
||||||
else {
|
else {
|
||||||
// Re-use old baud rate divisor to flush transmit reg.
|
// Re-use old baud rate divisor to flush transmit reg.
|
||||||
const int dll = serial_in(&com_port->dll);
|
const int dll = serial_in(&com_port->dll);
|
||||||
const int dlm = serial_in(&com_port->dlm);
|
const int dlm = serial_in(&com_port->dlm);
|
||||||
const int divisor = dll | (dlm << 8);
|
const int divisor = dll | (dlm << 8);
|
||||||
NS16550_setbrg(com_port, divisor);
|
ns16550_setbrg(com_port, divisor);
|
||||||
}
|
}
|
||||||
serial_out(0, &com_port->mdr1);
|
serial_out(0, &com_port->mdr1);
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ void NS16550_init(struct ns16550 *com_port, int baud_divisor)
|
||||||
/* initialize serial config to 8N1 before writing baudrate */
|
/* initialize serial config to 8N1 before writing baudrate */
|
||||||
serial_out(UART_LCRVAL, &com_port->lcr);
|
serial_out(UART_LCRVAL, &com_port->lcr);
|
||||||
if (baud_divisor != -1)
|
if (baud_divisor != -1)
|
||||||
NS16550_setbrg(com_port, baud_divisor);
|
ns16550_setbrg(com_port, baud_divisor);
|
||||||
#if defined(CONFIG_ARCH_OMAP2PLUS) || defined(CONFIG_SOC_DA8XX) || \
|
#if defined(CONFIG_ARCH_OMAP2PLUS) || defined(CONFIG_SOC_DA8XX) || \
|
||||||
defined(CONFIG_OMAP_SERIAL)
|
defined(CONFIG_OMAP_SERIAL)
|
||||||
/* /16 is proper to hit 115200 with 48MHz */
|
/* /16 is proper to hit 115200 with 48MHz */
|
||||||
|
@ -272,17 +272,17 @@ void NS16550_init(struct ns16550 *com_port, int baud_divisor)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_NS16550_MIN_FUNCTIONS
|
#ifndef CONFIG_NS16550_MIN_FUNCTIONS
|
||||||
void NS16550_reinit(struct ns16550 *com_port, int baud_divisor)
|
void ns16550_reinit(struct ns16550 *com_port, int baud_divisor)
|
||||||
{
|
{
|
||||||
serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
|
serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier);
|
||||||
NS16550_setbrg(com_port, 0);
|
ns16550_setbrg(com_port, 0);
|
||||||
serial_out(UART_MCRVAL, &com_port->mcr);
|
serial_out(UART_MCRVAL, &com_port->mcr);
|
||||||
serial_out(ns16550_getfcr(com_port), &com_port->fcr);
|
serial_out(ns16550_getfcr(com_port), &com_port->fcr);
|
||||||
NS16550_setbrg(com_port, baud_divisor);
|
ns16550_setbrg(com_port, baud_divisor);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_NS16550_MIN_FUNCTIONS */
|
#endif /* CONFIG_NS16550_MIN_FUNCTIONS */
|
||||||
|
|
||||||
void NS16550_putc(struct ns16550 *com_port, char c)
|
void ns16550_putc(struct ns16550 *com_port, char c)
|
||||||
{
|
{
|
||||||
while ((serial_in(&com_port->lsr) & UART_LSR_THRE) == 0)
|
while ((serial_in(&com_port->lsr) & UART_LSR_THRE) == 0)
|
||||||
;
|
;
|
||||||
|
@ -299,7 +299,7 @@ void NS16550_putc(struct ns16550 *com_port, char c)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_NS16550_MIN_FUNCTIONS
|
#ifndef CONFIG_NS16550_MIN_FUNCTIONS
|
||||||
char NS16550_getc(struct ns16550 *com_port)
|
char ns16550_getc(struct ns16550 *com_port)
|
||||||
{
|
{
|
||||||
while ((serial_in(&com_port->lsr) & UART_LSR_DR) == 0) {
|
while ((serial_in(&com_port->lsr) & UART_LSR_DR) == 0) {
|
||||||
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_USB_TTY)
|
#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_USB_TTY)
|
||||||
|
@ -311,7 +311,7 @@ char NS16550_getc(struct ns16550 *com_port)
|
||||||
return serial_in(&com_port->rbr);
|
return serial_in(&com_port->rbr);
|
||||||
}
|
}
|
||||||
|
|
||||||
int NS16550_tstc(struct ns16550 *com_port)
|
int ns16550_tstc(struct ns16550 *com_port)
|
||||||
{
|
{
|
||||||
return (serial_in(&com_port->lsr) & UART_LSR_DR) != 0;
|
return (serial_in(&com_port->lsr) & UART_LSR_DR) != 0;
|
||||||
}
|
}
|
||||||
|
@ -423,7 +423,7 @@ static int ns16550_serial_setbrg(struct udevice *dev, int baudrate)
|
||||||
|
|
||||||
clock_divisor = ns16550_calc_divisor(com_port, plat->clock, baudrate);
|
clock_divisor = ns16550_calc_divisor(com_port, plat->clock, baudrate);
|
||||||
|
|
||||||
NS16550_setbrg(com_port, clock_divisor);
|
ns16550_setbrg(com_port, clock_divisor);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -520,7 +520,7 @@ int ns16550_serial_probe(struct udevice *dev)
|
||||||
reset_deassert_bulk(&reset_bulk);
|
reset_deassert_bulk(&reset_bulk);
|
||||||
|
|
||||||
com_port->plat = dev_get_plat(dev);
|
com_port->plat = dev_get_plat(dev);
|
||||||
NS16550_init(com_port, -1);
|
ns16550_init(com_port, -1);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ static struct ns16550 *serial_ports[6] = {
|
||||||
int clock_divisor; \
|
int clock_divisor; \
|
||||||
clock_divisor = ns16550_calc_divisor(serial_ports[port-1], \
|
clock_divisor = ns16550_calc_divisor(serial_ports[port-1], \
|
||||||
CONFIG_SYS_NS16550_CLK, gd->baudrate); \
|
CONFIG_SYS_NS16550_CLK, gd->baudrate); \
|
||||||
NS16550_init(serial_ports[port-1], clock_divisor); \
|
ns16550_init(serial_ports[port - 1], clock_divisor); \
|
||||||
return 0 ; \
|
return 0 ; \
|
||||||
} \
|
} \
|
||||||
static void eserial##port##_setbrg(void) \
|
static void eserial##port##_setbrg(void) \
|
||||||
|
@ -117,9 +117,9 @@ static struct ns16550 *serial_ports[6] = {
|
||||||
static void _serial_putc(const char c, const int port)
|
static void _serial_putc(const char c, const int port)
|
||||||
{
|
{
|
||||||
if (c == '\n')
|
if (c == '\n')
|
||||||
NS16550_putc(PORT, '\r');
|
ns16550_putc(PORT, '\r');
|
||||||
|
|
||||||
NS16550_putc(PORT, c);
|
ns16550_putc(PORT, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _serial_puts(const char *s, const int port)
|
static void _serial_puts(const char *s, const int port)
|
||||||
|
@ -131,12 +131,12 @@ static void _serial_puts(const char *s, const int port)
|
||||||
|
|
||||||
static int _serial_getc(const int port)
|
static int _serial_getc(const int port)
|
||||||
{
|
{
|
||||||
return NS16550_getc(PORT);
|
return ns16550_getc(PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _serial_tstc(const int port)
|
static int _serial_tstc(const int port)
|
||||||
{
|
{
|
||||||
return NS16550_tstc(PORT);
|
return ns16550_tstc(PORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _serial_setbrg(const int port)
|
static void _serial_setbrg(const int port)
|
||||||
|
@ -145,7 +145,7 @@ static void _serial_setbrg(const int port)
|
||||||
|
|
||||||
clock_divisor = ns16550_calc_divisor(PORT, CONFIG_SYS_NS16550_CLK,
|
clock_divisor = ns16550_calc_divisor(PORT, CONFIG_SYS_NS16550_CLK,
|
||||||
gd->baudrate);
|
gd->baudrate);
|
||||||
NS16550_reinit(PORT, clock_divisor);
|
ns16550_reinit(PORT, clock_divisor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|
|
@ -222,11 +222,11 @@ struct ns16550 {
|
||||||
/* useful defaults for LCR */
|
/* useful defaults for LCR */
|
||||||
#define UART_LCR_8N1 0x03
|
#define UART_LCR_8N1 0x03
|
||||||
|
|
||||||
void NS16550_init(struct ns16550 *com_port, int baud_divisor);
|
void ns16550_init(struct ns16550 *com_port, int baud_divisor);
|
||||||
void NS16550_putc(struct ns16550 *com_port, char c);
|
void ns16550_putc(struct ns16550 *com_port, char c);
|
||||||
char NS16550_getc(struct ns16550 *com_port);
|
char ns16550_getc(struct ns16550 *com_port);
|
||||||
int NS16550_tstc(struct ns16550 *com_port);
|
int ns16550_tstc(struct ns16550 *com_port);
|
||||||
void NS16550_reinit(struct ns16550 *com_port, int baud_divisor);
|
void ns16550_reinit(struct ns16550 *com_port, int baud_divisor);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ns16550_calc_divisor() - calculate the divisor given clock and baud rate
|
* ns16550_calc_divisor() - calculate the divisor given clock and baud rate
|
||||||
|
|
Loading…
Reference in a new issue