Commit 7c304d7e authored by Stephen Warren's avatar Stephen Warren Committed by Greg Kroah-Hartman

memory: fix build when CONFIG_OF && !CONFIG_DDR

Commit e6b42eb6 "memory: emif: add device tree support to emif driver"
added drivers/memory/of_memory.c, which references tables defined in
lib/jedec_ddr_data.c. of_memory.c is compiled when CONFIG_OF, whereas
jedec_ddr_data.c is compiled when CONFIG_DDR. This breaks the build
when CONFIG_OF is defined but not CONFIG_DDR:

drivers/built-in.o: In function `of_get_ddr_timings':
drivers/memory/of_memory.c:138: undefined reference to `lpddr2_jedec_timings'
drivers/built-in.o: In function `of_get_min_tck':
drivers/memory/of_memory.c:62: undefined reference to `lpddr2_jedec_min_tck'
make: *** [vmlinux] Error 1

To solve this, only compile of_memory.c when CONFIG_OF && CONFIG_DDR,
otherwise, stub out the functions.
Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e6b42eb6
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
# Makefile for memory devices # Makefile for memory devices
# #
ifeq ($(CONFIG_DDR),y)
obj-$(CONFIG_OF) += of_memory.o obj-$(CONFIG_OF) += of_memory.o
endif
obj-$(CONFIG_TI_EMIF) += emif.o obj-$(CONFIG_TI_EMIF) += emif.o
obj-$(CONFIG_TEGRA20_MC) += tegra20-mc.o obj-$(CONFIG_TEGRA20_MC) += tegra20-mc.o
obj-$(CONFIG_TEGRA30_MC) += tegra30-mc.o obj-$(CONFIG_TEGRA30_MC) += tegra30-mc.o
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#ifndef __LINUX_MEMORY_OF_REG_H #ifndef __LINUX_MEMORY_OF_REG_H
#define __LINUX_MEMORY_OF_REG_H #define __LINUX_MEMORY_OF_REG_H
#ifdef CONFIG_OF #if defined(CONFIG_OF) && defined(CONFIG_DDR)
extern const struct lpddr2_min_tck *of_get_min_tck(struct device_node *np, extern const struct lpddr2_min_tck *of_get_min_tck(struct device_node *np,
struct device *dev); struct device *dev);
extern const struct lpddr2_timings extern const struct lpddr2_timings
...@@ -31,6 +31,6 @@ static inline const struct lpddr2_timings ...@@ -31,6 +31,6 @@ static inline const struct lpddr2_timings
{ {
return NULL; return NULL;
} }
#endif /* CONFIG_OF */ #endif /* CONFIG_OF && CONFIG_DDR */
#endif /* __LINUX_MEMORY_OF_REG_ */ #endif /* __LINUX_MEMORY_OF_REG_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment