From patchwork Wed Jul 4 18:33:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 141083 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1097778ljj; Wed, 4 Jul 2018 11:37:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfPNn/DxdH+M7u8BuHbW6CcNQwWnXrZE55Vdh2RlxPFlVFF9lJJaRgHu6TWyir8FFiekNuq X-Received: by 2002:a63:62c4:: with SMTP id w187-v6mr2841689pgb.55.1530729447092; Wed, 04 Jul 2018 11:37:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530729447; cv=none; d=google.com; s=arc-20160816; b=w/Z4eQeSLPyzstnAM0JNxIpdSxvs1soHN0LlzYZwbi6U1G/1EGu5gHRkhnniUwTtfF Cmt0Fb/i6WaMhMXf2UkbibfV8WuQVU4yP2ozWqsnW0hxZNtIef42X0KUZBGlfjGVM8ky No1eQVUALppJl+8s36psvg7zLtJha87T5eCgcWiEzFvDf2wfFqFQIlBFqOv1LTeBy3NO kSeMu7d4f4i0NlpnQJ35L/S5D6CiSKTjBfnsywBuQqoQzStYBnqmhWqv1/+X8XqbCgLA SoNmO7t/EiVlXfBvvUz0cMw1t1fcw8rTrljlonjZNJpI0KupZaJ19UK6StrUdgRY8qoa N64g== 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=FJhrV1Q8AbTG3+DhEHqNDtavFTs+NdRTz5PkjVJT+Z4=; b=PfhfzKxlNfEfFpA8vJF5dQG4cqFlRqifR8hkvo6DffeNoYptEW/oqcpeG36T/E3D8R JVBRmxdp7JP7xl54JS4cE44fNdUI+U8cSPYUjvYe8acvbp7emY3Ys0CEQfbyxwkCx3Lt HwYxeMlJUpuQ6unyYGbgoh+X9eXdDHKo5aZnuMvN4c0aoUiAQiGhZDTK7QIzt/zOwU6T 9v8Pj3nP0/K5kDUZCo77jzu3SFAXla5VKY2sbDhk0SOnSI8A18Tx3oWM5drllf5E4k1k MLnWehVx4ZT3Cx79FD2mg8FEchkM8CSkv68q/DaLGbrW3nk3UNPn9QZaZ5kBQdZocIPv cq1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fodfploV; 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 d6-v6si3961989pgh.569.2018.07.04.11.37.26; Wed, 04 Jul 2018 11:37:27 -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=fodfploV; 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 S1752622AbeGDShY (ORCPT + 10 others); Wed, 4 Jul 2018 14:37:24 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:33205 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752578AbeGDShX (ORCPT ); Wed, 4 Jul 2018 14:37:23 -0400 Received: by mail-lj1-f193.google.com with SMTP id t21-v6so4914533lji.0 for ; Wed, 04 Jul 2018 11:37:23 -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=FJhrV1Q8AbTG3+DhEHqNDtavFTs+NdRTz5PkjVJT+Z4=; b=fodfploVfoTrDn8oeWXnVpwJbt3dkr943G7vW2DdK27G0l3xZRYOnM4YfQSTkhYo7X zdc3fCynrxEK8Iau6YZ/CHkWXrzeHv4uefjdXry34yJJBcZuGMFxMl/l1EmcFBaDOz6h kx2Vc2wfgzw0s3LvzgbhDd9vRP5gX+YKwWF64= 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=FJhrV1Q8AbTG3+DhEHqNDtavFTs+NdRTz5PkjVJT+Z4=; b=qeBjaQDSnhmcBjUsjgjgaSeBGTHDsk8nF4PSeSspjSO2OmG42oMZfZOXOndkdBCJUr WzDPAsRGj7rIEvs9o+GhfZE6pd8B4I3TOTEdjvqoxcYAOaQni4mshMr1NfG/f3jRioqv P/huj05vvKlEcB2kIgQRvwS1AdCn58j3K8SSzE5t0fMNs6wp5lHEHxzm3WNjErKGR8Ai 0wCJVEd8SAnjMjKKtdm+ZalY7uprr6fEXtsGEbQeHzWwyifAqShWqm8Y4HsFCYPrIC8w oHUhA9lcBbIA6zVGBQyVQG+4P3FPEErL9ae66lqCHCulvVCjvPyCYi4qccTGDITUSuSk r9zQ== X-Gm-Message-State: APt69E2Y2UuXFFcBP8jt1eitwiL+KGsbf0qXrZrOdiUjzHmzHO04ePXY dslIRu+5vvPqlstUODXEBauDkyCAwsY= X-Received: by 2002:a2e:2282:: with SMTP id i124-v6mr2061962lji.11.1530729441954; Wed, 04 Jul 2018 11:37:21 -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 g2-v6sm681094ljj.53.2018.07.04.11.37.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 04 Jul 2018 11:37:20 -0700 (PDT) From: Linus Walleij To: netdev@vger.kernel.org, "David S . Miller" , =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: Janos Laube , Paulius Zaleckas , linux-arm-kernel@lists.infradead.org, Hans Ulli Kroll , Florian Fainelli , Linus Walleij Subject: [PATCH net-next 2/5 v2] net: gemini: Improve connection prints Date: Wed, 4 Jul 2018 20:33:21 +0200 Message-Id: <20180704183324.10605-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180704183324.10605-1-linus.walleij@linaro.org> References: <20180704183324.10605-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. Signed-off-by: Linus Walleij --- 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 | 44 +++++++++++++++------------ 1 file changed, 25 insertions(+), 19 deletions(-) -- 2.17.1 diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 8fc31723f700..f219208d2351 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,11 +371,8 @@ 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)); + netdev_dbg(netdev, "connected to PHY \"%s\"\n", + phydev_name(phy)); phy->supported &= PHY_GBIT_FEATURES; phy->supported |= SUPPORTED_Asym_Pause | SUPPORTED_Pause; @@ -376,19 +381,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"); @@ -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);