[From nobody Thu Jun 25 05:54:45 2020
Received: from merlin.infradead.org ([205.233.59.134])
 by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux))
 id 1feSTf-0003VM-LF
 for openwrt-devel@bombadil.infradead.org; Sat, 14 Jul 2018 21:53:19 +0000
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type:
 MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=PaWmWkEkW8nhPLOWv/ioHQHgUQINdaQ+NER/sZ2CY84=; b=xupzuRB0O4duckPRj89jP5HAg9
 8QVU6JH3rAEGfgHE+X4EHEmTZvczkwETsKHAW1oHdmIozYeypzzMGNI0Dyiv+qZXsksHWEHew5nrN
 r3RNxM1cBu5cf3xVLlMSLg+ZePRnyCGnZHPCJHtMg/W+oE7IiURvurqQRCFzoOx3dwcovhRntdK43
 dM5QGZ6JyQ204cLgTWpUVEzVtpTHC4r0NmEXW/9gD1QmRfruQH3681+eCeQu1TLGmFQXk/4LqgdXd
 OYl2JpzFJudcHuLVEqBfeEzXTP33R6tTsZIzlcR1sn05/g/NI0lyiIxpEFCLaAUuWtgWeRd6FA/gO
 I4rYKbyA==;
Received: from [2a02:c7f:1e5d:1600::2] (helo=stikonas.eu)
 by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux))
 id 1feOli-0000kj-8E
 for openwrt-devel@lists.openwrt.org; Sat, 14 Jul 2018 17:55:43 +0000
Received: from localhost.localdomain (unknown
 [IPv6:2a02:c7f:1e5d:1600:218b:b1f4:adfc:a5f5])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by stikonas.eu (Postfix) with ESMTPSA id B48BF6BC6AE0;
 Sat, 14 Jul 2018 17:44:32 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.10.3 stikonas.eu B48BF6BC6AE0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stikonas.eu; s=mail;
 t=1531590272; bh=PaWmWkEkW8nhPLOWv/ioHQHgUQINdaQ+NER/sZ2CY84=;
 h=From:To:Cc:Subject:Date;
 b=IVMDrnV2xGuzGuMOqRdedq4lcSJlwkTp4Za8Cuze16S6J6nRzeeHmu6n6Qx3UrNiX
 VHURW3lw28kFkN5ejShTLF42nvW7fpNIiYlsZvArBkWsVvhKIobjBOru5K6/NQUtX5
 2c3EKe4WpRKQg4KelL0HcFWQzjmkJdObldgr451U=
From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= &lt;andrius@stikonas.eu&gt;
To: openwrt-devel@lists.openwrt.org
Cc: =?UTF-8?q?Andrius=20=C5=A0tikonas?= &lt;andrius@stikonas.eu&gt;
Subject: [PATCH] brcm63xx: initial support for Sky SR102 router
Date: Sat, 14 Jul 2018 18:44:04 +0100
Message-Id: &lt;20180714174404.12322-1-andrius@stikonas.eu&gt;
X-Mailer: git-send-email 2.16.4
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 
X-CRM114-CacheID: sfid-20180714_135542_503612_EB62B763 
X-CRM114-Status: GOOD (  17.93  )
X-Spam-Score: 1.2 (+)
X-Spam-Report: SpamAssassin version 3.4.1 on merlin.infradead.org summary:
 Content analysis details:   (1.2 points)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature,
 not necessarily valid
 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's
 domain
 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS

SOC: 	    BCM63168 (BMIPS4350 V8.0 @400MHz)
Flash size: 16 MiB
RAM size:   128 MiB

Heavily based on patch for OpenWRT Chaos Chalmer.
Original patch and more info can be found at:
https://openwrt.org/toh/sky/sr102

Known issues:
 - Wireless and ADSL modem are not working.

