/* Simple U-Boot driver for the PrimeCell PL010/PL011 UARTs */
#include <common.h>
+#include <asm/global_data.h>
/* For get_bus_freq() */
#include <clock_legacy.h>
#include <dm.h>
#ifndef CONFIG_DM_SERIAL
static volatile unsigned char *const port[] = CONFIG_PL01x_PORTS;
-static enum pl01x_type pl01x_type __attribute__ ((section(".data")));
-static struct pl01x_regs *base_regs __attribute__ ((section(".data")));
+static enum pl01x_type pl01x_type __section(".data");
+static struct pl01x_regs *base_regs __section(".data");
#define NUM_PORTS (sizeof(port)/sizeof(port[0]))
#endif
{
int clock = 0;
-#if defined(CONFIG_PL010_SERIAL)
- pl01x_type = TYPE_PL010;
-#elif defined(CONFIG_PL011_SERIAL)
+#if defined(CONFIG_PL011_SERIAL)
pl01x_type = TYPE_PL011;
clock = CONFIG_PL011_CLOCK;
#endif
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) {
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;
#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;
.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
{
#ifndef CONFIG_DEBUG_UART_SKIP_INIT
struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_DEBUG_UART_BASE;
- enum pl01x_type type = CONFIG_IS_ENABLED(DEBUG_UART_PL011) ?
- TYPE_PL011 : TYPE_PL010;
+ enum pl01x_type type;
+
+ if (IS_ENABLED(CONFIG_DEBUG_UART_PL011))
+ type = TYPE_PL011;
+ else
+ type = TYPE_PL010;
pl01x_generic_serial_init(regs, type);
pl01x_generic_setbrg(regs, type,
{
struct pl01x_regs *regs = (struct pl01x_regs *)CONFIG_DEBUG_UART_BASE;
- pl01x_putc(regs, ch);
+ while (pl01x_putc(regs, ch) == -EAGAIN)
+ ;
}
DEBUG_UART_FUNCS