kbuild: Remove uncmd_spl logic
authorTom Rini <trini@konsulko.com>
Sun, 4 Dec 2022 15:14:13 +0000 (10:14 -0500)
committerTom Rini <trini@konsulko.com>
Fri, 23 Dec 2022 15:15:13 +0000 (10:15 -0500)
At this point in the conversion there should be no need to have logic to
disable some symbol during the SPL build as all symbols should have an
SPL counterpart.

The main real changes done here are that we now must make proper use of
CONFIG_IS_ENABLED(DM_SERIAL) rather than many of the odd tricks we
developed prior to CONFIG_IS_ENABLED() being available.

Signed-off-by: Tom Rini <trini@konsulko.com>
19 files changed:
board/freescale/common/i2c_common.c
board/freescale/common/i2c_common.h
drivers/misc/gsc.c
drivers/serial/Makefile
drivers/serial/atmel_usart.c
drivers/serial/serial-uclass.c
drivers/serial/serial_mtk.c
drivers/serial/serial_pl01x.c
drivers/serial/serial_pl01x_internal.h
include/config_uncmd_spl.h [deleted file]
include/configs/kmcent2.h
include/configs/mv-common.h
include/configs/sunxi-common.h
include/configs/ti_omap4_common.h
include/configs/x530.h
include/ns16550.h
scripts/Makefile.autoconf
scripts/Makefile.build
scripts/Makefile.uncmd_spl [deleted file]

index 0f09ed7..119ed3c 100644 (file)
@@ -9,7 +9,7 @@
 #include <i2c.h>
 #include "i2c_common.h"
 
-#ifdef CONFIG_DM_I2C
+#if CONFIG_IS_ENABLED(DM_I2C)
 
 /* If DM is in use, retrieve the chip for the specified bus number */
 int fsl_i2c_get_device(int address, int bus, DEVICE_HANDLE_T *dev)
index 840ad66..77a7b6a 100644 (file)
@@ -9,7 +9,7 @@
 #define __NXP_I2C_COMMON_H__
 
 /* Common functionality shared by the I2C drivers for VID and the mux. */
-#ifdef CONFIG_DM_I2C
+#if CONFIG_IS_ENABLED(DM_I2C)
 #define DEVICE_HANDLE_T struct udevice *
 
 #define I2C_READ(dev, register, data, length) \
index ec24ca8..65c9c2c 100644 (file)
@@ -77,7 +77,7 @@ enum {
        GSC_SC_RST_CAUSE_MAX            = 10,
 };
 