Signed-off-by: Andrius Štikonas &lt;andrius@stikonas.eu&gt;
---
 .../brcm63xx/base-files/etc/board.d/02_network     |   6 ++
 target/linux/brcm63xx/base-files/etc/diag.sh       |   4 +
 target/linux/brcm63xx/base-files/lib/brcm63xx.sh   |   3 +
 target/linux/brcm63xx/dts/sr102.dts                | 120 +++++++++++++++++++++
 target/linux/brcm63xx/image/bcm63xx.mk             |  12 +++
 .../brcm63xx/patches-4.9/598-board_sr102.patch     |  75 +++++++++++++
 target/linux/brcm63xx/profiles/sky.mk              |  16 +++
 7 files changed, 236 insertions(+)
 create mode 100644 target/linux/brcm63xx/dts/sr102.dts
 create mode 100644 target/linux/brcm63xx/patches-4.9/598-board_sr102.patch
 create mode 100644 target/linux/brcm63xx/profiles/sky.mk

diff --git a/target/linux/brcm63xx/base-files/etc/board.d/02_network b/target/linux/brcm63xx/base-files/etc/board.d/02_network
index a7fd6f5d38..a2ca5a37b3 100755
--- a/target/linux/brcm63xx/base-files/etc/board.d/02_network
+++ b/target/linux/brcm63xx/base-files/etc/board.d/02_network
@@ -130,6 +130,12 @@ neufbox6)
 		&quot;1:lan&quot; &quot;2:lan&quot; &quot;3:lan&quot; &quot;4:lan&quot; &quot;0:wan&quot; &quot;9t@eth0&quot;
 	;;
 
+sr102)
+	ucidef_set_interfaces_lan_wan &quot;eth0.1&quot; &quot;eth0.2&quot;
+	ucidef_add_switch &quot;switch0&quot; \
+		&quot;0:lan&quot; &quot;1:lan&quot; &quot;2:lan&quot; &quot;3:wan&quot; &quot;8t@eth0&quot;
+	;;
+
 vg50)
 	ucidef_add_switch &quot;switch0&quot; \
 		&quot;0:lan&quot; &quot;1:lan&quot; &quot;2:lan&quot; &quot;3:lan&quot; &quot;4:wan&quot; &quot;8t@eth0&quot;
diff --git a/target/linux/brcm63xx/base-files/etc/diag.sh b/target/linux/brcm63xx/base-files/etc/diag.sh
index acb1795214..afb347818f 100644
--- a/target/linux/brcm63xx/base-files/etc/diag.sh
+++ b/target/linux/brcm63xx/base-files/etc/diag.sh
@@ -132,6 +132,10 @@ set_state() {
 	rta770w)
 		status_led=&quot;RTA770W:green:diag&quot;
 		;;
+	sr102)
+		status_led=&quot;SR102:white:power&quot;
+		status_led2=&quot;SR102:red:power&quot;
+		;;
 	spw500v)
 		status_led=&quot;SPW500V:green:power&quot;
 		;;
diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
index 82abd737ce..1676ae0abb 100755
--- a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
+++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
@@ -237,6 +237,9 @@ brcm63xx_dt_detect() {
 	&quot;SFR neufbox 6 (Sercomm)&quot;)
 		board_name=&quot;neufbox6&quot;
 		;;
+	&quot;SKY SR102&quot;)
+		board_name=&quot;sr102&quot;
+		;;
 	&quot;T-Com Speedport W303 V&quot;)
 		board_name=&quot;spw303v&quot;
 		;;
