Commit Graph

60 Commits (fe4a57c581f88e81e9274e0750f1a22c8c73cf58)

Author SHA1 Message Date
Harro Haan 73e6991ad3 add Marvell 88W8688 support to libertas_sdio
This chip is for example used in the GuruPlug.
This patch avoids the following error:
libertas_sdio: failed to load firmware
libertas_sdio: probe of mmc0:0001:1 failed with error -5

The fix is based on code in:
drivers/net/wireless/libertas_uap/uap_sdio_mmc.c

This file can for example be found on the following links:
http://www.xilka.com/sheeva/2.6/2.6.36/2.6.36.2/source/0002-Driver-for-Marvell-Libertas-8688-SDIO-micro-AP-suppo-2.6.35.patch
http://www.downloadsnewit.co.uk/kernel-v3.0.7/

I followed the following wiki to setup a working WiFi client mode
connection on the GuruPlug:
http://wiki.debian.org/libertas

Signed-off-by: Harro Haan <hrhaan@gmail.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-11-14 14:55:34 -05:00
Daniel Drake f10723841e libertas sdio: fix suspend when interface is down
When the interface is down, the hardware is powered off.
However, the suspend handler currently tries to send host sleep commands
(when wakeup params are set) in this configuration, causing a system hang
when going into suspend (the commands will never complete).

Avoid this by detecting this situation and simply returning from
the suspend handler without doing anything special.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-09-05 14:53:36 -04:00
Daniel Drake 8c1057e43c libertas: fix two memory leaks
The if_sdio_card structure was never being freed, and neither
was the command structure used for association.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-08-02 13:51:47 -04:00
Daniel Drake 66d647efe5 libertas SDIO: convert to asynchronous firmware loading
Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-04-17 14:57:14 -04:00
Daniel Drake 370803c25d libertas: Firmware loading simplifications
Remove the ability to pass module parameters with firmware filenames
for USB and SDIO interfaces.

Remove the ability to pass custom "user" filenames to lbs_get_firmware().

