From nobody Thu Aug 11 18:23:20 2022 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4M3Ztd27DCz4ZNTB; Thu, 11 Aug 2022 18:23:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4M3Ztd1X8Bz4Ggp; Thu, 11 Aug 2022 18:23:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660242201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kC2gbHfQScW9oS9hdSqSWwk27M/EZArFAkOW050sIBM=; b=Vr8FbtGqyPmriAdMrtdT8EhmpLe12O51tZZkkHh7ncw4ImXW1TWhej/Usd4Nyk+UwY/vSh IxZVeIRLXn9T74IXuYRPwHIVP4xGtGMmg/LJAPpkooxGPSCPvhLya2ndfcBdYiR3D+NJJW enpPS9Kma0MMVzr0gdqP59n7pySn3Lfkptgl5vcu0Hw0tZBY25mqqPt0eOyuGgrH87Xs6h KYiPjaQFSYoY88WgYzKuJxIrmzAILgyIY67uGK3wsdAWF+1PEbSYpivwYLwn2hAGfytfrs lo9x9264fH+rlUWrKIEjtBLiQjNnxsIwu7r6TkAZyXD6DT7xWKiQEnK5yVsWBg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4M3Ztd0Ysbz11j6; Thu, 11 Aug 2022 18:23:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 27BINKls018059; Thu, 11 Aug 2022 18:23:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27BINKql018058; Thu, 11 Aug 2022 18:23:20 GMT (envelope-from git) Date: Thu, 11 Aug 2022 18:23:20 GMT Message-Id: <202208111823.27BINKql018058@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 54682ad8d9e3 - stable/12 - dwc: Use mii_fdt function List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 54682ad8d9e34109ad0269489ce3a3d577e0525d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1660242201; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kC2gbHfQScW9oS9hdSqSWwk27M/EZArFAkOW050sIBM=; b=Ibp6EfNC/sofN2ysoOyKS9yvxGIgJUbctKWlaemKFjXr9VsnTlUR2ZREVo7fjS9Km75fjI zewRQX8TjjR2Dpsd8eGMuo5ERwGXMt7zF3lt0ROttrpbhD0wH5x0kucItglszM+55EF1AB VNEbpnO//115yyMo7LnJVrqCwyzwi8xUg6zH/+CTGKuqjYwuO3x+mf5h33v1Z1F+9QOvDr dkdCHYMoKKM7P03YxEWt1P1qZswE26kOOXEdpEO1dOrhRE5vELol3txUTl/6wI7pM1OIKD 121eGmpsNutxFOVWvm9ghY88jtmRyzg49YTHPdOcpH+WBxTbQUJosszbh4Rn/Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1660242201; a=rsa-sha256; cv=none; b=Fm9acIDkP4thOdaFcgNWYh8OWWkAOTcfsfiYgJrlm0NB7TwyL6g4lc4vWnKqPKVH76WtU4 Ap4lT9N2FAf5PCxeaOcE84wm3AGEEATL96sl1G1rukPs2ncqtglSG42q4bOopobXzO2aFY GyclUkqPp+KvjjZ0y8hJR2W5DomJFQtZoTRaTVQ93O6TfpjKG/9W4GDrs/oSm5wDEAHbnr Xkv9I6xiHlSf9nO4EQoaMywnXsOnWPp9ry9un8XKNTHBdrHtPYcyWFjDOyMzaIhfNLTfsd 3536OCcSc3egoJSjLmSHq9SGzVC0+LBeKbXc028nDEGwsTpZwgpUDNCZ1lvSYw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=54682ad8d9e34109ad0269489ce3a3d577e0525d commit 54682ad8d9e34109ad0269489ce3a3d577e0525d Author: Emmanuel Vadot AuthorDate: 2021-04-11 19:34:57 +0000 Commit: Mitchell Horne CommitDate: 2022-08-11 17:54:30 +0000 dwc: Use mii_fdt function Use the helper function to get phy mode and configure dwc accordingly. Reviewed by: ian (cherry picked from commit f77d8d10115b0863cc3dfd6e1746c02847d6569d) --- sys/dev/dwc/if_dwc.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 934c19f8c419..1b0d5e97417f 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef EXT_RESOURCES #include @@ -1434,7 +1435,6 @@ dwc_attach(device_t dev) struct ifnet *ifp; int error, i; uint32_t reg; - char *phy_mode; phandle_t node; sc = device_get_softc(dev); @@ -1445,12 +1445,19 @@ dwc_attach(device_t dev) sc->mactype = IF_DWC_MAC_TYPE(dev); node = ofw_bus_get_node(dev); - if (OF_getprop_alloc(node, "phy-mode", (void **)&phy_mode)) { - if (strcmp(phy_mode, "rgmii") == 0) + switch (mii_fdt_get_contype(node)) { + case MII_CONTYPE_RGMII: + case MII_CONTYPE_RGMII_ID: + case MII_CONTYPE_RGMII_RXID: + case MII_CONTYPE_RGMII_TXID: sc->phy_mode = PHY_MODE_RGMII; - if (strcmp(phy_mode, "rmii") == 0) + break; + case MII_CONTYPE_RMII: sc->phy_mode = PHY_MODE_RMII; - OF_prop_free(phy_mode); + break; + default: + device_printf(dev, "Unsupported MII type\n"); + return (ENXIO); } if (IF_DWC_INIT(dev) != 0)