#include <dm.h>
#include <errno.h>
#include <fdtdec.h>
+#include <log.h>
#include <watchdog.h>
#include <asm/io.h>
+#include <dm/device_compat.h>
+#include <linux/bitops.h>
#include <linux/compiler.h>
#include <serial.h>
-
-DECLARE_GLOBAL_DATA_PTR;
+#include <linux/err.h>
#define ZYNQ_UART_SR_TXACTIVE BIT(11) /* TX active */
#define ZYNQ_UART_SR_TXFULL BIT(4) /* TX FIFO full */
struct uart_zynq *regs;
};
-/* Set up the baud rate in gd struct */
+/* Set up the baud rate */
static void _uart_zynq_serial_setbrg(struct uart_zynq *regs,
unsigned long clock, unsigned long baud)
{
static int zynq_serial_probe(struct udevice *dev)
{
struct zynq_uart_platdata *platdata = dev_get_platdata(dev);
+ struct uart_zynq *regs = platdata->regs;
+ u32 val;
- /* No need to reinitialize the UART after relocation */
- if (gd->flags & GD_FLG_RELOC)
+ /* No need to reinitialize the UART if TX already enabled */
+ val = readl(®s->control);
+ if (val & ZYNQ_UART_CR_TX_EN)
return 0;
_uart_zynq_serial_init(platdata->regs);
.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),
+ .platdata_auto = sizeof(struct zynq_uart_platdata),
.probe = zynq_serial_probe,
.ops = &zynq_serial_ops,
- .flags = DM_FLAG_PRE_RELOC,
};
#ifdef CONFIG_DEBUG_UART_ZYNQ