x86: serial: Use NS16550_DYNAMIC in Slim Bootloader
authorPark, Aiden <aiden.park@intel.com>
Wed, 18 Dec 2019 05:56:23 +0000 (05:56 +0000)
committerBin Meng <bmeng.cn@gmail.com>
Mon, 3 Feb 2020 17:19:26 +0000 (01:19 +0800)
Slim Bootloader provides serial port info in its HOB to support
both IO or MMIO serial ports, but it's controlled by SYS_NS16550_MEM32
or SYS_NS16550_PORT_MAPPED in U-Boot.
To support both serial port configurations dynamically at runtime,
Slim Bootloader serial driver leverages NS16550_DYNAMIC.

Signed-off-by: Aiden Park <aiden.park@intel.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[bmeng: remove the obsolete comments for data->type]
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
arch/x86/cpu/slimbootloader/serial.c
include/configs/slimbootloader.h

index 7b44a59bffec462b4cbbc4273e3fe2bba9635bb4..bab54b18df67d3c62a5ee900b4857dc021c3f07b 100644 (file)
@@ -34,18 +34,15 @@ static int slimbootloader_serial_ofdata_to_platdata(struct udevice *dev)
              data->stride,
              data->clk);
 
-       /*
-        * The data->type provides port io or mmio access type info,
-        * but the access type will be controlled by
-        * CONFIG_SYS_NS16550_PORT_MAPPED or CONFIG_SYS_NS16550_MEM32.
-        *
-        * TBD: ns16550 access type configuration in runtime.
-        *      ex) plat->access_type = data->type
-        */
        plat->base = data->base;
        /* ns16550 uses reg_shift, then covert stride to shift */
        plat->reg_shift = data->stride >> 1;
+       plat->reg_width = data->stride;
        plat->clock = data->clk;
+       plat->fcr = UART_FCR_DEFVAL;
+       plat->flags = 0;
+       if (data->type == 1)
+               plat->flags |= NS16550_FLAG_IO;
 
        return 0;
 }
index e0011ed4461bcbf12b860232d26dacbcba896797..b8169072cc86a2c10b978ab3d41a092047ef8038 100644 (file)
@@ -8,19 +8,6 @@
 
 #include <configs/x86-common.h>
 
-/*
- * By default, CONFIG_SYS_NS16550_PORT_MAPPED is enabled for port io serial.
- * To use mmio base serial, enable CONFIG_SYS_NS16550_MEM32 and disable
- * CONFIG_SYS_NS16550_PORT_MAPPED until ns16550 driver supports serial port
- * configuration in run-time.
- *
- * #define CONFIG_SYS_NS16550_MEM32
- * #undef CONFIG_SYS_NS16550_PORT_MAPPED
- */
-#ifdef CONFIG_SYS_NS16550_MEM32
-#undef CONFIG_SYS_NS16550_PORT_MAPPED
-#endif
-
 #define CONFIG_STD_DEVICES_SETTINGS            \
        "stdin=serial,i8042-kbd,usbkbd\0"       \
        "stdout=serial\0"                       \