public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: hsu.chih.kai@realtek.com
Cc: Jakub Kicinski <kuba@kernel.org>,
	davem@davemloft.net, netdev@vger.kernel.org,
	nic_swsd@realtek.com, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, edumazet@google.com, bjorn@mork.no,
	pabeni@redhat.com
Subject: Re: [PATCH net-next v4 3/3] r8152: add helper functions for PHY OCP registers
Date: Mon, 30 Mar 2026 19:01:56 -0700	[thread overview]
Message-ID: <20260331020156.3518006-2-kuba@kernel.org> (raw)
In-Reply-To: <20260326073925.32976-456-nic_swsd@realtek.com>

> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 32a4e8d423115..8747c55e0a484 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
[ ... ]
> +static void sram_write_w0w1(struct r8152 *tp, u16 addr, u16 clear, u16 set)
> +{
> +	u16 data;
> +
> +	data = sram_read(tp, addr);
> +	data = (data & ~clear) | set;
> +	ocp_reg_write(tp, OCP_SRAM_DATA, data);

AI flags:

  Does writing directly to OCP_SRAM_DATA here actually write to the intended
  address?

  Because hardware indirect SRAM access ports typically auto-increment their
  internal address pointer upon access, the sram_read() call will advance the
  pointer. By writing directly to OCP_SRAM_DATA instead of using
  sram_write(tp, addr, data) to re-establish the address, the updated value
  would be written to the next address (addr + 1) rather than the original addr.

  Could this corrupt the PHY configuration memory across the initialization paths
  that now use sram_clr_bits() and sram_set_bits()?

Can you confirm if this is legit? Not sure whether this device / register
auto-increments or where AI got it from.

  parent reply	other threads:[~2026-03-31  2:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-26  7:39 [PATCH net-next v4 0/3] r8152: add helper functions for PLA/USB/PHY OCP registers Chih Kai Hsu
2026-03-26  7:39 ` [PATCH net-next v4 1/3] r8152: fix incorrect register write to USB_UPHY_XTAL Chih Kai Hsu
2026-03-26 13:18   ` Hayes Wang
2026-03-26  7:39 ` [PATCH net-next v4 2/3] r8152: add helper functions for PLA/USB OCP registers Chih Kai Hsu
2026-03-26 13:19   ` Hayes Wang
2026-03-26  7:39 ` [PATCH net-next v4 3/3] r8152: add helper functions for PHY " Chih Kai Hsu
2026-03-26 13:19   ` Hayes Wang
2026-03-31  2:01   ` Jakub Kicinski [this message]
2026-03-31  5:45     ` Chih Kai Hsu
2026-03-31  8:24       ` Hayes Wang
2026-03-31  8:50 ` [PATCH net-next v4 0/3] r8152: add helper functions for PLA/USB/PHY " patchwork-bot+netdevbpf

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=20260331020156.3518006-2-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=bjorn@mork.no \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hsu.chih.kai@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --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