Skip to contentSkip to conversation

Marvell MV88E61XX Switch Driver support

PATCH Superseded Prafulla Wadaskar 3 participants 7 messages May 4, 2009 – May 26, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v9 1/1 Marvell MV88E61XX Switch Driver support

Chips supported:-
1. 88E6161 6 port gbe swtich with 5 integrated PHYs
2. 88E6165 6 port gbe swtich with 5 integrated PHYs
2. 88E6132 3 port gbe swtich with 2 integrated PHYs Platform specific configuration supported default and router port vlan config supported

Note: This driver is supported and tested against
kirkwood egiga interface

Contributors:
Yotam Admon <[email protected]>
Michael Blostein <michaelbl at marvell.com

Reviewed by: Ronen Shitrit <[email protected]>

---
Change log:-
v2: updated as per review comments for v1
removed other two drivers form earlier patch
debug_prints removed
driver moved to drivers/net/

v3: updated as per review comments for v2
miiphy interface used, platform specific dependency resolved Chip id detection and printing added
common code forked out
some cosmetic and magic number fixes

v4: updated as per review comments for v3
mv88e61xx.h added
platform specific configuration support added
some more documentation references provided
cleaned rgmii delay enable related code

v5: updated as per review comments for v3 code moved to drivers/net/phy/
vlan_init changed to vlan_config and platform specific

v6: mutichip related alias moved to header file vlan_config functions renamed as port_vlan_config mv_switch_88f61xx_init renamed as mv88f61xx_switch_initialization the function prototype for same is added in netdev.h

v7: minor updates as per v6 review feedback
RD_PHY/WR_PHY macros defined and used in the code

v8: BITxx macros replaced by 1<<xx

v9: switch specific public declaration moved to netdev.h for clean board specific usage

 drivers/net/phy/Makefile    |    1 +
 drivers/net/phy/mv88e61xx.c |  299 +++++++++++++++++++++++++++++++++++++++++++
 drivers/net/phy/mv88e61xx.h |   57 ++++++++
 include/netdev.h            |   29 ++++
 4 files changed, 386 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/phy/mv88e61xx.c
 create mode 100644 drivers/net/phy/mv88e61xx.h
drivers/net/phy/Makefile +1 -0
index 4fe3b05..3b92614 100644
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
 LIB	:= $(obj)libphy.a
 
 COBJS-$(CONFIG_BITBANGMII) += miiphybb.o
+COBJS-$(CONFIG_MV88E61XX_SWITCH) += mv88e61xx.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/net/phy/mv88e61xx.c new file +299 -0

299 lines not on this page · raw message

drivers/net/phy/mv88e61xx.h new file +57 -0

57 lines not on this page · raw message

include/netdev.h +29 -0
index b73aa8e..932d986 100644
@@ -28,6 +28,34 @@
 #ifndef _NETDEV_H_
 #define _NETDEV_H_
 
+/* constants for switch configuration */
+enum switch_cfg_vlan {
+	SWITCH_VLANCFG_DEFAULT,
+	SWITCH_VLANCFG_ROUTER
+};
+
+enum switch_cfg_rgmiid {
+	SWITCH_RGMII_DELAY_DIS,
+	SWITCH_RGMII_DELAY_EN
+};
+
+enum switch_cfg_prtstt {
+	SWITCH_PORTSTT_DISABLED,
+	SWITCH_PORTSTT_BLOCKING,
+	SWITCH_PORTSTT_LEARNING,
+	SWITCH_PORTSTT_FORWARDING
+};
+
+/* switch configuration structure */
+struct switch_config {
+	char *name;
+	enum switch_cfg_vlan vlancfg;
+	enum switch_cfg_rgmiid rgmii_delay;
+	enum switch_cfg_prtstt portstate;
+	u32 ports_enabled;
+	u8 cpuport;
+};
+
 /*
  * Board and CPU-specific initialization functions
  * board_eth_init() has highest priority.  cpu_eth_init() only
@@ -60,6 +88,7 @@ int mpc512x_fec_initialize(bd_t *bis);
 int mpc5xxx_fec_initialize(bd_t *bis);
 int mpc8220_fec_initialize(bd_t *bis);
 int mpc82xx_scc_enet_initialize(bd_t *bis);
+int mv88e61xx_switch_initialize(struct switch_config *swconfig);
 int natsemi_initialize(bd_t *bis);
 int npe_initialize(bd_t *bis);
 int ns8382x_initialize(bd_t *bis);
Signature · 1 line
1.5.3.4
#1 lore raw

PATCH v9 1/1 Marvell MV88E61XX Switch Driver support

include/netdev.h line 32

Quoted 8 lines
include/netdev.h +2 -0
@@ -28,6 +28,34 @@
 #ifndef _NETDEV_H_
 #define _NETDEV_H_
 
+/* constants for switch configuration */
+enum switch_cfg_vlan {

IHMO in this case it must be mvxxxx_swtich .....

and maybe cover by a defive

but I not sure it's the rigth place for this

Quoted 15 lines
include/netdev.h +15 -0
+	SWITCH_VLANCFG_DEFAULT,
+	SWITCH_VLANCFG_ROUTER
+};
+
+enum switch_cfg_rgmiid {
+	SWITCH_RGMII_DELAY_DIS,
+	SWITCH_RGMII_DELAY_EN
+};
+
+enum switch_cfg_prtstt {
+	SWITCH_PORTSTT_DISABLED,
+	SWITCH_PORTSTT_BLOCKING,
+	SWITCH_PORTSTT_LEARNING,
+	SWITCH_PORTSTT_FORWARDING
+};

include/netdev.h line 57

Quoted 10 lines
include/netdev.h +10 -0
+
+/* switch configuration structure */
+struct switch_config {
+	char *name;
+	enum switch_cfg_vlan vlancfg;
+	enum switch_cfg_rgmiid rgmii_delay;
+	enum switch_cfg_prtstt portstate;
+	u32 ports_enabled;
+	u8 cpuport;
+};

a simple
struct switch_config;

and the a MV88E61XX_H

will be cleaner

Best Regards,
J.

#2 lore raw

PATCH v9 1/1 Marvell MV88E61XX Switch Driver support

Quoted 11 lines

-----Original Message-----
From: Jean-Christophe PLAGNIOL-VILLARD [mailto:plagnioj at jcrosoft.com]
Sent: Tuesday, May 05, 2009 3:43 AM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH v9] Marvell MV88E61XX Switch Driver support

Quoted 8 lines

include/netdev.h line 31

Quoted 7 lines
include/netdev.h +1 -0
@@ -28,6 +28,34 @@
 #ifndef _NETDEV_H_
 #define _NETDEV_H_
 
+/* constants for switch configuration */ enum switch_cfg_vlan {

IHMO in this case it must be mvxxxx_swtich .....

Since this definition is a part of public header file and can be used for other switch/phy configuration, that's why I have replaced MV88E61XX by SWITCH.

Quoted 2 lines

and maybe cover by a defive

This is the only switch in the driver/net/phy folder that's why not ifdefed. I will do this

Quoted 2 lines

but I not sure it's the rigth place for this

I have suggested to creat new phydev.h for this, Ben suggested this place

Quoted 29 lines
Quoted 16 lines
include/netdev.h +15 -0
+	SWITCH_VLANCFG_DEFAULT,
+	SWITCH_VLANCFG_ROUTER
+};
+
+enum switch_cfg_rgmiid {
+	SWITCH_RGMII_DELAY_DIS,
+	SWITCH_RGMII_DELAY_EN
+};
+
+enum switch_cfg_prtstt {
+	SWITCH_PORTSTT_DISABLED,
+	SWITCH_PORTSTT_BLOCKING,
+	SWITCH_PORTSTT_LEARNING,
+	SWITCH_PORTSTT_FORWARDING
+};

include/netdev.h line 57

Quoted 10 lines
include/netdev.h +10 -0
+
+/* switch configuration structure */
+struct switch_config {
+	char *name;
+	enum switch_cfg_vlan vlancfg;
+	enum switch_cfg_rgmiid rgmii_delay;
+	enum switch_cfg_prtstt portstate;
+	u32 ports_enabled;
+	u8 cpuport;
+};

