From: Pavel Machek <pavel@ucw.cz>
To: andrew@lunn.ch, vivien.didelot@savoirfairelinux.com,
netdev@vger.kernel.org, f.fainelli@gmail.com
Cc: buytenh@marvell.com, buytenh@wantstofly.org, nico@marvell.com
Subject: mv88e6060: Turn e6060 driver into e6065 driver
Date: Thu, 6 Dec 2018 14:03:45 +0100 [thread overview]
Message-ID: <20181206130345.GD22343@amd> (raw)
In-Reply-To: <20181206130051.GA22343@amd>
[-- Attachment #1: Type: text/plain, Size: 4597 bytes --]
This is NOT ready for merge, as you lose support for 6060. Probably
not what you want.
Signed-off-by: Pavel Machek <pavel@ucw.cz> (not ready)
diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
index 9e3901f18518..9c9b4792bbad 100644
--- a/drivers/net/dsa/mv88e6060.c
+++ b/drivers/net/dsa/mv88e6060.c
@@ -61,6 +61,7 @@ static const char *mv88e6060_get_name(struct mii_bus *bus, int sw_addr)
int ret;
ret = mdiobus_read(bus, sw_addr + REG_PORT(0), PORT_SWITCH_ID);
+ printk("e6060: get name: %lx\n", (long) ret);
if (ret >= 0) {
if (ret == PORT_SWITCH_ID_6060)
return "Marvell 88E6060 (A0)";
@@ -69,6 +70,8 @@ static const char *mv88e6060_get_name(struct mii_bus *bus, int sw_addr)
return "Marvell 88E6060 (B0)";
if ((ret & PORT_SWITCH_ID_6060_MASK) == PORT_SWITCH_ID_6060)
return "Marvell 88E6060";
+ if ((ret & PORT_SWITCH_ID_6060_MASK) == 0x0650)
+ return "Marvell 88E6065";
}
return NULL;
@@ -79,7 +82,7 @@ static enum dsa_tag_protocol mv88e6060_get_tag_protocol(struct dsa_switch *ds,
{
//return DSA_TAG_PROTO_QCA;
//return DSA_TAG_PROTO_TRAILER;
- return DSA_TAG_PROTO_TRAILER;
+ return DSA_TAG_PROTO_DADDR;
}
static struct mv88e6060_priv *
@@ -128,6 +131,7 @@ static int mv88e6060_switch_reset(struct dsa_switch *ds)
ret & ~PORT_CONTROL_STATE_MASK);
}
+
/* Wait for transmit queues to drain. */
usleep_range(2000, 4000);
@@ -174,6 +178,11 @@ static int mv88e6060_setup_global(struct dsa_switch *ds)
return 0;
}
+static int mv88e6060_setup_port_hacks(struct dsa_switch *ds, int p)
+{
+}
+
+
static int mv88e6060_setup_port(struct dsa_switch *ds, int p)
{
int addr = REG_PORT(p);
@@ -184,12 +193,17 @@ static int mv88e6060_setup_port(struct dsa_switch *ds, int p)
* port, enable Ingress and Egress Trailer tagging mode.
*/
REG_WRITE(addr, PORT_CONTROL,
- dsa_is_cpu_port(ds, p) ?
- PORT_CONTROL_TRAILER |
- PORT_CONTROL_INGRESS_MODE |
- PORT_CONTROL_STATE_FORWARDING :
- PORT_CONTROL_STATE_FORWARDING);
-
+ PORT_CONTROL_INITIAL_PRI_6065 |
+ PORT_CONTROL_FLOOD_ALL_6065 |
+ PORT_CONTROL_STATE_FORWARDING |
+ (dsa_is_cpu_port(ds, p) ?
+ PORT_CONTROL_HEADER |
+ PORT_CONTROL_TRAILER_6065
+ : 0));
+
+ if (dsa_is_cpu_port(ds, p))
+ mv88e6060_setup_port_hacks(ds, p);
+
/* Port based VLAN map: give each port its own address
* database, allow the CPU port to talk to each of the 'real'
* ports, and allow each of the 'real' ports to only talk to
diff --git a/drivers/net/dsa/mv88e6060.h b/drivers/net/dsa/mv88e6060.h
index 10249bd16292..13f7e8a2107a 100644
--- a/drivers/net/dsa/mv88e6060.h
+++ b/drivers/net/dsa/mv88e6060.h
@@ -32,27 +32,30 @@
#define PORT_SWITCH_ID_6060_MASK 0xfff0
#define PORT_SWITCH_ID_6060_R1 0x0601
#define PORT_SWITCH_ID_6060_R2 0x0602
-#define PORT_CONTROL 0x04
+#define PORT_CONTROL 0x04 /* Matches */
#define PORT_CONTROL_FORCE_FLOW_CTRL BIT(15)
-#define PORT_CONTROL_TRAILER BIT(14)
-#define PORT_CONTROL_HEADER BIT(11)
-#define PORT_CONTROL_INGRESS_MODE BIT(8)
+#define PORT_CONTROL_TRAILER_6060 BIT(14)
+#define PORT_CONTROL_TRAILER_6065 (BIT(12) /* | BIT(13) */)
+#define PORT_CONTROL_HEADER BIT(11) /* Controls ingress/egress on 6065, 2 byte headers? */
+#define PORT_CONTROL_INGRESS_MODE_6060 BIT(8)
#define PORT_CONTROL_VLAN_TUNNEL BIT(7)
-#define PORT_CONTROL_STATE_MASK 0x03
+#define PORT_CONTROL_INITIAL_PRI_6065 BIT(4)
+#define PORT_CONTROL_FLOOD_ALL_6065 (BIT(2) | BIT(3))
+#define PORT_CONTROL_STATE_MASK 0x03 /* Matches */
#define PORT_CONTROL_STATE_DISABLED 0x00
#define PORT_CONTROL_STATE_BLOCKING 0x01
#define PORT_CONTROL_STATE_LEARNING 0x02
#define PORT_CONTROL_STATE_FORWARDING 0x03
-#define PORT_VLAN_MAP 0x06
+#define PORT_VLAN_MAP 0x06 /* Matches */
#define PORT_VLAN_MAP_DBNUM_SHIFT 12
#define PORT_VLAN_MAP_TABLE_MASK 0x1f
-#define PORT_ASSOC_VECTOR 0x0b
+#define PORT_ASSOC_VECTOR 0x0b /* Matches */
#define PORT_ASSOC_VECTOR_MONITOR BIT(15)
#define PORT_ASSOC_VECTOR_PAV_MASK 0x1f
-#define PORT_RX_CNTR 0x10
-#define PORT_TX_CNTR 0x11
+#define PORT_RX_CNTR 0x10 /* Matches */
+#define PORT_TX_CNTR 0x11 /* Matches */
-#define REG_GLOBAL 0x0f
+#define REG_GLOBAL 0x0f
#define GLOBAL_STATUS 0x00
#define GLOBAL_STATUS_SW_MODE_MASK (0x3 << 12)
#define GLOBAL_STATUS_SW_MODE_0 (0x0 << 12)
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2018-12-06 13:03 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-15 19:51 DSA support for Marvell 88e6065 switch Pavel Machek
2018-11-15 20:26 ` Andrew Lunn
2018-11-18 18:07 ` Pavel Machek
2018-11-18 18:20 ` Andrew Lunn
2018-11-18 20:15 ` Pavel Machek
2018-11-19 3:25 ` Andrew Lunn
2018-11-22 13:21 ` Pavel Machek
2018-11-22 15:33 ` Lennert Buytenhek
2018-11-22 20:27 ` Pavel Machek
2018-12-03 1:42 ` Lennert Buytenhek
2018-12-05 20:46 ` Pavel Machek
2018-12-05 22:20 ` Florian Fainelli
2018-12-06 14:40 ` Pavel Machek
2019-01-29 22:57 ` mv88e6xxx -- DSA support for Marvell 88e6065 switch (and maybe 88e6060?) Pavel Machek
2019-01-29 23:12 ` Andrew Lunn
2019-01-29 23:21 ` Vivien Didelot
2018-12-06 13:00 ` Well supported DSA switches, support for Marvell 88e6065 switch Pavel Machek
2018-12-06 13:01 ` [PATCH] mv88e6060: Warn about errors Pavel Machek
2018-12-06 20:21 ` David Miller
2018-12-06 20:36 ` Pavel Machek
2018-12-06 13:02 ` [RFD] mv88e6060: Allow the driver to be probed from device tree Pavel Machek
2018-12-06 18:32 ` kbuild test robot
2018-12-15 8:41 ` kbuild test robot
2018-12-06 13:03 ` Pavel Machek [this message]
2018-12-06 20:23 ` mv88e6060: Turn e6060 driver into e6065 driver David Miller
2018-12-06 20:35 ` Pavel Machek
2018-12-06 13:05 ` [PATCH] dsa device tree bindings: fix typo and wrong example Pavel Machek
2018-12-06 13:28 ` Vokáč Michal
2019-01-07 18:49 ` Pavel Machek
2019-01-07 18:53 ` Florian Fainelli
2018-12-06 13:06 ` [RFC] tag_daddr: add tagging scheme used by Marvel 88e6065 switch Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181206130345.GD22343@amd \
--to=pavel@ucw.cz \
--cc=andrew@lunn.ch \
--cc=buytenh@marvell.com \
--cc=buytenh@wantstofly.org \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nico@marvell.com \
--cc=vivien.didelot@savoirfairelinux.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.