diff options
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/altera_jtag_uart.c | 8 | ||||
-rw-r--r-- | drivers/serial/altera_uart.c | 8 | ||||
-rw-r--r-- | drivers/serial/atmel_usart.c | 2 | ||||
-rw-r--r-- | drivers/serial/ns16550.c | 68 | ||||
-rw-r--r-- | drivers/serial/sandbox.c | 24 | ||||
-rw-r--r-- | drivers/serial/serial-uclass.c | 2 | ||||
-rw-r--r-- | drivers/serial/serial_arc.c | 8 | ||||
-rw-r--r-- | drivers/serial/serial_coreboot.c | 2 | ||||
-rw-r--r-- | drivers/serial/serial_intel_mid.c | 2 | ||||
-rw-r--r-- | drivers/serial/serial_linflexuart.c | 2 | ||||
-rw-r--r-- | drivers/serial/serial_lpuart.c | 10 | ||||
-rw-r--r-- | drivers/serial/serial_mcf.c | 10 | ||||
-rw-r--r-- | drivers/serial/serial_meson.c | 12 | ||||
-rw-r--r-- | drivers/serial/serial_mxc.c | 12 | ||||
-rw-r--r-- | drivers/serial/serial_ns16550.c | 26 | ||||
-rw-r--r-- | drivers/serial/serial_omap.c | 8 | ||||
-rw-r--r-- | drivers/serial/serial_pxa.c | 10 | ||||
-rw-r--r-- | drivers/serial/serial_rockchip.c | 7 | ||||
-rw-r--r-- | drivers/serial/serial_s5p.c | 12 |
19 files changed, 110 insertions, 123 deletions
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c index 0d3ccd880ca..4435fcf56b9 100644 --- a/drivers/serial/altera_jtag_uart.c +++ b/drivers/serial/altera_jtag_uart.c @@ -37,7 +37,7 @@ static int altera_jtaguart_setbrg(struct udevice *dev, int baudrate) static int altera_jtaguart_putc(struct udevice *dev, const char ch) { - struct altera_jtaguart_plat *plat = dev->plat; + struct altera_jtaguart_plat *plat = dev_get_plat(dev); struct altera_jtaguart_regs *const regs = plat->regs; u32 st = readl(®s->control); @@ -56,7 +56,7 @@ static int altera_jtaguart_putc(struct udevice *dev, const char ch) static int altera_jtaguart_pending(struct udevice *dev, bool input) { - struct altera_jtaguart_plat *plat = dev->plat; + struct altera_jtaguart_plat *plat = dev_get_plat(dev); struct altera_jtaguart_regs *const regs = plat->regs; u32 st = readl(®s->control); @@ -68,7 +68,7 @@ static int altera_jtaguart_pending(struct udevice *dev, bool input) static int altera_jtaguart_getc(struct udevice *dev) { - struct altera_jtaguart_plat *plat = dev->plat; + struct altera_jtaguart_plat *plat = dev_get_plat(dev); struct altera_jtaguart_regs *const regs = plat->regs; u32 val; @@ -83,7 +83,7 @@ static int altera_jtaguart_getc(struct udevice *dev) static int altera_jtaguart_probe(struct udevice *dev) { #ifdef CONFIG_ALTERA_JTAG_UART_BYPASS - struct altera_jtaguart_plat *plat = dev->plat; + struct altera_jtaguart_plat *plat = dev_get_plat(dev); struct altera_jtaguart_regs *const regs = plat->regs; writel(ALTERA_JTAG_AC, ®s->control); /* clear AC flag */ diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c index a3efa1ee1b5..b18be6e2454 100644 --- a/drivers/serial/altera_uart.c +++ b/drivers/serial/altera_uart.c @@ -32,7 +32,7 @@ struct altera_uart_plat { static int altera_uart_setbrg(struct udevice *dev, int baudrate) { - struct altera_uart_plat *plat = dev->plat; + struct altera_uart_plat *plat = dev_get_plat(dev); struct altera_uart_regs *const regs = plat->regs; u32 div; @@ -44,7 +44,7 @@ static int altera_uart_setbrg(struct udevice *dev, int baudrate) static int altera_uart_putc(struct udevice *dev, const char ch) { - struct altera_uart_plat *plat = dev->plat; + struct altera_uart_plat *plat = dev_get_plat(dev); struct altera_uart_regs *const regs = plat->regs; if (!(readl(®s->status) & ALTERA_UART_TRDY)) @@ -57,7 +57,7 @@ static int altera_uart_putc(struct udevice *dev, const char ch) static int altera_uart_pending(struct udevice *dev, bool input) { - struct altera_uart_plat *plat = dev->plat; + struct altera_uart_plat *plat = dev_get_plat(dev); struct altera_uart_regs *const regs = plat->regs; u32 st = readl(®s->status); @@ -69,7 +69,7 @@ static int altera_uart_pending(struct udevice *dev, bool input) static int altera_uart_getc(struct udevice *dev) { - struct altera_uart_plat *plat = dev->plat; + struct altera_uart_plat *plat = dev_get_plat(dev); struct altera_uart_regs *const regs = plat->regs; if (!(readl(®s->status) & ALTERA_UART_RRDY)) diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c index 7eabf76d92e..7edec23e648 100644 --- a/drivers/serial/atmel_usart.c +++ b/drivers/serial/atmel_usart.c @@ -262,7 +262,7 @@ static int atmel_serial_enable_clk(struct udevice *dev) static int atmel_serial_probe(struct udevice *dev) { - struct atmel_serial_plat *plat = dev->plat; + struct atmel_serial_plat *plat = dev_get_plat(dev); struct atmel_serial_priv *priv = dev_get_priv(dev); int ret; #if CONFIG_IS_ENABLED(OF_CONTROL) diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 8dd81ad7948..65c6db073ec 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -156,7 +156,7 @@ static inline int serial_in_dynamic(struct ns16550_plat *plat, u8 *addr) #endif /* CONFIG_NS16550_DYNAMIC */ -static void ns16550_writeb(NS16550_t port, int offset, int value) +static void ns16550_writeb(struct ns16550 *port, int offset, int value) { struct ns16550_plat *plat = port->plat; unsigned char *addr; @@ -170,7 +170,7 @@ static void ns16550_writeb(NS16550_t port, int offset, int value) serial_out_shift(addr, plat->reg_shift, value); } -static int ns16550_readb(NS16550_t port, int offset) +static int ns16550_readb(struct ns16550 *port, int offset) { struct ns16550_plat *plat = port->plat; unsigned char *addr; @@ -184,7 +184,7 @@ static int ns16550_readb(NS16550_t port, int offset) return serial_in_shift(addr, plat->reg_shift); } -static u32 ns16550_getfcr(NS16550_t port) +static u32 ns16550_getfcr(struct ns16550 *port) { struct ns16550_plat *plat = port->plat; @@ -199,20 +199,20 @@ static u32 ns16550_getfcr(NS16550_t port) ns16550_readb(com_port, \ (unsigned char *)addr - (unsigned char *)com_port) #else -static u32 ns16550_getfcr(NS16550_t port) +static u32 ns16550_getfcr(struct ns16550 *port) { return UART_FCR_DEFVAL; } #endif -int ns16550_calc_divisor(NS16550_t port, int clock, int baudrate) +int ns16550_calc_divisor(struct ns16550 *port, int clock, int baudrate) { const unsigned int mode_x_div = 16; return DIV_ROUND_CLOSEST(clock, mode_x_div * baudrate); } -static void NS16550_setbrg(NS16550_t 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 */ int lcr_val = serial_in(&com_port->lcr) & ~UART_LCR_BKSE; @@ -223,7 +223,7 @@ static void NS16550_setbrg(NS16550_t com_port, int baud_divisor) serial_out(lcr_val, &com_port->lcr); } -void NS16550_init(NS16550_t com_port, int baud_divisor) +void ns16550_init(struct ns16550 *com_port, int baud_divisor) { #if (defined(CONFIG_SPL_BUILD) && \ (defined(CONFIG_OMAP34XX) || defined(CONFIG_OMAP44XX))) @@ -235,13 +235,13 @@ void NS16550_init(NS16550_t com_port, int baud_divisor) if ((serial_in(&com_port->lsr) & (UART_LSR_TEMT | UART_LSR_THRE)) == UART_LSR_THRE) { if (baud_divisor != -1) - NS16550_setbrg(com_port, baud_divisor); + ns16550_setbrg(com_port, baud_divisor); else { // Re-use old baud rate divisor to flush transmit reg. const int dll = serial_in(&com_port->dll); const int dlm = serial_in(&com_port->dlm); const int divisor = dll | (dlm << 8); - NS16550_setbrg(com_port, divisor); + ns16550_setbrg(com_port, divisor); } serial_out(0, &com_port->mdr1); } @@ -260,7 +260,7 @@ void NS16550_init(NS16550_t com_port, int baud_divisor) /* initialize serial config to 8N1 before writing baudrate */ serial_out(UART_LCRVAL, &com_port->lcr); 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) || \ defined(CONFIG_OMAP_SERIAL) /* /16 is proper to hit 115200 with 48MHz */ @@ -272,17 +272,17 @@ void NS16550_init(NS16550_t com_port, int baud_divisor) } #ifndef CONFIG_NS16550_MIN_FUNCTIONS -void NS16550_reinit(NS16550_t com_port, int baud_divisor) +void ns16550_reinit(struct ns16550 *com_port, int baud_divisor) { 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(ns16550_getfcr(com_port), &com_port->fcr); - NS16550_setbrg(com_port, baud_divisor); + ns16550_setbrg(com_port, baud_divisor); } #endif /* CONFIG_NS16550_MIN_FUNCTIONS */ -void NS16550_putc(NS16550_t com_port, char c) +void ns16550_putc(struct ns16550 *com_port, char c) { while ((serial_in(&com_port->lsr) & UART_LSR_THRE) == 0) ; @@ -299,7 +299,7 @@ void NS16550_putc(NS16550_t com_port, char c) } #ifndef CONFIG_NS16550_MIN_FUNCTIONS -char NS16550_getc(NS16550_t com_port) +char ns16550_getc(struct ns16550 *com_port) { while ((serial_in(&com_port->lsr) & UART_LSR_DR) == 0) { #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_USB_TTY) @@ -311,7 +311,7 @@ char NS16550_getc(NS16550_t com_port) return serial_in(&com_port->rbr); } -int NS16550_tstc(NS16550_t com_port) +int ns16550_tstc(struct ns16550 *com_port) { return (serial_in(&com_port->lsr) & UART_LSR_DR) != 0; } @@ -324,7 +324,7 @@ int NS16550_tstc(NS16550_t com_port) static inline void _debug_uart_init(void) { - struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; + struct ns16550 *com_port = (struct ns16550 *)CONFIG_DEBUG_UART_BASE; int baud_divisor; /* @@ -345,7 +345,7 @@ static inline void _debug_uart_init(void) serial_dout(&com_port->lcr, UART_LCRVAL); } -static inline int NS16550_read_baud_divisor(struct NS16550 *com_port) +static inline int NS16550_read_baud_divisor(struct ns16550 *com_port) { int ret; @@ -359,7 +359,7 @@ static inline int NS16550_read_baud_divisor(struct NS16550 *com_port) static inline void _debug_uart_putc(int ch) { - struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; + struct ns16550 *com_port = (struct ns16550 *)CONFIG_DEBUG_UART_BASE; while (!(serial_din(&com_port->lsr) & UART_LSR_THRE)) { #ifdef CONFIG_DEBUG_UART_NS16550_CHECK_ENABLED @@ -377,7 +377,7 @@ DEBUG_UART_FUNCS #if CONFIG_IS_ENABLED(DM_SERIAL) static int ns16550_serial_putc(struct udevice *dev, const char ch) { - struct NS16550 *const com_port = dev_get_priv(dev); + struct ns16550 *const com_port = dev_get_priv(dev); if (!(serial_in(&com_port->lsr) & UART_LSR_THRE)) return -EAGAIN; @@ -397,7 +397,7 @@ static int ns16550_serial_putc(struct udevice *dev, const char ch) static int ns16550_serial_pending(struct udevice *dev, bool input) { - struct NS16550 *const com_port = dev_get_priv(dev); + struct ns16550 *const com_port = dev_get_priv(dev); if (input) return (serial_in(&com_port->lsr) & UART_LSR_DR) ? 1 : 0; @@ -407,7 +407,7 @@ static int ns16550_serial_pending(struct udevice *dev, bool input) static int ns16550_serial_getc(struct udevice *dev) { - struct NS16550 *const com_port = dev_get_priv(dev); + struct ns16550 *const com_port = dev_get_priv(dev); if (!(serial_in(&com_port->lsr) & UART_LSR_DR)) return -EAGAIN; @@ -417,20 +417,20 @@ static int ns16550_serial_getc(struct udevice *dev) static int ns16550_serial_setbrg(struct udevice *dev, int baudrate) { - struct NS16550 *const com_port = dev_get_priv(dev); + struct ns16550 *const com_port = dev_get_priv(dev); struct ns16550_plat *plat = com_port->plat; int clock_divisor; clock_divisor = ns16550_calc_divisor(com_port, plat->clock, baudrate); - NS16550_setbrg(com_port, clock_divisor); + ns16550_setbrg(com_port, clock_divisor); return 0; } static int ns16550_serial_setconfig(struct udevice *dev, uint serial_config) { - struct NS16550 *const com_port = dev_get_priv(dev); + struct ns16550 *const com_port = dev_get_priv(dev); int lcr_val = UART_LCR_WLS_8; uint parity = SERIAL_GET_PARITY(serial_config); uint bits = SERIAL_GET_BITS(serial_config); @@ -464,7 +464,7 @@ static int ns16550_serial_setconfig(struct udevice *dev, uint serial_config) static int ns16550_serial_getinfo(struct udevice *dev, struct serial_device_info *info) { - struct NS16550 *const com_port = dev_get_priv(dev); + struct ns16550 *const com_port = dev_get_priv(dev); struct ns16550_plat *plat = com_port->plat; info->type = SERIAL_CHIP_16550_COMPATIBLE; @@ -498,8 +498,8 @@ static int ns16550_serial_assign_base(struct ns16550_plat *plat, ulong base) int ns16550_serial_probe(struct udevice *dev) { - struct ns16550_plat *plat = dev->plat; - struct NS16550 *const com_port = dev_get_priv(dev); + struct ns16550_plat *plat = dev_get_plat(dev); + struct ns16550 *const com_port = dev_get_priv(dev); struct reset_ctl_bulk reset_bulk; fdt_addr_t addr; int ret; @@ -520,7 +520,7 @@ int ns16550_serial_probe(struct udevice *dev) reset_deassert_bulk(&reset_bulk); com_port->plat = dev_get_plat(dev); - NS16550_init(com_port, -1); + ns16550_init(com_port, -1); return 0; } @@ -535,7 +535,7 @@ enum { #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) int ns16550_serial_of_to_plat(struct udevice *dev) { - struct ns16550_plat *plat = dev->plat; + struct ns16550_plat *plat = dev_get_plat(dev); const u32 port_type = dev_get_driver_data(dev); fdt_addr_t addr; struct clk clk; @@ -613,7 +613,7 @@ U_BOOT_DRIVER(ns16550_serial) = { .of_to_plat = ns16550_serial_of_to_plat, .plat_auto = sizeof(struct ns16550_plat), #endif - .priv_auto = sizeof(struct NS16550), + .priv_auto = sizeof(struct ns16550), .probe = ns16550_serial_probe, .ops = &ns16550_serial_ops, #if !CONFIG_IS_ENABLED(OF_CONTROL) @@ -621,9 +621,9 @@ U_BOOT_DRIVER(ns16550_serial) = { #endif }; -U_BOOT_DRIVER_ALIAS(ns16550_serial, rockchip_rk3328_uart) -U_BOOT_DRIVER_ALIAS(ns16550_serial, rockchip_rk3368_uart) -U_BOOT_DRIVER_ALIAS(ns16550_serial, ti_da830_uart) +DM_DRIVER_ALIAS(ns16550_serial, rockchip_rk3328_uart) +DM_DRIVER_ALIAS(ns16550_serial, rockchip_rk3368_uart) +DM_DRIVER_ALIAS(ns16550_serial, ti_da830_uart) #endif #endif /* SERIAL_PRESENT */ diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c index c7d5390b435..756738c2d21 100644 --- a/drivers/serial/sandbox.c +++ b/drivers/serial/sandbox.c @@ -17,25 +17,11 @@ #include <serial.h> #include <video.h> #include <linux/compiler.h> +#include <asm/serial.h> #include <asm/state.h> DECLARE_GLOBAL_DATA_PTR; -struct sandbox_serial_plat { - int colour; /* Text colour to use for output, -1 for none */ -}; - -/** - * struct sandbox_serial_priv - Private data for this driver - * - * @buf: holds input characters available to be read by this driver - */ -struct sandbox_serial_priv { - struct membuff buf; - char serial_buf[16]; - bool start_of_line; -}; - /** * output_ansi_colour() - Output an ANSI colour code * @@ -72,7 +58,7 @@ static int sandbox_serial_probe(struct udevice *dev) static int sandbox_serial_remove(struct udevice *dev) { - struct sandbox_serial_plat *plat = dev->plat; + struct sandbox_serial_plat *plat = dev_get_plat(dev); if (plat->colour != -1) output_ansi_reset(); @@ -83,7 +69,7 @@ static int sandbox_serial_remove(struct udevice *dev) static int sandbox_serial_putc(struct udevice *dev, const char ch) { struct sandbox_serial_priv *priv = dev_get_priv(dev); - struct sandbox_serial_plat *plat = dev->plat; + struct sandbox_serial_plat *plat = dev_get_plat(dev); /* With of-platdata we don't real the colour correctly, so disable it */ if (!CONFIG_IS_ENABLED(OF_PLATDATA) && priv->start_of_line && @@ -203,7 +189,7 @@ static const char * const ansi_colour[] = { static int sandbox_serial_of_to_plat(struct udevice *dev) { - struct sandbox_serial_plat *plat = dev->plat; + struct sandbox_serial_plat *plat = dev_get_plat(dev); const char *colour; int i; @@ -255,7 +241,7 @@ static const struct sandbox_serial_plat platdata_non_fdt = { .colour = -1, }; -U_BOOT_DEVICE(serial_sandbox_non_fdt) = { +U_BOOT_DRVINFO(serial_sandbox_non_fdt) = { .name = "sandbox_serial", .plat = &platdata_non_fdt, }; diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index b6457242dea..58a6541d8cc 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -123,7 +123,7 @@ static void serial_find_console_or_panic(void) #ifdef CONFIG_SERIAL_SEARCH_ALL if (!uclass_get_device_by_seq(UCLASS_SERIAL, INDEX, &dev) || !uclass_get_device(UCLASS_SERIAL, INDEX, &dev)) { - if (dev->flags & DM_FLAG_ACTIVATED) { + if (dev_get_flags(dev) & DM_FLAG_ACTIVATED) { gd->cur_serial_dev = dev; return; } diff --git a/drivers/serial/serial_arc.c b/drivers/serial/serial_arc.c index 022e37748c8..445eacc8aac 100644 --- a/drivers/serial/serial_arc.c +++ b/drivers/serial/serial_arc.c @@ -37,7 +37,7 @@ struct arc_serial_plat { static int arc_serial_setbrg(struct udevice *dev, int baudrate) { - struct arc_serial_plat *plat = dev->plat; + struct arc_serial_plat *plat = dev_get_plat(dev); struct arc_serial_regs *const regs = plat->reg; int arc_console_baud = gd->cpu_clk / (baudrate * 4) - 1; @@ -49,7 +49,7 @@ static int arc_serial_setbrg(struct udevice *dev, int baudrate) static int arc_serial_putc(struct udevice *dev, const char c) { - struct arc_serial_plat *plat = dev->plat; + struct arc_serial_plat *plat = dev_get_plat(dev); struct arc_serial_regs *const regs = plat->reg; while (!(readb(®s->status) & UART_TXEMPTY)) @@ -67,7 +67,7 @@ static int arc_serial_tstc(struct arc_serial_regs *const regs) static int arc_serial_pending(struct udevice *dev, bool input) { - struct arc_serial_plat *plat = dev->plat; + struct arc_serial_plat *plat = dev_get_plat(dev); struct arc_serial_regs *const regs = plat->reg; uint32_t status = readb(®s->status); @@ -79,7 +79,7 @@ static int arc_serial_pending(struct udevice *dev, bool input) static int arc_serial_getc(struct udevice *dev) { - struct arc_serial_plat *plat = dev->plat; + struct arc_serial_plat *plat = dev_get_plat(dev); struct arc_serial_regs *const regs = plat->reg; while (!arc_serial_tstc(regs)) diff --git a/drivers/serial/serial_coreboot.c b/drivers/serial/serial_coreboot.c index 904e1b306e0..88c8209c5db 100644 --- a/drivers/serial/serial_coreboot.c +++ b/drivers/serial/serial_coreboot.c @@ -37,7 +37,7 @@ U_BOOT_DRIVER(coreboot_uart) = { .name = "coreboot_uart", .id = UCLASS_SERIAL, .of_match = coreboot_serial_ids, - .priv_auto = sizeof(struct NS16550), + .priv_auto = sizeof(struct ns16550), .plat_auto = sizeof(struct ns16550_plat), .of_to_plat = coreboot_of_to_plat, .probe = ns16550_serial_probe, diff --git a/drivers/serial/serial_intel_mid.c b/drivers/serial/serial_intel_mid.c index be9bf662fd2..bbf19057c4d 100644 --- a/drivers/serial/serial_intel_mid.c +++ b/drivers/serial/serial_intel_mid.c @@ -61,7 +61,7 @@ U_BOOT_DRIVER(serial_intel_mid) = { .of_match = mid_serial_ids, .of_to_plat = ns16550_serial_of_to_plat, .plat_auto = sizeof(struct ns16550_plat), - .priv_auto = sizeof(struct NS16550), + .priv_auto = sizeof(struct ns16550), .probe = mid_serial_probe, .ops = &ns16550_serial_ops, }; diff --git a/drivers/serial/serial_linflexuart.c b/drivers/serial/serial_linflexuart.c index ced005706ae..c3714e1e1ec 100644 --- a/drivers/serial/serial_linflexuart.c +++ b/drivers/serial/serial_linflexuart.c @@ -168,7 +168,7 @@ static void linflex_serial_init_internal(struct linflex_fsl *lfuart) static int linflex_serial_probe(struct udevice *dev) { - struct linflex_serial_plat *plat = dev->plat; + struct linflex_serial_plat *plat = dev_get_plat(dev); struct linflex_serial_priv *priv = dev_get_priv(dev); priv->lfuart = (struct linflex_fsl *)plat->base_addr; diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c index 5beb5f2ce64..a35e5be303f 100644 --- a/drivers/serial/serial_lpuart.c +++ b/drivers/serial/serial_lpuart.c @@ -138,7 +138,7 @@ static inline int get_lpuart_clk_rate(struct udevice *dev, u32 *clk) static bool is_lpuart32(struct udevice *dev) { - struct lpuart_serial_plat *plat = dev->plat; + struct lpuart_serial_plat *plat = dev_get_plat(dev); return plat->flags & LPUART_FLAG_REGMAP_32BIT_REG; } @@ -445,7 +445,7 @@ static int lpuart_serial_setbrg(struct udevice *dev, int baudrate) static int lpuart_serial_getc(struct udevice *dev) { - struct lpuart_serial_plat *plat = dev->plat; + struct lpuart_serial_plat *plat = dev_get_plat(dev); if (is_lpuart32(dev)) return _lpuart32_serial_getc(plat); @@ -455,7 +455,7 @@ static int lpuart_serial_getc(struct udevice *dev) static int lpuart_serial_putc(struct udevice *dev, const char c) { - struct lpuart_serial_plat *plat = dev->plat; + struct lpuart_serial_plat *plat = dev_get_plat(dev); if (is_lpuart32(dev)) _lpuart32_serial_putc(plat, c); @@ -467,7 +467,7 @@ static int lpuart_serial_putc(struct udevice *dev, const char c) static int lpuart_serial_pending(struct udevice *dev, bool input) { - struct lpuart_serial_plat *plat = dev->plat; + struct lpuart_serial_plat *plat = dev_get_plat(dev); struct lpuart_fsl *reg = plat->reg; struct lpuart_fsl_reg32 *reg32 = plat->reg; u32 stat; @@ -513,7 +513,7 @@ static int lpuart_serial_probe(struct udevice *dev) static int lpuart_serial_of_to_plat(struct udevice *dev) { - struct lpuart_serial_plat *plat = dev->plat; + struct lpuart_serial_plat *plat = dev_get_plat(dev); const void *blob = gd->fdt_blob; int node = dev_of_offset(dev); fdt_addr_t addr; diff --git a/drivers/serial/serial_mcf.c b/drivers/serial/serial_mcf.c index 4ba6dc32f92..e6e21b2ce8c 100644 --- a/drivers/serial/serial_mcf.c +++ b/drivers/serial/serial_mcf.c @@ -83,7 +83,7 @@ static void mcf_serial_setbrg_common(uart_t *uart, int baudrate) static int coldfire_serial_probe(struct udevice *dev) { - struct coldfire_serial_plat *plat = dev->plat; + struct coldfire_serial_plat *plat = dev_get_plat(dev); plat->port = dev_seq(dev); @@ -93,7 +93,7 @@ static int coldfire_serial_probe(struct udevice *dev) static int coldfire_serial_putc(struct udevice *dev, const char ch) { - struct coldfire_serial_plat *plat = dev->plat; + struct coldfire_serial_plat *plat = dev_get_plat(dev); uart_t *uart = (uart_t *)plat->base; /* Wait for last character to go. */ @@ -107,7 +107,7 @@ static int coldfire_serial_putc(struct udevice *dev, const char ch) static int coldfire_serial_getc(struct udevice *dev) { - struct coldfire_serial_plat *plat = dev->plat; + struct coldfire_serial_plat *plat = dev_get_plat(dev); uart_t *uart = (uart_t *)(plat->base); /* Wait for a character to arrive. */ @@ -119,7 +119,7 @@ static int coldfire_serial_getc(struct udevice *dev) int coldfire_serial_setbrg(struct udevice *dev, int baudrate) { - struct coldfire_serial_plat *plat = dev->plat; + struct coldfire_serial_plat *plat = dev_get_plat(dev); uart_t *uart = (uart_t *)(plat->base); mcf_serial_setbrg_common(uart, baudrate); @@ -129,7 +129,7 @@ int coldfire_serial_setbrg(struct udevice *dev, int baudrate) static int coldfire_serial_pending(struct udevice *dev, bool input) { - struct coldfire_serial_plat *plat = dev->plat; + struct coldfire_serial_plat *plat = dev_get_plat(dev); uart_t *uart = (uart_t *)(plat->base); if (input) diff --git a/drivers/serial/serial_meson.c b/drivers/serial/serial_meson.c index 40d9bfe7c6f..d69ec221e45 100644 --- a/drivers/serial/serial_meson.c +++ b/drivers/serial/serial_meson.c @@ -57,7 +57,7 @@ static void meson_serial_init(struct meson_uart *uart) static int meson_serial_probe(struct udevice *dev) { - struct meson_serial_plat *plat = dev->plat; + struct meson_serial_plat *plat = dev_get_plat(dev); struct meson_uart *const uart = plat->reg; meson_serial_init(uart); @@ -67,7 +67,7 @@ static int meson_serial_probe(struct udevice *dev) static void meson_serial_rx_error(struct udevice *dev) { - struct meson_serial_plat *plat = dev->plat; + struct meson_serial_plat *plat = dev_get_plat(dev); struct meson_uart *const uart = plat->reg; u32 val = readl(&uart->control); @@ -83,7 +83,7 @@ static void meson_serial_rx_error(struct udevice *dev) static int meson_serial_getc(struct udevice *dev) { - struct meson_serial_plat *plat = dev->plat; + struct meson_serial_plat *plat = dev_get_plat(dev); struct meson_uart *const uart = plat->reg; uint32_t status = readl(&uart->status); @@ -100,7 +100,7 @@ static int meson_serial_getc(struct udevice *dev) static int meson_serial_putc(struct udevice *dev, const char ch) { - struct meson_serial_plat *plat = dev->plat; + struct meson_serial_plat *plat = dev_get_plat(dev); struct meson_uart *const uart = plat->reg; if (readl(&uart->status) & AML_UART_TX_FULL) @@ -113,7 +113,7 @@ static int meson_serial_putc(struct udevice *dev, const char ch) static int meson_serial_pending(struct udevice *dev, bool input) { - struct meson_serial_plat *plat = dev->plat; + struct meson_serial_plat *plat = dev_get_plat(dev); struct meson_uart *const uart = plat->reg; uint32_t status = readl(&uart->status); @@ -138,7 +138,7 @@ static int meson_serial_pending(struct udevice *dev, bool input) static int meson_serial_of_to_plat(struct udevice *dev) { - struct meson_serial_plat *plat = dev->plat; + struct meson_serial_plat *plat = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr(dev); diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c index 2603fa8611a..e5795da99d9 100644 --- a/drivers/serial/serial_mxc.c +++ b/drivers/serial/serial_mxc.c @@ -264,7 +264,7 @@ __weak struct serial_device *default_serial_console(void) int mxc_serial_setbrg(struct udevice *dev, int baudrate) { - struct mxc_serial_plat *plat = dev->plat; + struct mxc_serial_plat *plat = dev_get_plat(dev); u32 clk = imx_get_uartclk(); _mxc_serial_setbrg(plat->reg, clk, baudrate, plat->use_dte); @@ -274,7 +274,7 @@ int mxc_serial_setbrg(struct udevice *dev, int baudrate) static int mxc_serial_probe(struct udevice *dev) { - struct mxc_serial_plat *plat = dev->plat; + struct mxc_serial_plat *plat = dev_get_plat(dev); _mxc_serial_init(plat->reg, plat->use_dte); @@ -283,7 +283,7 @@ static int mxc_serial_probe(struct udevice *dev) static int mxc_serial_getc(struct udevice *dev) { - struct mxc_serial_plat *plat = dev->plat; + struct mxc_serial_plat *plat = dev_get_plat(dev); struct mxc_uart *const uart = plat->reg; if (readl(&uart->ts) & UTS_RXEMPTY) @@ -294,7 +294,7 @@ static int mxc_serial_getc(struct udevice *dev) static int mxc_serial_putc(struct udevice *dev, const char ch) { - struct mxc_serial_plat *plat = dev->plat; + struct mxc_serial_plat *plat = dev_get_plat(dev); struct mxc_uart *const uart = plat->reg; if (!(readl(&uart->ts) & UTS_TXEMPTY)) @@ -307,7 +307,7 @@ static int mxc_serial_putc(struct udevice *dev, const char ch) static int mxc_serial_pending(struct udevice *dev, bool input) { - struct mxc_serial_plat *plat = dev->plat; + struct mxc_serial_plat *plat = dev_get_plat(dev); struct mxc_uart *const uart = plat->reg; uint32_t sr2 = readl(&uart->sr2); @@ -327,7 +327,7 @@ static const struct dm_serial_ops mxc_serial_ops = { #if CONFIG_IS_ENABLED(OF_CONTROL) static int mxc_serial_of_to_plat(struct udevice *dev) { - struct mxc_serial_plat *plat = dev->plat; + struct mxc_serial_plat *plat = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr(dev); diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c index ef394b72350..b5beca976d3 100644 --- a/drivers/serial/serial_ns16550.c +++ b/drivers/serial/serial_ns16550.c @@ -36,34 +36,34 @@ DECLARE_GLOBAL_DATA_PTR; /* Note: The port number specified in the functions is 1 based. * the array is 0 based. */ -static NS16550_t serial_ports[6] = { +static struct ns16550 *serial_ports[6] = { #ifdef CONFIG_SYS_NS16550_COM1 - (NS16550_t)CONFIG_SYS_NS16550_COM1, + (struct ns16550 *)CONFIG_SYS_NS16550_COM1, #else NULL, #endif #ifdef CONFIG_SYS_NS16550_COM2 - (NS16550_t)CONFIG_SYS_NS16550_COM2, + (struct ns16550 *)CONFIG_SYS_NS16550_COM2, #else NULL, #endif #ifdef CONFIG_SYS_NS16550_COM3 - (NS16550_t)CONFIG_SYS_NS16550_COM3, + (struct ns16550 *)CONFIG_SYS_NS16550_COM3, #else NULL, #endif #ifdef CONFIG_SYS_NS16550_COM4 - (NS16550_t)CONFIG_SYS_NS16550_COM4, + (struct ns16550 *)CONFIG_SYS_NS16550_COM4, #else NULL, #endif #ifdef CONFIG_SYS_NS16550_COM5 - (NS16550_t)CONFIG_SYS_NS16550_COM5, + (struct ns16550 *)CONFIG_SYS_NS16550_COM5, #else NULL, #endif #ifdef CONFIG_SYS_NS16550_COM6 - (NS16550_t)CONFIG_SYS_NS16550_COM6 + (struct ns16550 *)CONFIG_SYS_NS16550_COM6 #else NULL #endif @@ -78,7 +78,7 @@ static NS16550_t serial_ports[6] = { int clock_divisor; \ clock_divisor = ns16550_calc_divisor(serial_ports[port-1], \ CONFIG_SYS_NS16550_CLK, gd->baudrate); \ - NS16550_init(serial_ports[port-1], clock_divisor); \ + ns16550_init(serial_ports[port - 1], clock_divisor); \ return 0 ; \ } \ static void eserial##port##_setbrg(void) \ @@ -117,9 +117,9 @@ static NS16550_t serial_ports[6] = { static void _serial_putc(const char c, const int port) { 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) @@ -131,12 +131,12 @@ static void _serial_puts(const char *s, 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) { - return NS16550_tstc(PORT); + return ns16550_tstc(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, gd->baudrate); - NS16550_reinit(PORT, clock_divisor); + ns16550_reinit(PORT, clock_divisor); } static inline void diff --git a/drivers/serial/serial_omap.c b/drivers/serial/serial_omap.c index 2f38e1b8901..2b23ece442e 100644 --- a/drivers/serial/serial_omap.c +++ b/drivers/serial/serial_omap.c @@ -66,7 +66,7 @@ static inline int serial_in_shift(void *addr, int shift) static inline void _debug_uart_init(void) { - struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; + struct ns16550 *com_port = (struct ns16550 *)CONFIG_DEBUG_UART_BASE; int baud_divisor; baud_divisor = ns16550_calc_divisor(com_port, CONFIG_DEBUG_UART_CLOCK, @@ -85,7 +85,7 @@ static inline void _debug_uart_init(void) static inline void _debug_uart_putc(int ch) { - struct NS16550 *com_port = (struct NS16550 *)CONFIG_DEBUG_UART_BASE; + struct ns16550 *com_port = (struct ns16550 *)CONFIG_DEBUG_UART_BASE; while (!(serial_din(&com_port->lsr) & UART_LSR_THRE)) ; @@ -101,7 +101,7 @@ DEBUG_UART_FUNCS #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) static int omap_serial_of_to_plat(struct udevice *dev) { - struct ns16550_plat *plat = dev->plat; + struct ns16550_plat *plat = dev_get_plat(dev); fdt_addr_t addr; struct clk clk; int err; @@ -160,7 +160,7 @@ U_BOOT_DRIVER(omap_serial) = { .of_to_plat = omap_serial_of_to_plat, .plat_auto = sizeof(struct ns16550_plat), #endif - .priv_auto = sizeof(struct NS16550), + .priv_auto = sizeof(struct ns16550), .probe = ns16550_serial_probe, .ops = &ns16550_serial_ops, #if !CONFIG_IS_ENABLED(OF_CONTROL) diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c index d82f3b97529..669841ede4d 100644 --- a/drivers/serial/serial_pxa.c +++ b/drivers/serial/serial_pxa.c @@ -268,7 +268,7 @@ void pxa_serial_initialize(void) #ifdef CONFIG_DM_SERIAL static int pxa_serial_probe(struct udevice *dev) { - struct pxa_serial_plat *plat = dev->plat; + struct pxa_serial_plat *plat = dev_get_plat(dev); pxa_setbrg_common((struct pxa_uart_regs *)plat->base, plat->port, plat->baudrate); @@ -277,7 +277,7 @@ static int pxa_serial_probe(struct udevice *dev) static int pxa_serial_putc(struct udevice *dev, const char ch) { - struct pxa_serial_plat *plat = dev->plat; + struct pxa_serial_plat *plat = dev_get_plat(dev); struct pxa_uart_regs *uart_regs = (struct pxa_uart_regs *)plat->base; /* Wait for last character to go. */ @@ -291,7 +291,7 @@ static int pxa_serial_putc(struct udevice *dev, const char ch) static int pxa_serial_getc(struct udevice *dev) { - struct pxa_serial_plat *plat = dev->plat; + struct pxa_serial_plat *plat = dev_get_plat(dev); struct pxa_uart_regs *uart_regs = (struct pxa_uart_regs *)plat->base; /* Wait for a character to arrive. */ @@ -303,7 +303,7 @@ static int pxa_serial_getc(struct udevice *dev) int pxa_serial_setbrg(struct udevice *dev, int baudrate) { - struct pxa_serial_plat *plat = dev->plat; + struct pxa_serial_plat *plat = dev_get_plat(dev); struct pxa_uart_regs *uart_regs = (struct pxa_uart_regs *)plat->base; int port = plat->port; @@ -314,7 +314,7 @@ int pxa_serial_setbrg(struct udevice *dev, int baudrate) static int pxa_serial_pending(struct udevice *dev, bool input) { - struct pxa_serial_plat *plat = dev->plat; + struct pxa_serial_plat *plat = dev_get_plat(dev); struct pxa_uart_regs *uart_regs = (struct pxa_uart_regs *)plat->base; if (input) diff --git a/drivers/serial/serial_rockchip.c b/drivers/serial/serial_rockchip.c index 4c0548ed0f3..97d40869a2a 100644 --- a/drivers/serial/serial_rockchip.c +++ b/drivers/serial/serial_rockchip.c @@ -10,6 +10,7 @@ #include <ns16550.h> #include <serial.h> #include <asm/arch-rockchip/clock.h> +#include <dm/device-internal.h> #if defined(CONFIG_ROCKCHIP_RK3188) struct rockchip_uart_plat { @@ -34,7 +35,7 @@ static int rockchip_serial_probe(struct udevice *dev) plat->plat.reg_shift = plat->dtplat.reg_shift; plat->plat.clock = plat->dtplat.clock_frequency; plat->plat.fcr = UART_FCR_DEFVAL; - dev->plat = &plat->plat; + dev_set_plat(dev, &plat->plat); return ns16550_serial_probe(dev); } @@ -42,7 +43,7 @@ static int rockchip_serial_probe(struct udevice *dev) U_BOOT_DRIVER(rockchip_rk3188_uart) = { .name = "rockchip_rk3188_uart", .id = UCLASS_SERIAL, - .priv_auto = sizeof(struct NS16550), + .priv_auto = sizeof(struct ns16550), .plat_auto = sizeof(struct rockchip_uart_plat), .probe = rockchip_serial_probe, .ops = &ns16550_serial_ops, @@ -52,7 +53,7 @@ U_BOOT_DRIVER(rockchip_rk3188_uart) = { U_BOOT_DRIVER(rockchip_rk3288_uart) = { .name = "rockchip_rk3288_uart", .id = UCLASS_SERIAL, - .priv_auto = sizeof(struct NS16550), + .priv_auto = sizeof(struct ns16550), .plat_auto = sizeof(struct rockchip_uart_plat), .probe = rockchip_serial_probe, .ops = &ns16550_serial_ops, diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index 120df835dbd..0eac0d53a50 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -88,7 +88,7 @@ static void __maybe_unused s5p_serial_baud(struct s5p_uart *uart, uint uclk, #ifndef CONFIG_SPL_BUILD int s5p_serial_setbrg(struct udevice *dev, int baudrate) { - struct s5p_serial_plat *plat = dev->plat; + struct s5p_serial_plat *plat = dev_get_plat(dev); struct s5p_uart *const uart = plat->reg; u32 uclk; @@ -111,7 +111,7 @@ int s5p_serial_setbrg(struct udevice *dev, int baudrate) static int s5p_serial_probe(struct udevice *dev) { - struct s5p_serial_plat *plat = dev->plat; + struct s5p_serial_plat *plat = dev_get_plat(dev); struct s5p_uart *const uart = plat->reg; s5p_serial_init(uart); @@ -140,7 +140,7 @@ static int serial_err_check(const struct s5p_uart *const uart, int op) static int s5p_serial_getc(struct udevice *dev) { - struct s5p_serial_plat *plat = dev->plat; + struct s5p_serial_plat *plat = dev_get_plat(dev); struct s5p_uart *const uart = plat->reg; if (!(readl(&uart->ufstat) & RX_FIFO_COUNT_MASK)) @@ -152,7 +152,7 @@ static int s5p_serial_getc(struct udevice *dev) static int s5p_serial_putc(struct udevice *dev, const char ch) { - struct s5p_serial_plat *plat = dev->plat; + struct s5p_serial_plat *plat = dev_get_plat(dev); struct s5p_uart *const uart = plat->reg; if (readl(&uart->ufstat) & TX_FIFO_FULL) @@ -166,7 +166,7 @@ static int s5p_serial_putc(struct udevice *dev, const char ch) static int s5p_serial_pending(struct udevice *dev, bool input) { - struct s5p_serial_plat *plat = dev->plat; + struct s5p_serial_plat *plat = dev_get_plat(dev); struct s5p_uart *const uart = plat->reg; uint32_t ufstat = readl(&uart->ufstat); @@ -178,7 +178,7 @@ static int s5p_serial_pending(struct udevice *dev, bool input) static int s5p_serial_of_to_plat(struct udevice *dev) { - struct s5p_serial_plat *plat = dev->plat; + struct s5p_serial_plat *plat = dev_get_plat(dev); fdt_addr_t addr; addr = dev_read_addr(dev); |