From: Chih Kai Hsu <hsu.chih.kai@realtek.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
"kuba@kernel.org" <kuba@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
nic_swsd <nic_swsd@realtek.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"edumazet@google.com" <edumazet@google.com>,
"bjorn@mork.no" <bjorn@mork.no>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>
Subject: RE: [PATCH net-next 1/8] r8152: refactor r8156_init
Date: Thu, 3 Sep 2026 02:57:26 +0000 [thread overview]
Message-ID: <ee890ce30dad440c9789f4aadab29724@realtek.com> (raw)
In-Reply-To: <9a90f05a-ce9e-4f90-9a0d-19242f57f225@lunn.ch>
On Wed, Sep 2, 2026 08:54 PM +0800, Andrew wrote:
>
> > -static int r8159_wait_backup_restore(struct r8152 *tp)
> > +static void r8156_init(struct r8152 *tp)
> > {
> > - u32 ocp_data;
> > + u16 data;
> > + int i;
> >
> > - ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_MISC_0);
> > - if (!(ocp_data & PCUT_STATUS))
> > - return 0;
> > + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
> > + return;
> >
> > - return poll_timeout_us(ocp_data = ocp_read_word(tp,
> MCU_TYPE_USB, USB_GPHY_CTRL),
> > - ocp_data & BACKUP_RESTRORE, 200,
> 20000, false);
> > + ocp_byte_clr_bits(tp, MCU_TYPE_USB, USB_ECM_OP,
> EN_ALL_SPEED);
> > +
> > + ocp_write_word(tp, MCU_TYPE_USB, USB_SPEED_OPTION, 0);
> > +
> > + ocp_word_set_bits(tp, MCU_TYPE_USB, USB_ECM_OPTION,
> > + BYPASS_MAC_RESET);
> > +
> > + r8153b_u1u2en(tp, false);
> > +
> > + for (i = 0; i < 500; i++) {
> > + if (ocp_read_word(tp, MCU_TYPE_PLA, PLA_BOOT_CTRL) &
> > + AUTOLOAD_DONE)
> > + break;
> > +
> > + msleep(20);
> > + if (test_bit(RTL8152_INACCESSIBLE, &tp->flags))
> > + return;
> > + }
>
> Please use one of the macros from iopoll.h. And return ETIMEDOUT on error.
>
> Andrew
Ok, I will do it in the next version.
Thank you,
Chih-Kai
next prev parent reply other threads:[~2026-09-03 2:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 9:06 [PATCH net-next 0/8] r8152: refactor and extend RTL8157/8159 support Chih Kai Hsu
2026-09-02 9:06 ` [PATCH net-next 1/8] r8152: refactor r8156_init Chih Kai Hsu
2026-09-02 12:53 ` Andrew Lunn
2026-09-03 2:57 ` Chih Kai Hsu [this message]
2026-09-02 9:06 ` [PATCH net-next 2/8] r8152: support RTL8159 for different packages Chih Kai Hsu
2026-09-02 12:55 ` Andrew Lunn
2026-09-03 3:02 ` Chih Kai Hsu
2026-09-02 9:06 ` [PATCH net-next 3/8] r8152: refactor rtl8156_enable, rtl8156_up, and rtl8156_down Chih Kai Hsu
2026-09-02 12:56 ` Andrew Lunn
2026-09-03 3:04 ` Chih Kai Hsu
2026-09-02 9:06 ` [PATCH net-next 4/8] r8152: refactor r8157_hw_phy_cfg Chih Kai Hsu
2026-09-02 9:06 ` [PATCH net-next 5/8] r8152: support rtl8157_unload and rtl8157_change_mtu Chih Kai Hsu
2026-09-02 9:06 ` [PATCH net-next 6/8] r8152: add TGPHY access support Chih Kai Hsu
2026-09-02 9:06 ` [PATCH net-next 7/8] r8152: support rtl_fc_pause_pkt_en() Chih Kai Hsu
2026-09-02 9:06 ` [PATCH net-next 8/8] r8152: support UPS for RTL8157 and RTL8159 Chih Kai Hsu
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=ee890ce30dad440c9789f4aadab29724@realtek.com \
--to=hsu.chih.kai@realtek.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=bjorn@mork.no \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--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