a simple
struct switch_config;

Quoted 3 lines

and the a MV88E61XX_H

will be cleaner

I will replace switch with mv88361xx and ifdef to make it clean

Regards..
Prafulla . .

Quoted 4 lines

Best Regards,
J.

#3 lore raw

PATCH v9 1/1 Marvell MV88E61XX Switch Driver support

In reply to Prafulla Wadaskar

Hi Prafulla,

Prafulla Wadaskar wrote:
<snip>

Quoted 27 lines
include/netdev.h +19 -0
index b73aa8e..932d986 100644
@@ -28,6 +28,34 @@
 #ifndef _NETDEV_H_
 #define _NETDEV_H_
 
+/* constants for switch configuration */
+enum switch_cfg_vlan {
+	SWITCH_VLANCFG_DEFAULT,
+	SWITCH_VLANCFG_ROUTER
+};
+
+enum switch_cfg_rgmiid {
+	SWITCH_RGMII_DELAY_DIS,
+	SWITCH_RGMII_DELAY_EN
+};
+
+enum switch_cfg_prtstt {
+	SWITCH_PORTSTT_DISABLED,
+	SWITCH_PORTSTT_BLOCKING,
+	SWITCH_PORTSTT_LEARNING,
+	SWITCH_PORTSTT_FORWARDING
+};
+
+/* switch configuration structure */

include/netdev.h line 59

Quoted 10 lines
include/netdev.h +9 -0
+struct switch_config {
+	char *name;
+	enum switch_cfg_vlan vlancfg;
+	enum switch_cfg_rgmiid rgmii_delay;
+	enum switch_cfg_prtstt portstate;
+	u32 ports_enabled;
+	u8 cpuport;
+};
+
 

Now you're in a common file, so namespaces are important. Keep in mind that while yours is the first switch here, it probably won't be the last and nobody else is bound to using your definitions. Please qualify all of these names so it's obvious what hardware they refer to.

Please add this stuff to the bottom of this file, and add an appropriate comment block in the same theme as I've done with the others.

regards,
Ben

#4 lore raw

PATCH v9 1/1 Marvell MV88E61XX Switch Driver support

Quoted 48 lines

-----Original Message-----
From: Ben Warren [mailto:biggerbadderben at gmail.com]
Sent: Tuesday, May 05, 2009 4:12 AM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik; Ronen Shitrit
Subject: Re: [U-Boot] [PATCH v9] Marvell MV88E61XX Switch Driver support

Hi Prafulla,

Prafulla Wadaskar wrote:
<snip>

Quoted 33 lines
include/netdev.h index renamed from include/netdev.h +0 -0

b73aa8e..932d986 100644

include/netdev.h +25 -0
@@ -28,6 +28,34 @@
 #ifndef _NETDEV_H_
 #define _NETDEV_H_
 
+/* constants for switch configuration */ enum switch_cfg_vlan {
+	SWITCH_VLANCFG_DEFAULT,
+	SWITCH_VLANCFG_ROUTER
+};
+
+enum switch_cfg_rgmiid {
+	SWITCH_RGMII_DELAY_DIS,
+	SWITCH_RGMII_DELAY_EN
+};
+
+enum switch_cfg_prtstt {
+	SWITCH_PORTSTT_DISABLED,
+	SWITCH_PORTSTT_BLOCKING,
+	SWITCH_PORTSTT_LEARNING,
+	SWITCH_PORTSTT_FORWARDING
+};
+
+/* switch configuration structure */
+struct switch_config {
+	char *name;
+	enum switch_cfg_vlan vlancfg;
+	enum switch_cfg_rgmiid rgmii_delay;
+	enum switch_cfg_prtstt portstate;
+	u32 ports_enabled;
+	u8 cpuport;
Quoted 8 lines

include/netdev.h

Quoted 3 lines
include/netdev.h +2 -0
+};
+
 

Now you're in a common file, so namespaces are important. Keep in mind that while yours is the first switch here, it probably won't be the last and nobody else is bound to using your definitions. Please qualify all of these names so it's obvious what hardware they refer to.

