devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Woudstra <ericwouds@gmail.com>
To: "Russell King (Oracle)" <linux@armlinux.org.uk>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Conor Dooley <conor+dt@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Frank Wunderlich <frank-w@public-files.de>,
	Daniel Golle <daniel@makrotopia.org>,
	Lucien Jheng <lucien.jheng@airoha.com>,
	Zhi-Jun You <hujy652@protonmail.com>,
	netdev@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next 2/2] net: phy: air_en8811h: Add the Airoha EN8811H PHY driver
Date: Wed, 7 Feb 2024 20:23:00 +0100	[thread overview]
Message-ID: <f3f811f8-07cd-416c-ad30-b6db42a78b03@gmail.com> (raw)
In-Reply-To: <32897bd5-4b53-4280-a5c0-5765cfe5b7d6@gmail.com>

Hi Russell,

>> Searching the driver for "air_buckpbus_reg_read", there are four
>> instances where you read-modify-write, and only one instance which is
>> just a read.
>>
>> I wonder whether it would make more sense to structure the accessors as
>>
>> 	__air_buckpbus_set_address(phydev, addr)
>> 	__air_buckpbus_read(phydev, *data)
>> 	__air_buckpbus_write(phydev, data)
>>
>> which would make implementing reg_read, reg_write and reg_modify()
>> easier, and the addition of reg_modify() means that (a) there are less
>> bus cycles (through having to set the address twice) and (b) ensures
>> that the read-modify-write can be done atomically on the bus. This
>> assumes that reading data doesn't auto-increment the address (which
>> you would need to check.)
> 
> I will see if I can change the code to:
> 
>         __air_buckpbus_set_address(phydev, addr)
>         __air_buckpbus_read(phydev, *data)
>         __air_buckpbus_write(phydev, data)
>         air_buckpbus_reg_read()
>         air_buckpbus_reg_write()
>         air_buckpbus_reg_modify()
> 
> While not changing (except if (saved_page >= 0)):
> 
>         __air_write_buf()
>         air_write_buf()
> 

I just remember, the address register for write, is a different
register from the address register for read. So we always have
to write to address registers twice.

I can still implement an atomic air_buckpbus_reg_modify() though.

Best regards,

Eric Woudstra

      reply	other threads:[~2024-02-07 19:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-06 19:47 [PATCH net-next 0/2] Add en8811h phy driver and devicetree binding doc Eric Woudstra
2024-02-06 19:47 ` [PATCH net-next 1/2] dt-bindings: net: airoha,en8811h: Add en8811h serdes polarity Eric Woudstra
2024-02-07  7:52   ` Krzysztof Kozlowski
2024-02-07 16:42     ` Eric Woudstra
2024-02-07 18:40       ` Andrew Lunn
2024-02-15 13:29       ` Rob Herring
2024-02-06 19:47 ` [PATCH net-next 2/2] net: phy: air_en8811h: Add the Airoha EN8811H PHY driver Eric Woudstra
2024-02-06 23:53   ` Russell King (Oracle)
2024-02-07 16:39     ` Eric Woudstra
2024-02-07 19:23       ` Eric Woudstra [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=f3f811f8-07cd-416c-ad30-b6db42a78b03@gmail.com \
    --to=ericwouds@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=frank-w@public-files.de \
    --cc=hkallweit1@gmail.com \
    --cc=hujy652@protonmail.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lucien.jheng@airoha.com \
    --cc=matthias.bgg@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh+dt@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).