public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: "Lucien.Jheng" <lucienzx159@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	ericwouds@gmail.com, frank-w@public-files.de,
	daniel@makrotopia.org, lucien.jheng@airoha.com
Subject: Re: [PATCH v1] net: phy: airoha: add AN8811HB MCU assert/deassert support
Date: Mon, 23 Mar 2026 22:11:13 +0800	[thread overview]
Message-ID: <042ec7fb-a5a6-4d21-9bf7-26a58a97bbea@gmail.com> (raw)
In-Reply-To: <96563ae4-f5fc-437c-b90e-92e7981490fe@lunn.ch>

Hi Andrew

Sorry for the late reply.

Andrew Lunn 於 2026/3/18 上午 02:18 寫道:
> On Sun, Mar 15, 2026 at 09:41:55PM +0800, Lucien.Jheng wrote:
>> AN8811HB requires the MCU to be held in reset before firmware
>> loading and released afterwards via a dedicated PBUS register
>> pair (0x5cf9f8 / 0x5cf9fc), accessed through the PHY-addr+8
>> MDIO bus node rather than the BUCKPBUS indirect path.
>>
>> Add __air_pbus_reg_write() as a low-level helper for this
>> access, then implement an8811hb_mcu_assert() / _deassert()
>> on top of it.  Wire both into an8811hb_load_firmware() and
>> en8811h_restart_mcu() so every firmware load or MCU restart
>> on AN8811HB correctly sequences the reset control registers.
> What happens if the MCU is not held in reset? Should this be
> considered a fix?
If the MCU does not perform the assert/deassert sequence before loading 
the firmware, the AN8811HB may not function correctly.

Yes, this should be considered a fix.
>
> What are the valid PHY addresses for this device? Do we need to worry
> about the PHY is at address 31, is the dedicated PBUS register is at
> 7?
The AN8811HB PHY address is restricted to 8–15 (decimal); therefore, the 
PBUS address will only be within the range of 16–21 (decimal).

Therefore, we don't need to worry about the PHY is at address 31.
>> +static int an8811hb_mcu_assert(struct phy_device *phydev)
>> +{
>> +	int ret;
>> +
>> +	phy_lock_mdio_bus(phydev);
>> +
>> +	ret = __air_pbus_reg_write(phydev, AN8811HB_MCU_SW_RST,
>> +				   AN8811HB_MCU_SW_RST_HOLD);
>> +	if (ret < 0)
>> +		goto unlock;
>> +
>> +	ret = __air_pbus_reg_write(phydev, AN8811HB_MCU_SW_START, 0);
>> +	if (ret < 0)
>> +		goto unlock;
>> +
>> +	msleep(50);
>> +	phydev_info(phydev, "MCU asserted\n");
> Please don't spam the log. phydev_dbg() or not at all.
Got it. I’ll use phydev_dbg() instead to keep the log clean.
>
>>   static int an8811hb_load_firmware(struct phy_device *phydev)
>>   {
>>   	int ret;
>>   
>> +	ret = an8811hb_mcu_assert(phydev);
>> +	if (ret < 0)
>> +		return ret;
>> +
>> +	ret = an8811hb_mcu_deassert(phydev);
>> +	if (ret < 0)
>> +		return ret;
>> +
> Assert and then deassert, but no firmware download between? That is
> not what the commit message says.
The intended sequence is: asserting the MCU, deasserting it, and then 
downloading the firmware."

I will update the commit message.
>
> 	Andrew

      reply	other threads:[~2026-03-23 14:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-15 13:41 [PATCH v1] net: phy: airoha: add AN8811HB MCU assert/deassert support Lucien.Jheng
2026-03-17 18:18 ` Andrew Lunn
2026-03-23 14:11   ` Lucien.Jheng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=042ec7fb-a5a6-4d21-9bf7-26a58a97bbea@gmail.com \
    --to=lucienzx159@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=ericwouds@gmail.com \
    --cc=frank-w@public-files.de \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lucien.jheng@airoha.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox