aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorTobias Diedrich <ranma+openwrt@tdiedrich.de>2016-07-04 13:28:19 +0200
committerZoltan HERPAI <wigyori@uid0.hu>2016-07-04 13:28:19 +0200
commit5fa16053e35ec41e57a62fec70cf07e057d3d9dc (patch)
tree302ff47986e9625c8ecd768f8441363cc82f6462 /target
parent64032d56b37cbf54a09c7a98153570c194bd0178 (diff)
downloadmaster-187ad058-5fa16053e35ec41e57a62fec70cf07e057d3d9dc.tar.gz
master-187ad058-5fa16053e35ec41e57a62fec70cf07e057d3d9dc.tar.bz2
master-187ad058-5fa16053e35ec41e57a62fec70cf07e057d3d9dc.zip
ramips: fix up switch settings for Sitecom WL-351 v1 002
Pinmux for rgmii needs to be set to rgmii, not gpio. Hide the ESW switch on boot (using new rgmii esw devicetree attribute). Also add a Sitecom-specific profile, since the image needs to include the rtl8366 kernel driver. Signed-off-by: Tobias Diedrich <ranma+openwrt@tdiedrich.de>
Diffstat (limited to 'target')
-rw-r--r--target/linux/ramips/dts/WL-351.dts7
-rw-r--r--target/linux/ramips/image/rt305x.mk1
-rw-r--r--target/linux/ramips/patches-4.4/0520-esw-gmac.patch69
-rw-r--r--target/linux/ramips/rt305x/profiles/sitecom.mk18
4 files changed, 93 insertions, 2 deletions
diff --git a/target/linux/ramips/dts/WL-351.dts b/target/linux/ramips/dts/WL-351.dts
index ecda696732..541f8cef99 100644
--- a/target/linux/ramips/dts/WL-351.dts
+++ b/target/linux/ramips/dts/WL-351.dts
@@ -86,9 +86,13 @@
&pinctrl {
state_default: pinctrl0 {
gpio {
- ralink,group = "spi", "i2c", "jtag", "rgmii", "mdio", "uartf";
+ ralink,group = "spi", "i2c", "jtag", "mdio", "uartf";
ralink,function = "gpio";
};
+ rgmii {
+ ralink,group = "rgmii";
+ ralink,function = "rgmii";
+ };
};
};
@@ -97,6 +101,7 @@
};
&esw {
+ ralink,rgmii = <1>;
mediatek,portmap = <0x3f>;
ralink,fct2 = <0x0002500c>;
/*
diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk
index da7fc463f4..96175747d7 100644
--- a/target/linux/ramips/image/rt305x.mk
+++ b/target/linux/ramips/image/rt305x.mk
@@ -379,7 +379,6 @@ define Image/Build/Profile/Default
$(call Image/Build/Profile/WL-330N,$(1))
$(call Image/Build/Profile/WL-330N3G,$(1))
$(call Image/Build/Profile/WL-341V3,$(1))
- $(call Image/Build/Profile/WL-351,$(1))
$(call Image/Build/Profile/WNCE2001,$(1))
$(call Image/Build/Profile/WR512-3GN,$(1))
$(call Image/Build/Profile/WR6202,$(1))
diff --git a/target/linux/ramips/patches-4.4/0520-esw-gmac.patch b/target/linux/ramips/patches-4.4/0520-esw-gmac.patch
new file mode 100644
index 0000000000..9d4cd3f4c1
--- /dev/null
+++ b/target/linux/ramips/patches-4.4/0520-esw-gmac.patch
@@ -0,0 +1,69 @@
+--- a/drivers/net/ethernet/mediatek/esw_rt3050.c
++++ b/drivers/net/ethernet/mediatek/esw_rt3050.c
+@@ -221,6 +221,8 @@
+
+ unsigned char port_map;
+ unsigned char port_disable;
++ unsigned int reg_initval_fct2;
++ unsigned int reg_initval_fpa2;
+ unsigned int reg_led_polarity;
+
+ struct switch_dev swdev;
+@@ -452,7 +454,10 @@
+ (RT305X_ESW_PORTS_NOCPU << RT305X_ESW_POC2_UNTAG_EN_S)),
+ RT305X_ESW_REG_POC2);
+
+- esw_w32(esw, 0x0002500c, RT305X_ESW_REG_FCT2);
++ if (esw->reg_initval_fct2)
++ esw_w32(esw, esw->reg_initval_fct2, RT305X_ESW_REG_FCT2);
++ else
++ esw_w32(esw, 0x0002500c, RT305X_ESW_REG_FCT2);
+
+ /* 300s aging timer, max packet len 1536, broadcast storm prevention
+ * disabled, disable collision abort, mac xor48 hash, 10 packet back
+@@ -475,7 +480,10 @@
+ * port5: disabled
+ * port6: enabled, gige, full-duplex, rx/tx-flow-control
+ */
+- esw_w32(esw, 0x3f502b28, RT305X_ESW_REG_FPA2);
++ if (esw->reg_initval_fpa2)
++ esw_w32(esw, esw->reg_initval_fpa2, RT305X_ESW_REG_FPA2);
++ else
++ esw_w32(esw, 0x3f502b28, RT305X_ESW_REG_FPA2);
+ esw_w32(esw, 0x00000000, RT305X_ESW_REG_FPA);
+
+ /* Force Link/Activity on ports */
+@@ -1361,6 +1369,14 @@
+ if (port_disable)
+ esw->port_disable = be32_to_cpu(*port_disable);
+
++ reg_init = of_get_property(np, "ralink,fct2", NULL);
++ if (reg_init)
++ esw->reg_initval_fct2 = be32_to_cpu(*reg_init);
++
++ reg_init = of_get_property(np, "ralink,fpa2", NULL);
++ if (reg_init)
++ esw->reg_initval_fpa2 = be32_to_cpu(*reg_init);
++
+ reg_init = of_get_property(np, "mediatek,led_polarity", NULL);
+ if (reg_init)
+ esw->reg_led_polarity = be32_to_cpu(*reg_init);
+@@ -1386,6 +1402,18 @@
+
+ esw_hw_init(esw);
+
++ reg_init = of_get_property(np, "ralink,rgmii", NULL);
++ if (reg_init && be32_to_cpu(*reg_init) == 1) {
++ /*
++ * External switch connected to RGMII interface.
++ * Unregister the switch device after initialization.
++ */
++ dev_err(&pdev->dev, "RGMII mode, not exporting switch device.\n");
++ unregister_switch(&esw->swdev);
++ platform_set_drvdata(pdev, NULL);
++ return -ENODEV;
++ }
++
+ ret = devm_request_irq(&pdev->dev, esw->irq, esw_interrupt, 0, "esw",
+ esw);
+
diff --git a/target/linux/ramips/rt305x/profiles/sitecom.mk b/target/linux/ramips/rt305x/profiles/sitecom.mk
new file mode 100644
index 0000000000..16d9feff43
--- /dev/null
+++ b/target/linux/ramips/rt305x/profiles/sitecom.mk
@@ -0,0 +1,18 @@
+#
+# Copyright (C) 2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Profile/WL-351
+ NAME:=Sitecom WL-351 v1
+ PACKAGES:=\
+ kmod-switch-rtl8366rb kmod-swconfig swconfig
+endef
+
+define Profile/WL-351/Description
+ Package set for Sitecom WL-351 v1
+endef
+
+$(eval $(call Profile,WL-351))