DP83TD510 Single Pair 10Mbps Ethernet PHY
Subsystems (5)
v3 cover DP83TD510 Single Pair 10Mbps Ethernet PHY
Hello
The DP83TD510 is an Ethernet PHY supporting single pair of twisted wires. The PHY is capable of 10Mbps communication over long distances and exceeds the IEEE 802.3cg 10BASE-T1L single-pair Ethernet specification. The PHY supports various voltage level signalling and can be forced to support a specific voltage or allowed to perfrom auto negotiation on the voltage level. The default for the PHY is auto negotiation but if the PHY is forced to a specific voltage then the LP must also support the same voltage.
Add the 10BASE-T1L linkmodes for ethtool to properly advertise the PHY's capability.
Dan
Dan Murphy (4):
ethtool: Add 10base-T1L link mode entries
dt-bindings: net: Add Rx/Tx output configuration for 10base T1L
dt-bindings: dp83td510: Add binding for DP83TD510 Ethernet PHY
net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
.../devicetree/bindings/net/ethernet-phy.yaml | 5 + .../devicetree/bindings/net/ti,dp83td510.yaml | 62 ++ drivers/net/phy/Kconfig | 6 + drivers/net/phy/Makefile | 1 + drivers/net/phy/dp83td510.c | 681 ++++++++++++++++++ drivers/net/phy/phy-core.c | 4 +- include/uapi/linux/ethtool.h | 2 + net/ethtool/common.c | 2 + net/ethtool/linkmodes.c | 2 + 9 files changed, 764 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/net/ti,dp83td510.yaml create mode 100644 drivers/net/phy/dp83td510.c
Signature · 1 line
2.28.0.585.ge1cfff676549
PATCH v3 1/4 ethtool: Add 10base-T1L link mode entries
Add entries for the 10base-T1L full and half duplex supported modes.
$ ethtool eth0
Supported ports: [ TP ]
Supported link modes: 10baseT1L/Half 10baseT1L/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT1L/Half 10baseT1L/Full
Advertised pause frame use: No
Advertised auto-negotiation: No
Advertised FEC modes: Not reported
Speed: 10Mb/s
Duplex: Full
Auto-negotiation: on
Port: MII
PHYAD: 1
Transceiver: external
Supports Wake-on: gs
Wake-on: d
SecureOn password: 00:00:00:00:00:00
Current message level: 0x00000000 (0)Link detected: yes
--- drivers/net/phy/phy-core.c | 4 +++- include/uapi/linux/ethtool.h | 2 ++ net/ethtool/common.c | 2 ++ net/ethtool/linkmodes.c | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-)
drivers/net/phy/phy-core.c +3 -1
@@ -13,7 +13,7 @@*/ const char *phy_speed_to_str (int speed) { -BUILD_BUG_ON_MSG (__ETHTOOL_LINK_MODE_MASK_NBITS !=92 , +BUILD_BUG_ON_MSG (__ETHTOOL_LINK_MODE_MASK_NBITS !=94 ,"Enum ethtool_link_mode_bit_indices and phylib are out of sync. " "If a speed or mode has been added please update phy_speed_to_str " "and the PHY settings array.\n" );
@@ -175,6 +175,8 @@ static const struct phy_setting settings[] = {/* 10M */ PHY_SETTING( 10, FULL, 10baseT_Full ), PHY_SETTING( 10, HALF, 10baseT_Half ), + PHY_SETTING( 10, FULL, 10baseT1L_Full ), + PHY_SETTING( 10, HALF, 10baseT1L_Half ), };#undef PHY_SETTING
include/uapi/linux/ethtool.h +2 -0
@@ -1619,6 +1619,8 @@ enum ethtool_link_mode_bit_indices { ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT =89 , ETHTOOL_LINK_MODE_100baseFX_Half_BIT =90 , ETHTOOL_LINK_MODE_100baseFX_Full_BIT =91 , + ETHTOOL_LINK_MODE_10baseT1L_Half_BIT =92 , + ETHTOOL_LINK_MODE_10baseT1L_Full_BIT =93 ,/* must be last entry */ __ETHTOOL_LINK_MODE_MASK_NBITS };
net/ethtool/common.c +2 -0
@@ -194,6 +194,8 @@ const char link_mode_names[][ETH_GSTRING_LEN] = {__DEFINE_LINK_MODE_NAME (400000 ,CR4 , Full),__DEFINE_LINK_MODE_NAME (100 ,FX , Half),__DEFINE_LINK_MODE_NAME (100 ,FX , Full), +__DEFINE_LINK_MODE_NAME (10 ,T1L , Half), +__DEFINE_LINK_MODE_NAME (10 ,T1L , Full), };static_assert (ARRAY_SIZE (link_mode_names) == __ETHTOOL_LINK_MODE_MASK_NBITS);
net/ethtool/linkmodes.c +2 -0
@@ -264,6 +264,8 @@ static const struct link_mode_info link_mode_params[] = {__DEFINE_LINK_MODE_PARAMS (400000 ,CR4 , Full),__DEFINE_LINK_MODE_PARAMS (100 ,FX , Half),__DEFINE_LINK_MODE_PARAMS (100 ,FX , Full), +__DEFINE_LINK_MODE_PARAMS (10 ,T1L , Half), + __DEFINE_LINK_MODE_PARAMS(10, T1L, Full), }; const struct nla_policy ethnl_linkmodes_set_policy[] = {
Signature · 1 line
2.28.0.585.ge1cfff676549
Re: [PATCH net-next v3 1/4] ethtool: Add 10base-T1L link mode entries
Quoted 23 lines · Dan Murphy
Add entries for the 10base-T1L full and half duplex supported modes.
$ ethtool eth0 Supported ports: [ TP ] Supported link modes: 10baseT1L/Half 10baseT1L/Full Supported pause frame use: Symmetric Receive-only Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 10baseT1L/Half 10baseT1L/Full Advertised pause frame use: No Advertised auto-negotiation: No Advertised FEC modes: Not reported Speed: 10Mb/s Duplex: Full Auto-negotiation: on Port: MII PHYAD: 1 Transceiver: external Supports Wake-on: gs Wake-on: d SecureOn password: 00:00:00:00:00:00 Current message level: 0x00000000 (0)
Quoted 3 lines
Link detected: yes
Signed-off-by Dan Murphy <[email protected]>
Andrew
Re: [PATCH net-next v3 1/4] ethtool: Add 10base-T1L link mode entries
In reply to Dan MurphyQuoted 23 lines · Dan Murphy
Add entries for the 10base-T1L full and half duplex supported modes.
$ ethtool eth0 Supported ports: [ TP ] Supported link modes: 10baseT1L/Half 10baseT1L/Full Supported pause frame use: Symmetric Receive-only Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 10baseT1L/Half 10baseT1L/Full Advertised pause frame use: No Advertised auto-negotiation: No Advertised FEC modes: Not reported Speed: 10Mb/s Duplex: Full Auto-negotiation: on Port: MII PHYAD: 1 Transceiver: external Supports Wake-on: gs Wake-on: d SecureOn password: 00:00:00:00:00:00 Current message level: 0x00000000 (0)
Quoted 3 lines
Link detected: yes
Signed-off-by Dan Murphy <[email protected]>
Signature · 1 line
Florian
PATCH v3 2/4 dt-bindings: net: Add Rx/Tx output configuration for 10base T1L
In reply to Dan MurphyPer the 802.3cg spec the 10base T1L can operate at 2 different differential voltages 1v p2p and 2.4v p2p. The abiility of the PHY to drive that output is dependent on the PHY's on board power supply. This common feature is applicable to all 10base T1L PHYs so this binding property belongs in a top level ethernet document.
--- Documentation/devicetree/bindings/net/ethernet-phy.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/net/ethernet-phy.yaml +5 -0
@@ -174,6 +174,11 @@ properties: PHY's that have configurable TX internal delays. If this property is present then the PHY applies the TX delay. + tx-rx-output-high: + type: boolean + description: | + Enable the 2.4v p2p differential output voltage for 10base-T1L PHYs. + required: - reg
Signature · 1 line
2.28.0.585.ge1cfff676549
Andrew Lunn
maintainerRe: [PATCH net-next v3 2/4] dt-bindings: net: Add Rx/Tx output configuration for 10base T1L
Quoted 3 lines · Dan Murphy
Per the 802.3cg spec the 10base T1L can operate at 2 different differential voltages 1v p2p and 2.4v p2p. The abiility of the PHY to drive that output is dependent on the PHY's on board power supply.
Hi Dan
So this property is about the board being able to support the needed voltages? The PHY is not forced into 2.4v p2p, it just says the PHY can operate at 2.4v and the board will not melt, blow a fuse, etc?
I actually think it is normal to specify the reverse. List the maximum that device can do because of board restrictions. e.g.
- maximum-power-milliwatt : Maximum module power consumption Specifies the maximum power consumption allowable by a module in the slot, in milli-Watts. Presently, modules can be up to 1W, 1.5W or 2W.
- max-link-speed:
If present this property specifies PCI gen for link capability. Host drivers could add this as a strategy to avoid unnecessary operation for unsupported link speed, for instance, trying to do training for unsupported link speed, etc. Must be '4' for gen4, '3' for gen3, '2' for gen2, and '1' for gen1. Any other values are invalid.
- max-microvolt : The maximum voltage value supplied to the haptic motor. [The unit of the voltage is a micro]
So i think this property should be
max-tx-rx-p2p = <1000>;
to limit it to 1000mv p2p because of board PSU limitations, and it is free to do 22000mv is the property is not present.
Andrew
Re: [PATCH net-next v3 2/4] dt-bindings: net: Add Rx/Tx output configuration for 10base T1L
Andrew
Quoted 24 lines · Andrew Lunn
Quoted 3 lines · Dan Murphy
Per the 802.3cg spec the 10base T1L can operate at 2 different differential voltages 1v p2p and 2.4v p2p. The abiility of the PHY to drive that output is dependent on the PHY's on board power supply.
Hi Dan
So this property is about the board being able to support the needed voltages? The PHY is not forced into 2.4v p2p, it just says the PHY can operate at 2.4v and the board will not melt, blow a fuse, etc?
I actually think it is normal to specify the reverse. List the maximum that device can do because of board restrictions. e.g.
- maximum-power-milliwatt : Maximum module power consumption Specifies the maximum power consumption allowable by a module in the slot, in milli-Watts. Presently, modules can be up to 1W, 1.5W or 2W.
- max-link-speed:
If present this property specifies PCI gen for link capability. Host drivers could add this as a strategy to avoid unnecessary operation for unsupported link speed, for instance, trying to do training for unsupported link speed, etc. Must be '4' for gen4, '3' for gen3, '2' for gen2, and '1' for gen1. Any other values are invalid.
Quoted 6 lines
- max-microvolt : The maximum voltage value supplied to the haptic motor. [The unit of the voltage is a micro]
So i think this property should be
max-tx-rx-p2p = <1000>;
When I was re-writing the code I couldn't come up with a better property name but I like this one.
I will implement it.
Do you have any issue with the property being in the ethernet-phy.yaml?
Dan
Andrew Lunn
maintainerRe: [PATCH net-next v3 2/4] dt-bindings: net: Add Rx/Tx output configuration for 10base T1L
Quoted 1 line
Do you have any issue with the property being in the
ethernet-phy.yaml?
It seems generic enough. Increasing the voltage increases the power requirements, and maybe not all boards are capable of that.
Andrew
Rob Herring
maintainerRe: [PATCH net-next v3 2/4] dt-bindings: net: Add Rx/Tx output configuration for 10base T1L
In reply to Andrew LunnQuoted 28 lines · Andrew Lunn
Quoted 3 lines · Dan Murphy
Per the 802.3cg spec the 10base T1L can operate at 2 different differential voltages 1v p2p and 2.4v p2p. The abiility of the PHY to drive that output is dependent on the PHY's on board power supply.
Hi Dan
So this property is about the board being able to support the needed voltages? The PHY is not forced into 2.4v p2p, it just says the PHY can operate at 2.4v and the board will not melt, blow a fuse, etc?
I actually think it is normal to specify the reverse. List the maximum that device can do because of board restrictions. e.g.
- maximum-power-milliwatt : Maximum module power consumption Specifies the maximum power consumption allowable by a module in the slot, in milli-Watts. Presently, modules can be up to 1W, 1.5W or 2W.
- max-link-speed:
If present this property specifies PCI gen for link capability. Host drivers could add this as a strategy to avoid unnecessary operation for unsupported link speed, for instance, trying to do training for unsupported link speed, etc. Must be '4' for gen4, '3' for gen3, '2' for gen2, and '1' for gen1. Any other values are invalid.- max-microvolt : The maximum voltage value supplied to the haptic motor. [The unit of the voltage is a micro]
Quoted 6 lines
So i think this property should be
max-tx-rx-p2p = <1000>;to limit it to 1000mv p2p because of board PSU limitations, and it is free to do 22000mv is the property is not present.
'-microvolt' suffix please.
Quoted 3 lines
Andrew
PATCH v3 3/4 dt-bindings: dp83td510: Add binding for DP83TD510 Ethernet PHY
In reply to Dan MurphyThe DP83TD510 is a 10M single twisted pair Ethernet PHY
--- .../devicetree/bindings/net/ti,dp83td510.yaml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/ti,dp83td510.yaml
Documentation/devicetree/bindings/net/ti,dp83td510.yaml new file +62 -0
@@ -0,0 +1,62 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2020 Texas Instruments Incorporated +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/net/ti,dp83td510.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: TI DP83TD510 ethernet PHY + +allOf: + - $ref: "ethernet-controller.yaml#" + - $ref: "ethernet-phy.yaml#" + +maintainers: + - Dan Murphy <[email protected]> + +description: | + The PHY is an twisted pair 10Mbps Ethernet PHY that support MII, RMII and + RGMII interfaces. + + Specifications about the Ethernet PHY can be found at: + http://www.ti.com/lit/ds/symlink/dp83td510e.pdf + +properties: + reg: + maxItems: 1 + + tx-fifo-depth: + description: | + Transmitt FIFO depth for RMII mode. The PHY only exposes 4 nibble + depths. The valid nibble depths are 4, 5, 6 and 8. + enum: [ 4, 5, 6, 8 ] + default: 5 + + rx-internal-delay-ps: + description: | + Setting this property to a non-zero number sets the RX internal delay + for the PHY. The internal delay for the PHY is fixed to 30ns relative + to receive data. + + tx-internal-delay-ps: + description: | + Setting this property to a non-zero number sets the TX internal delay + for the PHY. The internal delay for the PHY has a range of -4 to 4ns + relative to transmit data. + +required: + - reg + +examples: + - | + mdio0 { + #address-cells = <1>; + #size-cells = <0>; + ethphy0: ethernet-phy@0 { + reg = <0>; + tx-rx-output-high; + tx-fifo-depth = <5>; + rx-internal-delay-ps = <1>; + tx-internal-delay-ps = <1>; + }; + };
Signature · 1 line
2.28.0.585.ge1cfff676549
Re: [PATCH net-next v3 3/4] dt-bindings: dp83td510: Add binding for DP83TD510 Ethernet PHY
Quoted 53 lines · Dan Murphy
The DP83TD510 is a 10M single twisted pair Ethernet PHY
Signed-off-by Dan Murphy <[email protected]>--- .../devicetree/bindings/net/ti,dp83td510.yaml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/ti,dp83td510.yamlDocumentation/devicetree/bindings/net/ti,dp83td510.yaml new file +39
-0@@ -0,0 +1,62 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +# Copyright (C) 2020 Texas Instruments Incorporated +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/net/ti,dp83td510.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: TI DP83TD510 ethernet PHY + +allOf: + - $ref: "ethernet-controller.yaml#" + - $ref: "ethernet-phy.yaml#" + +maintainers: + - Dan Murphy <[email protected]> + +description: | + The PHY is an twisted pair 10Mbps Ethernet PHY that support MII, RMII and + RGMII interfaces. + + Specifications about the Ethernet PHY can be found at: + http://www.ti.com/lit/ds/symlink/dp83td510e.pdf + +properties: + reg: + maxItems: 1 + + tx-fifo-depth: + description: | + Transmitt FIFO depth for RMII mode. The PHY only exposes 4 nibble + depths. The valid nibble depths are 4, 5, 6 and 8. + enum: [ 4, 5, 6, 8 ] + default: 5 + + rx-internal-delay-ps: + description: | + Setting this property to a non-zero number sets the RX internal delay + for the PHY. The internal delay for the PHY is fixed to 30ns relative + to receive data.
Documentation/devicetree/bindings/net/ti,dp83td510.yaml line 49
Quoted 10 lines
Documentation/devicetree/bindings/net/ti,dp83td510.yaml new file +10
-0+ + tx-internal-delay-ps: + description: | + Setting this property to a non-zero number sets the TX internal delay + for the PHY. The internal delay for the PHY has a range of -4 to 4ns + relative to transmit data. + +required: + - reg +
I just got this feedback so I am passing it on.
Every dtbinding should have the additionalProperties set to false so that dtbs_check can actually catch if there is a undefined property used.
Ioana
Rob Herring
maintainerRe: [PATCH net-next v3 3/4] dt-bindings: dp83td510: Add binding for DP83TD510 Ethernet PHY
In reply to Dan MurphyQuoted 8 lines · Dan Murphy
The DP83TD510 is a 10M single twisted pair Ethernet PHY
Signed-off-by Dan Murphy <[email protected]>--- .../devicetree/bindings/net/ti,dp83td510.yaml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/ti,dp83td510.yaml
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/ti,dp83td510.yaml: {'$id': 'http://devicetree.org/schemas/net/ti,dp83td510.yaml#', '$schema': 'http://devicetree.org/meta-schemas/core.yaml#', 'title': 'TI DP83TD510 ethernet PHY', 'allOf': [{'$ref': 'ethernet-controller.yaml#'}, {'$ref': 'ethernet-phy.yaml#'}], 'maintainers': ['Dan Murphy <[email protected]>'], 'description': 'The PHY is an twisted pair 10Mbps Ethernet PHY that support MII, RMII and\nRGMII interfaces.\n\nSpecifications about the Ethernet PHY can be found at:\n http://www.ti.com/lit/ds/symlink/dp83td510e.pdf\n', 'properties': {'reg': {'maxItems': 1}, 'tx-fifo-depth': {'description': 'Transmitt FIFO depth for RMII mode. The PHY only exposes 4 nibble\ndepths. The valid nibble depths are 4, 5, 6 and 8.\n', 'enum': [4, 5, 6, 8], 'default': 5}, 'rx-internal-delay-ps': {'description': 'Setting this property to a non-zero number sets the RX internal delay\nfor the PHY. The internal delay for the PHY is
fixed to 30ns relative\nto receive data.\n'}, 'tx-internal-delay-ps': {'description': 'Setting this property to a non-zero number sets the TX internal delay\nfor the PHY. The internal delay for the PHY has a range of -4 to 4ns\nrelative to transmit data.\n'}}, 'required': ['reg'], 'examples': ['mdio0 {\n #address-cells = <1>;\n #size-cells = <0>;\n ethphy0: ethernet-phy@0 {\n reg = <0>;\n tx-rx-output-high;\n tx-fifo-depth = <5>;\n rx-internal-delay-ps = <1>;\n tx-internal-delay-ps = <1>;\n };\n};\n']} is not valid under any of the given schemas
{'oneOf': [{'required': ['unevaluatedProperties']},
{'required': ['additionalProperties']}]} (Possible causes of the failure):
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/ti,dp83td510.yaml: 'unevaluatedProperties' is a required property
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/net/ti,dp83td510.yaml: ignoring, error in schema:
warning: no schema found in file: ./Documentation/devicetree/bindings/net/ti,dp83td510.yaml
See https://patchwork.ozlabs.org/patch/1391184
The base for the patch is generally the last rc1. Any dependencies should be noted.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
PATCH v3 4/4 net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
In reply to Dan MurphyThe DP83TD510E is an ultra-low power Ethernet physical layer transceiver that supports 10M single pair cable.
The device supports both 2.4-V p2p and 1-V p2p output voltage as defined by IEEE 802.3cg 10Base-T1L specfications. These modes can be forced via the device tree or the device is defaulted to auto negotiation to determine the proper p2p voltage.
--- drivers/net/phy/Kconfig | 6 + drivers/net/phy/Makefile | 1 + drivers/net/phy/dp83td510.c | 681 ++++++++++++++++++++++++++++++++++++ 3 files changed, 688 insertions(+) create mode 100644 drivers/net/phy/dp83td510.c
drivers/net/phy/Kconfig +6 -0
@@ -302,6 +302,12 @@ config DP83869_PHY Currently supports the DP83869 PHY. This PHY supports copper and fiber connections. +config DP83TD510_PHY + tristate "Texas Instruments DP83TD510 10M Single Pair Ethernet PHY" + help + Support for the DP83TD510 Ethernet PHY. This PHY supports a 10M single + pair Ethernet connection. + config VITESSE_PHY tristate "Vitesse PHYs" help
drivers/net/phy/Makefile +1 -0
@@ -56,6 +56,7 @@ obj-$(CONFIG_DP83848_PHY) += dp83848.o obj-$(CONFIG_DP83867_PHY) += dp83867.o obj-$(CONFIG_DP83869_PHY) += dp83869.o obj-$(CONFIG_DP83TC811_PHY) += dp83tc811.o +obj-$(CONFIG_DP83TD510_PHY) += dp83td510.o obj-$(CONFIG_FIXED_PHY) += fixed_phy.o obj-$(CONFIG_ICPLUS_PHY) += icplus.o obj-$(CONFIG_INTEL_XWAY_PHY) += intel-xway.o
drivers/net/phy/dp83td510.c new file +681 -0
681 lines not on this page · raw message
Signature · 1 line
2.28.0.585.ge1cfff676549
Andrew Lunn
maintainerRe: [PATCH net-next v3 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
Quoted 4 lines
drivers/net/phy/dp83td510.c new file +4
-0+static int dp83td510_config_init (struct phy_device *phydev) +{ +struct dp83td510_private *dp83td510 = phydev->priv; +int mst_slave_cfg;
drivers/net/phy/dp83td510.c line 506
Quoted 10 lines
drivers/net/phy/dp83td510.c new file +10
-0+int ret =0 ; + +if (phy_interface_is_rgmii (phydev)) { +if (dp83td510->rgmii_delay) { + ret =phy_set_bits_mmd (phydev,DP83TD510_DEVADDR , +DP83TD510_MAC_CFG_1 , dp83td510->rgmii_delay); +if (ret) +return ret; + } + }
Hi Dan
I'm getting a bit paranoid about RGMII delays...
Quoted 4 lines
drivers/net/phy/dp83td510.c new file +4
-0+static int dp83td510_read_straps (struct phy_device *phydev) +{ +struct dp83td510_private *dp83td510 = phydev->priv; +int strap;
drivers/net/phy/dp83td510.c line 568
Quoted 10 lines
drivers/net/phy/dp83td510.c new file +10
-0+ + strap =phy_read_mmd (phydev,DP83TD510_DEVADDR ,DP83TD510_SOR_1 ); +if (strap <0 ) +return strap; + +if (strap &DP83TD510_RGMII ) + dp83td510->is_rgmii = true; + +return 0 ; +};
So dp83td510->is_rgmii is the strapping configuration. So if one of the four RGMII modes is selected, your appear to ignore which of the four is selected, and program the hardware with the strapping?
That seems like a bad idea.
Quoted 13 lines
drivers/net/phy/dp83td510.c new file +13
-0+#if IS_ENABLED (CONFIG_OF_MDIO ) +static int dp83td510_of_init (struct phy_device *phydev) +{ +struct dp83td510_private *dp83td510 = phydev->priv; +struct device *dev = &phydev->mdio.dev; +struct device_node *of_node = dev->of_node; +s32 rx_int_delay; +s32 tx_int_delay; +int ret; + +if (!of_node) +return -ENODEV ; +
drivers/net/phy/dp83td510.c line 592
Quoted 10 lines
drivers/net/phy/dp83td510.c new file +10
-0+ ret =dp83td510_read_straps (phydev); +if (ret) +return ret; + + dp83td510->hi_diff_output =device_property_read_bool (&phydev->mdio.dev, +"tx-rx-output-high" ); + +if (device_property_read_u32 (&phydev->mdio.dev,"tx-fifo-depth" , + &dp83td510->tx_fifo_depth)) + dp83td510->tx_fifo_depth =DP83TD510_FIFO_DEPTH_5_B_NIB ;
Please don't use device_property_read_foo API, we don't want to give the impression it is O.K. to stuff DT properties in ACPI tables. Please use of_ API calls.
Andrew
Re: [PATCH net-next v3 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
Andrew
Quoted 16 lines · Andrew Lunn
Quoted 4 lines
drivers/net/phy/dp83td510.c new file +4
-0+static int dp83td510_config_init (struct phy_device *phydev) +{ +struct dp83td510_private *dp83td510 = phydev->priv; +int mst_slave_cfg;drivers/net/phy/dp83td510.c line 506
Quoted 10 lines
drivers/net/phy/dp83td510.c new file +10
-0+int ret =0 ; + +if (phy_interface_is_rgmii (phydev)) { +if (dp83td510->rgmii_delay) { + ret =phy_set_bits_mmd (phydev,DP83TD510_DEVADDR , +DP83TD510_MAC_CFG_1 , dp83td510->rgmii_delay); +if (ret) +return ret; + } + }Hi Dan
Quoted 1 line
I'm getting a bit paranoid about RGMII delays...
Not sure what this means.
Quoted 19 lines
Quoted 5 lines
drivers/net/phy/dp83td510.c new file +4
-0+static int dp83td510_read_straps (struct phy_device *phydev) +{ +struct dp83td510_private *dp83td510 = phydev->priv; +int strap;drivers/net/phy/dp83td510.c line 568
Quoted 10 lines
drivers/net/phy/dp83td510.c new file +10
-0+ + strap =phy_read_mmd (phydev,DP83TD510_DEVADDR ,DP83TD510_SOR_1 ); +if (strap <0 ) +return strap; + +if (strap &DP83TD510_RGMII ) + dp83td510->is_rgmii = true; + +return 0 ; +};So
dp83td510->is_rgmiiis the strapping configuration. So if one of the four RGMII modes is selected, your appear to ignore which of the four is selected, and program the hardware with the strapping?
Quoted 1 line
That seems like a bad idea.
I will re-look at this code.
Quoted 19 lines
Quoted 19 lines
drivers/net/phy/dp83td510.c new file +18
-0+#if IS_ENABLED (CONFIG_OF_MDIO ) +static int dp83td510_of_init (struct phy_device *phydev) +{ +struct dp83td510_private *dp83td510 = phydev->priv; +struct device *dev = &phydev->mdio.dev; +struct device_node *of_node = dev->of_node; +s32 rx_int_delay; +s32 tx_int_delay; +int ret; + +if (!of_node) +return -ENODEV ; + + ret =dp83td510_read_straps (phydev); +if (ret) +return ret; + + dp83td510->hi_diff_output = device_property_read_bool(&phydev->mdio.dev,
Quoted 8 lines
drivers/net/phy/dp83td510.c line 592
Quoted 5 lines
drivers/net/phy/dp83td510.c new file +5
-0+ "tx-rx-output-high"); + +if (device_property_read_u32 (&phydev->mdio.dev,"tx-fifo-depth" , + &dp83td510->tx_fifo_depth)) + dp83td510->tx_fifo_depth =DP83TD510_FIFO_DEPTH_5_B_NIB ;Please don't use
device_property_read_fooAPI, we don't want to give the impression it is O.K. to stuff DT properties in ACPI tables. Please useof_API calls.
Hmm. Is this a new stance in DT handling for the networking tree?
If it is should I go back and rework some of my other drivers that use device_property APIs
Dan
Andrew Lunn
maintainerRe: [PATCH net-next v3 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
Quoted 19 lines · Dan Murphy
Andrew
Quoted 16 lines · Andrew Lunn
Quoted 4 lines
drivers/net/phy/dp83td510.c new file +4
-0+static int dp83td510_config_init (struct phy_device *phydev) +{ +struct dp83td510_private *dp83td510 = phydev->priv; +int mst_slave_cfg;drivers/net/phy/dp83td510.c line 506
Quoted 10 lines
drivers/net/phy/dp83td510.c new file +10
-0+int ret =0 ; + +if (phy_interface_is_rgmii (phydev)) { +if (dp83td510->rgmii_delay) { + ret =phy_set_bits_mmd (phydev,DP83TD510_DEVADDR , +DP83TD510_MAC_CFG_1 , dp83td510->rgmii_delay); +if (ret) +return ret; + } + }Hi Dan
Quoted 2 lines
Quoted 1 line
I'm getting a bit paranoid about RGMII delays...
Not sure what this means.
See the discussion and breakage around the realtek PHY. It wrongly implemented RGMII delays. When it was fixed, lots of board broke because the bug in the PHY driver hid bugs in the DT.
Quoted 8 lines
Quoted 3 lines
Please don't use
device_property_read_fooAPI, we don't want to give the impression it is O.K. to stuff DT properties in ACPI tables. Please useof_API calls.Hmm. Is this a new stance in DT handling for the networking tree?
If it is should I go back and rework some of my other drivers that use
device_propertyAPIs
There is a slowly growing understanding what ACPI support in this area means. It seems to mean that the firmware should actually do all the setup, and the kernel should not touch the hardware configuration. But some developers are ignoring this, and just stuffing DT properties into ACPI tables and letting the kernel configure the hardware, if it happens to use the device_property_read API. So i want to make it clear that these properties are for device tree, and if you want to use ACPI, you should do things the ACPI way.
For new code, i will be pushing for OF only calls. Older code is a bit more tricky. There might be boards out there using ACPI, but doing it wrongly, and stuffing OF properties into ACPI tables. We should try to avoid breaking them.
Andrew
Re: [PATCH net-next v3 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
Andrew
Quoted 20 lines · Andrew Lunn
Quoted 19 lines · Dan Murphy
Andrew
Quoted 16 lines · Andrew Lunn
Quoted 4 lines
drivers/net/phy/dp83td510.c new file +4
-0+static int dp83td510_config_init (struct phy_device *phydev) +{ +struct dp83td510_private *dp83td510 = phydev->priv; +int mst_slave_cfg;drivers/net/phy/dp83td510.c line 506
Quoted 10 lines
drivers/net/phy/dp83td510.c new file +10
-0+int ret =0 ; + +if (phy_interface_is_rgmii (phydev)) { +if (dp83td510->rgmii_delay) { + ret =phy_set_bits_mmd (phydev,DP83TD510_DEVADDR , +DP83TD510_MAC_CFG_1 , dp83td510->rgmii_delay); +if (ret) +return ret; + } + }Hi Dan
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
I'm getting a bit paranoid about RGMII delays...
Not sure what this means.
See the discussion and breakage around the realtek PHY. It wrongly implemented RGMII delays. When it was fixed, lots of board broke because the bug in the PHY driver hid bugs in the DT.
I will have to go find that thread. Do you have a link?
Quoted 16 lines
Quoted 7 lines
Quoted 3 lines
Please don't use
device_property_read_fooAPI, we don't want to give the impression it is O.K. to stuff DT properties in ACPI tables. Please useof_API calls.Hmm. Is this a new stance in DT handling for the networking tree?
If it is should I go back and rework some of my other drivers that use
device_propertyAPIsThere is a slowly growing understanding what ACPI support in this area means. It seems to mean that the firmware should actually do all the setup, and the kernel should not touch the hardware configuration. But some developers are ignoring this, and just stuffing DT properties into ACPI tables and letting the kernel configure the hardware, if it happens to use the
device_property_readAPI. So i want to make it clear that these properties are for device tree, and if you want to use ACPI, you should do things the ACPI way.
Quoted 4 lines
For new code, i will be pushing for OF only calls. Older code is a bit more tricky. There might be boards out there using ACPI, but doing it wrongly, and stuffing OF properties into ACPI tables. We should try to avoid breaking them.
Got it. I will move back to of_* calls
Dan
Quoted 1 line
Andrew
Re: [PATCH net-next v3 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
Quoted 24 lines · Dan Murphy
Andrew
Quoted 21 lines · Andrew Lunn
Quoted 20 lines · Dan Murphy
Andrew
Quoted 17 lines · Andrew Lunn
Quoted 10 lines
drivers/net/phy/dp83td510.c new file +10
-0+static int dp83td510_config_init (struct phy_device *phydev) +{ + struct dp83td510_private *dp83td510 = phydev->priv; + int mst_slave_cfg; + int ret = 0; + + if (phy_interface_is_rgmii(phydev)) { + if (dp83td510->rgmii_delay) { + ret = phy_set_bits_mmd(phydev, DP83TD510_DEVADDR, + DP83TD510_MAC_CFG_1,Quoted 5 lines
dp83td510->rgmii_delay);
+ if (ret)
+ return ret;
+ }
+ }Hi Dan
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
I'm getting a bit paranoid about RGMII delays...
Not sure what this means.
See the discussion and breakage around the realtek PHY. It wrongly implemented RGMII delays. When it was fixed, lots of board broke because the bug in the PHY driver hid bugs in the DT.
I will have to go find that thread. Do you have a link?
That would be the thread:
https://lore.kernel.org/netdev/CAMj1kXEEF_Un-4NTaD5iUN0NoZYaJQn-rPediX0S6oRiuVuW-A@mail.gmail.com/
Signature · 1 line
Florian
Jakub Kicinski
maintainerRe: [PATCH net-next v3 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
In reply to Dan MurphyQuoted 9 lines · On Fri, 30 Oct 2020 12:29:50 -0500 Dan Murphy wrote:
The DP83TD510E is an ultra-low power Ethernet physical layer transceiver that supports 10M single pair cable.
The device supports both 2.4-V p2p and 1-V p2p output voltage as defined by IEEE 802.3cg 10Base-T1L specfications. These modes can be forced via the device tree or the device is defaulted to auto negotiation to determine the proper p2p voltage.
Signed-off-by Dan Murphy <[email protected]>
drivers/net/phy/dp83td510.c:70:11: warning: symbol 'dp83td510_feature_array' was not declared. Should it be static?
Also this:
WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP #429: FILE: drivers/net/phy/dp83td510.c:371:
+ return -ENOTSUPP;
WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP #524: FILE: drivers/net/phy/dp83td510.c:466:
+ return -ENOTSUPP;
ERROR: space required before the open parenthesis '(' #580: FILE: drivers/net/phy/dp83td510.c:522:
+ if(phydev->autoneg) {
ERROR: space required before the open parenthesis '(' #588: FILE: drivers/net/phy/dp83td510.c:530:
+ if(phydev->autoneg) {
And please try to wrap the code on 80 chars on the non trivial lines:
WARNING: line length of 88 exceeds 80 columns
#458: FILE: drivers/net/phy/dp83td510.c:400:
+ mst_slave_cfg = phy_read_mmd(phydev, DP83TD510_PMD_DEVADDR, DP83TD510_PMD_CTRL);
WARNING: line length of 91 exceeds 80 columns
#505: FILE: drivers/net/phy/dp83td510.c:447:
+ linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported);
WARNING: line length of 93 exceeds 80 columns
#507: FILE: drivers/net/phy/dp83td510.c:449:
+ linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported);
WARNING: line length of 91 exceeds 80 columns
#514: FILE: drivers/net/phy/dp83td510.c:456:
+ linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported);
WARNING: line length of 93 exceeds 80 columns
#516: FILE: drivers/net/phy/dp83td510.c:458:
+ linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported);
WARNING: line length of 92 exceeds 80 columns
#560: FILE: drivers/net/phy/dp83td510.c:502:
+ DP83TD510_MAC_CFG_1, dp83td510->rgmii_delay);
WARNING: line length of 88 exceeds 80 columns
#574: FILE: drivers/net/phy/dp83td510.c:516:
+ mst_slave_cfg = phy_read_mmd(phydev, DP83TD510_PMD_DEVADDR, DP83TD510_PMD_CTRL);
WARNING: line length of 84 exceeds 80 columns
#695: FILE: drivers/net/phy/dp83td510.c:637:
+ dp83td510 = devm_kzalloc(&phydev->mdio.dev, sizeof(*dp83td510), GFP_KERNEL);
Re: [PATCH net-next v3 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
Hello
Quoted 11 lines · Jakub Kicinski
Quoted 9 lines · On Fri, 30 Oct 2020 12:29:50 -0500 Dan Murphy wrote:
The DP83TD510E is an ultra-low power Ethernet physical layer transceiver that supports 10M single pair cable.
The device supports both 2.4-V p2p and 1-V p2p output voltage as defined by IEEE 802.3cg 10Base-T1L specfications. These modes can be forced via the device tree or the device is defaulted to auto negotiation to determine the proper p2p voltage.
Signed-off-by Dan Murphy <[email protected]>
drivers/net/phy/dp83td510.c:70:11: warning: symbol 'dp83td510_feature_array' was not declared. Should it be static?
I did not see this warning. Did you use W=1?
Review
Quoted 11 lines
Also this:
WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP #429: FILE:
drivers/net/phy/dp83td510.c:371:(quoted diff) +1
-0+ return -ENOTSUPP;WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP #524: FILE:
drivers/net/phy/dp83td510.c:466:(quoted diff) +1
-0+ return -ENOTSUPP;
Same with these warnings how where they reproduced?
Quoted 11 lines
ERROR: space required before the open parenthesis '(' #580: FILE:
drivers/net/phy/dp83td510.c:522:(quoted diff) +1
-0+ if(phydev->autoneg) {ERROR: space required before the open parenthesis '(' #588: FILE:
drivers/net/phy/dp83td510.c:530:(quoted diff) +1
-0+ if(phydev->autoneg) {And please try to wrap the code on 80 chars on the non trivial lines:
What is the LoC limit for networking just for my clarification and I will align with that.
I know some maintainers like to keep the 80 LoC and some allow a longer line.
Dan
Andrew Lunn
maintainerRe: [PATCH net-next v3 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
Quoted 7 lines · Dan Murphy
Hello
Quoted 4 lines · Jakub Kicinski
Quoted 3 lines · On Fri, 30 Oct 2020 12:29:50 -0500 Dan Murphy wrote:
The DP83TD510E is an ultra-low power Ethernet physical layer transceiver that supports 10M single pair cable.
Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
The device supports both 2.4-V p2p and 1-V p2p output voltage as defined by IEEE 802.3cg 10Base-T1L specfications. These modes can be forced via the device tree or the device is defaulted to auto negotiation to determine the proper p2p voltage.
Signed-off-by Dan Murphy <[email protected]>
drivers/net/phy/dp83td510.c:70:11: warning: symbol 'dp83td510_feature_array' was not declared. Should it be static?I did not see this warning. Did you use W=1?
I _think_ that one is W=1. All the PHY drivers are W=1 clean, and i want to keep it that way. And i hope to make it the default in a lot of the network code soon.
Quoted 11 lines
Review
Quoted 9 lines
Also this:
WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP #429: FILE:
drivers/net/phy/dp83td510.c:371:(quoted diff) +1
-0+ return -ENOTSUPP;WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP #524: FILE:
drivers/net/phy/dp83td510.c:466:(quoted diff) +1
-0+ return -ENOTSUPP;Same with these warnings how where they reproduced?
Quoted 1 line
Quoted 8 lines
Review
Quoted 8 lines
ERROR: space required before the open parenthesis '(' #580: FILE:
drivers/net/phy/dp83td510.c:522:(quoted diff) +1
-0+ if(phydev->autoneg) {ERROR: space required before the open parenthesis '(' #588: FILE:
drivers/net/phy/dp83td510.c:530:(quoted diff) +1
-0+ if(phydev->autoneg) {
These look like checkpatch.
Quoted 5 lines
Quoted 2 lines
And please try to wrap the code on 80 chars on the non trivial lines:
What is the LoC limit for networking just for my clarification and I will align with that.
80. I would not be too surprised to see checkpatch getting a patch to set it to 80 for networking code.
Andrew
Re: [PATCH net-next v3 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
Andrew
Quoted 13 lines · Andrew Lunn
Quoted 12 lines · Dan Murphy
Hello
Quoted 9 lines · Jakub Kicinski
Quoted 8 lines · On Fri, 30 Oct 2020 12:29:50 -0500 Dan Murphy wrote:
The DP83TD510E is an ultra-low power Ethernet physical layer transceiver that supports 10M single pair cable.
The device supports both 2.4-V p2p and 1-V p2p output voltage as defined by IEEE 802.3cg 10Base-T1L specfications. These modes can be forced via the device tree or the device is defaulted to auto negotiation to determine the proper p2p voltage.
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
Quoted 1 line
Signed-off-by Dan Murphy <[email protected]>
drivers/net/phy/dp83td510.c:70:11: warning: symbol 'dp83td510_feature_array' was not declared. Should it be static?I did not see this warning. Did you use W=1?
I _think_ that one is W=1. All the PHY drivers are W=1 clean, and i want to keep it that way. And i hope to make it the default in a lot of the network code soon.
OK I built with the W=1 before submission I did not see this but I will try some other things.
Quoted 10 lines
Quoted 10 lines
Review
Quoted 9 lines
Also this:
WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP #429: FILE:
drivers/net/phy/dp83td510.c:371:(quoted diff) +1
-0+ return -ENOTSUPP;WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP #524: FILE:
drivers/net/phy/dp83td510.c:466:(quoted diff) +1
-0+ return -ENOTSUPP;Same with these warnings how where they reproduced?
Same as above
Quoted 9 lines
Quoted 8 lines
Review
Quoted 8 lines
ERROR: space required before the open parenthesis '(' #580: FILE:
drivers/net/phy/dp83td510.c:522:(quoted diff) +1
-0+ if(phydev->autoneg) {ERROR: space required before the open parenthesis '(' #588: FILE:
drivers/net/phy/dp83td510.c:530:(quoted diff) +1
-0+ if(phydev->autoneg) {These look like checkpatch.
These I missed
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
And please try to wrap the code on 80 chars on the non trivial lines:
What is the LoC limit for networking just for my clarification and I will align with that.
80. I would not be too surprised to see checkpatch getting a patch to set it to 80 for networking code.
OK I will align the lines to 80 then.
Dan
Quoted 1 line
Andrew
Andrew Lunn
maintainerRe: [PATCH net-next v3 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line
drivers/net/phy/dp83td510.c:70:11: warning: symbol 'dp83td510_feature_array' was not declared. Should it be static?I did not see this warning. Did you use W=1?
I _think_ that one is W=1. All the PHY drivers are W=1 clean, and i want to keep it that way. And i hope to make it the default in a lot of the network code soon.
OK I built with the W=1 before submission I did not see this but I will try some other things.
Then it might be sparse. Try C=1.
Andrew
Re: [PATCH net-next v3 4/4] net: phy: dp83td510: Add support for the DP83TD510 Ethernet PHY
In reply to Dan MurphyQuoted 16 lines · Dan Murphy
The DP83TD510E is an ultra-low power Ethernet physical layer transceiver that supports 10M single pair cable.
The device supports both 2.4-V p2p and 1-V p2p output voltage as defined by IEEE 802.3cg 10Base-T1L specfications. These modes can be forced via the device tree or the device is defaulted to auto negotiation to determine the proper p2p voltage.
Signed-off-by Dan Murphy <[email protected]>--- drivers/net/phy/Kconfig | 6 + drivers/net/phy/Makefile | 1 + drivers/net/phy/dp83td510.c | 681 ++++++++++++++++++++++++++++++++++++ 3 files changed, 688 insertions(+) create mode 100644 drivers/net/phy/dp83td510.c
(...)
Quoted 59 lines
drivers/net/phy/dp83td510.c new file +59
-0+static int dp83td510_ack_interrupt (struct phy_device *phydev) +{ +int ret; + + ret =phy_read (phydev,DP83TD510_INT_REG1 ); +if (ret <0 ) +return ret; + + ret =phy_read (phydev,DP83TD510_INT_REG2 ); +if (ret <0 ) +return ret; + +return 0 ; +} + +static int dp83td510_config_intr (struct phy_device *phydev) +{ +int int_status; +int gen_cfg_val; +int ret; + +if (phydev->interrupts ==PHY_INTERRUPT_ENABLED ) { + int_status =phy_read (phydev,DP83TD510_INT_REG1 ); +if (int_status <0 ) +return int_status; + + int_status = (DP83TD510_INT1_ESD_EN |DP83TD510_INT1_LINK_EN | +DP83TD510_INT1_RHF_EN ); + + ret =phy_write (phydev,DP83TD510_INT_REG1 , int_status); +if (ret) +return ret; + + int_status =phy_read (phydev,DP83TD510_INT_REG2 ); +if (int_status <0 ) +return int_status; + + int_status = (DP83TD510_INT2_POR |DP83TD510_INT2_POL | +DP83TD510_INT2_PAGE ); + + ret =phy_write (phydev,DP83TD510_INT_REG2 , int_status); +if (ret) +return ret; + + gen_cfg_val =phy_read (phydev,DP83TD510_GEN_CFG ); +if (gen_cfg_val <0 ) +return gen_cfg_val; + + gen_cfg_val |=DP83TD510_INT_OE |DP83TD510_INT_EN ; + + }else { + ret =phy_write (phydev,DP83TD510_INT_REG1 ,0 ); +if (ret) +return ret; + + ret =phy_write (phydev,DP83TD510_INT_REG2 ,0 ); +if (ret) +return ret; +
drivers/net/phy/dp83td510.c line 336
Quoted 10 lines
drivers/net/phy/dp83td510.c new file +10
-0+ gen_cfg_val =phy_read (phydev,DP83TD510_GEN_CFG ); +if (gen_cfg_val <0 ) +return gen_cfg_val; + + gen_cfg_val &= ~DP83TD510_INT_EN ; + } + +return phy_write (phydev,DP83TD510_GEN_CFG , gen_cfg_val); +} +
I am not really sure if the shared-IRQ work in the below linked patch set will go through, but I think it would be cleaner just to ack any pending interrupts after you disable them.
https://lore.kernel.org/netdev/[email protected]/
I see that you are reading the INT_REG1 and INT_REG2 registers (basically servicing any pending interrupts) before enabling the IRQ. The same reads should be done after the IRQ has been disabled.
drivers/net/phy/dp83td510.c line 660
Quoted 11 lines
drivers/net/phy/dp83td510.c new file +11
-0+static struct phy_driver dp83td510_driver[] = { + { +PHY_ID_MATCH_MODEL (DP83TD510E_PHY_ID ), + .name ="TI DP83TD510E" , + .probe = dp83td510_probe, + .config_init = dp83td510_config_init, + .soft_reset = dp83td510_phy_reset, + +/* IRQ related */ + .ack_interrupt = dp83td510_ack_interrupt, + .config_intr = dp83td510_config_intr,
I think the PHY maintainers could comment on this more, but maybe it would help if the driver implements the .handle_interrupt() callback just so that I wouldn't have to touch a driver that was just added to rework it for the shared-IRQ transition.
Ioana