* [PATCH] net/cadence_gem: Set PHY autonegotiation restart status
@ 2019-11-04 18:16 linus.ziegert
2019-11-04 22:44 ` Alistair Francis
0 siblings, 1 reply; 5+ messages in thread
From: linus.ziegert @ 2019-11-04 18:16 UTC (permalink / raw)
To: qemu-devel
Cc: Peter Maydell, Jason Wang, Alistair Francis,
open list:Xilinx Zynq, Linus Ziegert, Edgar E. Iglesias
From: Linus Ziegert <linus.ziegert+qemu@holoplot.com>
The Linux kernel PHY driver sets AN_RESTART in the BMCR of the
PHY when autonegotiation is started.
Recently the kernel started to read back the PHY's AN_RESTART
bit and now checks whether the autonegotiation is complete and
the bit was cleared [1]. Otherwise the link status is down.
The emulated PHY needs to clear AN_RESTART immediately to inform
the kernel driver about the completion of autonegotiation phase.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c36757eb9dee
Signed-off-by: Linus Ziegert <linus.ziegert+qemu@holoplot.com>
---
hw/net/cadence_gem.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
index 7f9cb5ab95..b8be73dc55 100644
--- a/hw/net/cadence_gem.c
+++ b/hw/net/cadence_gem.c
@@ -271,9 +271,10 @@
#define PHY_REG_EXT_PHYSPCFC_ST 27
#define PHY_REG_CABLE_DIAG 28
-#define PHY_REG_CONTROL_RST 0x8000
-#define PHY_REG_CONTROL_LOOP 0x4000
-#define PHY_REG_CONTROL_ANEG 0x1000
+#define PHY_REG_CONTROL_RST 0x8000
+#define PHY_REG_CONTROL_LOOP 0x4000
+#define PHY_REG_CONTROL_ANEG 0x1000
+#define PHY_REG_CONTROL_ANRESTART 0x0200
#define PHY_REG_STATUS_LINK 0x0004
#define PHY_REG_STATUS_ANEGCMPL 0x0020
@@ -1345,7 +1346,7 @@ static void gem_phy_write(CadenceGEMState *s, unsigned reg_num, uint16_t val)
}
if (val & PHY_REG_CONTROL_ANEG) {
/* Complete autonegotiation immediately */
- val &= ~PHY_REG_CONTROL_ANEG;
+ val &= ~(PHY_REG_CONTROL_ANEG | PHY_REG_CONTROL_ANRESTART);
s->phy_regs[PHY_REG_STATUS] |= PHY_REG_STATUS_ANEGCMPL;
}
if (val & PHY_REG_CONTROL_LOOP) {
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net/cadence_gem: Set PHY autonegotiation restart status
2019-11-04 18:16 [PATCH] net/cadence_gem: Set PHY autonegotiation restart status linus.ziegert
@ 2019-11-04 22:44 ` Alistair Francis
2019-11-05 11:31 ` Linus Ziegert
0 siblings, 1 reply; 5+ messages in thread
From: Alistair Francis @ 2019-11-04 22:44 UTC (permalink / raw)
To: linus.ziegert
Cc: Peter Maydell, Jason Wang, Alistair Francis,
qemu-devel@nongnu.org Developers, open list:Xilinx Zynq,
Linus Ziegert, Edgar E. Iglesias
On Mon, Nov 4, 2019 at 2:02 PM <linus.ziegert@holoplot.com> wrote:
>
> From: Linus Ziegert <linus.ziegert+qemu@holoplot.com>
>
> The Linux kernel PHY driver sets AN_RESTART in the BMCR of the
> PHY when autonegotiation is started.
> Recently the kernel started to read back the PHY's AN_RESTART
> bit and now checks whether the autonegotiation is complete and
> the bit was cleared [1]. Otherwise the link status is down.
>
> The emulated PHY needs to clear AN_RESTART immediately to inform
> the kernel driver about the completion of autonegotiation phase.
>
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c36757eb9dee
>
> Signed-off-by: Linus Ziegert <linus.ziegert+qemu@holoplot.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
> hw/net/cadence_gem.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
> index 7f9cb5ab95..b8be73dc55 100644
> --- a/hw/net/cadence_gem.c
> +++ b/hw/net/cadence_gem.c
> @@ -271,9 +271,10 @@
> #define PHY_REG_EXT_PHYSPCFC_ST 27
> #define PHY_REG_CABLE_DIAG 28
>
> -#define PHY_REG_CONTROL_RST 0x8000
> -#define PHY_REG_CONTROL_LOOP 0x4000
> -#define PHY_REG_CONTROL_ANEG 0x1000
> +#define PHY_REG_CONTROL_RST 0x8000
> +#define PHY_REG_CONTROL_LOOP 0x4000
> +#define PHY_REG_CONTROL_ANEG 0x1000
> +#define PHY_REG_CONTROL_ANRESTART 0x0200
>
> #define PHY_REG_STATUS_LINK 0x0004
> #define PHY_REG_STATUS_ANEGCMPL 0x0020
> @@ -1345,7 +1346,7 @@ static void gem_phy_write(CadenceGEMState *s, unsigned reg_num, uint16_t val)
> }
> if (val & PHY_REG_CONTROL_ANEG) {
> /* Complete autonegotiation immediately */
> - val &= ~PHY_REG_CONTROL_ANEG;
> + val &= ~(PHY_REG_CONTROL_ANEG | PHY_REG_CONTROL_ANRESTART);
> s->phy_regs[PHY_REG_STATUS] |= PHY_REG_STATUS_ANEGCMPL;
> }
> if (val & PHY_REG_CONTROL_LOOP) {
> --
> 2.21.0
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net/cadence_gem: Set PHY autonegotiation restart status
2019-11-04 22:44 ` Alistair Francis
@ 2019-11-05 11:31 ` Linus Ziegert
2019-11-18 17:21 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 5+ messages in thread
From: Linus Ziegert @ 2019-11-05 11:31 UTC (permalink / raw)
To: Alistair Francis
Cc: Peter Maydell, Jason Wang, Alistair Francis,
qemu-devel@nongnu.org Developers, open list:Xilinx Zynq,
Linus Ziegert, Edgar E. Iglesias
[-- Attachment #1: Type: text/plain, Size: 2300 bytes --]
Am Mo., 4. Nov. 2019 um 23:50 Uhr schrieb Alistair Francis <
alistair23@gmail.com>:
>
> On Mon, Nov 4, 2019 at 2:02 PM <linus.ziegert@holoplot.com> wrote:
> >
> > From: Linus Ziegert <linus.ziegert+qemu@holoplot.com>
> >
> > The Linux kernel PHY driver sets AN_RESTART in the BMCR of the
> > PHY when autonegotiation is started.
> > Recently the kernel started to read back the PHY's AN_RESTART
> > bit and now checks whether the autonegotiation is complete and
> > the bit was cleared [1]. Otherwise the link status is down.
> >
> > The emulated PHY needs to clear AN_RESTART immediately to inform
> > the kernel driver about the completion of autonegotiation phase.
> >
> > [1]
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c36757eb9dee
> >
> > Signed-off-by: Linus Ziegert <linus.ziegert+qemu@holoplot.com>
>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
I consider this stable material. Applies cleanly to all versions starting
from v1.5.0.
Thanks
>
> Alistair
>
> > ---
> > hw/net/cadence_gem.c | 9 +++++----
> > 1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
> > index 7f9cb5ab95..b8be73dc55 100644
> > --- a/hw/net/cadence_gem.c
> > +++ b/hw/net/cadence_gem.c
> > @@ -271,9 +271,10 @@
> > #define PHY_REG_EXT_PHYSPCFC_ST 27
> > #define PHY_REG_CABLE_DIAG 28
> >
> > -#define PHY_REG_CONTROL_RST 0x8000
> > -#define PHY_REG_CONTROL_LOOP 0x4000
> > -#define PHY_REG_CONTROL_ANEG 0x1000
> > +#define PHY_REG_CONTROL_RST 0x8000
> > +#define PHY_REG_CONTROL_LOOP 0x4000
> > +#define PHY_REG_CONTROL_ANEG 0x1000
> > +#define PHY_REG_CONTROL_ANRESTART 0x0200
> >
> > #define PHY_REG_STATUS_LINK 0x0004
> > #define PHY_REG_STATUS_ANEGCMPL 0x0020
> > @@ -1345,7 +1346,7 @@ static void gem_phy_write(CadenceGEMState *s,
unsigned reg_num, uint16_t val)
> > }
> > if (val & PHY_REG_CONTROL_ANEG) {
> > /* Complete autonegotiation immediately */
> > - val &= ~PHY_REG_CONTROL_ANEG;
> > + val &= ~(PHY_REG_CONTROL_ANEG | PHY_REG_CONTROL_ANRESTART);
> > s->phy_regs[PHY_REG_STATUS] |= PHY_REG_STATUS_ANEGCMPL;
> > }
> > if (val & PHY_REG_CONTROL_LOOP) {
> > --
> > 2.21.0
> >
> >
[-- Attachment #2: Type: text/html, Size: 3353 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net/cadence_gem: Set PHY autonegotiation restart status
2019-11-05 11:31 ` Linus Ziegert
@ 2019-11-18 17:21 ` Philippe Mathieu-Daudé
2019-11-18 17:24 ` Peter Maydell
0 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2019-11-18 17:21 UTC (permalink / raw)
To: Linus Ziegert, Alistair Francis, Jason Wang
Cc: Peter Maydell, Alistair Francis,
qemu-devel@nongnu.org Developers, qemu-stable,
open list:Xilinx Zynq, Linus Ziegert, Edgar E. Iglesias
On 11/5/19 12:31 PM, Linus Ziegert wrote:
> Am Mo., 4. Nov. 2019 um 23:50 Uhr schrieb Alistair Francis
> <alistair23@gmail.com <mailto:alistair23@gmail.com>>:
> >
> > On Mon, Nov 4, 2019 at 2:02 PM <linus.ziegert@holoplot.com
> <mailto:linus.ziegert@holoplot.com>> wrote:
> > >
> > > From: Linus Ziegert <linus.ziegert+qemu@holoplot.com
> <mailto:linus.ziegert%2Bqemu@holoplot.com>>
> > >
> > > The Linux kernel PHY driver sets AN_RESTART in the BMCR of the
> > > PHY when autonegotiation is started.
> > > Recently the kernel started to read back the PHY's AN_RESTART
> > > bit and now checks whether the autonegotiation is complete and
> > > the bit was cleared [1]. Otherwise the link status is down.
> > >
> > > The emulated PHY needs to clear AN_RESTART immediately to inform
> > > the kernel driver about the completion of autonegotiation phase.
> > >
> > > [1]
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c36757eb9dee
> > >
> > > Signed-off-by: Linus Ziegert <linus.ziegert+qemu@holoplot.com
> <mailto:linus.ziegert%2Bqemu@holoplot.com>>
> >
> > Reviewed-by: Alistair Francis <alistair.francis@wdc.com
> <mailto:alistair.francis@wdc.com>>
>
> I consider this stable material. Applies cleanly to all versions
> starting from v1.5.0.
Too bad this wasn't Cc'ed to qemu-stable@nongnu.org and missed 4.1.1
stable release.
Jason: ping?
> > Alistair
> >
> > > ---
> > > hw/net/cadence_gem.c | 9 +++++----
> > > 1 file changed, 5 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
> > > index 7f9cb5ab95..b8be73dc55 100644
> > > --- a/hw/net/cadence_gem.c
> > > +++ b/hw/net/cadence_gem.c
> > > @@ -271,9 +271,10 @@
> > > #define PHY_REG_EXT_PHYSPCFC_ST 27
> > > #define PHY_REG_CABLE_DIAG 28
> > >
> > > -#define PHY_REG_CONTROL_RST 0x8000
> > > -#define PHY_REG_CONTROL_LOOP 0x4000
> > > -#define PHY_REG_CONTROL_ANEG 0x1000
> > > +#define PHY_REG_CONTROL_RST 0x8000
> > > +#define PHY_REG_CONTROL_LOOP 0x4000
> > > +#define PHY_REG_CONTROL_ANEG 0x1000
> > > +#define PHY_REG_CONTROL_ANRESTART 0x0200
> > >
> > > #define PHY_REG_STATUS_LINK 0x0004
> > > #define PHY_REG_STATUS_ANEGCMPL 0x0020
> > > @@ -1345,7 +1346,7 @@ static void gem_phy_write(CadenceGEMState *s,
> unsigned reg_num, uint16_t val)
> > > }
> > > if (val & PHY_REG_CONTROL_ANEG) {
> > > /* Complete autonegotiation immediately */
> > > - val &= ~PHY_REG_CONTROL_ANEG;
> > > + val &= ~(PHY_REG_CONTROL_ANEG |
> PHY_REG_CONTROL_ANRESTART);
> > > s->phy_regs[PHY_REG_STATUS] |= PHY_REG_STATUS_ANEGCMPL;
> > > }
> > > if (val & PHY_REG_CONTROL_LOOP) {
> > > --
> > > 2.21.0
> > >
> > >
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net/cadence_gem: Set PHY autonegotiation restart status
2019-11-18 17:21 ` Philippe Mathieu-Daudé
@ 2019-11-18 17:24 ` Peter Maydell
0 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2019-11-18 17:24 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Jason Wang, Alistair Francis, Edgar E. Iglesias,
qemu-devel@nongnu.org Developers, qemu-stable,
open list:Xilinx Zynq, Linus Ziegert, Alistair Francis,
Linus Ziegert
On Mon, 18 Nov 2019 at 17:21, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> On 11/5/19 12:31 PM, Linus Ziegert wrote:
> > Am Mo., 4. Nov. 2019 um 23:50 Uhr schrieb Alistair Francis
> > <alistair23@gmail.com <mailto:alistair23@gmail.com>>:
> > >
> > > On Mon, Nov 4, 2019 at 2:02 PM <linus.ziegert@holoplot.com
> > <mailto:linus.ziegert@holoplot.com>> wrote:
> > > >
> > > > From: Linus Ziegert <linus.ziegert+qemu@holoplot.com
> > <mailto:linus.ziegert%2Bqemu@holoplot.com>>
> > > >
> > > > The Linux kernel PHY driver sets AN_RESTART in the BMCR of the
> > > > PHY when autonegotiation is started.
> > > > Recently the kernel started to read back the PHY's AN_RESTART
> > > > bit and now checks whether the autonegotiation is complete and
> > > > the bit was cleared [1]. Otherwise the link status is down.
> > > >
> > > > The emulated PHY needs to clear AN_RESTART immediately to inform
> > > > the kernel driver about the completion of autonegotiation phase.
> > > >
> > > > [1]
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c36757eb9dee
> > > >
> > > > Signed-off-by: Linus Ziegert <linus.ziegert+qemu@holoplot.com
> > <mailto:linus.ziegert%2Bqemu@holoplot.com>>
> > >
> > > Reviewed-by: Alistair Francis <alistair.francis@wdc.com
> > <mailto:alistair.francis@wdc.com>>
> >
> > I consider this stable material. Applies cleanly to all versions
> > starting from v1.5.0.
>
> Too bad this wasn't Cc'ed to qemu-stable@nongnu.org and missed 4.1.1
> stable release.
I can take it via target-arm since it only affects an arm board.
thanks
-- PMM
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-11-18 17:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-04 18:16 [PATCH] net/cadence_gem: Set PHY autonegotiation restart status linus.ziegert
2019-11-04 22:44 ` Alistair Francis
2019-11-05 11:31 ` Linus Ziegert
2019-11-18 17:21 ` Philippe Mathieu-Daudé
2019-11-18 17:24 ` Peter Maydell
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).