spl: fix build failure with !CONFIG_SPL_PCI_SUPPORT
authorSekhar Nori <nsekhar@ti.com>
Thu, 6 Dec 2018 10:10:08 +0000 (15:40 +0530)
committerTom Rini <trini@konsulko.com>
Wed, 12 Dec 2018 17:14:23 +0000 (12:14 -0500)
Building U-Boot with CONFIG_PCI and CONFIG_DM_PCI enabled, but
CONFIG_SPL_PCI_SUPPORT disabled, results in following linker
error:

lib/built-in.o: In function `fdtdec_get_pci_bar32':
lib/fdtdec.c:305: undefined reference to `dm_pci_read_bar32'
fdtdec.c:305:(.text.fdtdec_get_pci_bar32+0x24): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `dm_pci_read_bar32'

This is because reference to dm_pci_read_bar32() remains in lib/fdtdec.c
while SPL build does not descend into drivers/pci directory in
drivers/Makefile if CONFIG_SPL_PCI_SUPPORT is not enabled.

Fix this by applying appropriate #define guards in lib/fdtdec.c.
It looks like ns16550.c has the same problem, so fixed that too.

To simplify this, CONFIG_SPL_PCI_SUPPORT is renamed to CONFIG_SPL_PCI
(enables use of CONFIG_IS_ENABLED() macro).

Suggested-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Makefile
common/spl/Kconfig
configs/chromebook_link64_defconfig
configs/qemu-x86_64_defconfig
drivers/Makefile
drivers/serial/ns16550.c
lib/fdtdec.c

index 05896598fe3a12cf46aaca8ff1ddf24f9ed6dc6f..5683714947f24547461c4bb761942946ef894c34 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -695,7 +695,6 @@ libs-$(CONFIG_CMD_UBI) += drivers/mtd/ubi/
 libs-y += drivers/mtd/spi/
 libs-y += drivers/net/
 libs-y += drivers/net/phy/
-libs-y += drivers/pci/
 libs-y += drivers/power/ \
        drivers/power/domain/ \
        drivers/power/fuel_gauge/ \
index cab7220c9ace9991d9db9bb0ee79069f14c96488..953841ebe76131bd14a01e0157241ba3e6e7439b 100644 (file)
@@ -612,7 +612,7 @@ config SPL_PAYLOAD
          TPL, tpl/u-boot-with-tpl.bin. For new boards, suggest to
          use u-boot.img.
 
-config SPL_PCI_SUPPORT
+config SPL_PCI
        bool "Support PCI drivers"
        help
          Enable support for PCI in SPL. For platforms that need PCI to boot,
@@ -1026,7 +1026,7 @@ config TPL_NAND_SUPPORT
        help
          Enable support for NAND in TPL. See SPL_NAND_SUPPORT for details.
 
-config TPL_PCI_SUPPORT
+config TPL_PCI
        bool "Support PCI drivers"
        help
          Enable support for PCI in TPL. For platforms that need PCI to boot,
index 13b90a13f6cc5e488a8c18bcf349f906d3105739..074d333dd4e5407b0efff0a950d4696c1811b7e1 100644 (file)
@@ -33,7 +33,7 @@ CONFIG_SPL_CPU_SUPPORT=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_I2C_SUPPORT=y
 CONFIG_SPL_NET_SUPPORT=y
-CONFIG_SPL_PCI_SUPPORT=y
+CONFIG_SPL_PCI=y
 CONFIG_SPL_PCH_SUPPORT=y
 CONFIG_SPL_RTC_SUPPORT=y
 CONFIG_HUSH_PARSER=y
index 32922b84ffa1bab13a9b8db55905763dcb55f8c0..8d43acd4802e1d8dee37a7c5b9e706cd61533921 100644 (file)
@@ -31,7 +31,7 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_CPU_SUPPORT=y
 CONFIG_SPL_ENV_SUPPORT=y
 CONFIG_SPL_NET_SUPPORT=y
-CONFIG_SPL_PCI_SUPPORT=y
+CONFIG_SPL_PCI=y
 CONFIG_SPL_PCH_SUPPORT=y
 CONFIG_SPL_RTC_SUPPORT=y
 CONFIG_HUSH_PARSER=y
index 0538b50d01ca6d50ffbb3a3e5a156d38ba6d0582..752caeae4ef4bac03f54fdce617d1c9dd2485bcc 100644 (file)
@@ -10,7 +10,7 @@ obj-$(CONFIG_$(SPL_TPL_)LED) += led/
 obj-$(CONFIG_$(SPL_TPL_)MMC_SUPPORT) += mmc/
 obj-$(CONFIG_$(SPL_TPL_)NAND_SUPPORT) += mtd/nand/raw/
 obj-$(CONFIG_$(SPL_TPL_)PCH_SUPPORT) += pch/
-obj-$(CONFIG_$(SPL_TPL_)PCI_SUPPORT) += pci/
+obj-$(CONFIG_$(SPL_TPL_)PCI) += pci/
 obj-$(CONFIG_$(SPL_TPL_)PHY) += phy/
 obj-$(CONFIG_$(SPL_TPL_)PINCTRL) += pinctrl/
 obj-$(CONFIG_$(SPL_TPL_)RAM) += ram/
index f3bd8dbcdf50895594ea3110e39c38b3a3d401d1..560ca2ae349b4314911d6636f2d2c3dd9d358c0b 100644 (file)
@@ -425,7 +425,7 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
 
        /* try Processor Local Bus device first */
        addr = dev_read_addr(dev);
-#if defined(CONFIG_PCI) && defined(CONFIG_DM_PCI)
+#if CONFIG_IS_ENABLED(PCI) && defined(CONFIG_DM_PCI)
        if (addr == FDT_ADDR_T_NONE) {
                /* then try pci device */
                struct fdt_pci_addr pci_addr;
index 7bbc6d445e440397e23f6b2ef7269d3db091ae5a..6f8ec0dbed7dae2857b8320b9ec0f1af47b01e01 100644 (file)
@@ -200,7 +200,7 @@ fdt_addr_t fdtdec_get_addr(const void *blob, int node, const char *prop_name)
        return fdtdec_get_addr_size(blob, node, prop_name, NULL);
 }
 
-#if defined(CONFIG_PCI) && defined(CONFIG_DM_PCI)
+#if CONFIG_IS_ENABLED(PCI) && defined(CONFIG_DM_PCI)
 int fdtdec_get_pci_addr(const void *blob, int node, enum fdt_pci_space type,
                        const char *prop_name, struct fdt_pci_addr *addr)
 {