]> Git Repo - J-u-boot.git/blobdiff - drivers/serial/serial_pic32.c
pinctrl: renesas: Minimize R8A77970 V3M PFC tables
[J-u-boot.git] / drivers / serial / serial_pic32.c
index c2141f0a083dfc8651d89c126eed36ccad018300..a49c4139b5ae55739601e9b41500b87270ecb1a1 100644 (file)
@@ -1,14 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (c) 2015 Paul Thacker <[email protected]>
  *
- * SPDX-License-Identifier:    GPL-2.0+
- *
  */
-#include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <malloc.h>
 #include <serial.h>
 #include <wait_bit.h>
+#include <asm/global_data.h>
+#include <linux/bitops.h>
 #include <mach/pic32.h>
 #include <dt-bindings/clock/microchip,clock.h>
 
@@ -51,8 +52,8 @@ static int pic32_serial_init(void __iomem *base, ulong clk, u32 baudrate)
        u32 div = DIV_ROUND_CLOSEST(clk, baudrate * 16);
 
        /* wait for TX FIFO to empty */
-       wait_for_bit(__func__, base + U_STA, UART_TX_EMPTY,
-                    true, CONFIG_SYS_HZ, false);
+       wait_for_bit_le32(base + U_STA, UART_TX_EMPTY,
+                         true, CONFIG_SYS_HZ, false);
 
        /* send break */
        writel(UART_TX_BRK, base + U_STASET);
@@ -141,7 +142,8 @@ static int pic32_uart_probe(struct udevice *dev)
        int ret;
 
        /* get address */
-       addr = fdtdec_get_addr_size(gd->fdt_blob, dev->of_offset, "reg", &size);
+       addr = fdtdec_get_addr_size(gd->fdt_blob, dev_of_offset(dev), "reg",
+                                   &size);
        if (addr == FDT_ADDR_T_NONE)
                return -EINVAL;
 
@@ -152,7 +154,6 @@ static int pic32_uart_probe(struct udevice *dev)
        if (ret < 0)
                return ret;
        priv->uartclk = clk_get_rate(&clk);
-       clk_free(&clk);
 
        /* initialize serial */
        return pic32_serial_init(priv->base, priv->uartclk, CONFIG_BAUDRATE);
@@ -176,8 +177,7 @@ U_BOOT_DRIVER(pic32_serial) = {
        .of_match       = pic32_uart_ids,
        .probe          = pic32_uart_probe,
        .ops            = &pic32_uart_ops,
-       .flags          = DM_FLAG_PRE_RELOC,
-       .priv_auto_alloc_size = sizeof(struct pic32_uart_priv),
+       .priv_auto      = sizeof(struct pic32_uart_priv),
 };
 
 #ifdef CONFIG_DEBUG_UART_PIC32
@@ -185,14 +185,14 @@ U_BOOT_DRIVER(pic32_serial) = {
 
 static inline void _debug_uart_init(void)
 {
-       void __iomem *base = (void __iomem *)CONFIG_DEBUG_UART_BASE;
+       void __iomem *base = (void __iomem *)CONFIG_VAL(DEBUG_UART_BASE);
 
        pic32_serial_init(base, CONFIG_DEBUG_UART_CLOCK, CONFIG_BAUDRATE);
 }
 
 static inline void _debug_uart_putc(int ch)
 {
-       writel(ch, CONFIG_DEBUG_UART_BASE + U_TXR);
+       writel(ch, CONFIG_VAL(DEBUG_UART_BASE) + U_TXR);
 }
 
 DEBUG_UART_FUNCS
This page took 0.027003 seconds and 4 git commands to generate.