* [PATCH net-next 1/2] net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390
2017-01-25 1:55 [PATCH net-next 0/2] Work around missing PHY prodcut ID in mv88e6390 Andrew Lunn
@ 2017-01-25 1:55 ` Andrew Lunn
2017-01-25 17:27 ` Gregory CLEMENT
2017-01-26 12:06 ` Gregory CLEMENT
2017-01-25 1:55 ` [PATCH net-next 2/2] net: phy: Marvell: Add mv88e6390 internal PHY Andrew Lunn
` (2 subsequent siblings)
3 siblings, 2 replies; 17+ messages in thread
From: Andrew Lunn @ 2017-01-25 1:55 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Vivien Didelot, Gregory Clement, Andrew Lunn
The internal PHYs of the mv88e6390 do not have a model ID. Trap any
calls to the ID register, and if it is zero, return the ID for the
mv88e6390. The Marvell PHY driver can then bind to this ID.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/dsa/mv88e6xxx/global2.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/net/dsa/mv88e6xxx/global2.c b/drivers/net/dsa/mv88e6xxx/global2.c
index 353e26bea3c3..521a5511bd5f 100644
--- a/drivers/net/dsa/mv88e6xxx/global2.c
+++ b/drivers/net/dsa/mv88e6xxx/global2.c
@@ -520,7 +520,21 @@ int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
if (err)
return err;
- return mv88e6xxx_g2_read(chip, GLOBAL2_SMI_PHY_DATA, val);
+ err = mv88e6xxx_g2_read(chip, GLOBAL2_SMI_PHY_DATA, val);
+ if (err)
+ return err;
+
+ if (reg == MII_PHYSID2) {
+ /* The mv88e6390 internal PHYS don't have a model number.
+ * Use the switch family model number instead.
+ */
+ if (!(*val & 0x3ff)) {
+ if (chip->info->family == MV88E6XXX_FAMILY_6390)
+ *val |= PORT_SWITCH_ID_PROD_NUM_6390;
+ }
+ }
+
+ return 0;
}
int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
--
2.11.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390
2017-01-25 1:55 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390 Andrew Lunn
@ 2017-01-25 17:27 ` Gregory CLEMENT
2017-01-25 17:45 ` Vivien Didelot
` (2 more replies)
2017-01-26 12:06 ` Gregory CLEMENT
1 sibling, 3 replies; 17+ messages in thread
From: Gregory CLEMENT @ 2017-01-25 17:27 UTC (permalink / raw)
To: Andrew Lunn; +Cc: David Miller, netdev, Vivien Didelot
Hi Andrew,
On mer., janv. 25 2017, Andrew Lunn <andrew@lunn.ch> wrote:
> The internal PHYs of the mv88e6390 do not have a model ID. Trap any
> calls to the ID register, and if it is zero, return the ID for the
> mv88e6390. The Marvell PHY driver can then bind to this ID.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> drivers/net/dsa/mv88e6xxx/global2.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/dsa/mv88e6xxx/global2.c b/drivers/net/dsa/mv88e6xxx/global2.c
> index 353e26bea3c3..521a5511bd5f 100644
> --- a/drivers/net/dsa/mv88e6xxx/global2.c
> +++ b/drivers/net/dsa/mv88e6xxx/global2.c
> @@ -520,7 +520,21 @@ int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
> if (err)
> return err;
>
> - return mv88e6xxx_g2_read(chip, GLOBAL2_SMI_PHY_DATA, val);
> + err = mv88e6xxx_g2_read(chip, GLOBAL2_SMI_PHY_DATA, val);
> + if (err)
> + return err;
> +
> + if (reg == MII_PHYSID2) {
> + /* The mv88e6390 internal PHYS don't have a model number.
> + * Use the switch family model number instead.
> + */
> + if (!(*val & 0x3ff)) {
I tested this series on the Topaz switch but it failed because while I
said we read 0x1410C00 actually we read 0x01410C01. With the
MARVELL_PHY_ID_MASK we mask the 4 lower bits so that's why in my patch
"phy: marvell: Add support for the PHY embedded in the topaz switch" I
used the 0x01410C00 value for MARVELL_PHY_ID_88E6141.
However with the mask you use it doesn't work.
So this mask should be changed to 0x3f0 for the Topaz. Actually 0x3fe
would be enough but it seems more logical to use the same mask that for
MARVELL_PHY_ID_MASK.
We could either use the same mask for both family and still use 6390 as
they seem compatible or we use two different families based on the lower
bit.
Gregory
> + if (chip->info->family == MV88E6XXX_FAMILY_6390)
> + *val |= PORT_SWITCH_ID_PROD_NUM_6390;
> + }
> + }
> +
> + return 0;
> }
>
> int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
> --
> 2.11.0
>
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390
2017-01-25 17:27 ` Gregory CLEMENT
@ 2017-01-25 17:45 ` Vivien Didelot
2017-01-25 18:00 ` Andrew Lunn
2017-01-25 18:03 ` Vivien Didelot
2017-01-25 17:51 ` Florian Fainelli
2017-01-25 17:52 ` Andrew Lunn
2 siblings, 2 replies; 17+ messages in thread
From: Vivien Didelot @ 2017-01-25 17:45 UTC (permalink / raw)
To: Gregory CLEMENT, Andrew Lunn; +Cc: David Miller, netdev
Hi Gregory, Andrew,
Gregory CLEMENT <gregory.clement@free-electrons.com> writes:
>> + if (reg == MII_PHYSID2) {
>> + /* The mv88e6390 internal PHYS don't have a model number.
>> + * Use the switch family model number instead.
>> + */
>> + if (!(*val & 0x3ff)) {
>
> I tested this series on the Topaz switch but it failed because while I
> said we read 0x1410C00 actually we read 0x01410C01. With the
> MARVELL_PHY_ID_MASK we mask the 4 lower bits so that's why in my patch
> "phy: marvell: Add support for the PHY embedded in the topaz switch" I
> used the 0x01410C00 value for MARVELL_PHY_ID_88E6141.
>
> However with the mask you use it doesn't work.
>
> So this mask should be changed to 0x3f0 for the Topaz. Actually 0x3fe
> would be enough but it seems more logical to use the same mask that for
> MARVELL_PHY_ID_MASK.
>
> We could either use the same mask for both family and still use 6390 as
> they seem compatible or we use two different families based on the lower
> bit.
Since several chips have this issue, we can introduce a u16 physid2_mask
member in the mv88e6xxx_info structure and move the check in
mv88e6xxx_phy_read() so that the logic of device (as in Global2) helpers
are not affected by such (necessary) hack. Something like:
static int mv88e6xxx_phy_read(struct mv88e6xxx_chip *chip, int phy,
int reg, u16 *val)
{
...
err = chip->info->ops->phy_read(chip, bus, addr, reg, val);
if (err)
return err;
if (reg == MII_PHYSID2 && chip->info->physid2_mask) {
/* Some internal PHYs don't have a model number,
* so return the switch family model number directly.
*/
if (!(*val & chip->info->physid2_mask))
*val |= chip->info->prod_num;
}
return 0;
}
Thanks,
Vivien
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390
2017-01-25 17:45 ` Vivien Didelot
@ 2017-01-25 18:00 ` Andrew Lunn
2017-01-25 18:03 ` Vivien Didelot
1 sibling, 0 replies; 17+ messages in thread
From: Andrew Lunn @ 2017-01-25 18:00 UTC (permalink / raw)
To: Vivien Didelot; +Cc: Gregory CLEMENT, David Miller, netdev
> Since several chips have this issue, we can introduce a u16 physid2_mask
> member in the mv88e6xxx_info structure and move the check in
> mv88e6xxx_phy_read() so that the logic of device (as in Global2) helpers
> are not affected by such (necessary) hack. Something like:
>
> static int mv88e6xxx_phy_read(struct mv88e6xxx_chip *chip, int phy,
> int reg, u16 *val)
> {
> ...
>
> err = chip->info->ops->phy_read(chip, bus, addr, reg, val);
> if (err)
> return err;
>
> if (reg == MII_PHYSID2 && chip->info->physid2_mask) {
> /* Some internal PHYs don't have a model number,
> * so return the switch family model number directly.
> */
> if (!(*val & chip->info->physid2_mask))
Hi Vivien
I don't see the need to have per switch masks. Lets just hard code it
to ignore the lower 4 bits.
> *val |= chip->info->prod_num;
and this is not good. I deliberately picked the family num, not the
product num. Otherwise for the 6390 family, we have 6 different PHY
IDs. And two more for Gregorys two switches.
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390
2017-01-25 17:45 ` Vivien Didelot
2017-01-25 18:00 ` Andrew Lunn
@ 2017-01-25 18:03 ` Vivien Didelot
2017-01-25 19:30 ` Andrew Lunn
1 sibling, 1 reply; 17+ messages in thread
From: Vivien Didelot @ 2017-01-25 18:03 UTC (permalink / raw)
To: Gregory CLEMENT, Andrew Lunn; +Cc: David Miller, netdev
Andrew,
Vivien Didelot <vivien.didelot@savoirfairelinux.com> writes:
> Since several chips have this issue, we can introduce a u16 physid2_mask
> member in the mv88e6xxx_info structure and move the check in
> mv88e6xxx_phy_read() so that the logic of device (as in Global2) helpers
> are not affected by such (necessary) hack. Something like:
>
> static int mv88e6xxx_phy_read(struct mv88e6xxx_chip *chip, int phy,
> int reg, u16 *val)
> {
> ...
>
> err = chip->info->ops->phy_read(chip, bus, addr, reg, val);
> if (err)
> return err;
>
> if (reg == MII_PHYSID2 && chip->info->physid2_mask) {
> /* Some internal PHYs don't have a model number,
> * so return the switch family model number directly.
> */
> if (!(*val & chip->info->physid2_mask))
> *val |= chip->info->prod_num;
if (reg == MII_PHYSID2 && (*val & 0xfff0) == 0)
*val |= chip->info->prod_num << 4;
then. Do you agree?
> }
>
> return 0;
> }
Thanks,
Vivien
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390
2017-01-25 18:03 ` Vivien Didelot
@ 2017-01-25 19:30 ` Andrew Lunn
2017-01-25 19:37 ` Vivien Didelot
0 siblings, 1 reply; 17+ messages in thread
From: Andrew Lunn @ 2017-01-25 19:30 UTC (permalink / raw)
To: Vivien Didelot; +Cc: Gregory CLEMENT, David Miller, netdev
On Wed, Jan 25, 2017 at 01:03:43PM -0500, Vivien Didelot wrote:
> Andrew,
>
> Vivien Didelot <vivien.didelot@savoirfairelinux.com> writes:
>
> > Since several chips have this issue, we can introduce a u16 physid2_mask
> > member in the mv88e6xxx_info structure and move the check in
> > mv88e6xxx_phy_read() so that the logic of device (as in Global2) helpers
> > are not affected by such (necessary) hack. Something like:
> >
> > static int mv88e6xxx_phy_read(struct mv88e6xxx_chip *chip, int phy,
> > int reg, u16 *val)
> > {
> > ...
> >
> > err = chip->info->ops->phy_read(chip, bus, addr, reg, val);
> > if (err)
> > return err;
> >
> > if (reg == MII_PHYSID2 && chip->info->physid2_mask) {
> > /* Some internal PHYs don't have a model number,
> > * so return the switch family model number directly.
> > */
> > if (!(*val & chip->info->physid2_mask))
> > *val |= chip->info->prod_num;
>
> if (reg == MII_PHYSID2 && (*val & 0xfff0) == 0)
This should be 0x3f0. There are 10 bits for the device model, of which
Marvell uses the lowest 4 for version.
> *val |= chip->info->prod_num << 4;
#define PORT_SWITCH_ID_PROD_NUM_6190 0x190
#define PORT_SWITCH_ID_PROD_NUM_6190X 0x0a0
#define PORT_SWITCH_ID_PROD_NUM_6191 0x191
#define PORT_SWITCH_ID_PROD_NUM_6290 0x290
#define PORT_SWITCH_ID_PROD_NUM_6390 0x390
#define PORT_SWITCH_ID_PROD_NUM_6390X 0x0a1
That still gives us 6 different PHY IDs, and the shift will cause is
to modify the OUI, so it is no longer a Marvell OUI.
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390
2017-01-25 19:30 ` Andrew Lunn
@ 2017-01-25 19:37 ` Vivien Didelot
0 siblings, 0 replies; 17+ messages in thread
From: Vivien Didelot @ 2017-01-25 19:37 UTC (permalink / raw)
To: Andrew Lunn; +Cc: Gregory CLEMENT, David Miller, netdev
Hi Andrew,
Andrew Lunn <andrew@lunn.ch> writes:
>> if (reg == MII_PHYSID2 && (*val & 0xfff0) == 0)
>
> This should be 0x3f0. There are 10 bits for the device model, of which
> Marvell uses the lowest 4 for version.
>
>> *val |= chip->info->prod_num << 4;
>
> #define PORT_SWITCH_ID_PROD_NUM_6190 0x190
> #define PORT_SWITCH_ID_PROD_NUM_6190X 0x0a0
> #define PORT_SWITCH_ID_PROD_NUM_6191 0x191
> #define PORT_SWITCH_ID_PROD_NUM_6290 0x290
> #define PORT_SWITCH_ID_PROD_NUM_6390 0x390
> #define PORT_SWITCH_ID_PROD_NUM_6390X 0x0a1
>
> That still gives us 6 different PHY IDs, and the shift will cause is
> to modify the OUI, so it is no longer a Marvell OUI.
OK, this is fine with the Marvell mask then. Can you move the check in
the higher mv88e6xxx_phy_read() function when you respin please?
Thanks!
Vivien
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390
2017-01-25 17:27 ` Gregory CLEMENT
2017-01-25 17:45 ` Vivien Didelot
@ 2017-01-25 17:51 ` Florian Fainelli
2017-01-25 17:52 ` Andrew Lunn
2 siblings, 0 replies; 17+ messages in thread
From: Florian Fainelli @ 2017-01-25 17:51 UTC (permalink / raw)
To: Gregory CLEMENT, Andrew Lunn; +Cc: David Miller, netdev, Vivien Didelot
On 01/25/2017 09:27 AM, Gregory CLEMENT wrote:
> Hi Andrew,
>
> On mer., janv. 25 2017, Andrew Lunn <andrew@lunn.ch> wrote:
>
>> The internal PHYs of the mv88e6390 do not have a model ID. Trap any
>> calls to the ID register, and if it is zero, return the ID for the
>> mv88e6390. The Marvell PHY driver can then bind to this ID.
>>
>> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
>> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>> drivers/net/dsa/mv88e6xxx/global2.c | 16 +++++++++++++++-
>> 1 file changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/dsa/mv88e6xxx/global2.c b/drivers/net/dsa/mv88e6xxx/global2.c
>> index 353e26bea3c3..521a5511bd5f 100644
>> --- a/drivers/net/dsa/mv88e6xxx/global2.c
>> +++ b/drivers/net/dsa/mv88e6xxx/global2.c
>> @@ -520,7 +520,21 @@ int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
>> if (err)
>> return err;
>>
>> - return mv88e6xxx_g2_read(chip, GLOBAL2_SMI_PHY_DATA, val);
>> + err = mv88e6xxx_g2_read(chip, GLOBAL2_SMI_PHY_DATA, val);
>> + if (err)
>> + return err;
>> +
>> + if (reg == MII_PHYSID2) {
>> + /* The mv88e6390 internal PHYS don't have a model number.
>> + * Use the switch family model number instead.
>> + */
>> + if (!(*val & 0x3ff)) {
>
> I tested this series on the Topaz switch but it failed because while I
> said we read 0x1410C00 actually we read 0x01410C01. With the
> MARVELL_PHY_ID_MASK we mask the 4 lower bits so that's why in my patch
> "phy: marvell: Add support for the PHY embedded in the topaz switch" I
> used the 0x01410C00 value for MARVELL_PHY_ID_88E6141.
>
> However with the mask you use it doesn't work.
>
> So this mask should be changed to 0x3f0 for the Topaz. Actually 0x3fe
> would be enough but it seems more logical to use the same mask that for
> MARVELL_PHY_ID_MASK.
>
> We could either use the same mask for both family and still use 6390 as
> they seem compatible or we use two different families based on the lower
> bit.
By convention, the lower 4 bits are used to carry revision information,
which is why most drivers use 0xxxxx_fff0, can you try to use that here
for the PHY mask value?
--
Florian
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390
2017-01-25 17:27 ` Gregory CLEMENT
2017-01-25 17:45 ` Vivien Didelot
2017-01-25 17:51 ` Florian Fainelli
@ 2017-01-25 17:52 ` Andrew Lunn
2 siblings, 0 replies; 17+ messages in thread
From: Andrew Lunn @ 2017-01-25 17:52 UTC (permalink / raw)
To: Gregory CLEMENT; +Cc: David Miller, netdev, Vivien Didelot
> I tested this series on the Topaz switch but it failed because while I
> said we read 0x1410C00 actually we read 0x01410C01. With the
> MARVELL_PHY_ID_MASK we mask the 4 lower bits so that's why in my patch
> "phy: marvell: Add support for the PHY embedded in the topaz switch" I
> used the 0x01410C00 value for MARVELL_PHY_ID_88E6141.
O.K. The lower 4 bits seem to be the silicon revision. Marvells own
SDK ignores those bits. So lets do the same here, use
MARVELL_PHY_ID_MASK.
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net-next 1/2] net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390
2017-01-25 1:55 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390 Andrew Lunn
2017-01-25 17:27 ` Gregory CLEMENT
@ 2017-01-26 12:06 ` Gregory CLEMENT
1 sibling, 0 replies; 17+ messages in thread
From: Gregory CLEMENT @ 2017-01-26 12:06 UTC (permalink / raw)
To: Andrew Lunn; +Cc: David Miller, netdev, Vivien Didelot
Hi Andrew,
> - return mv88e6xxx_g2_read(chip, GLOBAL2_SMI_PHY_DATA, val);
> + err = mv88e6xxx_g2_read(chip, GLOBAL2_SMI_PHY_DATA, val);
> + if (err)
> + return err;
> +
> + if (reg == MII_PHYSID2) {
> + /* The mv88e6390 internal PHYS don't have a model number.
> + * Use the switch family model number instead.
> + */
> + if (!(*val & 0x3ff)) {
> + if (chip->info->family == MV88E6XXX_FAMILY_6390)
I needed to test the MV88E6XXX_FAMILY_6341 flag too. But this one have
to be done in my series because before it the flag is not introduced.
As pointed in the other patch, we still need to decide to use the sale
PHY ID or to use a new one.
Thanks,
Gregory
> + *val |= PORT_SWITCH_ID_PROD_NUM_6390;
> + }
> + }
> +
> + return 0;
> }
>
> int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
> --
> 2.11.0
>
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH net-next 2/2] net: phy: Marvell: Add mv88e6390 internal PHY
2017-01-25 1:55 [PATCH net-next 0/2] Work around missing PHY prodcut ID in mv88e6390 Andrew Lunn
2017-01-25 1:55 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390 Andrew Lunn
@ 2017-01-25 1:55 ` Andrew Lunn
2017-01-26 12:01 ` Gregory CLEMENT
2017-01-25 1:59 ` [PATCH net-next 0/2] Work around missing PHY prodcut ID in mv88e6390 Andrew Lunn
2017-01-25 18:25 ` David Miller
3 siblings, 1 reply; 17+ messages in thread
From: Andrew Lunn @ 2017-01-25 1:55 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Vivien Didelot, Gregory Clement, Andrew Lunn
The mv88e6390 Ethernet switch has internal PHYs. These PHYs don't have
an model ID in the ID2 register. So the MDIO driver in the switch
intercepts reads to this register, and returns the switch family ID.
Extend the Marvell PHY driver by including this ID, and tread the PHY
as a 88E1540.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/phy/marvell.c | 20 ++++++++++++++++++++
include/linux/marvell_phy.h | 6 ++++++
2 files changed, 26 insertions(+)
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index b5b73ff4329a..9debe1a4a6f6 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -2140,6 +2140,25 @@ static struct phy_driver marvell_drivers[] = {
.get_strings = marvell_get_strings,
.get_stats = marvell_get_stats,
},
+ {
+ .phy_id = MARVELL_PHY_ID_88E6390,
+ .phy_id_mask = MARVELL_PHY_ID_MASK,
+ .name = "Marvell 88E6390",
+ .features = PHY_GBIT_FEATURES,
+ .flags = PHY_HAS_INTERRUPT,
+ .probe = marvell_probe,
+ .config_init = &marvell_config_init,
+ .config_aneg = &m88e1510_config_aneg,
+ .read_status = &marvell_read_status,
+ .ack_interrupt = &marvell_ack_interrupt,
+ .config_intr = &marvell_config_intr,
+ .did_interrupt = &m88e1121_did_interrupt,
+ .resume = &genphy_resume,
+ .suspend = &genphy_suspend,
+ .get_sset_count = marvell_get_sset_count,
+ .get_strings = marvell_get_strings,
+ .get_stats = marvell_get_stats,
+ },
};
module_phy_driver(marvell_drivers);
@@ -2158,6 +2177,7 @@ static struct mdio_device_id __maybe_unused marvell_tbl[] = {
{ MARVELL_PHY_ID_88E1510, MARVELL_PHY_ID_MASK },
{ MARVELL_PHY_ID_88E1540, MARVELL_PHY_ID_MASK },
{ MARVELL_PHY_ID_88E3016, MARVELL_PHY_ID_MASK },
+ { MARVELL_PHY_ID_88E6390, MARVELL_PHY_ID_MASK },
{ }
};
diff --git a/include/linux/marvell_phy.h b/include/linux/marvell_phy.h
index a57f0dfb6db7..3d616d7f65bf 100644
--- a/include/linux/marvell_phy.h
+++ b/include/linux/marvell_phy.h
@@ -19,6 +19,12 @@
#define MARVELL_PHY_ID_88E1540 0x01410eb0
#define MARVELL_PHY_ID_88E3016 0x01410e60
+/* The MV88e6390 Ethernet switch contains embedded PHYs. These PHYs do
+ * not have a model ID. So the switch driver traps reads to the ID2
+ * register and returns the switch family ID
+ */
+#define MARVELL_PHY_ID_88E6390 0x01410f90
+
/* struct phy_device dev_flags definitions */
#define MARVELL_PHY_M1145_FLAGS_RESISTANCE 0x00000001
#define MARVELL_PHY_M1118_DNS323_LEDS 0x00000002
--
2.11.0
^ permalink raw reply related [flat|nested] 17+ messages in thread* Re: [PATCH net-next 2/2] net: phy: Marvell: Add mv88e6390 internal PHY
2017-01-25 1:55 ` [PATCH net-next 2/2] net: phy: Marvell: Add mv88e6390 internal PHY Andrew Lunn
@ 2017-01-26 12:01 ` Gregory CLEMENT
2017-01-26 14:16 ` Andrew Lunn
0 siblings, 1 reply; 17+ messages in thread
From: Gregory CLEMENT @ 2017-01-26 12:01 UTC (permalink / raw)
To: Andrew Lunn; +Cc: David Miller, netdev, Vivien Didelot
Hi Andrew,
On mer., janv. 25 2017, Andrew Lunn <andrew@lunn.ch> wrote:
> diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
> index b5b73ff4329a..9debe1a4a6f6 100644
> --- a/drivers/net/phy/marvell.c
> +++ b/drivers/net/phy/marvell.c
> @@ -2140,6 +2140,25 @@ static struct phy_driver marvell_drivers[] = {
> .get_strings = marvell_get_strings,
> .get_stats = marvell_get_stats,
> },
> + {
> + .phy_id = MARVELL_PHY_ID_88E6390,
> + .phy_id_mask = MARVELL_PHY_ID_MASK,
> + .name = "Marvell 88E6390",
> + .features = PHY_GBIT_FEATURES,
> + .flags = PHY_HAS_INTERRUPT,
> + .probe = marvell_probe,
In order to get the temperature support I also had to modify the line
above by using m88e1510_probe instead of the marvell_probe. Indeed the
hwmon register was not done marvell_probe.
I think that you use marvell_probe because currently the value you get
are wrong for 6390. So either we have the 6390 which returns an
incorrect value for the temperature until you find the correct setting
or we introduce a new phy_id for the 6341 family with the hwmon support.
Gregory
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH net-next 2/2] net: phy: Marvell: Add mv88e6390 internal PHY
2017-01-26 12:01 ` Gregory CLEMENT
@ 2017-01-26 14:16 ` Andrew Lunn
0 siblings, 0 replies; 17+ messages in thread
From: Andrew Lunn @ 2017-01-26 14:16 UTC (permalink / raw)
To: Gregory CLEMENT; +Cc: David Miller, netdev, Vivien Didelot
On Thu, Jan 26, 2017 at 01:01:06PM +0100, Gregory CLEMENT wrote:
> Hi Andrew,
>
> On mer., janv. 25 2017, Andrew Lunn <andrew@lunn.ch> wrote:
>
>
> > diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
> > index b5b73ff4329a..9debe1a4a6f6 100644
> > --- a/drivers/net/phy/marvell.c
> > +++ b/drivers/net/phy/marvell.c
> > @@ -2140,6 +2140,25 @@ static struct phy_driver marvell_drivers[] = {
> > .get_strings = marvell_get_strings,
> > .get_stats = marvell_get_stats,
> > },
> > + {
> > + .phy_id = MARVELL_PHY_ID_88E6390,
> > + .phy_id_mask = MARVELL_PHY_ID_MASK,
> > + .name = "Marvell 88E6390",
> > + .features = PHY_GBIT_FEATURES,
> > + .flags = PHY_HAS_INTERRUPT,
> > + .probe = marvell_probe,
>
> In order to get the temperature support I also had to modify the line
> above by using m88e1510_probe instead of the marvell_probe. Indeed the
> hwmon register was not done marvell_probe.
Yes, this is historic.
These patches come from one branch where i have all my mv88e6390
code. I had them in the opposite order to what we have now. I had this
PHY work around first, and then the temperature sensor move patches.
But to get the code into mainline, i pulled the patches apart. The
temperature code has hit mainline first, now follow the PHY ID
workaround. I need to fix this probe call as a result.
Although the temperature sensor does not work yet for the 6390, i'm
going to assume it will at some point work. So i think it is O.K. to
use the same ID, and have the 6390 PHYs return -25000mC until we
figure out what is wrong.
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net-next 0/2] Work around missing PHY prodcut ID in mv88e6390
2017-01-25 1:55 [PATCH net-next 0/2] Work around missing PHY prodcut ID in mv88e6390 Andrew Lunn
2017-01-25 1:55 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: Workaround missing PHY ID on mv88e6390 Andrew Lunn
2017-01-25 1:55 ` [PATCH net-next 2/2] net: phy: Marvell: Add mv88e6390 internal PHY Andrew Lunn
@ 2017-01-25 1:59 ` Andrew Lunn
2017-01-25 18:25 ` David Miller
3 siblings, 0 replies; 17+ messages in thread
From: Andrew Lunn @ 2017-01-25 1:59 UTC (permalink / raw)
To: Gregory Clement; +Cc: netdev, Vivien Didelot, Gregory Clement
On Wed, Jan 25, 2017 at 02:55:12AM +0100, Andrew Lunn wrote:
> The internal PHYs of the MV88E6390 have a Marvell OUI, but the product
> ID is zero. Work around this by trapping reads to the ID, and if it is
> zero, return the MV88E6390 family ID.
Hi Gregory
This should just work for your switch as well, the PHY will get the ID
6390. I expect the PHY is compatible with the 6390 PHYs, so i think we
can just leave it as it is. We can change it later, if we do have
compatibility problems.
Andrew
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH net-next 0/2] Work around missing PHY prodcut ID in mv88e6390
2017-01-25 1:55 [PATCH net-next 0/2] Work around missing PHY prodcut ID in mv88e6390 Andrew Lunn
` (2 preceding siblings ...)
2017-01-25 1:59 ` [PATCH net-next 0/2] Work around missing PHY prodcut ID in mv88e6390 Andrew Lunn
@ 2017-01-25 18:25 ` David Miller
2017-01-27 17:12 ` Gregory CLEMENT
3 siblings, 1 reply; 17+ messages in thread
From: David Miller @ 2017-01-25 18:25 UTC (permalink / raw)
To: andrew; +Cc: netdev, vivien.didelot, gregory.clement
From: Andrew Lunn <andrew@lunn.ch>
Date: Wed, 25 Jan 2017 02:55:12 +0100
> The internal PHYs of the MV88E6390 have a Marvell OUI, but the product
> ID is zero. Work around this by trapping reads to the ID, and if it is
> zero, return the MV88E6390 family ID.
Because of the ID masking issue, I am expecting a respin of this.
^ permalink raw reply [flat|nested] 17+ messages in thread* Re: [PATCH net-next 0/2] Work around missing PHY prodcut ID in mv88e6390
2017-01-25 18:25 ` David Miller
@ 2017-01-27 17:12 ` Gregory CLEMENT
0 siblings, 0 replies; 17+ messages in thread
From: Gregory CLEMENT @ 2017-01-27 17:12 UTC (permalink / raw)
To: Andrew Lunn; +Cc: David Miller, netdev, vivien.didelot
Hi Andrew,
On mer., janv. 25 2017, David Miller <davem@davemloft.net> wrote:
> From: Andrew Lunn <andrew@lunn.ch>
> Date: Wed, 25 Jan 2017 02:55:12 +0100
>
>> The internal PHYs of the MV88E6390 have a Marvell OUI, but the product
>> ID is zero. Work around this by trapping reads to the ID, and if it is
>> zero, return the MV88E6390 family ID.
>
> Because of the ID masking issue, I am expecting a respin of this.
Do you think you will send a new version soon?
It is the last missing part to send my v7 for the Topaz support on the
EspressoBin.
Thanks,
Gregory
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 17+ messages in thread