From 9d5a38c2143e32d36908cbd5ef53a688e89edcb5 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:41 +0100 Subject: net: phy: Factor manual relocation into separate function Create separate function to implement manual relocation of PHY driver functions and make use of that function. This is a preparatory patch for introduction of PHY driver definition using linker lists. No functional change. Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/phy.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 80230b907c..5097c32b82 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -470,6 +470,28 @@ static int genphy_init(void) static LIST_HEAD(phy_drivers); +#ifdef CONFIG_NEEDS_MANUAL_RELOC +static void phy_drv_reloc(struct phy_driver *drv) +{ + if (drv->probe) + drv->probe += gd->reloc_off; + if (drv->config) + drv->config += gd->reloc_off; + if (drv->startup) + drv->startup += gd->reloc_off; + if (drv->shutdown) + drv->shutdown += gd->reloc_off; + if (drv->readext) + drv->readext += gd->reloc_off; + if (drv->writeext) + drv->writeext += gd->reloc_off; + if (drv->read_mmd) + drv->read_mmd += gd->reloc_off; + if (drv->write_mmd) + drv->write_mmd += gd->reloc_off; +} +#endif + int phy_init(void) { #ifdef CONFIG_NEEDS_MANUAL_RELOC @@ -582,22 +604,7 @@ int phy_register(struct phy_driver *drv) list_add_tail(&drv->list, &phy_drivers); #ifdef CONFIG_NEEDS_MANUAL_RELOC - if (drv->probe) - drv->probe += gd->reloc_off; - if (drv->config) - drv->config += gd->reloc_off; - if (drv->startup) - drv->startup += gd->reloc_off; - if (drv->shutdown) - drv->shutdown += gd->reloc_off; - if (drv->readext) - drv->readext += gd->reloc_off; - if (drv->writeext) - drv->writeext += gd->reloc_off; - if (drv->read_mmd) - drv->read_mmd += gd->reloc_off; - if (drv->write_mmd) - drv->write_mmd += gd->reloc_off; + phy_drv_reloc(drv); #endif return 0; } -- cgit v1.2.3 From 7940a93eb9778d275d5c2adcc8ee04e2f52d7b57 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:42 +0100 Subject: net: phy: Iterate over both registered PHYs and struct phy_driver linker list Introduce U_BOOT_PHY_DRIVER() macro which is used to add struct phy_driver into a new linker list section containing all compiled in struct phy_driver drivers. This is so far empty until PHY drivers are converted over to this macro. Iterate over both drivers registered using soon to be legacy phy_register() as well as drivers in the new linker list when looking up a suitable PHY driver. This way, PHY drivers can be converted over to the new macro one driver at a time. The relocation of callbacks for linker list based drivers now happens in phy_init() call as the drivers are available at that point in time, and phy_register() is not called for those drivers. Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/phy.c | 15 +++++++++++++++ include/phy.h | 7 +++++++ 2 files changed, 22 insertions(+) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 5097c32b82..50bfabbb76 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -495,6 +495,9 @@ static void phy_drv_reloc(struct phy_driver *drv) int phy_init(void) { #ifdef CONFIG_NEEDS_MANUAL_RELOC + const int ll_n_ents = ll_entry_count(struct phy_driver, phy_driver); + struct phy_driver *drv, *ll_entry; + /* * The pointers inside phy_drivers also needs to be updated incase of * manual reloc, without which these points to some invalid @@ -504,6 +507,11 @@ int phy_init(void) head->next = (void *)head->next + gd->reloc_off; head->prev = (void *)head->prev + gd->reloc_off; + + /* Perform manual relocation on linker list based PHY drivers */ + ll_entry = ll_entry_start(struct phy_driver, phy_driver); + for (drv = ll_entry; drv != ll_entry + ll_n_ents; drv++) + phy_drv_reloc(drv); #endif #ifdef CONFIG_B53_SWITCH @@ -660,6 +668,8 @@ static struct phy_driver *generic_for_phy(struct phy_device *phydev) static struct phy_driver *get_phy_driver(struct phy_device *phydev) { + const int ll_n_ents = ll_entry_count(struct phy_driver, phy_driver); + struct phy_driver *ll_entry; struct list_head *entry; int phy_id = phydev->phy_id; struct phy_driver *drv = NULL; @@ -670,6 +680,11 @@ static struct phy_driver *get_phy_driver(struct phy_device *phydev) return drv; } + ll_entry = ll_entry_start(struct phy_driver, phy_driver); + for (drv = ll_entry; drv != ll_entry + ll_n_ents; drv++) + if ((drv->uid & drv->mask) == (phy_id & drv->mask)) + return drv; + /* If we made it here, there's no driver for this PHY */ return generic_for_phy(phydev); } diff --git a/include/phy.h b/include/phy.h index 87aa86c2e7..1eccfacec6 100644 --- a/include/phy.h +++ b/include/phy.h @@ -345,6 +345,13 @@ int phy_fixed_init(void); int phy_ncsi_init(void); int phy_xilinx_gmii2rgmii_init(void); +/** + * U_BOOT_PHY_DRIVER() - Declare a new U-Boot driver + * @__name: name of the driver + */ +#define U_BOOT_PHY_DRIVER(__name) \ + ll_entry_declare(struct phy_driver, __name, phy_driver) + int board_phy_config(struct phy_device *phydev); int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id); -- cgit v1.2.3 From 4de8644504a69285fa9e28da072ab1ec298543f5 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:43 +0100 Subject: net: phy: adin: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/adin.c | 9 +-------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c index a5bfd960d9..fb9f1e4c70 100644 --- a/drivers/net/phy/adin.c +++ b/drivers/net/phy/adin.c @@ -252,7 +252,7 @@ static int adin1300_config(struct phy_device *phydev) return genphy_config(phydev); } -static struct phy_driver ADIN1300_driver = { +U_BOOT_PHY_DRIVER(ADIN1300) = { .name = "ADIN1300", .uid = PHY_ID_ADIN1300, .mask = 0xffffffff, @@ -261,10 +261,3 @@ static struct phy_driver ADIN1300_driver = { .startup = genphy_startup, .shutdown = genphy_shutdown, }; - -int phy_adin_init(void) -{ - phy_register(&ADIN1300_driver); - - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 50bfabbb76..ecb4b72ed1 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -520,9 +520,6 @@ int phy_init(void) #ifdef CONFIG_MV88E61XX_SWITCH phy_mv88e61xx_init(); #endif -#ifdef CONFIG_PHY_ADIN - phy_adin_init(); -#endif #ifdef CONFIG_PHY_AQUANTIA phy_aquantia_init(); #endif diff --git a/include/phy.h b/include/phy.h index 1eccfacec6..dbc0da7e08 100644 --- a/include/phy.h +++ b/include/phy.h @@ -317,7 +317,6 @@ int gen10g_discover_mmds(struct phy_device *phydev); int phy_b53_init(void); int phy_mv88e61xx_init(void); -int phy_adin_init(void); int phy_aquantia_init(void); int phy_atheros_init(void); int phy_broadcom_init(void); -- cgit v1.2.3 From a5fbc10560699722b3a64a02ad0ce5cdae5d473f Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:44 +0100 Subject: net: phy: aquantia: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/aquantia.c | 33 +++++++++------------------------ drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 9 insertions(+), 28 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/aquantia.c b/drivers/net/phy/aquantia.c index fa887ade0c..a958e88d44 100644 --- a/drivers/net/phy/aquantia.c +++ b/drivers/net/phy/aquantia.c @@ -598,7 +598,7 @@ int aquantia_startup(struct phy_device *phydev) return 0; } -static struct phy_driver aq1202_driver = { +U_BOOT_PHY_DRIVER(aq1202) = { .name = "Aquantia AQ1202", .uid = 0x3a1b445, .mask = 0xfffffff0, @@ -611,7 +611,7 @@ static struct phy_driver aq1202_driver = { .shutdown = &gen10g_shutdown, }; -static struct phy_driver aq2104_driver = { +U_BOOT_PHY_DRIVER(aq2104) = { .name = "Aquantia AQ2104", .uid = 0x3a1b460, .mask = 0xfffffff0, @@ -624,7 +624,7 @@ static struct phy_driver aq2104_driver = { .shutdown = &gen10g_shutdown, }; -static struct phy_driver aqr105_driver = { +U_BOOT_PHY_DRIVER(aqr105) = { .name = "Aquantia AQR105", .uid = 0x3a1b4a2, .mask = 0xfffffff0, @@ -638,7 +638,7 @@ static struct phy_driver aqr105_driver = { .data = AQUANTIA_GEN1, }; -static struct phy_driver aqr106_driver = { +U_BOOT_PHY_DRIVER(aqr106) = { .name = "Aquantia AQR106", .uid = 0x3a1b4d0, .mask = 0xfffffff0, @@ -651,7 +651,7 @@ static struct phy_driver aqr106_driver = { .shutdown = &gen10g_shutdown, }; -static struct phy_driver aqr107_driver = { +U_BOOT_PHY_DRIVER(aqr107) = { .name = "Aquantia AQR107", .uid = 0x3a1b4e0, .mask = 0xfffffff0, @@ -665,7 +665,7 @@ static struct phy_driver aqr107_driver = { .data = AQUANTIA_GEN2, }; -static struct phy_driver aqr112_driver = { +U_BOOT_PHY_DRIVER(aqr112) = { .name = "Aquantia AQR112", .uid = 0x3a1b660, .mask = 0xfffffff0, @@ -679,7 +679,7 @@ static struct phy_driver aqr112_driver = { .data = AQUANTIA_GEN3, }; -static struct phy_driver aqr113c_driver = { +U_BOOT_PHY_DRIVER(aqr113c) = { .name = "Aquantia AQR113C", .uid = 0x31c31c12, .mask = 0xfffffff0, @@ -693,7 +693,7 @@ static struct phy_driver aqr113c_driver = { .data = AQUANTIA_GEN3, }; -static struct phy_driver aqr405_driver = { +U_BOOT_PHY_DRIVER(aqr405) = { .name = "Aquantia AQR405", .uid = 0x3a1b4b2, .mask = 0xfffffff0, @@ -707,7 +707,7 @@ static struct phy_driver aqr405_driver = { .data = AQUANTIA_GEN1, }; -static struct phy_driver aqr412_driver = { +U_BOOT_PHY_DRIVER(aqr412) = { .name = "Aquantia AQR412", .uid = 0x3a1b710, .mask = 0xfffffff0, @@ -720,18 +720,3 @@ static struct phy_driver aqr412_driver = { .shutdown = &gen10g_shutdown, .data = AQUANTIA_GEN3, }; - -int phy_aquantia_init(void) -{ - phy_register(&aq1202_driver); - phy_register(&aq2104_driver); - phy_register(&aqr105_driver); - phy_register(&aqr106_driver); - phy_register(&aqr107_driver); - phy_register(&aqr112_driver); - phy_register(&aqr113c_driver); - phy_register(&aqr405_driver); - phy_register(&aqr412_driver); - - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index ecb4b72ed1..4f17f98876 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -520,9 +520,6 @@ int phy_init(void) #ifdef CONFIG_MV88E61XX_SWITCH phy_mv88e61xx_init(); #endif -#ifdef CONFIG_PHY_AQUANTIA - phy_aquantia_init(); -#endif #ifdef CONFIG_PHY_ATHEROS phy_atheros_init(); #endif diff --git a/include/phy.h b/include/phy.h index dbc0da7e08..a0060cd19e 100644 --- a/include/phy.h +++ b/include/phy.h @@ -317,7 +317,6 @@ int gen10g_discover_mmds(struct phy_device *phydev); int phy_b53_init(void); int phy_mv88e61xx_init(void); -int phy_aquantia_init(void); int phy_atheros_init(void); int phy_broadcom_init(void); int phy_cortina_init(void); -- cgit v1.2.3 From fba31ab92c16f1757395b424b774e17c8c47aa97 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:45 +0100 Subject: net: phy: atheros: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/atheros.c | 15 +++------------ drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 3 insertions(+), 16 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/atheros.c b/drivers/net/phy/atheros.c index c6f9f91645..abb7bdf537 100644 --- a/drivers/net/phy/atheros.c +++ b/drivers/net/phy/atheros.c @@ -333,7 +333,7 @@ static int ar803x_config(struct phy_device *phydev) return 0; } -static struct phy_driver AR8021_driver = { +U_BOOT_PHY_DRIVER(AR8021) = { .name = "AR8021", .uid = AR8021_PHY_ID, .mask = 0xfffffff0, @@ -343,7 +343,7 @@ static struct phy_driver AR8021_driver = { .shutdown = genphy_shutdown, }; -static struct phy_driver AR8031_driver = { +U_BOOT_PHY_DRIVER(AR8031) = { .name = "AR8031/AR8033", .uid = AR8031_PHY_ID, .mask = 0xffffffef, @@ -353,7 +353,7 @@ static struct phy_driver AR8031_driver = { .shutdown = genphy_shutdown, }; -static struct phy_driver AR8035_driver = { +U_BOOT_PHY_DRIVER(AR8035) = { .name = "AR8035", .uid = AR8035_PHY_ID, .mask = 0xffffffef, @@ -362,12 +362,3 @@ static struct phy_driver AR8035_driver = { .startup = genphy_startup, .shutdown = genphy_shutdown, }; - -int phy_atheros_init(void) -{ - phy_register(&AR8021_driver); - phy_register(&AR8031_driver); - phy_register(&AR8035_driver); - - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 4f17f98876..853302cf97 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -520,9 +520,6 @@ int phy_init(void) #ifdef CONFIG_MV88E61XX_SWITCH phy_mv88e61xx_init(); #endif -#ifdef CONFIG_PHY_ATHEROS - phy_atheros_init(); -#endif #ifdef CONFIG_PHY_BROADCOM phy_broadcom_init(); #endif diff --git a/include/phy.h b/include/phy.h index a0060cd19e..a1be1fbe1a 100644 --- a/include/phy.h +++ b/include/phy.h @@ -317,7 +317,6 @@ int gen10g_discover_mmds(struct phy_device *phydev); int phy_b53_init(void); int phy_mv88e61xx_init(void); -int phy_atheros_init(void); int phy_broadcom_init(void); int phy_cortina_init(void); int phy_cortina_access_init(void); -- cgit v1.2.3 From 761e4060fecb2f5320df0b8f6babca836bb32de1 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:46 +0100 Subject: net: phy: b53: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/b53.c | 9 +-------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/b53.c b/drivers/net/phy/b53.c index c706e2b9bd..26e8e2fe64 100644 --- a/drivers/net/phy/b53.c +++ b/drivers/net/phy/b53.c @@ -612,7 +612,7 @@ static int b53_phy_startup(struct phy_device *phydev) return 0; } -static struct phy_driver b53_driver = { +U_BOOT_PHY_DRIVER(b53) = { .name = "Broadcom BCM53125", .uid = 0x03625c00, .mask = 0xfffffc00, @@ -623,13 +623,6 @@ static struct phy_driver b53_driver = { .shutdown = &genphy_shutdown, }; -int phy_b53_init(void) -{ - phy_register(&b53_driver); - - return 0; -} - int do_b53_reg_read(const char *name, int argc, char *const argv[]) { u8 page, offset, width; diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 853302cf97..7a7762377b 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_B53_SWITCH - phy_b53_init(); -#endif #ifdef CONFIG_MV88E61XX_SWITCH phy_mv88e61xx_init(); #endif diff --git a/include/phy.h b/include/phy.h index a1be1fbe1a..88c9013f1f 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_b53_init(void); int phy_mv88e61xx_init(void); int phy_broadcom_init(void); int phy_cortina_init(void); -- cgit v1.2.3 From c00f3f826f631f21006b5a6c4dcaf969ad6265e3 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:47 +0100 Subject: net: phy: broadcom: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/broadcom.c | 18 ++++-------------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 4 insertions(+), 18 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 566fcb8de7..ea98cfcc1b 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -323,7 +323,7 @@ static int bcm5482_startup(struct phy_device *phydev) return bcm54xx_parse_status(phydev); } -static struct phy_driver BCM5461S_driver = { +U_BOOT_PHY_DRIVER(bcm5461s) = { .name = "Broadcom BCM5461S", .uid = 0x2060c0, .mask = 0xfffff0, @@ -333,7 +333,7 @@ static struct phy_driver BCM5461S_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver BCM5464S_driver = { +U_BOOT_PHY_DRIVER(bcm5464s) = { .name = "Broadcom BCM5464S", .uid = 0x2060b0, .mask = 0xfffff0, @@ -343,7 +343,7 @@ static struct phy_driver BCM5464S_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver BCM5482S_driver = { +U_BOOT_PHY_DRIVER(bcm5482s) = { .name = "Broadcom BCM5482S", .uid = 0x143bcb0, .mask = 0xffffff0, @@ -353,7 +353,7 @@ static struct phy_driver BCM5482S_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver BCM_CYGNUS_driver = { +U_BOOT_PHY_DRIVER(bcm_cygnus) = { .name = "Broadcom CYGNUS GPHY", .uid = 0xae025200, .mask = 0xfffff0, @@ -362,13 +362,3 @@ static struct phy_driver BCM_CYGNUS_driver = { .startup = &bcm_cygnus_startup, .shutdown = &genphy_shutdown, }; - -int phy_broadcom_init(void) -{ - phy_register(&BCM5482S_driver); - phy_register(&BCM5464S_driver); - phy_register(&BCM5461S_driver); - phy_register(&BCM_CYGNUS_driver); - - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 7a7762377b..4b1fed1ff6 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -517,9 +517,6 @@ int phy_init(void) #ifdef CONFIG_MV88E61XX_SWITCH phy_mv88e61xx_init(); #endif -#ifdef CONFIG_PHY_BROADCOM - phy_broadcom_init(); -#endif #ifdef CONFIG_PHY_CORTINA phy_cortina_init(); #endif diff --git a/include/phy.h b/include/phy.h index 88c9013f1f..cecfbe6968 100644 --- a/include/phy.h +++ b/include/phy.h @@ -316,7 +316,6 @@ int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); int phy_mv88e61xx_init(void); -int phy_broadcom_init(void); int phy_cortina_init(void); int phy_cortina_access_init(void); int phy_davicom_init(void); -- cgit v1.2.3 From 227650f0e75ae550350270b953ff828c9c51aa8e Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:48 +0100 Subject: net: phy: ca_phy: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/ca_phy.c | 11 ++--------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 2 insertions(+), 13 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/ca_phy.c b/drivers/net/phy/ca_phy.c index 9180a41111..edef21867b 100644 --- a/drivers/net/phy/ca_phy.c +++ b/drivers/net/phy/ca_phy.c @@ -104,7 +104,7 @@ static int rtl8211_probe(struct phy_device *phydev) } /* Support for RTL8211 External PHY */ -static struct phy_driver rtl8211_external_driver = { +U_BOOT_PHY_DRIVER(rtl8211_external) = { .name = "Cortina RTL8211 External", .uid = PHY_ID_RTL8211_EXT, .mask = PHY_ID_MASK, @@ -115,7 +115,7 @@ static struct phy_driver rtl8211_external_driver = { }; /* Support for RTL8211 Internal PHY */ -static struct phy_driver rtl8211_internal_driver = { +U_BOOT_PHY_DRIVER(rtl8211_internal) = { .name = "Cortina RTL8211 Inrernal", .uid = PHY_ID_RTL8211_INT, .mask = PHY_ID_MASK, @@ -124,10 +124,3 @@ static struct phy_driver rtl8211_internal_driver = { .probe = &rtl8211_probe, .startup = &genphy_startup, }; - -int phy_cortina_access_init(void) -{ - phy_register(&rtl8211_external_driver); - phy_register(&rtl8211_internal_driver); - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 4b1fed1ff6..4446902ab6 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -520,9 +520,6 @@ int phy_init(void) #ifdef CONFIG_PHY_CORTINA phy_cortina_init(); #endif -#ifdef CONFIG_PHY_CORTINA_ACCESS - phy_cortina_access_init(); -#endif #ifdef CONFIG_PHY_DAVICOM phy_davicom_init(); #endif diff --git a/include/phy.h b/include/phy.h index cecfbe6968..50a5398281 100644 --- a/include/phy.h +++ b/include/phy.h @@ -317,7 +317,6 @@ int gen10g_discover_mmds(struct phy_device *phydev); int phy_mv88e61xx_init(void); int phy_cortina_init(void); -int phy_cortina_access_init(void); int phy_davicom_init(void); int phy_et1011c_init(void); int phy_lxt_init(void); -- cgit v1.2.3 From 579f359269266b99115b68679a6f5acbcfbc1e7d Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:49 +0100 Subject: net: phy: cortina: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/cortina.c | 11 ++--------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 2 insertions(+), 13 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/cortina.c b/drivers/net/phy/cortina.c index df5a73d611..1cf8b28f58 100644 --- a/drivers/net/phy/cortina.c +++ b/drivers/net/phy/cortina.c @@ -382,7 +382,7 @@ int cs4223_startup(struct phy_device *phydev) return 0; } -static struct phy_driver cs4340_driver = { +U_BOOT_PHY_DRIVER(cs4340) = { .name = "Cortina CS4315/CS4340", .uid = PHY_UID_CS4340, .mask = 0xfffffff0, @@ -396,7 +396,7 @@ static struct phy_driver cs4340_driver = { .shutdown = &gen10g_shutdown, }; -static struct phy_driver cs4223_driver = { +U_BOOT_PHY_DRIVER(cs4223) = { .name = "Cortina CS4223", .uid = PHY_UID_CS4223, .mask = 0x0ffff00f, @@ -409,13 +409,6 @@ static struct phy_driver cs4223_driver = { .shutdown = &gen10g_shutdown, }; -int phy_cortina_init(void) -{ - phy_register(&cs4340_driver); - phy_register(&cs4223_driver); - return 0; -} - int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id) { int phy_reg; diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 4446902ab6..d595290dd4 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -517,9 +517,6 @@ int phy_init(void) #ifdef CONFIG_MV88E61XX_SWITCH phy_mv88e61xx_init(); #endif -#ifdef CONFIG_PHY_CORTINA - phy_cortina_init(); -#endif #ifdef CONFIG_PHY_DAVICOM phy_davicom_init(); #endif diff --git a/include/phy.h b/include/phy.h index 50a5398281..797139bf68 100644 --- a/include/phy.h +++ b/include/phy.h @@ -316,7 +316,6 @@ int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); int phy_mv88e61xx_init(void); -int phy_cortina_init(void); int phy_davicom_init(void); int phy_et1011c_init(void); int phy_lxt_init(void); -- cgit v1.2.3 From 7e9ce5adf6ff14cc051fd9fe11107cd6ce0ba0ef Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:50 +0100 Subject: net: phy: davicom: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/davicom.c | 9 +-------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/davicom.c b/drivers/net/phy/davicom.c index 4666497d44..31ffa1ac7a 100644 --- a/drivers/net/phy/davicom.c +++ b/drivers/net/phy/davicom.c @@ -69,7 +69,7 @@ static int dm9161_startup(struct phy_device *phydev) return dm9161_parse_status(phydev); } -static struct phy_driver DM9161_driver = { +U_BOOT_PHY_DRIVER(dm9161) = { .name = "Davicom DM9161E", .uid = 0x181b880, .mask = 0xffffff0, @@ -78,10 +78,3 @@ static struct phy_driver DM9161_driver = { .startup = &dm9161_startup, .shutdown = &genphy_shutdown, }; - -int phy_davicom_init(void) -{ - phy_register(&DM9161_driver); - - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index d595290dd4..6d7e07c25a 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -517,9 +517,6 @@ int phy_init(void) #ifdef CONFIG_MV88E61XX_SWITCH phy_mv88e61xx_init(); #endif -#ifdef CONFIG_PHY_DAVICOM - phy_davicom_init(); -#endif #ifdef CONFIG_PHY_ET1011C phy_et1011c_init(); #endif diff --git a/include/phy.h b/include/phy.h index 797139bf68..51c2ddb7e4 100644 --- a/include/phy.h +++ b/include/phy.h @@ -316,7 +316,6 @@ int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); int phy_mv88e61xx_init(void); -int phy_davicom_init(void); int phy_et1011c_init(void); int phy_lxt_init(void); int phy_marvell_init(void); -- cgit v1.2.3 From abdbfad25c3712b5d0e8ccc514f85eed8aba7b20 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:51 +0100 Subject: net: phy: mv88e61xx: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/mv88e61xx.c | 15 +++------------ drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 3 insertions(+), 16 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/mv88e61xx.c b/drivers/net/phy/mv88e61xx.c index 7ab60164c7..85778106ed 100644 --- a/drivers/net/phy/mv88e61xx.c +++ b/drivers/net/phy/mv88e61xx.c @@ -1127,7 +1127,7 @@ static int mv88e61xx_phy_startup(struct phy_device *phydev) return 0; } -static struct phy_driver mv88e61xx_driver = { +U_BOOT_PHY_DRIVER(mv88e61xx) = { .name = "Marvell MV88E61xx", .uid = 0x01410eb1, .mask = 0xfffffff0, @@ -1138,7 +1138,7 @@ static struct phy_driver mv88e61xx_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver mv88e609x_driver = { +U_BOOT_PHY_DRIVER(mv88e609x) = { .name = "Marvell MV88E609x", .uid = 0x1410c89, .mask = 0xfffffff0, @@ -1149,7 +1149,7 @@ static struct phy_driver mv88e609x_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver mv88e6071_driver = { +U_BOOT_PHY_DRIVER(mv88e6071) = { .name = "Marvell MV88E6071", .uid = 0x1410db0, .mask = 0xfffffff0, @@ -1160,15 +1160,6 @@ static struct phy_driver mv88e6071_driver = { .shutdown = &genphy_shutdown, }; -int phy_mv88e61xx_init(void) -{ - phy_register(&mv88e61xx_driver); - phy_register(&mv88e609x_driver); - phy_register(&mv88e6071_driver); - - return 0; -} - /* * Overload weak get_phy_id definition since we need non-standard functions * to read PHY registers diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 6d7e07c25a..7312719cdb 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_MV88E61XX_SWITCH - phy_mv88e61xx_init(); -#endif #ifdef CONFIG_PHY_ET1011C phy_et1011c_init(); #endif diff --git a/include/phy.h b/include/phy.h index 51c2ddb7e4..9e5a9196cb 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_mv88e61xx_init(void); int phy_et1011c_init(void); int phy_lxt_init(void); int phy_marvell_init(void); -- cgit v1.2.3 From b20c53a93f9e6078bd65f1a8b4fd3e07d4ad26c6 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:52 +0100 Subject: net: phy: et1011c: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/et1011c.c | 9 +-------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/et1011c.c b/drivers/net/phy/et1011c.c index 7eff5ec7ca..fa4831427d 100644 --- a/drivers/net/phy/et1011c.c +++ b/drivers/net/phy/et1011c.c @@ -87,7 +87,7 @@ static int et1011c_startup(struct phy_device *phydev) return et1011c_parse_status(phydev); } -static struct phy_driver et1011c_driver = { +U_BOOT_PHY_DRIVER(et1011c) = { .name = "ET1011C", .uid = 0x0282f014, .mask = 0xfffffff0, @@ -95,10 +95,3 @@ static struct phy_driver et1011c_driver = { .config = &et1011c_config, .startup = &et1011c_startup, }; - -int phy_et1011c_init(void) -{ - phy_register(&et1011c_driver); - - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 7312719cdb..5b6e629437 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_ET1011C - phy_et1011c_init(); -#endif #ifdef CONFIG_PHY_LXT phy_lxt_init(); #endif diff --git a/include/phy.h b/include/phy.h index 9e5a9196cb..3bc4a0de72 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_et1011c_init(void); int phy_lxt_init(void); int phy_marvell_init(void); int phy_micrel_ksz8xxx_init(void); -- cgit v1.2.3 From f10c8938156ad5efa7da796ce76d6d9b5cd31606 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:53 +0100 Subject: net: phy: lxt: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/lxt.c | 9 +-------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/lxt.c b/drivers/net/phy/lxt.c index 2618deb009..20940033a3 100644 --- a/drivers/net/phy/lxt.c +++ b/drivers/net/phy/lxt.c @@ -58,7 +58,7 @@ static int lxt971_startup(struct phy_device *phydev) return lxt971_parse_status(phydev); } -static struct phy_driver LXT971_driver = { +U_BOOT_PHY_DRIVER(lxt971) = { .name = "LXT971", .uid = 0x1378e0, .mask = 0xfffff0, @@ -67,10 +67,3 @@ static struct phy_driver LXT971_driver = { .startup = &lxt971_startup, .shutdown = &genphy_shutdown, }; - -int phy_lxt_init(void) -{ - phy_register(&LXT971_driver); - - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 5b6e629437..e2e31773f6 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_LXT - phy_lxt_init(); -#endif #ifdef CONFIG_PHY_MARVELL phy_marvell_init(); #endif diff --git a/include/phy.h b/include/phy.h index 3bc4a0de72..a309056ce7 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_lxt_init(void); int phy_marvell_init(void); int phy_micrel_ksz8xxx_init(void); int phy_micrel_ksz90x1_init(void); -- cgit v1.2.3 From 9010be953e35d193c3948b221327d07eed9b6ae5 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:54 +0100 Subject: net: phy: marvell: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/marvell.c | 39 +++++++++++---------------------------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 11 insertions(+), 32 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index 1a25775eee..8992be6e89 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -693,7 +693,7 @@ static int m88e1680_config(struct phy_device *phydev) return 0; } -static struct phy_driver M88E1011S_driver = { +U_BOOT_PHY_DRIVER(m88e1011s) = { .name = "Marvell 88E1011S", .uid = 0x1410c60, .mask = 0xffffff0, @@ -703,7 +703,7 @@ static struct phy_driver M88E1011S_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver M88E1111S_driver = { +U_BOOT_PHY_DRIVER(m88e1111s) = { .name = "Marvell 88E1111S", .uid = 0x1410cc0, .mask = 0xffffff0, @@ -713,7 +713,7 @@ static struct phy_driver M88E1111S_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver M88E1118_driver = { +U_BOOT_PHY_DRIVER(m88e1118) = { .name = "Marvell 88E1118", .uid = 0x1410e10, .mask = 0xffffff0, @@ -723,7 +723,7 @@ static struct phy_driver M88E1118_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver M88E1118R_driver = { +U_BOOT_PHY_DRIVER(m88e1118r) = { .name = "Marvell 88E1118R", .uid = 0x1410e40, .mask = 0xffffff0, @@ -733,7 +733,7 @@ static struct phy_driver M88E1118R_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver M88E1121R_driver = { +U_BOOT_PHY_DRIVER(m88e1121r) = { .name = "Marvell 88E1121R", .uid = 0x1410cb0, .mask = 0xffffff0, @@ -743,7 +743,7 @@ static struct phy_driver M88E1121R_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver M88E1145_driver = { +U_BOOT_PHY_DRIVER(m88e1145) = { .name = "Marvell 88E1145", .uid = 0x1410cd0, .mask = 0xffffff0, @@ -753,7 +753,7 @@ static struct phy_driver M88E1145_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver M88E1149S_driver = { +U_BOOT_PHY_DRIVER(m88e1149s) = { .name = "Marvell 88E1149S", .uid = 0x1410ca0, .mask = 0xffffff0, @@ -763,7 +763,7 @@ static struct phy_driver M88E1149S_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver M88E1240_driver = { +U_BOOT_PHY_DRIVER(m88e1240) = { .name = "Marvell 88E1240", .uid = 0x1410e30, .mask = 0xffffff0, @@ -773,7 +773,7 @@ static struct phy_driver M88E1240_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver M88E151x_driver = { +U_BOOT_PHY_DRIVER(m88e151x) = { .name = "Marvell 88E151x", .uid = 0x1410dd0, .mask = 0xffffff0, @@ -785,7 +785,7 @@ static struct phy_driver M88E151x_driver = { .writeext = &m88e1xxx_phy_extwrite, }; -static struct phy_driver M88E1310_driver = { +U_BOOT_PHY_DRIVER(m88e1310) = { .name = "Marvell 88E1310", .uid = 0x01410e90, .mask = 0xffffff0, @@ -795,7 +795,7 @@ static struct phy_driver M88E1310_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver M88E1680_driver = { +U_BOOT_PHY_DRIVER(m88e1680) = { .name = "Marvell 88E1680", .uid = 0x1410ed0, .mask = 0xffffff0, @@ -804,20 +804,3 @@ static struct phy_driver M88E1680_driver = { .startup = &genphy_startup, .shutdown = &genphy_shutdown, }; - -int phy_marvell_init(void) -{ - phy_register(&M88E1310_driver); - phy_register(&M88E1149S_driver); - phy_register(&M88E1145_driver); - phy_register(&M88E1121R_driver); - phy_register(&M88E1118_driver); - phy_register(&M88E1118R_driver); - phy_register(&M88E1111S_driver); - phy_register(&M88E1011S_driver); - phy_register(&M88E1240_driver); - phy_register(&M88E151x_driver); - phy_register(&M88E1680_driver); - - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index e2e31773f6..efc75808ea 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_MARVELL - phy_marvell_init(); -#endif #ifdef CONFIG_PHY_MICREL_KSZ8XXX phy_micrel_ksz8xxx_init(); #endif diff --git a/include/phy.h b/include/phy.h index a309056ce7..77e46ebac8 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_marvell_init(void); int phy_micrel_ksz8xxx_init(void); int phy_micrel_ksz90x1_init(void); int phy_meson_gxl_init(void); -- cgit v1.2.3 From f282e32d0a4ccd8dbd5e71a8c70ffa57a274b266 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:55 +0100 Subject: net: phy: ksz8xxx: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/micrel_ksz8xxx.c | 29 ++++++++--------------------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 8 insertions(+), 25 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/micrel_ksz8xxx.c b/drivers/net/phy/micrel_ksz8xxx.c index 60d42fe984..b0f3abcb03 100644 --- a/drivers/net/phy/micrel_ksz8xxx.c +++ b/drivers/net/phy/micrel_ksz8xxx.c @@ -14,7 +14,7 @@ #include #include -static struct phy_driver KSZ804_driver = { +U_BOOT_PHY_DRIVER(ksz804) = { .name = "Micrel KSZ804", .uid = 0x221510, .mask = 0xfffff0, @@ -44,7 +44,7 @@ static int ksz_genconfig_bcastoff(struct phy_device *phydev) return genphy_config(phydev); } -static struct phy_driver KSZ8031_driver = { +U_BOOT_PHY_DRIVER(ksz8031) = { .name = "Micrel KSZ8021/KSZ8031", .uid = 0x221550, .mask = 0xfffff0, @@ -72,7 +72,7 @@ static int ksz8051_config(struct phy_device *phydev) return genphy_config(phydev); } -static struct phy_driver KSZ8051_driver = { +U_BOOT_PHY_DRIVER(ksz8051) = { .name = "Micrel KSZ8051", .uid = 0x221550, .mask = 0xfffff0, @@ -87,7 +87,7 @@ static int ksz8061_config(struct phy_device *phydev) return phy_write(phydev, MDIO_MMD_PMAPMD, MDIO_DEVID1, 0xB61A); } -static struct phy_driver KSZ8061_driver = { +U_BOOT_PHY_DRIVER(ksz8061) = { .name = "Micrel KSZ8061", .uid = 0x00221570, .mask = 0xfffff0, @@ -115,7 +115,7 @@ static int ksz8081_config(struct phy_device *phydev) return genphy_config(phydev); } -static struct phy_driver KSZ8081_driver = { +U_BOOT_PHY_DRIVER(ksz8081) = { .name = "Micrel KSZ8081", .uid = 0x221560, .mask = 0xfffff0, @@ -172,7 +172,7 @@ static int ksz8895_startup(struct phy_device *phydev) return 0; } -static struct phy_driver ksz8895_driver = { +U_BOOT_PHY_DRIVER(ksz8895) = { .name = "Micrel KSZ8895/KSZ8864", .uid = 0x221450, .mask = 0xffffe1, @@ -185,7 +185,7 @@ static struct phy_driver ksz8895_driver = { /* Micrel used the exact same model number for the KSZ9021, * so the revision number is used to distinguish them. */ -static struct phy_driver KS8721_driver = { +U_BOOT_PHY_DRIVER(ks8721) = { .name = "Micrel KS8721BL", .uid = 0x221618, .mask = 0xfffffc, @@ -210,7 +210,7 @@ static int ksz886x_startup(struct phy_device *phydev) return 0; } -static struct phy_driver ksz886x_driver = { +U_BOOT_PHY_DRIVER(ksz886x) = { .name = "Micrel KSZ886x Switch", .uid = 0x00221430, .mask = 0xfffff0, @@ -219,16 +219,3 @@ static struct phy_driver ksz886x_driver = { .startup = &ksz886x_startup, .shutdown = &genphy_shutdown, }; - -int phy_micrel_ksz8xxx_init(void) -{ - phy_register(&KSZ804_driver); - phy_register(&KSZ8031_driver); - phy_register(&KSZ8051_driver); - phy_register(&KSZ8061_driver); - phy_register(&KSZ8081_driver); - phy_register(&KS8721_driver); - phy_register(&ksz8895_driver); - phy_register(&ksz886x_driver); - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index efc75808ea..b2b2d6edfa 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_MICREL_KSZ8XXX - phy_micrel_ksz8xxx_init(); -#endif #ifdef CONFIG_PHY_MICREL_KSZ90X1 phy_micrel_ksz90x1_init(); #endif diff --git a/include/phy.h b/include/phy.h index 77e46ebac8..27d9742c6c 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_micrel_ksz8xxx_init(void); int phy_micrel_ksz90x1_init(void); int phy_meson_gxl_init(void); int phy_natsemi_init(void); -- cgit v1.2.3 From 6b5eea7508e91659997f07139e3108a6bb1b422e Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:56 +0100 Subject: net: phy: ksz90x1: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/micrel_ksz90x1.c | 14 +++----------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 3 insertions(+), 15 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c index 79ebdb5e82..ffc3c987ea 100644 --- a/drivers/net/phy/micrel_ksz90x1.c +++ b/drivers/net/phy/micrel_ksz90x1.c @@ -270,7 +270,7 @@ static int ksz9021_config(struct phy_device *phydev) return 0; } -static struct phy_driver ksz9021_driver = { +U_BOOT_PHY_DRIVER(ksz9021) = { .name = "Micrel ksz9021", .uid = 0x221610, .mask = 0xfffffe, @@ -368,7 +368,7 @@ static int ksz9031_config(struct phy_device *phydev) return genphy_config(phydev); } -static struct phy_driver ksz9031_driver = { +U_BOOT_PHY_DRIVER(ksz9031) = { .name = "Micrel ksz9031", .uid = PHY_ID_KSZ9031, .mask = MII_KSZ9x31_SILICON_REV_MASK, @@ -477,7 +477,7 @@ static int ksz9131_config(struct phy_device *phydev) return genphy_config(phydev); } -static struct phy_driver ksz9131_driver = { +U_BOOT_PHY_DRIVER(ksz9131) = { .name = "Micrel ksz9131", .uid = PHY_ID_KSZ9131, .mask = MII_KSZ9x31_SILICON_REV_MASK, @@ -497,11 +497,3 @@ int ksz9xx1_phy_get_id(struct phy_device *phydev) return phyid; } - -int phy_micrel_ksz90x1_init(void) -{ - phy_register(&ksz9021_driver); - phy_register(&ksz9031_driver); - phy_register(&ksz9131_driver); - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index b2b2d6edfa..4747011cda 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_MICREL_KSZ90X1 - phy_micrel_ksz90x1_init(); -#endif #ifdef CONFIG_PHY_MESON_GXL phy_meson_gxl_init(); #endif diff --git a/include/phy.h b/include/phy.h index 27d9742c6c..570524a21f 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_micrel_ksz90x1_init(void); int phy_meson_gxl_init(void); int phy_natsemi_init(void); int phy_nxp_c45_tja11xx_init(void); -- cgit v1.2.3 From 3b96dc7513c4c309fc74165d4de562e4bcd73467 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:57 +0100 Subject: net: phy: meson-gxl: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/meson-gxl.c | 9 +-------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/meson-gxl.c b/drivers/net/phy/meson-gxl.c index 753ca72768..b49c9b5f49 100644 --- a/drivers/net/phy/meson-gxl.c +++ b/drivers/net/phy/meson-gxl.c @@ -124,7 +124,7 @@ static int meson_gxl_phy_config(struct phy_device *phydev) return genphy_config(phydev); } -static struct phy_driver meson_gxl_phy_driver = { +U_BOOT_PHY_DRIVER(meson_gxl_phy) = { .name = "Meson GXL Internal PHY", .uid = 0x01814400, .mask = 0xfffffff0, @@ -133,10 +133,3 @@ static struct phy_driver meson_gxl_phy_driver = { .startup = &meson_gxl_startup, .shutdown = &genphy_shutdown, }; - -int phy_meson_gxl_init(void) -{ - phy_register(&meson_gxl_phy_driver); - - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 4747011cda..27cc9f5ec6 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_MESON_GXL - phy_meson_gxl_init(); -#endif #ifdef CONFIG_PHY_NATSEMI phy_natsemi_init(); #endif diff --git a/include/phy.h b/include/phy.h index 570524a21f..f69f379fc2 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_meson_gxl_init(void); int phy_natsemi_init(void); int phy_nxp_c45_tja11xx_init(void); int phy_nxp_tja11xx_init(void); -- cgit v1.2.3 From 390e3fcd4ecc7f669d26662c988d86ed6ea9a593 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:58 +0100 Subject: net: phy: natsemi: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/natsemi.c | 15 +++------------ drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 3 insertions(+), 16 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/natsemi.c b/drivers/net/phy/natsemi.c index efde4574de..6b9e99ea11 100644 --- a/drivers/net/phy/natsemi.c +++ b/drivers/net/phy/natsemi.c @@ -33,7 +33,7 @@ static int dp83630_config(struct phy_device *phydev) return 0; } -static struct phy_driver DP83630_driver = { +U_BOOT_PHY_DRIVER(dp83630) = { .name = "NatSemi DP83630", .uid = 0x20005ce1, .mask = 0xfffffff0, @@ -103,7 +103,7 @@ static int dp83865_startup(struct phy_device *phydev) } -static struct phy_driver DP83865_driver = { +U_BOOT_PHY_DRIVER(dp83865) = { .name = "NatSemi DP83865", .uid = 0x20005c70, .mask = 0xfffffff0, @@ -146,7 +146,7 @@ static int dp83848_startup(struct phy_device *phydev) return dp83848_parse_status(phydev); } -static struct phy_driver DP83848_driver = { +U_BOOT_PHY_DRIVER(dp83848) = { .name = "NatSemi DP83848", .uid = 0x20005c90, .mask = 0x2000ff90, @@ -155,12 +155,3 @@ static struct phy_driver DP83848_driver = { .startup = &dp83848_startup, .shutdown = &genphy_shutdown, }; - -int phy_natsemi_init(void) -{ - phy_register(&DP83630_driver); - phy_register(&DP83865_driver); - phy_register(&DP83848_driver); - - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 27cc9f5ec6..3d6fc8080e 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_NATSEMI - phy_natsemi_init(); -#endif #ifdef CONFIG_NXP_C45_TJA11XX_PHY phy_nxp_c45_tja11xx_init(); #endif diff --git a/include/phy.h b/include/phy.h index f69f379fc2..647d23595d 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_natsemi_init(void); int phy_nxp_c45_tja11xx_init(void); int phy_nxp_tja11xx_init(void); int phy_realtek_init(void); -- cgit v1.2.3 From d1296d44de5d5c4c6c41a64310dcdb4bd80d6a2a Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:02:59 +0100 Subject: net: phy: nxp-c45-tja11xx: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/nxp-c45-tja11xx.c | 8 +------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 1 insertion(+), 11 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/nxp-c45-tja11xx.c b/drivers/net/phy/nxp-c45-tja11xx.c index a0f41fab69..f701790194 100644 --- a/drivers/net/phy/nxp-c45-tja11xx.c +++ b/drivers/net/phy/nxp-c45-tja11xx.c @@ -330,7 +330,7 @@ static int nxp_c45_probe(struct phy_device *phydev) return 0; } -static struct phy_driver nxp_c45_tja11xx = { +U_BOOT_PHY_DRIVER(nxp_c45_tja11xx) = { .name = "NXP C45 TJA1103", .uid = PHY_ID_TJA_1103, .mask = 0xfffff0, @@ -340,9 +340,3 @@ static struct phy_driver nxp_c45_tja11xx = { .startup = &nxp_c45_startup, .shutdown = &genphy_shutdown, }; - -int phy_nxp_c45_tja11xx_init(void) -{ - phy_register(&nxp_c45_tja11xx); - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 3d6fc8080e..706b9505d6 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_NXP_C45_TJA11XX_PHY - phy_nxp_c45_tja11xx_init(); -#endif #ifdef CONFIG_PHY_NXP_TJA11XX phy_nxp_tja11xx_init(); #endif diff --git a/include/phy.h b/include/phy.h index 647d23595d..aa65ae16f6 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_nxp_c45_tja11xx_init(void); int phy_nxp_tja11xx_init(void); int phy_realtek_init(void); int phy_smsc_init(void); -- cgit v1.2.3 From 1965f2aa65fb6cc98775dec4ac5498eabcd885d3 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:00 +0100 Subject: net: phy: nxp-tja11xx: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/nxp-tja11xx.c | 12 ++---------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 2 insertions(+), 14 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/nxp-tja11xx.c b/drivers/net/phy/nxp-tja11xx.c index 30dec5e605..471b0e322b 100644 --- a/drivers/net/phy/nxp-tja11xx.c +++ b/drivers/net/phy/nxp-tja11xx.c @@ -248,7 +248,7 @@ static int tja11xx_startup(struct phy_device *phydev) return 0; } -static struct phy_driver TJA1100_driver = { +U_BOOT_PHY_DRIVER(tja1100) = { .name = "NXP TJA1100", .uid = PHY_ID_TJA1100, .mask = PHY_ID_MASK, @@ -258,7 +258,7 @@ static struct phy_driver TJA1100_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver TJA1101_driver = { +U_BOOT_PHY_DRIVER(tja1101) = { .name = "NXP TJA1101", .uid = PHY_ID_TJA1101, .mask = PHY_ID_MASK, @@ -267,11 +267,3 @@ static struct phy_driver TJA1101_driver = { .startup = &tja11xx_startup, .shutdown = &genphy_shutdown, }; - -int phy_nxp_tja11xx_init(void) -{ - phy_register(&TJA1100_driver); - phy_register(&TJA1101_driver); - - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 706b9505d6..03d221f216 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_NXP_TJA11XX - phy_nxp_tja11xx_init(); -#endif #ifdef CONFIG_PHY_REALTEK phy_realtek_init(); #endif diff --git a/include/phy.h b/include/phy.h index aa65ae16f6..bc42a522ea 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_nxp_tja11xx_init(void); int phy_realtek_init(void); int phy_smsc_init(void); int phy_teranetics_init(void); -- cgit v1.2.3 From f2e0be396e4100df9327d8bdc25a71585375c4c5 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:01 +0100 Subject: net: phy: realtek: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/phy.c | 3 --- drivers/net/phy/realtek.c | 21 +++++---------------- include/phy.h | 1 - 3 files changed, 5 insertions(+), 20 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 03d221f216..e821a3f37c 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_REALTEK - phy_realtek_init(); -#endif #ifdef CONFIG_PHY_SMSC phy_smsc_init(); #endif diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 24c3ea59bb..247d9753a8 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -409,7 +409,7 @@ static int rtl8211f_startup(struct phy_device *phydev) } /* Support for RTL8211B PHY */ -static struct phy_driver RTL8211B_driver = { +U_BOOT_PHY_DRIVER(rtl8211b) = { .name = "RealTek RTL8211B", .uid = 0x1cc912, .mask = 0xffffff, @@ -421,7 +421,7 @@ static struct phy_driver RTL8211B_driver = { }; /* Support for RTL8211E-VB-CG, RTL8211E-VL-CG and RTL8211EG-VB-CG PHYs */ -static struct phy_driver RTL8211E_driver = { +U_BOOT_PHY_DRIVER(rtl8211e) = { .name = "RealTek RTL8211E", .uid = 0x1cc915, .mask = 0xffffff, @@ -433,7 +433,7 @@ static struct phy_driver RTL8211E_driver = { }; /* Support for RTL8211DN PHY */ -static struct phy_driver RTL8211DN_driver = { +U_BOOT_PHY_DRIVER(rtl8211dn) = { .name = "RealTek RTL8211DN", .uid = 0x1cc914, .mask = 0xffffff, @@ -444,7 +444,7 @@ static struct phy_driver RTL8211DN_driver = { }; /* Support for RTL8211F PHY */ -static struct phy_driver RTL8211F_driver = { +U_BOOT_PHY_DRIVER(rtl8211f) = { .name = "RealTek RTL8211F", .uid = 0x1cc916, .mask = 0xffffff, @@ -458,7 +458,7 @@ static struct phy_driver RTL8211F_driver = { }; /* Support for RTL8201F PHY */ -static struct phy_driver RTL8201F_driver = { +U_BOOT_PHY_DRIVER(rtl8201f) = { .name = "RealTek RTL8201F 10/100Mbps Ethernet", .uid = 0x1cc816, .mask = 0xffffff, @@ -468,14 +468,3 @@ static struct phy_driver RTL8201F_driver = { .startup = &rtl8211e_startup, .shutdown = &genphy_shutdown, }; - -int phy_realtek_init(void) -{ - phy_register(&RTL8211B_driver); - phy_register(&RTL8211E_driver); - phy_register(&RTL8211F_driver); - phy_register(&RTL8211DN_driver); - phy_register(&RTL8201F_driver); - - return 0; -} diff --git a/include/phy.h b/include/phy.h index bc42a522ea..24a880ed2f 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_realtek_init(void); int phy_smsc_init(void); int phy_teranetics_init(void); int phy_ti_init(void); -- cgit v1.2.3 From 2ea350c466d0d0ab5a6ad18d7a859649556ae98b Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:02 +0100 Subject: net: phy: smsc: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/phy.c | 3 --- drivers/net/phy/smsc.c | 24 ++++++------------------ include/phy.h | 1 - 3 files changed, 6 insertions(+), 22 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index e821a3f37c..d4a50fb76a 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_SMSC - phy_smsc_init(); -#endif #ifdef CONFIG_PHY_TERANETICS phy_teranetics_init(); #endif diff --git a/drivers/net/phy/smsc.c b/drivers/net/phy/smsc.c index 7740a2510d..056b607e0b 100644 --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -43,7 +43,7 @@ static int smsc_startup(struct phy_device *phydev) return smsc_parse_status(phydev); } -static struct phy_driver lan8700_driver = { +U_BOOT_PHY_DRIVER(lan8700) = { .name = "SMSC LAN8700", .uid = 0x0007c0c0, .mask = 0xffff0, @@ -53,7 +53,7 @@ static struct phy_driver lan8700_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver lan911x_driver = { +U_BOOT_PHY_DRIVER(lan911x) = { .name = "SMSC LAN911x Internal PHY", .uid = 0x0007c0d0, .mask = 0xffff0, @@ -63,7 +63,7 @@ static struct phy_driver lan911x_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver lan8710_driver = { +U_BOOT_PHY_DRIVER(lan8710) = { .name = "SMSC LAN8710/LAN8720", .uid = 0x0007c0f0, .mask = 0xffff0, @@ -73,7 +73,7 @@ static struct phy_driver lan8710_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver lan8740_driver = { +U_BOOT_PHY_DRIVER(lan8740) = { .name = "SMSC LAN8740", .uid = 0x0007c110, .mask = 0xffff0, @@ -83,7 +83,7 @@ static struct phy_driver lan8740_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver lan8741_driver = { +U_BOOT_PHY_DRIVER(lan8741) = { .name = "SMSC LAN8741", .uid = 0x0007c120, .mask = 0xffff0, @@ -93,7 +93,7 @@ static struct phy_driver lan8741_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver lan8742_driver = { +U_BOOT_PHY_DRIVER(lan8742) = { .name = "SMSC LAN8742", .uid = 0x0007c130, .mask = 0xffff0, @@ -102,15 +102,3 @@ static struct phy_driver lan8742_driver = { .startup = &genphy_startup, .shutdown = &genphy_shutdown, }; - -int phy_smsc_init(void) -{ - phy_register(&lan8710_driver); - phy_register(&lan911x_driver); - phy_register(&lan8700_driver); - phy_register(&lan8740_driver); - phy_register(&lan8741_driver); - phy_register(&lan8742_driver); - - return 0; -} diff --git a/include/phy.h b/include/phy.h index 24a880ed2f..4326ef223e 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_smsc_init(void); int phy_teranetics_init(void); int phy_ti_init(void); int phy_vitesse_init(void); -- cgit v1.2.3 From 787a67f4710576e18c8df6131a881453f3737abb Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:03 +0100 Subject: net: phy: teranetics: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/phy.c | 3 --- drivers/net/phy/teranetics.c | 9 +-------- include/phy.h | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index d4a50fb76a..b76cc51cbf 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_TERANETICS - phy_teranetics_init(); -#endif #ifdef CONFIG_PHY_TI phy_ti_init(); #endif diff --git a/drivers/net/phy/teranetics.c b/drivers/net/phy/teranetics.c index c402bad88c..15f2c12ed8 100644 --- a/drivers/net/phy/teranetics.c +++ b/drivers/net/phy/teranetics.c @@ -90,7 +90,7 @@ int tn2020_startup(struct phy_device *phydev) return 0; } -static struct phy_driver tn2020_driver = { +U_BOOT_PHY_DRIVER(tn2020) = { .name = "Teranetics TN2020", .uid = PHY_UID_TN2020, .mask = 0xfffffff0, @@ -102,10 +102,3 @@ static struct phy_driver tn2020_driver = { .startup = &tn2020_startup, .shutdown = &gen10g_shutdown, }; - -int phy_teranetics_init(void) -{ - phy_register(&tn2020_driver); - - return 0; -} diff --git a/include/phy.h b/include/phy.h index 4326ef223e..2c6e167f26 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_teranetics_init(void); int phy_ti_init(void); int phy_vitesse_init(void); int phy_xilinx_init(void); -- cgit v1.2.3 From 5b777fe527ac67790e41ee9e355241118761aa4b Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:04 +0100 Subject: net: phy: ti: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" This particular PHY driver is slightly more spread out across additional source files. Since the phy_register() calls are no longer necessary, all the registration calls across those source files is dropped. Furthermore, the Makefile can now be updated to only compile generic TI PHY support if matching Kconfig symbol is enabled and the ifdeffery in the generic TI PHY driver can be dropped. Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/Makefile | 2 +- drivers/net/phy/dp83867.c | 8 +------- drivers/net/phy/dp83869.c | 8 +------- drivers/net/phy/phy.c | 3 --- drivers/net/phy/ti_phy_init.c | 38 +++++++------------------------------- include/phy.h | 1 - 6 files changed, 10 insertions(+), 50 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile index d38e99e717..963d96e2bc 100644 --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile @@ -29,7 +29,7 @@ obj-$(CONFIG_PHY_NXP_TJA11XX) += nxp-tja11xx.o obj-$(CONFIG_PHY_REALTEK) += realtek.o obj-$(CONFIG_PHY_SMSC) += smsc.o obj-$(CONFIG_PHY_TERANETICS) += teranetics.o -obj-$(CONFIG_PHY_TI) += ti_phy_init.o +obj-$(CONFIG_PHY_TI_GENERIC) += ti_phy_init.o obj-$(CONFIG_PHY_TI_DP83867) += dp83867.o obj-$(CONFIG_PHY_TI_DP83869) += dp83869.o obj-$(CONFIG_PHY_XILINX) += xilinx_phy.o diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index a45152bddc..b861bf7cef 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -409,7 +409,7 @@ static int dp83867_probe(struct phy_device *phydev) return 0; } -static struct phy_driver DP83867_driver = { +U_BOOT_PHY_DRIVER(dp83867) = { .name = "TI DP83867", .uid = 0x2000a231, .mask = 0xfffffff0, @@ -419,9 +419,3 @@ static struct phy_driver DP83867_driver = { .startup = &genphy_startup, .shutdown = &genphy_shutdown, }; - -int phy_dp83867_init(void) -{ - phy_register(&DP83867_driver); - return 0; -} diff --git a/drivers/net/phy/dp83869.c b/drivers/net/phy/dp83869.c index 23dbf42b68..8d32d73b07 100644 --- a/drivers/net/phy/dp83869.c +++ b/drivers/net/phy/dp83869.c @@ -473,7 +473,7 @@ static int dp83869_probe(struct phy_device *phydev) return 0; } -static struct phy_driver DP83869_driver = { +U_BOOT_PHY_DRIVER(dp83869) = { .name = "TI DP83869", .uid = 0x2000a0f1, .mask = 0xfffffff0, @@ -485,9 +485,3 @@ static struct phy_driver DP83869_driver = { .readext = dp83869_readext, .writeext = dp83869_writeext }; - -int phy_dp83869_init(void) -{ - phy_register(&DP83869_driver); - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index b76cc51cbf..404d61c5ab 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_TI - phy_ti_init(); -#endif #ifdef CONFIG_PHY_VITESSE phy_vitesse_init(); #endif diff --git a/drivers/net/phy/ti_phy_init.c b/drivers/net/phy/ti_phy_init.c index 075b19a39f..a0878193ac 100644 --- a/drivers/net/phy/ti_phy_init.c +++ b/drivers/net/phy/ti_phy_init.c @@ -10,8 +10,7 @@ #include #include "ti_phy_init.h" -#ifdef CONFIG_PHY_TI_GENERIC -static struct phy_driver dp83822_driver = { +U_BOOT_PHY_DRIVER(dp83822) = { .name = "TI DP83822", .uid = 0x2000a240, .mask = 0xfffffff0, @@ -21,7 +20,7 @@ static struct phy_driver dp83822_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver dp83826nc_driver = { +U_BOOT_PHY_DRIVER(dp83826nc) = { .name = "TI DP83826NC", .uid = 0x2000a110, .mask = 0xfffffff0, @@ -31,7 +30,7 @@ static struct phy_driver dp83826nc_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver dp83826c_driver = { +U_BOOT_PHY_DRIVER(dp83826c) = { .name = "TI DP83826C", .uid = 0x2000a130, .mask = 0xfffffff0, @@ -41,7 +40,7 @@ static struct phy_driver dp83826c_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver dp83825s_driver = { +U_BOOT_PHY_DRIVER(dp83825s) = { .name = "TI DP83825S", .uid = 0x2000a140, .mask = 0xfffffff0, @@ -51,7 +50,7 @@ static struct phy_driver dp83825s_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver dp83825i_driver = { +U_BOOT_PHY_DRIVER(dp83825i) = { .name = "TI DP83825I", .uid = 0x2000a150, .mask = 0xfffffff0, @@ -61,7 +60,7 @@ static struct phy_driver dp83825i_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver dp83825m_driver = { +U_BOOT_PHY_DRIVER(dp83825m) = { .name = "TI DP83825M", .uid = 0x2000a160, .mask = 0xfffffff0, @@ -71,7 +70,7 @@ static struct phy_driver dp83825m_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver dp83825cs_driver = { +U_BOOT_PHY_DRIVER(dp83825cs) = { .name = "TI DP83825CS", .uid = 0x2000a170, .mask = 0xfffffff0, @@ -80,26 +79,3 @@ static struct phy_driver dp83825cs_driver = { .startup = &genphy_startup, .shutdown = &genphy_shutdown, }; -#endif /* CONFIG_PHY_TI_GENERIC */ - -int phy_ti_init(void) -{ -#ifdef CONFIG_PHY_TI_DP83867 - phy_dp83867_init(); -#endif - -#ifdef CONFIG_PHY_TI_DP83869 - phy_dp83869_init(); -#endif - -#ifdef CONFIG_PHY_TI_GENERIC - phy_register(&dp83822_driver); - phy_register(&dp83825s_driver); - phy_register(&dp83825i_driver); - phy_register(&dp83825m_driver); - phy_register(&dp83825cs_driver); - phy_register(&dp83826c_driver); - phy_register(&dp83826nc_driver); -#endif - return 0; -} diff --git a/include/phy.h b/include/phy.h index 2c6e167f26..e6508a132d 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_ti_init(void); int phy_vitesse_init(void); int phy_xilinx_init(void); int phy_xway_init(void); -- cgit v1.2.3 From fb5cf1bb42b8b61d3ce1e9d9e34c33456ed945b3 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:05 +0100 Subject: net: phy: vitesse: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Reviewed-by: Ramon Fried Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/phy.c | 3 --- drivers/net/phy/vitesse.c | 45 +++++++++++++-------------------------------- include/phy.h | 1 - 3 files changed, 13 insertions(+), 36 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 404d61c5ab..fff1d669fc 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_VITESSE - phy_vitesse_init(); -#endif #ifdef CONFIG_PHY_XILINX phy_xilinx_init(); #endif diff --git a/drivers/net/phy/vitesse.c b/drivers/net/phy/vitesse.c index eca26c9893..c5cf0d7dfb 100644 --- a/drivers/net/phy/vitesse.c +++ b/drivers/net/phy/vitesse.c @@ -293,7 +293,7 @@ static int vsc8664_config(struct phy_device *phydev) return 0; } -static struct phy_driver VSC8211_driver = { +U_BOOT_PHY_DRIVER(vsc8211) = { .name = "Vitesse VSC8211", .uid = 0xfc4b0, .mask = 0xffff0, @@ -303,7 +303,7 @@ static struct phy_driver VSC8211_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8221_driver = { +U_BOOT_PHY_DRIVER(vsc8221) = { .name = "Vitesse VSC8221", .uid = 0xfc550, .mask = 0xffff0, @@ -313,7 +313,7 @@ static struct phy_driver VSC8221_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8244_driver = { +U_BOOT_PHY_DRIVER(vsc8244) = { .name = "Vitesse VSC8244", .uid = 0xfc6c0, .mask = 0xffff0, @@ -323,7 +323,7 @@ static struct phy_driver VSC8244_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8234_driver = { +U_BOOT_PHY_DRIVER(vsc8234) = { .name = "Vitesse VSC8234", .uid = 0xfc620, .mask = 0xffff0, @@ -333,7 +333,7 @@ static struct phy_driver VSC8234_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8574_driver = { +U_BOOT_PHY_DRIVER(vsc8574) = { .name = "Vitesse VSC8574", .uid = 0x704a0, .mask = 0xffff0, @@ -343,7 +343,7 @@ static struct phy_driver VSC8574_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8514_driver = { +U_BOOT_PHY_DRIVER(vsc8514) = { .name = "Vitesse VSC8514", .uid = 0x70670, .mask = 0xffff0, @@ -353,7 +353,7 @@ static struct phy_driver VSC8514_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8584_driver = { +U_BOOT_PHY_DRIVER(vsc8584) = { .name = "Vitesse VSC8584", .uid = 0x707c0, .mask = 0xffff0, @@ -363,7 +363,7 @@ static struct phy_driver VSC8584_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8601_driver = { +U_BOOT_PHY_DRIVER(vsc8601) = { .name = "Vitesse VSC8601", .uid = 0x70420, .mask = 0xffff0, @@ -373,7 +373,7 @@ static struct phy_driver VSC8601_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8641_driver = { +U_BOOT_PHY_DRIVER(vsc8641) = { .name = "Vitesse VSC8641", .uid = 0x70430, .mask = 0xffff0, @@ -383,7 +383,7 @@ static struct phy_driver VSC8641_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8662_driver = { +U_BOOT_PHY_DRIVER(vsc8662) = { .name = "Vitesse VSC8662", .uid = 0x70660, .mask = 0xffff0, @@ -393,7 +393,7 @@ static struct phy_driver VSC8662_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8664_driver = { +U_BOOT_PHY_DRIVER(vsc8664) = { .name = "Vitesse VSC8664", .uid = 0x70660, .mask = 0xffff0, @@ -404,7 +404,7 @@ static struct phy_driver VSC8664_driver = { }; /* Vitesse bought Cicada, so we'll put these here */ -static struct phy_driver cis8201_driver = { +U_BOOT_PHY_DRIVER(cis8201) = { .name = "CIS8201", .uid = 0xfc410, .mask = 0xffff0, @@ -414,7 +414,7 @@ static struct phy_driver cis8201_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver cis8204_driver = { +U_BOOT_PHY_DRIVER(cis8204) = { .name = "Cicada Cis8204", .uid = 0xfc440, .mask = 0xffff0, @@ -423,22 +423,3 @@ static struct phy_driver cis8204_driver = { .startup = &vitesse_startup, .shutdown = &genphy_shutdown, }; - -int phy_vitesse_init(void) -{ - phy_register(&VSC8641_driver); - phy_register(&VSC8601_driver); - phy_register(&VSC8234_driver); - phy_register(&VSC8244_driver); - phy_register(&VSC8211_driver); - phy_register(&VSC8221_driver); - phy_register(&VSC8574_driver); - phy_register(&VSC8584_driver); - phy_register(&VSC8514_driver); - phy_register(&VSC8662_driver); - phy_register(&VSC8664_driver); - phy_register(&cis8201_driver); - phy_register(&cis8204_driver); - - return 0; -} diff --git a/include/phy.h b/include/phy.h index e6508a132d..74f3ada249 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_vitesse_init(void); int phy_xilinx_init(void); int phy_xway_init(void); int phy_mscc_init(void); -- cgit v1.2.3 From 6620b9204dd2fe9c15a637792ecd5d3d5e0f0e95 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:06 +0100 Subject: net: phy: xilinx: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Reviewed-by: Ramon Fried Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/phy.c | 3 --- drivers/net/phy/xilinx_phy.c | 10 +--------- include/phy.h | 1 - 3 files changed, 1 insertion(+), 13 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index fff1d669fc..b85d5c4566 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_XILINX - phy_xilinx_init(); -#endif #ifdef CONFIG_PHY_XWAY phy_xway_init(); #endif diff --git a/drivers/net/phy/xilinx_phy.c b/drivers/net/phy/xilinx_phy.c index 39dbfdb7da..1df639d6f4 100644 --- a/drivers/net/phy/xilinx_phy.c +++ b/drivers/net/phy/xilinx_phy.c @@ -127,7 +127,7 @@ static int xilinxphy_config(struct phy_device *phydev) return 0; } -static struct phy_driver xilinxphy_driver = { +U_BOOT_PHY_DRIVER(xilinxphy) = { .uid = XILINX_PHY_ID, .mask = XILINX_PHY_ID_MASK, .name = "Xilinx PCS/PMA PHY", @@ -136,11 +136,3 @@ static struct phy_driver xilinxphy_driver = { .startup = &xilinxphy_startup, .shutdown = &genphy_shutdown, }; - -int phy_xilinx_init(void) -{ - debug("%s\n", __func__); - phy_register(&xilinxphy_driver); - - return 0; -} diff --git a/include/phy.h b/include/phy.h index 74f3ada249..e128ddf003 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_xilinx_init(void); int phy_xway_init(void); int phy_mscc_init(void); int phy_fixed_init(void); -- cgit v1.2.3 From 330d64f5a0d748707fe40139fa981aebeb2308a3 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:07 +0100 Subject: net: phy: intel-xway: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Reviewed-by: Ramon Fried Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/intel_xway.c | 9 +-------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 1 insertion(+), 12 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/intel_xway.c b/drivers/net/phy/intel_xway.c index dfce3f8332..9d1b97d349 100644 --- a/drivers/net/phy/intel_xway.c +++ b/drivers/net/phy/intel_xway.c @@ -30,7 +30,7 @@ static int xway_config(struct phy_device *phydev) return 0; } -static struct phy_driver XWAY_driver = { +U_BOOT_PHY_DRIVER(xway) = { .name = "XWAY", .uid = 0xD565A400, .mask = 0xffffff00, @@ -39,10 +39,3 @@ static struct phy_driver XWAY_driver = { .startup = genphy_startup, .shutdown = genphy_shutdown, }; - -int phy_xway_init(void) -{ - phy_register(&XWAY_driver); - - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index b85d5c4566..1542fe8925 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_XWAY - phy_xway_init(); -#endif #ifdef CONFIG_PHY_MSCC phy_mscc_init(); #endif diff --git a/include/phy.h b/include/phy.h index e128ddf003..fc8300d5d9 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_xway_init(void); int phy_mscc_init(void); int phy_fixed_init(void); int phy_ncsi_init(void); -- cgit v1.2.3 From 5c359aa712d2b91e23df15a2b11cc72aa3682b30 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:08 +0100 Subject: net: phy: mscc: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Reviewed-by: Ramon Fried Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/mscc.c | 27 +++++++-------------------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 7 insertions(+), 24 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c index f9482b21a0..ef1761a8bd 100644 --- a/drivers/net/phy/mscc.c +++ b/drivers/net/phy/mscc.c @@ -1558,7 +1558,7 @@ static int vsc8502_config(struct phy_device *phydev) return 0; } -static struct phy_driver VSC8530_driver = { +U_BOOT_PHY_DRIVER(vsc8530) = { .name = "Microsemi VSC8530", .uid = PHY_ID_VSC8530, .mask = 0x000ffff0, @@ -1568,7 +1568,7 @@ static struct phy_driver VSC8530_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8531_driver = { +U_BOOT_PHY_DRIVER(vsc8531) = { .name = "Microsemi VSC8531", .uid = PHY_ID_VSC8531, .mask = 0x000ffff0, @@ -1578,7 +1578,7 @@ static struct phy_driver VSC8531_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8502_driver = { +U_BOOT_PHY_DRIVER(vsc8502) = { .name = "Microsemi VSC8502", .uid = PHY_ID_VSC8502, .mask = 0x000ffff0, @@ -1588,7 +1588,7 @@ static struct phy_driver VSC8502_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8540_driver = { +U_BOOT_PHY_DRIVER(vsc8540) = { .name = "Microsemi VSC8540", .uid = PHY_ID_VSC8540, .mask = 0x000ffff0, @@ -1598,7 +1598,7 @@ static struct phy_driver VSC8540_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8541_driver = { +U_BOOT_PHY_DRIVER(vsc8541) = { .name = "Microsemi VSC8541", .uid = PHY_ID_VSC8541, .mask = 0x000ffff0, @@ -1608,7 +1608,7 @@ static struct phy_driver VSC8541_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8574_driver = { +U_BOOT_PHY_DRIVER(vsc8574) = { .name = "Microsemi VSC8574", .uid = PHY_ID_VSC8574, .mask = 0x000ffff0, @@ -1618,7 +1618,7 @@ static struct phy_driver VSC8574_driver = { .shutdown = &genphy_shutdown, }; -static struct phy_driver VSC8584_driver = { +U_BOOT_PHY_DRIVER(vsc8584) = { .name = "Microsemi VSC8584", .uid = PHY_ID_VSC8584, .mask = 0x000ffff0, @@ -1627,16 +1627,3 @@ static struct phy_driver VSC8584_driver = { .startup = &mscc_startup, .shutdown = &genphy_shutdown, }; - -int phy_mscc_init(void) -{ - phy_register(&VSC8530_driver); - phy_register(&VSC8531_driver); - phy_register(&VSC8502_driver); - phy_register(&VSC8540_driver); - phy_register(&VSC8541_driver); - phy_register(&VSC8574_driver); - phy_register(&VSC8584_driver); - - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 1542fe8925..c20e750aa1 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_MSCC - phy_mscc_init(); -#endif #ifdef CONFIG_PHY_FIXED phy_fixed_init(); #endif diff --git a/include/phy.h b/include/phy.h index fc8300d5d9..e4a3e10c48 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_mscc_init(void); int phy_fixed_init(void); int phy_ncsi_init(void); int phy_xilinx_gmii2rgmii_init(void); -- cgit v1.2.3 From 7f4e6c2ae129a3315390cc2ee76badade98e2e62 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:09 +0100 Subject: net: phy: fixed: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Reviewed-by: Ramon Fried Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/fixed.c | 8 +------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 1 insertion(+), 11 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 1192915ee5..2f0823b836 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -93,7 +93,7 @@ static int fixedphy_shutdown(struct phy_device *phydev) return 0; } -static struct phy_driver fixedphy_driver = { +U_BOOT_PHY_DRIVER(fixedphy) = { .uid = PHY_FIXED_ID, .mask = 0xffffffff, .name = "Fixed PHY", @@ -103,9 +103,3 @@ static struct phy_driver fixedphy_driver = { .startup = fixedphy_startup, .shutdown = fixedphy_shutdown, }; - -int phy_fixed_init(void) -{ - phy_register(&fixedphy_driver); - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index c20e750aa1..245357c31d 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_FIXED - phy_fixed_init(); -#endif #ifdef CONFIG_PHY_NCSI phy_ncsi_init(); #endif diff --git a/include/phy.h b/include/phy.h index e4a3e10c48..9cabfeedec 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_fixed_init(void); int phy_ncsi_init(void); int phy_xilinx_gmii2rgmii_init(void); -- cgit v1.2.3 From 81a8728c834cfb004205b42eebafd86a70098509 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:10 +0100 Subject: net: phy: ncsi: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Reviewed-by: Ramon Fried Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/ncsi.c | 8 +------- drivers/net/phy/phy.c | 3 --- include/phy.h | 1 - 3 files changed, 1 insertion(+), 11 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/ncsi.c b/drivers/net/phy/ncsi.c index bb7ecebed3..eb3fd65bb4 100644 --- a/drivers/net/phy/ncsi.c +++ b/drivers/net/phy/ncsi.c @@ -881,7 +881,7 @@ int ncsi_shutdown(struct phy_device *phydev) return 0; } -static struct phy_driver ncsi_driver = { +U_BOOT_PHY_DRIVER(ncsi) = { .uid = PHY_NCSI_ID, .mask = 0xffffffff, .name = "NC-SI", @@ -891,9 +891,3 @@ static struct phy_driver ncsi_driver = { .startup = ncsi_startup, .shutdown = ncsi_shutdown, }; - -int phy_ncsi_init(void) -{ - phy_register(&ncsi_driver); - return 0; -} diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 245357c31d..69db79f79e 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_NCSI - phy_ncsi_init(); -#endif #ifdef CONFIG_PHY_XILINX_GMII2RGMII phy_xilinx_gmii2rgmii_init(); #endif diff --git a/include/phy.h b/include/phy.h index 9cabfeedec..001c998db4 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,7 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_ncsi_init(void); int phy_xilinx_gmii2rgmii_init(void); /** -- cgit v1.2.3 From 53ef8d79f254c97dc7592ff8d10d5ba724195fe6 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:11 +0100 Subject: net: phy: xilinx-gmii2rgmii: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Reviewed-by: Ramon Fried Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/phy.c | 3 --- drivers/net/phy/xilinx_gmii2rgmii.c | 9 +-------- include/phy.h | 2 -- 3 files changed, 1 insertion(+), 13 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 69db79f79e..9d5d149461 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -514,9 +514,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif -#ifdef CONFIG_PHY_XILINX_GMII2RGMII - phy_xilinx_gmii2rgmii_init(); -#endif genphy_init(); return 0; diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c index 7376283956..0b7436a7e1 100644 --- a/drivers/net/phy/xilinx_gmii2rgmii.c +++ b/drivers/net/phy/xilinx_gmii2rgmii.c @@ -124,7 +124,7 @@ static int xilinxgmiitorgmii_probe(struct phy_device *phydev) return 0; } -static struct phy_driver gmii2rgmii_driver = { +U_BOOT_PHY_DRIVER(gmii2rgmii) = { .name = "XILINX GMII2RGMII", .uid = PHY_GMII2RGMII_ID, .mask = 0xffffffff, @@ -135,10 +135,3 @@ static struct phy_driver gmii2rgmii_driver = { .writeext = xilinxgmiitorgmii_extwrite, .readext = xilinxgmiitorgmii_extread, }; - -int phy_xilinx_gmii2rgmii_init(void) -{ - phy_register(&gmii2rgmii_driver); - - return 0; -} diff --git a/include/phy.h b/include/phy.h index 001c998db4..df2586f89e 100644 --- a/include/phy.h +++ b/include/phy.h @@ -315,8 +315,6 @@ int gen10g_startup(struct phy_device *phydev); int gen10g_shutdown(struct phy_device *phydev); int gen10g_discover_mmds(struct phy_device *phydev); -int phy_xilinx_gmii2rgmii_init(void); - /** * U_BOOT_PHY_DRIVER() - Declare a new U-Boot driver * @__name: name of the driver -- cgit v1.2.3 From f7053296cbe75fa7e5634b63d983e9d630052a96 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:12 +0100 Subject: net: phy: genphy: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/phy.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 9d5d149461..b1e9861c6f 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -451,7 +451,7 @@ int genphy_shutdown(struct phy_device *phydev) return 0; } -static struct phy_driver genphy_driver = { +U_BOOT_PHY_DRIVER(genphy) = { .uid = 0xffffffff, .mask = 0xffffffff, .name = "Generic PHY", @@ -463,11 +463,6 @@ static struct phy_driver genphy_driver = { .shutdown = genphy_shutdown, }; -static int genphy_init(void) -{ - return phy_register(&genphy_driver); -} - static LIST_HEAD(phy_drivers); #ifdef CONFIG_NEEDS_MANUAL_RELOC @@ -514,8 +509,6 @@ int phy_init(void) phy_drv_reloc(drv); #endif - genphy_init(); - return 0; } @@ -576,7 +569,7 @@ static struct phy_driver *generic_for_phy(struct phy_device *phydev) return &gen10g_driver; #endif - return &genphy_driver; + return ll_entry_get(struct phy_driver, genphy, phy_driver); } static struct phy_driver *get_phy_driver(struct phy_device *phydev) -- cgit v1.2.3 From 20bd8e4fcbb537be0f564bbc90e3a571aeeabf8d Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:13 +0100 Subject: net: phy: gen10g: Convert to U_BOOT_PHY_DRIVER() Convert PHY driver to U_BOOT_PHY_DRIVER() macro and drop phy_register() init call. Converted using sed "s@^static struct phy_driver \(.*\)_driver = \+{@U_BOOT_PHY_DRIVER(\L\1) = {" Signed-off-by: Marek Vasut Reviewed-by: Ramon Fried Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/generic_10g.c | 2 +- drivers/net/phy/phy.c | 2 +- include/phy.h | 4 ---- 3 files changed, 2 insertions(+), 6 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/generic_10g.c b/drivers/net/phy/generic_10g.c index b4384e1f78..34ac51ea07 100644 --- a/drivers/net/phy/generic_10g.c +++ b/drivers/net/phy/generic_10g.c @@ -80,7 +80,7 @@ int gen10g_config(struct phy_device *phydev) return gen10g_discover_mmds(phydev); } -struct phy_driver gen10g_driver = { +U_BOOT_PHY_DRIVER(gen10g) = { .uid = 0xffffffff, .mask = 0xffffffff, .name = "Generic 10G PHY", diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index b1e9861c6f..bd9c576f45 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -566,7 +566,7 @@ static struct phy_driver *generic_for_phy(struct phy_device *phydev) { #ifdef CONFIG_PHYLIB_10G if (phydev->is_c45) - return &gen10g_driver; + return ll_entry_get(struct phy_driver, gen10g, phy_driver); #endif return ll_entry_get(struct phy_driver, genphy, phy_driver); diff --git a/include/phy.h b/include/phy.h index df2586f89e..5f4967cb15 100644 --- a/include/phy.h +++ b/include/phy.h @@ -173,10 +173,6 @@ struct fixed_link { int asym_pause; }; -#ifdef CONFIG_PHYLIB_10G -extern struct phy_driver gen10g_driver; -#endif - /** * phy_init() - Initializes the PHY drivers * This function registers all available PHY drivers -- cgit v1.2.3 From 8728d4c032571a8569af14d09d18bf444c30e446 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:14 +0100 Subject: net: phy: Drop static phy_drivers list The static phy_drivers list is superseded by linker list of struct phy_drivers now that all drivers have been converted to the later. Drop the phy_drivers list as well as list_head from struct phy_driver. Signed-off-by: Marek Vasut Reviewed-by: Ramon Fried Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/phy.c | 26 ++------------------------ include/phy.h | 2 -- 2 files changed, 2 insertions(+), 26 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index bd9c576f45..f4aa1f664c 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -463,8 +463,6 @@ U_BOOT_PHY_DRIVER(genphy) = { .shutdown = genphy_shutdown, }; -static LIST_HEAD(phy_drivers); - #ifdef CONFIG_NEEDS_MANUAL_RELOC static void phy_drv_reloc(struct phy_driver *drv) { @@ -493,16 +491,6 @@ int phy_init(void) const int ll_n_ents = ll_entry_count(struct phy_driver, phy_driver); struct phy_driver *drv, *ll_entry; - /* - * The pointers inside phy_drivers also needs to be updated incase of - * manual reloc, without which these points to some invalid - * pre reloc address and leads to invalid accesses, hangs. - */ - struct list_head *head = &phy_drivers; - - head->next = (void *)head->next + gd->reloc_off; - head->prev = (void *)head->prev + gd->reloc_off; - /* Perform manual relocation on linker list based PHY drivers */ ll_entry = ll_entry_start(struct phy_driver, phy_driver); for (drv = ll_entry; drv != ll_entry + ll_n_ents; drv++) @@ -514,9 +502,6 @@ int phy_init(void) int phy_register(struct phy_driver *drv) { - INIT_LIST_HEAD(&drv->list); - list_add_tail(&drv->list, &phy_drivers); - #ifdef CONFIG_NEEDS_MANUAL_RELOC phy_drv_reloc(drv); #endif @@ -575,16 +560,9 @@ static struct phy_driver *generic_for_phy(struct phy_device *phydev) static struct phy_driver *get_phy_driver(struct phy_device *phydev) { const int ll_n_ents = ll_entry_count(struct phy_driver, phy_driver); - struct phy_driver *ll_entry; - struct list_head *entry; int phy_id = phydev->phy_id; - struct phy_driver *drv = NULL; - - list_for_each(entry, &phy_drivers) { - drv = list_entry(entry, struct phy_driver, list); - if ((drv->uid & drv->mask) == (phy_id & drv->mask)) - return drv; - } + struct phy_driver *ll_entry; + struct phy_driver *drv; ll_entry = ll_entry_start(struct phy_driver, phy_driver); for (drv = ll_entry; drv != ll_entry + ll_n_ents; drv++) diff --git a/include/phy.h b/include/phy.h index 5f4967cb15..5e8ae5e29a 100644 --- a/include/phy.h +++ b/include/phy.h @@ -125,8 +125,6 @@ struct phy_driver { int (*write_mmd)(struct phy_device *phydev, int devad, int reg, u16 val); - struct list_head list; - /* driver private data */ ulong data; }; -- cgit v1.2.3 From 7da03bbc5711b394674f2ed40a2a3c9c4cb46154 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:15 +0100 Subject: net: phy: Drop unused phy_register() This function is no longer used, drop it. Signed-off-by: Marek Vasut Reviewed-by: Ramon Fried Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/phy.c | 8 -------- include/phy.h | 1 - 2 files changed, 9 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index f4aa1f664c..15da9a80de 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -500,14 +500,6 @@ int phy_init(void) return 0; } -int phy_register(struct phy_driver *drv) -{ -#ifdef CONFIG_NEEDS_MANUAL_RELOC - phy_drv_reloc(drv); -#endif - return 0; -} - int phy_set_supported(struct phy_device *phydev, u32 max_speed) { /* The default values for phydev->supported are provided by the PHY diff --git a/include/phy.h b/include/phy.h index 5e8ae5e29a..4a9de46115 100644 --- a/include/phy.h +++ b/include/phy.h @@ -293,7 +293,6 @@ int phy_clear_bits_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val int phy_startup(struct phy_device *phydev); int phy_config(struct phy_device *phydev); int phy_shutdown(struct phy_device *phydev); -int phy_register(struct phy_driver *drv); int phy_set_supported(struct phy_device *phydev, u32 max_speed); int phy_modify(struct phy_device *phydev, int devad, int regnum, u16 mask, u16 set); -- cgit v1.2.3 From c878e70bebef706f09e647b16954c14cee81939c Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:16 +0100 Subject: net: phy: Re-inline phy_drv_reloc() Wrap phy_drv_reloc() back into phy_init() to reduce ifdeffery, since phy_drv_reloc() is now called only from one call site. No functional change. Signed-off-by: Marek Vasut Reviewed-by: Ramon Fried Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/phy.c | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 15da9a80de..61603f2817 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -463,28 +463,6 @@ U_BOOT_PHY_DRIVER(genphy) = { .shutdown = genphy_shutdown, }; -#ifdef CONFIG_NEEDS_MANUAL_RELOC -static void phy_drv_reloc(struct phy_driver *drv) -{ - if (drv->probe) - drv->probe += gd->reloc_off; - if (drv->config) - drv->config += gd->reloc_off; - if (drv->startup) - drv->startup += gd->reloc_off; - if (drv->shutdown) - drv->shutdown += gd->reloc_off; - if (drv->readext) - drv->readext += gd->reloc_off; - if (drv->writeext) - drv->writeext += gd->reloc_off; - if (drv->read_mmd) - drv->read_mmd += gd->reloc_off; - if (drv->write_mmd) - drv->write_mmd += gd->reloc_off; -} -#endif - int phy_init(void) { #ifdef CONFIG_NEEDS_MANUAL_RELOC @@ -493,8 +471,24 @@ int phy_init(void) /* Perform manual relocation on linker list based PHY drivers */ ll_entry = ll_entry_start(struct phy_driver, phy_driver); - for (drv = ll_entry; drv != ll_entry + ll_n_ents; drv++) - phy_drv_reloc(drv); + for (drv = ll_entry; drv != ll_entry + ll_n_ents; drv++) { + if (drv->probe) + drv->probe += gd->reloc_off; + if (drv->config) + drv->config += gd->reloc_off; + if (drv->startup) + drv->startup += gd->reloc_off; + if (drv->shutdown) + drv->shutdown += gd->reloc_off; + if (drv->readext) + drv->readext += gd->reloc_off; + if (drv->writeext) + drv->writeext += gd->reloc_off; + if (drv->read_mmd) + drv->read_mmd += gd->reloc_off; + if (drv->write_mmd) + drv->write_mmd += gd->reloc_off; + } #endif return 0; -- cgit v1.2.3 From 9461d73de988964b51a796f69ce0d9424599ebd9 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:03:17 +0100 Subject: net: phy: Only call phy_init() on systems needing manual relocation The phy_init() is now used only to perform manual relocation of PHY driver callbacks. Wrap it in ifdeffery and only call it on systems which still require manual relocation, i.e. m68k . Signed-off-by: Marek Vasut Reviewed-by: Ramon Fried Acked-by: Michal Simek Tested-by: Michal Simek #microblaze (MANUAL_RELOC) --- drivers/net/phy/phy.c | 4 ++-- net/eth_common.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 61603f2817..9b0e497f22 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -463,9 +463,9 @@ U_BOOT_PHY_DRIVER(genphy) = { .shutdown = genphy_shutdown, }; +#ifdef CONFIG_NEEDS_MANUAL_RELOC int phy_init(void) { -#ifdef CONFIG_NEEDS_MANUAL_RELOC const int ll_n_ents = ll_entry_count(struct phy_driver, phy_driver); struct phy_driver *drv, *ll_entry; @@ -489,10 +489,10 @@ int phy_init(void) if (drv->write_mmd) drv->write_mmd += gd->reloc_off; } -#endif return 0; } +#endif int phy_set_supported(struct phy_device *phydev, u32 max_speed) { diff --git a/net/eth_common.c b/net/eth_common.c index 82d527abba..c94a7ba6ae 100644 --- a/net/eth_common.c +++ b/net/eth_common.c @@ -37,7 +37,7 @@ void eth_common_init(void) miiphy_init(); #endif -#ifdef CONFIG_PHYLIB +#if defined(CONFIG_NEEDS_MANUAL_RELOC) && defined(CONFIG_PHYLIB) phy_init(); #endif #endif -- cgit v1.2.3 From 75d28899e3e93b8fed241744c6687f9606310f72 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Tue, 21 Mar 2023 18:25:54 +0100 Subject: net: phy: Synchronize PHY interface modes with Linux Synchronize PHY interface modes with Linux next 6.2.y commit: 0194b64578e90 ("net: phy: improve phy_read_poll_timeout") Retain LX2160A/LX2162A PHY modes as those are not yet supported by the Linux kernel, but isolate those with ifdeffery. Isolate NCSI which are also not supported by Linux kernel. Note that the ifdeffery cannot be avoided with IS_ENABLED() here due to compilation of the entire conditional, which would fail in case NCSI symbols are not available. Signed-off-by: Marek Vasut Reviewed-by: Ramon Fried --- drivers/net/phy/phy.c | 4 +++ include/phy_interface.h | 68 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 53 insertions(+), 19 deletions(-) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 9b0e497f22..f720d0a792 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1160,7 +1160,11 @@ int phy_clear_bits_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val bool phy_interface_is_ncsi(void) { +#ifdef CONFIG_PHY_NCSI struct eth_pdata *pdata = dev_get_plat(eth_get_dev()); return pdata->phy_interface == PHY_INTERFACE_MODE_NCSI; +#else + return 0; +#endif } diff --git a/include/phy_interface.h b/include/phy_interface.h index 52af7e612b..31be3228c7 100644 --- a/include/phy_interface.h +++ b/include/phy_interface.h @@ -14,65 +14,95 @@ typedef enum { PHY_INTERFACE_MODE_NA, /* don't touch */ + PHY_INTERFACE_MODE_INTERNAL, PHY_INTERFACE_MODE_MII, PHY_INTERFACE_MODE_GMII, PHY_INTERFACE_MODE_SGMII, - PHY_INTERFACE_MODE_SGMII_2500, - PHY_INTERFACE_MODE_QSGMII, PHY_INTERFACE_MODE_TBI, + PHY_INTERFACE_MODE_REVMII, PHY_INTERFACE_MODE_RMII, + PHY_INTERFACE_MODE_REVRMII, PHY_INTERFACE_MODE_RGMII, PHY_INTERFACE_MODE_RGMII_ID, PHY_INTERFACE_MODE_RGMII_RXID, PHY_INTERFACE_MODE_RGMII_TXID, PHY_INTERFACE_MODE_RTBI, + PHY_INTERFACE_MODE_SMII, + PHY_INTERFACE_MODE_XGMII, + PHY_INTERFACE_MODE_XLGMII, + PHY_INTERFACE_MODE_MOCA, + PHY_INTERFACE_MODE_QSGMII, + PHY_INTERFACE_MODE_TRGMII, + PHY_INTERFACE_MODE_100BASEX, PHY_INTERFACE_MODE_1000BASEX, PHY_INTERFACE_MODE_2500BASEX, - PHY_INTERFACE_MODE_XGMII, - PHY_INTERFACE_MODE_XAUI, - PHY_INTERFACE_MODE_RXAUI, PHY_INTERFACE_MODE_5GBASER, - PHY_INTERFACE_MODE_SFI, - PHY_INTERFACE_MODE_INTERNAL, + PHY_INTERFACE_MODE_RXAUI, + PHY_INTERFACE_MODE_XAUI, + /* 10GBASE-R, XFI, SFI - single lane 10G Serdes */ + PHY_INTERFACE_MODE_10GBASER, + PHY_INTERFACE_MODE_25GBASER, + PHY_INTERFACE_MODE_USXGMII, + /* 10GBASE-KR - with Clause 73 AN */ + PHY_INTERFACE_MODE_10GKR, + PHY_INTERFACE_MODE_QUSGMII, + PHY_INTERFACE_MODE_1000BASEKX, +#if defined(CONFIG_ARCH_LX2160A) || defined(CONFIG_ARCH_LX2162A) + /* LX2160A SERDES modes */ PHY_INTERFACE_MODE_25G_AUI, PHY_INTERFACE_MODE_XLAUI, PHY_INTERFACE_MODE_CAUI2, PHY_INTERFACE_MODE_CAUI4, +#endif +#if defined(CONFIG_PHY_NCSI) PHY_INTERFACE_MODE_NCSI, - PHY_INTERFACE_MODE_10GBASER, - PHY_INTERFACE_MODE_USXGMII, +#endif PHY_INTERFACE_MODE_MAX, } phy_interface_t; static const char * const phy_interface_strings[] = { - [PHY_INTERFACE_MODE_NA] = "", + [PHY_INTERFACE_MODE_NA] = "", + [PHY_INTERFACE_MODE_INTERNAL] = "internal", [PHY_INTERFACE_MODE_MII] = "mii", [PHY_INTERFACE_MODE_GMII] = "gmii", [PHY_INTERFACE_MODE_SGMII] = "sgmii", - [PHY_INTERFACE_MODE_SGMII_2500] = "sgmii-2500", - [PHY_INTERFACE_MODE_QSGMII] = "qsgmii", [PHY_INTERFACE_MODE_TBI] = "tbi", + [PHY_INTERFACE_MODE_REVMII] = "rev-mii", [PHY_INTERFACE_MODE_RMII] = "rmii", + [PHY_INTERFACE_MODE_REVRMII] = "rev-rmii", [PHY_INTERFACE_MODE_RGMII] = "rgmii", [PHY_INTERFACE_MODE_RGMII_ID] = "rgmii-id", [PHY_INTERFACE_MODE_RGMII_RXID] = "rgmii-rxid", [PHY_INTERFACE_MODE_RGMII_TXID] = "rgmii-txid", [PHY_INTERFACE_MODE_RTBI] = "rtbi", + [PHY_INTERFACE_MODE_SMII] = "smii", + [PHY_INTERFACE_MODE_XGMII] = "xgmii", + [PHY_INTERFACE_MODE_XLGMII] = "xlgmii", + [PHY_INTERFACE_MODE_MOCA] = "moca", + [PHY_INTERFACE_MODE_QSGMII] = "qsgmii", + [PHY_INTERFACE_MODE_TRGMII] = "trgmii", [PHY_INTERFACE_MODE_1000BASEX] = "1000base-x", + [PHY_INTERFACE_MODE_1000BASEKX] = "1000base-kx", [PHY_INTERFACE_MODE_2500BASEX] = "2500base-x", - [PHY_INTERFACE_MODE_XGMII] = "xgmii", - [PHY_INTERFACE_MODE_XAUI] = "xaui", - [PHY_INTERFACE_MODE_RXAUI] = "rxaui", [PHY_INTERFACE_MODE_5GBASER] = "5gbase-r", - [PHY_INTERFACE_MODE_SFI] = "sfi", - [PHY_INTERFACE_MODE_INTERNAL] = "internal", + [PHY_INTERFACE_MODE_RXAUI] = "rxaui", + [PHY_INTERFACE_MODE_XAUI] = "xaui", + [PHY_INTERFACE_MODE_10GBASER] = "10gbase-r", + [PHY_INTERFACE_MODE_25GBASER] = "25gbase-r", + [PHY_INTERFACE_MODE_USXGMII] = "usxgmii", + [PHY_INTERFACE_MODE_10GKR] = "10gbase-kr", + [PHY_INTERFACE_MODE_100BASEX] = "100base-x", + [PHY_INTERFACE_MODE_QUSGMII] = "qusgmii", +#if defined(CONFIG_ARCH_LX2160A) || defined(CONFIG_ARCH_LX2162A) + /* LX2160A SERDES modes */ [PHY_INTERFACE_MODE_25G_AUI] = "25g-aui", [PHY_INTERFACE_MODE_XLAUI] = "xlaui4", [PHY_INTERFACE_MODE_CAUI2] = "caui2", [PHY_INTERFACE_MODE_CAUI4] = "caui4", +#endif +#if defined(CONFIG_PHY_NCSI) [PHY_INTERFACE_MODE_NCSI] = "NC-SI", - [PHY_INTERFACE_MODE_10GBASER] = "10gbase-r", - [PHY_INTERFACE_MODE_USXGMII] = "usxgmii", +#endif }; /* Backplane modes: -- cgit v1.2.3 From 87b7502824416d606d976f635a9a4eef4923ffee Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sun, 19 Mar 2023 18:08:07 +0100 Subject: net: phy: Add phy_modify_mmd() and phy_modify_mmd_changed() from Linux Add phy_modify_mmd()/phy_modify_mmd_changed() from Linux 5.1.y as of commit b8554d4f7288f ("net: phy: add register modifying helpers returning 1 on change") This is used by the upcoming Marvell 10G PHY driver. Signed-off-by: Marek Vasut Reviewed-by: Ramon Fried --- drivers/net/phy/phy.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ include/phy.h | 4 ++++ 2 files changed, 58 insertions(+) (limited to 'drivers/net/phy/phy.c') diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index f720d0a792..0eeb0cb3a8 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -1158,6 +1158,60 @@ int phy_clear_bits_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val return 0; } +/** + * phy_modify_mmd_changed - Function for modifying a register on MMD + * @phydev: the phy_device struct + * @devad: the MMD containing register to modify + * @regnum: register number to modify + * @mask: bit mask of bits to clear + * @set: new value of bits set in mask to write to @regnum + * + * NOTE: MUST NOT be called from interrupt context, + * because the bus read/write functions may wait for an interrupt + * to conclude the operation. + * + * Returns negative errno, 0 if there was no change, and 1 in case of change + */ +int phy_modify_mmd_changed(struct phy_device *phydev, int devad, u32 regnum, + u16 mask, u16 set) +{ + int new, ret; + + ret = phy_read_mmd(phydev, devad, regnum); + if (ret < 0) + return ret; + + new = (ret & ~mask) | set; + if (new == ret) + return 0; + + ret = phy_write_mmd(phydev, devad, regnum, new); + + return ret < 0 ? ret : 1; +} + +/** + * phy_modify_mmd - Convenience function for modifying a register on MMD + * @phydev: the phy_device struct + * @devad: the MMD containing register to modify + * @regnum: register number to modify + * @mask: bit mask of bits to clear + * @set: new value of bits set in mask to write to @regnum + * + * NOTE: MUST NOT be called from interrupt context, + * because the bus read/write functions may wait for an interrupt + * to conclude the operation. + */ +int phy_modify_mmd(struct phy_device *phydev, int devad, u32 regnum, + u16 mask, u16 set) +{ + int ret; + + ret = phy_modify_mmd_changed(phydev, devad, regnum, mask, set); + + return ret < 0 ? ret : 0; +} + bool phy_interface_is_ncsi(void) { #ifdef CONFIG_PHY_NCSI diff --git a/include/phy.h b/include/phy.h index 4a9de46115..34675b2c9c 100644 --- a/include/phy.h +++ b/include/phy.h @@ -289,6 +289,10 @@ int phy_read_mmd(struct phy_device *phydev, int devad, int regnum); int phy_write_mmd(struct phy_device *phydev, int devad, int regnum, u16 val); int phy_set_bits_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val); int phy_clear_bits_mmd(struct phy_device *phydev, int devad, u32 regnum, u16 val); +int phy_modify_mmd_changed(struct phy_device *phydev, int devad, u32 regnum, + u16 mask, u16 set); +int phy_modify_mmd(struct phy_device *phydev, int devad, u32 regnum, + u16 mask, u16 set); int phy_startup(struct phy_device *phydev); int phy_config(struct phy_device *phydev); -- cgit v1.2.3