ddr4: Added DDR4 sublib compilation
old DDR4 lib = new DDR4 lib + new DDR4 sublib.
'-m 4' will build U-Boot with existing training libs
'-m 4 -d 2' will rebuild DDR3 source and use existing DDR4 sublib
'-m 4 -d 4' will rebuild both DDR3 and DDR4 source.
Lib separation will allow to user rebuild open part(common with DDR3) of DDR4 training flow.
new lib will be named ddr4_training_<SoC>sub.lib and placed in same place
as existing ddr4_training_<SoC>.lib. Existing DDR4 lib will consist only ddr3libv2 code
Change-Id: I8b4887713d655ed3e49b980ebc19fb767cf81c3c
Signed-off-by: Igor Petrik <igorp@marvell.com>
Reviewed-on: http://vgitil04.il.marvell.com:8080/19106
Reviewed-by: Omri Itach <omrii@marvell.com>
Tested-by: Omri Itach <omrii@marvell.com>
Reviewed-on: http://vgitil04.il.marvell.com:8080/24123
Tested-by: Star_Automation <star@marvell.com>
diff --git a/build.pl b/build.pl
index 11de266..01f97bd 100755
--- a/build.pl
+++ b/build.pl
@@ -20,7 +20,8 @@
print "\t\t\t\t\tac3_db, ac3_rd, ac3_customer0, ac3_customer1\n";
print "\t-o\tOutput dir/file. The image will be copied into this dir/file\n";
print "\t-e\tBig Endian. If not specified Little endian is used\n";
- print "\t-m\tDDR type(default: DDR3). Accepts: 3 for DDR3, 4 for DDR4\n";
+ print "\t-m\tDDR type(default: DDR4 for A39x, DDR3 for the rest). Accepts: 3 for DDR3, 4 for DDR4\n";
++ print "\t-d\tRebuild training lib, use '-d 2' to rebuild ddr3libv2 source\n";
print "\t-i\tSupported interfaces, seperated by \":\" - Accepts [spi:nor:nand]\n";
print "\t-v\tSW version (in file name: u-boot-alp-X.X.X-spi.bin, else using date by default)\n";
print "\t\tinterfaces. Supports spi, nor, nand. the boot \n";
@@ -349,6 +350,13 @@
print "\n";
}
+if($opt_d eq 4)
+{
+ system("echo \"DDR4SUBLIB = yes\" >> include/config.mk");
+ print "** Rebuild DDR4 sublib **\n";
+ $opt_d = 2;
+}
+
#by default -d 2 will be enabled for new TIP SoCs
if( ($ddr3LibBuild eq "yes") and !($opt_m eq 4))
{
diff --git a/tools/marvell/bin_hdr/Makefile b/tools/marvell/bin_hdr/Makefile
index 2643fe2..7c3cfac 100755
--- a/tools/marvell/bin_hdr/Makefile
+++ b/tools/marvell/bin_hdr/Makefile
@@ -108,12 +108,19 @@
DDRTYPE = ddr3
endif
+ifeq ($(DDRTYPE),ddr4)
+ TLIBS = $(TLIB) $(TDDR4SUBLIB)
+else
+ TLIBS = $(TLIB)
+endif
+
TLIB = ./src_ddr/lib/$(DDRTYPE)_training_$(LIBNAME).lib
+TDDR4SUBLIB = ./src_ddr/lib/$(DDRTYPE)_training_$(LIBNAME)sub.lib
COMPONENT_SUBDIRS = platform src_phy src_ddr src_pm src_init
-HDR_COMPONENTS = $(LIB_PLAT) $(LIB_GENERAL_INIT) $(LIB_PHY) $(LIB_DDR) $(TLIB) $(LIB_SWUP)
-HDR_COMPONENTS_UART = $(LIB_PLAT_UART) $(LIB_GENERAL_INIT_UART) $(LIB_PHY_UART) $(LIB_DDR_UART) $(TLIB) $(LIB_SWUP_UART)
-HDR_COMPONENTS_DEBUG = $(LIB_PLAT_DEBUG) $(LIB_GENERAL_INIT) $(LIB_PHY) $(LIB_DDR) $(TLIB) $(LIB_SWUP)
+HDR_COMPONENTS = $(LIB_PLAT) $(LIB_GENERAL_INIT) $(LIB_PHY) $(LIB_DDR) $(TLIBS) $(LIB_SWUP)
+HDR_COMPONENTS_UART = $(LIB_PLAT_UART) $(LIB_GENERAL_INIT_UART) $(LIB_PHY_UART) $(LIB_DDR_UART) $(TLIBS) $(LIB_SWUP_UART)
+HDR_COMPONENTS_DEBUG = $(LIB_PLAT_DEBUG) $(LIB_GENERAL_INIT) $(LIB_PHY) $(LIB_DDR) $(TLIBS) $(LIB_SWUP)
#how to add new component to binary header:
#EXAMPLE_COMPONENT=no
diff --git a/tools/marvell/bin_hdr/src_ddr/ddr3libv2/Makefile b/tools/marvell/bin_hdr/src_ddr/ddr3libv2/Makefile
index 0dc7916..da5af0a 100644
--- a/tools/marvell/bin_hdr/src_ddr/ddr3libv2/Makefile
+++ b/tools/marvell/bin_hdr/src_ddr/ddr3libv2/Makefile
@@ -72,7 +72,7 @@
-I$(TIP_INC)/Driver -I$(TIP_INC)/Driver/ddr3 -I$(BH_ROOT_DIR)/inc/common -I$(BH_ROOT_DIR)/inc/ddr3_soc/$(BOARD) -I$(BH_ROOT_DIR)/inc/ddr3_soc/$(INCNAME) -I$(BH_ROOT_DIR)/src_ddr
ifeq ($(DDRTYPE),ddr4)
-INCLUDE += -I$(BH_ROOT_DIR)/src_ddr/ddr3libv2/src/Driver/ddr4/h
+ INCLUDE += -I$(BH_ROOT_DIR)/src_ddr/ddr3libv2/src/Driver/ddr4/h
endif
TGT = ddr_$(LIBNAME).a
@@ -80,16 +80,25 @@
TLIB = ./$(DDRTYPE)_training_$(LIBNAME).lib
+TDDR4SUBLIB = ./$(DDRTYPE)_training_$(LIBNAME)sub.lib
+
TSRC = $(wildcard ./src/Driver/ddr3/*.c)
TSRC += ./src/Silicon/mvHwsDdr3$(SILNAME).c
TSRC += ./src/Soc/ddr3_$(BOARDNAME)_training.c
TSRC += ./src/Soc/ddr3_hws_hw_training.c
TSRC += ./src/Os/gtOs/mvXor.c
-ifeq ($(DDRTYPE),ddr4)
-TSRC += $(wildcard ./src/Driver/ddr4/src/*.c)
-endif
+
+TSRCDDR4 = $(wildcard ./src/Driver/ddr4/src/*.c)
TOBJ = $(TSRC:.c=.o)
+TOBJDDR4 = $(TSRCDDR4:.c=.o)
+
+ifeq ($(DDR4SUBLIB),yes)
+ TARGETS = $(TLIB) $(TDDR4SUBLIB)
+else
+ TARGETS = $(TLIB)
+endif
+
#############global flags enable/disable features to save footprint###########
# exclude debug function not relevent for SoC( set by default)
@@ -113,7 +122,7 @@
#############end of global flags #############################################
-all: $(TLIB)
+all: $(TARGETS)
%.o: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
@@ -121,6 +130,10 @@
%.uart.o: %.c
$(CC) $(CFLAGS) -DNOT_USE_UART -DMV_NO_INPUT -DMV_NO_PRINT $(CPPFLAGS) -c -o $@ $<
+$(TDDR4SUBLIB): $(TOBJDDR4)
+ ar rcs $(TDDR4SUBLIB) $(TOBJDDR4)
+ $(CP) ./$@ ../lib
+
$(TLIB): $(TOBJ)
ar rcs $(TLIB) $(TOBJ)
$(CP) ./$@ ../lib
diff --git a/tools/marvell/bin_hdr/src_ddr/ddr3libv2/src/Driver/ddr3/mvHwsDdr3Training.c b/tools/marvell/bin_hdr/src_ddr/ddr3libv2/src/Driver/ddr3/mvHwsDdr3Training.c
index 0241646..237ba01 100755
--- a/tools/marvell/bin_hdr/src_ddr/ddr3libv2/src/Driver/ddr3/mvHwsDdr3Training.c
+++ b/tools/marvell/bin_hdr/src_ddr/ddr3libv2/src/Driver/ddr3/mvHwsDdr3Training.c
@@ -332,10 +332,19 @@
return DDR3_TIP_VERSION_STRING;
}
+#ifdef CONFIG_DDR4
+const GT_CHAR* mvHwsDdr4SubLibVersionGet(void)
+{
+ return DDR4_TIP_SUBVERSION_STRING;
+}
+#endif
+
void ddr3PrintVersion()
{
mvPrintf(mvHwsDdr3TipVersionGet());
- mvPrintf("\n");
+#ifdef CONFIG_DDR4
+ mvPrintf(mvHwsDdr4SubLibVersionGet());
+#endif
}
/*****************************************************************************
diff --git a/tools/marvell/bin_hdr/src_ddr/lib/ddr4_training_a38x.lib b/tools/marvell/bin_hdr/src_ddr/lib/ddr4_training_a38x.lib
index eae2829..170b95b 100644
--- a/tools/marvell/bin_hdr/src_ddr/lib/ddr4_training_a38x.lib
+++ b/tools/marvell/bin_hdr/src_ddr/lib/ddr4_training_a38x.lib
Binary files differ
diff --git a/tools/marvell/bin_hdr/src_ddr/lib/ddr4_training_a38xsub.lib b/tools/marvell/bin_hdr/src_ddr/lib/ddr4_training_a38xsub.lib
new file mode 100644
index 0000000..e02c087
--- /dev/null
+++ b/tools/marvell/bin_hdr/src_ddr/lib/ddr4_training_a38xsub.lib
Binary files differ
diff --git a/tools/marvell/bin_hdr/src_ddr/lib/ddr4_training_a39x.lib b/tools/marvell/bin_hdr/src_ddr/lib/ddr4_training_a39x.lib
index 30f6846..d701989 100644
--- a/tools/marvell/bin_hdr/src_ddr/lib/ddr4_training_a39x.lib
+++ b/tools/marvell/bin_hdr/src_ddr/lib/ddr4_training_a39x.lib
Binary files differ
diff --git a/tools/marvell/bin_hdr/src_ddr/lib/ddr4_training_a39xsub.lib b/tools/marvell/bin_hdr/src_ddr/lib/ddr4_training_a39xsub.lib
new file mode 100644
index 0000000..db2fef2
--- /dev/null
+++ b/tools/marvell/bin_hdr/src_ddr/lib/ddr4_training_a39xsub.lib
Binary files differ