Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: drivers: build_all: ethernet: Test handling plural "compatible"s #82693

Merged
merged 2 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 23 additions & 23 deletions drivers/ethernet/phy/phy_adin2111.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@

#include <zephyr/logging/log.h>

#if DT_NODE_HAS_STATUS_OKAY(DT_INST(0, adi_adin2111_phy))
#define DT_DRV_COMPAT adi_adin2111_phy
#else
#define DT_DRV_COMPAT adi_adin1100_phy
#endif

LOG_MODULE_REGISTER(DT_DRV_COMPAT, CONFIG_PHY_LOG_LEVEL);

#include <errno.h>
Expand Down Expand Up @@ -636,22 +630,28 @@ static DEVICE_API(ethphy, phy_adin2111_api) = {
.write = phy_adin2111_reg_write,
};

#define ADIN2111_PHY_INITIALIZE(n) \
static const struct phy_adin2111_config phy_adin2111_config_##n = { \
.mdio = DEVICE_DT_GET(DT_INST_BUS(n)), \
.phy_addr = DT_INST_REG_ADDR(n), \
.led0_en = DT_INST_PROP(n, led0_en), \
.led1_en = DT_INST_PROP(n, led1_en), \
.tx_24v = !(DT_INST_PROP(n, disable_tx_mode_24v)), \
IF_ENABLED(DT_HAS_COMPAT_STATUS_OKAY(adi_adin1100_phy), \
(.mii = 1)) \
}; \
static struct phy_adin2111_data phy_adin2111_data_##n = { \
.sem = Z_SEM_INITIALIZER(phy_adin2111_data_##n.sem, 1, 1), \
}; \
DEVICE_DT_INST_DEFINE(n, &phy_adin2111_init, NULL, \
&phy_adin2111_data_##n, &phy_adin2111_config_##n, \
POST_KERNEL, CONFIG_PHY_INIT_PRIORITY, \
#define ADIN2111_PHY_INITIALIZE(n, model) \
static const struct phy_adin2111_config phy_adin##model##_config_##n = { \
.mdio = DEVICE_DT_GET(DT_INST_BUS(n)), \
.phy_addr = DT_INST_REG_ADDR(n), \
.led0_en = DT_INST_PROP(n, led0_en), \
.led1_en = DT_INST_PROP(n, led1_en), \
.tx_24v = !(DT_INST_PROP(n, disable_tx_mode_24v)), \
IF_ENABLED(DT_HAS_COMPAT_STATUS_OKAY(adi_adin1100_phy), \
(.mii = 1)) \
}; \
static struct phy_adin2111_data phy_adin##model##_data_##n = { \
.sem = Z_SEM_INITIALIZER(phy_adin##model##_data_##n.sem, 1, 1), \
}; \
DEVICE_DT_INST_DEFINE(n, &phy_adin2111_init, NULL, \
&phy_adin##model##_data_##n, \
&phy_adin##model##_config_##n, \
POST_KERNEL, CONFIG_PHY_INIT_PRIORITY, \
&phy_adin2111_api);

DT_INST_FOREACH_STATUS_OKAY(ADIN2111_PHY_INITIALIZE)
#define DT_DRV_COMPAT adi_adin2111_phy
DT_INST_FOREACH_STATUS_OKAY_VARGS(ADIN2111_PHY_INITIALIZE, 2111)
#undef DT_DRV_COMPAT
#define DT_DRV_COMPAT adi_adin1100_phy
DT_INST_FOREACH_STATUS_OKAY_VARGS(ADIN2111_PHY_INITIALIZE, 1100)
#undef DT_DRV_COMPAT
30 changes: 30 additions & 0 deletions tests/drivers/build_all/ethernet/app.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,36 @@
int-gpios = <&test_gpio 0 0>;
microchip,interface-type = "rmii";
};

ethernet-phy@3 {
reg = <0x3>;
compatible = "microchip,ksz8794";
status = "okay";
reset-gpios = <&test_gpio 0 0>;
int-gpios = <&test_gpio 0 0>;
microchip,interface-type = "rmii";
};

ethernet-phy@4 {
reg = <0x4>;
compatible = "microchip,ksz8863";
status = "okay";
reset-gpios = <&test_gpio 0 0>;
int-gpios = <&test_gpio 0 0>;
microchip,interface-type = "rmii";
};

ethernet-phy@5 {
reg = <0x5>;
compatible = "adi,adin1100-phy";
status = "okay";
};

ethernet-phy@6 {
reg = <0x6>;
compatible = "adi,adin2111-phy";
status = "okay";
};
};
};
};
Expand Down
Loading