From patchwork Thu Dec 3 09:18:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 1410221 X-Patchwork-Delegate: eugen.hristev@microchip.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=oN2P+HZ/; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cmqyk4qD3z9sRK for ; Thu, 3 Dec 2020 20:18:54 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 52F2582769; Thu, 3 Dec 2020 10:18:45 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="oN2P+HZ/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 143CA8263B; Thu, 3 Dec 2020 10:18:42 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from esa3.microchip.iphmx.com (esa3.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0D46B8263B for ; Thu, 3 Dec 2020 10:18:38 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Claudiu.Beznea@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606987119; x=1638523119; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=j4reCdQ1Nq8PHmOtDkE/7Ppu2JshSiUPCJ7hfkiCEl8=; b=oN2P+HZ/y1fr56/nQB0rf6gZT7CuDwQvFNpLJmmp12m4YuO74aJH8XBL rTwyy6RqrmErqk1qKbZlicITf6YPB1iBIuw5n5UR5nvLlJ6GvkALk8/JL pektXd30GqwlULo3Pqg2Oiob2Rb5ivhA5ywBSrx95ryxBQnttjbIv8IWt w2bzYRFJ9QEwAYaMDOj6RaNUJkHAHXnUCVEZmgWgngVb1miAQgeaaUTrk g6hw+Kfl4O8+AyprOCi5Jyb0KvjlsEBV9kwps0a4a7XnNG2Xwu495Dc5t xf3AYZu2+VyDz7ztIv7KqY7+Lw393RMgYbS+QK0vBedW0Su/9yvU0KkR7 w==; IronPort-SDR: wEr89yqX+uh2Y5fMiNqF5yKR+ip0cmUNzsK5ORgqA1LaYIOLVs/GucXn77lvPImUA9Pz5F3uim F/OsjrPZDqciiLzjdBu7bEiaYyS+JWa7TxK+mRIX46aUULmQPF3A120swh0DTofBovltX80OI5 0ek+hDT81L0thGxuBKJwEmxP1TKJZGTDHG5d/vp7nQD9TAR7thrCvtNpQQtQafJsRgBFcN37ji Ej5R1bPgajyLWivqanlTqExRteszNV4eCF5WOvz55PJMgBUYQ3/KlfbQCe+MkHxW2aMQKlci0V 3ds= X-IronPort-AV: E=Sophos;i="5.78,389,1599548400"; d="scan'208";a="101252525" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Dec 2020 02:18:37 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 3 Dec 2020 02:18:36 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Thu, 3 Dec 2020 02:18:35 -0700 From: Claudiu Beznea To: , CC: , Claudiu Beznea Subject: [PATCH 1/2] net: phy: micrel: add support for DLL setup on ksz9131 Date: Thu, 3 Dec 2020 11:18:30 +0200 Message-ID: <1606987111-19754-2-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1606987111-19754-1-git-send-email-claudiu.beznea@microchip.com> References: <1606987111-19754-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add support for DLL setup on KSZ9131. Signed-off-by: Claudiu Beznea --- drivers/net/phy/micrel_ksz90x1.c | 63 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c index f0032e8ce166..d6694c5cd88f 100644 --- a/drivers/net/phy/micrel_ksz90x1.c +++ b/drivers/net/phy/micrel_ksz90x1.c @@ -396,9 +396,70 @@ static struct phy_driver ksz9031_driver = { /* * KSZ9131 */ + +#define KSZ9131RN_MMD_COMMON_CTRL_REG 2 +#define KSZ9131RN_RXC_DLL_CTRL 76 +#define KSZ9131RN_TXC_DLL_CTRL 77 +#define KSZ9131RN_DLL_CTRL_BYPASS BIT_MASK(12) +#define KSZ9131RN_DLL_ENABLE_DELAY 0 +#define KSZ9131RN_DLL_DISABLE_DELAY BIT(12) + +static int ksz9131_config_rgmii_delay(struct phy_device *phydev) +{ + struct phy_driver *drv = phydev->drv; + u16 rxcdll_val, txcdll_val, val; + int ret; + + switch (phydev->interface) { + case PHY_INTERFACE_MODE_RGMII: + rxcdll_val = KSZ9131RN_DLL_DISABLE_DELAY; + txcdll_val = KSZ9131RN_DLL_DISABLE_DELAY; + break; + case PHY_INTERFACE_MODE_RGMII_ID: + rxcdll_val = KSZ9131RN_DLL_ENABLE_DELAY; + txcdll_val = KSZ9131RN_DLL_ENABLE_DELAY; + break; + case PHY_INTERFACE_MODE_RGMII_RXID: + rxcdll_val = KSZ9131RN_DLL_ENABLE_DELAY; + txcdll_val = KSZ9131RN_DLL_DISABLE_DELAY; + break; + case PHY_INTERFACE_MODE_RGMII_TXID: + rxcdll_val = KSZ9131RN_DLL_DISABLE_DELAY; + txcdll_val = KSZ9131RN_DLL_ENABLE_DELAY; + break; + default: + return 0; + } + + val = drv->readext(phydev, 0, KSZ9131RN_MMD_COMMON_CTRL_REG, + KSZ9131RN_RXC_DLL_CTRL); + val &= ~KSZ9131RN_DLL_CTRL_BYPASS; + val |= rxcdll_val; + ret = drv->writeext(phydev, 0, KSZ9131RN_MMD_COMMON_CTRL_REG, + KSZ9131RN_RXC_DLL_CTRL, val); + if (ret) + return ret; + + val = drv->readext(phydev, 0, KSZ9131RN_MMD_COMMON_CTRL_REG, + KSZ9131RN_TXC_DLL_CTRL); + + val &= ~KSZ9131RN_DLL_CTRL_BYPASS; + val |= txcdll_val; + ret = drv->writeext(phydev, 0, KSZ9131RN_MMD_COMMON_CTRL_REG, + KSZ9131RN_TXC_DLL_CTRL, val); + + return ret; +} + static int ksz9131_config(struct phy_device *phydev) { - /* TBD: Implement Skew values for dts */ + int ret; + + if (phy_interface_is_rgmii(phydev)) { + ret = ksz9131_config_rgmii_delay(phydev); + if (ret) + return ret; + } /* add an option to disable the gigabit feature of this PHY */ if (env_get("disable_giga")) { From patchwork Thu Dec 3 09:18:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Claudiu Beznea X-Patchwork-Id: 1410222 X-Patchwork-Delegate: eugen.hristev@microchip.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=uy60stgB; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cmqyv6px6z9sRK for ; Thu, 3 Dec 2020 20:19:03 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4A44D82800; Thu, 3 Dec 2020 10:18:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.b="uy60stgB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3DBD082772; Thu, 3 Dec 2020 10:18:46 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from esa2.microchip.iphmx.com (esa2.microchip.iphmx.com [68.232.149.84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E3B7A82705 for ; Thu, 3 Dec 2020 10:18:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=Claudiu.Beznea@microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1606987122; x=1638523122; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=go1TXJGC3RPqzoKckqdz7AockQ5uYeCKljdj3R4kqmw=; b=uy60stgBeD8laXefgvU7l9HJK8pfcSA1AsrellfqR50GB0OruAB2xhxA 19Kmv/SRzXz17A8KfRMj3eMm0fcJqQVQifUgIpqvsRTGNfIXedfb78pZf ekUb+CMs6qajYhBEAIC9XXmVHNW+oOsaDbu8sFqcqT1rwM4vAFIObze6R Exzeq4uxj+xr47qxCnLUc1v59nH1VIWffqMdNygAFB8wBS7eiA8/scs9N o78nv9nYXuw8lTvHJxN5fO8bXhOmBeFyvhHf222d4trELEThtPNKZsx0r Xhb7JRbkgHWIKEgNP4suwpWcbUWfi/SJez+JKnCBbWs0rs6H0sG9tD7Hg A==; IronPort-SDR: +EMTShgU6COJ/kNIy6lYGgY0ky9yVjzPfW/4zlCmc9AbCVTYu/CB0wltt1M6Q2mkxOe3GKwfbN TC8lP6+N0dTJZTMKheRsZFLa9mV1i3j4A7p+l7w8qYDctMQLIxqBg2+jZ6fxkeLJ28kvWByvge H2fYm0XieUFfdkv8rYJ3OjCxZmqCDbrQe9/305Dl38Td/kzVR6FzVKJkk2RAHMPfPC3KmhwBRH 9iTBY5Kn5srWpLATrZ8WS1wj00p22NERk9dfTT4YoUqXAl9JYu+sxy7h7u/RcIfMb9s4ePzFm7 dT4= X-IronPort-AV: E=Sophos;i="5.78,389,1599548400"; d="scan'208";a="98441836" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 03 Dec 2020 02:18:40 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.85.144) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Thu, 3 Dec 2020 02:18:39 -0700 Received: from m18063-ThinkPad-T460p.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Thu, 3 Dec 2020 02:18:37 -0700 From: Claudiu Beznea To: , CC: , Claudiu Beznea Subject: [PATCH 2/2] net: phy: micrel: fix typo Date: Thu, 3 Dec 2020 11:18:31 +0200 Message-ID: <1606987111-19754-3-git-send-email-claudiu.beznea@microchip.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1606987111-19754-1-git-send-email-claudiu.beznea@microchip.com> References: <1606987111-19754-1-git-send-email-claudiu.beznea@microchip.com> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Fix typo. Signed-off-by: Claudiu Beznea --- drivers/net/phy/micrel_ksz90x1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/micrel_ksz90x1.c b/drivers/net/phy/micrel_ksz90x1.c index d6694c5cd88f..77fad4a8fc9e 100644 --- a/drivers/net/phy/micrel_ksz90x1.c +++ b/drivers/net/phy/micrel_ksz90x1.c @@ -491,7 +491,7 @@ static int ksz9131_config(struct phy_device *phydev) } static struct phy_driver ksz9131_driver = { - .name = "Micrel ksz9031", + .name = "Micrel ksz9131", .uid = PHY_ID_KSZ9131, .mask = MII_KSZ9x31_SILICON_REV_MASK, .features = PHY_GBIT_FEATURES,