net: phy: Add Broadcom phy library for common interfaces
This patch adds the Broadcom phy library to consolidate common interfaces shared by Broadcom phy's. Moved the common interfaces to the 'bcm-phy-lib.c' and updated the Broadcom PHY drivers to use the new APIs. Signed-off-by: Arun Parameswaran <arunp@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

کامیت شده توسط
David S. Miller

والد
ddc24ae1fd
کامیت
a1cba5613e
@@ -6,6 +6,7 @@
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
#include "bcm-phy-lib.h"
|
||||
#include <linux/module.h>
|
||||
#include <linux/phy.h>
|
||||
|
||||
@@ -42,35 +43,6 @@ static int bcm63xx_config_init(struct phy_device *phydev)
|
||||
return phy_write(phydev, MII_BCM63XX_IR, reg);
|
||||
}
|
||||
|
||||
static int bcm63xx_ack_interrupt(struct phy_device *phydev)
|
||||
{
|
||||
int reg;
|
||||
|
||||
/* Clear pending interrupts. */
|
||||
reg = phy_read(phydev, MII_BCM63XX_IR);
|
||||
if (reg < 0)
|
||||
return reg;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcm63xx_config_intr(struct phy_device *phydev)
|
||||
{
|
||||
int reg, err;
|
||||
|
||||
reg = phy_read(phydev, MII_BCM63XX_IR);
|
||||
if (reg < 0)
|
||||
return reg;
|
||||
|
||||
if (phydev->interrupts == PHY_INTERRUPT_ENABLED)
|
||||
reg &= ~MII_BCM63XX_IR_GMASK;
|
||||
else
|
||||
reg |= MII_BCM63XX_IR_GMASK;
|
||||
|
||||
err = phy_write(phydev, MII_BCM63XX_IR, reg);
|
||||
return err;
|
||||
}
|
||||
|
||||
static struct phy_driver bcm63xx_driver[] = {
|
||||
{
|
||||
.phy_id = 0x00406000,
|
||||
@@ -82,8 +54,8 @@ static struct phy_driver bcm63xx_driver[] = {
|
||||
.config_init = bcm63xx_config_init,
|
||||
.config_aneg = genphy_config_aneg,
|
||||
.read_status = genphy_read_status,
|
||||
.ack_interrupt = bcm63xx_ack_interrupt,
|
||||
.config_intr = bcm63xx_config_intr,
|
||||
.ack_interrupt = bcm_phy_ack_intr,
|
||||
.config_intr = bcm_phy_config_intr,
|
||||
.driver = { .owner = THIS_MODULE },
|
||||
}, {
|
||||
/* same phy as above, with just a different OUI */
|
||||
@@ -95,8 +67,8 @@ static struct phy_driver bcm63xx_driver[] = {
|
||||
.config_init = bcm63xx_config_init,
|
||||
.config_aneg = genphy_config_aneg,
|
||||
.read_status = genphy_read_status,
|
||||
.ack_interrupt = bcm63xx_ack_interrupt,
|
||||
.config_intr = bcm63xx_config_intr,
|
||||
.ack_interrupt = bcm_phy_ack_intr,
|
||||
.config_intr = bcm_phy_config_intr,
|
||||
.driver = { .owner = THIS_MODULE },
|
||||
} };
|
||||
|
||||
|
مرجع در شماره جدید
Block a user