diff --git a/target/linux/brcm63xx/dts/sr102.dts b/target/linux/brcm63xx/dts/sr102.dts
new file mode 100644
index 0000000000..4d8cbd3435
--- /dev/null
+++ b/target/linux/brcm63xx/dts/sr102.dts
@@ -0,0 +1,120 @@
+/dts-v1/;
+
+#include &quot;bcm63268.dtsi&quot;
+
+#include &lt;dt-bindings/input/input.h&gt;
+
+/ {
+	model = &quot;SKY SR102&quot;;
+	compatible = &quot;sky,sr102&quot;, &quot;brcm,bcm63268&quot;;
+
+	chosen {
+		bootargs = &quot;rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200&quot;;
+		stdout-path = &quot;serial0:115200n8&quot;;
+	};
+
+	gpio-keys-polled {
+		compatible = &quot;gpio-keys-polled&quot;;
+		#address-cells = &lt;1&gt;;
+		#size-cells = &lt;0&gt;;
+		poll-interval = &lt;20&gt;;
+		debounce-interval = &lt;60&gt;;
+
+		wps {
+			label = &quot;wps&quot;;
+			gpios = &lt;&amp;pinctrl 33 0&gt;;
+			linux,code = &lt;KEY_WPS_BUTTON&gt;;
+		};
+	};
+
+	gpio-leds {
+		compatible = &quot;gpio-leds&quot;;
+
+		lan1_green {
+			label = &quot;SR102:green:lan1&quot;;
+			gpios = &lt;&amp;pinctrl 1 1&gt;;
+		};
+		power_red {
+			label = &quot;SR102:red:power&quot;;
+			gpios = &lt;&amp;pinctrl 2 1&gt;;
+		};
+		wifi_red {
+			label = &quot;SR102:red:wifi&quot;;
+			gpios = &lt;&amp;pinctrl 3 1&gt;;
+		};
+		inet_red {
+			label = &quot;SR102:red:inet&quot;;
+			gpios = &lt;&amp;pinctrl 4 1&gt;;
+		};
+		inet_white {
+			label = &quot;SR102:white:inet&quot;;
+			gpios = &lt;&amp;pinctrl 5 0&gt;;
+		};
+		power_white {
+			label = &quot;SR102:white:power&quot;;
+			gpios = &lt;&amp;pinctrl 6 0&gt;;
+			default-state = &quot;on&quot;;
+		};
+		wifi_white {
+			label = &quot;SR102:white:wifi&quot;;
+			gpios = &lt;&amp;pinctrl 8 0&gt;;
+		};
+		lan2_red {
+			label = &quot;SR102:red:lan2&quot;;
+			gpios = &lt;&amp;pinctrl 9 1&gt;;
+		};
+		lan3_red {
+			label = &quot;SR102:red:lan3&quot;;
+			gpios = &lt;&amp;pinctrl 10 1&gt;;
+		};
+		lan4_red {
+			label = &quot;SR102:red:lan4&quot;;
+			gpios = &lt;&amp;pinctrl 11 1&gt;;
+		};
+		lan1_red {
+			label = &quot;SR102:red:lan1&quot;;
+			gpios = &lt;&amp;pinctrl 12 1&gt;;
+		};
+		lan2_green {
+			label = &quot;SR102:green:lan2&quot;;
+			gpios = &lt;&amp;pinctrl 13 0&gt;;
+		};
+		lan3_green {
+			label = &quot;SR102:green:lan3&quot;;
+			gpios = &lt;&amp;pinctrl 14 1&gt;;
+		};
+		lan4_green {
+			label = &quot;SR102:green:lan4&quot;;
+			gpios = &lt;&amp;pinctrl 15 1&gt;;
+		};
+		hd_white {
+			label = &quot;SR102:white:hd&quot;;
+			gpios = &lt;&amp;pinctrl 18 0&gt;;
+		};
+	};
+};
+
+&amp;hsspi {
+	status = &quot;ok&quot;;
+
+	flash@0 {
+		compatible = &quot;jedec,spi-nor&quot;;
+		spi-max-frequency = &lt;16666667&gt;;
+		spi-tx-bus-width = &lt;2&gt;;
+		spi-rx-bus-width = &lt;2&gt;;
+		reg = &lt;0&gt;;
+
+		#address-cells = &lt;1&gt;;
+		#size-cells = &lt;1&gt;;
+
+		linux,part-probe = &quot;bcm63xxpart&quot;;
+
+		partitions {
+			compatible = &quot;brcm,bcm963xx-cfe-nor-partitions&quot;;
+		};
+	};
+};
+
+&amp;uart0 {
+	status = &quot;ok&quot;;
+};
diff --git a/target/linux/brcm63xx/image/bcm63xx.mk b/target/linux/brcm63xx/image/bcm63xx.mk
index b9ecd54064..6a2a9bfb4a 100644
--- a/target/linux/brcm63xx/image/bcm63xx.mk
+++ b/target/linux/brcm63xx/image/bcm63xx.mk
@@ -1020,6 +1020,18 @@ define Device/NEUFBOX6
 endef
 TARGET_DEVICES += NEUFBOX6
 
