提交 67c4f3fa 编写于 作者: J Jeff Garzik

Fix numerous minor problems with new phy subsystem.

Includes fixes for problems noted by Adrian Bunk, Andrew Morton,
and one other person lost in the annals of history (and email folders).
上级 303bcb4b
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
menu "PHY device support" menu "PHY device support"
config PHYLIB config PHYLIB
bool "PHY Device support and infrastructure" tristate "PHY Device support and infrastructure"
depends on NET_ETHERNET depends on NET_ETHERNET
help help
Ethernet controllers are usually attached to PHY Ethernet controllers are usually attached to PHY
...@@ -24,31 +24,31 @@ comment "MII PHY device drivers" ...@@ -24,31 +24,31 @@ comment "MII PHY device drivers"
depends on PHYLIB depends on PHYLIB
config MARVELL_PHY config MARVELL_PHY
bool "Drivers for Marvell PHYs" tristate "Drivers for Marvell PHYs"
depends on PHYLIB depends on PHYLIB
---help--- ---help---
Currently has a driver for the 88E1011S Currently has a driver for the 88E1011S
config DAVICOM_PHY config DAVICOM_PHY
bool "Drivers for Davicom PHYs" tristate "Drivers for Davicom PHYs"
depends on PHYLIB depends on PHYLIB
---help--- ---help---
Currently supports dm9161e and dm9131 Currently supports dm9161e and dm9131
config QSEMI_PHY config QSEMI_PHY
bool "Drivers for Quality Semiconductor PHYs" tristate "Drivers for Quality Semiconductor PHYs"
depends on PHYLIB depends on PHYLIB
---help--- ---help---
Currently supports the qs6612 Currently supports the qs6612
config LXT_PHY config LXT_PHY
bool "Drivers for the Intel LXT PHYs" tristate "Drivers for the Intel LXT PHYs"
depends on PHYLIB depends on PHYLIB
---help--- ---help---
Currently supports the lxt970, lxt971 Currently supports the lxt970, lxt971
config CICADA_PHY config CICADA_PHY
bool "Drivers for the Cicada PHYs" tristate "Drivers for the Cicada PHYs"
depends on PHYLIB depends on PHYLIB
---help--- ---help---
Currently supports the cis8204 Currently supports the cis8204
......
# Makefile for Linux PHY drivers # Makefile for Linux PHY drivers
obj-$(CONFIG_PHYLIB) += phy.o phy_device.o mdio_bus.o libphy-objs := phy.o phy_device.o mdio_bus.o
obj-$(CONFIG_MARVELL_PHY) += marvell.o obj-$(CONFIG_MARVELL_PHY) += libphy.o marvell.o
obj-$(CONFIG_DAVICOM_PHY) += davicom.o obj-$(CONFIG_DAVICOM_PHY) += libphy.o davicom.o
obj-$(CONFIG_CICADA_PHY) += cicada.o obj-$(CONFIG_CICADA_PHY) += libphy.o cicada.o
obj-$(CONFIG_LXT_PHY) += lxt.o obj-$(CONFIG_LXT_PHY) += libphy.o lxt.o
obj-$(CONFIG_QSEMI_PHY) += qsemi.o obj-$(CONFIG_QSEMI_PHY) += libphy.o qsemi.o
...@@ -165,9 +165,9 @@ struct bus_type mdio_bus_type = { ...@@ -165,9 +165,9 @@ struct bus_type mdio_bus_type = {
.resume = mdio_bus_resume, .resume = mdio_bus_resume,
}; };
static int __init mdio_bus_init(void) int __init mdio_bus_init(void)
{ {
return bus_register(&mdio_bus_type); return bus_register(&mdio_bus_type);
} }
subsys_initcall(mdio_bus_init);
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
static void phy_change(void *data);
static void phy_timer(unsigned long data); static void phy_timer(unsigned long data);
/* Convenience function to print out the current phy status /* Convenience function to print out the current phy status
...@@ -464,7 +463,6 @@ void phy_stop_machine(struct phy_device *phydev) ...@@ -464,7 +463,6 @@ void phy_stop_machine(struct phy_device *phydev)
phydev->adjust_state = NULL; phydev->adjust_state = NULL;
} }
#ifdef CONFIG_PHYCONTROL
/* phy_error: /* phy_error:
* *
* Moves the PHY to the HALTED state in response to a read * Moves the PHY to the HALTED state in response to a read
...@@ -479,6 +477,10 @@ void phy_error(struct phy_device *phydev) ...@@ -479,6 +477,10 @@ void phy_error(struct phy_device *phydev)
spin_unlock(&phydev->lock); spin_unlock(&phydev->lock);
} }
#ifdef CONFIG_PHYCONTROL
static void phy_change(void *data);
/* phy_interrupt /* phy_interrupt
* *
* description: When a PHY interrupt occurs, the handler disables * description: When a PHY interrupt occurs, the handler disables
...@@ -672,6 +674,8 @@ void phy_start(struct phy_device *phydev) ...@@ -672,6 +674,8 @@ void phy_start(struct phy_device *phydev)
EXPORT_SYMBOL(phy_stop); EXPORT_SYMBOL(phy_stop);
EXPORT_SYMBOL(phy_start); EXPORT_SYMBOL(phy_start);
#endif /* CONFIG_PHYCONTROL */
/* PHY timer which handles the state machine */ /* PHY timer which handles the state machine */
static void phy_timer(unsigned long data) static void phy_timer(unsigned long data)
{ {
...@@ -859,4 +863,3 @@ static void phy_timer(unsigned long data) ...@@ -859,4 +863,3 @@ static void phy_timer(unsigned long data)
mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ); mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ);
} }
#endif /* CONFIG_PHYCONTROL */
此差异已折叠。
...@@ -39,6 +39,19 @@ ...@@ -39,6 +39,19 @@
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
static int genphy_config_init(struct phy_device *phydev);
static struct phy_driver genphy_driver = {
.phy_id = 0xffffffff,
.phy_id_mask = 0xffffffff,
.name = "Generic PHY",
.config_init = genphy_config_init,
.features = 0,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
.driver = {.owner = THIS_MODULE, },
};
/* get_phy_device /* get_phy_device
* *
* description: Reads the ID registers of the PHY at addr on the * description: Reads the ID registers of the PHY at addr on the
...@@ -656,27 +669,32 @@ void phy_driver_unregister(struct phy_driver *drv) ...@@ -656,27 +669,32 @@ void phy_driver_unregister(struct phy_driver *drv)
} }
EXPORT_SYMBOL(phy_driver_unregister); EXPORT_SYMBOL(phy_driver_unregister);
static struct phy_driver genphy_driver = {
.phy_id = 0xffffffff,
.phy_id_mask = 0xffffffff,
.name = "Generic PHY",
.config_init = genphy_config_init,
.features = 0,
.config_aneg = genphy_config_aneg,
.read_status = genphy_read_status,
.driver = {.owner = THIS_MODULE, },
};
static int __init genphy_init(void) static int __init phy_init(void)
{ {
return phy_driver_register(&genphy_driver); int rc;
extern int mdio_bus_init(void);
rc = phy_driver_register(&genphy_driver);
if (rc)
goto out;
rc = mdio_bus_init();
if (rc)
goto out_unreg;
return 0;
out_unreg:
phy_driver_unregister(&genphy_driver);
out:
return rc;
} }
static void __exit genphy_exit(void) static void __exit phy_exit(void)
{ {
phy_driver_unregister(&genphy_driver); phy_driver_unregister(&genphy_driver);
} }
module_init(genphy_init); module_init(phy_init);
module_exit(genphy_exit); module_exit(phy_exit);
...@@ -374,5 +374,4 @@ int phy_start_interrupts(struct phy_device *phydev); ...@@ -374,5 +374,4 @@ int phy_start_interrupts(struct phy_device *phydev);
void phy_print_status(struct phy_device *phydev); void phy_print_status(struct phy_device *phydev);
extern struct bus_type mdio_bus_type; extern struct bus_type mdio_bus_type;
extern struct phy_driver genphy_driver;
#endif /* __PHY_H */ #endif /* __PHY_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册