It makes more sense to revert back to the MV88E61XX names I will do it..

Quoted 4 lines

Please add this stuff to the bottom of this file, and add an appropriate comment block in the same theme as I've done with the others.

Sure...

Regards..
Prafulla . .

Quoted 4 lines

regards,
Ben

#5 lore raw

PATCH v10 1/1 Marvell MV88E61XX Switch Driver support

Chips supported:-
1. 88E6161 6 port gbe swtich with 5 integrated PHYs
2. 88E6165 6 port gbe swtich with 5 integrated PHYs
2. 88E6132 3 port gbe swtich with 2 integrated PHYs Platform specific configuration supported for:- default or router port vlan configuration led_init configuration
mdip/n polarity reversal configuration

Note: This driver is supported and tested against
kirkwood egiga interface

Contributors:
Yotam Admon <[email protected]>
Michael Blostein <michaelbl at marvell.com

Reviewed by: Ronen Shitrit <[email protected]>

---
Change log:-
v2: updated as per review comments for v1
removed other two drivers form earlier patch
debug_prints removed
driver moved to drivers/net/

v3: updated as per review comments for v2
miiphy interface used, platform specific dependency resolved Chip id detection and printing added
common code forked out
some cosmetic and magic number fixes

v4: updated as per review comments for v3
mv88e61xx.h added
platform specific configuration support added
some more documentation references provided
cleaned rgmii delay enable related code

v5: updated as per review comments for v3 code moved to drivers/net/phy/
vlan_init changed to vlan_config and platform specific

v6: mutichip related alias moved to header file vlan_config functions renamed as port_vlan_config mv_switch_88f61xx_init renamed as mv88f61xx_switch_initialization the function prototype for same is added in netdev.h

v7: minor updates as per v6 review feedback
RD_PHY/WR_PHY macros defined and used in the code

v8: BITxx macros replaced by 1<<xx

v9: switch specific public declaration moved to netdev.h for clean board specific usage

v10: swtich specific public defination ifdefed and renamed led_init and reverse_mdipn configuration support added

 drivers/net/phy/Makefile    |    1 +
 drivers/net/phy/mv88e61xx.c |  413 +++++++++++++++++++++++++++++++++++++++++++
 drivers/net/phy/mv88e61xx.h |   62 +++++++
 include/netdev.h            |   47 +++++
 4 files changed, 523 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/phy/mv88e61xx.c
 create mode 100644 drivers/net/phy/mv88e61xx.h
drivers/net/phy/Makefile +1 -0
index 4fe3b05..3b92614 100644
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
 LIB	:= $(obj)libphy.a
 
 COBJS-$(CONFIG_BITBANGMII) += miiphybb.o
+COBJS-$(CONFIG_MV88E61XX_SWITCH) += mv88e61xx.o
 
 COBJS	:= $(COBJS-y)
 SRCS	:= $(COBJS:.o=.c)
drivers/net/phy/mv88e61xx.c new file +413 -0

413 lines not on this page · raw message

drivers/net/phy/mv88e61xx.h new file +62 -0

62 lines not on this page · raw message

include/netdev.h +47 -0

51 lines not on this page · raw message

Signature · 1 line
1.5.3.3
Applied
#6 lore raw

PATCH v10 1/1 Marvell MV88E61XX Switch Driver support

Quoted 12 lines · Prafulla Wadaskar

Chips supported:-
1. 88E6161 6 port gbe swtich with 5 integrated PHYs
2. 88E6165 6 port gbe swtich with 5 integrated PHYs
2. 88E6132 3 port gbe swtich with 2 integrated PHYs Platform specific configuration supported for:- default or router port vlan configuration led_init configuration
mdip/n polarity reversal configuration

Note: This driver is supported and tested against kirkwood egiga interface

Quoted 7 lines

Contributors:
Yotam Admon <[email protected]>
Michael Blostein <[email protected]

Reviewed by: Ronen Shitrit <[email protected]>

Applied to net/next. Thanks a lot!

Ben