support for rlt-1600g-w and rlt-1600x-w in GPON mode

Change-Id: Ib230d3e336043980eb00427384a49cb8bd386bb2
diff --git a/agent/Makefile.in b/agent/Makefile.in
index c62baf8..2e3ea01 100644
--- a/agent/Makefile.in
+++ b/agent/Makefile.in
@@ -29,15 +29,20 @@
 BAL_MAJOR_VER = 3
 BAL_MINOR_VER = 4
 BAL_REV_A_VER = 9
-BAL_REV_B_VER != if [ "$(OPENOLTDEVICE)" = "rlt-3200g-w" ]; then echo "8"; else echo "6"; fi
+ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
+BAL_REV_B_VER = 8
+DEV_VER = 20210420
+# Version of Open Network Linux (ONL).
+ONL_KERN_VER_MAJOR = 4.19
+else
+BAL_REV_B_VER = 6
+DEV_VER = 202012040101
+ONL_KERN_VER_MAJOR = 4.14
+endif
 BAL_API_REV_B_VER = 6
 BAL_API_VER = $(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_A_VER).$(BAL_API_REV_B_VER)
 BAL_VER = $(BAL_MAJOR_VER).$(BAL_MINOR_VER).$(BAL_REV_A_VER).$(BAL_REV_B_VER)
 SDK_VER = 6.5.13
-DEV_VER != if [ "$(OPENOLTDEVICE)" = "rlt-3200g-w" ]; then echo "20210420"; else echo "202012040101"; fi
-#
-# Version of Open Network Linux (ONL).
-ONL_KERN_VER_MAJOR != if [ "$(OPENOLTDEVICE)" = "rlt-3200g-w" ]; then echo "4.19"; else echo "4.14"; fi
 
 # OpenOLT Proto version.
 # This specifies the GIT tag in https://github.com/opencord/voltha-protos
@@ -52,8 +57,13 @@
 # NNI ports speed setting
 PORT_100G_SPEED ?= 100000
 PORT_25G_SPEED ?= 25000
-PORT_40G_SPEED ?= 40g
-PORT_10G_SPEED ?= 10g
+ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w"))
+PORT_QSFP_SPEED ?= 40g
+PORT_SFP_SPEED ?= 10g
+else ifeq ("$(strip $(OPENOLTDEVICE))","rlt-1600x-w")
+PORT_QSFP_SPEED ?= 100g
+PORT_SFP_SPEED ?= 25g
+endif
 
 # Build directory
 BUILD_DIR = build
@@ -93,7 +103,11 @@
 PCAPPLUSPLUS_INCLUDE_PATH=-I/usr/local/include/pcapplusplus/
 PCAPPLUSPLUS_LIB_PATH=-lPcap++ -lPacket++ -lCommon++
 
-CXX != if [ "$(OPENOLTDEVICE)" = "rlt-3200g-w" ]; then echo "@CXX@-6"; else echo "@CXX@-4.9"; fi
+ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
+CXX = @CXX@-6
+else
+CXX = @CXX@-4.9
+endif
 CXXFLAGS += @CXXFLAGS@
 CXXFLAGS += $(shell pkg-config --cflags-only-I grpc++)
 CXXFLAGS += $(PCAPPLUSPLUS_INCLUDE_PATH)
@@ -128,7 +142,8 @@
 		git clone https://github.com/opencomputeproject/OpenNetworkLinux.git $(ONL_DIR)/OpenNetworkLinux; \
 		cp download/Makefile.onl $(ONL_DIR)/Makefile; \
 		install -m 755 download/build-onl.sh $(ONL_DIR)/OpenNetworkLinux; \
-		if [ "$(OPENOLTDEVICE)" = "rlt-3200g-w" ]; then \
+		if [ "$(OPENOLTDEVICE)" = "rlt-3200g-w" ] || [ "$(OPENOLTDEVICE)" = "rlt-1600g-w" ] || [ "$(OPENOLTDEVICE)" = "rlt-1600x-w" ]; \
+		then \
 			cp $(TOP_DIR)/device/$(OPENOLTDEVICE)/update_kernel_options.sh $(ONL_DIR)/OpenNetworkLinux/.; \
 			chmod 0755 $(ONL_DIR)/OpenNetworkLinux/update_kernel_options.sh; \
 		fi; \
@@ -167,9 +182,11 @@
 ##
 BAL_ZIP = SW-BCM686OLT_$(subst .,_,$(BAL_VER)).tgz
 SDK_ZIP = sdk-all-$(SDK_VER).tar.gz