-#if (IS_ENABLED(CONFIG_DM_I2C))
+#if CONFIG_IS_ENABLED(DM_I2C)
 
 struct gsc_priv {
        int gscver;
index 33fa568..37d3f82 100644 (file)
@@ -3,30 +3,15 @@
 # (C) Copyright 2006-2009
 # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 
-ifdef CONFIG_SPL_BUILD
-
-ifeq ($(CONFIG_$(SPL_TPL_)BUILD)$(CONFIG_$(SPL_TPL_)DM_SERIAL),yy)
-obj-y += serial-uclass.o
-else
-obj-y += serial.o
-endif
-
-else
-
-ifdef CONFIG_DM_SERIAL
+ifeq ($(CONFIG_$(SPL_TPL_)DM_SERIAL),y)
 obj-y += serial-uclass.o
 else
 obj-y += serial.o
 endif
 
-endif
-
-ifdef CONFIG_DM_SERIAL
 obj-$(CONFIG_PL01X_SERIAL) += serial_pl01x.o
-else
 obj-$(CONFIG_PL011_SERIAL) += serial_pl01x.o
 obj-$(CONFIG_$(SPL_)SYS_NS16550_SERIAL) += serial_ns16550.o
-endif
 
 obj-$(CONFIG_ALTERA_UART) += altera_uart.o
 obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o
index 9d97bc8..9853f49 100644 (file)
@@ -18,7 +18,7 @@
 #include <linux/delay.h>
 
 #include <asm/io.h>
-#ifdef CONFIG_DM_SERIAL
+#if CONFIG_IS_ENABLED(DM_SERIAL)
 #include <asm/arch/atmel_serial.h>
 #endif
 #include <asm/arch/clk.h>
@@ -28,7 +28,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifndef CONFIG_DM_SERIAL
+#if !CONFIG_IS_ENABLED(DM_SERIAL)
 static void atmel_serial_setbrg_internal(atmel_usart3_t *usart, int id,
                                         int baudrate)
 {
@@ -133,9 +133,7 @@ __weak struct serial_device *default_serial_console(void)
 {
        return &atmel_serial_drv;
 }
-#endif
-
-#ifdef CONFIG_DM_SERIAL
+#else
 enum serial_clk_type {
        CLK_TYPE_NORMAL = 0,
        CLK_TYPE_DBGU,
index c021067..7240d76 100644 (file)
@@ -407,7 +407,7 @@ void serial_stdio_init(void)
 {
 }
 
-#if defined(CONFIG_DM_STDIO)
+#if CONFIG_IS_ENABLED(DM_STDIO)
 
 #if CONFIG_IS_ENABLED(SERIAL_PRESENT)
 static void serial_stub_putc(struct stdio_dev *sdev, const char ch)
@@ -505,7 +505,7 @@ U_BOOT_ENV_CALLBACK(baudrate, on_baudrate);
 static int serial_post_probe(struct udevice *dev)
 {
        struct dm_serial_ops *ops = serial_get_ops(dev);
-#ifdef CONFIG_DM_STDIO
+#if CONFIG_IS_ENABLED(DM_STDIO)
        struct serial_dev_priv *upriv = dev_get_uclass_priv(dev);
        struct stdio_dev sdev;
 #endif
@@ -540,7 +540,7 @@ static int serial_post_probe(struct udevice *dev)
                        return ret;
        }
 
-#ifdef CONFIG_DM_STDIO
+#if CONFIG_IS_ENABLED(DM_STDIO)
        if (!(gd->flags & GD_FLG_RELOC))
                return 0;
        memset(&sdev, '\0', sizeof(sdev));
index 6fb4cb6..ded7346 100644 (file)
@@ -173,8 +173,7 @@ static int _mtk_serial_pending(struct mtk_serial_priv *priv, bool input)
                return (readl(&priv->regs->lsr) & UART_LSR_THRE) ? 0 : 1;
 }
 
-#if defined(CONFIG_DM_SERIAL) && \
-       (!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_DM))
+#if CONFIG_IS_ENABLED(DM_SERIAL)
 static int mtk_serial_setbrg(struct udevice *dev, int baudrate)
 {
        struct mtk_serial_priv *priv = dev_get_priv(dev);
index 7449e9b..f546835 100644 (file)
@@ -27,8 +27,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifndef CONFIG_DM_SERIAL
-
+#if !CONFIG_IS_ENABLED(DM_SERIAL)
 static volatile unsigned char *const port[] = CFG_PL01x_PORTS;
 static enum pl01x_type pl01x_type __section(".data");
 static struct pl01x_regs *base_regs __section(".data");
@@ -186,7 +185,7 @@ static int pl01x_generic_setbrg(struct pl01x_regs *regs, enum pl01x_type type,
        return 0;
 }
 
-#ifndef CONFIG_DM_SERIAL
+#if !CONFIG_IS_ENABLED(DM_SERIAL)
 static void pl01x_serial_init_baud(int baudrate)
 {
        int clock = 0;
@@ -273,11 +272,7 @@ __weak struct serial_device *default_serial_console(void)
 {
        return &pl01x_serial_drv;
 }
-
-#endif /* nCONFIG_DM_SERIAL */
-
-#ifdef CONFIG_DM_SERIAL
-
+#else
 int pl01x_serial_setbrg(struct udevice *dev, int baudrate)
 {
        struct pl01x_serial_plat *plat = dev_get_plat(dev);
index dfd95a0..71c52bb 100644 (file)
@@ -38,7 +38,7 @@ struct pl01x_regs {
        u32     pl011_cr;       /* 0x30 Control register */
 };
 
-#ifdef CONFIG_DM_SERIAL
+#if CONFIG_IS_ENABLED(DM_SERIAL)
 
 int pl01x_serial_of_to_plat(struct udevice *dev);
 int pl01x_serial_probe(struct udevice *dev);
diff --git a/include/config_uncmd_spl.h b/include/config_uncmd_spl.h
deleted file mode 100644 (file)
index a59b9bb..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * (C) Copyright 2012
- * Ilya Yanok, ilya.yanok@gmail.com
- */
-
-#ifndef __CONFIG_UNCMD_SPL_H__
-#define __CONFIG_UNCMD_SPL_H__
-
-#ifdef CONFIG_SPL_BUILD
-/* SPL needs only BOOTP + TFTP so undefine other stuff to save space */
-
-#ifndef CONFIG_SPL_DM
-#undef CONFIG_DM_SERIAL
-#undef CONFIG_DM_I2C
-#endif
-
-#undef CONFIG_DM_STDIO
-
-#endif /* CONFIG_SPL_BUILD */
-#endif /* __CONFIG_UNCMD_SPL_H__ */
index 60fea59..e7ae18e 100644 (file)
  * shorted - index 1
  * Retain non-DM serial port for debug purposes.
  */
-#if !defined(CONFIG_DM_SERIAL)
+#if !CONFIG_IS_ENABLED(DM_SERIAL)
 #define CFG_SYS_NS16550_CLK            (get_bus_freq(0) / 2)
 #define CFG_SYS_NS16550_COM1   (CFG_SYS_CCSRBAR + 0x11C500)
 #endif
index fa275d6..3dfcb13 100644 (file)
@@ -33,7 +33,7 @@
  * NS16550 Configuration
  */
 #define CFG_SYS_NS16550_CLK            CFG_SYS_TCLK
-#if !defined(CONFIG_DM_SERIAL)
+#if !CONFIG_IS_ENABLED(DM_SERIAL)
 #define CFG_SYS_NS16550_COM1           MV_UART_CONSOLE_BASE
 #endif
 
index eae107f..8032abe 100644 (file)
@@ -23,7 +23,7 @@
 #else
 #define CFG_SYS_NS16550_CLK            24000000
 #endif
-#ifndef CONFIG_DM_SERIAL
+#if !CONFIG_IS_ENABLED(DM_SERIAL)
 # define CFG_SYS_NS16550_COM1          SUNXI_UART0_BASE
 # define CFG_SYS_NS16550_COM2          SUNXI_UART1_BASE
 # define CFG_SYS_NS16550_COM3          SUNXI_UART2_BASE
index 49f4263..9e312ac 100644 (file)
@@ -28,7 +28,7 @@
  * Hardware drivers
  */
 #define CFG_SYS_NS16550_CLK            48000000
-#if defined(CONFIG_SPL_BUILD) || !defined(CONFIG_DM_SERIAL)
+#if !CONFIG_IS_ENABLED(DM_SERIAL)
 #define CFG_SYS_NS16550_COM3           UART3_BASE
 #endif
 
index fddf00d..e1678e7 100644 (file)
@@ -14,7 +14,7 @@
  * NS16550 Configuration
  */
 #define CFG_SYS_NS16550_CLK            CFG_SYS_TCLK
-#if !defined(CONFIG_DM_SERIAL)
+#if !CONFIG_IS_ENABLED(DM_SERIAL)
 #define CFG_SYS_NS16550_COM1           MV_UART_CONSOLE_BASE
 #endif
 
index 0ee5c4d..f45fc8c 100644 (file)
@@ -26,7 +26,7 @@
 
 #include <linux/types.h>
 
-#if defined(CONFIG_DM_SERIAL) && !defined(CONFIG_SYS_NS16550_REG_SIZE)
+#if CONFIG_IS_ENABLED(DM_SERIAL) && !defined(CONFIG_SYS_NS16550_REG_SIZE)
 /*
  * For driver model we always use one byte per register, and sort out the
  * differences in the driver
 #ifdef CONFIG_NS16550_DYNAMIC
 #define UART_REG(x)    unsigned char x
 #else
-#if !defined(CONFIG_SYS_NS16550_REG_SIZE) || (CONFIG_SYS_NS16550_REG_SIZE == 0)
-#error "Please define NS16550 registers size."
-#elif defined(CONFIG_SYS_NS16550_MEM32) && !defined(CONFIG_DM_SERIAL)
+#if defined(CONFIG_SYS_NS16550_MEM32) && !CONFIG_IS_ENABLED(DM_SERIAL)
 #define UART_REG(x) u32 x
+#elif !defined(CONFIG_SYS_NS16550_REG_SIZE) || (CONFIG_SYS_NS16550_REG_SIZE == 0)
+#error "Please define NS16550 registers size."
 #elif (CONFIG_SYS_NS16550_REG_SIZE > 0)
 #define UART_REG(x)                                               \
        unsigned char prepad_##x[CONFIG_SYS_NS16550_REG_SIZE - 1]; \
@@ -113,7 +113,7 @@ struct ns16550 {
        UART_REG(scr);          /* 10*/
        UART_REG(ssr);          /* 11*/
 #endif
-#ifdef CONFIG_DM_SERIAL
+#if CONFIG_IS_ENABLED(DM_SERIAL)
        struct ns16550_plat *plat;
 #endif
 };
index f5f5e4a..0ade916 100644 (file)
@@ -113,7 +113,6 @@ vpl/include/autoconf.mk: vpl/u-boot.cfg
 define filechk_config_h
        (echo "/* Automatically generated - do not edit */";            \
        echo \#define CFG_BOARDDIR board/$(if $(VENDOR),$(VENDOR)/)$(BOARD);\
-       echo \#include \<config_uncmd_spl.h\>;                          \
        echo \#include \<configs/$(CONFIG_SYS_CONFIG_NAME).h\>;         \
        echo \#include \<asm/config.h\>;                                \
        echo \#include \<linux/kconfig.h\>;                             \
index 3b8c9d8..97dd4a6 100644 (file)
@@ -48,7 +48,6 @@ subdir-ccflags-y :=
 # Modified for U-Boot
 -include include/config/auto.conf
 -include $(prefix)/include/autoconf.mk
-include scripts/Makefile.uncmd_spl
 
 include scripts/Kbuild.include
 
diff --git a/scripts/Makefile.uncmd_spl b/scripts/Makefile.uncmd_spl
deleted file mode 100644 (file)
index 6ea097d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0+
-# Makefile version of include/config_uncmd_spl.h
-# TODO: Invent a better way
-
-ifdef CONFIG_SPL_BUILD
-
-ifndef CONFIG_SPL_DM
-CONFIG_DM_SERIAL=
-CONFIG_DM_I2C=
-CONFIG_DM_SPI=
-CONFIG_DM_SPI_FLASH=
-endif
-
-endif