summaryrefslogtreecommitdiffstats
path: root/drivers/serial/serial_sifive.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/serial_sifive.c')
-rw-r--r--drivers/serial/serial_sifive.c38
1 files changed, 19 insertions, 19 deletions
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,
};