-PATCH_FILE != if [ "$(OPENOLTDEVICE)" = "rlt-3200g-w" ]; then \
-	echo "PHOENIX_BAL_$(BAL_VER)_V$(DEV_VER).patch"; else \
-	echo "ACCTON_BAL_$(BAL_VER)-V$(DEV_VER).patch"; fi
+ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
+PATCH_FILE = PHOENIX_BAL_$(BAL_VER)_V$(DEV_VER).patch
+else
+PATCH_FILE = ACCTON_BAL_$(BAL_VER)-V$(DEV_VER).patch
+endif
 BAL_DIR = $(BUILD_DIR)/$(OPENOLTDEVICE)-bal
 BCM_SDK = $(BAL_DIR)/switch_sdk/$(SDK_VER)
 BALLIBDIR = $(BAL_DIR)/build/host_reference/host_api
@@ -206,17 +223,22 @@
 	echo "setenv port_speed_for_100 $(PORT_100G_SPEED)" > $(PORT_SPEED_FILE)
 	echo "setenv port_speed_for_25 $(PORT_25G_SPEED)" >> $(PORT_SPEED_FILE)
 endif
-ifeq ("$(strip $(OPENOLTDEVICE))","rlt-3200g-w")
+ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
 	chmod 0755 $(BAL_DIR)/onu_mgmt/libomcistack/me_codegen/omci_stack_codegen
 	make -C $(BAL_DIR) BOARD=phoenix ONL=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux ONL_DEBIAN_SUITE=$(shell lsb_release -c -s) OPEN_SOURCE=y
+	make -C $(BAL_DIR) BOARD=phoenix release_board
 else
 	make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) ONL_DIR=$(TOP_DIR)/$(ONL_DIR)/OpenNetworkLinux OPEN_SOURCE=y
-endif
 	make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board
 endif
+endif
 
 bal-release: sdk
+ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
+	make -C $(BAL_DIR) BOARD=phoenix release_board
+else
 	make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) release_board
+endif
 
 bal-clean:
 	make -C $(BAL_DIR) BOARD=$(OPENOLTDEVICE) clean_all
@@ -279,7 +301,7 @@
 all: $(BUILD_DIR)/openolt
 $(BUILD_DIR)/openolt: sdk protos $(OBJS)
 	$(CXX) $(LDFLAGS) -L$(BALLIBDIR) $(OBJS) $(OPENOLT_API_LIB) $(LIBPROTOBUF_PATH)/libprotobuf.a -o $@ -l$(BALLIBNAME) $(shell pkg-config --libs protobuf grpc++ grpc) $(PCAPPLUSPLUS_LIB_PATH)
-ifeq ("$(strip $(OPENOLTDEVICE))","rlt-3200g-w")
+ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
 	ln -sf $(TOP_DIR)/$(BAL_DIR)/build/fs/phoenix/release/release_phoenix_v$(BAL_VER).tar.gz $(BUILD_DIR)/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz
 else
 	ln -sf $(TOP_DIR)/$(BAL_DIR)/build/fs/$(OPENOLTDEVICE)/release/release_$(OPENOLTDEVICE)_V$(BAL_VER).$(DEV_VER).tar.gz $(BUILD_DIR)/.
@@ -307,8 +329,8 @@
 	cp $(BUILD_DIR)/libbal_host_api.so device/$(OPENOLTDEVICE)/mkdebian/debian
 	cp -a scripts/init.d device/$(OPENOLTDEVICE)/mkdebian/debian
 	cp -a $(RXTX_POWER_EXE) device/$(OPENOLTDEVICE)/mkdebian/debian
-ifeq ("$(strip $(OPENOLTDEVICE))","rlt-3200g-w")
-	sed -i '/\/opt\/bcm68650\/svk_init.sh/c\    \/opt\/bcm68650\/svk_init.sh -qsfp_speed=$(PORT_40G_SPEED) -sfp_speed=$(PORT_10G_SPEED)' device/$(OPENOLTDEVICE)/mkdebian/debian/init.d/dev_mgmt_daemon
+ifeq ("$(strip $(OPENOLTDEVICE))",$(findstring "$(strip $(OPENOLTDEVICE))", "rlt-3200g-w" "rlt-1600g-w" "rlt-1600x-w"))
+	sed -i '/\/opt\/bcm68650\/svk_init.sh/c\    \/opt\/bcm68650\/svk_init.sh -qsfp_speed=$(PORT_QSFP_SPEED) -sfp_speed=$(PORT_SFP_SPEED)' device/$(OPENOLTDEVICE)/mkdebian/debian/init.d/dev_mgmt_daemon
 endif
 	cp -a scripts/watchdog device/$(OPENOLTDEVICE)/mkdebian/debian
 	cd device/$(OPENOLTDEVICE)/mkdebian && ./build_$(OPENOLTDEVICE)_deb.sh