From patchwork Wed Jul 11 19:32:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 141767 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp675950ljj; Wed, 11 Jul 2018 12:36:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpenmdAmYxg0fSUd3cXS2xD/4rWItPyih2vA24RXp7TCNkcNSKZ11pHujj3ZRsQPiDqoWS9B X-Received: by 2002:a65:62d8:: with SMTP id m24-v6mr28114549pgv.307.1531337775514; Wed, 11 Jul 2018 12:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531337775; cv=none; d=google.com; s=arc-20160816; b=AL2jZwIn0X7mD3y0weJYhcdcIAC9Oz+ME7YdjI4L/I0qpBgseU1SrF6nDAuaUHFYEJ 37ueo0aCZVFl+QGWqR71+cPnOXEQJg+knCkMJWER6ZpA3eADfRxM0Gn6+lIcqUV0SHOz GOyxhygNKvoQTRlVxicyeG7xZJFEIUt/s/n4jVYji4fEQVdDQmiPJowO5InA6QYLSNcr sJ6EMILaEbhwcjWRrOUIVvyMLljl4KgZfRYhrrMSRQZXGQ21T8RrQRFcYZMzHue6BggY KUsCVbhjD2CmRUhEGpHoeB+HS0OBx9Rxp64vsmsE5PZymYsj+1JjctvILVWVtmJxINbl 7iTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=77wIjDtXWh8AM/RNgPez27RCUexVR5LtaaQSxSC6hLw=; b=fI9pA6ZsJFVh211e7O9bgnzXHjOnFHIoss3Ig8SDofznBGQrxZsNWygZdwefu3CCCs B2viIZLELVw1LYmS1E/moCYc6W77TN+Btlb3jHt0+uFcrLT0X1Kr6Oj0PWQYHjo+TUV5 8vZp/Q3+PrKhsp0edqWabfiUglLvlx3ajRFsj8dbEdY/iPcC/iWZr2MUexLrlpfp4eYP Qk2teNi7GHUyh4ZmxMZgTOO+IBnmS0gHTOHF+brluJfZs1QaHvyrUY0CjbNJRoxd7X3o B1JYc4doCqqyZR4ayDEAtzjbAJ4xfxu21XBeHbSyVMlJmqzJ1AQQvXkl0yLKs3lzSBFu DhDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GHKFNuna; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 85-v6si21344993pfm.264.2018.07.11.12.36.15; Wed, 11 Jul 2018 12:36:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GHKFNuna; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388321AbeGKTmB (ORCPT + 10 others); Wed, 11 Jul 2018 15:42:01 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:40068 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726783AbeGKTmB (ORCPT ); Wed, 11 Jul 2018 15:42:01 -0400 Received: by mail-lf0-f68.google.com with SMTP id y200-v6so22218205lfd.7 for ; Wed, 11 Jul 2018 12:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=77wIjDtXWh8AM/RNgPez27RCUexVR5LtaaQSxSC6hLw=; b=GHKFNuna9Vz2bdcBkbH+V+Rq9d5epKeIDuFlzyCI40QEn5wgJOjziZxVA8MNckiV2b 9iZ51jGvGArXkta4KwbHuwKn7nD+Ay6LA+EqtmA23Dv6u0X95QLtlOA6YKR+QfbIRdYN rXi9Dmqyb6LtqbAaI2Jzb3aObsqyHw+XVauGk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=77wIjDtXWh8AM/RNgPez27RCUexVR5LtaaQSxSC6hLw=; b=qC5rEuGMXVMSNo6c1VlCB5gN3l5rCpPLl7JQqxdgyFfDFgegoRNV7wj1WZH6x7AM4o ku3m6Ld1Mo3VRXbUua5yCVZ9yRD2/LHOa2nEojSrOJmYcAjDTsnCpOvaGVd2TYwszY5a GqUT7TYOy6QOSfbxI74Gk0wXLkavjYw/QGFWpiQdh70ya6bJX4+XGrnyUWCf1VU2yCT6 6X1u3MqbM98rkoWMXBVbIEljnvA1abauW5mKbGDtp1fhx9R8lQS+K5puJy5IqvZ4V+YH GxxVdlVdDGsvCM3rXybYSboRANiiwTaux55qTHmNXfLQ5P1Lcx0xD0j4kbeHyqpskqop JYOQ== X-Gm-Message-State: APt69E14VOJtZr57JLAxhsTmB4QlzCr0fUlfk+YGx09VShjjX88EJa5c j4OqJP1ovwiiHEuKjNE+BT/kUHzH05k= X-Received: by 2002:a19:1586:: with SMTP id 6-v6mr6524990lfv.51.1531337770824; Wed, 11 Jul 2018 12:36:10 -0700 (PDT) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id y5-v6sm5502299lfc.58.2018.07.11.12.36.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Jul 2018 12:36:09 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" Cc: Hans Ulli Kroll , Florian Fainelli , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= , Andrew Lunn , Linus Walleij Subject: [PATCH net-next 2/5 v3] net: gemini: Improve connection prints Date: Wed, 11 Jul 2018 21:32:42 +0200 Message-Id: <20180711193245.21980-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180711193245.21980-1-linus.walleij@linaro.org> References: <20180711193245.21980-1-linus.walleij@linaro.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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: Linus Walleij --- ChangeLog v2->v3: - Use phy_attached_info() live all other drivers. - Put it in an if (netif_msg_link()) clause like the other message from phy_print_status(). - Explain more in the commit message. ChangeLog v1->v2: - Use a module parameter and the message levels like all other drivers and stop trying to be special. --- drivers/net/ethernet/cortina/gemini.c | 46 +++++++++++++++------------ 1 file changed, 26 insertions(+), 20 deletions(-) -- 2.17.1 Reviewed-by: Andrew Lunn diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 8fc31723f700..f0ab6426daca 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -46,6 +46,11 @@ #define DRV_NAME "gmac-gemini" #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_16 0x01 #define HSIZE_32 0x02 @@ -300,23 +305,26 @@ static void gmac_speed_set(struct net_device *netdev) status.bits.speed = GMAC_SPEED_1000; if (phydev->interface == PHY_INTERFACE_MODE_RGMII) 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; case 100: status.bits.speed = GMAC_SPEED_100; if (phydev->interface == PHY_INTERFACE_MODE_RGMII) 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; case 10: status.bits.speed = GMAC_SPEED_10; if (phydev->interface == PHY_INTERFACE_MODE_RGMII) 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; default: - netdev_warn(netdev, "Not supported PHY speed (%d)\n", - phydev->speed); + netdev_warn(netdev, "Unsupported PHY speed (%d) on %s\n", + phydev->speed, phydev_name(phydev)); } if (phydev->duplex == DUPLEX_FULL) { @@ -363,12 +371,6 @@ static int gmac_setup_phy(struct net_device *netdev) return -ENODEV; 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 |= SUPPORTED_Asym_Pause | SUPPORTED_Pause; phy->advertising = phy->supported; @@ -376,19 +378,19 @@ static int gmac_setup_phy(struct net_device *netdev) /* set PHY interface type */ switch (phy->interface) { 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; - netdev_info(netdev, "connect to MII\n"); break; 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; - netdev_info(netdev, "connect to GMII\n"); break; 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; - netdev_info(netdev, "connect to RGMII\n"); break; default: netdev_err(netdev, "Unsupported MII interface\n"); @@ -398,6 +400,9 @@ static int gmac_setup_phy(struct net_device *netdev) } writel(status.bits32, port->gmac_base + GMAC_STATUS); + if (netif_msg_link(port)) + phy_attached_info(phy); + return 0; } @@ -1307,8 +1312,8 @@ static void gmac_enable_irq(struct net_device *netdev, int enable) unsigned long flags; u32 val, mask; - netdev_info(netdev, "%s device %d %s\n", __func__, - netdev->dev_id, enable ? "enable" : "disable"); + netdev_dbg(netdev, "%s device %d %s\n", __func__, + netdev->dev_id, enable ? "enable" : "disable"); spin_lock_irqsave(&geth->irq_lock, flags); mask = GMAC0_IRQ0_2 << (netdev->dev_id * 2); @@ -1813,7 +1818,7 @@ static int gmac_open(struct net_device *netdev) HRTIMER_MODE_REL); port->rx_coalesce_timer.function = &gmac_coalesce_delay_expired; - netdev_info(netdev, "opened\n"); + netdev_dbg(netdev, "opened\n"); return 0; @@ -2385,6 +2390,7 @@ static int gemini_ethernet_port_probe(struct platform_device *pdev) port->id = id; port->geth = geth; port->dev = dev; + port->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); /* DMA memory */ dmares = platform_get_resource(pdev, IORESOURCE_MEM, 0);