From 0478dac62a9add8c73981a900ceaa6da732ae2bb Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Sun, 4 Dec 2022 10:14:13 -0500 Subject: [PATCH] kbuild: Remove uncmd_spl logic 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 --- board/freescale/common/i2c_common.c | 2 +- board/freescale/common/i2c_common.h | 2 +- drivers/misc/gsc.c | 2 +- drivers/serial/Makefile | 17 +---------------- drivers/serial/atmel_usart.c | 8 +++----- drivers/serial/serial-uclass.c | 6 +++--- drivers/serial/serial_mtk.c | 3 +-- drivers/serial/serial_pl01x.c | 11 +++-------- drivers/serial/serial_pl01x_internal.h | 2 +- include/config_uncmd_spl.h | 21 --------------------- include/configs/kmcent2.h | 2 +- include/configs/mv-common.h | 2 +- include/configs/sunxi-common.h | 2 +- include/configs/ti_omap4_common.h | 2 +- include/configs/x530.h | 2 +- include/ns16550.h | 10 +++++----- scripts/Makefile.autoconf | 1 - scripts/Makefile.build | 1 - scripts/Makefile.uncmd_spl | 14 -------------- 19 files changed, 25 insertions(+), 85 deletions(-) delete mode 100644 include/config_uncmd_spl.h delete mode 100644 scripts/Makefile.uncmd_spl diff --git a/board/freescale/common/i2c_common.c b/board/freescale/common/i2c_common.c index 0f09ed7d34..119ed3c617 100644 --- a/board/freescale/common/i2c_common.c +++ b/board/freescale/common/i2c_common.c @@ -9,7 +9,7 @@ #include #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) diff --git a/board/freescale/common/i2c_common.h b/board/freescale/common/i2c_common.h index 840ad66183..77a7b6aedd 100644 --- a/board/freescale/common/i2c_common.h +++ b/board/freescale/common/i2c_common.h @@ -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) \ diff --git a/drivers/misc/gsc.c b/drivers/misc/gsc.c index ec24ca807b..65c9c2c6ce 100644 --- a/drivers/misc/gsc.c +++ b/drivers/misc/gsc.c @@ -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; diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile index 33fa568221..37d3f82dbd 100644 --- a/drivers/serial/Makefile +++ b/drivers/serial/Makefile @@ -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) +ifeq ($(CONFIG_$(SPL_TPL_)DM_SERIAL),y) obj-y += serial-uclass.o else obj-y += serial.o endif -else - -ifdef CONFIG_DM_SERIAL -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 diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c index 9d97bc8654..9853f49c94 100644 --- a/drivers/serial/atmel_usart.c +++ b/drivers/serial/atmel_usart.c @@ -18,7 +18,7 @@ #include #include -#ifdef CONFIG_DM_SERIAL +#if CONFIG_IS_ENABLED(DM_SERIAL) #include #endif #include @@ -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, diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index c02106747a..7240d763d1 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -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)); diff --git a/drivers/serial/serial_mtk.c b/drivers/serial/serial_mtk.c index 6fb4cb65c2..ded7346a13 100644 --- a/drivers/serial/serial_mtk.c +++ b/drivers/serial/serial_mtk.c @@ -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); diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c index 7449e9b904..f5468353e1 100644 --- a/drivers/serial/serial_pl01x.c +++ b/drivers/serial/serial_pl01x.c @@ -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); diff --git a/drivers/serial/serial_pl01x_internal.h b/drivers/serial/serial_pl01x_internal.h index dfd95a0b77..71c52bb531 100644 --- a/drivers/serial/serial_pl01x_internal.h +++ b/drivers/serial/serial_pl01x_internal.h @@ -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 index a59b9bbafb..0000000000 --- a/include/config_uncmd_spl.h +++ /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__ */ diff --git a/include/configs/kmcent2.h b/include/configs/kmcent2.h index 60fea59dee..e7ae18ec5f 100644 --- a/include/configs/kmcent2.h +++ b/include/configs/kmcent2.h @@ -314,7 +314,7 @@ * 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 diff --git a/include/configs/mv-common.h b/include/configs/mv-common.h index fa275d61d1..3dfcb138b4 100644 --- a/include/configs/mv-common.h +++ b/include/configs/mv-common.h @@ -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 diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h index eae107fe5e..8032abe769 100644 --- a/include/configs/sunxi-common.h +++ b/include/configs/sunxi-common.h @@ -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 diff --git a/include/configs/ti_omap4_common.h b/include/configs/ti_omap4_common.h index 49f4263e16..9e312ac16d 100644 --- a/include/configs/ti_omap4_common.h +++ b/include/configs/ti_omap4_common.h @@ -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 diff --git a/include/configs/x530.h b/include/configs/x530.h index fddf00d3d1..e1678e79e4 100644 --- a/include/configs/x530.h +++ b/include/configs/x530.h @@ -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 diff --git a/include/ns16550.h b/include/ns16550.h index 0ee5c4d6de..f45fc8cecc 100644 --- a/include/ns16550.h +++ b/include/ns16550.h @@ -26,7 +26,7 @@ #include -#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 @@ -37,10 +37,10 @@ #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 }; diff --git a/scripts/Makefile.autoconf b/scripts/Makefile.autoconf index f5f5e4a4d5..0ade91642a 100644 --- a/scripts/Makefile.autoconf +++ b/scripts/Makefile.autoconf @@ -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 \; \ echo \#include \; \ echo \#include \; \ echo \#include \; \ diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 3b8c9d8c31..97dd4a64f6 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -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 index 6ea097d36d..0000000000 --- a/scripts/Makefile.uncmd_spl +++ /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