The module is built as xilinx_emac.ko while the platform driver it registers is named xilinx_axienet. For a device tree instantiation that mismatch does not matter, because the OF match table supplies the modalias udev uses to load the module. A device registered by name from another driver has no OF node and so no OF modalias. It advertises platform:xilinx_axienet, which matches nothing, and the device is created but never bound. ptp_ocp is going to register the AXI Ethernet MAC of the ADVA TimeCard X2 this way, as a child platform device described by a software node. Add the corresponding MODULE_ALIAS so name-based instantiation can autoload the driver, and give the name a define now that it is used in more than one place. Tested on the X2 with a local ptp_ocp change: with this patch the module is loaded and binds when ptp_ocp registers the device; without it the device stays unbound until xilinx_emac is loaded by hand. Assisted-by: LLM sparse Signed-off-by: Sagi Maimon --- drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c index cfef8ad75909..ff1837103553 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c @@ -48,6 +48,7 @@ #include "xilinx_axienet.h" /* Descriptors defines for Tx and Rx DMA */ +#define AXIENET_DRIVER_NAME "xilinx_axienet" #define TX_BD_NUM_DEFAULT 128 #define RX_BD_NUM_DEFAULT 1024 #define TX_BD_NUM_MIN (MAX_SKB_FRAGS + 1) @@ -3223,7 +3224,7 @@ static struct platform_driver axienet_driver = { .remove = axienet_remove, .shutdown = axienet_shutdown, .driver = { - .name = "xilinx_axienet", + .name = AXIENET_DRIVER_NAME, .pm = &axienet_pm_ops, .of_match_table = axienet_of_match, }, @@ -3231,6 +3232,13 @@ static struct platform_driver axienet_driver = { module_platform_driver(axienet_driver); +/* The module is named xilinx_emac, the platform driver xilinx_axienet. A + * device registered by name rather than from firmware advertises a + * platform:xilinx_axienet modalias, which without this matches no module: + * udev cannot autoload the driver and the device stays unbound. + */ +MODULE_ALIAS("platform:" AXIENET_DRIVER_NAME); + MODULE_DESCRIPTION("Xilinx Axi Ethernet driver"); MODULE_AUTHOR("Xilinx"); MODULE_LICENSE("GPL"); -- 2.47.0