提交 9ab5c929 编写于 作者: L Linus Walleij 提交者: David S. Miller

net: gemini: Improve connection prints

Switch over to using a module parameter and debug prints
that can be controlled by this or ethtool like everyone
else. Depromote all other prints to debug messages.

The phy_print_status() was already in place, albeit never
really used because the debuglevel hiding it had to be
set up using ethtool.
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 cedca418
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
#define DRV_NAME "gmac-gemini" #define DRV_NAME "gmac-gemini"
#define DRV_VERSION "1.0" #define DRV_VERSION "1.0"
#define DEFAULT_MSG_ENABLE (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK)
static int debug = -1;
module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
#define HSIZE_8 0x00 #define HSIZE_8 0x00
#define HSIZE_16 0x01 #define HSIZE_16 0x01
#define HSIZE_32 0x02 #define HSIZE_32 0x02
...@@ -300,23 +305,26 @@ static void gmac_speed_set(struct net_device *netdev) ...@@ -300,23 +305,26 @@ static void gmac_speed_set(struct net_device *netdev)
status.bits.speed = GMAC_SPEED_1000; status.bits.speed = GMAC_SPEED_1000;
if (phydev->interface == PHY_INTERFACE_MODE_RGMII) if (phydev->interface == PHY_INTERFACE_MODE_RGMII)
status.bits.mii_rmii = GMAC_PHY_RGMII_1000; status.bits.mii_rmii = GMAC_PHY_RGMII_1000;
netdev_info(netdev, "connect to RGMII @ 1Gbit\n"); netdev_dbg(netdev, "connect %s to RGMII @ 1Gbit\n",
phydev_name(phydev));
break; break;
case 100: case 100:
status.bits.speed = GMAC_SPEED_100; status.bits.speed = GMAC_SPEED_100;
if (phydev->interface == PHY_INTERFACE_MODE_RGMII) if (phydev->interface == PHY_INTERFACE_MODE_RGMII)
status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; status.bits.mii_rmii = GMAC_PHY_RGMII_100_10;
netdev_info(netdev, "connect to RGMII @ 100 Mbit\n"); netdev_dbg(netdev, "connect %s to RGMII @ 100 Mbit\n",
phydev_name(phydev));
break; break;
case 10: case 10:
status.bits.speed = GMAC_SPEED_10; status.bits.speed = GMAC_SPEED_10;
if (phydev->interface == PHY_INTERFACE_MODE_RGMII) if (phydev->interface == PHY_INTERFACE_MODE_RGMII)
status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; status.bits.mii_rmii = GMAC_PHY_RGMII_100_10;
netdev_info(netdev, "connect to RGMII @ 10 Mbit\n"); netdev_dbg(netdev, "connect %s to RGMII @ 10 Mbit\n",
phydev_name(phydev));
break; break;
default: default:
netdev_warn(netdev, "Not supported PHY speed (%d)\n", netdev_warn(netdev, "Unsupported PHY speed (%d) on %s\n",
phydev->speed); phydev->speed, phydev_name(phydev));
} }
if (phydev->duplex == DUPLEX_FULL) { if (phydev->duplex == DUPLEX_FULL) {
...@@ -363,12 +371,6 @@ static int gmac_setup_phy(struct net_device *netdev) ...@@ -363,12 +371,6 @@ static int gmac_setup_phy(struct net_device *netdev)
return -ENODEV; return -ENODEV;
netdev->phydev = phy; netdev->phydev = phy;
netdev_info(netdev, "connected to PHY \"%s\"\n",
phydev_name(phy));
phy_attached_print(phy, "phy_id=0x%.8lx, phy_mode=%s\n",
(unsigned long)phy->phy_id,
phy_modes(phy->interface));
phy->supported &= PHY_GBIT_FEATURES; phy->supported &= PHY_GBIT_FEATURES;
phy->supported |= SUPPORTED_Asym_Pause | SUPPORTED_Pause; phy->supported |= SUPPORTED_Asym_Pause | SUPPORTED_Pause;
phy->advertising = phy->supported; phy->advertising = phy->supported;
...@@ -376,19 +378,19 @@ static int gmac_setup_phy(struct net_device *netdev) ...@@ -376,19 +378,19 @@ static int gmac_setup_phy(struct net_device *netdev)
/* set PHY interface type */ /* set PHY interface type */
switch (phy->interface) { switch (phy->interface) {
case PHY_INTERFACE_MODE_MII: case PHY_INTERFACE_MODE_MII:
netdev_info(netdev, "set GMAC0 to GMII mode, GMAC1 disabled\n"); netdev_dbg(netdev,
"MII: set GMAC0 to GMII mode, GMAC1 disabled\n");
status.bits.mii_rmii = GMAC_PHY_MII; status.bits.mii_rmii = GMAC_PHY_MII;
netdev_info(netdev, "connect to MII\n");
break; break;
case PHY_INTERFACE_MODE_GMII: case PHY_INTERFACE_MODE_GMII:
netdev_info(netdev, "set GMAC0 to GMII mode, GMAC1 disabled\n"); netdev_dbg(netdev,
"GMII: set GMAC0 to GMII mode, GMAC1 disabled\n");
status.bits.mii_rmii = GMAC_PHY_GMII; status.bits.mii_rmii = GMAC_PHY_GMII;
netdev_info(netdev, "connect to GMII\n");
break; break;
case PHY_INTERFACE_MODE_RGMII: case PHY_INTERFACE_MODE_RGMII:
dev_info(dev, "set GMAC0 and GMAC1 to MII/RGMII mode\n"); netdev_dbg(netdev,
"RGMII: set GMAC0 and GMAC1 to MII/RGMII mode\n");
status.bits.mii_rmii = GMAC_PHY_RGMII_100_10; status.bits.mii_rmii = GMAC_PHY_RGMII_100_10;
netdev_info(netdev, "connect to RGMII\n");
break; break;
default: default:
netdev_err(netdev, "Unsupported MII interface\n"); netdev_err(netdev, "Unsupported MII interface\n");
...@@ -398,6 +400,9 @@ static int gmac_setup_phy(struct net_device *netdev) ...@@ -398,6 +400,9 @@ static int gmac_setup_phy(struct net_device *netdev)
} }
writel(status.bits32, port->gmac_base + GMAC_STATUS); writel(status.bits32, port->gmac_base + GMAC_STATUS);
if (netif_msg_link(port))
phy_attached_info(phy);
return 0; return 0;
} }
...@@ -1307,7 +1312,7 @@ static void gmac_enable_irq(struct net_device *netdev, int enable) ...@@ -1307,7 +1312,7 @@ static void gmac_enable_irq(struct net_device *netdev, int enable)
unsigned long flags; unsigned long flags;
u32 val, mask; u32 val, mask;
netdev_info(netdev, "%s device %d %s\n", __func__, netdev_dbg(netdev, "%s device %d %s\n", __func__,
netdev->dev_id, enable ? "enable" : "disable"); netdev->dev_id, enable ? "enable" : "disable");
spin_lock_irqsave(&geth->irq_lock, flags); spin_lock_irqsave(&geth->irq_lock, flags);
...@@ -1813,7 +1818,7 @@ static int gmac_open(struct net_device *netdev) ...@@ -1813,7 +1818,7 @@ static int gmac_open(struct net_device *netdev)
HRTIMER_MODE_REL); HRTIMER_MODE_REL);
port->rx_coalesce_timer.function = &gmac_coalesce_delay_expired; port->rx_coalesce_timer.function = &gmac_coalesce_delay_expired;
netdev_info(netdev, "opened\n"); netdev_dbg(netdev, "opened\n");
return 0; return 0;
...@@ -2385,6 +2390,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) ...@@ -2385,6 +2390,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev)
port->id = id; port->id = id;
port->geth = geth; port->geth = geth;
port->dev = dev; port->dev = dev;
port->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE);
/* DMA memory */ /* DMA memory */
dmares = platform_get_resource(pdev, IORESOURCE_MEM, 0); dmares = platform_get_resource(pdev, IORESOURCE_MEM, 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册