netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] SIOCSIFFLAGS returns -EIO on SMSC LAN911x
@ 2011-12-30  9:44 Javier Martinez Canillas
  2011-12-30 10:56 ` Ben Hutchings
  0 siblings, 1 reply; 8+ messages in thread
From: Javier Martinez Canillas @ 2011-12-30  9:44 UTC (permalink / raw)
  To: netdev; +Cc: Enric Balletbo i Serra

Hello,

We have an issue with the SMSC LAN911x driver with today linux-2.6 [1]
executing on an IGEPv2 [2] board using omap2plus_defconfig.

When I try to bring up the network interface, the ioctl set interface
flags command (SIOCSIFFLAGS)  fails returning -EIO:

root@igep00x0:~# ifconfig eth0 up
ifconfig: SIOCSIFFLAGS: Input/output error

But if I execute again it succeeds:

root@igep00x0:~# ifconfig eth0 up
[  832.465423] smsc911x smsc911x.0: eth0: SMSC911x/921x identified at
0xdb086000, IRQ: 336

We found that the problem is on the SMSC LAN911x driver
(drivers/net/ethernet/smsc/smsc911x.c) net_dev ndo_open function
handler smsc911x_open.

When the handler is called, it tries to software reset the device by
writing a bit to a self-clearing configuration register. According to
the data-sheet the hardware clears that bit to notify that the reset
was successfully:

 static int smsc911x_soft_reset(struct smsc911x_data *pdata)
{
       unsigned int timeout;
       unsigned int temp;

       /* Reset the LAN911x */
       smsc911x_reg_write(pdata, HW_CFG, HW_CFG_SRST_);
       timeout = 10;
       do {
               udelay(10);
               temp = smsc911x_reg_read(pdata, HW_CFG);
       } while ((--timeout) && (temp & HW_CFG_SRST_));

       if (unlikely(temp & HW_CFG_SRST_)) {
               SMSC_WARN(pdata, drv, "Failed to complete reset");
               return -EIO;
       }
       return 0;
}

The condition temp & HW_CFG_SRST_ is false so the error code -EIO is
returned and propagated to user-space.

By doing a git bisect we found that this strange behavior exists when
the Kconfig tristate compilation condition SMSC_PHY has the value yes
to be compiled built-in:

SMSC_PHY=y

If this config symbol has the value module (m) or not build at all,
then bringing up the network interface never fails.

Did anyone have the same problem?

The problem is really strange to me, especially since we are sure that
all the requirements to software reset the device are meet in both
cases (with SMSC_PHY compiled built-in and without it)

[1]: HEAD on commit 371de6e4e0042adf4f9b54c414154f57414ddd37 drm/i915:
Disable RC6 on Sandybridge by default
[2]: https://wiki.linaro.org/Boards/Igep

Thank you and best regards,

-- 
Javier Martínez Canillas
(+34) 682 39 81 69
Barcelona, Spain

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

end of thread, other threads:[~2012-01-03  7:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-30  9:44 [BUG] SIOCSIFFLAGS returns -EIO on SMSC LAN911x Javier Martinez Canillas
2011-12-30 10:56 ` Ben Hutchings
2011-12-30 12:04   ` Javier Martinez Canillas
2011-12-30 12:58   ` Javier Martinez Canillas
2011-12-30 13:15     ` Ben Hutchings
2012-01-02 18:37       ` Javier Martinez Canillas
2012-01-02 19:45         ` Ben Hutchings
2012-01-03  7:44           ` Javier Martinez Canillas

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