From nobody Thu Oct 05 15:34:54 2023 X-Original-To: dev-commits-src-all@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 4S1bGR0kT2z4vnbq; Thu, 5 Oct 2023 15:34:55 +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 4S1bGR01JMz4cW5; Thu, 5 Oct 2023 15:34:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520095; 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=HH6KJIwRP3HzvH9cifm3hoP6LggeItOVavyKguBGTGc=; b=V3HB1zNlk+ngNRbGvNZaIu0VPTsqKlHAs56s8JhasO6v1NU/vSz6WK29eiLeGDawlChcf6 4gDc+mZdoDY4Vjy0IJuCC5Zhmm83n19zEAf5fV+YZBVmnpRw6KhsiWMXXXm2Qj/iNd+eKi n/V2++eOrpclncNFelhM2NR7pNx+n1nYW7J+pWP9MhCcnNWUvl0CLBT4ePMEM/amMEz/WM X7uAGkIdl+ENfiJ8ePB/uv03uT1Pz6NWl0G/p9CydGS8rKGOKGfoum9MGJCIjkKVSLhWwd uGw11seGT6OkdS/Uzztah0xS6ig7fbo+aT4z7ZIstxjpDK2+zZQjXxdbmGIvVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696520095; a=rsa-sha256; cv=none; b=jR2R5p/uN4h4VaHgxo7s1b4dW9urCUPFRNgtlfG6s+ZNRBCujtJUGOCYWGS5AZNZtzchkl EjhXvTSwMva7IoyOll+ntrCxvHt1uSQXlQzJ3odhrU4Wd3okxEyH1gtue/714bwK8qk6Ck xvNMWRpLJ4h3Mcwfg4xcw5nJYCFCVZ2EvGXoRXOcdIJmk4z+iKae5KUBesLtRuIceSs7jG dOJLPjNHqmTz6WlfH54l0DciDdFPiFyVR02kvExMvUfslO02W2DRD2FG9A28uTUdcmCvOu SYcvgarLHJG6a7b5ny5wZWweKsZzFf7z08QX6hiO1KKKniKyE0pXudtQEqoKMw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696520095; 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=HH6KJIwRP3HzvH9cifm3hoP6LggeItOVavyKguBGTGc=; b=LY0NqK+K6o6MLIiwQF/7fAFRTfA6MlVqbsU9UAz9SKiu3DEvSjBCvAFyHO2IvDW7/UMDnq 9wuSi/YBL00MrFsmb/oTTUOdHaSktdhvwQ/kN2ezC1nQ9xsPabkYotQK8gKzqaWFJuLuhj Sx3rPT0Hhff59olUt9HX1+8zBK96NAlrbqi2fNonWtQ+nPxsh0CKEBykSD3V0a/eVwQVYy hL5yACrLMR2G/EjC6HUIu+Dfn7a6ju8rz18zqYsO1mYnwlQ0mXbFsTOO0AO5+WNBsVgMpd cLc2W1IA+gw+eI9IefPpgi7scUbiOwo1IcifwvpBzxojvvMEHH9WpMN29sjH3w== 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 4S1bGQ6Bt5z1PfY; Thu, 5 Oct 2023 15:34:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FYsqu012065; Thu, 5 Oct 2023 15:34:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FYsrC012061; Thu, 5 Oct 2023 15:34:54 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:34:54 GMT Message-Id: <202310051534.395FYsrC012061@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: f114aadd3e23 - main - dwc: Rename dwc_reset to dwc_reset_phy List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f114aadd3e2300f74922511dcdd69b10a47e7328 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=f114aadd3e2300f74922511dcdd69b10a47e7328 commit f114aadd3e2300f74922511dcdd69b10a47e7328 Author: Emmanuel Vadot AuthorDate: 2023-09-23 16:34:19 +0000 Commit: Emmanuel Vadot CommitDate: 2023-10-05 15:34:38 +0000 dwc: Rename dwc_reset to dwc_reset_phy It only deals with reseting the phy. While here avoid calling ofw_bus_get_node again and save the node in softc. --- sys/dev/dwc/if_dwc.c | 41 ++++++++++++++++++++++------------------- sys/dev/dwc/if_dwcvar.h | 1 + 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/sys/dev/dwc/if_dwc.c b/sys/dev/dwc/if_dwc.c index 18e86ac025d4..accc1b6949cb 100644 --- a/sys/dev/dwc/if_dwc.c +++ b/sys/dev/dwc/if_dwc.c @@ -1495,43 +1495,47 @@ dwc_tick(void *arg) #define GPIO_ACTIVE_LOW 1 static int -dwc_reset(device_t dev) +dwc_reset_phy(struct dwc_softc *sc) { pcell_t gpio_prop[4]; pcell_t delay_prop[3]; - phandle_t node, gpio_node; + phandle_t gpio_node; device_t gpio; uint32_t pin, flags; uint32_t pin_value; - node = ofw_bus_get_node(dev); - if (OF_getencprop(node, "snps,reset-gpio", + /* + * All those properties are deprecated but still used in some DTS. + * The new way to deal with this is to use the generic bindings + * present in the ethernet-phy node. + */ + if (OF_getencprop(sc->node, "snps,reset-gpio", gpio_prop, sizeof(gpio_prop)) <= 0) return (0); - if (OF_getencprop(node, "snps,reset-delays-us", + if (OF_getencprop(sc->node, "snps,reset-delays-us", delay_prop, sizeof(delay_prop)) <= 0) { - device_printf(dev, + device_printf(sc->dev, "Wrong property for snps,reset-delays-us"); return (ENXIO); } gpio_node = OF_node_from_xref(gpio_prop[0]); if ((gpio = OF_device_from_xref(gpio_prop[0])) == NULL) { - device_printf(dev, + device_printf(sc->dev, "Can't find gpio controller for phy reset\n"); return (ENXIO); } - if (GPIO_MAP_GPIOS(gpio, node, gpio_node, + if (GPIO_MAP_GPIOS(gpio, sc->node, gpio_node, nitems(gpio_prop) - 1, gpio_prop + 1, &pin, &flags) != 0) { - device_printf(dev, "Can't map gpio for phy reset\n"); + device_printf(sc->dev, "Can't map gpio for phy reset\n"); return (ENXIO); } pin_value = GPIO_PIN_LOW; - if (OF_hasprop(node, "snps,reset-active-low")) + if (OF_hasprop(sc->node, "snps,reset-active-low")) pin_value = GPIO_PIN_HIGH; GPIO_PIN_SETFLAGS(gpio, pin, GPIO_PIN_OUTPUT); @@ -1604,7 +1608,6 @@ dwc_attach(device_t dev) if_t ifp; int error, i; uint32_t reg; - phandle_t node; uint32_t txpbl, rxpbl, pbl; bool nopblx8 = false; bool fixed_burst = false; @@ -1617,8 +1620,8 @@ dwc_attach(device_t dev) sc->mii_clk = IF_DWC_MII_CLK(dev); sc->mactype = IF_DWC_MAC_TYPE(dev); - node = ofw_bus_get_node(dev); - switch (mii_fdt_get_contype(node)) { + sc->node = ofw_bus_get_node(dev); + switch (mii_fdt_get_contype(sc->node)) { case MII_CONTYPE_RGMII: case MII_CONTYPE_RGMII_ID: case MII_CONTYPE_RGMII_RXID: @@ -1636,15 +1639,15 @@ dwc_attach(device_t dev) return (ENXIO); } - if (OF_getencprop(node, "snps,pbl", &pbl, sizeof(uint32_t)) <= 0) + if (OF_getencprop(sc->node, "snps,pbl", &pbl, sizeof(uint32_t)) <= 0) pbl = BUS_MODE_DEFAULT_PBL; - if (OF_getencprop(node, "snps,txpbl", &txpbl, sizeof(uint32_t)) <= 0) + if (OF_getencprop(sc->node, "snps,txpbl", &txpbl, sizeof(uint32_t)) <= 0) txpbl = pbl; - if (OF_getencprop(node, "snps,rxpbl", &rxpbl, sizeof(uint32_t)) <= 0) + if (OF_getencprop(sc->node, "snps,rxpbl", &rxpbl, sizeof(uint32_t)) <= 0) rxpbl = pbl; - if (OF_hasprop(node, "snps,no-pbl-x8") == 1) + if (OF_hasprop(sc->node, "snps,no-pbl-x8") == 1) nopblx8 = true; - if (OF_hasprop(node, "snps,fixed-burst") == 1) + if (OF_hasprop(sc->node, "snps,fixed-burst") == 1) fixed_burst = true; if (IF_DWC_INIT(dev) != 0) @@ -1662,7 +1665,7 @@ dwc_attach(device_t dev) dwc_get_hwaddr(sc, macaddr); /* Reset the PHY if needed */ - if (dwc_reset(dev) != 0) { + if (dwc_reset_phy(sc) != 0) { device_printf(dev, "Can't reset the PHY\n"); bus_release_resources(dev, dwc_spec, sc->res); return (ENXIO); diff --git a/sys/dev/dwc/if_dwcvar.h b/sys/dev/dwc/if_dwcvar.h index 8a8b9b283784..5e5792974560 100644 --- a/sys/dev/dwc/if_dwcvar.h +++ b/sys/dev/dwc/if_dwcvar.h @@ -59,6 +59,7 @@ struct dwc_bufmap { struct dwc_softc { struct resource *res[2]; device_t dev; + phandle_t node; int mactype; int mii_clk; device_t miibus;