brcm80211: fmac: add USB support for bcm43235/6/8 chipsets

This patch extends the use of the brcmfmac driver with support for
chipsets with a USB host interface. The first chipsets supported are
the bcm43235, bcm43236, and bcm43238 for which firmware has been
submitted.

This driver change has been successfully built for x86, x86_64,
ppc64, arm_le, and mips_be.

It has been tested successfully on x86 and x86_64.

Cc: M. Lambert <lambertm@westman.wave.ca>
Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com>
Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com>
Reviewed-by: Kan Yan <kanyan@broadcom.com>
Reviewed-by: Alwin Beukers <alwin@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Arend van Spriel 2012-02-09 21:09:08 +01:00 committed by John W. Linville
parent cf44066a38
commit 71bb244ba2
7 changed files with 1812 additions and 7 deletions

View File

@ -26,16 +26,25 @@ config BRCMFMAC
it'll be called brcmfmac.ko.
config BRCMFMAC_SDIO
bool "SDIO bus interface support for FullMAC"
bool "SDIO bus interface support for FullMAC driver"
depends on MMC
depends on BRCMFMAC
select FW_LOADER
default y
---help---
This option enables the SDIO bus interface support for Broadcom
FullMAC WLAN driver.
Say Y if you want to use brcmfmac for a compatible SDIO interface
wireless card.
IEEE802.11n embedded FullMAC WLAN driver. Say Y if you want to
use the driver for a SDIO wireless card.
config BRCMFMAC_USB
bool "USB bus interface support for FullMAC driver"
depends on USB
depends on BRCMFMAC
select FW_LOADER
---help---
This option enables the USB bus interface support for Broadcom
IEEE802.11n embedded FullMAC WLAN driver. Say Y if you want to
use the driver for an USB wireless card.
config BRCMDBG
bool "Broadcom driver debug functions"

View File

@ -19,6 +19,8 @@ ccflags-y += \
-Idrivers/net/wireless/brcm80211/brcmfmac \
-Idrivers/net/wireless/brcm80211/include
ccflags-y += -D__CHECK_ENDIAN__
obj-$(CONFIG_BRCMFMAC) += brcmfmac.o
brcmfmac-objs += \
wl_cfg80211.o \
@ -30,5 +32,5 @@ brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \
bcmsdh.o \
bcmsdh_sdmmc.o \
sdio_chip.o
ccflags-y += -D__CHECK_ENDIAN__
brcmfmac-$(CONFIG_BRCMFMAC_USB) += \
usb.o

View File

