summaryrefslogtreecommitdiff
path: root/drivers/serial
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-12-22 19:30:28 -0700
committerSimon Glass <sjg@chromium.org>2021-01-05 12:24:40 -0700
commit0fd3d91152df5bb6c5f7b9ee68f01a9a1c9a875d (patch)
tree1dbc5b936b98393e343cc99a40382b2734ac778e /drivers/serial
parent12559f5bab3e43b603dccfa6c354ffd7da03249c (diff)
downloadu-boot-0fd3d91152df5bb6c5f7b9ee68f01a9a1c9a875d.tar.gz
u-boot-0fd3d91152df5bb6c5f7b9ee68f01a9a1c9a875d.tar.bz2
u-boot-0fd3d91152df5bb6c5f7b9ee68f01a9a1c9a875d.zip
dm: Use access methods for dev/uclass private data
Most drivers use these access methods but a few do not. Update them. In some cases the access is not permitted, so mark those with a FIXME tag for the maintainer to check. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Pratyush Yadav <p.yadav@ti.com>
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/altera_jtag_uart.c8
-rw-r--r--drivers/serial/altera_uart.c8
-rw-r--r--drivers/serial/atmel_usart.c2
-rw-r--r--drivers/serial/ns16550.c4
-rw-r--r--drivers/serial/sandbox.c6
-rw-r--r--drivers/serial/serial_arc.c8
-rw-r--r--drivers/serial/serial_linflexuart.c2
-rw-r--r--drivers/serial/serial_lpuart.c10
-rw-r--r--drivers/serial/serial_mcf.c10
-rw-r--r--drivers/serial/serial_meson.c12
-rw-r--r--drivers/serial/serial_mxc.c12
-rw-r--r--drivers/serial/serial_omap.c2
-rw-r--r--drivers/serial/serial_pxa.c10
-rw-r--r--drivers/serial/serial_rockchip.c3
-rw-r--r--drivers/serial/serial_s5p.c12
15 files changed, 55 insertions, 54 deletions
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c
index 0d3ccd880c..4435fcf56b 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(&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_plat *plat = dev->plat;
+ 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_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, &regs->control); /* clear AC flag */
diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index a3efa1ee1b..b18be6e245 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(&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_plat *plat = dev->plat;
+ 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_plat *plat = dev->plat;
+ struct altera_uart_plat *plat = dev_get_plat(dev);
struct altera_uart_regs *const regs = plat->regs;
if (!(readl(&regs->status) & ALTERA_UART_RRDY))
diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index 7eabf76d92..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_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 17808fb70a..508c134b94 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -498,7 +498,7 @@ 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_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;
@@ -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;
diff --git a/drivers/serial/sandbox.c b/drivers/serial/sandbox.c
index c7d5390b43..a05c56458b 100644
--- a/drivers/serial/sandbox.c
+++ b/drivers/serial/sandbox.c
@@ -72,7 +72,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 +83,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 +203,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;
diff --git a/drivers/serial/serial_arc.c b/drivers/serial/serial_arc.c
index 022e37748c..445eacc8aa 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(&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_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(&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_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_linflexuart.c b/drivers/serial/serial_linflexuart.c
index ced005706a..c3714e1e1e 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 5beb5f2ce6..a35e5be303 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 4ba6dc32f9..e6e21b2ce8 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 40d9bfe7c6..d69ec221e4 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 2603fa8611..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_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_omap.c b/drivers/serial/serial_omap.c
index c235215541..2b23ece442 100644
--- a/drivers/serial/serial_omap.c
+++ b/drivers/serial/serial_omap.c
@@ -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;
diff --git a/drivers/serial/serial_pxa.c b/drivers/serial/serial_pxa.c
index d82f3b9752..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_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 036c07262b..97d40869a2 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);
}
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
index 120df835db..0eac0d53a5 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);