RE: [PATCH net-next v6 2/4] net: dsa: mv88e6xxx: Add support for ethernet switch 88E6341

2017-01-25 Thread Jon Pannell
Adding Bob Bernstein

Jon Pannell


-Original Message-
From: Gregory CLEMENT [mailto:gregory.clem...@free-electrons.com] 
Sent: Tuesday, January 24, 2017 11:56 PM
To: Andrew Lunn <and...@lunn.ch>
Cc: Vivien Didelot <vivien.dide...@savoirfairelinux.com>; Florian Fainelli 
<f.faine...@gmail.com>; net...@vger.kernel.org; linux-kernel@vger.kernel.org; 
David S. Miller <da...@davemloft.net>; Jason Cooper <ja...@lakedaemon.net>; 
Sebastian Hesselbarth <sebastian.hesselba...@gmail.com>; Thomas Petazzoni 
<thomas.petazz...@free-electrons.com>; linux-arm-ker...@lists.infradead.org; 
Nadav Haklai <nad...@marvell.com>; Wilson Ding <ding...@marvell.com>; Kostya 
Porotchkin <kos...@marvell.com>; Joe Zhou <shjz...@marvell.com>; Jon Pannell 
<jpann...@marvell.com>
Subject: Re: [PATCH net-next v6 2/4] net: dsa: mv88e6xxx: Add support for 
ethernet switch 88E6341

Hi Andrew,
 
 On mer., janv. 25 2017, Andrew Lunn <and...@lunn.ch> wrote:

