From patchwork Thu Nov 17 15:40:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Chiu X-Patchwork-Id: 13046989 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 66D80C433FE for ; Thu, 17 Nov 2022 15:41:47 +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: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:In-Reply-To:References: List-Owner; bh=4+0xGpCrb4mt4+s8XDpz967ZH7xl3PWJMbUXHhPrkH8=; b=lmJcxzSzbII9NK RhlzKxkHx0GkyMmqkvD8Ns3fujmUIgY6r5BWLIpPLjsvJVOx51B7EHjT2SMBnBs+9xtWHffLo8bJl ldBu5xs+KFoPMndTvlPTcu7nsLqwuN4+ApCziJDFQqZRnRGb/9rbfQyE2C9JvnBqcZBkr7vZnLddy xMfy025RIahCqan561Xc30evTfjMOgAZL0NnRrE0YFE3S5CHrIe2X9BGznEyW3UEdUymhi84/l74R FnOZc1kcRMk8sH5yot2b7Ykc0pthUrNrxSQIXlMGXCaebOcKfWzOUc6MTLWRg2P+HxJNU2GA9kPQW udXvb9NCluzZa7sZ8LQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovh0M-00FSKH-R0; Thu, 17 Nov 2022 15:40:42 +0000 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovh0K-00FSHy-0r for linux-arm-kernel@lists.infradead.org; Thu, 17 Nov 2022 15:40:41 +0000 Received: by mail-pg1-x536.google.com with SMTP id s196so2306311pgs.3 for ; Thu, 17 Nov 2022 07:40:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pfRqtRKd8SqE53Bj4VHMwwcbF9sjiMvyrIbl19n+WS8=; b=OWhqxymbjYJcH3uaYprhaap3P+2ad7c1PNYCs86hkhofwJT8At5HiplT7dXLTLWxv9 SpIsZK0gglEJMD3eLzaWpz8J75ismL3VcZTdc8JgQbvs6A70sZBI6pbZ6/2gsiKyNTMB pYMMIshXwjt/wtrS+K4us6bU5eIB0gkSWCKFYK8hEA7C+DJOywOP/tLPsWLsDsPM+gYq MNgCVDvHUZqymlsKFlOgif1G17fbLbTAKCg2DQuidep4JqBIJsAj5UEbVsGKLjQhCbrF GmBPK/zqsa/Q//tFcc9d3d98udFwGMVKiPGM9N/dKy8ZkopLxFuNeeWSimE9J6UgdS2L eVdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pfRqtRKd8SqE53Bj4VHMwwcbF9sjiMvyrIbl19n+WS8=; b=zQOk3sJW4ElsTJekVrcNhRzio8EutMCxWo4TD4GdP/GFx6PZEgYkLpGW1o4NkHU8QW WmQz1pSVVC9+DAWkcsbV4G98II6kUbVlccH3AsKzvi9Ja2EwGTafhdNF09PHSSqmqYrd EDZDUHi8TWu+ARWZWLKshJ12fOlQ/dBmr5GtjQh9M0juXSFVy6YmETMfg935JttPBkFp YV1TR86JF23nNusqZpI5ilP3DQXpjZ3zzjoe8KvVSvVTwZ3J/XHeXHaQuw8LjGNa4XSM zgcGSqBZw72i3V+sr6OhiuCAVSFSQNDalSz0IA+M2lXIQIwIyvVuhFVV3afag3eZTrKk IPbg== X-Gm-Message-State: ANoB5pmtFijfT5szFJtxcms4lbrRt9v0uwAOPGL8sjKmqOcQv39bmn0E 2Kf1JnHjjAWTrj5Kk7DVFeqIEQ== X-Google-Smtp-Source: AA0mqf6QLQLorHXpp0fOgY/kytwiTqbSgHX1EdM3E1RcZ7RugFQ+bFwkB/NZumxcuJuuF025YMVuPA== X-Received: by 2002:a05:6a00:2396:b0:572:698b:5fa9 with SMTP id f22-20020a056a00239600b00572698b5fa9mr3474821pfc.28.1668699637684; Thu, 17 Nov 2022 07:40:37 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 07:40:37 -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 0/3] net: axienet: Use a DT property to configure frequency of the MDIO bus Date: Thu, 17 Nov 2022 23:40:11 +0800 Message-Id: <20221117154014.1418834-1-andy.chiu@sifive.com> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_074040_130996_5C16E8E5 X-CRM114-Status: UNSURE ( 9.84 ) 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 Some FPGA platforms have to set frequency of the MDIO bus lower than 2.5 MHz. Thus, we use a DT property, which is "clock-frequency", to work with it at boot time. The default 2.5 MHz would be set if the property is not pressent. Also, factor out mdio enable/disable functions due to the api change since 253761a0e61b7. Changelog: --- v5 --- 1. Make dt-binding patch prior to the implementation patch. 2. Disable mdio bus in error path. 3. Update description of some functions. --- v4 --- 1. change MAX_MDIO_FREQ to DEFAULT_MDIO_FREQ as suggested by Andrew. --- v3 RESEND --- 1. Repost the exact same patch again --- v3 --- 1. Fix coding style, and make probing of the driver fail if MDC overflow --- v2 --- 1. Use clock-frequency, as defined in mdio.yaml, to configure MDIO clock. 2. Only print out frequency if it is set to a non-standard value. 3. Reduce the scope of axienet_mdio_enable and remove axienet_mdio_disable because no one really uses it anymore. Andy Chiu (3): net: axienet: Unexport and remove unused mdio functions dt-bindings: describe the support of "clock-frequency" in mdio net: axienet: set mdio clock according to bus-frequency .../bindings/net/xilinx_axienet.txt | 2 + drivers/net/ethernet/xilinx/xilinx_axienet.h | 2 - .../net/ethernet/xilinx/xilinx_axienet_mdio.c | 79 +++++++++++-------- 3 files changed, 50 insertions(+), 33 deletions(-)