From patchwork Sun Apr 10 10:46:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josua Mayer X-Patchwork-Id: 12808107 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96420C433EF for ; Sun, 10 Apr 2022 10:47:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237000AbiDJKt3 (ORCPT ); Sun, 10 Apr 2022 06:49:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236992AbiDJKt1 (ORCPT ); Sun, 10 Apr 2022 06:49:27 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A048532CA for ; Sun, 10 Apr 2022 03:47:16 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id b19so18958265wrh.11 for ; Sun, 10 Apr 2022 03:47:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=solid-run-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=svUJ4ir0Dr2U1dE5ScG9t3ewLApCBlPpmf7/Q/Ayqbc=; b=N9X0PlZK2C/MsV9hx5696qFBXEOsY0iFZMKeds2NBWjoi68bMz7GjMHSVYTksD9Irc zU5sfWqYesJGqMr7PKg3mlnRwmUPUKpqhJESj4tk8IuVfMVp4qlwBfsEusp8aHL1fh8n weAiqSKwlcn79inPvAJQbD0GOpEtDE6lxoj0qpkgw13f+imkMZBnsmxGZWrKNfYwJEvo BZBvUMLXsarzvSA4uYUNdOWadf3GqF+J74z7ALS7w3cdch0M2SA7dHEKVpUmNnZ5PzmJ 8b8m7Wkf7Z5jHMNYG8fWJ5CQlprSwmtrvoYwG3im6YfIWx4Sbnml79VCXcW2xaznklF6 3TQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=svUJ4ir0Dr2U1dE5ScG9t3ewLApCBlPpmf7/Q/Ayqbc=; b=RMIzDf38DKQxKtUmqOymjQUYaMYqtvUX50JP0F7FhHxa53GJUC1smqKkyv8ViNAwtp 0gYkMAOs61zEaqc9sTEds5gM4pBb/loll3qYIYqqSFk7Us8WNCBzvVFoK32Aoax7NFgg 5Oq6VkeEWcJnJ6lwCwBju1Qu8sspJWDg0NkjxygvFjWiWeDtnkc8YqnoN7281QhqZTID XRX6WYzv+I+9n8/ND1Qm3ZlyHyDOOvla8zmgUnKuH3dV7f9bdGQ/glnRay930XlSOVav IAtps0AqDQx9gySAQayDxbU0SQ72kT0EdKOW52ETjzR+BAb7LszkmTBqVaNATrVAzwrb L1Vg== X-Gm-Message-State: AOAM532x4KCp8IW2Ajkwyygmh8U9rVHGPB7dGouNUvBasJv6NjjoT4Qx UVaog7j6UxB+qtL6/Mo+Jy7UEYj47GAKkh5OnVs= X-Google-Smtp-Source: ABdhPJyWXvZwF8ahNEDjEJBr86HMpyrpo7SeLGXy5ooXPPGT47/s6UDHQ4y90kX7v+r6i81Lya33sw== X-Received: by 2002:adf:b64c:0:b0:1e3:16d0:3504 with SMTP id i12-20020adfb64c000000b001e316d03504mr21059056wre.333.1649587634947; Sun, 10 Apr 2022 03:47:14 -0700 (PDT) Received: from josua-work.lan (bzq-82-81-222-124.cablep.bezeqint.net. [82.81.222.124]) by smtp.gmail.com with ESMTPSA id f8-20020a5d64c8000000b0020784359295sm12839196wri.54.2022.04.10.03.47.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Apr 2022 03:47:14 -0700 (PDT) From: Josua Mayer To: netdev@vger.kernel.org Cc: alvaro.karsz@solid-run.com, Josua Mayer , Michael Hennerich , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Alexandru Ardelean Subject: [PATCH 1/3] dt: adin: document clk-out property Date: Sun, 10 Apr 2022 13:46:24 +0300 Message-Id: <20220410104626.11517-2-josua@solid-run.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220410104626.11517-1-josua@solid-run.com> References: <20220410104626.11517-1-josua@solid-run.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The ADIN1300 supports generating certain clocks on its GP_CLK pin. Add a DT property to specify the frequency. Due to the complexity of the clock configuration register, for now only 125MHz is documented. Signed-off-by: Josua Mayer --- Documentation/devicetree/bindings/net/adi,adin.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/net/adi,adin.yaml b/Documentation/devicetree/bindings/net/adi,adin.yaml index 1129f2b58e98..4e421bf5193d 100644 --- a/Documentation/devicetree/bindings/net/adi,adin.yaml +++ b/Documentation/devicetree/bindings/net/adi,adin.yaml @@ -36,6 +36,11 @@ properties: enum: [ 4, 8, 12, 16, 20, 24 ] default: 8 + adi,clk-out-frequency: + description: Clock output frequency in Hertz. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [125000000] + unevaluatedProperties: false examples: From patchwork Sun Apr 10 10:46:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josua Mayer X-Patchwork-Id: 12808108 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2EA5C433EF for ; Sun, 10 Apr 2022 10:47:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237077AbiDJKtk (ORCPT ); Sun, 10 Apr 2022 06:49:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237121AbiDJKti (ORCPT ); Sun, 10 Apr 2022 06:49:38 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15064532D7 for ; Sun, 10 Apr 2022 03:47:25 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id i20so5873397wrb.13 for ; Sun, 10 Apr 2022 03:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=solid-run-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dHw0ze7kPDnIvTVoxJK6ZVkq2hDaA8Qm0g3L6P4FDSw=; b=G/R1HKosO5zdupv20vffPuKUvnr5Dc+Xa79WY4Ehm8vxEms8Y9Iaz5QfXihi/mMAYk mDdPoWxZZl7wo8eTfwK5oz602vrrUPCiSFcUw2dzU5H6d8jRflvk8s0WIVbCN0v28sYr r4ollu2OpbbhPgCwnIm9UFZw7j6IWRa8RlxkpGCypgVnt5VR9B3Lu0WIt/WKtgrXh8p1 9Ns1UimFg3ZbdQo3etloXg0i/2gKcetu1vFAt/00qDXFFLvoWVtdISCQo1V44Zx95ZTO wPrtiltYFWw2HhcSXqnviaC7+bCt1t9Q1yo6S9DbcWIllzpxTULVA0plsxLUYYjNl0lK 5D3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dHw0ze7kPDnIvTVoxJK6ZVkq2hDaA8Qm0g3L6P4FDSw=; b=pOhcGgAxFFExpJVFuqNaHBVXDb0JlwR94tusRighEdShxpBH5w+oxZ5NofpOmq78MZ vuEZQawaAqzqfFVxdmzpLxJM6k4XfmXLAwqsT8k5TUHX0A48Ly73yd0ElGhRiXuMeyCo P4nNWQwlW9LJfY1cE6gUyskzkjTnf1yFvRG8/bN19PsTMesIlt10oky9fsPvOcIxVIam 5WuAMjExR71PDfGYSkL0qGmD8hLKn5I8xVVKIx9viTPhX9Fs3oA+C6V58rt/3zyzIddt Tf1rCMiYCtjYAnNqiLU4yE3YRQPBsmqaohf4jzjs+rGyfcyeDsBvtEi5bByxFICDue1G YJhg== X-Gm-Message-State: AOAM533FRGPJ8eYay5s0CRs5C6hkGhrjwuNDXT5svnpHFI4vSvoMXq0M OoxZLUNUq9NC2Or3/z9QvB+xVzqBFfS61HblRnI= X-Google-Smtp-Source: ABdhPJzIWofi38fb5fboVlfGGesJhiyxgscvwa8zvXE8u2H+Ouv14Jt74TzkEa8sYCcIBE1xAuMLeg== X-Received: by 2002:a5d:67c3:0:b0:207:a0e8:1932 with SMTP id n3-20020a5d67c3000000b00207a0e81932mr4186764wrw.436.1649587643441; Sun, 10 Apr 2022 03:47:23 -0700 (PDT) Received: from josua-work.lan (bzq-82-81-222-124.cablep.bezeqint.net. [82.81.222.124]) by smtp.gmail.com with ESMTPSA id f8-20020a5d64c8000000b0020784359295sm12839196wri.54.2022.04.10.03.47.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Apr 2022 03:47:22 -0700 (PDT) From: Josua Mayer To: netdev@vger.kernel.org Cc: alvaro.karsz@solid-run.com, Josua Mayer , Michael Hennerich , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Jakub Kicinski , Paolo Abeni Subject: [PATCH 2/3] net: phy: adin: add support for 125MHz clk-out Date: Sun, 10 Apr 2022 13:46:25 +0300 Message-Id: <20220410104626.11517-3-josua@solid-run.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220410104626.11517-1-josua@solid-run.com> References: <20220410104626.11517-1-josua@solid-run.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The ADIN1300 supports generating certain clocks on its GP_CLK pin. Add support for selecting the 125MHz clock via a device-tree property. While other frequencies are technically available, they are omitted for now, due to the complexity of choices. Co-developed-by: Alvaro Karsz Signed-off-by: Alvaro Karsz Signed-off-by: Josua Mayer --- drivers/net/phy/adin.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/net/phy/adin.c b/drivers/net/phy/adin.c index 5ce6da62cc8e..dbe2bb7f30d9 100644 --- a/drivers/net/phy/adin.c +++ b/drivers/net/phy/adin.c @@ -99,6 +99,10 @@ #define ADIN1300_GE_SOFT_RESET_REG 0xff0c #define ADIN1300_GE_SOFT_RESET BIT(0) +#define ADIN1300_GE_CLK_CFG_REG 0xff1f +#define ADIN1300_GE_CLK_CFG_MASK GENMASK(5, 0) +#define ADIN1300_GE_CLK_CFG_FREE_125 BIT(4) + #define ADIN1300_GE_RGMII_CFG_REG 0xff23 #define ADIN1300_GE_RGMII_RX_MSK GENMASK(8, 6) #define ADIN1300_GE_RGMII_RX_SEL(x) \ @@ -433,6 +437,28 @@ static int adin_set_tunable(struct phy_device *phydev, } } +static int adin_config_clk_out(struct phy_device *phydev) +{ + struct device *dev = &phydev->mdio.dev; + u32 val; + u8 sel; + + if (device_property_read_u32(dev, "adi,clk-out-frequency", &val)) + return 0; + + switch (val) { + case 125000000: + sel = ADIN1300_GE_CLK_CFG_FREE_125; + break; + default: + phydev_err(phydev, "invalid adi,clk-out-frequency\n"); + return -EINVAL; + } + + return phy_modify_mmd(phydev, MDIO_MMD_VEND1, ADIN1300_GE_CLK_CFG_REG, + ADIN1300_GE_CLK_CFG_MASK, sel); +} + static int adin_config_init(struct phy_device *phydev) { int rc; @@ -455,6 +481,10 @@ static int adin_config_init(struct phy_device *phydev) if (rc < 0) return rc; + rc = adin_config_clk_out(phydev); + if (rc < 0) + return rc; + phydev_dbg(phydev, "PHY is using mode '%s'\n", phy_modes(phydev->interface)); From patchwork Sun Apr 10 10:46:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josua Mayer X-Patchwork-Id: 12808109 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C199C433F5 for ; Sun, 10 Apr 2022 10:47:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237015AbiDJKtx (ORCPT ); Sun, 10 Apr 2022 06:49:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236992AbiDJKtp (ORCPT ); Sun, 10 Apr 2022 06:49:45 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B88DE52E7C for ; Sun, 10 Apr 2022 03:47:34 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id v64-20020a1cac43000000b0038cfd1b3a6dso10311910wme.5 for ; Sun, 10 Apr 2022 03:47:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=solid-run-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ivs50OGRJHFGwNpFNc+agiJsbX/PoeocJmJxK3yuRk0=; b=eZXiSiP1+IdozcuR6JEa+r6IftQJHuY+1ImpnGmTHhP/jts58WnPOcN62DotyHByan Bz6WyaRvU72aCTsyuZgIhwseJRw78aylIGtYrdMw344ZvZ7nuVK97NtyUdtIXFWAfO+J MuMzrxRg9ToM0PpV7AtSs8uBn0Vb1YEqxfiEuRTxxicr5iCA2n4UqLlNYMcHZTFemVhZ SOVRmiCxQyioXslgkRHsro9XR//UyjO2N2a6vukwP7vry3DUooA7jhqK7zSBTQ/AlK7t zlTPpZxpc3kKG6Ee7l3wQQUT0xCREkN0luFNOivdi7QBLsH82D1hg+YwhzlG3u++yUVR eRHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ivs50OGRJHFGwNpFNc+agiJsbX/PoeocJmJxK3yuRk0=; b=ONGSSaACMp77dmjGo16P/Jm2CGpQHLh6sDd4CzHvutyJawdBmVnYLJrNhYhIuH00Du qiXQ4vnTTwQ5Ghw3wBHjbpHCG6KRylp0seY4LylGM7gEVywcqKgLm5WWUpI5TGcTbLjS HzGR3S6Ajw+/Nj7XTLUBJDg/a6/vrsHGHYxYdbpSj5w/c739vf2zzFcXN9fzrqUfqoFD faYnk+p4dgtm1MKwqtHCgZGRGIljA3jtiuk2tNVnzlz7E0/zlvR57jFpnu2rv9om735f J2ecEGV2E+DE+WlgErOMGRQ4nThHeyHtbgfu4Lh2HJSkntYtqL+ejU2M9scazaW58U5G Ocww== X-Gm-Message-State: AOAM533PzKMEL+ZMTsvITWPalLieRQK5dtjH7Z11J1vIATpX5MI0sTTg YfZEUC/tSbX+HWo3Sm44e8OP5WvLbs4q8aJyi4o= X-Google-Smtp-Source: ABdhPJwHS2oOr4C0n6QmvlsHbRGXujl67211nxeGKqg2wDyinJfOqOFZtunggq2h3DT437qtaPTOjQ== X-Received: by 2002:a05:600c:35cc:b0:38c:6d25:f4ad with SMTP id r12-20020a05600c35cc00b0038c6d25f4admr24438298wmq.127.1649587652980; Sun, 10 Apr 2022 03:47:32 -0700 (PDT) Received: from josua-work.lan (bzq-82-81-222-124.cablep.bezeqint.net. [82.81.222.124]) by smtp.gmail.com with ESMTPSA id f8-20020a5d64c8000000b0020784359295sm12839196wri.54.2022.04.10.03.47.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Apr 2022 03:47:32 -0700 (PDT) From: Josua Mayer To: netdev@vger.kernel.org Cc: alvaro.karsz@solid-run.com, Josua Mayer , Russell King , Rob Herring , Krzysztof Kozlowski , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Subject: [PATCH 3/3] ARM: dts: imx6qdl-sr-som: update phy configuration for som revision 1.9 Date: Sun, 10 Apr 2022 13:46:26 +0300 Message-Id: <20220410104626.11517-4-josua@solid-run.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220410104626.11517-1-josua@solid-run.com> References: <20220410104626.11517-1-josua@solid-run.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Since SoM revision 1.9 the PHY has been replaced with an ADIN1300, add an entry for it next to the original. Co-developed-by: Alvaro Karsz Signed-off-by: Alvaro Karsz Signed-off-by: Josua Mayer --- arch/arm/boot/dts/imx6qdl-sr-som.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/imx6qdl-sr-som.dtsi b/arch/arm/boot/dts/imx6qdl-sr-som.dtsi index f86efd0ccc40..04fd4c02b1c6 100644 --- a/arch/arm/boot/dts/imx6qdl-sr-som.dtsi +++ b/arch/arm/boot/dts/imx6qdl-sr-som.dtsi @@ -83,6 +83,12 @@ ethernet-phy@4 { qca,clk-out-frequency = <125000000>; qca,smarteee-tw-us-1g = <24>; }; + + /* ADIN1300 (som rev 1.9 or later) */ + ethernet-phy@1 { + reg = <1>; + adi,clk-out-frequency = <125000000>; + }; }; };