>> +[MV88E6341] = {
>> +.prod_num = PORT_SWITCH_ID_PROD_NUM_6341,
>> +.family = MV88E6XXX_FAMILY_6341,
>> +.name = "Marvell 88E6341",
>> +.num_databases = 4096,
>> +.num_ports = 6,
>> +.port_base_addr = 0x10,
>> +.global1_addr = 0x1b,
>> +.age_time_coeff = 15000,
>
> Hi Gregory
>
> Please could you check this timer in the datasheet. There is currently 
> a bug in the mv88e6390 support code. I also set it to 15s. But in fact 
> it is 3.75 seconds. The 6341 might also use 3.75 seconds.

When I read your series I also thought about it and indeed it is 3.75 seconds. 
I will fix it.

Thanks,

Gregory


>
>Thanks
>   Andrew

--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux development, consulting, training 
and support.
http://free-electrons.com


RE: [PATCH net-next v6 2/4] net: dsa: mv88e6xxx: Add support for ethernet switch 88E6341

2017-01-25 Thread Jon Pannell
Adding Bob Bernstein

Jon Pannell


-Original Message-
From: Gregory CLEMENT [mailto:gregory.clem...@free-electrons.com] 
Sent: Tuesday, January 24, 2017 11:56 PM
To: Andrew Lunn 
Cc: Vivien Didelot ; Florian Fainelli 
; net...@vger.kernel.org; linux-kernel@vger.kernel.org; 
David S. Miller ; Jason Cooper ; 
Sebastian Hesselbarth ; Thomas Petazzoni 
; linux-arm-ker...@lists.infradead.org; 
Nadav Haklai ; Wilson Ding ; Kostya 
Porotchkin ; Joe Zhou ; Jon Pannell 

Subject: Re: [PATCH net-next v6 2/4] net: dsa: mv88e6xxx: Add support for 
ethernet switch 88E6341

Hi Andrew,
 
 On mer., janv. 25 2017, Andrew Lunn  wrote:

>> +[MV88E6341] = {
>> +.prod_num = PORT_SWITCH_ID_PROD_NUM_6341,
>> +.family = MV88E6XXX_FAMILY_6341,
>> +.name = "Marvell 88E6341",
>> +.num_databases = 4096,
>> +.num_ports = 6,
>> +.port_base_addr = 0x10,
>> +.global1_addr = 0x1b,
>> +.age_time_coeff = 15000,
>
> Hi Gregory
>
> Please could you check this timer in the datasheet. There is currently 
> a bug in the mv88e6390 support code. I also set it to 15s. But in fact 
> it is 3.75 seconds. The 6341 might also use 3.75 seconds.

When I read your series I also thought about it and indeed it is 3.75 seconds. 
I will fix it.

Thanks,

Gregory


>
>Thanks
>   Andrew

--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux development, consulting, training 
and support.
http://free-electrons.com


Re: [PATCH net-next v6 2/4] net: dsa: mv88e6xxx: Add support for ethernet switch 88E6341

2017-01-24 Thread Gregory CLEMENT
Hi Andrew,
 
 On mer., janv. 25 2017, Andrew Lunn  wrote:

>> +[MV88E6341] = {
>> +.prod_num = PORT_SWITCH_ID_PROD_NUM_6341,
>> +.family = MV88E6XXX_FAMILY_6341,
>> +.name = "Marvell 88E6341",
>> +.num_databases = 4096,
>> +.num_ports = 6,
>> +.port_base_addr = 0x10,
>> +.global1_addr = 0x1b,
>> +.age_time_coeff = 15000,
>
> Hi Gregory
>
> Please could you check this timer in the datasheet. There is currently
> a bug in the mv88e6390 support code. I also set it to 15s. But in fact
> it is 3.75 seconds. The 6341 might also use 3.75 seconds.

When I read your series I also thought about it and indeed it is 3.75
seconds. I will fix it.

Thanks,

Gregory


>
>Thanks
>   Andrew

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com


Re: [PATCH net-next v6 2/4] net: dsa: mv88e6xxx: Add support for ethernet switch 88E6341

2017-01-24 Thread Gregory CLEMENT
Hi Andrew,
 
 On mer., janv. 25 2017, Andrew Lunn  wrote:

>> +[MV88E6341] = {
>> +.prod_num = PORT_SWITCH_ID_PROD_NUM_6341,
>> +.family = MV88E6XXX_FAMILY_6341,
>> +.name = "Marvell 88E6341",
>> +.num_databases = 4096,
>> +.num_ports = 6,
>> +.port_base_addr = 0x10,
>> +.global1_addr = 0x1b,
>> +.age_time_coeff = 15000,
>
> Hi Gregory
>
> Please could you check this timer in the datasheet. There is currently
> a bug in the mv88e6390 support code. I also set it to 15s. But in fact
> it is 3.75 seconds. The 6341 might also use 3.75 seconds.

When I read your series I also thought about it and indeed it is 3.75
seconds. I will fix it.

Thanks,

Gregory


>
>Thanks
>   Andrew

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com


Re: [PATCH net-next v6 2/4] net: dsa: mv88e6xxx: Add support for ethernet switch 88E6341

2017-01-24 Thread Andrew Lunn
> + [MV88E6341] = {
> + .prod_num = PORT_SWITCH_ID_PROD_NUM_6341,
> + .family = MV88E6XXX_FAMILY_6341,
> + .name = "Marvell 88E6341",
> + .num_databases = 4096,
> + .num_ports = 6,
> + .port_base_addr = 0x10,
> + .global1_addr = 0x1b,
> + .age_time_coeff = 15000,

Hi Gregory

Please could you check this timer in the datasheet. There is currently
a bug in the mv88e6390 support code. I also set it to 15s. But in fact
it is 3.75 seconds. The 6341 might also use 3.75 seconds.

   Thanks
Andrew


Re: [PATCH net-next v6 2/4] net: dsa: mv88e6xxx: Add support for ethernet switch 88E6341

2017-01-24 Thread Andrew Lunn
> + [MV88E6341] = {
> + .prod_num = PORT_SWITCH_ID_PROD_NUM_6341,
> + .family = MV88E6XXX_FAMILY_6341,
> + .name = "Marvell 88E6341",
> + .num_databases = 4096,
> + .num_ports = 6,
> + .port_base_addr = 0x10,
> + .global1_addr = 0x1b,
> + .age_time_coeff = 15000,

Hi Gregory

Please could you check this timer in the datasheet. There is currently
a bug in the mv88e6390 support code. I also set it to 15s. But in fact
it is 3.75 seconds. The 6341 might also use 3.75 seconds.

   Thanks
Andrew


[PATCH net-next v6 2/4] net: dsa: mv88e6xxx: Add support for ethernet switch 88E6341

2017-01-24 Thread Gregory CLEMENT
The Marvell 88E6341 device is single-chip, 6-port Ethernet switch with
four integrated 10/100/1000Mbps Ethernet transceivers and one high speed
SerDes interfaces. It is partially compatible with switches of family
88E6352 and switches of family 88E6390.

This commit adds an initial support for this switch by describing its
capabilities to the driver and introducing a new family.

Signed-off-by: Gregory CLEMENT 
---
 drivers/net/dsa/mv88e6xxx/chip.c  | 54 ++--
 drivers/net/dsa/mv88e6xxx/mv88e6xxx.h | 19 +-
 2 files changed, 69 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 7d942f8a42a7..00db33ca1696 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -664,6 +664,11 @@ static bool mv88e6xxx_6320_family(struct mv88e6xxx_chip 
*chip)
return chip->info->family == MV88E6XXX_FAMILY_6320;
 }
 
+static bool mv88e6xxx_6341_family(struct mv88e6xxx_chip *chip)
+{
+   return chip->info->family == MV88E6XXX_FAMILY_6341;
+}
+
 static bool mv88e6xxx_6351_family(struct mv88e6xxx_chip *chip)
 {
return chip->info->family == MV88E6XXX_FAMILY_6351;
@@ -1688,7 +1693,8 @@ static int _mv88e6xxx_vtu_new(struct mv88e6xxx_chip 
*chip, u16 vid,
: GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER;
 
if (mv88e6xxx_6097_family(chip) || mv88e6xxx_6165_family(chip) ||
-   mv88e6xxx_6351_family(chip) || mv88e6xxx_6352_family(chip)) {
+   mv88e6xxx_6351_family(chip) || mv88e6xxx_6352_family(chip) ||
+   mv88e6xxx_6341_family(chip)) {
struct mv88e6xxx_vtu_entry vstp;
 
/* Adding a VTU entry requires a valid STU entry. As VSTP is not
@@ -2543,7 +2549,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip 
*chip, int port)
if (mv88e6xxx_6352_family(chip) || mv88e6xxx_6351_family(chip) ||
mv88e6xxx_6165_family(chip) || mv88e6xxx_6097_family(chip) ||
mv88e6xxx_6095_family(chip) || mv88e6xxx_6320_family(chip) ||
-   mv88e6xxx_6185_family(chip))
+   mv88e6xxx_6185_family(chip) || mv88e6xxx_6341_family(chip))
reg = PORT_CONTROL_2_MAP_DA;
 
if (mv88e6xxx_6095_family(chip) || mv88e6xxx_6185_family(chip)) {
@@ -2597,7 +2603,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip 
*chip, int port)
 
if (mv88e6xxx_6352_family(chip) || mv88e6xxx_6351_family(chip) ||
mv88e6xxx_6165_family(chip) || mv88e6xxx_6097_family(chip) ||
-   mv88e6xxx_6320_family(chip)) {
+   mv88e6xxx_6320_family(chip) || mv88e6xxx_6341_family(chip)) {
/* Port ATU control: disable limiting the number of
 * address database entries that this port is allowed
 * to use.
@@ -3566,6 +3572,34 @@ static const struct mv88e6xxx_ops mv88e6352_ops = {
.reset = mv88e6352_g1_reset,
 };
 
+static const struct mv88e6xxx_ops mv88e6341_ops = {
+   /* MV88E6XXX_FAMILY_6341 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom8,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom8,
+   .set_switch_mac = mv88e6xxx_g2_set_switch_mac,
+   .phy_read = mv88e6xxx_g2_smi_phy_read,
+   .phy_write = mv88e6xxx_g2_smi_phy_write,
+   .port_set_link = mv88e6xxx_port_set_link,
+   .port_set_duplex = mv88e6xxx_port_set_duplex,
+   .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay,
+   .port_set_speed = mv88e6390_port_set_speed,
+   .port_tag_remap = mv88e6095_port_tag_remap,
+   .port_set_frame_mode = mv88e6351_port_set_frame_mode,
+   .port_set_egress_unknowns = mv88e6351_port_set_egress_unknowns,
+   .port_set_ether_type = mv88e6351_port_set_ether_type,
+   .port_jumbo_config = mv88e6165_port_jumbo_config,
+   .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting,
+   .port_pause_config = mv88e6097_port_pause_config,
+   .stats_snapshot = mv88e6390_g1_stats_snapshot,
+   .stats_get_sset_count = mv88e6320_stats_get_sset_count,
+   .stats_get_strings = mv88e6320_stats_get_strings,
+   .stats_get_stats = mv88e6390_stats_get_stats,
+   .g1_set_cpu_port = mv88e6390_g1_set_cpu_port,
+   .g1_set_egress_port = mv88e6390_g1_set_egress_port,
+   .mgmt_rsvd2cpu =  mv88e6390_g1_mgmt_rsvd2cpu,
+   .reset = mv88e6352_g1_reset,
+};
+
 static const struct mv88e6xxx_ops mv88e6390_ops = {
/* MV88E6XXX_FAMILY_6390 */
.get_eeprom = mv88e6xxx_g2_get_eeprom8,
@@ -3953,6 +3987,20 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
.ops = _ops,
},
 
+   [MV88E6341] = {
+   .prod_num = PORT_SWITCH_ID_PROD_NUM_6341,
+   .family = MV88E6XXX_FAMILY_6341,
+   .name = "Marvell 88E6341",
+   .num_databases = 4096,
+   .num_ports = 6,
+   .port_base_addr = 0x10,
+   

[PATCH net-next v6 2/4] net: dsa: mv88e6xxx: Add support for ethernet switch 88E6341

2017-01-24 Thread Gregory CLEMENT
The Marvell 88E6341 device is single-chip, 6-port Ethernet switch with
four integrated 10/100/1000Mbps Ethernet transceivers and one high speed
SerDes interfaces. It is partially compatible with switches of family
88E6352 and switches of family 88E6390.

This commit adds an initial support for this switch by describing its
capabilities to the driver and introducing a new family.

Signed-off-by: Gregory CLEMENT 
---
 drivers/net/dsa/mv88e6xxx/chip.c  | 54 ++--
 drivers/net/dsa/mv88e6xxx/mv88e6xxx.h | 19 +-
 2 files changed, 69 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 7d942f8a42a7..00db33ca1696 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -664,6 +664,11 @@ static bool mv88e6xxx_6320_family(struct mv88e6xxx_chip 
*chip)
return chip->info->family == MV88E6XXX_FAMILY_6320;
 }
 
+static bool mv88e6xxx_6341_family(struct mv88e6xxx_chip *chip)
+{
+   return chip->info->family == MV88E6XXX_FAMILY_6341;
+}
+
 static bool mv88e6xxx_6351_family(struct mv88e6xxx_chip *chip)
 {
return chip->info->family == MV88E6XXX_FAMILY_6351;
@@ -1688,7 +1693,8 @@ static int _mv88e6xxx_vtu_new(struct mv88e6xxx_chip 
*chip, u16 vid,
: GLOBAL_VTU_DATA_MEMBER_TAG_NON_MEMBER;
 
if (mv88e6xxx_6097_family(chip) || mv88e6xxx_6165_family(chip) ||
-   mv88e6xxx_6351_family(chip) || mv88e6xxx_6352_family(chip)) {
+   mv88e6xxx_6351_family(chip) || mv88e6xxx_6352_family(chip) ||
+   mv88e6xxx_6341_family(chip)) {
struct mv88e6xxx_vtu_entry vstp;
 
/* Adding a VTU entry requires a valid STU entry. As VSTP is not
@@ -2543,7 +2549,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip 
*chip, int port)
if (mv88e6xxx_6352_family(chip) || mv88e6xxx_6351_family(chip) ||
mv88e6xxx_6165_family(chip) || mv88e6xxx_6097_family(chip) ||
mv88e6xxx_6095_family(chip) || mv88e6xxx_6320_family(chip) ||
-   mv88e6xxx_6185_family(chip))
+   mv88e6xxx_6185_family(chip) || mv88e6xxx_6341_family(chip))
reg = PORT_CONTROL_2_MAP_DA;
 
if (mv88e6xxx_6095_family(chip) || mv88e6xxx_6185_family(chip)) {
@@ -2597,7 +2603,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip 
*chip, int port)
 
if (mv88e6xxx_6352_family(chip) || mv88e6xxx_6351_family(chip) ||
mv88e6xxx_6165_family(chip) || mv88e6xxx_6097_family(chip) ||
-   mv88e6xxx_6320_family(chip)) {
+   mv88e6xxx_6320_family(chip) || mv88e6xxx_6341_family(chip)) {
/* Port ATU control: disable limiting the number of
 * address database entries that this port is allowed
 * to use.
@@ -3566,6 +3572,34 @@ static const struct mv88e6xxx_ops mv88e6352_ops = {
.reset = mv88e6352_g1_reset,
 };
 
+static const struct mv88e6xxx_ops mv88e6341_ops = {
+   /* MV88E6XXX_FAMILY_6341 */
+   .get_eeprom = mv88e6xxx_g2_get_eeprom8,
+   .set_eeprom = mv88e6xxx_g2_set_eeprom8,
+   .set_switch_mac = mv88e6xxx_g2_set_switch_mac,
+   .phy_read = mv88e6xxx_g2_smi_phy_read,
+   .phy_write = mv88e6xxx_g2_smi_phy_write,
+   .port_set_link = mv88e6xxx_port_set_link,
+   .port_set_duplex = mv88e6xxx_port_set_duplex,
+   .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay,
+   .port_set_speed = mv88e6390_port_set_speed,
+   .port_tag_remap = mv88e6095_port_tag_remap,
+   .port_set_frame_mode = mv88e6351_port_set_frame_mode,
+   .port_set_egress_unknowns = mv88e6351_port_set_egress_unknowns,
+   .port_set_ether_type = mv88e6351_port_set_ether_type,
+   .port_jumbo_config = mv88e6165_port_jumbo_config,
+   .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting,
+   .port_pause_config = mv88e6097_port_pause_config,
+   .stats_snapshot = mv88e6390_g1_stats_snapshot,
+   .stats_get_sset_count = mv88e6320_stats_get_sset_count,
+   .stats_get_strings = mv88e6320_stats_get_strings,
+   .stats_get_stats = mv88e6390_stats_get_stats,
+   .g1_set_cpu_port = mv88e6390_g1_set_cpu_port,
+   .g1_set_egress_port = mv88e6390_g1_set_egress_port,
+   .mgmt_rsvd2cpu =  mv88e6390_g1_mgmt_rsvd2cpu,
+   .reset = mv88e6352_g1_reset,
+};
+
 static const struct mv88e6xxx_ops mv88e6390_ops = {
/* MV88E6XXX_FAMILY_6390 */
.get_eeprom = mv88e6xxx_g2_get_eeprom8,
@@ -3953,6 +3987,20 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
.ops = _ops,
},
 
+   [MV88E6341] = {
+   .prod_num = PORT_SWITCH_ID_PROD_NUM_6341,
+   .family = MV88E6XXX_FAMILY_6341,
+   .name = "Marvell 88E6341",
+   .num_databases = 4096,
+   .num_ports = 6,
+   .port_base_addr = 0x10,
+   .global1_addr = 0x1b,
+