From nobody Mon Dec 11 10:41:13 2023 X-Original-To: dev-commits-src-main@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 4SpdZf0btZz53Q2W; Mon, 11 Dec 2023 10:41:14 +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 4SpdZf01QRz3Bln; Mon, 11 Dec 2023 10:41:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702291274; 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=rKSIJeFKjT2FcgE0i7slof5LxUAY7xLUKl17AItsjj4=; b=lzkWsqxzCyn680ryWZvxoH+zM2gQc+EDzPEOLfgwj8dI/oU9xCI79b97JNrzyKZB887FAJ lizrdv3RpcsUPXs8R6VssSYWBXUS5TkDL47dHZQtPfKaTItzaZQsFCOK6kgkol8YMzzRFg c7K0b35sFTL4un9d9zlsD5KEJkfDLxVBwEhs2n+8dLugwx2ndXyKsXwWE0BLwVbY3HcYu3 eOd72U0ByQud072WPoY18A7JTxV7hIaQfBJ/EqEYaRgrQu6GOAhouLa6CycwgqAD5HXSgF ySz8wetPO1yLsiq6eQRJtwTLWQwyzlbISI8D/NGAlqoqLjNo3+NMBsJ0JuIUnQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1702291274; a=rsa-sha256; cv=none; b=PsaL74r4hZu3FeBe53m6FK0jOyTalanQ0zTCeG6w818EUV+YgiEC8oovK0woxCMhgaIcnJ /buYnwlITIqnRImDfKQtU4k0XzYOSvPH1GZWnprEctBHzDOlxpWDH2URIpqLmnqBwaVVfe +6eGMvOPHtZvRt+vuT+zvnzBkbw0VVy1zl0iaCnu35t5lJ4CIRfpXBVFZYQJpWugJr9gzi QFS9TW3gH0sEk5RoYsHo++LMGqTTFK2pSsHKblmMkXm9vYZ1fi/W0JUpyAbGl1QauuLVHr zUUSfi7D7YkndnCFg4AqEnB3BfETO76GtVBgUuw5DkskmuRj965BWyy3o2I2YA== 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=1702291274; 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=rKSIJeFKjT2FcgE0i7slof5LxUAY7xLUKl17AItsjj4=; b=KahtxpkxEuznvHnFQZJSdPQiv2kxBkp6eM/GGiT8mh/RVjBEjeUwLN4dcCSvIfSS7lYo6T TT/q8Efo6tErWkpHcVx7IFF1miEBE0LUj5xgRjuMAm/Jt3iFrZs0UKCtk0GNum6jGOSXY/ 2Hs1nSmJoRTRbLrsXSa6UVbdBQR+6vS4wErhZ9tVZB9IxPuvSV2Q8clj7dF9s2feSCRkbj tmEZxbW/ci7Xc9/gGHs7q9ua0zZvIKzSmGb0JkYYNRz1F3AvV1v2NHXnq2ywVhe9K4SjwA fx5/gf5nqEA+8ardMOCUC913iPVWFwFeJpCTpu4zhqUY2EcUsqjINnTMBrA2FQ== 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 4SpdZd5xnbzD5h; Mon, 11 Dec 2023 10:41:13 +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 3BBAfDe7013180; Mon, 11 Dec 2023 10:41:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BBAfDjh013177; Mon, 11 Dec 2023 10:41:13 GMT (envelope-from git) Date: Mon, 11 Dec 2023 10:41:13 GMT Message-Id: <202312111041.3BBAfDjh013177@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: 22029445cbef - main - eqos: Unbreak fdt support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 22029445cbef0ffc71196a6f38cee4738e9a6d0f Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=22029445cbef0ffc71196a6f38cee4738e9a6d0f commit 22029445cbef0ffc71196a6f38cee4738e9a6d0f Author: Emmanuel Vadot AuthorDate: 2023-12-11 10:29:16 +0000 Commit: Emmanuel Vadot CommitDate: 2023-12-11 10:31:26 +0000 eqos: Unbreak fdt support We need to enable the clocks and deassert the resets for eqos to work correctly. --- sys/dev/eqos/if_eqos_fdt.c | 56 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/sys/dev/eqos/if_eqos_fdt.c b/sys/dev/eqos/if_eqos_fdt.c index 17241b1c560b..68fcbc1ea706 100644 --- a/sys/dev/eqos/if_eqos_fdt.c +++ b/sys/dev/eqos/if_eqos_fdt.c @@ -50,6 +50,7 @@ #include #include +#include #include #include #include @@ -148,6 +149,9 @@ eqos_fdt_init(device_t dev) regulator_t eqos_supply; uint32_t rx_delay, tx_delay; uint8_t buffer[16]; + clk_t stmmaceth, mac_clk_rx, mac_clk_tx, aclk_mac, pclk_mac; + uint64_t freq; + int error; if (OF_hasprop(node, "rockchip,grf") && syscon_get_by_ofw_property(dev, node, "rockchip,grf", &sc->grf)) { @@ -174,8 +178,56 @@ eqos_fdt_init(device_t dev) device_printf(dev, "cannot get reset\n"); return (ENXIO); } - else - hwreset_assert(eqos_reset); + hwreset_assert(eqos_reset); + + error = clk_set_assigned(dev, ofw_bus_get_node(dev)); + if (error != 0) { + device_printf(dev, "clk_set_assigned failed\n"); + return (error); + } + + if (clk_get_by_ofw_name(dev, 0, "stmmaceth", &stmmaceth) == 0) { + error = clk_enable(stmmaceth); + if (error != 0) { + device_printf(dev, "could not enable main clock\n"); + return (error); + } + if (bootverbose) { + clk_get_freq(stmmaceth, &freq); + device_printf(dev, "MAC clock(%s) freq: %jd\n", + clk_get_name(stmmaceth), (intmax_t)freq); + } + } + else { + device_printf(dev, "could not find clock stmmaceth\n"); + } + + if (clk_get_by_ofw_name(dev, 0, "mac_clk_rx", &mac_clk_rx) != 0) { + device_printf(dev, "could not get mac_clk_rx clock\n"); + mac_clk_rx = NULL; + } + + if (clk_get_by_ofw_name(dev, 0, "mac_clk_tx", &mac_clk_tx) != 0) { + device_printf(dev, "could not get mac_clk_tx clock\n"); + mac_clk_tx = NULL; + } + + if (clk_get_by_ofw_name(dev, 0, "aclk_mac", &aclk_mac) != 0) { + device_printf(dev, "could not get aclk_mac clock\n"); + aclk_mac = NULL; + } + + if (clk_get_by_ofw_name(dev, 0, "pclk_mac", &pclk_mac) != 0) { + device_printf(dev, "could not get pclk_mac clock\n"); + pclk_mac = NULL; + } + + if (aclk_mac) + clk_enable(aclk_mac); + if (pclk_mac) + clk_enable(pclk_mac); + if (mac_clk_tx) + clk_enable(mac_clk_tx); sc->csr_clock = 125000000; sc->csr_clock_range = GMAC_MAC_MDIO_ADDRESS_CR_100_150;