bgmac: connect to PHY and make use of PHY device
We were already registering MDIO bus, but we were not connecting bgmac to the PHY. Add proper call and implement adjust link function to switch MAC into requested state. At the same time it's possible to drop our internal PHY management. This is a "standard" PHY, so the "Generic PHY" driver works perfectly fine with this. Don't duplicate the code. Finally make use of phy_ethtool_[gs]set functions instead implementing them from scratch. This change was successfully tested on BCM5357. I was able to autonegotiate 1000Mb/s full duplex, as well as force any of the 10/100/1000 half/full modes. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
2c722fe1c8
commit
5824d2d16d
@@ -342,10 +342,6 @@
|
||||
#define BGMAC_CHIPCTL_1_SW_TYPE_RGMII 0x000000C0
|
||||
#define BGMAC_CHIPCTL_1_RXC_DLL_BYPASS 0x00010000
|
||||
|
||||
#define BGMAC_SPEED_10 0x0001
|
||||
#define BGMAC_SPEED_100 0x0002
|
||||
#define BGMAC_SPEED_1000 0x0004
|
||||
|
||||
#define BGMAC_WEIGHT 64
|
||||
|
||||
#define ETHER_MAX_LEN 1518
|
||||
@@ -402,6 +398,7 @@ struct bgmac {
|
||||
struct net_device *net_dev;
|
||||
struct napi_struct napi;
|
||||
struct mii_bus *mii_bus;
|
||||
struct phy_device *phy_dev;
|
||||
|
||||
/* DMA */
|
||||
struct bgmac_dma_ring tx_ring[BGMAC_MAX_TX_RINGS];
|
||||
@@ -416,10 +413,9 @@ struct bgmac {
|
||||
u32 int_mask;
|
||||
u32 int_status;
|
||||
|
||||
/* Speed-related */
|
||||
int speed;
|
||||
bool autoneg;
|
||||
bool full_duplex;
|
||||
/* Current MAC state */
|
||||
int mac_speed;
|
||||
int mac_duplex;
|
||||
|
||||
u8 phyaddr;
|
||||
bool has_robosw;
|
||||
|
Reference in New Issue
Block a user