Remove the ability to reprogram internal device memory with a different
firmware from the USB driver (we don't know of any users), and simplify
the OLPC firmware loading quirk to simply placing the OLPC firmware
at the top of the list (we don't know of any users other than OLPC).

Move lbs_get_firmware() into its own file.

These simplifications should have no real-life effect but make the
upcoming transition to asynchronous firmware loading considerably less
painful.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-04-17 14:57:13 -04:00
Jesper Juhl a7b957a277 wireless, libertas: remove redundant NULL tests before calling release_firmware()
release_firmware() tests for, and deals gracefully with, NULL
pointers. Remove redundant explicit tests before calling the function.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-04-12 15:06:07 -04:00
Paul Gortmaker ac5c24e9e6 drivers/net: change moduleparam.h to module.h as required.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:31:08 -04:00
Daniel Drake 7e1f79a1f5 libertas: implement if_sdio runtime power management
The SDIO card is now fully powered down when the network interface is
brought down.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-08-09 15:52:03 -04:00
Daniel Drake 9a821f5d0f libertas: add sd8686 reset_card support
At http://dev.laptop.org/ticket/10748 we are seeing a case of the
libertas firmware randomly stopping responding to commands after
resume. Careful monitoring of communications indicates a firmware or
hardware bug, which has been reported to Marvell.

Work around this issue by adding a reset_card method; this is
automatically called when command timeouts are detected and provides an
instant recovery to this situation.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-10 14:57:47 -04:00
Daniel Drake d2ac49fe3c libertas_sdio: handle spurious interrupts
Commit 06e8935feb adds an IRQ handling
optimization for single-function SDIO cards like this one, but at the
same time exposes a small hardware bug.

During hardware init, an interrupt is generated with (apparently) no
source. Previously, mmc threw this interrupt away, but now (due to the
optimization), the mmc layer passes this onto libertas, before it is ready
(and before it has enabled interrupts), causing a crash.

Work around this hardware bug by registering the IRQ handler later and
making it capable of handling interrupts with no cause. The change that
makes the IRQ handler registration happen later actually eliminates
the spurious interrupt as well.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-06-03 14:22:06 -04:00
Joe Perches f3a57fd148 libertas: Use netdev_<level> or dev_<level> where possible
Using the more descriptive logging styles gives a bit
more information about the device being operated on.

Makes the object trivially smaller too.

$ size drivers/net/wireless/libertas/built-in.o.*
 187730	   2973	  38488	 229191	  37f47	drivers/net/wireless/libertas/built-in.o.new
 188195	   2973	  38488	 229656	  38118	drivers/net/wireless/libertas/built-in.o.old

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-05-11 13:06:02 -04:00
Joe Perches 0e4e06ae5e libertas: Convert lbs_pr_<level> to pr_<level>
Use the standard pr_<level> functions eases grep a bit.

Added a few missing terminating newlines to messages.
Coalesced long formats.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2011-05-11 13:03:20 -04:00
Sven Neumann 16ccdf0dbc libertas: fix invalid access
card->priv must not be accessed after lbs_remove_card() was called
as lbs_remove_card() frees card->priv via free_netdev().

For libertas_sdio this is a regression introduced by 23b149c189.
The correct fix to the issue described there is simply to remove the
assignment. This flag is set at the appropriate time inside
lbs_remove_card anyway.

Reported-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Sven Neumann <s.neumann@raumfeld.com>
Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-11-29 14:41:27 -05:00
Paul Fox 731b203499 libertas: Fix sd8686 firmware reload
For the SD8686, we cannot rely on the scratch register to read the firmware
load status, because the same register is used for storing RX packet length.
Broaden the check to account for this.

The module can now be unloaded/reloaded successfully.

Based on the implementation from libertas_tf.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Steve deRosier <steve@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-10-29 14:33:25 -04:00
David S. Miller e548833df8 Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
	net/mac80211/main.c
2010-09-09 22:27:33 -07:00
Linus Torvalds 608307e6de Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (26 commits)
  pkt_sched: Fix lockdep warning on est_tree_lock in gen_estimator
  ipvs: avoid oops for passive FTP
  Revert "sky2: don't do GRO on second port"
  gro: fix different skb headrooms
  bridge: Clear INET control block of SKBs passed into ip_fragment().
  3c59x: Remove incorrect locking; correct documented lock hierarchy
  sky2: don't do GRO on second port
  ipv4: minor fix about RPF in help of Kconfig
  xfrm_user: avoid a warning with some compiler
  net/sched/sch_hfsc.c: initialize parent's cl_cfmin properly in init_vf()
  pxa168_eth: fix a mdiobus leak
  net sched: fix kernel leak in act_police
  vhost: stop worker only if created
  MAINTAINERS: Add ehea driver as Supported
  ath9k_hw: fix parsing of HT40 5 GHz CTLs
  ath9k_hw: Fix EEPROM uncompress block reading on AR9003
  wireless: register wiphy rfkill w/o holding cfg80211_mutex
  netlink: Make NETLINK_USERSOCK work again.
  irda: Correctly clean up self->ias_obj on irda_bind() failure.
  wireless extensions: fix kernel heap content leak
  ...
2010-09-07 14:06:10 -07:00
Mike Rapoport 557de5eb29 libertas: if_sdio: fix buffer alignment in struct if_sdio_card
The commit 886275ce41 (param: lock
if_sdio's lbs_helper_name and lbs_fw_name against sysfs changes)
introduced new fields into the if_sdio_card structure. It caused
missalignment of the if_sdio_card.buffer field and failure at driver
load time:

  ~# modprobe libertas_sdio
  [   62.315124] libertas_sdio: Libertas SDIO driver
  [   62.319976] libertas_sdio: Copyright Pierre Ossman
  [   63.020629] DMA misaligned error with device 48
  [   63.025207] mmci-omap-hs mmci-omap-hs.1: unexpected dma status 800
  [   66.005035] libertas: command 0x0003 timed out
  [   66.009826] libertas: Timeout submitting command 0x0003
  [   66.016296] libertas: PREP_CMD: command 0x0003 failed: -110

Adding explicit alignment attribute for the if_sdio_card.buffer field
fixes this problem.

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-08-27 13:13:11 -04:00
John W. Linville e569aa78ba Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts:
	drivers/net/wireless/libertas/if_sdio.c
2010-08-25 14:51:42 -04:00
Dan Williams 3d32a58b87 libertas: [sdio] use common firmware request helper and new firmware locations
linux-firmware puts libertas firmware in /libertas.  Fix the driver to
look there first, but fall back to the old firmware names if the new
ones don't exist.  Add preference for newer firmware versions too.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-08-16 15:26:43 -04:00
Rusty Russell 886275ce41 param: lock if_sdio's lbs_helper_name and lbs_fw_name against sysfs changes.
Since it can be changed via sysfs, we need to make a copy.  This most
generic way of doing this is to keep a flag so we know when to free it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Cc: Dan Williams <dcbw@redhat.com>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: libertas-dev@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Cc: netdev@vger.kernel.org
2010-08-11 23:04:37 +09:30
Amitkumar Karwar 66fceb69b7 libertas: Added callback functions to support SDIO suspend/resume.
In suspend() host sleep is activated using already configured
host sleep parameters through wol command, and in resume() host
sleep is cancelled. Earlier priv->fw_ready flag used to reset and
set in suspend and resume handler respectively. Since after suspend
only host goes into sleep state and firmware is always ready, those
changes in flag state are removed.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-06-02 16:13:06 -04:00
John W. Linville 83163244f8 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts:
	drivers/net/wireless/libertas_tf/cmd.c
	drivers/net/wireless/libertas_tf/main.c
2010-05-05 16:14:16 -04:00
Dan Williams ca962557c2 libertas: fix 8686 firmware loading regression
The 'ready' condition was incorrectly evaluated which sometimes lead to
failures loading the second-stage firmware on 8686 devices.

(This was introduced in "libertas: consolidate SDIO firmware wait code".
-- JWL)

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-04-28 16:49:23 -04:00
John W. Linville 3b51cc996e Merge branch 'master' into for-davem
Conflicts:
	drivers/net/wireless/ath/ath9k/phy.c
	drivers/net/wireless/iwlwifi/iwl-6000.c
	drivers/net/wireless/iwlwifi/iwl-debugfs.c
2010-04-23 14:43:45 -04:00
Dan Williams ac1a474d71 libertas: Davinci platforms need more time loading helper firmware
Davinci platforms apparently need more time in-between helper firmware
blocks.  Even though this is an increased delay, we only take this hit
once at initialization time.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-04-16 15:32:01 -04:00
Dan Williams 96021f096e libertas: consolidate SDIO firmware wait code
Consolidate a bunch of C&P code that waits for the firmware to be ready.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-04-16 15:32:01 -04:00
John W. Linville 5c01d56693 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts:
	Documentation/feature-removal-schedule.txt
	drivers/net/wireless/ath/ath5k/phy.c
	drivers/net/wireless/wl12xx/wl1271_main.c
2010-04-15 16:21:34 -04:00
Daniel Mack 8a64c0f6b7 libertas/sdio: 8686: set ECSI bit for 1-bit transfers
When operating in 1-bit mode, SDAT1 is used as dedicated interrupt line.
However, the 8686 will only drive this line when the ECSI bit is set in
the CCCR_IF register.

Thanks to Alagu Sankar for pointing me in the right direction.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Alagu Sankar <alagusankar@embwise.com>
Cc: Volker Ernst <volker.ernst@txtr.com>
Cc: Dan Williams <dcbw@redhat.com>
Cc: John W. Linville <linville@tuxdriver.com>
Cc: Holger Schurig <hs4233@mail.mn-solutions.de>
Cc: Bing Zhao <bzhao@marvell.com>
Cc: libertas-dev@lists.infradead.org
Cc: linux-wireless@vger.kernel.org
Cc: linux-mmc@vger.kernel.org
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2010-04-06 16:52:06 -04:00
Tejun Heo 5a0e3ad6af include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-30 22:02:32 +09:00
Linus Torvalds 4ef58d4e2a Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (42 commits)
  tree-wide: fix misspelling of "definition" in comments
  reiserfs: fix misspelling of "journaled"
  doc: Fix a typo in slub.txt.
  inotify: remove superfluous return code check
  hdlc: spelling fix in find_pvc() comment
  doc: fix regulator docs cut-and-pasteism
  mtd: Fix comment in Kconfig
  doc: Fix IRQ chip docs
  tree-wide: fix assorted typos all over the place
  drivers/ata/libata-sff.c: comment spelling fixes
  fix typos/grammos in Documentation/edac.txt
  sysctl: add missing comments
  fs/debugfs/inode.c: fix comment typos
  sgivwfb: Make use of ARRAY_SIZE.
  sky2: fix sky2_link_down copy/paste comment error
  tree-wide: fix typos "couter" -> "counter"
  tree-wide: fix typos "offest" -> "offset"
  fix kerneldoc for set_irq_msi()
  spidev: fix double "of of" in comment
  comment typo fix: sybsystem -> subsystem
  ...
2009-12-09 19:43:33 -08:00
André Goddard Rosa af901ca181 tree-wide: fix assorted typos all over the place
That is "success", "unknown", "through", "performance", "[re|un]mapping"
, "access", "default", "reasonable", "[con]currently", "temperature"
, "channel", "[un]used", "application", "example","hierarchy", "therefore"
, "[over|under]flow", "contiguous", "threshold", "enough" and others.

Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2009-12-04 15:39:55 +01:00
Ben Hutchings a974a4bbcb libertas: declare MODULE_FIRMWARE
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-11-11 15:23:53 -05:00
Amitkumar Karwar 4912545472 libertas: Add auto deep sleep support for SD8385/SD8686/SD8688
Add timer based auto deep sleep feature in libertas driver which can be
configured using iwconfig command. This is tested on SD8688, SD8686 cards
with firmware versions 10.38.1.p25, 9.70.4.p0 respectively on 32-bit and 64-bit
platforms. Tests have been done for USB/CS cards to make sure that the patch
won't break USB/CS code. We didn't test the if_spi driver.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-10-07 16:39:43 -04:00
Andrey Yurovsky 23b149c189 libertas: fix card cleanup order in SDIO driver
The SDIO driver sets the surpriseremoved flag before calling
lbs_remove_card.  With IEEE PS enabled, lbs_remove_card must issue a
command to exit IEEE PS mode, however with that flag set the command
path is blocked and the card is never taken out of IEEE PS mode.  This
step is required to ensure that the driver can be reloaded.  This patch
moves the setting of surpriseremoved after lbs_remove_card is called.

Tested with V9 firmware by ensuring that IEEE PS is disabled when the
driver is removed.  Reloading the driver is not fully tested due to a
separate issue with module reload in the SDIO driver, however this
patch at least leaves the card in a better state when we bring the
driver down.

Signed-off-by: Andrey Yurovsky <andrey@cozybit.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-07-10 15:01:55 -04:00
Andrey Yurovsky e0d6133cba libertas: remove ps_supported flag, use fwcapinfo
Power save support depends on the firmware capabilities rather than the
card's hardware interface.  Use the FW_CAPINFO_PS bit in the firmware
capabilities mask throughout the driver in place of the redundant
ps_supported flag and don't make decisions about PS support in the
interface drivers (with the exception of a special case in the USB
driver).

V2: put the USB special case in the right place.

Signed-off-by: Andrey Yurovsky <andrey@cozybit.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-07-10 14:57:41 -04:00
Bing Zhao 6bc61f4d8e libertas: improve function init/shutdown handling for SD8688
This patch is to incorporate Dan Williams' comments for commit:
"libertas: implement function init/shutdown commands for SD8688"

1. remove fn_init_required and fn_shutdown_required variables from
lbs_private structure. If required, __lbs_cmd() will be called
directly to send function init/shutdown command for SD8688 in
if_sdio_probe() or if_sdio_remove() callback.

2. add global variable "user_rmmod" to distinguish between the module
removal case and the card removal case. This flag will be checked in
if_sdio_remove() against SD8688 card to determine whether or not the
function shutdown command needs to be sent.

3. remove "card" from if_sdio_model structure as it cannot store
card pointers for multiple cards. Besides, it's no longer needed
to store the "card" pointer with changes #1 & #2 above.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-06-03 14:05:16 -04:00
Bing Zhao 2c7e57981f libertas: read SD8688 firmware status from new register
The scratch pad register is used to store firmware status after
firmware is downloaded and initialized. After firmware status is
verified OK, the same register is used to store RX packet length.
Hence the firmware status code is no longer valid afterwards.

SD8688 firmware introduces a new register for firmware status
which will never be overwritten.

Also add scratch_reg variable to if_sdio_card structure and
initialize it based on the model of the card during probe.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-05-22 14:06:02 -04:00
Bing Zhao d26285f873 libertas: implement function init/shutdown commands for SD8688
SD8688 is a WLAN/Bluetooth combo chip and both functions are supported
in a single firmware image. FUNC_INIT and FUNC_SHUTDOWN commands are
implemented to utilize the multiple function feature.

When SD8688 card is inserted, the firmware image should be downloaded
only once through either WLAN function (Libertas driver) or Bluetooth
function (Bluetooth driver).

This patch adds function init/shutdown for SD8688 WLAN function only.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-05-22 14:06:01 -04:00
Bing Zhao b136a1414c libertas: get SD8688 rx length with one CMD52
Usually, the 16-bit rx length is read from scratch pad registers
with two CMD52 transactions:
SD8385: 	IF_SDIO_SCRATCH_OLD (0x80fe/0x80ff)
SD8686/SD8688:	IF_SDIO_SCRATCH     (0x34/0x35)

Alternatively, SD8688 firmware offers an enhanced method for driver
to read an 8-bit rx length (in units) with a single CMD52:
IF_SDIO_RX_UNIT 0x43 is read one time after firmware is ready.
IF_SDIO_RX_LEN  0x42 is read every time when rx interrupt is received.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-05-22 14:06:00 -04:00
Bing Zhao e70a5ac5d2 libertas: define macros for SDIO model numbers
replace direct usages of SDIO model numbers with defined macros.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-05-22 14:06:00 -04:00
Bing Zhao e45d8e534b libertas: add support for Marvell SD8688 chip
libertas: add support for Marvell SD8688 chip

Use RxPD->pkt_ptr to locate eth803 header in the packet
received since SD8688/v10 firmware allows a gap between
RxPD and eth803 header.

Set SDIO block size to 256 for CMD53.
The maximum block size for SD8688 WLAN function is set
to 512 in TPLFE_MAX_BLK_SIZE. But using 512 as block size
results upto 2K bytes data (4 blocks) being transferred
and causes buffer overflow in firmware.

Both changes above are backward compatible with earlier
firmware versions for SD8385/SD8686.

The SDIO_DEVICE_IDs for SD8688 chip are added in
include/linux/mmc/sdio_ids.h

Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-04-22 16:54:41 -04:00
Dan Williams 9b02f419a7 libertas: use private SDIO workqueue to avoid scheduling latency
The libertas SDIO interface scheduled the packet worker, resulting in
unwanted latency for every data packet or command sent to the firmware.
Fix a bug on the SDIO probe error path too.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-02-27 14:52:51 -05:00
Bing Zhao f5ac2b9eb5 libertas: fix power save issue in libertas_sdio module
The problem: "iwconfig ethX power on" returns error

The cause: "ps_supported" flag was never set for SD8385/8686

The fix: check firmware capabilities returned by GET_HW_SPEC command.
Set "ps_supported" to 1 if FW_CAPINFO_PS bit is on. This fix applies
to SDIO interface only.

Signed-off-by: Bing Zhao <bzhao@marvell.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2009-02-27 14:51:38 -05:00
Ilpo Järvinen 23827926eb libertas: use roundup instead of opencoding
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-12-19 15:23:14 -05:00
Pierre Ossman ad3868b2ec mmc,sdio: helper function for transfer padding
There are a lot of crappy controllers out there that cannot handle
all the request sizes that the MMC/SD/SDIO specifications require.
In case the card driver can pad the data to overcome the problems,
this commit adds a helper that calculates how much that padding
should be.

A corresponding helper is also added for SDIO, but it can also deal
with all the complexities of splitting up a large transfer efficiently.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
2008-07-15 14:14:44 +02:00
David Woodhouse 6dfff895fa libertas: treat firmware data as const
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2008-07-10 14:25:57 +01:00
Holger Schurig 7919b89c82 libertas: convert libertas driver to use an event/cmdresp queue
This patch (co-developed by Dan Williams and Holger Schurig) uses a kfifo
object for events and a swapping buffer scheme for the command response to
preserve the zero-copy semantics of the CF driver and keep memory usage low.
The main thread should only ever touch the buffer indexed by priv->resp_idx,
while the interface code is free to write to the second buffer, then swap
priv->resp_idx under the driver spinlock.  The firmware specs only permit
one in-flight command, so there will only ever be one command response to
process at a time.

Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-04-16 15:59:56 -04:00
David Woodhouse 7003b078c8 libertas: use priv->upld_buf for command responses
If we don't scribble over the command we sent, then we can retry it when
the firmware responds with 0x0004 (which means -EAGAIN).

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28 15:07:44 -08:00
David Woodhouse 7e226272fc libertas: kill whitespace at end of lines
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28 15:07:28 -08:00
Dan Williams ddac452680 libertas: rename and re-type bufvirtualaddr to cmdbuf
Make it a struct cmd_header, since that's what it is, and clean up
the places that it's used.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
2008-01-28 15:06:45 -08:00