rmmod libertas_sdio and reinsert causes problems with firmware upload.

Jonathan Cameron jic23 at cam.ac.uk
Fri Aug 29 15:16:23 EDT 2008

Dear All,

So procedure is:

Insert the boards spi host driver and libertas_sdio which
works fine.

Next remove libertas_sdio.

Reinsert libertas_sdio and watch the firmware load fail.

(using 2.6.27-rc4)

Firstly I'll admit this a fairly odd circumstance to be in, but technically
this should be a valid thing to do. 

The problem lies in the fact that the scratch register is used all over
the place by the device so unsuprisingly doesn't contain the firmware
upload succeeded flag and hence tries to load firmware into a device on
which it is already running causing the driver insertion to fail.

So question is, what would be the correct fix? 

I'm not terribly familiar with the sdio subsystem, but I assume it's possible
to tell whether a remove is due to driver removal or device removal.  If it's
the driver, then issuing a CMD_802_11_RESET will apparently reset to the extent
of needing a new firmware load - hence putting our device minus driver back
to the state it was in before the driver was loaded.

Another option would be to fudge the test for whether the firmware has already
loaded to allow for values other than the correct one, though I guess it's
possible the scratch register can contain zero with firmware loaded as well
as on startup so that's not ideal.

Please cc me in to replies as I'm not on libertas-dev...
Jonathan Cameron

More information about the libertas-dev mailing list