From owner-freebsd-arm@freebsd.org Mon Apr 12 14:14:28 2021 Return-Path: Delivered-To: freebsd-arm@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E5E75D28DF for ; Mon, 12 Apr 2021 14:14:28 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound5c.ore.mailhop.org (outbound5c.ore.mailhop.org [54.244.192.240]) (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 mx1.freebsd.org (Postfix) with ESMTPS id 4FJrMm0bTGz4WrD for ; Mon, 12 Apr 2021 14:14:27 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1618236867; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=UBQVOW+OFdK+WILokVHpkxOekcokvN9BOvxBDDoeArDqAehpHjoAltPkKrqRjzUyrm3GJe16QM2wM MR/7docUjoiZdoGpeGPT2L4M/Ggxg7eMkn55I9+5XsMqmjGDTjC97q0rhbqcgrc0Qlb6zh7+yu/ZZD QB5anyCp9C9bKqIdlUM6Vr5CVVRqvMDgu6v1m4eln/JxaBQtKAseGJN90T0hUNeSQp2V7opgZpWLSf PlfN1Vd+YY5w5cdcc8oiiQa1u8GYs9yLx91HxV/1aqZ78cHJiDSsz13KO49Km15VjN3jytOMM8A9UC eQvwKGiPHuqKIM4U0OvN1WxhNPLi0Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=NPE6b2+PkYc50P/sZyTOqo7uxhRw1mIJYbQQK5xfZ7I=; b=Zzqh5vBrK86YKqt4qwgThMrsaMhSKmSYOtRGiu6DngO8PedvRFoee50fcEq6gKARFJ/1mKNB57xm7 FRJlhkCq7YCd6M4CQVlNIZwYyjgRKZLUfxl1Mn6nqur2vawxenb67RPN9hkkEcdMHsQ6bCkJnVJaZv tNW/sUty2nfwTavheZ45Ze1BzBqLVH+qwSO7DfN04PblSwZPOZHAmRB7ybMyIlsVul8cE2K48M+8i1 +tJQ38cFuhiD31xVQYVitInhM+yoM4GpJBLG1PbM8sBxC4iilUC4YqgS8Q/77maTU5oJq7JA7KTaA4 n27J7OTE7I4GorxB7C4BfYQAuXEeutQ== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=NPE6b2+PkYc50P/sZyTOqo7uxhRw1mIJYbQQK5xfZ7I=; b=OZxgp56vnB7zkVVtU8Ke7NGDGPGLiJBK0+iN4qpHEt30VlvzzbsFUKTEVuAztc3NDE9vFQChu404N CPzM4D1gjkErzEDMl5EQ3KkPL3680INV4FBEHToFvx7mUpP+6NtHRwcXMnDzwdSqB7spvZwJpfSgIA 9VMFKb4vGL1X4asqAU7HCbgYWYgdmSXdi023lx1TlHW4XEHJRFSMxxyJKJ8EDi2frh/QpgcoUn6ZEl /IGrD2PQiiEBqpF6bcoOHaNxM0QyYdxF8Z6znXrZ45/1B+1dfwb8ba0oMagvR+5mvz4pF6D8xSyU6I WyMccRicqBT99uZDmtF+zSEPMQyuoFA== X-Originating-IP: 67.177.211.60 X-MHO-RoutePath: aGlwcGll X-MHO-User: 61519007-9b99-11eb-ba3c-bf9d68d023b6 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-67-177-211-60.hsd1.co.comcast.net [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 61519007-9b99-11eb-ba3c-bf9d68d023b6; Mon, 12 Apr 2021 14:14:25 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 13CEEL9X015712; Mon, 12 Apr 2021 08:14:22 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <2d946b70e771c42ebd21c9b1b224b9c3ac39dcc2.camel@freebsd.org> Subject: Re: No dwc0 on bananapi m1 with Linux 5.10 devicetree From: Ian Lepore To: Emmanuel Vadot Cc: "freebsd-arm@FreeBSD.org" Date: Mon, 12 Apr 2021 08:14:21 -0600 In-Reply-To: <20210412131422.68ebcd1dd748c17f2d57efb1@bidouilliste.com> References: <1sKA_1f0z4MvqNKPTG1kiNCHauRdILGumygIn6w0H-XBzxg_cTV0c-01SCnrUcmzy96RCoE2zA4khWzwo6DQQymVphL7zpjOVx5c48lXAXU=@protonmail.com> <20210411213728.7a53a7a91c2aa3c930f5abc6@bidouilliste.com> <20210412131422.68ebcd1dd748c17f2d57efb1@bidouilliste.com> Content-Type: text/plain; charset="ASCII" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4FJrMm0bTGz4WrD X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; local_wl_from(0.00)[freebsd.org]; ASN(0.00)[asn:16509, ipnet:54.244.128.0/17, country:US] X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Porting FreeBSD to ARM processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Apr 2021 14:14:28 -0000 On Mon, 2021-04-12 at 13:14 +0200, Emmanuel Vadot wrote: > On Sun, 11 Apr 2021 17:06:02 -0600 > Ian Lepore wrote: > > > On Sun, 2021-04-11 at 21:37 +0200, Emmanuel Vadot wrote: > > > [...] > > Thanks, I didn't knew about those helpers. > New patch inline, only build tested. > > From e1f901a3dce3df965a3955ae1341ba809aa28394 Mon Sep 17 00:00:00 > 2001 > From: Emmanuel Vadot > Date: Sun, 11 Apr 2021 21:34:57 +0200 > Subject: [PATCH] dwc: Use mii_fdt function > > Use the helper function to get phy mode and configure dwc > accordingly. > --- > sys/dev/dwc/if_dwc.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c > index 776d0d0dc39..563769f8406 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 > @@ -1559,7 +1560,6 @@ dwc_attach(device_t dev) > struct ifnet *ifp; > int error, i; > uint32_t reg; > - char *phy_mode; > phandle_t node; > uint32_t txpbl, rxpbl, pbl; > bool nopblx8 = false; > @@ -1574,12 +1574,17 @@ 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: I think you should list all four RGMII values here; some day another board may come along that uses one of them. > 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 (OF_getencprop(node, "snps,pbl", &pbl, sizeof(uint32_t)) <= > 0) > -- > 2.31.1 > -- Ian