#!/bin/sh
# Copyright (c) 2015, 2020 The Linux Foundation. All rights reserved.
# Copyright (C) 2011 OpenWrt.org
# Copyright (c) 2022, Qualcomm Innovation Center, Inc. All rights reserved.
#


[ -e /etc/config/network ] && exit 0

touch /etc/config/network

CFG=/etc/board.json

. /lib/functions/uci-defaults.sh

ipq53xx_setup_interfaces()
{
	local board="$1"

	case "$board" in
	qcom,ipq5332-ap-emulation |\
	qcom,ipq5332-db-mi01.1 |\
	qcom,ipq5332-db-mi02.1 |\
	qcom,ipq5332-db-mi03.1)
		ucidef_set_interfaces_lan_wan "eth1" "eth0"
			;;
	qcom,ipq5332-ap-mi01.2 |\
	qcom,ipq5332-ap-mi01.2-c2 |\
	qcom,ipq5332-ap-mi01.2-qcn9160-c1 |\
	qcom,ipq5332-ap-mi01.3 |\
	qcom,ipq5332-ap-mi01.4 |\
	qcom,ipq5332-ap-mi01.6 |\
	qcom,ipq5332-ap-mi01.7 |\
	qcom,ipq5332-ap-mi01.9 |\
	qcom,ipq5332-ap-mi03.1 |\
	qcom,ipq5332-ap-mi04.1)
		ucidef_set_interfaces_lan_wan "eth1" "eth0"
		ucidef_add_switch "switch1"
		ucidef_add_switch_attr "switch1" "enable" false
			;;
		*)
		echo "Unsupported hardware. Network interfaces not intialized"
		;;
	esac
}

board_config_update
board=$(board_name)
ipq53xx_setup_interfaces $board
board_config_flush

exit 0
