From patchwork Wed Feb 24 14:56:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_Gonz=C3=A1lez_Cabanelas?= X-Patchwork-Id: 12102041 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CA1CC432C3 for ; Wed, 24 Feb 2021 15:25:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BE82164F0F for ; Wed, 24 Feb 2021 15:25:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236550AbhBXPXN (ORCPT ); Wed, 24 Feb 2021 10:23:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235897AbhBXO5r (ORCPT ); Wed, 24 Feb 2021 09:57:47 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49FA1C061574 for ; Wed, 24 Feb 2021 06:57:07 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id 7so2189519wrz.0 for ; Wed, 24 Feb 2021 06:57:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=xIB+Qj4r3eqV2Do1yD4qWo7FiqhWH2F6QqhaA1dSUP8=; b=pHg5LvgiHuzr/DkN7Ck9s5hNKhv9Hyjm1Z/NCR82TrtgL92qXoJthJq7XqH3Tv4QRn 475DBTNIQiv5Fw0JZG5mgwGUO9/C72en91ixm2N35wFp2pgGOsKPkB8XptgO2mxZa0wL mEjH/DLFTJ0NFa49BK5qjfyz4AIF4Y3fn2b8V6RjCTIK3HSI3IaKmf1UObnJBpT+YtLA 0cQeK0q7H7EXGcS5WVxtXx8hfAFovRCPPY/JWss5Ks4h8QvAn330Oc7FnHZqkPyR2iTP tYU2H3hHOFMIalj69ZnIyMHKWedK7GL5qdlytMQazyZkjP4diQZmOLte1//rtOVjvHWI V0sQ== 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:mime-version :content-transfer-encoding; bh=xIB+Qj4r3eqV2Do1yD4qWo7FiqhWH2F6QqhaA1dSUP8=; b=rkZQUcLWWZum1dwvfJJ+2ER/sgL8w1zJ3LdMrrcqXrztbmHUHHizf4ISE7PM1aFLko j0aBKi+DK9VqXmtNBhPOhaN62ormM2+7CxHYM+5PqavQPVWhXqmph3i8V/TSWcC1rFgg ywG+4fpUxdxDPzn3JMz/hKpe5cgYxPilGp2RBYNihf9Io9j5aaZw7ZLDzvoCEWquxNWr XrreR1nAKoFcie90YCBkat6+7Ig45BaG/1XrPHzRcg5XIWDg21dWjXeCijaeU2bOjYai y1ADq1TKAyfMFfMChk4CX6MVGZMhZNY0P8AYVFfKqPsAlwONaeK0izgUSgN/YgHfb4sO F97w== X-Gm-Message-State: AOAM5338XGzViuXmo4b0LSSVp6zwH4z50ClR/9s75kQmC5CGlCrNNggn 7nffOUlg1H9/H/S/IMJqgDqTMLP3m5ATLA== X-Google-Smtp-Source: ABdhPJyJliPBakhaUS0i+ZgqSNL3hjRAOc6fqL2RD5eT7OgNdznfcMEbT6aLLqYYuNOOKqPJrYOF2A== X-Received: by 2002:a5d:4050:: with SMTP id w16mr8851718wrp.21.1614178626108; Wed, 24 Feb 2021 06:57:06 -0800 (PST) Received: from tool.localnet ([213.177.198.100]) by smtp.gmail.com with ESMTPSA id y2sm3766953wrp.39.2021.02.24.06.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Feb 2021 06:57:04 -0800 (PST) From: Daniel =?iso-8859-1?q?Gonz=E1lez?= Cabanelas To: davem@davemloft.net Cc: kuba@kernel.org, f.fainelli@gmail.com, gregkh@linuxfoundation.org, netdev@vger.kernel.org, noltari@gmail.com Subject: [PATCH] bcm63xx_enet: fix internal phy IRQ assignment Date: Wed, 24 Feb 2021 15:56:08 +0100 Message-ID: <2270332.afWbCi5vXM@tool> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The current bcm63xx_enet driver doesn't asign the internal phy IRQ. As a result of this it works in polling mode. Fix it using the phy_device structure to assign the platform IRQ. Tested under a BCM6348 board. Kernel dmesg before the patch: Broadcom BCM63XX (1) bcm63xx_enet-0:01: attached PHY driver [Broadcom BCM63XX (1)] (mii_bus:phy_addr=bcm63xx_enet-0:01, irq=POLL) After the patch: Broadcom BCM63XX (1) bcm63xx_enet-0:01: attached PHY driver [Broadcom BCM63XX (1)] (mii_bus:phy_addr=bcm63xx_enet-0:01, irq=17) Pluging and uplugging the ethernet cable now generates interrupts and the PHY goes up and down as expected. Signed-off-by: Daniel González Cabanelas --- drivers/net/ethernet/broadcom/bcm63xx_enet.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bcm63xx_enet.c b/drivers/net/ethernet/broadcom/bcm63xx_enet.c index fd876721316..0dad527abb9 100644 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c @@ -1819,7 +1819,14 @@ static int bcm_enet_probe(struct platform_device *pdev) bus->phy_mask = ~(1 << priv->phy_id); if (priv->has_phy_interrupt) + phydev = mdiobus_get_phy(bus, priv->phy_id); + if (!phydev) { + dev_err(&dev->dev, "no PHY found\n"); + goto out_unregister_mdio; + } + bus->irq[priv->phy_id] = priv->phy_interrupt; + phydev->irq = priv->phy_interrupt; ret = mdiobus_register(bus); if (ret) {