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 887861C295 for ; Mon, 20 Nov 2023 14:16:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Omsrc4Py" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91C97C433C7; Mon, 20 Nov 2023 14:16:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700489774; bh=qspyWLlSq8sWpiqqSuSqAERRXWBLMY+qTWVHc/Kgvh8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Omsrc4PyxEIUeFN5Ayq65crRl3hLKVNA3iff9/dqzjjeBE0az8zdqipvpPl6alQxk E6DOyURCSwVxCJ/NLKbEyO+bWsp1LXHzUvXLZfkGOtT9UeF6D4cs9C6FA04jsM5fab 4AQu1xxSjE91ZUYq5gkaBgaRT20TCf3UJJGbXIsITYHHTvFY5IIcsL2kwklI5DwgTE 3T2ZDF2tStp/ohTP5wov0fa2bLsco8HW4zeeOHvhdraCZ94aW5O4b+L/Uj9UL904Tj GdQvNSX/e2Z3mTmogcP81pMr4csmoEFcph6SdSRCGmYoxlq3H+vkxRWtoq7x4hoTph czBc15KLN3UgQ== Date: Mon, 20 Nov 2023 22:03:48 +0800 From: Jisheng Zhang To: Andrew Lunn Cc: HeinerKallweit , Russell King , "David S.Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Conor Dooley , netdev@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [RFC] support built-in ethernet phy which needs some mmio accesses Message-ID: References: Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Sun, Nov 19, 2023 at 05:18:49PM +0100, Andrew Lunn wrote: > On Sun, Nov 19, 2023 at 09:57:17PM +0800, Jisheng Zhang wrote: > > Hi, > > > > I want to upstream milkv duo (powered by cv1800b) ethernet support. The SoC > > contains a built-in eth phy which also needs some initialization via. > > mmio access during init. So, I need to do something like this(sol A): > > What does this initialisation do? Per my understanding of the vendor code, it reads calibration data from efuse then apply the setting, set tx bias current, set MLT3 phase code, and so on. I can see it switches to page 5, page 16, page 17 etc. to apply settings. Compared with normal phy driver, the programming is done via. the mmio rather than phy_read/write. Here is the vendor source code: https://github.com/milkv-duo/duo-buildroot-sdk/blob/develop/linux_5.10/drivers/net/phy/cvitek.c Hi Heiner, IIUC, the initialization also needs redo after power off, so it's not init-once action. Thanks > > If you are turning on clocks, write a common clock provider, which the > PHY driver can use. If its a reset, write a reset driver. If its a > regulator, write a regulator driver, etc. > > Andrew