From patchwork Thu Nov 17 15:40:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 13046990 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3FB9C4332F for ; Thu, 17 Nov 2022 15:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=VSnHZJ0dcAVEPSy00EQTj//R2epTS32MoCDt2/ZS7KY=; b=hwxteKKw1a4MHx qH5RgjVWN02XZw8f17UQ76VYlrsEJFaFCSRD7XnYuQE97ZTzhcgEolfBDg2k0LrHQHY5IVFVZZvN3 3EwdA9h9WMqRYQ4t3HYUz8945Rg6QgHhPDVn3DpuHG3h4iAzqIW1nkH4gnIpiFgO16gtLSbzOrM5U gmkHKY0ZOZoMH0Y80sEbZUAnFrjQUQPhFjv+fno4gdoI0L4yekMdp0Cv06Vt3BXeo8sLz+aXWGXYe /hQEHpVfRuhcar6CIfUMunbso5fiutBSnsBDLEK4lDpUjoG6w73URzPBslmCLRIVEHKHv1QclYXYd didStGdzXL2cgyc7LlJg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovh0Z-00FSOY-J0; Thu, 17 Nov 2022 15:40:55 +0000 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovh0M-00FSJd-S6 for linux-arm-kernel@lists.infradead.org; Thu, 17 Nov 2022 15:40:44 +0000 Received: by mail-pl1-x62d.google.com with SMTP id io19so1949502plb.8 for ; Thu, 17 Nov 2022 07:40:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oLJYSiggvAjbp+LwFxqT7uEEbEOvnatHP5iviwJOgSs=; b=lPZnKuA+IGDARzqKeOlwG6wwU2I1q9d4lrhLdd8funbceoQve6kg7fXWiJCQ54p540 lIDvCgFOml3d40gOFy/hSXCyYh1On7vq7TSLja7jPJ/Px0+Rm0T+ncrJRT+wUUQ9vcTs 3xTyoqbkZEtEpog+F8kHMW8714XT8fvc+PCmzLcXe7YyTIES3FV3wuVqMemMenNZm+Ao n96n4nZ/i8vmAGtV8yGSIIKLYU6Z98LBd5pEpNEi7ZCQcZM0gKtCeEx8keTVMczr+EWY CTtd6pkjzLsKmzdWHutANrBZWZYtjiXpvrHbW9QT1pdQxVTHRgGlxNb24OpwVVZFcq4h OTnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oLJYSiggvAjbp+LwFxqT7uEEbEOvnatHP5iviwJOgSs=; b=xkTq1H97jeJ/lZsFQicn9VX/UU/jKo4ZMSRlPLyFcVLxndLArjDzwSybVAXVtoshFv Avq7G+QZgSbuBN9RknyiZK/rVcBGBp2dyxvbGqHZuWEbcW3DxyC1XXQUtUwq66kreJve LmN5ue7RkSSoDZPvemKEaavIu87YxsMhjBC5H3cl0gdeIb7HU/8gMXxRUnaYh9V5z8Qz 3RxzaMMMLBHnIwX2aANW9RSKdOAhi1tkIh4h11bx6iCo4AORjqZyeoSsxfcRdcoxiI0h EdVwO4KHXx3GhSyLFCsPX6ctLF4MjOwYpgV8r5nnOhD9s6+16fl/mp2Zo/VLIa4Tfd3s qxnQ== X-Gm-Message-State: ANoB5pnyylsWOmGjAfFJ759n2RMCKqrgl6WB8pOLClx5Uy4uDt8RApCS skswLE9nwJbOHM0li/Si49jQ9w== X-Google-Smtp-Source: AA0mqf7ZyTUBzAQtqpgaTHa+DvymqUBVqN5ZEqLpVzMeKmg/cajj1yV0PppjyyD1v48AbEM2nvcxcQ== X-Received: by 2002:a17:90b:30d0:b0:213:f1d8:eb6a with SMTP id hi16-20020a17090b30d000b00213f1d8eb6amr3237464pjb.219.1668699641135; Thu, 17 Nov 2022 07:40:41 -0800 (PST) Received: from archlinux.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id b7-20020aa79507000000b0056bcfe015c9sm1252363pfp.204.2022.11.17.07.40.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 07:40:40 -0800 (PST) From: Andy Chiu To: davem@davemloft.net, andrew@lunn.ch, kuba@kernel.org, michal.simek@xilinx.com, radhey.shyam.pandey@xilinx.com Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robh+dt@kernel.org, pabeni@redhat.com, edumazet@google.com, andy.chiu@sifive.com, greentime.hu@sifive.com Subject: [PATCH v5 net-next 1/3] net: axienet: Unexport and remove unused mdio functions Date: Thu, 17 Nov 2022 23:40:12 +0800 Message-Id: <20221117154014.1418834-2-andy.chiu@sifive.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20221117154014.1418834-1-andy.chiu@sifive.com> References: <20221117154014.1418834-1-andy.chiu@sifive.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_074042_942558_8749C7A0 X-CRM114-Status: GOOD ( 11.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Both axienet_mdio_{enable/disable} functions are no longer used in xilinx_axienet_main.c due to 253761a0e61b7. And axienet_mdio_disable is not even used in the mdio.c. So unexport and remove them. Signed-off-by: Andy Chiu Reviewed-by: Greentime Hu Reviewed-by: Andrew Lunn --- drivers/net/ethernet/xilinx/xilinx_axienet.h | 2 -- drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | 13 +------------ 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet.h b/drivers/net/ethernet/xilinx/xilinx_axienet.h index 6370c447ac5c..575ff9de8985 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet.h +++ b/drivers/net/ethernet/xilinx/xilinx_axienet.h @@ -611,8 +611,6 @@ static inline void axienet_dma_out_addr(struct axienet_local *lp, off_t reg, #endif /* CONFIG_64BIT */ /* Function prototypes visible in xilinx_axienet_mdio.c for other files */ -int axienet_mdio_enable(struct axienet_local *lp); -void axienet_mdio_disable(struct axienet_local *lp); int axienet_mdio_setup(struct axienet_local *lp); void axienet_mdio_teardown(struct axienet_local *lp); diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c index 0b3b6935c558..e1f51a071888 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c @@ -153,7 +153,7 @@ static int axienet_mdio_write(struct mii_bus *bus, int phy_id, int reg, * Sets up the MDIO interface by initializing the MDIO clock and enabling the * MDIO interface in hardware. **/ -int axienet_mdio_enable(struct axienet_local *lp) +static int axienet_mdio_enable(struct axienet_local *lp) { u32 host_clock; @@ -226,17 +226,6 @@ int axienet_mdio_enable(struct axienet_local *lp) return axienet_mdio_wait_until_ready(lp); } -/** - * axienet_mdio_disable - MDIO hardware disable function - * @lp: Pointer to axienet local data structure. - * - * Disable the MDIO interface in hardware. - **/ -void axienet_mdio_disable(struct axienet_local *lp) -{ - axienet_iow(lp, XAE_MDIO_MC_OFFSET, 0); -} - /** * axienet_mdio_setup - MDIO setup function * @lp: Pointer to axienet local data structure. From patchwork Thu Nov 17 15:40:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 13046991 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4C2FBC4332F for ; Thu, 17 Nov 2022 15:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eoiaex7nZ3M1lgc794hDdtHpOYCsC+JCLcrILJrt6fM=; b=LkiUHtLBX8XY9g xUQCxp69fK78RTKZaBm9rsTbN+XrSA9A06bh1kbaXpiX0wjkvlzSLhdDPfuPeunGJPWIoEBpfj3dT U8BgHobiyEptB6Kgx6RyQz8POpJNioCGvKW5CRxr/9U1+JBecZxs7pKecbfEszE+Wgd8AbbwX0h8u Scpr8iCO/hadLjR/aMsJAkbAeVvhqRACYgLGscAToK/S6DpgPYMJaDt/mvqN7Bqxh8Am3sJWVT5xA KiW4N8QAl7JGv6OxXB3eVfMYe1tFbm43q0wU79XwO3/I0kLYsIZu2A75pBMyd4qB7jkcYvjwQfLF1 IBmNxLmb3M2oBFKXZqWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovh0m-00FSUD-Dz; Thu, 17 Nov 2022 15:41:08 +0000 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovh0Q-00FSLM-Bi for linux-arm-kernel@lists.infradead.org; Thu, 17 Nov 2022 15:40:47 +0000 Received: by mail-pf1-x432.google.com with SMTP id z26so2145246pff.1 for ; Thu, 17 Nov 2022 07:40:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YXBE4c0bQF7I0eIkv6UTkINV8n+xSb5KU8CMf36EQc4=; b=A9PnsiwrtqXW7VqZVjrvvqZT846udynLXca2Pet2RXbhQbWlscxz2JayEN2gLe7AMN pw7qAsdYUU5cIQi2d4QzuSMSK2Ts17mvhEHQH+dM/WI20bWgzKAMV4Laq5ejABpyXVKi wvsApRNZNzkNGPv5xZ906Byh2+j4hI2BUdkEttArIR5xxOw9H1FMh+EZZTh5t1fkQloj OHaGhOJuZ70eGIl+SOE/JxH8y9981JInhpVABuZfoD84vGwnizGtlB1En6R4kEkvhyHD Wvt0QXGWeF6m1tQSNGzpLRuNF/g9FSkqWxFSp4bXJ44cPvwIRrlalMnbg+7C7kJ4qBKV CgBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YXBE4c0bQF7I0eIkv6UTkINV8n+xSb5KU8CMf36EQc4=; b=e93gA7DDz84/54grAxvgqzq9sN49VSZBcLIUYOg3XJ/0nkA3dN1NC9yIgQb8BsJzZP A+pqXX+TYche/YAuqXw7ugq3zQcQALiIVhxc8sfvzTJJEECsnTMvkmfoCoqzrZZqz74/ cJyYPV0RU5ZnLIsMN5PP14dJOaavef4fvcxRL8O5rb7t/N+vE1AjdoFAPNdIu9GASE7p hogk459EqXEdfcYSY6Up6muHJvcQY7yGXauGwrCwhaIWjQreJ5D+0YdXMxzFvhKOZkPq EaWn7oQMv3n5G95jI/GxJz3qnzng/W73WKWWKd2KETwt8V4alC6KFZsDLpQCj7X1LOUG 254A== X-Gm-Message-State: ANoB5plAgFaMe1HBM/5R4XOGasq2KBBeSH4z8UvHepN3JJTHF2P7nC6u ivPWNoIMiSPxlZ1pFlCYK+mOrw== X-Google-Smtp-Source: AA0mqf5FiR6os7pqdyAZOlRNU3CP+OUehkfh4DYsNgwXw973Q0Oy5B78sXOQ5oJ34gUFxHvIWVqUaw== X-Received: by 2002:a62:3181:0:b0:572:149c:e1ba with SMTP id x123-20020a623181000000b00572149ce1bamr3544364pfx.19.1668699644463; Thu, 17 Nov 2022 07:40:44 -0800 (PST) Received: from archlinux.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id b7-20020aa79507000000b0056bcfe015c9sm1252363pfp.204.2022.11.17.07.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 07:40:44 -0800 (PST) From: Andy Chiu To: davem@davemloft.net, andrew@lunn.ch, kuba@kernel.org, michal.simek@xilinx.com, radhey.shyam.pandey@xilinx.com Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robh+dt@kernel.org, pabeni@redhat.com, edumazet@google.com, andy.chiu@sifive.com, greentime.hu@sifive.com, Rob Herring Subject: [PATCH v5 net-next 2/3] dt-bindings: describe the support of "clock-frequency" in mdio Date: Thu, 17 Nov 2022 23:40:13 +0800 Message-Id: <20221117154014.1418834-3-andy.chiu@sifive.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20221117154014.1418834-1-andy.chiu@sifive.com> References: <20221117154014.1418834-1-andy.chiu@sifive.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_074046_455164_BB34B5B6 X-CRM114-Status: UNSURE ( 9.69 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org mdio bus frequency is going to be configurable at boottime by a property in DT now, so add a description to it. Signed-off-by: Andy Chiu Reviewed-by: Greentime Hu Reviewed-by: Andrew Lunn Acked-by: Rob Herring --- Documentation/devicetree/bindings/net/xilinx_axienet.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/net/xilinx_axienet.txt b/Documentation/devicetree/bindings/net/xilinx_axienet.txt index 1aa4c6006cd0..80e505a2fda1 100644 --- a/Documentation/devicetree/bindings/net/xilinx_axienet.txt +++ b/Documentation/devicetree/bindings/net/xilinx_axienet.txt @@ -68,6 +68,8 @@ Optional properties: - mdio : Child node for MDIO bus. Must be defined if PHY access is required through the core's MDIO interface (i.e. always, unless the PHY is accessed through a different bus). + Non-standard MDIO bus frequency is supported via + "clock-frequency", see mdio.yaml. - pcs-handle: Phandle to the internal PCS/PMA PHY in SGMII or 1000Base-X modes, where "pcs-handle" should be used to point From patchwork Thu Nov 17 15:40:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 13046993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C6B09C433FE for ; Thu, 17 Nov 2022 15:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NCBcIYLEc++nRwGoDxFM914genG6njm75fixUYr7Gk4=; b=T076Lu2fPta1e/ jmb1alqKcudpXV+R3a0Bx6Ito0JTxagpslMtF8glPMQweVUU5FZ9atBE0lr6aITN3zPZAzBMtn2mz 46Du9FOlUkbtLsiFNUyva6p9NBDeFJh6nz8BJ9s9DMLMfnt8olsK7A+iA30QkNZOJZlW/B0jNJBUP 4EcccLsO9oam0aL449VnQ9i1sQYK4wB87z7Ng8I4gZQShU4Ec/Fm2JcE+xENLXUwr8iHulYTONEmq RLA4//pIFOMGsl6puXVWIh0wtLauIGxy4vED3EZV8cAli6Ir7mHXa83QlDjyNd59BJBO7zRzvLpLi CE++FIHoO2wVT5I+BPIg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovh0z-00FSb9-8a; Thu, 17 Nov 2022 15:41:21 +0000 Received: from mail-pf1-x430.google.com ([2607:f8b0:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovh0V-00FSMP-Gw for linux-arm-kernel@lists.infradead.org; Thu, 17 Nov 2022 15:40:53 +0000 Received: by mail-pf1-x430.google.com with SMTP id b185so2116882pfb.9 for ; Thu, 17 Nov 2022 07:40:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=msvCIOK/h6MLc6IW/jU+iRbJ69+mcNCO5Gup0wjtGOY=; b=jZLWkTE1AGPA2orwncOl9GK7Rpds55oEnBmV4YrV+lCsr7Qo/Zz7cdzfLXB79J6xJb ZwrAmR5aB9NHTyilkU7r75O6wcfqdtn0dqdIlNI6I4KE87Snygviiq7EFhk1tU/LTdJz 1I+9/+tHgN4D8fcGf+u14CBd3XlY6pTogFdeAQO5HYZ8XTTyO3WfUSSxHeRY5v7xT35g jpWxpUGG2bGvNuqI0WynkThgts24d/qIZyd3MJAo/9nJ1T9bryx5ePWsfECnu/MxMhO2 oiuC9mBMohM9spU5JJ3AIAiEfi4v6hgnCaZ5DLe0/Fz+nlnXwYLBYJwcUR2Wp5QtTOhE DM6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=msvCIOK/h6MLc6IW/jU+iRbJ69+mcNCO5Gup0wjtGOY=; b=vNEGT64ghcYh3xLLkZWSYFfnSpWLFkMBm2ANCARFDtqhZ6fHP23c3IkbJb5Ep1tdkM un1nw4HibMyZZP/z0DJ/lPfBaQSY1Sv/nE31JyJ7C5n3jzDsd56AVnOwzjNO48VIg4on O+mS1FjYiSicoTvnKPh8ZbjaS6mdngLgtN84SAmENygAjL0aSFRakRhhb/cJs5t8XGyE tWgaRIqPK0yhz0LzR/T7jAtn2b9hLRNnB6/5P39cvpFHvEAC6r0GEYlcOW9nynuhN6vF wIlDjgAAMjv7GmbpotAU9JWQUs7Dc28lkV9q7VYHJw2PBRLd8KXlLMDzq60OxjqvbQw3 ggPw== X-Gm-Message-State: ANoB5pl19aicjFsmaNeSnDpy/P/2UVBxObroEE+/+99V/qcoPEdmzfwa gXUODkMNtkDbzw0tfYwD7Q8Tcw== X-Google-Smtp-Source: AA0mqf4BDSeoRMTG+3FTeht9pOvb4qi7OB9u6jSMTYlkYKAh4O23jJFGm9XQ2XiwHvgMa+GxHdgQrg== X-Received: by 2002:a65:4b8d:0:b0:477:d61:d2b3 with SMTP id t13-20020a654b8d000000b004770d61d2b3mr2088663pgq.624.1668699647729; Thu, 17 Nov 2022 07:40:47 -0800 (PST) Received: from archlinux.internal.sifive.com (59-124-168-89.hinet-ip.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id b7-20020aa79507000000b0056bcfe015c9sm1252363pfp.204.2022.11.17.07.40.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 07:40:47 -0800 (PST) From: Andy Chiu To: davem@davemloft.net, andrew@lunn.ch, kuba@kernel.org, michal.simek@xilinx.com, radhey.shyam.pandey@xilinx.com Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robh+dt@kernel.org, pabeni@redhat.com, edumazet@google.com, andy.chiu@sifive.com, greentime.hu@sifive.com Subject: [PATCH v5 net-next 3/3] net: axienet: set mdio clock according to bus-frequency Date: Thu, 17 Nov 2022 23:40:14 +0800 Message-Id: <20221117154014.1418834-4-andy.chiu@sifive.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20221117154014.1418834-1-andy.chiu@sifive.com> References: <20221117154014.1418834-1-andy.chiu@sifive.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_074051_601586_05A5C06D X-CRM114-Status: GOOD ( 21.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some FPGA platforms have 80KHz MDIO bus frequency constraint when connecting Ethernet to its on-board external Marvell PHY. Thus, we may have to set MDIO clock according to the DT. Otherwise, use the default 2.5 MHz, as specified by 802.3, if the entry is not present. Also, change MAX_MDIO_FREQ to DEFAULT_MDIO_FREQ because we may actually set MDIO bus frequency higher than 2.5MHz if undelying devices support it. And properly disable the mdio bus clock in error path. Signed-off-by: Andy Chiu Reviewed-by: Radhey Shyam Pandey Reviewed-by: Andrew Lunn --- .../net/ethernet/xilinx/xilinx_axienet_mdio.c | 70 +++++++++++++------ 1 file changed, 49 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c index e1f51a071888..2f07fde361aa 100644 --- a/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c @@ -17,7 +17,7 @@ #include "xilinx_axienet.h" -#define MAX_MDIO_FREQ 2500000 /* 2.5 MHz */ +#define DEFAULT_MDIO_FREQ 2500000 /* 2.5 MHz */ #define DEFAULT_HOST_CLOCK 150000000 /* 150 MHz */ /* Wait till MDIO interface is ready to accept a new transaction.*/ @@ -147,15 +147,20 @@ static int axienet_mdio_write(struct mii_bus *bus, int phy_id, int reg, /** * axienet_mdio_enable - MDIO hardware setup function * @lp: Pointer to axienet local data structure. + * @np: Pointer to mdio device tree node. * - * Return: 0 on success, -ETIMEDOUT on a timeout. + * Return: 0 on success, -ETIMEDOUT on a timeout, -EOVERFLOW on a clock + * divisor overflow. * * Sets up the MDIO interface by initializing the MDIO clock and enabling the * MDIO interface in hardware. **/ -static int axienet_mdio_enable(struct axienet_local *lp) +static int axienet_mdio_enable(struct axienet_local *lp, struct device_node *np) { + u32 mdio_freq = DEFAULT_MDIO_FREQ; u32 host_clock; + u32 clk_div; + int ret; lp->mii_clk_div = 0; @@ -184,6 +189,12 @@ static int axienet_mdio_enable(struct axienet_local *lp) host_clock); } + if (np) + of_property_read_u32(np, "clock-frequency", &mdio_freq); + if (mdio_freq != DEFAULT_MDIO_FREQ) + netdev_info(lp->ndev, "Setting non-standard mdio bus frequency to %u Hz\n", + mdio_freq); + /* clk_div can be calculated by deriving it from the equation: * fMDIO = fHOST / ((1 + clk_div) * 2) * @@ -209,29 +220,42 @@ static int axienet_mdio_enable(struct axienet_local *lp) * "clock-frequency" from the CPU */ - lp->mii_clk_div = (host_clock / (MAX_MDIO_FREQ * 2)) - 1; + clk_div = (host_clock / (mdio_freq * 2)) - 1; /* If there is any remainder from the division of - * fHOST / (MAX_MDIO_FREQ * 2), then we need to add - * 1 to the clock divisor or we will surely be above 2.5 MHz + * fHOST / (mdio_freq * 2), then we need to add + * 1 to the clock divisor or we will surely be + * above the requested frequency */ - if (host_clock % (MAX_MDIO_FREQ * 2)) - lp->mii_clk_div++; + if (host_clock % (mdio_freq * 2)) + clk_div++; + + /* Check for overflow of mii_clk_div */ + if (clk_div & ~XAE_MDIO_MC_CLOCK_DIVIDE_MAX) { + netdev_warn(lp->ndev, "MDIO clock divisor overflow\n"); + return -EOVERFLOW; + } + lp->mii_clk_div = (u8)clk_div; netdev_dbg(lp->ndev, "Setting MDIO clock divisor to %u/%u Hz host clock.\n", lp->mii_clk_div, host_clock); - axienet_iow(lp, XAE_MDIO_MC_OFFSET, lp->mii_clk_div | XAE_MDIO_MC_MDIOEN_MASK); + axienet_mdio_mdc_enable(lp); - return axienet_mdio_wait_until_ready(lp); + ret = axienet_mdio_wait_until_ready(lp); + if (ret) + axienet_mdio_mdc_disable(lp); + + return ret; } /** * axienet_mdio_setup - MDIO setup function * @lp: Pointer to axienet local data structure. * - * Return: 0 on success, -ETIMEDOUT on a timeout, -ENOMEM when - * mdiobus_alloc (to allocate memory for mii bus structure) fails. + * Return: 0 on success, -ETIMEDOUT on a timeout, -EOVERFLOW on a clock + * divisor overflow, -ENOMEM when mdiobus_alloc (to allocate + * memory for mii bus structure) fails. * * Sets up the MDIO interface by initializing the MDIO clock. * Register the MDIO interface. @@ -242,10 +266,6 @@ int axienet_mdio_setup(struct axienet_local *lp) struct mii_bus *bus; int ret; - ret = axienet_mdio_enable(lp); - if (ret < 0) - return ret; - bus = mdiobus_alloc(); if (!bus) return -ENOMEM; @@ -261,15 +281,23 @@ int axienet_mdio_setup(struct axienet_local *lp) lp->mii_bus = bus; mdio_node = of_get_child_by_name(lp->dev->of_node, "mdio"); + ret = axienet_mdio_enable(lp, mdio_node); + if (ret < 0) + goto unregister; ret = of_mdiobus_register(bus, mdio_node); + if (ret) + goto unregister_mdio_enabled; of_node_put(mdio_node); - if (ret) { - mdiobus_free(bus); - lp->mii_bus = NULL; - return ret; - } axienet_mdio_mdc_disable(lp); return 0; + +unregister_mdio_enabled: + axienet_mdio_mdc_disable(lp); +unregister: + of_node_put(mdio_node); + mdiobus_free(bus); + lp->mii_bus = NULL; + return ret; } /**