2020-02-27 15:43:46

by Antoine Tenart

[permalink] [raw]
Subject: [PATCH net-next 0/2] net: phy: mscc: support LOS active low

Hello,

This series adds a device tree property for the VSC8584 PHY family to
describe the LOS pin connected to the PHY as being active low. This new
property is then used in the MSCC PHY driver.

Thanks!
Antoine

Antoine Tenart (2):
dt-bindings: net: phy: mscc: document LOS active low property
net: phy: mscc: support LOS being active low

Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt | 1 +
drivers/net/phy/mscc.c | 7 +++++++
2 files changed, 8 insertions(+)

--
2.24.1


2020-02-27 15:43:46

by Antoine Tenart

[permalink] [raw]
Subject: [PATCH net-next 2/2] net: phy: mscc: support LOS being active low

This patch adds support for describing the LOS pin as being active low
when using MSCC PHYs.

Signed-off-by: Antoine Tenart <[email protected]>
---
drivers/net/phy/mscc.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
index 56d6a45a90c2..3755919b03e8 100644
--- a/drivers/net/phy/mscc.c
+++ b/drivers/net/phy/mscc.c
@@ -172,6 +172,7 @@ enum macsec_bank {
#define VALID_CRC_CNT_CRC_MASK GENMASK(13, 0)

#define MSCC_PHY_EXT_MODE_CNTL 19
+#define SIGDET_ACTIVE_LOW BIT(0)
#define FORCE_MDI_CROSSOVER_MASK 0x000C
#define FORCE_MDI_CROSSOVER_MDIX 0x000C
#define FORCE_MDI_CROSSOVER_MDI 0x0008
@@ -2688,6 +2689,7 @@ static int vsc8584_config_init(struct phy_device *phydev)
{
u32 skew_rx = VSC8584_RGMII_SKEW_0_2, skew_tx = VSC8584_RGMII_SKEW_0_2;
struct vsc8531_private *vsc8531 = phydev->priv;
+ struct device *dev = &phydev->mdio.dev;
u16 addr, val;
int ret, i;

@@ -2831,6 +2833,11 @@ static int vsc8584_config_init(struct phy_device *phydev)
(VSC8584_MAC_IF_SELECTION_SGMII << VSC8584_MAC_IF_SELECTION_POS);
ret = phy_write(phydev, MSCC_PHY_EXT_PHY_CNTL_1, val);

+ if (of_property_read_bool(dev->of_node, "vsc8584,los-active-low"))
+ phy_modify_paged(phydev, MSCC_PHY_PAGE_EXTENDED,
+ MSCC_PHY_EXT_MODE_CNTL, SIGDET_ACTIVE_LOW,
+ SIGDET_ACTIVE_LOW);
+
ret = genphy_soft_reset(phydev);
if (ret)
return ret;
--
2.24.1

2020-02-27 15:44:38

by Antoine Tenart

[permalink] [raw]
Subject: [PATCH net-next 1/2] dt-bindings: net: phy: mscc: document LOS active low property

This patch adds a "vsc8584,los-active-low" property to denote when the
LOS signal connected directly to the PHY is active low.

Signed-off-by: Antoine Tenart <[email protected]>
---
Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt b/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
index c682b6e74b14..24faee3cfebf 100644
--- a/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
+++ b/Documentation/devicetree/bindings/net/mscc-phy-vsc8531.txt
@@ -39,6 +39,7 @@ Optional properties:
Allowed values are defined in
"include/dt-bindings/net/mscc-phy-vsc8531.h".
Default value is VSC8584_RGMII_SKEW_0_2.
+- vsc8584,los-active-low : If set, indicates the LOS pin is active low.


Table: 1 - Edge rate change
--
2.24.1

2020-02-27 15:55:21

by Andrew Lunn

[permalink] [raw]
Subject: Re: [PATCH net-next 0/2] net: phy: mscc: support LOS active low

On Thu, Feb 27, 2020 at 04:40:31PM +0100, Antoine Tenart wrote:
> Hello,
>
> This series adds a device tree property for the VSC8584 PHY family to
> describe the LOS pin connected to the PHY as being active low. This new
> property is then used in the MSCC PHY driver.

Hi Antoine

I think i'm missing the big picture.

Is this for when an SFP is connected directly to the PHY? The SFP
output LOS, indicating loss of received fibre/copper signal, is active
low?

Andrew

2020-02-27 16:11:48

by Antoine Tenart

[permalink] [raw]
Subject: Re: [PATCH net-next 0/2] net: phy: mscc: support LOS active low

Hello Andrew,

On Thu, Feb 27, 2020 at 04:54:40PM +0100, Andrew Lunn wrote:
> On Thu, Feb 27, 2020 at 04:40:31PM +0100, Antoine Tenart wrote:
> >
> > This series adds a device tree property for the VSC8584 PHY family to
> > describe the LOS pin connected to the PHY as being active low. This new
> > property is then used in the MSCC PHY driver.
>
> I think i'm missing the big picture.
>
> Is this for when an SFP is connected directly to the PHY? The SFP
> output LOS, indicating loss of received fibre/copper signal, is active
> low?

Yes, the SFP cage can be connected directly to the PHY, and the SFP LOS
signal is active low (there's a pull-up on the LOS line).

Also, I realized I send this series before my other patches adding
support for fibre mode on this PHY, so it may make more sense to send
this one after.

Thanks!
Antoine

--
Antoine T?nart, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2020-03-01 05:25:00

by David Miller

[permalink] [raw]
Subject: Re: [PATCH net-next 0/2] net: phy: mscc: support LOS active low

From: Antoine Tenart <[email protected]>
Date: Thu, 27 Feb 2020 17:10:10 +0100

> Hello Andrew,
>
> On Thu, Feb 27, 2020 at 04:54:40PM +0100, Andrew Lunn wrote:
>> On Thu, Feb 27, 2020 at 04:40:31PM +0100, Antoine Tenart wrote:
>> >
>> > This series adds a device tree property for the VSC8584 PHY family to
>> > describe the LOS pin connected to the PHY as being active low. This new
>> > property is then used in the MSCC PHY driver.
>>
>> I think i'm missing the big picture.
>>
>> Is this for when an SFP is connected directly to the PHY? The SFP
>> output LOS, indicating loss of received fibre/copper signal, is active
>> low?
>
> Yes, the SFP cage can be connected directly to the PHY, and the SFP LOS
> signal is active low (there's a pull-up on the LOS line).
>
> Also, I realized I send this series before my other patches adding
> support for fibre mode on this PHY, so it may make more sense to send
> this one after.

Please do so, I'll mark these as deferred in patchwork.

2020-03-01 11:37:42

by Sergei Shtylyov

[permalink] [raw]
Subject: Re: [PATCH net-next 1/2] dt-bindings: net: phy: mscc: document LOS active low property

Hello!

On 27.02.2020 18:40, Antoine Tenart wrote:

> This patch adds a "vsc8584,los-active-low" property to denote when the

The part before comma is supposed to be a vendor name, no?

> LOS signal connected directly to the PHY is active low.
>
> Signed-off-by: Antoine Tenart <[email protected]>
[...]

MBR, Sergei