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 <trini@konsulko.com>
This commit is contained in:
Tom Rini 2022-12-04 10:14:13 -05:00
parent e95bcfb56c
commit 0478dac62a
19 changed files with 25 additions and 85 deletions

View File

@ -9,7 +9,7 @@
#include <i2c.h> #include <i2c.h>
#include "i2c_common.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 */ /* 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) int fsl_i2c_get_device(int address, int bus, DEVICE_HANDLE_T *dev)

View File

@ -9,7 +9,7 @@
#define __NXP_I2C_COMMON_H__ #define __NXP_I2C_COMMON_H__
/* Common functionality shared by the I2C drivers for VID and the mux. */ /* 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 DEVICE_HANDLE_T struct udevice *
#define I2C_READ(dev, register, data, length) \ #define I2C_READ(dev, register, data, length) \

View File

@ -77,7 +77,7 @@ enum {
GSC_SC_RST_CAUSE_MAX = 10, GSC_SC_RST_CAUSE_MAX = 10,
}; };
#if (IS_ENABLED(CONFIG_DM_I2C)) #if CONFIG_IS_ENABLED(DM_I2C)
struct gsc_priv { struct gsc_priv {
int gscver; int gscver;

View File

@ -3,30 +3,15 @@
# (C) Copyright 2006-2009 # (C) Copyright 2006-2009
# Wolfgang Denk, DENX Software Engineering, wd@denx.de. # Wolfgang Denk, DENX Software Engineering, wd@denx.de.
ifdef CONFIG_SPL_BUILD ifeq ($(CONFIG_$(SPL_TPL_)DM_SERIAL),y)
ifeq ($(CONFIG_$(SPL_TPL_)BUILD)$(CONFIG_$(SPL_TPL_)DM_SERIAL),yy)
obj-y += serial-uclass.o obj-y += serial-uclass.o
else else
obj-y += serial.o obj-y += serial.o
endif 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 obj-$(CONFIG_PL01X_SERIAL) += serial_pl01x.o
else
obj-$(CONFIG_PL011_SERIAL) += serial_pl01x.o obj-$(CONFIG_PL011_SERIAL) += serial_pl01x.o
obj-$(CONFIG_$(SPL_)SYS_NS16550_SERIAL) += serial_ns16550.o obj-$(CONFIG_$(SPL_)SYS_NS16550_SERIAL) += serial_ns16550.o
endif
obj-$(CONFIG_ALTERA_UART) += altera_uart.o obj-$(CONFIG_ALTERA_UART) += altera_uart.o
obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o obj-$(CONFIG_ALTERA_JTAG_UART) += altera_jtag_uart.o

View File

@ -18,7 +18,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <asm/io.h> #include <asm/io.h>
#ifdef CONFIG_DM_SERIAL #if CONFIG_IS_ENABLED(DM_SERIAL)
#include <asm/arch/atmel_serial.h> #include <asm/arch/atmel_serial.h>
#endif #endif
#include <asm/arch/clk.h> #include <asm/arch/clk.h>
@ -28,7 +28,7 @@
DECLARE_GLOBAL_DATA_PTR; 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, static void atmel_serial_setbrg_internal(atmel_usart3_t *usart, int id,
int baudrate) int baudrate)
{ {
@ -133,9 +133,7 @@ __weak struct serial_device *default_serial_console(void)
{ {
return &atmel_serial_drv; return &atmel_serial_drv;
} }
#endif #else
#ifdef CONFIG_DM_SERIAL
enum serial_clk_type { enum serial_clk_type {
CLK_TYPE_NORMAL = 0, CLK_TYPE_NORMAL = 0,
CLK_TYPE_DBGU, CLK_TYPE_DBGU,

View 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) #if CONFIG_IS_ENABLED(SERIAL_PRESENT)
static void serial_stub_putc(struct stdio_dev *sdev, const char ch) 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) static int serial_post_probe(struct udevice *dev)
{ {
struct dm_serial_ops *ops = serial_get_ops(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 serial_dev_priv *upriv = dev_get_uclass_priv(dev);
struct stdio_dev sdev; struct stdio_dev sdev;
#endif #endif
@ -540,7 +540,7 @@ static int serial_post_probe(struct udevice *dev)
return ret; return ret;
} }
#ifdef CONFIG_DM_STDIO #if CONFIG_IS_ENABLED(DM_STDIO)
if (!(gd->flags & GD_FLG_RELOC)) if (!(gd->flags & GD_FLG_RELOC))
return 0; return 0;
memset(&sdev, '\0', sizeof(sdev)); memset(&sdev, '\0', sizeof(sdev));

View 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; return (readl(&priv->regs->lsr) & UART_LSR_THRE) ? 0 : 1;
} }
#if defined(CONFIG_DM_SERIAL) && \ #if CONFIG_IS_ENABLED(DM_SERIAL)
(!defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_DM))
static int mtk_serial_setbrg(struct udevice *dev, int baudrate) static int mtk_serial_setbrg(struct udevice *dev, int baudrate)
{ {
struct mtk_serial_priv *priv = dev_get_priv(dev); struct mtk_serial_priv *priv = dev_get_priv(dev);

View File

@ -27,8 +27,7 @@
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
#ifndef CONFIG_DM_SERIAL #if !CONFIG_IS_ENABLED(DM_SERIAL)
static volatile unsigned char *const port[] = CFG_PL01x_PORTS; static volatile unsigned char *const port[] = CFG_PL01x_PORTS;
static enum pl01x_type pl01x_type __section(".data"); static enum pl01x_type pl01x_type __section(".data");
static struct pl01x_regs *base_regs __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; return 0;
} }
#ifndef CONFIG_DM_SERIAL #if !CONFIG_IS_ENABLED(DM_SERIAL)
static void pl01x_serial_init_baud(int baudrate) static void pl01x_serial_init_baud(int baudrate)
{ {
int clock = 0; int clock = 0;
@ -273,11 +272,7 @@ __weak struct serial_device *default_serial_console(void)
{ {
return &pl01x_serial_drv; return &pl01x_serial_drv;
} }
#else
#endif /* nCONFIG_DM_SERIAL */
#ifdef CONFIG_DM_SERIAL
int pl01x_serial_setbrg(struct udevice *dev, int baudrate) int pl01x_serial_setbrg(struct udevice *dev, int baudrate)
{ {
struct pl01x_serial_plat *plat = dev_get_plat(dev); struct pl01x_serial_plat *plat = dev_get_plat(dev);

View File

@ -38,7 +38,7 @@ struct pl01x_regs {
u32 pl011_cr; /* 0x30 Control register */ 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_of_to_plat(struct udevice *dev);
int pl01x_serial_probe(struct udevice *dev); int pl01x_serial_probe(struct udevice *dev);

View File

@ -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__ */

View File

@ -314,7 +314,7 @@
* shorted - index 1 * shorted - index 1
* Retain non-DM serial port for debug purposes. * 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_CLK (get_bus_freq(0) / 2)
#define CFG_SYS_NS16550_COM1 (CFG_SYS_CCSRBAR + 0x11C500) #define CFG_SYS_NS16550_COM1 (CFG_SYS_CCSRBAR + 0x11C500)
#endif #endif

View File

@ -33,7 +33,7 @@
* NS16550 Configuration * NS16550 Configuration
*/ */
#define CFG_SYS_NS16550_CLK CFG_SYS_TCLK #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 #define CFG_SYS_NS16550_COM1 MV_UART_CONSOLE_BASE
#endif #endif

View File

@ -23,7 +23,7 @@
#else #else
#define CFG_SYS_NS16550_CLK 24000000 #define CFG_SYS_NS16550_CLK 24000000
#endif #endif
#ifndef CONFIG_DM_SERIAL #if !CONFIG_IS_ENABLED(DM_SERIAL)
# define CFG_SYS_NS16550_COM1 SUNXI_UART0_BASE # define CFG_SYS_NS16550_COM1 SUNXI_UART0_BASE
# define CFG_SYS_NS16550_COM2 SUNXI_UART1_BASE # define CFG_SYS_NS16550_COM2 SUNXI_UART1_BASE
# define CFG_SYS_NS16550_COM3 SUNXI_UART2_BASE # define CFG_SYS_NS16550_COM3 SUNXI_UART2_BASE

View File

@ -28,7 +28,7 @@
* Hardware drivers * Hardware drivers
*/ */
#define CFG_SYS_NS16550_CLK 48000000 #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 #define CFG_SYS_NS16550_COM3 UART3_BASE
#endif #endif

View File

@ -14,7 +14,7 @@
* NS16550 Configuration * NS16550 Configuration
*/ */
#define CFG_SYS_NS16550_CLK CFG_SYS_TCLK #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 #define CFG_SYS_NS16550_COM1 MV_UART_CONSOLE_BASE
#endif #endif

View File

@ -26,7 +26,7 @@
#include <linux/types.h> #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 * For driver model we always use one byte per register, and sort out the
* differences in the driver * differences in the driver
@ -37,10 +37,10 @@
#ifdef CONFIG_NS16550_DYNAMIC #ifdef CONFIG_NS16550_DYNAMIC
#define UART_REG(x) unsigned char x #define UART_REG(x) unsigned char x
#else #else
#if !defined(CONFIG_SYS_NS16550_REG_SIZE) || (CONFIG_SYS_NS16550_REG_SIZE == 0) #if defined(CONFIG_SYS_NS16550_MEM32) && !CONFIG_IS_ENABLED(DM_SERIAL)
#error "Please define NS16550 registers size."
#elif defined(CONFIG_SYS_NS16550_MEM32) && !defined(CONFIG_DM_SERIAL)
#define UART_REG(x) u32 x #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) #elif (CONFIG_SYS_NS16550_REG_SIZE > 0)
#define UART_REG(x) \ #define UART_REG(x) \
unsigned char prepad_##x[CONFIG_SYS_NS16550_REG_SIZE - 1]; \ unsigned char prepad_##x[CONFIG_SYS_NS16550_REG_SIZE - 1]; \
@ -113,7 +113,7 @@ struct ns16550 {
UART_REG(scr); /* 10*/ UART_REG(scr); /* 10*/
UART_REG(ssr); /* 11*/ UART_REG(ssr); /* 11*/
#endif #endif
#ifdef CONFIG_DM_SERIAL #if CONFIG_IS_ENABLED(DM_SERIAL)
struct ns16550_plat *plat; struct ns16550_plat *plat;
#endif #endif
}; };

View File

@ -113,7 +113,6 @@ vpl/include/autoconf.mk: vpl/u-boot.cfg
define filechk_config_h define filechk_config_h
(echo "/* Automatically generated - do not edit */"; \ (echo "/* Automatically generated - do not edit */"; \
echo \#define CFG_BOARDDIR board/$(if $(VENDOR),$(VENDOR)/)$(BOARD);\ 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 \<configs/$(CONFIG_SYS_CONFIG_NAME).h\>; \
echo \#include \<asm/config.h\>; \ echo \#include \<asm/config.h\>; \
echo \#include \<linux/kconfig.h\>; \ echo \#include \<linux/kconfig.h\>; \

View File

@ -48,7 +48,6 @@ subdir-ccflags-y :=
# Modified for U-Boot # Modified for U-Boot
-include include/config/auto.conf -include include/config/auto.conf
-include $(prefix)/include/autoconf.mk -include $(prefix)/include/autoconf.mk
include scripts/Makefile.uncmd_spl
include scripts/Kbuild.include include scripts/Kbuild.include

View File

@ -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