+define Device/SR102
+  $(Device/bcm63xx)
+  DEVICE_TITLE := SKY-SR102
+  DEVICE_DTS := sr102
+  CFE_BOARD_ID := BSKYB_63168
+  CFE_CHIP_ID := 63268
+  CFE_EXTRAS += --rsa-signature &quot;$(VERSION_DIST)-$(firstword $(subst -,$(space),$(REVISION)))&quot;
+  DEVICE_PACKAGES := \
+    $(B43_PACKAGES) $(USB2_PACKAGES)
+endef
+TARGET_DEVICES += SR102
+
 ### T-Com ###
 define Device/SPW303V
   $(Device/bcm63xx)
diff --git a/target/linux/brcm63xx/patches-4.9/598-board_sr102.patch b/target/linux/brcm63xx/patches-4.9/598-board_sr102.patch
new file mode 100644
index 0000000000..1a9578ead1
--- /dev/null
+++ b/target/linux/brcm63xx/patches-4.9/598-board_sr102.patch
@@ -0,0 +1,75 @@
+--- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
++++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
+@@ -2457,6 +2457,56 @@
+ 		},
+ 	},
+ };
++
++static struct board_info __initdata board_BSKYB_63168 = {
++	.name				= &quot;BSKYB_63168&quot;,
++	.expected_cpu_id		= 0x63268,
++
++	.has_pci			= 1,
++	.use_fallback_sprom		= 0,
++
++	.has_ehci0			= 1,
++	.has_ohci0			= 1,
++	.num_usbh_ports			= 2,
++
++	.has_enetsw			= 1,
++
++	.enetsw = {
++		.used_ports = {
++			[0] = {
++				.used	= 1,
++				.phy_id	= 1,
++				.name	= &quot;Port 1&quot;,
++			},
++
++			[1] = {
++				.used	= 1,
++				.phy_id	= 2,
++				.name	= &quot;Port 2&quot;,
++			},
++
++			[2] = {
++				.used	= 1,
++				.phy_id	= 3,
++				.name	= &quot;Port 3&quot;,
++			},
++
++			[3] = {
++				.used	= 1,
++				.phy_id	= 4,
++				.name	= &quot;Port 4&quot;,
++			},
++
++		},
++	},
++/*
++	.fallback_sprom = {
++		.type				= SPROM_BCM435F,
++		.pci_bus			= 0,
++		.pci_dev			= 0,
++	},
++*/
++};
+ #endif /* CONFIG_BCM63XX_CPU_63268 */
+ 
+ /*
+@@ -2557,6 +2609,7 @@
+ 	&amp;board_963268bu_p300,
+ 	&amp;board_963269bhr,
+ 	&amp;board_vw6339gu,
++	&amp;board_BSKYB_63168,
+ #endif
+ };
+ 
+@@ -2661,6 +2714,7 @@
+ 	{ .compatible = &quot;brcm,bcm963268bu_p300&quot;, .data = &amp;board_963268bu_p300, },
+ 	{ .compatible = &quot;brcm,bcm963269bhr&quot;, .data = &amp;board_963269bhr, },
+ 	{ .compatible = &quot;inteno,vg50&quot;, .data = &amp;board_vw6339gu, },
++	{ .compatible = &quot;sky,sr102&quot;, .data = &amp;board_BSKYB_63168, },
+ #endif
+ #endif /* CONFIG_OF */
+ 	{ },
diff --git a/target/linux/brcm63xx/profiles/sky.mk b/target/linux/brcm63xx/profiles/sky.mk
new file mode 100644
index 0000000000..f209794800
--- /dev/null
+++ b/target/linux/brcm63xx/profiles/sky.mk
@@ -0,0 +1,16 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/SR102
+  NAME:=SKY SR102
+  PACKAGES:=kmod-b43 wpad-mini \
+	kmod-usb2 kmod-usb-ohci
+endef
+define Profile/SR102/Description
+  Package set optimized for SKY SR102.
+endef
+$(eval $(call Profile,SR102))
-- 
2.16.4


]