Commit 78b69921 authored by Christian Lamparter's avatar Christian Lamparter Committed by David S. Miller

net: ibm: emac: replace custom PHY_MODE_* macros

The ibm_emac driver predates the PHY_INTERFACE_MODE_*
enums by a few years.

And while the driver has been retrofitted to use the PHYLIB,
the old definitions have stuck around to this day.

This patch replaces all occurences of PHY_MODE_* with
the respective equivalent PHY_INTERFACE_MODE_* enum.
And finally, it purges the old macros for good.
Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 49dd19bf
...@@ -199,18 +199,18 @@ static void __emac_set_multicast_list(struct emac_instance *dev); ...@@ -199,18 +199,18 @@ static void __emac_set_multicast_list(struct emac_instance *dev);
static inline int emac_phy_supports_gige(int phy_mode) static inline int emac_phy_supports_gige(int phy_mode)
{ {
return phy_mode == PHY_MODE_GMII || return phy_mode == PHY_INTERFACE_MODE_GMII ||
phy_mode == PHY_MODE_RGMII || phy_mode == PHY_INTERFACE_MODE_RGMII ||
phy_mode == PHY_MODE_SGMII || phy_mode == PHY_INTERFACE_MODE_SGMII ||
phy_mode == PHY_MODE_TBI || phy_mode == PHY_INTERFACE_MODE_TBI ||
phy_mode == PHY_MODE_RTBI; phy_mode == PHY_INTERFACE_MODE_RTBI;
} }
static inline int emac_phy_gpcs(int phy_mode) static inline int emac_phy_gpcs(int phy_mode)
{ {
return phy_mode == PHY_MODE_SGMII || return phy_mode == PHY_INTERFACE_MODE_SGMII ||
phy_mode == PHY_MODE_TBI || phy_mode == PHY_INTERFACE_MODE_TBI ||
phy_mode == PHY_MODE_RTBI; phy_mode == PHY_INTERFACE_MODE_RTBI;
} }
static inline void emac_tx_enable(struct emac_instance *dev) static inline void emac_tx_enable(struct emac_instance *dev)
...@@ -2865,7 +2865,7 @@ static int emac_init_config(struct emac_instance *dev) ...@@ -2865,7 +2865,7 @@ static int emac_init_config(struct emac_instance *dev)
/* PHY mode needs some decoding */ /* PHY mode needs some decoding */
dev->phy_mode = of_get_phy_mode(np); dev->phy_mode = of_get_phy_mode(np);
if (dev->phy_mode < 0) if (dev->phy_mode < 0)
dev->phy_mode = PHY_MODE_NA; dev->phy_mode = PHY_INTERFACE_MODE_NA;
/* Check EMAC version */ /* Check EMAC version */
if (of_device_is_compatible(np, "ibm,emac4sync")) { if (of_device_is_compatible(np, "ibm,emac4sync")) {
...@@ -3168,7 +3168,7 @@ static int emac_probe(struct platform_device *ofdev) ...@@ -3168,7 +3168,7 @@ static int emac_probe(struct platform_device *ofdev)
printk(KERN_INFO "%s: EMAC-%d %pOF, MAC %pM\n", printk(KERN_INFO "%s: EMAC-%d %pOF, MAC %pM\n",
ndev->name, dev->cell_index, np, ndev->dev_addr); ndev->name, dev->cell_index, np, ndev->dev_addr);
if (dev->phy_mode == PHY_MODE_SGMII) if (dev->phy_mode == PHY_INTERFACE_MODE_SGMII)
printk(KERN_NOTICE "%s: in SGMII mode\n", ndev->name); printk(KERN_NOTICE "%s: in SGMII mode\n", ndev->name);
if (dev->phy.address >= 0) if (dev->phy.address >= 0)
......
...@@ -104,19 +104,6 @@ struct emac_regs { ...@@ -104,19 +104,6 @@ struct emac_regs {
} u1; } u1;
}; };
/*
* PHY mode settings (EMAC <-> ZMII/RGMII bridge <-> PHY)
*/
#define PHY_MODE_NA PHY_INTERFACE_MODE_NA
#define PHY_MODE_MII PHY_INTERFACE_MODE_MII
#define PHY_MODE_RMII PHY_INTERFACE_MODE_RMII
#define PHY_MODE_SMII PHY_INTERFACE_MODE_SMII
#define PHY_MODE_RGMII PHY_INTERFACE_MODE_RGMII
#define PHY_MODE_TBI PHY_INTERFACE_MODE_TBI
#define PHY_MODE_GMII PHY_INTERFACE_MODE_GMII
#define PHY_MODE_RTBI PHY_INTERFACE_MODE_RTBI
#define PHY_MODE_SGMII PHY_INTERFACE_MODE_SGMII
/* EMACx_MR0 */ /* EMACx_MR0 */
#define EMAC_MR0_RXI 0x80000000 #define EMAC_MR0_RXI 0x80000000
#define EMAC_MR0_TXI 0x40000000 #define EMAC_MR0_TXI 0x40000000
......
...@@ -96,7 +96,7 @@ int emac_mii_reset_gpcs(struct mii_phy *phy) ...@@ -96,7 +96,7 @@ int emac_mii_reset_gpcs(struct mii_phy *phy)
if ((val & BMCR_ISOLATE) && limit > 0) if ((val & BMCR_ISOLATE) && limit > 0)
gpcs_phy_write(phy, MII_BMCR, val & ~BMCR_ISOLATE); gpcs_phy_write(phy, MII_BMCR, val & ~BMCR_ISOLATE);
if (limit > 0 && phy->mode == PHY_MODE_SGMII) { if (limit > 0 && phy->mode == PHY_INTERFACE_MODE_SGMII) {
/* Configure GPCS interface to recommended setting for SGMII */ /* Configure GPCS interface to recommended setting for SGMII */
gpcs_phy_write(phy, 0x04, 0x8120); /* AsymPause, FDX */ gpcs_phy_write(phy, 0x04, 0x8120); /* AsymPause, FDX */
gpcs_phy_write(phy, 0x07, 0x2801); /* msg_pg, toggle */ gpcs_phy_write(phy, 0x07, 0x2801); /* msg_pg, toggle */
...@@ -313,16 +313,16 @@ static int cis8201_init(struct mii_phy *phy) ...@@ -313,16 +313,16 @@ static int cis8201_init(struct mii_phy *phy)
epcr &= ~EPCR_MODE_MASK; epcr &= ~EPCR_MODE_MASK;
switch (phy->mode) { switch (phy->mode) {
case PHY_MODE_TBI: case PHY_INTERFACE_MODE_TBI:
epcr |= EPCR_TBI_MODE; epcr |= EPCR_TBI_MODE;
break; break;
case PHY_MODE_RTBI: case PHY_INTERFACE_MODE_RTBI:
epcr |= EPCR_RTBI_MODE; epcr |= EPCR_RTBI_MODE;
break; break;
case PHY_MODE_GMII: case PHY_INTERFACE_MODE_GMII:
epcr |= EPCR_GMII_MODE; epcr |= EPCR_GMII_MODE;
break; break;
case PHY_MODE_RGMII: case PHY_INTERFACE_MODE_RGMII:
default: default:
epcr |= EPCR_RGMII_MODE; epcr |= EPCR_RGMII_MODE;
} }
......
...@@ -52,25 +52,25 @@ ...@@ -52,25 +52,25 @@
/* RGMII bridge supports only GMII/TBI and RGMII/RTBI PHYs */ /* RGMII bridge supports only GMII/TBI and RGMII/RTBI PHYs */
static inline int rgmii_valid_mode(int phy_mode) static inline int rgmii_valid_mode(int phy_mode)
{ {
return phy_mode == PHY_MODE_GMII || return phy_mode == PHY_INTERFACE_MODE_GMII ||
phy_mode == PHY_MODE_MII || phy_mode == PHY_INTERFACE_MODE_MII ||
phy_mode == PHY_MODE_RGMII || phy_mode == PHY_INTERFACE_MODE_RGMII ||
phy_mode == PHY_MODE_TBI || phy_mode == PHY_INTERFACE_MODE_TBI ||
phy_mode == PHY_MODE_RTBI; phy_mode == PHY_INTERFACE_MODE_RTBI;
} }
static inline u32 rgmii_mode_mask(int mode, int input) static inline u32 rgmii_mode_mask(int mode, int input)
{ {
switch (mode) { switch (mode) {
case PHY_MODE_RGMII: case PHY_INTERFACE_MODE_RGMII:
return RGMII_FER_RGMII(input); return RGMII_FER_RGMII(input);
case PHY_MODE_TBI: case PHY_INTERFACE_MODE_TBI:
return RGMII_FER_TBI(input); return RGMII_FER_TBI(input);
case PHY_MODE_GMII: case PHY_INTERFACE_MODE_GMII:
return RGMII_FER_GMII(input); return RGMII_FER_GMII(input);
case PHY_MODE_MII: case PHY_INTERFACE_MODE_MII:
return RGMII_FER_MII(input); return RGMII_FER_MII(input);
case PHY_MODE_RTBI: case PHY_INTERFACE_MODE_RTBI:
return RGMII_FER_RTBI(input); return RGMII_FER_RTBI(input);
default: default:
BUG(); BUG();
......
...@@ -49,20 +49,20 @@ ...@@ -49,20 +49,20 @@
*/ */
static inline int zmii_valid_mode(int mode) static inline int zmii_valid_mode(int mode)
{ {
return mode == PHY_MODE_MII || return mode == PHY_INTERFACE_MODE_MII ||
mode == PHY_MODE_RMII || mode == PHY_INTERFACE_MODE_RMII ||
mode == PHY_MODE_SMII || mode == PHY_INTERFACE_MODE_SMII ||
mode == PHY_MODE_NA; mode == PHY_INTERFACE_MODE_NA;
} }
static inline const char *zmii_mode_name(int mode) static inline const char *zmii_mode_name(int mode)
{ {
switch (mode) { switch (mode) {
case PHY_MODE_MII: case PHY_INTERFACE_MODE_MII:
return "MII"; return "MII";
case PHY_MODE_RMII: case PHY_INTERFACE_MODE_RMII:
return "RMII"; return "RMII";
case PHY_MODE_SMII: case PHY_INTERFACE_MODE_SMII:
return "SMII"; return "SMII";
default: default:
BUG(); BUG();
...@@ -72,11 +72,11 @@ static inline const char *zmii_mode_name(int mode) ...@@ -72,11 +72,11 @@ static inline const char *zmii_mode_name(int mode)
static inline u32 zmii_mode_mask(int mode, int input) static inline u32 zmii_mode_mask(int mode, int input)
{ {
switch (mode) { switch (mode) {
case PHY_MODE_MII: case PHY_INTERFACE_MODE_MII:
return ZMII_FER_MII(input); return ZMII_FER_MII(input);
case PHY_MODE_RMII: case PHY_INTERFACE_MODE_RMII:
return ZMII_FER_RMII(input); return ZMII_FER_RMII(input);
case PHY_MODE_SMII: case PHY_INTERFACE_MODE_SMII:
return ZMII_FER_SMII(input); return ZMII_FER_SMII(input);
default: default:
return 0; return 0;
...@@ -106,27 +106,27 @@ int zmii_attach(struct platform_device *ofdev, int input, int *mode) ...@@ -106,27 +106,27 @@ int zmii_attach(struct platform_device *ofdev, int input, int *mode)
* Please, always specify PHY mode in your board port to avoid * Please, always specify PHY mode in your board port to avoid
* any surprises. * any surprises.
*/ */
if (dev->mode == PHY_MODE_NA) { if (dev->mode == PHY_INTERFACE_MODE_NA) {
if (*mode == PHY_MODE_NA) { if (*mode == PHY_INTERFACE_MODE_NA) {
u32 r = dev->fer_save; u32 r = dev->fer_save;
ZMII_DBG(dev, "autodetecting mode, FER = 0x%08x" NL, r); ZMII_DBG(dev, "autodetecting mode, FER = 0x%08x" NL, r);
if (r & (ZMII_FER_MII(0) | ZMII_FER_MII(1))) if (r & (ZMII_FER_MII(0) | ZMII_FER_MII(1)))
dev->mode = PHY_MODE_MII; dev->mode = PHY_INTERFACE_MODE_MII;
else if (r & (ZMII_FER_RMII(0) | ZMII_FER_RMII(1))) else if (r & (ZMII_FER_RMII(0) | ZMII_FER_RMII(1)))
dev->mode = PHY_MODE_RMII; dev->mode = PHY_INTERFACE_MODE_RMII;
else else
dev->mode = PHY_MODE_SMII; dev->mode = PHY_INTERFACE_MODE_SMII;
} else } else {
dev->mode = *mode; dev->mode = *mode;
}
printk(KERN_NOTICE "%pOF: bridge in %s mode\n", printk(KERN_NOTICE "%pOF: bridge in %s mode\n",
ofdev->dev.of_node, ofdev->dev.of_node,
zmii_mode_name(dev->mode)); zmii_mode_name(dev->mode));
} else { } else {
/* All inputs must use the same mode */ /* All inputs must use the same mode */
if (*mode != PHY_MODE_NA && *mode != dev->mode) { if (*mode != PHY_INTERFACE_MODE_NA && *mode != dev->mode) {
printk(KERN_ERR printk(KERN_ERR
"%pOF: invalid mode %d specified for input %d\n", "%pOF: invalid mode %d specified for input %d\n",
ofdev->dev.of_node, *mode, input); ofdev->dev.of_node, *mode, input);
...@@ -246,7 +246,7 @@ static int zmii_probe(struct platform_device *ofdev) ...@@ -246,7 +246,7 @@ static int zmii_probe(struct platform_device *ofdev)
mutex_init(&dev->lock); mutex_init(&dev->lock);
dev->ofdev = ofdev; dev->ofdev = ofdev;
dev->mode = PHY_MODE_NA; dev->mode = PHY_INTERFACE_MODE_NA;
rc = -ENXIO; rc = -ENXIO;
if (of_address_to_resource(np, 0, &regs)) { if (of_address_to_resource(np, 0, &regs)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment