summaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/altera_jtag_uart.c18
-rw-r--r--drivers/serial/altera_uart.c18
-rw-r--r--drivers/serial/atmel_usart.c6
-rw-r--r--drivers/serial/lpc32xx_hsuart.c6
-rw-r--r--drivers/serial/ns16550.c98
-rw-r--r--drivers/serial/sandbox.c85
-rw-r--r--drivers/serial/serial-uclass.c4
-rw-r--r--drivers/serial/serial_ar933x.c2
-rw-r--r--drivers/serial/serial_arc.c18
-rw-r--r--drivers/serial/serial_bcm283x_mu.c10
-rw-r--r--drivers/serial/serial_bcm283x_pl011.c10
-rw-r--r--drivers/serial/serial_bcm6345.c2
-rw-r--r--drivers/serial/serial_coreboot.c10
-rw-r--r--drivers/serial/serial_cortina.c6
-rw-r--r--drivers/serial/serial_efi.c2
-rw-r--r--drivers/serial/serial_intel_mid.c10
-rw-r--r--drivers/serial/serial_linflexuart.c6
-rw-r--r--drivers/serial/serial_lpuart.c42
-rw-r--r--drivers/serial/serial_mcf.c20
-rw-r--r--drivers/serial/serial_meson.c20
-rw-r--r--drivers/serial/serial_msm.c6
-rw-r--r--drivers/serial/serial_mtk.c6
-rw-r--r--drivers/serial/serial_mvebu_a3700.c20
-rw-r--r--drivers/serial/serial_mxc.c18
-rw-r--r--drivers/serial/serial_ns16550.c26
-rw-r--r--drivers/serial/serial_omap.c14
-rw-r--r--drivers/serial/serial_owl.c6
-rw-r--r--drivers/serial/serial_pic32.c2
-rw-r--r--drivers/serial/serial_pl01x.c14
-rw-r--r--drivers/serial/serial_pl01x_internal.h2
-rw-r--r--drivers/serial/serial_pxa.c10
-rw-r--r--drivers/serial/serial_rockchip.c21
-rw-r--r--drivers/serial/serial_s5p.c22
-rw-r--r--drivers/serial/serial_sh.c14
-rw-r--r--drivers/serial/serial_sifive.c38
-rw-r--r--drivers/serial/serial_sti_asc.c2
-rw-r--r--drivers/serial/serial_stm32.c20
-rw-r--r--drivers/serial/serial_stm32.h2
-rw-r--r--drivers/serial/serial_uniphier.c2
-rw-r--r--drivers/serial/serial_xen.c2
-rw-r--r--drivers/serial/serial_xuartlite.c20
-rw-r--r--drivers/serial/serial_zynq.c38
42 files changed, 333 insertions, 365 deletions
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c
index 35b76f53f9..4435fcf56b 100644
--- a/drivers/serial/altera_jtag_uart.c
+++ b/drivers/serial/altera_jtag_uart.c
@@ -26,7 +26,7 @@ struct altera_jtaguart_regs {
u32 control; /* Control register */
};
-struct altera_jtaguart_platdata {
+struct altera_jtaguart_plat {
struct altera_jtaguart_regs *regs;
};
@@ -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_platdata *plat = dev->platdata;
+ struct altera_jtaguart_plat *plat = dev_get_plat(dev);
struct altera_jtaguart_regs *const regs = plat->regs;
u32 st = readl(&regs->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_platdata *plat = dev->platdata;
+ struct altera_jtaguart_plat *plat = dev_get_plat(dev);
struct altera_jtaguart_regs *const regs = plat->regs;
u32 st = readl(&regs->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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ struct altera_jtaguart_plat *plat = dev_get_plat(dev);
struct altera_jtaguart_regs *const regs = plat->regs;
writel(ALTERA_JTAG_AC, &regs->control); /* clear AC flag */
@@ -91,9 +91,9 @@ static int altera_jtaguart_probe(struct udevice *dev)
return 0;
}
-static int altera_jtaguart_ofdata_to_platdata(struct udevice *dev)
+static int altera_jtaguart_of_to_plat(struct udevice *dev)
{
- struct altera_jtaguart_platdata *plat = dev_get_platdata(dev);
+ struct altera_jtaguart_plat *plat = dev_get_plat(dev);
plat->regs = map_physmem(dev_read_addr(dev),
sizeof(struct altera_jtaguart_regs),
@@ -118,8 +118,8 @@ U_BOOT_DRIVER(altera_jtaguart) = {
.name = "altera_jtaguart",
.id = UCLASS_SERIAL,
.of_match = altera_jtaguart_ids,
- .ofdata_to_platdata = altera_jtaguart_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct altera_jtaguart_platdata),
+ .of_to_plat = altera_jtaguart_of_to_plat,
+ .plat_auto = sizeof(struct altera_jtaguart_plat),
.probe = altera_jtaguart_probe,
.ops = &altera_jtaguart_ops,
};
diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index 0be5cd75c8..b18be6e245 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -25,14 +25,14 @@ struct altera_uart_regs {
u32 endofpacket; /* End-of-packet reg */
};
-struct altera_uart_platdata {
+struct altera_uart_plat {
struct altera_uart_regs *regs;
unsigned int uartclk;
};
static int altera_uart_setbrg(struct udevice *dev, int baudrate)
{
- struct altera_uart_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ struct altera_uart_plat *plat = dev_get_plat(dev);
struct altera_uart_regs *const regs = plat->regs;
if (!(readl(&regs->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_platdata *plat = dev->platdata;
+ struct altera_uart_plat *plat = dev_get_plat(dev);
struct altera_uart_regs *const regs = plat->regs;
u32 st = readl(&regs->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_platdata *plat = dev->platdata;
+ struct altera_uart_plat *plat = dev_get_plat(dev);
struct altera_uart_regs *const regs = plat->regs;
if (!(readl(&regs->status) & ALTERA_UART_RRDY))
@@ -83,9 +83,9 @@ static int altera_uart_probe(struct udevice *dev)
return 0;
}
-static int altera_uart_ofdata_to_platdata(struct udevice *dev)
+static int altera_uart_of_to_plat(struct udevice *dev)
{
- struct altera_uart_platdata *plat = dev_get_platdata(dev);
+ struct altera_uart_plat *plat = dev_get_plat(dev);
plat->regs = map_physmem(dev_read_addr(dev),
sizeof(struct altera_uart_regs),
@@ -111,8 +111,8 @@ U_BOOT_DRIVER(altera_uart) = {
.name = "altera_uart",
.id = UCLASS_SERIAL,
.of_match = altera_uart_ids,
- .ofdata_to_platdata = altera_uart_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct altera_uart_platdata),
+ .of_to_plat = altera_uart_of_to_plat,
+ .plat_auto = sizeof(struct altera_uart_plat),
.probe = altera_uart_probe,
.ops = &altera_uart_ops,
};
diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index f759ea8893..7edec23e64 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_platdata *plat = dev->platdata;
+ 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)
@@ -304,14 +304,14 @@ U_BOOT_DRIVER(serial_atmel) = {
.id = UCLASS_SERIAL,
#if CONFIG_IS_ENABLED(OF_CONTROL)
.of_match = atmel_serial_ids,
- .platdata_auto_alloc_size = sizeof(struct atmel_serial_platdata),
+ .plat_auto = sizeof(struct atmel_serial_plat),
#endif
.probe = atmel_serial_probe,
.ops = &atmel_serial_ops,
#if !CONFIG_IS_ENABLED(OF_CONTROL)
.flags = DM_FLAG_PRE_RELOC,
#endif
- .priv_auto_alloc_size = sizeof(struct atmel_serial_priv),
+ .priv_auto = sizeof(struct atmel_serial_priv),
};
#endif
diff --git a/drivers/serial/lpc32xx_hsuart.c b/drivers/serial/lpc32xx_hsuart.c
index 7d31c6d4a1..d39a3c0494 100644
--- a/drivers/serial/lpc32xx_hsuart.c
+++ b/drivers/serial/lpc32xx_hsuart.c
@@ -85,10 +85,10 @@ static int lpc32xx_serial_init(struct hsuart_regs *hsuart)
static int lpc32xx_hsuart_probe(struct udevice *dev)
{
- struct lpc32xx_hsuart_platdata *platdata = dev_get_platdata(dev);
+ struct lpc32xx_hsuart_plat *plat = dev_get_plat(dev);
struct lpc32xx_hsuart_priv *priv = dev_get_priv(dev);
- priv->hsuart = (struct hsuart_regs *)platdata->base;
+ priv->hsuart = (struct hsuart_regs *)plat->base;
lpc32xx_serial_init(priv->hsuart);
@@ -107,6 +107,6 @@ U_BOOT_DRIVER(lpc32xx_hsuart) = {
.id = UCLASS_SERIAL,
.probe = lpc32xx_hsuart_probe,
.ops = &lpc32xx_hsuart_ops,
- .priv_auto_alloc_size = sizeof(struct lpc32xx_hsuart_priv),
+ .priv_auto = sizeof(struct lpc32xx_hsuart_priv),
.flags = DM_FLAG_PRE_RELOC,
};
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 702109b23b..65c6db073e 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -103,7 +103,7 @@ static inline int serial_in_shift(void *addr, int shift)
* on a platform
*/
#ifdef CONFIG_NS16550_DYNAMIC
-static void serial_out_dynamic(struct ns16550_platdata *plat, u8 *addr,
+static void serial_out_dynamic(struct ns16550_plat *plat, u8 *addr,
int value)
{
if (plat->flags & NS16550_FLAG_IO) {
@@ -124,7 +124,7 @@ static void serial_out_dynamic(struct ns16550_platdata *plat, u8 *addr,
}
}
-static int serial_in_dynamic(struct ns16550_platdata *plat, u8 *addr)
+static int serial_in_dynamic(struct ns16550_plat *plat, u8 *addr)
{
if (plat->flags & NS16550_FLAG_IO) {
return inb(addr);
@@ -144,21 +144,21 @@ static int serial_in_dynamic(struct ns16550_platdata *plat, u8 *addr)
}
}
#else
-static inline void serial_out_dynamic(struct ns16550_platdata *plat, u8 *addr,
+static inline void serial_out_dynamic(struct ns16550_plat *plat, u8 *addr,
int value)
{
}
-static inline int serial_in_dynamic(struct ns16550_platdata *plat, u8 *addr)
+static inline int serial_in_dynamic(struct ns16550_plat *plat, u8 *addr)
{
return 0;
}
#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_platdata *plat = port->plat;
+ struct ns16550_plat *plat = port->plat;
unsigned char *addr;
offset *= 1 << plat->reg_shift;
@@ -170,9 +170,9 @@ 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_platdata *plat = port->plat;
+ struct ns16550_plat *plat = port->plat;
unsigned char *addr;
offset *= 1 << plat->reg_shift;
@@ -184,9 +184,9 @@ 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_platdata *plat = port->plat;
+ struct ns16550_plat *plat = port->plat;
return plat->fcr;
}
@@ -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_platdata *plat = com_port->plat;
+ 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,8 +464,8 @@ 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_platdata *plat = com_port->plat;
+ struct ns16550 *const com_port = dev_get_priv(dev);
+ struct ns16550_plat *plat = com_port->plat;
info->type = SERIAL_CHIP_16550_COMPATIBLE;
#ifdef CONFIG_SYS_NS16550_PORT_MAPPED
@@ -482,7 +482,7 @@ static int ns16550_serial_getinfo(struct udevice *dev,
return 0;
}
-static int ns16550_serial_assign_base(struct ns16550_platdata *plat, ulong base)
+static int ns16550_serial_assign_base(struct ns16550_plat *plat, ulong base)
{
if (base == FDT_ADDR_T_NONE)
return -EINVAL;
@@ -498,15 +498,15 @@ static int ns16550_serial_assign_base(struct ns16550_platdata *plat, ulong base)
int ns16550_serial_probe(struct udevice *dev)
{
- struct ns16550_platdata *plat = dev->platdata;
- 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;
/*
* If we are on PCI bus, either directly attached to a PCI root port,
- * or via a PCI bridge, assign platdata->base before probing hardware.
+ * or via a PCI bridge, assign plat->base before probing hardware.
*/
if (device_is_on_pci_bus(dev)) {
addr = devfdt_get_addr_pci(dev);
@@ -519,8 +519,8 @@ int ns16550_serial_probe(struct udevice *dev)
if (!ret)
reset_deassert_bulk(&reset_bulk);
- com_port->plat = dev_get_platdata(dev);
- NS16550_init(com_port, -1);
+ com_port->plat = dev_get_plat(dev);
+ ns16550_init(com_port, -1);
return 0;
}
@@ -533,9 +533,9 @@ enum {
#endif
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
-int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
+int ns16550_serial_of_to_plat(struct udevice *dev)
{
- struct ns16550_platdata *plat = dev->platdata;
+ struct ns16550_plat *plat = dev_get_plat(dev);
const u32 port_type = dev_get_driver_data(dev);
fdt_addr_t addr;
struct clk clk;
@@ -610,10 +610,10 @@ U_BOOT_DRIVER(ns16550_serial) = {
.id = UCLASS_SERIAL,
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
.of_match = ns16550_serial_ids,
- .ofdata_to_platdata = ns16550_serial_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
+ .of_to_plat = ns16550_serial_of_to_plat,
+ .plat_auto = sizeof(struct ns16550_plat),
#endif
- .priv_auto_alloc_size = 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 db2fbac629..756738c2d2 100644
--- a/drivers/serial/sandbox.c
+++ b/drivers/serial/sandbox.c
@@ -12,39 +12,16 @@
#include <common.h>
#include <console.h>
#include <dm.h>
-#include <fdtdec.h>
#include <lcd.h>
#include <os.h>
#include <serial.h>
#include <video.h>
#include <linux/compiler.h>
+#include <asm/serial.h>
#include <asm/state.h>
DECLARE_GLOBAL_DATA_PTR;
-#if CONFIG_IS_ENABLED(OF_CONTROL)
-
-/*
- *
- * serial_buf: A buffer that holds keyboard characters for the
- * Sandbox U-Boot.
- *
- * invariants:
- * serial_buf_write == serial_buf_read -> empty buffer
- * (serial_buf_write + 1) % 16 == serial_buf_read -> full buffer
- */
-static unsigned char serial_buf[16];
-static unsigned int serial_buf_write;
-static unsigned int serial_buf_read;
-
-struct sandbox_serial_platdata {
- int colour; /* Text colour to use for output, -1 for none */
-};
-
-struct sandbox_serial_priv {
- bool start_of_line;
-};
-
/**
* output_ansi_colour() - Output an ANSI colour code
*
@@ -74,13 +51,14 @@ static int sandbox_serial_probe(struct udevice *dev)
if (state->term_raw != STATE_TERM_RAW)
disable_ctrlc(1);
+ membuff_init(&priv->buf, priv->serial_buf, sizeof(priv->serial_buf));
return 0;
}
static int sandbox_serial_remove(struct udevice *dev)
{
- struct sandbox_serial_platdata *plat = dev->platdata;
+ struct sandbox_serial_plat *plat = dev_get_plat(dev);
if (plat->colour != -1)
output_ansi_reset();
@@ -91,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_platdata *plat = dev->platdata;
+ 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 &&
@@ -107,46 +85,39 @@ static int sandbox_serial_putc(struct udevice *dev, const char ch)
return 0;
}
-static unsigned int increment_buffer_index(unsigned int index)
-{
- return (index + 1) % ARRAY_SIZE(serial_buf);
-}
-
static int sandbox_serial_pending(struct udevice *dev, bool input)
{
- const unsigned int next_index =
- increment_buffer_index(serial_buf_write);
+ struct sandbox_serial_priv *priv = dev_get_priv(dev);
ssize_t count;
+ char *data;
+ int avail;
if (!input)
return 0;
os_usleep(100);
-#ifndef CONFIG_SPL_BUILD
- video_sync_all();
-#endif
- if (next_index == serial_buf_read)
+ if (!IS_ENABLED(CONFIG_SPL_BUILD))
+ video_sync_all();
+ avail = membuff_putraw(&priv->buf, 100, false, &data);
+ if (!avail)
return 1; /* buffer full */
- count = os_read(0, &serial_buf[serial_buf_write], 1);
- if (count == 1)
- serial_buf_write = next_index;
+ count = os_read(0, data, avail);
+ if (count > 0)
+ membuff_putraw(&priv->buf, count, true, &data);
- return serial_buf_write != serial_buf_read;
+ return membuff_avail(&priv->buf);
}
static int sandbox_serial_getc(struct udevice *dev)
{
- int result;
+ struct sandbox_serial_priv *priv = dev_get_priv(dev);
if (!sandbox_serial_pending(dev, true))
return -EAGAIN; /* buffer empty */
- result = serial_buf[serial_buf_read];
- serial_buf_read = increment_buffer_index(serial_buf_read);
- return result;
+ return membuff_getbyte(&priv->buf);
}
-#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
#ifdef CONFIG_DEBUG_UART_SANDBOX
@@ -211,23 +182,21 @@ static int sandbox_serial_getinfo(struct udevice *dev,
return 0;
}
-#if CONFIG_IS_ENABLED(OF_CONTROL)
static const char * const ansi_colour[] = {
"black", "red", "green", "yellow", "blue", "megenta", "cyan",
"white",
};
-static int sandbox_serial_ofdata_to_platdata(struct udevice *dev)
+static int sandbox_serial_of_to_plat(struct udevice *dev)
{
- struct sandbox_serial_platdata *plat = dev->platdata;
+ struct sandbox_serial_plat *plat = dev_get_plat(dev);
const char *colour;
int i;
if (CONFIG_IS_ENABLED(OF_PLATDATA))
return 0;
plat->colour = -1;
- colour = fdt_getprop(gd->fdt_blob, dev_of_offset(dev),
- "sandbox,text-colour", NULL);
+ colour = dev_read_string(dev, "sandbox,text-colour");
if (colour) {
for (i = 0; i < ARRAY_SIZE(ansi_colour); i++) {
if (!strcmp(colour, ansi_colour[i])) {
@@ -258,9 +227,9 @@ U_BOOT_DRIVER(sandbox_serial) = {
.name = "sandbox_serial",
.id = UCLASS_SERIAL,
.of_match = sandbox_serial_ids,
- .ofdata_to_platdata = sandbox_serial_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct sandbox_serial_platdata),
- .priv_auto_alloc_size = sizeof(struct sandbox_serial_priv),
+ .of_to_plat = sandbox_serial_of_to_plat,
+ .plat_auto = sizeof(struct sandbox_serial_plat),
+ .priv_auto = sizeof(struct sandbox_serial_priv),
.probe = sandbox_serial_probe,
.remove = sandbox_serial_remove,
.ops = &sandbox_serial_ops,
@@ -268,14 +237,12 @@ U_BOOT_DRIVER(sandbox_serial) = {
};
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
-static const struct sandbox_serial_platdata platdata_non_fdt = {
+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",
- .platdata = &platdata_non_fdt,
+ .plat = &platdata_non_fdt,
};
#endif
-
-#endif /* CONFIG_IS_ENABLED(OF_CONTROL) */
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index f3c25d4216..58a6541d8c 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;
}
@@ -507,6 +507,6 @@ UCLASS_DRIVER(serial) = {
.flags = DM_UC_FLAG_SEQ_ALIAS,
.post_probe = serial_post_probe,
.pre_remove = serial_pre_remove,
- .per_device_auto_alloc_size = sizeof(struct serial_dev_priv),
+ .per_device_auto = sizeof(struct serial_dev_priv),
};
#endif
diff --git a/drivers/serial/serial_ar933x.c b/drivers/serial/serial_ar933x.c
index 9de94b69bd..da06bef97c 100644
--- a/drivers/serial/serial_ar933x.c
+++ b/drivers/serial/serial_ar933x.c
@@ -188,7 +188,7 @@ U_BOOT_DRIVER(serial_ar933x) = {
.name = "serial_ar933x",
.id = UCLASS_SERIAL,
.of_match = ar933x_serial_ids,
- .priv_auto_alloc_size = sizeof(struct ar933x_serial_priv),
+ .priv_auto = sizeof(struct ar933x_serial_priv),
.probe = ar933x_serial_probe,
.ops = &ar933x_serial_ops,
};
diff --git a/drivers/serial/serial_arc.c b/drivers/serial/serial_arc.c
index 04063fbe39..445eacc8aa 100644
--- a/drivers/serial/serial_arc.c
+++ b/drivers/serial/serial_arc.c
@@ -25,7 +25,7 @@ struct arc_serial_regs {
};
-struct arc_serial_platdata {
+struct arc_serial_plat {
struct arc_serial_regs *reg;
unsigned int uartclk;
};
@@ -37,7 +37,7 @@ struct arc_serial_platdata {
static int arc_serial_setbrg(struct udevice *dev, int baudrate)
{
- struct arc_serial_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ struct arc_serial_plat *plat = dev_get_plat(dev);
struct arc_serial_regs *const regs = plat->reg;
while (!(readb(&regs->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_platdata *plat = dev->platdata;
+ struct arc_serial_plat *plat = dev_get_plat(dev);
struct arc_serial_regs *const regs = plat->reg;
uint32_t status = readb(&regs->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_platdata *plat = dev->platdata;
+ struct arc_serial_plat *plat = dev_get_plat(dev);
struct arc_serial_regs *const regs = plat->reg;
while (!arc_serial_tstc(regs))
@@ -109,9 +109,9 @@ static const struct udevice_id arc_serial_ids[] = {
{ }
};
-static int arc_serial_ofdata_to_platdata(struct udevice *dev)
+static int arc_serial_of_to_plat(struct udevice *dev)
{
- struct arc_serial_platdata *plat = dev_get_platdata(dev);
+ struct arc_serial_plat *plat = dev_get_plat(dev);
DECLARE_GLOBAL_DATA_PTR;
plat->reg = dev_read_addr_ptr(dev);
@@ -125,8 +125,8 @@ U_BOOT_DRIVER(serial_arc) = {
.name = "serial_arc",
.id = UCLASS_SERIAL,
.of_match = arc_serial_ids,
- .ofdata_to_platdata = arc_serial_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct arc_serial_platdata),
+ .of_to_plat = arc_serial_of_to_plat,
+ .plat_auto = sizeof(struct arc_serial_plat),
.probe = arc_serial_probe,
.ops = &arc_serial_ops,
};
diff --git a/drivers/serial/serial_bcm283x_mu.c b/drivers/serial/serial_bcm283x_mu.c
index 8a4af87eb6..58fa722b4b 100644
--- a/drivers/serial/serial_bcm283x_mu.c
+++ b/drivers/serial/serial_bcm283x_mu.c
@@ -55,7 +55,7 @@ static int bcm283x_mu_serial_getc(struct udevice *dev);
static int bcm283x_mu_serial_setbrg(struct udevice *dev, int baudrate)
{
- struct bcm283x_mu_serial_platdata *plat = dev_get_platdata(dev);
+ struct bcm283x_mu_serial_plat *plat = dev_get_plat(dev);
struct bcm283x_mu_priv *priv = dev_get_priv(dev);
struct bcm283x_mu_regs *regs = priv->regs;
u32 divider;
@@ -158,7 +158,7 @@ static bool bcm283x_is_serial_muxed(void)
static int bcm283x_mu_serial_probe(struct udevice *dev)
{
- struct bcm283x_mu_serial_platdata *plat = dev_get_platdata(dev);
+ struct bcm283x_mu_serial_plat *plat = dev_get_plat(dev);
struct bcm283x_mu_priv *priv = dev_get_priv(dev);
fdt_addr_t addr;
@@ -167,7 +167,7 @@ static int bcm283x_mu_serial_probe(struct udevice *dev)
return -ENODEV;
/*
- * Read the ofdata here rather than in an ofdata_to_platdata() method
+ * Read the ofdata here rather than in an of_to_plat() method
* since we need the soc simple-bus to be probed so that the 'ranges'
* property is used.
*/
@@ -194,11 +194,11 @@ U_BOOT_DRIVER(serial_bcm283x_mu) = {
.name = "serial_bcm283x_mu",
.id = UCLASS_SERIAL,
.of_match = of_match_ptr(bcm283x_mu_serial_id),
- .platdata_auto_alloc_size = sizeof(struct bcm283x_mu_serial_platdata),
+ .plat_auto = sizeof(struct bcm283x_mu_serial_plat),
.probe = bcm283x_mu_serial_probe,
.ops = &bcm283x_mu_serial_ops,
#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD)
.flags = DM_FLAG_PRE_RELOC,
#endif
- .priv_auto_alloc_size = sizeof(struct bcm283x_mu_priv),
+ .priv_auto = sizeof(struct bcm283x_mu_priv),
};
diff --git a/drivers/serial/serial_bcm283x_pl011.c b/drivers/serial/serial_bcm283x_pl011.c
index 923f402fbe..2d2e970316 100644
--- a/drivers/serial/serial_bcm283x_pl011.c
+++ b/drivers/serial/serial_bcm283x_pl011.c
@@ -35,7 +35,7 @@ static bool bcm283x_is_serial_muxed(void)
static int bcm283x_pl011_serial_probe(struct udevice *dev)
{
- struct pl01x_serial_platdata *plat = dev_get_platdata(dev);
+ struct pl01x_serial_plat *plat = dev_get_plat(dev);
int ret;
/* Don't spawn the device if it's not muxed */
@@ -43,11 +43,11 @@ static int bcm283x_pl011_serial_probe(struct udevice *dev)
return -ENODEV;
/*
- * Read the ofdata here rather than in an ofdata_to_platdata() method
+ * Read the ofdata here rather than in an of_to_plat() method
* since we need the soc simple-bus to be probed so that the 'ranges'
* property is used.
*/
- ret = pl01x_serial_ofdata_to_platdata(dev);
+ ret = pl01x_serial_of_to_plat(dev);
if (ret)
return ret;
@@ -92,10 +92,10 @@ U_BOOT_DRIVER(bcm283x_pl011_uart) = {
.id = UCLASS_SERIAL,
.of_match = of_match_ptr(bcm283x_pl011_serial_id),
.probe = bcm283x_pl011_serial_probe,
- .platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata),
+ .plat_auto = sizeof(struct pl01x_serial_plat),
.ops = &bcm283x_pl011_serial_ops,
#if !CONFIG_IS_ENABLED(OF_CONTROL) || CONFIG_IS_ENABLED(OF_BOARD)
.flags = DM_FLAG_PRE_RELOC,
#endif
- .priv_auto_alloc_size = sizeof(struct pl01x_priv),
+ .priv_auto = sizeof(struct pl01x_priv),
};
diff --git a/drivers/serial/serial_bcm6345.c b/drivers/serial/serial_bcm6345.c
index 5b963ce45b..f08e91ff3b 100644
--- a/drivers/serial/serial_bcm6345.c
+++ b/drivers/serial/serial_bcm6345.c
@@ -262,7 +262,7 @@ U_BOOT_DRIVER(bcm6345_serial) = {
.id = UCLASS_SERIAL,
.of_match = bcm6345_serial_ids,
.probe = bcm6345_serial_probe,
- .priv_auto_alloc_size = sizeof(struct bcm6345_serial_priv),
+ .priv_auto = sizeof(struct bcm6345_serial_priv),
.ops = &bcm6345_serial_ops,
};
diff --git a/drivers/serial/serial_coreboot.c b/drivers/serial/serial_coreboot.c
index ccab347514..88c8209c5d 100644
--- a/drivers/serial/serial_coreboot.c
+++ b/drivers/serial/serial_coreboot.c
@@ -11,9 +11,9 @@
#include <serial.h>
#include <asm/arch/sysinfo.h>
-static int coreboot_ofdata_to_platdata(struct udevice *dev)
+static int coreboot_of_to_plat(struct udevice *dev)
{
- struct ns16550_platdata *plat = dev_get_platdata(dev);
+ struct ns16550_plat *plat = dev_get_plat(dev);
struct cb_serial *cb_info = lib_sysinfo.serial;
plat->base = cb_info->baseaddr;
@@ -37,9 +37,9 @@ U_BOOT_DRIVER(coreboot_uart) = {
.name = "coreboot_uart",
.id = UCLASS_SERIAL,
.of_match = coreboot_serial_ids,
- .priv_auto_alloc_size = sizeof(struct NS16550),
- .platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
- .ofdata_to_platdata = coreboot_ofdata_to_platdata,
+ .priv_auto = sizeof(struct ns16550),
+ .plat_auto = sizeof(struct ns16550_plat),
+ .of_to_plat = coreboot_of_to_plat,
.probe = ns16550_serial_probe,
.ops = &ns16550_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
diff --git a/drivers/serial/serial_cortina.c b/drivers/serial/serial_cortina.c
index cc20673efe..6dc81a775d 100644
--- a/drivers/serial/serial_cortina.c
+++ b/drivers/serial/serial_cortina.c
@@ -131,7 +131,7 @@ static int ca_serial_probe(struct udevice *dev)
return 0;
}
-static int ca_serial_ofdata_to_platdata(struct udevice *dev)
+static int ca_serial_of_to_plat(struct udevice *dev)
{
struct ca_uart_priv *priv = dev_get_priv(dev);
@@ -158,8 +158,8 @@ U_BOOT_DRIVER(serial_cortina) = {
.name = "serial_cortina",
.id = UCLASS_SERIAL,
.of_match = ca_serial_ids,
- .ofdata_to_platdata = ca_serial_ofdata_to_platdata,
- .priv_auto_alloc_size = sizeof(struct ca_uart_priv),
+ .of_to_plat = ca_serial_of_to_plat,
+ .priv_auto = sizeof(struct ca_uart_priv),
.probe = ca_serial_probe,
.ops = &ca_serial_ops
};
diff --git a/drivers/serial/serial_efi.c b/drivers/serial/serial_efi.c
index b152e10258..33ddbd6080 100644
--- a/drivers/serial/serial_efi.c
+++ b/drivers/serial/serial_efi.c
@@ -150,7 +150,7 @@ U_BOOT_DRIVER(serial_efi) = {
.name = "serial_efi",
.id = UCLASS_SERIAL,
.of_match = serial_efi_ids,
- .priv_auto_alloc_size = sizeof(struct serial_efi_priv),
+ .priv_auto = sizeof(struct serial_efi_priv),
.probe = serial_efi_probe,
.ops = &serial_efi_ops,
};
diff --git a/drivers/serial/serial_intel_mid.c b/drivers/serial/serial_intel_mid.c
index 39bd40e68b..bbf19057c4 100644
--- a/drivers/serial/serial_intel_mid.c
+++ b/drivers/serial/serial_intel_mid.c
@@ -21,7 +21,7 @@
#define UART_MUL 0x34
#define UART_DIV 0x38
-static void mid_writel(struct ns16550_platdata *plat, int offset, int value)
+static void mid_writel(struct ns16550_plat *plat, int offset, int value)
{
unsigned char *addr;
@@ -33,7 +33,7 @@ static void mid_writel(struct ns16550_platdata *plat, int offset, int value)
static int mid_serial_probe(struct udevice *dev)
{
- struct ns16550_platdata *plat = dev_get_platdata(dev);
+ struct ns16550_plat *plat = dev_get_plat(dev);
/*
* Initialize fractional divider correctly for Intel Edison
@@ -59,9 +59,9 @@ U_BOOT_DRIVER(serial_intel_mid) = {
.name = "serial_intel_mid",
.id = UCLASS_SERIAL,
.of_match = mid_serial_ids,
- .ofdata_to_platdata = ns16550_serial_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
- .priv_auto_alloc_size = sizeof(struct NS16550),
+ .of_to_plat = ns16550_serial_of_to_plat,
+ .plat_auto = sizeof(struct ns16550_plat),
+ .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 83dc96c449..c3714e1e1e 100644
--- a/drivers/serial/serial_linflexuart.c
+++ b/drivers/serial/serial_linflexuart.c
@@ -115,7 +115,7 @@ static int _linflex_serial_init(struct linflex_fsl *base)
return 0;
}
-struct linflex_serial_platdata {
+struct linflex_serial_plat {
struct linflex_fsl *base_addr;
u8 port_id; /* do we need this? */
};
@@ -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_platdata *plat = dev->platdata;
+ 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;
@@ -190,7 +190,7 @@ U_BOOT_DRIVER(serial_linflex) = {
.probe = linflex_serial_probe,
.ops = &linflex_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
- .priv_auto_alloc_size = sizeof(struct linflex_serial_priv),
+ .priv_auto = sizeof(struct linflex_serial_priv),
};
#ifdef CONFIG_DEBUG_UART_LINFLEXUART
diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index 95cbe63b3d..a35e5be303 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -74,7 +74,7 @@ enum lpuart_devtype {
DEV_IMXRT,
};
-struct lpuart_serial_platdata {
+struct lpuart_serial_plat {
void *reg;
enum lpuart_devtype devtype;
ulong flags;
@@ -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_platdata *plat = dev->platdata;
+ struct lpuart_serial_plat *plat = dev_get_plat(dev);
return plat->flags & LPUART_FLAG_REGMAP_32BIT_REG;
}
@@ -146,7 +146,7 @@ static bool is_lpuart32(struct udevice *dev)
static void _lpuart_serial_setbrg(struct udevice *dev,
int baudrate)
{
- struct lpuart_serial_platdata *plat = dev_get_platdata(dev);
+ struct lpuart_serial_plat *plat = dev_get_plat(dev);
struct lpuart_fsl *base = plat->reg;
u32 clk;
u16 sbr;
@@ -167,7 +167,7 @@ static void _lpuart_serial_setbrg(struct udevice *dev,
__raw_writeb(sbr & 0xff, &base->ubdl);
}
-static int _lpuart_serial_getc(struct lpuart_serial_platdata *plat)
+static int _lpuart_serial_getc(struct lpuart_serial_plat *plat)
{
struct lpuart_fsl *base = plat->reg;
while (!(__raw_readb(&base->us1) & (US1_RDRF | US1_OR)))
@@ -178,7 +178,7 @@ static int _lpuart_serial_getc(struct lpuart_serial_platdata *plat)
return __raw_readb(&base->ud);
}
-static void _lpuart_serial_putc(struct lpuart_serial_platdata *plat,
+static void _lpuart_serial_putc(struct lpuart_serial_plat *plat,
const char c)
{
struct lpuart_fsl *base = plat->reg;
@@ -190,7 +190,7 @@ static void _lpuart_serial_putc(struct lpuart_serial_platdata *plat,
}
/* Test whether a character is in the RX buffer */
-static int _lpuart_serial_tstc(struct lpuart_serial_platdata *plat)
+static int _lpuart_serial_tstc(struct lpuart_serial_plat *plat)
{
struct lpuart_fsl *base = plat->reg;
@@ -206,7 +206,7 @@ static int _lpuart_serial_tstc(struct lpuart_serial_platdata *plat)
*/
static int _lpuart_serial_init(struct udevice *dev)
{
- struct lpuart_serial_platdata *plat = dev_get_platdata(dev);
+ struct lpuart_serial_plat *plat = dev_get_plat(dev);
struct lpuart_fsl *base = (struct lpuart_fsl *)plat->reg;
u8 ctrl;
@@ -235,7 +235,7 @@ static int _lpuart_serial_init(struct udevice *dev)
static void _lpuart32_serial_setbrg_7ulp(struct udevice *dev,
int baudrate)
{
- struct lpuart_serial_platdata *plat = dev_get_platdata(dev);
+ struct lpuart_serial_plat *plat = dev_get_plat(dev);
struct lpuart_fsl_reg32 *base = plat->reg;
u32 sbr, osr, baud_diff, tmp_osr, tmp_sbr, tmp_diff, tmp;
u32 clk;
@@ -304,7 +304,7 @@ static void _lpuart32_serial_setbrg_7ulp(struct udevice *dev,
static void _lpuart32_serial_setbrg(struct udevice *dev,
int baudrate)
{
- struct lpuart_serial_platdata *plat = dev_get_platdata(dev);
+ struct lpuart_serial_plat *plat = dev_get_plat(dev);
struct lpuart_fsl_reg32 *base = plat->reg;
u32 clk;
u32 sbr;
@@ -324,7 +324,7 @@ static void _lpuart32_serial_setbrg(struct udevice *dev,
lpuart_write32(plat->flags, &base->baud, sbr);
}
-static int _lpuart32_serial_getc(struct lpuart_serial_platdata *plat)
+static int _lpuart32_serial_getc(struct lpuart_serial_plat *plat)
{
struct lpuart_fsl_reg32 *base = plat->reg;
u32 stat, val;
@@ -345,7 +345,7 @@ static int _lpuart32_serial_getc(struct lpuart_serial_platdata *plat)
return val & 0x3ff;
}
-static void _lpuart32_serial_putc(struct lpuart_serial_platdata *plat,
+static void _lpuart32_serial_putc(struct lpuart_serial_plat *plat,
const char c)
{
struct lpuart_fsl_reg32 *base = plat->reg;
@@ -367,7 +367,7 @@ static void _lpuart32_serial_putc(struct lpuart_serial_platdata *plat,
}
/* Test whether a character is in the RX buffer */
-static int _lpuart32_serial_tstc(struct lpuart_serial_platdata *plat)
+static int _lpuart32_serial_tstc(struct lpuart_serial_plat *plat)
{
struct lpuart_fsl_reg32 *base = plat->reg;
u32 water;
@@ -386,7 +386,7 @@ static int _lpuart32_serial_tstc(struct lpuart_serial_platdata *plat)
*/
static int _lpuart32_serial_init(struct udevice *dev)
{
- struct lpuart_serial_platdata *plat = dev_get_platdata(dev);
+ struct lpuart_serial_plat *plat = dev_get_plat(dev);
struct lpuart_fsl_reg32 *base = (struct lpuart_fsl_reg32 *)plat->reg;
u32 val, tx_fifo_size;
@@ -428,7 +428,7 @@ static int _lpuart32_serial_init(struct udevice *dev)
static int lpuart_serial_setbrg(struct udevice *dev, int baudrate)
{
- struct lpuart_serial_platdata *plat = dev_get_platdata(dev);
+ struct lpuart_serial_plat *plat = dev_get_plat(dev);
if (is_lpuart32(dev)) {
if (plat->devtype == DEV_MX7ULP || plat->devtype == DEV_IMX8 ||
@@ -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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ struct lpuart_serial_plat *plat = dev_get_plat(dev);
struct lpuart_fsl *reg = plat->reg;
struct lpuart_fsl_reg32 *reg32 = plat->reg;
u32 stat;
@@ -511,9 +511,9 @@ static int lpuart_serial_probe(struct udevice *dev)
return _lpuart_serial_init(dev);
}
-static int lpuart_serial_ofdata_to_platdata(struct udevice *dev)
+static int lpuart_serial_of_to_plat(struct udevice *dev)
{
- struct lpuart_serial_platdata *plat = dev->platdata;
+ 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;
@@ -566,8 +566,8 @@ U_BOOT_DRIVER(serial_lpuart) = {
.name = "serial_lpuart",
.id = UCLASS_SERIAL,
.of_match = lpuart_serial_ids,
- .ofdata_to_platdata = lpuart_serial_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct lpuart_serial_platdata),
+ .of_to_plat = lpuart_serial_of_to_plat,
+ .plat_auto = sizeof(struct lpuart_serial_plat),
.probe = lpuart_serial_probe,
.ops = &lpuart_serial_ops,
};
diff --git a/drivers/serial/serial_mcf.c b/drivers/serial/serial_mcf.c
index 402fd5343c..e6e21b2ce8 100644
--- a/drivers/serial/serial_mcf.c
+++ b/drivers/serial/serial_mcf.c
@@ -83,9 +83,9 @@ static void mcf_serial_setbrg_common(uart_t *uart, int baudrate)
static int coldfire_serial_probe(struct udevice *dev)
{
- struct coldfire_serial_platdata *plat = dev->platdata;
+ struct coldfire_serial_plat *plat = dev_get_plat(dev);
- plat->port = dev->seq;
+ plat->port = dev_seq(dev);
return mcf_serial_init_common((uart_t *)plat->base,
plat->port, plat->baudrate);
@@ -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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ struct coldfire_serial_plat *plat = dev_get_plat(dev);
uart_t *uart = (uart_t *)(plat->base);
if (input)
@@ -140,9 +140,9 @@ static int coldfire_serial_pending(struct udevice *dev, bool input)
return 0;
}
-static int coldfire_ofdata_to_platdata(struct udevice *dev)
+static int coldfire_of_to_plat(struct udevice *dev)
{
- struct coldfire_serial_platdata *plat = dev_get_platdata(dev);
+ struct coldfire_serial_plat *plat = dev_get_plat(dev);
fdt_addr_t addr_base;
addr_base = dev_read_addr(dev);
@@ -171,8 +171,8 @@ U_BOOT_DRIVER(serial_coldfire) = {
.name = "serial_coldfire",
.id = UCLASS_SERIAL,
.of_match = coldfire_serial_ids,
- .ofdata_to_platdata = coldfire_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct coldfire_serial_platdata),
+ .of_to_plat = coldfire_of_to_plat,
+ .plat_auto = sizeof(struct coldfire_serial_plat),
.probe = coldfire_serial_probe,
.ops = &coldfire_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
diff --git a/drivers/serial/serial_meson.c b/drivers/serial/serial_meson.c
index 496a2ca2c3..d69ec221e4 100644
--- a/drivers/serial/serial_meson.c
+++ b/drivers/serial/serial_meson.c
@@ -19,7 +19,7 @@ struct meson_uart {
u32 misc;
};
-struct meson_serial_platdata {
+struct meson_serial_plat {
struct meson_uart *reg;
};
@@ -57,7 +57,7 @@ static void meson_serial_init(struct meson_uart *uart)
static int meson_serial_probe(struct udevice *dev)
{
- struct meson_serial_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ struct meson_serial_plat *plat = dev_get_plat(dev);
struct meson_uart *const uart = plat->reg;
uint32_t status = readl(&uart->status);
@@ -136,9 +136,9 @@ static int meson_serial_pending(struct udevice *dev, bool input)
}
}
-static int meson_serial_ofdata_to_platdata(struct udevice *dev)
+static int meson_serial_of_to_plat(struct udevice *dev)
{
- struct meson_serial_platdata *plat = dev->platdata;
+ struct meson_serial_plat *plat = dev_get_plat(dev);
fdt_addr_t addr;
addr = dev_read_addr(dev);
@@ -168,8 +168,8 @@ U_BOOT_DRIVER(serial_meson) = {
.of_match = meson_serial_ids,
.probe = meson_serial_probe,
.ops = &meson_serial_ops,
- .ofdata_to_platdata = meson_serial_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct meson_serial_platdata),
+ .of_to_plat = meson_serial_of_to_plat,
+ .plat_auto = sizeof(struct meson_serial_plat),
};
#ifdef CONFIG_DEBUG_UART_MESON
diff --git a/drivers/serial/serial_msm.c b/drivers/serial/serial_msm.c
index c8946c3aae..024c2c956e 100644
--- a/drivers/serial/serial_msm.c
+++ b/drivers/serial/serial_msm.c
@@ -216,7 +216,7 @@ static int msm_serial_probe(struct udevice *dev)
return 0;
}
-static int msm_serial_ofdata_to_platdata(struct udevice *dev)
+static int msm_serial_of_to_plat(struct udevice *dev)
{
struct msm_serial_data *priv = dev_get_priv(dev);
@@ -239,8 +239,8 @@ U_BOOT_DRIVER(serial_msm) = {
.name = "serial_msm",
.id = UCLASS_SERIAL,
.of_match = msm_serial_ids,
- .ofdata_to_platdata = msm_serial_ofdata_to_platdata,
- .priv_auto_alloc_size = sizeof(struct msm_serial_data),
+ .of_to_plat = msm_serial_of_to_plat,
+ .priv_auto = sizeof(struct msm_serial_data),
.probe = msm_serial_probe,
.ops = &msm_serial_ops,
};
diff --git a/drivers/serial/serial_mtk.c b/drivers/serial/serial_mtk.c
index 778a04d87e..665b2aa3b2 100644
--- a/drivers/serial/serial_mtk.c
+++ b/drivers/serial/serial_mtk.c
@@ -216,7 +216,7 @@ static int mtk_serial_probe(struct udevice *dev)
return 0;
}
-static int mtk_serial_ofdata_to_platdata(struct udevice *dev)
+static int mtk_serial_of_to_plat(struct udevice *dev)
{
struct mtk_serial_priv *priv = dev_get_priv(dev);
fdt_addr_t addr;
@@ -267,8 +267,8 @@ U_BOOT_DRIVER(serial_mtk) = {
.name = "serial_mtk",
.id = UCLASS_SERIAL,
.of_match = mtk_serial_ids,
- .ofdata_to_platdata = mtk_serial_ofdata_to_platdata,
- .priv_auto_alloc_size = sizeof(struct mtk_serial_priv),
+ .of_to_plat = mtk_serial_of_to_plat,
+ .priv_auto = sizeof(struct mtk_serial_priv),
.probe = mtk_serial_probe,
.ops = &mtk_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
diff --git a/drivers/serial/serial_mvebu_a3700.c b/drivers/serial/serial_mvebu_a3700.c
index fb43f88eaf..5a1d40e0a6 100644
--- a/drivers/serial/serial_mvebu_a3700.c
+++ b/drivers/serial/serial_mvebu_a3700.c
@@ -8,7 +8,7 @@
#include <serial.h>
#include <asm/io.h>
-struct mvebu_platdata {
+struct mvebu_plat {
void __iomem *base;
};
@@ -32,7 +32,7 @@ struct mvebu_platdata {
static int mvebu_serial_putc(struct udevice *dev, const char ch)
{
- struct mvebu_platdata *plat = dev_get_platdata(dev);
+ struct mvebu_plat *plat = dev_get_plat(dev);
void __iomem *base = plat->base;
while (readl(base + UART_STATUS_REG) & UART_STATUS_TXFIFO_FULL)
@@ -45,7 +45,7 @@ static int mvebu_serial_putc(struct udevice *dev, const char ch)
static int mvebu_serial_getc(struct udevice *dev)
{
- struct mvebu_platdata *plat = dev_get_platdata(dev);
+ struct mvebu_plat *plat = dev_get_plat(dev);
void __iomem *base = plat->base;
while (!(readl(base + UART_STATUS_REG) & UART_STATUS_RX_RDY))
@@ -56,7 +56,7 @@ static int mvebu_serial_getc(struct udevice *dev)
static int mvebu_serial_pending(struct udevice *dev, bool input)
{
- struct mvebu_platdata *plat = dev_get_platdata(dev);
+ struct mvebu_plat *plat = dev_get_plat(dev);
void __iomem *base = plat->base;
if (readl(base + UART_STATUS_REG) & UART_STATUS_RX_RDY)
@@ -67,7 +67,7 @@ static int mvebu_serial_pending(struct udevice *dev, bool input)
static int mvebu_serial_setbrg(struct udevice *dev, int baudrate)
{
- struct mvebu_platdata *plat = dev_get_platdata(dev);
+ struct mvebu_plat *plat = dev_get_plat(dev);
void __iomem *base = plat->base;
/*
@@ -87,7 +87,7 @@ static int mvebu_serial_setbrg(struct udevice *dev, int baudrate)
static int mvebu_serial_probe(struct udevice *dev)
{
- struct mvebu_platdata *plat = dev_get_platdata(dev);
+ struct mvebu_plat *plat = dev_get_plat(dev);
void __iomem *base = plat->base;
/* reset FIFOs */
@@ -100,9 +100,9 @@ static int mvebu_serial_probe(struct udevice *dev)
return 0;
}
-static int mvebu_serial_ofdata_to_platdata(struct udevice *dev)
+static int mvebu_serial_of_to_plat(struct udevice *dev)
{
- struct mvebu_platdata *plat = dev_get_platdata(dev);
+ struct mvebu_plat *plat = dev_get_plat(dev);
plat->base = dev_read_addr_ptr(dev);
@@ -125,8 +125,8 @@ U_BOOT_DRIVER(serial_mvebu) = {
.name = "serial_mvebu",
.id = UCLASS_SERIAL,
.of_match = mvebu_serial_ids,
- .ofdata_to_platdata = mvebu_serial_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct mvebu_platdata),
+ .of_to_plat = mvebu_serial_of_to_plat,
+ .plat_auto = sizeof(struct mvebu_plat),
.probe = mvebu_serial_probe,
.ops = &mvebu_serial_ops,
};
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c
index de6cefcd3a..e5795da99d 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ struct mxc_serial_plat *plat = dev_get_plat(dev);
struct mxc_uart *const uart = plat->reg;
uint32_t sr2 = readl(&uart->sr2);
@@ -325,9 +325,9 @@ static const struct dm_serial_ops mxc_serial_ops = {
};
#if CONFIG_IS_ENABLED(OF_CONTROL)
-static int mxc_serial_ofdata_to_platdata(struct udevice *dev)
+static int mxc_serial_of_to_plat(struct udevice *dev)
{
- struct mxc_serial_platdata *plat = dev->platdata;
+ struct mxc_serial_plat *plat = dev_get_plat(dev);
fdt_addr_t addr;
addr = dev_read_addr(dev);
@@ -357,8 +357,8 @@ U_BOOT_DRIVER(serial_mxc) = {
.id = UCLASS_SERIAL,
#if CONFIG_IS_ENABLED(OF_CONTROL)
.of_match = mxc_serial_ids,
- .ofdata_to_platdata = mxc_serial_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct mxc_serial_platdata),
+ .of_to_plat = mxc_serial_of_to_plat,
+ .plat_auto = sizeof(struct mxc_serial_plat),
#endif
.probe = mxc_serial_probe,
.ops = &mxc_serial_ops,
diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c
index ef394b7235..b5beca976d 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 f7997fc788..2b23ece442 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))
;
@@ -99,9 +99,9 @@ DEBUG_UART_FUNCS
#if CONFIG_IS_ENABLED(DM_SERIAL)
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
-static int omap_serial_ofdata_to_platdata(struct udevice *dev)
+static int omap_serial_of_to_plat(struct udevice *dev)
{
- struct ns16550_platdata *plat = dev->platdata;
+ struct ns16550_plat *plat = dev_get_plat(dev);
fdt_addr_t addr;
struct clk clk;
int err;
@@ -157,10 +157,10 @@ U_BOOT_DRIVER(omap_serial) = {
.id = UCLASS_SERIAL,
#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
.of_match = omap_serial_ids,
- .ofdata_to_platdata = omap_serial_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct ns16550_platdata),
+ .of_to_plat = omap_serial_of_to_plat,
+ .plat_auto = sizeof(struct ns16550_plat),
#endif
- .priv_auto_alloc_size = 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_owl.c b/drivers/serial/serial_owl.c
index 2651a45a7f..3b795785f7 100644
--- a/drivers/serial/serial_owl.c
+++ b/drivers/serial/serial_owl.c
@@ -102,7 +102,7 @@ static int owl_serial_probe(struct udevice *dev)
return 0;
}
-static int owl_serial_ofdata_to_platdata(struct udevice *dev)
+static int owl_serial_of_to_plat(struct udevice *dev)
{
struct owl_serial_priv *priv = dev_get_priv(dev);
@@ -129,8 +129,8 @@ U_BOOT_DRIVER(serial_owl) = {
.name = "serial_owl",
.id = UCLASS_SERIAL,
.of_match = owl_serial_ids,
- .ofdata_to_platdata = owl_serial_ofdata_to_platdata,
- .priv_auto_alloc_size = sizeof(struct owl_serial_priv),
+ .of_to_plat = owl_serial_of_to_plat,
+ .priv_auto = sizeof(struct owl_serial_priv),
.probe = owl_serial_probe,
.ops = &owl_serial_ops,
};
diff --git a/drivers/serial/serial_pic32.c b/drivers/serial/serial_pic32.c
index a492063e39..5d1dbe7a91 100644
--- a/drivers/serial/serial_pic32.c
+++ b/drivers/serial/serial_pic32.c
@@ -178,7 +178,7 @@ U_BOOT_DRIVER(pic32_serial) = {
.of_match = pic32_uart_ids,
.probe = pic32_uart_probe,
.ops = &pic32_uart_ops,
- .priv_auto_alloc_size = sizeof(struct pic32_uart_priv),
+ .priv_auto = sizeof(struct pic32_uart_priv),
};
#ifdef CONFIG_DEBUG_UART_PIC32
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c
index d9e35c6a2b..b21e943d21 100644
--- a/drivers/serial/serial_pl01x.c
+++ b/drivers/serial/serial_pl01x.c
@@ -281,7 +281,7 @@ __weak struct serial_device *default_serial_console(void)
int pl01x_serial_setbrg(struct udevice *dev, int baudrate)
{
- struct pl01x_serial_platdata *plat = dev_get_platdata(dev);
+ struct pl01x_serial_plat *plat = dev_get_plat(dev);
struct pl01x_priv *priv = dev_get_priv(dev);
if (!plat->skip_init) {
@@ -294,7 +294,7 @@ int pl01x_serial_setbrg(struct udevice *dev, int baudrate)
int pl01x_serial_probe(struct udevice *dev)
{
- struct pl01x_serial_platdata *plat = dev_get_platdata(dev);
+ struct pl01x_serial_plat *plat = dev_get_plat(dev);
struct pl01x_priv *priv = dev_get_priv(dev);
priv->regs = (struct pl01x_regs *)plat->base;
@@ -348,9 +348,9 @@ static const struct udevice_id pl01x_serial_id[] ={
#define CONFIG_PL011_CLOCK 0
#endif
-int pl01x_serial_ofdata_to_platdata(struct udevice *dev)
+int pl01x_serial_of_to_plat(struct udevice *dev)
{
- struct pl01x_serial_platdata *plat = dev_get_platdata(dev);
+ struct pl01x_serial_plat *plat = dev_get_plat(dev);
struct clk clk;
fdt_addr_t addr;
int ret;
@@ -387,12 +387,12 @@ U_BOOT_DRIVER(serial_pl01x) = {
.name = "serial_pl01x",
.id = UCLASS_SERIAL,
.of_match = of_match_ptr(pl01x_serial_id),
- .ofdata_to_platdata = of_match_ptr(pl01x_serial_ofdata_to_platdata),
- .platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata),
+ .of_to_plat = of_match_ptr(pl01x_serial_of_to_plat),
+ .plat_auto = sizeof(struct pl01x_serial_plat),
.probe = pl01x_serial_probe,
.ops = &pl01x_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
- .priv_auto_alloc_size = sizeof(struct pl01x_priv),
+ .priv_auto = sizeof(struct pl01x_priv),
};
#endif
diff --git a/drivers/serial/serial_pl01x_internal.h b/drivers/serial/serial_pl01x_internal.h
index c5c706b153..dfd95a0b77 100644
--- a/drivers/serial/serial_pl01x_internal.h
+++ b/drivers/serial/serial_pl01x_internal.h
@@ -40,7 +40,7 @@ struct pl01x_regs {
#ifdef CONFIG_DM_SERIAL
-int pl01x_serial_ofdata_to_platdata(struct udevice *dev);
+int pl01x_serial_of_to_plat(struct udevice *dev);
int pl01x_serial_probe(struct udevice *dev);
/* Needed for external pl01x_serial_ops drivers */
diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index 6f8f7e1198..669841ede4 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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 b1718f72d1..97d40869a2 100644
--- a/drivers/serial/serial_rockchip.c
+++ b/drivers/serial/serial_rockchip.c
@@ -10,31 +10,32 @@
#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_platdata {
+struct rockchip_uart_plat {
struct dtd_rockchip_rk3188_uart dtplat;
- struct ns16550_platdata plat;
+ struct ns16550_plat plat;
};
struct dtd_rockchip_rk3188_uart *dtplat, s_dtplat;
#elif defined(CONFIG_ROCKCHIP_RK3288)
-struct rockchip_uart_platdata {
+struct rockchip_uart_plat {
struct dtd_rockchip_rk3288_uart dtplat;
- struct ns16550_platdata plat;
+ struct ns16550_plat plat;
};
struct dtd_rockchip_rk3288_uart *dtplat, s_dtplat;
#endif
static int rockchip_serial_probe(struct udevice *dev)
{
- struct rockchip_uart_platdata *plat = dev_get_platdata(dev);
+ struct rockchip_uart_plat *plat = dev_get_plat(dev);
/* Create some new platform data for the standard driver */
plat->plat.base = plat->dtplat.reg[0];
plat->plat.reg_shift = plat->dtplat.reg_shift;
plat->plat.clock = plat->dtplat.clock_frequency;
plat->plat.fcr = UART_FCR_DEFVAL;
- dev->platdata = &plat->plat;
+ dev_set_plat(dev, &plat->plat);
return ns16550_serial_probe(dev);
}
@@ -42,8 +43,8 @@ static int rockchip_serial_probe(struct udevice *dev)
U_BOOT_DRIVER(rockchip_rk3188_uart) = {
.name = "rockchip_rk3188_uart",
.id = UCLASS_SERIAL,
- .priv_auto_alloc_size = sizeof(struct NS16550),
- .platdata_auto_alloc_size = sizeof(struct rockchip_uart_platdata),
+ .priv_auto = sizeof(struct ns16550),
+ .plat_auto = sizeof(struct rockchip_uart_plat),
.probe = rockchip_serial_probe,
.ops = &ns16550_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
@@ -52,8 +53,8 @@ U_BOOT_DRIVER(rockchip_rk3188_uart) = {
U_BOOT_DRIVER(rockchip_rk3288_uart) = {
.name = "rockchip_rk3288_uart",
.id = UCLASS_SERIAL,
- .priv_auto_alloc_size = sizeof(struct NS16550),
- .platdata_auto_alloc_size = sizeof(struct rockchip_uart_platdata),
+ .priv_auto = sizeof(struct ns16550),
+ .plat_auto = sizeof(struct rockchip_uart_plat),
.probe = rockchip_serial_probe,
.ops = &ns16550_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
index 9bb2be21e7..0eac0d53a5 100644
--- a/drivers/serial/serial_s5p.c
+++ b/drivers/serial/serial_s5p.c
@@ -28,7 +28,7 @@ DECLARE_GLOBAL_DATA_PTR;
#define TX_FIFO_FULL (1 << 24)
/* Information about a serial port */
-struct s5p_serial_platdata {
+struct s5p_serial_plat {
struct s5p_uart *reg; /* address of registers in physical memory */
u8 port_id; /* uart port number */
};
@@ -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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ 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_platdata *plat = dev->platdata;
+ struct s5p_serial_plat *plat = dev_get_plat(dev);
struct s5p_uart *const uart = plat->reg;
uint32_t ufstat = readl(&uart->ufstat);
@@ -176,9 +176,9 @@ static int s5p_serial_pending(struct udevice *dev, bool input)
return (ufstat & TX_FIFO_COUNT_MASK) >> TX_FIFO_COUNT_SHIFT;
}
-static int s5p_serial_ofdata_to_platdata(struct udevice *dev)
+static int s5p_serial_of_to_plat(struct udevice *dev)
{
- struct s5p_serial_platdata *plat = dev->platdata;
+ struct s5p_serial_plat *plat = dev_get_plat(dev);
fdt_addr_t addr;
addr = dev_read_addr(dev);
@@ -187,7 +187,7 @@ static int s5p_serial_ofdata_to_platdata(struct udevice *dev)
plat->reg = (struct s5p_uart *)addr;
plat->port_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
- "id", dev->seq);
+ "id", dev_seq(dev));
return 0;
}
@@ -207,8 +207,8 @@ U_BOOT_DRIVER(serial_s5p) = {
.name = "serial_s5p",
.id = UCLASS_SERIAL,
.of_match = s5p_serial_ids,
- .ofdata_to_platdata = s5p_serial_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct s5p_serial_platdata),
+ .of_to_plat = s5p_serial_of_to_plat,
+ .plat_auto = sizeof(struct s5p_serial_plat),
.probe = s5p_serial_probe,
.ops = &s5p_serial_ops,
};
diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c
index e27d256574..d74f890233 100644
--- a/drivers/serial/serial_sh.c
+++ b/drivers/serial/serial_sh.c
@@ -169,7 +169,7 @@ static int sh_serial_getc(struct udevice *dev)
static int sh_serial_setbrg(struct udevice *dev, int baudrate)
{
- struct sh_serial_platdata *plat = dev_get_platdata(dev);
+ struct sh_serial_plat *plat = dev_get_plat(dev);
struct uart_port *priv = dev_get_priv(dev);
sh_serial_setbrg_generic(priv, plat->clk, baudrate);
@@ -179,7 +179,7 @@ static int sh_serial_setbrg(struct udevice *dev, int baudrate)
static int sh_serial_probe(struct udevice *dev)
{
- struct sh_serial_platdata *plat = dev_get_platdata(dev);
+ struct sh_serial_plat *plat = dev_get_plat(dev);
struct uart_port *priv = dev_get_priv(dev);
priv->membase = (unsigned char *)plat->base;
@@ -207,9 +207,9 @@ static const struct udevice_id sh_serial_id[] ={
{}
};
-static int sh_serial_ofdata_to_platdata(struct udevice *dev)
+static int sh_serial_of_to_plat(struct udevice *dev)
{
- struct sh_serial_platdata *plat = dev_get_platdata(dev);
+ struct sh_serial_plat *plat = dev_get_plat(dev);
struct clk sh_serial_clk;
fdt_addr_t addr;
int ret;
@@ -239,14 +239,14 @@ U_BOOT_DRIVER(serial_sh) = {
.name = "serial_sh",
.id = UCLASS_SERIAL,
.of_match = of_match_ptr(sh_serial_id),
- .ofdata_to_platdata = of_match_ptr(sh_serial_ofdata_to_platdata),
- .platdata_auto_alloc_size = sizeof(struct sh_serial_platdata),
+ .of_to_plat = of_match_ptr(sh_serial_of_to_plat),
+ .plat_auto = sizeof(struct sh_serial_plat),
.probe = sh_serial_probe,
.ops = &sh_serial_ops,
#if !CONFIG_IS_ENABLED(OF_CONTROL)
.flags = DM_FLAG_PRE_RELOC,
#endif
- .priv_auto_alloc_size = sizeof(struct uart_port),
+ .priv_auto = sizeof(struct uart_port),
};
#else /* CONFIG_DM_SERIAL */
diff --git a/drivers/serial/serial_sifive.c b/drivers/serial/serial_sifive.c
index fcc47fb348..d26fe7e770 100644
--- a/drivers/serial/serial_sifive.c
+++ b/drivers/serial/serial_sifive.c
@@ -37,7 +37,7 @@ struct uart_sifive {
u32 div;
};
-struct sifive_uart_platdata {
+struct sifive_uart_plat {
unsigned long clock;
struct uart_sifive *regs;
};
@@ -105,7 +105,7 @@ static int sifive_serial_setbrg(struct udevice *dev, int baudrate)
{
int ret;
struct clk clk;
- struct sifive_uart_platdata *platdata = dev_get_platdata(dev);
+ struct sifive_uart_plat *plat = dev_get_plat(dev);
u32 clock = 0;
ret = clk_get_by_index(dev, 0, &clk);
@@ -123,21 +123,21 @@ static int sifive_serial_setbrg(struct udevice *dev, int baudrate)
return 0;
}
}
- platdata->clock = clock;
- _sifive_serial_setbrg(platdata->regs, platdata->clock, baudrate);
+ plat->clock = clock;
+ _sifive_serial_setbrg(plat->regs, plat->clock, baudrate);
return 0;
}
static int sifive_serial_probe(struct udevice *dev)
{
- struct sifive_uart_platdata *platdata = dev_get_platdata(dev);
+ struct sifive_uart_plat *plat = dev_get_plat(dev);
/* No need to reinitialize the UART after relocation */
if (gd->flags & GD_FLG_RELOC)
return 0;
- _sifive_serial_init(platdata->regs);
+ _sifive_serial_init(plat->regs);
return 0;
}
@@ -145,8 +145,8 @@ static int sifive_serial_probe(struct udevice *dev)
static int sifive_serial_getc(struct udevice *dev)
{
int c;
- struct sifive_uart_platdata *platdata = dev_get_platdata(dev);
- struct uart_sifive *regs = platdata->regs;
+ struct sifive_uart_plat *plat = dev_get_plat(dev);
+ struct uart_sifive *regs = plat->regs;
while ((c = _sifive_serial_getc(regs)) == -EAGAIN) ;
@@ -156,17 +156,17 @@ static int sifive_serial_getc(struct udevice *dev)
static int sifive_serial_putc(struct udevice *dev, const char ch)
{
int rc;
- struct sifive_uart_platdata *platdata = dev_get_platdata(dev);
+ struct sifive_uart_plat *plat = dev_get_plat(dev);
- while ((rc = _sifive_serial_putc(platdata->regs, ch)) == -EAGAIN) ;
+ while ((rc = _sifive_serial_putc(plat->regs, ch)) == -EAGAIN) ;
return rc;
}
static int sifive_serial_pending(struct udevice *dev, bool input)
{
- struct sifive_uart_platdata *platdata = dev_get_platdata(dev);
- struct uart_sifive *regs = platdata->regs;
+ struct sifive_uart_plat *plat = dev_get_plat(dev);
+ struct uart_sifive *regs = plat->regs;
if (input)
return (readl(&regs->ip) & UART_IP_RXWM);
@@ -174,13 +174,13 @@ static int sifive_serial_pending(struct udevice *dev, bool input)
return !!(readl(&regs->txfifo) & UART_TXFIFO_FULL);
}
-static int sifive_serial_ofdata_to_platdata(struct udevice *dev)
+static int sifive_serial_of_to_plat(struct udevice *dev)
{
- struct sifive_uart_platdata *platdata = dev_get_platdata(dev);
+ struct sifive_uart_plat *plat = dev_get_plat(dev);
- platdata->regs = (struct uart_sifive *)dev_read_addr(dev);
- if (IS_ERR(platdata->regs))
- return PTR_ERR(platdata->regs);
+ plat->regs = (struct uart_sifive *)dev_read_addr(dev);
+ if (IS_ERR(plat->regs))
+ return PTR_ERR(plat->regs);
return 0;
}
@@ -201,8 +201,8 @@ U_BOOT_DRIVER(serial_sifive) = {
.name = "serial_sifive",
.id = UCLASS_SERIAL,
.of_match = sifive_serial_ids,
- .ofdata_to_platdata = sifive_serial_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct sifive_uart_platdata),
+ .of_to_plat = sifive_serial_of_to_plat,
+ .plat_auto = sizeof(struct sifive_uart_plat),
.probe = sifive_serial_probe,
.ops = &sifive_serial_ops,
};
diff --git a/drivers/serial/serial_sti_asc.c b/drivers/serial/serial_sti_asc.c
index 91e1574638..5d1a46c6bc 100644
--- a/drivers/serial/serial_sti_asc.c
+++ b/drivers/serial/serial_sti_asc.c
@@ -206,6 +206,6 @@ U_BOOT_DRIVER(serial_sti_asc) = {
.of_match = sti_serial_of_match,
.ops = &sti_asc_serial_ops,
.probe = sti_asc_serial_probe,
- .priv_auto_alloc_size = sizeof(struct sti_asc_serial),
+ .priv_auto = sizeof(struct sti_asc_serial),
};
diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
index cab0db2c96..818c34cf11 100644
--- a/drivers/serial/serial_stm32.c
+++ b/drivers/serial/serial_stm32.c
@@ -44,7 +44,7 @@ static void _stm32_serial_setbrg(fdt_addr_t base,
static int stm32_serial_setbrg(struct udevice *dev, int baudrate)
{
- struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
+ struct stm32x7_serial_plat *plat = dev_get_plat(dev);
_stm32_serial_setbrg(plat->base, plat->uart_info,
plat->clock_rate, baudrate);
@@ -54,7 +54,7 @@ static int stm32_serial_setbrg(struct udevice *dev, int baudrate)
static int stm32_serial_setconfig(struct udevice *dev, uint serial_config)
{
- struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
+ struct stm32x7_serial_plat *plat = dev_get_plat(dev);
bool stm32f4 = plat->uart_info->stm32f4;
u8 uart_enable_bit = plat->uart_info->uart_enable_bit;
u32 cr1 = plat->base + CR1_OFFSET(stm32f4);
@@ -102,7 +102,7 @@ static int stm32_serial_setconfig(struct udevice *dev, uint serial_config)
static int stm32_serial_getc(struct udevice *dev)
{
- struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
+ struct stm32x7_serial_plat *plat = dev_get_plat(dev);
bool stm32f4 = plat->uart_info->stm32f4;
fdt_addr_t base = plat->base;
u32 isr = readl(base + ISR_OFFSET(stm32f4));
@@ -139,14 +139,14 @@ static int _stm32_serial_putc(fdt_addr_t base,
static int stm32_serial_putc(struct udevice *dev, const char c)
{
- struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
+ struct stm32x7_serial_plat *plat = dev_get_plat(dev);
return _stm32_serial_putc(plat->base, plat->uart_info, c);
}
static int stm32_serial_pending(struct udevice *dev, bool input)
{
- struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
+ struct stm32x7_serial_plat *plat = dev_get_plat(dev);
bool stm32f4 = plat->uart_info->stm32f4;
fdt_addr_t base = plat->base;
@@ -175,7 +175,7 @@ static void _stm32_serial_init(fdt_addr_t base,
static int stm32_serial_probe(struct udevice *dev)
{
- struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
+ struct stm32x7_serial_plat *plat = dev_get_plat(dev);
struct clk clk;
struct reset_ctl reset;
int ret;
@@ -217,9 +217,9 @@ static const struct udevice_id stm32_serial_id[] = {
{}
};
-static int stm32_serial_ofdata_to_platdata(struct udevice *dev)
+static int stm32_serial_of_to_plat(struct udevice *dev)
{
- struct stm32x7_serial_platdata *plat = dev_get_platdata(dev);
+ struct stm32x7_serial_plat *plat = dev_get_plat(dev);
plat->base = dev_read_addr(dev);
if (plat->base == FDT_ADDR_T_NONE)
@@ -240,8 +240,8 @@ U_BOOT_DRIVER(serial_stm32) = {
.name = "serial_stm32",
.id = UCLASS_SERIAL,
.of_match = of_match_ptr(stm32_serial_id),
- .ofdata_to_platdata = of_match_ptr(stm32_serial_ofdata_to_platdata),
- .platdata_auto_alloc_size = sizeof(struct stm32x7_serial_platdata),
+ .of_to_plat = of_match_ptr(stm32_serial_of_to_plat),
+ .plat_auto = sizeof(struct stm32x7_serial_plat),
.ops = &stm32_serial_ops,
.probe = stm32_serial_probe,
#if !CONFIG_IS_ENABLED(OF_CONTROL)
diff --git a/drivers/serial/serial_stm32.h b/drivers/serial/serial_stm32.h
index 5737651888..5bee68fa9c 100644
--- a/drivers/serial/serial_stm32.h
+++ b/drivers/serial/serial_stm32.h
@@ -48,7 +48,7 @@ struct stm32_uart_info stm32h7_info = {
};
/* Information about a serial port */
-struct stm32x7_serial_platdata {
+struct stm32x7_serial_plat {
fdt_addr_t base; /* address of registers in physical memory */
struct stm32_uart_info *uart_info;
unsigned long int clock_rate;
diff --git a/drivers/serial/serial_uniphier.c b/drivers/serial/serial_uniphier.c
index a098028ca0..27e4b92c39 100644
--- a/drivers/serial/serial_uniphier.c
+++ b/drivers/serial/serial_uniphier.c
@@ -172,6 +172,6 @@ U_BOOT_DRIVER(uniphier_serial) = {
.id = UCLASS_SERIAL,
.of_match = uniphier_uart_of_match,
.probe = uniphier_serial_probe,
- .priv_auto_alloc_size = sizeof(struct uniphier_serial_priv),
+ .priv_auto = sizeof(struct uniphier_serial_priv),
.ops = &uniphier_serial_ops,
};
diff --git a/drivers/serial/serial_xen.c b/drivers/serial/serial_xen.c
index ba6504b947..dbb7b22b51 100644
--- a/drivers/serial/serial_xen.c
+++ b/drivers/serial/serial_xen.c
@@ -172,7 +172,7 @@ U_BOOT_DRIVER(serial_xen) = {
#if CONFIG_IS_ENABLED(OF_CONTROL)
.of_match = xen_serial_ids,
#endif
- .priv_auto_alloc_size = sizeof(struct xen_uart_priv),
+ .priv_auto = sizeof(struct xen_uart_priv),
.probe = xen_serial_probe,
.ops = &xen_serial_ops,
#if !CONFIG_IS_ENABLED(OF_CONTROL)
diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
index 236ab860ad..9780a44d09 100644
--- a/drivers/serial/serial_xuartlite.c
+++ b/drivers/serial/serial_xuartlite.c
@@ -32,7 +32,7 @@ struct uartlite {
unsigned int control;
};
-struct uartlite_platdata {
+struct uartlite_plat {
struct uartlite *regs;
};
@@ -54,7 +54,7 @@ static void uart_out32(void __iomem *addr, u32 val)
static int uartlite_serial_putc(struct udevice *dev, const char ch)
{
- struct uartlite_platdata *plat = dev_get_platdata(dev);
+ struct uartlite_plat *plat = dev_get_plat(dev);
struct uartlite *regs = plat->regs;
if (uart_in32(&regs->status) & SR_TX_FIFO_FULL)
@@ -67,7 +67,7 @@ static int uartlite_serial_putc(struct udevice *dev, const char ch)
static int uartlite_serial_getc(struct udevice *dev)
{
- struct uartlite_platdata *plat = dev_get_platdata(dev);
+ struct uartlite_plat *plat = dev_get_plat(dev);
struct uartlite *regs = plat->regs;
if (!(uart_in32(&regs->status) & SR_RX_FIFO_VALID_DATA))
@@ -78,7 +78,7 @@ static int uartlite_serial_getc(struct udevice *dev)
static int uartlite_serial_pending(struct udevice *dev, bool input)
{
- struct uartlite_platdata *plat = dev_get_platdata(dev);
+ struct uartlite_plat *plat = dev_get_plat(dev);
struct uartlite *regs = plat->regs;
if (input)
@@ -89,7 +89,7 @@ static int uartlite_serial_pending(struct udevice *dev, bool input)
static int uartlite_serial_probe(struct udevice *dev)
{
- struct uartlite_platdata *plat = dev_get_platdata(dev);
+ struct uartlite_plat *plat = dev_get_plat(dev);
struct uartlite *regs = plat->regs;
int ret;
@@ -106,9 +106,9 @@ static int uartlite_serial_probe(struct udevice *dev)
return 0;
}
-static int uartlite_serial_ofdata_to_platdata(struct udevice *dev)
+static int uartlite_serial_of_to_plat(struct udevice *dev)
{
- struct uartlite_platdata *plat = dev_get_platdata(dev);
+ struct uartlite_plat *plat = dev_get_plat(dev);
plat->regs = dev_read_addr_ptr(dev);
@@ -131,8 +131,8 @@ U_BOOT_DRIVER(serial_uartlite) = {
.name = "serial_uartlite",
.id = UCLASS_SERIAL,
.of_match = uartlite_serial_ids,
- .ofdata_to_platdata = uartlite_serial_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct uartlite_platdata),
+ .of_to_plat = uartlite_serial_of_to_plat,
+ .plat_auto = sizeof(struct uartlite_plat),
.probe = uartlite_serial_probe,
.ops = &uartlite_serial_ops,
};
@@ -148,7 +148,7 @@ static inline void _debug_uart_init(void)
uart_out32(&regs->control, 0);
uart_out32(&regs->control, ULITE_CONTROL_RST_RX | ULITE_CONTROL_RST_TX);
- uart_in32(&regs->status);
+ ret = uart_in32(&regs->status);
/* Endianness detection */
if ((ret & SR_TX_FIFO_EMPTY) != SR_TX_FIFO_EMPTY) {
little_endian = true;
diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c
index 0e71cada1b..2883e2466f 100644
--- a/drivers/serial/serial_zynq.c
+++ b/drivers/serial/serial_zynq.c
@@ -41,7 +41,7 @@ struct uart_zynq {
u32 baud_rate_divider; /* 0x34 - Baud Rate Divider [7:0] */
};
-struct zynq_uart_platdata {
+struct zynq_uart_plat {
struct uart_zynq *regs;
};
@@ -107,7 +107,7 @@ static int _uart_zynq_serial_putc(struct uart_zynq *regs, const char c)
static int zynq_serial_setbrg(struct udevice *dev, int baudrate)
{
- struct zynq_uart_platdata *platdata = dev_get_platdata(dev);
+ struct zynq_uart_plat *plat = dev_get_plat(dev);
unsigned long clock;
int ret;
@@ -132,15 +132,15 @@ static int zynq_serial_setbrg(struct udevice *dev, int baudrate)
return ret;
}
- _uart_zynq_serial_setbrg(platdata->regs, clock, baudrate);
+ _uart_zynq_serial_setbrg(plat->regs, clock, baudrate);
return 0;
}
static int zynq_serial_probe(struct udevice *dev)
{
- struct zynq_uart_platdata *platdata = dev_get_platdata(dev);
- struct uart_zynq *regs = platdata->regs;
+ struct zynq_uart_plat *plat = dev_get_plat(dev);
+ struct uart_zynq *regs = plat->regs;
u32 val;
/* No need to reinitialize the UART if TX already enabled */
@@ -148,15 +148,15 @@ static int zynq_serial_probe(struct udevice *dev)
if (val & ZYNQ_UART_CR_TX_EN)
return 0;
- _uart_zynq_serial_init(platdata->regs);
+ _uart_zynq_serial_init(plat->regs);
return 0;
}
static int zynq_serial_getc(struct udevice *dev)
{
- struct zynq_uart_platdata *platdata = dev_get_platdata(dev);
- struct uart_zynq *regs = platdata->regs;
+ struct zynq_uart_plat *plat = dev_get_plat(dev);
+ struct uart_zynq *regs = plat->regs;
if (readl(&regs->channel_sts) & ZYNQ_UART_SR_RXEMPTY)
return -EAGAIN;
@@ -166,15 +166,15 @@ static int zynq_serial_getc(struct udevice *dev)
static int zynq_serial_putc(struct udevice *dev, const char ch)
{
- struct zynq_uart_platdata *platdata = dev_get_platdata(dev);
+ struct zynq_uart_plat *plat = dev_get_plat(dev);
- return _uart_zynq_serial_putc(platdata->regs, ch);
+ return _uart_zynq_serial_putc(plat->regs, ch);
}
static int zynq_serial_pending(struct udevice *dev, bool input)
{
- struct zynq_uart_platdata *platdata = dev_get_platdata(dev);
- struct uart_zynq *regs = platdata->regs;
+ struct zynq_uart_plat *plat = dev_get_plat(dev);
+ struct uart_zynq *regs = plat->regs;
if (input)
return !(readl(&regs->channel_sts) & ZYNQ_UART_SR_RXEMPTY);
@@ -182,13 +182,13 @@ static int zynq_serial_pending(struct udevice *dev, bool input)
return !!(readl(&regs->channel_sts) & ZYNQ_UART_SR_TXACTIVE);
}
-static int zynq_serial_ofdata_to_platdata(struct udevice *dev)
+static int zynq_serial_of_to_plat(struct udevice *dev)
{
- struct zynq_uart_platdata *platdata = dev_get_platdata(dev);
+ struct zynq_uart_plat *plat = dev_get_plat(dev);
- platdata->regs = (struct uart_zynq *)dev_read_addr(dev);
- if (IS_ERR(platdata->regs))
- return PTR_ERR(platdata->regs);
+ plat->regs = (struct uart_zynq *)dev_read_addr(dev);
+ if (IS_ERR(plat->regs))
+ return PTR_ERR(plat->regs);
return 0;
}
@@ -211,8 +211,8 @@ U_BOOT_DRIVER(serial_zynq) = {
.name = "serial_zynq",
.id = UCLASS_SERIAL,
.of_match = zynq_serial_ids,
- .ofdata_to_platdata = zynq_serial_ofdata_to_platdata,
- .platdata_auto_alloc_size = sizeof(struct zynq_uart_platdata),
+ .of_to_plat = zynq_serial_of_to_plat,
+ .plat_auto = sizeof(struct zynq_uart_plat),
.probe = zynq_serial_probe,
.ops = &zynq_serial_ops,
};