Skip to content

Commit

Permalink
dts: bindings: boards: Update Ethernet PHY to use reg property
Browse files Browse the repository at this point in the history
Updates Ethernet PHY devicetree bindings to be more consistent with
Linux by using the standard `reg` property for the PHY address instead
of a custom `address` property. As a result, MDIO controller bindings
now require standard `#address-cells` and `#size-cells` properties.

Signed-off-by: Maureen Helm <[email protected]>
  • Loading branch information
MaureenHelm authored and carlescufi committed Sep 29, 2023
1 parent ce42ffc commit d528757
Show file tree
Hide file tree
Showing 19 changed files with 66 additions and 28 deletions.
4 changes: 2 additions & 2 deletions boards/arm/atsame54_xpro/atsame54_xpro.dts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ zephyr_udc0: &usb0 {
pinctrl-0 = <&mdio_default>;
pinctrl-names = "default";

phy: ethernet-phy {
phy: ethernet-phy@0 {
compatible = "ethernet-phy";
status = "okay";
address = <0>;
reg = <0>;
};
};
4 changes: 2 additions & 2 deletions boards/arm/s32z270dc2_r52/s32z270dc2_r52.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
pinctrl-names = "default";
status = "okay";

phy0: ethernet-phy {
phy0: ethernet-phy@7 {
compatible = "ethernet-phy";
address = <0x7>;
reg = <0x7>;
status = "okay";
};
};
Expand Down
4 changes: 2 additions & 2 deletions boards/arm/sam4e_xpro/sam4e_xpro.dts
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,10 @@
pinctrl-0 = <&mdio_default>;
pinctrl-names = "default";

phy: ethernet-phy {
phy: ethernet-phy@0 {
compatible = "ethernet-phy";
status = "okay";
address = <0>;
reg = <0>;
};
};

Expand Down
4 changes: 2 additions & 2 deletions boards/arm/sam_e70_xplained/sam_e70_xplained-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ zephyr_udc0: &usbhs {
pinctrl-0 = <&mdio_default>;
pinctrl-names = "default";

phy: ethernet-phy {
phy: ethernet-phy@0 {
compatible = "ethernet-phy";
status = "okay";
address = <0>;
reg = <0>;
};
};

Expand Down
4 changes: 2 additions & 2 deletions boards/arm/sam_v71_xult/sam_v71_xult-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ zephyr_udc0: &usbhs {
pinctrl-0 = <&mdio_default>;
pinctrl-names = "default";

phy: ethernet-phy {
phy: ethernet-phy@0 {
compatible = "ethernet-phy";
status = "okay";
address = <0>;
reg = <0>;
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,13 @@
mdio: mdio {
compatible = "smsc,lan91c111-mdio";
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;

phy: ethernet-phy {
phy: ethernet-phy@0 {
compatible = "ethernet-phy";
status = "disabled";
address = <0>;
reg = <0>;
};
};
};
Expand Down
4 changes: 2 additions & 2 deletions boards/xtensa/esp32_ethernet_kit/esp32_ethernet_kit.dts
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@
pinctrl-0 = <&mdio_default>;
pinctrl-names = "default";

phy: ethernet-phy {
phy: ethernet-phy@1 {
compatible = "ethernet-phy";
status = "disabled";
address = <1>;
reg = <1>;
};
};

Expand Down
21 changes: 21 additions & 0 deletions doc/releases/migration-guide-3.5.rst
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,27 @@ Required changes
:c:func:`can_set_bitrate` and :c:func:`can_set_bitrate_data` now also automatically calculate a
suitable SJW, but their SJW cannot be overwritten by the caller.

* Ethernet PHY devicetree bindings were updated to use the standard ``reg``
property for the PHY address instead of a custom ``address`` property. As a
result, MDIO controller nodes now require ``#address-cells`` and
``#size-cells`` properties. Similarly, Ethernet PHY devicetree nodes and
corresponding driver were updated to consistently use the node name
``ethernet-phy`` instead of ``phy``. Devicetrees and overlays must be updated
accordingly:

.. code-block:: devicetree
mdio {
compatible = "mdio-controller";
#address-cells = <1>;
#size-cells = <0>;
ethernet-phy@0 {
compatible = "ethernet-phy";
reg = <0>;
};
};
Recommended Changes
*******************

Expand Down
2 changes: 1 addition & 1 deletion drivers/ethernet/phy/phy_mii.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ static const struct ethphy_driver_api phy_mii_driver_api = {

#define PHY_MII_CONFIG(n) \
static const struct phy_mii_dev_config phy_mii_dev_config_##n = { \
.phy_addr = DT_INST_PROP(n, address), \
.phy_addr = DT_INST_REG_ADDR(n), \
.fixed = IS_FIXED_LINK(n), \
.fixed_speed = DT_INST_ENUM_IDX_OR(n, fixed_link, 0), \
.mdio = UTIL_AND(UTIL_NOT(IS_FIXED_LINK(n)), \
Expand Down
2 changes: 2 additions & 0 deletions dts/arm/atmel/sam4e.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@
compatible = "atmel,sam-mdio";
reg = <0x40034000 0x4000>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};

pinctrl: pinctrl@400e0e00 {
Expand Down
2 changes: 2 additions & 0 deletions dts/arm/atmel/same5x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
compatible = "atmel,sam-mdio";
reg = <0x42000800 0x400>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};
};
};
2 changes: 2 additions & 0 deletions dts/arm/atmel/same70.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@
compatible = "atmel,sam-mdio";
reg = <0x40050000 0x4000>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};

tc0: tc@4000c000 {
Expand Down
2 changes: 2 additions & 0 deletions dts/arm/nxp/nxp_s32z27x_r52.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,8 @@
compatible = "nxp,s32-netc-emdio";
reg = <0x74b60000 0x1c44>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};

enetc_psi0: ethernet@74b00000 {
Expand Down
6 changes: 4 additions & 2 deletions dts/arm64/fvp/fvp-aemv8r.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,13 @@
mdio: mdio {
compatible = "smsc,lan91c111-mdio";
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;

phy: ethernet-phy {
phy: ethernet-phy@0 {
compatible = "ethernet-phy";
status = "disabled";
address = <0>;
reg = <0>;
};
};
};
Expand Down
3 changes: 1 addition & 2 deletions dts/bindings/ethernet/ethernet-phy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ compatible: "ethernet-phy"
include: phy.yaml

properties:
address:
type: int
reg:
required: true
description: PHY address
no-reset:
Expand Down
9 changes: 0 additions & 9 deletions dts/bindings/mdio/adi,adin2111-mdio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,3 @@ compatible: "adi,adin2111-mdio"
include: mdio-controller.yaml

on-bus: adin2111

properties:
"#address-cells":
required: true
const: 1

"#size-cells":
required: true
const: 0
9 changes: 9 additions & 0 deletions dts/bindings/mdio/mdio-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,12 @@
include: base.yaml

bus: mdio

properties:
"#address-cells":
required: true
const: 1

"#size-cells":
required: true
const: 0
2 changes: 2 additions & 0 deletions dts/xtensa/espressif/esp32/esp32_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
compatible = "espressif,esp32-mdio";
clocks = <&rtc ESP32_EMAC_MODULE>;
status = "disabled";
#address-cells = <1>;
#size-cells = <0>;
};

pinctrl: pin-controller {
Expand Down
4 changes: 4 additions & 0 deletions tests/drivers/build_all/mdio/app.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
mdc-gpios = <&test_gpio 0 0>;
mdio-gpios = <&test_gpio 0 0>;
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
};

test_mdio1: mdio@33334444 {
Expand All @@ -37,6 +39,8 @@
mdc-gpios = <&test_gpio 0 0>;
mdio-gpios = <&test_gpio 0 0>;
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
};
};
};

0 comments on commit d528757

Please sign in to comment.