brcmfmac: new USB devices, vendor command, and cleanup
cover brcmfmac: new USB devices, vendor command, and cleanup
The patch series add driver support for new USB device. These are 11ac fullmac devices with USB3.0 interface. Also opting for the vendor-specific netlink command instead of cfg80211 testmode. The remaining patches are small cleanup patches.
This series is intended for 3.17 and applies to the master branch of the wireless-next repository.
Arend van Spriel (3):
brcmfmac: clear ht info during attach phase
brcmfmac: correct logging levels in btcoex source
brcmfmac: reduce log level in fwil if firmware returns error
Daniel Kim (1):
brcmfmac: Don't control mpc setting during scan operation
Franky Lin (1):
brcmfmac: replace cfg80211 testmode with vendor command
Hante Meuleman (3):
brcmfmac: Add 43569 USB support.
brcmfmac: Add USB device 43566 to supported devices.
brcmfmac: Change USB probe routine to support Composite USB
drivers/net/wireless/brcm80211/brcmfmac/Makefile | 3 +- drivers/net/wireless/brcm80211/brcmfmac/btcoex.c | 38 ++-- drivers/net/wireless/brcm80211/brcmfmac/dhd.h | 10 - .../net/wireless/brcm80211/brcmfmac/dhd_common.c | 7 + drivers/net/wireless/brcm80211/brcmfmac/fwil.c | 2 +- drivers/net/wireless/brcm80211/brcmfmac/usb.c | 214 +++++++++----------- drivers/net/wireless/brcm80211/brcmfmac/vendor.c | 115 +++++++++++ drivers/net/wireless/brcm80211/brcmfmac/vendor.h | 64 ++++++ .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 56 ++--- 9 files changed, 326 insertions(+), 183 deletions(-) create mode 100644 drivers/net/wireless/brcm80211/brcmfmac/vendor.c create mode 100644 drivers/net/wireless/brcm80211/brcmfmac/vendor.h
Signature · 1 line
1.7.9.5
PATCH 1/8 brcmfmac: Add 43569 USB support.
From: Hante Meuleman <[email protected]>
Added usb device id for the new device 43569 to the list of supported devices.
--- drivers/net/wireless/brcm80211/brcmfmac/usb.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/wireless/brcm80211/brcmfmac/usb.c +9 -1
@@ -55,6 +55,7 @@#define BRCMF_USB_43143_FW_NAME "brcm/brcmfmac43143.bin"#define BRCMF_USB_43236_FW_NAME "brcm/brcmfmac43236b.bin"#define BRCMF_USB_43242_FW_NAME "brcm/brcmfmac43242a.bin" +#define BRCMF_USB_43569_FW_NAME "brcm/brcmfmac43569.bin"struct brcmf_usb_image {struct list_head list;
@@ -928,6 +929,8 @@ static bool brcmf_usb_chip_support(int chipid, int chiprev)return (chiprev ==3 );case 43242 :return true; +case 43569 : +return true;default :break ; }
@@ -1028,6 +1031,8 @@ static const char *brcmf_usb_get_fwname(struct brcmf_usbdev_info *devinfo)return BRCMF_USB_43236_FW_NAME ;case 43242 :return BRCMF_USB_43242_FW_NAME ; +case 43569 : +return BRCMF_USB_43569_FW_NAME ;default :return NULL ; }
@@ -1229,7 +1234,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)u8 endpoint_num;struct brcmf_usbdev_info *devinfo; -brcmf_dbg (USB ,"Enter\n" ); +brcmf_dbg (USB ,"Enter 0x%04x:0x%04x\n" , id->idVendor, id->idProduct); devinfo =kzalloc (sizeof (*devinfo),GFP_ATOMIC );if (devinfo ==NULL )
@@ -1392,12 +1397,14 @@ static int brcmf_usb_reset_resume(struct usb_interface *intf)#define BRCMF_USB_DEVICE_ID_43143 0xbd1e#define BRCMF_USB_DEVICE_ID_43236 0xbd17#define BRCMF_USB_DEVICE_ID_43242 0xbd1f +#define BRCMF_USB_DEVICE_ID_43569 0xbd27#define BRCMF_USB_DEVICE_ID_BCMFW 0x0bdcstatic struct usb_device_id brcmf_usb_devid_table[] = { {USB_DEVICE (BRCMF_USB_VENDOR_ID_BROADCOM ,BRCMF_USB_DEVICE_ID_43143 ) }, {USB_DEVICE (BRCMF_USB_VENDOR_ID_BROADCOM ,BRCMF_USB_DEVICE_ID_43236 ) }, {USB_DEVICE (BRCMF_USB_VENDOR_ID_BROADCOM ,BRCMF_USB_DEVICE_ID_43242 ) }, + {USB_DEVICE (BRCMF_USB_VENDOR_ID_BROADCOM ,BRCMF_USB_DEVICE_ID_43569 ) },/* special entry for device with firmware loaded and running */ {USB_DEVICE (BRCMF_USB_VENDOR_ID_BROADCOM ,BRCMF_USB_DEVICE_ID_BCMFW ) }, { }
@@ -1407,6 +1414,7 @@ MODULE_DEVICE_TABLE(usb, brcmf_usb_devid_table);MODULE_FIRMWARE (BRCMF_USB_43143_FW_NAME );MODULE_FIRMWARE (BRCMF_USB_43236_FW_NAME );MODULE_FIRMWARE (BRCMF_USB_43242_FW_NAME ); +MODULE_FIRMWARE (BRCMF_USB_43569_FW_NAME );static struct usb_driver brcmf_usbdrvr = { .name =KBUILD_MODNAME ,
Signature · 1 line
1.7.9.5
PATCH 2/8 brcmfmac: Add USB device 43566 to supported devices.
In reply to Arend van SprielFrom: Hante Meuleman <[email protected]>
Add the USB 43566 device to the supported devices list. The 43566 is a WiFi-only variant of the 43569. It uses the same FW as 43569.
--- drivers/net/wireless/brcm80211/brcmfmac/usb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/brcm80211/brcmfmac/usb.c +2 -0
@@ -929,6 +929,7 @@ static bool brcmf_usb_chip_support(int chipid, int chiprev)return (chiprev ==3 );case 43242 :return true; +case 43566 :case 43569 :return true;default :
@@ -1031,6 +1032,7 @@ static const char *brcmf_usb_get_fwname(struct brcmf_usbdev_info *devinfo)return BRCMF_USB_43236_FW_NAME ;case 43242 :return BRCMF_USB_43242_FW_NAME ; +case 43566 :case 43569 :return BRCMF_USB_43569_FW_NAME ;default :
Signature · 1 line
1.7.9.5
Re: [PATCH 2/8] brcmfmac: Add USB device 43566 to supported devices.
Quoted 4 lines · Arend van Spriel
From: Hante Meuleman <[email protected]>
Add the USB 43566 device to the supported devices list. The 43566 is a WiFi-only variant of the 43569. It uses the same FW as 43569.
What about USB ID of this device? You didn't add any. Is it shared with some different one? A 0a5c:bd27 maybe?
Re: [PATCH 2/8] brcmfmac: Add USB device 43566 to supported devices.
Quoted 8 lines · Rafał Miłecki
Quoted 4 lines · Arend van Spriel
From: Hante Meuleman<[email protected]>
Add the USB 43566 device to the supported devices list. The 43566 is a WiFi-only variant of the 43569. It uses the same FW as 43569.
What about USB ID of this device? You didn't add any. Is it shared with some different one? A 0a5c:bd27 maybe?
The 43566 has exactly the same USB ID as the 43569. The bootloader in the device will tell brcmfmac what it is during probe. These devices are exactly the same for the WiFi part, but 43569 additionally has BT logic inside being a composite USB device. Patch 4 probably is needed to make that work. That probably would have been clear when mentioned in the 43569 patch.
Regards,
Arend
PATCH 3/8 brcmfmac: clear ht info during attach phase
In reply to Arend van SprielAfter updating 2G bandwidth capability clear ht info. This will be properly set upon calling brcmf_update_wiphy_bands().
--- .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +3 -0
@@ -5051,6 +5051,9 @@ struct brcmf_cfg80211_info *brcmf_cfg80211_attach(struct brcmf_pub *drvr, err =brcmf_fil_iovar_int_set (ifp,"obss_coex" ,BRCMF_OBSS_COEX_AUTO ); } +/* clear for now and rely on update later */ + wiphy->bands[IEEE80211_BAND_2GHZ ]->ht_cap.ht_supported = false; + wiphy->bands[IEEE80211_BAND_2GHZ ]->ht_cap.cap =0 ; err =brcmf_fil_iovar_int_set (ifp,"tdls_enable" ,1 );if (err) {
Signature · 1 line
1.7.9.5
PATCH 4/8 brcmfmac: Change USB probe routine to support Composite USB
In reply to Arend van SprielFrom: Hante Meuleman <[email protected]>
Some of the USB devices also have Bluetooth inside. These devices can with specific firmware result in a composite USB device. This change will update the driver such that it will also accept the correct interface of composite devices. It is backward compatible with old non-composite USB fw.
--- drivers/net/wireless/brcm80211/brcmfmac/usb.c | 204 +++++++++++-------------- 1 file changed, 87 insertions(+), 117 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/usb.c +87 -117
@@ -29,33 +29,24 @@#include "usb_rdl.h" #include "usb.h" -#define IOCTL_RESP_TIMEOUT 2000 +#define IOCTL_RESP_TIMEOUT 2000#define BRCMF_USB_RESET_GETVER_SPINWAIT 100/* in unit of ms */ #define BRCMF_USB_RESET_GETVER_LOOP_CNT 10#define BRCMF_POSTBOOT_ID 0xA123/* ID to detect if dongle has boot up */ -#define BRCMF_USB_NRXQ 50 -#define BRCMF_USB_NTXQ 50 +#define BRCMF_USB_NRXQ 50 +#define BRCMF_USB_NTXQ 50 -#define CONFIGDESC (usb) (&((usb)->actconfig)->desc) -#define IFPTR (usb, idx) ((usb)->actconfig->interface[(idx)]) -#define IFALTS (usb, idx) (IFPTR((usb), (idx))->altsetting[0]) -#define IFDESC (usb, idx) IFALTS((usb), (idx)).desc -#define IFEPDESC (usb, idx, ep) (IFALTS((usb), (idx)).endpoint[(ep)]).desc +#define BRCMF_USB_CBCTL_WRITE 0 +#define BRCMF_USB_CBCTL_READ 1 +#define BRCMF_USB_MAX_PKT_SIZE 1600 -#define CONTROL_IF 0 -#define BULK_IF 0 - -#define BRCMF_USB_CBCTL_WRITE 0 -#define BRCMF_USB_CBCTL_READ 1 -#define BRCMF_USB_MAX_PKT_SIZE 1600 - -#define BRCMF_USB_43143_FW_NAME "brcm/brcmfmac43143.bin" -#define BRCMF_USB_43236_FW_NAME "brcm/brcmfmac43236b.bin" -#define BRCMF_USB_43242_FW_NAME "brcm/brcmfmac43242a.bin" -#define BRCMF_USB_43569_FW_NAME "brcm/brcmfmac43569.bin" +#define BRCMF_USB_43143_FW_NAME "brcm/brcmfmac43143.bin" +#define BRCMF_USB_43236_FW_NAME "brcm/brcmfmac43236b.bin" +#define BRCMF_USB_43242_FW_NAME "brcm/brcmfmac43242a.bin" +#define BRCMF_USB_43569_FW_NAME "brcm/brcmfmac43569.bin"struct brcmf_usb_image {struct list_head list;
@@ -71,7 +62,7 @@ struct brcmf_usbdev_info {struct list_head rx_postq;struct list_head tx_freeq;struct list_head tx_postq; -uint rx_pipe, tx_pipe, rx_pipe2; +uint rx_pipe, tx_pipe;int rx_low_watermark;int tx_low_watermark;
@@ -98,6 +89,7 @@ struct brcmf_usbdev_info {int ctl_completed;wait_queue_head_t ioctl_resp_wait;ulong ctl_op; +u8 ifnum;struct urb *bulk_urb;/* used for FW download */ };
@@ -577,7 +569,6 @@ fail:static int brcmf_usb_up (struct device *dev) {struct brcmf_usbdev_info *devinfo =brcmf_usb_get_businfo (dev); -u16 ifnum;brcmf_dbg (USB ,"Enter\n" );if (devinfo->bus_pub.state ==BRCMFMAC_USB_STATE_UP )
@@ -590,21 +581,19 @@ static int brcmf_usb_up(struct device *dev) devinfo->ctl_in_pipe =usb_rcvctrlpipe (devinfo->usbdev,0 ); devinfo->ctl_out_pipe =usb_sndctrlpipe (devinfo->usbdev,0 ); - ifnum =IFDESC (devinfo->usbdev,CONTROL_IF ).bInterfaceNumber; -/* CTL Write */ devinfo->ctl_write.bRequestType =USB_DIR_OUT |USB_TYPE_CLASS |USB_RECIP_INTERFACE ; devinfo->ctl_write.bRequest =0 ; devinfo->ctl_write.wValue =cpu_to_le16 (0 ); - devinfo->ctl_write.wIndex =cpu_to_le16p (&ifnum); + devinfo->ctl_write.wIndex =cpu_to_le16 (devinfo->ifnum);/* CTL Read */ devinfo->ctl_read.bRequestType =USB_DIR_IN |USB_TYPE_CLASS |USB_RECIP_INTERFACE ; devinfo->ctl_read.bRequest =1 ; devinfo->ctl_read.wValue =cpu_to_le16 (0 ); - devinfo->ctl_read.wIndex =cpu_to_le16p (&ifnum); + devinfo->ctl_read.wIndex =cpu_to_le16 (devinfo->ifnum); }brcmf_usb_rx_fill_all (devinfo);return 0 ;
@@ -643,19 +632,19 @@ brcmf_usb_sync_complete(struct urb *urb)brcmf_usb_ioctl_resp_wake (devinfo); } -static bool brcmf_usb_dl_cmd (struct brcmf_usbdev_info *devinfo,u8 cmd, -void *buffer,int buflen) +static int brcmf_usb_dl_cmd (struct brcmf_usbdev_info *devinfo,u8 cmd, +void *buffer,int buflen) { -int ret =0 ; +int ret;char *tmpbuf;u16 size;if ((!devinfo) || (devinfo->ctl_urb ==NULL )) -return false; +return -EINVAL ; tmpbuf =kmalloc (buflen,GFP_ATOMIC );if (!tmpbuf) -return false; +return -ENOMEM ; size = buflen; devinfo->ctl_urb->transfer_buffer_length = size;
@@ -676,14 +665,16 @@ static bool brcmf_usb_dl_cmd(struct brcmf_usbdev_info *devinfo, u8 cmd, ret =usb_submit_urb (devinfo->ctl_urb,GFP_ATOMIC );if (ret <0 ) {brcmf_err ("usb_submit_urb failed %d\n" , ret); -kfree (tmpbuf); -return false; + goto finalize; } - ret =brcmf_usb_ioctl_resp_wait (devinfo); -memcpy (buffer, tmpbuf, buflen); -kfree (tmpbuf); +if (!brcmf_usb_ioctl_resp_wait (devinfo)) + ret = -ETIMEDOUT ; +else +memcpy (buffer, tmpbuf, buflen); +finalize: +kfree (tmpbuf);return ret; }
@@ -725,6 +716,7 @@ brcmf_usb_resetcfg(struct brcmf_usbdev_info *devinfo) {struct bootrom_id_le id;u32 loop_cnt; +int err;brcmf_dbg (USB ,"Enter\n" );
@@ -733,7 +725,9 @@ brcmf_usb_resetcfg(struct brcmf_usbdev_info *devinfo)mdelay (BRCMF_USB_RESET_GETVER_SPINWAIT ); loop_cnt++; id.chip =cpu_to_le32 (0xDEAD );/* Get the ID */ -brcmf_usb_dl_cmd (devinfo,DL_GETVER , &id,sizeof (id)); + err =brcmf_usb_dl_cmd (devinfo,DL_GETVER , &id,sizeof (id)); +if ((err) && (err != -ETIMEDOUT )) +return err;if (id.chip ==cpu_to_le32 (BRCMF_POSTBOOT_ID ))break ; }while (loop_cnt <BRCMF_USB_RESET_GETVER_LOOP_CNT );
@@ -795,8 +789,7 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, u8 *fw, int fwlen) }/* 1) Prepare USB boot loader for runtime image */ -brcmf_usb_dl_cmd (devinfo,DL_START , &state, -sizeof (struct rdl_state_le )); +brcmf_usb_dl_cmd (devinfo,DL_START , &state,sizeof (state)); rdlstate =le32_to_cpu (state.state); rdlbytes =le32_to_cpu (state.bytes);
@@ -840,10 +833,10 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, u8 *fw, int fwlen) dlpos += sendlen; sent += sendlen; } -if (!brcmf_usb_dl_cmd (devinfo,DL_GETSTATE , &state, -sizeof (struct rdl_state_le ))) { -brcmf_err ("DL_GETSTATE Failed xxxx\n" ); - err = -EINVAL ; + err =brcmf_usb_dl_cmd (devinfo,DL_GETSTATE , &state, +sizeof (state)); +if (err) { +brcmf_err ("DL_GETSTATE Failed\n" ); goto fail; }
@@ -899,13 +892,12 @@ static int brcmf_usb_dlrun(struct brcmf_usbdev_info *devinfo)return -EINVAL ;/* Check we are runnable */ -brcmf_usb_dl_cmd (devinfo,DL_GETSTATE , &state, -sizeof (struct rdl_state_le )); + state.state =0 ; +brcmf_usb_dl_cmd (devinfo,DL_GETSTATE , &state,sizeof (state));/* Start the image */ if (state.state ==cpu_to_le32 (DL_RUNNABLE )) { -if (!brcmf_usb_dl_cmd (devinfo,DL_GO , &state, -sizeof (struct rdl_state_le ))) +if (brcmf_usb_dl_cmd (devinfo,DL_GO , &state,sizeof (state)))return -ENODEV ;if (brcmf_usb_resetcfg (devinfo))return -ENODEV ;
@@ -1228,13 +1220,13 @@ brcmf_usb_disconnect_cb(struct brcmf_usbdev_info *devinfo)static int brcmf_usb_probe (struct usb_interface *intf,const struct usb_device_id *id) { -int ep; -struct usb_endpoint_descriptor *endpoint; -int ret =0 ;struct usb_device *usb =interface_to_usbdev (intf); -int num_of_eps; -u8 endpoint_num;struct brcmf_usbdev_info *devinfo; +struct usb_interface_descriptor *desc; +struct usb_endpoint_descriptor *endpoint; +int ret =0 ; +u32 num_of_eps; +u8 endpoint_num, ep;brcmf_dbg (USB ,"Enter 0x%04x:0x%04x\n" , id->idVendor, id->idProduct);
@@ -1244,92 +1236,71 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id) devinfo->usbdev = usb; devinfo->dev = &usb->dev; -usb_set_intfdata (intf, devinfo);/* Check that the device supports only one configuration */ if (usb->descriptor.bNumConfigurations !=1 ) { - ret =-1 ; - goto fail; - } - -if (usb->descriptor.bDeviceClass !=USB_CLASS_VENDOR_SPEC ) { - ret =-1 ; - goto fail; - } - -/* -* Only the BDC interface configuration is supported: -* Device class: USB_CLASS_VENDOR_SPEC -* if0 class: USB_CLASS_VENDOR_SPEC -* if0/ep0: control -* if0/ep1: bulk in -* if0/ep2: bulk out (ok if swapped with bulk in) -*/ -if (CONFIGDESC (usb)->bNumInterfaces !=1 ) { - ret =-1 ; +brcmf_err ("Number of configurations: %d not supported\n" , + usb->descriptor.bNumConfigurations); + ret = -ENODEV ; goto fail; } -/* Check interface */ -if (IFDESC (usb,CONTROL_IF ).bInterfaceClass !=USB_CLASS_VENDOR_SPEC || -IFDESC (usb,CONTROL_IF ).bInterfaceSubClass !=2 || -IFDESC (usb,CONTROL_IF ).bInterfaceProtocol !=0xff ) { -brcmf_err ("invalid control interface: class %d, subclass %d, proto %d\n" , -IFDESC (usb,CONTROL_IF ).bInterfaceClass, -IFDESC (usb,CONTROL_IF ).bInterfaceSubClass, -IFDESC (usb,CONTROL_IF ).bInterfaceProtocol); - ret =-1 ; +if ((usb->descriptor.bDeviceClass !=USB_CLASS_VENDOR_SPEC ) && + (usb->descriptor.bDeviceClass !=USB_CLASS_MISC ) && + (usb->descriptor.bDeviceClass !=USB_CLASS_WIRELESS_CONTROLLER )) { +brcmf_err ("Device class: 0x%x not supported\n" , + usb->descriptor.bDeviceClass); + ret = -ENODEV ; goto fail; } -/* Check control endpoint */ - endpoint = &IFEPDESC (usb,CONTROL_IF ,0 ); -if ((endpoint->bmAttributes &USB_ENDPOINT_XFERTYPE_MASK ) - !=USB_ENDPOINT_XFER_INT ) { -brcmf_err ("invalid control endpoint %d\n" , - endpoint->bmAttributes &USB_ENDPOINT_XFERTYPE_MASK ); - ret =-1 ; + desc = &intf->altsetting[0 ].desc; +if ((desc->bInterfaceClass !=USB_CLASS_VENDOR_SPEC ) || + (desc->bInterfaceSubClass !=2 ) || + (desc->bInterfaceProtocol !=0xff )) { +brcmf_err ("non WLAN interface %d: 0x%x:0x%x:0x%x\n" , + desc->bInterfaceNumber, desc->bInterfaceClass, + desc->bInterfaceSubClass, desc->bInterfaceProtocol); + ret = -ENODEV ; goto fail; } - devinfo->rx_pipe =0 ; - devinfo->rx_pipe2 =0 ; - devinfo->tx_pipe =0 ; - num_of_eps =IFDESC (usb,BULK_IF ).bNumEndpoints -1 ; - -/* Check data endpoints and get pipes */ -for (ep =1 ; ep <= num_of_eps; ep++) { - endpoint = &IFEPDESC (usb,BULK_IF , ep); -if ((endpoint->bmAttributes &USB_ENDPOINT_XFERTYPE_MASK ) != -USB_ENDPOINT_XFER_BULK ) { -brcmf_err ("invalid data endpoint %d\n" , ep); - ret =-1 ; - goto fail; - } - - endpoint_num = endpoint->bEndpointAddress & -USB_ENDPOINT_NUMBER_MASK ; -if ((endpoint->bEndpointAddress &USB_ENDPOINT_DIR_MASK ) - ==USB_DIR_IN ) { -if (!devinfo->rx_pipe) { + num_of_eps = desc->bNumEndpoints; +for (ep =0 ; ep < num_of_eps; ep++) { + endpoint = &intf->altsetting[0 ].endpoint[ep].desc; + endpoint_num =usb_endpoint_num (endpoint); +if (!usb_endpoint_xfer_bulk (endpoint)) +continue ; +if (usb_endpoint_dir_in (endpoint)) { +if (!devinfo->rx_pipe) devinfo->rx_pipe =usb_rcvbulkpipe (usb, endpoint_num); - }else { - devinfo->rx_pipe2 = -usb_rcvbulkpipe (usb, endpoint_num); - } }else { - devinfo->tx_pipe =usb_sndbulkpipe (usb, endpoint_num); +if (!devinfo->tx_pipe) + devinfo->tx_pipe = +usb_sndbulkpipe (usb, endpoint_num); } } +if (devinfo->rx_pipe ==0 ) { +brcmf_err ("No RX (in) Bulk EP found\n" ); + ret = -ENODEV ; + goto fail; + } +if (devinfo->tx_pipe ==0 ) { +brcmf_err ("No TX (out) Bulk EP found\n" ); + ret = -ENODEV ; + goto fail; + } + + devinfo->ifnum = desc->bInterfaceNumber;if (usb->speed ==USB_SPEED_SUPER ) -brcmf_dbg (USB ,"Broadcom super speed USB wireless device detected\n" ); +brcmf_dbg (USB ,"Broadcom super speed USB WLAN interface detected\n" );else if (usb->speed ==USB_SPEED_HIGH ) -brcmf_dbg (USB ,"Broadcom high speed USB wireless device detected\n" ); +brcmf_dbg (USB ,"Broadcom high speed USB WLAN interface detected\n" );else -brcmf_dbg (USB ,"Broadcom full speed USB wireless device detected\n" ); +brcmf_dbg (USB ,"Broadcom full speed USB WLAN interface detected\n" ); ret =brcmf_usb_probe_cb (devinfo);if (ret)
@@ -1339,11 +1310,9 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)return 0 ; fail: -brcmf_err ("failed with errno %d\n" , ret);kfree (devinfo);usb_set_intfdata (intf,NULL );return ret; - } static void
@@ -1388,6 +1357,7 @@ static int brcmf_usb_reset_resume(struct usb_interface *intf) {struct usb_device *usb =interface_to_usbdev (intf);struct brcmf_usbdev_info *devinfo =brcmf_usb_get_businfo (&usb->dev); +brcmf_dbg (USB ,"Enter\n" ); return brcmf_fw_get_firmwares(&usb->dev, 0,
Signature · 1 line
1.7.9.5
PATCH 5/8 brcmfmac: replace cfg80211 testmode with vendor command
In reply to Arend van SprielFrom: Franky Lin <[email protected]>
Passing a pointer from user space and using it directly in driver is not a preferable behavior. Switch to cfg80211 vendor mode for dongle command for better cross platform compatibility.
--- drivers/net/wireless/brcm80211/brcmfmac/Makefile | 3 +- drivers/net/wireless/brcm80211/brcmfmac/dhd.h | 10 -- drivers/net/wireless/brcm80211/brcmfmac/vendor.c | 115 ++++++++++++++++++++ drivers/net/wireless/brcm80211/brcmfmac/vendor.h | 64 +++++++++++ .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 37 ++----- 5 files changed, 188 insertions(+), 41 deletions(-) create mode 100644 drivers/net/wireless/brcm80211/brcmfmac/vendor.c create mode 100644 drivers/net/wireless/brcm80211/brcmfmac/vendor.h
drivers/net/wireless/brcm80211/brcmfmac/Makefile +2 -1
@@ -34,7 +34,8 @@ brcmfmac-objs += \ dhd_common.o \ dhd_linux.o \ firmware.o \ - btcoex.o + btcoex.o \ + vendor.o brcmfmac-$(CONFIG_BRCMFMAC_SDIO) += \ dhd_sdio.o \ bcmsdh.o
drivers/net/wireless/brcm80211/brcmfmac/dhd.h +0 -10
@@ -49,16 +49,6 @@*/ #define BRCMF_DRIVER_FIRMWARE_VERSION_LEN 32 -/* Bus independent dongle command */ -struct brcmf_dcmd { -uint cmd;/* common dongle cmd definition */ -void *buf;/* pointer to user buffer */ -uint len;/* length of user buffer */ -u8 set;/* get or set request (optional) */ -uint used;/* bytes read or written (optional) */ -uint needed;/* bytes needed (optional) */ -}; -/** * struct brcmf_ampdu_rx_reorder - AMPDU receive reorder info *
drivers/net/wireless/brcm80211/brcmfmac/vendor.c new file +115 -0
115 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmfmac/vendor.h new file +64 -0
64 lines not on this page · raw message
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +7 -30
@@ -19,6 +19,7 @@#include <linux/kernel.h> #include <linux/etherdevice.h> #include <linux/module.h> +#include <linux/vmalloc.h> #include <net/cfg80211.h> #include <net/netlink.h>
@@ -33,6 +34,7 @@#include "btcoex.h" #include "wl_cfg80211.h" #include "fwil.h" +#include "vendor.h" #define BRCMF_SCAN_IE_LEN_MAX 2048#define BRCMF_PNO_VERSION 2
@@ -3257,35 +3259,6 @@ static int brcmf_cfg80211_sched_scan_stop(struct wiphy *wiphy,return 0 ; } -#ifdef CONFIG_NL80211_TESTMODE -static int brcmf_cfg80211_testmode (struct wiphy *wiphy, -struct wireless_dev *wdev, -void *data,int len) -{ -struct brcmf_cfg80211_info *cfg =wiphy_to_cfg (wiphy); -struct net_device *ndev =cfg_to_ndev (cfg); -struct brcmf_dcmd *dcmd = data; -struct sk_buff *reply; -int ret; - -brcmf_dbg (TRACE ,"cmd %x set %d buf %p len %d\n" , dcmd->cmd, dcmd->set, - dcmd->buf, dcmd->len); - -if (dcmd->set) - ret =brcmf_fil_cmd_data_set (netdev_priv (ndev), dcmd->cmd, - dcmd->buf, dcmd->len); -else - ret =brcmf_fil_cmd_data_get (netdev_priv (ndev), dcmd->cmd, - dcmd->buf, dcmd->len); -if (ret ==0 ) { - reply =cfg80211_testmode_alloc_reply_skb (wiphy,sizeof (*dcmd)); -nla_put (reply,NL80211_ATTR_TESTDATA ,sizeof (*dcmd), dcmd); - ret =cfg80211_testmode_reply (reply); - } -return ret; -} -#endif -static s32 brcmf_configure_opensecurity (struct brcmf_if *ifp) {s32 err;
@@ -4303,7 +4276,6 @@ static struct cfg80211_ops wl_cfg80211_ops = { .crit_proto_start = brcmf_cfg80211_crit_proto_start, .crit_proto_stop = brcmf_cfg80211_crit_proto_stop, .tdls_oper = brcmf_cfg80211_tdls_oper, - CFG80211_TESTMODE_CMD(brcmf_cfg80211_testmode) };static void brcmf_wiphy_pno_params (struct wiphy *wiphy)
@@ -4408,6 +4380,11 @@ static struct wiphy *brcmf_setup_wiphy(struct device *phydev)brcmf_dbg (INFO ,"Registering custom regulatory\n" ); wiphy->regulatory_flags |=REGULATORY_CUSTOM_REG ;wiphy_apply_custom_regulatory (wiphy, &brcmf_regdom); + +/* vendor commands/events support */ + wiphy->vendor_commands = brcmf_vendor_cmds; + wiphy->n_vendor_commands =BRCMF_VNDR_CMDS_LAST -1 ; + err =wiphy_register (wiphy);if (err <0 ) {brcmf_err ("Could not register wiphy device (%d)\n" , err);
Signature · 1 line
1.7.9.5
PATCH 6/8 brcmfmac: correct logging levels in btcoex source
In reply to Arend van SprielAll log messages were set to TRACE level, which is intended for function entry and exit. Using INFO instead in other places. Also reducing an error message that always popped up upon module unload.
--- drivers/net/wireless/brcm80211/brcmfmac/btcoex.c | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/btcoex.c +19 -19
@@ -157,7 +157,7 @@ static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci,*/ /* save current */ -brcmf_dbg (TRACE ,"new SCO/eSCO coex algo {save & override}\n" ); +brcmf_dbg (INFO ,"new SCO/eSCO coex algo {save & override}\n" );brcmf_btcoex_params_read (ifp,50 , &btci->reg50);brcmf_btcoex_params_read (ifp,51 , &btci->reg51);brcmf_btcoex_params_read (ifp,64 , &btci->reg64);
@@ -165,7 +165,7 @@ static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci,brcmf_btcoex_params_read (ifp,71 , &btci->reg71); btci->saved_regs_part2 = true; -brcmf_dbg (TRACE , +brcmf_dbg (INFO ,"saved bt_params[50,51,64,65,71]: 0x%x 0x%x 0x%x 0x%x 0x%x\n" , btci->reg50, btci->reg51, btci->reg64, btci->reg65, btci->reg71);
@@ -179,21 +179,21 @@ static void brcmf_btcoex_boost_wifi(struct brcmf_btcoex_info *btci, }else if (btci->saved_regs_part2) {/* restore previously saved bt params */ -brcmf_dbg (TRACE ,"Do new SCO/eSCO coex algo {restore}\n" ); +brcmf_dbg (INFO ,"Do new SCO/eSCO coex algo {restore}\n" );brcmf_btcoex_params_write (ifp,50 , btci->reg50);brcmf_btcoex_params_write (ifp,51 , btci->reg51);brcmf_btcoex_params_write (ifp,64 , btci->reg64);brcmf_btcoex_params_write (ifp,65 , btci->reg65);brcmf_btcoex_params_write (ifp,71 , btci->reg71); -brcmf_dbg (TRACE , +brcmf_dbg (INFO ,"restored bt_params[50,51,64,65,71]: 0x%x 0x%x 0x%x 0x%x 0x%x\n" , btci->reg50, btci->reg51, btci->reg64, btci->reg65, btci->reg71); btci->saved_regs_part2 = false; }else { -brcmf_err ("attempted to restore not saved BTCOEX params\n" ); +brcmf_dbg (INFO ,"attempted to restore not saved BTCOEX params\n" ); } }
@@ -219,14 +219,14 @@ static bool brcmf_btcoex_is_sco_active(struct brcmf_if *ifp)break ; } -brcmf_dbg (TRACE ,"sample[%d], btc_params 27:%x\n" , i, param27); +brcmf_dbg (INFO ,"sample[%d], btc_params 27:%x\n" , i, param27);if ((param27 &0x6 ) ==2 ) {/* count both sco & esco */ sco_id_cnt++; }if (sco_id_cnt >2 ) { -brcmf_dbg (TRACE , +brcmf_dbg (INFO ,"sco/esco detected, pkt id_cnt:%d samples:%d\n" , sco_id_cnt, i); res = true;
@@ -250,7 +250,7 @@ static void btcmf_btcoex_save_part1(struct brcmf_btcoex_info *btci)brcmf_btcoex_params_read (ifp,41 , &btci->reg41);brcmf_btcoex_params_read (ifp,68 , &btci->reg68); btci->saved_regs_part1 = true; -brcmf_dbg (TRACE , +brcmf_dbg (INFO ,"saved btc_params regs (66,41,68) 0x%x 0x%x 0x%x\n" , btci->reg66, btci->reg41, btci->reg68);
@@ -270,7 +270,7 @@ static void brcmf_btcoex_restore_part1(struct brcmf_btcoex_info *btci)brcmf_btcoex_params_write (ifp,66 , btci->reg66);brcmf_btcoex_params_write (ifp,41 , btci->reg41);brcmf_btcoex_params_write (ifp,68 , btci->reg68); -brcmf_dbg (TRACE , +brcmf_dbg (INFO ,"restored btc_params regs {66,41,68} 0x%x 0x%x 0x%x\n" , btci->reg66, btci->reg41, btci->reg68);
@@ -307,7 +307,7 @@ static void brcmf_btcoex_handler(struct work_struct *work)/* DHCP started provide OPPORTUNITY window to get DHCP address */ -brcmf_dbg (TRACE ,"DHCP started\n" ); +brcmf_dbg (INFO ,"DHCP started\n" ); btci->bt_state =BRCMF_BT_DHCP_OPPR_WIN ;if (btci->timeout <BRCMF_BTCOEX_OPPR_WIN_TIME ) {mod_timer (&btci->timer, btci->timer.expires);
@@ -322,12 +322,12 @@ static void brcmf_btcoex_handler(struct work_struct *work)case BRCMF_BT_DHCP_OPPR_WIN :if (btci->dhcp_done) { -brcmf_dbg (TRACE ,"DHCP done before T1 expiration\n" ); +brcmf_dbg (INFO ,"DHCP done before T1 expiration\n" ); goto idle; }/* DHCP is not over yet, start lowering BT priority */ -brcmf_dbg (TRACE ,"DHCP T1:%d expired\n" , +brcmf_dbg (INFO ,"DHCP T1:%d expired\n" ,BRCMF_BTCOEX_OPPR_WIN_TIME );brcmf_btcoex_boost_wifi (btci, true);
@@ -339,9 +339,9 @@ static void brcmf_btcoex_handler(struct work_struct *work)case BRCMF_BT_DHCP_FLAG_FORCE_TIMEOUT :if (btci->dhcp_done) -brcmf_dbg (TRACE ,"DHCP done before T2 expiration\n" ); +brcmf_dbg (INFO ,"DHCP done before T2 expiration\n" );else -brcmf_dbg (TRACE ,"DHCP T2:%d expired\n" , +brcmf_dbg (INFO ,"DHCP T2:%d expired\n" ,BRCMF_BT_DHCP_FLAG_FORCE_TIMEOUT ); goto idle;
@@ -440,13 +440,13 @@ static void brcmf_btcoex_dhcp_end(struct brcmf_btcoex_info *btci)/* Stop any bt timer because DHCP session is done */ btci->dhcp_done = true;if (btci->timer_on) { -brcmf_dbg (TRACE ,"disable BT DHCP Timer\n" ); +brcmf_dbg (INFO ,"disable BT DHCP Timer\n" ); btci->timer_on = false;del_timer_sync (&btci->timer);/* schedule worker if transition to IDLE is needed */ if (btci->bt_state !=BRCMF_BT_DHCP_IDLE ) { -brcmf_dbg (TRACE ,"bt_state:%d\n" , +brcmf_dbg (INFO ,"bt_state:%d\n" , btci->bt_state);schedule_work (&btci->work); }
@@ -472,7 +472,7 @@ int brcmf_btcoex_set_mode(struct brcmf_cfg80211_vif *vif,switch (mode) {case BRCMF_BTCOEX_DISABLED : -brcmf_dbg (TRACE ,"DHCP session starts\n" ); +brcmf_dbg (INFO ,"DHCP session starts\n" );if (btci->bt_state !=BRCMF_BT_DHCP_IDLE )return -EBUSY ;/* Start BT timer only for SCO connection */
@@ -484,14 +484,14 @@ int brcmf_btcoex_set_mode(struct brcmf_cfg80211_vif *vif,break ;case BRCMF_BTCOEX_ENABLED : -brcmf_dbg (TRACE ,"DHCP session ends\n" ); +brcmf_dbg (INFO ,"DHCP session ends\n" );if (btci->bt_state !=BRCMF_BT_DHCP_IDLE && vif == btci->vif) {brcmf_btcoex_dhcp_end (btci); }break ;default : -brcmf_dbg (TRACE ,"Unknown mode, ignored\n" ); +brcmf_dbg (INFO ,"Unknown mode, ignored\n" ); }return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 7/8 brcmfmac: Don't control mpc setting during scan operation
In reply to Arend van SprielFrom: Daniel Kim <[email protected]>
Instead of controlling mpc setting during scan operation, initialize mpc setting and then let firmware take care of it.
--- .../net/wireless/brcm80211/brcmfmac/dhd_common.c | 7 +++++++ .../net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 16 +++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +7 -0
@@ -282,6 +282,13 @@ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp) ptr =strrchr (buf,' ' ) +1 ;strlcpy (ifp->drvr->fwver, ptr,sizeof (ifp->drvr->fwver)); +/* set mpc */ + err =brcmf_fil_iovar_int_set (ifp,"mpc" ,1 ); +if (err) { +brcmf_err ("failed setting mpc\n" ); + goto done; + } +/* * Setup timeout if Beacons are lost and roam is off to report * link down
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +11 -5
@@ -590,6 +590,12 @@ static struct wireless_dev *brcmf_cfg80211_add_iface(struct wiphy *wiphy, } } +static void brcmf_scan_config_mpc (struct brcmf_if *ifp,int mpc) +{ +if ((brcmf_get_chip_info (ifp) >>4 ) ==0x4329 ) +brcmf_set_mpc (ifp, mpc); +} +void brcmf_set_mpc (struct brcmf_if *ifp,int mpc) {s32 err =0 ;
@@ -643,7 +649,7 @@ s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg,brcmf_err ("Scan abort failed\n" ); } -brcmf_set_mpc (ifp,1 ); +brcmf_scan_config_mpc (ifp,1 );/* * e-scan can be initiated by scheduled scan
@@ -922,7 +928,7 @@ brcmf_do_escan(struct brcmf_cfg80211_info *cfg, struct wiphy *wiphy,brcmf_err ("error (%d)\n" , err);return err; } -brcmf_set_mpc (ifp,0 ); +brcmf_scan_config_mpc (ifp,0 ); results = (struct brcmf_scan_results *)cfg->escan_info.escan_buf; results->version =0 ; results->count =0 ;
@@ -930,7 +936,7 @@ brcmf_do_escan(struct brcmf_cfg80211_info *cfg, struct wiphy *wiphy, err = escan->run (cfg, ifp, request,WL_ESCAN_ACTION_START );if (err) -brcmf_set_mpc (ifp,1 ); +brcmf_scan_config_mpc (ifp,1 );return err; }
@@ -1021,7 +1027,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct brcmf_cfg80211_vif *vif,brcmf_err ("WLC_SET_PASSIVE_SCAN error (%d)\n" , err); goto scan_out; } -brcmf_set_mpc (ifp,0 ); +brcmf_scan_config_mpc (ifp,0 ); err =brcmf_fil_cmd_data_set (ifp,BRCMF_C_SCAN , &sr->ssid_le,sizeof (sr->ssid_le));if (err) {
@@ -1031,7 +1037,7 @@ brcmf_cfg80211_escan(struct wiphy *wiphy, struct brcmf_cfg80211_vif *vif,else brcmf_err ("WLC_SCAN error (%d)\n" , err); -brcmf_set_mpc (ifp,1 ); +brcmf_scan_config_mpc (ifp,1 ); goto scan_out; } }
Signature · 1 line
1.7.9.5
PATCH 8/8 brcmfmac: reduce log level in fwil if firmware returns error
In reply to Arend van SprielThe users of the fwil put an error message in the log so there is no need to do the same in the lower level functions in fwil when the firmware on the device returns an error. Some errors can be ignored for the driver to function and this will avoid driver users to point at the low-level error message as potential bug.
--- drivers/net/wireless/brcm80211/brcmfmac/fwil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/brcm80211/brcmfmac/fwil.c +1 -1
@@ -54,7 +54,7 @@ brcmf_fil_cmd_data(struct brcmf_if *ifp, u32 cmd, void *data, u32 len, bool set)if (err >=0 ) err =0 ;else -brcmf_err ("Failed err=%d\n" , err); +brcmf_dbg (FIL ,"Failed err=%d\n" , err);return err; }
Signature · 1 line
1.7.9.5
Quoted 7 lines · Arend van Spriel
The patch series add driver support for new USB device. These are 11ac fullmac devices with USB3.0 interface. Also opting for the vendor-specific netlink command instead of cfg80211 testmode. The remaining patches are small cleanup patches.
This series is intended for 3.17 and applies to the master branch of the wireless-next repository.
I've slightly updated
http://wireless.kernel.org/en/users/Drivers/brcm80211
, feel free to correct me if I did anything wrong.
Quoted 6 lines · Rafał Miłecki
Quoted 5 lines · Arend van Spriel
The patch series add driver support for new USB device. These are 11ac fullmac devices with USB3.0 interface. Also opting for the vendor-specific netlink command instead of cfg80211 testmode. The remaining patches are small cleanup patches.
Quoted 6 lines
Quoted 2 lines
This series is intended for 3.17 and applies to the master branch of the wireless-next repository.
I've slightly updated
http://wireless.kernel.org/en/users/Drivers/brcm80211
, feel free to correct me if I did anything wrong.
Slightly thanks ;-) I got the notification emails and it looks fine.
Regards,
Arend