Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144481067
D16757.1774892897.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D16757.1774892897.diff
View Options
Index: sys/dev/etherswitch/mtkswitch/mtkswitch_rt3050.h
===================================================================
--- sys/dev/etherswitch/mtkswitch/mtkswitch_rt3050.h
+++ sys/dev/etherswitch/mtkswitch/mtkswitch_rt3050.h
@@ -57,6 +57,17 @@
#define MTKSWITCH_FPA 0x0084
#define FPA_ALL_AUTO 0x00000000
+#define MTKSWITCH_SOCPC 0x008c
+#define SOCPC_DISUN2C(x) (1 << (x))
+#define SOCPC_DISMC2C(x) ((1 << (x)) << 8)
+#define SOCPC_DISBC2C(x) ((1 << (x)) << 16)
+#define SOCPC_CRC_PADDING 0x02000000
+
+#define MTKSWITCH_POC0 0x0090
+#define POC0_DIS_PORT_MSK 0x0f800000
+#define POC0_DIS_GPORT1_MSK 0x10000000
+#define POC0_DIS_GPORT2_MSK 0x20000000
+
#define MTKSWITCH_POC2 0x0098
#define POC2_UNTAG_PORT(x) (1 << (x))
#define POC2_UNTAG_VLAN (1 << 15)
@@ -76,6 +87,9 @@
#define PCR1_DATA_OFF 16
#define PCR1_DATA_MASK 0xffff
+#define MTKSWITCH_FPA2 0x00c8
+#define MTKSWITCH_FCT2 0x00cc
+
#define MTKSWITCH_SGC2 0x00e4
#define SGC2_DOUBLE_TAG_PORT(x) (1 << (x))
Index: sys/dev/etherswitch/mtkswitch/mtkswitch_rt3050.c
===================================================================
--- sys/dev/etherswitch/mtkswitch/mtkswitch_rt3050.c
+++ sys/dev/etherswitch/mtkswitch/mtkswitch_rt3050.c
@@ -51,6 +51,9 @@
#include <dev/mii/miivar.h>
#include <dev/mdio/mdio.h>
+#include <dev/fdt/fdt_common.h>
+#include <dev/ofw/ofw_bus.h>
+
#include <dev/etherswitch/etherswitch.h>
#include <dev/etherswitch/mtkswitch/mtkswitchvar.h>
#include <dev/etherswitch/mtkswitch/mtkswitch_rt3050.h>
@@ -124,7 +127,16 @@
static int
mtkswitch_reset(struct mtkswitch_softc *sc)
{
+ phandle_t node;
+ int val;
+
+ node = ofw_bus_get_node(sc->sc_dev);
+ if (OF_getencprop(node, "ralink,noreset", &val,
+ sizeof(val)) >= 0) {
+ if(val == 1)
+ return (0);
+ }
MTKSWITCH_LOCK_ASSERT(sc, MA_NOTOWNED);
MTKSWITCH_LOCK(sc);
MTKSWITCH_WRITE(sc, MTKSWITCH_STRT, STRT_RESET);
@@ -137,12 +149,33 @@
static int
mtkswitch_hw_setup(struct mtkswitch_softc *sc)
{
+ phandle_t node;
+ int val;
+
+ node = ofw_bus_get_node(sc->sc_dev);
/*
* TODO: parse the device tree and see if we need to configure
* ports, etc. differently. For now we fallback to defaults.
*/
+ if (OF_getencprop(node, "ralink,fct2", &val,
+ sizeof(val)) >= 0) {
+ MTKSWITCH_WRITE(sc, MTKSWITCH_FCT2, val);
+ }
+ if (OF_getencprop(node, "ralink,fpa2", &val,
+ sizeof(val)) >= 0) {
+ MTKSWITCH_WRITE(sc, MTKSWITCH_FPA2, val);
+ }
+ val = MTKSWITCH_READ(sc, MTKSWITCH_POC0);
+ val = val & ~(POC0_DIS_PORT_MSK | POC0_DIS_GPORT1_MSK |
+ POC0_DIS_GPORT2_MSK);
+ MTKSWITCH_WRITE(sc, MTKSWITCH_POC0, val);
+ MTKSWITCH_WRITE(sc, MTKSWITCH_SOCPC, (SOCPC_CRC_PADDING |
+ SOCPC_DISBC2C(MTKSWITCH_CPU_PORT) |
+ SOCPC_DISMC2C(MTKSWITCH_CPU_PORT) |
+ SOCPC_DISUN2C(MTKSWITCH_CPU_PORT)));
+
/* Called early and hence unlocked */
/* Set ports 0-4 to auto negotiation */
MTKSWITCH_WRITE(sc, MTKSWITCH_FPA, FPA_ALL_AUTO);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 30, 5:48 PM (11 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28231326
Default Alt Text
D16757.1774892897.diff (2 KB)
Attached To
Mode
D16757: RTL8366 support on RT3052
Attached
Detach File
Event Timeline
Log In to Comment