@ -40,8 +40,8 @@ struct dngl_stats {
struct brcmf_bus {
u8 type; /* bus type */
union {
/* pointer to sdio private structure */
struct brcmf_sdio_dev *sdio;
struct brcmf_usbdev *usb;
} bus_priv;
struct brcmf_pub *drvr; /* pointer to driver pub structure brcmf_pub */
enum brcmf_bus_state state;
@ -110,5 +110,9 @@ extern int brcmf_add_if(struct device *dev, int ifidx,
extern void brcmf_sdio_exit(void);
extern int brcmf_sdio_init(void);
#endif
#ifdef CONFIG_BRCMFMAC_USB
extern void brcmf_usb_exit(void);
extern int brcmf_usb_init(void);
#endif
#endif /* _BRCMF_BUS_H_ */

View File

@ -1190,6 +1190,11 @@ static int __init brcmfmac_init(void)
if (ret)
goto fail;
#endif
#ifdef CONFIG_BRCMFMAC_USB
ret = brcmf_usb_init();
if (ret)
goto fail;
#endif
fail:
return ret;
@ -1200,6 +1205,9 @@ static void __exit brcmfmac_exit(void)
#ifdef CONFIG_BRCMFMAC_SDIO
brcmf_sdio_exit();
#endif
#ifdef CONFIG_BRCMFMAC_USB
brcmf_usb_exit();
#endif
}
module_init(brcmfmac_init);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,84 @@
/*
* Copyright (c) 2011 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef BRCMFMAC_USB_H
#define BRCMFMAC_USB_H
enum brcmf_usb_state {
BCMFMAC_USB_STATE_DL_PENDING,
BCMFMAC_USB_STATE_DL_DONE,
BCMFMAC_USB_STATE_UP,
BCMFMAC_USB_STATE_DOWN,
BCMFMAC_USB_STATE_PNP_FWDL,
BCMFMAC_USB_STATE_DISCONNECT,
BCMFMAC_USB_STATE_SLEEP
};
enum brcmf_usb_pnp_state {
BCMFMAC_USB_PNP_DISCONNECT,
BCMFMAC_USB_PNP_SLEEP,
BCMFMAC_USB_PNP_RESUME,
};
struct brcmf_stats {
u32 tx_errors;
u32 tx_packets;
u32 tx_multicast;
u32 tx_ctlpkts;
u32 tx_ctlerrs;
u32 tx_dropped;
u32 tx_flushed;
u32 rx_errors;
u32 rx_packets;
u32 rx_multicast;
u32 rx_ctlpkts;
u32 rx_ctlerrs;
u32 rx_dropped;
u32 rx_flushed;
};
struct brcmf_usb_attrib {
int bustype;
int vid;
int pid;
int devid;
int chiprev; /* chip revsion number */
int mtu;
int nchan; /* Data Channels */
int has_2nd_bulk_in_ep;
};
struct brcmf_usbdev_info;
struct brcmf_usbdev {
struct brcmf_bus *bus;
struct brcmf_usbdev_info *devinfo;
enum brcmf_usb_state state;
struct brcmf_stats stats;
int ntxq, nrxq, rxsize;
u32 bus_mtu;
struct brcmf_usb_attrib attrib;
};
/* IO Request Block (IRB) */
struct brcmf_usbreq {
struct list_head list;
struct brcmf_usbdev_info *devinfo;
struct urb *urb;
struct sk_buff *skb;
};
#endif /* BRCMFMAC_USB_H */

View File

@ -0,0 +1,75 @@
/*
* Copyright (c) 2011 Broadcom Corporation
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _USB_RDL_H
#define _USB_RDL_H
/* Control messages: bRequest values */
#define DL_GETSTATE 0 /* returns the rdl_state_t struct */
#define DL_CHECK_CRC 1 /* currently unused */
#define DL_GO 2 /* execute downloaded image */
#define DL_START 3 /* initialize dl state */
#define DL_REBOOT 4 /* reboot the device in 2 seconds */
#define DL_GETVER 5 /* returns the bootrom_id_t struct */
#define DL_GO_PROTECTED 6 /* execute the downloaded code and set reset
* event to occur in 2 seconds. It is the
* responsibility of the downloaded code to
* clear this event
*/
#define DL_EXEC 7 /* jump to a supplied address */
#define DL_RESETCFG 8 /* To support single enum on dongle
* - Not used by bootloader
*/
#define DL_DEFER_RESP_OK 9 /* Potentially defer the response to setup
* if resp unavailable
*/
/* states */
#define DL_WAITING 0 /* waiting to rx first pkt */
#define DL_READY 1 /* hdr was good, waiting for more of the
* compressed image */
#define DL_BAD_HDR 2 /* hdr was corrupted */
#define DL_BAD_CRC 3 /* compressed image was corrupted */
#define DL_RUNNABLE 4 /* download was successful,waiting for go cmd */
#define DL_START_FAIL 5 /* failed to initialize correctly */
#define DL_NVRAM_TOOBIG 6 /* host specified nvram data exceeds DL_NVRAM
* value */
#define DL_IMAGE_TOOBIG 7 /* download image too big (exceeds DATA_START
* for rdl) */
struct rdl_state_le {
__le32 state;
__le32 bytes;
};
struct bootrom_id_le {
__le32 chip; /* Chip id */
__le32 chiprev; /* Chip rev */
__le32 ramsize; /* Size of RAM */
__le32 remapbase; /* Current remap base address */
__le32 boardtype; /* Type of board */
__le32 boardrev; /* Board revision */
};
#define RDL_CHUNK 1500 /* size of each dl transfer */
#define TRX_OFFSETS_DLFWLEN_IDX 0
#define TRX_OFFSETS_JUMPTO_IDX 1
#define TRX_OFFSETS_NVM_LEN_IDX 2
#define TRX_OFFSETS_DLBASE_IDX 0
#endif /* _USB_RDL_H */