From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B42583176E2; Sat, 16 Aug 2025 23:06:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755385588; cv=none; b=auDSBdytVUtzVim1+Ics43tY5MpYuIN0a/kW1i2iIX4ZeMYvMIv7wVy3JB/DdcjBhJZqSdGQKImjWV+UMd3Me3U/88QhHmziogX5qvnRUMi51SYjYxAkAux64+X/idL2BDBQ0Gc5d/BHdfU3YJrDlbhss2MkOLZeS0iioEch1JY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755385588; c=relaxed/simple; bh=iSKnB2zZ894IV2ruSrlFuVSXiPxFFjRzOOZWUxvj+Qs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Irt9mSMeGd8jE2ixQuRvKdri3yFWSCGXJCCjsn1N/7MnNRb2cOT2cjAQ0GbZNul2I5mJSDjgetrMetcA+J3zolbtTjT3AeGy41/r6+MhpPhddYsRb4eaOB4IeY91UoRTFD4+idkx1DFTV6eO6uhSH8Imry6c+rLyMoCSHHzzecE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RcuVuj8i; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RcuVuj8i" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10163C4CEEF; Sat, 16 Aug 2025 23:06:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1755385588; bh=iSKnB2zZ894IV2ruSrlFuVSXiPxFFjRzOOZWUxvj+Qs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RcuVuj8iWC1LOVXruzh1iTw7J1+fVWyGVSFT1uUB+DSeSQ6JtyOLcaot6P/ntJkDS /J3a7ja+Ak4l8PFb3vWIr9UvjcZWLFJjXiIakqp0pXoK9Qx/VuC73hFS7mMHzz+rrX O+rzlI/6N5f8Kf1MgKUAdmSPOI/Mfe1ARUdbpHUmb0FCo9Qfij/LTfST0v2knlSgJy KH8IAYi51toR3PCMqW3lJEkejPvcVNqcbJjXiBumiruuTC/ZQpRubDfP7WKnBO2XuW Q6tWgIt3BrN2ebi/O4FHgZxfTlB92sa7y9vIwgCjGwMiohke7q3vWjVCOs856iGI3p EC0IEhEpvRabg== Date: Sat, 16 Aug 2025 16:06:26 -0700 From: Drew Fustini To: Yao Zi Cc: Guo Ren , Fu Wei , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Emil Renner Berthing , Jisheng Zhang , nux-riscv@lists.infradead.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Han Gao , Han Gao Subject: Re: [PATCH net v3] net: stmmac: thead: Enable TX clock before MAC initialization Message-ID: References: <20250815104803.55294-1-ziyao@disroot.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250815104803.55294-1-ziyao@disroot.org> On Fri, Aug 15, 2025 at 10:48:03AM +0000, Yao Zi wrote: > The clk_tx_i clock must be supplied to the MAC for successful > initialization. On TH1520 SoC, the clock is provided by an internal > divider configured through GMAC_PLLCLK_DIV register when using RGMII > interface. However, currently we don't setup the divider before > initialization of the MAC, resulting in DMA reset failures if the > bootloader/firmware doesn't enable the divider, > > [ 7.839601] thead-dwmac ffe7060000.ethernet eth0: Register MEM_TYPE_PAGE_POOL RxQ-0 > [ 7.938338] thead-dwmac ffe7060000.ethernet eth0: PHY [stmmac-0:02] driver [RTL8211F Gigabit Ethernet] (irq=POLL) > [ 8.160746] thead-dwmac ffe7060000.ethernet eth0: Failed to reset the dma > [ 8.170118] thead-dwmac ffe7060000.ethernet eth0: stmmac_hw_setup: DMA engine initialization failed > [ 8.179384] thead-dwmac ffe7060000.ethernet eth0: __stmmac_open: Hw setup failed > > Let's simply write GMAC_PLLCLK_DIV_EN to GMAC_PLLCLK_DIV to enable the > divider before MAC initialization. Note that for reconfiguring the > divisor, the divider must be disabled first and re-enabled later to make > sure the new divisor take effect. > > The exact clock rate doesn't affect MAC's initialization according to my > test. It's set to the speed required by RGMII when the linkspeed is > 1Gbps and could be reclocked later after link is up if necessary. > > Fixes: 33a1a01e3afa ("net: stmmac: Add glue layer for T-HEAD TH1520 SoC") > Signed-off-by: Yao Zi Reviewed-by: Drew Fustini