public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Woudstra <ericwouds@gmail.com>
To: "Lucien.Jheng" <lucienzx159@gmail.com>,
	andrew@lunn.ch, 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, bjorn@mork.no
Cc: frank-w@public-files.de, daniel@makrotopia.org, lucien.jheng@airoha.com
Subject: Re: [PATCH v2] net: phy: air_en8811h: add AN8811HB MCU assert/deassert support
Date: Sat, 28 Mar 2026 11:21:59 +0100	[thread overview]
Message-ID: <6f42d92b-a26d-49a4-bef7-2227c252eea7@gmail.com> (raw)
In-Reply-To: <edeee8e5-0de3-48ea-aeb5-cc705fdcd469@gmail.com>



On 3/27/26 5:41 AM, Eric Woudstra wrote:
> static int __air_pbus_reg_write(struct mdio_device *mdio, u32 pbus_address,
> 				u32 pbus_data)
> {
> 	int ret;
> 
> 	ret = __mdiobus_write(mdio->bus, mdio->addr, AIR_EXT_PAGE_ACCESS,
> 			      (u16)(pbus_address >> 6));
> 	if (ret < 0)
> 		return ret;
> 
> 	ret = __mdiobus_write(mdio->bus, mdio->addr, (pbus_address >> 2) & 0xf,
> 			      (u16)pbus_data);
> 	if (ret < 0)
> 		return ret;
> 
> 	ret = __mdiobus_write(mdio->bus, mdio->addr, AIR_PBUS_DATA_HIGH,
> 			      (u16)(pbus_data >> 16));
> 	if (ret < 0)
> 		return ret;
> 
> 	return 0;
> }
> 
> static int air_pbus_reg_write(struct mdio_device *mdio, u32 pbus_address,
> 			      u32 pbus_data)
> {
> 	int ret;
> 
> 	mutex_lock(&mdio->bus->mdio_lock);
> 
> 	ret = __air_pbus_reg_write(mdio, pbus_address, pbus_data);
> 	if (ret < 0)
> 		dev_err(&mdio->dev, "%s 0x%08x failed: %d\n", __func__,
> 			pbus_address, ret);
> 
> 	mutex_unlock(&mdio->bus->mdio_lock);
> 
> 	return ret;
> }
> 
> static int __air_pbus_reg_read(struct mdio_device *mdio, u32 pbus_address,
> 			       u32 *pbus_data)
> {
> 	int ret, pbus_data_low;
> 
> 	ret = __mdiobus_write(mdio->bus, mdio->addr, AIR_EXT_PAGE_ACCESS,
> 			      (u16)(pbus_address >> 6));
> 	if (ret < 0)
> 		return ret;
> 
> 	ret = __mdiobus_read(mdio->bus, mdio->addr, (pbus_address >> 2) & 0xf);
> 	if (ret < 0)
> 		return ret;
> 	pbus_data_low = ret;
> 
> 	ret = __mdiobus_read(mdio->bus, mdio->addr, AIR_PBUS_DATA_HIGH);
> 	if (ret < 0)
> 		return ret;
> 
> 	*pbus_data = (ret << 16) + pbus_data_low;
> 
> 	return 0;
> }
> 
> static int air_pbus_reg_read(struct mdio_device *mdio, u32 pbus_address,
> 			     u32 *pbus_data)
> {
> 	int ret;
> 
> 	mutex_lock(&mdio->bus->mdio_lock);
> 
> 	ret = __air_pbus_reg_read(mdio, pbus_address, pbus_data);
> 	if (ret < 0)
> 		dev_err(&mdio->dev, "%s 0x%08x failed: %d\n", __func__,
> 			pbus_address, ret);
> 
> 	mutex_unlock(&mdio->bus->mdio_lock);
> 
> 	return ret;
> }
> 
> With:
> 
> #define AIR_PBUS_DATA_HIGH		0x10

Small correction using upper_16_bits() and lower_16_bits():

static int __air_pbus_reg_write(struct mdio_device *mdio, u32 pbus_address,
				u32 pbus_data)
{
	int ret;

	ret = __mdiobus_write(mdio->bus, mdio->addr, AIR_EXT_PAGE_ACCESS,
			      (u16)(pbus_address >> 6));
	if (ret < 0)
		return ret;

	ret = __mdiobus_write(mdio->bus, mdio->addr, (pbus_address >> 2) & 0xf,
			      lower_16_bits(pbus_data));
	if (ret < 0)
		return ret;

	ret = __mdiobus_write(mdio->bus, mdio->addr, AIR_PBUS_DATA_HIGH,
			      upper_16_bits(pbus_data));
	if (ret < 0)
		return ret;

	return 0;
}

static int air_pbus_reg_write(struct mdio_device *mdio, u32 pbus_address,
			      u32 pbus_data)
{
	int ret;

	mutex_lock(&mdio->bus->mdio_lock);

	ret = __air_pbus_reg_write(mdio, pbus_address, pbus_data);
	if (ret < 0)
		dev_err(&mdio->dev, "%s 0x%08x failed: %d\n", __func__,
			pbus_address, ret);

	mutex_unlock(&mdio->bus->mdio_lock);

	return ret;
}


  reply	other threads:[~2026-03-28 15:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26 15:35 [PATCH v2] net: phy: air_en8811h: add AN8811HB MCU assert/deassert support Lucien.Jheng
2026-03-26 20:00 ` Eric Woudstra
2026-03-29  4:59   ` Lucien.Jheng
2026-03-27  4:41 ` Eric Woudstra
2026-03-28 10:21   ` Eric Woudstra [this message]
2026-03-28 10:25     ` Russell King (Oracle)
2026-03-28 14:15       ` Andrew Lunn
2026-03-29  5:09         ` Lucien.Jheng
2026-03-29  5:05     ` Lucien.Jheng
2026-03-29  5:04   ` Lucien.Jheng

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=6f42d92b-a26d-49a4-bef7-2227c252eea7@gmail.com \
    --to=ericwouds@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=bjorn@mork.no \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.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=lucienzx159@gmail.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