Skip to content

Commit

Permalink
ethernet: smsc91x: rework the device node hierarchy
Browse files Browse the repository at this point in the history
Rework the devicetree definition for smsc91x to put the mdio and
ethernet device at the same level, and make the phy a child of the mdio
node.

This allows matching up the device initialization sequence with the
devicetree hierarchy.

Signed-off-by: Fabio Baltieri <[email protected]>
  • Loading branch information
fabiobaltieri authored and carlescufi committed Aug 16, 2023
1 parent e9e111b commit f2e2756
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 21 deletions.
21 changes: 13 additions & 8 deletions boards/arm64/fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a.dts
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,27 @@
clocks = <&uartclk>;
};

eth: ethernet@1a000000 {
compatible = "smsc,lan91c111";
ethernet@1a000000 {
reg = <0x1a000000 0x1000>;
interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>;
status = "disabled";

phy: phy {
compatible = "ethernet-phy";
eth: ethernet {
compatible = "smsc,lan91c111";
interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>;
status = "disabled";
address = <0>;
mdio = <&mdio>;

phy-handle = <&phy>;
};

mdio: mdio {
compatible = "smsc,lan91c111-mdio";
status = "disabled";

phy: phy {
compatible = "ethernet-phy";
status = "disabled";
address = <0>;
mdio = <&mdio>;
};
};
};

Expand Down
6 changes: 3 additions & 3 deletions drivers/ethernet/eth_smsc91x.c
Original file line number Diff line number Diff line change
Expand Up @@ -821,8 +821,8 @@ int eth_init(const struct device *dev)
static struct eth_context eth_0_context;

static struct eth_config eth_0_config = {
DEVICE_MMIO_ROM_INIT(DT_DRV_INST(0)),
.phy_dev = DEVICE_DT_GET(DT_INST_CHILD(0, phy)),
DEVICE_MMIO_ROM_INIT(DT_PARENT(DT_DRV_INST(0))),
.phy_dev = DEVICE_DT_GET(DT_INST_PHANDLE(0, phy_handle)),
};

ETH_NET_DEVICE_DT_INST_DEFINE(0,
Expand Down Expand Up @@ -879,7 +879,7 @@ static const struct mdio_driver_api mdio_smsc_api = {
};

const struct mdio_smsc_config mdio_smsc_config_0 = {
.eth_dev = DEVICE_DT_GET(DT_INST_PARENT(0)),
.eth_dev = DEVICE_DT_GET(DT_CHILD(DT_INST_PARENT(0), ethernet)),
};

DEVICE_DT_INST_DEFINE(0, NULL, NULL, NULL, &mdio_smsc_config_0, POST_KERNEL,
Expand Down
21 changes: 13 additions & 8 deletions dts/arm64/fvp/fvp-aemv8r.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,27 @@
clocks = <&uartclk>;
};

eth: ethernet@9a000000 {
compatible = "smsc,lan91c111";
ethernet@9a000000 {
reg = <0x9a000000 0x1000>;
interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>;
status = "disabled";

phy: phy {
compatible = "ethernet-phy";
eth: ethernet {
compatible = "smsc,lan91c111";
interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>;
status = "disabled";
address = <0>;
mdio = <&mdio>;

phy-handle = <&phy>;
};

mdio: mdio {
compatible = "smsc,lan91c111-mdio";
status = "disabled";

phy: phy {
compatible = "ethernet-phy";
status = "disabled";
address = <0>;
mdio = <&mdio>;
};
};
};
};
Expand Down
4 changes: 2 additions & 2 deletions dts/bindings/ethernet/smsc,lan91c111.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ description: SMSC (now Microchip) LAN91C111 Ethernet controller

compatible: "smsc,lan91c111"

include: base.yaml
include: [ethernet-controller.yaml, base.yaml]

properties:
reg:
phy-handle:
required: true

interrupts:
Expand Down

0 comments on commit f2e2756

Please sign in to comment.