linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* PATCH: arch/ppc/8xx_io_fec.c
@ 2003-05-27 14:38 Jean-Denis Boyer
  2003-05-27 16:58 ` Tom Rini
  0 siblings, 1 reply; 8+ messages in thread
From: Jean-Denis Boyer @ 2003-05-27 14:38 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 2087 bytes --]


I discovered an old bug in the Fast Ethernet driver of the 860T.
In function fec_restart, the FEC is reset with no concern
to pending MDIO requests.

If an MDIO request is being served while the FEC is reset,
it is lost, causing the system to hang if it is waiting for
the answer (MDIO read). It may also lose a register modification
request (MDIO write).

1 - Especially at boot up, in function fec_enet_open, we could hang on:
        while(!fep->sequence_done)
            schedule();
2 - Or, the worst, in function mdio_read called through the ioctl,
    which would hang the calling process.

I encountered only the first problem, hanging at boot up just after printing:
  eth0: Phy @ 0x1, type DP83846A (0x20005c23)
The problem was extremely rare, due to a link down/link up sequence
that occurs at every boot up, and probably an MDIO request queued just
before the time of the FEC reset.

Attached is a patch (over 2.4.21-rc3) that adds two functions:
  static void stop_mii_queue(struct net_device *dev)
  static void start_mii_queue(struct net_device *dev)
that are both called by fec_restart.
The tests I performed easily demonstrates that we no longer loose
an MDIO request when fec_restart is called.

I also cleanen up some code around the MDIO management.

1 - In function mii_link_interrupt, I removed the code that juggles with
    the bit ECNTRL[ETHER_EN]. It is completly useless since the MDIO will
    work no matter the state of this bit. It can also as bad effects
    to put this bit to 1 without initializing the rest properly.
2 - In function fec_stop, I simplified the code, since there is no need
    to reconfigure all the registers after a graceful transmitter stop.
    Especially, the code that "Clear outstanding MII command interrupts."
    should not be there.

I'm waiting for comments.

--------------------------------------------
 Jean-Denis Boyer, Software Designer
 M5T Inc.
 4283 rue Garlock
 Sherbrooke (Québec)
 J1L 2C8  CANADA
 (819)829-3972 x241
--------------------------------------------

[-- Attachment #2: patch_8xx_fec_20030526.diff.gz --]
[-- Type: application/x-gzip, Size: 1449 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: PATCH: arch/ppc/8xx_io_fec.c
@ 2003-05-27 19:47 Jean-Denis Boyer
  2003-05-28 11:01 ` Dan Malek
  0 siblings, 1 reply; 8+ messages in thread
From: Jean-Denis Boyer @ 2003-05-27 19:47 UTC (permalink / raw)
  To: Dan Malek, Tom Rini; +Cc: linuxppc-embedded


> Yes.  There are silicon revisions that require the FEC to
> be enabled for the MDIO to operate.

I tested on revisions B3 and D4, and did not see any problem.
Anyway, fec_stop was already disabling the FEC,
so if it was a problem, it would have broken there.

> The code formatting looks like crap, so that needs to be fixed.

Do you mean for the mixed tabs/spaces? :-( Sorry for that one...
I will fix and resubmit as soon as everyone agree on the changes.

Regards,

Jean-Denis Boyer

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: PATCH: arch/ppc/8xx_io_fec.c
@ 2003-05-28 13:57 Steven Rothweiler
  0 siblings, 0 replies; 8+ messages in thread
From: Steven Rothweiler @ 2003-05-28 13:57 UTC (permalink / raw)
  To: linuxppc-embedded


>
> > Do you mean for the mixed tabs/spaces? :-( Sorry for that one...
> > I will fix and resubmit as soon as everyone agree on the changes.
>
> Yes, and there is a Linux coding standards document that would be
> nice if people followed:
>
> 	if (condition) {
>
> not,
> 	if(condition){, or if( condition ){, or other weird variations
>
> Thanks.
>
>
> 	-- Dan
>

I agree; I hate those "weird variations".

Did someone already coin FTFCS (Follow The <bleeping> Coding Standards)?
I think it applies here.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-05-28 13:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-27 14:38 PATCH: arch/ppc/8xx_io_fec.c Jean-Denis Boyer
2003-05-27 16:58 ` Tom Rini
2003-05-27 19:33   ` Dan Malek
2003-05-27 20:13     ` Tom Rini
2003-05-28 11:04       ` Dan Malek
  -- strict thread matches above, loose matches on Subject: below --
2003-05-27 19:47 Jean-Denis Boyer
2003-05-28 11:01 ` Dan Malek
2003-05-28 13:57 Steven Rothweiler

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).