* 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (741 commits) staging:iio:meter:ade7753 should be 16 bit read not 8 bit for mode register. staging:iio:kfifo_buf fix double initialization of the ring device structure. staging:iio:accel:lis3l02dq: fix incorrect pointer passed to spi_set_drvdata. staging:iio:imu fix missing register table index for some channels spectra: enable device before poking it staging: rts_pstor: Fix a miswriting staging/lirc_bt829: Return -ENODEV when no hardware is found. staging/lirc_parallel: remove pointless prototypes. staging/lirc_parallel: fix panic on rmmod staging:iio:adc:ad7476: Incorrect pointer into spi_set_drvdata. Staging: zram: Fix kunmapping order Revert "gma500: Fix dependencies" gma500: Add medfield header gma500: wire up the mrst i2c bus from chip_info gma500: Fix DPU build gma500: Clean up the DPU config and make it runtime gma500: resync with Medfield progress gma500: Use the mrst helpers and power control for mode commit gma500@ Fix backlight range error gma500: More Moorestown muddle meddling means MM maybe might modeset ... Fix up fairly trivial conflicts all over, mostly due to header file cleanup conflicts, but some deleted files and some just context changes: - Documentation/feature-removal-schedule.txt - drivers/staging/bcm/headers.h - drivers/staging/brcm80211/brcmfmac/dhd_linux.c - drivers/staging/brcm80211/brcmfmac/dhd_sdio.c - drivers/staging/brcm80211/brcmfmac/wl_cfg80211.h - drivers/staging/brcm80211/brcmfmac/wl_iw.c - drivers/staging/et131x/et131x_netdev.c - drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c - drivers/staging/rtl8192e/r8192E.h - drivers/staging/usbip/userspace/src/utils.h
Unified · Split
| @@ -193,20 +193,6 @@ Why: /proc/<pid>/oom_adj allows userspace to influence the oom killer's · 192 unmodified lines | ||
| 193 | 193 | |
| 194 | 194 | --------------------------- |
| 195 | 195 | |
| 196 | −What: CS5535/CS5536 obsolete GPIO driver | |
| 197 | −When: June 2011 | |
| 198 | −Files: drivers/staging/cs5535_gpio/* | |
| 199 | −Check: drivers/staging/cs5535_gpio/cs5535_gpio.c | |
| 200 | −Why: A newer driver replaces this; it is drivers/gpio/cs5535-gpio.c, and | |
| 201 | − integrates with the Linux GPIO subsystem. The old driver has been | |
| 202 | − moved to staging, and will be removed altogether around 3.0. | |
| 203 | − Please test the new driver, and ensure that the functionality you | |
| 204 | − need and any bugfixes from the old driver are available in the new | |
| 205 | − one. | |
| 206 | −Who: Andres Salomon <dilinger@queued.net> | |
| 207 | − | |
| 208 | −-------------------------- | |
| 209 | − | |
| 210 | 196 | What: remove EXPORT_SYMBOL(kernel_thread) |
| 211 | 197 | When: August 2006 |
| 212 | 198 | Files: arch/*/kernel/*_ksyms.c |
| @@ -1546,9 +1546,10 @@ F: drivers/net/tg3.* · 1545 unmodified lines | ||
| 1546 | 1546 | BROADCOM BRCM80211 IEEE802.11n WIRELESS DRIVER |
| 1547 | 1547 | M: Brett Rudley <brudley@broadcom.com> |
| 1548 | 1548 | M: Henry Ptasinski <henryp@broadcom.com> |
| 1549 | −M: Dowan Kim <dowan@broadcom.com> | |
| 1550 | 1549 | M: Roland Vossen <rvossen@broadcom.com> |
| 1551 | 1550 | M: Arend van Spriel <arend@broadcom.com> |
| 1551 | +M: Franky (Zhenhui) Lin <frankyl@broadcom.com> | |
| 1552 | +M: Kan Yan <kanyan@broadcom.com> | |
| 1552 | 1553 | L: linux-wireless@vger.kernel.org |
| 1553 | 1554 | S: Supported |
| 1554 | 1555 | F: drivers/staging/brcm80211/ |
| @@ -6092,6 +6093,145 @@ L: devel@driverdev.osuosl.org · 4537 unmodified lines | ||
| 6092 | 6093 | S: Maintained |
| 6093 | 6094 | F: drivers/staging/ |
| 6094 | 6095 | |
| 6096 | +STAGING - AGERE HERMES II and II.5 WIRELESS DRIVERS | |
| 6097 | +M: Henk de Groot <pe1dnn@amsat.org> | |
| 6098 | +S: Odd Fixes | |
| 6099 | +F: drivers/staging/wlags49_h2/ | |
| 6100 | +F: drivers/staging/wlags49_h25/ | |
| 6101 | + | |
| 6102 | +STAGING - ASUS OLED | |
| 6103 | +M: Jakub Schmidtke <sjakub@gmail.com> | |
| 6104 | +S: Odd Fixes | |
| 6105 | +F: drivers/staging/asus_oled/ | |
| 6106 | + | |
| 6107 | +STAGING - ATHEROS ATH6KL WIRELESS DRIVER | |
| 6108 | +M: Luis R. Rodriguez <mcgrof@gmail.com> | |
| 6109 | +M: Naveen Singh <nsingh@atheros.com> | |
| 6110 | +S: Odd Fixes | |
| 6111 | +F: drivers/staging/ath6kl/ | |
| 6112 | + | |
| 6113 | +STAGING - COMEDI | |
| 6114 | +M: Ian Abbott <abbotti@mev.co.uk> | |
| 6115 | +M: Mori Hess <fmhess@users.sourceforge.net> | |
| 6116 | +S: Odd Fixes | |
| 6117 | +F: drivers/staging/comedi/ | |
| 6118 | + | |
| 6119 | +STAGING - CRYSTAL HD VIDEO DECODER | |
| 6120 | +M: Naren Sankar <nsankar@broadcom.com> | |
| 6121 | +M: Jarod Wilson <jarod@wilsonet.com> | |
| 6122 | +M: Scott Davilla <davilla@4pi.com> | |
| 6123 | +M: Manu Abraham <abraham.manu@gmail.com> | |
| 6124 | +S: Odd Fixes | |
| 6125 | +F: drivers/staging/crystalhd/ | |
| 6126 | + | |
| 6127 | +STAGING - CYPRESS WESTBRIDGE SUPPORT | |
| 6128 | +M: David Cross <david.cross@cypress.com> | |
| 6129 | +S: Odd Fixes | |
| 6130 | +F: drivers/staging/westbridge/ | |
| 6131 | + | |
| 6132 | +STAGING - ECHO CANCELLER | |
| 6133 | +M: Steve Underwood <steveu@coppice.org> | |
| 6134 | +M: David Rowe <david@rowetel.com> | |
| 6135 | +S: Odd Fixes | |
| 6136 | +F: drivers/staging/echo/ | |
| 6137 | + | |
| 6138 | +STAGING - FLARION FT1000 DRIVERS | |
| 6139 | +M: Marek Belisko <marek.belisko@gmail.com> | |
| 6140 | +S: Odd Fixes | |
| 6141 | +F: drivers/staging/ft1000/ | |
| 6142 | + | |
| 6143 | +STAGING - FRONTIER TRANZPORT AND ALPHATRACK | |
| 6144 | +M: David Täht <d@teklibre.com> | |
| 6145 | +S: Odd Fixes | |
| 6146 | +F: drivers/staging/frontier/ | |
| 6147 | + | |
| 6148 | +STAGING - HYPER-V (MICROSOFT) | |
| 6149 | +M: Hank Janssen <hjanssen@microsoft.com> | |
| 6150 | +M: Haiyang Zhang <haiyangz@microsoft.com> | |
| 6151 | +S: Odd Fixes | |
| 6152 | +F: drivers/staging/hv/ | |
| 6153 | + | |
| 6154 | +STAGING - INDUSTRIAL IO | |
| 6155 | +M: Jonathan Cameron <jic23@cam.ac.uk> | |
| 6156 | +L: linux-iio@vger.kernel.org | |
| 6157 | +S: Odd Fixes | |
| 6158 | +F: drivers/staging/iio/ | |
| 6159 | + | |
| 6160 | +STAGING - LIRC (LINUX INFRARED REMOTE CONTROL) DRIVERS | |
| 6161 | +M: Jarod Wilson <jarod@wilsonet.com> | |
| 6162 | +W: http://www.lirc.org/ | |
| 6163 | +S: Odd Fixes | |
| 6164 | +F: drivers/staging/lirc/ | |
| 6165 | + | |
| 6166 | +STAGING - OLPC SECONDARY DISPLAY CONTROLLER (DCON) | |
| 6167 | +M: Andres Salomon <dilinger@queued.net> | |
| 6168 | +M: Chris Ball <cjb@laptop.org> | |
| 6169 | +M: Jon Nettleton <jon.nettleton@gmail.com> | |
| 6170 | +W: http://wiki.laptop.org/go/DCON | |
| 6171 | +S: Odd Fixes | |
| 6172 | +F: drivers/staging/olpc_dcon/ | |
| 6173 | + | |
| 6174 | +STAGING - PARALLEL LCD/KEYPAD PANEL DRIVER | |
| 6175 | +M: Willy Tarreau <willy@meta-x.org> | |
| 6176 | +S: Odd Fixes | |
| 6177 | +F: drivers/staging/panel/ | |
| 6178 | + | |
| 6179 | +STAGING - REALTEK RTL8712U DRIVERS | |
| 6180 | +M: Larry Finger <Larry.Finger@lwfinger.net> | |
| 6181 | +M: Florian Schilhabel <florian.c.schilhabel@googlemail.com>. | |
| 6182 | +S: Odd Fixes | |
| 6183 | +F: drivers/staging/rtl8712/ | |
| 6184 | + | |
| 6185 | +STAGING - SILICON MOTION SM7XX FRAME BUFFER DRIVER | |
| 6186 | +M: Teddy Wang <teddy.wang@siliconmotion.com.cn> | |
| 6187 | +S: Odd Fixes | |
| 6188 | +F: drivers/staging/sm7xx/ | |
| 6189 | + | |
| 6190 | +STAGING - SOFTLOGIC 6x10 MPEG CODEC | |
| 6191 | +M: Ben Collins <bcollins@bluecherry.net> | |
| 6192 | +S: Odd Fixes | |
| 6193 | +F: drivers/staging/solo6x10/ | |
| 6194 | + | |
| 6195 | +STAGING - SPEAKUP CONSOLE SPEECH DRIVER | |
| 6196 | +M: William Hubbs <w.d.hubbs@gmail.com> | |
| 6197 | +M: Chris Brannon <chris@the-brannons.com> | |
| 6198 | +M: Kirk Reiser <kirk@braille.uwo.ca> | |
| 6199 | +M: Samuel Thibault <samuel.thibault@ens-lyon.org> | |
| 6200 | +L: speakup@braille.uwo.ca | |
| 6201 | +W: http://www.linux-speakup.org/ | |
| 6202 | +S: Odd Fixes | |
| 6203 | +F: drivers/staging/speakup/ | |
| 6204 | + | |
| 6205 | +STAGING - TI DSP BRIDGE DRIVERS | |
| 6206 | +M: Omar Ramirez Luna <omar.ramirez@ti.com> | |
| 6207 | +S: Odd Fixes | |
| 6208 | +F: drivers/staging/tidspbridge/ | |
| 6209 | + | |
| 6210 | +STAGING - TRIDENT TVMASTER TMxxxx USB VIDEO CAPTURE DRIVERS | |
| 6211 | +L: linux-media@vger.kernel.org | |
| 6212 | +S: Odd Fixes | |
| 6213 | +F: drivers/staging/tm6000/ | |
| 6214 | + | |
| 6215 | +STAGING - USB ENE SM/MS CARD READER DRIVER | |
| 6216 | +M: Al Cho <acho@novell.com> | |
| 6217 | +S: Odd Fixes | |
| 6218 | +F: drivers/staging/keucr/ | |
| 6219 | + | |
| 6220 | +STAGING - VIA VT665X DRIVERS | |
| 6221 | +M: Forest Bond <forest@alittletooquiet.net> | |
| 6222 | +S: Odd Fixes | |
| 6223 | +F: drivers/staging/vt665?/ | |
| 6224 | + | |
| 6225 | +STAGING - WINBOND IS89C35 WLAN USB DRIVER | |
| 6226 | +M: Pavel Machek <pavel@ucw.cz> | |
| 6227 | +S: Odd Fixes | |
| 6228 | +F: drivers/staging/winbond/ | |
| 6229 | + | |
| 6230 | +STAGING - XGI Z7,Z9,Z11 PCI DISPLAY DRIVER | |
| 6231 | +M: Arnaud Patard <apatard@mandriva.com> | |
| 6232 | +S: Odd Fixes | |
| 6233 | +F: drivers/staging/xgifb/ | |
| 6234 | + | |
| 6095 | 6235 | STARFIRE/DURALAN NETWORK DRIVER |
| 6096 | 6236 | M: Ion Badulescu <ionut@badula.org> |
| 6097 | 6237 | S: Odd Fixes |
| @@ -6594,13 +6734,6 @@ W: http://pegasus2.sourceforge.net/ · 496 unmodified lines | ||
| 6594 | 6734 | S: Maintained |
| 6595 | 6735 | F: drivers/net/usb/rtl8150.c |
| 6596 | 6736 | |
| 6597 | −USB SE401 DRIVER | |
| 6598 | −L: linux-usb@vger.kernel.org | |
| 6599 | −W: http://www.chello.nl/~j.vreeken/se401/ | |
| 6600 | −S: Orphan | |
| 6601 | −F: Documentation/video4linux/se401.txt | |
| 6602 | −F: drivers/staging/se401/ | |
| 6603 | − | |
| 6604 | 6737 | USB SERIAL BELKIN F5U103 DRIVER |
| 6605 | 6738 | M: William Greathouse <wgreathouse@smva.com> |
| 6606 | 6739 | L: linux-usb@vger.kernel.org |
| @@ -12,34 +12,14 @@ · 11 unmodified lines | ||
| 12 | 12 | #include <linux/interrupt.h> |
| 13 | 13 | #include <linux/mfd/tc3589x.h> |
| 14 | 14 | #include <linux/input/matrix_keypad.h> |
| 15 | −#include <../drivers/staging/ste_rmi4/synaptics_i2c_rmi4.h> | |
| 16 | 15 | |
| 17 | 16 | #include <mach/gpio.h> |
| 18 | 17 | #include <mach/irqs.h> |
| 19 | 18 | |
| 20 | 19 | #include "board-mop500.h" |
| 21 | 20 | |
| 22 | −/* | |
| 23 | − * Synaptics RMI4 touchscreen interface on the U8500 UIB | |
| 24 | − */ | |
| 25 | − | |
| 26 | −/* | |
| 27 | − * Descriptor structure. | |
| 28 | − * Describes the number of i2c devices on the bus that speak RMI. | |
| 29 | − */ | |
| 30 | −static struct synaptics_rmi4_platform_data rmi4_i2c_dev_platformdata = { | |
| 31 | − .irq_number = NOMADIK_GPIO_TO_IRQ(84), | |
| 32 | − .irq_type = (IRQF_TRIGGER_FALLING | IRQF_SHARED), | |
| 33 | − .x_flip = false, | |
| 34 | − .y_flip = true, | |
| 35 | − .regulator_en = false, | |
| 36 | −}; | |
| 37 | − | |
| 38 | −static struct i2c_board_info __initdata mop500_i2c3_devices_u8500[] = { | |
| 39 | − { | |
| 40 | − I2C_BOARD_INFO("synaptics_rmi4_i2c", 0x4B), | |
| 41 | − .platform_data = &rmi4_i2c_dev_platformdata, | |
| 42 | − }, | |
| 21 | +/* Dummy data that can be overridden by staging driver */ | |
| 22 | +struct i2c_board_info __initdata __weak mop500_i2c3_devices_u8500[] = { | |
| 43 | 23 | }; |
| 44 | 24 | |
| 45 | 25 | /* |
| @@ -24,10 +24,6 @@ menuconfig STAGING · 23 unmodified lines | ||
| 24 | 24 | |
| 25 | 25 | if STAGING |
| 26 | 26 | |
| 27 | −source "drivers/staging/tty/Kconfig" | |
| 28 | − | |
| 29 | −source "drivers/staging/generic_serial/Kconfig" | |
| 30 | − | |
| 31 | 27 | source "drivers/staging/et131x/Kconfig" |
| 32 | 28 | |
| 33 | 29 | source "drivers/staging/slicoss/Kconfig" |
| @@ -100,8 +96,6 @@ source "drivers/staging/sep/Kconfig" · 66 unmodified lines | ||
| 100 | 96 | |
| 101 | 97 | source "drivers/staging/iio/Kconfig" |
| 102 | 98 | |
| 103 | −source "drivers/staging/cs5535_gpio/Kconfig" | |
| 104 | − | |
| 105 | 99 | source "drivers/staging/zram/Kconfig" |
| 106 | 100 | |
| 107 | 101 | source "drivers/staging/zcache/Kconfig" |
| @@ -120,8 +114,6 @@ source "drivers/staging/cxt1e1/Kconfig" · 12 unmodified lines | ||
| 120 | 114 | |
| 121 | 115 | source "drivers/staging/xgifb/Kconfig" |
| 122 | 116 | |
| 123 | −source "drivers/staging/msm/Kconfig" | |
| 124 | − | |
| 125 | 117 | source "drivers/staging/lirc/Kconfig" |
| 126 | 118 | |
| 127 | 119 | source "drivers/staging/easycap/Kconfig" |
| @@ -132,8 +124,6 @@ source "drivers/staging/tidspbridge/Kconfig" · 4 unmodified lines | ||
| 132 | 124 | |
| 133 | 125 | source "drivers/staging/quickstart/Kconfig" |
| 134 | 126 | |
| 135 | −source "drivers/staging/westbridge/Kconfig" | |
| 136 | − | |
| 137 | 127 | source "drivers/staging/sbe-2t3e3/Kconfig" |
| 138 | 128 | |
| 139 | 129 | source "drivers/staging/ath6kl/Kconfig" |
| @@ -3,8 +3,6 @@ · 2 unmodified lines | ||
| 3 | 3 | # fix for build system bug... |
| 4 | 4 | obj-$(CONFIG_STAGING) += staging.o |
| 5 | 5 | |
| 6 | −obj-y += tty/ | |
| 7 | −obj-y += generic_serial/ | |
| 8 | 6 | obj-$(CONFIG_ET131X) += et131x/ |
| 9 | 7 | obj-$(CONFIG_SLICOSS) += slicoss/ |
| 10 | 8 | obj-$(CONFIG_VIDEO_GO7007) += go7007/ |
| @@ -41,7 +39,6 @@ obj-$(CONFIG_HYPERV) += hv/ · 30 unmodified lines | ||
| 41 | 39 | obj-$(CONFIG_VME_BUS) += vme/ |
| 42 | 40 | obj-$(CONFIG_DX_SEP) += sep/ |
| 43 | 41 | obj-$(CONFIG_IIO) += iio/ |
| 44 | −obj-$(CONFIG_CS5535_GPIO) += cs5535_gpio/ | |
| 45 | 42 | obj-$(CONFIG_ZRAM) += zram/ |
| 46 | 43 | obj-$(CONFIG_XVMALLOC) += zram/ |
| 47 | 44 | obj-$(CONFIG_ZCACHE) += zcache/ |
| @@ -52,12 +49,10 @@ obj-$(CONFIG_VIDEO_DT3155) += dt3155v4l/ · 4 unmodified lines | ||
| 52 | 49 | obj-$(CONFIG_CRYSTALHD) += crystalhd/ |
| 53 | 50 | obj-$(CONFIG_CXT1E1) += cxt1e1/ |
| 54 | 51 | obj-$(CONFIG_FB_XGI) += xgifb/ |
| 55 | −obj-$(CONFIG_MSM_STAGING) += msm/ | |
| 56 | 52 | obj-$(CONFIG_EASYCAP) += easycap/ |
| 57 | 53 | obj-$(CONFIG_SOLO6X10) += solo6x10/ |
| 58 | 54 | obj-$(CONFIG_TIDSPBRIDGE) += tidspbridge/ |
| 59 | 55 | obj-$(CONFIG_ACPI_QUICKSTART) += quickstart/ |
| 60 | −obj-$(CONFIG_WESTBRIDGE_ASTORIA) += westbridge/astoria/ | |
| 61 | 56 | obj-$(CONFIG_SBE_2T3E3) += sbe-2t3e3/ |
| 62 | 57 | obj-$(CONFIG_ATH6K_LEGACY) += ath6kl/ |
| 63 | 58 | obj-$(CONFIG_USB_ENESTORAGE) += keucr/ |
| @@ -1,5 +1,3 @@ | ||
| 1 | −comment "Altera FPGA firmware download module" | |
| 2 | − | |
| 3 | 1 | config ALTERA_STAPL |
| 4 | 2 | tristate "Altera FPGA firmware download module" |
| 5 | 3 | depends on I2C |
| @@ -1,3 +1,3 @@ | ||
| 1 | −altera-stapl-objs = altera-lpt.o altera-jtag.o altera-comp.o altera.o | |
| 1 | +altera-stapl-y := altera-lpt.o altera-jtag.o altera-comp.o altera.o | |
| 2 | 2 | |
| 3 | 3 | obj-$(CONFIG_ALTERA_STAPL) += altera-stapl.o |
| @@ -2430,16 +2430,23 @@ int altera_init(struct altera_config *config, const struct firmware *fw) · 2429 unmodified lines | ||
| 2430 | 2430 | int index = 0; |
| 2431 | 2431 | s32 offset = 0L; |
| 2432 | 2432 | s32 error_address = 0L; |
| 2433 | + int retval = 0; | |
| 2433 | 2434 | |
| 2434 | − key = kzalloc(33 * sizeof(char), GFP_KERNEL); | |
| 2435 | − if (!key) | |
| 2436 | − return -ENOMEM; | |
| 2437 | − value = kzalloc(257 * sizeof(char), GFP_KERNEL); | |
| 2438 | − if (!value) | |
| 2439 | − return -ENOMEM; | |
| 2435 | + key = kzalloc(33, GFP_KERNEL); | |
| 2436 | + if (!key) { | |
| 2437 | + retval = -ENOMEM; | |
| 2438 | + goto out; | |
| 2439 | + } | |
| 2440 | + value = kzalloc(257, GFP_KERNEL); | |
| 2441 | + if (!value) { | |
| 2442 | + retval = -ENOMEM; | |
| 2443 | + goto free_key; | |
| 2444 | + } | |
| 2440 | 2445 | astate = kzalloc(sizeof(struct altera_state), GFP_KERNEL); |
| 2441 | − if (!astate) | |
| 2442 | − return -ENOMEM; | |
| 2446 | + if (!astate) { | |
| 2447 | + retval = -ENOMEM; | |
| 2448 | + goto free_value; | |
| 2449 | + } | |
| 2443 | 2450 | |
| 2444 | 2451 | astate->config = config; |
| 2445 | 2452 | if (!astate->config->jtag_io) { |
| @@ -2518,10 +2525,12 @@ int altera_init(struct altera_config *config, const struct firmware *fw) · 72 unmodified lines | ||
| 2518 | 2525 | } else if (exec_result) |
| 2519 | 2526 | printk(KERN_ERR "%s: error %d\n", __func__, exec_result); |
| 2520 | 2527 | |
| 2521 | − kfree(key); | |
| 2522 | − kfree(value); | |
| 2523 | 2528 | kfree(astate); |
| 2524 | − | |
| 2525 | − return 0; | |
| 2529 | +free_value: | |
| 2530 | + kfree(value); | |
| 2531 | +free_key: | |
| 2532 | + kfree(key); | |
| 2533 | +out: | |
| 2534 | + return retval; | |
| 2526 | 2535 | } |
| 2527 | 2536 | EXPORT_SYMBOL(altera_init); |
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | TODO: |
| 2 | 2 | |
| 3 | 3 | We are working hard on cleaning up the driver. There's sooooooooo much todo |
| 4 | −so instead of editign this file please use the wiki: | |
| 4 | +so instead of editing this file please use the wiki: | |
| 5 | 5 | |
| 6 | 6 | http://wireless.kernel.org/en/users/Drivers/ath6kl |
| 7 | 7 | |
| @@ -954,9 +954,13 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 953 unmodified lines | ||
| 954 | 954 | const char *filename; |
| 955 | 955 | const struct firmware *fw_entry; |
| 956 | 956 | u32 fw_entry_size; |
| 957 | + u8 **buf; | |
| 958 | + size_t *buf_len; | |
| 957 | 959 | |
| 958 | 960 | switch (file) { |
| 959 | 961 | case AR6K_OTP_FILE: |
| 962 | + buf = &ar->fw_otp; | |
| 963 | + buf_len = &ar->fw_otp_len; | |
| 960 | 964 | if (ar->arVersion.target_ver == AR6003_REV1_VERSION) { |
| 961 | 965 | filename = AR6003_REV1_OTP_FILE; |
| 962 | 966 | } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { |
| @@ -970,6 +974,8 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 7 unmodified lines | ||
| 970 | 974 | break; |
| 971 | 975 | |
| 972 | 976 | case AR6K_FIRMWARE_FILE: |
| 977 | + buf = &ar->fw; | |
| 978 | + buf_len = &ar->fw_len; | |
| 973 | 979 | if (ar->arVersion.target_ver == AR6003_REV1_VERSION) { |
| 974 | 980 | filename = AR6003_REV1_FIRMWARE_FILE; |
| 975 | 981 | } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { |
| @@ -1028,6 +1034,8 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 52 unmodified lines | ||
| 1028 | 1034 | break; |
| 1029 | 1035 | |
| 1030 | 1036 | case AR6K_PATCH_FILE: |
| 1037 | + buf = &ar->fw_patch; | |
| 1038 | + buf_len = &ar->fw_patch_len; | |
| 1031 | 1039 | if (ar->arVersion.target_ver == AR6003_REV1_VERSION) { |
| 1032 | 1040 | filename = AR6003_REV1_PATCH_FILE; |
| 1033 | 1041 | } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { |
| @@ -1041,6 +1049,8 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 7 unmodified lines | ||
| 1041 | 1049 | break; |
| 1042 | 1050 | |
| 1043 | 1051 | case AR6K_BOARD_DATA_FILE: |
| 1052 | + buf = &ar->fw_data; | |
| 1053 | + buf_len = &ar->fw_data_len; | |
| 1044 | 1054 | if (ar->arVersion.target_ver == AR6003_REV1_VERSION) { |
| 1045 | 1055 | filename = AR6003_REV1_BOARD_DATA_FILE; |
| 1046 | 1056 | } else if (ar->arVersion.target_ver == AR6003_REV2_VERSION) { |
| @@ -1057,23 +1067,29 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 10 unmodified lines | ||
| 1057 | 1067 | AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Unknown file type: %d\n", file)); |
| 1058 | 1068 | return A_ERROR; |
| 1059 | 1069 | } |
| 1060 | − if ((A_REQUEST_FIRMWARE(&fw_entry, filename, ((struct device *)ar->osDevInfo.pOSDevice))) != 0) | |
| 1061 | − { | |
| 1062 | − AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to get %s\n", filename)); | |
| 1063 | − return A_ENOENT; | |
| 1070 | + | |
| 1071 | + if (*buf == NULL) { | |
| 1072 | + if ((A_REQUEST_FIRMWARE(&fw_entry, filename, ((struct device *)ar->osDevInfo.pOSDevice))) != 0) { | |
| 1073 | + AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Failed to get %s\n", filename)); | |
| 1074 | + return A_ENOENT; | |
| 1075 | + } | |
| 1076 | + | |
| 1077 | + *buf = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL); | |
| 1078 | + *buf_len = fw_entry->size; | |
| 1079 | + A_RELEASE_FIRMWARE(fw_entry); | |
| 1064 | 1080 | } |
| 1065 | 1081 | |
| 1066 | 1082 | #ifdef SOFTMAC_FILE_USED |
| 1067 | − if (file==AR6K_BOARD_DATA_FILE && fw_entry->data) { | |
| 1068 | − ar6000_softmac_update(ar, (u8 *)fw_entry->data, fw_entry->size); | |
| 1083 | + if (file==AR6K_BOARD_DATA_FILE && *buf_len) { | |
| 1084 | + ar6000_softmac_update(ar, *buf, *buf_len); | |
| 1069 | 1085 | } |
| 1070 | 1086 | #endif |
| 1071 | 1087 | |
| 1072 | 1088 | |
| 1073 | − fw_entry_size = fw_entry->size; | |
| 1089 | + fw_entry_size = *buf_len; | |
| 1074 | 1090 | |
| 1075 | 1091 | /* Load extended board data for AR6003 */ |
| 1076 | − if ((file==AR6K_BOARD_DATA_FILE) && (fw_entry->data)) { | |
| 1092 | + if ((file==AR6K_BOARD_DATA_FILE) && *buf) { | |
| 1077 | 1093 | u32 board_ext_address; |
| 1078 | 1094 | u32 board_ext_data_size; |
| 1079 | 1095 | u32 board_data_size; |
| @@ -1089,14 +1105,13 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 9 unmodified lines | ||
| 1089 | 1105 | AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("Board extended Data download address: 0x%x\n", board_ext_address)); |
| 1090 | 1106 | |
| 1091 | 1107 | /* check whether the target has allocated memory for extended board data and file contains extended board data */ |
| 1092 | − if ((board_ext_address) && (fw_entry->size == (board_data_size + board_ext_data_size))) { | |
| 1108 | + if ((board_ext_address) && (*buf_len == (board_data_size + board_ext_data_size))) { | |
| 1093 | 1109 | u32 param; |
| 1094 | 1110 | |
| 1095 | − status = BMIWriteMemory(ar->arHifDevice, board_ext_address, (u8 *)(fw_entry->data + board_data_size), board_ext_data_size); | |
| 1111 | + status = BMIWriteMemory(ar->arHifDevice, board_ext_address, (u8 *)(*buf + board_data_size), board_ext_data_size); | |
| 1096 | 1112 | |
| 1097 | 1113 | if (status) { |
| 1098 | 1114 | AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__)); |
| 1099 | − A_RELEASE_FIRMWARE(fw_entry); | |
| 1100 | 1115 | return A_ERROR; |
| 1101 | 1116 | } |
| 1102 | 1117 | |
| @@ -1110,17 +1125,16 @@ ar6000_transfer_bin_file(struct ar6_softc *ar, AR6K_BIN_FILE file, u32 address, · 7 unmodified lines | ||
| 1110 | 1125 | } |
| 1111 | 1126 | |
| 1112 | 1127 | if (compressed) { |
| 1113 | − status = BMIFastDownload(ar->arHifDevice, address, (u8 *)fw_entry->data, fw_entry_size); | |
| 1128 | + status = BMIFastDownload(ar->arHifDevice, address, *buf, fw_entry_size); | |
| 1114 | 1129 | } else { |
| 1115 | − status = BMIWriteMemory(ar->arHifDevice, address, (u8 *)fw_entry->data, fw_entry_size); | |
| 1130 | + status = BMIWriteMemory(ar->arHifDevice, address, *buf, fw_entry_size); | |
| 1116 | 1131 | } |
| 1117 | 1132 | |
| 1118 | 1133 | if (status) { |
| 1119 | 1134 | AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("BMI operation failed: %d\n", __LINE__)); |
| 1120 | − A_RELEASE_FIRMWARE(fw_entry); | |
| 1121 | 1135 | return A_ERROR; |
| 1122 | 1136 | } |
| 1123 | − A_RELEASE_FIRMWARE(fw_entry); | |
| 1137 | + | |
| 1124 | 1138 | return 0; |
| 1125 | 1139 | } |
| 1126 | 1140 | |
| @@ -2088,6 +2102,11 @@ ar6000_destroy(struct net_device *dev, unsigned int unregister) · 961 unmodified lines | ||
| 2088 | 2102 | ar6000_remove_ap_interface(); |
| 2089 | 2103 | #endif /*CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT */ |
| 2090 | 2104 | |
| 2105 | + kfree(ar->fw_otp); | |
| 2106 | + kfree(ar->fw); | |
| 2107 | + kfree(ar->fw_patch); | |
| 2108 | + kfree(ar->fw_data); | |
| 2109 | + | |
| 2091 | 2110 | AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("-ar6000_destroy \n")); |
| 2092 | 2111 | } |
| 2093 | 2112 | |
| @@ -4114,6 +4133,13 @@ ar6000_ready_event(void *devt, u8 *datap, u8 phyCap, u32 sw_ver, u32 abi_ver) · 2020 unmodified lines | ||
| 4114 | 4133 | ar->arVersion.wlan_ver = sw_ver; |
| 4115 | 4134 | ar->arVersion.abi_ver = abi_ver; |
| 4116 | 4135 | |
| 4136 | + snprintf(ar->wdev->wiphy->fw_version, sizeof(ar->wdev->wiphy->fw_version), | |
| 4137 | + "%u:%u:%u:%u", | |
| 4138 | + (ar->arVersion.wlan_ver & 0xf0000000) >> 28, | |
| 4139 | + (ar->arVersion.wlan_ver & 0x0f000000) >> 24, | |
| 4140 | + (ar->arVersion.wlan_ver & 0x00ff0000) >> 16, | |
| 4141 | + (ar->arVersion.wlan_ver & 0x0000ffff)); | |
| 4142 | + | |
| 4117 | 4143 | /* Indicate to the waiting thread that the ready event was received */ |
| 4118 | 4144 | ar->arWmiReady = true; |
| 4119 | 4145 | wake_up(&arEvent); |
| @@ -24,6 +24,7 @@ · 23 unmodified lines | ||
| 24 | 24 | #include <linux/wireless.h> |
| 25 | 25 | #include <linux/ieee80211.h> |
| 26 | 26 | #include <net/cfg80211.h> |
| 27 | +#include <net/netlink.h> | |
| 27 | 28 | |
| 28 | 29 | #include "ar6000_drv.h" |
| 29 | 30 | |
| @@ -867,26 +868,31 @@ ar6k_cfg80211_scanComplete_event(struct ar6_softc *ar, int status) · 837 unmodified lines | ||
| 867 | 868 | |
| 868 | 869 | AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: status %d\n", __func__, status)); |
| 869 | 870 | |
| 870 | − if(ar->scan_request) | |
| 871 | − { | |
| 872 | − /* Translate data to cfg80211 mgmt format */ | |
| 873 | − if (ar->arWmi) | |
| 874 | − wmi_iterate_nodes(ar->arWmi, ar6k_cfg80211_scan_node, ar->wdev->wiphy); | |
| 871 | + if (!ar->scan_request) | |
| 872 | + return; | |
| 873 | + | |
| 874 | + if ((status == A_ECANCELED) || (status == A_EBUSY)) { | |
| 875 | + cfg80211_scan_done(ar->scan_request, true); | |
| 876 | + goto out; | |
| 877 | + } | |
| 875 | 878 | |
| 876 | − cfg80211_scan_done(ar->scan_request, | |
| 877 | − ((status & A_ECANCELED) || (status & A_EBUSY)) ? true : false); | |
| 879 | + /* Translate data to cfg80211 mgmt format */ | |
| 880 | + wmi_iterate_nodes(ar->arWmi, ar6k_cfg80211_scan_node, ar->wdev->wiphy); | |
| 878 | 881 | |
| 879 | − if(ar->scan_request->n_ssids && | |
| 880 | − ar->scan_request->ssids[0].ssid_len) { | |
| 882 | + cfg80211_scan_done(ar->scan_request, false); | |
| 883 | + | |
| 884 | + if(ar->scan_request->n_ssids && | |
| 885 | + ar->scan_request->ssids[0].ssid_len) { | |
| 881 | 886 | u8 i; |
| 882 | 887 | |
| 883 | 888 | for (i = 0; i < ar->scan_request->n_ssids; i++) { |
| 884 | − wmi_probedSsid_cmd(ar->arWmi, i+1, DISABLE_SSID_FLAG, | |
| 885 | − 0, NULL); | |
| 889 | + wmi_probedSsid_cmd(ar->arWmi, i+1, DISABLE_SSID_FLAG, | |
| 890 | + 0, NULL); | |
| 886 | 891 | } |
| 887 | − } | |
| 888 | − ar->scan_request = NULL; | |
| 889 | 892 | } |
| 893 | + | |
| 894 | +out: | |
| 895 | + ar->scan_request = NULL; | |
| 890 | 896 | } |
| 891 | 897 | |
| 892 | 898 | static int |
| @@ -1453,6 +1459,159 @@ ar6k_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) · 560 unmodified lines | ||
| 1453 | 1459 | return 0; |
| 1454 | 1460 | } |
| 1455 | 1461 | |
| 1462 | +#ifdef CONFIG_NL80211_TESTMODE | |
| 1463 | +enum ar6k_testmode_attr { | |
| 1464 | + __AR6K_TM_ATTR_INVALID = 0, | |
| 1465 | + AR6K_TM_ATTR_CMD = 1, | |
| 1466 | + AR6K_TM_ATTR_DATA = 2, | |
| 1467 | + | |
| 1468 | + /* keep last */ | |
| 1469 | + __AR6K_TM_ATTR_AFTER_LAST, | |
| 1470 | + AR6K_TM_ATTR_MAX = __AR6K_TM_ATTR_AFTER_LAST - 1 | |
| 1471 | +}; | |
| 1472 | + | |
| 1473 | +enum ar6k_testmode_cmd { | |
| 1474 | + AR6K_TM_CMD_TCMD = 0, | |
| 1475 | + AR6K_TM_CMD_RX_REPORT = 1, | |
| 1476 | +}; | |
| 1477 | + | |
| 1478 | +#define AR6K_TM_DATA_MAX_LEN 5000 | |
| 1479 | + | |
| 1480 | +static const struct nla_policy ar6k_testmode_policy[AR6K_TM_ATTR_MAX + 1] = { | |
| 1481 | + [AR6K_TM_ATTR_CMD] = { .type = NLA_U32 }, | |
| 1482 | + [AR6K_TM_ATTR_DATA] = { .type = NLA_BINARY, | |
| 1483 | + .len = AR6K_TM_DATA_MAX_LEN }, | |
| 1484 | +}; | |
| 1485 | + | |
| 1486 | +void ar6000_testmode_rx_report_event(struct ar6_softc *ar, void *buf, | |
| 1487 | + int buf_len) | |
| 1488 | +{ | |
| 1489 | + if (down_interruptible(&ar->arSem)) | |
| 1490 | + return; | |
| 1491 | + | |
| 1492 | + kfree(ar->tcmd_rx_report); | |
| 1493 | + | |
| 1494 | + ar->tcmd_rx_report = kmemdup(buf, buf_len, GFP_KERNEL); | |
| 1495 | + ar->tcmd_rx_report_len = buf_len; | |
| 1496 | + | |
| 1497 | + up(&ar->arSem); | |
| 1498 | + | |
| 1499 | + wake_up(&arEvent); | |
| 1500 | +} | |
| 1501 | + | |
| 1502 | +static int ar6000_testmode_rx_report(struct ar6_softc *ar, void *buf, | |
| 1503 | + int buf_len, struct sk_buff *skb) | |
| 1504 | +{ | |
| 1505 | + int ret = 0; | |
| 1506 | + long left; | |
| 1507 | + | |
| 1508 | + if (down_interruptible(&ar->arSem)) | |
| 1509 | + return -ERESTARTSYS; | |
| 1510 | + | |
| 1511 | + if (ar->arWmiReady == false) { | |
| 1512 | + ret = -EIO; | |
| 1513 | + goto out; | |
| 1514 | + } | |
| 1515 | + | |
| 1516 | + if (ar->bIsDestroyProgress) { | |
| 1517 | + ret = -EBUSY; | |
| 1518 | + goto out; | |
| 1519 | + } | |
| 1520 | + | |
| 1521 | + WARN_ON(ar->tcmd_rx_report != NULL); | |
| 1522 | + WARN_ON(ar->tcmd_rx_report_len > 0); | |
| 1523 | + | |
| 1524 | + if (wmi_test_cmd(ar->arWmi, buf, buf_len) < 0) { | |
| 1525 | + up(&ar->arSem); | |
| 1526 | + return -EIO; | |
| 1527 | + } | |
| 1528 | + | |
| 1529 | + left = wait_event_interruptible_timeout(arEvent, | |
| 1530 | + ar->tcmd_rx_report != NULL, | |
| 1531 | + wmitimeout * HZ); | |
| 1532 | + | |
| 1533 | + if (left == 0) { | |
| 1534 | + ret = -ETIMEDOUT; | |
| 1535 | + goto out; | |
| 1536 | + } else if (left < 0) { | |
| 1537 | + ret = left; | |
| 1538 | + goto out; | |
| 1539 | + } | |
| 1540 | + | |
| 1541 | + if (ar->tcmd_rx_report == NULL || ar->tcmd_rx_report_len == 0) { | |
| 1542 | + ret = -EINVAL; | |
| 1543 | + goto out; | |
| 1544 | + } | |
| 1545 | + | |
| 1546 | + NLA_PUT(skb, AR6K_TM_ATTR_DATA, ar->tcmd_rx_report_len, | |
| 1547 | + ar->tcmd_rx_report); | |
| 1548 | + | |
| 1549 | + kfree(ar->tcmd_rx_report); | |
| 1550 | + ar->tcmd_rx_report = NULL; | |
| 1551 | + | |
| 1552 | +out: | |
| 1553 | + up(&ar->arSem); | |
| 1554 | + | |
| 1555 | + return ret; | |
| 1556 | + | |
| 1557 | +nla_put_failure: | |
| 1558 | + ret = -ENOBUFS; | |
| 1559 | + goto out; | |
| 1560 | +} | |
| 1561 | + | |
| 1562 | +static int ar6k_testmode_cmd(struct wiphy *wiphy, void *data, int len) | |
| 1563 | +{ | |
| 1564 | + struct ar6_softc *ar = wiphy_priv(wiphy); | |
| 1565 | + struct nlattr *tb[AR6K_TM_ATTR_MAX + 1]; | |
| 1566 | + int err, buf_len, reply_len; | |
| 1567 | + struct sk_buff *skb; | |
| 1568 | + void *buf; | |
| 1569 | + | |
| 1570 | + err = nla_parse(tb, AR6K_TM_ATTR_MAX, data, len, | |
| 1571 | + ar6k_testmode_policy); | |
| 1572 | + if (err) | |
| 1573 | + return err; | |
| 1574 | + | |
| 1575 | + if (!tb[AR6K_TM_ATTR_CMD]) | |
| 1576 | + return -EINVAL; | |
| 1577 | + | |
| 1578 | + switch (nla_get_u32(tb[AR6K_TM_ATTR_CMD])) { | |
| 1579 | + case AR6K_TM_CMD_TCMD: | |
| 1580 | + if (!tb[AR6K_TM_ATTR_DATA]) | |
| 1581 | + return -EINVAL; | |
| 1582 | + | |
| 1583 | + buf = nla_data(tb[AR6K_TM_ATTR_DATA]); | |
| 1584 | + buf_len = nla_len(tb[AR6K_TM_ATTR_DATA]); | |
| 1585 | + | |
| 1586 | + wmi_test_cmd(ar->arWmi, buf, buf_len); | |
| 1587 | + | |
| 1588 | + return 0; | |
| 1589 | + | |
| 1590 | + break; | |
| 1591 | + case AR6K_TM_CMD_RX_REPORT: | |
| 1592 | + if (!tb[AR6K_TM_ATTR_DATA]) | |
| 1593 | + return -EINVAL; | |
| 1594 | + | |
| 1595 | + buf = nla_data(tb[AR6K_TM_ATTR_DATA]); | |
| 1596 | + buf_len = nla_len(tb[AR6K_TM_ATTR_DATA]); | |
| 1597 | + | |
| 1598 | + reply_len = nla_total_size(AR6K_TM_DATA_MAX_LEN); | |
| 1599 | + skb = cfg80211_testmode_alloc_reply_skb(wiphy, reply_len); | |
| 1600 | + if (!skb) | |
| 1601 | + return -ENOMEM; | |
| 1602 | + | |
| 1603 | + err = ar6000_testmode_rx_report(ar, buf, buf_len, skb); | |
| 1604 | + if (err < 0) { | |
| 1605 | + kfree_skb(skb); | |
| 1606 | + return err; | |
| 1607 | + } | |
| 1608 | + | |
| 1609 | + return cfg80211_testmode_reply(skb); | |
| 1610 | + default: | |
| 1611 | + return -EOPNOTSUPP; | |
| 1612 | + } | |
| 1613 | +} | |
| 1614 | +#endif | |
| 1456 | 1615 | |
| 1457 | 1616 | static const |
| 1458 | 1617 | u32 cipher_suites[] = { |
| @@ -1607,6 +1766,28 @@ static int ar6k_get_station(struct wiphy *wiphy, struct net_device *dev, · 148 unmodified lines | ||
| 1607 | 1766 | return 0; |
| 1608 | 1767 | } |
| 1609 | 1768 | |
| 1769 | +static int ar6k_set_pmksa(struct wiphy *wiphy, struct net_device *netdev, | |
| 1770 | + struct cfg80211_pmksa *pmksa) | |
| 1771 | +{ | |
| 1772 | + struct ar6_softc *ar = ar6k_priv(netdev); | |
| 1773 | + return wmi_setPmkid_cmd(ar->arWmi, pmksa->bssid, pmksa->pmkid, true); | |
| 1774 | +} | |
| 1775 | + | |
| 1776 | +static int ar6k_del_pmksa(struct wiphy *wiphy, struct net_device *netdev, | |
| 1777 | + struct cfg80211_pmksa *pmksa) | |
| 1778 | +{ | |
| 1779 | + struct ar6_softc *ar = ar6k_priv(netdev); | |
| 1780 | + return wmi_setPmkid_cmd(ar->arWmi, pmksa->bssid, pmksa->pmkid, false); | |
| 1781 | +} | |
| 1782 | + | |
| 1783 | +static int ar6k_flush_pmksa(struct wiphy *wiphy, struct net_device *netdev) | |
| 1784 | +{ | |
| 1785 | + struct ar6_softc *ar = ar6k_priv(netdev); | |
| 1786 | + if (ar->arConnected) | |
| 1787 | + return wmi_setPmkid_cmd(ar->arWmi, ar->arBssid, NULL, false); | |
| 1788 | + return 0; | |
| 1789 | +} | |
| 1790 | + | |
| 1610 | 1791 | static struct |
| 1611 | 1792 | cfg80211_ops ar6k_cfg80211_ops = { |
| 1612 | 1793 | .change_virtual_intf = ar6k_cfg80211_change_iface, |
| @@ -1628,6 +1809,10 @@ cfg80211_ops ar6k_cfg80211_ops = { · 15 unmodified lines | ||
| 1628 | 1809 | .join_ibss = ar6k_cfg80211_join_ibss, |
| 1629 | 1810 | .leave_ibss = ar6k_cfg80211_leave_ibss, |
| 1630 | 1811 | .get_station = ar6k_get_station, |
| 1812 | + .set_pmksa = ar6k_set_pmksa, | |
| 1813 | + .del_pmksa = ar6k_del_pmksa, | |
| 1814 | + .flush_pmksa = ar6k_flush_pmksa, | |
| 1815 | + CFG80211_TESTMODE_CMD(ar6k_testmode_cmd) | |
| 1631 | 1816 | }; |
| 1632 | 1817 | |
| 1633 | 1818 | struct wireless_dev * |
| @@ -545,15 +545,9 @@ struct ar6_softc { · 544 unmodified lines | ||
| 545 | 545 | s8 arMaxRetries; |
| 546 | 546 | u8 arPhyCapability; |
| 547 | 547 | #ifdef CONFIG_HOST_TCMD_SUPPORT |
| 548 | − u8 tcmdRxReport; | |
| 549 | − u32 tcmdRxTotalPkt; | |
| 550 | − s32 tcmdRxRssi; | |
| 551 | − u32 tcmdPm; | |
| 552 | 548 | u32 arTargetMode; |
| 553 | − u32 tcmdRxcrcErrPkt; | |
| 554 | − u32 tcmdRxsecErrPkt; | |
| 555 | − u16 tcmdRateCnt[TCMD_MAX_RATES]; | |
| 556 | − u16 tcmdRateCntShortGuard[TCMD_MAX_RATES]; | |
| 549 | + void *tcmd_rx_report; | |
| 550 | + int tcmd_rx_report_len; | |
| 557 | 551 | #endif |
| 558 | 552 | AR6000_WLAN_STATE arWlanState; |
| 559 | 553 | struct ar_node_mapping arNodeMap[MAX_NODE_NUM]; |
| @@ -650,6 +644,15 @@ struct ar6_softc { · 90 unmodified lines | ||
| 650 | 644 | void *arApDev; |
| 651 | 645 | #endif |
| 652 | 646 | u8 arAutoAuthStage; |
| 647 | + | |
| 648 | + u8 *fw_otp; | |
| 649 | + size_t fw_otp_len; | |
| 650 | + u8 *fw; | |
| 651 | + size_t fw_len; | |
| 652 | + u8 *fw_patch; | |
| 653 | + size_t fw_patch_len; | |
| 654 | + u8 *fw_data; | |
| 655 | + size_t fw_data_len; | |
| 653 | 656 | }; |
| 654 | 657 | |
| 655 | 658 | #ifdef CONFIG_AP_VIRTUAL_ADAPTER_SUPPORT |
| @@ -41,6 +41,17 @@ void ar6k_cfg80211_disconnect_event(struct ar6_softc *ar, u8 reason, · 40 unmodified lines | ||
| 41 | 41 | |
| 42 | 42 | void ar6k_cfg80211_tkip_micerr_event(struct ar6_softc *ar, u8 keyid, bool ismcast); |
| 43 | 43 | |
| 44 | +#ifdef CONFIG_NL80211_TESTMODE | |
| 45 | +void ar6000_testmode_rx_report_event(struct ar6_softc *ar, void *buf, | |
| 46 | + int buf_len); | |
| 47 | +#else | |
| 48 | +static inline void ar6000_testmode_rx_report_event(struct ar6_softc *ar, | |
| 49 | + void *buf, int buf_len) | |
| 50 | +{ | |
| 51 | +} | |
| 52 | +#endif | |
| 53 | + | |
| 54 | + | |
| 44 | 55 | #endif /* _AR6K_CFG80211_H_ */ |
| 45 | 56 | |
| 46 | 57 | |
| @@ -28,8 +28,6 @@ · 27 unmodified lines | ||
| 28 | 28 | extern "C" { |
| 29 | 29 | #endif |
| 30 | 30 | |
| 31 | −#include <linux/version.h> | |
| 32 | − | |
| 33 | 31 | /* |
| 34 | 32 | * Host side Test Command support |
| 35 | 33 | */ |
| @@ -24,8 +24,6 @@ · 23 unmodified lines | ||
| 24 | 24 | #ifndef _IEEE80211_IOCTL_H_ |
| 25 | 25 | #define _IEEE80211_IOCTL_H_ |
| 26 | 26 | |
| 27 | −#include <linux/version.h> | |
| 28 | − | |
| 29 | 27 | #ifdef __cplusplus |
| 30 | 28 | extern "C" { |
| 31 | 29 | #endif |
| @@ -29,7 +29,6 @@ · 28 unmodified lines | ||
| 29 | 29 | |
| 30 | 30 | #ifdef __KERNEL__ |
| 31 | 31 | |
| 32 | −#include <linux/version.h> | |
| 33 | 32 | #include <linux/types.h> |
| 34 | 33 | #include <linux/kernel.h> |
| 35 | 34 | #include <linux/string.h> |
| @@ -41,6 +41,7 @@ · 40 unmodified lines | ||
| 41 | 41 | #include "a_debug.h" |
| 42 | 42 | #include "dbglog_api.h" |
| 43 | 43 | #include "roaming.h" |
| 44 | +#include "cfg80211.h" | |
| 44 | 45 | |
| 45 | 46 | #define ATH_DEBUG_WMI ATH_DEBUG_MAKE_MODULE_MASK(0) |
| 46 | 47 | |
| @@ -4465,10 +4466,9 @@ wmi_verify_tspec_params(WMI_CREATE_PSTREAM_CMD *pCmd, int tspecCompliance) · 4418 unmodified lines | ||
| 4465 | 4466 | static int |
| 4466 | 4467 | wmi_tcmd_test_report_rx(struct wmi_t *wmip, u8 *datap, int len) |
| 4467 | 4468 | { |
| 4469 | + ar6000_testmode_rx_report_event(wmip->wmi_devt, datap, len); | |
| 4468 | 4470 | |
| 4469 | − A_DPRINTF(DBG_WMI, (DBGFMT "Enter\n", DBGARG)); | |
| 4470 | − | |
| 4471 | − return 0; | |
| 4471 | + return 0; | |
| 4472 | 4472 | } |
| 4473 | 4473 | |
| 4474 | 4474 | #endif /* CONFIG_HOST_TCMD_SUPPORT*/ |
| @@ -131,7 +131,7 @@ DriverEntry.c, bcmfwup.c, ChipDetectTask.c, HaltnReset.c, InterfaceDDR.c */ · 130 unmodified lines | ||
| 131 | 131 | |
| 132 | 132 | // TODO - put PHS_SEND in Tx PHS_RECEIVE in Rx path ? |
| 133 | 133 | #define PHS_SEND (OTHERS<<16) |
| 134 | −#define PHS_RECIEVE (OTHERS<<17) | |
| 134 | +#define PHS_RECEIVE (OTHERS<<17) | |
| 135 | 135 | #define PHS_MODULE (OTHERS<<18) |
| 136 | 136 | |
| 137 | 137 | #define INTF_INIT (OTHERS<<19) |
| @@ -157,7 +157,7 @@ static void read_bulk_callback(struct urb *urb) · 156 unmodified lines | ||
| 157 | 157 | { |
| 158 | 158 | /* Moving ahead by ETH_HLEN to the data ptr as received from FW */ |
| 159 | 159 | skb_pull(skb, ETH_HLEN); |
| 160 | − PHSRecieve(Adapter, pLeader->Vcid, skb, &skb->len, | |
| 160 | + PHSReceive(Adapter, pLeader->Vcid, skb, &skb->len, | |
| 161 | 161 | NULL,bHeaderSupressionEnabled); |
| 162 | 162 | |
| 163 | 163 | if(!Adapter->PackInfo[QueueIndex].bEthCSSupport) |
| @@ -229,7 +229,7 @@ static int ReceiveRcb(PS_INTERFACE_ADAPTER psIntfAdapter, PUSB_RCB pRcb) · 65 unmodified lines | ||
| 229 | 229 | /* |
| 230 | 230 | Function: InterfaceRx |
| 231 | 231 | |
| 232 | −Description: This is the hardware specific Function for Recieveing | |
| 232 | +Description: This is the hardware specific Function for Receiving | |
| 233 | 233 | data packet/control packets from the device. |
| 234 | 234 | |
| 235 | 235 | Input parameters: IN PMINI_ADAPTER Adapter - Miniport Adapter Context |
| @@ -176,8 +176,8 @@ enum enLinkStatus { · 175 unmodified lines | ||
| 176 | 176 | PHY_SYNC_ACHIVED = 2, |
| 177 | 177 | LINKUP_IN_PROGRESS = 3, |
| 178 | 178 | LINKUP_DONE = 4, |
| 179 | − DREG_RECIEVED = 5, | |
| 180 | − LINK_STATUS_RESET_RECIEVED = 6, | |
| 179 | + DREG_RECEIVED = 5, | |
| 180 | + LINK_STATUS_RESET_RECEIVED = 6, | |
| 181 | 181 | PERIODIC_WAKE_UP_NOTIFICATION_FRM_FW = 7, |
| 182 | 182 | LINK_SHUTDOWN_REQ_FROM_FIRMWARE = 8, |
| 183 | 183 | COMPLETE_WAKE_UP_NOTIFICATION_FRM_FW =9 |
| @@ -1447,16 +1447,10 @@ static void convertEndian(B_UINT8 rwFlag, PUINT puiBuffer, UINT uiByteCount) · 1446 unmodified lines | ||
| 1447 | 1447 | |
| 1448 | 1448 | int rdm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize) |
| 1449 | 1449 | { |
| 1450 | − INT uiRetVal =0; | |
| 1451 | − | |
| 1452 | − uiRetVal = Adapter->interface_rdm(Adapter->pvInterfaceAdapter, | |
| 1450 | + return Adapter->interface_rdm(Adapter->pvInterfaceAdapter, | |
| 1453 | 1451 | uiAddress, pucBuff, sSize); |
| 1454 | − | |
| 1455 | − if(uiRetVal < 0) | |
| 1456 | − return uiRetVal; | |
| 1457 | − | |
| 1458 | − return uiRetVal; | |
| 1459 | 1452 | } |
| 1453 | + | |
| 1460 | 1454 | int wrm(PMINI_ADAPTER Adapter, UINT uiAddress, PCHAR pucBuff, size_t sSize) |
| 1461 | 1455 | { |
| 1462 | 1456 | int iRetVal; |
| @@ -209,7 +209,7 @@ int PHSTransmit(PMINI_ADAPTER Adapter, · 208 unmodified lines | ||
| 209 | 209 | return STATUS_SUCCESS; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | −int PHSRecieve(PMINI_ADAPTER Adapter, | |
| 212 | +int PHSReceive(PMINI_ADAPTER Adapter, | |
| 213 | 213 | USHORT usVcid, |
| 214 | 214 | struct sk_buff *packet, |
| 215 | 215 | UINT *punPacketLen, |
| @@ -223,7 +223,7 @@ int PHSRecieve(PMINI_ADAPTER Adapter, · 7 unmodified lines | ||
| 223 | 223 | UINT TotalBytesAdded = 0; |
| 224 | 224 | if(!bHeaderSuppressionEnabled) |
| 225 | 225 | { |
| 226 | − BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"\nPhs Disabled for incoming packet"); | |
| 226 | + BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nPhs Disabled for incoming packet"); | |
| 227 | 227 | return ulPhsStatus; |
| 228 | 228 | } |
| 229 | 229 | |
| @@ -238,7 +238,7 @@ int PHSRecieve(PMINI_ADAPTER Adapter, · 8 unmodified lines | ||
| 238 | 238 | &nTotalsupressedPktHdrBytes, |
| 239 | 239 | &nStandardPktHdrLen); |
| 240 | 240 | |
| 241 | − BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"\nSupressed PktHdrLen : 0x%x Restored PktHdrLen : 0x%x", | |
| 241 | + BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nSupressed PktHdrLen : 0x%x Restored PktHdrLen : 0x%x", | |
| 242 | 242 | nTotalsupressedPktHdrBytes,nStandardPktHdrLen); |
| 243 | 243 | |
| 244 | 244 | if(ulPhsStatus != STATUS_PHS_COMPRESSED) |
| @@ -786,14 +786,14 @@ ULONG PhsDeCompress(IN void* pvContext, · 541 unmodified lines | ||
| 786 | 786 | |
| 787 | 787 | if(pDeviceExtension == NULL) |
| 788 | 788 | { |
| 789 | − BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"Invalid Device Extension\n"); | |
| 789 | + BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"Invalid Device Extension\n"); | |
| 790 | 790 | return ERR_PHS_INVALID_DEVICE_EXETENSION; |
| 791 | 791 | } |
| 792 | 792 | |
| 793 | − BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"Restoring header \n"); | |
| 793 | + BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"Restoring header\n"); | |
| 794 | 794 | |
| 795 | 795 | phsi = *((unsigned char *)(pvInputBuffer)); |
| 796 | − BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"PHSI To Be Used For restore : %x \n",phsi); | |
| 796 | + BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"PHSI To Be Used For restore : %x\n",phsi); | |
| 797 | 797 | if(phsi == UNCOMPRESSED_PACKET ) |
| 798 | 798 | { |
| 799 | 799 | return STATUS_PHS_NOCOMPRESSION; |
| @@ -804,7 +804,7 @@ ULONG PhsDeCompress(IN void* pvContext, · 4 unmodified lines | ||
| 804 | 804 | uiVcid,&pstServiceFlowEntry); |
| 805 | 805 | if(nSFIndex == PHS_INVALID_TABLE_INDEX) |
| 806 | 806 | { |
| 807 | − BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"SFID Match Failed During Lookup\n"); | |
| 807 | + BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"SFID Match Failed During Lookup\n"); | |
| 808 | 808 | return ERR_SF_MATCH_FAIL; |
| 809 | 809 | } |
| 810 | 810 | |
| @@ -1417,7 +1417,7 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, · 606 unmodified lines | ||
| 1417 | 1417 | int in_buf_len = *header_size-1; |
| 1418 | 1418 | PMINI_ADAPTER Adapter = GET_BCM_ADAPTER(gblpnetdev); |
| 1419 | 1419 | in_buf++; |
| 1420 | − BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"====>\n"); | |
| 1420 | + BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"====>\n"); | |
| 1421 | 1421 | *header_size = 0; |
| 1422 | 1422 | |
| 1423 | 1423 | if((decomp_phs_rules == NULL )) |
| @@ -1425,7 +1425,7 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, · 1 unmodified line | ||
| 1425 | 1425 | |
| 1426 | 1426 | |
| 1427 | 1427 | tmp_memb = decomp_phs_rules; |
| 1428 | − //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI 1 %d",phsi)); | |
| 1428 | + //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI 1 %d",phsi)); | |
| 1429 | 1429 | //*header_size = tmp_memb->u8PHSFLength; |
| 1430 | 1430 | phss = tmp_memb->u8PHSS; |
| 1431 | 1431 | phsf = tmp_memb->u8PHSF; |
| @@ -1433,7 +1433,7 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, · 1 unmodified line | ||
| 1433 | 1433 | |
| 1434 | 1434 | if(phss > MAX_PHS_LENGTHS) |
| 1435 | 1435 | phss = MAX_PHS_LENGTHS; |
| 1436 | − //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI %d phss %d index %d",phsi,phss,index)); | |
| 1436 | + //BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phs_decompress PHSI %d phss %d index %d",phsi,phss,index)); | |
| 1437 | 1437 | while((phss > 0) && (size < in_buf_len)) |
| 1438 | 1438 | { |
| 1439 | 1439 | bit = ((*phsm << i)& SUPPRESS); |
| @@ -1441,13 +1441,13 @@ int phs_decompress(unsigned char *in_buf,unsigned char *out_buf, · 1 unmodified line | ||
| 1441 | 1441 | if(bit == SUPPRESS) |
| 1442 | 1442 | { |
| 1443 | 1443 | *out_buf = *phsf; |
| 1444 | − BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"\nDECOMP:In phss %d phsf %d ouput %d", | |
| 1444 | + BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phss %d phsf %d ouput %d", | |
| 1445 | 1445 | phss,*phsf,*out_buf); |
| 1446 | 1446 | } |
| 1447 | 1447 | else |
| 1448 | 1448 | { |
| 1449 | 1449 | *out_buf = *in_buf; |
| 1450 | − BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECIEVE,DBG_LVL_ALL,"\nDECOMP:In phss %d input %d ouput %d", | |
| 1450 | + BCM_DEBUG_PRINT(Adapter,DBG_TYPE_OTHERS, PHS_RECEIVE,DBG_LVL_ALL,"\nDECOMP:In phss %d input %d ouput %d", | |
| 1451 | 1451 | phss,*in_buf,*out_buf); |
| 1452 | 1452 | in_buf++; |
| 1453 | 1453 | size++; |
| @@ -9,7 +9,7 @@ int PHSTransmit(PMINI_ADAPTER Adapter, · 8 unmodified lines | ||
| 9 | 9 | PUINT PacketLen, |
| 10 | 10 | UCHAR bEthCSSupport); |
| 11 | 11 | |
| 12 | −int PHSRecieve(PMINI_ADAPTER Adapter, | |
| 12 | +int PHSReceive(PMINI_ADAPTER Adapter, | |
| 13 | 13 | USHORT usVcid, |
| 14 | 14 | struct sk_buff *packet, |
| 15 | 15 | UINT *punPacketLen, |
| @@ -23,7 +23,6 @@ · 22 unmodified lines | ||
| 23 | 23 | #include <linux/wait.h> |
| 24 | 24 | #include <linux/proc_fs.h> |
| 25 | 25 | #include <linux/interrupt.h> |
| 26 | −#include <linux/version.h> | |
| 27 | 26 | #include <linux/stddef.h> |
| 28 | 27 | #include <linux/stat.h> |
| 29 | 28 | #include <linux/fcntl.h> |
| @@ -1,4 +1,5 @@ | ||
| 1 | 1 | #include "headers.h" |
| 2 | +#include <linux/sort.h> | |
| 2 | 3 | |
| 3 | 4 | /* |
| 4 | 5 | * File Name: sort.c |
| @@ -10,54 +11,42 @@ · 5 unmodified lines | ||
| 10 | 11 | * Copyright (c) 2007 Beceem Communications Pvt. Ltd |
| 11 | 12 | */ |
| 12 | 13 | |
| 14 | +static int compare_packet_info(void const *a, void const *b) | |
| 15 | +{ | |
| 16 | + PacketInfo const *pa = a; | |
| 17 | + PacketInfo const *pb = b; | |
| 18 | + | |
| 19 | + if (!pa->bValid || !pb->bValid) | |
| 20 | + return 0; | |
| 21 | + | |
| 22 | + return pa->u8TrafficPriority - pb->u8TrafficPriority; | |
| 23 | +} | |
| 24 | + | |
| 13 | 25 | VOID SortPackInfo(PMINI_ADAPTER Adapter) |
| 14 | 26 | { |
| 15 | − UINT nIndex1; | |
| 16 | − UINT nIndex2; | |
| 17 | − | |
| 18 | − BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<======="); | |
| 19 | − | |
| 20 | − for(nIndex1 = 0; nIndex1 < NO_OF_QUEUES -2 ; nIndex1++) | |
| 21 | − { | |
| 22 | − for(nIndex2 = nIndex1 + 1 ; nIndex2 < NO_OF_QUEUES -1 ; nIndex2++) | |
| 23 | − { | |
| 24 | − if(Adapter->PackInfo[nIndex1].bValid && Adapter->PackInfo[nIndex2].bValid) | |
| 25 | − { | |
| 26 | − if(Adapter->PackInfo[nIndex2].u8TrafficPriority < | |
| 27 | − Adapter->PackInfo[nIndex1].u8TrafficPriority) | |
| 28 | − { | |
| 29 | − PacketInfo stTemppackInfo = Adapter->PackInfo[nIndex2]; | |
| 30 | − Adapter->PackInfo[nIndex2] = Adapter->PackInfo[nIndex1]; | |
| 31 | − Adapter->PackInfo[nIndex1] = stTemppackInfo; | |
| 32 | − | |
| 33 | − } | |
| 34 | − } | |
| 35 | − } | |
| 36 | − } | |
| 27 | + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, | |
| 28 | + DBG_LVL_ALL, "<======="); | |
| 29 | + | |
| 30 | + sort(Adapter->PackInfo, NO_OF_QUEUES, sizeof(PacketInfo), | |
| 31 | + compare_packet_info, NULL); | |
| 32 | +} | |
| 33 | + | |
| 34 | +static int compare_classifiers(void const *a, void const *b) | |
| 35 | +{ | |
| 36 | + S_CLASSIFIER_RULE const *pa = a; | |
| 37 | + S_CLASSIFIER_RULE const *pb = b; | |
| 38 | + | |
| 39 | + if (!pa->bUsed || !pb->bUsed) | |
| 40 | + return 0; | |
| 41 | + | |
| 42 | + return pa->u8ClassifierRulePriority - pb->u8ClassifierRulePriority; | |
| 37 | 43 | } |
| 38 | 44 | |
| 39 | 45 | VOID SortClassifiers(PMINI_ADAPTER Adapter) |
| 40 | 46 | { |
| 41 | − UINT nIndex1; | |
| 42 | − UINT nIndex2; | |
| 43 | − | |
| 44 | − BCM_DEBUG_PRINT( Adapter,DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, "<======="); | |
| 45 | − | |
| 46 | − for(nIndex1 = 0; nIndex1 < MAX_CLASSIFIERS -1 ; nIndex1++) | |
| 47 | − { | |
| 48 | − for(nIndex2 = nIndex1 + 1 ; nIndex2 < MAX_CLASSIFIERS ; nIndex2++) | |
| 49 | − { | |
| 50 | − if(Adapter->astClassifierTable[nIndex1].bUsed && Adapter->astClassifierTable[nIndex2].bUsed) | |
| 51 | − { | |
| 52 | − if(Adapter->astClassifierTable[nIndex2].u8ClassifierRulePriority < | |
| 53 | − Adapter->astClassifierTable[nIndex1].u8ClassifierRulePriority) | |
| 54 | − { | |
| 55 | − S_CLASSIFIER_RULE stTempClassifierRule = Adapter->astClassifierTable[nIndex2]; | |
| 56 | − Adapter->astClassifierTable[nIndex2] = Adapter->astClassifierTable[nIndex1]; | |
| 57 | − Adapter->astClassifierTable[nIndex1] = stTempClassifierRule; | |
| 58 | − | |
| 59 | − } | |
| 60 | − } | |
| 61 | − } | |
| 62 | − } | |
| 47 | + BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, | |
| 48 | + DBG_LVL_ALL, "<======="); | |
| 49 | + | |
| 50 | + sort(Adapter->astClassifierTable, MAX_CLASSIFIERS, | |
| 51 | + sizeof(S_CLASSIFIER_RULE), compare_classifiers, NULL); | |
| 63 | 52 | } |
| @@ -17,8 +17,8 @@ · 16 unmodified lines | ||
| 17 | 17 | |
| 18 | 18 | # common flags |
| 19 | 19 | subdir-ccflags-y := -DBCMDMA32 |
| 20 | −subdir-ccflags-$(CONFIG_BRCMDBG) += -DBCMDBG -DBCMDBG_ASSERT | |
| 20 | +subdir-ccflags-$(CONFIG_BRCMDBG) += -DBCMDBG | |
| 21 | 21 | |
| 22 | −obj-$(CONFIG_BRCMUTIL) += util/ | |
| 22 | +obj-$(CONFIG_BRCMUTIL) += brcmutil/ | |
| 23 | 23 | obj-$(CONFIG_BRCMFMAC) += brcmfmac/ |
| 24 | 24 | obj-$(CONFIG_BRCMSMAC) += brcmsmac/ |
| @@ -1,64 +1 @@ | ||
| 1 | −Broadcom brcmsmac (mac80211-based softmac PCIe) and brcmfmac (SDIO) drivers. | |
| 2 | − | |
| 3 | −Completely open source host drivers, no binary object files. | |
| 4 | − | |
| 5 | −Support for the following chips: | |
| 6 | −=============================== | |
| 7 | − | |
| 8 | − brcmsmac (PCIe) | |
| 9 | − Name Device ID | |
| 10 | − BCM4313 0x4727 | |
| 11 | − BCM43224 0x4353 | |
| 12 | − BCM43225 0x4357 | |
| 13 | − | |
| 14 | − brcmfmac (SDIO) | |
| 15 | − Name | |
| 16 | − BCM4329 | |
| 17 | − | |
| 18 | −Both brcmsmac and brcmfmac drivers require firmware files that need to be | |
| 19 | −separately downloaded. | |
| 20 | − | |
| 21 | −Firmware | |
| 22 | −====================== | |
| 23 | −Firmware is available from the Linux firmware repository at: | |
| 24 | − | |
| 25 | − git://git.kernel.org/pub/scm/linux/kernel/git/dwmw2/linux-firmware.git | |
| 26 | − http://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git | |
| 27 | − https://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git | |
| 28 | − | |
| 29 | − | |
| 30 | −=============================================================== | |
| 31 | −Broadcom brcmsmac driver | |
| 32 | −=============================================================== | |
| 33 | −- Support for both 32 and 64 bit Linux kernels | |
| 34 | − | |
| 35 | − | |
| 36 | −Firmware installation | |
| 37 | −====================== | |
| 38 | −Copy brcm/bcm43xx-0.fw and brcm/bcm43xx_hdr-0.fw to | |
| 39 | −/lib/firmware/brcm (or wherever firmware is normally installed | |
| 40 | −on your system). | |
| 41 | − | |
| 42 | − | |
| 43 | −=============================================================== | |
| 44 | −Broadcom brcmfmac driver | |
| 45 | −=============================================================== | |
| 46 | −- Support for 32 bit Linux kernel, 64 bit untested | |
| 47 | − | |
| 48 | − | |
| 49 | −Firmware installation | |
| 50 | −====================== | |
| 51 | −Copy brcm/bcm4329-fullmac-4.bin and brcm/bcm4329-fullmac-4.txt | |
| 52 | −to /lib/firmware/brcm (or wherever firmware is normally installed on your | |
| 53 | −system). | |
| 54 | − | |
| 55 | − | |
| 56 | −Contact Info: | |
| 57 | −============= | |
| 58 | −Brett Rudley brudley@broadcom.com | |
| 59 | −Henry Ptasinski henryp@broadcom.com | |
| 60 | −Dowan Kim dowan@broadcom.com | |
| 61 | −Roland Vossen rvossen@broadcom.com | |
| 62 | −Arend van Spriel arend@broadcom.com | |
| 63 | − | |
| 64 | −For more info, refer to: http://linuxwireless.org/en/users/Drivers/brcm80211 | |
| 1 | +refer to: http://linuxwireless.org/en/users/Drivers/brcm80211 | |
| @@ -2,14 +2,12 @@ To Do List for Broadcom Mac80211 driver before getting in mainline · 1 unmodified line | ||
| 2 | 2 | |
| 3 | 3 | Bugs |
| 4 | 4 | ==== |
| 5 | −- Oops on AMPDU traffic, to be solved by new ucode (currently under test) | |
| 5 | +- none known at this moment | |
| 6 | 6 | |
| 7 | −brcmfmac and brcmsmac | |
| 7 | +brcmfmac | |
| 8 | 8 | ===================== |
| 9 | −- ASSERTS not allowed in mainline, replace by warning + error handling | |
| 10 | −- Replace printk and WL_ERROR() with proper routines | |
| 9 | +- ASSERTS deprecated in mainline, replace by warning + error handling | |
| 11 | 10 | |
| 12 | −brcmfmac | |
| 11 | +brcm80211 info page | |
| 13 | 12 | ===================== |
| 14 | −- Replace driver's proprietary ssb interface with generic kernel ssb module | |
| 15 | −- Build and test on 64 bit linux kernel | |
| 13 | +http://linuxwireless.org/en/users/Drivers/brcm80211 | |
| @@ -16,23 +16,11 @@ · 15 unmodified lines | ||
| 16 | 16 | # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 17 | 17 | |
| 18 | 18 | ccflags-y := \ |
| 19 | − -DARP_OFFLOAD_SUPPORT \ | |
| 20 | − -DBCMLXSDMMC \ | |
| 21 | − -DBCMPLATFORM_BUS \ | |
| 22 | − -DBCMSDIO \ | |
| 23 | − -DBDC \ | |
| 24 | − -DBRCM_FULLMAC \ | |
| 25 | − -DDHD_FIRSTREAD=64 \ | |
| 26 | − -DDHD_SCHED \ | |
| 27 | − -DDHD_SDALIGN=64 \ | |
| 28 | − -DEMBEDDED_PLATFORM \ | |
| 29 | − -DMAX_HDR_READ=64 \ | |
| 30 | − -DMMC_SDIO_ABORT \ | |
| 31 | − -DPKT_FILTER_SUPPORT \ | |
| 32 | − -DSHOW_EVENTS \ | |
| 33 | − -DTOE | |
| 19 | + -DBRCMF_FIRSTREAD=64 \ | |
| 20 | + -DBRCMF_SDALIGN=64 \ | |
| 21 | + -DMAX_HDR_READ=64 | |
| 34 | 22 | |
| 35 | −ccflags-$(CONFIG_BRCMDBG) += -DDHD_DEBUG | |
| 23 | +ccflags-$(CONFIG_BRCMDBG) += -DSHOW_EVENTS | |
| 36 | 24 | |
| 37 | 25 | ccflags-y += \ |
| 38 | 26 | -Idrivers/staging/brcm80211/brcmfmac \ |
| @@ -40,17 +28,12 @@ ccflags-y += \ · 1 unmodified line | ||
| 40 | 28 | |
| 41 | 29 | DHDOFILES = \ |
| 42 | 30 | wl_cfg80211.o \ |
| 43 | − wl_iw.o \ | |
| 44 | 31 | dhd_cdc.o \ |
| 45 | 32 | dhd_common.o \ |
| 46 | − dhd_custom_gpio.o \ | |
| 47 | 33 | dhd_sdio.o \ |
| 48 | 34 | dhd_linux.o \ |
| 49 | − dhd_linux_sched.o \ | |
| 50 | 35 | bcmsdh.o \ |
| 51 | − bcmsdh_linux.o \ | |
| 52 | − bcmsdh_sdmmc.o \ | |
| 53 | − bcmsdh_sdmmc_linux.o | |
| 36 | + bcmsdh_sdmmc.o | |
| 54 | 37 | |
| 55 | 38 | obj-$(CONFIG_BRCMFMAC) += brcmfmac.o |
| 56 | 39 | brcmfmac-objs += $(DHDOFILES) |
| @@ -1,2 +0,0 @@ | ||
| 1 | − | |
| 2 | − | |
| @@ -1 +0,0 @@ | ||
| 1 | −#include "../util/aiutils.c" | |
| @@ -1,98 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2010 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | − * purpose with or without fee is hereby granted, provided that the above | |
| 6 | − * copyright notice and this permission notice appear in all copies. | |
| 7 | − * | |
| 8 | − * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | − * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | − * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | − * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | − * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | − * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | − * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | − */ | |
| 16 | −#include <linux/if_ether.h> | |
| 17 | − | |
| 18 | −typedef struct cdc_ioctl { | |
| 19 | − u32 cmd; /* ioctl command value */ | |
| 20 | − u32 len; /* lower 16: output buflen; upper 16: | |
| 21 | − input buflen (excludes header) */ | |
| 22 | − u32 flags; /* flag defns given below */ | |
| 23 | − u32 status; /* status code returned from the device */ | |
| 24 | −} cdc_ioctl_t; | |
| 25 | − | |
| 26 | −/* Max valid buffer size that can be sent to the dongle */ | |
| 27 | −#define CDC_MAX_MSG_SIZE (ETH_FRAME_LEN+ETH_FCS_LEN) | |
| 28 | − | |
| 29 | −/* len field is divided into input and output buffer lengths */ | |
| 30 | −#define CDCL_IOC_OUTLEN_MASK 0x0000FFFF /* maximum or expected | |
| 31 | − response length, */ | |
| 32 | − /* excluding IOCTL header */ | |
| 33 | −#define CDCL_IOC_OUTLEN_SHIFT 0 | |
| 34 | −#define CDCL_IOC_INLEN_MASK 0xFFFF0000 /* input buffer length, | |
| 35 | − excluding IOCTL header */ | |
| 36 | −#define CDCL_IOC_INLEN_SHIFT 16 | |
| 37 | − | |
| 38 | −/* CDC flag definitions */ | |
| 39 | −#define CDCF_IOC_ERROR 0x01 /* 0=success, 1=ioctl cmd failed */ | |
| 40 | −#define CDCF_IOC_SET 0x02 /* 0=get, 1=set cmd */ | |
| 41 | −#define CDCF_IOC_IF_MASK 0xF000 /* I/F index */ | |
| 42 | −#define CDCF_IOC_IF_SHIFT 12 | |
| 43 | −#define CDCF_IOC_ID_MASK 0xFFFF0000 /* used to uniquely id an ioctl | |
| 44 | − req/resp pairing */ | |
| 45 | −#define CDCF_IOC_ID_SHIFT 16 /* # of bits of shift for ID Mask */ | |
| 46 | − | |
| 47 | −#define CDC_IOC_IF_IDX(flags) \ | |
| 48 | − (((flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT) | |
| 49 | −#define CDC_IOC_ID(flags) \ | |
| 50 | − (((flags) & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT) | |
| 51 | − | |
| 52 | −#define CDC_GET_IF_IDX(hdr) \ | |
| 53 | − ((int)((((hdr)->flags) & CDCF_IOC_IF_MASK) >> CDCF_IOC_IF_SHIFT)) | |
| 54 | −#define CDC_SET_IF_IDX(hdr, idx) \ | |
| 55 | − ((hdr)->flags = (((hdr)->flags & ~CDCF_IOC_IF_MASK) | \ | |
| 56 | − ((idx) << CDCF_IOC_IF_SHIFT))) | |
| 57 | − | |
| 58 | −/* | |
| 59 | − * BDC header | |
| 60 | − * | |
| 61 | − * The BDC header is used on data packets to convey priority across USB. | |
| 62 | − */ | |
| 63 | − | |
| 64 | −#define BDC_HEADER_LEN 4 | |
| 65 | − | |
| 66 | −#define BDC_PROTO_VER 1 /* Protocol version */ | |
| 67 | − | |
| 68 | −#define BDC_FLAG_VER_MASK 0xf0 /* Protocol version mask */ | |
| 69 | −#define BDC_FLAG_VER_SHIFT 4 /* Protocol version shift */ | |
| 70 | − | |
| 71 | −#define BDC_FLAG__UNUSED 0x03 /* Unassigned */ | |
| 72 | −#define BDC_FLAG_SUM_GOOD 0x04 /* Dongle has verified good | |
| 73 | − RX checksums */ | |
| 74 | −#define BDC_FLAG_SUM_NEEDED 0x08 /* Dongle needs to do TX checksums */ | |
| 75 | − | |
| 76 | −#define BDC_PRIORITY_MASK 0x7 | |
| 77 | − | |
| 78 | −#define BDC_FLAG2_FC_FLAG 0x10 /* flag to indicate if pkt contains */ | |
| 79 | − /* FLOW CONTROL info only */ | |
| 80 | −#define BDC_PRIORITY_FC_SHIFT 4 /* flow control info shift */ | |
| 81 | − | |
| 82 | −#define BDC_FLAG2_IF_MASK 0x0f /* APSTA: interface on which the | |
| 83 | − packet was received */ | |
| 84 | −#define BDC_FLAG2_IF_SHIFT 0 | |
| 85 | − | |
| 86 | −#define BDC_GET_IF_IDX(hdr) \ | |
| 87 | − ((int)((((hdr)->flags2) & BDC_FLAG2_IF_MASK) >> BDC_FLAG2_IF_SHIFT)) | |
| 88 | −#define BDC_SET_IF_IDX(hdr, idx) \ | |
| 89 | − ((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_IF_MASK) | \ | |
| 90 | − ((idx) << BDC_FLAG2_IF_SHIFT))) | |
| 91 | − | |
| 92 | −struct bdc_header { | |
| 93 | − u8 flags; /* Flags */ | |
| 94 | − u8 priority; /* 802.1d Priority 0:2 bits, 4:7 flow | |
| 95 | − control info for usb */ | |
| 96 | − u8 flags2; | |
| 97 | − u8 rssi; | |
| 98 | −}; | |
| @@ -17,12 +17,6 @@ · 16 unmodified lines | ||
| 17 | 17 | #ifndef _bcmchip_h_ |
| 18 | 18 | #define _bcmchip_h_ |
| 19 | 19 | |
| 20 | −/* Core reg address translation */ | |
| 21 | −#define CORE_CC_REG(base, field) (base + offsetof(chipcregs_t, field)) | |
| 22 | −#define CORE_BUS_REG(base, field) (base + offsetof(sdpcmd_regs_t, field)) | |
| 23 | −#define CORE_SB(base, field) \ | |
| 24 | − (base + SBCONFIGOFF + offsetof(sbconfig_t, field)) | |
| 25 | − | |
| 26 | 20 | /* bcm4329 */ |
| 27 | 21 | /* SDIO device core, ID 0x829 */ |
| 28 | 22 | #define BCM4329_CORE_BUS_BASE 0x18011000 |
| @@ -31,5 +25,8 @@ · 2 unmodified lines | ||
| 31 | 25 | /* ARM Cortex M3 core, ID 0x82a */ |
| 32 | 26 | #define BCM4329_CORE_ARM_BASE 0x18002000 |
| 33 | 27 | #define BCM4329_RAMSIZE 0x48000 |
| 28 | +/* firmware name */ | |
| 29 | +#define BCM4329_FW_NAME "brcm/bcm4329-fullmac-4.bin" | |
| 30 | +#define BCM4329_NV_NAME "brcm/bcm4329-fullmac-4.txt" | |
| 34 | 31 | |
| 35 | 32 | #endif /* _bcmchip_h_ */ |
| @@ -1,113 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2010 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | − * purpose with or without fee is hereby granted, provided that the above | |
| 6 | − * copyright notice and this permission notice appear in all copies. | |
| 7 | − * | |
| 8 | − * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | − * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | − * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | − * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | − * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | − * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | − * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | − */ | |
| 16 | − | |
| 17 | −#ifndef _sdio_api_h_ | |
| 18 | −#define _sdio_api_h_ | |
| 19 | − | |
| 20 | −#define SDIOH_API_RC_SUCCESS (0x00) | |
| 21 | −#define SDIOH_API_RC_FAIL (0x01) | |
| 22 | −#define SDIOH_API_SUCCESS(status) (status == 0) | |
| 23 | − | |
| 24 | −#define SDIOH_READ 0 /* Read request */ | |
| 25 | −#define SDIOH_WRITE 1 /* Write request */ | |
| 26 | − | |
| 27 | −#define SDIOH_DATA_FIX 0 /* Fixed addressing */ | |
| 28 | −#define SDIOH_DATA_INC 1 /* Incremental addressing */ | |
| 29 | − | |
| 30 | −#define SDIOH_CMD_TYPE_NORMAL 0 /* Normal command */ | |
| 31 | −#define SDIOH_CMD_TYPE_APPEND 1 /* Append command */ | |
| 32 | −#define SDIOH_CMD_TYPE_CUTTHRU 2 /* Cut-through command */ | |
| 33 | − | |
| 34 | −#define SDIOH_DATA_PIO 0 /* PIO mode */ | |
| 35 | −#define SDIOH_DATA_DMA 1 /* DMA mode */ | |
| 36 | − | |
| 37 | −typedef int SDIOH_API_RC; | |
| 38 | − | |
| 39 | −/* SDio Host structure */ | |
| 40 | −typedef struct sdioh_info sdioh_info_t; | |
| 41 | − | |
| 42 | −/* callback function, taking one arg */ | |
| 43 | −typedef void (*sdioh_cb_fn_t) (void *); | |
| 44 | − | |
| 45 | −/* attach, return handler on success, NULL if failed. | |
| 46 | − * The handler shall be provided by all subsequent calls. No local cache | |
| 47 | − * cfghdl points to the starting address of pci device mapped memory | |
| 48 | − */ | |
| 49 | −extern sdioh_info_t *sdioh_attach(void *cfghdl, uint irq); | |
| 50 | −extern SDIOH_API_RC sdioh_detach(sdioh_info_t *si); | |
| 51 | −extern SDIOH_API_RC sdioh_interrupt_register(sdioh_info_t *si, | |
| 52 | − sdioh_cb_fn_t fn, void *argh); | |
| 53 | −extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *si); | |
| 54 | − | |
| 55 | −/* query whether SD interrupt is enabled or not */ | |
| 56 | −extern SDIOH_API_RC sdioh_interrupt_query(sdioh_info_t *si, bool *onoff); | |
| 57 | − | |
| 58 | −/* enable or disable SD interrupt */ | |
| 59 | −extern SDIOH_API_RC sdioh_interrupt_set(sdioh_info_t *si, bool enable_disable); | |
| 60 | − | |
| 61 | −#if defined(DHD_DEBUG) | |
| 62 | −extern bool sdioh_interrupt_pending(sdioh_info_t *si); | |
| 63 | −#endif | |
| 64 | − | |
| 65 | −extern int sdioh_claim_host_and_lock(sdioh_info_t *si); | |
| 66 | −extern int sdioh_release_host_and_unlock(sdioh_info_t *si); | |
| 67 | − | |
| 68 | −/* read or write one byte using cmd52 */ | |
| 69 | −extern SDIOH_API_RC sdioh_request_byte(sdioh_info_t *si, uint rw, uint fnc, | |
| 70 | − uint addr, u8 *byte); | |
| 71 | − | |
| 72 | −/* read or write 2/4 bytes using cmd53 */ | |
| 73 | −extern SDIOH_API_RC sdioh_request_word(sdioh_info_t *si, uint cmd_type, | |
| 74 | − uint rw, uint fnc, uint addr, | |
| 75 | − u32 *word, uint nbyte); | |
| 76 | − | |
| 77 | −/* read or write any buffer using cmd53 */ | |
| 78 | −extern SDIOH_API_RC sdioh_request_buffer(sdioh_info_t *si, uint pio_dma, | |
| 79 | − uint fix_inc, uint rw, uint fnc_num, | |
| 80 | − u32 addr, uint regwidth, | |
| 81 | − u32 buflen, u8 *buffer, | |
| 82 | − struct sk_buff *pkt); | |
| 83 | − | |
| 84 | −/* get cis data */ | |
| 85 | −extern SDIOH_API_RC sdioh_cis_read(sdioh_info_t *si, uint fuc, u8 *cis, | |
| 86 | − u32 length); | |
| 87 | − | |
| 88 | −extern SDIOH_API_RC sdioh_cfg_read(sdioh_info_t *si, uint fuc, u32 addr, | |
| 89 | − u8 *data); | |
| 90 | −extern SDIOH_API_RC sdioh_cfg_write(sdioh_info_t *si, uint fuc, u32 addr, | |
| 91 | − u8 *data); | |
| 92 | − | |
| 93 | −/* query number of io functions */ | |
| 94 | −extern uint sdioh_query_iofnum(sdioh_info_t *si); | |
| 95 | − | |
| 96 | −/* handle iovars */ | |
| 97 | −extern int sdioh_iovar_op(sdioh_info_t *si, const char *name, | |
| 98 | − void *params, int plen, void *arg, int len, bool set); | |
| 99 | − | |
| 100 | −/* Issue abort to the specified function and clear controller as needed */ | |
| 101 | −extern int sdioh_abort(sdioh_info_t *si, uint fnc); | |
| 102 | − | |
| 103 | −/* Start and Stop SDIO without re-enumerating the SD card. */ | |
| 104 | −extern int sdioh_start(sdioh_info_t *si, int stage); | |
| 105 | −extern int sdioh_stop(sdioh_info_t *si); | |
| 106 | − | |
| 107 | −/* Reset and re-initialize the device */ | |
| 108 | −extern int sdioh_sdio_reset(sdioh_info_t *si); | |
| 109 | − | |
| 110 | −/* Helper function */ | |
| 111 | −void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh); | |
| 112 | − | |
| 113 | −#endif /* _sdio_api_h_ */ | |
| @@ -13,29 +13,59 @@ · 12 unmodified lines | ||
| 13 | 13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 14 | 14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | 15 | */ |
| 16 | −/* ****************** BCMSDH Interface Functions *************************** */ | |
| 16 | +/* ****************** SDIO CARD Interface Functions **************************/ | |
| 17 | 17 | |
| 18 | 18 | #include <linux/types.h> |
| 19 | 19 | #include <linux/netdevice.h> |
| 20 | +#include <linux/pci.h> | |
| 20 | 21 | #include <linux/pci_ids.h> |
| 21 | −#include <bcmdefs.h> | |
| 22 | −#include <bcmdevs.h> | |
| 23 | −#include <bcmutils.h> | |
| 24 | −#include <hndsoc.h> | |
| 25 | − | |
| 26 | −#include <bcmsdh.h> /* BRCM API for SDIO | |
| 27 | − clients (such as wl, dhd) */ | |
| 28 | −#include <bcmsdbus.h> /* common SDIO/controller interface */ | |
| 29 | −#include <sbsdio.h> /* BRCM sdio device core */ | |
| 30 | − | |
| 31 | −#include <sdio.h> /* sdio spec */ | |
| 32 | −#include "dngl_stats.h" | |
| 22 | +#include <linux/sched.h> | |
| 23 | +#include <linux/completion.h> | |
| 24 | + | |
| 25 | +#include <defs.h> | |
| 26 | +#include <brcm_hw_ids.h> | |
| 27 | +#include <brcmu_utils.h> | |
| 28 | +#include <brcmu_wifi.h> | |
| 29 | +#include <soc.h> | |
| 33 | 30 | #include "dhd.h" |
| 31 | +#include "dhd_bus.h" | |
| 32 | +#include "sdio_host.h" | |
| 34 | 33 | |
| 35 | 34 | #define SDIOH_API_ACCESS_RETRY_LIMIT 2 |
| 36 | −const uint bcmsdh_msglevel = BCMSDH_ERROR_VAL; | |
| 37 | 35 | |
| 38 | −struct bcmsdh_info { | |
| 36 | +#define BRCMF_SD_ERROR_VAL 0x0001 /* Error */ | |
| 37 | +#define BRCMF_SD_INFO_VAL 0x0002 /* Info */ | |
| 38 | + | |
| 39 | + | |
| 40 | +#ifdef BCMDBG | |
| 41 | +#define BRCMF_SD_ERROR(x) \ | |
| 42 | + do { \ | |
| 43 | + if ((brcmf_sdio_msglevel & BRCMF_SD_ERROR_VAL) && \ | |
| 44 | + net_ratelimit()) \ | |
| 45 | + printk x; \ | |
| 46 | + } while (0) | |
| 47 | +#define BRCMF_SD_INFO(x) \ | |
| 48 | + do { \ | |
| 49 | + if ((brcmf_sdio_msglevel & BRCMF_SD_INFO_VAL) && \ | |
| 50 | + net_ratelimit()) \ | |
| 51 | + printk x; \ | |
| 52 | + } while (0) | |
| 53 | +#else /* BCMDBG */ | |
| 54 | +#define BRCMF_SD_ERROR(x) | |
| 55 | +#define BRCMF_SD_INFO(x) | |
| 56 | +#endif /* BCMDBG */ | |
| 57 | + | |
| 58 | +/* debugging macros */ | |
| 59 | +#define SDLX_MSG(x) | |
| 60 | + | |
| 61 | +#define SDIOH_CMD_TYPE_NORMAL 0 /* Normal command */ | |
| 62 | +#define SDIOH_CMD_TYPE_APPEND 1 /* Append command */ | |
| 63 | +#define SDIOH_CMD_TYPE_CUTTHRU 2 /* Cut-through command */ | |
| 64 | + | |
| 65 | +#define SDIOH_DATA_PIO 0 /* PIO mode */ | |
| 66 | +#define SDIOH_DATA_DMA 1 /* DMA mode */ | |
| 67 | + | |
| 68 | +struct brcmf_sdio_card { | |
| 39 | 69 | bool init_success; /* underlying driver successfully attached */ |
| 40 | 70 | void *sdioh; /* handler for sdioh */ |
| 41 | 71 | u32 vendevid; /* Target Vendor and Device ID on SD bus */ |
| @@ -43,282 +73,232 @@ struct bcmsdh_info { · 1 unmodified line | ||
| 43 | 73 | reg_read/reg_write call */ |
| 44 | 74 | u32 sbwad; /* Save backplane window address */ |
| 45 | 75 | }; |
| 76 | + | |
| 77 | +/** | |
| 78 | + * SDIO Host Controller info | |
| 79 | + */ | |
| 80 | +struct sdio_hc { | |
| 81 | + struct sdio_hc *next; | |
| 82 | + struct device *dev; /* platform device handle */ | |
| 83 | + void *regs; /* SDIO Host Controller address */ | |
| 84 | + struct brcmf_sdio_card *card; | |
| 85 | + void *ch; | |
| 86 | + unsigned int oob_irq; | |
| 87 | + unsigned long oob_flags; /* OOB Host specifiction | |
| 88 | + as edge and etc */ | |
| 89 | + bool oob_irq_registered; | |
| 90 | +}; | |
| 91 | + | |
| 46 | 92 | /* local copy of bcm sd handler */ |
| 47 | −bcmsdh_info_t *l_bcmsdh; | |
| 93 | +static struct brcmf_sdio_card *l_card; | |
| 48 | 94 | |
| 49 | −#if defined(OOB_INTR_ONLY) && defined(HW_OOB) | |
| 50 | −extern int sdioh_enable_hw_oob_intr(void *sdioh, bool enable); | |
| 95 | +const uint brcmf_sdio_msglevel = BRCMF_SD_ERROR_VAL; | |
| 51 | 96 | |
| 52 | −void bcmsdh_enable_hw_oob_intr(bcmsdh_info_t *sdh, bool enable) | |
| 53 | −{ | |
| 54 | − sdioh_enable_hw_oob_intr(sdh->sdioh, enable); | |
| 55 | −} | |
| 56 | −#endif | |
| 97 | +static struct sdio_hc *sdhcinfo; | |
| 98 | + | |
| 99 | +/* driver info, initialized when brcmf_sdio_register is called */ | |
| 100 | +static struct brcmf_sdioh_driver drvinfo = { NULL, NULL }; | |
| 101 | + | |
| 102 | +/* Module parameters specific to each host-controller driver */ | |
| 103 | + | |
| 104 | +module_param(sd_msglevel, uint, 0); | |
| 57 | 105 | |
| 58 | −bcmsdh_info_t *bcmsdh_attach(void *cfghdl, void **regsva, uint irq) | |
| 106 | +extern uint sd_f2_blocksize; | |
| 107 | +module_param(sd_f2_blocksize, int, 0); | |
| 108 | + | |
| 109 | +/* forward declarations */ | |
| 110 | +int brcmf_sdio_probe(struct device *dev); | |
| 111 | +EXPORT_SYMBOL(brcmf_sdio_probe); | |
| 112 | + | |
| 113 | +int brcmf_sdio_remove(struct device *dev); | |
| 114 | +EXPORT_SYMBOL(brcmf_sdio_remove); | |
| 115 | + | |
| 116 | +struct brcmf_sdio_card* | |
| 117 | +brcmf_sdcard_attach(void *cfghdl, u32 *regsva, uint irq) | |
| 59 | 118 | { |
| 60 | − bcmsdh_info_t *bcmsdh; | |
| 119 | + struct brcmf_sdio_card *card; | |
| 61 | 120 | |
| 62 | − bcmsdh = kzalloc(sizeof(bcmsdh_info_t), GFP_ATOMIC); | |
| 63 | − if (bcmsdh == NULL) { | |
| 64 | − BCMSDH_ERROR(("bcmsdh_attach: out of memory")); | |
| 121 | + card = kzalloc(sizeof(struct brcmf_sdio_card), GFP_ATOMIC); | |
| 122 | + if (card == NULL) { | |
| 123 | + BRCMF_SD_ERROR(("sdcard_attach: out of memory")); | |
| 65 | 124 | return NULL; |
| 66 | 125 | } |
| 67 | 126 | |
| 68 | 127 | /* save the handler locally */ |
| 69 | − l_bcmsdh = bcmsdh; | |
| 128 | + l_card = card; | |
| 70 | 129 | |
| 71 | − bcmsdh->sdioh = sdioh_attach(cfghdl, irq); | |
| 72 | − if (!bcmsdh->sdioh) { | |
| 73 | − bcmsdh_detach(bcmsdh); | |
| 130 | + card->sdioh = brcmf_sdioh_attach(cfghdl, irq); | |
| 131 | + if (!card->sdioh) { | |
| 132 | + brcmf_sdcard_detach(card); | |
| 74 | 133 | return NULL; |
| 75 | 134 | } |
| 76 | 135 | |
| 77 | − bcmsdh->init_success = true; | |
| 136 | + card->init_success = true; | |
| 78 | 137 | |
| 79 | − *regsva = (u32 *) SI_ENUM_BASE; | |
| 138 | + *regsva = SI_ENUM_BASE; | |
| 80 | 139 | |
| 81 | 140 | /* Report the BAR, to fix if needed */ |
| 82 | − bcmsdh->sbwad = SI_ENUM_BASE; | |
| 83 | − return bcmsdh; | |
| 141 | + card->sbwad = SI_ENUM_BASE; | |
| 142 | + return card; | |
| 84 | 143 | } |
| 85 | 144 | |
| 86 | −int bcmsdh_detach(void *sdh) | |
| 145 | +int brcmf_sdcard_detach(struct brcmf_sdio_card *card) | |
| 87 | 146 | { |
| 88 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 89 | − | |
| 90 | − if (bcmsdh != NULL) { | |
| 91 | − if (bcmsdh->sdioh) { | |
| 92 | − sdioh_detach(bcmsdh->sdioh); | |
| 93 | − bcmsdh->sdioh = NULL; | |
| 147 | + if (card != NULL) { | |
| 148 | + if (card->sdioh) { | |
| 149 | + brcmf_sdioh_detach(card->sdioh); | |
| 150 | + card->sdioh = NULL; | |
| 94 | 151 | } |
| 95 | − kfree(bcmsdh); | |
| 152 | + kfree(card); | |
| 96 | 153 | } |
| 97 | 154 | |
| 98 | − l_bcmsdh = NULL; | |
| 155 | + l_card = NULL; | |
| 99 | 156 | return 0; |
| 100 | 157 | } |
| 101 | 158 | |
| 102 | 159 | int |
| 103 | −bcmsdh_iovar_op(void *sdh, const char *name, | |
| 160 | +brcmf_sdcard_iovar_op(struct brcmf_sdio_card *card, const char *name, | |
| 104 | 161 | void *params, int plen, void *arg, int len, bool set) |
| 105 | 162 | { |
| 106 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 107 | − return sdioh_iovar_op(bcmsdh->sdioh, name, params, plen, arg, len, set); | |
| 108 | −} | |
| 109 | − | |
| 110 | −bool bcmsdh_intr_query(void *sdh) | |
| 111 | −{ | |
| 112 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 113 | − SDIOH_API_RC status; | |
| 114 | − bool on; | |
| 115 | − | |
| 116 | − ASSERT(bcmsdh); | |
| 117 | − status = sdioh_interrupt_query(bcmsdh->sdioh, &on); | |
| 118 | − if (SDIOH_API_SUCCESS(status)) | |
| 119 | − return false; | |
| 120 | − else | |
| 121 | − return on; | |
| 122 | −} | |
| 123 | − | |
| 124 | −int bcmsdh_intr_enable(void *sdh) | |
| 125 | −{ | |
| 126 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 127 | − SDIOH_API_RC status; | |
| 128 | − ASSERT(bcmsdh); | |
| 129 | − | |
| 130 | − status = sdioh_interrupt_set(bcmsdh->sdioh, true); | |
| 131 | − return SDIOH_API_SUCCESS(status) ? 0 : -EIO; | |
| 163 | + return brcmf_sdioh_iovar_op(card->sdioh, name, params, plen, arg, | |
| 164 | + len, set); | |
| 132 | 165 | } |
| 133 | 166 | |
| 134 | −int bcmsdh_intr_disable(void *sdh) | |
| 167 | +int brcmf_sdcard_intr_enable(struct brcmf_sdio_card *card) | |
| 135 | 168 | { |
| 136 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 137 | − SDIOH_API_RC status; | |
| 138 | − ASSERT(bcmsdh); | |
| 139 | − | |
| 140 | − status = sdioh_interrupt_set(bcmsdh->sdioh, false); | |
| 141 | − return SDIOH_API_SUCCESS(status) ? 0 : -EIO; | |
| 169 | + return brcmf_sdioh_interrupt_set(card->sdioh, true); | |
| 142 | 170 | } |
| 143 | 171 | |
| 144 | −int bcmsdh_intr_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh) | |
| 172 | +int brcmf_sdcard_intr_disable(struct brcmf_sdio_card *card) | |
| 145 | 173 | { |
| 146 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 147 | − SDIOH_API_RC status; | |
| 148 | − ASSERT(bcmsdh); | |
| 149 | − | |
| 150 | − status = sdioh_interrupt_register(bcmsdh->sdioh, fn, argh); | |
| 151 | − return SDIOH_API_SUCCESS(status) ? 0 : -EIO; | |
| 174 | + return brcmf_sdioh_interrupt_set(card->sdioh, false); | |
| 152 | 175 | } |
| 153 | 176 | |
| 154 | −int bcmsdh_intr_dereg(void *sdh) | |
| 177 | +int brcmf_sdcard_intr_reg(struct brcmf_sdio_card *card, | |
| 178 | + void (*fn)(void *), void *argh) | |
| 155 | 179 | { |
| 156 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 157 | − SDIOH_API_RC status; | |
| 158 | − ASSERT(bcmsdh); | |
| 159 | − | |
| 160 | − status = sdioh_interrupt_deregister(bcmsdh->sdioh); | |
| 161 | − return SDIOH_API_SUCCESS(status) ? 0 : -EIO; | |
| 180 | + return brcmf_sdioh_interrupt_register(card->sdioh, fn, argh); | |
| 162 | 181 | } |
| 163 | 182 | |
| 164 | −#if defined(DHD_DEBUG) | |
| 165 | −bool bcmsdh_intr_pending(void *sdh) | |
| 183 | +int brcmf_sdcard_intr_dereg(struct brcmf_sdio_card *card) | |
| 166 | 184 | { |
| 167 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 168 | − | |
| 169 | − ASSERT(sdh); | |
| 170 | − return sdioh_interrupt_pending(bcmsdh->sdioh); | |
| 185 | + return brcmf_sdioh_interrupt_deregister(card->sdioh); | |
| 171 | 186 | } |
| 172 | −#endif | |
| 173 | 187 | |
| 174 | −int bcmsdh_devremove_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh) | |
| 188 | +u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint fnc_num, u32 addr, | |
| 189 | + int *err) | |
| 175 | 190 | { |
| 176 | − ASSERT(sdh); | |
| 177 | − | |
| 178 | − /* don't support yet */ | |
| 179 | − return -ENOTSUPP; | |
| 180 | −} | |
| 181 | − | |
| 182 | −u8 bcmsdh_cfg_read(void *sdh, uint fnc_num, u32 addr, int *err) | |
| 183 | −{ | |
| 184 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 185 | − SDIOH_API_RC status; | |
| 186 | −#ifdef SDIOH_API_ACCESS_RETRY_LIMIT | |
| 191 | + int status; | |
| 187 | 192 | s32 retry = 0; |
| 188 | −#endif | |
| 189 | 193 | u8 data = 0; |
| 190 | 194 | |
| 191 | − if (!bcmsdh) | |
| 192 | − bcmsdh = l_bcmsdh; | |
| 193 | − | |
| 194 | − ASSERT(bcmsdh->init_success); | |
| 195 | + if (!card) | |
| 196 | + card = l_card; | |
| 195 | 197 | |
| 196 | −#ifdef SDIOH_API_ACCESS_RETRY_LIMIT | |
| 197 | 198 | do { |
| 198 | 199 | if (retry) /* wait for 1 ms till bus get settled down */ |
| 199 | 200 | udelay(1000); |
| 200 | −#endif | |
| 201 | 201 | status = |
| 202 | − sdioh_cfg_read(bcmsdh->sdioh, fnc_num, addr, | |
| 202 | + brcmf_sdioh_cfg_read(card->sdioh, fnc_num, addr, | |
| 203 | 203 | (u8 *) &data); |
| 204 | −#ifdef SDIOH_API_ACCESS_RETRY_LIMIT | |
| 205 | − } while (!SDIOH_API_SUCCESS(status) | |
| 204 | + } while (status != 0 | |
| 206 | 205 | && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT)); |
| 207 | −#endif | |
| 208 | 206 | if (err) |
| 209 | − *err = (SDIOH_API_SUCCESS(status) ? 0 : -EIO); | |
| 207 | + *err = status; | |
| 210 | 208 | |
| 211 | − BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u8data = 0x%x\n", | |
| 209 | + BRCMF_SD_INFO(("%s:fun = %d, addr = 0x%x, u8data = 0x%x\n", | |
| 212 | 210 | __func__, fnc_num, addr, data)); |
| 213 | 211 | |
| 214 | 212 | return data; |
| 215 | 213 | } |
| 216 | 214 | |
| 217 | 215 | void |
| 218 | −bcmsdh_cfg_write(void *sdh, uint fnc_num, u32 addr, u8 data, int *err) | |
| 216 | +brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint fnc_num, u32 addr, | |
| 217 | + u8 data, int *err) | |
| 219 | 218 | { |
| 220 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 221 | − SDIOH_API_RC status; | |
| 222 | −#ifdef SDIOH_API_ACCESS_RETRY_LIMIT | |
| 219 | + int status; | |
| 223 | 220 | s32 retry = 0; |
| 224 | −#endif | |
| 225 | 221 | |
| 226 | − if (!bcmsdh) | |
| 227 | − bcmsdh = l_bcmsdh; | |
| 222 | + if (!card) | |
| 223 | + card = l_card; | |
| 228 | 224 | |
| 229 | − ASSERT(bcmsdh->init_success); | |
| 230 | − | |
| 231 | −#ifdef SDIOH_API_ACCESS_RETRY_LIMIT | |
| 232 | 225 | do { |
| 233 | 226 | if (retry) /* wait for 1 ms till bus get settled down */ |
| 234 | 227 | udelay(1000); |
| 235 | −#endif | |
| 236 | 228 | status = |
| 237 | − sdioh_cfg_write(bcmsdh->sdioh, fnc_num, addr, | |
| 229 | + brcmf_sdioh_cfg_write(card->sdioh, fnc_num, addr, | |
| 238 | 230 | (u8 *) &data); |
| 239 | −#ifdef SDIOH_API_ACCESS_RETRY_LIMIT | |
| 240 | − } while (!SDIOH_API_SUCCESS(status) | |
| 231 | + } while (status != 0 | |
| 241 | 232 | && (retry++ < SDIOH_API_ACCESS_RETRY_LIMIT)); |
| 242 | −#endif | |
| 243 | 233 | if (err) |
| 244 | − *err = SDIOH_API_SUCCESS(status) ? 0 : -EIO; | |
| 234 | + *err = status; | |
| 245 | 235 | |
| 246 | − BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u8data = 0x%x\n", | |
| 236 | + BRCMF_SD_INFO(("%s:fun = %d, addr = 0x%x, u8data = 0x%x\n", | |
| 247 | 237 | __func__, fnc_num, addr, data)); |
| 248 | 238 | } |
| 249 | 239 | |
| 250 | −u32 bcmsdh_cfg_read_word(void *sdh, uint fnc_num, u32 addr, int *err) | |
| 240 | +u32 brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num, | |
| 241 | + u32 addr, int *err) | |
| 251 | 242 | { |
| 252 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 253 | − SDIOH_API_RC status; | |
| 243 | + int status; | |
| 254 | 244 | u32 data = 0; |
| 255 | 245 | |
| 256 | − if (!bcmsdh) | |
| 257 | − bcmsdh = l_bcmsdh; | |
| 258 | − | |
| 259 | − ASSERT(bcmsdh->init_success); | |
| 246 | + if (!card) | |
| 247 | + card = l_card; | |
| 260 | 248 | |
| 261 | − status = | |
| 262 | − sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, SDIOH_READ, | |
| 263 | − fnc_num, addr, &data, 4); | |
| 249 | + status = brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL, | |
| 250 | + SDIOH_READ, fnc_num, addr, &data, 4); | |
| 264 | 251 | |
| 265 | 252 | if (err) |
| 266 | − *err = (SDIOH_API_SUCCESS(status) ? 0 : -EIO); | |
| 253 | + *err = status; | |
| 267 | 254 | |
| 268 | − BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n", | |
| 255 | + BRCMF_SD_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n", | |
| 269 | 256 | __func__, fnc_num, addr, data)); |
| 270 | 257 | |
| 271 | 258 | return data; |
| 272 | 259 | } |
| 273 | 260 | |
| 274 | 261 | void |
| 275 | −bcmsdh_cfg_write_word(void *sdh, uint fnc_num, u32 addr, u32 data, | |
| 276 | − int *err) | |
| 262 | +brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card, uint fnc_num, | |
| 263 | + u32 addr, u32 data, int *err) | |
| 277 | 264 | { |
| 278 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 279 | − SDIOH_API_RC status; | |
| 280 | − | |
| 281 | − if (!bcmsdh) | |
| 282 | − bcmsdh = l_bcmsdh; | |
| 265 | + int status; | |
| 283 | 266 | |
| 284 | − ASSERT(bcmsdh->init_success); | |
| 267 | + if (!card) | |
| 268 | + card = l_card; | |
| 285 | 269 | |
| 286 | 270 | status = |
| 287 | − sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, | |
| 271 | + brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL, | |
| 288 | 272 | SDIOH_WRITE, fnc_num, addr, &data, 4); |
| 289 | 273 | |
| 290 | 274 | if (err) |
| 291 | − *err = (SDIOH_API_SUCCESS(status) ? 0 : -EIO); | |
| 275 | + *err = status; | |
| 292 | 276 | |
| 293 | − BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n", | |
| 277 | + BRCMF_SD_INFO(("%s:fun = %d, addr = 0x%x, u32data = 0x%x\n", | |
| 294 | 278 | __func__, fnc_num, addr, data)); |
| 295 | 279 | } |
| 296 | 280 | |
| 297 | −int bcmsdh_cis_read(void *sdh, uint func, u8 * cis, uint length) | |
| 281 | +int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, u8 * cis, | |
| 282 | + uint length) | |
| 298 | 283 | { |
| 299 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 300 | − SDIOH_API_RC status; | |
| 284 | + int status; | |
| 301 | 285 | |
| 302 | 286 | u8 *tmp_buf, *tmp_ptr; |
| 303 | 287 | u8 *ptr; |
| 304 | 288 | bool ascii = func & ~0xf; |
| 305 | 289 | func &= 0x7; |
| 306 | 290 | |
| 307 | − if (!bcmsdh) | |
| 308 | − bcmsdh = l_bcmsdh; | |
| 291 | + if (!card) | |
| 292 | + card = l_card; | |
| 309 | 293 | |
| 310 | − ASSERT(bcmsdh->init_success); | |
| 311 | − ASSERT(cis); | |
| 312 | − ASSERT(length <= SBSDIO_CIS_SIZE_LIMIT); | |
| 313 | − | |
| 314 | − status = sdioh_cis_read(bcmsdh->sdioh, func, cis, length); | |
| 294 | + status = brcmf_sdioh_cis_read(card->sdioh, func, cis, length); | |
| 315 | 295 | |
| 316 | 296 | if (ascii) { |
| 317 | 297 | /* Move binary bits to tmp and format them |
| 318 | 298 | into the provided buffer. */ |
| 319 | 299 | tmp_buf = kmalloc(length, GFP_ATOMIC); |
| 320 | 300 | if (tmp_buf == NULL) { |
| 321 | − BCMSDH_ERROR(("%s: out of memory\n", __func__)); | |
| 301 | + BRCMF_SD_ERROR(("%s: out of memory\n", __func__)); | |
| 322 | 302 | return -ENOMEM; |
| 323 | 303 | } |
| 324 | 304 | memcpy(tmp_buf, cis, length); |
| @@ -331,60 +311,60 @@ int bcmsdh_cis_read(void *sdh, uint func, u8 * cis, uint length) · 6 unmodified lines | ||
| 331 | 311 | kfree(tmp_buf); |
| 332 | 312 | } |
| 333 | 313 | |
| 334 | − return SDIOH_API_SUCCESS(status) ? 0 : -EIO; | |
| 314 | + return status; | |
| 335 | 315 | } |
| 336 | 316 | |
| 337 | −static int bcmsdhsdio_set_sbaddr_window(void *sdh, u32 address) | |
| 317 | +static int | |
| 318 | +brcmf_sdcard_set_sbaddr_window(struct brcmf_sdio_card *card, u32 address) | |
| 338 | 319 | { |
| 339 | 320 | int err = 0; |
| 340 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 341 | − bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW, | |
| 321 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW, | |
| 342 | 322 | (address >> 8) & SBSDIO_SBADDRLOW_MASK, &err); |
| 343 | 323 | if (!err) |
| 344 | − bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRMID, | |
| 345 | − (address >> 16) & SBSDIO_SBADDRMID_MASK, &err); | |
| 324 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, | |
| 325 | + SBSDIO_FUNC1_SBADDRMID, | |
| 326 | + (address >> 16) & SBSDIO_SBADDRMID_MASK, | |
| 327 | + &err); | |
| 346 | 328 | if (!err) |
| 347 | − bcmsdh_cfg_write(bcmsdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRHIGH, | |
| 348 | − (address >> 24) & SBSDIO_SBADDRHIGH_MASK, | |
| 349 | − &err); | |
| 329 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, | |
| 330 | + SBSDIO_FUNC1_SBADDRHIGH, | |
| 331 | + (address >> 24) & SBSDIO_SBADDRHIGH_MASK, | |
| 332 | + &err); | |
| 350 | 333 | |
| 351 | 334 | return err; |
| 352 | 335 | } |
| 353 | 336 | |
| 354 | −u32 bcmsdh_reg_read(void *sdh, u32 addr, uint size) | |
| 337 | +u32 brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size) | |
| 355 | 338 | { |
| 356 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 357 | − SDIOH_API_RC status; | |
| 339 | + int status; | |
| 358 | 340 | u32 word = 0; |
| 359 | 341 | uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK; |
| 360 | 342 | |
| 361 | − BCMSDH_INFO(("%s:fun = 1, addr = 0x%x, ", __func__, addr)); | |
| 362 | − | |
| 363 | − if (!bcmsdh) | |
| 364 | − bcmsdh = l_bcmsdh; | |
| 343 | + BRCMF_SD_INFO(("%s:fun = 1, addr = 0x%x, ", __func__, addr)); | |
| 365 | 344 | |
| 366 | − ASSERT(bcmsdh->init_success); | |
| 345 | + if (!card) | |
| 346 | + card = l_card; | |
| 367 | 347 | |
| 368 | − if (bar0 != bcmsdh->sbwad) { | |
| 369 | − if (bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0)) | |
| 348 | + if (bar0 != card->sbwad) { | |
| 349 | + if (brcmf_sdcard_set_sbaddr_window(card, bar0)) | |
| 370 | 350 | return 0xFFFFFFFF; |
| 371 | 351 | |
| 372 | − bcmsdh->sbwad = bar0; | |
| 352 | + card->sbwad = bar0; | |
| 373 | 353 | } |
| 374 | 354 | |
| 375 | 355 | addr &= SBSDIO_SB_OFT_ADDR_MASK; |
| 376 | 356 | if (size == 4) |
| 377 | 357 | addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; |
| 378 | 358 | |
| 379 | − status = sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, | |
| 359 | + status = brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL, | |
| 380 | 360 | SDIOH_READ, SDIO_FUNC_1, addr, &word, size); |
| 381 | 361 | |
| 382 | − bcmsdh->regfail = !(SDIOH_API_SUCCESS(status)); | |
| 362 | + card->regfail = (status != 0); | |
| 383 | 363 | |
| 384 | − BCMSDH_INFO(("u32data = 0x%x\n", word)); | |
| 364 | + BRCMF_SD_INFO(("u32data = 0x%x\n", word)); | |
| 385 | 365 | |
| 386 | 366 | /* if ok, return appropriately masked word */ |
| 387 | − if (SDIOH_API_SUCCESS(status)) { | |
| 367 | + if (status == 0) { | |
| 388 | 368 | switch (size) { |
| 389 | 369 | case sizeof(u8): |
| 390 | 370 | return word & 0xff; |
| @@ -393,90 +373,86 @@ u32 bcmsdh_reg_read(void *sdh, u32 addr, uint size) · 2 unmodified lines | ||
| 393 | 373 | case sizeof(u32): |
| 394 | 374 | return word; |
| 395 | 375 | default: |
| 396 | − bcmsdh->regfail = true; | |
| 376 | + card->regfail = true; | |
| 397 | 377 | |
| 398 | 378 | } |
| 399 | 379 | } |
| 400 | 380 | |
| 401 | 381 | /* otherwise, bad sdio access or invalid size */ |
| 402 | − BCMSDH_ERROR(("%s: error reading addr 0x%04x size %d\n", __func__, | |
| 382 | + BRCMF_SD_ERROR(("%s: error reading addr 0x%04x size %d\n", __func__, | |
| 403 | 383 | addr, size)); |
| 404 | 384 | return 0xFFFFFFFF; |
| 405 | 385 | } |
| 406 | 386 | |
| 407 | −u32 bcmsdh_reg_write(void *sdh, u32 addr, uint size, u32 data) | |
| 387 | +u32 brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size, | |
| 388 | + u32 data) | |
| 408 | 389 | { |
| 409 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 410 | − SDIOH_API_RC status; | |
| 390 | + int status; | |
| 411 | 391 | uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK; |
| 412 | 392 | int err = 0; |
| 413 | 393 | |
| 414 | − BCMSDH_INFO(("%s:fun = 1, addr = 0x%x, uint%ddata = 0x%x\n", | |
| 394 | + BRCMF_SD_INFO(("%s:fun = 1, addr = 0x%x, uint%ddata = 0x%x\n", | |
| 415 | 395 | __func__, addr, size * 8, data)); |
| 416 | 396 | |
| 417 | − if (!bcmsdh) | |
| 418 | − bcmsdh = l_bcmsdh; | |
| 419 | − | |
| 420 | − ASSERT(bcmsdh->init_success); | |
| 397 | + if (!card) | |
| 398 | + card = l_card; | |
| 421 | 399 | |
| 422 | − if (bar0 != bcmsdh->sbwad) { | |
| 423 | − err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0); | |
| 400 | + if (bar0 != card->sbwad) { | |
| 401 | + err = brcmf_sdcard_set_sbaddr_window(card, bar0); | |
| 424 | 402 | if (err) |
| 425 | 403 | return err; |
| 426 | 404 | |
| 427 | − bcmsdh->sbwad = bar0; | |
| 405 | + card->sbwad = bar0; | |
| 428 | 406 | } |
| 429 | 407 | |
| 430 | 408 | addr &= SBSDIO_SB_OFT_ADDR_MASK; |
| 431 | 409 | if (size == 4) |
| 432 | 410 | addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; |
| 433 | 411 | status = |
| 434 | − sdioh_request_word(bcmsdh->sdioh, SDIOH_CMD_TYPE_NORMAL, | |
| 412 | + brcmf_sdioh_request_word(card->sdioh, SDIOH_CMD_TYPE_NORMAL, | |
| 435 | 413 | SDIOH_WRITE, SDIO_FUNC_1, addr, &data, size); |
| 436 | − bcmsdh->regfail = !(SDIOH_API_SUCCESS(status)); | |
| 414 | + card->regfail = (status != 0); | |
| 437 | 415 | |
| 438 | − if (SDIOH_API_SUCCESS(status)) | |
| 416 | + if (status == 0) | |
| 439 | 417 | return 0; |
| 440 | 418 | |
| 441 | − BCMSDH_ERROR(("%s: error writing 0x%08x to addr 0x%04x size %d\n", | |
| 419 | + BRCMF_SD_ERROR(("%s: error writing 0x%08x to addr 0x%04x size %d\n", | |
| 442 | 420 | __func__, data, addr, size)); |
| 443 | 421 | return 0xFFFFFFFF; |
| 444 | 422 | } |
| 445 | 423 | |
| 446 | −bool bcmsdh_regfail(void *sdh) | |
| 424 | +bool brcmf_sdcard_regfail(struct brcmf_sdio_card *card) | |
| 447 | 425 | { |
| 448 | − return ((bcmsdh_info_t *) sdh)->regfail; | |
| 426 | + return card->regfail; | |
| 449 | 427 | } |
| 450 | 428 | |
| 451 | 429 | int |
| 452 | −bcmsdh_recv_buf(void *sdh, u32 addr, uint fn, uint flags, | |
| 453 | − u8 *buf, uint nbytes, struct sk_buff *pkt, | |
| 454 | − bcmsdh_cmplt_fn_t complete, void *handle) | |
| 455 | −{ | |
| 456 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 457 | − SDIOH_API_RC status; | |
| 430 | +brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn, | |
| 431 | + uint flags, | |
| 432 | + u8 *buf, uint nbytes, struct sk_buff *pkt, | |
| 433 | + void (*complete)(void *handle, int status, | |
| 434 | + bool sync_waiting), | |
| 435 | + void *handle) | |
| 436 | +{ | |
| 437 | + int status; | |
| 458 | 438 | uint incr_fix; |
| 459 | 439 | uint width; |
| 460 | 440 | uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK; |
| 461 | 441 | int err = 0; |
| 462 | 442 | |
| 463 | − ASSERT(bcmsdh); | |
| 464 | − ASSERT(bcmsdh->init_success); | |
| 465 | − | |
| 466 | − BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n", | |
| 443 | + BRCMF_SD_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n", | |
| 467 | 444 | __func__, fn, addr, nbytes)); |
| 468 | 445 | |
| 469 | 446 | /* Async not implemented yet */ |
| 470 | − ASSERT(!(flags & SDIO_REQ_ASYNC)); | |
| 471 | 447 | if (flags & SDIO_REQ_ASYNC) |
| 472 | 448 | return -ENOTSUPP; |
| 473 | 449 | |
| 474 | − if (bar0 != bcmsdh->sbwad) { | |
| 475 | − err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0); | |
| 450 | + if (bar0 != card->sbwad) { | |
| 451 | + err = brcmf_sdcard_set_sbaddr_window(card, bar0); | |
| 476 | 452 | if (err) |
| 477 | 453 | return err; |
| 478 | 454 | |
| 479 | − bcmsdh->sbwad = bar0; | |
| 455 | + card->sbwad = bar0; | |
| 480 | 456 | } |
| 481 | 457 | |
| 482 | 458 | addr &= SBSDIO_SB_OFT_ADDR_MASK; |
| @@ -486,42 +462,37 @@ bcmsdh_recv_buf(void *sdh, u32 addr, uint fn, uint flags, · 3 unmodified lines | ||
| 486 | 462 | if (width == 4) |
| 487 | 463 | addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; |
| 488 | 464 | |
| 489 | − status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, incr_fix, | |
| 490 | − SDIOH_READ, fn, addr, width, nbytes, buf, | |
| 491 | − pkt); | |
| 465 | + status = brcmf_sdioh_request_buffer(card->sdioh, SDIOH_DATA_PIO, | |
| 466 | + incr_fix, SDIOH_READ, fn, addr, width, nbytes, buf, pkt); | |
| 492 | 467 | |
| 493 | − return SDIOH_API_SUCCESS(status) ? 0 : -EIO; | |
| 468 | + return status; | |
| 494 | 469 | } |
| 495 | 470 | |
| 496 | 471 | int |
| 497 | −bcmsdh_send_buf(void *sdh, u32 addr, uint fn, uint flags, | |
| 498 | − u8 *buf, uint nbytes, void *pkt, | |
| 499 | − bcmsdh_cmplt_fn_t complete, void *handle) | |
| 472 | +brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn, | |
| 473 | + uint flags, u8 *buf, uint nbytes, void *pkt, | |
| 474 | + void (*complete)(void *handle, int status, | |
| 475 | + bool sync_waiting), | |
| 476 | + void *handle) | |
| 500 | 477 | { |
| 501 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 502 | − SDIOH_API_RC status; | |
| 503 | 478 | uint incr_fix; |
| 504 | 479 | uint width; |
| 505 | 480 | uint bar0 = addr & ~SBSDIO_SB_OFT_ADDR_MASK; |
| 506 | 481 | int err = 0; |
| 507 | 482 | |
| 508 | − ASSERT(bcmsdh); | |
| 509 | − ASSERT(bcmsdh->init_success); | |
| 510 | − | |
| 511 | − BCMSDH_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n", | |
| 483 | + BRCMF_SD_INFO(("%s:fun = %d, addr = 0x%x, size = %d\n", | |
| 512 | 484 | __func__, fn, addr, nbytes)); |
| 513 | 485 | |
| 514 | 486 | /* Async not implemented yet */ |
| 515 | − ASSERT(!(flags & SDIO_REQ_ASYNC)); | |
| 516 | 487 | if (flags & SDIO_REQ_ASYNC) |
| 517 | 488 | return -ENOTSUPP; |
| 518 | 489 | |
| 519 | − if (bar0 != bcmsdh->sbwad) { | |
| 520 | − err = bcmsdhsdio_set_sbaddr_window(bcmsdh, bar0); | |
| 490 | + if (bar0 != card->sbwad) { | |
| 491 | + err = brcmf_sdcard_set_sbaddr_window(card, bar0); | |
| 521 | 492 | if (err) |
| 522 | 493 | return err; |
| 523 | 494 | |
| 524 | − bcmsdh->sbwad = bar0; | |
| 495 | + card->sbwad = bar0; | |
| 525 | 496 | } |
| 526 | 497 | |
| 527 | 498 | addr &= SBSDIO_SB_OFT_ADDR_MASK; |
| @@ -531,101 +502,141 @@ bcmsdh_send_buf(void *sdh, u32 addr, uint fn, uint flags, · 3 unmodified lines | ||
| 531 | 502 | if (width == 4) |
| 532 | 503 | addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; |
| 533 | 504 | |
| 534 | − status = sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, incr_fix, | |
| 535 | − SDIOH_WRITE, fn, addr, width, nbytes, buf, | |
| 536 | − pkt); | |
| 537 | − | |
| 538 | − return SDIOH_API_SUCCESS(status) ? 0 : -EIO; | |
| 505 | + return brcmf_sdioh_request_buffer(card->sdioh, SDIOH_DATA_PIO, | |
| 506 | + incr_fix, SDIOH_WRITE, fn, addr, width, nbytes, buf, pkt); | |
| 539 | 507 | } |
| 540 | 508 | |
| 541 | −int bcmsdh_rwdata(void *sdh, uint rw, u32 addr, u8 *buf, uint nbytes) | |
| 509 | +int brcmf_sdcard_rwdata(struct brcmf_sdio_card *card, uint rw, u32 addr, | |
| 510 | + u8 *buf, uint nbytes) | |
| 542 | 511 | { |
| 543 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 544 | − SDIOH_API_RC status; | |
| 545 | − | |
| 546 | − ASSERT(bcmsdh); | |
| 547 | − ASSERT(bcmsdh->init_success); | |
| 548 | − ASSERT((addr & SBSDIO_SBWINDOW_MASK) == 0); | |
| 549 | − | |
| 550 | 512 | addr &= SBSDIO_SB_OFT_ADDR_MASK; |
| 551 | 513 | addr |= SBSDIO_SB_ACCESS_2_4B_FLAG; |
| 552 | 514 | |
| 553 | − status = | |
| 554 | − sdioh_request_buffer(bcmsdh->sdioh, SDIOH_DATA_PIO, SDIOH_DATA_INC, | |
| 555 | − (rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1, | |
| 556 | − addr, 4, nbytes, buf, NULL); | |
| 557 | − | |
| 558 | − return SDIOH_API_SUCCESS(status) ? 0 : -EIO; | |
| 515 | + return brcmf_sdioh_request_buffer(card->sdioh, SDIOH_DATA_PIO, | |
| 516 | + SDIOH_DATA_INC, (rw ? SDIOH_WRITE : SDIOH_READ), SDIO_FUNC_1, | |
| 517 | + addr, 4, nbytes, buf, NULL); | |
| 559 | 518 | } |
| 560 | 519 | |
| 561 | −int bcmsdh_abort(void *sdh, uint fn) | |
| 520 | +int brcmf_sdcard_abort(struct brcmf_sdio_card *card, uint fn) | |
| 562 | 521 | { |
| 563 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 564 | − | |
| 565 | − return sdioh_abort(bcmsdh->sdioh, fn); | |
| 522 | + return brcmf_sdioh_abort(card->sdioh, fn); | |
| 566 | 523 | } |
| 567 | 524 | |
| 568 | −int bcmsdh_start(void *sdh, int stage) | |
| 525 | +int brcmf_sdcard_query_device(struct brcmf_sdio_card *card) | |
| 569 | 526 | { |
| 570 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 571 | − | |
| 572 | − return sdioh_start(bcmsdh->sdioh, stage); | |
| 527 | + card->vendevid = (PCI_VENDOR_ID_BROADCOM << 16) | 0; | |
| 528 | + return card->vendevid; | |
| 573 | 529 | } |
| 574 | 530 | |
| 575 | −int bcmsdh_stop(void *sdh) | |
| 531 | +u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card) | |
| 576 | 532 | { |
| 577 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 533 | + if (!card) | |
| 534 | + card = l_card; | |
| 578 | 535 | |
| 579 | − return sdioh_stop(bcmsdh->sdioh); | |
| 536 | + return card->sbwad; | |
| 580 | 537 | } |
| 581 | 538 | |
| 582 | −int bcmsdh_query_device(void *sdh) | |
| 539 | +int brcmf_sdio_probe(struct device *dev) | |
| 583 | 540 | { |
| 584 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 585 | − bcmsdh->vendevid = (PCI_VENDOR_ID_BROADCOM << 16) | 0; | |
| 586 | − return bcmsdh->vendevid; | |
| 587 | −} | |
| 541 | + struct sdio_hc *sdhc = NULL; | |
| 542 | + u32 regs = 0; | |
| 543 | + struct brcmf_sdio_card *card = NULL; | |
| 544 | + int irq = 0; | |
| 545 | + u32 vendevid; | |
| 546 | + unsigned long irq_flags = 0; | |
| 588 | 547 | |
| 589 | −uint bcmsdh_query_iofnum(void *sdh) | |
| 590 | −{ | |
| 591 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 548 | + /* allocate SDIO Host Controller state info */ | |
| 549 | + sdhc = kzalloc(sizeof(struct sdio_hc), GFP_ATOMIC); | |
| 550 | + if (!sdhc) { | |
| 551 | + SDLX_MSG(("%s: out of memory\n", __func__)); | |
| 552 | + goto err; | |
| 553 | + } | |
| 554 | + sdhc->dev = (void *)dev; | |
| 592 | 555 | |
| 593 | − if (!bcmsdh) | |
| 594 | − bcmsdh = l_bcmsdh; | |
| 556 | + card = brcmf_sdcard_attach((void *)0, ®s, irq); | |
| 557 | + if (!card) { | |
| 558 | + SDLX_MSG(("%s: attach failed\n", __func__)); | |
| 559 | + goto err; | |
| 560 | + } | |
| 595 | 561 | |
| 596 | − return sdioh_query_iofnum(bcmsdh->sdioh); | |
| 597 | −} | |
| 562 | + sdhc->card = card; | |
| 563 | + sdhc->oob_irq = irq; | |
| 564 | + sdhc->oob_flags = irq_flags; | |
| 565 | + sdhc->oob_irq_registered = false; /* to make sure.. */ | |
| 566 | + | |
| 567 | + /* chain SDIO Host Controller info together */ | |
| 568 | + sdhc->next = sdhcinfo; | |
| 569 | + sdhcinfo = sdhc; | |
| 570 | + /* Read the vendor/device ID from the CIS */ | |
| 571 | + vendevid = brcmf_sdcard_query_device(card); | |
| 572 | + | |
| 573 | + /* try to attach to the target device */ | |
| 574 | + sdhc->ch = drvinfo.attach((vendevid >> 16), (vendevid & 0xFFFF), | |
| 575 | + 0, 0, 0, 0, regs, card); | |
| 576 | + if (!sdhc->ch) { | |
| 577 | + SDLX_MSG(("%s: device attach failed\n", __func__)); | |
| 578 | + goto err; | |
| 579 | + } | |
| 598 | 580 | |
| 599 | −int bcmsdh_reset(bcmsdh_info_t *sdh) | |
| 600 | −{ | |
| 601 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 581 | + return 0; | |
| 602 | 582 | |
| 603 | − return sdioh_sdio_reset(bcmsdh->sdioh); | |
| 604 | −} | |
| 583 | + /* error handling */ | |
| 584 | +err: | |
| 585 | + if (sdhc) { | |
| 586 | + if (sdhc->card) | |
| 587 | + brcmf_sdcard_detach(sdhc->card); | |
| 588 | + kfree(sdhc); | |
| 589 | + } | |
| 605 | 590 | |
| 606 | −void *bcmsdh_get_sdioh(bcmsdh_info_t *sdh) | |
| 607 | −{ | |
| 608 | − ASSERT(sdh); | |
| 609 | − return sdh->sdioh; | |
| 591 | + return -ENODEV; | |
| 610 | 592 | } |
| 611 | 593 | |
| 612 | −/* Function to pass device-status bits to DHD. */ | |
| 613 | −u32 bcmsdh_get_dstatus(void *sdh) | |
| 594 | +int brcmf_sdio_remove(struct device *dev) | |
| 614 | 595 | { |
| 596 | + struct sdio_hc *sdhc, *prev; | |
| 597 | + | |
| 598 | + sdhc = sdhcinfo; | |
| 599 | + drvinfo.detach(sdhc->ch); | |
| 600 | + brcmf_sdcard_detach(sdhc->card); | |
| 601 | + /* find the SDIO Host Controller state for this pdev | |
| 602 | + and take it out from the list */ | |
| 603 | + for (sdhc = sdhcinfo, prev = NULL; sdhc; sdhc = sdhc->next) { | |
| 604 | + if (sdhc->dev == (void *)dev) { | |
| 605 | + if (prev) | |
| 606 | + prev->next = sdhc->next; | |
| 607 | + else | |
| 608 | + sdhcinfo = NULL; | |
| 609 | + break; | |
| 610 | + } | |
| 611 | + prev = sdhc; | |
| 612 | + } | |
| 613 | + if (!sdhc) { | |
| 614 | + SDLX_MSG(("%s: failed\n", __func__)); | |
| 615 | + return 0; | |
| 616 | + } | |
| 617 | + | |
| 618 | + /* release SDIO Host Controller info */ | |
| 619 | + kfree(sdhc); | |
| 615 | 620 | return 0; |
| 616 | 621 | } |
| 617 | 622 | |
| 618 | −u32 bcmsdh_cur_sbwad(void *sdh) | |
| 623 | +int brcmf_sdio_register(struct brcmf_sdioh_driver *driver) | |
| 619 | 624 | { |
| 620 | − bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *) sdh; | |
| 625 | + drvinfo = *driver; | |
| 621 | 626 | |
| 622 | − if (!bcmsdh) | |
| 623 | − bcmsdh = l_bcmsdh; | |
| 627 | + SDLX_MSG(("Linux Kernel SDIO/MMC Driver\n")); | |
| 628 | + return brcmf_sdio_function_init(); | |
| 629 | +} | |
| 624 | 630 | |
| 625 | − return bcmsdh->sbwad; | |
| 631 | +void brcmf_sdio_unregister(void) | |
| 632 | +{ | |
| 633 | + brcmf_sdio_function_cleanup(); | |
| 626 | 634 | } |
| 627 | 635 | |
| 628 | −void bcmsdh_chipinfo(void *sdh, u32 chip, u32 chiprev) | |
| 636 | +void brcmf_sdio_wdtmr_enable(bool enable) | |
| 629 | 637 | { |
| 630 | − return; | |
| 638 | + if (enable) | |
| 639 | + brcmf_sdbrcm_wd_timer(sdhcinfo->ch, brcmf_watchdog_ms); | |
| 640 | + else | |
| 641 | + brcmf_sdbrcm_wd_timer(sdhcinfo->ch, 0); | |
| 631 | 642 | } |
| @@ -1,386 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2010 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | − * purpose with or without fee is hereby granted, provided that the above | |
| 6 | − * copyright notice and this permission notice appear in all copies. | |
| 7 | − * | |
| 8 | − * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | − * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | − * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | − * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | − * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | − * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | − * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | − */ | |
| 16 | − | |
| 17 | −/** | |
| 18 | − * @file bcmsdh_linux.c | |
| 19 | − */ | |
| 20 | − | |
| 21 | −#define __UNDEF_NO_VERSION__ | |
| 22 | − | |
| 23 | −#include <linux/netdevice.h> | |
| 24 | −#include <linux/pci.h> | |
| 25 | −#include <linux/completion.h> | |
| 26 | − | |
| 27 | −#include <pcicfg.h> | |
| 28 | −#include <bcmdefs.h> | |
| 29 | −#include <bcmdevs.h> | |
| 30 | −#include <bcmutils.h> | |
| 31 | − | |
| 32 | −#if defined(OOB_INTR_ONLY) | |
| 33 | −#include <linux/irq.h> | |
| 34 | −extern void dhdsdio_isr(void *args); | |
| 35 | −#include <dngl_stats.h> | |
| 36 | −#include <dhd.h> | |
| 37 | −#endif /* defined(OOB_INTR_ONLY) */ | |
| 38 | −#if defined(CONFIG_MACH_SANDGATE2G) || defined(CONFIG_MACH_LOGICPD_PXA270) | |
| 39 | −#if !defined(BCMPLATFORM_BUS) | |
| 40 | −#define BCMPLATFORM_BUS | |
| 41 | −#endif /* !defined(BCMPLATFORM_BUS) */ | |
| 42 | − | |
| 43 | −#include <linux/platform_device.h> | |
| 44 | −#endif /* CONFIG_MACH_SANDGATE2G */ | |
| 45 | − | |
| 46 | −#include "dngl_stats.h" | |
| 47 | −#include "dhd.h" | |
| 48 | − | |
| 49 | −/** | |
| 50 | − * SDIO Host Controller info | |
| 51 | − */ | |
| 52 | −typedef struct bcmsdh_hc bcmsdh_hc_t; | |
| 53 | − | |
| 54 | −struct bcmsdh_hc { | |
| 55 | − bcmsdh_hc_t *next; | |
| 56 | −#ifdef BCMPLATFORM_BUS | |
| 57 | − struct device *dev; /* platform device handle */ | |
| 58 | −#else | |
| 59 | − struct pci_dev *dev; /* pci device handle */ | |
| 60 | −#endif /* BCMPLATFORM_BUS */ | |
| 61 | − void *regs; /* SDIO Host Controller address */ | |
| 62 | − bcmsdh_info_t *sdh; /* SDIO Host Controller handle */ | |
| 63 | − void *ch; | |
| 64 | − unsigned int oob_irq; | |
| 65 | − unsigned long oob_flags; /* OOB Host specifiction | |
| 66 | − as edge and etc */ | |
| 67 | − bool oob_irq_registered; | |
| 68 | −#if defined(OOB_INTR_ONLY) | |
| 69 | − spinlock_t irq_lock; | |
| 70 | −#endif | |
| 71 | −}; | |
| 72 | −static bcmsdh_hc_t *sdhcinfo; | |
| 73 | − | |
| 74 | −/* driver info, initialized when bcmsdh_register is called */ | |
| 75 | −static bcmsdh_driver_t drvinfo = { NULL, NULL }; | |
| 76 | − | |
| 77 | −/* debugging macros */ | |
| 78 | −#define SDLX_MSG(x) | |
| 79 | − | |
| 80 | −/** | |
| 81 | − * Checks to see if vendor and device IDs match a supported SDIO Host Controller. | |
| 82 | − */ | |
| 83 | −bool bcmsdh_chipmatch(u16 vendor, u16 device) | |
| 84 | −{ | |
| 85 | − /* Add other vendors and devices as required */ | |
| 86 | − | |
| 87 | −#ifdef BCMSDIOH_STD | |
| 88 | − /* Check for Arasan host controller */ | |
| 89 | − if (vendor == VENDOR_SI_IMAGE) | |
| 90 | − return true; | |
| 91 | − | |
| 92 | − /* Check for BRCM 27XX Standard host controller */ | |
| 93 | − if (device == BCM27XX_SDIOH_ID && vendor == PCI_VENDOR_ID_BROADCOM) | |
| 94 | − return true; | |
| 95 | − | |
| 96 | − /* Check for BRCM Standard host controller */ | |
| 97 | − if (device == SDIOH_FPGA_ID && vendor == PCI_VENDOR_ID_BROADCOM) | |
| 98 | − return true; | |
| 99 | − | |
| 100 | − /* Check for TI PCIxx21 Standard host controller */ | |
| 101 | − if (device == PCIXX21_SDIOH_ID && vendor == VENDOR_TI) | |
| 102 | − return true; | |
| 103 | − | |
| 104 | − if (device == PCIXX21_SDIOH0_ID && vendor == VENDOR_TI) | |
| 105 | − return true; | |
| 106 | − | |
| 107 | − /* Ricoh R5C822 Standard SDIO Host */ | |
| 108 | − if (device == R5C822_SDIOH_ID && vendor == VENDOR_RICOH) | |
| 109 | − return true; | |
| 110 | − | |
| 111 | − /* JMicron Standard SDIO Host */ | |
| 112 | − if (device == JMICRON_SDIOH_ID && vendor == VENDOR_JMICRON) | |
| 113 | − return true; | |
| 114 | −#endif /* BCMSDIOH_STD */ | |
| 115 | −#ifdef BCMSDIOH_SPI | |
| 116 | − /* This is the PciSpiHost. */ | |
| 117 | − if (device == SPIH_FPGA_ID && vendor == PCI_VENDOR_ID_BROADCOM) { | |
| 118 | − return true; | |
| 119 | − } | |
| 120 | −#endif /* BCMSDIOH_SPI */ | |
| 121 | − | |
| 122 | − return false; | |
| 123 | −} | |
| 124 | − | |
| 125 | −#if defined(BCMPLATFORM_BUS) | |
| 126 | −#if defined(BCMLXSDMMC) | |
| 127 | −/* forward declarations */ | |
| 128 | −int bcmsdh_probe(struct device *dev); | |
| 129 | −EXPORT_SYMBOL(bcmsdh_probe); | |
| 130 | − | |
| 131 | −int bcmsdh_remove(struct device *dev); | |
| 132 | −EXPORT_SYMBOL(bcmsdh_remove); | |
| 133 | − | |
| 134 | −#else | |
| 135 | −/* forward declarations */ | |
| 136 | −static int __devinit bcmsdh_probe(struct device *dev); | |
| 137 | −static int __devexit bcmsdh_remove(struct device *dev); | |
| 138 | −#endif /* BCMLXSDMMC */ | |
| 139 | − | |
| 140 | −#ifndef BCMLXSDMMC | |
| 141 | −static | |
| 142 | −#endif /* BCMLXSDMMC */ | |
| 143 | −int bcmsdh_probe(struct device *dev) | |
| 144 | −{ | |
| 145 | − bcmsdh_hc_t *sdhc = NULL; | |
| 146 | − unsigned long regs = 0; | |
| 147 | − bcmsdh_info_t *sdh = NULL; | |
| 148 | −#if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS) | |
| 149 | − struct platform_device *pdev; | |
| 150 | − struct resource *r; | |
| 151 | −#endif /* BCMLXSDMMC */ | |
| 152 | − int irq = 0; | |
| 153 | − u32 vendevid; | |
| 154 | − unsigned long irq_flags = 0; | |
| 155 | − | |
| 156 | −#if !defined(BCMLXSDMMC) && defined(BCMPLATFORM_BUS) | |
| 157 | − pdev = to_platform_device(dev); | |
| 158 | − r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | |
| 159 | − irq = platform_get_irq(pdev, 0); | |
| 160 | − if (!r || irq == NO_IRQ) | |
| 161 | − return -ENXIO; | |
| 162 | −#endif /* BCMLXSDMMC */ | |
| 163 | − | |
| 164 | −#if defined(OOB_INTR_ONLY) | |
| 165 | −#ifdef HW_OOB | |
| 166 | − irq_flags = | |
| 167 | − IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL | | |
| 168 | − IORESOURCE_IRQ_SHAREABLE; | |
| 169 | −#else | |
| 170 | − irq_flags = IRQF_TRIGGER_FALLING; | |
| 171 | −#endif /* HW_OOB */ | |
| 172 | − irq = dhd_customer_oob_irq_map(&irq_flags); | |
| 173 | − if (irq < 0) { | |
| 174 | − SDLX_MSG(("%s: Host irq is not defined\n", __func__)); | |
| 175 | − return 1; | |
| 176 | − } | |
| 177 | −#endif /* defined(OOB_INTR_ONLY) */ | |
| 178 | − /* allocate SDIO Host Controller state info */ | |
| 179 | − sdhc = kzalloc(sizeof(bcmsdh_hc_t), GFP_ATOMIC); | |
| 180 | − if (!sdhc) { | |
| 181 | − SDLX_MSG(("%s: out of memory\n", __func__)); | |
| 182 | − goto err; | |
| 183 | − } | |
| 184 | − sdhc->dev = (void *)dev; | |
| 185 | − | |
| 186 | −#ifdef BCMLXSDMMC | |
| 187 | − sdh = bcmsdh_attach((void *)0, (void **)®s, irq); | |
| 188 | − if (!sdh) { | |
| 189 | − SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__)); | |
| 190 | − goto err; | |
| 191 | − } | |
| 192 | −#else | |
| 193 | − sdh = bcmsdh_attach((void *)r->start, (void **)®s, irq); | |
| 194 | − if (!sdh) { | |
| 195 | − SDLX_MSG(("%s: bcmsdh_attach failed\n", __func__)); | |
| 196 | − goto err; | |
| 197 | − } | |
| 198 | −#endif /* BCMLXSDMMC */ | |
| 199 | − sdhc->sdh = sdh; | |
| 200 | − sdhc->oob_irq = irq; | |
| 201 | − sdhc->oob_flags = irq_flags; | |
| 202 | − sdhc->oob_irq_registered = false; /* to make sure.. */ | |
| 203 | −#if defined(OOB_INTR_ONLY) | |
| 204 | − spin_lock_init(&sdhc->irq_lock); | |
| 205 | −#endif | |
| 206 | − | |
| 207 | − /* chain SDIO Host Controller info together */ | |
| 208 | − sdhc->next = sdhcinfo; | |
| 209 | − sdhcinfo = sdhc; | |
| 210 | − /* Read the vendor/device ID from the CIS */ | |
| 211 | − vendevid = bcmsdh_query_device(sdh); | |
| 212 | − | |
| 213 | − /* try to attach to the target device */ | |
| 214 | − sdhc->ch = drvinfo.attach((vendevid >> 16), (vendevid & 0xFFFF), | |
| 215 | − 0, 0, 0, 0, (void *)regs, sdh); | |
| 216 | − if (!sdhc->ch) { | |
| 217 | − SDLX_MSG(("%s: device attach failed\n", __func__)); | |
| 218 | − goto err; | |
| 219 | − } | |
| 220 | − | |
| 221 | − return 0; | |
| 222 | − | |
| 223 | − /* error handling */ | |
| 224 | −err: | |
| 225 | − if (sdhc) { | |
| 226 | − if (sdhc->sdh) | |
| 227 | − bcmsdh_detach(sdhc->sdh); | |
| 228 | − kfree(sdhc); | |
| 229 | − } | |
| 230 | − | |
| 231 | − return -ENODEV; | |
| 232 | −} | |
| 233 | − | |
| 234 | −#ifndef BCMLXSDMMC | |
| 235 | −static | |
| 236 | −#endif /* BCMLXSDMMC */ | |
| 237 | −int bcmsdh_remove(struct device *dev) | |
| 238 | −{ | |
| 239 | − bcmsdh_hc_t *sdhc, *prev; | |
| 240 | − | |
| 241 | − sdhc = sdhcinfo; | |
| 242 | − drvinfo.detach(sdhc->ch); | |
| 243 | − bcmsdh_detach(sdhc->sdh); | |
| 244 | − /* find the SDIO Host Controller state for this pdev | |
| 245 | − and take it out from the list */ | |
| 246 | − for (sdhc = sdhcinfo, prev = NULL; sdhc; sdhc = sdhc->next) { | |
| 247 | − if (sdhc->dev == (void *)dev) { | |
| 248 | − if (prev) | |
| 249 | − prev->next = sdhc->next; | |
| 250 | − else | |
| 251 | − sdhcinfo = NULL; | |
| 252 | − break; | |
| 253 | − } | |
| 254 | − prev = sdhc; | |
| 255 | − } | |
| 256 | − if (!sdhc) { | |
| 257 | − SDLX_MSG(("%s: failed\n", __func__)); | |
| 258 | − return 0; | |
| 259 | − } | |
| 260 | − | |
| 261 | − /* release SDIO Host Controller info */ | |
| 262 | − kfree(sdhc); | |
| 263 | − | |
| 264 | −#if !defined(BCMLXSDMMC) | |
| 265 | − dev_set_drvdata(dev, NULL); | |
| 266 | −#endif /* !defined(BCMLXSDMMC) */ | |
| 267 | − | |
| 268 | − return 0; | |
| 269 | −} | |
| 270 | −#endif /* BCMPLATFORM_BUS */ | |
| 271 | − | |
| 272 | −extern int sdio_function_init(void); | |
| 273 | − | |
| 274 | −int bcmsdh_register(bcmsdh_driver_t *driver) | |
| 275 | −{ | |
| 276 | − drvinfo = *driver; | |
| 277 | − | |
| 278 | − SDLX_MSG(("Linux Kernel SDIO/MMC Driver\n")); | |
| 279 | − return sdio_function_init(); | |
| 280 | −} | |
| 281 | − | |
| 282 | −extern void sdio_function_cleanup(void); | |
| 283 | − | |
| 284 | −void bcmsdh_unregister(void) | |
| 285 | −{ | |
| 286 | − sdio_function_cleanup(); | |
| 287 | −} | |
| 288 | − | |
| 289 | −#if defined(OOB_INTR_ONLY) | |
| 290 | −void bcmsdh_oob_intr_set(bool enable) | |
| 291 | −{ | |
| 292 | − static bool curstate = 1; | |
| 293 | − unsigned long flags; | |
| 294 | − | |
| 295 | − spin_lock_irqsave(&sdhcinfo->irq_lock, flags); | |
| 296 | − if (curstate != enable) { | |
| 297 | − if (enable) | |
| 298 | − enable_irq(sdhcinfo->oob_irq); | |
| 299 | − else | |
| 300 | − disable_irq_nosync(sdhcinfo->oob_irq); | |
| 301 | − curstate = enable; | |
| 302 | − } | |
| 303 | − spin_unlock_irqrestore(&sdhcinfo->irq_lock, flags); | |
| 304 | −} | |
| 305 | − | |
| 306 | −static irqreturn_t wlan_oob_irq(int irq, void *dev_id) | |
| 307 | −{ | |
| 308 | − dhd_pub_t *dhdp; | |
| 309 | − | |
| 310 | − dhdp = (dhd_pub_t *) dev_get_drvdata(sdhcinfo->dev); | |
| 311 | − | |
| 312 | − bcmsdh_oob_intr_set(0); | |
| 313 | − | |
| 314 | − if (dhdp == NULL) { | |
| 315 | − SDLX_MSG(("Out of band GPIO interrupt fired way too early\n")); | |
| 316 | − return IRQ_HANDLED; | |
| 317 | − } | |
| 318 | − | |
| 319 | − dhdsdio_isr((void *)dhdp->bus); | |
| 320 | − | |
| 321 | − return IRQ_HANDLED; | |
| 322 | −} | |
| 323 | − | |
| 324 | −int bcmsdh_register_oob_intr(void *dhdp) | |
| 325 | −{ | |
| 326 | − int error = 0; | |
| 327 | − | |
| 328 | − SDLX_MSG(("%s Enter\n", __func__)); | |
| 329 | − | |
| 330 | − sdhcinfo->oob_flags = | |
| 331 | − IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL | | |
| 332 | − IORESOURCE_IRQ_SHAREABLE; | |
| 333 | − dev_set_drvdata(sdhcinfo->dev, dhdp); | |
| 334 | − | |
| 335 | − if (!sdhcinfo->oob_irq_registered) { | |
| 336 | − SDLX_MSG(("%s IRQ=%d Type=%X\n", __func__, | |
| 337 | − (int)sdhcinfo->oob_irq, (int)sdhcinfo->oob_flags)); | |
| 338 | − /* Refer to customer Host IRQ docs about | |
| 339 | − proper irqflags definition */ | |
| 340 | − error = | |
| 341 | − request_irq(sdhcinfo->oob_irq, wlan_oob_irq, | |
| 342 | − sdhcinfo->oob_flags, "bcmsdh_sdmmc", NULL); | |
| 343 | − if (error) | |
| 344 | − return -ENODEV; | |
| 345 | − | |
| 346 | − irq_set_irq_wake(sdhcinfo->oob_irq, 1); | |
| 347 | − sdhcinfo->oob_irq_registered = true; | |
| 348 | − } | |
| 349 | − | |
| 350 | − return 0; | |
| 351 | −} | |
| 352 | − | |
| 353 | −void bcmsdh_unregister_oob_intr(void) | |
| 354 | −{ | |
| 355 | − SDLX_MSG(("%s: Enter\n", __func__)); | |
| 356 | − | |
| 357 | − irq_set_irq_wake(sdhcinfo->oob_irq, 0); | |
| 358 | − disable_irq(sdhcinfo->oob_irq); /* just in case.. */ | |
| 359 | − free_irq(sdhcinfo->oob_irq, NULL); | |
| 360 | − sdhcinfo->oob_irq_registered = false; | |
| 361 | −} | |
| 362 | −#endif /* defined(OOB_INTR_ONLY) */ | |
| 363 | −/* Module parameters specific to each host-controller driver */ | |
| 364 | − | |
| 365 | −extern uint sd_msglevel; /* Debug message level */ | |
| 366 | −module_param(sd_msglevel, uint, 0); | |
| 367 | − | |
| 368 | −extern uint sd_power; /* 0 = SD Power OFF, | |
| 369 | − 1 = SD Power ON. */ | |
| 370 | −module_param(sd_power, uint, 0); | |
| 371 | − | |
| 372 | −extern uint sd_clock; /* SD Clock Control, 0 = SD Clock OFF, | |
| 373 | − 1 = SD Clock ON */ | |
| 374 | −module_param(sd_clock, uint, 0); | |
| 375 | − | |
| 376 | −extern uint sd_divisor; /* Divisor (-1 means external clock) */ | |
| 377 | −module_param(sd_divisor, uint, 0); | |
| 378 | − | |
| 379 | −extern uint sd_sdmode; /* Default is SD4, 0=SPI, 1=SD1, 2=SD4 */ | |
| 380 | −module_param(sd_sdmode, uint, 0); | |
| 381 | − | |
| 382 | −extern uint sd_hiok; /* Ok to use hi-speed mode */ | |
| 383 | −module_param(sd_hiok, uint, 0); | |
| 384 | − | |
| 385 | −extern uint sd_f2_blocksize; | |
| 386 | −module_param(sd_f2_blocksize, int, 0); | |
| @@ -15,64 +15,179 @@ · 14 unmodified lines | ||
| 15 | 15 | */ |
| 16 | 16 | #include <linux/types.h> |
| 17 | 17 | #include <linux/netdevice.h> |
| 18 | −#include <bcmdefs.h> | |
| 19 | −#include <bcmdevs.h> | |
| 20 | −#include <bcmutils.h> | |
| 21 | −#include <sdio.h> /* SDIO Device and Protocol Specs */ | |
| 22 | −#include <sdioh.h> /* SDIO Host Controller Specification */ | |
| 23 | −#include <bcmsdbus.h> /* bcmsdh to/from specific controller APIs */ | |
| 24 | −#include <sdiovar.h> /* ioctl/iovars */ | |
| 25 | − | |
| 18 | +#include <linux/mmc/sdio.h> | |
| 26 | 19 | #include <linux/mmc/core.h> |
| 27 | 20 | #include <linux/mmc/sdio_func.h> |
| 28 | 21 | #include <linux/mmc/sdio_ids.h> |
| 22 | +#include <linux/mmc/card.h> | |
| 29 | 23 | #include <linux/suspend.h> |
| 24 | +#include <linux/errno.h> | |
| 25 | +#include <linux/sched.h> /* request_irq() */ | |
| 26 | +#include <net/cfg80211.h> | |
| 30 | 27 | |
| 31 | −#include <dngl_stats.h> | |
| 32 | −#include <dhd.h> | |
| 28 | +#include <defs.h> | |
| 29 | +#include <brcm_hw_ids.h> | |
| 30 | +#include <brcmu_utils.h> | |
| 31 | +#include <brcmu_wifi.h> | |
| 32 | +#include "sdio_host.h" | |
| 33 | +#include "dhd.h" | |
| 34 | +#include "dhd_dbg.h" | |
| 35 | +#include "wl_cfg80211.h" | |
| 33 | 36 | |
| 34 | −#include "bcmsdh_sdmmc.h" | |
| 37 | +#define BLOCK_SIZE_64 64 | |
| 38 | +#define BLOCK_SIZE_512 512 | |
| 39 | +#define BLOCK_SIZE_4318 64 | |
| 40 | +#define BLOCK_SIZE_4328 512 | |
| 35 | 41 | |
| 36 | −extern int sdio_function_init(void); | |
| 37 | −extern void sdio_function_cleanup(void); | |
| 42 | +/* private bus modes */ | |
| 43 | +#define SDIOH_MODE_SD4 2 | |
| 38 | 44 | |
| 39 | −#if !defined(OOB_INTR_ONLY) | |
| 40 | −static void IRQHandler(struct sdio_func *func); | |
| 41 | −static void IRQHandlerF2(struct sdio_func *func); | |
| 42 | −#endif /* !defined(OOB_INTR_ONLY) */ | |
| 43 | −static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, u32 regaddr); | |
| 44 | −extern int sdio_reset_comm(struct mmc_card *card); | |
| 45 | +#define CLIENT_INTR 0x100 /* Get rid of this! */ | |
| 45 | 46 | |
| 46 | −extern PBCMSDH_SDMMC_INSTANCE gInstance; | |
| 47 | +#if !defined(SDIO_VENDOR_ID_BROADCOM) | |
| 48 | +#define SDIO_VENDOR_ID_BROADCOM 0x02d0 | |
| 49 | +#endif /* !defined(SDIO_VENDOR_ID_BROADCOM) */ | |
| 47 | 50 | |
| 48 | −uint sd_sdmode = SDIOH_MODE_SD4; /* Use SD4 mode by default */ | |
| 49 | −uint sd_f2_blocksize = 512; /* Default blocksize */ | |
| 51 | +#define SDIO_DEVICE_ID_BROADCOM_DEFAULT 0x0000 | |
| 52 | + | |
| 53 | +#define DMA_ALIGN_MASK 0x03 | |
| 50 | 54 | |
| 51 | −uint sd_divisor = 2; /* Default 48MHz/2 = 24MHz */ | |
| 55 | +#if !defined(SDIO_DEVICE_ID_BROADCOM_4325_SDGWB) | |
| 56 | +#define SDIO_DEVICE_ID_BROADCOM_4325_SDGWB 0x0492 /* BCM94325SDGWB */ | |
| 57 | +#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4325_SDGWB) */ | |
| 58 | +#if !defined(SDIO_DEVICE_ID_BROADCOM_4325) | |
| 59 | +#define SDIO_DEVICE_ID_BROADCOM_4325 0x0493 | |
| 60 | +#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4325) */ | |
| 61 | +#if !defined(SDIO_DEVICE_ID_BROADCOM_4329) | |
| 62 | +#define SDIO_DEVICE_ID_BROADCOM_4329 0x4329 | |
| 63 | +#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4329) */ | |
| 64 | +#if !defined(SDIO_DEVICE_ID_BROADCOM_4319) | |
| 65 | +#define SDIO_DEVICE_ID_BROADCOM_4319 0x4319 | |
| 66 | +#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4329) */ | |
| 67 | + | |
| 68 | +/* Common msglevel constants */ | |
| 69 | +#define SDH_ERROR_VAL 0x0001 /* Error */ | |
| 70 | +#define SDH_TRACE_VAL 0x0002 /* Trace */ | |
| 71 | +#define SDH_INFO_VAL 0x0004 /* Info */ | |
| 72 | +#define SDH_DEBUG_VAL 0x0008 /* Debug */ | |
| 73 | +#define SDH_DATA_VAL 0x0010 /* Data */ | |
| 74 | +#define SDH_CTRL_VAL 0x0020 /* Control Regs */ | |
| 75 | +#define SDH_LOG_VAL 0x0040 /* Enable bcmlog */ | |
| 76 | +#define SDH_DMA_VAL 0x0080 /* DMA */ | |
| 77 | + | |
| 78 | +#ifdef BCMDBG | |
| 79 | +#define sd_err(x) \ | |
| 80 | + do { \ | |
| 81 | + if ((sd_msglevel & SDH_ERROR_VAL) && net_ratelimit()) \ | |
| 82 | + printk x; \ | |
| 83 | + } while (0) | |
| 84 | +#define sd_trace(x) \ | |
| 85 | + do { \ | |
| 86 | + if ((sd_msglevel & SDH_TRACE_VAL) && net_ratelimit()) \ | |
| 87 | + printk x; \ | |
| 88 | + } while (0) | |
| 89 | +#define sd_info(x) \ | |
| 90 | + do { \ | |
| 91 | + if ((sd_msglevel & SDH_INFO_VAL) && net_ratelimit()) \ | |
| 92 | + printk x; \ | |
| 93 | + } while (0) | |
| 94 | +#define sd_debug(x) \ | |
| 95 | + do { \ | |
| 96 | + if ((sd_msglevel & SDH_DEBUG_VAL) && net_ratelimit()) \ | |
| 97 | + printk x; \ | |
| 98 | + } while (0) | |
| 99 | +#define sd_data(x) \ | |
| 100 | + do { \ | |
| 101 | + if ((sd_msglevel & SDH_DATA_VAL) && net_ratelimit()) \ | |
| 102 | + printk x; \ | |
| 103 | + } while (0) | |
| 104 | +#define sd_ctrl(x) \ | |
| 105 | + do { \ | |
| 106 | + if ((sd_msglevel & SDH_CTRL_VAL) && net_ratelimit()) \ | |
| 107 | + printk x; \ | |
| 108 | + } while (0) | |
| 109 | +#else | |
| 110 | +#define sd_err(x) | |
| 111 | +#define sd_trace(x) | |
| 112 | +#define sd_info(x) | |
| 113 | +#define sd_debug(x) | |
| 114 | +#define sd_data(x) | |
| 115 | +#define sd_ctrl(x) | |
| 116 | +#endif | |
| 117 | + | |
| 118 | +struct sdos_info { | |
| 119 | + struct sdioh_info *sd; | |
| 120 | + spinlock_t lock; | |
| 121 | +}; | |
| 122 | + | |
| 123 | +static void brcmf_sdioh_irqhandler(struct sdio_func *func); | |
| 124 | +static void brcmf_sdioh_irqhandler_f2(struct sdio_func *func); | |
| 125 | +static int brcmf_sdioh_get_cisaddr(struct sdioh_info *sd, u32 regaddr); | |
| 126 | +static int brcmf_ops_sdio_probe(struct sdio_func *func, | |
| 127 | + const struct sdio_device_id *id); | |
| 128 | +static void brcmf_ops_sdio_remove(struct sdio_func *func); | |
| 129 | + | |
| 130 | +#ifdef CONFIG_PM | |
| 131 | +static int brcmf_sdio_suspend(struct device *dev); | |
| 132 | +static int brcmf_sdio_resume(struct device *dev); | |
| 133 | +#endif /* CONFIG_PM */ | |
| 134 | + | |
| 135 | +uint sd_f2_blocksize = 512; /* Default blocksize */ | |
| 52 | 136 | |
| 53 | −uint sd_power = 1; /* Default to SD Slot powered ON */ | |
| 54 | −uint sd_clock = 1; /* Default to SD Clock turned ON */ | |
| 55 | −uint sd_hiok = false; /* Don't use hi-speed mode by default */ | |
| 56 | 137 | uint sd_msglevel = 0x01; |
| 57 | −uint sd_use_dma = true; | |
| 58 | −DHD_PM_RESUME_WAIT_INIT(sdioh_request_byte_wait); | |
| 59 | −DHD_PM_RESUME_WAIT_INIT(sdioh_request_word_wait); | |
| 60 | −DHD_PM_RESUME_WAIT_INIT(sdioh_request_packet_wait); | |
| 61 | −DHD_PM_RESUME_WAIT_INIT(sdioh_request_buffer_wait); | |
| 62 | 138 | |
| 63 | −#define DMA_ALIGN_MASK 0x03 | |
| 139 | +/* module param defaults */ | |
| 140 | +static int clockoverride; | |
| 64 | 141 | |
| 65 | −int sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, u32 regaddr, | |
| 66 | − int regsize, u32 *data); | |
| 142 | +module_param(clockoverride, int, 0644); | |
| 143 | +MODULE_PARM_DESC(clockoverride, "SDIO card clock override"); | |
| 67 | 144 | |
| 68 | −void sdioh_sdio_set_host_pm_flags(int flag) | |
| 69 | −{ | |
| 70 | − if (sdio_set_host_pm_flags(gInstance->func[1], flag)) | |
| 71 | − printk(KERN_ERR "%s: Failed to set pm_flags 0x%08x\n",\ | |
| 72 | − __func__, (unsigned int)flag); | |
| 73 | −} | |
| 145 | +struct brcmf_sdmmc_instance *gInstance; | |
| 146 | + | |
| 147 | +struct device sdmmc_dev; | |
| 148 | + | |
| 149 | +/* devices we support, null terminated */ | |
| 150 | +static const struct sdio_device_id brcmf_sdmmc_ids[] = { | |
| 151 | + {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_DEFAULT)}, | |
| 152 | + {SDIO_DEVICE | |
| 153 | + (SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325_SDGWB)}, | |
| 154 | + {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325)}, | |
| 155 | + {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4329)}, | |
| 156 | + {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4319)}, | |
| 157 | + { /* end: all zeroes */ }, | |
| 158 | +}; | |
| 159 | + | |
| 160 | +#ifdef CONFIG_PM | |
| 161 | +static const struct dev_pm_ops brcmf_sdio_pm_ops = { | |
| 162 | + .suspend = brcmf_sdio_suspend, | |
| 163 | + .resume = brcmf_sdio_resume, | |
| 164 | +}; | |
| 165 | +#endif /* CONFIG_PM */ | |
| 166 | + | |
| 167 | +static struct sdio_driver brcmf_sdmmc_driver = { | |
| 168 | + .probe = brcmf_ops_sdio_probe, | |
| 169 | + .remove = brcmf_ops_sdio_remove, | |
| 170 | + .name = "brcmfmac", | |
| 171 | + .id_table = brcmf_sdmmc_ids, | |
| 172 | +#ifdef CONFIG_PM | |
| 173 | + .drv = { | |
| 174 | + .pm = &brcmf_sdio_pm_ops, | |
| 175 | + }, | |
| 176 | +#endif /* CONFIG_PM */ | |
| 177 | +}; | |
| 178 | + | |
| 179 | +MODULE_DEVICE_TABLE(sdio, brcmf_sdmmc_ids); | |
| 180 | + | |
| 181 | +BRCMF_PM_RESUME_WAIT_INIT(sdioh_request_byte_wait); | |
| 182 | +BRCMF_PM_RESUME_WAIT_INIT(sdioh_request_word_wait); | |
| 183 | +BRCMF_PM_RESUME_WAIT_INIT(sdioh_request_packet_wait); | |
| 184 | +BRCMF_PM_RESUME_WAIT_INIT(sdioh_request_buffer_wait); | |
| 74 | 185 | |
| 75 | −static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd) | |
| 186 | +static int | |
| 187 | +brcmf_sdioh_card_regread(struct sdioh_info *sd, int func, u32 regaddr, | |
| 188 | + int regsize, u32 *data); | |
| 189 | + | |
| 190 | +static int brcmf_sdioh_enablefuncs(struct sdioh_info *sd) | |
| 76 | 191 | { |
| 77 | 192 | int err_ret; |
| 78 | 193 | u32 fbraddr; |
| @@ -81,16 +196,16 @@ static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd) · 2 unmodified lines | ||
| 81 | 196 | sd_trace(("%s\n", __func__)); |
| 82 | 197 | |
| 83 | 198 | /* Get the Card's common CIS address */ |
| 84 | − sd->com_cis_ptr = sdioh_sdmmc_get_cisaddr(sd, SDIOD_CCCR_CISPTR_0); | |
| 199 | + sd->com_cis_ptr = brcmf_sdioh_get_cisaddr(sd, SDIO_CCCR_CIS); | |
| 85 | 200 | sd->func_cis_ptr[0] = sd->com_cis_ptr; |
| 86 | 201 | sd_info(("%s: Card's Common CIS Ptr = 0x%x\n", __func__, |
| 87 | 202 | sd->com_cis_ptr)); |
| 88 | 203 | |
| 89 | 204 | /* Get the Card's function CIS (for each function) */ |
| 90 | − for (fbraddr = SDIOD_FBR_STARTADDR, func = 1; | |
| 205 | + for (fbraddr = SDIO_FBR_BASE(1), func = 1; | |
| 91 | 206 | func <= sd->num_funcs; func++, fbraddr += SDIOD_FBR_SIZE) { |
| 92 | 207 | sd->func_cis_ptr[func] = |
| 93 | − sdioh_sdmmc_get_cisaddr(sd, SDIOD_FBR_CISPTR_0 + fbraddr); | |
| 208 | + brcmf_sdioh_get_cisaddr(sd, SDIO_FBR_CIS + fbraddr); | |
| 94 | 209 | sd_info(("%s: Function %d CIS Ptr = 0x%x\n", __func__, func, |
| 95 | 210 | sd->func_cis_ptr[func])); |
| 96 | 211 | } |
| @@ -104,8 +219,8 @@ static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd) · 7 unmodified lines | ||
| 104 | 219 | err_ret = sdio_enable_func(gInstance->func[1]); |
| 105 | 220 | sdio_release_host(gInstance->func[1]); |
| 106 | 221 | if (err_ret) { |
| 107 | − sd_err(("bcmsdh_sdmmc: Failed to enable F1 Err: 0x%08x", | |
| 108 | − err_ret)); | |
| 222 | + sd_err(("brcmf_sdioh_enablefuncs: Failed to enable F1 " | |
| 223 | + "Err: 0x%08x\n", err_ret)); | |
| 109 | 224 | } |
| 110 | 225 | |
| 111 | 226 | return false; |
| @@ -114,9 +229,9 @@ static int sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd) · 2 unmodified lines | ||
| 114 | 229 | /* |
| 115 | 230 | * Public entry points & extern's |
| 116 | 231 | */ |
| 117 | −sdioh_info_t *sdioh_attach(void *bar0, uint irq) | |
| 232 | +struct sdioh_info *brcmf_sdioh_attach(void *bar0, uint irq) | |
| 118 | 233 | { |
| 119 | − sdioh_info_t *sd; | |
| 234 | + struct sdioh_info *sd; | |
| 120 | 235 | int err_ret; |
| 121 | 236 | |
| 122 | 237 | sd_trace(("%s\n", __func__)); |
| @@ -126,19 +241,18 @@ sdioh_info_t *sdioh_attach(void *bar0, uint irq) · 3 unmodified lines | ||
| 126 | 241 | return NULL; |
| 127 | 242 | } |
| 128 | 243 | |
| 129 | − sd = kzalloc(sizeof(sdioh_info_t), GFP_ATOMIC); | |
| 244 | + sd = kzalloc(sizeof(struct sdioh_info), GFP_ATOMIC); | |
| 130 | 245 | if (sd == NULL) { |
| 131 | 246 | sd_err(("sdioh_attach: out of memory\n")); |
| 132 | 247 | return NULL; |
| 133 | 248 | } |
| 134 | − if (sdioh_sdmmc_osinit(sd) != 0) { | |
| 249 | + if (brcmf_sdioh_osinit(sd) != 0) { | |
| 135 | 250 | sd_err(("%s:sdioh_sdmmc_osinit() failed\n", __func__)); |
| 136 | 251 | kfree(sd); |
| 137 | 252 | return NULL; |
| 138 | 253 | } |
| 139 | 254 | |
| 140 | 255 | sd->num_funcs = 2; |
| 141 | − sd->sd_blockmode = true; | |
| 142 | 256 | sd->use_client_ints = true; |
| 143 | 257 | sd->client_block_size[0] = 64; |
| 144 | 258 | |
| @@ -150,7 +264,7 @@ sdioh_info_t *sdioh_attach(void *bar0, uint irq) · 5 unmodified lines | ||
| 150 | 264 | sd->client_block_size[1] = 64; |
| 151 | 265 | err_ret = sdio_set_block_size(gInstance->func[1], 64); |
| 152 | 266 | if (err_ret) |
| 153 | − sd_err(("bcmsdh_sdmmc: Failed to set F1 blocksize\n")); | |
| 267 | + sd_err(("brcmf_sdioh_attach: Failed to set F1 blocksize\n")); | |
| 154 | 268 | |
| 155 | 269 | /* Release host controller F1 */ |
| 156 | 270 | sdio_release_host(gInstance->func[1]); |
| @@ -163,20 +277,20 @@ sdioh_info_t *sdioh_attach(void *bar0, uint irq) · 6 unmodified lines | ||
| 163 | 277 | err_ret = |
| 164 | 278 | sdio_set_block_size(gInstance->func[2], sd_f2_blocksize); |
| 165 | 279 | if (err_ret) |
| 166 | − sd_err(("bcmsdh_sdmmc: Failed to set F2 blocksize " | |
| 167 | − "to %d\n", sd_f2_blocksize)); | |
| 280 | + sd_err(("brcmf_sdioh_attach: Failed to set F2 blocksize" | |
| 281 | + " to %d\n", sd_f2_blocksize)); | |
| 168 | 282 | |
| 169 | 283 | /* Release host controller F2 */ |
| 170 | 284 | sdio_release_host(gInstance->func[2]); |
| 171 | 285 | } |
| 172 | 286 | |
| 173 | − sdioh_sdmmc_card_enablefuncs(sd); | |
| 287 | + brcmf_sdioh_enablefuncs(sd); | |
| 174 | 288 | |
| 175 | 289 | sd_trace(("%s: Done\n", __func__)); |
| 176 | 290 | return sd; |
| 177 | 291 | } |
| 178 | 292 | |
| 179 | −extern SDIOH_API_RC sdioh_detach(sdioh_info_t *sd) | |
| 293 | +extern int brcmf_sdioh_detach(struct sdioh_info *sd) | |
| 180 | 294 | { |
| 181 | 295 | sd_trace(("%s\n", __func__)); |
| 182 | 296 | |
| @@ -193,92 +307,25 @@ extern SDIOH_API_RC sdioh_detach(sdioh_info_t *sd) · 10 unmodified lines | ||
| 193 | 307 | sdio_release_host(gInstance->func[1]); |
| 194 | 308 | |
| 195 | 309 | /* deregister irq */ |
| 196 | − sdioh_sdmmc_osfree(sd); | |
| 310 | + brcmf_sdioh_osfree(sd); | |
| 197 | 311 | |
| 198 | 312 | kfree(sd); |
| 199 | 313 | } |
| 200 | − return SDIOH_API_RC_SUCCESS; | |
| 201 | −} | |
| 202 | − | |
| 203 | −#if defined(OOB_INTR_ONLY) && defined(HW_OOB) | |
| 204 | − | |
| 205 | −extern SDIOH_API_RC sdioh_enable_func_intr(void) | |
| 206 | −{ | |
| 207 | − u8 reg; | |
| 208 | − int err; | |
| 209 | − | |
| 210 | − if (gInstance->func[0]) { | |
| 211 | − sdio_claim_host(gInstance->func[0]); | |
| 212 | − | |
| 213 | − reg = sdio_readb(gInstance->func[0], SDIOD_CCCR_INTEN, &err); | |
| 214 | − if (err) { | |
| 215 | − sd_err(("%s: error for read SDIO_CCCR_IENx : 0x%x\n", | |
| 216 | − __func__, err)); | |
| 217 | − sdio_release_host(gInstance->func[0]); | |
| 218 | − return SDIOH_API_RC_FAIL; | |
| 219 | − } | |
| 220 | − | |
| 221 | − /* Enable F1 and F2 interrupts, set master enable */ | |
| 222 | − reg |= | |
| 223 | − (INTR_CTL_FUNC1_EN | INTR_CTL_FUNC2_EN | | |
| 224 | − INTR_CTL_MASTER_EN); | |
| 225 | − | |
| 226 | − sdio_writeb(gInstance->func[0], reg, SDIOD_CCCR_INTEN, &err); | |
| 227 | − sdio_release_host(gInstance->func[0]); | |
| 228 | − | |
| 229 | − if (err) { | |
| 230 | − sd_err(("%s: error for write SDIO_CCCR_IENx : 0x%x\n", | |
| 231 | − __func__, err)); | |
| 232 | − return SDIOH_API_RC_FAIL; | |
| 233 | − } | |
| 234 | − } | |
| 235 | − | |
| 236 | − return SDIOH_API_RC_SUCCESS; | |
| 237 | −} | |
| 238 | − | |
| 239 | −extern SDIOH_API_RC sdioh_disable_func_intr(void) | |
| 240 | −{ | |
| 241 | − u8 reg; | |
| 242 | − int err; | |
| 243 | − | |
| 244 | − if (gInstance->func[0]) { | |
| 245 | − sdio_claim_host(gInstance->func[0]); | |
| 246 | − reg = sdio_readb(gInstance->func[0], SDIOD_CCCR_INTEN, &err); | |
| 247 | − if (err) { | |
| 248 | − sd_err(("%s: error for read SDIO_CCCR_IENx : 0x%x\n", | |
| 249 | − __func__, err)); | |
| 250 | − sdio_release_host(gInstance->func[0]); | |
| 251 | − return SDIOH_API_RC_FAIL; | |
| 252 | − } | |
| 253 | − | |
| 254 | − reg &= ~(INTR_CTL_FUNC1_EN | INTR_CTL_FUNC2_EN); | |
| 255 | − /* Disable master interrupt with the last function interrupt */ | |
| 256 | − if (!(reg & 0xFE)) | |
| 257 | − reg = 0; | |
| 258 | − sdio_writeb(gInstance->func[0], reg, SDIOD_CCCR_INTEN, &err); | |
| 259 | − | |
| 260 | − sdio_release_host(gInstance->func[0]); | |
| 261 | − if (err) { | |
| 262 | − sd_err(("%s: error for write SDIO_CCCR_IENx : 0x%x\n", | |
| 263 | − __func__, err)); | |
| 264 | − return SDIOH_API_RC_FAIL; | |
| 265 | − } | |
| 266 | − } | |
| 267 | − return SDIOH_API_RC_SUCCESS; | |
| 314 | + return 0; | |
| 268 | 315 | } |
| 269 | −#endif /* defined(OOB_INTR_ONLY) && defined(HW_OOB) */ | |
| 270 | 316 | |
| 271 | 317 | /* Configure callback to client when we receive client interrupt */ |
| 272 | −extern SDIOH_API_RC | |
| 273 | −sdioh_interrupt_register(sdioh_info_t *sd, sdioh_cb_fn_t fn, void *argh) | |
| 318 | +extern int | |
| 319 | +brcmf_sdioh_interrupt_register(struct sdioh_info *sd, void (*fn)(void *), | |
| 320 | + void *argh) | |
| 274 | 321 | { |
| 275 | 322 | sd_trace(("%s: Entering\n", __func__)); |
| 276 | 323 | if (fn == NULL) { |
| 277 | 324 | sd_err(("%s: interrupt handler is NULL, not registering\n", |
| 278 | 325 | __func__)); |
| 279 | − return SDIOH_API_RC_FAIL; | |
| 326 | + return -EINVAL; | |
| 280 | 327 | } |
| 281 | −#if !defined(OOB_INTR_ONLY) | |
| 328 | + | |
| 282 | 329 | sd->intr_handler = fn; |
| 283 | 330 | sd->intr_handler_arg = argh; |
| 284 | 331 | sd->intr_handler_valid = true; |
| @@ -286,26 +333,23 @@ sdioh_interrupt_register(sdioh_info_t *sd, sdioh_cb_fn_t fn, void *argh) · 1 unmodified line | ||
| 286 | 333 | /* register and unmask irq */ |
| 287 | 334 | if (gInstance->func[2]) { |
| 288 | 335 | sdio_claim_host(gInstance->func[2]); |
| 289 | − sdio_claim_irq(gInstance->func[2], IRQHandlerF2); | |
| 336 | + sdio_claim_irq(gInstance->func[2], brcmf_sdioh_irqhandler_f2); | |
| 290 | 337 | sdio_release_host(gInstance->func[2]); |
| 291 | 338 | } |
| 292 | 339 | |
| 293 | 340 | if (gInstance->func[1]) { |
| 294 | 341 | sdio_claim_host(gInstance->func[1]); |
| 295 | − sdio_claim_irq(gInstance->func[1], IRQHandler); | |
| 342 | + sdio_claim_irq(gInstance->func[1], brcmf_sdioh_irqhandler); | |
| 296 | 343 | sdio_release_host(gInstance->func[1]); |
| 297 | 344 | } |
| 298 | −#elif defined(HW_OOB) | |
| 299 | − sdioh_enable_func_intr(); | |
| 300 | −#endif /* defined(OOB_INTR_ONLY) */ | |
| 301 | − return SDIOH_API_RC_SUCCESS; | |
| 345 | + | |
| 346 | + return 0; | |
| 302 | 347 | } |
| 303 | 348 | |
| 304 | −extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *sd) | |
| 349 | +extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *sd) | |
| 305 | 350 | { |
| 306 | 351 | sd_trace(("%s: Entering\n", __func__)); |
| 307 | 352 | |
| 308 | −#if !defined(OOB_INTR_ONLY) | |
| 309 | 353 | if (gInstance->func[1]) { |
| 310 | 354 | /* register and unmask irq */ |
| 311 | 355 | sdio_claim_host(gInstance->func[1]); |
| @@ -324,73 +368,28 @@ extern SDIOH_API_RC sdioh_interrupt_deregister(sdioh_info_t *sd) · 12 unmodified lines | ||
| 324 | 368 | sd->intr_handler_valid = false; |
| 325 | 369 | sd->intr_handler = NULL; |
| 326 | 370 | sd->intr_handler_arg = NULL; |
| 327 | −#elif defined(HW_OOB) | |
| 328 | − sdioh_disable_func_intr(); | |
| 329 | −#endif /* !defined(OOB_INTR_ONLY) */ | |
| 330 | − return SDIOH_API_RC_SUCCESS; | |
| 331 | −} | |
| 332 | − | |
| 333 | −extern SDIOH_API_RC sdioh_interrupt_query(sdioh_info_t *sd, bool *onoff) | |
| 334 | −{ | |
| 335 | − sd_trace(("%s: Entering\n", __func__)); | |
| 336 | − *onoff = sd->client_intr_enabled; | |
| 337 | − return SDIOH_API_RC_SUCCESS; | |
| 338 | −} | |
| 339 | 371 | |
| 340 | −#if defined(DHD_DEBUG) | |
| 341 | −extern bool sdioh_interrupt_pending(sdioh_info_t *sd) | |
| 342 | −{ | |
| 343 | 372 | return 0; |
| 344 | 373 | } |
| 345 | −#endif | |
| 346 | − | |
| 347 | −uint sdioh_query_iofnum(sdioh_info_t *sd) | |
| 348 | −{ | |
| 349 | − return sd->num_funcs; | |
| 350 | −} | |
| 351 | 374 | |
| 352 | 375 | /* IOVar table */ |
| 353 | 376 | enum { |
| 354 | 377 | IOV_MSGLEVEL = 1, |
| 355 | − IOV_BLOCKMODE, | |
| 356 | 378 | IOV_BLOCKSIZE, |
| 357 | − IOV_DMA, | |
| 358 | 379 | IOV_USEINTS, |
| 359 | 380 | IOV_NUMINTS, |
| 360 | − IOV_NUMLOCALINTS, | |
| 361 | − IOV_HOSTREG, | |
| 362 | 381 | IOV_DEVREG, |
| 363 | − IOV_DIVISOR, | |
| 364 | − IOV_SDMODE, | |
| 365 | − IOV_HISPEED, | |
| 366 | 382 | IOV_HCIREGS, |
| 367 | − IOV_POWER, | |
| 368 | − IOV_CLOCK, | |
| 369 | 383 | IOV_RXCHAIN |
| 370 | 384 | }; |
| 371 | 385 | |
| 372 | −const bcm_iovar_t sdioh_iovars[] = { | |
| 386 | +const struct brcmu_iovar sdioh_iovars[] = { | |
| 373 | 387 | {"sd_msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0}, |
| 374 | − {"sd_blockmode", IOV_BLOCKMODE, 0, IOVT_BOOL, 0}, | |
| 375 | 388 | {"sd_blocksize", IOV_BLOCKSIZE, 0, IOVT_UINT32, 0},/* ((fn << 16) | |
| 376 | 389 | size) */ |
| 377 | − {"sd_dma", IOV_DMA, 0, IOVT_BOOL, 0}, | |
| 378 | 390 | {"sd_ints", IOV_USEINTS, 0, IOVT_BOOL, 0}, |
| 379 | 391 | {"sd_numints", IOV_NUMINTS, 0, IOVT_UINT32, 0}, |
| 380 | − {"sd_numlocalints", IOV_NUMLOCALINTS, 0, IOVT_UINT32, 0}, | |
| 381 | − {"sd_hostreg", IOV_HOSTREG, 0, IOVT_BUFFER, sizeof(sdreg_t)} | |
| 382 | − , | |
| 383 | − {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(sdreg_t)} | |
| 384 | − , | |
| 385 | − {"sd_divisor", IOV_DIVISOR, 0, IOVT_UINT32, 0} | |
| 386 | − , | |
| 387 | − {"sd_power", IOV_POWER, 0, IOVT_UINT32, 0} | |
| 388 | − , | |
| 389 | − {"sd_clock", IOV_CLOCK, 0, IOVT_UINT32, 0} | |
| 390 | − , | |
| 391 | − {"sd_mode", IOV_SDMODE, 0, IOVT_UINT32, 100} | |
| 392 | − , | |
| 393 | − {"sd_highspeed", IOV_HISPEED, 0, IOVT_UINT32, 0} | |
| 392 | + {"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(struct brcmf_sdreg)} | |
| 394 | 393 | , |
| 395 | 394 | {"sd_rxchain", IOV_RXCHAIN, 0, IOVT_BOOL, 0} |
| 396 | 395 | , |
| @@ -398,33 +397,37 @@ const bcm_iovar_t sdioh_iovars[] = { · 1 unmodified line | ||
| 398 | 397 | }; |
| 399 | 398 | |
| 400 | 399 | int |
| 401 | −sdioh_iovar_op(sdioh_info_t *si, const char *name, | |
| 402 | − void *params, int plen, void *arg, int len, bool set) | |
| 400 | +brcmf_sdioh_iovar_op(struct sdioh_info *si, const char *name, | |
| 401 | + void *params, int plen, void *arg, int len, bool set) | |
| 403 | 402 | { |
| 404 | − const bcm_iovar_t *vi = NULL; | |
| 403 | + const struct brcmu_iovar *vi = NULL; | |
| 405 | 404 | int bcmerror = 0; |
| 406 | 405 | int val_size; |
| 407 | 406 | s32 int_val = 0; |
| 408 | 407 | bool bool_val; |
| 409 | 408 | u32 actionid; |
| 410 | 409 | |
| 411 | − ASSERT(name); | |
| 412 | − ASSERT(len >= 0); | |
| 410 | + if (name == NULL || len <= 0) | |
| 411 | + return -EINVAL; | |
| 412 | + | |
| 413 | + /* Set does not take qualifiers */ | |
| 414 | + if (set && (params || plen)) | |
| 415 | + return -EINVAL; | |
| 413 | 416 | |
| 414 | − /* Get must have return space; Set does not take qualifiers */ | |
| 415 | − ASSERT(set || (arg && len)); | |
| 416 | − ASSERT(!set || (!params && !plen)); | |
| 417 | + /* Get must have return space;*/ | |
| 418 | + if (!set && !(arg && len)) | |
| 419 | + return -EINVAL; | |
| 417 | 420 | |
| 418 | 421 | sd_trace(("%s: Enter (%s %s)\n", __func__, (set ? "set" : "get"), |
| 419 | 422 | name)); |
| 420 | 423 | |
| 421 | − vi = bcm_iovar_lookup(sdioh_iovars, name); | |
| 424 | + vi = brcmu_iovar_lookup(sdioh_iovars, name); | |
| 422 | 425 | if (vi == NULL) { |
| 423 | 426 | bcmerror = -ENOTSUPP; |
| 424 | 427 | goto exit; |
| 425 | 428 | } |
| 426 | 429 | |
| 427 | − bcmerror = bcm_iovar_lencheck(vi, arg, len, set); | |
| 430 | + bcmerror = brcmu_iovar_lencheck(vi, arg, len, set); | |
| 428 | 431 | if (bcmerror != 0) |
| 429 | 432 | goto exit; |
| 430 | 433 | |
| @@ -457,16 +460,6 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, · 26 unmodified lines | ||
| 457 | 460 | sd_msglevel = int_val; |
| 458 | 461 | break; |
| 459 | 462 | |
| 460 | − case IOV_GVAL(IOV_BLOCKMODE): | |
| 461 | − int_val = (s32) si->sd_blockmode; | |
| 462 | − memcpy(arg, &int_val, val_size); | |
| 463 | − break; | |
| 464 | − | |
| 465 | − case IOV_SVAL(IOV_BLOCKMODE): | |
| 466 | − si->sd_blockmode = (bool) int_val; | |
| 467 | − /* Haven't figured out how to make non-block mode with DMA */ | |
| 468 | − break; | |
| 469 | − | |
| 470 | 463 | case IOV_GVAL(IOV_BLOCKSIZE): |
| 471 | 464 | if ((u32) int_val > si->num_funcs) { |
| 472 | 465 | bcmerror = -EINVAL; |
| @@ -518,15 +511,6 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, · 45 unmodified lines | ||
| 518 | 511 | memcpy(arg, &int_val, val_size); |
| 519 | 512 | break; |
| 520 | 513 | |
| 521 | − case IOV_GVAL(IOV_DMA): | |
| 522 | − int_val = (s32) si->sd_use_dma; | |
| 523 | − memcpy(arg, &int_val, val_size); | |
| 524 | − break; | |
| 525 | − | |
| 526 | − case IOV_SVAL(IOV_DMA): | |
| 527 | − si->sd_use_dma = (bool) int_val; | |
| 528 | − break; | |
| 529 | − | |
| 530 | 514 | case IOV_GVAL(IOV_USEINTS): |
| 531 | 515 | int_val = (s32) si->use_client_ints; |
| 532 | 516 | memcpy(arg, &int_val, val_size); |
| @@ -541,117 +525,18 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, · 8 unmodified lines | ||
| 541 | 525 | |
| 542 | 526 | break; |
| 543 | 527 | |
| 544 | − case IOV_GVAL(IOV_DIVISOR): | |
| 545 | − int_val = (u32) sd_divisor; | |
| 546 | − memcpy(arg, &int_val, val_size); | |
| 547 | − break; | |
| 548 | − | |
| 549 | − case IOV_SVAL(IOV_DIVISOR): | |
| 550 | − sd_divisor = int_val; | |
| 551 | − break; | |
| 552 | − | |
| 553 | − case IOV_GVAL(IOV_POWER): | |
| 554 | − int_val = (u32) sd_power; | |
| 555 | − memcpy(arg, &int_val, val_size); | |
| 556 | − break; | |
| 557 | − | |
| 558 | − case IOV_SVAL(IOV_POWER): | |
| 559 | − sd_power = int_val; | |
| 560 | − break; | |
| 561 | − | |
| 562 | − case IOV_GVAL(IOV_CLOCK): | |
| 563 | − int_val = (u32) sd_clock; | |
| 564 | − memcpy(arg, &int_val, val_size); | |
| 565 | − break; | |
| 566 | − | |
| 567 | − case IOV_SVAL(IOV_CLOCK): | |
| 568 | − sd_clock = int_val; | |
| 569 | − break; | |
| 570 | − | |
| 571 | − case IOV_GVAL(IOV_SDMODE): | |
| 572 | − int_val = (u32) sd_sdmode; | |
| 573 | − memcpy(arg, &int_val, val_size); | |
| 574 | − break; | |
| 575 | − | |
| 576 | − case IOV_SVAL(IOV_SDMODE): | |
| 577 | − sd_sdmode = int_val; | |
| 578 | − break; | |
| 579 | − | |
| 580 | − case IOV_GVAL(IOV_HISPEED): | |
| 581 | − int_val = (u32) sd_hiok; | |
| 582 | − memcpy(arg, &int_val, val_size); | |
| 583 | − break; | |
| 584 | − | |
| 585 | − case IOV_SVAL(IOV_HISPEED): | |
| 586 | − sd_hiok = int_val; | |
| 587 | − break; | |
| 588 | − | |
| 589 | 528 | case IOV_GVAL(IOV_NUMINTS): |
| 590 | 529 | int_val = (s32) si->intrcount; |
| 591 | 530 | memcpy(arg, &int_val, val_size); |
| 592 | 531 | break; |
| 593 | 532 | |
| 594 | − case IOV_GVAL(IOV_NUMLOCALINTS): | |
| 595 | − int_val = (s32) 0; | |
| 596 | − memcpy(arg, &int_val, val_size); | |
| 597 | − break; | |
| 598 | − | |
| 599 | − case IOV_GVAL(IOV_HOSTREG): | |
| 600 | − { | |
| 601 | − sdreg_t *sd_ptr = (sdreg_t *) params; | |
| 602 | − | |
| 603 | − if (sd_ptr->offset < SD_SysAddr | |
| 604 | − || sd_ptr->offset > SD_MaxCurCap) { | |
| 605 | − sd_err(("%s: bad offset 0x%x\n", __func__, | |
| 606 | − sd_ptr->offset)); | |
| 607 | − bcmerror = -EINVAL; | |
| 608 | − break; | |
| 609 | − } | |
| 610 | − | |
| 611 | − sd_trace(("%s: rreg%d at offset %d\n", __func__, | |
| 612 | − (sd_ptr->offset & 1) ? 8 | |
| 613 | − : ((sd_ptr->offset & 2) ? 16 : 32), | |
| 614 | − sd_ptr->offset)); | |
| 615 | − if (sd_ptr->offset & 1) | |
| 616 | − int_val = 8; /* sdioh_sdmmc_rreg8(si, | |
| 617 | − sd_ptr->offset); */ | |
| 618 | − else if (sd_ptr->offset & 2) | |
| 619 | − int_val = 16; /* sdioh_sdmmc_rreg16(si, | |
| 620 | − sd_ptr->offset); */ | |
| 621 | − else | |
| 622 | − int_val = 32; /* sdioh_sdmmc_rreg(si, | |
| 623 | − sd_ptr->offset); */ | |
| 624 | − | |
| 625 | − memcpy(arg, &int_val, sizeof(int_val)); | |
| 626 | − break; | |
| 627 | − } | |
| 628 | − | |
| 629 | − case IOV_SVAL(IOV_HOSTREG): | |
| 630 | − { | |
| 631 | − sdreg_t *sd_ptr = (sdreg_t *) params; | |
| 632 | − | |
| 633 | − if (sd_ptr->offset < SD_SysAddr | |
| 634 | − || sd_ptr->offset > SD_MaxCurCap) { | |
| 635 | − sd_err(("%s: bad offset 0x%x\n", __func__, | |
| 636 | − sd_ptr->offset)); | |
| 637 | − bcmerror = -EINVAL; | |
| 638 | − break; | |
| 639 | − } | |
| 640 | − | |
| 641 | − sd_trace(("%s: wreg%d value 0x%08x at offset %d\n", | |
| 642 | − __func__, sd_ptr->value, | |
| 643 | − (sd_ptr->offset & 1) ? 8 | |
| 644 | − : ((sd_ptr->offset & 2) ? 16 : 32), | |
| 645 | − sd_ptr->offset)); | |
| 646 | − break; | |
| 647 | − } | |
| 648 | − | |
| 649 | 533 | case IOV_GVAL(IOV_DEVREG): |
| 650 | 534 | { |
| 651 | − sdreg_t *sd_ptr = (sdreg_t *) params; | |
| 535 | + struct brcmf_sdreg *sd_ptr = | |
| 536 | + (struct brcmf_sdreg *) params; | |
| 652 | 537 | u8 data = 0; |
| 653 | 538 | |
| 654 | − if (sdioh_cfg_read | |
| 539 | + if (brcmf_sdioh_cfg_read | |
| 655 | 540 | (si, sd_ptr->func, sd_ptr->offset, &data)) { |
| 656 | 541 | bcmerror = -EIO; |
| 657 | 542 | break; |
| @@ -664,10 +549,11 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name, · 6 unmodified lines | ||
| 664 | 549 | |
| 665 | 550 | case IOV_SVAL(IOV_DEVREG): |
| 666 | 551 | { |
| 667 | − sdreg_t *sd_ptr = (sdreg_t *) params; | |
| 552 | + struct brcmf_sdreg *sd_ptr = | |
| 553 | + (struct brcmf_sdreg *) params; | |
| 668 | 554 | u8 data = (u8) sd_ptr->value; |
| 669 | 555 | |
| 670 | − if (sdioh_cfg_write | |
| 556 | + if (brcmf_sdioh_cfg_write | |
| 671 | 557 | (si, sd_ptr->func, sd_ptr->offset, &data)) { |
| 672 | 558 | bcmerror = -EIO; |
| 673 | 559 | break; |
| @@ -684,50 +570,32 @@ exit: · 10 unmodified lines | ||
| 684 | 570 | return bcmerror; |
| 685 | 571 | } |
| 686 | 572 | |
| 687 | −#if defined(OOB_INTR_ONLY) && defined(HW_OOB) | |
| 688 | − | |
| 689 | −SDIOH_API_RC sdioh_enable_hw_oob_intr(sdioh_info_t *sd, bool enable) | |
| 690 | −{ | |
| 691 | − SDIOH_API_RC status; | |
| 692 | − u8 data; | |
| 693 | − | |
| 694 | − if (enable) | |
| 695 | − data = 3; /* enable hw oob interrupt */ | |
| 696 | − else | |
| 697 | − data = 4; /* disable hw oob interrupt */ | |
| 698 | − data |= 4; /* Active HIGH */ | |
| 699 | − | |
| 700 | − status = sdioh_request_byte(sd, SDIOH_WRITE, 0, 0xf2, &data); | |
| 701 | − return status; | |
| 702 | −} | |
| 703 | −#endif /* defined(OOB_INTR_ONLY) && defined(HW_OOB) */ | |
| 704 | − | |
| 705 | −extern SDIOH_API_RC | |
| 706 | −sdioh_cfg_read(sdioh_info_t *sd, uint fnc_num, u32 addr, u8 *data) | |
| 573 | +extern int | |
| 574 | +brcmf_sdioh_cfg_read(struct sdioh_info *sd, uint fnc_num, u32 addr, u8 *data) | |
| 707 | 575 | { |
| 708 | − SDIOH_API_RC status; | |
| 709 | − /* No lock needed since sdioh_request_byte does locking */ | |
| 710 | − status = sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data); | |
| 576 | + int status; | |
| 577 | + /* No lock needed since brcmf_sdioh_request_byte does locking */ | |
| 578 | + status = brcmf_sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data); | |
| 711 | 579 | return status; |
| 712 | 580 | } |
| 713 | 581 | |
| 714 | −extern SDIOH_API_RC | |
| 715 | −sdioh_cfg_write(sdioh_info_t *sd, uint fnc_num, u32 addr, u8 *data) | |
| 582 | +extern int | |
| 583 | +brcmf_sdioh_cfg_write(struct sdioh_info *sd, uint fnc_num, u32 addr, u8 *data) | |
| 716 | 584 | { |
| 717 | − /* No lock needed since sdioh_request_byte does locking */ | |
| 718 | − SDIOH_API_RC status; | |
| 719 | − status = sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data); | |
| 585 | + /* No lock needed since brcmf_sdioh_request_byte does locking */ | |
| 586 | + int status; | |
| 587 | + status = brcmf_sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data); | |
| 720 | 588 | return status; |
| 721 | 589 | } |
| 722 | 590 | |
| 723 | −static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, u32 regaddr) | |
| 591 | +static int brcmf_sdioh_get_cisaddr(struct sdioh_info *sd, u32 regaddr) | |
| 724 | 592 | { |
| 725 | 593 | /* read 24 bits and return valid 17 bit addr */ |
| 726 | 594 | int i; |
| 727 | 595 | u32 scratch, regdata; |
| 728 | 596 | u8 *ptr = (u8 *)&scratch; |
| 729 | 597 | for (i = 0; i < 3; i++) { |
| 730 | − if ((sdioh_sdmmc_card_regread(sd, 0, regaddr, 1, ®data)) != | |
| 598 | + if ((brcmf_sdioh_card_regread(sd, 0, regaddr, 1, ®data)) != | |
| 731 | 599 | SUCCESS) |
| 732 | 600 | sd_err(("%s: Can't read!\n", __func__)); |
| 733 | 601 | |
| @@ -741,8 +609,8 @@ static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, u32 regaddr) · 7 unmodified lines | ||
| 741 | 609 | return scratch; |
| 742 | 610 | } |
| 743 | 611 | |
| 744 | −extern SDIOH_API_RC | |
| 745 | −sdioh_cis_read(sdioh_info_t *sd, uint func, u8 *cisd, u32 length) | |
| 612 | +extern int | |
| 613 | +brcmf_sdioh_cis_read(struct sdioh_info *sd, uint func, u8 *cisd, u32 length) | |
| 746 | 614 | { |
| 747 | 615 | u32 count; |
| 748 | 616 | int offset; |
| @@ -754,7 +622,7 @@ sdioh_cis_read(sdioh_info_t *sd, uint func, u8 *cisd, u32 length) · 5 unmodified lines | ||
| 754 | 622 | if (!sd->func_cis_ptr[func]) { |
| 755 | 623 | memset(cis, 0, length); |
| 756 | 624 | sd_err(("%s: no func_cis_ptr[%d]\n", __func__, func)); |
| 757 | − return SDIOH_API_RC_FAIL; | |
| 625 | + return -ENOTSUPP; | |
| 758 | 626 | } |
| 759 | 627 | |
| 760 | 628 | sd_err(("%s: func_cis_ptr[%d]=0x%04x\n", __func__, func, |
| @@ -762,37 +630,37 @@ sdioh_cis_read(sdioh_info_t *sd, uint func, u8 *cisd, u32 length) · 1 unmodified line | ||
| 762 | 630 | |
| 763 | 631 | for (count = 0; count < length; count++) { |
| 764 | 632 | offset = sd->func_cis_ptr[func] + count; |
| 765 | − if (sdioh_sdmmc_card_regread(sd, 0, offset, 1, &foo) < 0) { | |
| 633 | + if (brcmf_sdioh_card_regread(sd, 0, offset, 1, &foo) < 0) { | |
| 766 | 634 | sd_err(("%s: regread failed: Can't read CIS\n", |
| 767 | 635 | __func__)); |
| 768 | − return SDIOH_API_RC_FAIL; | |
| 636 | + return -EIO; | |
| 769 | 637 | } |
| 770 | 638 | |
| 771 | 639 | *cis = (u8) (foo & 0xff); |
| 772 | 640 | cis++; |
| 773 | 641 | } |
| 774 | 642 | |
| 775 | − return SDIOH_API_RC_SUCCESS; | |
| 643 | + return 0; | |
| 776 | 644 | } |
| 777 | 645 | |
| 778 | −extern SDIOH_API_RC | |
| 779 | −sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, | |
| 780 | − u8 *byte) | |
| 646 | +extern int | |
| 647 | +brcmf_sdioh_request_byte(struct sdioh_info *sd, uint rw, uint func, | |
| 648 | + uint regaddr, u8 *byte) | |
| 781 | 649 | { |
| 782 | 650 | int err_ret; |
| 783 | 651 | |
| 784 | 652 | sd_info(("%s: rw=%d, func=%d, addr=0x%05x\n", __func__, rw, func, |
| 785 | 653 | regaddr)); |
| 786 | 654 | |
| 787 | − DHD_PM_RESUME_WAIT(sdioh_request_byte_wait); | |
| 788 | − DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL); | |
| 655 | + BRCMF_PM_RESUME_WAIT(sdioh_request_byte_wait); | |
| 656 | + BRCMF_PM_RESUME_RETURN_ERROR(-EIO); | |
| 789 | 657 | if (rw) { /* CMD52 Write */ |
| 790 | 658 | if (func == 0) { |
| 791 | 659 | /* Can only directly write to some F0 registers. |
| 792 | 660 | * Handle F2 enable |
| 793 | 661 | * as a special case. |
| 794 | 662 | */ |
| 795 | − if (regaddr == SDIOD_CCCR_IOEN) { | |
| 663 | + if (regaddr == SDIO_CCCR_IOEx) { | |
| 796 | 664 | if (gInstance->func[2]) { |
| 797 | 665 | sdio_claim_host(gInstance->func[2]); |
| 798 | 666 | if (*byte & SDIO_FUNC_ENABLE_2) { |
| @@ -801,7 +669,9 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, · 2 unmodified lines | ||
| 801 | 669 | sdio_enable_func |
| 802 | 670 | (gInstance->func[2]); |
| 803 | 671 | if (err_ret) |
| 804 | − sd_err(("bcmsdh_sdmmc: enable F2 failed:%d", | |
| 672 | + sd_err(("request_byte: " | |
| 673 | + "enable F2 " | |
| 674 | + "failed:%d\n", | |
| 805 | 675 | err_ret)); |
| 806 | 676 | } else { |
| 807 | 677 | /* Disable Function 2 */ |
| @@ -809,15 +679,16 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, · 1 unmodified line | ||
| 809 | 679 | sdio_disable_func |
| 810 | 680 | (gInstance->func[2]); |
| 811 | 681 | if (err_ret) |
| 812 | − sd_err(("bcmsdh_sdmmc: Disab F2 failed:%d", | |
| 682 | + sd_err(("request_byte: " | |
| 683 | + "Disab F2 " | |
| 684 | + "failed:%d\n", | |
| 813 | 685 | err_ret)); |
| 814 | 686 | } |
| 815 | 687 | sdio_release_host(gInstance->func[2]); |
| 816 | 688 | } |
| 817 | 689 | } |
| 818 | −#if defined(MMC_SDIO_ABORT) | |
| 819 | 690 | /* to allow abort command through F1 */ |
| 820 | − else if (regaddr == SDIOD_CCCR_IOABORT) { | |
| 691 | + else if (regaddr == SDIO_CCCR_ABORT) { | |
| 821 | 692 | sdio_claim_host(gInstance->func[func]); |
| 822 | 693 | /* |
| 823 | 694 | * this sdio_f0_writeb() can be replaced |
| @@ -828,10 +699,8 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, · 4 unmodified lines | ||
| 828 | 699 | sdio_writeb(gInstance->func[func], *byte, |
| 829 | 700 | regaddr, &err_ret); |
| 830 | 701 | sdio_release_host(gInstance->func[func]); |
| 831 | − } | |
| 832 | −#endif /* MMC_SDIO_ABORT */ | |
| 833 | − else if (regaddr < 0xF0) { | |
| 834 | − sd_err(("bcmsdh_sdmmc: F0 Wr:0x%02x: write " | |
| 702 | + } else if (regaddr < 0xF0) { | |
| 703 | + sd_err(("brcmf: F0 Wr:0x%02x: write " | |
| 835 | 704 | "disallowed\n", regaddr)); |
| 836 | 705 | } else { |
| 837 | 706 | /* Claim host controller, perform F0 write, |
| @@ -867,29 +736,29 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, · 29 unmodified lines | ||
| 867 | 736 | } |
| 868 | 737 | |
| 869 | 738 | if (err_ret) |
| 870 | − sd_err(("bcmsdh_sdmmc: Failed to %s byte F%d:@0x%05x=%02x, " | |
| 739 | + sd_err(("brcmf: Failed to %s byte F%d:@0x%05x=%02x, " | |
| 871 | 740 | "Err: %d\n", rw ? "Write" : "Read", func, regaddr, |
| 872 | 741 | *byte, err_ret)); |
| 873 | 742 | |
| 874 | − return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL); | |
| 743 | + return err_ret; | |
| 875 | 744 | } |
| 876 | 745 | |
| 877 | −extern SDIOH_API_RC | |
| 878 | −sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, | |
| 879 | − uint addr, u32 *word, uint nbytes) | |
| 746 | +extern int | |
| 747 | +brcmf_sdioh_request_word(struct sdioh_info *sd, uint cmd_type, uint rw, | |
| 748 | + uint func, uint addr, u32 *word, uint nbytes) | |
| 880 | 749 | { |
| 881 | − int err_ret = SDIOH_API_RC_FAIL; | |
| 750 | + int err_ret = -EIO; | |
| 882 | 751 | |
| 883 | 752 | if (func == 0) { |
| 884 | 753 | sd_err(("%s: Only CMD52 allowed to F0.\n", __func__)); |
| 885 | − return SDIOH_API_RC_FAIL; | |
| 754 | + return -EINVAL; | |
| 886 | 755 | } |
| 887 | 756 | |
| 888 | 757 | sd_info(("%s: cmd_type=%d, rw=%d, func=%d, addr=0x%05x, nbytes=%d\n", |
| 889 | 758 | __func__, cmd_type, rw, func, addr, nbytes)); |
| 890 | 759 | |
| 891 | − DHD_PM_RESUME_WAIT(sdioh_request_word_wait); | |
| 892 | − DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL); | |
| 760 | + BRCMF_PM_RESUME_WAIT(sdioh_request_word_wait); | |
| 761 | + BRCMF_PM_RESUME_RETURN_ERROR(-EIO); | |
| 893 | 762 | /* Claim host controller */ |
| 894 | 763 | sdio_claim_host(gInstance->func[func]); |
| 895 | 764 | |
| @@ -920,16 +789,16 @@ sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, · 24 unmodified lines | ||
| 920 | 789 | sdio_release_host(gInstance->func[func]); |
| 921 | 790 | |
| 922 | 791 | if (err_ret) { |
| 923 | − sd_err(("bcmsdh_sdmmc: Failed to %s word, Err: 0x%08x", | |
| 792 | + sd_err(("brcmf: Failed to %s word, Err: 0x%08x\n", | |
| 924 | 793 | rw ? "Write" : "Read", err_ret)); |
| 925 | 794 | } |
| 926 | 795 | |
| 927 | − return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL); | |
| 796 | + return err_ret; | |
| 928 | 797 | } |
| 929 | 798 | |
| 930 | −static SDIOH_API_RC | |
| 931 | −sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, | |
| 932 | − uint addr, struct sk_buff *pkt) | |
| 799 | +static int | |
| 800 | +brcmf_sdioh_request_packet(struct sdioh_info *sd, uint fix_inc, uint write, | |
| 801 | + uint func, uint addr, struct sk_buff *pkt) | |
| 933 | 802 | { |
| 934 | 803 | bool fifo = (fix_inc == SDIOH_DATA_FIX); |
| 935 | 804 | u32 SGCount = 0; |
| @@ -939,9 +808,8 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, · 3 unmodified lines | ||
| 939 | 808 | |
| 940 | 809 | sd_trace(("%s: Enter\n", __func__)); |
| 941 | 810 | |
| 942 | − ASSERT(pkt); | |
| 943 | − DHD_PM_RESUME_WAIT(sdioh_request_packet_wait); | |
| 944 | − DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL); | |
| 811 | + BRCMF_PM_RESUME_WAIT(sdioh_request_packet_wait); | |
| 812 | + BRCMF_PM_RESUME_RETURN_ERROR(-EIO); | |
| 945 | 813 | |
| 946 | 814 | /* Claim host controller */ |
| 947 | 815 | sdio_claim_host(gInstance->func[func]); |
| @@ -950,21 +818,6 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, · 2 unmodified lines | ||
| 950 | 818 | pkt_len += 3; |
| 951 | 819 | pkt_len &= 0xFFFFFFFC; |
| 952 | 820 | |
| 953 | −#ifdef CONFIG_MMC_MSM7X00A | |
| 954 | − if ((pkt_len % 64) == 32) { | |
| 955 | − sd_trace(("%s: Rounding up TX packet +=32\n", | |
| 956 | − __func__)); | |
| 957 | − pkt_len += 32; | |
| 958 | − } | |
| 959 | −#endif /* CONFIG_MMC_MSM7X00A */ | |
| 960 | − /* Make sure the packet is aligned properly. | |
| 961 | − * If it isn't, then this | |
| 962 | − * is the fault of sdioh_request_buffer() which | |
| 963 | − * is supposed to give | |
| 964 | − * us something we can work with. | |
| 965 | − */ | |
| 966 | − ASSERT(((u32) (pkt->data) & DMA_ALIGN_MASK) == 0); | |
| 967 | − | |
| 968 | 821 | if ((write) && (!fifo)) { |
| 969 | 822 | err_ret = sdio_memcpy_toio(gInstance->func[func], addr, |
| 970 | 823 | ((u8 *) (pnext->data)), |
| @@ -1005,7 +858,7 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, · 34 unmodified lines | ||
| 1005 | 858 | sdio_release_host(gInstance->func[func]); |
| 1006 | 859 | |
| 1007 | 860 | sd_trace(("%s: Exit\n", __func__)); |
| 1008 | − return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL); | |
| 861 | + return err_ret; | |
| 1009 | 862 | } |
| 1010 | 863 | |
| 1011 | 864 | /* |
| @@ -1023,114 +876,101 @@ sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func, · 11 unmodified lines | ||
| 1023 | 876 | * aligned packet. |
| 1024 | 877 | * |
| 1025 | 878 | */ |
| 1026 | −extern SDIOH_API_RC | |
| 1027 | −sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write, | |
| 1028 | − uint func, uint addr, uint reg_width, uint buflen_u, | |
| 1029 | − u8 *buffer, struct sk_buff *pkt) | |
| 879 | +extern int | |
| 880 | +brcmf_sdioh_request_buffer(struct sdioh_info *sd, uint pio_dma, uint fix_inc, | |
| 881 | + uint write, uint func, uint addr, uint reg_width, | |
| 882 | + uint buflen_u, u8 *buffer, struct sk_buff *pkt) | |
| 1030 | 883 | { |
| 1031 | − SDIOH_API_RC Status; | |
| 884 | + int Status; | |
| 1032 | 885 | struct sk_buff *mypkt = NULL; |
| 1033 | 886 | |
| 1034 | 887 | sd_trace(("%s: Enter\n", __func__)); |
| 1035 | 888 | |
| 1036 | − DHD_PM_RESUME_WAIT(sdioh_request_buffer_wait); | |
| 1037 | − DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL); | |
| 889 | + BRCMF_PM_RESUME_WAIT(sdioh_request_buffer_wait); | |
| 890 | + BRCMF_PM_RESUME_RETURN_ERROR(-EIO); | |
| 1038 | 891 | /* Case 1: we don't have a packet. */ |
| 1039 | 892 | if (pkt == NULL) { |
| 1040 | 893 | sd_data(("%s: Creating new %s Packet, len=%d\n", |
| 1041 | 894 | __func__, write ? "TX" : "RX", buflen_u)); |
| 1042 | − mypkt = bcm_pkt_buf_get_skb(buflen_u); | |
| 895 | + mypkt = brcmu_pkt_buf_get_skb(buflen_u); | |
| 1043 | 896 | if (!mypkt) { |
| 1044 | − sd_err(("%s: bcm_pkt_buf_get_skb failed: len %d\n", | |
| 897 | + sd_err(("%s: brcmu_pkt_buf_get_skb failed: len %d\n", | |
| 1045 | 898 | __func__, buflen_u)); |
| 1046 | − return SDIOH_API_RC_FAIL; | |
| 899 | + return -EIO; | |
| 1047 | 900 | } |
| 1048 | 901 | |
| 1049 | 902 | /* For a write, copy the buffer data into the packet. */ |
| 1050 | 903 | if (write) |
| 1051 | 904 | memcpy(mypkt->data, buffer, buflen_u); |
| 1052 | 905 | |
| 1053 | − Status = | |
| 1054 | − sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt); | |
| 906 | + Status = brcmf_sdioh_request_packet(sd, fix_inc, write, func, | |
| 907 | + addr, mypkt); | |
| 1055 | 908 | |
| 1056 | 909 | /* For a read, copy the packet data back to the buffer. */ |
| 1057 | 910 | if (!write) |
| 1058 | 911 | memcpy(buffer, mypkt->data, buflen_u); |
| 1059 | 912 | |
| 1060 | − bcm_pkt_buf_free_skb(mypkt); | |
| 1061 | − } else if (((u32) (pkt->data) & DMA_ALIGN_MASK) != 0) { | |
| 1062 | − /* Case 2: We have a packet, but it is unaligned. */ | |
| 1063 | − | |
| 1064 | − /* In this case, we cannot have a chain. */ | |
| 1065 | − ASSERT(pkt->next == NULL); | |
| 1066 | − | |
| 913 | + brcmu_pkt_buf_free_skb(mypkt); | |
| 914 | + } else if (((ulong) (pkt->data) & DMA_ALIGN_MASK) != 0) { | |
| 915 | + /* | |
| 916 | + * Case 2: We have a packet, but it is unaligned. | |
| 917 | + * In this case, we cannot have a chain (pkt->next == NULL) | |
| 918 | + */ | |
| 1067 | 919 | sd_data(("%s: Creating aligned %s Packet, len=%d\n", |
| 1068 | 920 | __func__, write ? "TX" : "RX", pkt->len)); |
| 1069 | − mypkt = bcm_pkt_buf_get_skb(pkt->len); | |
| 921 | + mypkt = brcmu_pkt_buf_get_skb(pkt->len); | |
| 1070 | 922 | if (!mypkt) { |
| 1071 | − sd_err(("%s: bcm_pkt_buf_get_skb failed: len %d\n", | |
| 923 | + sd_err(("%s: brcmu_pkt_buf_get_skb failed: len %d\n", | |
| 1072 | 924 | __func__, pkt->len)); |
| 1073 | − return SDIOH_API_RC_FAIL; | |
| 925 | + return -EIO; | |
| 1074 | 926 | } |
| 1075 | 927 | |
| 1076 | 928 | /* For a write, copy the buffer data into the packet. */ |
| 1077 | 929 | if (write) |
| 1078 | 930 | memcpy(mypkt->data, pkt->data, pkt->len); |
| 1079 | 931 | |
| 1080 | − Status = | |
| 1081 | − sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt); | |
| 932 | + Status = brcmf_sdioh_request_packet(sd, fix_inc, write, func, | |
| 933 | + addr, mypkt); | |
| 1082 | 934 | |
| 1083 | 935 | /* For a read, copy the packet data back to the buffer. */ |
| 1084 | 936 | if (!write) |
| 1085 | 937 | memcpy(pkt->data, mypkt->data, mypkt->len); |
| 1086 | 938 | |
| 1087 | − bcm_pkt_buf_free_skb(mypkt); | |
| 939 | + brcmu_pkt_buf_free_skb(mypkt); | |
| 1088 | 940 | } else { /* case 3: We have a packet and |
| 1089 | 941 | it is aligned. */ |
| 1090 | 942 | sd_data(("%s: Aligned %s Packet, direct DMA\n", |
| 1091 | 943 | __func__, write ? "Tx" : "Rx")); |
| 1092 | − Status = | |
| 1093 | − sdioh_request_packet(sd, fix_inc, write, func, addr, pkt); | |
| 944 | + Status = brcmf_sdioh_request_packet(sd, fix_inc, write, func, | |
| 945 | + addr, pkt); | |
| 1094 | 946 | } |
| 1095 | 947 | |
| 1096 | 948 | return Status; |
| 1097 | 949 | } |
| 1098 | 950 | |
| 1099 | 951 | /* this function performs "abort" for both of host & device */ |
| 1100 | −extern int sdioh_abort(sdioh_info_t *sd, uint func) | |
| 952 | +extern int brcmf_sdioh_abort(struct sdioh_info *sd, uint func) | |
| 1101 | 953 | { |
| 1102 | −#if defined(MMC_SDIO_ABORT) | |
| 1103 | 954 | char t_func = (char)func; |
| 1104 | −#endif /* defined(MMC_SDIO_ABORT) */ | |
| 1105 | 955 | sd_trace(("%s: Enter\n", __func__)); |
| 1106 | 956 | |
| 1107 | −#if defined(MMC_SDIO_ABORT) | |
| 1108 | − /* issue abort cmd52 command through F1 */ | |
| 1109 | − sdioh_request_byte(sd, SD_IO_OP_WRITE, SDIO_FUNC_0, SDIOD_CCCR_IOABORT, | |
| 957 | + /* issue abort cmd52 command through F0 */ | |
| 958 | + brcmf_sdioh_request_byte(sd, SDIOH_WRITE, SDIO_FUNC_0, SDIO_CCCR_ABORT, | |
| 1110 | 959 | &t_func); |
| 1111 | −#endif /* defined(MMC_SDIO_ABORT) */ | |
| 1112 | − | |
| 1113 | − sd_trace(("%s: Exit\n", __func__)); | |
| 1114 | − return SDIOH_API_RC_SUCCESS; | |
| 1115 | −} | |
| 1116 | 960 | |
| 1117 | −/* Reset and re-initialize the device */ | |
| 1118 | −int sdioh_sdio_reset(sdioh_info_t *si) | |
| 1119 | −{ | |
| 1120 | − sd_trace(("%s: Enter\n", __func__)); | |
| 1121 | 961 | sd_trace(("%s: Exit\n", __func__)); |
| 1122 | − return SDIOH_API_RC_SUCCESS; | |
| 962 | + return 0; | |
| 1123 | 963 | } |
| 1124 | 964 | |
| 1125 | 965 | /* Disable device interrupt */ |
| 1126 | −void sdioh_sdmmc_devintr_off(sdioh_info_t *sd) | |
| 966 | +void brcmf_sdioh_dev_intr_off(struct sdioh_info *sd) | |
| 1127 | 967 | { |
| 1128 | 968 | sd_trace(("%s: %d\n", __func__, sd->use_client_ints)); |
| 1129 | 969 | sd->intmask &= ~CLIENT_INTR; |
| 1130 | 970 | } |
| 1131 | 971 | |
| 1132 | 972 | /* Enable device interrupt */ |
| 1133 | −void sdioh_sdmmc_devintr_on(sdioh_info_t *sd) | |
| 973 | +void brcmf_sdioh_dev_intr_on(struct sdioh_info *sd) | |
| 1134 | 974 | { |
| 1135 | 975 | sd_trace(("%s: %d\n", __func__, sd->use_client_ints)); |
| 1136 | 976 | sd->intmask |= CLIENT_INTR; |
| @@ -1138,19 +978,19 @@ void sdioh_sdmmc_devintr_on(sdioh_info_t *sd) · 1 unmodified line | ||
| 1138 | 978 | |
| 1139 | 979 | /* Read client card reg */ |
| 1140 | 980 | int |
| 1141 | −sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, u32 regaddr, | |
| 981 | +brcmf_sdioh_card_regread(struct sdioh_info *sd, int func, u32 regaddr, | |
| 1142 | 982 | int regsize, u32 *data) |
| 1143 | 983 | { |
| 1144 | 984 | |
| 1145 | 985 | if ((func == 0) || (regsize == 1)) { |
| 1146 | 986 | u8 temp = 0; |
| 1147 | 987 | |
| 1148 | − sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp); | |
| 988 | + brcmf_sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp); | |
| 1149 | 989 | *data = temp; |
| 1150 | 990 | *data &= 0xff; |
| 1151 | 991 | sd_data(("%s: byte read data=0x%02x\n", __func__, *data)); |
| 1152 | 992 | } else { |
| 1153 | − sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, data, | |
| 993 | + brcmf_sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, data, | |
| 1154 | 994 | regsize); |
| 1155 | 995 | if (regsize == 2) |
| 1156 | 996 | *data &= 0xffff; |
| @@ -1161,25 +1001,20 @@ sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, u32 regaddr, · 4 unmodified lines | ||
| 1161 | 1001 | return SUCCESS; |
| 1162 | 1002 | } |
| 1163 | 1003 | |
| 1164 | −#if !defined(OOB_INTR_ONLY) | |
| 1165 | −/* bcmsdh_sdmmc interrupt handler */ | |
| 1166 | −static void IRQHandler(struct sdio_func *func) | |
| 1004 | +static void brcmf_sdioh_irqhandler(struct sdio_func *func) | |
| 1167 | 1005 | { |
| 1168 | − sdioh_info_t *sd; | |
| 1006 | + struct sdioh_info *sd; | |
| 1169 | 1007 | |
| 1170 | − sd_trace(("bcmsdh_sdmmc: ***IRQHandler\n")); | |
| 1008 | + sd_trace(("brcmf: ***IRQHandler\n")); | |
| 1171 | 1009 | sd = gInstance->sd; |
| 1172 | 1010 | |
| 1173 | − ASSERT(sd != NULL); | |
| 1174 | 1011 | sdio_release_host(gInstance->func[0]); |
| 1175 | 1012 | |
| 1176 | 1013 | if (sd->use_client_ints) { |
| 1177 | 1014 | sd->intrcount++; |
| 1178 | − ASSERT(sd->intr_handler); | |
| 1179 | − ASSERT(sd->intr_handler_arg); | |
| 1180 | 1015 | (sd->intr_handler) (sd->intr_handler_arg); |
| 1181 | 1016 | } else { |
| 1182 | − sd_err(("bcmsdh_sdmmc: ***IRQHandler\n")); | |
| 1017 | + sd_err(("brcmf: ***IRQHandler\n")); | |
| 1183 | 1018 | |
| 1184 | 1019 | sd_err(("%s: Not ready for intr: enabled %d, handler %p\n", |
| 1185 | 1020 | __func__, sd->client_intr_enabled, sd->intr_handler)); |
| @@ -1188,52 +1023,174 @@ static void IRQHandler(struct sdio_func *func) · 2 unmodified lines | ||
| 1188 | 1023 | sdio_claim_host(gInstance->func[0]); |
| 1189 | 1024 | } |
| 1190 | 1025 | |
| 1191 | −/* bcmsdh_sdmmc interrupt handler for F2 (dummy handler) */ | |
| 1192 | −static void IRQHandlerF2(struct sdio_func *func) | |
| 1026 | +/* interrupt handler for F2 (dummy handler) */ | |
| 1027 | +static void brcmf_sdioh_irqhandler_f2(struct sdio_func *func) | |
| 1193 | 1028 | { |
| 1194 | − sdioh_info_t *sd; | |
| 1029 | + struct sdioh_info *sd; | |
| 1195 | 1030 | |
| 1196 | − sd_trace(("bcmsdh_sdmmc: ***IRQHandlerF2\n")); | |
| 1031 | + sd_trace(("brcmf: ***IRQHandlerF2\n")); | |
| 1197 | 1032 | |
| 1198 | 1033 | sd = gInstance->sd; |
| 1034 | +} | |
| 1035 | + | |
| 1036 | +static int brcmf_ops_sdio_probe(struct sdio_func *func, | |
| 1037 | + const struct sdio_device_id *id) | |
| 1038 | +{ | |
| 1039 | + int ret = 0; | |
| 1040 | + static struct sdio_func sdio_func_0; | |
| 1041 | + sd_trace(("sdio_probe: %s Enter\n", __func__)); | |
| 1042 | + sd_trace(("sdio_probe: func->class=%x\n", func->class)); | |
| 1043 | + sd_trace(("sdio_vendor: 0x%04x\n", func->vendor)); | |
| 1044 | + sd_trace(("sdio_device: 0x%04x\n", func->device)); | |
| 1045 | + sd_trace(("Function#: 0x%04x\n", func->num)); | |
| 1046 | + | |
| 1047 | + if (func->num == 1) { | |
| 1048 | + sdio_func_0.num = 0; | |
| 1049 | + sdio_func_0.card = func->card; | |
| 1050 | + gInstance->func[0] = &sdio_func_0; | |
| 1051 | + if (func->device == 0x4) { /* 4318 */ | |
| 1052 | + gInstance->func[2] = NULL; | |
| 1053 | + sd_trace(("NIC found, calling brcmf_sdio_probe...\n")); | |
| 1054 | + ret = brcmf_sdio_probe(&sdmmc_dev); | |
| 1055 | + } | |
| 1056 | + } | |
| 1199 | 1057 | |
| 1200 | − ASSERT(sd != NULL); | |
| 1058 | + gInstance->func[func->num] = func; | |
| 1059 | + | |
| 1060 | + if (func->num == 2) { | |
| 1061 | + brcmf_cfg80211_sdio_func(func); | |
| 1062 | + sd_trace(("F2 found, calling brcmf_sdio_probe...\n")); | |
| 1063 | + ret = brcmf_sdio_probe(&sdmmc_dev); | |
| 1064 | + } | |
| 1065 | + | |
| 1066 | + return ret; | |
| 1201 | 1067 | } |
| 1202 | −#endif /* !defined(OOB_INTR_ONLY) */ | |
| 1203 | 1068 | |
| 1204 | −#ifdef NOTUSED | |
| 1205 | −/* Write client card reg */ | |
| 1206 | −static int | |
| 1207 | −sdioh_sdmmc_card_regwrite(sdioh_info_t *sd, int func, u32 regaddr, | |
| 1208 | − int regsize, u32 data) | |
| 1069 | +static void brcmf_ops_sdio_remove(struct sdio_func *func) | |
| 1209 | 1070 | { |
| 1071 | + sd_trace(("%s Enter\n", __func__)); | |
| 1072 | + sd_info(("func->class=%x\n", func->class)); | |
| 1073 | + sd_info(("sdio_vendor: 0x%04x\n", func->vendor)); | |
| 1074 | + sd_info(("sdio_device: 0x%04x\n", func->device)); | |
| 1075 | + sd_info(("Function#: 0x%04x\n", func->num)); | |
| 1076 | + | |
| 1077 | + if (func->num == 2) { | |
| 1078 | + sd_trace(("F2 found, calling brcmf_sdio_remove...\n")); | |
| 1079 | + brcmf_sdio_remove(&sdmmc_dev); | |
| 1080 | + } | |
| 1081 | +} | |
| 1210 | 1082 | |
| 1211 | − if ((func == 0) || (regsize == 1)) { | |
| 1212 | − u8 temp; | |
| 1213 | 1083 | |
| 1214 | − temp = data & 0xff; | |
| 1215 | − sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp); | |
| 1216 | − sd_data(("%s: byte write data=0x%02x\n", __func__, data)); | |
| 1217 | − } else { | |
| 1218 | − if (regsize == 2) | |
| 1219 | − data &= 0xffff; | |
| 1084 | +#ifdef CONFIG_PM | |
| 1085 | +static int brcmf_sdio_suspend(struct device *dev) | |
| 1086 | +{ | |
| 1087 | + mmc_pm_flag_t sdio_flags; | |
| 1088 | + int ret = 0; | |
| 1220 | 1089 | |
| 1221 | − sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, &data, | |
| 1222 | − regsize); | |
| 1090 | + sd_trace(("%s\n", __func__)); | |
| 1223 | 1091 | |
| 1224 | − sd_data(("%s: word write data=0x%08x\n", __func__, data)); | |
| 1092 | + sdio_flags = sdio_get_host_pm_caps(gInstance->func[1]); | |
| 1093 | + if (!(sdio_flags & MMC_PM_KEEP_POWER)) { | |
| 1094 | + sd_err(("Host can't keep power while suspended\n")); | |
| 1095 | + return -EINVAL; | |
| 1225 | 1096 | } |
| 1226 | 1097 | |
| 1227 | − return SUCCESS; | |
| 1098 | + ret = sdio_set_host_pm_flags(gInstance->func[1], MMC_PM_KEEP_POWER); | |
| 1099 | + if (ret) { | |
| 1100 | + sd_err(("Failed to set pm_flags\n")); | |
| 1101 | + return ret; | |
| 1102 | + } | |
| 1103 | + | |
| 1104 | + brcmf_sdio_wdtmr_enable(false); | |
| 1105 | + | |
| 1106 | + return ret; | |
| 1107 | +} | |
| 1108 | + | |
| 1109 | +static int brcmf_sdio_resume(struct device *dev) | |
| 1110 | +{ | |
| 1111 | + brcmf_sdio_wdtmr_enable(true); | |
| 1112 | + return 0; | |
| 1228 | 1113 | } |
| 1229 | −#endif /* NOTUSED */ | |
| 1114 | +#endif /* CONFIG_PM */ | |
| 1230 | 1115 | |
| 1231 | −int sdioh_start(sdioh_info_t *si, int stage) | |
| 1116 | +int brcmf_sdioh_osinit(struct sdioh_info *sd) | |
| 1232 | 1117 | { |
| 1118 | + struct sdos_info *sdos; | |
| 1119 | + | |
| 1120 | + sdos = kmalloc(sizeof(struct sdos_info), GFP_ATOMIC); | |
| 1121 | + sd->sdos_info = (void *)sdos; | |
| 1122 | + if (sdos == NULL) | |
| 1123 | + return -ENOMEM; | |
| 1124 | + | |
| 1125 | + sdos->sd = sd; | |
| 1126 | + spin_lock_init(&sdos->lock); | |
| 1233 | 1127 | return 0; |
| 1234 | 1128 | } |
| 1235 | 1129 | |
| 1236 | −int sdioh_stop(sdioh_info_t *si) | |
| 1130 | +void brcmf_sdioh_osfree(struct sdioh_info *sd) | |
| 1131 | +{ | |
| 1132 | + struct sdos_info *sdos; | |
| 1133 | + | |
| 1134 | + sdos = (struct sdos_info *)sd->sdos_info; | |
| 1135 | + kfree(sdos); | |
| 1136 | +} | |
| 1137 | + | |
| 1138 | +/* Interrupt enable/disable */ | |
| 1139 | +int brcmf_sdioh_interrupt_set(struct sdioh_info *sd, bool enable) | |
| 1237 | 1140 | { |
| 1141 | + unsigned long flags; | |
| 1142 | + struct sdos_info *sdos; | |
| 1143 | + | |
| 1144 | + sd_trace(("%s: %s\n", __func__, enable ? "Enabling" : "Disabling")); | |
| 1145 | + | |
| 1146 | + sdos = (struct sdos_info *)sd->sdos_info; | |
| 1147 | + | |
| 1148 | + if (enable && !(sd->intr_handler && sd->intr_handler_arg)) { | |
| 1149 | + sd_err(("%s: no handler registered, will not enable\n", | |
| 1150 | + __func__)); | |
| 1151 | + return -EINVAL; | |
| 1152 | + } | |
| 1153 | + | |
| 1154 | + /* Ensure atomicity for enable/disable calls */ | |
| 1155 | + spin_lock_irqsave(&sdos->lock, flags); | |
| 1156 | + | |
| 1157 | + sd->client_intr_enabled = enable; | |
| 1158 | + if (enable) | |
| 1159 | + brcmf_sdioh_dev_intr_on(sd); | |
| 1160 | + else | |
| 1161 | + brcmf_sdioh_dev_intr_off(sd); | |
| 1162 | + | |
| 1163 | + spin_unlock_irqrestore(&sdos->lock, flags); | |
| 1164 | + | |
| 1238 | 1165 | return 0; |
| 1239 | 1166 | } |
| 1167 | + | |
| 1168 | +/* | |
| 1169 | + * module init | |
| 1170 | +*/ | |
| 1171 | +int brcmf_sdio_function_init(void) | |
| 1172 | +{ | |
| 1173 | + int error = 0; | |
| 1174 | + sd_trace(("brcmf_sdio_function_init: %s Enter\n", __func__)); | |
| 1175 | + | |
| 1176 | + gInstance = kzalloc(sizeof(struct brcmf_sdmmc_instance), GFP_KERNEL); | |
| 1177 | + if (!gInstance) | |
| 1178 | + return -ENOMEM; | |
| 1179 | + | |
| 1180 | + memset(&sdmmc_dev, 0, sizeof(sdmmc_dev)); | |
| 1181 | + error = sdio_register_driver(&brcmf_sdmmc_driver); | |
| 1182 | + | |
| 1183 | + return error; | |
| 1184 | +} | |
| 1185 | + | |
| 1186 | +/* | |
| 1187 | + * module cleanup | |
| 1188 | +*/ | |
| 1189 | +void brcmf_sdio_function_cleanup(void) | |
| 1190 | +{ | |
| 1191 | + sd_trace(("%s Enter\n", __func__)); | |
| 1192 | + | |
| 1193 | + sdio_unregister_driver(&brcmf_sdmmc_driver); | |
| 1194 | + | |
| 1195 | + kfree(gInstance); | |
| 1196 | +} | |
| @@ -1,134 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2010 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | − * purpose with or without fee is hereby granted, provided that the above | |
| 6 | − * copyright notice and this permission notice appear in all copies. | |
| 7 | − * | |
| 8 | − * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | − * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | − * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | − * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | − * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | − * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | − * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | − */ | |
| 16 | − | |
| 17 | −#ifndef __BCMSDH_SDMMC_H__ | |
| 18 | −#define __BCMSDH_SDMMC_H__ | |
| 19 | − | |
| 20 | −#ifdef BCMDBG | |
| 21 | −#define sd_err(x) \ | |
| 22 | − do { \ | |
| 23 | − if ((sd_msglevel & SDH_ERROR_VAL) && net_ratelimit()) \ | |
| 24 | − printk x; \ | |
| 25 | − } while (0) | |
| 26 | −#define sd_trace(x) \ | |
| 27 | − do { \ | |
| 28 | − if ((sd_msglevel & SDH_TRACE_VAL) && net_ratelimit()) \ | |
| 29 | − printk x; \ | |
| 30 | − } while (0) | |
| 31 | −#define sd_info(x) \ | |
| 32 | − do { \ | |
| 33 | − if ((sd_msglevel & SDH_INFO_VAL) && net_ratelimit()) \ | |
| 34 | − printk x; \ | |
| 35 | − } while (0) | |
| 36 | −#define sd_debug(x) \ | |
| 37 | − do { \ | |
| 38 | − if ((sd_msglevel & SDH_DEBUG_VAL) && net_ratelimit()) \ | |
| 39 | − printk x; \ | |
| 40 | − } while (0) | |
| 41 | −#define sd_data(x) \ | |
| 42 | − do { \ | |
| 43 | − if ((sd_msglevel & SDH_DATA_VAL) && net_ratelimit()) \ | |
| 44 | − printk x; \ | |
| 45 | − } while (0) | |
| 46 | −#define sd_ctrl(x) \ | |
| 47 | − do { \ | |
| 48 | − if ((sd_msglevel & SDH_CTRL_VAL) && net_ratelimit()) \ | |
| 49 | − printk x; \ | |
| 50 | − } while (0) | |
| 51 | −#else | |
| 52 | −#define sd_err(x) | |
| 53 | −#define sd_trace(x) | |
| 54 | −#define sd_info(x) | |
| 55 | −#define sd_debug(x) | |
| 56 | −#define sd_data(x) | |
| 57 | −#define sd_ctrl(x) | |
| 58 | −#endif | |
| 59 | − | |
| 60 | −/* Allocate/init/free per-OS private data */ | |
| 61 | −extern int sdioh_sdmmc_osinit(sdioh_info_t *sd); | |
| 62 | −extern void sdioh_sdmmc_osfree(sdioh_info_t *sd); | |
| 63 | − | |
| 64 | −#define BLOCK_SIZE_64 64 | |
| 65 | −#define BLOCK_SIZE_512 512 | |
| 66 | −#define BLOCK_SIZE_4318 64 | |
| 67 | −#define BLOCK_SIZE_4328 512 | |
| 68 | − | |
| 69 | −/* internal return code */ | |
| 70 | −#define SUCCESS 0 | |
| 71 | −#define ERROR 1 | |
| 72 | − | |
| 73 | −/* private bus modes */ | |
| 74 | −#define SDIOH_MODE_SD4 2 | |
| 75 | −#define CLIENT_INTR 0x100 /* Get rid of this! */ | |
| 76 | − | |
| 77 | −struct sdioh_info { | |
| 78 | − struct osl_info *osh; /* osh handler */ | |
| 79 | − bool client_intr_enabled; /* interrupt connnected flag */ | |
| 80 | − bool intr_handler_valid; /* client driver interrupt handler valid */ | |
| 81 | − sdioh_cb_fn_t intr_handler; /* registered interrupt handler */ | |
| 82 | − void *intr_handler_arg; /* argument to call interrupt handler */ | |
| 83 | − u16 intmask; /* Current active interrupts */ | |
| 84 | − void *sdos_info; /* Pointer to per-OS private data */ | |
| 85 | − | |
| 86 | − uint irq; /* Client irq */ | |
| 87 | − int intrcount; /* Client interrupts */ | |
| 88 | − bool sd_use_dma; /* DMA on CMD53 */ | |
| 89 | − bool sd_blockmode; /* sd_blockmode == false => 64 Byte Cmd 53s. */ | |
| 90 | − /* Must be on for sd_multiblock to be effective */ | |
| 91 | − bool use_client_ints; /* If this is false, make sure to restore */ | |
| 92 | − int sd_mode; /* SD1/SD4/SPI */ | |
| 93 | − int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */ | |
| 94 | − u8 num_funcs; /* Supported funcs on client */ | |
| 95 | − u32 com_cis_ptr; | |
| 96 | − u32 func_cis_ptr[SDIOD_MAX_IOFUNCS]; | |
| 97 | − uint max_dma_len; | |
| 98 | − uint max_dma_descriptors; /* DMA Descriptors supported by this controller. */ | |
| 99 | − /* SDDMA_DESCRIPTOR SGList[32]; *//* Scatter/Gather DMA List */ | |
| 100 | −}; | |
| 101 | − | |
| 102 | −/************************************************************ | |
| 103 | − * Internal interfaces: per-port references into bcmsdh_sdmmc.c | |
| 104 | − */ | |
| 105 | − | |
| 106 | −/* Global message bits */ | |
| 107 | −extern uint sd_msglevel; | |
| 108 | − | |
| 109 | −/* OS-independent interrupt handler */ | |
| 110 | −extern bool check_client_intr(sdioh_info_t *sd); | |
| 111 | − | |
| 112 | −/* Core interrupt enable/disable of device interrupts */ | |
| 113 | −extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd); | |
| 114 | −extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd); | |
| 115 | − | |
| 116 | −/************************************************************** | |
| 117 | − * Internal interfaces: bcmsdh_sdmmc.c references to per-port code | |
| 118 | − */ | |
| 119 | − | |
| 120 | −/* Register mapping routines */ | |
| 121 | −extern u32 *sdioh_sdmmc_reg_map(s32 addr, int size); | |
| 122 | −extern void sdioh_sdmmc_reg_unmap(s32 addr, int size); | |
| 123 | − | |
| 124 | −/* Interrupt (de)registration routines */ | |
| 125 | −extern int sdioh_sdmmc_register_irq(sdioh_info_t *sd, uint irq); | |
| 126 | −extern void sdioh_sdmmc_free_irq(uint irq, sdioh_info_t *sd); | |
| 127 | − | |
| 128 | −typedef struct _BCMSDH_SDMMC_INSTANCE { | |
| 129 | − sdioh_info_t *sd; | |
| 130 | − struct sdio_func *func[SDIOD_MAX_IOFUNCS]; | |
| 131 | − u32 host_claimed; | |
| 132 | −} BCMSDH_SDMMC_INSTANCE, *PBCMSDH_SDMMC_INSTANCE; | |
| 133 | − | |
| 134 | −#endif /* __BCMSDH_SDMMC_H__ */ | |
| @@ -1,235 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2010 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | − * purpose with or without fee is hereby granted, provided that the above | |
| 6 | − * copyright notice and this permission notice appear in all copies. | |
| 7 | − * | |
| 8 | − * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | − * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | − * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | − * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | − * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | − * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | − * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | − */ | |
| 16 | −#include <linux/types.h> | |
| 17 | −#include <linux/sched.h> /* request_irq() */ | |
| 18 | −#include <linux/netdevice.h> | |
| 19 | −#include <bcmdefs.h> | |
| 20 | −#include <bcmutils.h> | |
| 21 | −#include <sdio.h> /* SDIO Specs */ | |
| 22 | −#include <bcmsdbus.h> /* bcmsdh to/from specific controller APIs */ | |
| 23 | −#include <sdiovar.h> /* to get msglevel bit values */ | |
| 24 | − | |
| 25 | −#include <linux/mmc/core.h> | |
| 26 | −#include <linux/mmc/card.h> | |
| 27 | −#include <linux/mmc/sdio_func.h> | |
| 28 | −#include <linux/mmc/sdio_ids.h> | |
| 29 | − | |
| 30 | −#include "dngl_stats.h" | |
| 31 | −#include "dhd.h" | |
| 32 | − | |
| 33 | −#if !defined(SDIO_VENDOR_ID_BROADCOM) | |
| 34 | −#define SDIO_VENDOR_ID_BROADCOM 0x02d0 | |
| 35 | −#endif /* !defined(SDIO_VENDOR_ID_BROADCOM) */ | |
| 36 | − | |
| 37 | −#define SDIO_DEVICE_ID_BROADCOM_DEFAULT 0x0000 | |
| 38 | − | |
| 39 | −#if !defined(SDIO_DEVICE_ID_BROADCOM_4325_SDGWB) | |
| 40 | −#define SDIO_DEVICE_ID_BROADCOM_4325_SDGWB 0x0492 /* BCM94325SDGWB */ | |
| 41 | −#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4325_SDGWB) */ | |
| 42 | −#if !defined(SDIO_DEVICE_ID_BROADCOM_4325) | |
| 43 | −#define SDIO_DEVICE_ID_BROADCOM_4325 0x0493 | |
| 44 | −#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4325) */ | |
| 45 | −#if !defined(SDIO_DEVICE_ID_BROADCOM_4329) | |
| 46 | −#define SDIO_DEVICE_ID_BROADCOM_4329 0x4329 | |
| 47 | −#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4329) */ | |
| 48 | −#if !defined(SDIO_DEVICE_ID_BROADCOM_4319) | |
| 49 | −#define SDIO_DEVICE_ID_BROADCOM_4319 0x4319 | |
| 50 | −#endif /* !defined(SDIO_DEVICE_ID_BROADCOM_4329) */ | |
| 51 | − | |
| 52 | −#include <bcmsdh_sdmmc.h> | |
| 53 | − | |
| 54 | −#include <dhd_dbg.h> | |
| 55 | −#include <wl_cfg80211.h> | |
| 56 | − | |
| 57 | −extern void sdioh_sdmmc_devintr_off(sdioh_info_t *sd); | |
| 58 | −extern void sdioh_sdmmc_devintr_on(sdioh_info_t *sd); | |
| 59 | − | |
| 60 | −int sdio_function_init(void); | |
| 61 | −void sdio_function_cleanup(void); | |
| 62 | − | |
| 63 | −/* module param defaults */ | |
| 64 | −static int clockoverride; | |
| 65 | − | |
| 66 | −module_param(clockoverride, int, 0644); | |
| 67 | −MODULE_PARM_DESC(clockoverride, "SDIO card clock override"); | |
| 68 | − | |
| 69 | −PBCMSDH_SDMMC_INSTANCE gInstance; | |
| 70 | − | |
| 71 | −/* Maximum number of bcmsdh_sdmmc devices supported by driver */ | |
| 72 | −#define BCMSDH_SDMMC_MAX_DEVICES 1 | |
| 73 | − | |
| 74 | −extern int bcmsdh_probe(struct device *dev); | |
| 75 | −extern int bcmsdh_remove(struct device *dev); | |
| 76 | −struct device sdmmc_dev; | |
| 77 | − | |
| 78 | −static int bcmsdh_sdmmc_probe(struct sdio_func *func, | |
| 79 | − const struct sdio_device_id *id) | |
| 80 | −{ | |
| 81 | − int ret = 0; | |
| 82 | − static struct sdio_func sdio_func_0; | |
| 83 | − sd_trace(("bcmsdh_sdmmc: %s Enter\n", __func__)); | |
| 84 | − sd_trace(("sdio_bcmsdh: func->class=%x\n", func->class)); | |
| 85 | − sd_trace(("sdio_vendor: 0x%04x\n", func->vendor)); | |
| 86 | − sd_trace(("sdio_device: 0x%04x\n", func->device)); | |
| 87 | − sd_trace(("Function#: 0x%04x\n", func->num)); | |
| 88 | − | |
| 89 | − if (func->num == 1) { | |
| 90 | − sdio_func_0.num = 0; | |
| 91 | − sdio_func_0.card = func->card; | |
| 92 | − gInstance->func[0] = &sdio_func_0; | |
| 93 | − if (func->device == 0x4) { /* 4318 */ | |
| 94 | − gInstance->func[2] = NULL; | |
| 95 | − sd_trace(("NIC found, calling bcmsdh_probe...\n")); | |
| 96 | − ret = bcmsdh_probe(&sdmmc_dev); | |
| 97 | − } | |
| 98 | − } | |
| 99 | − | |
| 100 | − gInstance->func[func->num] = func; | |
| 101 | − | |
| 102 | − if (func->num == 2) { | |
| 103 | − wl_cfg80211_sdio_func(func); | |
| 104 | − sd_trace(("F2 found, calling bcmsdh_probe...\n")); | |
| 105 | − ret = bcmsdh_probe(&sdmmc_dev); | |
| 106 | − } | |
| 107 | − | |
| 108 | − return ret; | |
| 109 | −} | |
| 110 | − | |
| 111 | −static void bcmsdh_sdmmc_remove(struct sdio_func *func) | |
| 112 | −{ | |
| 113 | − sd_trace(("bcmsdh_sdmmc: %s Enter\n", __func__)); | |
| 114 | − sd_info(("sdio_bcmsdh: func->class=%x\n", func->class)); | |
| 115 | − sd_info(("sdio_vendor: 0x%04x\n", func->vendor)); | |
| 116 | − sd_info(("sdio_device: 0x%04x\n", func->device)); | |
| 117 | − sd_info(("Function#: 0x%04x\n", func->num)); | |
| 118 | − | |
| 119 | − if (func->num == 2) { | |
| 120 | − sd_trace(("F2 found, calling bcmsdh_remove...\n")); | |
| 121 | − bcmsdh_remove(&sdmmc_dev); | |
| 122 | − } | |
| 123 | −} | |
| 124 | − | |
| 125 | −/* devices we support, null terminated */ | |
| 126 | −static const struct sdio_device_id bcmsdh_sdmmc_ids[] = { | |
| 127 | − {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_DEFAULT)}, | |
| 128 | − {SDIO_DEVICE | |
| 129 | − (SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325_SDGWB)}, | |
| 130 | − {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4325)}, | |
| 131 | − {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4329)}, | |
| 132 | − {SDIO_DEVICE(SDIO_VENDOR_ID_BROADCOM, SDIO_DEVICE_ID_BROADCOM_4319)}, | |
| 133 | − { /* end: all zeroes */ }, | |
| 134 | −}; | |
| 135 | − | |
| 136 | −MODULE_DEVICE_TABLE(sdio, bcmsdh_sdmmc_ids); | |
| 137 | − | |
| 138 | −static struct sdio_driver bcmsdh_sdmmc_driver = { | |
| 139 | − .probe = bcmsdh_sdmmc_probe, | |
| 140 | − .remove = bcmsdh_sdmmc_remove, | |
| 141 | − .name = "brcmfmac", | |
| 142 | − .id_table = bcmsdh_sdmmc_ids, | |
| 143 | −}; | |
| 144 | − | |
| 145 | −struct sdos_info { | |
| 146 | − sdioh_info_t *sd; | |
| 147 | − spinlock_t lock; | |
| 148 | −}; | |
| 149 | − | |
| 150 | −int sdioh_sdmmc_osinit(sdioh_info_t *sd) | |
| 151 | −{ | |
| 152 | − struct sdos_info *sdos; | |
| 153 | − | |
| 154 | − sdos = kmalloc(sizeof(struct sdos_info), GFP_ATOMIC); | |
| 155 | − sd->sdos_info = (void *)sdos; | |
| 156 | − if (sdos == NULL) | |
| 157 | − return -ENOMEM; | |
| 158 | − | |
| 159 | − sdos->sd = sd; | |
| 160 | − spin_lock_init(&sdos->lock); | |
| 161 | − return 0; | |
| 162 | −} | |
| 163 | − | |
| 164 | −void sdioh_sdmmc_osfree(sdioh_info_t *sd) | |
| 165 | −{ | |
| 166 | − struct sdos_info *sdos; | |
| 167 | − ASSERT(sd && sd->sdos_info); | |
| 168 | − | |
| 169 | − sdos = (struct sdos_info *)sd->sdos_info; | |
| 170 | − kfree(sdos); | |
| 171 | −} | |
| 172 | − | |
| 173 | −/* Interrupt enable/disable */ | |
| 174 | −SDIOH_API_RC sdioh_interrupt_set(sdioh_info_t *sd, bool enable) | |
| 175 | −{ | |
| 176 | − unsigned long flags; | |
| 177 | − struct sdos_info *sdos; | |
| 178 | − | |
| 179 | − sd_trace(("%s: %s\n", __func__, enable ? "Enabling" : "Disabling")); | |
| 180 | − | |
| 181 | − sdos = (struct sdos_info *)sd->sdos_info; | |
| 182 | − ASSERT(sdos); | |
| 183 | − | |
| 184 | −#if !defined(OOB_INTR_ONLY) | |
| 185 | − if (enable && !(sd->intr_handler && sd->intr_handler_arg)) { | |
| 186 | − sd_err(("%s: no handler registered, will not enable\n", | |
| 187 | − __func__)); | |
| 188 | − return SDIOH_API_RC_FAIL; | |
| 189 | − } | |
| 190 | −#endif /* !defined(OOB_INTR_ONLY) */ | |
| 191 | − | |
| 192 | − /* Ensure atomicity for enable/disable calls */ | |
| 193 | − spin_lock_irqsave(&sdos->lock, flags); | |
| 194 | − | |
| 195 | − sd->client_intr_enabled = enable; | |
| 196 | − if (enable) | |
| 197 | − sdioh_sdmmc_devintr_on(sd); | |
| 198 | − else | |
| 199 | − sdioh_sdmmc_devintr_off(sd); | |
| 200 | − | |
| 201 | − spin_unlock_irqrestore(&sdos->lock, flags); | |
| 202 | − | |
| 203 | − return SDIOH_API_RC_SUCCESS; | |
| 204 | −} | |
| 205 | − | |
| 206 | −/* | |
| 207 | − * module init | |
| 208 | −*/ | |
| 209 | −int sdio_function_init(void) | |
| 210 | −{ | |
| 211 | − int error = 0; | |
| 212 | − sd_trace(("bcmsdh_sdmmc: %s Enter\n", __func__)); | |
| 213 | − | |
| 214 | − gInstance = kzalloc(sizeof(BCMSDH_SDMMC_INSTANCE), GFP_KERNEL); | |
| 215 | − if (!gInstance) | |
| 216 | − return -ENOMEM; | |
| 217 | − | |
| 218 | − memset(&sdmmc_dev, 0, sizeof(sdmmc_dev)); | |
| 219 | − error = sdio_register_driver(&bcmsdh_sdmmc_driver); | |
| 220 | − | |
| 221 | − return error; | |
| 222 | −} | |
| 223 | − | |
| 224 | −/* | |
| 225 | − * module cleanup | |
| 226 | −*/ | |
| 227 | −extern int bcmsdh_remove(struct device *dev); | |
| 228 | −void sdio_function_cleanup(void) | |
| 229 | −{ | |
| 230 | − sd_trace(("%s Enter\n", __func__)); | |
| 231 | − | |
| 232 | − sdio_unregister_driver(&bcmsdh_sdmmc_driver); | |
| 233 | − | |
| 234 | − kfree(gInstance); | |
| 235 | −} | |
| @@ -18,51 +18,539 @@ · 17 unmodified lines | ||
| 18 | 18 | * Common types * |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | −#ifndef _dhd_h_ | |
| 22 | −#define _dhd_h_ | |
| 23 | − | |
| 24 | −#include <linux/sched.h> | |
| 25 | −#include <linux/init.h> | |
| 26 | −#include <linux/kernel.h> | |
| 27 | −#include <linux/slab.h> | |
| 28 | −#include <linux/skbuff.h> | |
| 29 | −#include <linux/netdevice.h> | |
| 30 | −#include <linux/etherdevice.h> | |
| 31 | −#include <linux/random.h> | |
| 32 | −#include <linux/spinlock.h> | |
| 33 | −#include <linux/ethtool.h> | |
| 34 | −#include <linux/suspend.h> | |
| 35 | −#include <asm/uaccess.h> | |
| 36 | −#include <asm/unaligned.h> | |
| 37 | −/* The kernel threading is sdio-specific */ | |
| 38 | − | |
| 39 | −#include <wlioctl.h> | |
| 40 | − | |
| 41 | −/* Forward decls */ | |
| 42 | −struct dhd_bus; | |
| 43 | −struct dhd_prot; | |
| 44 | −struct dhd_info; | |
| 21 | +#ifndef _BRCMF_H_ | |
| 22 | +#define _BRCMF_H_ | |
| 23 | + | |
| 24 | +#define BRCMF_VERSION_STR "4.218.248.5" | |
| 25 | + | |
| 26 | +#define BRCMF_C_IOCTL_SMLEN 256 /* "small" ioctl buffer required */ | |
| 27 | +#define BRCMF_C_IOCTL_MEDLEN 1536 /* "med" ioctl buffer required */ | |
| 28 | +#define BRCMF_C_IOCTL_MAXLEN 8192 | |
| 29 | + | |
| 30 | +#define BRCMF_C_UP 2 | |
| 31 | +#define BRCMF_C_SET_PROMISC 10 | |
| 32 | +#define BRCMF_C_GET_RATE 12 | |
| 33 | +#define BRCMF_C_GET_INFRA 19 | |
| 34 | +#define BRCMF_C_SET_INFRA 20 | |
| 35 | +#define BRCMF_C_GET_AUTH 21 | |
| 36 | +#define BRCMF_C_SET_AUTH 22 | |
| 37 | +#define BRCMF_C_GET_BSSID 23 | |
| 38 | +#define BRCMF_C_GET_SSID 25 | |
| 39 | +#define BRCMF_C_SET_SSID 26 | |
| 40 | +#define BRCMF_C_GET_CHANNEL 29 | |
| 41 | +#define BRCMF_C_GET_SRL 31 | |
| 42 | +#define BRCMF_C_GET_LRL 33 | |
| 43 | +#define BRCMF_C_GET_RADIO 37 | |
| 44 | +#define BRCMF_C_SET_RADIO 38 | |
| 45 | +#define BRCMF_C_GET_PHYTYPE 39 | |
| 46 | +#define BRCMF_C_SET_KEY 45 | |
| 47 | +#define BRCMF_C_SET_PASSIVE_SCAN 49 | |
| 48 | +#define BRCMF_C_SCAN 50 | |
| 49 | +#define BRCMF_C_SCAN_RESULTS 51 | |
| 50 | +#define BRCMF_C_DISASSOC 52 | |
| 51 | +#define BRCMF_C_REASSOC 53 | |
| 52 | +#define BRCMF_C_SET_ROAM_TRIGGER 55 | |
| 53 | +#define BRCMF_C_SET_ROAM_DELTA 57 | |
| 54 | +#define BRCMF_C_GET_DTIMPRD 77 | |
| 55 | +#define BRCMF_C_SET_COUNTRY 84 | |
| 56 | +#define BRCMF_C_GET_PM 85 | |
| 57 | +#define BRCMF_C_SET_PM 86 | |
| 58 | +#define BRCMF_C_GET_AP 117 | |
| 59 | +#define BRCMF_C_SET_AP 118 | |
| 60 | +#define BRCMF_C_GET_RSSI 127 | |
| 61 | +#define BRCMF_C_GET_WSEC 133 | |
| 62 | +#define BRCMF_C_SET_WSEC 134 | |
| 63 | +#define BRCMF_C_GET_PHY_NOISE 135 | |
| 64 | +#define BRCMF_C_GET_BSS_INFO 136 | |
| 65 | +#define BRCMF_C_SET_SCAN_CHANNEL_TIME 185 | |
| 66 | +#define BRCMF_C_SET_SCAN_UNASSOC_TIME 187 | |
| 67 | +#define BRCMF_C_SCB_DEAUTHENTICATE_FOR_REASON 201 | |
| 68 | +#define BRCMF_C_GET_VALID_CHANNELS 217 | |
| 69 | +#define BRCMF_C_GET_KEY_PRIMARY 235 | |
| 70 | +#define BRCMF_C_SET_KEY_PRIMARY 236 | |
| 71 | +#define BRCMF_C_SET_SCAN_PASSIVE_TIME 258 | |
| 72 | +#define BRCMF_C_GET_VAR 262 | |
| 73 | +#define BRCMF_C_SET_VAR 263 | |
| 74 | + | |
| 75 | +/* phy types (returned by WLC_GET_PHYTPE) */ | |
| 76 | +#define WLC_PHY_TYPE_A 0 | |
| 77 | +#define WLC_PHY_TYPE_B 1 | |
| 78 | +#define WLC_PHY_TYPE_G 2 | |
| 79 | +#define WLC_PHY_TYPE_N 4 | |
| 80 | +#define WLC_PHY_TYPE_LP 5 | |
| 81 | +#define WLC_PHY_TYPE_SSN 6 | |
| 82 | +#define WLC_PHY_TYPE_HT 7 | |
| 83 | +#define WLC_PHY_TYPE_LCN 8 | |
| 84 | +#define WLC_PHY_TYPE_NULL 0xf | |
| 85 | + | |
| 86 | +#define BRCMF_PKT_FILTER_FIXED_LEN offsetof(struct brcmf_pkt_filter, u) | |
| 87 | +#define BRCMF_PKT_FILTER_PATTERN_FIXED_LEN \ | |
| 88 | + offsetof(struct brcmf_pkt_filter_pattern, mask_and_pattern) | |
| 89 | + | |
| 90 | +#define BRCMF_EVENTING_MASK_LEN 16 | |
| 91 | + | |
| 92 | +#define TOE_TX_CSUM_OL 0x00000001 | |
| 93 | +#define TOE_RX_CSUM_OL 0x00000002 | |
| 94 | + | |
| 95 | +/* maximum channels returned by the get valid channels iovar */ | |
| 96 | +#define WL_NUMCHANNELS 64 | |
| 97 | + | |
| 98 | +#define BRCMF_BSS_INFO_VERSION 108 /* current ver of brcmf_bss_info struct */ | |
| 99 | + | |
| 100 | +/* size of brcmf_scan_params not including variable length array */ | |
| 101 | +#define BRCMF_SCAN_PARAMS_FIXED_SIZE 64 | |
| 102 | + | |
| 103 | +/* masks for channel and ssid count */ | |
| 104 | +#define BRCMF_SCAN_PARAMS_COUNT_MASK 0x0000ffff | |
| 105 | +#define BRCMF_SCAN_PARAMS_NSSID_SHIFT 16 | |
| 106 | + | |
| 107 | +#define BRCMF_SCAN_ACTION_START 1 | |
| 108 | +#define BRCMF_SCAN_ACTION_CONTINUE 2 | |
| 109 | +#define WL_SCAN_ACTION_ABORT 3 | |
| 110 | + | |
| 111 | +#define BRCMF_ISCAN_REQ_VERSION 1 | |
| 112 | + | |
| 113 | +/* brcmf_iscan_results status values */ | |
| 114 | +#define BRCMF_SCAN_RESULTS_SUCCESS 0 | |
| 115 | +#define BRCMF_SCAN_RESULTS_PARTIAL 1 | |
| 116 | +#define BRCMF_SCAN_RESULTS_PENDING 2 | |
| 117 | +#define BRCMF_SCAN_RESULTS_ABORTED 3 | |
| 118 | +#define BRCMF_SCAN_RESULTS_NO_MEM 4 | |
| 119 | + | |
| 120 | +#define WL_SOFT_KEY (1 << 0) /* Indicates this key is using soft encrypt */ | |
| 121 | +#define BRCMF_PRIMARY_KEY (1 << 1) /* primary (ie tx) key */ | |
| 122 | +#define WL_KF_RES_4 (1 << 4) /* Reserved for backward compat */ | |
| 123 | +#define WL_KF_RES_5 (1 << 5) /* Reserved for backward compat */ | |
| 124 | +#define WL_IBSS_PEER_GROUP_KEY (1 << 6) /* Indicates a group key for a IBSS PEER */ | |
| 125 | + | |
| 126 | +/* For supporting multiple interfaces */ | |
| 127 | +#define BRCMF_MAX_IFS 16 | |
| 128 | +#define BRCMF_DEL_IF -0xe | |
| 129 | +#define BRCMF_BAD_IF -0xf | |
| 130 | + | |
| 131 | +#define DOT11_BSSTYPE_ANY 2 | |
| 132 | +#define DOT11_MAX_DEFAULT_KEYS 4 | |
| 133 | + | |
| 134 | +#define BRCMF_EVENT_MSG_LINK 0x01 | |
| 135 | +#define BRCMF_EVENT_MSG_FLUSHTXQ 0x02 | |
| 136 | +#define BRCMF_EVENT_MSG_GROUP 0x04 | |
| 137 | + | |
| 138 | +struct brcmf_event_msg { | |
| 139 | + u16 version; | |
| 140 | + u16 flags; | |
| 141 | + u32 event_type; | |
| 142 | + u32 status; | |
| 143 | + u32 reason; | |
| 144 | + u32 auth_type; | |
| 145 | + u32 datalen; | |
| 146 | + u8 addr[ETH_ALEN]; | |
| 147 | + char ifname[IFNAMSIZ]; | |
| 148 | +} __packed; | |
| 149 | + | |
| 150 | +struct brcm_ethhdr { | |
| 151 | + u16 subtype; | |
| 152 | + u16 length; | |
| 153 | + u8 version; | |
| 154 | + u8 oui[3]; | |
| 155 | + u16 usr_subtype; | |
| 156 | +} __packed; | |
| 157 | + | |
| 158 | +struct brcmf_event { | |
| 159 | + struct ethhdr eth; | |
| 160 | + struct brcm_ethhdr hdr; | |
| 161 | + struct brcmf_event_msg msg; | |
| 162 | +} __packed; | |
| 163 | + | |
| 164 | +struct dngl_stats { | |
| 165 | + unsigned long rx_packets; /* total packets received */ | |
| 166 | + unsigned long tx_packets; /* total packets transmitted */ | |
| 167 | + unsigned long rx_bytes; /* total bytes received */ | |
| 168 | + unsigned long tx_bytes; /* total bytes transmitted */ | |
| 169 | + unsigned long rx_errors; /* bad packets received */ | |
| 170 | + unsigned long tx_errors; /* packet transmit problems */ | |
| 171 | + unsigned long rx_dropped; /* packets dropped by dongle */ | |
| 172 | + unsigned long tx_dropped; /* packets dropped by dongle */ | |
| 173 | + unsigned long multicast; /* multicast packets received */ | |
| 174 | +}; | |
| 175 | + | |
| 176 | +#define BRCMF_E_SET_SSID 0 | |
| 177 | +#define BRCMF_E_JOIN 1 | |
| 178 | +#define BRCMF_E_START 2 | |
| 179 | +#define BRCMF_E_AUTH 3 | |
| 180 | +#define BRCMF_E_AUTH_IND 4 | |
| 181 | +#define BRCMF_E_DEAUTH 5 | |
| 182 | +#define BRCMF_E_DEAUTH_IND 6 | |
| 183 | +#define BRCMF_E_ASSOC 7 | |
| 184 | +#define BRCMF_E_ASSOC_IND 8 | |
| 185 | +#define BRCMF_E_REASSOC 9 | |
| 186 | +#define BRCMF_E_REASSOC_IND 10 | |
| 187 | +#define BRCMF_E_DISASSOC 11 | |
| 188 | +#define BRCMF_E_DISASSOC_IND 12 | |
| 189 | +#define BRCMF_E_QUIET_START 13 | |
| 190 | +#define BRCMF_E_QUIET_END 14 | |
| 191 | +#define BRCMF_E_BEACON_RX 15 | |
| 192 | +#define BRCMF_E_LINK 16 | |
| 193 | +#define BRCMF_E_MIC_ERROR 17 | |
| 194 | +#define BRCMF_E_NDIS_LINK 18 | |
| 195 | +#define BRCMF_E_ROAM 19 | |
| 196 | +#define BRCMF_E_TXFAIL 20 | |
| 197 | +#define BRCMF_E_PMKID_CACHE 21 | |
| 198 | +#define BRCMF_E_RETROGRADE_TSF 22 | |
| 199 | +#define BRCMF_E_PRUNE 23 | |
| 200 | +#define BRCMF_E_AUTOAUTH 24 | |
| 201 | +#define BRCMF_E_EAPOL_MSG 25 | |
| 202 | +#define BRCMF_E_SCAN_COMPLETE 26 | |
| 203 | +#define BRCMF_E_ADDTS_IND 27 | |
| 204 | +#define BRCMF_E_DELTS_IND 28 | |
| 205 | +#define BRCMF_E_BCNSENT_IND 29 | |
| 206 | +#define BRCMF_E_BCNRX_MSG 30 | |
| 207 | +#define BRCMF_E_BCNLOST_MSG 31 | |
| 208 | +#define BRCMF_E_ROAM_PREP 32 | |
| 209 | +#define BRCMF_E_PFN_NET_FOUND 33 | |
| 210 | +#define BRCMF_E_PFN_NET_LOST 34 | |
| 211 | +#define BRCMF_E_RESET_COMPLETE 35 | |
| 212 | +#define BRCMF_E_JOIN_START 36 | |
| 213 | +#define BRCMF_E_ROAM_START 37 | |
| 214 | +#define BRCMF_E_ASSOC_START 38 | |
| 215 | +#define BRCMF_E_IBSS_ASSOC 39 | |
| 216 | +#define BRCMF_E_RADIO 40 | |
| 217 | +#define BRCMF_E_PSM_WATCHDOG 41 | |
| 218 | +#define BRCMF_E_PROBREQ_MSG 44 | |
| 219 | +#define BRCMF_E_SCAN_CONFIRM_IND 45 | |
| 220 | +#define BRCMF_E_PSK_SUP 46 | |
| 221 | +#define BRCMF_E_COUNTRY_CODE_CHANGED 47 | |
| 222 | +#define BRCMF_E_EXCEEDED_MEDIUM_TIME 48 | |
| 223 | +#define BRCMF_E_ICV_ERROR 49 | |
| 224 | +#define BRCMF_E_UNICAST_DECODE_ERROR 50 | |
| 225 | +#define BRCMF_E_MULTICAST_DECODE_ERROR 51 | |
| 226 | +#define BRCMF_E_TRACE 52 | |
| 227 | +#define BRCMF_E_IF 54 | |
| 228 | +#define BRCMF_E_RSSI 56 | |
| 229 | +#define BRCMF_E_PFN_SCAN_COMPLETE 57 | |
| 230 | +#define BRCMF_E_EXTLOG_MSG 58 | |
| 231 | +#define BRCMF_E_ACTION_FRAME 59 | |
| 232 | +#define BRCMF_E_ACTION_FRAME_COMPLETE 60 | |
| 233 | +#define BRCMF_E_PRE_ASSOC_IND 61 | |
| 234 | +#define BRCMF_E_PRE_REASSOC_IND 62 | |
| 235 | +#define BRCMF_E_CHANNEL_ADOPTED 63 | |
| 236 | +#define BRCMF_E_AP_STARTED 64 | |
| 237 | +#define BRCMF_E_DFS_AP_STOP 65 | |
| 238 | +#define BRCMF_E_DFS_AP_RESUME 66 | |
| 239 | +#define BRCMF_E_RESERVED1 67 | |
| 240 | +#define BRCMF_E_RESERVED2 68 | |
| 241 | +#define BRCMF_E_ESCAN_RESULT 69 | |
| 242 | +#define BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE 70 | |
| 243 | +#define BRCMF_E_DCS_REQUEST 73 | |
| 244 | + | |
| 245 | +#define BRCMF_E_FIFO_CREDIT_MAP 74 | |
| 246 | + | |
| 247 | +#define BRCMF_E_LAST 75 | |
| 248 | + | |
| 249 | +#define BRCMF_E_STATUS_SUCCESS 0 | |
| 250 | +#define BRCMF_E_STATUS_FAIL 1 | |
| 251 | +#define BRCMF_E_STATUS_TIMEOUT 2 | |
| 252 | +#define BRCMF_E_STATUS_NO_NETWORKS 3 | |
| 253 | +#define BRCMF_E_STATUS_ABORT 4 | |
| 254 | +#define BRCMF_E_STATUS_NO_ACK 5 | |
| 255 | +#define BRCMF_E_STATUS_UNSOLICITED 6 | |
| 256 | +#define BRCMF_E_STATUS_ATTEMPT 7 | |
| 257 | +#define BRCMF_E_STATUS_PARTIAL 8 | |
| 258 | +#define BRCMF_E_STATUS_NEWSCAN 9 | |
| 259 | +#define BRCMF_E_STATUS_NEWASSOC 10 | |
| 260 | +#define BRCMF_E_STATUS_11HQUIET 11 | |
| 261 | +#define BRCMF_E_STATUS_SUPPRESS 12 | |
| 262 | +#define BRCMF_E_STATUS_NOCHANS 13 | |
| 263 | +#define BRCMF_E_STATUS_CS_ABORT 15 | |
| 264 | +#define BRCMF_E_STATUS_ERROR 16 | |
| 265 | + | |
| 266 | +#define BRCMF_E_REASON_INITIAL_ASSOC 0 | |
| 267 | +#define BRCMF_E_REASON_LOW_RSSI 1 | |
| 268 | +#define BRCMF_E_REASON_DEAUTH 2 | |
| 269 | +#define BRCMF_E_REASON_DISASSOC 3 | |
| 270 | +#define BRCMF_E_REASON_BCNS_LOST 4 | |
| 271 | +#define BRCMF_E_REASON_MINTXRATE 9 | |
| 272 | +#define BRCMF_E_REASON_TXFAIL 10 | |
| 273 | + | |
| 274 | +#define BRCMF_E_REASON_FAST_ROAM_FAILED 5 | |
| 275 | +#define BRCMF_E_REASON_DIRECTED_ROAM 6 | |
| 276 | +#define BRCMF_E_REASON_TSPEC_REJECTED 7 | |
| 277 | +#define BRCMF_E_REASON_BETTER_AP 8 | |
| 278 | + | |
| 279 | +#define BRCMF_E_PRUNE_ENCR_MISMATCH 1 | |
| 280 | +#define BRCMF_E_PRUNE_BCAST_BSSID 2 | |
| 281 | +#define BRCMF_E_PRUNE_MAC_DENY 3 | |
| 282 | +#define BRCMF_E_PRUNE_MAC_NA 4 | |
| 283 | +#define BRCMF_E_PRUNE_REG_PASSV 5 | |
| 284 | +#define BRCMF_E_PRUNE_SPCT_MGMT 6 | |
| 285 | +#define BRCMF_E_PRUNE_RADAR 7 | |
| 286 | +#define BRCMF_E_RSN_MISMATCH 8 | |
| 287 | +#define BRCMF_E_PRUNE_NO_COMMON_RATES 9 | |
| 288 | +#define BRCMF_E_PRUNE_BASIC_RATES 10 | |
| 289 | +#define BRCMF_E_PRUNE_CIPHER_NA 12 | |
| 290 | +#define BRCMF_E_PRUNE_KNOWN_STA 13 | |
| 291 | +#define BRCMF_E_PRUNE_WDS_PEER 15 | |
| 292 | +#define BRCMF_E_PRUNE_QBSS_LOAD 16 | |
| 293 | +#define BRCMF_E_PRUNE_HOME_AP 17 | |
| 294 | + | |
| 295 | +#define BRCMF_E_SUP_OTHER 0 | |
| 296 | +#define BRCMF_E_SUP_DECRYPT_KEY_DATA 1 | |
| 297 | +#define BRCMF_E_SUP_BAD_UCAST_WEP128 2 | |
| 298 | +#define BRCMF_E_SUP_BAD_UCAST_WEP40 3 | |
| 299 | +#define BRCMF_E_SUP_UNSUP_KEY_LEN 4 | |
| 300 | +#define BRCMF_E_SUP_PW_KEY_CIPHER 5 | |
| 301 | +#define BRCMF_E_SUP_MSG3_TOO_MANY_IE 6 | |
| 302 | +#define BRCMF_E_SUP_MSG3_IE_MISMATCH 7 | |
| 303 | +#define BRCMF_E_SUP_NO_INSTALL_FLAG 8 | |
| 304 | +#define BRCMF_E_SUP_MSG3_NO_GTK 9 | |
| 305 | +#define BRCMF_E_SUP_GRP_KEY_CIPHER 10 | |
| 306 | +#define BRCMF_E_SUP_GRP_MSG1_NO_GTK 11 | |
| 307 | +#define BRCMF_E_SUP_GTK_DECRYPT_FAIL 12 | |
| 308 | +#define BRCMF_E_SUP_SEND_FAIL 13 | |
| 309 | +#define BRCMF_E_SUP_DEAUTH 14 | |
| 310 | + | |
| 311 | +#define BRCMF_E_IF_ADD 1 | |
| 312 | +#define BRCMF_E_IF_DEL 2 | |
| 313 | +#define BRCMF_E_IF_CHANGE 3 | |
| 314 | + | |
| 315 | +#define BRCMF_E_IF_ROLE_STA 0 | |
| 316 | +#define BRCMF_E_IF_ROLE_AP 1 | |
| 317 | +#define BRCMF_E_IF_ROLE_WDS 2 | |
| 318 | + | |
| 319 | +#define BRCMF_E_LINK_BCN_LOSS 1 | |
| 320 | +#define BRCMF_E_LINK_DISASSOC 2 | |
| 321 | +#define BRCMF_E_LINK_ASSOC_REC 3 | |
| 322 | +#define BRCMF_E_LINK_BSSCFG_DIS 4 | |
| 45 | 323 | |
| 46 | 324 | /* The level of bus communication with the dongle */ |
| 47 | −enum dhd_bus_state { | |
| 48 | − DHD_BUS_DOWN, /* Not ready for frame transfers */ | |
| 49 | − DHD_BUS_LOAD, /* Download access only (CPU reset) */ | |
| 50 | − DHD_BUS_DATA /* Ready for frame transfers */ | |
| 325 | +enum brcmf_bus_state { | |
| 326 | + BRCMF_BUS_DOWN, /* Not ready for frame transfers */ | |
| 327 | + BRCMF_BUS_LOAD, /* Download access only (CPU reset) */ | |
| 328 | + BRCMF_BUS_DATA /* Ready for frame transfers */ | |
| 329 | +}; | |
| 330 | + | |
| 331 | +/* Pattern matching filter. Specifies an offset within received packets to | |
| 332 | + * start matching, the pattern to match, the size of the pattern, and a bitmask | |
| 333 | + * that indicates which bits within the pattern should be matched. | |
| 334 | + */ | |
| 335 | +struct brcmf_pkt_filter_pattern { | |
| 336 | + u32 offset; /* Offset within received packet to start pattern matching. | |
| 337 | + * Offset '0' is the first byte of the ethernet header. | |
| 338 | + */ | |
| 339 | + u32 size_bytes; /* Size of the pattern. Bitmask must be the same size. */ | |
| 340 | + u8 mask_and_pattern[1]; /* Variable length mask and pattern data. mask starts | |
| 341 | + * at offset 0. Pattern immediately follows mask. | |
| 342 | + */ | |
| 343 | +}; | |
| 344 | + | |
| 345 | +/* IOVAR "pkt_filter_add" parameter. Used to install packet filters. */ | |
| 346 | +struct brcmf_pkt_filter { | |
| 347 | + u32 id; /* Unique filter id, specified by app. */ | |
| 348 | + u32 type; /* Filter type (WL_PKT_FILTER_TYPE_xxx). */ | |
| 349 | + u32 negate_match; /* Negate the result of filter matches */ | |
| 350 | + union { /* Filter definitions */ | |
| 351 | + struct brcmf_pkt_filter_pattern pattern; /* Filter pattern */ | |
| 352 | + } u; | |
| 353 | +}; | |
| 354 | + | |
| 355 | +/* IOVAR "pkt_filter_enable" parameter. */ | |
| 356 | +struct brcmf_pkt_filter_enable { | |
| 357 | + u32 id; /* Unique filter id */ | |
| 358 | + u32 enable; /* Enable/disable bool */ | |
| 359 | +}; | |
| 360 | + | |
| 361 | +/* BSS info structure | |
| 362 | + * Applications MUST CHECK ie_offset field and length field to access IEs and | |
| 363 | + * next bss_info structure in a vector (in struct brcmf_scan_results) | |
| 364 | + */ | |
| 365 | +struct brcmf_bss_info { | |
| 366 | + u32 version; /* version field */ | |
| 367 | + u32 length; /* byte length of data in this record, | |
| 368 | + * starting at version and including IEs | |
| 369 | + */ | |
| 370 | + u8 BSSID[ETH_ALEN]; | |
| 371 | + u16 beacon_period; /* units are Kusec */ | |
| 372 | + u16 capability; /* Capability information */ | |
| 373 | + u8 SSID_len; | |
| 374 | + u8 SSID[32]; | |
| 375 | + struct { | |
| 376 | + uint count; /* # rates in this set */ | |
| 377 | + u8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */ | |
| 378 | + } rateset; /* supported rates */ | |
| 379 | + chanspec_t chanspec; /* chanspec for bss */ | |
| 380 | + u16 atim_window; /* units are Kusec */ | |
| 381 | + u8 dtim_period; /* DTIM period */ | |
| 382 | + s16 RSSI; /* receive signal strength (in dBm) */ | |
| 383 | + s8 phy_noise; /* noise (in dBm) */ | |
| 384 | + | |
| 385 | + u8 n_cap; /* BSS is 802.11N Capable */ | |
| 386 | + u32 nbss_cap; /* 802.11N BSS Capabilities (based on HT_CAP_*) */ | |
| 387 | + u8 ctl_ch; /* 802.11N BSS control channel number */ | |
| 388 | + u32 reserved32[1]; /* Reserved for expansion of BSS properties */ | |
| 389 | + u8 flags; /* flags */ | |
| 390 | + u8 reserved[3]; /* Reserved for expansion of BSS properties */ | |
| 391 | + u8 basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */ | |
| 392 | + | |
| 393 | + u16 ie_offset; /* offset at which IEs start, from beginning */ | |
| 394 | + u32 ie_length; /* byte length of Information Elements */ | |
| 395 | + s16 SNR; /* average SNR of during frame reception */ | |
| 396 | + /* Add new fields here */ | |
| 397 | + /* variable length Information Elements */ | |
| 398 | +}; | |
| 399 | + | |
| 400 | +struct brcmf_ssid { | |
| 401 | + u32 SSID_len; | |
| 402 | + unsigned char SSID[32]; | |
| 403 | +}; | |
| 404 | + | |
| 405 | +struct brcmf_scan_params { | |
| 406 | + struct brcmf_ssid ssid; /* default: {0, ""} */ | |
| 407 | + u8 bssid[ETH_ALEN]; /* default: bcast */ | |
| 408 | + s8 bss_type; /* default: any, | |
| 409 | + * DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT | |
| 410 | + */ | |
| 411 | + u8 scan_type; /* flags, 0 use default */ | |
| 412 | + s32 nprobes; /* -1 use default, number of probes per channel */ | |
| 413 | + s32 active_time; /* -1 use default, dwell time per channel for | |
| 414 | + * active scanning | |
| 415 | + */ | |
| 416 | + s32 passive_time; /* -1 use default, dwell time per channel | |
| 417 | + * for passive scanning | |
| 418 | + */ | |
| 419 | + s32 home_time; /* -1 use default, dwell time for the home channel | |
| 420 | + * between channel scans | |
| 421 | + */ | |
| 422 | + s32 channel_num; /* count of channels and ssids that follow | |
| 423 | + * | |
| 424 | + * low half is count of channels in | |
| 425 | + * channel_list, 0 means default (use all | |
| 426 | + * available channels) | |
| 427 | + * | |
| 428 | + * high half is entries in struct brcmf_ssid | |
| 429 | + * array that follows channel_list, aligned for | |
| 430 | + * s32 (4 bytes) meaning an odd channel count | |
| 431 | + * implies a 2-byte pad between end of | |
| 432 | + * channel_list and first ssid | |
| 433 | + * | |
| 434 | + * if ssid count is zero, single ssid in the | |
| 435 | + * fixed parameter portion is assumed, otherwise | |
| 436 | + * ssid in the fixed portion is ignored | |
| 437 | + */ | |
| 438 | + u16 channel_list[1]; /* list of chanspecs */ | |
| 439 | +}; | |
| 440 | + | |
| 441 | +/* incremental scan struct */ | |
| 442 | +struct brcmf_iscan_params { | |
| 443 | + u32 version; | |
| 444 | + u16 action; | |
| 445 | + u16 scan_duration; | |
| 446 | + struct brcmf_scan_params params; | |
| 447 | +}; | |
| 448 | + | |
| 449 | +/* 3 fields + size of brcmf_scan_params, not including variable length array */ | |
| 450 | +#define BRCMF_ISCAN_PARAMS_FIXED_SIZE \ | |
| 451 | + (offsetof(struct brcmf_iscan_params, params) + \ | |
| 452 | + sizeof(struct brcmf_ssid)) | |
| 453 | + | |
| 454 | +struct brcmf_scan_results { | |
| 455 | + u32 buflen; | |
| 456 | + u32 version; | |
| 457 | + u32 count; | |
| 458 | + struct brcmf_bss_info bss_info[1]; | |
| 459 | +}; | |
| 460 | + | |
| 461 | +/* used for association with a specific BSSID and chanspec list */ | |
| 462 | +struct brcmf_assoc_params { | |
| 463 | + u8 bssid[ETH_ALEN]; /* 00:00:00:00:00:00: broadcast scan */ | |
| 464 | + s32 chanspec_num; /* 0: all available channels, | |
| 465 | + * otherwise count of chanspecs in chanspec_list | |
| 466 | + */ | |
| 467 | + chanspec_t chanspec_list[1]; /* list of chanspecs */ | |
| 468 | +}; | |
| 469 | +#define BRCMF_ASSOC_PARAMS_FIXED_SIZE \ | |
| 470 | + (sizeof(struct brcmf_assoc_params) - sizeof(chanspec_t)) | |
| 471 | + | |
| 472 | +/* used for join with or without a specific bssid and channel list */ | |
| 473 | +struct brcmf_join_params { | |
| 474 | + struct brcmf_ssid ssid; | |
| 475 | + struct brcmf_assoc_params params; | |
| 476 | +}; | |
| 477 | + | |
| 478 | +/* size of brcmf_scan_results not including variable length array */ | |
| 479 | +#define BRCMF_SCAN_RESULTS_FIXED_SIZE \ | |
| 480 | + (sizeof(struct brcmf_scan_results) - sizeof(struct brcmf_bss_info)) | |
| 481 | + | |
| 482 | +/* incremental scan results struct */ | |
| 483 | +struct brcmf_iscan_results { | |
| 484 | + u32 status; | |
| 485 | + struct brcmf_scan_results results; | |
| 486 | +}; | |
| 487 | + | |
| 488 | +/* size of brcmf_iscan_results not including variable length array */ | |
| 489 | +#define BRCMF_ISCAN_RESULTS_FIXED_SIZE \ | |
| 490 | + (BRCMF_SCAN_RESULTS_FIXED_SIZE + \ | |
| 491 | + offsetof(struct brcmf_iscan_results, results)) | |
| 492 | + | |
| 493 | +struct brcmf_wsec_key { | |
| 494 | + u32 index; /* key index */ | |
| 495 | + u32 len; /* key length */ | |
| 496 | + u8 data[WLAN_MAX_KEY_LEN]; /* key data */ | |
| 497 | + u32 pad_1[18]; | |
| 498 | + u32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */ | |
| 499 | + u32 flags; /* misc flags */ | |
| 500 | + u32 pad_2[2]; | |
| 501 | + int pad_3; | |
| 502 | + int iv_initialized; /* has IV been initialized already? */ | |
| 503 | + int pad_4; | |
| 504 | + /* Rx IV */ | |
| 505 | + struct { | |
| 506 | + u32 hi; /* upper 32 bits of IV */ | |
| 507 | + u16 lo; /* lower 16 bits of IV */ | |
| 508 | + } rxiv; | |
| 509 | + u32 pad_5[2]; | |
| 510 | + u8 ea[ETH_ALEN]; /* per station */ | |
| 511 | +}; | |
| 512 | + | |
| 513 | +/* Used to get specific STA parameters */ | |
| 514 | +struct brcmf_scb_val { | |
| 515 | + u32 val; | |
| 516 | + u8 ea[ETH_ALEN]; | |
| 517 | +}; | |
| 518 | + | |
| 519 | +/* channel encoding */ | |
| 520 | +struct brcmf_channel_info { | |
| 521 | + int hw_channel; | |
| 522 | + int target_channel; | |
| 523 | + int scan_channel; | |
| 51 | 524 | }; |
| 52 | 525 | |
| 526 | +/* Linux network driver ioctl encoding */ | |
| 527 | +struct brcmf_ioctl { | |
| 528 | + uint cmd; /* common ioctl definition */ | |
| 529 | + void *buf; /* pointer to user buffer */ | |
| 530 | + uint len; /* length of user buffer */ | |
| 531 | + u8 set; /* get or set request (optional) */ | |
| 532 | + uint used; /* bytes read or written (optional) */ | |
| 533 | + uint needed; /* bytes needed (optional) */ | |
| 534 | +}; | |
| 535 | + | |
| 536 | +/* Forward decls for struct brcmf_pub (see below) */ | |
| 537 | +struct brcmf_bus; /* device bus info */ | |
| 538 | +struct brcmf_proto; /* device communication protocol info */ | |
| 539 | +struct brcmf_info; /* device driver info */ | |
| 540 | + | |
| 53 | 541 | /* Common structure for module and instance linkage */ |
| 54 | −typedef struct dhd_pub { | |
| 542 | +struct brcmf_pub { | |
| 55 | 543 | /* Linkage ponters */ |
| 56 | − struct dhd_bus *bus; /* Bus module handle */ | |
| 57 | − struct dhd_prot *prot; /* Protocol module handle */ | |
| 58 | − struct dhd_info *info; /* Info module handle */ | |
| 544 | + struct brcmf_bus *bus; | |
| 545 | + struct brcmf_proto *prot; | |
| 546 | + struct brcmf_info *info; | |
| 59 | 547 | |
| 60 | − /* Internal dhd items */ | |
| 548 | + /* Internal brcmf items */ | |
| 61 | 549 | bool up; /* Driver up/down (to OS) */ |
| 62 | 550 | bool txoff; /* Transmit flow-controlled */ |
| 63 | 551 | bool dongle_reset; /* true = DEVRESET put dongle into reset */ |
| 64 | − enum dhd_bus_state busstate; | |
| 65 | − uint hdrlen; /* Total DHD header length (proto + bus) */ | |
| 552 | + enum brcmf_bus_state busstate; | |
| 553 | + uint hdrlen; /* Total BRCMF header length (proto + bus) */ | |
| 66 | 554 | uint maxctl; /* Max size rxctl request from proto to bus */ |
| 67 | 555 | uint rxsz; /* Rx buffer size bus module should use */ |
| 68 | 556 | u8 wme_dp; /* wme discard priority */ |
| @@ -71,7 +559,7 @@ typedef struct dhd_pub { · 2 unmodified lines | ||
| 71 | 559 | bool iswl; /* Dongle-resident driver is wl */ |
| 72 | 560 | unsigned long drv_version; /* Version of dongle-resident driver */ |
| 73 | 561 | u8 mac[ETH_ALEN]; /* MAC address obtained from dongle */ |
| 74 | − dngl_stats_t dstats; /* Stats for dongle-based data */ | |
| 562 | + struct dngl_stats dstats; /* Stats for dongle-based data */ | |
| 75 | 563 | |
| 76 | 564 | /* Additional stats for the bus level */ |
| 77 | 565 | unsigned long tx_packets; /* Data packets sent to dongle */ |
| @@ -88,7 +576,7 @@ typedef struct dhd_pub { · 10 unmodified lines | ||
| 88 | 576 | unsigned long rx_dropped; /* Packets dropped locally (no memory) */ |
| 89 | 577 | unsigned long rx_flushed; /* Packets flushed due to |
| 90 | 578 | unscheduled sendup thread */ |
| 91 | − unsigned long wd_dpc_sched; /* Number of times dhd dpc scheduled by | |
| 579 | + unsigned long wd_dpc_sched; /* Number of times dpc scheduled by | |
| 92 | 580 | watchdog timer */ |
| 93 | 581 | |
| 94 | 582 | unsigned long rx_readahead_cnt; /* Number of packets where header read-ahead |
| @@ -108,40 +596,51 @@ typedef struct dhd_pub { · 13 unmodified lines | ||
| 108 | 596 | int suspend_disable_flag; /* "1" to disable all extra powersaving |
| 109 | 597 | during suspend */ |
| 110 | 598 | int in_suspend; /* flag set to 1 when early suspend called */ |
| 111 | −#ifdef PNO_SUPPORT | |
| 112 | − int pno_enable; /* pno status : "1" is pno enable */ | |
| 113 | −#endif /* PNO_SUPPORT */ | |
| 114 | 599 | int dtim_skip; /* dtim skip , default 0 means wake each dtim */ |
| 115 | 600 | |
| 116 | 601 | /* Pkt filter defination */ |
| 117 | 602 | char *pktfilter[100]; |
| 118 | 603 | int pktfilter_count; |
| 119 | 604 | |
| 120 | − u8 country_code[WLC_CNTRY_BUF_SZ]; | |
| 121 | − char eventmask[WL_EVENTING_MASK_LEN]; | |
| 605 | + u8 country_code[BRCM_CNTRY_BUF_SZ]; | |
| 606 | + char eventmask[BRCMF_EVENTING_MASK_LEN]; | |
| 607 | + | |
| 608 | +}; | |
| 609 | + | |
| 610 | +struct brcmf_if_event { | |
| 611 | + u8 ifidx; | |
| 612 | + u8 action; | |
| 613 | + u8 flags; | |
| 614 | + u8 bssidx; | |
| 615 | +}; | |
| 616 | + | |
| 617 | +struct brcmf_timeout { | |
| 618 | + u32 limit; /* Expiration time (usec) */ | |
| 619 | + u32 increment; /* Current expiration increment (usec) */ | |
| 620 | + u32 elapsed; /* Current elapsed time (usec) */ | |
| 621 | + u32 tick; /* O/S tick time (usec) */ | |
| 622 | +}; | |
| 122 | 623 | |
| 123 | −} dhd_pub_t; | |
| 624 | +struct bcmevent_name { | |
| 625 | + uint event; | |
| 626 | + const char *name; | |
| 627 | +}; | |
| 124 | 628 | |
| 125 | 629 | #if defined(CONFIG_PM_SLEEP) |
| 126 | −extern atomic_t dhd_mmc_suspend; | |
| 127 | −#define DHD_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a); | |
| 128 | −#define _DHD_PM_RESUME_WAIT(a, b) do { \ | |
| 630 | +extern atomic_t brcmf_mmc_suspend; | |
| 631 | +#define BRCMF_PM_RESUME_WAIT_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a); | |
| 632 | +#define _BRCMF_PM_RESUME_WAIT(a, b) do { \ | |
| 129 | 633 | int retry = 0; \ |
| 130 | − while (atomic_read(&dhd_mmc_suspend) && retry++ != b) { \ | |
| 634 | + while (atomic_read(&brcmf_mmc_suspend) && retry++ != b) { \ | |
| 131 | 635 | wait_event_timeout(a, false, HZ/100); \ |
| 132 | 636 | } \ |
| 133 | 637 | } while (0) |
| 134 | −#define DHD_PM_RESUME_WAIT(a) _DHD_PM_RESUME_WAIT(a, 30) | |
| 135 | −#define DHD_PM_RESUME_WAIT_FOREVER(a) _DHD_PM_RESUME_WAIT(a, ~0) | |
| 136 | −#define DHD_PM_RESUME_RETURN_ERROR(a) \ | |
| 137 | − do { if (atomic_read(&dhd_mmc_suspend)) return a; } while (0) | |
| 138 | −#define DHD_PM_RESUME_RETURN do { \ | |
| 139 | − if (atomic_read(&dhd_mmc_suspend)) \ | |
| 140 | − return; \ | |
| 141 | − } while (0) | |
| 638 | +#define BRCMF_PM_RESUME_WAIT(a) _BRCMF_PM_RESUME_WAIT(a, 30) | |
| 639 | +#define BRCMF_PM_RESUME_RETURN_ERROR(a) \ | |
| 640 | + do { if (atomic_read(&brcmf_mmc_suspend)) return a; } while (0) | |
| 142 | 641 | |
| 143 | −#define DHD_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a); | |
| 144 | −#define SPINWAIT_SLEEP(a, exp, us) do { \ | |
| 642 | +#define BRCMF_SPINWAIT_SLEEP_INIT(a) DECLARE_WAIT_QUEUE_HEAD(a); | |
| 643 | +#define BRCMF_SPINWAIT_SLEEP(a, exp, us) do { \ | |
| 145 | 644 | uint countdown = (us) + 9999; \ |
| 146 | 645 | while ((exp) && (countdown >= 10000)) { \ |
| 147 | 646 | wait_event_timeout(a, false, HZ/100); \ |
| @@ -151,14 +650,12 @@ extern atomic_t dhd_mmc_suspend; · 3 unmodified lines | ||
| 151 | 650 | |
| 152 | 651 | #else |
| 153 | 652 | |
| 154 | −#define DHD_PM_RESUME_WAIT_INIT(a) | |
| 155 | −#define DHD_PM_RESUME_WAIT(a) | |
| 156 | −#define DHD_PM_RESUME_WAIT_FOREVER(a) | |
| 157 | −#define DHD_PM_RESUME_RETURN_ERROR(a) | |
| 158 | −#define DHD_PM_RESUME_RETURN | |
| 653 | +#define BRCMF_PM_RESUME_WAIT_INIT(a) | |
| 654 | +#define BRCMF_PM_RESUME_WAIT(a) | |
| 655 | +#define BRCMF_PM_RESUME_RETURN_ERROR(a) | |
| 159 | 656 | |
| 160 | −#define DHD_SPINWAIT_SLEEP_INIT(a) | |
| 161 | −#define SPINWAIT_SLEEP(a, exp, us) do { \ | |
| 657 | +#define BRCMF_SPINWAIT_SLEEP_INIT(a) | |
| 658 | +#define BRCMF_SPINWAIT_SLEEP(a, exp, us) do { \ | |
| 162 | 659 | uint countdown = (us) + 9; \ |
| 163 | 660 | while ((exp) && (countdown >= 10)) { \ |
| 164 | 661 | udelay(10); \ |
| @@ -167,29 +664,82 @@ extern atomic_t dhd_mmc_suspend; · 2 unmodified lines | ||
| 167 | 664 | } while (0) |
| 168 | 665 | |
| 169 | 666 | #endif /* defined(CONFIG_PM_SLEEP) */ |
| 170 | −#define DHD_IF_VIF 0x01 /* Virtual IF (Hidden from user) */ | |
| 171 | 667 | |
| 172 | −static inline void MUTEX_LOCK_INIT(dhd_pub_t *dhdp) | |
| 668 | +/* | |
| 669 | + * Insmod parameters for debug/test | |
| 670 | + */ | |
| 671 | + | |
| 672 | +/* Use interrupts */ | |
| 673 | +extern uint brcmf_intr; | |
| 674 | + | |
| 675 | +/* Use polling */ | |
| 676 | +extern uint brcmf_poll; | |
| 677 | + | |
| 678 | +/* ARP offload agent mode */ | |
| 679 | +extern uint brcmf_arp_mode; | |
| 680 | + | |
| 681 | +/* ARP offload enable */ | |
| 682 | +extern uint brcmf_arp_enable; | |
| 683 | + | |
| 684 | +/* Pkt filte enable control */ | |
| 685 | +extern uint brcmf_pkt_filter_enable; | |
| 686 | + | |
| 687 | +/* Pkt filter init setup */ | |
| 688 | +extern uint brcmf_pkt_filter_init; | |
| 689 | + | |
| 690 | +/* Pkt filter mode control */ | |
| 691 | +extern uint brcmf_master_mode; | |
| 692 | + | |
| 693 | +/* Roaming mode control */ | |
| 694 | +extern uint brcmf_roam; | |
| 695 | + | |
| 696 | +/* Roaming mode control */ | |
| 697 | +extern uint brcmf_radio_up; | |
| 698 | + | |
| 699 | +/* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */ | |
| 700 | +extern int brcmf_idletime; | |
| 701 | +#define BRCMF_IDLETIME_TICKS 1 | |
| 702 | + | |
| 703 | +/* SDIO Drive Strength */ | |
| 704 | +extern uint brcmf_sdiod_drive_strength; | |
| 705 | + | |
| 706 | +/* Override to force tx queueing all the time */ | |
| 707 | +extern uint brcmf_force_tx_queueing; | |
| 708 | + | |
| 709 | +#ifdef SDTEST | |
| 710 | +/* Echo packet generator (SDIO), pkts/s */ | |
| 711 | +extern uint brcmf_pktgen; | |
| 712 | + | |
| 713 | +/* Echo packet len (0 => sawtooth, max 1800) */ | |
| 714 | +extern uint brcmf_pktgen_len; | |
| 715 | +#define BRCMF_MAX_PKTGEN_LEN 1800 | |
| 716 | +#endif | |
| 717 | + | |
| 718 | +extern const struct bcmevent_name bcmevent_names[]; | |
| 719 | +extern const int bcmevent_names_size; | |
| 720 | + | |
| 721 | + | |
| 722 | +static inline void MUTEX_LOCK_INIT(struct brcmf_pub *drvr) | |
| 173 | 723 | { |
| 174 | 724 | } |
| 175 | 725 | |
| 176 | −static inline void MUTEX_LOCK(dhd_pub_t *dhdp) | |
| 726 | +static inline void MUTEX_LOCK(struct brcmf_pub *drvr) | |
| 177 | 727 | { |
| 178 | 728 | } |
| 179 | 729 | |
| 180 | −static inline void MUTEX_UNLOCK(dhd_pub_t *dhdp) | |
| 730 | +static inline void MUTEX_UNLOCK(struct brcmf_pub *drvr) | |
| 181 | 731 | { |
| 182 | 732 | } |
| 183 | 733 | |
| 184 | −static inline void MUTEX_LOCK_SOFTAP_SET_INIT(dhd_pub_t *dhdp) | |
| 734 | +static inline void MUTEX_LOCK_SOFTAP_SET_INIT(struct brcmf_pub *drvr) | |
| 185 | 735 | { |
| 186 | 736 | } |
| 187 | 737 | |
| 188 | −static inline void MUTEX_LOCK_SOFTAP_SET(dhd_pub_t *dhdp) | |
| 738 | +static inline void MUTEX_LOCK_SOFTAP_SET(struct brcmf_pub *drvr) | |
| 189 | 739 | { |
| 190 | 740 | } |
| 191 | 741 | |
| 192 | −static inline void MUTEX_UNLOCK_SOFTAP_SET(dhd_pub_t *dhdp) | |
| 742 | +static inline void MUTEX_UNLOCK_SOFTAP_SET(struct brcmf_pub *drvr) | |
| 193 | 743 | { |
| 194 | 744 | } |
| 195 | 745 | |
| @@ -205,210 +755,150 @@ static inline void MUTEX_UNLOCK_WL_SCAN_SET(void) · 9 unmodified lines | ||
| 205 | 755 | { |
| 206 | 756 | } |
| 207 | 757 | |
| 208 | −typedef struct dhd_if_event { | |
| 209 | − u8 ifidx; | |
| 210 | − u8 action; | |
| 211 | − u8 flags; | |
| 212 | − u8 bssidx; | |
| 213 | −} dhd_if_event_t; | |
| 214 | − | |
| 215 | −/* | |
| 216 | − * Exported from dhd OS modules (dhd_linux/dhd_ndis) | |
| 217 | − */ | |
| 218 | − | |
| 219 | 758 | /* Indication from bus module regarding presence/insertion of dongle. |
| 220 | − * Return dhd_pub_t pointer, used as handle to OS module in later calls. | |
| 759 | + * Return struct brcmf_pub pointer, used as handle to OS module in later calls. | |
| 221 | 760 | * Returned structure should have bus and prot pointers filled in. |
| 222 | 761 | * bus_hdrlen specifies required headroom for bus module header. |
| 223 | 762 | */ |
| 224 | −extern dhd_pub_t *dhd_attach(struct dhd_bus *bus, | |
| 225 | − uint bus_hdrlen); | |
| 226 | −extern int dhd_net_attach(dhd_pub_t *dhdp, int idx); | |
| 763 | +extern struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, | |
| 764 | + uint bus_hdrlen); | |
| 765 | +extern int brcmf_net_attach(struct brcmf_pub *drvr, int idx); | |
| 766 | +extern int brcmf_netdev_wait_pend8021x(struct net_device *dev); | |
| 227 | 767 | |
| 228 | 768 | /* Indication from bus module regarding removal/absence of dongle */ |
| 229 | −extern void dhd_detach(dhd_pub_t *dhdp); | |
| 769 | +extern void brcmf_detach(struct brcmf_pub *drvr); | |
| 230 | 770 | |
| 231 | 771 | /* Indication from bus module to change flow-control state */ |
| 232 | −extern void dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool on); | |
| 772 | +extern void brcmf_txflowcontrol(struct brcmf_pub *drvr, int ifidx, bool on); | |
| 233 | 773 | |
| 234 | −extern bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, | |
| 774 | +extern bool brcmf_c_prec_enq(struct brcmf_pub *drvr, struct pktq *q, | |
| 235 | 775 | struct sk_buff *pkt, int prec); |
| 236 | 776 | |
| 237 | 777 | /* Receive frame for delivery to OS. Callee disposes of rxp. */ |
| 238 | −extern void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, | |
| 778 | +extern void brcmf_rx_frame(struct brcmf_pub *drvr, int ifidx, | |
| 239 | 779 | struct sk_buff *rxp, int numpkt); |
| 240 | 780 | |
| 241 | 781 | /* Return pointer to interface name */ |
| 242 | −extern char *dhd_ifname(dhd_pub_t *dhdp, int idx); | |
| 243 | − | |
| 244 | −/* Request scheduling of the bus dpc */ | |
| 245 | −extern void dhd_sched_dpc(dhd_pub_t *dhdp); | |
| 782 | +extern char *brcmf_ifname(struct brcmf_pub *drvr, int idx); | |
| 246 | 783 | |
| 247 | 784 | /* Notify tx completion */ |
| 248 | −extern void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success); | |
| 785 | +extern void brcmf_txcomplete(struct brcmf_pub *drvr, struct sk_buff *txp, | |
| 786 | + bool success); | |
| 249 | 787 | |
| 250 | 788 | /* Query ioctl */ |
| 251 | −extern int dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, | |
| 252 | − uint len); | |
| 789 | +extern int brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, | |
| 790 | + uint cmd, void *buf, uint len); | |
| 253 | 791 | |
| 254 | 792 | /* OS independent layer functions */ |
| 255 | −extern int dhd_os_proto_block(dhd_pub_t *pub); | |
| 256 | −extern int dhd_os_proto_unblock(dhd_pub_t *pub); | |
| 257 | −extern int dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, | |
| 793 | +extern int brcmf_os_proto_block(struct brcmf_pub *drvr); | |
| 794 | +extern int brcmf_os_proto_unblock(struct brcmf_pub *drvr); | |
| 795 | +extern int brcmf_os_ioctl_resp_wait(struct brcmf_pub *drvr, uint *condition, | |
| 258 | 796 | bool *pending); |
| 259 | −extern int dhd_os_ioctl_resp_wake(dhd_pub_t *pub); | |
| 260 | −extern unsigned int dhd_os_get_ioctl_resp_timeout(void); | |
| 261 | −extern void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec); | |
| 262 | −extern void *dhd_os_open_image(char *filename); | |
| 263 | −extern int dhd_os_get_image_block(char *buf, int len, void *image); | |
| 264 | −extern void dhd_os_close_image(void *image); | |
| 265 | −extern void dhd_os_wd_timer(void *bus, uint wdtick); | |
| 266 | −extern void dhd_os_sdlock(dhd_pub_t *pub); | |
| 267 | −extern void dhd_os_sdunlock(dhd_pub_t *pub); | |
| 268 | −extern void dhd_os_sdlock_txq(dhd_pub_t *pub); | |
| 269 | −extern void dhd_os_sdunlock_txq(dhd_pub_t *pub); | |
| 270 | −extern void dhd_os_sdlock_rxq(dhd_pub_t *pub); | |
| 271 | −extern void dhd_os_sdunlock_rxq(dhd_pub_t *pub); | |
| 272 | −extern void dhd_os_sdlock_sndup_rxq(dhd_pub_t *pub); | |
| 273 | −extern void dhd_customer_gpio_wlan_ctrl(int onoff); | |
| 274 | −extern int dhd_custom_get_mac_address(unsigned char *buf); | |
| 275 | −extern void dhd_os_sdunlock_sndup_rxq(dhd_pub_t *pub); | |
| 276 | −extern void dhd_os_sdlock_eventq(dhd_pub_t *pub); | |
| 277 | −extern void dhd_os_sdunlock_eventq(dhd_pub_t *pub); | |
| 278 | −#ifdef DHD_DEBUG | |
| 279 | −extern int write_to_file(dhd_pub_t *dhd, u8 *buf, int size); | |
| 280 | −#endif /* DHD_DEBUG */ | |
| 281 | −#if defined(OOB_INTR_ONLY) | |
| 282 | −extern int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr); | |
| 283 | −#endif /* defined(OOB_INTR_ONLY) */ | |
| 284 | −extern void dhd_os_sdtxlock(dhd_pub_t *pub); | |
| 285 | −extern void dhd_os_sdtxunlock(dhd_pub_t *pub); | |
| 286 | − | |
| 287 | −int setScheduler(struct task_struct *p, int policy, struct sched_param *param); | |
| 288 | − | |
| 289 | −typedef struct { | |
| 290 | − u32 limit; /* Expiration time (usec) */ | |
| 291 | − u32 increment; /* Current expiration increment (usec) */ | |
| 292 | − u32 elapsed; /* Current elapsed time (usec) */ | |
| 293 | − u32 tick; /* O/S tick time (usec) */ | |
| 294 | −} dhd_timeout_t; | |
| 797 | +extern int brcmf_os_ioctl_resp_wake(struct brcmf_pub *drvr); | |
| 798 | +extern unsigned int brcmf_os_get_ioctl_resp_timeout(void); | |
| 799 | +extern void brcmf_os_set_ioctl_resp_timeout(unsigned int timeout_msec); | |
| 800 | +#ifdef BCMDBG | |
| 801 | +extern int brcmf_write_to_file(struct brcmf_pub *drvr, u8 *buf, int size); | |
| 802 | +#endif /* BCMDBG */ | |
| 295 | 803 | |
| 296 | −extern void dhd_timeout_start(dhd_timeout_t *tmo, uint usec); | |
| 297 | −extern int dhd_timeout_expired(dhd_timeout_t *tmo); | |
| 804 | +extern void brcmf_timeout_start(struct brcmf_timeout *tmo, uint usec); | |
| 805 | +extern int brcmf_timeout_expired(struct brcmf_timeout *tmo); | |
| 298 | 806 | |
| 299 | −extern int dhd_ifname2idx(struct dhd_info *dhd, char *name); | |
| 300 | −extern u8 *dhd_bssidx2bssid(dhd_pub_t *dhd, int idx); | |
| 301 | −extern int wl_host_event(struct dhd_info *dhd, int *idx, void *pktdata, | |
| 302 | − wl_event_msg_t *, void **data_ptr); | |
| 807 | +extern int brcmf_ifname2idx(struct brcmf_info *drvr_priv, char *name); | |
| 808 | +extern int brcmf_c_host_event(struct brcmf_info *drvr_priv, int *idx, | |
| 809 | + void *pktdata, struct brcmf_event_msg *, | |
| 810 | + void **data_ptr); | |
| 303 | 811 | |
| 304 | −extern void dhd_common_init(void); | |
| 812 | +extern void brcmf_c_init(void); | |
| 305 | 813 | |
| 306 | −extern int dhd_add_if(struct dhd_info *dhd, int ifidx, void *handle, | |
| 814 | +extern int brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, void *handle, | |
| 307 | 815 | char *name, u8 *mac_addr, u32 flags, u8 bssidx); |
| 308 | −extern void dhd_del_if(struct dhd_info *dhd, int ifidx); | |
| 309 | − | |
| 310 | −extern void dhd_vif_add(struct dhd_info *dhd, int ifidx, char *name); | |
| 311 | −extern void dhd_vif_del(struct dhd_info *dhd, int ifidx); | |
| 312 | − | |
| 313 | −extern void dhd_event(struct dhd_info *dhd, char *evpkt, int evlen, int ifidx); | |
| 314 | −extern void dhd_vif_sendup(struct dhd_info *dhd, int ifidx, unsigned char * cp, | |
| 315 | − int len); | |
| 816 | +extern void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx); | |
| 316 | 817 | |
| 317 | 818 | /* Send packet to dongle via data channel */ |
| 318 | −extern int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pkt); | |
| 319 | − | |
| 320 | −/* Send event to host */ | |
| 321 | −extern void dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, | |
| 322 | − void *data); | |
| 323 | −extern int dhd_bus_devreset(dhd_pub_t *dhdp, u8 flag); | |
| 324 | −extern uint dhd_bus_status(dhd_pub_t *dhdp); | |
| 325 | −extern int dhd_bus_start(dhd_pub_t *dhdp); | |
| 326 | − | |
| 327 | −enum cust_gpio_modes { | |
| 328 | − WLAN_RESET_ON, | |
| 329 | − WLAN_RESET_OFF, | |
| 330 | − WLAN_POWER_ON, | |
| 331 | − WLAN_POWER_OFF | |
| 819 | +extern int brcmf_sendpkt(struct brcmf_pub *drvr, int ifidx,\ | |
| 820 | + struct sk_buff *pkt); | |
| 821 | + | |
| 822 | +extern int brcmf_bus_devreset(struct brcmf_pub *drvr, u8 flag); | |
| 823 | +extern int brcmf_bus_start(struct brcmf_pub *drvr); | |
| 824 | + | |
| 825 | +extern void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg); | |
| 826 | +extern void brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, | |
| 827 | + int enable, int master_mode); | |
| 828 | + | |
| 829 | +/* Linux network driver ioctl encoding */ | |
| 830 | +struct brcmf_c_ioctl { | |
| 831 | + uint cmd; /* common ioctl definition */ | |
| 832 | + void *buf; /* pointer to user buffer */ | |
| 833 | + uint len; /* length of user buffer */ | |
| 834 | + bool set; /* get or set request (optional) */ | |
| 835 | + uint used; /* bytes read or written (optional) */ | |
| 836 | + uint needed; /* bytes needed (optional) */ | |
| 837 | + uint driver; /* to identify target driver */ | |
| 332 | 838 | }; |
| 333 | −/* | |
| 334 | − * Insmod parameters for debug/test | |
| 335 | − */ | |
| 336 | − | |
| 337 | −/* Watchdog timer interval */ | |
| 338 | −extern uint dhd_watchdog_ms; | |
| 339 | − | |
| 340 | −#if defined(DHD_DEBUG) | |
| 341 | −/* Console output poll interval */ | |
| 342 | −extern uint dhd_console_ms; | |
| 343 | −#endif /* defined(DHD_DEBUG) */ | |
| 344 | − | |
| 345 | −/* Use interrupts */ | |
| 346 | −extern uint dhd_intr; | |
| 347 | − | |
| 348 | −/* Use polling */ | |
| 349 | −extern uint dhd_poll; | |
| 350 | − | |
| 351 | −/* ARP offload agent mode */ | |
| 352 | −extern uint dhd_arp_mode; | |
| 353 | − | |
| 354 | −/* ARP offload enable */ | |
| 355 | −extern uint dhd_arp_enable; | |
| 356 | − | |
| 357 | −/* Pkt filte enable control */ | |
| 358 | −extern uint dhd_pkt_filter_enable; | |
| 359 | − | |
| 360 | −/* Pkt filter init setup */ | |
| 361 | −extern uint dhd_pkt_filter_init; | |
| 362 | − | |
| 363 | −/* Pkt filter mode control */ | |
| 364 | −extern uint dhd_master_mode; | |
| 365 | 839 | |
| 366 | −/* Roaming mode control */ | |
| 367 | −extern uint dhd_roam; | |
| 368 | − | |
| 369 | −/* Roaming mode control */ | |
| 370 | −extern uint dhd_radio_up; | |
| 371 | − | |
| 372 | −/* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */ | |
| 373 | −extern int dhd_idletime; | |
| 374 | −#define DHD_IDLETIME_TICKS 1 | |
| 375 | − | |
| 376 | −/* SDIO Drive Strength */ | |
| 377 | −extern uint dhd_sdiod_drive_strength; | |
| 378 | − | |
| 379 | −/* Override to force tx queueing all the time */ | |
| 380 | −extern uint dhd_force_tx_queueing; | |
| 840 | +/* per-driver magic numbers */ | |
| 841 | +#define BRCMF_IOCTL_MAGIC 0x00444944 | |
| 842 | + | |
| 843 | +/* bump this number if you change the ioctl interface */ | |
| 844 | +#define BRCMF_IOCTL_VERSION 1 | |
| 845 | +#define BRCMF_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */ | |
| 846 | + | |
| 847 | +/* common ioctl definitions */ | |
| 848 | +#define BRCMF_GET_MAGIC 0 | |
| 849 | +#define BRCMF_GET_VERSION 1 | |
| 850 | +#define BRCMF_GET_VAR 2 | |
| 851 | +#define BRCMF_SET_VAR 3 | |
| 852 | + | |
| 853 | +/* message levels */ | |
| 854 | +#define BRCMF_ERROR_VAL 0x0001 | |
| 855 | +#define BRCMF_TRACE_VAL 0x0002 | |
| 856 | +#define BRCMF_INFO_VAL 0x0004 | |
| 857 | +#define BRCMF_DATA_VAL 0x0008 | |
| 858 | +#define BRCMF_CTL_VAL 0x0010 | |
| 859 | +#define BRCMF_TIMER_VAL 0x0020 | |
| 860 | +#define BRCMF_HDRS_VAL 0x0040 | |
| 861 | +#define BRCMF_BYTES_VAL 0x0080 | |
| 862 | +#define BRCMF_INTR_VAL 0x0100 | |
| 863 | +#define BRCMF_GLOM_VAL 0x0400 | |
| 864 | +#define BRCMF_EVENT_VAL 0x0800 | |
| 865 | +#define BRCMF_BTA_VAL 0x1000 | |
| 866 | +#define BRCMF_ISCAN_VAL 0x2000 | |
| 381 | 867 | |
| 382 | 868 | #ifdef SDTEST |
| 383 | −/* Echo packet generator (SDIO), pkts/s */ | |
| 384 | −extern uint dhd_pktgen; | |
| 385 | − | |
| 386 | −/* Echo packet len (0 => sawtooth, max 1800) */ | |
| 387 | −extern uint dhd_pktgen_len; | |
| 388 | −#define MAX_PKTGEN_LEN 1800 | |
| 389 | −#endif | |
| 390 | − | |
| 391 | −/* optionally set by a module_param_string() */ | |
| 392 | −#define MOD_PARAM_PATHLEN 2048 | |
| 393 | −extern char fw_path[MOD_PARAM_PATHLEN]; | |
| 394 | −extern char nv_path[MOD_PARAM_PATHLEN]; | |
| 869 | +/* For pktgen iovar */ | |
| 870 | +struct brcmf_pktgen { | |
| 871 | + uint version; /* To allow structure change tracking */ | |
| 872 | + uint freq; /* Max ticks between tx/rx attempts */ | |
| 873 | + uint count; /* Test packets to send/rcv each attempt */ | |
| 874 | + uint print; /* Print counts every <print> attempts */ | |
| 875 | + uint total; /* Total packets (or bursts) */ | |
| 876 | + uint minlen; /* Minimum length of packets to send */ | |
| 877 | + uint maxlen; /* Maximum length of packets to send */ | |
| 878 | + uint numsent; /* Count of test packets sent */ | |
| 879 | + uint numrcvd; /* Count of test packets received */ | |
| 880 | + uint numfail; /* Count of test send failures */ | |
| 881 | + uint mode; /* Test mode (type of test packets) */ | |
| 882 | + uint stop; /* Stop after this many tx failures */ | |
| 883 | +}; | |
| 395 | 884 | |
| 396 | −/* For supporting multiple interfaces */ | |
| 397 | −#define DHD_MAX_IFS 16 | |
| 398 | −#define DHD_DEL_IF -0xe | |
| 399 | −#define DHD_BAD_IF -0xf | |
| 885 | +/* Version in case structure changes */ | |
| 886 | +#define BRCMF_PKTGEN_VERSION 2 | |
| 400 | 887 | |
| 401 | −extern void dhd_wait_for_event(dhd_pub_t *dhd, bool * lockvar); | |
| 402 | −extern void dhd_wait_event_wakeup(dhd_pub_t *dhd); | |
| 888 | +/* Type of test packets to use */ | |
| 889 | +#define BRCMF_PKTGEN_ECHO 1 /* Send echo requests */ | |
| 890 | +#define BRCMF_PKTGEN_SEND 2 /* Send discard packets */ | |
| 891 | +#define BRCMF_PKTGEN_RXBURST 3 /* Request dongle send N packets */ | |
| 892 | +#define BRCMF_PKTGEN_RECV 4 /* Continuous rx from continuous | |
| 893 | + tx dongle */ | |
| 894 | +#endif /* SDTEST */ | |
| 403 | 895 | |
| 404 | −extern u32 g_assert_type; | |
| 896 | +/* Enter idle immediately (no timeout) */ | |
| 897 | +#define BRCMF_IDLE_IMMEDIATE (-1) | |
| 405 | 898 | |
| 406 | −#ifdef BCMDBG | |
| 407 | −#define ASSERT(exp) \ | |
| 408 | − do { if (!(exp)) osl_assert(#exp, __FILE__, __LINE__); } while (0) | |
| 409 | −extern void osl_assert(char *exp, char *file, int line); | |
| 410 | −#else | |
| 411 | −#define ASSERT(exp) do {} while (0) | |
| 412 | −#endif /* defined(BCMDBG) */ | |
| 899 | +/* Values for idleclock iovar: other values are the sd_divisor to use | |
| 900 | + when idle */ | |
| 901 | +#define BRCMF_IDLE_ACTIVE 0 /* Do not request any SD clock change | |
| 902 | + when idle */ | |
| 413 | 903 | |
| 414 | −#endif /* _dhd_h_ */ | |
| 904 | +#endif /* _BRCMF_H_ */ | |
| @@ -14,69 +14,65 @@ · 13 unmodified lines | ||
| 14 | 14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | −#ifndef _dhd_bus_h_ | |
| 18 | −#define _dhd_bus_h_ | |
| 17 | +#ifndef _BRCMF_BUS_H_ | |
| 18 | +#define _BRCMF_BUS_H_ | |
| 19 | + | |
| 20 | +/* Packet alignment for most efficient SDIO (can change based on platform) */ | |
| 21 | +#ifndef BRCMF_SDALIGN | |
| 22 | +#define BRCMF_SDALIGN 32 | |
| 23 | +#endif | |
| 24 | +#if !ISPOWEROF2(BRCMF_SDALIGN) | |
| 25 | +#error BRCMF_SDALIGN is not a power of 2! | |
| 26 | +#endif | |
| 19 | 27 | |
| 20 | 28 | /* |
| 21 | − * Exported from dhd bus module (dhd_usb, dhd_sdio) | |
| 29 | + * Exported from brcmf bus module (brcmf_usb, brcmf_sdio) | |
| 22 | 30 | */ |
| 23 | 31 | |
| 24 | −/* Indicate (dis)interest in finding dongles. */ | |
| 25 | −extern int dhd_bus_register(void); | |
| 26 | −extern void dhd_bus_unregister(void); | |
| 32 | +/* dongle ram module parameter */ | |
| 33 | +extern int brcmf_dongle_memsize; | |
| 34 | + | |
| 35 | +/* Tx/Rx bounds module parameters */ | |
| 36 | +extern uint brcmf_txbound; | |
| 37 | +extern uint brcmf_rxbound; | |
| 27 | 38 | |
| 28 | −/* Download firmware image and nvram image */ | |
| 29 | −extern bool dhd_bus_download_firmware(struct dhd_bus *bus, | |
| 30 | − char *fw_path, char *nv_path); | |
| 39 | +/* Watchdog timer interval */ | |
| 40 | +extern uint brcmf_watchdog_ms; | |
| 41 | + | |
| 42 | +/* Indicate (dis)interest in finding dongles. */ | |
| 43 | +extern int brcmf_bus_register(void); | |
| 44 | +extern void brcmf_bus_unregister(void); | |
| 31 | 45 | |
| 32 | 46 | /* Stop bus module: clear pending frames, disable data flow */ |
| 33 | −extern void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex); | |
| 47 | +extern void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex); | |
| 34 | 48 | |
| 35 | 49 | /* Initialize bus module: prepare for communication w/dongle */ |
| 36 | −extern int dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex); | |
| 50 | +extern int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex); | |
| 37 | 51 | |
| 38 | 52 | /* Send a data frame to the dongle. Callee disposes of txp. */ |
| 39 | −extern int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *txp); | |
| 53 | +extern int brcmf_sdbrcm_bus_txdata(struct brcmf_bus *bus, struct sk_buff *txp); | |
| 40 | 54 | |
| 41 | 55 | /* Send/receive a control message to/from the dongle. |
| 42 | 56 | * Expects caller to enforce a single outstanding transaction. |
| 43 | 57 | */ |
| 44 | −extern int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen); | |
| 45 | −extern int dhd_bus_rxctl(struct dhd_bus *bus, unsigned char *msg, uint msglen); | |
| 58 | +extern int | |
| 59 | +brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen); | |
| 46 | 60 | |
| 47 | −/* Watchdog timer function */ | |
| 48 | −extern bool dhd_bus_watchdog(dhd_pub_t *dhd); | |
| 49 | − | |
| 50 | −#ifdef DHD_DEBUG | |
| 51 | −/* Device console input function */ | |
| 52 | −extern int dhd_bus_console_in(dhd_pub_t *dhd, unsigned char *msg, uint msglen); | |
| 53 | −#endif /* DHD_DEBUG */ | |
| 54 | − | |
| 55 | −/* Deferred processing for the bus, return true requests reschedule */ | |
| 56 | −extern bool dhd_bus_dpc(struct dhd_bus *bus); | |
| 57 | −extern void dhd_bus_isr(bool *InterruptRecognized, | |
| 58 | − bool *QueueMiniportHandleInterrupt, void *arg); | |
| 61 | +extern int | |
| 62 | +brcmf_sdbrcm_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen); | |
| 59 | 63 | |
| 60 | 64 | /* Check for and handle local prot-specific iovar commands */ |
| 61 | −extern int dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name, | |
| 65 | +extern int brcmf_sdbrcm_bus_iovar_op(struct brcmf_pub *drvr, const char *name, | |
| 62 | 66 | void *params, int plen, void *arg, int len, |
| 63 | 67 | bool set); |
| 64 | 68 | |
| 65 | 69 | /* Add bus dump output to a buffer */ |
| 66 | −extern void dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf); | |
| 70 | +extern void brcmf_sdbrcm_bus_dump(struct brcmf_pub *drvr, | |
| 71 | + struct brcmu_strbuf *strbuf); | |
| 67 | 72 | |
| 68 | 73 | /* Clear any bus counters */ |
| 69 | −extern void dhd_bus_clearcounts(dhd_pub_t *dhdp); | |
| 70 | − | |
| 71 | −/* return the dongle chipid */ | |
| 72 | −extern uint dhd_bus_chip(struct dhd_bus *bus); | |
| 73 | − | |
| 74 | −/* Set user-specified nvram parameters. */ | |
| 75 | −extern void dhd_bus_set_nvram_params(struct dhd_bus *bus, | |
| 76 | − const char *nvram_params); | |
| 74 | +extern void brcmf_bus_clearcounts(struct brcmf_pub *drvr); | |
| 77 | 75 | |
| 78 | −extern void *dhd_bus_pub(struct dhd_bus *bus); | |
| 79 | −extern void *dhd_bus_txq(struct dhd_bus *bus); | |
| 80 | −extern uint dhd_bus_hdrlen(struct dhd_bus *bus); | |
| 76 | +extern void brcmf_sdbrcm_wd_timer(struct brcmf_bus *bus, uint wdtick); | |
| 81 | 77 | |
| 82 | −#endif /* _dhd_bus_h_ */ | |
| 78 | +#endif /* _BRCMF_BUS_H_ */ | |
| @@ -16,33 +16,71 @@ · 15 unmodified lines | ||
| 16 | 16 | |
| 17 | 17 | #include <linux/types.h> |
| 18 | 18 | #include <linux/netdevice.h> |
| 19 | −#include <bcmdefs.h> | |
| 20 | − | |
| 21 | −#include <bcmutils.h> | |
| 22 | −#include <bcmcdc.h> | |
| 23 | − | |
| 24 | −#include <dngl_stats.h> | |
| 25 | −#include <dhd.h> | |
| 26 | −#include <dhd_proto.h> | |
| 27 | −#include <dhd_bus.h> | |
| 28 | −#include <dhd_dbg.h> | |
| 29 | −#ifdef CUSTOMER_HW2 | |
| 30 | −int wifi_get_mac_addr(unsigned char *buf); | |
| 31 | −#endif | |
| 32 | − | |
| 33 | −extern int dhd_preinit_ioctls(dhd_pub_t *dhd); | |
| 34 | − | |
| 35 | −/* Packet alignment for most efficient SDIO (can change based on platform) */ | |
| 36 | −#ifndef DHD_SDALIGN | |
| 37 | −#define DHD_SDALIGN 32 | |
| 38 | −#endif | |
| 39 | −#if !ISPOWEROF2(DHD_SDALIGN) | |
| 40 | −#error DHD_SDALIGN is not a power of 2! | |
| 41 | −#endif | |
| 19 | +#include <linux/sched.h> | |
| 20 | +#include <defs.h> | |
| 21 | + | |
| 22 | +#include <brcmu_utils.h> | |
| 23 | +#include <brcmu_wifi.h> | |
| 24 | + | |
| 25 | +#include "dhd.h" | |
| 26 | +#include "dhd_proto.h" | |
| 27 | +#include "dhd_bus.h" | |
| 28 | +#include "dhd_dbg.h" | |
| 29 | + | |
| 30 | +struct brcmf_proto_cdc_ioctl { | |
| 31 | + u32 cmd; /* ioctl command value */ | |
| 32 | + u32 len; /* lower 16: output buflen; | |
| 33 | + * upper 16: input buflen (excludes header) */ | |
| 34 | + u32 flags; /* flag defns given below */ | |
| 35 | + u32 status; /* status code returned from the device */ | |
| 36 | +}; | |
| 37 | + | |
| 38 | +/* Max valid buffer size that can be sent to the dongle */ | |
| 39 | +#define CDC_MAX_MSG_SIZE (ETH_FRAME_LEN+ETH_FCS_LEN) | |
| 40 | + | |
| 41 | +/* CDC flag definitions */ | |
| 42 | +#define CDCF_IOC_ERROR 0x01 /* 1=ioctl cmd failed */ | |
| 43 | +#define CDCF_IOC_SET 0x02 /* 0=get, 1=set cmd */ | |
| 44 | +#define CDCF_IOC_IF_MASK 0xF000 /* I/F index */ | |
| 45 | +#define CDCF_IOC_IF_SHIFT 12 | |
| 46 | +#define CDCF_IOC_ID_MASK 0xFFFF0000 /* id an ioctl pairing */ | |
| 47 | +#define CDCF_IOC_ID_SHIFT 16 /* ID Mask shift bits */ | |
| 48 | +#define CDC_IOC_ID(flags) \ | |
| 49 | + (((flags) & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT) | |
| 50 | +#define CDC_SET_IF_IDX(hdr, idx) \ | |
| 51 | + ((hdr)->flags = (((hdr)->flags & ~CDCF_IOC_IF_MASK) | \ | |
| 52 | + ((idx) << CDCF_IOC_IF_SHIFT))) | |
| 53 | + | |
| 54 | +/* | |
| 55 | + * BDC header - Broadcom specific extension of CDC. | |
| 56 | + * Used on data packets to convey priority across USB. | |
| 57 | + */ | |
| 58 | +#define BDC_HEADER_LEN 4 | |
| 59 | +#define BDC_PROTO_VER 1 /* Protocol version */ | |
| 60 | +#define BDC_FLAG_VER_MASK 0xf0 /* Protocol version mask */ | |
| 61 | +#define BDC_FLAG_VER_SHIFT 4 /* Protocol version shift */ | |
| 62 | +#define BDC_FLAG_SUM_GOOD 0x04 /* Good RX checksums */ | |
| 63 | +#define BDC_FLAG_SUM_NEEDED 0x08 /* Dongle needs to do TX checksums */ | |
| 64 | +#define BDC_PRIORITY_MASK 0x7 | |
| 65 | +#define BDC_FLAG2_IF_MASK 0x0f /* packet rx interface in APSTA */ | |
| 66 | +#define BDC_FLAG2_IF_SHIFT 0 | |
| 67 | + | |
| 68 | +#define BDC_GET_IF_IDX(hdr) \ | |
| 69 | + ((int)((((hdr)->flags2) & BDC_FLAG2_IF_MASK) >> BDC_FLAG2_IF_SHIFT)) | |
| 70 | +#define BDC_SET_IF_IDX(hdr, idx) \ | |
| 71 | + ((hdr)->flags2 = (((hdr)->flags2 & ~BDC_FLAG2_IF_MASK) | \ | |
| 72 | + ((idx) << BDC_FLAG2_IF_SHIFT))) | |
| 73 | + | |
| 74 | +struct brcmf_proto_bdc_header { | |
| 75 | + u8 flags; | |
| 76 | + u8 priority; /* 802.1d Priority, 4:7 flow control info for usb */ | |
| 77 | + u8 flags2; | |
| 78 | + u8 rssi; | |
| 79 | +}; | |
| 80 | + | |
| 42 | 81 | |
| 43 | 82 | #define RETRIES 2 /* # of retries to retrieve matching ioctl response */ |
| 44 | −#define BUS_HEADER_LEN (16+DHD_SDALIGN) /* Must be atleast SDPCM_RESERVE | |
| 45 | − * defined in dhd_sdio.c | |
| 83 | +#define BUS_HEADER_LEN (16+BRCMF_SDALIGN) /* Must be atleast SDPCM_RESERVE | |
| 46 | 84 | * (amount of header tha might be added) |
| 47 | 85 | * plus any space that might be needed |
| 48 | 86 | * for alignment padding. |
| @@ -51,21 +89,22 @@ extern int dhd_preinit_ioctls(dhd_pub_t *dhd); · 2 unmodified lines | ||
| 51 | 89 | * round off at the end of buffer |
| 52 | 90 | */ |
| 53 | 91 | |
| 54 | −typedef struct dhd_prot { | |
| 92 | +struct brcmf_proto { | |
| 55 | 93 | u16 reqid; |
| 56 | 94 | u8 pending; |
| 57 | 95 | u32 lastcmd; |
| 58 | 96 | u8 bus_header[BUS_HEADER_LEN]; |
| 59 | − cdc_ioctl_t msg; | |
| 60 | − unsigned char buf[WLC_IOCTL_MAXLEN + ROUND_UP_MARGIN]; | |
| 61 | −} dhd_prot_t; | |
| 97 | + struct brcmf_proto_cdc_ioctl msg; | |
| 98 | + unsigned char buf[BRCMF_C_IOCTL_MAXLEN + ROUND_UP_MARGIN]; | |
| 99 | +}; | |
| 62 | 100 | |
| 63 | −static int dhdcdc_msg(dhd_pub_t *dhd) | |
| 101 | +static int brcmf_proto_cdc_msg(struct brcmf_pub *drvr) | |
| 64 | 102 | { |
| 65 | − dhd_prot_t *prot = dhd->prot; | |
| 66 | − int len = le32_to_cpu(prot->msg.len) + sizeof(cdc_ioctl_t); | |
| 103 | + struct brcmf_proto *prot = drvr->prot; | |
| 104 | + int len = le32_to_cpu(prot->msg.len) + | |
| 105 | + sizeof(struct brcmf_proto_cdc_ioctl); | |
| 67 | 106 | |
| 68 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 107 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 69 | 108 | |
| 70 | 109 | /* NOTE : cdc->msg.len holds the desired length of the buffer to be |
| 71 | 110 | * returned. Only up to CDC_MAX_MSG_SIZE of this buffer area |
| @@ -75,20 +114,21 @@ static int dhdcdc_msg(dhd_pub_t *dhd) · 3 unmodified lines | ||
| 75 | 114 | len = CDC_MAX_MSG_SIZE; |
| 76 | 115 | |
| 77 | 116 | /* Send request */ |
| 78 | − return dhd_bus_txctl(dhd->bus, (unsigned char *)&prot->msg, len); | |
| 117 | + return brcmf_sdbrcm_bus_txctl(drvr->bus, (unsigned char *)&prot->msg, | |
| 118 | + len); | |
| 79 | 119 | } |
| 80 | 120 | |
| 81 | −static int dhdcdc_cmplt(dhd_pub_t *dhd, u32 id, u32 len) | |
| 121 | +static int brcmf_proto_cdc_cmplt(struct brcmf_pub *drvr, u32 id, u32 len) | |
| 82 | 122 | { |
| 83 | 123 | int ret; |
| 84 | − dhd_prot_t *prot = dhd->prot; | |
| 124 | + struct brcmf_proto *prot = drvr->prot; | |
| 85 | 125 | |
| 86 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 126 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 87 | 127 | |
| 88 | 128 | do { |
| 89 | − ret = | |
| 90 | − dhd_bus_rxctl(dhd->bus, (unsigned char *)&prot->msg, | |
| 91 | − len + sizeof(cdc_ioctl_t)); | |
| 129 | + ret = brcmf_sdbrcm_bus_rxctl(drvr->bus, | |
| 130 | + (unsigned char *)&prot->msg, | |
| 131 | + len + sizeof(struct brcmf_proto_cdc_ioctl)); | |
| 92 | 132 | if (ret < 0) |
| 93 | 133 | break; |
| 94 | 134 | } while (CDC_IOC_ID(le32_to_cpu(prot->msg.flags)) != id); |
| @@ -97,30 +137,31 @@ static int dhdcdc_cmplt(dhd_pub_t *dhd, u32 id, u32 len) · 2 unmodified lines | ||
| 97 | 137 | } |
| 98 | 138 | |
| 99 | 139 | int |
| 100 | −dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len) | |
| 140 | +brcmf_proto_cdc_query_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd, | |
| 141 | + void *buf, uint len) | |
| 101 | 142 | { |
| 102 | − dhd_prot_t *prot = dhd->prot; | |
| 103 | − cdc_ioctl_t *msg = &prot->msg; | |
| 143 | + struct brcmf_proto *prot = drvr->prot; | |
| 144 | + struct brcmf_proto_cdc_ioctl *msg = &prot->msg; | |
| 104 | 145 | void *info; |
| 105 | 146 | int ret = 0, retries = 0; |
| 106 | 147 | u32 id, flags = 0; |
| 107 | 148 | |
| 108 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 109 | − DHD_CTL(("%s: cmd %d len %d\n", __func__, cmd, len)); | |
| 149 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 150 | + BRCMF_CTL(("%s: cmd %d len %d\n", __func__, cmd, len)); | |
| 110 | 151 | |
| 111 | 152 | /* Respond "bcmerror" and "bcmerrorstr" with local cache */ |
| 112 | − if (cmd == WLC_GET_VAR && buf) { | |
| 153 | + if (cmd == BRCMF_C_GET_VAR && buf) { | |
| 113 | 154 | if (!strcmp((char *)buf, "bcmerrorstr")) { |
| 114 | 155 | strncpy((char *)buf, "bcm_error", |
| 115 | 156 | BCME_STRLEN); |
| 116 | 157 | goto done; |
| 117 | 158 | } else if (!strcmp((char *)buf, "bcmerror")) { |
| 118 | − *(int *)buf = dhd->dongle_error; | |
| 159 | + *(int *)buf = drvr->dongle_error; | |
| 119 | 160 | goto done; |
| 120 | 161 | } |
| 121 | 162 | } |
| 122 | 163 | |
| 123 | − memset(msg, 0, sizeof(cdc_ioctl_t)); | |
| 164 | + memset(msg, 0, sizeof(struct brcmf_proto_cdc_ioctl)); | |
| 124 | 165 | |
| 125 | 166 | msg->cmd = cpu_to_le32(cmd); |
| 126 | 167 | msg->len = cpu_to_le32(len); |
| @@ -131,16 +172,16 @@ dhdcdc_query_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len) · 4 unmodified lines | ||
| 131 | 172 | if (buf) |
| 132 | 173 | memcpy(prot->buf, buf, len); |
| 133 | 174 | |
| 134 | − ret = dhdcdc_msg(dhd); | |
| 175 | + ret = brcmf_proto_cdc_msg(drvr); | |
| 135 | 176 | if (ret < 0) { |
| 136 | − DHD_ERROR(("dhdcdc_query_ioctl: dhdcdc_msg failed w/status " | |
| 137 | − "%d\n", ret)); | |
| 177 | + BRCMF_ERROR(("brcmf_proto_cdc_query_ioctl: brcmf_proto_cdc_msg " | |
| 178 | + "failed w/status %d\n", ret)); | |
| 138 | 179 | goto done; |
| 139 | 180 | } |
| 140 | 181 | |
| 141 | 182 | retry: |
| 142 | 183 | /* wait for interrupt and get first fragment */ |
| 143 | − ret = dhdcdc_cmplt(dhd, prot->reqid, len); | |
| 184 | + ret = brcmf_proto_cdc_cmplt(drvr, prot->reqid, len); | |
| 144 | 185 | if (ret < 0) |
| 145 | 186 | goto done; |
| 146 | 187 | |
| @@ -150,8 +191,9 @@ retry: · 3 unmodified lines | ||
| 150 | 191 | if ((id < prot->reqid) && (++retries < RETRIES)) |
| 151 | 192 | goto retry; |
| 152 | 193 | if (id != prot->reqid) { |
| 153 | − DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n", | |
| 154 | − dhd_ifname(dhd, ifidx), __func__, id, prot->reqid)); | |
| 194 | + BRCMF_ERROR(("%s: %s: unexpected request id %d (expected %d)\n", | |
| 195 | + brcmf_ifname(drvr, ifidx), __func__, id, | |
| 196 | + prot->reqid)); | |
| 155 | 197 | ret = -EINVAL; |
| 156 | 198 | goto done; |
| 157 | 199 | } |
| @@ -170,24 +212,25 @@ retry: · 12 unmodified lines | ||
| 170 | 212 | if (flags & CDCF_IOC_ERROR) { |
| 171 | 213 | ret = le32_to_cpu(msg->status); |
| 172 | 214 | /* Cache error from dongle */ |
| 173 | − dhd->dongle_error = ret; | |
| 215 | + drvr->dongle_error = ret; | |
| 174 | 216 | } |
| 175 | 217 | |
| 176 | 218 | done: |
| 177 | 219 | return ret; |
| 178 | 220 | } |
| 179 | 221 | |
| 180 | −int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len) | |
| 222 | +int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, uint cmd, | |
| 223 | + void *buf, uint len) | |
| 181 | 224 | { |
| 182 | − dhd_prot_t *prot = dhd->prot; | |
| 183 | − cdc_ioctl_t *msg = &prot->msg; | |
| 225 | + struct brcmf_proto *prot = drvr->prot; | |
| 226 | + struct brcmf_proto_cdc_ioctl *msg = &prot->msg; | |
| 184 | 227 | int ret = 0; |
| 185 | 228 | u32 flags, id; |
| 186 | 229 | |
| 187 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 188 | − DHD_CTL(("%s: cmd %d len %d\n", __func__, cmd, len)); | |
| 230 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 231 | + BRCMF_CTL(("%s: cmd %d len %d\n", __func__, cmd, len)); | |
| 189 | 232 | |
| 190 | − memset(msg, 0, sizeof(cdc_ioctl_t)); | |
| 233 | + memset(msg, 0, sizeof(struct brcmf_proto_cdc_ioctl)); | |
| 191 | 234 | |
| 192 | 235 | msg->cmd = cpu_to_le32(cmd); |
| 193 | 236 | msg->len = cpu_to_le32(len); |
| @@ -198,11 +241,11 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len) · 4 unmodified lines | ||
| 198 | 241 | if (buf) |
| 199 | 242 | memcpy(prot->buf, buf, len); |
| 200 | 243 | |
| 201 | − ret = dhdcdc_msg(dhd); | |
| 244 | + ret = brcmf_proto_cdc_msg(drvr); | |
| 202 | 245 | if (ret < 0) |
| 203 | 246 | goto done; |
| 204 | 247 | |
| 205 | − ret = dhdcdc_cmplt(dhd, prot->reqid, len); | |
| 248 | + ret = brcmf_proto_cdc_cmplt(drvr, prot->reqid, len); | |
| 206 | 249 | if (ret < 0) |
| 207 | 250 | goto done; |
| 208 | 251 | |
| @@ -210,8 +253,9 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len) · 1 unmodified line | ||
| 210 | 253 | id = (flags & CDCF_IOC_ID_MASK) >> CDCF_IOC_ID_SHIFT; |
| 211 | 254 | |
| 212 | 255 | if (id != prot->reqid) { |
| 213 | − DHD_ERROR(("%s: %s: unexpected request id %d (expected %d)\n", | |
| 214 | − dhd_ifname(dhd, ifidx), __func__, id, prot->reqid)); | |
| 256 | + BRCMF_ERROR(("%s: %s: unexpected request id %d (expected %d)\n", | |
| 257 | + brcmf_ifname(drvr, ifidx), __func__, id, | |
| 258 | + prot->reqid)); | |
| 215 | 259 | ret = -EINVAL; |
| 216 | 260 | goto done; |
| 217 | 261 | } |
| @@ -220,41 +264,40 @@ int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, uint len) · 2 unmodified lines | ||
| 220 | 264 | if (flags & CDCF_IOC_ERROR) { |
| 221 | 265 | ret = le32_to_cpu(msg->status); |
| 222 | 266 | /* Cache error from dongle */ |
| 223 | − dhd->dongle_error = ret; | |
| 267 | + drvr->dongle_error = ret; | |
| 224 | 268 | } |
| 225 | 269 | |
| 226 | 270 | done: |
| 227 | 271 | return ret; |
| 228 | 272 | } |
| 229 | 273 | |
| 230 | −extern int dhd_bus_interface(struct dhd_bus *bus, uint arg, void *arg2); | |
| 231 | 274 | int |
| 232 | −dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf, int len) | |
| 275 | +brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, struct brcmf_ioctl *ioc, | |
| 276 | + void *buf, int len) | |
| 233 | 277 | { |
| 234 | − dhd_prot_t *prot = dhd->prot; | |
| 278 | + struct brcmf_proto *prot = drvr->prot; | |
| 235 | 279 | int ret = -1; |
| 236 | 280 | |
| 237 | − if (dhd->busstate == DHD_BUS_DOWN) { | |
| 238 | − DHD_ERROR(("%s : bus is down. we have nothing to do\n", | |
| 239 | − __func__)); | |
| 281 | + if (drvr->busstate == BRCMF_BUS_DOWN) { | |
| 282 | + BRCMF_ERROR(("%s : bus is down. we have nothing to do\n", | |
| 283 | + __func__)); | |
| 240 | 284 | return ret; |
| 241 | 285 | } |
| 242 | − dhd_os_proto_block(dhd); | |
| 243 | − | |
| 244 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 286 | + brcmf_os_proto_block(drvr); | |
| 245 | 287 | |
| 246 | − ASSERT(len <= WLC_IOCTL_MAXLEN); | |
| 288 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 247 | 289 | |
| 248 | − if (len > WLC_IOCTL_MAXLEN) | |
| 290 | + if (len > BRCMF_C_IOCTL_MAXLEN) | |
| 249 | 291 | goto done; |
| 250 | 292 | |
| 251 | 293 | if (prot->pending == true) { |
| 252 | − DHD_TRACE(("CDC packet is pending!!!! cmd=0x%x (%lu) " | |
| 253 | − "lastcmd=0x%x (%lu)\n", | |
| 254 | − ioc->cmd, (unsigned long)ioc->cmd, prot->lastcmd, | |
| 255 | − (unsigned long)prot->lastcmd)); | |
| 256 | − if ((ioc->cmd == WLC_SET_VAR) || (ioc->cmd == WLC_GET_VAR)) | |
| 257 | − DHD_TRACE(("iovar cmd=%s\n", (char *)buf)); | |
| 294 | + BRCMF_TRACE(("CDC packet is pending!!!! cmd=0x%x (%lu) " | |
| 295 | + "lastcmd=0x%x (%lu)\n", | |
| 296 | + ioc->cmd, (unsigned long)ioc->cmd, prot->lastcmd, | |
| 297 | + (unsigned long)prot->lastcmd)); | |
| 298 | + if ((ioc->cmd == BRCMF_C_SET_VAR) || | |
| 299 | + (ioc->cmd == BRCMF_C_GET_VAR)) | |
| 300 | + BRCMF_TRACE(("iovar cmd=%s\n", (char *)buf)); | |
| 258 | 301 | |
| 259 | 302 | goto done; |
| 260 | 303 | } |
| @@ -262,36 +305,39 @@ dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, void *buf, int len) · 1 unmodified line | ||
| 262 | 305 | prot->pending = true; |
| 263 | 306 | prot->lastcmd = ioc->cmd; |
| 264 | 307 | if (ioc->set) |
| 265 | − ret = dhdcdc_set_ioctl(dhd, ifidx, ioc->cmd, buf, len); | |
| 308 | + ret = brcmf_proto_cdc_set_ioctl(drvr, ifidx, ioc->cmd, | |
| 309 | + buf, len); | |
| 266 | 310 | else { |
| 267 | − ret = dhdcdc_query_ioctl(dhd, ifidx, ioc->cmd, buf, len); | |
| 311 | + ret = brcmf_proto_cdc_query_ioctl(drvr, ifidx, ioc->cmd, | |
| 312 | + buf, len); | |
| 268 | 313 | if (ret > 0) |
| 269 | − ioc->used = ret - sizeof(cdc_ioctl_t); | |
| 314 | + ioc->used = ret - sizeof(struct brcmf_proto_cdc_ioctl); | |
| 270 | 315 | } |
| 271 | 316 | |
| 272 | 317 | /* Too many programs assume ioctl() returns 0 on success */ |
| 273 | 318 | if (ret >= 0) |
| 274 | 319 | ret = 0; |
| 275 | 320 | else { |
| 276 | − cdc_ioctl_t *msg = &prot->msg; | |
| 321 | + struct brcmf_proto_cdc_ioctl *msg = &prot->msg; | |
| 277 | 322 | /* len == needed when set/query fails from dongle */ |
| 278 | 323 | ioc->needed = le32_to_cpu(msg->len); |
| 279 | 324 | } |
| 280 | 325 | |
| 281 | 326 | /* Intercept the wme_dp ioctl here */ |
| 282 | − if ((!ret) && (ioc->cmd == WLC_SET_VAR) && (!strcmp(buf, "wme_dp"))) { | |
| 327 | + if (!ret && ioc->cmd == BRCMF_C_SET_VAR && | |
| 328 | + !strcmp(buf, "wme_dp")) { | |
| 283 | 329 | int slen, val = 0; |
| 284 | 330 | |
| 285 | 331 | slen = strlen("wme_dp") + 1; |
| 286 | 332 | if (len >= (int)(slen + sizeof(int))) |
| 287 | 333 | memcpy(&val, (char *)buf + slen, sizeof(int)); |
| 288 | − dhd->wme_dp = (u8) le32_to_cpu(val); | |
| 334 | + drvr->wme_dp = (u8) le32_to_cpu(val); | |
| 289 | 335 | } |
| 290 | 336 | |
| 291 | 337 | prot->pending = false; |
| 292 | 338 | |
| 293 | 339 | done: |
| 294 | − dhd_os_proto_unblock(dhd); | |
| 340 | + brcmf_os_proto_unblock(drvr); | |
| 295 | 341 | |
| 296 | 342 | return ret; |
| 297 | 343 | } |
| @@ -302,35 +348,23 @@ done: · 4 unmodified lines | ||
| 302 | 348 | (((struct sk_buff *)(skb))->ip_summed = \ |
| 303 | 349 | ((x) ? CHECKSUM_UNNECESSARY : CHECKSUM_NONE)) |
| 304 | 350 | |
| 305 | −/* PKTSETSUMNEEDED and PKTSUMGOOD are not possible because | |
| 306 | − skb->ip_summed is overloaded */ | |
| 307 | − | |
| 308 | −int | |
| 309 | −dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name, | |
| 310 | − void *params, int plen, void *arg, int len, bool set) | |
| 311 | −{ | |
| 312 | − return -ENOTSUPP; | |
| 313 | −} | |
| 314 | − | |
| 315 | −void dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf) | |
| 351 | +void brcmf_proto_dump(struct brcmf_pub *drvr, struct brcmu_strbuf *strbuf) | |
| 316 | 352 | { |
| 317 | − bcm_bprintf(strbuf, "Protocol CDC: reqid %d\n", dhdp->prot->reqid); | |
| 353 | + brcmu_bprintf(strbuf, "Protocol CDC: reqid %d\n", drvr->prot->reqid); | |
| 318 | 354 | } |
| 319 | 355 | |
| 320 | −void dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf) | |
| 356 | +void brcmf_proto_hdrpush(struct brcmf_pub *drvr, int ifidx, | |
| 357 | + struct sk_buff *pktbuf) | |
| 321 | 358 | { |
| 322 | −#ifdef BDC | |
| 323 | − struct bdc_header *h; | |
| 324 | −#endif /* BDC */ | |
| 359 | + struct brcmf_proto_bdc_header *h; | |
| 325 | 360 | |
| 326 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 361 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 327 | 362 | |
| 328 | −#ifdef BDC | |
| 329 | 363 | /* Push BDC header used to convey priority for buses that don't */ |
| 330 | 364 | |
| 331 | 365 | skb_push(pktbuf, BDC_HEADER_LEN); |
| 332 | 366 | |
| 333 | − h = (struct bdc_header *)(pktbuf->data); | |
| 367 | + h = (struct brcmf_proto_bdc_header *)(pktbuf->data); | |
| 334 | 368 | |
| 335 | 369 | h->flags = (BDC_PROTO_VER << BDC_FLAG_VER_SHIFT); |
| 336 | 370 | if (PKTSUMNEEDED(pktbuf)) |
| @@ -339,79 +373,74 @@ void dhd_prot_hdrpush(dhd_pub_t *dhd, int ifidx, struct sk_buff *pktbuf) · 2 unmodified lines | ||
| 339 | 373 | h->priority = (pktbuf->priority & BDC_PRIORITY_MASK); |
| 340 | 374 | h->flags2 = 0; |
| 341 | 375 | h->rssi = 0; |
| 342 | −#endif /* BDC */ | |
| 343 | 376 | BDC_SET_IF_IDX(h, ifidx); |
| 344 | 377 | } |
| 345 | 378 | |
| 346 | −int dhd_prot_hdrpull(dhd_pub_t *dhd, int *ifidx, struct sk_buff *pktbuf) | |
| 379 | +int brcmf_proto_hdrpull(struct brcmf_pub *drvr, int *ifidx, | |
| 380 | + struct sk_buff *pktbuf) | |
| 347 | 381 | { |
| 348 | −#ifdef BDC | |
| 349 | − struct bdc_header *h; | |
| 350 | −#endif | |
| 382 | + struct brcmf_proto_bdc_header *h; | |
| 351 | 383 | |
| 352 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 384 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 353 | 385 | |
| 354 | −#ifdef BDC | |
| 355 | 386 | /* Pop BDC header used to convey priority for buses that don't */ |
| 356 | 387 | |
| 357 | 388 | if (pktbuf->len < BDC_HEADER_LEN) { |
| 358 | − DHD_ERROR(("%s: rx data too short (%d < %d)\n", __func__, | |
| 359 | − pktbuf->len, BDC_HEADER_LEN)); | |
| 389 | + BRCMF_ERROR(("%s: rx data too short (%d < %d)\n", __func__, | |
| 390 | + pktbuf->len, BDC_HEADER_LEN)); | |
| 360 | 391 | return -EBADE; |
| 361 | 392 | } |
| 362 | 393 | |
| 363 | − h = (struct bdc_header *)(pktbuf->data); | |
| 394 | + h = (struct brcmf_proto_bdc_header *)(pktbuf->data); | |
| 364 | 395 | |
| 365 | 396 | *ifidx = BDC_GET_IF_IDX(h); |
| 366 | − if (*ifidx >= DHD_MAX_IFS) { | |
| 367 | − DHD_ERROR(("%s: rx data ifnum out of range (%d)\n", | |
| 368 | − __func__, *ifidx)); | |
| 397 | + if (*ifidx >= BRCMF_MAX_IFS) { | |
| 398 | + BRCMF_ERROR(("%s: rx data ifnum out of range (%d)\n", | |
| 399 | + __func__, *ifidx)); | |
| 369 | 400 | return -EBADE; |
| 370 | 401 | } |
| 371 | 402 | |
| 372 | 403 | if (((h->flags & BDC_FLAG_VER_MASK) >> BDC_FLAG_VER_SHIFT) != |
| 373 | 404 | BDC_PROTO_VER) { |
| 374 | − DHD_ERROR(("%s: non-BDC packet received, flags 0x%x\n", | |
| 375 | − dhd_ifname(dhd, *ifidx), h->flags)); | |
| 405 | + BRCMF_ERROR(("%s: non-BDC packet received, flags 0x%x\n", | |
| 406 | + brcmf_ifname(drvr, *ifidx), h->flags)); | |
| 376 | 407 | return -EBADE; |
| 377 | 408 | } |
| 378 | 409 | |
| 379 | 410 | if (h->flags & BDC_FLAG_SUM_GOOD) { |
| 380 | − DHD_INFO(("%s: BDC packet received with good rx-csum, " | |
| 381 | − "flags 0x%x\n", | |
| 382 | − dhd_ifname(dhd, *ifidx), h->flags)); | |
| 411 | + BRCMF_INFO(("%s: BDC packet received with good rx-csum, " | |
| 412 | + "flags 0x%x\n", | |
| 413 | + brcmf_ifname(drvr, *ifidx), h->flags)); | |
| 383 | 414 | PKTSETSUMGOOD(pktbuf, true); |
| 384 | 415 | } |
| 385 | 416 | |
| 386 | 417 | pktbuf->priority = h->priority & BDC_PRIORITY_MASK; |
| 387 | 418 | |
| 388 | 419 | skb_pull(pktbuf, BDC_HEADER_LEN); |
| 389 | −#endif /* BDC */ | |
| 390 | 420 | |
| 391 | 421 | return 0; |
| 392 | 422 | } |
| 393 | 423 | |
| 394 | −int dhd_prot_attach(dhd_pub_t *dhd) | |
| 424 | +int brcmf_proto_attach(struct brcmf_pub *drvr) | |
| 395 | 425 | { |
| 396 | − dhd_prot_t *cdc; | |
| 426 | + struct brcmf_proto *cdc; | |
| 397 | 427 | |
| 398 | − cdc = kzalloc(sizeof(dhd_prot_t), GFP_ATOMIC); | |
| 428 | + cdc = kzalloc(sizeof(struct brcmf_proto), GFP_ATOMIC); | |
| 399 | 429 | if (!cdc) { |
| 400 | − DHD_ERROR(("%s: kmalloc failed\n", __func__)); | |
| 430 | + BRCMF_ERROR(("%s: kmalloc failed\n", __func__)); | |
| 401 | 431 | goto fail; |
| 402 | 432 | } |
| 403 | 433 | |
| 404 | 434 | /* ensure that the msg buf directly follows the cdc msg struct */ |
| 405 | 435 | if ((unsigned long)(&cdc->msg + 1) != (unsigned long)cdc->buf) { |
| 406 | − DHD_ERROR(("dhd_prot_t is not correctly defined\n")); | |
| 436 | + BRCMF_ERROR(("struct brcmf_proto is not correctly defined\n")); | |
| 407 | 437 | goto fail; |
| 408 | 438 | } |
| 409 | 439 | |
| 410 | − dhd->prot = cdc; | |
| 411 | −#ifdef BDC | |
| 412 | − dhd->hdrlen += BDC_HEADER_LEN; | |
| 413 | −#endif | |
| 414 | − dhd->maxctl = WLC_IOCTL_MAXLEN + sizeof(cdc_ioctl_t) + ROUND_UP_MARGIN; | |
| 440 | + drvr->prot = cdc; | |
| 441 | + drvr->hdrlen += BDC_HEADER_LEN; | |
| 442 | + drvr->maxctl = BRCMF_C_IOCTL_MAXLEN + | |
| 443 | + sizeof(struct brcmf_proto_cdc_ioctl) + ROUND_UP_MARGIN; | |
| 415 | 444 | return 0; |
| 416 | 445 | |
| 417 | 446 | fail: |
| @@ -420,55 +449,54 @@ fail: · 2 unmodified lines | ||
| 420 | 449 | } |
| 421 | 450 | |
| 422 | 451 | /* ~NOTE~ What if another thread is waiting on the semaphore? Holding it? */ |
| 423 | −void dhd_prot_detach(dhd_pub_t *dhd) | |
| 452 | +void brcmf_proto_detach(struct brcmf_pub *drvr) | |
| 424 | 453 | { |
| 425 | − kfree(dhd->prot); | |
| 426 | − dhd->prot = NULL; | |
| 454 | + kfree(drvr->prot); | |
| 455 | + drvr->prot = NULL; | |
| 427 | 456 | } |
| 428 | 457 | |
| 429 | −void dhd_prot_dstats(dhd_pub_t *dhd) | |
| 458 | +void brcmf_proto_dstats(struct brcmf_pub *drvr) | |
| 430 | 459 | { |
| 431 | 460 | /* No stats from dongle added yet, copy bus stats */ |
| 432 | − dhd->dstats.tx_packets = dhd->tx_packets; | |
| 433 | − dhd->dstats.tx_errors = dhd->tx_errors; | |
| 434 | − dhd->dstats.rx_packets = dhd->rx_packets; | |
| 435 | − dhd->dstats.rx_errors = dhd->rx_errors; | |
| 436 | − dhd->dstats.rx_dropped = dhd->rx_dropped; | |
| 437 | − dhd->dstats.multicast = dhd->rx_multicast; | |
| 461 | + drvr->dstats.tx_packets = drvr->tx_packets; | |
| 462 | + drvr->dstats.tx_errors = drvr->tx_errors; | |
| 463 | + drvr->dstats.rx_packets = drvr->rx_packets; | |
| 464 | + drvr->dstats.rx_errors = drvr->rx_errors; | |
| 465 | + drvr->dstats.rx_dropped = drvr->rx_dropped; | |
| 466 | + drvr->dstats.multicast = drvr->rx_multicast; | |
| 438 | 467 | return; |
| 439 | 468 | } |
| 440 | 469 | |
| 441 | −int dhd_prot_init(dhd_pub_t *dhd) | |
| 470 | +int brcmf_proto_init(struct brcmf_pub *drvr) | |
| 442 | 471 | { |
| 443 | 472 | int ret = 0; |
| 444 | 473 | char buf[128]; |
| 445 | 474 | |
| 446 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 475 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 447 | 476 | |
| 448 | − dhd_os_proto_block(dhd); | |
| 477 | + brcmf_os_proto_block(drvr); | |
| 449 | 478 | |
| 450 | 479 | /* Get the device MAC address */ |
| 451 | 480 | strcpy(buf, "cur_etheraddr"); |
| 452 | − ret = dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, buf, sizeof(buf)); | |
| 481 | + ret = brcmf_proto_cdc_query_ioctl(drvr, 0, BRCMF_C_GET_VAR, | |
| 482 | + buf, sizeof(buf)); | |
| 453 | 483 | if (ret < 0) { |
| 454 | − dhd_os_proto_unblock(dhd); | |
| 484 | + brcmf_os_proto_unblock(drvr); | |
| 455 | 485 | return ret; |
| 456 | 486 | } |
| 457 | − memcpy(dhd->mac, buf, ETH_ALEN); | |
| 487 | + memcpy(drvr->mac, buf, ETH_ALEN); | |
| 458 | 488 | |
| 459 | − dhd_os_proto_unblock(dhd); | |
| 489 | + brcmf_os_proto_unblock(drvr); | |
| 460 | 490 | |
| 461 | −#ifdef EMBEDDED_PLATFORM | |
| 462 | − ret = dhd_preinit_ioctls(dhd); | |
| 463 | −#endif /* EMBEDDED_PLATFORM */ | |
| 491 | + ret = brcmf_c_preinit_ioctls(drvr); | |
| 464 | 492 | |
| 465 | 493 | /* Always assumes wl for now */ |
| 466 | − dhd->iswl = true; | |
| 494 | + drvr->iswl = true; | |
| 467 | 495 | |
| 468 | 496 | return ret; |
| 469 | 497 | } |
| 470 | 498 | |
| 471 | −void dhd_prot_stop(dhd_pub_t *dhd) | |
| 499 | +void brcmf_proto_stop(struct brcmf_pub *drvr) | |
| 472 | 500 | { |
| 473 | 501 | /* Nothing to do for CDC */ |
| 474 | 502 | } |
| @@ -15,64 +15,41 @@ · 14 unmodified lines | ||
| 15 | 15 | */ |
| 16 | 16 | #include <linux/kernel.h> |
| 17 | 17 | #include <linux/string.h> |
| 18 | −#include <bcmdefs.h> | |
| 18 | +#include <linux/sched.h> | |
| 19 | 19 | #include <linux/netdevice.h> |
| 20 | −#include <bcmutils.h> | |
| 21 | −#include <dngl_stats.h> | |
| 22 | −#include <dhd.h> | |
| 23 | −#include <dhd_bus.h> | |
| 24 | −#include <dhd_proto.h> | |
| 25 | −#include <dhd_dbg.h> | |
| 26 | −#include <msgtrace.h> | |
| 27 | −#include <wlioctl.h> | |
| 28 | − | |
| 29 | −int dhd_msg_level; | |
| 30 | −char fw_path[MOD_PARAM_PATHLEN]; | |
| 31 | −char nv_path[MOD_PARAM_PATHLEN]; | |
| 32 | − | |
| 33 | −/* Last connection success/failure status */ | |
| 34 | −u32 dhd_conn_event; | |
| 35 | −u32 dhd_conn_status; | |
| 36 | −u32 dhd_conn_reason; | |
| 37 | − | |
| 38 | −extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, | |
| 39 | − uint len); | |
| 40 | −extern void dhd_ind_scan_confirm(void *h, bool status); | |
| 41 | −extern int dhd_wl_ioctl(dhd_pub_t *dhd, uint cmd, char *buf, uint buflen); | |
| 42 | −void dhd_iscan_lock(void); | |
| 43 | −void dhd_iscan_unlock(void); | |
| 44 | − | |
| 45 | −/* Packet alignment for most efficient SDIO (can change based on platform) */ | |
| 46 | −#ifndef DHD_SDALIGN | |
| 47 | −#define DHD_SDALIGN 32 | |
| 48 | −#endif | |
| 49 | −#if !ISPOWEROF2(DHD_SDALIGN) | |
| 50 | −#error DHD_SDALIGN is not a power of 2! | |
| 51 | −#endif | |
| 52 | − | |
| 53 | −#define EPI_VERSION_STR "4.218.248.5" | |
| 54 | −#ifdef DHD_DEBUG | |
| 55 | −const char dhd_version[] = | |
| 56 | −"Dongle Host Driver, version " EPI_VERSION_STR "\nCompiled on " __DATE__ | |
| 20 | +#include <asm/unaligned.h> | |
| 21 | +#include <defs.h> | |
| 22 | +#include <brcmu_wifi.h> | |
| 23 | +#include <brcmu_utils.h> | |
| 24 | +#include "dhd.h" | |
| 25 | +#include "dhd_bus.h" | |
| 26 | +#include "dhd_proto.h" | |
| 27 | +#include "dhd_dbg.h" | |
| 28 | + | |
| 29 | +#define BRCM_OUI "\x00\x10\x18" | |
| 30 | +#define DOT11_OUI_LEN 3 | |
| 31 | +#define BCMILCP_BCM_SUBTYPE_EVENT 1 | |
| 32 | +#define PKTFILTER_BUF_SIZE 2048 | |
| 33 | + | |
| 34 | +int brcmf_msg_level; | |
| 35 | + | |
| 36 | +#define MSGTRACE_VERSION 1 | |
| 37 | + | |
| 38 | +#ifdef BCMDBG | |
| 39 | +const char brcmf_version[] = | |
| 40 | +"Dongle Host Driver, version " BRCMF_VERSION_STR "\nCompiled on " __DATE__ | |
| 57 | 41 | " at " __TIME__; |
| 58 | 42 | #else |
| 59 | −const char dhd_version[] = "Dongle Host Driver, version " EPI_VERSION_STR; | |
| 43 | +const char brcmf_version[] = "Dongle Host Driver, version " BRCMF_VERSION_STR; | |
| 60 | 44 | #endif |
| 61 | 45 | |
| 62 | −void dhd_set_timer(void *bus, uint wdtick); | |
| 63 | − | |
| 64 | 46 | /* IOVar table */ |
| 65 | 47 | enum { |
| 66 | 48 | IOV_VERSION = 1, |
| 67 | 49 | IOV_MSGLEVEL, |
| 68 | 50 | IOV_BCMERRORSTR, |
| 69 | 51 | IOV_BCMERROR, |
| 70 | − IOV_WDTICK, | |
| 71 | 52 | IOV_DUMP, |
| 72 | −#ifdef DHD_DEBUG | |
| 73 | − IOV_CONS, | |
| 74 | − IOV_DCONSOLE_POLL, | |
| 75 | −#endif | |
| 76 | 53 | IOV_CLEARCOUNTS, |
| 77 | 54 | IOV_LOGDUMP, |
| 78 | 55 | IOV_LOGCAL, |
| @@ -82,27 +59,19 @@ enum { · 3 unmodified lines | ||
| 82 | 59 | IOV_LAST |
| 83 | 60 | }; |
| 84 | 61 | |
| 85 | −const bcm_iovar_t dhd_iovars[] = { | |
| 86 | − {"version", IOV_VERSION, 0, IOVT_BUFFER, sizeof(dhd_version)} | |
| 62 | +const struct brcmu_iovar brcmf_iovars[] = { | |
| 63 | + {"version", IOV_VERSION, 0, IOVT_BUFFER, sizeof(brcmf_version)} | |
| 87 | 64 | , |
| 88 | −#ifdef DHD_DEBUG | |
| 65 | +#ifdef BCMDBG | |
| 89 | 66 | {"msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0} |
| 90 | 67 | , |
| 91 | −#endif /* DHD_DEBUG */ | |
| 68 | +#endif /* BCMDBG */ | |
| 92 | 69 | {"bcmerrorstr", IOV_BCMERRORSTR, 0, IOVT_BUFFER, BCME_STRLEN} |
| 93 | 70 | , |
| 94 | 71 | {"bcmerror", IOV_BCMERROR, 0, IOVT_INT8, 0} |
| 95 | 72 | , |
| 96 | − {"wdtick", IOV_WDTICK, 0, IOVT_UINT32, 0} | |
| 97 | − , | |
| 98 | − {"dump", IOV_DUMP, 0, IOVT_BUFFER, DHD_IOCTL_MAXLEN} | |
| 99 | − , | |
| 100 | −#ifdef DHD_DEBUG | |
| 101 | − {"dconpoll", IOV_DCONSOLE_POLL, 0, IOVT_UINT32, 0} | |
| 73 | + {"dump", IOV_DUMP, 0, IOVT_BUFFER, BRCMF_IOCTL_MAXLEN} | |
| 102 | 74 | , |
| 103 | − {"cons", IOV_CONS, 0, IOVT_BUFFER, 0} | |
| 104 | − , | |
| 105 | −#endif | |
| 106 | 75 | {"clearcounts", IOV_CLEARCOUNTS, 0, IOVT_VOID, 0} |
| 107 | 76 | , |
| 108 | 77 | {"gpioob", IOV_GPIOOB, 0, IOVT_UINT32, 0} |
| @@ -112,7 +81,23 @@ const bcm_iovar_t dhd_iovars[] = { · 3 unmodified lines | ||
| 112 | 81 | {NULL, 0, 0, 0, 0} |
| 113 | 82 | }; |
| 114 | 83 | |
| 115 | −void dhd_common_init(void) | |
| 84 | +/* Message trace header */ | |
| 85 | +struct msgtrace_hdr { | |
| 86 | + u8 version; | |
| 87 | + u8 spare; | |
| 88 | + u16 len; /* Len of the trace */ | |
| 89 | + u32 seqnum; /* Sequence number of message. Useful | |
| 90 | + * if the messsage has been lost | |
| 91 | + * because of DMA error or a bus reset | |
| 92 | + * (ex: SDIO Func2) | |
| 93 | + */ | |
| 94 | + u32 discarded_bytes; /* Number of discarded bytes because of | |
| 95 | + trace overflow */ | |
| 96 | + u32 discarded_printf; /* Number of discarded printf | |
| 97 | + because of trace overflow */ | |
| 98 | +} __packed; | |
| 99 | + | |
| 100 | +void brcmf_c_init(void) | |
| 116 | 101 | { |
| 117 | 102 | /* Init global variables at run-time, not as part of the declaration. |
| 118 | 103 | * This is required to support init/de-init of the driver. |
| @@ -122,87 +107,77 @@ void dhd_common_init(void) · 3 unmodified lines | ||
| 122 | 107 | * first time that the driver is initialized vs subsequent |
| 123 | 108 | * initializations. |
| 124 | 109 | */ |
| 125 | − dhd_msg_level = DHD_ERROR_VAL; | |
| 126 | −#ifdef CONFIG_BCM4329_FW_PATH | |
| 127 | − strncpy(fw_path, CONFIG_BCM4329_FW_PATH, MOD_PARAM_PATHLEN - 1); | |
| 128 | −#else | |
| 129 | − fw_path[0] = '\0'; | |
| 130 | −#endif | |
| 131 | −#ifdef CONFIG_BCM4329_NVRAM_PATH | |
| 132 | − strncpy(nv_path, CONFIG_BCM4329_NVRAM_PATH, MOD_PARAM_PATHLEN - 1); | |
| 133 | −#else | |
| 134 | − nv_path[0] = '\0'; | |
| 135 | −#endif | |
| 110 | + brcmf_msg_level = BRCMF_ERROR_VAL; | |
| 136 | 111 | } |
| 137 | 112 | |
| 138 | −static int dhd_dump(dhd_pub_t *dhdp, char *buf, int buflen) | |
| 113 | +static int brcmf_c_dump(struct brcmf_pub *drvr, char *buf, int buflen) | |
| 139 | 114 | { |
| 140 | − struct bcmstrbuf b; | |
| 141 | − struct bcmstrbuf *strbuf = &b; | |
| 142 | − | |
| 143 | − bcm_binit(strbuf, buf, buflen); | |
| 144 | − | |
| 145 | − /* Base DHD info */ | |
| 146 | − bcm_bprintf(strbuf, "%s\n", dhd_version); | |
| 147 | − bcm_bprintf(strbuf, "\n"); | |
| 148 | − bcm_bprintf(strbuf, "pub.up %d pub.txoff %d pub.busstate %d\n", | |
| 149 | − dhdp->up, dhdp->txoff, dhdp->busstate); | |
| 150 | − bcm_bprintf(strbuf, "pub.hdrlen %d pub.maxctl %d pub.rxsz %d\n", | |
| 151 | − dhdp->hdrlen, dhdp->maxctl, dhdp->rxsz); | |
| 152 | − bcm_bprintf(strbuf, "pub.iswl %d pub.drv_version %ld pub.mac %pM\n", | |
| 153 | − dhdp->iswl, dhdp->drv_version, &dhdp->mac); | |
| 154 | − bcm_bprintf(strbuf, "pub.bcmerror %d tickcnt %d\n", dhdp->bcmerror, | |
| 155 | − dhdp->tickcnt); | |
| 156 | − | |
| 157 | − bcm_bprintf(strbuf, "dongle stats:\n"); | |
| 158 | − bcm_bprintf(strbuf, | |
| 115 | + struct brcmu_strbuf b; | |
| 116 | + struct brcmu_strbuf *strbuf = &b; | |
| 117 | + | |
| 118 | + brcmu_binit(strbuf, buf, buflen); | |
| 119 | + | |
| 120 | + /* Base info */ | |
| 121 | + brcmu_bprintf(strbuf, "%s\n", brcmf_version); | |
| 122 | + brcmu_bprintf(strbuf, "\n"); | |
| 123 | + brcmu_bprintf(strbuf, "pub.up %d pub.txoff %d pub.busstate %d\n", | |
| 124 | + drvr->up, drvr->txoff, drvr->busstate); | |
| 125 | + brcmu_bprintf(strbuf, "pub.hdrlen %d pub.maxctl %d pub.rxsz %d\n", | |
| 126 | + drvr->hdrlen, drvr->maxctl, drvr->rxsz); | |
| 127 | + brcmu_bprintf(strbuf, "pub.iswl %d pub.drv_version %ld pub.mac %pM\n", | |
| 128 | + drvr->iswl, drvr->drv_version, &drvr->mac); | |
| 129 | + brcmu_bprintf(strbuf, "pub.bcmerror %d tickcnt %d\n", drvr->bcmerror, | |
| 130 | + drvr->tickcnt); | |
| 131 | + | |
| 132 | + brcmu_bprintf(strbuf, "dongle stats:\n"); | |
| 133 | + brcmu_bprintf(strbuf, | |
| 159 | 134 | "tx_packets %ld tx_bytes %ld tx_errors %ld tx_dropped %ld\n", |
| 160 | − dhdp->dstats.tx_packets, dhdp->dstats.tx_bytes, | |
| 161 | − dhdp->dstats.tx_errors, dhdp->dstats.tx_dropped); | |
| 162 | − bcm_bprintf(strbuf, | |
| 135 | + drvr->dstats.tx_packets, drvr->dstats.tx_bytes, | |
| 136 | + drvr->dstats.tx_errors, drvr->dstats.tx_dropped); | |
| 137 | + brcmu_bprintf(strbuf, | |
| 163 | 138 | "rx_packets %ld rx_bytes %ld rx_errors %ld rx_dropped %ld\n", |
| 164 | − dhdp->dstats.rx_packets, dhdp->dstats.rx_bytes, | |
| 165 | − dhdp->dstats.rx_errors, dhdp->dstats.rx_dropped); | |
| 166 | − bcm_bprintf(strbuf, "multicast %ld\n", dhdp->dstats.multicast); | |
| 167 | − | |
| 168 | − bcm_bprintf(strbuf, "bus stats:\n"); | |
| 169 | − bcm_bprintf(strbuf, "tx_packets %ld tx_multicast %ld tx_errors %ld\n", | |
| 170 | − dhdp->tx_packets, dhdp->tx_multicast, dhdp->tx_errors); | |
| 171 | − bcm_bprintf(strbuf, "tx_ctlpkts %ld tx_ctlerrs %ld\n", | |
| 172 | − dhdp->tx_ctlpkts, dhdp->tx_ctlerrs); | |
| 173 | − bcm_bprintf(strbuf, "rx_packets %ld rx_multicast %ld rx_errors %ld\n", | |
| 174 | − dhdp->rx_packets, dhdp->rx_multicast, dhdp->rx_errors); | |
| 175 | − bcm_bprintf(strbuf, | |
| 139 | + drvr->dstats.rx_packets, drvr->dstats.rx_bytes, | |
| 140 | + drvr->dstats.rx_errors, drvr->dstats.rx_dropped); | |
| 141 | + brcmu_bprintf(strbuf, "multicast %ld\n", drvr->dstats.multicast); | |
| 142 | + | |
| 143 | + brcmu_bprintf(strbuf, "bus stats:\n"); | |
| 144 | + brcmu_bprintf(strbuf, "tx_packets %ld tx_multicast %ld tx_errors %ld\n", | |
| 145 | + drvr->tx_packets, drvr->tx_multicast, drvr->tx_errors); | |
| 146 | + brcmu_bprintf(strbuf, "tx_ctlpkts %ld tx_ctlerrs %ld\n", | |
| 147 | + drvr->tx_ctlpkts, drvr->tx_ctlerrs); | |
| 148 | + brcmu_bprintf(strbuf, "rx_packets %ld rx_multicast %ld rx_errors %ld\n", | |
| 149 | + drvr->rx_packets, drvr->rx_multicast, drvr->rx_errors); | |
| 150 | + brcmu_bprintf(strbuf, | |
| 176 | 151 | "rx_ctlpkts %ld rx_ctlerrs %ld rx_dropped %ld rx_flushed %ld\n", |
| 177 | − dhdp->rx_ctlpkts, dhdp->rx_ctlerrs, dhdp->rx_dropped, | |
| 178 | − dhdp->rx_flushed); | |
| 179 | − bcm_bprintf(strbuf, | |
| 152 | + drvr->rx_ctlpkts, drvr->rx_ctlerrs, drvr->rx_dropped, | |
| 153 | + drvr->rx_flushed); | |
| 154 | + brcmu_bprintf(strbuf, | |
| 180 | 155 | "rx_readahead_cnt %ld tx_realloc %ld fc_packets %ld\n", |
| 181 | − dhdp->rx_readahead_cnt, dhdp->tx_realloc, dhdp->fc_packets); | |
| 182 | − bcm_bprintf(strbuf, "wd_dpc_sched %ld\n", dhdp->wd_dpc_sched); | |
| 183 | − bcm_bprintf(strbuf, "\n"); | |
| 156 | + drvr->rx_readahead_cnt, drvr->tx_realloc, drvr->fc_packets); | |
| 157 | + brcmu_bprintf(strbuf, "wd_dpc_sched %ld\n", drvr->wd_dpc_sched); | |
| 158 | + brcmu_bprintf(strbuf, "\n"); | |
| 184 | 159 | |
| 185 | 160 | /* Add any prot info */ |
| 186 | − dhd_prot_dump(dhdp, strbuf); | |
| 187 | − bcm_bprintf(strbuf, "\n"); | |
| 161 | + brcmf_proto_dump(drvr, strbuf); | |
| 162 | + brcmu_bprintf(strbuf, "\n"); | |
| 188 | 163 | |
| 189 | 164 | /* Add any bus info */ |
| 190 | − dhd_bus_dump(dhdp, strbuf); | |
| 165 | + brcmf_sdbrcm_bus_dump(drvr, strbuf); | |
| 191 | 166 | |
| 192 | 167 | return !strbuf->size ? -EOVERFLOW : 0; |
| 193 | 168 | } |
| 194 | 169 | |
| 195 | 170 | static int |
| 196 | −dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid, | |
| 197 | − const char *name, void *params, int plen, void *arg, int len, | |
| 198 | − int val_size) | |
| 171 | +brcmf_c_doiovar(struct brcmf_pub *drvr, const struct brcmu_iovar *vi, | |
| 172 | + u32 actionid, const char *name, void *params, int plen, | |
| 173 | + void *arg, int len, int val_size) | |
| 199 | 174 | { |
| 200 | 175 | int bcmerror = 0; |
| 201 | 176 | s32 int_val = 0; |
| 202 | 177 | |
| 203 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 178 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 204 | 179 | |
| 205 | − bcmerror = bcm_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid)); | |
| 180 | + bcmerror = brcmu_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid)); | |
| 206 | 181 | if (bcmerror != 0) |
| 207 | 182 | goto exit; |
| 208 | 183 | |
| @@ -212,16 +187,16 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid, · 3 unmodified lines | ||
| 212 | 187 | switch (actionid) { |
| 213 | 188 | case IOV_GVAL(IOV_VERSION): |
| 214 | 189 | /* Need to have checked buffer length */ |
| 215 | − strncpy((char *)arg, dhd_version, len); | |
| 190 | + strncpy((char *)arg, brcmf_version, len); | |
| 216 | 191 | break; |
| 217 | 192 | |
| 218 | 193 | case IOV_GVAL(IOV_MSGLEVEL): |
| 219 | − int_val = (s32) dhd_msg_level; | |
| 194 | + int_val = (s32) brcmf_msg_level; | |
| 220 | 195 | memcpy(arg, &int_val, val_size); |
| 221 | 196 | break; |
| 222 | 197 | |
| 223 | 198 | case IOV_SVAL(IOV_MSGLEVEL): |
| 224 | − dhd_msg_level = int_val; | |
| 199 | + brcmf_msg_level = int_val; | |
| 225 | 200 | break; |
| 226 | 201 | |
| 227 | 202 | case IOV_GVAL(IOV_BCMERRORSTR): |
| @@ -231,58 +206,29 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid, · 3 unmodified lines | ||
| 231 | 206 | break; |
| 232 | 207 | |
| 233 | 208 | case IOV_GVAL(IOV_BCMERROR): |
| 234 | − int_val = (s32) dhd_pub->bcmerror; | |
| 209 | + int_val = (s32) drvr->bcmerror; | |
| 235 | 210 | memcpy(arg, &int_val, val_size); |
| 236 | 211 | break; |
| 237 | 212 | |
| 238 | − case IOV_GVAL(IOV_WDTICK): | |
| 239 | − int_val = (s32) dhd_watchdog_ms; | |
| 240 | − memcpy(arg, &int_val, val_size); | |
| 241 | − break; | |
| 242 | − | |
| 243 | − case IOV_SVAL(IOV_WDTICK): | |
| 244 | − if (!dhd_pub->up) { | |
| 245 | − bcmerror = -ENOLINK; | |
| 246 | − break; | |
| 247 | − } | |
| 248 | − dhd_os_wd_timer(dhd_pub, (uint) int_val); | |
| 249 | − break; | |
| 250 | − | |
| 251 | 213 | case IOV_GVAL(IOV_DUMP): |
| 252 | − bcmerror = dhd_dump(dhd_pub, arg, len); | |
| 253 | − break; | |
| 254 | − | |
| 255 | −#ifdef DHD_DEBUG | |
| 256 | − case IOV_GVAL(IOV_DCONSOLE_POLL): | |
| 257 | − int_val = (s32) dhd_console_ms; | |
| 258 | − memcpy(arg, &int_val, val_size); | |
| 259 | − break; | |
| 260 | − | |
| 261 | − case IOV_SVAL(IOV_DCONSOLE_POLL): | |
| 262 | − dhd_console_ms = (uint) int_val; | |
| 263 | − break; | |
| 264 | − | |
| 265 | − case IOV_SVAL(IOV_CONS): | |
| 266 | − if (len > 0) | |
| 267 | − bcmerror = dhd_bus_console_in(dhd_pub, arg, len - 1); | |
| 214 | + bcmerror = brcmf_c_dump(drvr, arg, len); | |
| 268 | 215 | break; |
| 269 | −#endif | |
| 270 | 216 | |
| 271 | 217 | case IOV_SVAL(IOV_CLEARCOUNTS): |
| 272 | − dhd_pub->tx_packets = dhd_pub->rx_packets = 0; | |
| 273 | − dhd_pub->tx_errors = dhd_pub->rx_errors = 0; | |
| 274 | − dhd_pub->tx_ctlpkts = dhd_pub->rx_ctlpkts = 0; | |
| 275 | − dhd_pub->tx_ctlerrs = dhd_pub->rx_ctlerrs = 0; | |
| 276 | − dhd_pub->rx_dropped = 0; | |
| 277 | − dhd_pub->rx_readahead_cnt = 0; | |
| 278 | − dhd_pub->tx_realloc = 0; | |
| 279 | − dhd_pub->wd_dpc_sched = 0; | |
| 280 | − memset(&dhd_pub->dstats, 0, sizeof(dhd_pub->dstats)); | |
| 281 | − dhd_bus_clearcounts(dhd_pub); | |
| 218 | + drvr->tx_packets = drvr->rx_packets = 0; | |
| 219 | + drvr->tx_errors = drvr->rx_errors = 0; | |
| 220 | + drvr->tx_ctlpkts = drvr->rx_ctlpkts = 0; | |
| 221 | + drvr->tx_ctlerrs = drvr->rx_ctlerrs = 0; | |
| 222 | + drvr->rx_dropped = 0; | |
| 223 | + drvr->rx_readahead_cnt = 0; | |
| 224 | + drvr->tx_realloc = 0; | |
| 225 | + drvr->wd_dpc_sched = 0; | |
| 226 | + memset(&drvr->dstats, 0, sizeof(drvr->dstats)); | |
| 227 | + brcmf_bus_clearcounts(drvr); | |
| 282 | 228 | break; |
| 283 | 229 | |
| 284 | 230 | case IOV_GVAL(IOV_IOCTLTIMEOUT):{ |
| 285 | − int_val = (s32) dhd_os_get_ioctl_resp_timeout(); | |
| 231 | + int_val = (s32) brcmf_os_get_ioctl_resp_timeout(); | |
| 286 | 232 | memcpy(arg, &int_val, sizeof(int_val)); |
| 287 | 233 | break; |
| 288 | 234 | } |
| @@ -291,7 +237,7 @@ dhd_doiovar(dhd_pub_t *dhd_pub, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines | ||
| 291 | 237 | if (int_val <= 0) |
| 292 | 238 | bcmerror = -EINVAL; |
| 293 | 239 | else |
| 294 | − dhd_os_set_ioctl_resp_timeout((unsigned int) | |
| 240 | + brcmf_os_set_ioctl_resp_timeout((unsigned int) | |
| 295 | 241 | int_val); |
| 296 | 242 | break; |
| 297 | 243 | } |
| @@ -305,8 +251,8 @@ exit: · 7 unmodified lines | ||
| 305 | 251 | return bcmerror; |
| 306 | 252 | } |
| 307 | 253 | |
| 308 | −bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt, | |
| 309 | − int prec) | |
| 254 | +bool brcmf_c_prec_enq(struct brcmf_pub *drvr, struct pktq *q, | |
| 255 | + struct sk_buff *pkt, int prec) | |
| 310 | 256 | { |
| 311 | 257 | struct sk_buff *p; |
| 312 | 258 | int eprec = -1; /* precedence to evict from */ |
| @@ -316,7 +262,7 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt, · 3 unmodified lines | ||
| 316 | 262 | * exceeding total queue length |
| 317 | 263 | */ |
| 318 | 264 | if (!pktq_pfull(q, prec) && !pktq_full(q)) { |
| 319 | − bcm_pktq_penq(q, prec, pkt); | |
| 265 | + brcmu_pktq_penq(q, prec, pkt); | |
| 320 | 266 | return true; |
| 321 | 267 | } |
| 322 | 268 | |
| @@ -324,8 +270,7 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt, · 1 unmodified line | ||
| 324 | 270 | if (pktq_pfull(q, prec)) |
| 325 | 271 | eprec = prec; |
| 326 | 272 | else if (pktq_full(q)) { |
| 327 | − p = bcm_pktq_peek_tail(q, &eprec); | |
| 328 | − ASSERT(p); | |
| 273 | + p = brcmu_pktq_peek_tail(q, &eprec); | |
| 329 | 274 | if (eprec > prec) |
| 330 | 275 | return false; |
| 331 | 276 | } |
| @@ -333,60 +278,58 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt, · 1 unmodified line | ||
| 333 | 278 | /* Evict if needed */ |
| 334 | 279 | if (eprec >= 0) { |
| 335 | 280 | /* Detect queueing to unconfigured precedence */ |
| 336 | − ASSERT(!pktq_pempty(q, eprec)); | |
| 337 | − discard_oldest = AC_BITMAP_TST(dhdp->wme_dp, eprec); | |
| 281 | + discard_oldest = AC_BITMAP_TST(drvr->wme_dp, eprec); | |
| 338 | 282 | if (eprec == prec && !discard_oldest) |
| 339 | 283 | return false; /* refuse newer (incoming) packet */ |
| 340 | 284 | /* Evict packet according to discard policy */ |
| 341 | − p = discard_oldest ? bcm_pktq_pdeq(q, eprec) : | |
| 342 | − bcm_pktq_pdeq_tail(q, eprec); | |
| 285 | + p = discard_oldest ? brcmu_pktq_pdeq(q, eprec) : | |
| 286 | + brcmu_pktq_pdeq_tail(q, eprec); | |
| 343 | 287 | if (p == NULL) { |
| 344 | − DHD_ERROR(("%s: bcm_pktq_penq() failed, oldest %d.", | |
| 345 | − __func__, discard_oldest)); | |
| 346 | − ASSERT(p); | |
| 288 | + BRCMF_ERROR(("%s: brcmu_pktq_penq() failed, oldest %d.", | |
| 289 | + __func__, discard_oldest)); | |
| 347 | 290 | } |
| 348 | − | |
| 349 | − bcm_pkt_buf_free_skb(p); | |
| 291 | + brcmu_pkt_buf_free_skb(p); | |
| 350 | 292 | } |
| 351 | 293 | |
| 352 | 294 | /* Enqueue */ |
| 353 | − p = bcm_pktq_penq(q, prec, pkt); | |
| 295 | + p = brcmu_pktq_penq(q, prec, pkt); | |
| 354 | 296 | if (p == NULL) { |
| 355 | − DHD_ERROR(("%s: bcm_pktq_penq() failed.", __func__)); | |
| 356 | − ASSERT(p); | |
| 297 | + BRCMF_ERROR(("%s: brcmu_pktq_penq() failed.", __func__)); | |
| 357 | 298 | } |
| 358 | 299 | |
| 359 | − return true; | |
| 300 | + return p != NULL; | |
| 360 | 301 | } |
| 361 | 302 | |
| 362 | 303 | static int |
| 363 | −dhd_iovar_op(dhd_pub_t *dhd_pub, const char *name, | |
| 304 | +brcmf_c_iovar_op(struct brcmf_pub *drvr, const char *name, | |
| 364 | 305 | void *params, int plen, void *arg, int len, bool set) |
| 365 | 306 | { |
| 366 | 307 | int bcmerror = 0; |
| 367 | 308 | int val_size; |
| 368 | − const bcm_iovar_t *vi = NULL; | |
| 309 | + const struct brcmu_iovar *vi = NULL; | |
| 369 | 310 | u32 actionid; |
| 370 | 311 | |
| 371 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 312 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 372 | 313 | |
| 373 | − ASSERT(name); | |
| 374 | − ASSERT(len >= 0); | |
| 314 | + if (name == NULL || len <= 0) | |
| 315 | + return -EINVAL; | |
| 375 | 316 | |
| 376 | − /* Get MUST have return space */ | |
| 377 | − ASSERT(set || (arg && len)); | |
| 317 | + /* Set does not take qualifiers */ | |
| 318 | + if (set && (params || plen)) | |
| 319 | + return -EINVAL; | |
| 378 | 320 | |
| 379 | − /* Set does NOT take qualifiers */ | |
| 380 | − ASSERT(!set || (!params && !plen)); | |
| 321 | + /* Get must have return space;*/ | |
| 322 | + if (!set && !(arg && len)) | |
| 323 | + return -EINVAL; | |
| 381 | 324 | |
| 382 | − vi = bcm_iovar_lookup(dhd_iovars, name); | |
| 325 | + vi = brcmu_iovar_lookup(brcmf_iovars, name); | |
| 383 | 326 | if (vi == NULL) { |
| 384 | 327 | bcmerror = -ENOTSUPP; |
| 385 | 328 | goto exit; |
| 386 | 329 | } |
| 387 | 330 | |
| 388 | − DHD_CTL(("%s: %s %s, len %d plen %d\n", __func__, | |
| 389 | − name, (set ? "set" : "get"), len, plen)); | |
| 331 | + BRCMF_CTL(("%s: %s %s, len %d plen %d\n", __func__, | |
| 332 | + name, (set ? "set" : "get"), len, plen)); | |
| 390 | 333 | |
| 391 | 334 | /* set up 'params' pointer in case this is a set command so that |
| 392 | 335 | * the convenience int and bool code can be common to set and get |
| @@ -406,39 +349,40 @@ dhd_iovar_op(dhd_pub_t *dhd_pub, const char *name, · 13 unmodified lines | ||
| 406 | 349 | |
| 407 | 350 | actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid); |
| 408 | 351 | bcmerror = |
| 409 | − dhd_doiovar(dhd_pub, vi, actionid, name, params, plen, arg, len, | |
| 352 | + brcmf_c_doiovar(drvr, vi, actionid, name, params, plen, arg, len, | |
| 410 | 353 | val_size); |
| 411 | 354 | |
| 412 | 355 | exit: |
| 413 | 356 | return bcmerror; |
| 414 | 357 | } |
| 415 | 358 | |
| 416 | −int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen) | |
| 359 | +int brcmf_c_ioctl(struct brcmf_pub *drvr, struct brcmf_c_ioctl *ioc, void *buf, | |
| 360 | + uint buflen) | |
| 417 | 361 | { |
| 418 | 362 | int bcmerror = 0; |
| 419 | 363 | |
| 420 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 364 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 421 | 365 | |
| 422 | 366 | if (!buf) |
| 423 | 367 | return -EINVAL; |
| 424 | 368 | |
| 425 | 369 | switch (ioc->cmd) { |
| 426 | − case DHD_GET_MAGIC: | |
| 370 | + case BRCMF_GET_MAGIC: | |
| 427 | 371 | if (buflen < sizeof(int)) |
| 428 | 372 | bcmerror = -EOVERFLOW; |
| 429 | 373 | else |
| 430 | − *(int *)buf = DHD_IOCTL_MAGIC; | |
| 374 | + *(int *)buf = BRCMF_IOCTL_MAGIC; | |
| 431 | 375 | break; |
| 432 | 376 | |
| 433 | − case DHD_GET_VERSION: | |
| 377 | + case BRCMF_GET_VERSION: | |
| 434 | 378 | if (buflen < sizeof(int)) |
| 435 | 379 | bcmerror = -EOVERFLOW; |
| 436 | 380 | else |
| 437 | − *(int *)buf = DHD_IOCTL_VERSION; | |
| 381 | + *(int *)buf = BRCMF_IOCTL_VERSION; | |
| 438 | 382 | break; |
| 439 | 383 | |
| 440 | − case DHD_GET_VAR: | |
| 441 | − case DHD_SET_VAR:{ | |
| 384 | + case BRCMF_GET_VAR: | |
| 385 | + case BRCMF_SET_VAR:{ | |
| 442 | 386 | char *arg; |
| 443 | 387 | uint arglen; |
| 444 | 388 | |
| @@ -456,38 +400,25 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen) · 11 unmodified lines | ||
| 456 | 400 | arg++, arglen--; |
| 457 | 401 | |
| 458 | 402 | /* call with the appropriate arguments */ |
| 459 | − if (ioc->cmd == DHD_GET_VAR) | |
| 460 | − bcmerror = | |
| 461 | − dhd_iovar_op(dhd_pub, buf, arg, arglen, buf, | |
| 462 | − buflen, IOV_GET); | |
| 403 | + if (ioc->cmd == BRCMF_GET_VAR) | |
| 404 | + bcmerror = brcmf_c_iovar_op(drvr, buf, arg, | |
| 405 | + arglen, buf, buflen, IOV_GET); | |
| 463 | 406 | else |
| 464 | 407 | bcmerror = |
| 465 | − dhd_iovar_op(dhd_pub, buf, NULL, 0, arg, | |
| 466 | − arglen, IOV_SET); | |
| 467 | − if (bcmerror != -ENOTSUPP) | |
| 468 | − break; | |
| 469 | − | |
| 470 | − /* not in generic table, try protocol module */ | |
| 471 | − if (ioc->cmd == DHD_GET_VAR) | |
| 472 | − bcmerror = dhd_prot_iovar_op(dhd_pub, buf, arg, | |
| 473 | − arglen, buf, | |
| 474 | − buflen, IOV_GET); | |
| 475 | − else | |
| 476 | − bcmerror = dhd_prot_iovar_op(dhd_pub, buf, | |
| 477 | − NULL, 0, arg, | |
| 478 | − arglen, IOV_SET); | |
| 408 | + brcmf_c_iovar_op(drvr, buf, NULL, 0, arg, | |
| 409 | + arglen, IOV_SET); | |
| 479 | 410 | if (bcmerror != -ENOTSUPP) |
| 480 | 411 | break; |
| 481 | 412 | |
| 482 | 413 | /* if still not found, try bus module */ |
| 483 | − if (ioc->cmd == DHD_GET_VAR) | |
| 484 | − bcmerror = dhd_bus_iovar_op(dhd_pub, buf, | |
| 485 | − arg, arglen, buf, | |
| 486 | − buflen, IOV_GET); | |
| 414 | + if (ioc->cmd == BRCMF_GET_VAR) | |
| 415 | + bcmerror = brcmf_sdbrcm_bus_iovar_op(drvr, | |
| 416 | + buf, arg, arglen, buf, buflen, | |
| 417 | + IOV_GET); | |
| 487 | 418 | else |
| 488 | − bcmerror = dhd_bus_iovar_op(dhd_pub, buf, | |
| 489 | − NULL, 0, arg, | |
| 490 | − arglen, IOV_SET); | |
| 419 | + bcmerror = brcmf_sdbrcm_bus_iovar_op(drvr, | |
| 420 | + buf, NULL, 0, arg, arglen, | |
| 421 | + IOV_SET); | |
| 491 | 422 | |
| 492 | 423 | break; |
| 493 | 424 | } |
| @@ -500,7 +431,8 @@ int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, uint buflen) · 6 unmodified lines | ||
| 500 | 431 | } |
| 501 | 432 | |
| 502 | 433 | #ifdef SHOW_EVENTS |
| 503 | −static void wl_show_host_event(wl_event_msg_t *event, void *event_data) | |
| 434 | +static void | |
| 435 | +brcmf_c_show_host_event(struct brcmf_event_msg *event, void *event_data) | |
| 504 | 436 | { |
| 505 | 437 | uint i, status, reason; |
| 506 | 438 | bool group = false, flush_txq = false, link = false; |
| @@ -512,62 +444,62 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 5 unmodified lines | ||
| 512 | 444 | char *event_name; |
| 513 | 445 | } event_names[] = { |
| 514 | 446 | { |
| 515 | − WLC_E_SET_SSID, "SET_SSID"}, { | |
| 516 | − WLC_E_JOIN, "JOIN"}, { | |
| 517 | − WLC_E_START, "START"}, { | |
| 518 | − WLC_E_AUTH, "AUTH"}, { | |
| 519 | − WLC_E_AUTH_IND, "AUTH_IND"}, { | |
| 520 | − WLC_E_DEAUTH, "DEAUTH"}, { | |
| 521 | − WLC_E_DEAUTH_IND, "DEAUTH_IND"}, { | |
| 522 | − WLC_E_ASSOC, "ASSOC"}, { | |
| 523 | − WLC_E_ASSOC_IND, "ASSOC_IND"}, { | |
| 524 | − WLC_E_REASSOC, "REASSOC"}, { | |
| 525 | − WLC_E_REASSOC_IND, "REASSOC_IND"}, { | |
| 526 | − WLC_E_DISASSOC, "DISASSOC"}, { | |
| 527 | − WLC_E_DISASSOC_IND, "DISASSOC_IND"}, { | |
| 528 | − WLC_E_QUIET_START, "START_QUIET"}, { | |
| 529 | − WLC_E_QUIET_END, "END_QUIET"}, { | |
| 530 | − WLC_E_BEACON_RX, "BEACON_RX"}, { | |
| 531 | − WLC_E_LINK, "LINK"}, { | |
| 532 | − WLC_E_MIC_ERROR, "MIC_ERROR"}, { | |
| 533 | − WLC_E_NDIS_LINK, "NDIS_LINK"}, { | |
| 534 | − WLC_E_ROAM, "ROAM"}, { | |
| 535 | − WLC_E_TXFAIL, "TXFAIL"}, { | |
| 536 | − WLC_E_PMKID_CACHE, "PMKID_CACHE"}, { | |
| 537 | − WLC_E_RETROGRADE_TSF, "RETROGRADE_TSF"}, { | |
| 538 | − WLC_E_PRUNE, "PRUNE"}, { | |
| 539 | − WLC_E_AUTOAUTH, "AUTOAUTH"}, { | |
| 540 | − WLC_E_EAPOL_MSG, "EAPOL_MSG"}, { | |
| 541 | − WLC_E_SCAN_COMPLETE, "SCAN_COMPLETE"}, { | |
| 542 | − WLC_E_ADDTS_IND, "ADDTS_IND"}, { | |
| 543 | − WLC_E_DELTS_IND, "DELTS_IND"}, { | |
| 544 | − WLC_E_BCNSENT_IND, "BCNSENT_IND"}, { | |
| 545 | − WLC_E_BCNRX_MSG, "BCNRX_MSG"}, { | |
| 546 | − WLC_E_BCNLOST_MSG, "BCNLOST_MSG"}, { | |
| 547 | − WLC_E_ROAM_PREP, "ROAM_PREP"}, { | |
| 548 | − WLC_E_PFN_NET_FOUND, "PNO_NET_FOUND"}, { | |
| 549 | − WLC_E_PFN_NET_LOST, "PNO_NET_LOST"}, { | |
| 550 | − WLC_E_RESET_COMPLETE, "RESET_COMPLETE"}, { | |
| 551 | − WLC_E_JOIN_START, "JOIN_START"}, { | |
| 552 | − WLC_E_ROAM_START, "ROAM_START"}, { | |
| 553 | − WLC_E_ASSOC_START, "ASSOC_START"}, { | |
| 554 | − WLC_E_IBSS_ASSOC, "IBSS_ASSOC"}, { | |
| 555 | − WLC_E_RADIO, "RADIO"}, { | |
| 556 | − WLC_E_PSM_WATCHDOG, "PSM_WATCHDOG"}, { | |
| 557 | − WLC_E_PROBREQ_MSG, "PROBREQ_MSG"}, { | |
| 558 | − WLC_E_SCAN_CONFIRM_IND, "SCAN_CONFIRM_IND"}, { | |
| 559 | − WLC_E_PSK_SUP, "PSK_SUP"}, { | |
| 560 | − WLC_E_COUNTRY_CODE_CHANGED, "COUNTRY_CODE_CHANGED"}, { | |
| 561 | − WLC_E_EXCEEDED_MEDIUM_TIME, "EXCEEDED_MEDIUM_TIME"}, { | |
| 562 | − WLC_E_ICV_ERROR, "ICV_ERROR"}, { | |
| 563 | − WLC_E_UNICAST_DECODE_ERROR, "UNICAST_DECODE_ERROR"}, { | |
| 564 | − WLC_E_MULTICAST_DECODE_ERROR, "MULTICAST_DECODE_ERROR"}, { | |
| 565 | − WLC_E_TRACE, "TRACE"}, { | |
| 566 | − WLC_E_ACTION_FRAME, "ACTION FRAME"}, { | |
| 567 | − WLC_E_ACTION_FRAME_COMPLETE, "ACTION FRAME TX COMPLETE"}, { | |
| 568 | − WLC_E_IF, "IF"}, { | |
| 569 | − WLC_E_RSSI, "RSSI"}, { | |
| 570 | − WLC_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"} | |
| 447 | + BRCMF_E_SET_SSID, "SET_SSID"}, { | |
| 448 | + BRCMF_E_JOIN, "JOIN"}, { | |
| 449 | + BRCMF_E_START, "START"}, { | |
| 450 | + BRCMF_E_AUTH, "AUTH"}, { | |
| 451 | + BRCMF_E_AUTH_IND, "AUTH_IND"}, { | |
| 452 | + BRCMF_E_DEAUTH, "DEAUTH"}, { | |
| 453 | + BRCMF_E_DEAUTH_IND, "DEAUTH_IND"}, { | |
| 454 | + BRCMF_E_ASSOC, "ASSOC"}, { | |
| 455 | + BRCMF_E_ASSOC_IND, "ASSOC_IND"}, { | |
| 456 | + BRCMF_E_REASSOC, "REASSOC"}, { | |
| 457 | + BRCMF_E_REASSOC_IND, "REASSOC_IND"}, { | |
| 458 | + BRCMF_E_DISASSOC, "DISASSOC"}, { | |
| 459 | + BRCMF_E_DISASSOC_IND, "DISASSOC_IND"}, { | |
| 460 | + BRCMF_E_QUIET_START, "START_QUIET"}, { | |
| 461 | + BRCMF_E_QUIET_END, "END_QUIET"}, { | |
| 462 | + BRCMF_E_BEACON_RX, "BEACON_RX"}, { | |
| 463 | + BRCMF_E_LINK, "LINK"}, { | |
| 464 | + BRCMF_E_MIC_ERROR, "MIC_ERROR"}, { | |
| 465 | + BRCMF_E_NDIS_LINK, "NDIS_LINK"}, { | |
| 466 | + BRCMF_E_ROAM, "ROAM"}, { | |
| 467 | + BRCMF_E_TXFAIL, "TXFAIL"}, { | |
| 468 | + BRCMF_E_PMKID_CACHE, "PMKID_CACHE"}, { | |
| 469 | + BRCMF_E_RETROGRADE_TSF, "RETROGRADE_TSF"}, { | |
| 470 | + BRCMF_E_PRUNE, "PRUNE"}, { | |
| 471 | + BRCMF_E_AUTOAUTH, "AUTOAUTH"}, { | |
| 472 | + BRCMF_E_EAPOL_MSG, "EAPOL_MSG"}, { | |
| 473 | + BRCMF_E_SCAN_COMPLETE, "SCAN_COMPLETE"}, { | |
| 474 | + BRCMF_E_ADDTS_IND, "ADDTS_IND"}, { | |
| 475 | + BRCMF_E_DELTS_IND, "DELTS_IND"}, { | |
| 476 | + BRCMF_E_BCNSENT_IND, "BCNSENT_IND"}, { | |
| 477 | + BRCMF_E_BCNRX_MSG, "BCNRX_MSG"}, { | |
| 478 | + BRCMF_E_BCNLOST_MSG, "BCNLOST_MSG"}, { | |
| 479 | + BRCMF_E_ROAM_PREP, "ROAM_PREP"}, { | |
| 480 | + BRCMF_E_PFN_NET_FOUND, "PNO_NET_FOUND"}, { | |
| 481 | + BRCMF_E_PFN_NET_LOST, "PNO_NET_LOST"}, { | |
| 482 | + BRCMF_E_RESET_COMPLETE, "RESET_COMPLETE"}, { | |
| 483 | + BRCMF_E_JOIN_START, "JOIN_START"}, { | |
| 484 | + BRCMF_E_ROAM_START, "ROAM_START"}, { | |
| 485 | + BRCMF_E_ASSOC_START, "ASSOC_START"}, { | |
| 486 | + BRCMF_E_IBSS_ASSOC, "IBSS_ASSOC"}, { | |
| 487 | + BRCMF_E_RADIO, "RADIO"}, { | |
| 488 | + BRCMF_E_PSM_WATCHDOG, "PSM_WATCHDOG"}, { | |
| 489 | + BRCMF_E_PROBREQ_MSG, "PROBREQ_MSG"}, { | |
| 490 | + BRCMF_E_SCAN_CONFIRM_IND, "SCAN_CONFIRM_IND"}, { | |
| 491 | + BRCMF_E_PSK_SUP, "PSK_SUP"}, { | |
| 492 | + BRCMF_E_COUNTRY_CODE_CHANGED, "COUNTRY_CODE_CHANGED"}, { | |
| 493 | + BRCMF_E_EXCEEDED_MEDIUM_TIME, "EXCEEDED_MEDIUM_TIME"}, { | |
| 494 | + BRCMF_E_ICV_ERROR, "ICV_ERROR"}, { | |
| 495 | + BRCMF_E_UNICAST_DECODE_ERROR, "UNICAST_DECODE_ERROR"}, { | |
| 496 | + BRCMF_E_MULTICAST_DECODE_ERROR, "MULTICAST_DECODE_ERROR"}, { | |
| 497 | + BRCMF_E_TRACE, "TRACE"}, { | |
| 498 | + BRCMF_E_ACTION_FRAME, "ACTION FRAME"}, { | |
| 499 | + BRCMF_E_ACTION_FRAME_COMPLETE, "ACTION FRAME TX COMPLETE"}, { | |
| 500 | + BRCMF_E_IF, "IF"}, { | |
| 501 | + BRCMF_E_RSSI, "RSSI"}, { | |
| 502 | + BRCMF_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE"} | |
| 571 | 503 | }; |
| 572 | 504 | uint event_type, flags, auth_type, datalen; |
| 573 | 505 | event_type = be32_to_cpu(event->event_type); |
| @@ -585,54 +517,55 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 11 unmodified lines | ||
| 585 | 517 | event_name = event_names[i].event_name; |
| 586 | 518 | } |
| 587 | 519 | |
| 588 | − DHD_EVENT(("EVENT: %s, event ID = %d\n", event_name, event_type)); | |
| 589 | − DHD_EVENT(("flags 0x%04x, status %d, reason %d, auth_type %d MAC %s\n", | |
| 590 | − flags, status, reason, auth_type, eabuf)); | |
| 520 | + BRCMF_EVENT(("EVENT: %s, event ID = %d\n", event_name, event_type)); | |
| 521 | + BRCMF_EVENT(("flags 0x%04x, status %d, reason %d, auth_type %d" | |
| 522 | + " MAC %s\n", flags, status, reason, auth_type, eabuf)); | |
| 591 | 523 | |
| 592 | − if (flags & WLC_EVENT_MSG_LINK) | |
| 524 | + if (flags & BRCMF_EVENT_MSG_LINK) | |
| 593 | 525 | link = true; |
| 594 | − if (flags & WLC_EVENT_MSG_GROUP) | |
| 526 | + if (flags & BRCMF_EVENT_MSG_GROUP) | |
| 595 | 527 | group = true; |
| 596 | − if (flags & WLC_EVENT_MSG_FLUSHTXQ) | |
| 528 | + if (flags & BRCMF_EVENT_MSG_FLUSHTXQ) | |
| 597 | 529 | flush_txq = true; |
| 598 | 530 | |
| 599 | 531 | switch (event_type) { |
| 600 | − case WLC_E_START: | |
| 601 | − case WLC_E_DEAUTH: | |
| 602 | − case WLC_E_DISASSOC: | |
| 603 | − DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf)); | |
| 532 | + case BRCMF_E_START: | |
| 533 | + case BRCMF_E_DEAUTH: | |
| 534 | + case BRCMF_E_DISASSOC: | |
| 535 | + BRCMF_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf)); | |
| 604 | 536 | break; |
| 605 | 537 | |
| 606 | − case WLC_E_ASSOC_IND: | |
| 607 | − case WLC_E_REASSOC_IND: | |
| 608 | − DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf)); | |
| 538 | + case BRCMF_E_ASSOC_IND: | |
| 539 | + case BRCMF_E_REASSOC_IND: | |
| 540 | + BRCMF_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf)); | |
| 609 | 541 | break; |
| 610 | 542 | |
| 611 | − case WLC_E_ASSOC: | |
| 612 | − case WLC_E_REASSOC: | |
| 613 | − if (status == WLC_E_STATUS_SUCCESS) { | |
| 614 | − DHD_EVENT(("MACEVENT: %s, MAC %s, SUCCESS\n", | |
| 615 | − event_name, eabuf)); | |
| 616 | − } else if (status == WLC_E_STATUS_TIMEOUT) { | |
| 617 | − DHD_EVENT(("MACEVENT: %s, MAC %s, TIMEOUT\n", | |
| 618 | − event_name, eabuf)); | |
| 619 | − } else if (status == WLC_E_STATUS_FAIL) { | |
| 620 | − DHD_EVENT(("MACEVENT: %s, MAC %s, FAILURE, reason %d\n", | |
| 621 | − event_name, eabuf, (int)reason)); | |
| 543 | + case BRCMF_E_ASSOC: | |
| 544 | + case BRCMF_E_REASSOC: | |
| 545 | + if (status == BRCMF_E_STATUS_SUCCESS) { | |
| 546 | + BRCMF_EVENT(("MACEVENT: %s, MAC %s, SUCCESS\n", | |
| 547 | + event_name, eabuf)); | |
| 548 | + } else if (status == BRCMF_E_STATUS_TIMEOUT) { | |
| 549 | + BRCMF_EVENT(("MACEVENT: %s, MAC %s, TIMEOUT\n", | |
| 550 | + event_name, eabuf)); | |
| 551 | + } else if (status == BRCMF_E_STATUS_FAIL) { | |
| 552 | + BRCMF_EVENT(("MACEVENT: %s, MAC %s, FAILURE," | |
| 553 | + " reason %d\n", event_name, eabuf, | |
| 554 | + (int)reason)); | |
| 622 | 555 | } else { |
| 623 | − DHD_EVENT(("MACEVENT: %s, MAC %s, unexpected status " | |
| 624 | − "%d\n", event_name, eabuf, (int)status)); | |
| 556 | + BRCMF_EVENT(("MACEVENT: %s, MAC %s, unexpected status " | |
| 557 | + "%d\n", event_name, eabuf, (int)status)); | |
| 625 | 558 | } |
| 626 | 559 | break; |
| 627 | 560 | |
| 628 | − case WLC_E_DEAUTH_IND: | |
| 629 | − case WLC_E_DISASSOC_IND: | |
| 630 | − DHD_EVENT(("MACEVENT: %s, MAC %s, reason %d\n", event_name, | |
| 631 | − eabuf, (int)reason)); | |
| 561 | + case BRCMF_E_DEAUTH_IND: | |
| 562 | + case BRCMF_E_DISASSOC_IND: | |
| 563 | + BRCMF_EVENT(("MACEVENT: %s, MAC %s, reason %d\n", event_name, | |
| 564 | + eabuf, (int)reason)); | |
| 632 | 565 | break; |
| 633 | 566 | |
| 634 | − case WLC_E_AUTH: | |
| 635 | − case WLC_E_AUTH_IND: | |
| 567 | + case BRCMF_E_AUTH: | |
| 568 | + case BRCMF_E_AUTH_IND: | |
| 636 | 569 | if (auth_type == WLAN_AUTH_OPEN) |
| 637 | 570 | auth_str = "Open System"; |
| 638 | 571 | else if (auth_type == WLAN_AUTH_SHARED_KEY) |
| @@ -641,102 +574,102 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 2 unmodified lines | ||
| 641 | 574 | sprintf(err_msg, "AUTH unknown: %d", (int)auth_type); |
| 642 | 575 | auth_str = err_msg; |
| 643 | 576 | } |
| 644 | − if (event_type == WLC_E_AUTH_IND) { | |
| 645 | − DHD_EVENT(("MACEVENT: %s, MAC %s, %s\n", event_name, | |
| 646 | − eabuf, auth_str)); | |
| 647 | − } else if (status == WLC_E_STATUS_SUCCESS) { | |
| 648 | − DHD_EVENT(("MACEVENT: %s, MAC %s, %s, SUCCESS\n", | |
| 649 | − event_name, eabuf, auth_str)); | |
| 650 | − } else if (status == WLC_E_STATUS_TIMEOUT) { | |
| 651 | − DHD_EVENT(("MACEVENT: %s, MAC %s, %s, TIMEOUT\n", | |
| 652 | − event_name, eabuf, auth_str)); | |
| 653 | − } else if (status == WLC_E_STATUS_FAIL) { | |
| 654 | − DHD_EVENT(("MACEVENT: %s, MAC %s, %s, FAILURE, " | |
| 655 | − "reason %d\n", | |
| 656 | − event_name, eabuf, auth_str, (int)reason)); | |
| 577 | + if (event_type == BRCMF_E_AUTH_IND) { | |
| 578 | + BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s\n", event_name, | |
| 579 | + eabuf, auth_str)); | |
| 580 | + } else if (status == BRCMF_E_STATUS_SUCCESS) { | |
| 581 | + BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s, SUCCESS\n", | |
| 582 | + event_name, eabuf, auth_str)); | |
| 583 | + } else if (status == BRCMF_E_STATUS_TIMEOUT) { | |
| 584 | + BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s, TIMEOUT\n", | |
| 585 | + event_name, eabuf, auth_str)); | |
| 586 | + } else if (status == BRCMF_E_STATUS_FAIL) { | |
| 587 | + BRCMF_EVENT(("MACEVENT: %s, MAC %s, %s, FAILURE, " | |
| 588 | + "reason %d\n", | |
| 589 | + event_name, eabuf, auth_str, (int)reason)); | |
| 657 | 590 | } |
| 658 | 591 | |
| 659 | 592 | break; |
| 660 | 593 | |
| 661 | − case WLC_E_JOIN: | |
| 662 | − case WLC_E_ROAM: | |
| 663 | − case WLC_E_SET_SSID: | |
| 664 | − if (status == WLC_E_STATUS_SUCCESS) { | |
| 665 | − DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name, | |
| 666 | − eabuf)); | |
| 667 | − } else if (status == WLC_E_STATUS_FAIL) { | |
| 668 | − DHD_EVENT(("MACEVENT: %s, failed\n", event_name)); | |
| 669 | − } else if (status == WLC_E_STATUS_NO_NETWORKS) { | |
| 670 | − DHD_EVENT(("MACEVENT: %s, no networks found\n", | |
| 671 | − event_name)); | |
| 594 | + case BRCMF_E_JOIN: | |
| 595 | + case BRCMF_E_ROAM: | |
| 596 | + case BRCMF_E_SET_SSID: | |
| 597 | + if (status == BRCMF_E_STATUS_SUCCESS) { | |
| 598 | + BRCMF_EVENT(("MACEVENT: %s, MAC %s\n", event_name, | |
| 599 | + eabuf)); | |
| 600 | + } else if (status == BRCMF_E_STATUS_FAIL) { | |
| 601 | + BRCMF_EVENT(("MACEVENT: %s, failed\n", event_name)); | |
| 602 | + } else if (status == BRCMF_E_STATUS_NO_NETWORKS) { | |
| 603 | + BRCMF_EVENT(("MACEVENT: %s, no networks found\n", | |
| 604 | + event_name)); | |
| 672 | 605 | } else { |
| 673 | − DHD_EVENT(("MACEVENT: %s, unexpected status %d\n", | |
| 674 | − event_name, (int)status)); | |
| 606 | + BRCMF_EVENT(("MACEVENT: %s, unexpected status %d\n", | |
| 607 | + event_name, (int)status)); | |
| 675 | 608 | } |
| 676 | 609 | break; |
| 677 | 610 | |
| 678 | − case WLC_E_BEACON_RX: | |
| 679 | − if (status == WLC_E_STATUS_SUCCESS) { | |
| 680 | − DHD_EVENT(("MACEVENT: %s, SUCCESS\n", event_name)); | |
| 681 | − } else if (status == WLC_E_STATUS_FAIL) { | |
| 682 | − DHD_EVENT(("MACEVENT: %s, FAIL\n", event_name)); | |
| 611 | + case BRCMF_E_BEACON_RX: | |
| 612 | + if (status == BRCMF_E_STATUS_SUCCESS) { | |
| 613 | + BRCMF_EVENT(("MACEVENT: %s, SUCCESS\n", event_name)); | |
| 614 | + } else if (status == BRCMF_E_STATUS_FAIL) { | |
| 615 | + BRCMF_EVENT(("MACEVENT: %s, FAIL\n", event_name)); | |
| 683 | 616 | } else { |
| 684 | − DHD_EVENT(("MACEVENT: %s, status %d\n", event_name, | |
| 685 | − status)); | |
| 617 | + BRCMF_EVENT(("MACEVENT: %s, status %d\n", event_name, | |
| 618 | + status)); | |
| 686 | 619 | } |
| 687 | 620 | break; |
| 688 | 621 | |
| 689 | − case WLC_E_LINK: | |
| 690 | − DHD_EVENT(("MACEVENT: %s %s\n", event_name, | |
| 691 | − link ? "UP" : "DOWN")); | |
| 622 | + case BRCMF_E_LINK: | |
| 623 | + BRCMF_EVENT(("MACEVENT: %s %s\n", event_name, | |
| 624 | + link ? "UP" : "DOWN")); | |
| 692 | 625 | break; |
| 693 | 626 | |
| 694 | − case WLC_E_MIC_ERROR: | |
| 695 | − DHD_EVENT(("MACEVENT: %s, MAC %s, Group %d, Flush %d\n", | |
| 696 | − event_name, eabuf, group, flush_txq)); | |
| 627 | + case BRCMF_E_MIC_ERROR: | |
| 628 | + BRCMF_EVENT(("MACEVENT: %s, MAC %s, Group %d, Flush %d\n", | |
| 629 | + event_name, eabuf, group, flush_txq)); | |
| 697 | 630 | break; |
| 698 | 631 | |
| 699 | − case WLC_E_ICV_ERROR: | |
| 700 | − case WLC_E_UNICAST_DECODE_ERROR: | |
| 701 | − case WLC_E_MULTICAST_DECODE_ERROR: | |
| 702 | − DHD_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf)); | |
| 632 | + case BRCMF_E_ICV_ERROR: | |
| 633 | + case BRCMF_E_UNICAST_DECODE_ERROR: | |
| 634 | + case BRCMF_E_MULTICAST_DECODE_ERROR: | |
| 635 | + BRCMF_EVENT(("MACEVENT: %s, MAC %s\n", event_name, eabuf)); | |
| 703 | 636 | break; |
| 704 | 637 | |
| 705 | − case WLC_E_TXFAIL: | |
| 706 | − DHD_EVENT(("MACEVENT: %s, RA %s\n", event_name, eabuf)); | |
| 638 | + case BRCMF_E_TXFAIL: | |
| 639 | + BRCMF_EVENT(("MACEVENT: %s, RA %s\n", event_name, eabuf)); | |
| 707 | 640 | break; |
| 708 | 641 | |
| 709 | − case WLC_E_SCAN_COMPLETE: | |
| 710 | − case WLC_E_PMKID_CACHE: | |
| 711 | − DHD_EVENT(("MACEVENT: %s\n", event_name)); | |
| 642 | + case BRCMF_E_SCAN_COMPLETE: | |
| 643 | + case BRCMF_E_PMKID_CACHE: | |
| 644 | + BRCMF_EVENT(("MACEVENT: %s\n", event_name)); | |
| 712 | 645 | break; |
| 713 | 646 | |
| 714 | − case WLC_E_PFN_NET_FOUND: | |
| 715 | − case WLC_E_PFN_NET_LOST: | |
| 716 | − case WLC_E_PFN_SCAN_COMPLETE: | |
| 717 | − DHD_EVENT(("PNOEVENT: %s\n", event_name)); | |
| 647 | + case BRCMF_E_PFN_NET_FOUND: | |
| 648 | + case BRCMF_E_PFN_NET_LOST: | |
| 649 | + case BRCMF_E_PFN_SCAN_COMPLETE: | |
| 650 | + BRCMF_EVENT(("PNOEVENT: %s\n", event_name)); | |
| 718 | 651 | break; |
| 719 | 652 | |
| 720 | − case WLC_E_PSK_SUP: | |
| 721 | − case WLC_E_PRUNE: | |
| 722 | − DHD_EVENT(("MACEVENT: %s, status %d, reason %d\n", | |
| 653 | + case BRCMF_E_PSK_SUP: | |
| 654 | + case BRCMF_E_PRUNE: | |
| 655 | + BRCMF_EVENT(("MACEVENT: %s, status %d, reason %d\n", | |
| 723 | 656 | event_name, (int)status, (int)reason)); |
| 724 | 657 | break; |
| 725 | 658 | |
| 726 | − case WLC_E_TRACE: | |
| 659 | + case BRCMF_E_TRACE: | |
| 727 | 660 | { |
| 728 | 661 | static u32 seqnum_prev; |
| 729 | − msgtrace_hdr_t hdr; | |
| 662 | + struct msgtrace_hdr hdr; | |
| 730 | 663 | u32 nblost; |
| 731 | 664 | char *s, *p; |
| 732 | 665 | |
| 733 | 666 | buf = (unsigned char *) event_data; |
| 734 | − memcpy(&hdr, buf, MSGTRACE_HDRLEN); | |
| 667 | + memcpy(&hdr, buf, sizeof(struct msgtrace_hdr)); | |
| 735 | 668 | |
| 736 | 669 | if (hdr.version != MSGTRACE_VERSION) { |
| 737 | − DHD_ERROR( | |
| 670 | + BRCMF_ERROR( | |
| 738 | 671 | ("\nMACEVENT: %s [unsupported version --> " |
| 739 | − "dhd version:%d dongle version:%d]\n", | |
| 672 | + "brcmf version:%d dongle version:%d]\n", | |
| 740 | 673 | event_name, MSGTRACE_VERSION, hdr.version) |
| 741 | 674 | ); |
| 742 | 675 | /* Reset datalen to avoid display below */ |
| @@ -745,11 +678,12 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 2 unmodified lines | ||
| 745 | 678 | } |
| 746 | 679 | |
| 747 | 680 | /* There are 2 bytes available at the end of data */ |
| 748 | − buf[MSGTRACE_HDRLEN + be16_to_cpu(hdr.len)] = '\0'; | |
| 681 | + *(buf + sizeof(struct msgtrace_hdr) | |
| 682 | + + be16_to_cpu(hdr.len)) = '\0'; | |
| 749 | 683 | |
| 750 | 684 | if (be32_to_cpu(hdr.discarded_bytes) |
| 751 | 685 | || be32_to_cpu(hdr.discarded_printf)) { |
| 752 | − DHD_ERROR( | |
| 686 | + BRCMF_ERROR( | |
| 753 | 687 | ("\nWLC_E_TRACE: [Discarded traces in dongle -->" |
| 754 | 688 | "discarded_bytes %d discarded_printf %d]\n", |
| 755 | 689 | be32_to_cpu(hdr.discarded_bytes), |
| @@ -758,7 +692,7 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 2 unmodified lines | ||
| 758 | 692 | |
| 759 | 693 | nblost = be32_to_cpu(hdr.seqnum) - seqnum_prev - 1; |
| 760 | 694 | if (nblost > 0) { |
| 761 | − DHD_ERROR( | |
| 695 | + BRCMF_ERROR( | |
| 762 | 696 | ("\nWLC_E_TRACE: [Event lost --> seqnum %d nblost %d\n", |
| 763 | 697 | be32_to_cpu(hdr.seqnum), nblost)); |
| 764 | 698 | } |
| @@ -768,7 +702,7 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 3 unmodified lines | ||
| 768 | 702 | * avoid display big |
| 769 | 703 | * printf (issue with Linux printk ) |
| 770 | 704 | */ |
| 771 | − p = (char *)&buf[MSGTRACE_HDRLEN]; | |
| 705 | + p = (char *)&buf[sizeof(struct msgtrace_hdr)]; | |
| 772 | 706 | while ((s = strstr(p, "\n")) != NULL) { |
| 773 | 707 | *s = '\0'; |
| 774 | 708 | printk(KERN_DEBUG"%s\n", p); |
| @@ -781,49 +715,49 @@ static void wl_show_host_event(wl_event_msg_t *event, void *event_data) · 6 unmodified lines | ||
| 781 | 715 | } |
| 782 | 716 | break; |
| 783 | 717 | |
| 784 | − case WLC_E_RSSI: | |
| 785 | − DHD_EVENT(("MACEVENT: %s %d\n", event_name, | |
| 786 | − be32_to_cpu(*((int *)event_data)))); | |
| 718 | + case BRCMF_E_RSSI: | |
| 719 | + BRCMF_EVENT(("MACEVENT: %s %d\n", event_name, | |
| 720 | + be32_to_cpu(*((int *)event_data)))); | |
| 787 | 721 | break; |
| 788 | 722 | |
| 789 | 723 | default: |
| 790 | − DHD_EVENT(("MACEVENT: %s %d, MAC %s, status %d, reason %d, " | |
| 791 | − "auth %d\n", event_name, event_type, eabuf, | |
| 792 | − (int)status, (int)reason, (int)auth_type)); | |
| 724 | + BRCMF_EVENT(("MACEVENT: %s %d, MAC %s, status %d, reason %d, " | |
| 725 | + "auth %d\n", event_name, event_type, eabuf, | |
| 726 | + (int)status, (int)reason, (int)auth_type)); | |
| 793 | 727 | break; |
| 794 | 728 | } |
| 795 | 729 | |
| 796 | 730 | /* show any appended data */ |
| 797 | 731 | if (datalen) { |
| 798 | 732 | buf = (unsigned char *) event_data; |
| 799 | − DHD_EVENT((" data (%d) : ", datalen)); | |
| 733 | + BRCMF_EVENT((" data (%d) : ", datalen)); | |
| 800 | 734 | for (i = 0; i < datalen; i++) |
| 801 | − DHD_EVENT((" 0x%02x ", *buf++)); | |
| 802 | − DHD_EVENT(("\n")); | |
| 735 | + BRCMF_EVENT((" 0x%02x ", *buf++)); | |
| 736 | + BRCMF_EVENT(("\n")); | |
| 803 | 737 | } |
| 804 | 738 | } |
| 805 | 739 | #endif /* SHOW_EVENTS */ |
| 806 | 740 | |
| 807 | 741 | int |
| 808 | −wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata, | |
| 809 | − wl_event_msg_t *event, void **data_ptr) | |
| 742 | +brcmf_c_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata, | |
| 743 | + struct brcmf_event_msg *event, void **data_ptr) | |
| 810 | 744 | { |
| 811 | 745 | /* check whether packet is a BRCM event pkt */ |
| 812 | − bcm_event_t *pvt_data = (bcm_event_t *) pktdata; | |
| 746 | + struct brcmf_event *pvt_data = (struct brcmf_event *) pktdata; | |
| 813 | 747 | char *event_data; |
| 814 | 748 | u32 type, status; |
| 815 | 749 | u16 flags; |
| 816 | 750 | int evlen; |
| 817 | 751 | |
| 818 | − if (memcmp(BRCM_OUI, &pvt_data->bcm_hdr.oui[0], DOT11_OUI_LEN)) { | |
| 819 | − DHD_ERROR(("%s: mismatched OUI, bailing\n", __func__)); | |
| 752 | + if (memcmp(BRCM_OUI, &pvt_data->hdr.oui[0], DOT11_OUI_LEN)) { | |
| 753 | + BRCMF_ERROR(("%s: mismatched OUI, bailing\n", __func__)); | |
| 820 | 754 | return -EBADE; |
| 821 | 755 | } |
| 822 | 756 | |
| 823 | 757 | /* BRCM event pkt may be unaligned - use xxx_ua to load user_subtype. */ |
| 824 | − if (get_unaligned_be16(&pvt_data->bcm_hdr.usr_subtype) != | |
| 758 | + if (get_unaligned_be16(&pvt_data->hdr.usr_subtype) != | |
| 825 | 759 | BCMILCP_BCM_SUBTYPE_EVENT) { |
| 826 | − DHD_ERROR(("%s: mismatched subtype, bailing\n", __func__)); | |
| 760 | + BRCMF_ERROR(("%s: mismatched subtype, bailing\n", __func__)); | |
| 827 | 761 | return -EBADE; |
| 828 | 762 | } |
| 829 | 763 | |
| @@ -831,93 +765,87 @@ wl_host_event(struct dhd_info *dhd, int *ifidx, void *pktdata, · 1 unmodified line | ||
| 831 | 765 | event_data = *data_ptr; |
| 832 | 766 | |
| 833 | 767 | /* memcpy since BRCM event pkt may be unaligned. */ |
| 834 | − memcpy(event, &pvt_data->event, sizeof(wl_event_msg_t)); | |
| 768 | + memcpy(event, &pvt_data->msg, sizeof(struct brcmf_event_msg)); | |
| 835 | 769 | |
| 836 | 770 | type = get_unaligned_be32(&event->event_type); |
| 837 | 771 | flags = get_unaligned_be16(&event->flags); |
| 838 | 772 | status = get_unaligned_be32(&event->status); |
| 839 | − evlen = get_unaligned_be32(&event->datalen) + sizeof(bcm_event_t); | |
| 773 | + evlen = get_unaligned_be32(&event->datalen) + | |
| 774 | + sizeof(struct brcmf_event); | |
| 840 | 775 | |
| 841 | 776 | switch (type) { |
| 842 | − case WLC_E_IF: | |
| 777 | + case BRCMF_E_IF: | |
| 843 | 778 | { |
| 844 | − dhd_if_event_t *ifevent = (dhd_if_event_t *) event_data; | |
| 845 | − DHD_TRACE(("%s: if event\n", __func__)); | |
| 779 | + struct brcmf_if_event *ifevent = | |
| 780 | + (struct brcmf_if_event *) event_data; | |
| 781 | + BRCMF_TRACE(("%s: if event\n", __func__)); | |
| 846 | 782 | |
| 847 | 783 | if (ifevent->ifidx > 0 && |
| 848 | − ifevent->ifidx < DHD_MAX_IFS) { | |
| 849 | − if (ifevent->action == WLC_E_IF_ADD) | |
| 850 | − dhd_add_if(dhd, ifevent->ifidx, | |
| 784 | + ifevent->ifidx < BRCMF_MAX_IFS) { | |
| 785 | + if (ifevent->action == BRCMF_E_IF_ADD) | |
| 786 | + brcmf_add_if(drvr_priv, ifevent->ifidx, | |
| 851 | 787 | NULL, event->ifname, |
| 852 | 788 | pvt_data->eth.h_dest, |
| 853 | 789 | ifevent->flags, |
| 854 | 790 | ifevent->bssidx); |
| 855 | 791 | else |
| 856 | − dhd_del_if(dhd, ifevent->ifidx); | |
| 792 | + brcmf_del_if(drvr_priv, ifevent->ifidx); | |
| 857 | 793 | } else { |
| 858 | − DHD_ERROR(("%s: Invalid ifidx %d for %s\n", | |
| 859 | − __func__, ifevent->ifidx, | |
| 860 | − event->ifname)); | |
| 794 | + BRCMF_ERROR(("%s: Invalid ifidx %d for %s\n", | |
| 795 | + __func__, ifevent->ifidx, | |
| 796 | + event->ifname)); | |
| 861 | 797 | } |
| 862 | 798 | } |
| 863 | 799 | /* send up the if event: btamp user needs it */ |
| 864 | − *ifidx = dhd_ifname2idx(dhd, event->ifname); | |
| 865 | − /* push up to external supp/auth */ | |
| 866 | − dhd_event(dhd, (char *)pvt_data, evlen, *ifidx); | |
| 800 | + *ifidx = brcmf_ifname2idx(drvr_priv, event->ifname); | |
| 867 | 801 | break; |
| 868 | 802 | |
| 869 | −#ifdef P2P | |
| 870 | − case WLC_E_NDIS_LINK: | |
| 871 | − break; | |
| 872 | −#endif | |
| 873 | − /* fall through */ | |
| 874 | 803 | /* These are what external supplicant/authenticator wants */ |
| 875 | − case WLC_E_LINK: | |
| 876 | − case WLC_E_ASSOC_IND: | |
| 877 | − case WLC_E_REASSOC_IND: | |
| 878 | − case WLC_E_DISASSOC_IND: | |
| 879 | − case WLC_E_MIC_ERROR: | |
| 804 | + case BRCMF_E_LINK: | |
| 805 | + case BRCMF_E_ASSOC_IND: | |
| 806 | + case BRCMF_E_REASSOC_IND: | |
| 807 | + case BRCMF_E_DISASSOC_IND: | |
| 808 | + case BRCMF_E_MIC_ERROR: | |
| 880 | 809 | default: |
| 881 | 810 | /* Fall through: this should get _everything_ */ |
| 882 | 811 | |
| 883 | − *ifidx = dhd_ifname2idx(dhd, event->ifname); | |
| 884 | − /* push up to external supp/auth */ | |
| 885 | − dhd_event(dhd, (char *)pvt_data, evlen, *ifidx); | |
| 886 | − DHD_TRACE(("%s: MAC event %d, flags %x, status %x\n", | |
| 887 | − __func__, type, flags, status)); | |
| 812 | + *ifidx = brcmf_ifname2idx(drvr_priv, event->ifname); | |
| 813 | + BRCMF_TRACE(("%s: MAC event %d, flags %x, status %x\n", | |
| 814 | + __func__, type, flags, status)); | |
| 888 | 815 | |
| 889 | − /* put it back to WLC_E_NDIS_LINK */ | |
| 890 | − if (type == WLC_E_NDIS_LINK) { | |
| 816 | + /* put it back to BRCMF_E_NDIS_LINK */ | |
| 817 | + if (type == BRCMF_E_NDIS_LINK) { | |
| 891 | 818 | u32 temp; |
| 892 | 819 | |
| 893 | 820 | temp = get_unaligned_be32(&event->event_type); |
| 894 | − DHD_TRACE(("Converted to WLC_E_LINK type %d\n", temp)); | |
| 821 | + BRCMF_TRACE(("Converted to WLC_E_LINK type %d\n", | |
| 822 | + temp)); | |
| 895 | 823 | |
| 896 | − temp = be32_to_cpu(WLC_E_NDIS_LINK); | |
| 897 | − memcpy((void *)(&pvt_data->event.event_type), &temp, | |
| 898 | − sizeof(pvt_data->event.event_type)); | |
| 824 | + temp = be32_to_cpu(BRCMF_E_NDIS_LINK); | |
| 825 | + memcpy((void *)(&pvt_data->msg.event_type), &temp, | |
| 826 | + sizeof(pvt_data->msg.event_type)); | |
| 899 | 827 | } |
| 900 | 828 | break; |
| 901 | 829 | } |
| 902 | 830 | |
| 903 | 831 | #ifdef SHOW_EVENTS |
| 904 | − wl_show_host_event(event, event_data); | |
| 832 | + brcmf_c_show_host_event(event, event_data); | |
| 905 | 833 | #endif /* SHOW_EVENTS */ |
| 906 | 834 | |
| 907 | 835 | return 0; |
| 908 | 836 | } |
| 909 | 837 | |
| 910 | 838 | /* Convert user's input in hex pattern to byte-size mask */ |
| 911 | −static int wl_pattern_atoh(char *src, char *dst) | |
| 839 | +static int brcmf_c_pattern_atoh(char *src, char *dst) | |
| 912 | 840 | { |
| 913 | 841 | int i; |
| 914 | 842 | if (strncmp(src, "0x", 2) != 0 && strncmp(src, "0X", 2) != 0) { |
| 915 | − DHD_ERROR(("Mask invalid format. Needs to start with 0x\n")); | |
| 843 | + BRCMF_ERROR(("Mask invalid format. Needs to start with 0x\n")); | |
| 916 | 844 | return -1; |
| 917 | 845 | } |
| 918 | 846 | src = src + 2; /* Skip past 0x */ |
| 919 | 847 | if (strlen(src) % 2 != 0) { |
| 920 | − DHD_ERROR(("Mask invalid format. Length must be even.\n")); | |
| 848 | + BRCMF_ERROR(("Mask invalid format. Length must be even.\n")); | |
| 921 | 849 | return -1; |
| 922 | 850 | } |
| 923 | 851 | for (i = 0; *src != '\0'; i++) { |
| @@ -931,7 +859,7 @@ static int wl_pattern_atoh(char *src, char *dst) · 7 unmodified lines | ||
| 931 | 859 | } |
| 932 | 860 | |
| 933 | 861 | void |
| 934 | −dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, | |
| 862 | +brcmf_c_pktfilter_offload_enable(struct brcmf_pub *drvr, char *arg, int enable, | |
| 935 | 863 | int master_mode) |
| 936 | 864 | { |
| 937 | 865 | char *argv[8]; |
| @@ -942,12 +870,12 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, · 4 unmodified lines | ||
| 942 | 870 | char *arg_save = 0, *arg_org = 0; |
| 943 | 871 | int rc; |
| 944 | 872 | char buf[128]; |
| 945 | − wl_pkt_filter_enable_t enable_parm; | |
| 946 | − wl_pkt_filter_enable_t *pkt_filterp; | |
| 873 | + struct brcmf_pkt_filter_enable enable_parm; | |
| 874 | + struct brcmf_pkt_filter_enable *pkt_filterp; | |
| 947 | 875 | |
| 948 | 876 | arg_save = kmalloc(strlen(arg) + 1, GFP_ATOMIC); |
| 949 | 877 | if (!arg_save) { |
| 950 | − DHD_ERROR(("%s: kmalloc failed\n", __func__)); | |
| 878 | + BRCMF_ERROR(("%s: kmalloc failed\n", __func__)); | |
| 951 | 879 | goto fail; |
| 952 | 880 | } |
| 953 | 881 | arg_org = arg_save; |
| @@ -957,7 +885,7 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, · 3 unmodified lines | ||
| 957 | 885 | |
| 958 | 886 | i = 0; |
| 959 | 887 | if (NULL == argv[i]) { |
| 960 | − DHD_ERROR(("No args provided\n")); | |
| 888 | + BRCMF_ERROR(("No args provided\n")); | |
| 961 | 889 | goto fail; |
| 962 | 890 | } |
| 963 | 891 | |
| @@ -967,7 +895,7 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, · 3 unmodified lines | ||
| 967 | 895 | buf[str_len] = '\0'; |
| 968 | 896 | buf_len = str_len + 1; |
| 969 | 897 | |
| 970 | − pkt_filterp = (wl_pkt_filter_enable_t *) (buf + str_len + 1); | |
| 898 | + pkt_filterp = (struct brcmf_pkt_filter_enable *) (buf + str_len + 1); | |
| 971 | 899 | |
| 972 | 900 | /* Parse packet filter id. */ |
| 973 | 901 | enable_parm.id = simple_strtoul(argv[i], NULL, 0); |
| @@ -979,33 +907,34 @@ dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, · 5 unmodified lines | ||
| 979 | 907 | memcpy((char *)pkt_filterp, &enable_parm, sizeof(enable_parm)); |
| 980 | 908 | |
| 981 | 909 | /* Enable/disable the specified filter. */ |
| 982 | − rc = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, buf_len); | |
| 910 | + rc = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, buf, buf_len); | |
| 983 | 911 | rc = rc >= 0 ? 0 : rc; |
| 984 | 912 | if (rc) |
| 985 | − DHD_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n", | |
| 986 | − __func__, arg, rc)); | |
| 913 | + BRCMF_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n", | |
| 914 | + __func__, arg, rc)); | |
| 987 | 915 | else |
| 988 | − DHD_TRACE(("%s: successfully added pktfilter %s\n", | |
| 989 | − __func__, arg)); | |
| 916 | + BRCMF_TRACE(("%s: successfully added pktfilter %s\n", | |
| 917 | + __func__, arg)); | |
| 990 | 918 | |
| 991 | 919 | /* Contorl the master mode */ |
| 992 | − bcm_mkiovar("pkt_filter_mode", (char *)&master_mode, 4, buf, | |
| 920 | + brcmu_mkiovar("pkt_filter_mode", (char *)&master_mode, 4, buf, | |
| 993 | 921 | sizeof(buf)); |
| 994 | − rc = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, sizeof(buf)); | |
| 922 | + rc = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, buf, | |
| 923 | + sizeof(buf)); | |
| 995 | 924 | rc = rc >= 0 ? 0 : rc; |
| 996 | 925 | if (rc) |
| 997 | − DHD_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n", | |
| 998 | − __func__, arg, rc)); | |
| 926 | + BRCMF_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n", | |
| 927 | + __func__, arg, rc)); | |
| 999 | 928 | |
| 1000 | 929 | fail: |
| 1001 | 930 | kfree(arg_org); |
| 1002 | 931 | } |
| 1003 | 932 | |
| 1004 | −void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) | |
| 933 | +void brcmf_c_pktfilter_offload_set(struct brcmf_pub *drvr, char *arg) | |
| 1005 | 934 | { |
| 1006 | 935 | const char *str; |
| 1007 | − wl_pkt_filter_t pkt_filter; | |
| 1008 | − wl_pkt_filter_t *pkt_filterp; | |
| 936 | + struct brcmf_pkt_filter pkt_filter; | |
| 937 | + struct brcmf_pkt_filter *pkt_filterp; | |
| 1009 | 938 | int buf_len; |
| 1010 | 939 | int str_len; |
| 1011 | 940 | int rc; |
| @@ -1014,29 +943,22 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 2 unmodified lines | ||
| 1014 | 943 | char *argv[8], *buf = 0; |
| 1015 | 944 | int i = 0; |
| 1016 | 945 | char *arg_save = 0, *arg_org = 0; |
| 1017 | −#define BUF_SIZE 2048 | |
| 1018 | 946 | |
| 1019 | 947 | arg_save = kmalloc(strlen(arg) + 1, GFP_ATOMIC); |
| 1020 | 948 | if (!arg_save) { |
| 1021 | − DHD_ERROR(("%s: kmalloc failed\n", __func__)); | |
| 949 | + BRCMF_ERROR(("%s: kmalloc failed\n", __func__)); | |
| 1022 | 950 | goto fail; |
| 1023 | 951 | } |
| 1024 | 952 | |
| 1025 | 953 | arg_org = arg_save; |
| 1026 | 954 | |
| 1027 | − buf = kmalloc(BUF_SIZE, GFP_ATOMIC); | |
| 955 | + buf = kmalloc(PKTFILTER_BUF_SIZE, GFP_ATOMIC); | |
| 1028 | 956 | if (!buf) { |
| 1029 | − DHD_ERROR(("%s: kmalloc failed\n", __func__)); | |
| 957 | + BRCMF_ERROR(("%s: kmalloc failed\n", __func__)); | |
| 1030 | 958 | goto fail; |
| 1031 | 959 | } |
| 1032 | 960 | |
| 1033 | − memcpy(arg_save, arg, strlen(arg) + 1); | |
| 1034 | − | |
| 1035 | − if (strlen(arg) > BUF_SIZE) { | |
| 1036 | − DHD_ERROR(("Not enough buffer %d < %d\n", (int)strlen(arg), | |
| 1037 | − (int)sizeof(buf))); | |
| 1038 | − goto fail; | |
| 1039 | − } | |
| 961 | + strcpy(arg_save, arg); | |
| 1040 | 962 | |
| 1041 | 963 | argv[i] = strsep(&arg_save, " "); |
| 1042 | 964 | while (argv[i++]) |
| @@ -1044,23 +966,22 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 1 unmodified line | ||
| 1044 | 966 | |
| 1045 | 967 | i = 0; |
| 1046 | 968 | if (NULL == argv[i]) { |
| 1047 | − DHD_ERROR(("No args provided\n")); | |
| 969 | + BRCMF_ERROR(("No args provided\n")); | |
| 1048 | 970 | goto fail; |
| 1049 | 971 | } |
| 1050 | 972 | |
| 1051 | 973 | str = "pkt_filter_add"; |
| 974 | + strcpy(buf, str); | |
| 1052 | 975 | str_len = strlen(str); |
| 1053 | − strncpy(buf, str, str_len); | |
| 1054 | − buf[str_len] = '\0'; | |
| 1055 | 976 | buf_len = str_len + 1; |
| 1056 | 977 | |
| 1057 | − pkt_filterp = (wl_pkt_filter_t *) (buf + str_len + 1); | |
| 978 | + pkt_filterp = (struct brcmf_pkt_filter *) (buf + str_len + 1); | |
| 1058 | 979 | |
| 1059 | 980 | /* Parse packet filter id. */ |
| 1060 | 981 | pkt_filter.id = simple_strtoul(argv[i], NULL, 0); |
| 1061 | 982 | |
| 1062 | 983 | if (NULL == argv[++i]) { |
| 1063 | − DHD_ERROR(("Polarity not provided\n")); | |
| 984 | + BRCMF_ERROR(("Polarity not provided\n")); | |
| 1064 | 985 | goto fail; |
| 1065 | 986 | } |
| 1066 | 987 | |
| @@ -1068,7 +989,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 1 unmodified line | ||
| 1068 | 989 | pkt_filter.negate_match = simple_strtoul(argv[i], NULL, 0); |
| 1069 | 990 | |
| 1070 | 991 | if (NULL == argv[++i]) { |
| 1071 | − DHD_ERROR(("Filter type not provided\n")); | |
| 992 | + BRCMF_ERROR(("Filter type not provided\n")); | |
| 1072 | 993 | goto fail; |
| 1073 | 994 | } |
| 1074 | 995 | |
| @@ -1076,7 +997,7 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 1 unmodified line | ||
| 1076 | 997 | pkt_filter.type = simple_strtoul(argv[i], NULL, 0); |
| 1077 | 998 | |
| 1078 | 999 | if (NULL == argv[++i]) { |
| 1079 | − DHD_ERROR(("Offset not provided\n")); | |
| 1000 | + BRCMF_ERROR(("Offset not provided\n")); | |
| 1080 | 1001 | goto fail; |
| 1081 | 1002 | } |
| 1082 | 1003 | |
| @@ -1084,34 +1005,34 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 1 unmodified line | ||
| 1084 | 1005 | pkt_filter.u.pattern.offset = simple_strtoul(argv[i], NULL, 0); |
| 1085 | 1006 | |
| 1086 | 1007 | if (NULL == argv[++i]) { |
| 1087 | − DHD_ERROR(("Bitmask not provided\n")); | |
| 1008 | + BRCMF_ERROR(("Bitmask not provided\n")); | |
| 1088 | 1009 | goto fail; |
| 1089 | 1010 | } |
| 1090 | 1011 | |
| 1091 | 1012 | /* Parse pattern filter mask. */ |
| 1092 | 1013 | mask_size = |
| 1093 | − wl_pattern_atoh | |
| 1014 | + brcmf_c_pattern_atoh | |
| 1094 | 1015 | (argv[i], (char *)pkt_filterp->u.pattern.mask_and_pattern); |
| 1095 | 1016 | |
| 1096 | 1017 | if (NULL == argv[++i]) { |
| 1097 | − DHD_ERROR(("Pattern not provided\n")); | |
| 1018 | + BRCMF_ERROR(("Pattern not provided\n")); | |
| 1098 | 1019 | goto fail; |
| 1099 | 1020 | } |
| 1100 | 1021 | |
| 1101 | 1022 | /* Parse pattern filter pattern. */ |
| 1102 | 1023 | pattern_size = |
| 1103 | − wl_pattern_atoh(argv[i], | |
| 1024 | + brcmf_c_pattern_atoh(argv[i], | |
| 1104 | 1025 | (char *)&pkt_filterp->u.pattern. |
| 1105 | 1026 | mask_and_pattern[mask_size]); |
| 1106 | 1027 | |
| 1107 | 1028 | if (mask_size != pattern_size) { |
| 1108 | − DHD_ERROR(("Mask and pattern not the same size\n")); | |
| 1029 | + BRCMF_ERROR(("Mask and pattern not the same size\n")); | |
| 1109 | 1030 | goto fail; |
| 1110 | 1031 | } |
| 1111 | 1032 | |
| 1112 | 1033 | pkt_filter.u.pattern.size_bytes = mask_size; |
| 1113 | − buf_len += WL_PKT_FILTER_FIXED_LEN; | |
| 1114 | − buf_len += (WL_PKT_FILTER_PATTERN_FIXED_LEN + 2 * mask_size); | |
| 1034 | + buf_len += BRCMF_PKT_FILTER_FIXED_LEN; | |
| 1035 | + buf_len += (BRCMF_PKT_FILTER_PATTERN_FIXED_LEN + 2 * mask_size); | |
| 1115 | 1036 | |
| 1116 | 1037 | /* Keep-alive attributes are set in local |
| 1117 | 1038 | * variable (keep_alive_pkt), and |
| @@ -1120,17 +1041,17 @@ void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg) · 2 unmodified lines | ||
| 1120 | 1041 | */ |
| 1121 | 1042 | memcpy((char *)pkt_filterp, |
| 1122 | 1043 | &pkt_filter, |
| 1123 | − WL_PKT_FILTER_FIXED_LEN + WL_PKT_FILTER_PATTERN_FIXED_LEN); | |
| 1044 | + BRCMF_PKT_FILTER_FIXED_LEN + BRCMF_PKT_FILTER_PATTERN_FIXED_LEN); | |
| 1124 | 1045 | |
| 1125 | − rc = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, buf_len); | |
| 1046 | + rc = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, buf, buf_len); | |
| 1126 | 1047 | rc = rc >= 0 ? 0 : rc; |
| 1127 | 1048 | |
| 1128 | 1049 | if (rc) |
| 1129 | − DHD_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n", | |
| 1130 | − __func__, arg, rc)); | |
| 1050 | + BRCMF_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n", | |
| 1051 | + __func__, arg, rc)); | |
| 1131 | 1052 | else |
| 1132 | − DHD_TRACE(("%s: successfully added pktfilter %s\n", | |
| 1133 | − __func__, arg)); | |
| 1053 | + BRCMF_TRACE(("%s: successfully added pktfilter %s\n", | |
| 1054 | + __func__, arg)); | |
| 1134 | 1055 | |
| 1135 | 1056 | fail: |
| 1136 | 1057 | kfree(arg_org); |
| @@ -1138,711 +1059,138 @@ fail: · 1 unmodified line | ||
| 1138 | 1059 | kfree(buf); |
| 1139 | 1060 | } |
| 1140 | 1061 | |
| 1141 | −void dhd_arp_offload_set(dhd_pub_t *dhd, int arp_mode) | |
| 1062 | +void brcmf_c_arp_offload_set(struct brcmf_pub *drvr, int arp_mode) | |
| 1142 | 1063 | { |
| 1143 | 1064 | char iovbuf[32]; |
| 1144 | 1065 | int retcode; |
| 1145 | 1066 | |
| 1146 | − bcm_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf)); | |
| 1147 | − retcode = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); | |
| 1067 | + brcmu_mkiovar("arp_ol", (char *)&arp_mode, 4, iovbuf, sizeof(iovbuf)); | |
| 1068 | + retcode = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, | |
| 1069 | + iovbuf, sizeof(iovbuf)); | |
| 1148 | 1070 | retcode = retcode >= 0 ? 0 : retcode; |
| 1149 | 1071 | if (retcode) |
| 1150 | − DHD_TRACE(("%s: failed to set ARP offload mode to 0x%x, " | |
| 1151 | − "retcode = %d\n", __func__, arp_mode, retcode)); | |
| 1072 | + BRCMF_TRACE(("%s: failed to set ARP offload mode to 0x%x, " | |
| 1073 | + "retcode = %d\n", __func__, arp_mode, retcode)); | |
| 1152 | 1074 | else |
| 1153 | − DHD_TRACE(("%s: successfully set ARP offload mode to 0x%x\n", | |
| 1154 | − __func__, arp_mode)); | |
| 1075 | + BRCMF_TRACE(("%s: successfully set ARP offload mode to 0x%x\n", | |
| 1076 | + __func__, arp_mode)); | |
| 1155 | 1077 | } |
| 1156 | 1078 | |
| 1157 | −void dhd_arp_offload_enable(dhd_pub_t *dhd, int arp_enable) | |
| 1079 | +void brcmf_c_arp_offload_enable(struct brcmf_pub *drvr, int arp_enable) | |
| 1158 | 1080 | { |
| 1159 | 1081 | char iovbuf[32]; |
| 1160 | 1082 | int retcode; |
| 1161 | 1083 | |
| 1162 | − bcm_mkiovar("arpoe", (char *)&arp_enable, 4, iovbuf, sizeof(iovbuf)); | |
| 1163 | − retcode = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); | |
| 1084 | + brcmu_mkiovar("arpoe", (char *)&arp_enable, 4, iovbuf, sizeof(iovbuf)); | |
| 1085 | + retcode = brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, | |
| 1086 | + iovbuf, sizeof(iovbuf)); | |
| 1164 | 1087 | retcode = retcode >= 0 ? 0 : retcode; |
| 1165 | 1088 | if (retcode) |
| 1166 | − DHD_TRACE(("%s: failed to enabe ARP offload to %d, " | |
| 1167 | − "retcode = %d\n", __func__, arp_enable, retcode)); | |
| 1089 | + BRCMF_TRACE(("%s: failed to enabe ARP offload to %d, " | |
| 1090 | + "retcode = %d\n", __func__, arp_enable, retcode)); | |
| 1168 | 1091 | else |
| 1169 | − DHD_TRACE(("%s: successfully enabed ARP offload to %d\n", | |
| 1170 | − __func__, arp_enable)); | |
| 1092 | + BRCMF_TRACE(("%s: successfully enabed ARP offload to %d\n", | |
| 1093 | + __func__, arp_enable)); | |
| 1171 | 1094 | } |
| 1172 | 1095 | |
| 1173 | −int dhd_preinit_ioctls(dhd_pub_t *dhd) | |
| 1096 | +int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr) | |
| 1174 | 1097 | { |
| 1175 | − char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for | |
| 1098 | + char iovbuf[BRCMF_EVENTING_MASK_LEN + 12]; /* Room for | |
| 1176 | 1099 | "event_msgs" + '\0' + bitvec */ |
| 1177 | 1100 | uint up = 0; |
| 1178 | 1101 | char buf[128], *ptr; |
| 1179 | 1102 | uint power_mode = PM_FAST; |
| 1180 | − u32 dongle_align = DHD_SDALIGN; | |
| 1103 | + u32 dongle_align = BRCMF_SDALIGN; | |
| 1181 | 1104 | u32 glom = 0; |
| 1182 | 1105 | uint bcn_timeout = 3; |
| 1183 | 1106 | int scan_assoc_time = 40; |
| 1184 | 1107 | int scan_unassoc_time = 40; |
| 1185 | −#ifdef GET_CUSTOM_MAC_ENABLE | |
| 1186 | − int ret = 0; | |
| 1187 | − u8 ea_addr[ETH_ALEN]; | |
| 1188 | −#endif /* GET_CUSTOM_MAC_ENABLE */ | |
| 1189 | − | |
| 1190 | − dhd_os_proto_block(dhd); | |
| 1191 | − | |
| 1192 | −#ifdef GET_CUSTOM_MAC_ENABLE | |
| 1193 | − /* Read MAC address from external customer place | |
| 1194 | − ** NOTE that default mac address has to be present in | |
| 1195 | − ** otp or nvram file to bring up | |
| 1196 | − ** firmware but unique per board mac address maybe provided by | |
| 1197 | − ** customer code | |
| 1198 | − */ | |
| 1199 | − ret = dhd_custom_get_mac_address(ea_addr); | |
| 1200 | − if (!ret) { | |
| 1201 | − bcm_mkiovar("cur_etheraddr", (void *)ea_addr, ETH_ALEN, | |
| 1202 | − buf, sizeof(buf)); | |
| 1203 | − ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, buf, sizeof(buf)); | |
| 1204 | − if (ret < 0) { | |
| 1205 | − DHD_ERROR(("%s: can't set MAC address , error=%d\n", | |
| 1206 | − __func__, ret)); | |
| 1207 | − } else | |
| 1208 | − memcpy(dhd->mac.octet, (void *)&ea_addr, | |
| 1209 | − ETH_ALEN); | |
| 1210 | − } | |
| 1211 | −#endif /* GET_CUSTOM_MAC_ENABLE */ | |
| 1108 | + int i; | |
| 1109 | + | |
| 1110 | + brcmf_os_proto_block(drvr); | |
| 1212 | 1111 | |
| 1213 | 1112 | /* Set Country code */ |
| 1214 | − if (dhd->country_code[0] != 0) { | |
| 1215 | − if (dhdcdc_set_ioctl(dhd, 0, WLC_SET_COUNTRY, | |
| 1216 | − dhd->country_code, | |
| 1217 | − sizeof(dhd->country_code)) < 0) { | |
| 1218 | − DHD_ERROR(("%s: country code setting failed\n", | |
| 1219 | − __func__)); | |
| 1113 | + if (drvr->country_code[0] != 0) { | |
| 1114 | + if (brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_COUNTRY, | |
| 1115 | + drvr->country_code, | |
| 1116 | + sizeof(drvr->country_code)) < 0) { | |
| 1117 | + BRCMF_ERROR(("%s: country code setting failed\n", | |
| 1118 | + __func__)); | |
| 1220 | 1119 | } |
| 1221 | 1120 | } |
| 1222 | 1121 | |
| 1223 | 1122 | /* query for 'ver' to get version info from firmware */ |
| 1224 | 1123 | memset(buf, 0, sizeof(buf)); |
| 1225 | 1124 | ptr = buf; |
| 1226 | − bcm_mkiovar("ver", 0, 0, buf, sizeof(buf)); | |
| 1227 | − dhdcdc_query_ioctl(dhd, 0, WLC_GET_VAR, buf, sizeof(buf)); | |
| 1125 | + brcmu_mkiovar("ver", 0, 0, buf, sizeof(buf)); | |
| 1126 | + brcmf_proto_cdc_query_ioctl(drvr, 0, BRCMF_C_GET_VAR, buf, sizeof(buf)); | |
| 1228 | 1127 | strsep(&ptr, "\n"); |
| 1229 | 1128 | /* Print fw version info */ |
| 1230 | − DHD_ERROR(("Firmware version = %s\n", buf)); | |
| 1129 | + BRCMF_ERROR(("Firmware version = %s\n", buf)); | |
| 1231 | 1130 | |
| 1232 | 1131 | /* Set PowerSave mode */ |
| 1233 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_PM, (char *)&power_mode, | |
| 1132 | + brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_PM, (char *)&power_mode, | |
| 1234 | 1133 | sizeof(power_mode)); |
| 1235 | 1134 | |
| 1236 | 1135 | /* Match Host and Dongle rx alignment */ |
| 1237 | − bcm_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf, | |
| 1136 | + brcmu_mkiovar("bus:txglomalign", (char *)&dongle_align, 4, iovbuf, | |
| 1238 | 1137 | sizeof(iovbuf)); |
| 1239 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); | |
| 1138 | + brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | |
| 1139 | + sizeof(iovbuf)); | |
| 1240 | 1140 | |
| 1241 | 1141 | /* disable glom option per default */ |
| 1242 | − bcm_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf)); | |
| 1243 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); | |
| 1142 | + brcmu_mkiovar("bus:txglom", (char *)&glom, 4, iovbuf, sizeof(iovbuf)); | |
| 1143 | + brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | |
| 1144 | + sizeof(iovbuf)); | |
| 1244 | 1145 | |
| 1245 | 1146 | /* Setup timeout if Beacons are lost and roam is off to report |
| 1246 | 1147 | link down */ |
| 1247 | − bcm_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, | |
| 1148 | + brcmu_mkiovar("bcn_timeout", (char *)&bcn_timeout, 4, iovbuf, | |
| 1248 | 1149 | sizeof(iovbuf)); |
| 1249 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); | |
| 1150 | + brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | |
| 1151 | + sizeof(iovbuf)); | |
| 1250 | 1152 | |
| 1251 | 1153 | /* Enable/Disable build-in roaming to allowed ext supplicant to take |
| 1252 | 1154 | of romaing */ |
| 1253 | − bcm_mkiovar("roam_off", (char *)&dhd_roam, 4, iovbuf, sizeof(iovbuf)); | |
| 1254 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); | |
| 1155 | + brcmu_mkiovar("roam_off", (char *)&brcmf_roam, 4, | |
| 1156 | + iovbuf, sizeof(iovbuf)); | |
| 1157 | + brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | |
| 1158 | + sizeof(iovbuf)); | |
| 1255 | 1159 | |
| 1256 | 1160 | /* Force STA UP */ |
| 1257 | − if (dhd_radio_up) | |
| 1258 | − dhdcdc_set_ioctl(dhd, 0, WLC_UP, (char *)&up, sizeof(up)); | |
| 1161 | + if (brcmf_radio_up) | |
| 1162 | + brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_UP, (char *)&up, | |
| 1163 | + sizeof(up)); | |
| 1259 | 1164 | |
| 1260 | 1165 | /* Setup event_msgs */ |
| 1261 | − bcm_mkiovar("event_msgs", dhd->eventmask, WL_EVENTING_MASK_LEN, iovbuf, | |
| 1262 | − sizeof(iovbuf)); | |
| 1263 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); | |
| 1166 | + brcmu_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN, | |
| 1167 | + iovbuf, sizeof(iovbuf)); | |
| 1168 | + brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_VAR, iovbuf, | |
| 1169 | + sizeof(iovbuf)); | |
| 1264 | 1170 | |
| 1265 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_SCAN_CHANNEL_TIME, | |
| 1171 | + brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_SCAN_CHANNEL_TIME, | |
| 1266 | 1172 | (char *)&scan_assoc_time, sizeof(scan_assoc_time)); |
| 1267 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_SCAN_UNASSOC_TIME, | |
| 1173 | + brcmf_proto_cdc_set_ioctl(drvr, 0, BRCMF_C_SET_SCAN_UNASSOC_TIME, | |
| 1268 | 1174 | (char *)&scan_unassoc_time, sizeof(scan_unassoc_time)); |
| 1269 | 1175 | |
| 1270 | −#ifdef ARP_OFFLOAD_SUPPORT | |
| 1271 | 1176 | /* Set and enable ARP offload feature */ |
| 1272 | − if (dhd_arp_enable) | |
| 1273 | − dhd_arp_offload_set(dhd, dhd_arp_mode); | |
| 1274 | − dhd_arp_offload_enable(dhd, dhd_arp_enable); | |
| 1275 | −#endif /* ARP_OFFLOAD_SUPPORT */ | |
| 1276 | − | |
| 1277 | −#ifdef PKT_FILTER_SUPPORT | |
| 1278 | − { | |
| 1279 | − int i; | |
| 1280 | − /* Set up pkt filter */ | |
| 1281 | − if (dhd_pkt_filter_enable) { | |
| 1282 | − for (i = 0; i < dhd->pktfilter_count; i++) { | |
| 1283 | − dhd_pktfilter_offload_set(dhd, | |
| 1284 | − dhd->pktfilter[i]); | |
| 1285 | − dhd_pktfilter_offload_enable(dhd, | |
| 1286 | − dhd->pktfilter[i], | |
| 1287 | − dhd_pkt_filter_init, | |
| 1288 | − dhd_master_mode); | |
| 1289 | − } | |
| 1290 | − } | |
| 1291 | − } | |
| 1292 | −#endif /* PKT_FILTER_SUPPORT */ | |
| 1293 | − | |
| 1294 | − dhd_os_proto_unblock(dhd); | |
| 1295 | − | |
| 1296 | − return 0; | |
| 1297 | −} | |
| 1298 | − | |
| 1299 | −#ifdef SIMPLE_ISCAN | |
| 1300 | −uint iscan_thread_id; | |
| 1301 | −iscan_buf_t *iscan_chain; | |
| 1302 | − | |
| 1303 | −iscan_buf_t *dhd_iscan_allocate_buf(dhd_pub_t *dhd, iscan_buf_t **iscanbuf) | |
| 1304 | −{ | |
| 1305 | − iscan_buf_t *iscanbuf_alloc = 0; | |
| 1306 | − iscan_buf_t *iscanbuf_head; | |
| 1307 | − | |
| 1308 | − dhd_iscan_lock(); | |
| 1309 | − | |
| 1310 | − iscanbuf_alloc = kmalloc(sizeof(iscan_buf_t), GFP_ATOMIC); | |
| 1311 | − if (iscanbuf_alloc == NULL) | |
| 1312 | − goto fail; | |
| 1313 | − | |
| 1314 | − iscanbuf_alloc->next = NULL; | |
| 1315 | − iscanbuf_head = *iscanbuf; | |
| 1316 | − | |
| 1317 | − DHD_ISCAN(("%s: addr of allocated node = 0x%X" | |
| 1318 | − "addr of iscanbuf_head = 0x%X dhd = 0x%X\n", | |
| 1319 | − __func__, iscanbuf_alloc, iscanbuf_head, dhd)); | |
| 1320 | − | |
| 1321 | − if (iscanbuf_head == NULL) { | |
| 1322 | − *iscanbuf = iscanbuf_alloc; | |
| 1323 | − DHD_ISCAN(("%s: Head is allocated\n", __func__)); | |
| 1324 | − goto fail; | |
| 1325 | − } | |
| 1326 | − | |
| 1327 | − while (iscanbuf_head->next) | |
| 1328 | − iscanbuf_head = iscanbuf_head->next; | |
| 1329 | − | |
| 1330 | − iscanbuf_head->next = iscanbuf_alloc; | |
| 1331 | − | |
| 1332 | −fail: | |
| 1333 | − dhd_iscan_unlock(); | |
| 1334 | − return iscanbuf_alloc; | |
| 1335 | −} | |
| 1336 | − | |
| 1337 | −void dhd_iscan_free_buf(void *dhdp, iscan_buf_t *iscan_delete) | |
| 1338 | −{ | |
| 1339 | − iscan_buf_t *iscanbuf_free = 0; | |
| 1340 | − iscan_buf_t *iscanbuf_prv = 0; | |
| 1341 | − iscan_buf_t *iscanbuf_cur = iscan_chain; | |
| 1342 | − dhd_pub_t *dhd = dhd_bus_pub(dhdp); | |
| 1343 | − | |
| 1344 | − dhd_iscan_lock(); | |
| 1345 | − /* If iscan_delete is null then delete the entire | |
| 1346 | − * chain or else delete specific one provided | |
| 1347 | − */ | |
| 1348 | − if (!iscan_delete) { | |
| 1349 | − while (iscanbuf_cur) { | |
| 1350 | − iscanbuf_free = iscanbuf_cur; | |
| 1351 | − iscanbuf_cur = iscanbuf_cur->next; | |
| 1352 | − iscanbuf_free->next = 0; | |
| 1353 | − kfree(iscanbuf_free); | |
| 1354 | − } | |
| 1355 | − iscan_chain = 0; | |
| 1356 | − } else { | |
| 1357 | − while (iscanbuf_cur) { | |
| 1358 | − if (iscanbuf_cur == iscan_delete) | |
| 1359 | − break; | |
| 1360 | − iscanbuf_prv = iscanbuf_cur; | |
| 1361 | − iscanbuf_cur = iscanbuf_cur->next; | |
| 1362 | − } | |
| 1363 | − if (iscanbuf_prv) | |
| 1364 | − iscanbuf_prv->next = iscan_delete->next; | |
| 1365 | − | |
| 1366 | − iscan_delete->next = 0; | |
| 1367 | − kfree(iscan_delete); | |
| 1368 | − | |
| 1369 | − if (!iscanbuf_prv) | |
| 1370 | − iscan_chain = 0; | |
| 1371 | − } | |
| 1372 | − dhd_iscan_unlock(); | |
| 1373 | −} | |
| 1374 | − | |
| 1375 | −iscan_buf_t *dhd_iscan_result_buf(void) | |
| 1376 | −{ | |
| 1377 | − return iscan_chain; | |
| 1378 | −} | |
| 1379 | − | |
| 1380 | −/* | |
| 1381 | −* print scan cache | |
| 1382 | −* print partial iscan_skip list differently | |
| 1383 | −*/ | |
| 1384 | −int dhd_iscan_print_cache(iscan_buf_t *iscan_skip) | |
| 1385 | −{ | |
| 1386 | − int i = 0, l = 0; | |
| 1387 | − iscan_buf_t *iscan_cur; | |
| 1388 | − wl_iscan_results_t *list; | |
| 1389 | − wl_scan_results_t *results; | |
| 1390 | − wl_bss_info_t UNALIGNED *bi; | |
| 1391 | − | |
| 1392 | − dhd_iscan_lock(); | |
| 1393 | − | |
| 1394 | − iscan_cur = dhd_iscan_result_buf(); | |
| 1395 | − | |
| 1396 | − while (iscan_cur) { | |
| 1397 | − list = (wl_iscan_results_t *)iscan_cur->iscan_buf; | |
| 1398 | − if (!list) | |
| 1399 | − break; | |
| 1400 | − | |
| 1401 | − results = (wl_scan_results_t *)&list->results; | |
| 1402 | − if (!results) | |
| 1403 | − break; | |
| 1404 | − | |
| 1405 | − if (results->version != WL_BSS_INFO_VERSION) { | |
| 1406 | − DHD_ISCAN(("%s: results->version %d != " | |
| 1407 | − "WL_BSS_INFO_VERSION\n", | |
| 1408 | − __func__, results->version)); | |
| 1409 | − goto done; | |
| 1410 | − } | |
| 1411 | − | |
| 1412 | − bi = results->bss_info; | |
| 1413 | − for (i = 0; i < results->count; i++) { | |
| 1414 | − if (!bi) | |
| 1415 | − break; | |
| 1416 | − | |
| 1417 | − DHD_ISCAN(("%s[%2.2d:%2.2d] %X:%X:%X:%X:%X:%X\n", | |
| 1418 | − iscan_cur != iscan_skip ? "BSS" : "bss", l, | |
| 1419 | − i, bi->BSSID.octet[0], bi->BSSID.octet[1], | |
| 1420 | − bi->BSSID.octet[2], bi->BSSID.octet[3], | |
| 1421 | − bi->BSSID.octet[4], bi->BSSID.octet[5])); | |
| 1422 | − | |
| 1423 | − bi = (wl_bss_info_t *)((unsigned long)bi + bi->length); | |
| 1424 | − } | |
| 1425 | − iscan_cur = iscan_cur->next; | |
| 1426 | − l++; | |
| 1427 | − } | |
| 1428 | − | |
| 1429 | −done: | |
| 1430 | − dhd_iscan_unlock(); | |
| 1431 | − return 0; | |
| 1432 | −} | |
| 1433 | − | |
| 1434 | −/* | |
| 1435 | −* delete disappeared AP from specific scan cache but skip partial | |
| 1436 | −* list in iscan_skip | |
| 1437 | −*/ | |
| 1438 | −int dhd_iscan_delete_bss(void *dhdp, void *addr, iscan_buf_t *iscan_skip) | |
| 1439 | −{ | |
| 1440 | − int i = 0, j = 0, l = 0; | |
| 1441 | − iscan_buf_t *iscan_cur; | |
| 1442 | − wl_iscan_results_t *list; | |
| 1443 | − wl_scan_results_t *results; | |
| 1444 | − wl_bss_info_t UNALIGNED *bi, *bi_new, *bi_next; | |
| 1445 | − | |
| 1446 | − unsigned char *s_addr = addr; | |
| 1447 | − | |
| 1448 | − dhd_iscan_lock(); | |
| 1449 | − DHD_ISCAN(("%s: BSS to remove %X:%X:%X:%X:%X:%X\n", | |
| 1450 | − __func__, s_addr[0], s_addr[1], s_addr[2], | |
| 1451 | − s_addr[3], s_addr[4], s_addr[5])); | |
| 1452 | − | |
| 1453 | − iscan_cur = dhd_iscan_result_buf(); | |
| 1454 | − | |
| 1455 | − while (iscan_cur) { | |
| 1456 | − if (iscan_cur != iscan_skip) { | |
| 1457 | − list = (wl_iscan_results_t *)iscan_cur->iscan_buf; | |
| 1458 | − if (!list) | |
| 1459 | − break; | |
| 1460 | − | |
| 1461 | − results = (wl_scan_results_t *)&list->results; | |
| 1462 | − if (!results) | |
| 1463 | − break; | |
| 1464 | − | |
| 1465 | − if (results->version != WL_BSS_INFO_VERSION) { | |
| 1466 | − DHD_ERROR(("%s: results->version %d != " | |
| 1467 | − "WL_BSS_INFO_VERSION\n", | |
| 1468 | − __func__, results->version)); | |
| 1469 | − goto done; | |
| 1470 | − } | |
| 1471 | − | |
| 1472 | − bi = results->bss_info; | |
| 1473 | − for (i = 0; i < results->count; i++) { | |
| 1474 | − if (!bi) | |
| 1475 | − break; | |
| 1476 | − | |
| 1477 | − if (!memcmp | |
| 1478 | − (bi->BSSID.octet, addr, ETH_ALEN)) { | |
| 1479 | − DHD_ISCAN(("%s: Del BSS[%2.2d:%2.2d] " | |
| 1480 | − "%X:%X:%X:%X:%X:%X\n", | |
| 1481 | − __func__, l, i, bi->BSSID.octet[0], | |
| 1482 | − bi->BSSID.octet[1], bi->BSSID.octet[2], | |
| 1483 | − bi->BSSID.octet[3], bi->BSSID.octet[4], | |
| 1484 | − bi->BSSID.octet[5])); | |
| 1485 | − | |
| 1486 | − bi_new = bi; | |
| 1487 | − bi = (wl_bss_info_t *)((unsigned long) | |
| 1488 | − bi + bi->length); | |
| 1489 | −/* | |
| 1490 | − if(bi && bi_new) { | |
| 1491 | − memcpy(bi_new, bi, results->buflen - | |
| 1492 | − bi_new->length); | |
| 1493 | − results->buflen -= bi_new->length; | |
| 1494 | − } | |
| 1495 | −*/ | |
| 1496 | − results->buflen -= bi_new->length; | |
| 1497 | − results->count--; | |
| 1498 | − | |
| 1499 | − for (j = i; j < results->count; j++) { | |
| 1500 | − if (bi && bi_new) { | |
| 1501 | − DHD_ISCAN(("%s: Moved up BSS[%2.2d:%2.2d]" "%X:%X:%X:%X:%X:%X\n", | |
| 1502 | − __func__, l, j, | |
| 1503 | − bi->BSSID.octet[0], | |
| 1504 | − bi->BSSID.octet[1], | |
| 1505 | − bi->BSSID.octet[2], | |
| 1506 | − bi->BSSID.octet[3], | |
| 1507 | − bi->BSSID.octet[4], | |
| 1508 | − bi->BSSID.octet[5])); | |
| 1509 | − | |
| 1510 | − bi_next = | |
| 1511 | − (wl_bss_info_t *)((unsigned long)bi + | |
| 1512 | − bi->length); | |
| 1513 | − memcpy(bi_new, bi, | |
| 1514 | − bi->length); | |
| 1515 | − bi_new = | |
| 1516 | − (wl_bss_info_t *)((unsigned long)bi_new + | |
| 1517 | − bi_new-> | |
| 1518 | − length); | |
| 1519 | − bi = bi_next; | |
| 1520 | − } | |
| 1521 | − } | |
| 1522 | − | |
| 1523 | − if (results->count == 0) { | |
| 1524 | − /* Prune now empty partial | |
| 1525 | − scan list */ | |
| 1526 | − dhd_iscan_free_buf(dhdp, | |
| 1527 | − iscan_cur); | |
| 1528 | − goto done; | |
| 1529 | − } | |
| 1530 | − break; | |
| 1531 | − } | |
| 1532 | − bi = (wl_bss_info_t *)((unsigned long)bi + | |
| 1533 | − bi->length); | |
| 1534 | − } | |
| 1177 | + if (brcmf_arp_enable) | |
| 1178 | + brcmf_c_arp_offload_set(drvr, brcmf_arp_mode); | |
| 1179 | + brcmf_c_arp_offload_enable(drvr, brcmf_arp_enable); | |
| 1180 | + | |
| 1181 | + /* Set up pkt filter */ | |
| 1182 | + if (brcmf_pkt_filter_enable) { | |
| 1183 | + for (i = 0; i < drvr->pktfilter_count; i++) { | |
| 1184 | + brcmf_c_pktfilter_offload_set(drvr, | |
| 1185 | + drvr->pktfilter[i]); | |
| 1186 | + brcmf_c_pktfilter_offload_enable(drvr, | |
| 1187 | + drvr->pktfilter[i], | |
| 1188 | + brcmf_pkt_filter_init, | |
| 1189 | + brcmf_master_mode); | |
| 1535 | 1190 | } |
| 1536 | − iscan_cur = iscan_cur->next; | |
| 1537 | − l++; | |
| 1538 | − } | |
| 1539 | − | |
| 1540 | −done: | |
| 1541 | − dhd_iscan_unlock(); | |
| 1542 | − return 0; | |
| 1543 | −} | |
| 1544 | − | |
| 1545 | −int dhd_iscan_remove_duplicates(void *dhdp, iscan_buf_t *iscan_cur) | |
| 1546 | −{ | |
| 1547 | − int i = 0; | |
| 1548 | − wl_iscan_results_t *list; | |
| 1549 | − wl_scan_results_t *results; | |
| 1550 | − wl_bss_info_t UNALIGNED *bi, *bi_new, *bi_next; | |
| 1551 | − | |
| 1552 | − dhd_iscan_lock(); | |
| 1553 | − | |
| 1554 | − DHD_ISCAN(("%s: Scan cache before delete\n", __func__)); | |
| 1555 | − dhd_iscan_print_cache(iscan_cur); | |
| 1556 | − | |
| 1557 | − if (!iscan_cur) | |
| 1558 | − goto done; | |
| 1559 | − | |
| 1560 | − list = (wl_iscan_results_t *)iscan_cur->iscan_buf; | |
| 1561 | − if (!list) | |
| 1562 | − goto done; | |
| 1563 | − | |
| 1564 | − results = (wl_scan_results_t *)&list->results; | |
| 1565 | − if (!results) | |
| 1566 | − goto done; | |
| 1567 | − | |
| 1568 | − if (results->version != WL_BSS_INFO_VERSION) { | |
| 1569 | − DHD_ERROR(("%s: results->version %d != WL_BSS_INFO_VERSION\n", | |
| 1570 | − __func__, results->version)); | |
| 1571 | − goto done; | |
| 1572 | 1191 | } |
| 1573 | 1192 | |
| 1574 | − bi = results->bss_info; | |
| 1575 | − for (i = 0; i < results->count; i++) { | |
| 1576 | − if (!bi) | |
| 1577 | − break; | |
| 1578 | − | |
| 1579 | − DHD_ISCAN(("%s: Find dups for BSS[%2.2d] %X:%X:%X:%X:%X:%X\n", | |
| 1580 | − __func__, i, bi->BSSID.octet[0], | |
| 1581 | − bi->BSSID.octet[1], bi->BSSID.octet[2], | |
| 1582 | − bi->BSSID.octet[3], bi->BSSID.octet[4], | |
| 1583 | − bi->BSSID.octet[5])); | |
| 1584 | − | |
| 1585 | − dhd_iscan_delete_bss(dhdp, bi->BSSID.octet, iscan_cur); | |
| 1193 | + brcmf_os_proto_unblock(drvr); | |
| 1586 | 1194 | |
| 1587 | − bi = (wl_bss_info_t *)((unsigned long)bi + bi->length); | |
| 1588 | − } | |
| 1589 | − | |
| 1590 | −done: | |
| 1591 | − DHD_ISCAN(("%s: Scan cache after delete\n", __func__)); | |
| 1592 | − dhd_iscan_print_cache(iscan_cur); | |
| 1593 | − dhd_iscan_unlock(); | |
| 1594 | 1195 | return 0; |
| 1595 | 1196 | } |
| 1596 | − | |
| 1597 | −void dhd_iscan_ind_scan_confirm(void *dhdp, bool status) | |
| 1598 | −{ | |
| 1599 | − | |
| 1600 | − dhd_ind_scan_confirm(dhdp, status); | |
| 1601 | −} | |
| 1602 | − | |
| 1603 | −int dhd_iscan_request(void *dhdp, u16 action) | |
| 1604 | −{ | |
| 1605 | − int rc; | |
| 1606 | − wl_iscan_params_t params; | |
| 1607 | − dhd_pub_t *dhd = dhd_bus_pub(dhdp); | |
| 1608 | − char buf[WLC_IOCTL_SMLEN]; | |
| 1609 | − | |
| 1610 | − memset(¶ms, 0, sizeof(wl_iscan_params_t)); | |
| 1611 | − memcpy(¶ms.params.bssid, ðer_bcast, ETH_ALEN); | |
| 1612 | − | |
| 1613 | − params.params.bss_type = DOT11_BSSTYPE_ANY; | |
| 1614 | − params.params.scan_type = DOT11_SCANTYPE_ACTIVE; | |
| 1615 | − | |
| 1616 | − params.params.nprobes = -1; | |
| 1617 | − params.params.active_time = -1; | |
| 1618 | − params.params.passive_time = -1; | |
| 1619 | − params.params.home_time = -1; | |
| 1620 | − params.params.channel_num = 0; | |
| 1621 | − | |
| 1622 | − params.version = ISCAN_REQ_VERSION; | |
| 1623 | − params.action = action; | |
| 1624 | − params.scan_duration = 0; | |
| 1625 | − | |
| 1626 | − bcm_mkiovar("iscan", (char *)¶ms, sizeof(wl_iscan_params_t), buf, | |
| 1627 | − WLC_IOCTL_SMLEN); | |
| 1628 | − rc = dhd_wl_ioctl(dhdp, WLC_SET_VAR, buf, WLC_IOCTL_SMLEN); | |
| 1629 | − | |
| 1630 | − return rc; | |
| 1631 | −} | |
| 1632 | − | |
| 1633 | −static int dhd_iscan_get_partial_result(void *dhdp, uint *scan_count) | |
| 1634 | −{ | |
| 1635 | − wl_iscan_results_t *list_buf; | |
| 1636 | − wl_iscan_results_t list; | |
| 1637 | − wl_scan_results_t *results; | |
| 1638 | − iscan_buf_t *iscan_cur; | |
| 1639 | − int status = -1; | |
| 1640 | − dhd_pub_t *dhd = dhd_bus_pub(dhdp); | |
| 1641 | − int rc; | |
| 1642 | − | |
| 1643 | − iscan_cur = dhd_iscan_allocate_buf(dhd, &iscan_chain); | |
| 1644 | − if (!iscan_cur) { | |
| 1645 | − DHD_ERROR(("%s: Failed to allocate node\n", __func__)); | |
| 1646 | − dhd_iscan_free_buf(dhdp, 0); | |
| 1647 | − dhd_iscan_request(dhdp, WL_SCAN_ACTION_ABORT); | |
| 1648 | − goto fail; | |
| 1649 | − } | |
| 1650 | − | |
| 1651 | − dhd_iscan_lock(); | |
| 1652 | − | |
| 1653 | − memset(iscan_cur->iscan_buf, 0, WLC_IW_ISCAN_MAXLEN); | |
| 1654 | − list_buf = (wl_iscan_results_t *) iscan_cur->iscan_buf; | |
| 1655 | − results = &list_buf->results; | |
| 1656 | − results->buflen = WL_ISCAN_RESULTS_FIXED_SIZE; | |
| 1657 | − results->version = 0; | |
| 1658 | − results->count = 0; | |
| 1659 | − | |
| 1660 | − memset(&list, 0, sizeof(list)); | |
| 1661 | − list.results.buflen = WLC_IW_ISCAN_MAXLEN; | |
| 1662 | − bcm_mkiovar("iscanresults", (char *)&list, WL_ISCAN_RESULTS_FIXED_SIZE, | |
| 1663 | − iscan_cur->iscan_buf, WLC_IW_ISCAN_MAXLEN); | |
| 1664 | − rc = dhd_wl_ioctl(dhdp, WLC_GET_VAR, iscan_cur->iscan_buf, | |
| 1665 | − WLC_IW_ISCAN_MAXLEN); | |
| 1666 | − | |
| 1667 | − results->buflen = results->buflen; | |
| 1668 | − results->version = results->version; | |
| 1669 | − *scan_count = results->count = results->count; | |
| 1670 | − status = list_buf->status; | |
| 1671 | − | |
| 1672 | − dhd_iscan_unlock(); | |
| 1673 | − | |
| 1674 | − if (!(*scan_count)) | |
| 1675 | − dhd_iscan_free_buf(dhdp, iscan_cur); | |
| 1676 | − else | |
| 1677 | − dhd_iscan_remove_duplicates(dhdp, iscan_cur); | |
| 1678 | − | |
| 1679 | −fail: | |
| 1680 | − return status; | |
| 1681 | −} | |
| 1682 | −#endif /* SIMPLE_ISCAN */ | |
| 1683 | − | |
| 1684 | −#ifdef PNO_SUPPORT | |
| 1685 | −int dhd_pno_clean(dhd_pub_t *dhd) | |
| 1686 | −{ | |
| 1687 | − char iovbuf[128]; | |
| 1688 | − int pfn_enabled = 0; | |
| 1689 | − int iov_len = 0; | |
| 1690 | − int ret; | |
| 1691 | − | |
| 1692 | − /* Disable pfn */ | |
| 1693 | − iov_len = | |
| 1694 | − bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf, sizeof(iovbuf)); | |
| 1695 | − ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); | |
| 1696 | − if (ret >= 0) { | |
| 1697 | − /* clear pfn */ | |
| 1698 | − iov_len = bcm_mkiovar("pfnclear", 0, 0, iovbuf, sizeof(iovbuf)); | |
| 1699 | − if (iov_len) { | |
| 1700 | − ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, | |
| 1701 | − iov_len); | |
| 1702 | − if (ret < 0) { | |
| 1703 | − DHD_ERROR(("%s failed code %d\n", __func__, | |
| 1704 | − ret)); | |
| 1705 | − } | |
| 1706 | − } else { | |
| 1707 | − ret = -1; | |
| 1708 | − DHD_ERROR(("%s failed code %d\n", __func__, iov_len)); | |
| 1709 | − } | |
| 1710 | − } else | |
| 1711 | − DHD_ERROR(("%s failed code %d\n", __func__, ret)); | |
| 1712 | − | |
| 1713 | − return ret; | |
| 1714 | −} | |
| 1715 | − | |
| 1716 | −int dhd_pno_enable(dhd_pub_t *dhd, int pfn_enabled) | |
| 1717 | −{ | |
| 1718 | − char iovbuf[128]; | |
| 1719 | − int ret = -1; | |
| 1720 | − | |
| 1721 | − if ((!dhd) && ((pfn_enabled != 0) || (pfn_enabled != 1))) { | |
| 1722 | − DHD_ERROR(("%s error exit\n", __func__)); | |
| 1723 | − return ret; | |
| 1724 | − } | |
| 1725 | − | |
| 1726 | − /* Enable/disable PNO */ | |
| 1727 | − ret = bcm_mkiovar("pfn", (char *)&pfn_enabled, 4, iovbuf, | |
| 1728 | − sizeof(iovbuf)); | |
| 1729 | − if (ret > 0) { | |
| 1730 | − ret = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, | |
| 1731 | − sizeof(iovbuf)); | |
| 1732 | − if (ret < 0) { | |
| 1733 | − DHD_ERROR(("%s failed for error=%d\n", __func__, ret)); | |
| 1734 | − return ret; | |
| 1735 | − } else { | |
| 1736 | − dhd->pno_enable = pfn_enabled; | |
| 1737 | − DHD_TRACE(("%s set pno as %d\n", __func__, | |
| 1738 | − dhd->pno_enable)); | |
| 1739 | − } | |
| 1740 | − } else | |
| 1741 | − DHD_ERROR(("%s failed err=%d\n", __func__, ret)); | |
| 1742 | − | |
| 1743 | − return ret; | |
| 1744 | −} | |
| 1745 | − | |
| 1746 | −/* Function to execute combined scan */ | |
| 1747 | −int | |
| 1748 | −dhd_pno_set(dhd_pub_t *dhd, wlc_ssid_t *ssids_local, int nssid, unsigned char scan_fr) | |
| 1749 | −{ | |
| 1750 | − int err = -1; | |
| 1751 | − char iovbuf[128]; | |
| 1752 | − int k, i; | |
| 1753 | − wl_pfn_param_t pfn_param; | |
| 1754 | − wl_pfn_t pfn_element; | |
| 1755 | − | |
| 1756 | − DHD_TRACE(("%s nssid=%d nchan=%d\n", __func__, nssid, scan_fr)); | |
| 1757 | − | |
| 1758 | − if ((!dhd) && (!ssids_local)) { | |
| 1759 | − DHD_ERROR(("%s error exit\n", __func__)); | |
| 1760 | − err = -1; | |
| 1761 | − } | |
| 1762 | − | |
| 1763 | − /* Check for broadcast ssid */ | |
| 1764 | − for (k = 0; k < nssid; k++) { | |
| 1765 | − if (!ssids_local[k].SSID_len) { | |
| 1766 | − DHD_ERROR(("%d: Broadcast SSID is ilegal for PNO " | |
| 1767 | − "setting\n", k)); | |
| 1768 | − return err; | |
| 1769 | − } | |
| 1770 | − } | |
| 1771 | −/* #define PNO_DUMP 1 */ | |
| 1772 | −#ifdef PNO_DUMP | |
| 1773 | − { | |
| 1774 | − int j; | |
| 1775 | − for (j = 0; j < nssid; j++) { | |
| 1776 | − DHD_ERROR(("%d: scan for %s size =%d\n", j, | |
| 1777 | − ssids_local[j].SSID, | |
| 1778 | − ssids_local[j].SSID_len)); | |
| 1779 | − } | |
| 1780 | − } | |
| 1781 | −#endif /* PNO_DUMP */ | |
| 1782 | − | |
| 1783 | − /* clean up everything */ | |
| 1784 | − err = dhd_pno_clean(dhd); | |
| 1785 | − if (err < 0) { | |
| 1786 | − DHD_ERROR(("%s failed error=%d\n", __func__, err)); | |
| 1787 | − return err; | |
| 1788 | − } | |
| 1789 | − memset(&pfn_param, 0, sizeof(pfn_param)); | |
| 1790 | − memset(&pfn_element, 0, sizeof(pfn_element)); | |
| 1791 | − | |
| 1792 | − /* set pfn parameters */ | |
| 1793 | − pfn_param.version = PFN_VERSION; | |
| 1794 | − pfn_param.flags = (PFN_LIST_ORDER << SORT_CRITERIA_BIT); | |
| 1795 | − | |
| 1796 | − /* set up pno scan fr */ | |
| 1797 | − if (scan_fr != 0) | |
| 1798 | − pfn_param.scan_freq = scan_fr; | |
| 1799 | − | |
| 1800 | − bcm_mkiovar("pfn_set", (char *)&pfn_param, sizeof(pfn_param), iovbuf, | |
| 1801 | − sizeof(iovbuf)); | |
| 1802 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, sizeof(iovbuf)); | |
| 1803 | − | |
| 1804 | − /* set all pfn ssid */ | |
| 1805 | − for (i = 0; i < nssid; i++) { | |
| 1806 | − | |
| 1807 | − pfn_element.bss_type = DOT11_BSSTYPE_INFRASTRUCTURE; | |
| 1808 | − pfn_element.auth = WLAN_AUTH_OPEN; | |
| 1809 | − pfn_element.wpa_auth = WPA_AUTH_PFN_ANY; | |
| 1810 | − pfn_element.wsec = 0; | |
| 1811 | − pfn_element.infra = 1; | |
| 1812 | − | |
| 1813 | − memcpy((char *)pfn_element.ssid.SSID, ssids_local[i].SSID, | |
| 1814 | − ssids_local[i].SSID_len); | |
| 1815 | − pfn_element.ssid.SSID_len = ssids_local[i].SSID_len; | |
| 1816 | − | |
| 1817 | − err = bcm_mkiovar("pfn_add", (char *)&pfn_element, | |
| 1818 | − sizeof(pfn_element), iovbuf, sizeof(iovbuf)); | |
| 1819 | − if (err > 0) { | |
| 1820 | − err = dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, | |
| 1821 | − sizeof(iovbuf)); | |
| 1822 | − if (err < 0) { | |
| 1823 | − DHD_ERROR(("%s failed for i=%d error=%d\n", | |
| 1824 | − __func__, i, err)); | |
| 1825 | − return err; | |
| 1826 | − } | |
| 1827 | − } else | |
| 1828 | − DHD_ERROR(("%s failed err=%d\n", __func__, err)); | |
| 1829 | − } | |
| 1830 | − | |
| 1831 | − /* Enable PNO */ | |
| 1832 | − /* dhd_pno_enable(dhd, 1); */ | |
| 1833 | − return err; | |
| 1834 | −} | |
| 1835 | − | |
| 1836 | −int dhd_pno_get_status(dhd_pub_t *dhd) | |
| 1837 | −{ | |
| 1838 | − int ret = -1; | |
| 1839 | − | |
| 1840 | − if (!dhd) | |
| 1841 | − return ret; | |
| 1842 | − else | |
| 1843 | − return dhd->pno_enable; | |
| 1844 | −} | |
| 1845 | − | |
| 1846 | −#endif /* PNO_SUPPORT */ | |
| 1847 | − | |
| 1848 | −/* Androd ComboSCAN support */ | |
| @@ -1,158 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2010 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | − * purpose with or without fee is hereby granted, provided that the above | |
| 6 | − * copyright notice and this permission notice appear in all copies. | |
| 7 | − * | |
| 8 | − * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | − * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | − * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | − * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | − * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | − * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | − * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | − */ | |
| 16 | − | |
| 17 | −#include <linux/netdevice.h> | |
| 18 | −#include <bcmutils.h> | |
| 19 | − | |
| 20 | −#include <dngl_stats.h> | |
| 21 | −#include <dhd.h> | |
| 22 | − | |
| 23 | −#include <wlioctl.h> | |
| 24 | −#include <wl_iw.h> | |
| 25 | − | |
| 26 | −#define WL_ERROR(fmt, args...) printk(fmt, ##args) | |
| 27 | −#define WL_TRACE(fmt, args...) no_printk(fmt, ##args) | |
| 28 | − | |
| 29 | −#ifdef CUSTOMER_HW | |
| 30 | −extern void bcm_wlan_power_off(int); | |
| 31 | −extern void bcm_wlan_power_on(int); | |
| 32 | −#endif /* CUSTOMER_HW */ | |
| 33 | −#ifdef CUSTOMER_HW2 | |
| 34 | −int wifi_set_carddetect(int on); | |
| 35 | −int wifi_set_power(int on, unsigned long msec); | |
| 36 | −int wifi_get_irq_number(unsigned long *irq_flags_ptr); | |
| 37 | −#endif | |
| 38 | − | |
| 39 | −#if defined(OOB_INTR_ONLY) | |
| 40 | − | |
| 41 | −#if defined(BCMLXSDMMC) | |
| 42 | −extern int sdioh_mmc_irq(int irq); | |
| 43 | −#endif /* (BCMLXSDMMC) */ | |
| 44 | − | |
| 45 | −#ifdef CUSTOMER_HW3 | |
| 46 | −#include <mach/gpio.h> | |
| 47 | −#endif | |
| 48 | − | |
| 49 | −/* Customer specific Host GPIO definition */ | |
| 50 | −static int dhd_oob_gpio_num = -1; /* GG 19 */ | |
| 51 | − | |
| 52 | −module_param(dhd_oob_gpio_num, int, 0644); | |
| 53 | −MODULE_PARM_DESC(dhd_oob_gpio_num, "DHD oob gpio number"); | |
| 54 | − | |
| 55 | −int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr) | |
| 56 | −{ | |
| 57 | − int host_oob_irq = 0; | |
| 58 | − | |
| 59 | −#ifdef CUSTOMER_HW2 | |
| 60 | − host_oob_irq = wifi_get_irq_number(irq_flags_ptr); | |
| 61 | − | |
| 62 | −#else /* for NOT CUSTOMER_HW2 */ | |
| 63 | −#if defined(CUSTOM_OOB_GPIO_NUM) | |
| 64 | − if (dhd_oob_gpio_num < 0) | |
| 65 | − dhd_oob_gpio_num = CUSTOM_OOB_GPIO_NUM; | |
| 66 | −#endif | |
| 67 | − | |
| 68 | − if (dhd_oob_gpio_num < 0) { | |
| 69 | − WL_ERROR("%s: ERROR customer specific Host GPIO is NOT defined\n", | |
| 70 | − __func__); | |
| 71 | − return dhd_oob_gpio_num; | |
| 72 | − } | |
| 73 | − | |
| 74 | − WL_ERROR("%s: customer specific Host GPIO number is (%d)\n", | |
| 75 | − __func__, dhd_oob_gpio_num); | |
| 76 | − | |
| 77 | −#if defined CUSTOMER_HW | |
| 78 | − host_oob_irq = MSM_GPIO_TO_INT(dhd_oob_gpio_num); | |
| 79 | −#elif defined CUSTOMER_HW3 | |
| 80 | − gpio_request(dhd_oob_gpio_num, "oob irq"); | |
| 81 | − host_oob_irq = gpio_to_irq(dhd_oob_gpio_num); | |
| 82 | − gpio_direction_input(dhd_oob_gpio_num); | |
| 83 | −#endif /* CUSTOMER_HW */ | |
| 84 | −#endif /* CUSTOMER_HW2 */ | |
| 85 | − | |
| 86 | − return host_oob_irq; | |
| 87 | −} | |
| 88 | −#endif /* defined(OOB_INTR_ONLY) */ | |
| 89 | − | |
| 90 | −/* Customer function to control hw specific wlan gpios */ | |
| 91 | −void dhd_customer_gpio_wlan_ctrl(int onoff) | |
| 92 | −{ | |
| 93 | − switch (onoff) { | |
| 94 | − case WLAN_RESET_OFF: | |
| 95 | − WL_TRACE("%s: call customer specific GPIO to insert WLAN RESET\n", | |
| 96 | − __func__); | |
| 97 | −#ifdef CUSTOMER_HW | |
| 98 | − bcm_wlan_power_off(2); | |
| 99 | −#endif /* CUSTOMER_HW */ | |
| 100 | −#ifdef CUSTOMER_HW2 | |
| 101 | − wifi_set_power(0, 0); | |
| 102 | −#endif | |
| 103 | − WL_ERROR("=========== WLAN placed in RESET ========\n"); | |
| 104 | − break; | |
| 105 | − | |
| 106 | − case WLAN_RESET_ON: | |
| 107 | − WL_TRACE("%s: callc customer specific GPIO to remove WLAN RESET\n", | |
| 108 | − __func__); | |
| 109 | −#ifdef CUSTOMER_HW | |
| 110 | − bcm_wlan_power_on(2); | |
| 111 | −#endif /* CUSTOMER_HW */ | |
| 112 | −#ifdef CUSTOMER_HW2 | |
| 113 | − wifi_set_power(1, 0); | |
| 114 | −#endif | |
| 115 | − WL_ERROR("=========== WLAN going back to live ========\n"); | |
| 116 | − break; | |
| 117 | − | |
| 118 | − case WLAN_POWER_OFF: | |
| 119 | − WL_TRACE("%s: call customer specific GPIO to turn off WL_REG_ON\n", | |
| 120 | − __func__); | |
| 121 | −#ifdef CUSTOMER_HW | |
| 122 | − bcm_wlan_power_off(1); | |
| 123 | −#endif /* CUSTOMER_HW */ | |
| 124 | − break; | |
| 125 | − | |
| 126 | − case WLAN_POWER_ON: | |
| 127 | − WL_TRACE("%s: call customer specific GPIO to turn on WL_REG_ON\n", | |
| 128 | − __func__); | |
| 129 | −#ifdef CUSTOMER_HW | |
| 130 | − bcm_wlan_power_on(1); | |
| 131 | −#endif /* CUSTOMER_HW */ | |
| 132 | − /* Lets customer power to get stable */ | |
| 133 | − udelay(200); | |
| 134 | − break; | |
| 135 | − } | |
| 136 | −} | |
| 137 | − | |
| 138 | −#ifdef GET_CUSTOM_MAC_ENABLE | |
| 139 | −/* Function to get custom MAC address */ | |
| 140 | −int dhd_custom_get_mac_address(unsigned char *buf) | |
| 141 | −{ | |
| 142 | − WL_TRACE("%s Enter\n", __func__); | |
| 143 | − if (!buf) | |
| 144 | − return -EINVAL; | |
| 145 | − | |
| 146 | − /* Customer access to MAC address stored outside of DHD driver */ | |
| 147 | − | |
| 148 | −#ifdef EXAMPLE_GET_MAC | |
| 149 | − /* EXAMPLE code */ | |
| 150 | − { | |
| 151 | − u8 ea_example[ETH_ALEN] = {0x00, 0x11, 0x22, 0x33, 0x44, 0xFF}; | |
| 152 | − memcpy(buf, ea_example, ETH_ALEN); | |
| 153 | − } | |
| 154 | −#endif /* EXAMPLE_GET_MAC */ | |
| 155 | − | |
| 156 | − return 0; | |
| 157 | −} | |
| 158 | −#endif /* GET_CUSTOM_MAC_ENABLE */ | |
| @@ -14,90 +14,57 @@ · 13 unmodified lines | ||
| 14 | 14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | −#ifndef _dhd_dbg_ | |
| 18 | −#define _dhd_dbg_ | |
| 17 | +#ifndef _BRCMF_DBG_H_ | |
| 18 | +#define _BRCMF_DBG_H_ | |
| 19 | 19 | |
| 20 | −#if defined(DHD_DEBUG) | |
| 20 | +#if defined(BCMDBG) | |
| 21 | 21 | |
| 22 | −#define DHD_ERROR(args) \ | |
| 23 | − do {if ((dhd_msg_level & DHD_ERROR_VAL) && (net_ratelimit())) \ | |
| 22 | +#define BRCMF_ERROR(args) \ | |
| 23 | + do {if ((brcmf_msg_level & BRCMF_ERROR_VAL) && (net_ratelimit())) \ | |
| 24 | 24 | printk args; } while (0) |
| 25 | −#define DHD_TRACE(args) do {if (dhd_msg_level & DHD_TRACE_VAL) \ | |
| 25 | +#define BRCMF_TRACE(args) do {if (brcmf_msg_level & BRCMF_TRACE_VAL) \ | |
| 26 | 26 | printk args; } while (0) |
| 27 | −#define DHD_INFO(args) do {if (dhd_msg_level & DHD_INFO_VAL) \ | |
| 27 | +#define BRCMF_INFO(args) do {if (brcmf_msg_level & BRCMF_INFO_VAL) \ | |
| 28 | 28 | printk args; } while (0) |
| 29 | −#define DHD_DATA(args) do {if (dhd_msg_level & DHD_DATA_VAL) \ | |
| 29 | +#define BRCMF_DATA(args) do {if (brcmf_msg_level & BRCMF_DATA_VAL) \ | |
| 30 | 30 | printk args; } while (0) |
| 31 | −#define DHD_CTL(args) do {if (dhd_msg_level & DHD_CTL_VAL) \ | |
| 31 | +#define BRCMF_CTL(args) do {if (brcmf_msg_level & BRCMF_CTL_VAL) \ | |
| 32 | 32 | printk args; } while (0) |
| 33 | −#define DHD_TIMER(args) do {if (dhd_msg_level & DHD_TIMER_VAL) \ | |
| 33 | +#define BRCMF_TIMER(args) do {if (brcmf_msg_level & BRCMF_TIMER_VAL) \ | |
| 34 | 34 | printk args; } while (0) |
| 35 | −#define DHD_HDRS(args) do {if (dhd_msg_level & DHD_HDRS_VAL) \ | |
| 35 | +#define BRCMF_INTR(args) do {if (brcmf_msg_level & BRCMF_INTR_VAL) \ | |
| 36 | 36 | printk args; } while (0) |
| 37 | −#define DHD_BYTES(args) do {if (dhd_msg_level & DHD_BYTES_VAL) \ | |
| 37 | +#define BRCMF_GLOM(args) do {if (brcmf_msg_level & BRCMF_GLOM_VAL) \ | |
| 38 | 38 | printk args; } while (0) |
| 39 | −#define DHD_INTR(args) do {if (dhd_msg_level & DHD_INTR_VAL) \ | |
| 39 | +#define BRCMF_EVENT(args) do {if (brcmf_msg_level & BRCMF_EVENT_VAL) \ | |
| 40 | 40 | printk args; } while (0) |
| 41 | −#define DHD_GLOM(args) do {if (dhd_msg_level & DHD_GLOM_VAL) \ | |
| 42 | − printk args; } while (0) | |
| 43 | −#define DHD_EVENT(args) do {if (dhd_msg_level & DHD_EVENT_VAL) \ | |
| 44 | − printk args; } while (0) | |
| 45 | −#define DHD_BTA(args) do {if (dhd_msg_level & DHD_BTA_VAL) \ | |
| 46 | − printk args; } while (0) | |
| 47 | −#define DHD_ISCAN(args) do {if (dhd_msg_level & DHD_ISCAN_VAL) \ | |
| 48 | − printk args; } while (0) | |
| 49 | − | |
| 50 | −#define DHD_ERROR_ON() (dhd_msg_level & DHD_ERROR_VAL) | |
| 51 | −#define DHD_TRACE_ON() (dhd_msg_level & DHD_TRACE_VAL) | |
| 52 | −#define DHD_INFO_ON() (dhd_msg_level & DHD_INFO_VAL) | |
| 53 | −#define DHD_DATA_ON() (dhd_msg_level & DHD_DATA_VAL) | |
| 54 | −#define DHD_CTL_ON() (dhd_msg_level & DHD_CTL_VAL) | |
| 55 | −#define DHD_TIMER_ON() (dhd_msg_level & DHD_TIMER_VAL) | |
| 56 | −#define DHD_HDRS_ON() (dhd_msg_level & DHD_HDRS_VAL) | |
| 57 | −#define DHD_BYTES_ON() (dhd_msg_level & DHD_BYTES_VAL) | |
| 58 | −#define DHD_INTR_ON() (dhd_msg_level & DHD_INTR_VAL) | |
| 59 | −#define DHD_GLOM_ON() (dhd_msg_level & DHD_GLOM_VAL) | |
| 60 | −#define DHD_EVENT_ON() (dhd_msg_level & DHD_EVENT_VAL) | |
| 61 | −#define DHD_BTA_ON() (dhd_msg_level & DHD_BTA_VAL) | |
| 62 | −#define DHD_ISCAN_ON() (dhd_msg_level & DHD_ISCAN_VAL) | |
| 63 | 41 | |
| 64 | −#else /* (defined BCMDBG) || (defined DHD_DEBUG) */ | |
| 42 | +#define BRCMF_DATA_ON() (brcmf_msg_level & BRCMF_DATA_VAL) | |
| 43 | +#define BRCMF_CTL_ON() (brcmf_msg_level & BRCMF_CTL_VAL) | |
| 44 | +#define BRCMF_HDRS_ON() (brcmf_msg_level & BRCMF_HDRS_VAL) | |
| 45 | +#define BRCMF_BYTES_ON() (brcmf_msg_level & BRCMF_BYTES_VAL) | |
| 46 | +#define BRCMF_GLOM_ON() (brcmf_msg_level & BRCMF_GLOM_VAL) | |
| 65 | 47 | |
| 66 | −#define DHD_ERROR(args) do {if (net_ratelimit()) printk args; } while (0) | |
| 67 | −#define DHD_TRACE(args) | |
| 68 | −#define DHD_INFO(args) | |
| 69 | −#define DHD_DATA(args) | |
| 70 | −#define DHD_CTL(args) | |
| 71 | −#define DHD_TIMER(args) | |
| 72 | −#define DHD_HDRS(args) | |
| 73 | −#define DHD_BYTES(args) | |
| 74 | −#define DHD_INTR(args) | |
| 75 | −#define DHD_GLOM(args) | |
| 76 | −#define DHD_EVENT(args) | |
| 77 | −#define DHD_BTA(args) | |
| 78 | −#define DHD_ISCAN(args) | |
| 48 | +#else /* (defined BCMDBG) || (defined BCMDBG) */ | |
| 79 | 49 | |
| 80 | −#define DHD_ERROR_ON() 0 | |
| 81 | −#define DHD_TRACE_ON() 0 | |
| 82 | −#define DHD_INFO_ON() 0 | |
| 83 | −#define DHD_DATA_ON() 0 | |
| 84 | −#define DHD_CTL_ON() 0 | |
| 85 | −#define DHD_TIMER_ON() 0 | |
| 86 | −#define DHD_HDRS_ON() 0 | |
| 87 | −#define DHD_BYTES_ON() 0 | |
| 88 | −#define DHD_INTR_ON() 0 | |
| 89 | −#define DHD_GLOM_ON() 0 | |
| 90 | −#define DHD_EVENT_ON() 0 | |
| 91 | −#define DHD_BTA_ON() 0 | |
| 92 | −#define DHD_ISCAN_ON() 0 | |
| 93 | −#endif /* defined(DHD_DEBUG) */ | |
| 50 | +#define BRCMF_ERROR(args) do {if (net_ratelimit()) printk args; } while (0) | |
| 51 | +#define BRCMF_TRACE(args) | |
| 52 | +#define BRCMF_INFO(args) | |
| 53 | +#define BRCMF_DATA(args) | |
| 54 | +#define BRCMF_CTL(args) | |
| 55 | +#define BRCMF_TIMER(args) | |
| 56 | +#define BRCMF_INTR(args) | |
| 57 | +#define BRCMF_GLOM(args) | |
| 58 | +#define BRCMF_EVENT(args) | |
| 94 | 59 | |
| 95 | −#define DHD_LOG(args) | |
| 60 | +#define BRCMF_DATA_ON() 0 | |
| 61 | +#define BRCMF_CTL_ON() 0 | |
| 62 | +#define BRCMF_HDRS_ON() 0 | |
| 63 | +#define BRCMF_BYTES_ON() 0 | |
| 64 | +#define BRCMF_GLOM_ON() 0 | |
| 96 | 65 | |
| 97 | −#define DHD_NONE(args) | |
| 98 | −extern int dhd_msg_level; | |
| 66 | +#endif /* defined(BCMDBG) */ | |
| 99 | 67 | |
| 100 | −/* Defines msg bits */ | |
| 101 | −#include <dhdioctl.h> | |
| 68 | +extern int brcmf_msg_level; | |
| 102 | 69 | |
| 103 | −#endif /* _dhd_dbg_ */ | |
| 70 | +#endif /* _BRCMF_DBG_H_ */ | |
| @@ -14,9 +14,6 @@ · 13 unmodified lines | ||
| 14 | 14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | −#ifdef CONFIG_WIFI_CONTROL_FUNC | |
| 18 | −#include <linux/platform_device.h> | |
| 19 | −#endif | |
| 20 | 17 | #include <linux/init.h> |
| 21 | 18 | #include <linux/kernel.h> |
| 22 | 19 | #include <linux/kthread.h> |
| @@ -33,177 +30,32 @@ · 10 unmodified lines | ||
| 33 | 30 | #include <linux/uaccess.h> |
| 34 | 31 | #include <linux/interrupt.h> |
| 35 | 32 | #include <linux/hardirq.h> |
| 36 | −#include <bcmdefs.h> | |
| 37 | −#include <bcmutils.h> | |
| 38 | − | |
| 39 | −#include <dngl_stats.h> | |
| 40 | −#include <dhd.h> | |
| 41 | −#include <dhd_bus.h> | |
| 42 | −#include <dhd_proto.h> | |
| 43 | −#include <dhd_dbg.h> | |
| 44 | − | |
| 45 | −#include <wl_cfg80211.h> | |
| 46 | − | |
| 47 | −#define EPI_VERSION_STR "4.218.248.5" | |
| 48 | −#define ETH_P_BRCM 0x886c | |
| 49 | − | |
| 50 | −#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) | |
| 51 | −#include <linux/wifi_tiwlan.h> | |
| 52 | − | |
| 53 | −struct semaphore wifi_control_sem; | |
| 54 | − | |
| 55 | −struct dhd_bus *g_bus; | |
| 56 | − | |
| 57 | −static struct wifi_platform_data *wifi_control_data; | |
| 58 | −static struct resource *wifi_irqres; | |
| 59 | − | |
| 60 | −int wifi_get_irq_number(unsigned long *irq_flags_ptr) | |
| 61 | −{ | |
| 62 | − if (wifi_irqres) { | |
| 63 | − *irq_flags_ptr = wifi_irqres->flags & IRQF_TRIGGER_MASK; | |
| 64 | − return (int)wifi_irqres->start; | |
| 65 | − } | |
| 66 | −#ifdef CUSTOM_OOB_GPIO_NUM | |
| 67 | − return CUSTOM_OOB_GPIO_NUM; | |
| 68 | −#else | |
| 69 | − return -1; | |
| 70 | −#endif | |
| 71 | −} | |
| 72 | − | |
| 73 | −int wifi_set_carddetect(int on) | |
| 74 | −{ | |
| 75 | − printk(KERN_ERR "%s = %d\n", __func__, on); | |
| 76 | − if (wifi_control_data && wifi_control_data->set_carddetect) | |
| 77 | − wifi_control_data->set_carddetect(on); | |
| 78 | − return 0; | |
| 79 | −} | |
| 80 | − | |
| 81 | −int wifi_set_power(int on, unsigned long msec) | |
| 82 | −{ | |
| 83 | − printk(KERN_ERR "%s = %d\n", __func__, on); | |
| 84 | − if (wifi_control_data && wifi_control_data->set_power) | |
| 85 | − wifi_control_data->set_power(on); | |
| 86 | − if (msec) | |
| 87 | − mdelay(msec); | |
| 88 | − return 0; | |
| 89 | −} | |
| 90 | − | |
| 91 | −int wifi_set_reset(int on, unsigned long msec) | |
| 92 | −{ | |
| 93 | − printk(KERN_ERR "%s = %d\n", __func__, on); | |
| 94 | − if (wifi_control_data && wifi_control_data->set_reset) | |
| 95 | − wifi_control_data->set_reset(on); | |
| 96 | − if (msec) | |
| 97 | − mdelay(msec); | |
| 98 | − return 0; | |
| 99 | −} | |
| 100 | − | |
| 101 | −static int wifi_probe(struct platform_device *pdev) | |
| 102 | −{ | |
| 103 | − struct wifi_platform_data *wifi_ctrl = | |
| 104 | − (struct wifi_platform_data *)(pdev->dev.platform_data); | |
| 105 | − | |
| 106 | − printk(KERN_ERR "## %s\n", __func__); | |
| 107 | − wifi_irqres = | |
| 108 | − platform_get_resource_byname(pdev, IORESOURCE_IRQ, | |
| 109 | − "bcm4329_wlan_irq"); | |
| 110 | − wifi_control_data = wifi_ctrl; | |
| 111 | − | |
| 112 | − wifi_set_power(1, 0); /* Power On */ | |
| 113 | − wifi_set_carddetect(1); /* CardDetect (0->1) */ | |
| 114 | − | |
| 115 | − up(&wifi_control_sem); | |
| 116 | − return 0; | |
| 117 | −} | |
| 118 | − | |
| 119 | −static int wifi_remove(struct platform_device *pdev) | |
| 120 | −{ | |
| 121 | − struct wifi_platform_data *wifi_ctrl = | |
| 122 | − (struct wifi_platform_data *)(pdev->dev.platform_data); | |
| 123 | − | |
| 124 | − printk(KERN_ERR "## %s\n", __func__); | |
| 125 | − wifi_control_data = wifi_ctrl; | |
| 126 | − | |
| 127 | − wifi_set_carddetect(0); /* CardDetect (1->0) */ | |
| 128 | − wifi_set_power(0, 0); /* Power Off */ | |
| 129 | − | |
| 130 | − up(&wifi_control_sem); | |
| 131 | − return 0; | |
| 132 | −} | |
| 133 | − | |
| 134 | −static int wifi_suspend(struct platform_device *pdev, pm_message_t state) | |
| 135 | −{ | |
| 136 | − DHD_TRACE(("##> %s\n", __func__)); | |
| 137 | − return 0; | |
| 138 | −} | |
| 139 | − | |
| 140 | −static int wifi_resume(struct platform_device *pdev) | |
| 141 | −{ | |
| 142 | − DHD_TRACE(("##> %s\n", __func__)); | |
| 143 | − return 0; | |
| 144 | −} | |
| 145 | − | |
| 146 | −static struct platform_driver wifi_device = { | |
| 147 | − .probe = wifi_probe, | |
| 148 | − .remove = wifi_remove, | |
| 149 | − .suspend = wifi_suspend, | |
| 150 | − .resume = wifi_resume, | |
| 151 | − .driver = { | |
| 152 | − .name = KBUILD_MODNAME, | |
| 153 | − } | |
| 154 | −}; | |
| 155 | − | |
| 156 | −int wifi_add_dev(void) | |
| 157 | −{ | |
| 158 | − DHD_TRACE(("## Calling platform_driver_register\n")); | |
| 159 | − return platform_driver_register(&wifi_device); | |
| 160 | −} | |
| 161 | − | |
| 162 | −void wifi_del_dev(void) | |
| 163 | −{ | |
| 164 | − DHD_TRACE(("## Unregister platform_driver_register\n")); | |
| 165 | − platform_driver_unregister(&wifi_device); | |
| 166 | −} | |
| 167 | −#endif /* defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */ | |
| 33 | +#include <net/cfg80211.h> | |
| 34 | +#include <defs.h> | |
| 35 | +#include <brcmu_utils.h> | |
| 36 | +#include <brcmu_wifi.h> | |
| 37 | + | |
| 38 | +#include "dhd.h" | |
| 39 | +#include "dhd_bus.h" | |
| 40 | +#include "dhd_proto.h" | |
| 41 | +#include "dhd_dbg.h" | |
| 42 | +#include "wl_cfg80211.h" | |
| 43 | +#include "bcmchip.h" | |
| 168 | 44 | |
| 169 | 45 | #if defined(CONFIG_PM_SLEEP) |
| 170 | 46 | #include <linux/suspend.h> |
| 171 | −atomic_t dhd_mmc_suspend; | |
| 172 | −DECLARE_WAIT_QUEUE_HEAD(dhd_dpc_wait); | |
| 47 | +atomic_t brcmf_mmc_suspend; | |
| 173 | 48 | #endif /* defined(CONFIG_PM_SLEEP) */ |
| 174 | 49 | |
| 175 | −#if defined(OOB_INTR_ONLY) | |
| 176 | −extern void dhd_enable_oob_intr(struct dhd_bus *bus, bool enable); | |
| 177 | −#endif /* defined(OOB_INTR_ONLY) */ | |
| 178 | − | |
| 179 | 50 | MODULE_AUTHOR("Broadcom Corporation"); |
| 180 | 51 | MODULE_DESCRIPTION("Broadcom 802.11n wireless LAN fullmac driver."); |
| 181 | 52 | MODULE_SUPPORTED_DEVICE("Broadcom 802.11n WLAN fullmac cards"); |
| 182 | 53 | MODULE_LICENSE("Dual BSD/GPL"); |
| 183 | 54 | |
| 184 | −#define DRV_MODULE_NAME "brcmfmac" | |
| 185 | − | |
| 186 | −/* Linux wireless extension support */ | |
| 187 | −#if defined(CONFIG_WIRELESS_EXT) | |
| 188 | −#include <wl_iw.h> | |
| 189 | −extern wl_iw_extra_params_t g_wl_iw_params; | |
| 190 | −#endif /* defined(CONFIG_WIRELESS_EXT) */ | |
| 191 | − | |
| 192 | −#if defined(CONFIG_HAS_EARLYSUSPEND) | |
| 193 | −#include <linux/earlysuspend.h> | |
| 194 | −extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, | |
| 195 | − uint len); | |
| 196 | −#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */ | |
| 197 | − | |
| 198 | −#ifdef PKT_FILTER_SUPPORT | |
| 199 | −extern void dhd_pktfilter_offload_set(dhd_pub_t *dhd, char *arg); | |
| 200 | −extern void dhd_pktfilter_offload_enable(dhd_pub_t *dhd, char *arg, int enable, | |
| 201 | − int master_mode); | |
| 202 | −#endif | |
| 203 | 55 | |
| 204 | 56 | /* Interface control information */ |
| 205 | −typedef struct dhd_if { | |
| 206 | − struct dhd_info *info; /* back pointer to dhd_info */ | |
| 57 | +struct brcmf_if { | |
| 58 | + struct brcmf_info *info; /* back pointer to brcmf_info */ | |
| 207 | 59 | /* OS/stack specifics */ |
| 208 | 60 | struct net_device *net; |
| 209 | 61 | struct net_device_stats stats; |
| @@ -214,33 +66,17 @@ typedef struct dhd_if { · 4 unmodified lines | ||
| 214 | 66 | bool attached; /* Delayed attachment when unset */ |
| 215 | 67 | bool txflowcontrol; /* Per interface flow control indicator */ |
| 216 | 68 | char name[IFNAMSIZ]; /* linux interface name */ |
| 217 | −} dhd_if_t; | |
| 69 | +}; | |
| 218 | 70 | |
| 219 | 71 | /* Local private structure (extension of pub) */ |
| 220 | −typedef struct dhd_info { | |
| 221 | −#if defined(CONFIG_WIRELESS_EXT) | |
| 222 | − wl_iw_t iw; /* wireless extensions state (must be first) */ | |
| 223 | −#endif /* defined(CONFIG_WIRELESS_EXT) */ | |
| 224 | − | |
| 225 | − dhd_pub_t pub; | |
| 72 | +struct brcmf_info { | |
| 73 | + struct brcmf_pub pub; | |
| 226 | 74 | |
| 227 | 75 | /* OS/stack specifics */ |
| 228 | − dhd_if_t *iflist[DHD_MAX_IFS]; | |
| 76 | + struct brcmf_if *iflist[BRCMF_MAX_IFS]; | |
| 229 | 77 | |
| 230 | 78 | struct semaphore proto_sem; |
| 231 | 79 | wait_queue_head_t ioctl_resp_wait; |
| 232 | − struct timer_list timer; | |
| 233 | − bool wd_timer_valid; | |
| 234 | − struct tasklet_struct tasklet; | |
| 235 | − spinlock_t sdlock; | |
| 236 | − spinlock_t txqlock; | |
| 237 | − /* Thread based operation */ | |
| 238 | − bool threads_only; | |
| 239 | − struct semaphore sdsem; | |
| 240 | − struct task_struct *watchdog_tsk; | |
| 241 | − struct semaphore watchdog_sem; | |
| 242 | − struct task_struct *dpc_tsk; | |
| 243 | − struct semaphore dpc_sem; | |
| 244 | 80 | |
| 245 | 81 | /* Thread to issue ioctl for multicast */ |
| 246 | 82 | struct task_struct *sysioc_tsk; |
| @@ -248,83 +84,44 @@ typedef struct dhd_info { · 1 unmodified line | ||
| 248 | 84 | bool set_multicast; |
| 249 | 85 | bool set_macaddress; |
| 250 | 86 | u8 macvalue[ETH_ALEN]; |
| 251 | − wait_queue_head_t ctrl_wait; | |
| 252 | 87 | atomic_t pend_8021x_cnt; |
| 253 | − | |
| 254 | −#ifdef CONFIG_HAS_EARLYSUSPEND | |
| 255 | − struct early_suspend early_suspend; | |
| 256 | −#endif /* CONFIG_HAS_EARLYSUSPEND */ | |
| 257 | −} dhd_info_t; | |
| 258 | − | |
| 259 | −/* Definitions to provide path to the firmware and nvram | |
| 260 | − * example nvram_path[MOD_PARAM_PATHLEN]="/projects/wlan/nvram.txt" | |
| 261 | − */ | |
| 262 | −char firmware_path[MOD_PARAM_PATHLEN]; | |
| 263 | −char nvram_path[MOD_PARAM_PATHLEN]; | |
| 264 | − | |
| 265 | −/* load firmware and/or nvram values from the filesystem */ | |
| 266 | −module_param_string(firmware_path, firmware_path, MOD_PARAM_PATHLEN, 0); | |
| 267 | −module_param_string(nvram_path, nvram_path, MOD_PARAM_PATHLEN, 0); | |
| 88 | +}; | |
| 268 | 89 | |
| 269 | 90 | /* Error bits */ |
| 270 | −module_param(dhd_msg_level, int, 0); | |
| 91 | +module_param(brcmf_msg_level, int, 0); | |
| 271 | 92 | |
| 272 | 93 | /* Spawn a thread for system ioctls (set mac, set mcast) */ |
| 273 | −uint dhd_sysioc = true; | |
| 274 | −module_param(dhd_sysioc, uint, 0); | |
| 275 | − | |
| 276 | −/* Watchdog interval */ | |
| 277 | −uint dhd_watchdog_ms = 10; | |
| 278 | −module_param(dhd_watchdog_ms, uint, 0); | |
| 279 | − | |
| 280 | −#ifdef DHD_DEBUG | |
| 281 | −/* Console poll interval */ | |
| 282 | −uint dhd_console_ms; | |
| 283 | −module_param(dhd_console_ms, uint, 0); | |
| 284 | −#endif /* DHD_DEBUG */ | |
| 94 | +uint brcmf_sysioc = true; | |
| 95 | +module_param(brcmf_sysioc, uint, 0); | |
| 285 | 96 | |
| 286 | 97 | /* ARP offload agent mode : Enable ARP Host Auto-Reply |
| 287 | 98 | and ARP Peer Auto-Reply */ |
| 288 | −uint dhd_arp_mode = 0xb; | |
| 289 | −module_param(dhd_arp_mode, uint, 0); | |
| 99 | +uint brcmf_arp_mode = 0xb; | |
| 100 | +module_param(brcmf_arp_mode, uint, 0); | |
| 290 | 101 | |
| 291 | 102 | /* ARP offload enable */ |
| 292 | −uint dhd_arp_enable = true; | |
| 293 | −module_param(dhd_arp_enable, uint, 0); | |
| 103 | +uint brcmf_arp_enable = true; | |
| 104 | +module_param(brcmf_arp_enable, uint, 0); | |
| 294 | 105 | |
| 295 | 106 | /* Global Pkt filter enable control */ |
| 296 | −uint dhd_pkt_filter_enable = true; | |
| 297 | −module_param(dhd_pkt_filter_enable, uint, 0); | |
| 107 | +uint brcmf_pkt_filter_enable = true; | |
| 108 | +module_param(brcmf_pkt_filter_enable, uint, 0); | |
| 298 | 109 | |
| 299 | 110 | /* Pkt filter init setup */ |
| 300 | −uint dhd_pkt_filter_init; | |
| 301 | −module_param(dhd_pkt_filter_init, uint, 0); | |
| 111 | +uint brcmf_pkt_filter_init; | |
| 112 | +module_param(brcmf_pkt_filter_init, uint, 0); | |
| 302 | 113 | |
| 303 | 114 | /* Pkt filter mode control */ |
| 304 | −uint dhd_master_mode = true; | |
| 305 | −module_param(dhd_master_mode, uint, 1); | |
| 306 | − | |
| 307 | −/* Watchdog thread priority, -1 to use kernel timer */ | |
| 308 | −int dhd_watchdog_prio = 97; | |
| 309 | −module_param(dhd_watchdog_prio, int, 0); | |
| 310 | − | |
| 311 | −/* DPC thread priority, -1 to use tasklet */ | |
| 312 | −int dhd_dpc_prio = 98; | |
| 313 | −module_param(dhd_dpc_prio, int, 0); | |
| 115 | +uint brcmf_master_mode = true; | |
| 116 | +module_param(brcmf_master_mode, uint, 0); | |
| 314 | 117 | |
| 315 | −/* DPC thread priority, -1 to use tasklet */ | |
| 316 | −extern int dhd_dongle_memsize; | |
| 317 | −module_param(dhd_dongle_memsize, int, 0); | |
| 118 | +module_param(brcmf_dongle_memsize, int, 0); | |
| 318 | 119 | |
| 319 | 120 | /* Contorl fw roaming */ |
| 320 | −#ifdef CUSTOMER_HW2 | |
| 321 | −uint dhd_roam; | |
| 322 | −#else | |
| 323 | −uint dhd_roam = 1; | |
| 324 | −#endif | |
| 121 | +uint brcmf_roam = 1; | |
| 325 | 122 | |
| 326 | 123 | /* Control radio state */ |
| 327 | −uint dhd_radio_up = 1; | |
| 124 | +uint brcmf_radio_up = 1; | |
| 328 | 125 | |
| 329 | 126 | /* Network inteface name */ |
| 330 | 127 | char iface_name[IFNAMSIZ] = "wlan"; |
| @@ -333,252 +130,58 @@ module_param_string(iface_name, iface_name, IFNAMSIZ, 0); · 2 unmodified lines | ||
| 333 | 130 | /* The following are specific to the SDIO dongle */ |
| 334 | 131 | |
| 335 | 132 | /* IOCTL response timeout */ |
| 336 | −int dhd_ioctl_timeout_msec = IOCTL_RESP_TIMEOUT; | |
| 133 | +int brcmf_ioctl_timeout_msec = IOCTL_RESP_TIMEOUT; | |
| 337 | 134 | |
| 338 | 135 | /* Idle timeout for backplane clock */ |
| 339 | −int dhd_idletime = DHD_IDLETIME_TICKS; | |
| 340 | −module_param(dhd_idletime, int, 0); | |
| 136 | +int brcmf_idletime = BRCMF_IDLETIME_TICKS; | |
| 137 | +module_param(brcmf_idletime, int, 0); | |
| 341 | 138 | |
| 342 | 139 | /* Use polling */ |
| 343 | −uint dhd_poll = false; | |
| 344 | −module_param(dhd_poll, uint, 0); | |
| 345 | − | |
| 346 | −/* Use cfg80211 */ | |
| 347 | −uint dhd_cfg80211 = true; | |
| 348 | −module_param(dhd_cfg80211, uint, 0); | |
| 140 | +uint brcmf_poll; | |
| 141 | +module_param(brcmf_poll, uint, 0); | |
| 349 | 142 | |
| 350 | 143 | /* Use interrupts */ |
| 351 | −uint dhd_intr = true; | |
| 352 | −module_param(dhd_intr, uint, 0); | |
| 144 | +uint brcmf_intr = true; | |
| 145 | +module_param(brcmf_intr, uint, 0); | |
| 353 | 146 | |
| 354 | 147 | /* SDIO Drive Strength (in milliamps) */ |
| 355 | −uint dhd_sdiod_drive_strength = 6; | |
| 356 | −module_param(dhd_sdiod_drive_strength, uint, 0); | |
| 148 | +uint brcmf_sdiod_drive_strength = 6; | |
| 149 | +module_param(brcmf_sdiod_drive_strength, uint, 0); | |
| 357 | 150 | |
| 358 | 151 | /* Tx/Rx bounds */ |
| 359 | −extern uint dhd_txbound; | |
| 360 | −extern uint dhd_rxbound; | |
| 361 | −module_param(dhd_txbound, uint, 0); | |
| 362 | −module_param(dhd_rxbound, uint, 0); | |
| 363 | − | |
| 364 | −/* Deferred transmits */ | |
| 365 | −extern uint dhd_deferred_tx; | |
| 366 | −module_param(dhd_deferred_tx, uint, 0); | |
| 152 | +module_param(brcmf_txbound, uint, 0); | |
| 153 | +module_param(brcmf_rxbound, uint, 0); | |
| 367 | 154 | |
| 368 | 155 | #ifdef SDTEST |
| 369 | 156 | /* Echo packet generator (pkts/s) */ |
| 370 | −uint dhd_pktgen; | |
| 371 | −module_param(dhd_pktgen, uint, 0); | |
| 157 | +uint brcmf_pktgen; | |
| 158 | +module_param(brcmf_pktgen, uint, 0); | |
| 372 | 159 | |
| 373 | 160 | /* Echo packet len (0 => sawtooth, max 2040) */ |
| 374 | −uint dhd_pktgen_len; | |
| 375 | −module_param(dhd_pktgen_len, uint, 0); | |
| 376 | −#endif | |
| 377 | − | |
| 378 | −#define FAVORITE_WIFI_CP (!!dhd_cfg80211) | |
| 379 | −#define IS_CFG80211_FAVORITE() FAVORITE_WIFI_CP | |
| 380 | −#define DBG_CFG80211_GET() ((dhd_cfg80211 & WL_DBG_MASK) >> 1) | |
| 381 | −#define NO_FW_REQ() (dhd_cfg80211 & 0x80) | |
| 382 | − | |
| 383 | −/* Version string to report */ | |
| 384 | −#ifdef DHD_DEBUG | |
| 385 | −#define DHD_COMPILED "\nCompiled in " SRCBASE | |
| 386 | −#else | |
| 387 | −#define DHD_COMPILED | |
| 161 | +uint brcmf_pktgen_len; | |
| 162 | +module_param(brcmf_pktgen_len, uint, 0); | |
| 388 | 163 | #endif |
| 389 | 164 | |
| 390 | −static void dhd_dpc(unsigned long data); | |
| 391 | −/* forward decl */ | |
| 392 | −extern int dhd_wait_pend8021x(struct net_device *dev); | |
| 393 | − | |
| 394 | −#ifdef TOE | |
| 395 | −#ifndef BDC | |
| 396 | −#error TOE requires BDC | |
| 397 | −#endif /* !BDC */ | |
| 398 | −static int dhd_toe_get(dhd_info_t *dhd, int idx, u32 *toe_ol); | |
| 399 | −static int dhd_toe_set(dhd_info_t *dhd, int idx, u32 toe_ol); | |
| 400 | −#endif /* TOE */ | |
| 401 | − | |
| 402 | −static int dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata, | |
| 403 | − wl_event_msg_t *event_ptr, void **data_ptr); | |
| 404 | − | |
| 405 | −#if defined(CONFIG_PM_SLEEP) | |
| 406 | −static int dhd_sleep_pm_callback(struct notifier_block *nfb, | |
| 407 | − unsigned long action, void *ignored) | |
| 408 | −{ | |
| 409 | − switch (action) { | |
| 410 | − case PM_HIBERNATION_PREPARE: | |
| 411 | − case PM_SUSPEND_PREPARE: | |
| 412 | − atomic_set(&dhd_mmc_suspend, true); | |
| 413 | − return NOTIFY_OK; | |
| 414 | − case PM_POST_HIBERNATION: | |
| 415 | − case PM_POST_SUSPEND: | |
| 416 | − atomic_set(&dhd_mmc_suspend, false); | |
| 417 | − return NOTIFY_OK; | |
| 418 | − } | |
| 419 | − return 0; | |
| 420 | −} | |
| 421 | − | |
| 422 | −static struct notifier_block dhd_sleep_pm_notifier = { | |
| 423 | − .notifier_call = dhd_sleep_pm_callback, | |
| 424 | − .priority = 0 | |
| 425 | −}; | |
| 426 | − | |
| 427 | −extern int register_pm_notifier(struct notifier_block *nb); | |
| 428 | −extern int unregister_pm_notifier(struct notifier_block *nb); | |
| 429 | −#endif /* defined(CONFIG_PM_SLEEP) */ | |
| 430 | − /* && defined(DHD_GPL) */ | |
| 431 | −static void dhd_set_packet_filter(int value, dhd_pub_t *dhd) | |
| 432 | −{ | |
| 433 | −#ifdef PKT_FILTER_SUPPORT | |
| 434 | − DHD_TRACE(("%s: %d\n", __func__, value)); | |
| 435 | − /* 1 - Enable packet filter, only allow unicast packet to send up */ | |
| 436 | − /* 0 - Disable packet filter */ | |
| 437 | − if (dhd_pkt_filter_enable) { | |
| 438 | − int i; | |
| 439 | − | |
| 440 | − for (i = 0; i < dhd->pktfilter_count; i++) { | |
| 441 | − dhd_pktfilter_offload_set(dhd, dhd->pktfilter[i]); | |
| 442 | − dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i], | |
| 443 | − value, dhd_master_mode); | |
| 444 | − } | |
| 445 | − } | |
| 446 | −#endif | |
| 447 | −} | |
| 448 | − | |
| 449 | −#if defined(CONFIG_HAS_EARLYSUSPEND) | |
| 450 | −static int dhd_set_suspend(int value, dhd_pub_t *dhd) | |
| 451 | −{ | |
| 452 | − int power_mode = PM_MAX; | |
| 453 | − /* wl_pkt_filter_enable_t enable_parm; */ | |
| 454 | − char iovbuf[32]; | |
| 455 | − int bcn_li_dtim = 3; | |
| 456 | −#ifdef CUSTOMER_HW2 | |
| 457 | − uint roamvar = 1; | |
| 458 | −#endif /* CUSTOMER_HW2 */ | |
| 459 | − | |
| 460 | − DHD_TRACE(("%s: enter, value = %d in_suspend=%d\n", | |
| 461 | − __func__, value, dhd->in_suspend)); | |
| 462 | − | |
| 463 | − if (dhd && dhd->up) { | |
| 464 | − if (value && dhd->in_suspend) { | |
| 465 | − | |
| 466 | − /* Kernel suspended */ | |
| 467 | − DHD_TRACE(("%s: force extra Suspend setting\n", | |
| 468 | − __func__)); | |
| 469 | − | |
| 470 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_PM, | |
| 471 | − (char *)&power_mode, | |
| 472 | − sizeof(power_mode)); | |
| 473 | − | |
| 474 | − /* Enable packet filter, only allow unicast | |
| 475 | − packet to send up */ | |
| 476 | − dhd_set_packet_filter(1, dhd); | |
| 477 | − | |
| 478 | − /* if dtim skip setup as default force it | |
| 479 | − * to wake each third dtim | |
| 480 | − * for better power saving. | |
| 481 | − * Note that side effect is chance to miss BC/MC | |
| 482 | − * packet | |
| 483 | − */ | |
| 484 | − if ((dhd->dtim_skip == 0) || (dhd->dtim_skip == 1)) | |
| 485 | − bcn_li_dtim = 3; | |
| 486 | − else | |
| 487 | − bcn_li_dtim = dhd->dtim_skip; | |
| 488 | − bcm_mkiovar("bcn_li_dtim", (char *)&bcn_li_dtim, | |
| 489 | − 4, iovbuf, sizeof(iovbuf)); | |
| 490 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, | |
| 491 | − sizeof(iovbuf)); | |
| 492 | −#ifdef CUSTOMER_HW2 | |
| 493 | − /* Disable build-in roaming to allowed \ | |
| 494 | − * supplicant to take of romaing | |
| 495 | − */ | |
| 496 | − bcm_mkiovar("roam_off", (char *)&roamvar, 4, | |
| 497 | − iovbuf, sizeof(iovbuf)); | |
| 498 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, | |
| 499 | − sizeof(iovbuf)); | |
| 500 | −#endif /* CUSTOMER_HW2 */ | |
| 501 | − } else { | |
| 502 | − | |
| 503 | − /* Kernel resumed */ | |
| 504 | − DHD_TRACE(("%s: Remove extra suspend setting\n", | |
| 505 | − __func__)); | |
| 506 | − | |
| 507 | − power_mode = PM_FAST; | |
| 508 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_PM, | |
| 509 | − (char *)&power_mode, | |
| 510 | − sizeof(power_mode)); | |
| 511 | − | |
| 512 | − /* disable pkt filter */ | |
| 513 | − dhd_set_packet_filter(0, dhd); | |
| 514 | − | |
| 515 | − /* restore pre-suspend setting for dtim_skip */ | |
| 516 | − bcm_mkiovar("bcn_li_dtim", (char *)&dhd->dtim_skip, | |
| 517 | − 4, iovbuf, sizeof(iovbuf)); | |
| 518 | − | |
| 519 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, | |
| 520 | − sizeof(iovbuf)); | |
| 521 | −#ifdef CUSTOMER_HW2 | |
| 522 | − roamvar = 0; | |
| 523 | − bcm_mkiovar("roam_off", (char *)&roamvar, 4, iovbuf, | |
| 524 | − sizeof(iovbuf)); | |
| 525 | − dhdcdc_set_ioctl(dhd, 0, WLC_SET_VAR, iovbuf, | |
| 526 | − sizeof(iovbuf)); | |
| 527 | −#endif /* CUSTOMER_HW2 */ | |
| 528 | − } | |
| 529 | − } | |
| 530 | − | |
| 531 | − return 0; | |
| 532 | −} | |
| 533 | − | |
| 534 | −static void dhd_suspend_resume_helper(struct dhd_info *dhd, int val) | |
| 535 | −{ | |
| 536 | − dhd_pub_t *dhdp = &dhd->pub; | |
| 537 | − | |
| 538 | − dhd_os_proto_block(dhdp); | |
| 539 | − /* Set flag when early suspend was called */ | |
| 540 | − dhdp->in_suspend = val; | |
| 541 | − if (!dhdp->suspend_disable_flag) | |
| 542 | − dhd_set_suspend(val, dhdp); | |
| 543 | − dhd_os_proto_unblock(dhdp); | |
| 544 | −} | |
| 545 | − | |
| 546 | −static void dhd_early_suspend(struct early_suspend *h) | |
| 547 | −{ | |
| 548 | − struct dhd_info *dhd = container_of(h, struct dhd_info, early_suspend); | |
| 549 | − | |
| 550 | − DHD_TRACE(("%s: enter\n", __func__)); | |
| 551 | − | |
| 552 | − if (dhd) | |
| 553 | − dhd_suspend_resume_helper(dhd, 1); | |
| 554 | − | |
| 555 | −} | |
| 556 | − | |
| 557 | −static void dhd_late_resume(struct early_suspend *h) | |
| 558 | −{ | |
| 559 | − struct dhd_info *dhd = container_of(h, struct dhd_info, early_suspend); | |
| 560 | − | |
| 561 | − DHD_TRACE(("%s: enter\n", __func__)); | |
| 562 | − | |
| 563 | − if (dhd) | |
| 564 | − dhd_suspend_resume_helper(dhd, 0); | |
| 565 | −} | |
| 566 | −#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */ | |
| 165 | +static int brcmf_toe_get(struct brcmf_info *drvr_priv, int idx, u32 *toe_ol); | |
| 166 | +static int brcmf_toe_set(struct brcmf_info *drvr_priv, int idx, u32 toe_ol); | |
| 167 | +static int brcmf_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata, | |
| 168 | + struct brcmf_event_msg *event_ptr, | |
| 169 | + void **data_ptr); | |
| 567 | 170 | |
| 568 | 171 | /* |
| 569 | 172 | * Generalized timeout mechanism. Uses spin sleep with exponential |
| 570 | 173 | * back-off until |
| 571 | 174 | * the sleep time reaches one jiffy, then switches over to task delay. Usage: |
| 572 | 175 | * |
| 573 | − * dhd_timeout_start(&tmo, usec); | |
| 574 | − * while (!dhd_timeout_expired(&tmo)) | |
| 176 | + * brcmf_timeout_start(&tmo, usec); | |
| 177 | + * while (!brcmf_timeout_expired(&tmo)) | |
| 575 | 178 | * if (poll_something()) |
| 576 | 179 | * break; |
| 577 | − * if (dhd_timeout_expired(&tmo)) | |
| 180 | + * if (brcmf_timeout_expired(&tmo)) | |
| 578 | 181 | * fatal(); |
| 579 | 182 | */ |
| 580 | 183 | |
| 581 | −void dhd_timeout_start(dhd_timeout_t *tmo, uint usec) | |
| 184 | +void brcmf_timeout_start(struct brcmf_timeout *tmo, uint usec) | |
| 582 | 185 | { |
| 583 | 186 | tmo->limit = usec; |
| 584 | 187 | tmo->increment = 0; |
| @@ -586,7 +189,7 @@ void dhd_timeout_start(dhd_timeout_t *tmo, uint usec) · 1 unmodified line | ||
| 586 | 189 | tmo->tick = 1000000 / HZ; |
| 587 | 190 | } |
| 588 | 191 | |
| 589 | −int dhd_timeout_expired(dhd_timeout_t *tmo) | |
| 192 | +int brcmf_timeout_expired(struct brcmf_timeout *tmo) | |
| 590 | 193 | { |
| 591 | 194 | /* Does nothing the first call */ |
| 592 | 195 | if (tmo->increment == 0) { |
| @@ -623,74 +226,68 @@ int dhd_timeout_expired(dhd_timeout_t *tmo) · 30 unmodified lines | ||
| 623 | 226 | return 0; |
| 624 | 227 | } |
| 625 | 228 | |
| 626 | −static int dhd_net2idx(dhd_info_t *dhd, struct net_device *net) | |
| 229 | +static int brcmf_net2idx(struct brcmf_info *drvr_priv, struct net_device *net) | |
| 627 | 230 | { |
| 628 | 231 | int i = 0; |
| 629 | 232 | |
| 630 | − ASSERT(dhd); | |
| 631 | − while (i < DHD_MAX_IFS) { | |
| 632 | − if (dhd->iflist[i] && (dhd->iflist[i]->net == net)) | |
| 233 | + while (i < BRCMF_MAX_IFS) { | |
| 234 | + if (drvr_priv->iflist[i] && (drvr_priv->iflist[i]->net == net)) | |
| 633 | 235 | return i; |
| 634 | 236 | i++; |
| 635 | 237 | } |
| 636 | 238 | |
| 637 | − return DHD_BAD_IF; | |
| 239 | + return BRCMF_BAD_IF; | |
| 638 | 240 | } |
| 639 | 241 | |
| 640 | −int dhd_ifname2idx(dhd_info_t *dhd, char *name) | |
| 242 | +int brcmf_ifname2idx(struct brcmf_info *drvr_priv, char *name) | |
| 641 | 243 | { |
| 642 | − int i = DHD_MAX_IFS; | |
| 643 | − | |
| 644 | − ASSERT(dhd); | |
| 244 | + int i = BRCMF_MAX_IFS; | |
| 645 | 245 | |
| 646 | 246 | if (name == NULL || *name == '\0') |
| 647 | 247 | return 0; |
| 648 | 248 | |
| 649 | 249 | while (--i > 0) |
| 650 | − if (dhd->iflist[i] | |
| 651 | − && !strncmp(dhd->iflist[i]->name, name, IFNAMSIZ)) | |
| 250 | + if (drvr_priv->iflist[i] | |
| 251 | + && !strncmp(drvr_priv->iflist[i]->name, name, IFNAMSIZ)) | |
| 652 | 252 | break; |
| 653 | 253 | |
| 654 | − DHD_TRACE(("%s: return idx %d for \"%s\"\n", __func__, i, name)); | |
| 254 | + BRCMF_TRACE(("%s: return idx %d for \"%s\"\n", __func__, i, name)); | |
| 655 | 255 | |
| 656 | 256 | return i; /* default - the primary interface */ |
| 657 | 257 | } |
| 658 | 258 | |
| 659 | −char *dhd_ifname(dhd_pub_t *dhdp, int ifidx) | |
| 259 | +char *brcmf_ifname(struct brcmf_pub *drvr, int ifidx) | |
| 660 | 260 | { |
| 661 | − dhd_info_t *dhd = (dhd_info_t *) dhdp->info; | |
| 662 | − | |
| 663 | − ASSERT(dhd); | |
| 261 | + struct brcmf_info *drvr_priv = drvr->info; | |
| 664 | 262 | |
| 665 | − if (ifidx < 0 || ifidx >= DHD_MAX_IFS) { | |
| 666 | − DHD_ERROR(("%s: ifidx %d out of range\n", __func__, ifidx)); | |
| 263 | + if (ifidx < 0 || ifidx >= BRCMF_MAX_IFS) { | |
| 264 | + BRCMF_ERROR(("%s: ifidx %d out of range\n", __func__, ifidx)); | |
| 667 | 265 | return "<if_bad>"; |
| 668 | 266 | } |
| 669 | 267 | |
| 670 | − if (dhd->iflist[ifidx] == NULL) { | |
| 671 | − DHD_ERROR(("%s: null i/f %d\n", __func__, ifidx)); | |
| 268 | + if (drvr_priv->iflist[ifidx] == NULL) { | |
| 269 | + BRCMF_ERROR(("%s: null i/f %d\n", __func__, ifidx)); | |
| 672 | 270 | return "<if_null>"; |
| 673 | 271 | } |
| 674 | 272 | |
| 675 | − if (dhd->iflist[ifidx]->net) | |
| 676 | − return dhd->iflist[ifidx]->net->name; | |
| 273 | + if (drvr_priv->iflist[ifidx]->net) | |
| 274 | + return drvr_priv->iflist[ifidx]->net->name; | |
| 677 | 275 | |
| 678 | 276 | return "<if_none>"; |
| 679 | 277 | } |
| 680 | 278 | |
| 681 | −static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) | |
| 279 | +static void _brcmf_set_multicast_list(struct brcmf_info *drvr_priv, int ifidx) | |
| 682 | 280 | { |
| 683 | 281 | struct net_device *dev; |
| 684 | 282 | struct netdev_hw_addr *ha; |
| 685 | 283 | u32 allmulti, cnt; |
| 686 | 284 | |
| 687 | − wl_ioctl_t ioc; | |
| 285 | + struct brcmf_ioctl ioc; | |
| 688 | 286 | char *buf, *bufp; |
| 689 | 287 | uint buflen; |
| 690 | 288 | int ret; |
| 691 | 289 | |
| 692 | − ASSERT(dhd && dhd->iflist[ifidx]); | |
| 693 | − dev = dhd->iflist[ifidx]->net; | |
| 290 | + dev = drvr_priv->iflist[ifidx]->net; | |
| 694 | 291 | cnt = netdev_mc_count(dev); |
| 695 | 292 | |
| 696 | 293 | /* Determine initial value of allmulti flag */ |
| @@ -701,8 +298,8 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) · 4 unmodified lines | ||
| 701 | 298 | buflen = sizeof("mcast_list") + sizeof(cnt) + (cnt * ETH_ALEN); |
| 702 | 299 | bufp = buf = kmalloc(buflen, GFP_ATOMIC); |
| 703 | 300 | if (!bufp) { |
| 704 | − DHD_ERROR(("%s: out of memory for mcast_list, cnt %d\n", | |
| 705 | − dhd_ifname(&dhd->pub, ifidx), cnt)); | |
| 301 | + BRCMF_ERROR(("%s: out of memory for mcast_list, cnt %d\n", | |
| 302 | + brcmf_ifname(&drvr_priv->pub, ifidx), cnt)); | |
| 706 | 303 | return; |
| 707 | 304 | } |
| 708 | 305 | |
| @@ -722,15 +319,15 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) · 13 unmodified lines | ||
| 722 | 319 | } |
| 723 | 320 | |
| 724 | 321 | memset(&ioc, 0, sizeof(ioc)); |
| 725 | − ioc.cmd = WLC_SET_VAR; | |
| 322 | + ioc.cmd = BRCMF_C_SET_VAR; | |
| 726 | 323 | ioc.buf = buf; |
| 727 | 324 | ioc.len = buflen; |
| 728 | 325 | ioc.set = true; |
| 729 | 326 | |
| 730 | − ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 327 | + ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 731 | 328 | if (ret < 0) { |
| 732 | − DHD_ERROR(("%s: set mcast_list failed, cnt %d\n", | |
| 733 | − dhd_ifname(&dhd->pub, ifidx), cnt)); | |
| 329 | + BRCMF_ERROR(("%s: set mcast_list failed, cnt %d\n", | |
| 330 | + brcmf_ifname(&drvr_priv->pub, ifidx), cnt)); | |
| 734 | 331 | allmulti = cnt ? true : allmulti; |
| 735 | 332 | } |
| 736 | 333 | |
| @@ -744,32 +341,33 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) · 7 unmodified lines | ||
| 744 | 341 | buflen = sizeof("allmulti") + sizeof(allmulti); |
| 745 | 342 | buf = kmalloc(buflen, GFP_ATOMIC); |
| 746 | 343 | if (!buf) { |
| 747 | − DHD_ERROR(("%s: out of memory for allmulti\n", | |
| 748 | − dhd_ifname(&dhd->pub, ifidx))); | |
| 344 | + BRCMF_ERROR(("%s: out of memory for allmulti\n", | |
| 345 | + brcmf_ifname(&drvr_priv->pub, ifidx))); | |
| 749 | 346 | return; |
| 750 | 347 | } |
| 751 | 348 | allmulti = cpu_to_le32(allmulti); |
| 752 | 349 | |
| 753 | − if (!bcm_mkiovar | |
| 350 | + if (!brcmu_mkiovar | |
| 754 | 351 | ("allmulti", (void *)&allmulti, sizeof(allmulti), buf, buflen)) { |
| 755 | − DHD_ERROR(("%s: mkiovar failed for allmulti, datalen %d " | |
| 756 | − "buflen %u\n", dhd_ifname(&dhd->pub, ifidx), | |
| 757 | − (int)sizeof(allmulti), buflen)); | |
| 352 | + BRCMF_ERROR(("%s: mkiovar failed for allmulti, datalen %d " | |
| 353 | + "buflen %u\n", | |
| 354 | + brcmf_ifname(&drvr_priv->pub, ifidx), | |
| 355 | + (int)sizeof(allmulti), buflen)); | |
| 758 | 356 | kfree(buf); |
| 759 | 357 | return; |
| 760 | 358 | } |
| 761 | 359 | |
| 762 | 360 | memset(&ioc, 0, sizeof(ioc)); |
| 763 | − ioc.cmd = WLC_SET_VAR; | |
| 361 | + ioc.cmd = BRCMF_C_SET_VAR; | |
| 764 | 362 | ioc.buf = buf; |
| 765 | 363 | ioc.len = buflen; |
| 766 | 364 | ioc.set = true; |
| 767 | 365 | |
| 768 | − ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 366 | + ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 769 | 367 | if (ret < 0) { |
| 770 | − DHD_ERROR(("%s: set allmulti %d failed\n", | |
| 771 | − dhd_ifname(&dhd->pub, ifidx), | |
| 772 | − le32_to_cpu(allmulti))); | |
| 368 | + BRCMF_ERROR(("%s: set allmulti %d failed\n", | |
| 369 | + brcmf_ifname(&drvr_priv->pub, ifidx), | |
| 370 | + le32_to_cpu(allmulti))); | |
| 773 | 371 | } |
| 774 | 372 | |
| 775 | 373 | kfree(buf); |
| @@ -781,45 +379,44 @@ static void _dhd_set_multicast_list(dhd_info_t *dhd, int ifidx) · 5 unmodified lines | ||
| 781 | 379 | allmulti = cpu_to_le32(allmulti); |
| 782 | 380 | |
| 783 | 381 | memset(&ioc, 0, sizeof(ioc)); |
| 784 | − ioc.cmd = WLC_SET_PROMISC; | |
| 382 | + ioc.cmd = BRCMF_C_SET_PROMISC; | |
| 785 | 383 | ioc.buf = &allmulti; |
| 786 | 384 | ioc.len = sizeof(allmulti); |
| 787 | 385 | ioc.set = true; |
| 788 | 386 | |
| 789 | − ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 387 | + ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 790 | 388 | if (ret < 0) { |
| 791 | − DHD_ERROR(("%s: set promisc %d failed\n", | |
| 792 | − dhd_ifname(&dhd->pub, ifidx), | |
| 793 | − le32_to_cpu(allmulti))); | |
| 389 | + BRCMF_ERROR(("%s: set promisc %d failed\n", | |
| 390 | + brcmf_ifname(&drvr_priv->pub, ifidx), | |
| 391 | + le32_to_cpu(allmulti))); | |
| 794 | 392 | } |
| 795 | 393 | } |
| 796 | 394 | |
| 797 | −static int | |
| 798 | −_dhd_set_mac_address(dhd_info_t *dhd, int ifidx, u8 *addr) | |
| 395 | +static int _brcmf_set_mac_address(struct brcmf_info *drvr_priv, int ifidx, u8 *addr) | |
| 799 | 396 | { |
| 800 | 397 | char buf[32]; |
| 801 | − wl_ioctl_t ioc; | |
| 398 | + struct brcmf_ioctl ioc; | |
| 802 | 399 | int ret; |
| 803 | 400 | |
| 804 | − DHD_TRACE(("%s enter\n", __func__)); | |
| 805 | − if (!bcm_mkiovar | |
| 401 | + BRCMF_TRACE(("%s enter\n", __func__)); | |
| 402 | + if (!brcmu_mkiovar | |
| 806 | 403 | ("cur_etheraddr", (char *)addr, ETH_ALEN, buf, 32)) { |
| 807 | − DHD_ERROR(("%s: mkiovar failed for cur_etheraddr\n", | |
| 808 | − dhd_ifname(&dhd->pub, ifidx))); | |
| 404 | + BRCMF_ERROR(("%s: mkiovar failed for cur_etheraddr\n", | |
| 405 | + brcmf_ifname(&drvr_priv->pub, ifidx))); | |
| 809 | 406 | return -1; |
| 810 | 407 | } |
| 811 | 408 | memset(&ioc, 0, sizeof(ioc)); |
| 812 | − ioc.cmd = WLC_SET_VAR; | |
| 409 | + ioc.cmd = BRCMF_C_SET_VAR; | |
| 813 | 410 | ioc.buf = buf; |
| 814 | 411 | ioc.len = 32; |
| 815 | 412 | ioc.set = true; |
| 816 | 413 | |
| 817 | − ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 414 | + ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 818 | 415 | if (ret < 0) { |
| 819 | − DHD_ERROR(("%s: set cur_etheraddr failed\n", | |
| 820 | − dhd_ifname(&dhd->pub, ifidx))); | |
| 416 | + BRCMF_ERROR(("%s: set cur_etheraddr failed\n", | |
| 417 | + brcmf_ifname(&drvr_priv->pub, ifidx))); | |
| 821 | 418 | } else { |
| 822 | − memcpy(dhd->iflist[ifidx]->net->dev_addr, addr, ETH_ALEN); | |
| 419 | + memcpy(drvr_priv->iflist[ifidx]->net->dev_addr, addr, ETH_ALEN); | |
| 823 | 420 | } |
| 824 | 421 | |
| 825 | 422 | return ret; |
| @@ -829,45 +426,44 @@ _dhd_set_mac_address(dhd_info_t *dhd, int ifidx, u8 *addr) · 3 unmodified lines | ||
| 829 | 426 | extern struct net_device *ap_net_dev; |
| 830 | 427 | #endif |
| 831 | 428 | |
| 832 | −static void dhd_op_if(dhd_if_t *ifp) | |
| 429 | +/* Virtual interfaces only ((ifp && ifp->info && ifp->idx == true) */ | |
| 430 | +static void brcmf_op_if(struct brcmf_if *ifp) | |
| 833 | 431 | { |
| 834 | − dhd_info_t *dhd; | |
| 432 | + struct brcmf_info *drvr_priv; | |
| 835 | 433 | int ret = 0, err = 0; |
| 836 | 434 | |
| 837 | − ASSERT(ifp && ifp->info && ifp->idx); /* Virtual interfaces only */ | |
| 838 | − | |
| 839 | − dhd = ifp->info; | |
| 435 | + drvr_priv = ifp->info; | |
| 840 | 436 | |
| 841 | − DHD_TRACE(("%s: idx %d, state %d\n", __func__, ifp->idx, ifp->state)); | |
| 437 | + BRCMF_TRACE(("%s: idx %d, state %d\n", __func__, ifp->idx, ifp->state)); | |
| 842 | 438 | |
| 843 | 439 | switch (ifp->state) { |
| 844 | − case WLC_E_IF_ADD: | |
| 440 | + case BRCMF_E_IF_ADD: | |
| 845 | 441 | /* |
| 846 | 442 | * Delete the existing interface before overwriting it |
| 847 | − * in case we missed the WLC_E_IF_DEL event. | |
| 443 | + * in case we missed the BRCMF_E_IF_DEL event. | |
| 848 | 444 | */ |
| 849 | 445 | if (ifp->net != NULL) { |
| 850 | − DHD_ERROR(("%s: ERROR: netdev:%s already exists, " | |
| 851 | − "try free & unregister\n", | |
| 852 | − __func__, ifp->net->name)); | |
| 446 | + BRCMF_ERROR(("%s: ERROR: netdev:%s already exists, " | |
| 447 | + "try free & unregister\n", | |
| 448 | + __func__, ifp->net->name)); | |
| 853 | 449 | netif_stop_queue(ifp->net); |
| 854 | 450 | unregister_netdev(ifp->net); |
| 855 | 451 | free_netdev(ifp->net); |
| 856 | 452 | } |
| 857 | 453 | /* Allocate etherdev, including space for private structure */ |
| 858 | − ifp->net = alloc_etherdev(sizeof(dhd)); | |
| 454 | + ifp->net = alloc_etherdev(sizeof(drvr_priv)); | |
| 859 | 455 | if (!ifp->net) { |
| 860 | − DHD_ERROR(("%s: OOM - alloc_etherdev\n", __func__)); | |
| 456 | + BRCMF_ERROR(("%s: OOM - alloc_etherdev\n", __func__)); | |
| 861 | 457 | ret = -ENOMEM; |
| 862 | 458 | } |
| 863 | 459 | if (ret == 0) { |
| 864 | 460 | strcpy(ifp->net->name, ifp->name); |
| 865 | − memcpy(netdev_priv(ifp->net), &dhd, sizeof(dhd)); | |
| 866 | − err = dhd_net_attach(&dhd->pub, ifp->idx); | |
| 461 | + memcpy(netdev_priv(ifp->net), &drvr_priv, sizeof(drvr_priv)); | |
| 462 | + err = brcmf_net_attach(&drvr_priv->pub, ifp->idx); | |
| 867 | 463 | if (err != 0) { |
| 868 | − DHD_ERROR(("%s: dhd_net_attach failed, " | |
| 869 | − "err %d\n", | |
| 870 | − __func__, err)); | |
| 464 | + BRCMF_ERROR(("%s: brcmf_net_attach failed, " | |
| 465 | + "err %d\n", | |
| 466 | + __func__, err)); | |
| 871 | 467 | ret = -EOPNOTSUPP; |
| 872 | 468 | } else { |
| 873 | 469 | #ifdef SOFTAP |
| @@ -882,26 +478,25 @@ static void dhd_op_if(dhd_if_t *ifp) · 8 unmodified lines | ||
| 882 | 478 | wl0.1 is ready */ |
| 883 | 479 | up(&ap_eth_sema); |
| 884 | 480 | #endif |
| 885 | − DHD_TRACE(("\n ==== pid:%x, net_device for " | |
| 886 | − "if:%s created ===\n\n", | |
| 887 | − current->pid, ifp->net->name)); | |
| 481 | + BRCMF_TRACE(("\n ==== pid:%x, net_device for " | |
| 482 | + "if:%s created ===\n\n", | |
| 483 | + current->pid, ifp->net->name)); | |
| 888 | 484 | ifp->state = 0; |
| 889 | 485 | } |
| 890 | 486 | } |
| 891 | 487 | break; |
| 892 | − case WLC_E_IF_DEL: | |
| 488 | + case BRCMF_E_IF_DEL: | |
| 893 | 489 | if (ifp->net != NULL) { |
| 894 | − DHD_TRACE(("\n%s: got 'WLC_E_IF_DEL' state\n", | |
| 895 | − __func__)); | |
| 490 | + BRCMF_TRACE(("\n%s: got 'WLC_E_IF_DEL' state\n", | |
| 491 | + __func__)); | |
| 896 | 492 | netif_stop_queue(ifp->net); |
| 897 | 493 | unregister_netdev(ifp->net); |
| 898 | − ret = DHD_DEL_IF; /* Make sure the free_netdev() | |
| 494 | + ret = BRCMF_DEL_IF; /* Make sure the free_netdev() | |
| 899 | 495 | is called */ |
| 900 | 496 | } |
| 901 | 497 | break; |
| 902 | 498 | default: |
| 903 | − DHD_ERROR(("%s: bad op %d\n", __func__, ifp->state)); | |
| 904 | − ASSERT(!ifp->state); | |
| 499 | + BRCMF_ERROR(("%s: bad op %d\n", __func__, ifp->state)); | |
| 905 | 500 | break; |
| 906 | 501 | } |
| 907 | 502 | |
| @@ -909,7 +504,7 @@ static void dhd_op_if(dhd_if_t *ifp) · 1 unmodified line | ||
| 909 | 504 | if (ifp->net) |
| 910 | 505 | free_netdev(ifp->net); |
| 911 | 506 | |
| 912 | − dhd->iflist[ifp->idx] = NULL; | |
| 507 | + drvr_priv->iflist[ifp->idx] = NULL; | |
| 913 | 508 | kfree(ifp); |
| 914 | 509 | #ifdef SOFTAP |
| 915 | 510 | if (ifp->net == ap_net_dev) |
| @@ -919,9 +514,9 @@ static void dhd_op_if(dhd_if_t *ifp) · 3 unmodified lines | ||
| 919 | 514 | } |
| 920 | 515 | } |
| 921 | 516 | |
| 922 | −static int _dhd_sysioc_thread(void *data) | |
| 517 | +static int _brcmf_sysioc_thread(void *data) | |
| 923 | 518 | { |
| 924 | − dhd_info_t *dhd = (dhd_info_t *) data; | |
| 519 | + struct brcmf_info *drvr_priv = (struct brcmf_info *) data; | |
| 925 | 520 | int i; |
| 926 | 521 | #ifdef SOFTAP |
| 927 | 522 | bool in_ap = false; |
| @@ -929,46 +524,51 @@ static int _dhd_sysioc_thread(void *data) · 1 unmodified line | ||
| 929 | 524 | |
| 930 | 525 | allow_signal(SIGTERM); |
| 931 | 526 | |
| 932 | − while (down_interruptible(&dhd->sysioc_sem) == 0) { | |
| 527 | + while (down_interruptible(&drvr_priv->sysioc_sem) == 0) { | |
| 933 | 528 | if (kthread_should_stop()) |
| 934 | 529 | break; |
| 935 | − for (i = 0; i < DHD_MAX_IFS; i++) { | |
| 936 | − if (dhd->iflist[i]) { | |
| 530 | + for (i = 0; i < BRCMF_MAX_IFS; i++) { | |
| 531 | + struct brcmf_if *ifentry = drvr_priv->iflist[i]; | |
| 532 | + if (ifentry) { | |
| 937 | 533 | #ifdef SOFTAP |
| 938 | 534 | in_ap = (ap_net_dev != NULL); |
| 939 | 535 | #endif /* SOFTAP */ |
| 940 | − if (dhd->iflist[i]->state) | |
| 941 | − dhd_op_if(dhd->iflist[i]); | |
| 536 | + if (ifentry->state) | |
| 537 | + brcmf_op_if(ifentry); | |
| 942 | 538 | #ifdef SOFTAP |
| 943 | − if (dhd->iflist[i] == NULL) { | |
| 944 | − DHD_TRACE(("\n\n %s: interface %d " | |
| 945 | − "removed!\n", __func__, i)); | |
| 539 | + if (drvr_priv->iflist[i] == NULL) { | |
| 540 | + BRCMF_TRACE(("\n\n %s: interface %d " | |
| 541 | + "removed!\n", __func__, | |
| 542 | + i)); | |
| 946 | 543 | continue; |
| 947 | 544 | } |
| 948 | 545 | |
| 949 | − if (in_ap && dhd->set_macaddress) { | |
| 950 | − DHD_TRACE(("attempt to set MAC for %s " | |
| 951 | − "in AP Mode," "blocked. \n", | |
| 952 | − dhd->iflist[i]->net->name)); | |
| 953 | − dhd->set_macaddress = false; | |
| 546 | + if (in_ap && drvr_priv->set_macaddress) { | |
| 547 | + BRCMF_TRACE(("attempt to set MAC for" | |
| 548 | + " %s in AP Mode," | |
| 549 | + " blocked.\n", | |
| 550 | + ifentry->net->name)); | |
| 551 | + drvr_priv->set_macaddress = false; | |
| 954 | 552 | continue; |
| 955 | 553 | } |
| 956 | 554 | |
| 957 | − if (in_ap && dhd->set_multicast) { | |
| 958 | − DHD_TRACE(("attempt to set MULTICAST list for %s" "in AP Mode, blocked. \n", | |
| 959 | − dhd->iflist[i]->net->name)); | |
| 960 | − dhd->set_multicast = false; | |
| 555 | + if (in_ap && drvr_priv->set_multicast) { | |
| 556 | + BRCMF_TRACE(("attempt to set MULTICAST " | |
| 557 | + "list for %s in AP Mode, " | |
| 558 | + "blocked.\n", | |
| 559 | + ifentry->net->name)); | |
| 560 | + drvr_priv->set_multicast = false; | |
| 961 | 561 | continue; |
| 962 | 562 | } |
| 963 | 563 | #endif /* SOFTAP */ |
| 964 | − if (dhd->set_multicast) { | |
| 965 | − dhd->set_multicast = false; | |
| 966 | − _dhd_set_multicast_list(dhd, i); | |
| 564 | + if (drvr_priv->set_multicast) { | |
| 565 | + drvr_priv->set_multicast = false; | |
| 566 | + _brcmf_set_multicast_list(drvr_priv, i); | |
| 967 | 567 | } |
| 968 | − if (dhd->set_macaddress) { | |
| 969 | − dhd->set_macaddress = false; | |
| 970 | − _dhd_set_mac_address(dhd, i, | |
| 971 | − dhd->macvalue); | |
| 568 | + if (drvr_priv->set_macaddress) { | |
| 569 | + drvr_priv->set_macaddress = false; | |
| 570 | + _brcmf_set_mac_address(drvr_priv, i, | |
| 571 | + drvr_priv->macvalue); | |
| 972 | 572 | } |
| 973 | 573 | } |
| 974 | 574 | } |
| @@ -976,47 +576,44 @@ static int _dhd_sysioc_thread(void *data) · 1 unmodified line | ||
| 976 | 576 | return 0; |
| 977 | 577 | } |
| 978 | 578 | |
| 979 | −static int dhd_set_mac_address(struct net_device *dev, void *addr) | |
| 579 | +static int brcmf_netdev_set_mac_address(struct net_device *dev, void *addr) | |
| 980 | 580 | { |
| 981 | 581 | int ret = 0; |
| 982 | 582 | |
| 983 | − dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(dev); | |
| 583 | + struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(dev); | |
| 984 | 584 | struct sockaddr *sa = (struct sockaddr *)addr; |
| 985 | 585 | int ifidx; |
| 986 | 586 | |
| 987 | − ifidx = dhd_net2idx(dhd, dev); | |
| 988 | − if (ifidx == DHD_BAD_IF) | |
| 587 | + ifidx = brcmf_net2idx(drvr_priv, dev); | |
| 588 | + if (ifidx == BRCMF_BAD_IF) | |
| 989 | 589 | return -1; |
| 990 | 590 | |
| 991 | − ASSERT(dhd->sysioc_tsk); | |
| 992 | − memcpy(&dhd->macvalue, sa->sa_data, ETH_ALEN); | |
| 993 | − dhd->set_macaddress = true; | |
| 994 | − up(&dhd->sysioc_sem); | |
| 591 | + memcpy(&drvr_priv->macvalue, sa->sa_data, ETH_ALEN); | |
| 592 | + drvr_priv->set_macaddress = true; | |
| 593 | + up(&drvr_priv->sysioc_sem); | |
| 995 | 594 | |
| 996 | 595 | return ret; |
| 997 | 596 | } |
| 998 | 597 | |
| 999 | −static void dhd_set_multicast_list(struct net_device *dev) | |
| 598 | +static void brcmf_netdev_set_multicast_list(struct net_device *dev) | |
| 1000 | 599 | { |
| 1001 | − dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(dev); | |
| 600 | + struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(dev); | |
| 1002 | 601 | int ifidx; |
| 1003 | 602 | |
| 1004 | − ifidx = dhd_net2idx(dhd, dev); | |
| 1005 | − if (ifidx == DHD_BAD_IF) | |
| 603 | + ifidx = brcmf_net2idx(drvr_priv, dev); | |
| 604 | + if (ifidx == BRCMF_BAD_IF) | |
| 1006 | 605 | return; |
| 1007 | 606 | |
| 1008 | − ASSERT(dhd->sysioc_tsk); | |
| 1009 | − dhd->set_multicast = true; | |
| 1010 | − up(&dhd->sysioc_sem); | |
| 607 | + drvr_priv->set_multicast = true; | |
| 608 | + up(&drvr_priv->sysioc_sem); | |
| 1011 | 609 | } |
| 1012 | 610 | |
| 1013 | −int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf) | |
| 611 | +int brcmf_sendpkt(struct brcmf_pub *drvr, int ifidx, struct sk_buff *pktbuf) | |
| 1014 | 612 | { |
| 1015 | − int ret; | |
| 1016 | − dhd_info_t *dhd = (dhd_info_t *) (dhdp->info); | |
| 613 | + struct brcmf_info *drvr_priv = drvr->info; | |
| 1017 | 614 | |
| 1018 | 615 | /* Reject if down */ |
| 1019 | − if (!dhdp->up || (dhdp->busstate == DHD_BUS_DOWN)) | |
| 616 | + if (!drvr->up || (drvr->busstate == BRCMF_BUS_DOWN)) | |
| 1020 | 617 | return -ENODEV; |
| 1021 | 618 | |
| 1022 | 619 | /* Update multicast statistic */ |
| @@ -1025,143 +622,107 @@ int dhd_sendpkt(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf) · 2 unmodified lines | ||
| 1025 | 622 | struct ethhdr *eh = (struct ethhdr *)pktdata; |
| 1026 | 623 | |
| 1027 | 624 | if (is_multicast_ether_addr(eh->h_dest)) |
| 1028 | − dhdp->tx_multicast++; | |
| 625 | + drvr->tx_multicast++; | |
| 1029 | 626 | if (ntohs(eh->h_proto) == ETH_P_PAE) |
| 1030 | − atomic_inc(&dhd->pend_8021x_cnt); | |
| 627 | + atomic_inc(&drvr_priv->pend_8021x_cnt); | |
| 1031 | 628 | } |
| 1032 | 629 | |
| 1033 | 630 | /* If the protocol uses a data header, apply it */ |
| 1034 | − dhd_prot_hdrpush(dhdp, ifidx, pktbuf); | |
| 631 | + brcmf_proto_hdrpush(drvr, ifidx, pktbuf); | |
| 1035 | 632 | |
| 1036 | 633 | /* Use bus module to send data frame */ |
| 1037 | −#ifdef BCMDBUS | |
| 1038 | − ret = dbus_send_pkt(dhdp->dbus, pktbuf, NULL /* pktinfo */); | |
| 1039 | −#else | |
| 1040 | − ret = dhd_bus_txdata(dhdp->bus, pktbuf); | |
| 1041 | −#endif /* BCMDBUS */ | |
| 1042 | − | |
| 1043 | − return ret; | |
| 1044 | −} | |
| 1045 | − | |
| 1046 | −static inline void * | |
| 1047 | −osl_pkt_frmnative(struct sk_buff *skb) | |
| 1048 | −{ | |
| 1049 | − return (void *)skb; | |
| 1050 | −} | |
| 1051 | −#define PKTFRMNATIVE(osh, skb) \ | |
| 1052 | − osl_pkt_frmnative((struct sk_buff *)(skb)) | |
| 1053 | − | |
| 1054 | −static inline struct sk_buff * | |
| 1055 | −osl_pkt_tonative(void *pkt) | |
| 1056 | −{ | |
| 1057 | − return (struct sk_buff *)pkt; | |
| 634 | + return brcmf_sdbrcm_bus_txdata(drvr->bus, pktbuf); | |
| 1058 | 635 | } |
| 1059 | −#define PKTTONATIVE(osh, pkt) \ | |
| 1060 | − osl_pkt_tonative((pkt)) | |
| 1061 | 636 | |
| 1062 | −static int dhd_start_xmit(struct sk_buff *skb, struct net_device *net) | |
| 637 | +static int brcmf_netdev_start_xmit(struct sk_buff *skb, struct net_device *net) | |
| 1063 | 638 | { |
| 1064 | 639 | int ret; |
| 1065 | − void *pktbuf; | |
| 1066 | − dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net); | |
| 640 | + struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net); | |
| 1067 | 641 | int ifidx; |
| 1068 | 642 | |
| 1069 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 643 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 1070 | 644 | |
| 1071 | 645 | /* Reject if down */ |
| 1072 | − if (!dhd->pub.up || (dhd->pub.busstate == DHD_BUS_DOWN)) { | |
| 1073 | − DHD_ERROR(("%s: xmit rejected pub.up=%d busstate=%d\n", | |
| 1074 | − __func__, dhd->pub.up, dhd->pub.busstate)); | |
| 646 | + if (!drvr_priv->pub.up || (drvr_priv->pub.busstate == BRCMF_BUS_DOWN)) { | |
| 647 | + BRCMF_ERROR(("%s: xmit rejected pub.up=%d busstate=%d\n", | |
| 648 | + __func__, drvr_priv->pub.up, | |
| 649 | + drvr_priv->pub.busstate)); | |
| 1075 | 650 | netif_stop_queue(net); |
| 1076 | 651 | return -ENODEV; |
| 1077 | 652 | } |
| 1078 | 653 | |
| 1079 | − ifidx = dhd_net2idx(dhd, net); | |
| 1080 | − if (ifidx == DHD_BAD_IF) { | |
| 1081 | − DHD_ERROR(("%s: bad ifidx %d\n", __func__, ifidx)); | |
| 654 | + ifidx = brcmf_net2idx(drvr_priv, net); | |
| 655 | + if (ifidx == BRCMF_BAD_IF) { | |
| 656 | + BRCMF_ERROR(("%s: bad ifidx %d\n", __func__, ifidx)); | |
| 1082 | 657 | netif_stop_queue(net); |
| 1083 | 658 | return -ENODEV; |
| 1084 | 659 | } |
| 1085 | 660 | |
| 1086 | 661 | /* Make sure there's enough room for any header */ |
| 1087 | − if (skb_headroom(skb) < dhd->pub.hdrlen) { | |
| 662 | + if (skb_headroom(skb) < drvr_priv->pub.hdrlen) { | |
| 1088 | 663 | struct sk_buff *skb2; |
| 1089 | 664 | |
| 1090 | − DHD_INFO(("%s: insufficient headroom\n", | |
| 1091 | − dhd_ifname(&dhd->pub, ifidx))); | |
| 1092 | − dhd->pub.tx_realloc++; | |
| 1093 | − skb2 = skb_realloc_headroom(skb, dhd->pub.hdrlen); | |
| 665 | + BRCMF_INFO(("%s: insufficient headroom\n", | |
| 666 | + brcmf_ifname(&drvr_priv->pub, ifidx))); | |
| 667 | + drvr_priv->pub.tx_realloc++; | |
| 668 | + skb2 = skb_realloc_headroom(skb, drvr_priv->pub.hdrlen); | |
| 1094 | 669 | dev_kfree_skb(skb); |
| 1095 | 670 | skb = skb2; |
| 1096 | 671 | if (skb == NULL) { |
| 1097 | − DHD_ERROR(("%s: skb_realloc_headroom failed\n", | |
| 1098 | − dhd_ifname(&dhd->pub, ifidx))); | |
| 672 | + BRCMF_ERROR(("%s: skb_realloc_headroom failed\n", | |
| 673 | + brcmf_ifname(&drvr_priv->pub, ifidx))); | |
| 1099 | 674 | ret = -ENOMEM; |
| 1100 | 675 | goto done; |
| 1101 | 676 | } |
| 1102 | 677 | } |
| 1103 | 678 | |
| 1104 | − /* Convert to packet */ | |
| 1105 | − pktbuf = PKTFRMNATIVE(dhd->pub.osh, skb); | |
| 1106 | − if (!pktbuf) { | |
| 1107 | − DHD_ERROR(("%s: PKTFRMNATIVE failed\n", | |
| 1108 | − dhd_ifname(&dhd->pub, ifidx))); | |
| 1109 | − dev_kfree_skb_any(skb); | |
| 1110 | − ret = -ENOMEM; | |
| 1111 | − goto done; | |
| 1112 | − } | |
| 1113 | − | |
| 1114 | − ret = dhd_sendpkt(&dhd->pub, ifidx, pktbuf); | |
| 679 | + ret = brcmf_sendpkt(&drvr_priv->pub, ifidx, skb); | |
| 1115 | 680 | |
| 1116 | 681 | done: |
| 1117 | 682 | if (ret) |
| 1118 | − dhd->pub.dstats.tx_dropped++; | |
| 683 | + drvr_priv->pub.dstats.tx_dropped++; | |
| 1119 | 684 | else |
| 1120 | − dhd->pub.tx_packets++; | |
| 685 | + drvr_priv->pub.tx_packets++; | |
| 1121 | 686 | |
| 1122 | 687 | /* Return ok: we always eat the packet */ |
| 1123 | 688 | return 0; |
| 1124 | 689 | } |
| 1125 | 690 | |
| 1126 | −void dhd_txflowcontrol(dhd_pub_t *dhdp, int ifidx, bool state) | |
| 691 | +void brcmf_txflowcontrol(struct brcmf_pub *drvr, int ifidx, bool state) | |
| 1127 | 692 | { |
| 1128 | 693 | struct net_device *net; |
| 1129 | − dhd_info_t *dhd = dhdp->info; | |
| 694 | + struct brcmf_info *drvr_priv = drvr->info; | |
| 1130 | 695 | |
| 1131 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 696 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 1132 | 697 | |
| 1133 | − dhdp->txoff = state; | |
| 1134 | − ASSERT(dhd && dhd->iflist[ifidx]); | |
| 1135 | − net = dhd->iflist[ifidx]->net; | |
| 698 | + drvr->txoff = state; | |
| 699 | + net = drvr_priv->iflist[ifidx]->net; | |
| 1136 | 700 | if (state == ON) |
| 1137 | 701 | netif_stop_queue(net); |
| 1138 | 702 | else |
| 1139 | 703 | netif_wake_queue(net); |
| 1140 | 704 | } |
| 1141 | 705 | |
| 1142 | −void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf, | |
| 706 | +void brcmf_rx_frame(struct brcmf_pub *drvr, int ifidx, struct sk_buff *skb, | |
| 1143 | 707 | int numpkt) |
| 1144 | 708 | { |
| 1145 | − dhd_info_t *dhd = (dhd_info_t *) dhdp->info; | |
| 1146 | − struct sk_buff *skb; | |
| 709 | + struct brcmf_info *drvr_priv = drvr->info; | |
| 1147 | 710 | unsigned char *eth; |
| 1148 | 711 | uint len; |
| 1149 | 712 | void *data; |
| 1150 | 713 | struct sk_buff *pnext, *save_pktbuf; |
| 1151 | 714 | int i; |
| 1152 | − dhd_if_t *ifp; | |
| 1153 | − wl_event_msg_t event; | |
| 1154 | − | |
| 1155 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 715 | + struct brcmf_if *ifp; | |
| 716 | + struct brcmf_event_msg event; | |
| 1156 | 717 | |
| 1157 | − save_pktbuf = pktbuf; | |
| 718 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 1158 | 719 | |
| 1159 | − for (i = 0; pktbuf && i < numpkt; i++, pktbuf = pnext) { | |
| 720 | + save_pktbuf = skb; | |
| 1160 | 721 | |
| 1161 | − pnext = pktbuf->next; | |
| 1162 | − pktbuf->next = NULL; | |
| 722 | + for (i = 0; skb && i < numpkt; i++, skb = pnext) { | |
| 1163 | 723 | |
| 1164 | − skb = PKTTONATIVE(dhdp->osh, pktbuf); | |
| 724 | + pnext = skb->next; | |
| 725 | + skb->next = NULL; | |
| 1165 | 726 | |
| 1166 | 727 | /* Get the protocol, maintain skb around eth_type_trans() |
| 1167 | 728 | * The main reason for this hack is for the limitation of |
| @@ -1178,16 +739,15 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf, · 10 unmodified lines | ||
| 1178 | 739 | eth = skb->data; |
| 1179 | 740 | len = skb->len; |
| 1180 | 741 | |
| 1181 | − ifp = dhd->iflist[ifidx]; | |
| 742 | + ifp = drvr_priv->iflist[ifidx]; | |
| 1182 | 743 | if (ifp == NULL) |
| 1183 | − ifp = dhd->iflist[0]; | |
| 744 | + ifp = drvr_priv->iflist[0]; | |
| 1184 | 745 | |
| 1185 | − ASSERT(ifp); | |
| 1186 | 746 | skb->dev = ifp->net; |
| 1187 | 747 | skb->protocol = eth_type_trans(skb, skb->dev); |
| 1188 | 748 | |
| 1189 | 749 | if (skb->pkt_type == PACKET_MULTICAST) |
| 1190 | − dhd->pub.rx_multicast++; | |
| 750 | + drvr_priv->pub.rx_multicast++; | |
| 1191 | 751 | |
| 1192 | 752 | skb->data = eth; |
| 1193 | 753 | skb->len = len; |
| @@ -1196,20 +756,20 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf, · 2 unmodified lines | ||
| 1196 | 756 | skb_pull(skb, ETH_HLEN); |
| 1197 | 757 | |
| 1198 | 758 | /* Process special event packets and then discard them */ |
| 1199 | − if (ntohs(skb->protocol) == ETH_P_BRCM) | |
| 1200 | − dhd_wl_host_event(dhd, &ifidx, | |
| 759 | + if (ntohs(skb->protocol) == ETH_P_LINK_CTL) | |
| 760 | + brcmf_host_event(drvr_priv, &ifidx, | |
| 1201 | 761 | skb_mac_header(skb), |
| 1202 | 762 | &event, &data); |
| 1203 | 763 | |
| 1204 | − ASSERT(ifidx < DHD_MAX_IFS && dhd->iflist[ifidx]); | |
| 1205 | − if (dhd->iflist[ifidx] && !dhd->iflist[ifidx]->state) | |
| 1206 | − ifp = dhd->iflist[ifidx]; | |
| 764 | + if (drvr_priv->iflist[ifidx] && | |
| 765 | + !drvr_priv->iflist[ifidx]->state) | |
| 766 | + ifp = drvr_priv->iflist[ifidx]; | |
| 1207 | 767 | |
| 1208 | 768 | if (ifp->net) |
| 1209 | 769 | ifp->net->last_rx = jiffies; |
| 1210 | 770 | |
| 1211 | − dhdp->dstats.rx_bytes += skb->len; | |
| 1212 | − dhdp->rx_packets++; /* Local count */ | |
| 771 | + drvr->dstats.rx_bytes += skb->len; | |
| 772 | + drvr->rx_packets++; /* Local count */ | |
| 1213 | 773 | |
| 1214 | 774 | if (in_interrupt()) { |
| 1215 | 775 | netif_rx(skb); |
| @@ -1225,216 +785,83 @@ void dhd_rx_frame(dhd_pub_t *dhdp, int ifidx, struct sk_buff *pktbuf, · 9 unmodified lines | ||
| 1225 | 785 | } |
| 1226 | 786 | } |
| 1227 | 787 | |
| 1228 | −void dhd_event(struct dhd_info *dhd, char *evpkt, int evlen, int ifidx) | |
| 1229 | −{ | |
| 1230 | − /* Linux version has nothing to do */ | |
| 1231 | − return; | |
| 1232 | −} | |
| 1233 | − | |
| 1234 | −void dhd_txcomplete(dhd_pub_t *dhdp, struct sk_buff *txp, bool success) | |
| 788 | +void brcmf_txcomplete(struct brcmf_pub *drvr, struct sk_buff *txp, bool success) | |
| 1235 | 789 | { |
| 1236 | 790 | uint ifidx; |
| 1237 | − dhd_info_t *dhd = (dhd_info_t *) (dhdp->info); | |
| 791 | + struct brcmf_info *drvr_priv = drvr->info; | |
| 1238 | 792 | struct ethhdr *eh; |
| 1239 | 793 | u16 type; |
| 1240 | 794 | |
| 1241 | − dhd_prot_hdrpull(dhdp, &ifidx, txp); | |
| 795 | + brcmf_proto_hdrpull(drvr, &ifidx, txp); | |
| 1242 | 796 | |
| 1243 | 797 | eh = (struct ethhdr *)(txp->data); |
| 1244 | 798 | type = ntohs(eh->h_proto); |
| 1245 | 799 | |
| 1246 | 800 | if (type == ETH_P_PAE) |
| 1247 | − atomic_dec(&dhd->pend_8021x_cnt); | |
| 801 | + atomic_dec(&drvr_priv->pend_8021x_cnt); | |
| 1248 | 802 | |
| 1249 | 803 | } |
| 1250 | 804 | |
| 1251 | −static struct net_device_stats *dhd_get_stats(struct net_device *net) | |
| 805 | +static struct net_device_stats *brcmf_netdev_get_stats(struct net_device *net) | |
| 1252 | 806 | { |
| 1253 | − dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net); | |
| 1254 | − dhd_if_t *ifp; | |
| 807 | + struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net); | |
| 808 | + struct brcmf_if *ifp; | |
| 1255 | 809 | int ifidx; |
| 1256 | 810 | |
| 1257 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 811 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 1258 | 812 | |
| 1259 | − ifidx = dhd_net2idx(dhd, net); | |
| 1260 | − if (ifidx == DHD_BAD_IF) | |
| 813 | + ifidx = brcmf_net2idx(drvr_priv, net); | |
| 814 | + if (ifidx == BRCMF_BAD_IF) | |
| 1261 | 815 | return NULL; |
| 1262 | 816 | |
| 1263 | − ifp = dhd->iflist[ifidx]; | |
| 1264 | − ASSERT(dhd && ifp); | |
| 817 | + ifp = drvr_priv->iflist[ifidx]; | |
| 1265 | 818 | |
| 1266 | − if (dhd->pub.up) { | |
| 819 | + if (drvr_priv->pub.up) { | |
| 1267 | 820 | /* Use the protocol to get dongle stats */ |
| 1268 | − dhd_prot_dstats(&dhd->pub); | |
| 821 | + brcmf_proto_dstats(&drvr_priv->pub); | |
| 1269 | 822 | } |
| 1270 | 823 | |
| 1271 | 824 | /* Copy dongle stats to net device stats */ |
| 1272 | − ifp->stats.rx_packets = dhd->pub.dstats.rx_packets; | |
| 1273 | − ifp->stats.tx_packets = dhd->pub.dstats.tx_packets; | |
| 1274 | − ifp->stats.rx_bytes = dhd->pub.dstats.rx_bytes; | |
| 1275 | − ifp->stats.tx_bytes = dhd->pub.dstats.tx_bytes; | |
| 1276 | − ifp->stats.rx_errors = dhd->pub.dstats.rx_errors; | |
| 1277 | − ifp->stats.tx_errors = dhd->pub.dstats.tx_errors; | |
| 1278 | − ifp->stats.rx_dropped = dhd->pub.dstats.rx_dropped; | |
| 1279 | − ifp->stats.tx_dropped = dhd->pub.dstats.tx_dropped; | |
| 1280 | − ifp->stats.multicast = dhd->pub.dstats.multicast; | |
| 825 | + ifp->stats.rx_packets = drvr_priv->pub.dstats.rx_packets; | |
| 826 | + ifp->stats.tx_packets = drvr_priv->pub.dstats.tx_packets; | |
| 827 | + ifp->stats.rx_bytes = drvr_priv->pub.dstats.rx_bytes; | |
| 828 | + ifp->stats.tx_bytes = drvr_priv->pub.dstats.tx_bytes; | |
| 829 | + ifp->stats.rx_errors = drvr_priv->pub.dstats.rx_errors; | |
| 830 | + ifp->stats.tx_errors = drvr_priv->pub.dstats.tx_errors; | |
| 831 | + ifp->stats.rx_dropped = drvr_priv->pub.dstats.rx_dropped; | |
| 832 | + ifp->stats.tx_dropped = drvr_priv->pub.dstats.tx_dropped; | |
| 833 | + ifp->stats.multicast = drvr_priv->pub.dstats.multicast; | |
| 1281 | 834 | |
| 1282 | 835 | return &ifp->stats; |
| 1283 | 836 | } |
| 1284 | 837 | |
| 1285 | −static int dhd_watchdog_thread(void *data) | |
| 1286 | −{ | |
| 1287 | − dhd_info_t *dhd = (dhd_info_t *) data; | |
| 1288 | − | |
| 1289 | − /* This thread doesn't need any user-level access, | |
| 1290 | − * so get rid of all our resources | |
| 1291 | − */ | |
| 1292 | −#ifdef DHD_SCHED | |
| 1293 | − if (dhd_watchdog_prio > 0) { | |
| 1294 | − struct sched_param param; | |
| 1295 | − param.sched_priority = (dhd_watchdog_prio < MAX_RT_PRIO) ? | |
| 1296 | − dhd_watchdog_prio : (MAX_RT_PRIO - 1); | |
| 1297 | − setScheduler(current, SCHED_FIFO, ¶m); | |
| 1298 | − } | |
| 1299 | −#endif /* DHD_SCHED */ | |
| 1300 | − | |
| 1301 | − allow_signal(SIGTERM); | |
| 1302 | − /* Run until signal received */ | |
| 1303 | − while (1) { | |
| 1304 | − if (kthread_should_stop()) | |
| 1305 | − break; | |
| 1306 | − if (down_interruptible(&dhd->watchdog_sem) == 0) { | |
| 1307 | − if (dhd->pub.dongle_reset == false) { | |
| 1308 | − /* Call the bus module watchdog */ | |
| 1309 | − dhd_bus_watchdog(&dhd->pub); | |
| 1310 | − } | |
| 1311 | − /* Count the tick for reference */ | |
| 1312 | − dhd->pub.tickcnt++; | |
| 1313 | − } else | |
| 1314 | − break; | |
| 1315 | − } | |
| 1316 | − return 0; | |
| 1317 | −} | |
| 1318 | − | |
| 1319 | −static void dhd_watchdog(unsigned long data) | |
| 1320 | −{ | |
| 1321 | − dhd_info_t *dhd = (dhd_info_t *) data; | |
| 1322 | − | |
| 1323 | − if (dhd->watchdog_tsk) { | |
| 1324 | − up(&dhd->watchdog_sem); | |
| 1325 | − | |
| 1326 | − /* Reschedule the watchdog */ | |
| 1327 | − if (dhd->wd_timer_valid) { | |
| 1328 | − mod_timer(&dhd->timer, | |
| 1329 | − jiffies + dhd_watchdog_ms * HZ / 1000); | |
| 1330 | − } | |
| 1331 | − return; | |
| 1332 | − } | |
| 1333 | − | |
| 1334 | − /* Call the bus module watchdog */ | |
| 1335 | − dhd_bus_watchdog(&dhd->pub); | |
| 1336 | − | |
| 1337 | − /* Count the tick for reference */ | |
| 1338 | − dhd->pub.tickcnt++; | |
| 1339 | − | |
| 1340 | − /* Reschedule the watchdog */ | |
| 1341 | − if (dhd->wd_timer_valid) | |
| 1342 | − mod_timer(&dhd->timer, jiffies + dhd_watchdog_ms * HZ / 1000); | |
| 1343 | −} | |
| 1344 | − | |
| 1345 | −static int dhd_dpc_thread(void *data) | |
| 1346 | −{ | |
| 1347 | − dhd_info_t *dhd = (dhd_info_t *) data; | |
| 1348 | − | |
| 1349 | − /* This thread doesn't need any user-level access, | |
| 1350 | − * so get rid of all our resources | |
| 1351 | − */ | |
| 1352 | −#ifdef DHD_SCHED | |
| 1353 | − if (dhd_dpc_prio > 0) { | |
| 1354 | − struct sched_param param; | |
| 1355 | − param.sched_priority = | |
| 1356 | − (dhd_dpc_prio < | |
| 1357 | − MAX_RT_PRIO) ? dhd_dpc_prio : (MAX_RT_PRIO - 1); | |
| 1358 | − setScheduler(current, SCHED_FIFO, ¶m); | |
| 1359 | − } | |
| 1360 | −#endif /* DHD_SCHED */ | |
| 1361 | − | |
| 1362 | − allow_signal(SIGTERM); | |
| 1363 | − /* Run until signal received */ | |
| 1364 | − while (1) { | |
| 1365 | − if (kthread_should_stop()) | |
| 1366 | − break; | |
| 1367 | − if (down_interruptible(&dhd->dpc_sem) == 0) { | |
| 1368 | − /* Call bus dpc unless it indicated down | |
| 1369 | − (then clean stop) */ | |
| 1370 | − if (dhd->pub.busstate != DHD_BUS_DOWN) { | |
| 1371 | − if (dhd_bus_dpc(dhd->pub.bus)) { | |
| 1372 | − up(&dhd->dpc_sem); | |
| 1373 | − } | |
| 1374 | − } else { | |
| 1375 | − dhd_bus_stop(dhd->pub.bus, true); | |
| 1376 | − } | |
| 1377 | − } else | |
| 1378 | − break; | |
| 1379 | − } | |
| 1380 | − return 0; | |
| 1381 | −} | |
| 1382 | − | |
| 1383 | −static void dhd_dpc(unsigned long data) | |
| 1384 | −{ | |
| 1385 | − dhd_info_t *dhd; | |
| 1386 | − | |
| 1387 | − dhd = (dhd_info_t *) data; | |
| 1388 | − | |
| 1389 | − /* Call bus dpc unless it indicated down (then clean stop) */ | |
| 1390 | − if (dhd->pub.busstate != DHD_BUS_DOWN) { | |
| 1391 | − if (dhd_bus_dpc(dhd->pub.bus)) | |
| 1392 | − tasklet_schedule(&dhd->tasklet); | |
| 1393 | − } else { | |
| 1394 | − dhd_bus_stop(dhd->pub.bus, true); | |
| 1395 | − } | |
| 1396 | −} | |
| 1397 | − | |
| 1398 | −void dhd_sched_dpc(dhd_pub_t *dhdp) | |
| 1399 | −{ | |
| 1400 | − dhd_info_t *dhd = (dhd_info_t *) dhdp->info; | |
| 1401 | − | |
| 1402 | − if (dhd->dpc_tsk) { | |
| 1403 | − up(&dhd->dpc_sem); | |
| 1404 | − return; | |
| 1405 | − } | |
| 1406 | − | |
| 1407 | − tasklet_schedule(&dhd->tasklet); | |
| 1408 | −} | |
| 1409 | − | |
| 1410 | −#ifdef TOE | |
| 1411 | 838 | /* Retrieve current toe component enables, which are kept |
| 1412 | 839 | as a bitmap in toe_ol iovar */ |
| 1413 | −static int dhd_toe_get(dhd_info_t *dhd, int ifidx, u32 *toe_ol) | |
| 840 | +static int brcmf_toe_get(struct brcmf_info *drvr_priv, int ifidx, u32 *toe_ol) | |
| 1414 | 841 | { |
| 1415 | − wl_ioctl_t ioc; | |
| 842 | + struct brcmf_ioctl ioc; | |
| 1416 | 843 | char buf[32]; |
| 1417 | 844 | int ret; |
| 1418 | 845 | |
| 1419 | 846 | memset(&ioc, 0, sizeof(ioc)); |
| 1420 | 847 | |
| 1421 | − ioc.cmd = WLC_GET_VAR; | |
| 848 | + ioc.cmd = BRCMF_C_GET_VAR; | |
| 1422 | 849 | ioc.buf = buf; |
| 1423 | 850 | ioc.len = (uint) sizeof(buf); |
| 1424 | 851 | ioc.set = false; |
| 1425 | 852 | |
| 1426 | 853 | strcpy(buf, "toe_ol"); |
| 1427 | − ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 854 | + ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 1428 | 855 | if (ret < 0) { |
| 1429 | 856 | /* Check for older dongle image that doesn't support toe_ol */ |
| 1430 | 857 | if (ret == -EIO) { |
| 1431 | − DHD_ERROR(("%s: toe not supported by device\n", | |
| 1432 | − dhd_ifname(&dhd->pub, ifidx))); | |
| 858 | + BRCMF_ERROR(("%s: toe not supported by device\n", | |
| 859 | + brcmf_ifname(&drvr_priv->pub, ifidx))); | |
| 1433 | 860 | return -EOPNOTSUPP; |
| 1434 | 861 | } |
| 1435 | 862 | |
| 1436 | − DHD_INFO(("%s: could not get toe_ol: ret=%d\n", | |
| 1437 | − dhd_ifname(&dhd->pub, ifidx), ret)); | |
| 863 | + BRCMF_INFO(("%s: could not get toe_ol: ret=%d\n", | |
| 864 | + brcmf_ifname(&drvr_priv->pub, ifidx), ret)); | |
| 1438 | 865 | return ret; |
| 1439 | 866 | } |
| 1440 | 867 | |
| @@ -1444,15 +871,15 @@ static int dhd_toe_get(dhd_info_t *dhd, int ifidx, u32 *toe_ol) · 3 unmodified lines | ||
| 1444 | 871 | |
| 1445 | 872 | /* Set current toe component enables in toe_ol iovar, |
| 1446 | 873 | and set toe global enable iovar */ |
| 1447 | −static int dhd_toe_set(dhd_info_t *dhd, int ifidx, u32 toe_ol) | |
| 874 | +static int brcmf_toe_set(struct brcmf_info *drvr_priv, int ifidx, u32 toe_ol) | |
| 1448 | 875 | { |
| 1449 | − wl_ioctl_t ioc; | |
| 876 | + struct brcmf_ioctl ioc; | |
| 1450 | 877 | char buf[32]; |
| 1451 | 878 | int toe, ret; |
| 1452 | 879 | |
| 1453 | 880 | memset(&ioc, 0, sizeof(ioc)); |
| 1454 | 881 | |
| 1455 | − ioc.cmd = WLC_SET_VAR; | |
| 882 | + ioc.cmd = BRCMF_C_SET_VAR; | |
| 1456 | 883 | ioc.buf = buf; |
| 1457 | 884 | ioc.len = (uint) sizeof(buf); |
| 1458 | 885 | ioc.set = true; |
| @@ -1462,10 +889,10 @@ static int dhd_toe_set(dhd_info_t *dhd, int ifidx, u32 toe_ol) · 3 unmodified lines | ||
| 1462 | 889 | strcpy(buf, "toe_ol"); |
| 1463 | 890 | memcpy(&buf[sizeof("toe_ol")], &toe_ol, sizeof(u32)); |
| 1464 | 891 | |
| 1465 | − ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 892 | + ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 1466 | 893 | if (ret < 0) { |
| 1467 | − DHD_ERROR(("%s: could not set toe_ol: ret=%d\n", | |
| 1468 | − dhd_ifname(&dhd->pub, ifidx), ret)); | |
| 894 | + BRCMF_ERROR(("%s: could not set toe_ol: ret=%d\n", | |
| 895 | + brcmf_ifname(&drvr_priv->pub, ifidx), ret)); | |
| 1469 | 896 | return ret; |
| 1470 | 897 | } |
| 1471 | 898 | |
| @@ -1476,44 +903,42 @@ static int dhd_toe_set(dhd_info_t *dhd, int ifidx, u32 toe_ol) · 4 unmodified lines | ||
| 1476 | 903 | strcpy(buf, "toe"); |
| 1477 | 904 | memcpy(&buf[sizeof("toe")], &toe, sizeof(u32)); |
| 1478 | 905 | |
| 1479 | − ret = dhd_prot_ioctl(&dhd->pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 906 | + ret = brcmf_proto_ioctl(&drvr_priv->pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 1480 | 907 | if (ret < 0) { |
| 1481 | − DHD_ERROR(("%s: could not set toe: ret=%d\n", | |
| 1482 | − dhd_ifname(&dhd->pub, ifidx), ret)); | |
| 908 | + BRCMF_ERROR(("%s: could not set toe: ret=%d\n", | |
| 909 | + brcmf_ifname(&drvr_priv->pub, ifidx), ret)); | |
| 1483 | 910 | return ret; |
| 1484 | 911 | } |
| 1485 | 912 | |
| 1486 | 913 | return 0; |
| 1487 | 914 | } |
| 1488 | −#endif /* TOE */ | |
| 1489 | 915 | |
| 1490 | −static void dhd_ethtool_get_drvinfo(struct net_device *net, | |
| 916 | +static void brcmf_ethtool_get_drvinfo(struct net_device *net, | |
| 1491 | 917 | struct ethtool_drvinfo *info) |
| 1492 | 918 | { |
| 1493 | − dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net); | |
| 919 | + struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net); | |
| 1494 | 920 | |
| 1495 | − sprintf(info->driver, DRV_MODULE_NAME); | |
| 1496 | − sprintf(info->version, "%lu", dhd->pub.drv_version); | |
| 1497 | − sprintf(info->fw_version, "%s", wl_cfg80211_get_fwname()); | |
| 1498 | − sprintf(info->bus_info, "%s", dev_name(&wl_cfg80211_get_sdio_func()->dev)); | |
| 921 | + sprintf(info->driver, KBUILD_MODNAME); | |
| 922 | + sprintf(info->version, "%lu", drvr_priv->pub.drv_version); | |
| 923 | + sprintf(info->fw_version, "%s", BCM4329_FW_NAME); | |
| 924 | + sprintf(info->bus_info, "%s", | |
| 925 | + dev_name(&brcmf_cfg80211_get_sdio_func()->dev)); | |
| 1499 | 926 | } |
| 1500 | 927 | |
| 1501 | −struct ethtool_ops dhd_ethtool_ops = { | |
| 1502 | − .get_drvinfo = dhd_ethtool_get_drvinfo | |
| 928 | +struct ethtool_ops brcmf_ethtool_ops = { | |
| 929 | + .get_drvinfo = brcmf_ethtool_get_drvinfo | |
| 1503 | 930 | }; |
| 1504 | 931 | |
| 1505 | −static int dhd_ethtool(dhd_info_t *dhd, void *uaddr) | |
| 932 | +static int brcmf_ethtool(struct brcmf_info *drvr_priv, void *uaddr) | |
| 1506 | 933 | { |
| 1507 | 934 | struct ethtool_drvinfo info; |
| 1508 | 935 | char drvname[sizeof(info.driver)]; |
| 1509 | 936 | u32 cmd; |
| 1510 | −#ifdef TOE | |
| 1511 | 937 | struct ethtool_value edata; |
| 1512 | 938 | u32 toe_cmpnt, csum_dir; |
| 1513 | 939 | int ret; |
| 1514 | −#endif | |
| 1515 | 940 | |
| 1516 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 941 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 1517 | 942 | |
| 1518 | 943 | /* all ethtool calls start with a cmd word */ |
| 1519 | 944 | if (copy_from_user(&cmd, uaddr, sizeof(u32))) |
| @@ -1531,36 +956,35 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr) · 11 unmodified lines | ||
| 1531 | 956 | memset(&info, 0, sizeof(info)); |
| 1532 | 957 | info.cmd = cmd; |
| 1533 | 958 | |
| 1534 | − /* if dhd requested, identify ourselves */ | |
| 959 | + /* if requested, identify ourselves */ | |
| 1535 | 960 | if (strcmp(drvname, "?dhd") == 0) { |
| 1536 | 961 | sprintf(info.driver, "dhd"); |
| 1537 | − strcpy(info.version, EPI_VERSION_STR); | |
| 962 | + strcpy(info.version, BRCMF_VERSION_STR); | |
| 1538 | 963 | } |
| 1539 | 964 | |
| 1540 | 965 | /* otherwise, require dongle to be up */ |
| 1541 | − else if (!dhd->pub.up) { | |
| 1542 | − DHD_ERROR(("%s: dongle is not up\n", __func__)); | |
| 966 | + else if (!drvr_priv->pub.up) { | |
| 967 | + BRCMF_ERROR(("%s: dongle is not up\n", __func__)); | |
| 1543 | 968 | return -ENODEV; |
| 1544 | 969 | } |
| 1545 | 970 | |
| 1546 | 971 | /* finally, report dongle driver type */ |
| 1547 | − else if (dhd->pub.iswl) | |
| 972 | + else if (drvr_priv->pub.iswl) | |
| 1548 | 973 | sprintf(info.driver, "wl"); |
| 1549 | 974 | else |
| 1550 | 975 | sprintf(info.driver, "xx"); |
| 1551 | 976 | |
| 1552 | − sprintf(info.version, "%lu", dhd->pub.drv_version); | |
| 977 | + sprintf(info.version, "%lu", drvr_priv->pub.drv_version); | |
| 1553 | 978 | if (copy_to_user(uaddr, &info, sizeof(info))) |
| 1554 | 979 | return -EFAULT; |
| 1555 | − DHD_CTL(("%s: given %*s, returning %s\n", __func__, | |
| 1556 | − (int)sizeof(drvname), drvname, info.driver)); | |
| 980 | + BRCMF_CTL(("%s: given %*s, returning %s\n", __func__, | |
| 981 | + (int)sizeof(drvname), drvname, info.driver)); | |
| 1557 | 982 | break; |
| 1558 | 983 | |
| 1559 | −#ifdef TOE | |
| 1560 | 984 | /* Get toe offload components from dongle */ |
| 1561 | 985 | case ETHTOOL_GRXCSUM: |
| 1562 | 986 | case ETHTOOL_GTXCSUM: |
| 1563 | − ret = dhd_toe_get(dhd, 0, &toe_cmpnt); | |
| 987 | + ret = brcmf_toe_get(drvr_priv, 0, &toe_cmpnt); | |
| 1564 | 988 | if (ret < 0) |
| 1565 | 989 | return ret; |
| 1566 | 990 | |
| @@ -1581,7 +1005,7 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr) · 14 unmodified lines | ||
| 1581 | 1005 | return -EFAULT; |
| 1582 | 1006 | |
| 1583 | 1007 | /* Read the current settings, update and write back */ |
| 1584 | − ret = dhd_toe_get(dhd, 0, &toe_cmpnt); | |
| 1008 | + ret = brcmf_toe_get(drvr_priv, 0, &toe_cmpnt); | |
| 1585 | 1009 | if (ret < 0) |
| 1586 | 1010 | return ret; |
| 1587 | 1011 | |
| @@ -1593,22 +1017,21 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr) · 5 unmodified lines | ||
| 1593 | 1017 | else |
| 1594 | 1018 | toe_cmpnt &= ~csum_dir; |
| 1595 | 1019 | |
| 1596 | − ret = dhd_toe_set(dhd, 0, toe_cmpnt); | |
| 1020 | + ret = brcmf_toe_set(drvr_priv, 0, toe_cmpnt); | |
| 1597 | 1021 | if (ret < 0) |
| 1598 | 1022 | return ret; |
| 1599 | 1023 | |
| 1600 | 1024 | /* If setting TX checksum mode, tell Linux the new mode */ |
| 1601 | 1025 | if (cmd == ETHTOOL_STXCSUM) { |
| 1602 | 1026 | if (edata.data) |
| 1603 | − dhd->iflist[0]->net->features |= | |
| 1027 | + drvr_priv->iflist[0]->net->features |= | |
| 1604 | 1028 | NETIF_F_IP_CSUM; |
| 1605 | 1029 | else |
| 1606 | − dhd->iflist[0]->net->features &= | |
| 1030 | + drvr_priv->iflist[0]->net->features &= | |
| 1607 | 1031 | ~NETIF_F_IP_CSUM; |
| 1608 | 1032 | } |
| 1609 | 1033 | |
| 1610 | 1034 | break; |
| 1611 | −#endif /* TOE */ | |
| 1612 | 1035 | |
| 1613 | 1036 | default: |
| 1614 | 1037 | return -EOPNOTSUPP; |
| @@ -1617,10 +1040,11 @@ static int dhd_ethtool(dhd_info_t *dhd, void *uaddr) · 2 unmodified lines | ||
| 1617 | 1040 | return 0; |
| 1618 | 1041 | } |
| 1619 | 1042 | |
| 1620 | −static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) | |
| 1043 | +static int brcmf_netdev_ioctl_entry(struct net_device *net, struct ifreq *ifr, | |
| 1044 | + int cmd) | |
| 1621 | 1045 | { |
| 1622 | − dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net); | |
| 1623 | − dhd_ioctl_t ioc; | |
| 1046 | + struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net); | |
| 1047 | + struct brcmf_c_ioctl ioc; | |
| 1624 | 1048 | int bcmerror = 0; |
| 1625 | 1049 | int buflen = 0; |
| 1626 | 1050 | void *buf = NULL; |
| @@ -1628,22 +1052,14 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) · 1 unmodified line | ||
| 1628 | 1052 | int ifidx; |
| 1629 | 1053 | bool is_set_key_cmd; |
| 1630 | 1054 | |
| 1631 | − ifidx = dhd_net2idx(dhd, net); | |
| 1632 | − DHD_TRACE(("%s: ifidx %d, cmd 0x%04x\n", __func__, ifidx, cmd)); | |
| 1055 | + ifidx = brcmf_net2idx(drvr_priv, net); | |
| 1056 | + BRCMF_TRACE(("%s: ifidx %d, cmd 0x%04x\n", __func__, ifidx, cmd)); | |
| 1633 | 1057 | |
| 1634 | − if (ifidx == DHD_BAD_IF) | |
| 1058 | + if (ifidx == BRCMF_BAD_IF) | |
| 1635 | 1059 | return -1; |
| 1636 | 1060 | |
| 1637 | −#if defined(CONFIG_WIRELESS_EXT) | |
| 1638 | − /* linux wireless extensions */ | |
| 1639 | − if ((cmd >= SIOCIWFIRST) && (cmd <= SIOCIWLAST)) { | |
| 1640 | − /* may recurse, do NOT lock */ | |
| 1641 | − return wl_iw_ioctl(net, ifr, cmd); | |
| 1642 | − } | |
| 1643 | −#endif /* defined(CONFIG_WIRELESS_EXT) */ | |
| 1644 | − | |
| 1645 | 1061 | if (cmd == SIOCETHTOOL) |
| 1646 | − return dhd_ethtool(dhd, (void *)ifr->ifr_data); | |
| 1062 | + return brcmf_ethtool(drvr_priv, (void *)ifr->ifr_data); | |
| 1647 | 1063 | |
| 1648 | 1064 | if (cmd != SIOCDEVPRIVATE) |
| 1649 | 1065 | return -EOPNOTSUPP; |
| @@ -1651,14 +1067,14 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) · 1 unmodified line | ||
| 1651 | 1067 | memset(&ioc, 0, sizeof(ioc)); |
| 1652 | 1068 | |
| 1653 | 1069 | /* Copy the ioc control structure part of ioctl request */ |
| 1654 | − if (copy_from_user(&ioc, ifr->ifr_data, sizeof(wl_ioctl_t))) { | |
| 1070 | + if (copy_from_user(&ioc, ifr->ifr_data, sizeof(struct brcmf_ioctl))) { | |
| 1655 | 1071 | bcmerror = -EINVAL; |
| 1656 | 1072 | goto done; |
| 1657 | 1073 | } |
| 1658 | 1074 | |
| 1659 | 1075 | /* Copy out any buffer passed */ |
| 1660 | 1076 | if (ioc.buf) { |
| 1661 | − buflen = min_t(int, ioc.len, DHD_IOCTL_MAXLEN); | |
| 1077 | + buflen = min_t(int, ioc.len, BRCMF_IOCTL_MAXLEN); | |
| 1662 | 1078 | /* optimization for direct ioctl calls from kernel */ |
| 1663 | 1079 | /* |
| 1664 | 1080 | if (segment_eq(get_fs(), KERNEL_DS)) { |
| @@ -1678,9 +1094,9 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) · 13 unmodified lines | ||
| 1678 | 1094 | } |
| 1679 | 1095 | } |
| 1680 | 1096 | |
| 1681 | − /* To differentiate between wl and dhd read 4 more byes */ | |
| 1682 | − if ((copy_from_user(&driver, (char *)ifr->ifr_data + sizeof(wl_ioctl_t), | |
| 1683 | − sizeof(uint)) != 0)) { | |
| 1097 | + /* To differentiate read 4 more byes */ | |
| 1098 | + if ((copy_from_user(&driver, (char *)ifr->ifr_data + | |
| 1099 | + sizeof(struct brcmf_ioctl), sizeof(uint)) != 0)) { | |
| 1684 | 1100 | bcmerror = -EINVAL; |
| 1685 | 1101 | goto done; |
| 1686 | 1102 | } |
| @@ -1690,39 +1106,41 @@ static int dhd_ioctl_entry(struct net_device *net, struct ifreq *ifr, int cmd) · 3 unmodified lines | ||
| 1690 | 1106 | goto done; |
| 1691 | 1107 | } |
| 1692 | 1108 | |
| 1693 | − /* check for local dhd ioctl and handle it */ | |
| 1694 | − if (driver == DHD_IOCTL_MAGIC) { | |
| 1695 | − bcmerror = dhd_ioctl((void *)&dhd->pub, &ioc, buf, buflen); | |
| 1109 | + /* check for local brcmf ioctl and handle it */ | |
| 1110 | + if (driver == BRCMF_IOCTL_MAGIC) { | |
| 1111 | + bcmerror = brcmf_c_ioctl((void *)&drvr_priv->pub, &ioc, buf, buflen); | |
| 1696 | 1112 | if (bcmerror) |
| 1697 | − dhd->pub.bcmerror = bcmerror; | |
| 1113 | + drvr_priv->pub.bcmerror = bcmerror; | |
| 1698 | 1114 | goto done; |
| 1699 | 1115 | } |
| 1700 | 1116 | |
| 1701 | 1117 | /* send to dongle (must be up, and wl) */ |
| 1702 | − if ((dhd->pub.busstate != DHD_BUS_DATA)) { | |
| 1703 | − DHD_ERROR(("%s DONGLE_DOWN,__func__\n", __func__)); | |
| 1118 | + if ((drvr_priv->pub.busstate != BRCMF_BUS_DATA)) { | |
| 1119 | + BRCMF_ERROR(("%s DONGLE_DOWN,__func__\n", __func__)); | |
| 1704 | 1120 | bcmerror = -EIO; |
| 1705 | 1121 | goto done; |
| 1706 | 1122 | } |
| 1707 | 1123 | |
| 1708 | − if (!dhd->pub.iswl) { | |
| 1124 | + if (!drvr_priv->pub.iswl) { | |
| 1709 | 1125 | bcmerror = -EIO; |
| 1710 | 1126 | goto done; |
| 1711 | 1127 | } |
| 1712 | 1128 | |
| 1713 | − /* Intercept WLC_SET_KEY IOCTL - serialize M4 send and set key IOCTL to | |
| 1714 | − * prevent M4 encryption. | |
| 1129 | + /* | |
| 1130 | + * Intercept BRCMF_C_SET_KEY IOCTL - serialize M4 send and | |
| 1131 | + * set key IOCTL to prevent M4 encryption. | |
| 1715 | 1132 | */ |
| 1716 | − is_set_key_cmd = ((ioc.cmd == WLC_SET_KEY) || | |
| 1717 | − ((ioc.cmd == WLC_SET_VAR) && | |
| 1133 | + is_set_key_cmd = ((ioc.cmd == BRCMF_C_SET_KEY) || | |
| 1134 | + ((ioc.cmd == BRCMF_C_SET_VAR) && | |
| 1718 | 1135 | !(strncmp("wsec_key", ioc.buf, 9))) || |
| 1719 | − ((ioc.cmd == WLC_SET_VAR) && | |
| 1136 | + ((ioc.cmd == BRCMF_C_SET_VAR) && | |
| 1720 | 1137 | !(strncmp("bsscfg:wsec_key", ioc.buf, 15)))); |
| 1721 | 1138 | if (is_set_key_cmd) |
| 1722 | − dhd_wait_pend8021x(net); | |
| 1139 | + brcmf_netdev_wait_pend8021x(net); | |
| 1723 | 1140 | |
| 1724 | 1141 | bcmerror = |
| 1725 | − dhd_prot_ioctl(&dhd->pub, ifidx, (wl_ioctl_t *)&ioc, buf, buflen); | |
| 1142 | + brcmf_proto_ioctl(&drvr_priv->pub, ifidx, (struct brcmf_ioctl *)&ioc, | |
| 1143 | + buf, buflen); | |
| 1726 | 1144 | |
| 1727 | 1145 | done: |
| 1728 | 1146 | if (!bcmerror && buf && ioc.buf) { |
| @@ -1738,159 +1156,146 @@ done: · 9 unmodified lines | ||
| 1738 | 1156 | return bcmerror; |
| 1739 | 1157 | } |
| 1740 | 1158 | |
| 1741 | −static int dhd_stop(struct net_device *net) | |
| 1159 | +static int brcmf_netdev_stop(struct net_device *net) | |
| 1742 | 1160 | { |
| 1743 | 1161 | #if !defined(IGNORE_ETH0_DOWN) |
| 1744 | − dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net); | |
| 1162 | + struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net); | |
| 1745 | 1163 | |
| 1746 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 1747 | − if (IS_CFG80211_FAVORITE()) { | |
| 1748 | − wl_cfg80211_down(); | |
| 1749 | − } | |
| 1750 | − if (dhd->pub.up == 0) | |
| 1164 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 1165 | + brcmf_cfg80211_down(); | |
| 1166 | + if (drvr_priv->pub.up == 0) | |
| 1751 | 1167 | return 0; |
| 1752 | 1168 | |
| 1753 | 1169 | /* Set state and stop OS transmissions */ |
| 1754 | − dhd->pub.up = 0; | |
| 1170 | + drvr_priv->pub.up = 0; | |
| 1755 | 1171 | netif_stop_queue(net); |
| 1756 | 1172 | #else |
| 1757 | − DHD_ERROR(("BYPASS %s:due to BRCM compilation : under investigation\n", | |
| 1758 | − __func__)); | |
| 1173 | + BRCMF_ERROR(("BYPASS %s:due to BRCM compilation: under investigation\n", | |
| 1174 | + __func__)); | |
| 1759 | 1175 | #endif /* !defined(IGNORE_ETH0_DOWN) */ |
| 1760 | 1176 | |
| 1761 | 1177 | return 0; |
| 1762 | 1178 | } |
| 1763 | 1179 | |
| 1764 | −static int dhd_open(struct net_device *net) | |
| 1180 | +static int brcmf_netdev_open(struct net_device *net) | |
| 1765 | 1181 | { |
| 1766 | − dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(net); | |
| 1767 | −#ifdef TOE | |
| 1182 | + struct brcmf_info *drvr_priv = *(struct brcmf_info **) netdev_priv(net); | |
| 1768 | 1183 | u32 toe_ol; |
| 1769 | −#endif | |
| 1770 | − int ifidx = dhd_net2idx(dhd, net); | |
| 1184 | + int ifidx = brcmf_net2idx(drvr_priv, net); | |
| 1771 | 1185 | s32 ret = 0; |
| 1772 | 1186 | |
| 1773 | − DHD_TRACE(("%s: ifidx %d\n", __func__, ifidx)); | |
| 1187 | + BRCMF_TRACE(("%s: ifidx %d\n", __func__, ifidx)); | |
| 1774 | 1188 | |
| 1775 | 1189 | if (ifidx == 0) { /* do it only for primary eth0 */ |
| 1776 | 1190 | |
| 1777 | 1191 | /* try to bring up bus */ |
| 1778 | − ret = dhd_bus_start(&dhd->pub); | |
| 1192 | + ret = brcmf_bus_start(&drvr_priv->pub); | |
| 1779 | 1193 | if (ret != 0) { |
| 1780 | − DHD_ERROR(("%s: failed with code %d\n", __func__, ret)); | |
| 1194 | + BRCMF_ERROR(("%s: failed with code %d\n", | |
| 1195 | + __func__, ret)); | |
| 1781 | 1196 | return -1; |
| 1782 | 1197 | } |
| 1783 | − atomic_set(&dhd->pend_8021x_cnt, 0); | |
| 1198 | + atomic_set(&drvr_priv->pend_8021x_cnt, 0); | |
| 1784 | 1199 | |
| 1785 | − memcpy(net->dev_addr, dhd->pub.mac, ETH_ALEN); | |
| 1200 | + memcpy(net->dev_addr, drvr_priv->pub.mac, ETH_ALEN); | |
| 1786 | 1201 | |
| 1787 | −#ifdef TOE | |
| 1788 | 1202 | /* Get current TOE mode from dongle */ |
| 1789 | − if (dhd_toe_get(dhd, ifidx, &toe_ol) >= 0 | |
| 1203 | + if (brcmf_toe_get(drvr_priv, ifidx, &toe_ol) >= 0 | |
| 1790 | 1204 | && (toe_ol & TOE_TX_CSUM_OL) != 0) |
| 1791 | − dhd->iflist[ifidx]->net->features |= NETIF_F_IP_CSUM; | |
| 1205 | + drvr_priv->iflist[ifidx]->net->features |= | |
| 1206 | + NETIF_F_IP_CSUM; | |
| 1792 | 1207 | else |
| 1793 | − dhd->iflist[ifidx]->net->features &= ~NETIF_F_IP_CSUM; | |
| 1794 | −#endif | |
| 1208 | + drvr_priv->iflist[ifidx]->net->features &= | |
| 1209 | + ~NETIF_F_IP_CSUM; | |
| 1795 | 1210 | } |
| 1796 | 1211 | /* Allow transmit calls */ |
| 1797 | 1212 | netif_start_queue(net); |
| 1798 | − dhd->pub.up = 1; | |
| 1799 | − if (IS_CFG80211_FAVORITE()) { | |
| 1800 | − if (unlikely(wl_cfg80211_up())) { | |
| 1801 | − DHD_ERROR(("%s: failed to bring up cfg80211\n", | |
| 1802 | − __func__)); | |
| 1803 | − return -1; | |
| 1804 | − } | |
| 1213 | + drvr_priv->pub.up = 1; | |
| 1214 | + if (unlikely(brcmf_cfg80211_up())) { | |
| 1215 | + BRCMF_ERROR(("%s: failed to bring up cfg80211\n", | |
| 1216 | + __func__)); | |
| 1217 | + return -1; | |
| 1805 | 1218 | } |
| 1806 | 1219 | |
| 1807 | 1220 | return ret; |
| 1808 | 1221 | } |
| 1809 | 1222 | |
| 1810 | 1223 | int |
| 1811 | −dhd_add_if(dhd_info_t *dhd, int ifidx, void *handle, char *name, | |
| 1224 | +brcmf_add_if(struct brcmf_info *drvr_priv, int ifidx, void *handle, char *name, | |
| 1812 | 1225 | u8 *mac_addr, u32 flags, u8 bssidx) |
| 1813 | 1226 | { |
| 1814 | − dhd_if_t *ifp; | |
| 1815 | − | |
| 1816 | − DHD_TRACE(("%s: idx %d, handle->%p\n", __func__, ifidx, handle)); | |
| 1227 | + struct brcmf_if *ifp; | |
| 1817 | 1228 | |
| 1818 | − ASSERT(dhd && (ifidx < DHD_MAX_IFS)); | |
| 1229 | + BRCMF_TRACE(("%s: idx %d, handle->%p\n", __func__, ifidx, handle)); | |
| 1819 | 1230 | |
| 1820 | − ifp = dhd->iflist[ifidx]; | |
| 1821 | − if (!ifp && !(ifp = kmalloc(sizeof(dhd_if_t), GFP_ATOMIC))) { | |
| 1822 | − DHD_ERROR(("%s: OOM - dhd_if_t\n", __func__)); | |
| 1823 | − return -ENOMEM; | |
| 1231 | + ifp = drvr_priv->iflist[ifidx]; | |
| 1232 | + if (!ifp) { | |
| 1233 | + ifp = kmalloc(sizeof(struct brcmf_if), GFP_ATOMIC); | |
| 1234 | + if (!ifp) { | |
| 1235 | + BRCMF_ERROR(("%s: OOM - struct brcmf_if\n", __func__)); | |
| 1236 | + return -ENOMEM; | |
| 1237 | + } | |
| 1824 | 1238 | } |
| 1825 | 1239 | |
| 1826 | − memset(ifp, 0, sizeof(dhd_if_t)); | |
| 1827 | − ifp->info = dhd; | |
| 1828 | − dhd->iflist[ifidx] = ifp; | |
| 1240 | + memset(ifp, 0, sizeof(struct brcmf_if)); | |
| 1241 | + ifp->info = drvr_priv; | |
| 1242 | + drvr_priv->iflist[ifidx] = ifp; | |
| 1829 | 1243 | strlcpy(ifp->name, name, IFNAMSIZ); |
| 1830 | 1244 | if (mac_addr != NULL) |
| 1831 | 1245 | memcpy(&ifp->mac_addr, mac_addr, ETH_ALEN); |
| 1832 | 1246 | |
| 1833 | 1247 | if (handle == NULL) { |
| 1834 | − ifp->state = WLC_E_IF_ADD; | |
| 1248 | + ifp->state = BRCMF_E_IF_ADD; | |
| 1835 | 1249 | ifp->idx = ifidx; |
| 1836 | − ASSERT(dhd->sysioc_tsk); | |
| 1837 | − up(&dhd->sysioc_sem); | |
| 1250 | + up(&drvr_priv->sysioc_sem); | |
| 1838 | 1251 | } else |
| 1839 | 1252 | ifp->net = (struct net_device *)handle; |
| 1840 | 1253 | |
| 1841 | 1254 | return 0; |
| 1842 | 1255 | } |
| 1843 | 1256 | |
| 1844 | −void dhd_del_if(dhd_info_t *dhd, int ifidx) | |
| 1257 | +void brcmf_del_if(struct brcmf_info *drvr_priv, int ifidx) | |
| 1845 | 1258 | { |
| 1846 | − dhd_if_t *ifp; | |
| 1259 | + struct brcmf_if *ifp; | |
| 1847 | 1260 | |
| 1848 | − DHD_TRACE(("%s: idx %d\n", __func__, ifidx)); | |
| 1261 | + BRCMF_TRACE(("%s: idx %d\n", __func__, ifidx)); | |
| 1849 | 1262 | |
| 1850 | − ASSERT(dhd && ifidx && (ifidx < DHD_MAX_IFS)); | |
| 1851 | − ifp = dhd->iflist[ifidx]; | |
| 1263 | + ifp = drvr_priv->iflist[ifidx]; | |
| 1852 | 1264 | if (!ifp) { |
| 1853 | − DHD_ERROR(("%s: Null interface\n", __func__)); | |
| 1265 | + BRCMF_ERROR(("%s: Null interface\n", __func__)); | |
| 1854 | 1266 | return; |
| 1855 | 1267 | } |
| 1856 | 1268 | |
| 1857 | − ifp->state = WLC_E_IF_DEL; | |
| 1269 | + ifp->state = BRCMF_E_IF_DEL; | |
| 1858 | 1270 | ifp->idx = ifidx; |
| 1859 | − ASSERT(dhd->sysioc_tsk); | |
| 1860 | − up(&dhd->sysioc_sem); | |
| 1271 | + up(&drvr_priv->sysioc_sem); | |
| 1861 | 1272 | } |
| 1862 | 1273 | |
| 1863 | −dhd_pub_t *dhd_attach(struct dhd_bus *bus, uint bus_hdrlen) | |
| 1274 | +struct brcmf_pub *brcmf_attach(struct brcmf_bus *bus, uint bus_hdrlen) | |
| 1864 | 1275 | { |
| 1865 | − dhd_info_t *dhd = NULL; | |
| 1276 | + struct brcmf_info *drvr_priv = NULL; | |
| 1866 | 1277 | struct net_device *net; |
| 1867 | 1278 | |
| 1868 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 1869 | − /* updates firmware nvram path if it was provided as module | |
| 1870 | − paramters */ | |
| 1871 | − if ((firmware_path != NULL) && (firmware_path[0] != '\0')) | |
| 1872 | − strcpy(fw_path, firmware_path); | |
| 1873 | − if ((nvram_path != NULL) && (nvram_path[0] != '\0')) | |
| 1874 | − strcpy(nv_path, nvram_path); | |
| 1279 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 1875 | 1280 | |
| 1876 | 1281 | /* Allocate etherdev, including space for private structure */ |
| 1877 | − net = alloc_etherdev(sizeof(dhd)); | |
| 1282 | + net = alloc_etherdev(sizeof(drvr_priv)); | |
| 1878 | 1283 | if (!net) { |
| 1879 | − DHD_ERROR(("%s: OOM - alloc_etherdev\n", __func__)); | |
| 1284 | + BRCMF_ERROR(("%s: OOM - alloc_etherdev\n", __func__)); | |
| 1880 | 1285 | goto fail; |
| 1881 | 1286 | } |
| 1882 | 1287 | |
| 1883 | − /* Allocate primary dhd_info */ | |
| 1884 | − dhd = kzalloc(sizeof(dhd_info_t), GFP_ATOMIC); | |
| 1885 | − if (!dhd) { | |
| 1886 | − DHD_ERROR(("%s: OOM - alloc dhd_info\n", __func__)); | |
| 1288 | + /* Allocate primary brcmf_info */ | |
| 1289 | + drvr_priv = kzalloc(sizeof(struct brcmf_info), GFP_ATOMIC); | |
| 1290 | + if (!drvr_priv) { | |
| 1291 | + BRCMF_ERROR(("%s: OOM - alloc brcmf_info\n", __func__)); | |
| 1887 | 1292 | goto fail; |
| 1888 | 1293 | } |
| 1889 | 1294 | |
| 1890 | 1295 | /* |
| 1891 | − * Save the dhd_info into the priv | |
| 1296 | + * Save the brcmf_info into the priv | |
| 1892 | 1297 | */ |
| 1893 | − memcpy(netdev_priv(net), &dhd, sizeof(dhd)); | |
| 1298 | + memcpy(netdev_priv(net), &drvr_priv, sizeof(drvr_priv)); | |
| 1894 | 1299 | |
| 1895 | 1300 | /* Set network interface name if it was provided as module parameter */ |
| 1896 | 1301 | if (iface_name[0]) { |
| @@ -1904,317 +1309,180 @@ dhd_pub_t *dhd_attach(struct dhd_bus *bus, uint bus_hdrlen) · 7 unmodified lines | ||
| 1904 | 1309 | strcat(net->name, "%d"); |
| 1905 | 1310 | } |
| 1906 | 1311 | |
| 1907 | − if (dhd_add_if(dhd, 0, (void *)net, net->name, NULL, 0, 0) == | |
| 1908 | − DHD_BAD_IF) | |
| 1312 | + if (brcmf_add_if(drvr_priv, 0, (void *)net, net->name, NULL, 0, 0) == | |
| 1313 | + BRCMF_BAD_IF) | |
| 1909 | 1314 | goto fail; |
| 1910 | 1315 | |
| 1911 | 1316 | net->netdev_ops = NULL; |
| 1912 | − sema_init(&dhd->proto_sem, 1); | |
| 1317 | + sema_init(&drvr_priv->proto_sem, 1); | |
| 1913 | 1318 | /* Initialize other structure content */ |
| 1914 | − init_waitqueue_head(&dhd->ioctl_resp_wait); | |
| 1915 | − init_waitqueue_head(&dhd->ctrl_wait); | |
| 1916 | − | |
| 1917 | − /* Initialize the spinlocks */ | |
| 1918 | − spin_lock_init(&dhd->sdlock); | |
| 1919 | − spin_lock_init(&dhd->txqlock); | |
| 1319 | + init_waitqueue_head(&drvr_priv->ioctl_resp_wait); | |
| 1920 | 1320 | |
| 1921 | 1321 | /* Link to info module */ |
| 1922 | − dhd->pub.info = dhd; | |
| 1322 | + drvr_priv->pub.info = drvr_priv; | |
| 1923 | 1323 | |
| 1924 | 1324 | /* Link to bus module */ |
| 1925 | − dhd->pub.bus = bus; | |
| 1926 | − dhd->pub.hdrlen = bus_hdrlen; | |
| 1325 | + drvr_priv->pub.bus = bus; | |
| 1326 | + drvr_priv->pub.hdrlen = bus_hdrlen; | |
| 1927 | 1327 | |
| 1928 | 1328 | /* Attach and link in the protocol */ |
| 1929 | − if (dhd_prot_attach(&dhd->pub) != 0) { | |
| 1930 | − DHD_ERROR(("dhd_prot_attach failed\n")); | |
| 1329 | + if (brcmf_proto_attach(&drvr_priv->pub) != 0) { | |
| 1330 | + BRCMF_ERROR(("brcmf_prot_attach failed\n")); | |
| 1931 | 1331 | goto fail; |
| 1932 | 1332 | } |
| 1933 | −#if defined(CONFIG_WIRELESS_EXT) | |
| 1934 | − /* Attach and link in the iw */ | |
| 1935 | − if (wl_iw_attach(net, (void *)&dhd->pub) != 0) { | |
| 1936 | − DHD_ERROR(("wl_iw_attach failed\n")); | |
| 1937 | − goto fail; | |
| 1938 | − } | |
| 1939 | −#endif /* defined(CONFIG_WIRELESS_EXT) */ | |
| 1940 | 1333 | |
| 1941 | 1334 | /* Attach and link in the cfg80211 */ |
| 1942 | − if (IS_CFG80211_FAVORITE()) { | |
| 1943 | − if (unlikely(wl_cfg80211_attach(net, &dhd->pub))) { | |
| 1944 | − DHD_ERROR(("wl_cfg80211_attach failed\n")); | |
| 1945 | − goto fail; | |
| 1946 | − } | |
| 1947 | − if (!NO_FW_REQ()) { | |
| 1948 | − strcpy(fw_path, wl_cfg80211_get_fwname()); | |
| 1949 | − strcpy(nv_path, wl_cfg80211_get_nvramname()); | |
| 1950 | − } | |
| 1951 | − } | |
| 1952 | − | |
| 1953 | − /* Set up the watchdog timer */ | |
| 1954 | − init_timer(&dhd->timer); | |
| 1955 | − dhd->timer.data = (unsigned long) dhd; | |
| 1956 | − dhd->timer.function = dhd_watchdog; | |
| 1957 | − | |
| 1958 | − /* Initialize thread based operation and lock */ | |
| 1959 | − sema_init(&dhd->sdsem, 1); | |
| 1960 | − if ((dhd_watchdog_prio >= 0) && (dhd_dpc_prio >= 0)) | |
| 1961 | − dhd->threads_only = true; | |
| 1962 | − else | |
| 1963 | − dhd->threads_only = false; | |
| 1964 | − | |
| 1965 | − if (dhd_dpc_prio >= 0) { | |
| 1966 | − /* Initialize watchdog thread */ | |
| 1967 | − sema_init(&dhd->watchdog_sem, 0); | |
| 1968 | − dhd->watchdog_tsk = kthread_run(dhd_watchdog_thread, dhd, | |
| 1969 | − "dhd_watchdog"); | |
| 1970 | − if (IS_ERR(dhd->watchdog_tsk)) { | |
| 1971 | − printk(KERN_WARNING | |
| 1972 | − "dhd_watchdog thread failed to start\n"); | |
| 1973 | − dhd->watchdog_tsk = NULL; | |
| 1974 | − } | |
| 1975 | − } else { | |
| 1976 | − dhd->watchdog_tsk = NULL; | |
| 1977 | − } | |
| 1978 | − | |
| 1979 | − /* Set up the bottom half handler */ | |
| 1980 | − if (dhd_dpc_prio >= 0) { | |
| 1981 | − /* Initialize DPC thread */ | |
| 1982 | − sema_init(&dhd->dpc_sem, 0); | |
| 1983 | − dhd->dpc_tsk = kthread_run(dhd_dpc_thread, dhd, "dhd_dpc"); | |
| 1984 | − if (IS_ERR(dhd->dpc_tsk)) { | |
| 1985 | − printk(KERN_WARNING | |
| 1986 | − "dhd_dpc thread failed to start\n"); | |
| 1987 | − dhd->dpc_tsk = NULL; | |
| 1988 | − } | |
| 1989 | − } else { | |
| 1990 | − tasklet_init(&dhd->tasklet, dhd_dpc, (unsigned long) dhd); | |
| 1991 | − dhd->dpc_tsk = NULL; | |
| 1335 | + if (unlikely(brcmf_cfg80211_attach(net, &drvr_priv->pub))) { | |
| 1336 | + BRCMF_ERROR(("wl_cfg80211_attach failed\n")); | |
| 1337 | + goto fail; | |
| 1992 | 1338 | } |
| 1993 | 1339 | |
| 1994 | − if (dhd_sysioc) { | |
| 1995 | − sema_init(&dhd->sysioc_sem, 0); | |
| 1996 | − dhd->sysioc_tsk = kthread_run(_dhd_sysioc_thread, dhd, | |
| 1997 | − "_dhd_sysioc"); | |
| 1998 | − if (IS_ERR(dhd->sysioc_tsk)) { | |
| 1340 | + if (brcmf_sysioc) { | |
| 1341 | + sema_init(&drvr_priv->sysioc_sem, 0); | |
| 1342 | + drvr_priv->sysioc_tsk = kthread_run(_brcmf_sysioc_thread, drvr_priv, | |
| 1343 | + "_brcmf_sysioc"); | |
| 1344 | + if (IS_ERR(drvr_priv->sysioc_tsk)) { | |
| 1999 | 1345 | printk(KERN_WARNING |
| 2000 | − "_dhd_sysioc thread failed to start\n"); | |
| 2001 | − dhd->sysioc_tsk = NULL; | |
| 1346 | + "_brcmf_sysioc thread failed to start\n"); | |
| 1347 | + drvr_priv->sysioc_tsk = NULL; | |
| 2002 | 1348 | } |
| 2003 | 1349 | } else |
| 2004 | − dhd->sysioc_tsk = NULL; | |
| 1350 | + drvr_priv->sysioc_tsk = NULL; | |
| 2005 | 1351 | |
| 2006 | 1352 | /* |
| 2007 | − * Save the dhd_info into the priv | |
| 1353 | + * Save the brcmf_info into the priv | |
| 2008 | 1354 | */ |
| 2009 | − memcpy(netdev_priv(net), &dhd, sizeof(dhd)); | |
| 1355 | + memcpy(netdev_priv(net), &drvr_priv, sizeof(drvr_priv)); | |
| 2010 | 1356 | |
| 2011 | −#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) | |
| 2012 | − g_bus = bus; | |
| 2013 | −#endif | |
| 2014 | 1357 | #if defined(CONFIG_PM_SLEEP) |
| 2015 | − atomic_set(&dhd_mmc_suspend, false); | |
| 2016 | − if (!IS_CFG80211_FAVORITE()) | |
| 2017 | − register_pm_notifier(&dhd_sleep_pm_notifier); | |
| 1358 | + atomic_set(&brcmf_mmc_suspend, false); | |
| 2018 | 1359 | #endif /* defined(CONFIG_PM_SLEEP) */ |
| 2019 | − /* && defined(DHD_GPL) */ | |
| 2020 | − /* Init lock suspend to prevent kernel going to suspend */ | |
| 2021 | −#ifdef CONFIG_HAS_EARLYSUSPEND | |
| 2022 | − dhd->early_suspend.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + 20; | |
| 2023 | − dhd->early_suspend.suspend = dhd_early_suspend; | |
| 2024 | − dhd->early_suspend.resume = dhd_late_resume; | |
| 2025 | − register_early_suspend(&dhd->early_suspend); | |
| 2026 | −#endif | |
| 2027 | − | |
| 2028 | − return &dhd->pub; | |
| 1360 | + return &drvr_priv->pub; | |
| 2029 | 1361 | |
| 2030 | 1362 | fail: |
| 2031 | 1363 | if (net) |
| 2032 | 1364 | free_netdev(net); |
| 2033 | − if (dhd) | |
| 2034 | − dhd_detach(&dhd->pub); | |
| 1365 | + if (drvr_priv) | |
| 1366 | + brcmf_detach(&drvr_priv->pub); | |
| 2035 | 1367 | |
| 2036 | 1368 | return NULL; |
| 2037 | 1369 | } |
| 2038 | 1370 | |
| 2039 | −int dhd_bus_start(dhd_pub_t *dhdp) | |
| 1371 | +int brcmf_bus_start(struct brcmf_pub *drvr) | |
| 2040 | 1372 | { |
| 2041 | 1373 | int ret = -1; |
| 2042 | − dhd_info_t *dhd = (dhd_info_t *) dhdp->info; | |
| 2043 | −#ifdef EMBEDDED_PLATFORM | |
| 2044 | − char iovbuf[WL_EVENTING_MASK_LEN + 12]; /* Room for "event_msgs" + | |
| 2045 | − '\0' + bitvec */ | |
| 2046 | −#endif /* EMBEDDED_PLATFORM */ | |
| 2047 | − | |
| 2048 | − ASSERT(dhd); | |
| 2049 | − | |
| 2050 | − DHD_TRACE(("%s:\n", __func__)); | |
| 2051 | − | |
| 2052 | − /* try to download image and nvram to the dongle */ | |
| 2053 | − if (dhd->pub.busstate == DHD_BUS_DOWN) { | |
| 2054 | − if (!(dhd_bus_download_firmware(dhd->pub.bus, | |
| 2055 | − fw_path, nv_path))) { | |
| 2056 | − DHD_ERROR(("%s: dhdsdio_probe_download failed. " | |
| 2057 | − "firmware = %s nvram = %s\n", | |
| 2058 | − __func__, fw_path, nv_path)); | |
| 2059 | − return -1; | |
| 2060 | − } | |
| 2061 | − } | |
| 1374 | + struct brcmf_info *drvr_priv = drvr->info; | |
| 1375 | + /* Room for "event_msgs" + '\0' + bitvec */ | |
| 1376 | + char iovbuf[BRCMF_EVENTING_MASK_LEN + 12]; | |
| 2062 | 1377 | |
| 2063 | − /* Start the watchdog timer */ | |
| 2064 | − dhd->pub.tickcnt = 0; | |
| 2065 | − dhd_os_wd_timer(&dhd->pub, dhd_watchdog_ms); | |
| 1378 | + BRCMF_TRACE(("%s:\n", __func__)); | |
| 2066 | 1379 | |
| 2067 | 1380 | /* Bring up the bus */ |
| 2068 | − ret = dhd_bus_init(&dhd->pub, true); | |
| 1381 | + ret = brcmf_sdbrcm_bus_init(&drvr_priv->pub, true); | |
| 2069 | 1382 | if (ret != 0) { |
| 2070 | − DHD_ERROR(("%s, dhd_bus_init failed %d\n", __func__, ret)); | |
| 1383 | + BRCMF_ERROR(("%s, brcmf_sdbrcm_bus_init failed %d\n", __func__, | |
| 1384 | + ret)); | |
| 2071 | 1385 | return ret; |
| 2072 | 1386 | } |
| 2073 | −#if defined(OOB_INTR_ONLY) | |
| 2074 | − /* Host registration for OOB interrupt */ | |
| 2075 | − if (bcmsdh_register_oob_intr(dhdp)) { | |
| 2076 | − del_timer_sync(&dhd->timer); | |
| 2077 | − dhd->wd_timer_valid = false; | |
| 2078 | − DHD_ERROR(("%s Host failed to resgister for OOB\n", __func__)); | |
| 2079 | − return -ENODEV; | |
| 2080 | − } | |
| 2081 | − | |
| 2082 | − /* Enable oob at firmware */ | |
| 2083 | − dhd_enable_oob_intr(dhd->pub.bus, true); | |
| 2084 | −#endif /* defined(OOB_INTR_ONLY) */ | |
| 2085 | 1387 | |
| 2086 | 1388 | /* If bus is not ready, can't come up */ |
| 2087 | − if (dhd->pub.busstate != DHD_BUS_DATA) { | |
| 2088 | − del_timer_sync(&dhd->timer); | |
| 2089 | − dhd->wd_timer_valid = false; | |
| 2090 | − DHD_ERROR(("%s failed bus is not ready\n", __func__)); | |
| 1389 | + if (drvr_priv->pub.busstate != BRCMF_BUS_DATA) { | |
| 1390 | + BRCMF_ERROR(("%s failed bus is not ready\n", __func__)); | |
| 2091 | 1391 | return -ENODEV; |
| 2092 | 1392 | } |
| 2093 | −#ifdef EMBEDDED_PLATFORM | |
| 2094 | − bcm_mkiovar("event_msgs", dhdp->eventmask, WL_EVENTING_MASK_LEN, iovbuf, | |
| 2095 | − sizeof(iovbuf)); | |
| 2096 | − dhdcdc_query_ioctl(dhdp, 0, WLC_GET_VAR, iovbuf, sizeof(iovbuf)); | |
| 2097 | − memcpy(dhdp->eventmask, iovbuf, WL_EVENTING_MASK_LEN); | |
| 2098 | − | |
| 2099 | − setbit(dhdp->eventmask, WLC_E_SET_SSID); | |
| 2100 | − setbit(dhdp->eventmask, WLC_E_PRUNE); | |
| 2101 | − setbit(dhdp->eventmask, WLC_E_AUTH); | |
| 2102 | − setbit(dhdp->eventmask, WLC_E_REASSOC); | |
| 2103 | − setbit(dhdp->eventmask, WLC_E_REASSOC_IND); | |
| 2104 | − setbit(dhdp->eventmask, WLC_E_DEAUTH_IND); | |
| 2105 | − setbit(dhdp->eventmask, WLC_E_DISASSOC_IND); | |
| 2106 | − setbit(dhdp->eventmask, WLC_E_DISASSOC); | |
| 2107 | − setbit(dhdp->eventmask, WLC_E_JOIN); | |
| 2108 | − setbit(dhdp->eventmask, WLC_E_ASSOC_IND); | |
| 2109 | − setbit(dhdp->eventmask, WLC_E_PSK_SUP); | |
| 2110 | − setbit(dhdp->eventmask, WLC_E_LINK); | |
| 2111 | − setbit(dhdp->eventmask, WLC_E_NDIS_LINK); | |
| 2112 | − setbit(dhdp->eventmask, WLC_E_MIC_ERROR); | |
| 2113 | − setbit(dhdp->eventmask, WLC_E_PMKID_CACHE); | |
| 2114 | − setbit(dhdp->eventmask, WLC_E_TXFAIL); | |
| 2115 | − setbit(dhdp->eventmask, WLC_E_JOIN_START); | |
| 2116 | − setbit(dhdp->eventmask, WLC_E_SCAN_COMPLETE); | |
| 2117 | −#ifdef PNO_SUPPORT | |
| 2118 | − setbit(dhdp->eventmask, WLC_E_PFN_NET_FOUND); | |
| 2119 | −#endif /* PNO_SUPPORT */ | |
| 1393 | + | |
| 1394 | + brcmu_mkiovar("event_msgs", drvr->eventmask, BRCMF_EVENTING_MASK_LEN, | |
| 1395 | + iovbuf, sizeof(iovbuf)); | |
| 1396 | + brcmf_proto_cdc_query_ioctl(drvr, 0, BRCMF_C_GET_VAR, iovbuf, | |
| 1397 | + sizeof(iovbuf)); | |
| 1398 | + memcpy(drvr->eventmask, iovbuf, BRCMF_EVENTING_MASK_LEN); | |
| 1399 | + | |
| 1400 | + setbit(drvr->eventmask, BRCMF_E_SET_SSID); | |
| 1401 | + setbit(drvr->eventmask, BRCMF_E_PRUNE); | |
| 1402 | + setbit(drvr->eventmask, BRCMF_E_AUTH); | |
| 1403 | + setbit(drvr->eventmask, BRCMF_E_REASSOC); | |
| 1404 | + setbit(drvr->eventmask, BRCMF_E_REASSOC_IND); | |
| 1405 | + setbit(drvr->eventmask, BRCMF_E_DEAUTH_IND); | |
| 1406 | + setbit(drvr->eventmask, BRCMF_E_DISASSOC_IND); | |
| 1407 | + setbit(drvr->eventmask, BRCMF_E_DISASSOC); | |
| 1408 | + setbit(drvr->eventmask, BRCMF_E_JOIN); | |
| 1409 | + setbit(drvr->eventmask, BRCMF_E_ASSOC_IND); | |
| 1410 | + setbit(drvr->eventmask, BRCMF_E_PSK_SUP); | |
| 1411 | + setbit(drvr->eventmask, BRCMF_E_LINK); | |
| 1412 | + setbit(drvr->eventmask, BRCMF_E_NDIS_LINK); | |
| 1413 | + setbit(drvr->eventmask, BRCMF_E_MIC_ERROR); | |
| 1414 | + setbit(drvr->eventmask, BRCMF_E_PMKID_CACHE); | |
| 1415 | + setbit(drvr->eventmask, BRCMF_E_TXFAIL); | |
| 1416 | + setbit(drvr->eventmask, BRCMF_E_JOIN_START); | |
| 1417 | + setbit(drvr->eventmask, BRCMF_E_SCAN_COMPLETE); | |
| 2120 | 1418 | |
| 2121 | 1419 | /* enable dongle roaming event */ |
| 2122 | 1420 | |
| 2123 | − dhdp->pktfilter_count = 1; | |
| 1421 | + drvr->pktfilter_count = 1; | |
| 2124 | 1422 | /* Setup filter to allow only unicast */ |
| 2125 | − dhdp->pktfilter[0] = "100 0 0 0 0x01 0x00"; | |
| 2126 | −#endif /* EMBEDDED_PLATFORM */ | |
| 1423 | + drvr->pktfilter[0] = "100 0 0 0 0x01 0x00"; | |
| 2127 | 1424 | |
| 2128 | 1425 | /* Bus is ready, do any protocol initialization */ |
| 2129 | − ret = dhd_prot_init(&dhd->pub); | |
| 1426 | + ret = brcmf_proto_init(&drvr_priv->pub); | |
| 2130 | 1427 | if (ret < 0) |
| 2131 | 1428 | return ret; |
| 2132 | 1429 | |
| 2133 | 1430 | return 0; |
| 2134 | 1431 | } |
| 2135 | 1432 | |
| 2136 | −int | |
| 2137 | −dhd_iovar(dhd_pub_t *pub, int ifidx, char *name, char *cmd_buf, uint cmd_len, | |
| 2138 | − int set) | |
| 2139 | −{ | |
| 2140 | − char buf[strlen(name) + 1 + cmd_len]; | |
| 2141 | − int len = sizeof(buf); | |
| 2142 | − wl_ioctl_t ioc; | |
| 2143 | − int ret; | |
| 2144 | − | |
| 2145 | − len = bcm_mkiovar(name, cmd_buf, cmd_len, buf, len); | |
| 2146 | − | |
| 2147 | − memset(&ioc, 0, sizeof(ioc)); | |
| 2148 | − | |
| 2149 | − ioc.cmd = set ? WLC_SET_VAR : WLC_GET_VAR; | |
| 2150 | − ioc.buf = buf; | |
| 2151 | − ioc.len = len; | |
| 2152 | − ioc.set = set; | |
| 2153 | − | |
| 2154 | − ret = dhd_prot_ioctl(pub, ifidx, &ioc, ioc.buf, ioc.len); | |
| 2155 | − if (!set && ret >= 0) | |
| 2156 | − memcpy(cmd_buf, buf, cmd_len); | |
| 2157 | − | |
| 2158 | − return ret; | |
| 2159 | −} | |
| 2160 | − | |
| 2161 | −static struct net_device_ops dhd_ops_pri = { | |
| 2162 | − .ndo_open = dhd_open, | |
| 2163 | − .ndo_stop = dhd_stop, | |
| 2164 | − .ndo_get_stats = dhd_get_stats, | |
| 2165 | − .ndo_do_ioctl = dhd_ioctl_entry, | |
| 2166 | − .ndo_start_xmit = dhd_start_xmit, | |
| 2167 | − .ndo_set_mac_address = dhd_set_mac_address, | |
| 2168 | − .ndo_set_multicast_list = dhd_set_multicast_list | |
| 1433 | +static struct net_device_ops brcmf_netdev_ops_pri = { | |
| 1434 | + .ndo_open = brcmf_netdev_open, | |
| 1435 | + .ndo_stop = brcmf_netdev_stop, | |
| 1436 | + .ndo_get_stats = brcmf_netdev_get_stats, | |
| 1437 | + .ndo_do_ioctl = brcmf_netdev_ioctl_entry, | |
| 1438 | + .ndo_start_xmit = brcmf_netdev_start_xmit, | |
| 1439 | + .ndo_set_mac_address = brcmf_netdev_set_mac_address, | |
| 1440 | + .ndo_set_multicast_list = brcmf_netdev_set_multicast_list | |
| 2169 | 1441 | }; |
| 2170 | 1442 | |
| 2171 | −int dhd_net_attach(dhd_pub_t *dhdp, int ifidx) | |
| 1443 | +int brcmf_net_attach(struct brcmf_pub *drvr, int ifidx) | |
| 2172 | 1444 | { |
| 2173 | − dhd_info_t *dhd = (dhd_info_t *) dhdp->info; | |
| 1445 | + struct brcmf_info *drvr_priv = drvr->info; | |
| 2174 | 1446 | struct net_device *net; |
| 2175 | 1447 | u8 temp_addr[ETH_ALEN] = { |
| 2176 | 1448 | 0x00, 0x90, 0x4c, 0x11, 0x22, 0x33}; |
| 2177 | 1449 | |
| 2178 | − DHD_TRACE(("%s: ifidx %d\n", __func__, ifidx)); | |
| 2179 | − | |
| 2180 | − ASSERT(dhd && dhd->iflist[ifidx]); | |
| 1450 | + BRCMF_TRACE(("%s: ifidx %d\n", __func__, ifidx)); | |
| 2181 | 1451 | |
| 2182 | − net = dhd->iflist[ifidx]->net; | |
| 2183 | − ASSERT(net); | |
| 2184 | − | |
| 2185 | − ASSERT(!net->netdev_ops); | |
| 2186 | − net->netdev_ops = &dhd_ops_pri; | |
| 1452 | + net = drvr_priv->iflist[ifidx]->net; | |
| 1453 | + net->netdev_ops = &brcmf_netdev_ops_pri; | |
| 2187 | 1454 | |
| 2188 | 1455 | /* |
| 2189 | 1456 | * We have to use the primary MAC for virtual interfaces |
| 2190 | 1457 | */ |
| 2191 | 1458 | if (ifidx != 0) { |
| 2192 | 1459 | /* for virtual interfaces use the primary MAC */ |
| 2193 | − memcpy(temp_addr, dhd->pub.mac, ETH_ALEN); | |
| 1460 | + memcpy(temp_addr, drvr_priv->pub.mac, ETH_ALEN); | |
| 2194 | 1461 | |
| 2195 | 1462 | } |
| 2196 | 1463 | |
| 2197 | 1464 | if (ifidx == 1) { |
| 2198 | − DHD_TRACE(("%s ACCESS POINT MAC: \n", __func__)); | |
| 1465 | + BRCMF_TRACE(("%s ACCESS POINT MAC:\n", __func__)); | |
| 2199 | 1466 | /* ACCESSPOINT INTERFACE CASE */ |
| 2200 | 1467 | temp_addr[0] |= 0X02; /* set bit 2 , |
| 2201 | 1468 | - Locally Administered address */ |
| 2202 | 1469 | |
| 2203 | 1470 | } |
| 2204 | − net->hard_header_len = ETH_HLEN + dhd->pub.hdrlen; | |
| 2205 | − net->ethtool_ops = &dhd_ethtool_ops; | |
| 1471 | + net->hard_header_len = ETH_HLEN + drvr_priv->pub.hdrlen; | |
| 1472 | + net->ethtool_ops = &brcmf_ethtool_ops; | |
| 2206 | 1473 | |
| 2207 | − dhd->pub.rxsz = net->mtu + net->hard_header_len + dhd->pub.hdrlen; | |
| 1474 | + drvr_priv->pub.rxsz = net->mtu + net->hard_header_len + | |
| 1475 | + drvr_priv->pub.hdrlen; | |
| 2208 | 1476 | |
| 2209 | 1477 | memcpy(net->dev_addr, temp_addr, ETH_ALEN); |
| 2210 | 1478 | |
| 2211 | 1479 | if (register_netdev(net) != 0) { |
| 2212 | − DHD_ERROR(("%s: couldn't register the net device\n", | |
| 2213 | − __func__)); | |
| 1480 | + BRCMF_ERROR(("%s: couldn't register the net device\n", | |
| 1481 | + __func__)); | |
| 2214 | 1482 | goto fail; |
| 2215 | 1483 | } |
| 2216 | 1484 | |
| 2217 | − DHD_INFO(("%s: Broadcom Dongle Host Driver\n", net->name)); | |
| 1485 | + BRCMF_INFO(("%s: Broadcom Dongle Host Driver\n", net->name)); | |
| 2218 | 1486 | |
| 2219 | 1487 | return 0; |
| 2220 | 1488 | |
| @@ -2223,221 +1491,139 @@ fail: · 2 unmodified lines | ||
| 2223 | 1491 | return -EBADE; |
| 2224 | 1492 | } |
| 2225 | 1493 | |
| 2226 | −void dhd_bus_detach(dhd_pub_t *dhdp) | |
| 1494 | +static void brcmf_bus_detach(struct brcmf_pub *drvr) | |
| 2227 | 1495 | { |
| 2228 | − dhd_info_t *dhd; | |
| 1496 | + struct brcmf_info *drvr_priv; | |
| 2229 | 1497 | |
| 2230 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 1498 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 2231 | 1499 | |
| 2232 | − if (dhdp) { | |
| 2233 | − dhd = (dhd_info_t *) dhdp->info; | |
| 2234 | − if (dhd) { | |
| 1500 | + if (drvr) { | |
| 1501 | + drvr_priv = drvr->info; | |
| 1502 | + if (drvr_priv) { | |
| 2235 | 1503 | /* Stop the protocol module */ |
| 2236 | − dhd_prot_stop(&dhd->pub); | |
| 1504 | + brcmf_proto_stop(&drvr_priv->pub); | |
| 2237 | 1505 | |
| 2238 | 1506 | /* Stop the bus module */ |
| 2239 | − dhd_bus_stop(dhd->pub.bus, true); | |
| 2240 | −#if defined(OOB_INTR_ONLY) | |
| 2241 | − bcmsdh_unregister_oob_intr(); | |
| 2242 | −#endif /* defined(OOB_INTR_ONLY) */ | |
| 2243 | − | |
| 2244 | − /* Clear the watchdog timer */ | |
| 2245 | − del_timer_sync(&dhd->timer); | |
| 2246 | − dhd->wd_timer_valid = false; | |
| 1507 | + brcmf_sdbrcm_bus_stop(drvr_priv->pub.bus, true); | |
| 2247 | 1508 | } |
| 2248 | 1509 | } |
| 2249 | 1510 | } |
| 2250 | 1511 | |
| 2251 | −void dhd_detach(dhd_pub_t *dhdp) | |
| 1512 | +void brcmf_detach(struct brcmf_pub *drvr) | |
| 2252 | 1513 | { |
| 2253 | − dhd_info_t *dhd; | |
| 1514 | + struct brcmf_info *drvr_priv; | |
| 2254 | 1515 | |
| 2255 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 1516 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 2256 | 1517 | |
| 2257 | − if (dhdp) { | |
| 2258 | − dhd = (dhd_info_t *) dhdp->info; | |
| 2259 | − if (dhd) { | |
| 2260 | − dhd_if_t *ifp; | |
| 1518 | + if (drvr) { | |
| 1519 | + drvr_priv = drvr->info; | |
| 1520 | + if (drvr_priv) { | |
| 1521 | + struct brcmf_if *ifp; | |
| 2261 | 1522 | int i; |
| 2262 | 1523 | |
| 2263 | −#if defined(CONFIG_HAS_EARLYSUSPEND) | |
| 2264 | − if (dhd->early_suspend.suspend) | |
| 2265 | − unregister_early_suspend(&dhd->early_suspend); | |
| 2266 | −#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */ | |
| 2267 | − | |
| 2268 | − for (i = 1; i < DHD_MAX_IFS; i++) | |
| 2269 | − if (dhd->iflist[i]) | |
| 2270 | − dhd_del_if(dhd, i); | |
| 1524 | + for (i = 1; i < BRCMF_MAX_IFS; i++) | |
| 1525 | + if (drvr_priv->iflist[i]) | |
| 1526 | + brcmf_del_if(drvr_priv, i); | |
| 2271 | 1527 | |
| 2272 | − ifp = dhd->iflist[0]; | |
| 2273 | − ASSERT(ifp); | |
| 2274 | − if (ifp->net->netdev_ops == &dhd_ops_pri) { | |
| 2275 | − dhd_stop(ifp->net); | |
| 1528 | + ifp = drvr_priv->iflist[0]; | |
| 1529 | + if (ifp->net->netdev_ops == &brcmf_netdev_ops_pri) { | |
| 1530 | + brcmf_netdev_stop(ifp->net); | |
| 2276 | 1531 | unregister_netdev(ifp->net); |
| 2277 | 1532 | } |
| 2278 | 1533 | |
| 2279 | − if (dhd->watchdog_tsk) { | |
| 2280 | − send_sig(SIGTERM, dhd->watchdog_tsk, 1); | |
| 2281 | − kthread_stop(dhd->watchdog_tsk); | |
| 2282 | − dhd->watchdog_tsk = NULL; | |
| 1534 | + if (drvr_priv->sysioc_tsk) { | |
| 1535 | + send_sig(SIGTERM, drvr_priv->sysioc_tsk, 1); | |
| 1536 | + kthread_stop(drvr_priv->sysioc_tsk); | |
| 1537 | + drvr_priv->sysioc_tsk = NULL; | |
| 2283 | 1538 | } |
| 2284 | 1539 | |
| 2285 | − if (dhd->dpc_tsk) { | |
| 2286 | − send_sig(SIGTERM, dhd->dpc_tsk, 1); | |
| 2287 | − kthread_stop(dhd->dpc_tsk); | |
| 2288 | − dhd->dpc_tsk = NULL; | |
| 2289 | − } else | |
| 2290 | − tasklet_kill(&dhd->tasklet); | |
| 2291 | − | |
| 2292 | − if (dhd->sysioc_tsk) { | |
| 2293 | − send_sig(SIGTERM, dhd->sysioc_tsk, 1); | |
| 2294 | − kthread_stop(dhd->sysioc_tsk); | |
| 2295 | − dhd->sysioc_tsk = NULL; | |
| 2296 | − } | |
| 1540 | + brcmf_bus_detach(drvr); | |
| 2297 | 1541 | |
| 2298 | − dhd_bus_detach(dhdp); | |
| 1542 | + if (drvr->prot) | |
| 1543 | + brcmf_proto_detach(drvr); | |
| 2299 | 1544 | |
| 2300 | − if (dhdp->prot) | |
| 2301 | − dhd_prot_detach(dhdp); | |
| 1545 | + brcmf_cfg80211_detach(); | |
| 2302 | 1546 | |
| 2303 | −#if defined(CONFIG_WIRELESS_EXT) | |
| 2304 | − wl_iw_detach(); | |
| 2305 | −#endif /* (CONFIG_WIRELESS_EXT) */ | |
| 2306 | − | |
| 2307 | − if (IS_CFG80211_FAVORITE()) | |
| 2308 | − wl_cfg80211_detach(); | |
| 2309 | − | |
| 2310 | −#if defined(CONFIG_PM_SLEEP) | |
| 2311 | − if (!IS_CFG80211_FAVORITE()) | |
| 2312 | − unregister_pm_notifier(&dhd_sleep_pm_notifier); | |
| 2313 | −#endif /* defined(CONFIG_PM_SLEEP) */ | |
| 2314 | − /* && defined(DHD_GPL) */ | |
| 2315 | 1547 | free_netdev(ifp->net); |
| 2316 | 1548 | kfree(ifp); |
| 2317 | − kfree(dhd); | |
| 1549 | + kfree(drvr_priv); | |
| 2318 | 1550 | } |
| 2319 | 1551 | } |
| 2320 | 1552 | } |
| 2321 | 1553 | |
| 2322 | −static void __exit dhd_module_cleanup(void) | |
| 1554 | +static void __exit brcmf_module_cleanup(void) | |
| 2323 | 1555 | { |
| 2324 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 1556 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 2325 | 1557 | |
| 2326 | − dhd_bus_unregister(); | |
| 2327 | −#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) | |
| 2328 | − wifi_del_dev(); | |
| 2329 | −#endif | |
| 2330 | − /* Call customer gpio to turn off power with WL_REG_ON signal */ | |
| 2331 | − dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF); | |
| 1558 | + brcmf_bus_unregister(); | |
| 2332 | 1559 | } |
| 2333 | 1560 | |
| 2334 | −static int __init dhd_module_init(void) | |
| 1561 | +static int __init brcmf_module_init(void) | |
| 2335 | 1562 | { |
| 2336 | 1563 | int error; |
| 2337 | 1564 | |
| 2338 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 1565 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 2339 | 1566 | |
| 2340 | − /* Sanity check on the module parameters */ | |
| 2341 | − do { | |
| 2342 | − /* Both watchdog and DPC as tasklets are ok */ | |
| 2343 | − if ((dhd_watchdog_prio < 0) && (dhd_dpc_prio < 0)) | |
| 2344 | − break; | |
| 2345 | − | |
| 2346 | − /* If both watchdog and DPC are threads, TX must be deferred */ | |
| 2347 | − if ((dhd_watchdog_prio >= 0) && (dhd_dpc_prio >= 0) | |
| 2348 | − && dhd_deferred_tx) | |
| 2349 | − break; | |
| 2350 | − | |
| 2351 | − DHD_ERROR(("Invalid module parameters.\n")); | |
| 2352 | − return -EINVAL; | |
| 2353 | − } while (0); | |
| 2354 | − /* Call customer gpio to turn on power with WL_REG_ON signal */ | |
| 2355 | − dhd_customer_gpio_wlan_ctrl(WLAN_POWER_ON); | |
| 2356 | − | |
| 2357 | −#if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) | |
| 2358 | − sema_init(&wifi_control_sem, 0); | |
| 2359 | − | |
| 2360 | − error = wifi_add_dev(); | |
| 2361 | − if (error) { | |
| 2362 | − DHD_ERROR(("%s: platform_driver_register failed\n", __func__)); | |
| 2363 | − goto failed; | |
| 2364 | − } | |
| 2365 | − | |
| 2366 | − /* Waiting callback after platform_driver_register is done or | |
| 2367 | − exit with error */ | |
| 2368 | − if (down_timeout(&wifi_control_sem, msecs_to_jiffies(1000)) != 0) { | |
| 2369 | − printk(KERN_ERR "%s: platform_driver_register timeout\n", | |
| 2370 | − __func__); | |
| 2371 | − /* remove device */ | |
| 2372 | − wifi_del_dev(); | |
| 2373 | − goto failed; | |
| 2374 | − } | |
| 2375 | −#endif /* #if defined(CUSTOMER_HW2) && defined(CONFIG_WIFI_CONTROL_FUNC) */ | |
| 2376 | − | |
| 2377 | − error = dhd_bus_register(); | |
| 1567 | + error = brcmf_bus_register(); | |
| 2378 | 1568 | |
| 2379 | 1569 | if (error) { |
| 2380 | − DHD_ERROR(("%s: sdio_register_driver failed\n", __func__)); | |
| 1570 | + BRCMF_ERROR(("%s: brcmf_bus_register failed\n", __func__)); | |
| 2381 | 1571 | goto failed; |
| 2382 | 1572 | } |
| 2383 | − return error; | |
| 1573 | + return 0; | |
| 2384 | 1574 | |
| 2385 | 1575 | failed: |
| 2386 | − /* turn off power and exit */ | |
| 2387 | − dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF); | |
| 2388 | 1576 | return -EINVAL; |
| 2389 | 1577 | } |
| 2390 | 1578 | |
| 2391 | −module_init(dhd_module_init); | |
| 2392 | −module_exit(dhd_module_cleanup); | |
| 1579 | +module_init(brcmf_module_init); | |
| 1580 | +module_exit(brcmf_module_cleanup); | |
| 2393 | 1581 | |
| 2394 | −/* | |
| 2395 | − * OS specific functions required to implement DHD driver in OS independent way | |
| 2396 | − */ | |
| 2397 | −int dhd_os_proto_block(dhd_pub_t *pub) | |
| 1582 | +int brcmf_os_proto_block(struct brcmf_pub *drvr) | |
| 2398 | 1583 | { |
| 2399 | − dhd_info_t *dhd = (dhd_info_t *) (pub->info); | |
| 1584 | + struct brcmf_info *drvr_priv = drvr->info; | |
| 2400 | 1585 | |
| 2401 | − if (dhd) { | |
| 2402 | − down(&dhd->proto_sem); | |
| 1586 | + if (drvr_priv) { | |
| 1587 | + down(&drvr_priv->proto_sem); | |
| 2403 | 1588 | return 1; |
| 2404 | 1589 | } |
| 2405 | 1590 | return 0; |
| 2406 | 1591 | } |
| 2407 | 1592 | |
| 2408 | −int dhd_os_proto_unblock(dhd_pub_t *pub) | |
| 1593 | +int brcmf_os_proto_unblock(struct brcmf_pub *drvr) | |
| 2409 | 1594 | { |
| 2410 | − dhd_info_t *dhd = (dhd_info_t *) (pub->info); | |
| 1595 | + struct brcmf_info *drvr_priv = drvr->info; | |
| 2411 | 1596 | |
| 2412 | − if (dhd) { | |
| 2413 | − up(&dhd->proto_sem); | |
| 1597 | + if (drvr_priv) { | |
| 1598 | + up(&drvr_priv->proto_sem); | |
| 2414 | 1599 | return 1; |
| 2415 | 1600 | } |
| 2416 | 1601 | |
| 2417 | 1602 | return 0; |
| 2418 | 1603 | } |
| 2419 | 1604 | |
| 2420 | −unsigned int dhd_os_get_ioctl_resp_timeout(void) | |
| 1605 | +unsigned int brcmf_os_get_ioctl_resp_timeout(void) | |
| 2421 | 1606 | { |
| 2422 | − return (unsigned int)dhd_ioctl_timeout_msec; | |
| 1607 | + return (unsigned int)brcmf_ioctl_timeout_msec; | |
| 2423 | 1608 | } |
| 2424 | 1609 | |
| 2425 | −void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec) | |
| 1610 | +void brcmf_os_set_ioctl_resp_timeout(unsigned int timeout_msec) | |
| 2426 | 1611 | { |
| 2427 | − dhd_ioctl_timeout_msec = (int)timeout_msec; | |
| 1612 | + brcmf_ioctl_timeout_msec = (int)timeout_msec; | |
| 2428 | 1613 | } |
| 2429 | 1614 | |
| 2430 | −int dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, bool *pending) | |
| 1615 | +int brcmf_os_ioctl_resp_wait(struct brcmf_pub *drvr, uint *condition, | |
| 1616 | + bool *pending) | |
| 2431 | 1617 | { |
| 2432 | − dhd_info_t *dhd = (dhd_info_t *) (pub->info); | |
| 1618 | + struct brcmf_info *drvr_priv = drvr->info; | |
| 2433 | 1619 | DECLARE_WAITQUEUE(wait, current); |
| 2434 | − int timeout = dhd_ioctl_timeout_msec; | |
| 1620 | + int timeout = brcmf_ioctl_timeout_msec; | |
| 2435 | 1621 | |
| 2436 | 1622 | /* Convert timeout in millsecond to jiffies */ |
| 2437 | 1623 | timeout = timeout * HZ / 1000; |
| 2438 | 1624 | |
| 2439 | 1625 | /* Wait until control frame is available */ |
| 2440 | − add_wait_queue(&dhd->ioctl_resp_wait, &wait); | |
| 1626 | + add_wait_queue(&drvr_priv->ioctl_resp_wait, &wait); | |
| 2441 | 1627 | set_current_state(TASK_INTERRUPTIBLE); |
| 2442 | 1628 | |
| 2443 | 1629 | while (!(*condition) && (!signal_pending(current) && timeout)) |
| @@ -2447,366 +1633,59 @@ int dhd_os_ioctl_resp_wait(dhd_pub_t *pub, uint *condition, bool *pending) · 3 unmodified lines | ||
| 2447 | 1633 | *pending = true; |
| 2448 | 1634 | |
| 2449 | 1635 | set_current_state(TASK_RUNNING); |
| 2450 | − remove_wait_queue(&dhd->ioctl_resp_wait, &wait); | |
| 1636 | + remove_wait_queue(&drvr_priv->ioctl_resp_wait, &wait); | |
| 2451 | 1637 | |
| 2452 | 1638 | return timeout; |
| 2453 | 1639 | } |
| 2454 | 1640 | |
| 2455 | −int dhd_os_ioctl_resp_wake(dhd_pub_t *pub) | |
| 1641 | +int brcmf_os_ioctl_resp_wake(struct brcmf_pub *drvr) | |
| 2456 | 1642 | { |
| 2457 | − dhd_info_t *dhd = (dhd_info_t *) (pub->info); | |
| 1643 | + struct brcmf_info *drvr_priv = drvr->info; | |
| 2458 | 1644 | |
| 2459 | − if (waitqueue_active(&dhd->ioctl_resp_wait)) | |
| 2460 | − wake_up_interruptible(&dhd->ioctl_resp_wait); | |
| 1645 | + if (waitqueue_active(&drvr_priv->ioctl_resp_wait)) | |
| 1646 | + wake_up_interruptible(&drvr_priv->ioctl_resp_wait); | |
| 2461 | 1647 | |
| 2462 | 1648 | return 0; |
| 2463 | 1649 | } |
| 2464 | 1650 | |
| 2465 | −void dhd_os_wd_timer(void *bus, uint wdtick) | |
| 2466 | −{ | |
| 2467 | − dhd_pub_t *pub = bus; | |
| 2468 | − static uint save_dhd_watchdog_ms; | |
| 2469 | − dhd_info_t *dhd = (dhd_info_t *) pub->info; | |
| 2470 | − | |
| 2471 | − /* don't start the wd until fw is loaded */ | |
| 2472 | − if (pub->busstate == DHD_BUS_DOWN) | |
| 2473 | − return; | |
| 2474 | − | |
| 2475 | − /* Totally stop the timer */ | |
| 2476 | − if (!wdtick && dhd->wd_timer_valid == true) { | |
| 2477 | − del_timer_sync(&dhd->timer); | |
| 2478 | − dhd->wd_timer_valid = false; | |
| 2479 | − save_dhd_watchdog_ms = wdtick; | |
| 2480 | − return; | |
| 2481 | − } | |
| 2482 | − | |
| 2483 | − if (wdtick) { | |
| 2484 | − dhd_watchdog_ms = (uint) wdtick; | |
| 2485 | − | |
| 2486 | − if (save_dhd_watchdog_ms != dhd_watchdog_ms) { | |
| 2487 | − | |
| 2488 | − if (dhd->wd_timer_valid == true) | |
| 2489 | − /* Stop timer and restart at new value */ | |
| 2490 | − del_timer_sync(&dhd->timer); | |
| 2491 | − | |
| 2492 | − /* Create timer again when watchdog period is | |
| 2493 | − dynamically changed or in the first instance | |
| 2494 | − */ | |
| 2495 | − dhd->timer.expires = | |
| 2496 | − jiffies + dhd_watchdog_ms * HZ / 1000; | |
| 2497 | − add_timer(&dhd->timer); | |
| 2498 | − | |
| 2499 | − } else { | |
| 2500 | − /* Re arm the timer, at last watchdog period */ | |
| 2501 | − mod_timer(&dhd->timer, | |
| 2502 | − jiffies + dhd_watchdog_ms * HZ / 1000); | |
| 2503 | − } | |
| 2504 | − | |
| 2505 | − dhd->wd_timer_valid = true; | |
| 2506 | − save_dhd_watchdog_ms = wdtick; | |
| 2507 | − } | |
| 2508 | −} | |
| 2509 | − | |
| 2510 | −void *dhd_os_open_image(char *filename) | |
| 2511 | −{ | |
| 2512 | − struct file *fp; | |
| 2513 | − | |
| 2514 | − if (IS_CFG80211_FAVORITE() && !NO_FW_REQ()) | |
| 2515 | − return wl_cfg80211_request_fw(filename); | |
| 2516 | − | |
| 2517 | − fp = filp_open(filename, O_RDONLY, 0); | |
| 2518 | − /* | |
| 2519 | − * 2.6.11 (FC4) supports filp_open() but later revs don't? | |
| 2520 | − * Alternative: | |
| 2521 | − * fp = open_namei(AT_FDCWD, filename, O_RD, 0); | |
| 2522 | − * ??? | |
| 2523 | − */ | |
| 2524 | − if (IS_ERR(fp)) | |
| 2525 | − fp = NULL; | |
| 2526 | − | |
| 2527 | − return fp; | |
| 2528 | −} | |
| 2529 | − | |
| 2530 | −int dhd_os_get_image_block(char *buf, int len, void *image) | |
| 2531 | −{ | |
| 2532 | − struct file *fp = (struct file *)image; | |
| 2533 | − int rdlen; | |
| 2534 | − | |
| 2535 | − if (IS_CFG80211_FAVORITE() && !NO_FW_REQ()) | |
| 2536 | − return wl_cfg80211_read_fw(buf, len); | |
| 2537 | − | |
| 2538 | − if (!image) | |
| 2539 | − return 0; | |
| 2540 | − | |
| 2541 | − rdlen = kernel_read(fp, fp->f_pos, buf, len); | |
| 2542 | − if (rdlen > 0) | |
| 2543 | − fp->f_pos += rdlen; | |
| 2544 | − | |
| 2545 | − return rdlen; | |
| 2546 | −} | |
| 2547 | − | |
| 2548 | −void dhd_os_close_image(void *image) | |
| 2549 | −{ | |
| 2550 | − if (IS_CFG80211_FAVORITE() && !NO_FW_REQ()) | |
| 2551 | − return wl_cfg80211_release_fw(); | |
| 2552 | − if (image) | |
| 2553 | − filp_close((struct file *)image, NULL); | |
| 2554 | −} | |
| 2555 | − | |
| 2556 | −void dhd_os_sdlock(dhd_pub_t *pub) | |
| 2557 | −{ | |
| 2558 | − dhd_info_t *dhd; | |
| 2559 | − | |
| 2560 | − dhd = (dhd_info_t *) (pub->info); | |
| 2561 | − | |
| 2562 | − if (dhd->threads_only) | |
| 2563 | − down(&dhd->sdsem); | |
| 2564 | − else | |
| 2565 | − spin_lock_bh(&dhd->sdlock); | |
| 2566 | −} | |
| 2567 | − | |
| 2568 | −void dhd_os_sdunlock(dhd_pub_t *pub) | |
| 2569 | −{ | |
| 2570 | − dhd_info_t *dhd; | |
| 2571 | − | |
| 2572 | − dhd = (dhd_info_t *) (pub->info); | |
| 2573 | − | |
| 2574 | − if (dhd->threads_only) | |
| 2575 | − up(&dhd->sdsem); | |
| 2576 | − else | |
| 2577 | − spin_unlock_bh(&dhd->sdlock); | |
| 2578 | −} | |
| 2579 | − | |
| 2580 | −void dhd_os_sdlock_txq(dhd_pub_t *pub) | |
| 2581 | −{ | |
| 2582 | − dhd_info_t *dhd; | |
| 2583 | − | |
| 2584 | − dhd = (dhd_info_t *) (pub->info); | |
| 2585 | − spin_lock_bh(&dhd->txqlock); | |
| 2586 | −} | |
| 2587 | − | |
| 2588 | −void dhd_os_sdunlock_txq(dhd_pub_t *pub) | |
| 2589 | −{ | |
| 2590 | − dhd_info_t *dhd; | |
| 2591 | − | |
| 2592 | − dhd = (dhd_info_t *) (pub->info); | |
| 2593 | − spin_unlock_bh(&dhd->txqlock); | |
| 2594 | −} | |
| 2595 | − | |
| 2596 | −void dhd_os_sdlock_rxq(dhd_pub_t *pub) | |
| 2597 | −{ | |
| 2598 | −} | |
| 2599 | − | |
| 2600 | −void dhd_os_sdunlock_rxq(dhd_pub_t *pub) | |
| 2601 | −{ | |
| 2602 | −} | |
| 2603 | − | |
| 2604 | −void dhd_os_sdtxlock(dhd_pub_t *pub) | |
| 2605 | −{ | |
| 2606 | − dhd_os_sdlock(pub); | |
| 2607 | −} | |
| 2608 | − | |
| 2609 | −void dhd_os_sdtxunlock(dhd_pub_t *pub) | |
| 2610 | −{ | |
| 2611 | − dhd_os_sdunlock(pub); | |
| 2612 | −} | |
| 2613 | − | |
| 2614 | −static int | |
| 2615 | −dhd_wl_host_event(dhd_info_t *dhd, int *ifidx, void *pktdata, | |
| 2616 | − wl_event_msg_t *event, void **data) | |
| 1651 | +static int brcmf_host_event(struct brcmf_info *drvr_priv, int *ifidx, void *pktdata, | |
| 1652 | + struct brcmf_event_msg *event, void **data) | |
| 2617 | 1653 | { |
| 2618 | 1654 | int bcmerror = 0; |
| 2619 | 1655 | |
| 2620 | − ASSERT(dhd != NULL); | |
| 2621 | − | |
| 2622 | − bcmerror = wl_host_event(dhd, ifidx, pktdata, event, data); | |
| 1656 | + bcmerror = brcmf_c_host_event(drvr_priv, ifidx, pktdata, event, data); | |
| 2623 | 1657 | if (bcmerror != 0) |
| 2624 | 1658 | return bcmerror; |
| 2625 | 1659 | |
| 2626 | −#if defined(CONFIG_WIRELESS_EXT) | |
| 2627 | − if (!IS_CFG80211_FAVORITE()) { | |
| 2628 | − if ((dhd->iflist[*ifidx] == NULL) | |
| 2629 | − || (dhd->iflist[*ifidx]->net == NULL)) { | |
| 2630 | − DHD_ERROR(("%s Exit null pointer\n", __func__)); | |
| 2631 | − return bcmerror; | |
| 2632 | − } | |
| 2633 | − | |
| 2634 | − if (dhd->iflist[*ifidx]->net) | |
| 2635 | − wl_iw_event(dhd->iflist[*ifidx]->net, event, *data); | |
| 2636 | − } | |
| 2637 | −#endif /* defined(CONFIG_WIRELESS_EXT) */ | |
| 2638 | − | |
| 2639 | − if (IS_CFG80211_FAVORITE()) { | |
| 2640 | − ASSERT(dhd->iflist[*ifidx] != NULL); | |
| 2641 | − ASSERT(dhd->iflist[*ifidx]->net != NULL); | |
| 2642 | − if (dhd->iflist[*ifidx]->net) | |
| 2643 | − wl_cfg80211_event(dhd->iflist[*ifidx]->net, event, | |
| 2644 | − *data); | |
| 2645 | − } | |
| 1660 | + if (drvr_priv->iflist[*ifidx]->net) | |
| 1661 | + brcmf_cfg80211_event(drvr_priv->iflist[*ifidx]->net, | |
| 1662 | + event, *data); | |
| 2646 | 1663 | |
| 2647 | 1664 | return bcmerror; |
| 2648 | 1665 | } |
| 2649 | 1666 | |
| 2650 | −/* send up locally generated event */ | |
| 2651 | −void dhd_sendup_event(dhd_pub_t *dhdp, wl_event_msg_t *event, void *data) | |
| 2652 | −{ | |
| 2653 | − switch (be32_to_cpu(event->event_type)) { | |
| 2654 | − default: | |
| 2655 | − break; | |
| 2656 | − } | |
| 2657 | −} | |
| 2658 | − | |
| 2659 | −void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar) | |
| 1667 | +int brcmf_netdev_reset(struct net_device *dev, u8 flag) | |
| 2660 | 1668 | { |
| 2661 | − struct dhd_info *dhdinfo = dhd->info; | |
| 2662 | − dhd_os_sdunlock(dhd); | |
| 2663 | − wait_event_interruptible_timeout(dhdinfo->ctrl_wait, | |
| 2664 | − (*lockvar == false), HZ * 2); | |
| 2665 | − dhd_os_sdlock(dhd); | |
| 2666 | − return; | |
| 2667 | −} | |
| 1669 | + struct brcmf_info *drvr_priv = *(struct brcmf_info **)netdev_priv(dev); | |
| 2668 | 1670 | |
| 2669 | −void dhd_wait_event_wakeup(dhd_pub_t *dhd) | |
| 2670 | −{ | |
| 2671 | − struct dhd_info *dhdinfo = dhd->info; | |
| 2672 | − if (waitqueue_active(&dhdinfo->ctrl_wait)) | |
| 2673 | − wake_up_interruptible(&dhdinfo->ctrl_wait); | |
| 2674 | − return; | |
| 2675 | −} | |
| 2676 | − | |
| 2677 | −int dhd_dev_reset(struct net_device *dev, u8 flag) | |
| 2678 | −{ | |
| 2679 | − dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); | |
| 2680 | − | |
| 2681 | − /* Turning off watchdog */ | |
| 2682 | − if (flag) | |
| 2683 | − dhd_os_wd_timer(&dhd->pub, 0); | |
| 2684 | − | |
| 2685 | − dhd_bus_devreset(&dhd->pub, flag); | |
| 2686 | − | |
| 2687 | − /* Turning on watchdog back */ | |
| 2688 | − if (!flag) | |
| 2689 | − dhd_os_wd_timer(&dhd->pub, dhd_watchdog_ms); | |
| 2690 | − DHD_ERROR(("%s: WLAN OFF DONE\n", __func__)); | |
| 1671 | + brcmf_bus_devreset(&drvr_priv->pub, flag); | |
| 2691 | 1672 | |
| 2692 | 1673 | return 1; |
| 2693 | 1674 | } |
| 2694 | 1675 | |
| 2695 | −int net_os_set_suspend_disable(struct net_device *dev, int val) | |
| 2696 | −{ | |
| 2697 | − dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); | |
| 2698 | − int ret = 0; | |
| 2699 | − | |
| 2700 | − if (dhd) { | |
| 2701 | − ret = dhd->pub.suspend_disable_flag; | |
| 2702 | − dhd->pub.suspend_disable_flag = val; | |
| 2703 | − } | |
| 2704 | − return ret; | |
| 2705 | −} | |
| 2706 | − | |
| 2707 | −int net_os_set_suspend(struct net_device *dev, int val) | |
| 1676 | +static int brcmf_get_pend_8021x_cnt(struct brcmf_info *drvr_priv) | |
| 2708 | 1677 | { |
| 2709 | − int ret = 0; | |
| 2710 | −#if defined(CONFIG_HAS_EARLYSUSPEND) | |
| 2711 | − dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); | |
| 2712 | − | |
| 2713 | − if (dhd) { | |
| 2714 | − dhd_os_proto_block(&dhd->pub); | |
| 2715 | − ret = dhd_set_suspend(val, &dhd->pub); | |
| 2716 | − dhd_os_proto_unblock(&dhd->pub); | |
| 2717 | − } | |
| 2718 | −#endif /* defined(CONFIG_HAS_EARLYSUSPEND) */ | |
| 2719 | − return ret; | |
| 2720 | −} | |
| 2721 | − | |
| 2722 | −int net_os_set_dtim_skip(struct net_device *dev, int val) | |
| 2723 | −{ | |
| 2724 | − dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(dev); | |
| 2725 | − | |
| 2726 | − if (dhd) | |
| 2727 | − dhd->pub.dtim_skip = val; | |
| 2728 | − | |
| 2729 | − return 0; | |
| 2730 | −} | |
| 2731 | − | |
| 2732 | −int net_os_set_packet_filter(struct net_device *dev, int val) | |
| 2733 | −{ | |
| 2734 | − dhd_info_t *dhd = *(dhd_info_t **) netdev_priv(dev); | |
| 2735 | − int ret = 0; | |
| 2736 | − | |
| 2737 | − /* Packet filtering is set only if we still in early-suspend and | |
| 2738 | − * we need either to turn it ON or turn it OFF | |
| 2739 | − * We can always turn it OFF in case of early-suspend, but we turn it | |
| 2740 | − * back ON only if suspend_disable_flag was not set | |
| 2741 | − */ | |
| 2742 | − if (dhd && dhd->pub.up) { | |
| 2743 | − dhd_os_proto_block(&dhd->pub); | |
| 2744 | − if (dhd->pub.in_suspend) { | |
| 2745 | − if (!val || (val && !dhd->pub.suspend_disable_flag)) | |
| 2746 | − dhd_set_packet_filter(val, &dhd->pub); | |
| 2747 | − } | |
| 2748 | − dhd_os_proto_unblock(&dhd->pub); | |
| 2749 | − } | |
| 2750 | − return ret; | |
| 2751 | −} | |
| 2752 | − | |
| 2753 | −void dhd_dev_init_ioctl(struct net_device *dev) | |
| 2754 | −{ | |
| 2755 | − dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); | |
| 2756 | − | |
| 2757 | − dhd_preinit_ioctls(&dhd->pub); | |
| 2758 | −} | |
| 2759 | − | |
| 2760 | −#ifdef PNO_SUPPORT | |
| 2761 | −/* Linux wrapper to call common dhd_pno_clean */ | |
| 2762 | −int dhd_dev_pno_reset(struct net_device *dev) | |
| 2763 | −{ | |
| 2764 | − dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); | |
| 2765 | − | |
| 2766 | − return dhd_pno_clean(&dhd->pub); | |
| 2767 | −} | |
| 2768 | − | |
| 2769 | −/* Linux wrapper to call common dhd_pno_enable */ | |
| 2770 | −int dhd_dev_pno_enable(struct net_device *dev, int pfn_enabled) | |
| 2771 | −{ | |
| 2772 | − dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); | |
| 2773 | − | |
| 2774 | − return dhd_pno_enable(&dhd->pub, pfn_enabled); | |
| 2775 | −} | |
| 2776 | − | |
| 2777 | −/* Linux wrapper to call common dhd_pno_set */ | |
| 2778 | −int | |
| 2779 | −dhd_dev_pno_set(struct net_device *dev, wlc_ssid_t *ssids_local, int nssid, | |
| 2780 | − unsigned char scan_fr) | |
| 2781 | −{ | |
| 2782 | − dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); | |
| 2783 | − | |
| 2784 | − return dhd_pno_set(&dhd->pub, ssids_local, nssid, scan_fr); | |
| 2785 | −} | |
| 2786 | − | |
| 2787 | −/* Linux wrapper to get pno status */ | |
| 2788 | −int dhd_dev_get_pno_status(struct net_device *dev) | |
| 2789 | −{ | |
| 2790 | − dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); | |
| 2791 | − | |
| 2792 | − return dhd_pno_get_status(&dhd->pub); | |
| 2793 | −} | |
| 2794 | − | |
| 2795 | −#endif /* PNO_SUPPORT */ | |
| 2796 | − | |
| 2797 | −static int dhd_get_pend_8021x_cnt(dhd_info_t *dhd) | |
| 2798 | −{ | |
| 2799 | − return atomic_read(&dhd->pend_8021x_cnt); | |
| 1678 | + return atomic_read(&drvr_priv->pend_8021x_cnt); | |
| 2800 | 1679 | } |
| 2801 | 1680 | |
| 2802 | 1681 | #define MAX_WAIT_FOR_8021X_TX 10 |
| 2803 | 1682 | |
| 2804 | −int dhd_wait_pend8021x(struct net_device *dev) | |
| 1683 | +int brcmf_netdev_wait_pend8021x(struct net_device *dev) | |
| 2805 | 1684 | { |
| 2806 | − dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(dev); | |
| 1685 | + struct brcmf_info *drvr_priv = *(struct brcmf_info **)netdev_priv(dev); | |
| 2807 | 1686 | int timeout = 10 * HZ / 1000; |
| 2808 | 1687 | int ntimes = MAX_WAIT_FOR_8021X_TX; |
| 2809 | − int pend = dhd_get_pend_8021x_cnt(dhd); | |
| 1688 | + int pend = brcmf_get_pend_8021x_cnt(drvr_priv); | |
| 2810 | 1689 | |
| 2811 | 1690 | while (ntimes && pend) { |
| 2812 | 1691 | if (pend) { |
| @@ -2815,20 +1694,13 @@ int dhd_wait_pend8021x(struct net_device *dev) · 2 unmodified lines | ||
| 2815 | 1694 | set_current_state(TASK_RUNNING); |
| 2816 | 1695 | ntimes--; |
| 2817 | 1696 | } |
| 2818 | − pend = dhd_get_pend_8021x_cnt(dhd); | |
| 1697 | + pend = brcmf_get_pend_8021x_cnt(drvr_priv); | |
| 2819 | 1698 | } |
| 2820 | 1699 | return pend; |
| 2821 | 1700 | } |
| 2822 | 1701 | |
| 2823 | −void wl_os_wd_timer(struct net_device *ndev, uint wdtick) | |
| 2824 | −{ | |
| 2825 | − dhd_info_t *dhd = *(dhd_info_t **)netdev_priv(ndev); | |
| 2826 | − | |
| 2827 | − dhd_os_wd_timer(&dhd->pub, wdtick); | |
| 2828 | −} | |
| 2829 | − | |
| 2830 | −#ifdef DHD_DEBUG | |
| 2831 | −int write_to_file(dhd_pub_t *dhd, u8 *buf, int size) | |
| 1702 | +#ifdef BCMDBG | |
| 1703 | +int brcmf_write_to_file(struct brcmf_pub *drvr, u8 *buf, int size) | |
| 2832 | 1704 | { |
| 2833 | 1705 | int ret = 0; |
| 2834 | 1706 | struct file *fp; |
| @@ -2842,7 +1714,7 @@ int write_to_file(dhd_pub_t *dhd, u8 *buf, int size) · 7 unmodified lines | ||
| 2842 | 1714 | /* open file to write */ |
| 2843 | 1715 | fp = filp_open("/tmp/mem_dump", O_WRONLY | O_CREAT, 0640); |
| 2844 | 1716 | if (!fp) { |
| 2845 | − DHD_ERROR(("%s: open file error\n", __func__)); | |
| 1717 | + BRCMF_ERROR(("%s: open file error\n", __func__)); | |
| 2846 | 1718 | ret = -1; |
| 2847 | 1719 | goto exit; |
| 2848 | 1720 | } |
| @@ -2861,4 +1733,4 @@ exit: · 12 unmodified lines | ||
| 2861 | 1733 | |
| 2862 | 1734 | return ret; |
| 2863 | 1735 | } |
| 2864 | −#endif /* DHD_DEBUG */ | |
| 1736 | +#endif /* BCMDBG */ | |
| @@ -1,25 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2010 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | − * purpose with or without fee is hereby granted, provided that the above | |
| 6 | − * copyright notice and this permission notice appear in all copies. | |
| 7 | − * | |
| 8 | − * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | − * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | − * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | − * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | − * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | − * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | − * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | − */ | |
| 16 | −#include <linux/kernel.h> | |
| 17 | −#include <linux/module.h> | |
| 18 | −#include <linux/sched.h> | |
| 19 | − | |
| 20 | −int setScheduler(struct task_struct *p, int policy, struct sched_param *param) | |
| 21 | −{ | |
| 22 | − int rc = 0; | |
| 23 | − rc = sched_setscheduler(p, policy, param); | |
| 24 | − return rc; | |
| 25 | −} | |
| @@ -14,11 +14,8 @@ · 13 unmodified lines | ||
| 14 | 14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | −#ifndef _dhd_proto_h_ | |
| 18 | −#define _dhd_proto_h_ | |
| 19 | − | |
| 20 | −#include <dhdioctl.h> | |
| 21 | −#include <wlioctl.h> | |
| 17 | +#ifndef _BRCMF_PROTO_H_ | |
| 18 | +#define _BRCMF_PROTO_H_ | |
| 22 | 19 | |
| 23 | 20 | #ifndef IOCTL_RESP_TIMEOUT |
| 24 | 21 | #define IOCTL_RESP_TIMEOUT 2000 /* In milli second */ |
| @@ -29,62 +26,50 @@ · 4 unmodified lines | ||
| 29 | 26 | #endif |
| 30 | 27 | |
| 31 | 28 | /* |
| 32 | − * Exported from the dhd protocol module (dhd_cdc, dhd_rndis) | |
| 29 | + * Exported from the brcmf protocol module (brcmf_cdc) | |
| 33 | 30 | */ |
| 34 | 31 | |
| 35 | 32 | /* Linkage, sets prot link and updates hdrlen in pub */ |
| 36 | −extern int dhd_prot_attach(dhd_pub_t *dhdp); | |
| 33 | +extern int brcmf_proto_attach(struct brcmf_pub *drvr); | |
| 37 | 34 | |
| 38 | −/* Unlink, frees allocated protocol memory (including dhd_prot) */ | |
| 39 | −extern void dhd_prot_detach(dhd_pub_t *dhdp); | |
| 35 | +/* Unlink, frees allocated protocol memory (including brcmf_proto) */ | |
| 36 | +extern void brcmf_proto_detach(struct brcmf_pub *drvr); | |
| 40 | 37 | |
| 41 | 38 | /* Initialize protocol: sync w/dongle state. |
| 42 | 39 | * Sets dongle media info (iswl, drv_version, mac address). |
| 43 | 40 | */ |
| 44 | −extern int dhd_prot_init(dhd_pub_t *dhdp); | |
| 41 | +extern int brcmf_proto_init(struct brcmf_pub *drvr); | |
| 45 | 42 | |
| 46 | 43 | /* Stop protocol: sync w/dongle state. */ |
| 47 | −extern void dhd_prot_stop(dhd_pub_t *dhdp); | |
| 44 | +extern void brcmf_proto_stop(struct brcmf_pub *drvr); | |
| 48 | 45 | |
| 49 | 46 | /* Add any protocol-specific data header. |
| 50 | 47 | * Caller must reserve prot_hdrlen prepend space. |
| 51 | 48 | */ |
| 52 | −extern void dhd_prot_hdrpush(dhd_pub_t *, int ifidx, struct sk_buff *txp); | |
| 49 | +extern void brcmf_proto_hdrpush(struct brcmf_pub *, int ifidx, | |
| 50 | + struct sk_buff *txp); | |
| 53 | 51 | |
| 54 | 52 | /* Remove any protocol-specific data header. */ |
| 55 | −extern int dhd_prot_hdrpull(dhd_pub_t *, int *ifidx, struct sk_buff *rxp); | |
| 53 | +extern int brcmf_proto_hdrpull(struct brcmf_pub *, int *ifidx, | |
| 54 | + struct sk_buff *rxp); | |
| 56 | 55 | |
| 57 | 56 | /* Use protocol to issue ioctl to dongle */ |
| 58 | −extern int dhd_prot_ioctl(dhd_pub_t *dhd, int ifidx, wl_ioctl_t *ioc, | |
| 59 | − void *buf, int len); | |
| 60 | − | |
| 61 | −/* Check for and handle local prot-specific iovar commands */ | |
| 62 | −extern int dhd_prot_iovar_op(dhd_pub_t *dhdp, const char *name, | |
| 63 | − void *params, int plen, void *arg, int len, | |
| 64 | − bool set); | |
| 57 | +extern int brcmf_proto_ioctl(struct brcmf_pub *drvr, int ifidx, | |
| 58 | + struct brcmf_ioctl *ioc, void *buf, int len); | |
| 65 | 59 | |
| 66 | 60 | /* Add prot dump output to a buffer */ |
| 67 | −extern void dhd_prot_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf); | |
| 61 | +extern void brcmf_proto_dump(struct brcmf_pub *drvr, | |
| 62 | + struct brcmu_strbuf *strbuf); | |
| 68 | 63 | |
| 69 | 64 | /* Update local copy of dongle statistics */ |
| 70 | −extern void dhd_prot_dstats(dhd_pub_t *dhdp); | |
| 65 | +extern void brcmf_proto_dstats(struct brcmf_pub *drvr); | |
| 71 | 66 | |
| 72 | −extern int dhd_ioctl(dhd_pub_t *dhd_pub, dhd_ioctl_t *ioc, void *buf, | |
| 73 | − uint buflen); | |
| 67 | +extern int brcmf_c_ioctl(struct brcmf_pub *drvr, struct brcmf_c_ioctl *ioc, | |
| 68 | + void *buf, uint buflen); | |
| 74 | 69 | |
| 75 | −extern int dhd_preinit_ioctls(dhd_pub_t *dhd); | |
| 70 | +extern int brcmf_c_preinit_ioctls(struct brcmf_pub *drvr); | |
| 76 | 71 | |
| 77 | −/******************************** | |
| 78 | − * For version-string expansion * | |
| 79 | − */ | |
| 80 | −#if defined(BDC) | |
| 81 | −#define DHD_PROTOCOL "bdc" | |
| 82 | −#elif defined(CDC) | |
| 83 | −#define DHD_PROTOCOL "cdc" | |
| 84 | −#elif defined(RNDIS) | |
| 85 | −#define DHD_PROTOCOL "rndis" | |
| 86 | −#else | |
| 87 | −#define DHD_PROTOCOL "unknown" | |
| 88 | −#endif /* proto */ | |
| 89 | − | |
| 90 | −#endif /* _dhd_proto_h_ */ | |
| 72 | +extern int brcmf_proto_cdc_set_ioctl(struct brcmf_pub *drvr, int ifidx, | |
| 73 | + uint cmd, void *buf, uint len); | |
| 74 | + | |
| 75 | +#endif /* _BRCMF_PROTO_H_ */ | |
| @@ -16,46 +16,145 @@ · 15 unmodified lines | ||
| 16 | 16 | |
| 17 | 17 | #include <linux/types.h> |
| 18 | 18 | #include <linux/kernel.h> |
| 19 | +#include <linux/kthread.h> | |
| 19 | 20 | #include <linux/printk.h> |
| 20 | 21 | #include <linux/pci_ids.h> |
| 21 | 22 | #include <linux/netdevice.h> |
| 22 | −#include <bcmdefs.h> | |
| 23 | −#include <bcmsdh.h> | |
| 24 | − | |
| 25 | −#ifdef BCMEMBEDIMAGE | |
| 26 | −#include BCMEMBEDIMAGE | |
| 27 | −#endif /* BCMEMBEDIMAGE */ | |
| 28 | − | |
| 29 | −#include <bcmutils.h> | |
| 30 | −#include <bcmdevs.h> | |
| 31 | − | |
| 32 | −#include <hndsoc.h> | |
| 33 | −#ifdef DHD_DEBUG | |
| 34 | −#include <hndrte_armtrap.h> | |
| 35 | −#include <hndrte_cons.h> | |
| 36 | −#endif /* DHD_DEBUG */ | |
| 37 | −#include <sbchipc.h> | |
| 38 | −#include <sbhnddma.h> | |
| 39 | − | |
| 40 | −#include <sdio.h> | |
| 41 | −#include <sbsdio.h> | |
| 42 | −#include <sbsdpcmdev.h> | |
| 43 | −#include <bcmsdpcm.h> | |
| 44 | − | |
| 45 | −#include <proto/802.11.h> | |
| 46 | − | |
| 47 | −#include <dngl_stats.h> | |
| 48 | −#include <dhd.h> | |
| 49 | −#include <dhd_bus.h> | |
| 50 | −#include <dhd_proto.h> | |
| 51 | −#include <dhd_dbg.h> | |
| 52 | −#include <dhdioctl.h> | |
| 53 | −#include <sdiovar.h> | |
| 54 | −#include <bcmchip.h> | |
| 23 | +#include <linux/interrupt.h> | |
| 24 | +#include <linux/sched.h> | |
| 25 | +#include <linux/mmc/sdio.h> | |
| 26 | +#include <linux/mmc/sdio_func.h> | |
| 27 | +#include <linux/semaphore.h> | |
| 28 | +#include <linux/firmware.h> | |
| 29 | +#include <asm/unaligned.h> | |
| 30 | +#include <defs.h> | |
| 31 | +#include <brcmu_wifi.h> | |
| 32 | +#include <brcmu_utils.h> | |
| 33 | +#include <brcm_hw_ids.h> | |
| 34 | +#include <soc.h> | |
| 35 | +#include "sdio_host.h" | |
| 36 | + | |
| 37 | +/* register access macros */ | |
| 38 | +#ifndef __BIG_ENDIAN | |
| 39 | +#ifndef __mips__ | |
| 40 | +#define R_REG(r, typ) \ | |
| 41 | + brcmf_sdcard_reg_read(NULL, (r), sizeof(typ)) | |
| 42 | +#else /* __mips__ */ | |
| 43 | +#define R_REG(r, typ) \ | |
| 44 | + ({ \ | |
| 45 | + __typeof(*(r)) __osl_v; \ | |
| 46 | + __asm__ __volatile__("sync"); \ | |
| 47 | + __osl_v = brcmf_sdcard_reg_read(NULL, (r),\ | |
| 48 | + sizeof(typ)); \ | |
| 49 | + __asm__ __volatile__("sync"); \ | |
| 50 | + __osl_v; \ | |
| 51 | + }) | |
| 52 | +#endif /* __mips__ */ | |
| 53 | + | |
| 54 | +#else /* __BIG_ENDIAN */ | |
| 55 | +#define R_REG(r, typ) \ | |
| 56 | + brcmf_sdcard_reg_read(NULL, (r), sizeof(typ)) | |
| 57 | +#endif /* __BIG_ENDIAN */ | |
| 58 | + | |
| 59 | +#define OR_REG(r, v, typ) \ | |
| 60 | + brcmf_sdcard_reg_write(NULL, (r), sizeof(typ), R_REG(r, typ) | (v)) | |
| 61 | + | |
| 62 | +#ifdef BCMDBG | |
| 63 | + | |
| 64 | +/* ARM trap handling */ | |
| 65 | + | |
| 66 | +/* Trap types defined by ARM (see arminc.h) */ | |
| 67 | + | |
| 68 | +#if defined(__ARM_ARCH_4T__) | |
| 69 | +#define MAX_TRAP_TYPE (TR_FIQ + 1) | |
| 70 | +#elif defined(__ARM_ARCH_7M__) | |
| 71 | +#define MAX_TRAP_TYPE (TR_ISR + ARMCM3_NUMINTS) | |
| 72 | +#endif /* __ARM_ARCH_7M__ */ | |
| 73 | + | |
| 74 | +/* The trap structure is defined here as offsets for assembly */ | |
| 75 | +#define TR_TYPE 0x00 | |
| 76 | +#define TR_EPC 0x04 | |
| 77 | +#define TR_CPSR 0x08 | |
| 78 | +#define TR_SPSR 0x0c | |
| 79 | +#define TR_REGS 0x10 | |
| 80 | +#define TR_REG(n) (TR_REGS + (n) * 4) | |
| 81 | +#define TR_SP TR_REG(13) | |
| 82 | +#define TR_LR TR_REG(14) | |
| 83 | +#define TR_PC TR_REG(15) | |
| 84 | + | |
| 85 | +#define TRAP_T_SIZE 80 | |
| 86 | + | |
| 87 | +struct brcmf_trap { | |
| 88 | + u32 type; | |
| 89 | + u32 epc; | |
| 90 | + u32 cpsr; | |
| 91 | + u32 spsr; | |
| 92 | + u32 r0; | |
| 93 | + u32 r1; | |
| 94 | + u32 r2; | |
| 95 | + u32 r3; | |
| 96 | + u32 r4; | |
| 97 | + u32 r5; | |
| 98 | + u32 r6; | |
| 99 | + u32 r7; | |
| 100 | + u32 r8; | |
| 101 | + u32 r9; | |
| 102 | + u32 r10; | |
| 103 | + u32 r11; | |
| 104 | + u32 r12; | |
| 105 | + u32 r13; | |
| 106 | + u32 r14; | |
| 107 | + u32 pc; | |
| 108 | +}; | |
| 55 | 109 | |
| 56 | −#ifndef DHDSDIO_MEM_DUMP_FNAME | |
| 57 | −#define DHDSDIO_MEM_DUMP_FNAME "mem_dump" | |
| 58 | −#endif | |
| 110 | +#define CBUF_LEN (128) | |
| 111 | + | |
| 112 | +struct rte_log { | |
| 113 | + u32 buf; /* Can't be pointer on (64-bit) hosts */ | |
| 114 | + uint buf_size; | |
| 115 | + uint idx; | |
| 116 | + char *_buf_compat; /* Redundant pointer for backward compat. */ | |
| 117 | +}; | |
| 118 | + | |
| 119 | +struct rte_console { | |
| 120 | + /* Virtual UART | |
| 121 | + * When there is no UART (e.g. Quickturn), | |
| 122 | + * the host should write a complete | |
| 123 | + * input line directly into cbuf and then write | |
| 124 | + * the length into vcons_in. | |
| 125 | + * This may also be used when there is a real UART | |
| 126 | + * (at risk of conflicting with | |
| 127 | + * the real UART). vcons_out is currently unused. | |
| 128 | + */ | |
| 129 | + volatile uint vcons_in; | |
| 130 | + volatile uint vcons_out; | |
| 131 | + | |
| 132 | + /* Output (logging) buffer | |
| 133 | + * Console output is written to a ring buffer log_buf at index log_idx. | |
| 134 | + * The host may read the output when it sees log_idx advance. | |
| 135 | + * Output will be lost if the output wraps around faster than the host | |
| 136 | + * polls. | |
| 137 | + */ | |
| 138 | + struct rte_log log; | |
| 139 | + | |
| 140 | + /* Console input line buffer | |
| 141 | + * Characters are read one at a time into cbuf | |
| 142 | + * until <CR> is received, then | |
| 143 | + * the buffer is processed as a command line. | |
| 144 | + * Also used for virtual UART. | |
| 145 | + */ | |
| 146 | + uint cbuf_idx; | |
| 147 | + char cbuf[CBUF_LEN]; | |
| 148 | +}; | |
| 149 | + | |
| 150 | +#endif /* BCMDBG */ | |
| 151 | +#include <chipcommon.h> | |
| 152 | + | |
| 153 | +#include "dhd.h" | |
| 154 | +#include "dhd_bus.h" | |
| 155 | +#include "dhd_proto.h" | |
| 156 | +#include "dhd_dbg.h" | |
| 157 | +#include <bcmchip.h> | |
| 59 | 158 | |
| 60 | 159 | #define TXQLEN 2048 /* bulk tx queue length */ |
| 61 | 160 | #define TXHI (TXQLEN - 256) /* turn on flow control above TXHI */ |
| @@ -64,47 +163,239 @@ · 2 unmodified lines | ||
| 64 | 163 | |
| 65 | 164 | #define TXRETRIES 2 /* # of retries for tx frames */ |
| 66 | 165 | |
| 67 | −#if defined(CONFIG_MACH_SANDGATE2G) | |
| 68 | −#define DHD_RXBOUND 250 /* Default for max rx frames in | |
| 166 | +#define BRCMF_RXBOUND 50 /* Default for max rx frames in | |
| 69 | 167 | one scheduling */ |
| 70 | −#else | |
| 71 | −#define DHD_RXBOUND 50 /* Default for max rx frames in | |
| 72 | − one scheduling */ | |
| 73 | −#endif /* defined(CONFIG_MACH_SANDGATE2G) */ | |
| 74 | 168 | |
| 75 | −#define DHD_TXBOUND 20 /* Default for max tx frames in | |
| 169 | +#define BRCMF_TXBOUND 20 /* Default for max tx frames in | |
| 76 | 170 | one scheduling */ |
| 77 | 171 | |
| 78 | −#define DHD_TXMINMAX 1 /* Max tx frames if rx still pending */ | |
| 172 | +#define BRCMF_TXMINMAX 1 /* Max tx frames if rx still pending */ | |
| 79 | 173 | |
| 80 | 174 | #define MEMBLOCK 2048 /* Block size used for downloading |
| 81 | 175 | of dongle image */ |
| 82 | 176 | #define MAX_DATA_BUF (32 * 1024) /* Must be large enough to hold |
| 83 | 177 | biggest possible glom */ |
| 84 | 178 | |
| 85 | −/* Packet alignment for most efficient SDIO (can change based on platform) */ | |
| 86 | −#ifndef DHD_SDALIGN | |
| 87 | −#define DHD_SDALIGN 32 | |
| 88 | −#endif | |
| 89 | −#if !ISPOWEROF2(DHD_SDALIGN) | |
| 90 | −#error DHD_SDALIGN is not a power of 2! | |
| 179 | +#ifndef BRCMF_FIRSTREAD | |
| 180 | +#define BRCMF_FIRSTREAD 32 | |
| 91 | 181 | #endif |
| 92 | 182 | |
| 93 | −#ifndef DHD_FIRSTREAD | |
| 94 | −#define DHD_FIRSTREAD 32 | |
| 95 | −#endif | |
| 96 | −#if !ISPOWEROF2(DHD_FIRSTREAD) | |
| 97 | −#error DHD_FIRSTREAD is not a power of 2! | |
| 183 | +#if !ISPOWEROF2(BRCMF_FIRSTREAD) | |
| 184 | +#error BRCMF_FIRSTREAD is not a power of 2! | |
| 98 | 185 | #endif |
| 99 | 186 | |
| 187 | +/* SBSDIO_DEVICE_CTL */ | |
| 188 | +#define SBSDIO_DEVCTL_SETBUSY 0x01 /* 1: device will assert busy signal when | |
| 189 | + * receiving CMD53 | |
| 190 | + */ | |
| 191 | +#define SBSDIO_DEVCTL_SPI_INTR_SYNC 0x02 /* 1: assertion of sdio interrupt is | |
| 192 | + * synchronous to the sdio clock | |
| 193 | + */ | |
| 194 | +#define SBSDIO_DEVCTL_CA_INT_ONLY 0x04 /* 1: mask all interrupts to host | |
| 195 | + * except the chipActive (rev 8) | |
| 196 | + */ | |
| 197 | +#define SBSDIO_DEVCTL_PADS_ISO 0x08 /* 1: isolate internal sdio signals, put | |
| 198 | + * external pads in tri-state; requires | |
| 199 | + * sdio bus power cycle to clear (rev 9) | |
| 200 | + */ | |
| 201 | +#define SBSDIO_DEVCTL_SB_RST_CTL 0x30 /* Force SD->SB reset mapping (rev 11) */ | |
| 202 | +#define SBSDIO_DEVCTL_RST_CORECTL 0x00 /* Determined by CoreControl bit */ | |
| 203 | +#define SBSDIO_DEVCTL_RST_BPRESET 0x10 /* Force backplane reset */ | |
| 204 | +#define SBSDIO_DEVCTL_RST_NOBPRESET 0x20 /* Force no backplane reset */ | |
| 205 | + | |
| 206 | +/* SBSDIO_FUNC1_CHIPCLKCSR */ | |
| 207 | +#define SBSDIO_FORCE_ALP 0x01 /* Force ALP request to backplane */ | |
| 208 | +#define SBSDIO_FORCE_HT 0x02 /* Force HT request to backplane */ | |
| 209 | +#define SBSDIO_FORCE_ILP 0x04 /* Force ILP request to backplane */ | |
| 210 | +#define SBSDIO_ALP_AVAIL_REQ 0x08 /* Make ALP ready (power up xtal) */ | |
| 211 | +#define SBSDIO_HT_AVAIL_REQ 0x10 /* Make HT ready (power up PLL) */ | |
| 212 | +#define SBSDIO_FORCE_HW_CLKREQ_OFF 0x20 /* Squelch clock requests from HW */ | |
| 213 | +#define SBSDIO_ALP_AVAIL 0x40 /* Status: ALP is ready */ | |
| 214 | +#define SBSDIO_HT_AVAIL 0x80 /* Status: HT is ready */ | |
| 215 | + | |
| 216 | +#define SBSDIO_AVBITS (SBSDIO_HT_AVAIL | SBSDIO_ALP_AVAIL) | |
| 217 | +#define SBSDIO_ALPAV(regval) ((regval) & SBSDIO_AVBITS) | |
| 218 | +#define SBSDIO_HTAV(regval) (((regval) & SBSDIO_AVBITS) == SBSDIO_AVBITS) | |
| 219 | +#define SBSDIO_ALPONLY(regval) (SBSDIO_ALPAV(regval) && !SBSDIO_HTAV(regval)) | |
| 220 | +#define SBSDIO_CLKAV(regval, alponly) (SBSDIO_ALPAV(regval) && \ | |
| 221 | + (alponly ? 1 : SBSDIO_HTAV(regval))) | |
| 222 | +/* direct(mapped) cis space */ | |
| 223 | +#define SBSDIO_CIS_BASE_COMMON 0x1000 /* MAPPED common CIS address */ | |
| 224 | +#define SBSDIO_CIS_SIZE_LIMIT 0x200 /* maximum bytes in one CIS */ | |
| 225 | +#define SBSDIO_CIS_OFT_ADDR_MASK 0x1FFFF /* cis offset addr is < 17 bits */ | |
| 226 | + | |
| 227 | +#define SBSDIO_CIS_MANFID_TUPLE_LEN 6 /* manfid tuple length, include tuple, | |
| 228 | + * link bytes | |
| 229 | + */ | |
| 230 | + | |
| 231 | +/* intstatus */ | |
| 232 | +#define I_SMB_SW0 (1 << 0) /* To SB Mail S/W interrupt 0 */ | |
| 233 | +#define I_SMB_SW1 (1 << 1) /* To SB Mail S/W interrupt 1 */ | |
| 234 | +#define I_SMB_SW2 (1 << 2) /* To SB Mail S/W interrupt 2 */ | |
| 235 | +#define I_SMB_SW3 (1 << 3) /* To SB Mail S/W interrupt 3 */ | |
| 236 | +#define I_SMB_SW_MASK 0x0000000f /* To SB Mail S/W interrupts mask */ | |
| 237 | +#define I_SMB_SW_SHIFT 0 /* To SB Mail S/W interrupts shift */ | |
| 238 | +#define I_HMB_SW0 (1 << 4) /* To Host Mail S/W interrupt 0 */ | |
| 239 | +#define I_HMB_SW1 (1 << 5) /* To Host Mail S/W interrupt 1 */ | |
| 240 | +#define I_HMB_SW2 (1 << 6) /* To Host Mail S/W interrupt 2 */ | |
| 241 | +#define I_HMB_SW3 (1 << 7) /* To Host Mail S/W interrupt 3 */ | |
| 242 | +#define I_HMB_SW_MASK 0x000000f0 /* To Host Mail S/W interrupts mask */ | |
| 243 | +#define I_HMB_SW_SHIFT 4 /* To Host Mail S/W interrupts shift */ | |
| 244 | +#define I_WR_OOSYNC (1 << 8) /* Write Frame Out Of Sync */ | |
| 245 | +#define I_RD_OOSYNC (1 << 9) /* Read Frame Out Of Sync */ | |
| 246 | +#define I_PC (1 << 10) /* descriptor error */ | |
| 247 | +#define I_PD (1 << 11) /* data error */ | |
| 248 | +#define I_DE (1 << 12) /* Descriptor protocol Error */ | |
| 249 | +#define I_RU (1 << 13) /* Receive descriptor Underflow */ | |
| 250 | +#define I_RO (1 << 14) /* Receive fifo Overflow */ | |
| 251 | +#define I_XU (1 << 15) /* Transmit fifo Underflow */ | |
| 252 | +#define I_RI (1 << 16) /* Receive Interrupt */ | |
| 253 | +#define I_BUSPWR (1 << 17) /* SDIO Bus Power Change (rev 9) */ | |
| 254 | +#define I_XMTDATA_AVAIL (1 << 23) /* bits in fifo */ | |
| 255 | +#define I_XI (1 << 24) /* Transmit Interrupt */ | |
| 256 | +#define I_RF_TERM (1 << 25) /* Read Frame Terminate */ | |
| 257 | +#define I_WF_TERM (1 << 26) /* Write Frame Terminate */ | |
| 258 | +#define I_PCMCIA_XU (1 << 27) /* PCMCIA Transmit FIFO Underflow */ | |
| 259 | +#define I_SBINT (1 << 28) /* sbintstatus Interrupt */ | |
| 260 | +#define I_CHIPACTIVE (1 << 29) /* chip from doze to active state */ | |
| 261 | +#define I_SRESET (1 << 30) /* CCCR RES interrupt */ | |
| 262 | +#define I_IOE2 (1U << 31) /* CCCR IOE2 Bit Changed */ | |
| 263 | +#define I_ERRORS (I_PC | I_PD | I_DE | I_RU | I_RO | I_XU) | |
| 264 | +#define I_DMA (I_RI | I_XI | I_ERRORS) | |
| 265 | + | |
| 266 | +/* corecontrol */ | |
| 267 | +#define CC_CISRDY (1 << 0) /* CIS Ready */ | |
| 268 | +#define CC_BPRESEN (1 << 1) /* CCCR RES signal */ | |
| 269 | +#define CC_F2RDY (1 << 2) /* set CCCR IOR2 bit */ | |
| 270 | +#define CC_CLRPADSISO (1 << 3) /* clear SDIO pads isolation */ | |
| 271 | +#define CC_XMTDATAAVAIL_MODE (1 << 4) | |
| 272 | +#define CC_XMTDATAAVAIL_CTRL (1 << 5) | |
| 273 | + | |
| 274 | +/* SDA_FRAMECTRL */ | |
| 275 | +#define SFC_RF_TERM (1 << 0) /* Read Frame Terminate */ | |
| 276 | +#define SFC_WF_TERM (1 << 1) /* Write Frame Terminate */ | |
| 277 | +#define SFC_CRC4WOOS (1 << 2) /* CRC error for write out of sync */ | |
| 278 | +#define SFC_ABORTALL (1 << 3) /* Abort all in-progress frames */ | |
| 279 | + | |
| 280 | +/* HW frame tag */ | |
| 281 | +#define SDPCM_FRAMETAG_LEN 4 /* 2 bytes len, 2 bytes check val */ | |
| 282 | + | |
| 100 | 283 | /* Total length of frame header for dongle protocol */ |
| 101 | 284 | #define SDPCM_HDRLEN (SDPCM_FRAMETAG_LEN + SDPCM_SWHEADER_LEN) |
| 102 | 285 | #ifdef SDTEST |
| 103 | −#define SDPCM_RESERVE (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + DHD_SDALIGN) | |
| 286 | +#define SDPCM_RESERVE (SDPCM_HDRLEN + SDPCM_TEST_HDRLEN + BRCMF_SDALIGN) | |
| 104 | 287 | #else |
| 105 | −#define SDPCM_RESERVE (SDPCM_HDRLEN + DHD_SDALIGN) | |
| 288 | +#define SDPCM_RESERVE (SDPCM_HDRLEN + BRCMF_SDALIGN) | |
| 106 | 289 | #endif |
| 107 | 290 | |
| 291 | +/* | |
| 292 | + * Software allocation of To SB Mailbox resources | |
| 293 | + */ | |
| 294 | + | |
| 295 | +/* tosbmailbox bits corresponding to intstatus bits */ | |
| 296 | +#define SMB_NAK (1 << 0) /* Frame NAK */ | |
| 297 | +#define SMB_INT_ACK (1 << 1) /* Host Interrupt ACK */ | |
| 298 | +#define SMB_USE_OOB (1 << 2) /* Use OOB Wakeup */ | |
| 299 | +#define SMB_DEV_INT (1 << 3) /* Miscellaneous Interrupt */ | |
| 300 | + | |
| 301 | +/* tosbmailboxdata */ | |
| 302 | +#define SMB_DATA_VERSION_SHIFT 16 /* host protocol version */ | |
| 303 | + | |
| 304 | +/* | |
| 305 | + * Software allocation of To Host Mailbox resources | |
| 306 | + */ | |
| 307 | + | |
| 308 | +/* intstatus bits */ | |
| 309 | +#define I_HMB_FC_STATE I_HMB_SW0 /* Flow Control State */ | |
| 310 | +#define I_HMB_FC_CHANGE I_HMB_SW1 /* Flow Control State Changed */ | |
| 311 | +#define I_HMB_FRAME_IND I_HMB_SW2 /* Frame Indication */ | |
| 312 | +#define I_HMB_HOST_INT I_HMB_SW3 /* Miscellaneous Interrupt */ | |
| 313 | + | |
| 314 | +/* tohostmailboxdata */ | |
| 315 | +#define HMB_DATA_NAKHANDLED 1 /* retransmit NAK'd frame */ | |
| 316 | +#define HMB_DATA_DEVREADY 2 /* talk to host after enable */ | |
| 317 | +#define HMB_DATA_FC 4 /* per prio flowcontrol update flag */ | |
| 318 | +#define HMB_DATA_FWREADY 8 /* fw ready for protocol activity */ | |
| 319 | + | |
| 320 | +#define HMB_DATA_FCDATA_MASK 0xff000000 | |
| 321 | +#define HMB_DATA_FCDATA_SHIFT 24 | |
| 322 | + | |
| 323 | +#define HMB_DATA_VERSION_MASK 0x00ff0000 | |
| 324 | +#define HMB_DATA_VERSION_SHIFT 16 | |
| 325 | + | |
| 326 | +/* | |
| 327 | + * Software-defined protocol header | |
| 328 | + */ | |
| 329 | + | |
| 330 | +/* Current protocol version */ | |
| 331 | +#define SDPCM_PROT_VERSION 4 | |
| 332 | + | |
| 333 | +/* SW frame header */ | |
| 334 | +#define SDPCM_PACKET_SEQUENCE(p) (((u8 *)p)[0] & 0xff) | |
| 335 | + | |
| 336 | +#define SDPCM_CHANNEL_MASK 0x00000f00 | |
| 337 | +#define SDPCM_CHANNEL_SHIFT 8 | |
| 338 | +#define SDPCM_PACKET_CHANNEL(p) (((u8 *)p)[1] & 0x0f) | |
| 339 | + | |
| 340 | +#define SDPCM_NEXTLEN_OFFSET 2 | |
| 341 | + | |
| 342 | +/* Data Offset from SOF (HW Tag, SW Tag, Pad) */ | |
| 343 | +#define SDPCM_DOFFSET_OFFSET 3 /* Data Offset */ | |
| 344 | +#define SDPCM_DOFFSET_VALUE(p) (((u8 *)p)[SDPCM_DOFFSET_OFFSET] & 0xff) | |
| 345 | +#define SDPCM_DOFFSET_MASK 0xff000000 | |
| 346 | +#define SDPCM_DOFFSET_SHIFT 24 | |
| 347 | +#define SDPCM_FCMASK_OFFSET 4 /* Flow control */ | |
| 348 | +#define SDPCM_FCMASK_VALUE(p) (((u8 *)p)[SDPCM_FCMASK_OFFSET] & 0xff) | |
| 349 | +#define SDPCM_WINDOW_OFFSET 5 /* Credit based fc */ | |
| 350 | +#define SDPCM_WINDOW_VALUE(p) (((u8 *)p)[SDPCM_WINDOW_OFFSET] & 0xff) | |
| 351 | + | |
| 352 | +#define SDPCM_SWHEADER_LEN 8 /* SW header is 64 bits */ | |
| 353 | + | |
| 354 | +/* logical channel numbers */ | |
| 355 | +#define SDPCM_CONTROL_CHANNEL 0 /* Control channel Id */ | |
| 356 | +#define SDPCM_EVENT_CHANNEL 1 /* Asyc Event Indication Channel Id */ | |
| 357 | +#define SDPCM_DATA_CHANNEL 2 /* Data Xmit/Recv Channel Id */ | |
| 358 | +#define SDPCM_GLOM_CHANNEL 3 /* For coalesced packets */ | |
| 359 | +#define SDPCM_TEST_CHANNEL 15 /* Reserved for test/debug packets */ | |
| 360 | + | |
| 361 | +#define SDPCM_SEQUENCE_WRAP 256 /* wrap-around val for 8bit frame seq */ | |
| 362 | + | |
| 363 | +#define SDPCM_GLOMDESC(p) (((u8 *)p)[1] & 0x80) | |
| 364 | + | |
| 365 | +/* For TEST_CHANNEL packets, define another 4-byte header */ | |
| 366 | +#define SDPCM_TEST_HDRLEN 4 /* | |
| 367 | + * Generally: Cmd(1), Ext(1), Len(2); | |
| 368 | + * Semantics of Ext byte depend on | |
| 369 | + * command. Len is current or requested | |
| 370 | + * frame length, not including test | |
| 371 | + * header; sent little-endian. | |
| 372 | + */ | |
| 373 | +#define SDPCM_TEST_DISCARD 0x01 /* Receiver discards. Ext:pattern id. */ | |
| 374 | +#define SDPCM_TEST_ECHOREQ 0x02 /* Echo request. Ext:pattern id. */ | |
| 375 | +#define SDPCM_TEST_ECHORSP 0x03 /* Echo response. Ext:pattern id. */ | |
| 376 | +#define SDPCM_TEST_BURST 0x04 /* | |
| 377 | + * Receiver to send a burst. | |
| 378 | + * Ext is a frame count | |
| 379 | + */ | |
| 380 | +#define SDPCM_TEST_SEND 0x05 /* | |
| 381 | + * Receiver sets send mode. | |
| 382 | + * Ext is boolean on/off | |
| 383 | + */ | |
| 384 | + | |
| 385 | +/* Handy macro for filling in datagen packets with a pattern */ | |
| 386 | +#define SDPCM_TEST_FILL(byteno, id) ((u8)(id + byteno)) | |
| 387 | + | |
| 388 | +/* | |
| 389 | + * Shared structure between dongle and the host. | |
| 390 | + * The structure contains pointers to trap or assert information. | |
| 391 | + */ | |
| 392 | +#define SDPCM_SHARED_VERSION 0x0002 | |
| 393 | +#define SDPCM_SHARED_VERSION_MASK 0x00FF | |
| 394 | +#define SDPCM_SHARED_ASSERT_BUILT 0x0100 | |
| 395 | +#define SDPCM_SHARED_ASSERT 0x0200 | |
| 396 | +#define SDPCM_SHARED_TRAP 0x0400 | |
| 397 | + | |
| 398 | + | |
| 108 | 399 | /* Space for header read, limit for data packets */ |
| 109 | 400 | #ifndef MAX_HDR_READ |
| 110 | 401 | #define MAX_HDR_READ 32 |
| @@ -116,7 +407,7 @@ · 5 unmodified lines | ||
| 116 | 407 | #define MAX_RX_DATASZ 2048 |
| 117 | 408 | |
| 118 | 409 | /* Maximum milliseconds to wait for F2 to come up */ |
| 119 | −#define DHD_WAIT_F2RDY 3000 | |
| 410 | +#define BRCMF_WAIT_F2RDY 3000 | |
| 120 | 411 | |
| 121 | 412 | /* Bump up limit on waiting for HT to account for first startup; |
| 122 | 413 | * if the image is doing a CRC calculation before programming the PMU |
| @@ -129,13 +420,48 @@ · 6 unmodified lines | ||
| 129 | 420 | #endif |
| 130 | 421 | |
| 131 | 422 | /* Value for ChipClockCSR during initial setup */ |
| 132 | −#define DHD_INIT_CLKCTL1 (SBSDIO_FORCE_HW_CLKREQ_OFF | \ | |
| 423 | +#define BRCMF_INIT_CLKCTL1 (SBSDIO_FORCE_HW_CLKREQ_OFF | \ | |
| 133 | 424 | SBSDIO_ALP_AVAIL_REQ) |
| 134 | −#define DHD_INIT_CLKCTL2 (SBSDIO_FORCE_HW_CLKREQ_OFF | SBSDIO_FORCE_ALP) | |
| 135 | 425 | |
| 136 | 426 | /* Flags for SDH calls */ |
| 137 | 427 | #define F2SYNC (SDIO_REQ_4BYTE | SDIO_REQ_FIXED) |
| 138 | 428 | |
| 429 | +/* sbimstate */ | |
| 430 | +#define SBIM_IBE 0x20000 /* inbanderror */ | |
| 431 | +#define SBIM_TO 0x40000 /* timeout */ | |
| 432 | +#define SBIM_BY 0x01800000 /* busy (sonics >= 2.3) */ | |
| 433 | +#define SBIM_RJ 0x02000000 /* reject (sonics >= 2.3) */ | |
| 434 | + | |
| 435 | +/* sbtmstatelow */ | |
| 436 | +#define SBTML_RESET 0x0001 /* reset */ | |
| 437 | +#define SBTML_REJ_MASK 0x0006 /* reject field */ | |
| 438 | +#define SBTML_REJ 0x0002 /* reject */ | |
| 439 | +#define SBTML_TMPREJ 0x0004 /* temporary reject, for error recovery */ | |
| 440 | + | |
| 441 | +#define SBTML_SICF_SHIFT 16 /* Shift to locate the SI control flags in sbtml */ | |
| 442 | + | |
| 443 | +/* sbtmstatehigh */ | |
| 444 | +#define SBTMH_SERR 0x0001 /* serror */ | |
| 445 | +#define SBTMH_INT 0x0002 /* interrupt */ | |
| 446 | +#define SBTMH_BUSY 0x0004 /* busy */ | |
| 447 | +#define SBTMH_TO 0x0020 /* timeout (sonics >= 2.3) */ | |
| 448 | + | |
| 449 | +#define SBTMH_SISF_SHIFT 16 /* Shift to locate the SI status flags in sbtmh */ | |
| 450 | + | |
| 451 | +/* sbidlow */ | |
| 452 | +#define SBIDL_INIT 0x80 /* initiator */ | |
| 453 | + | |
| 454 | +/* sbidhigh */ | |
| 455 | +#define SBIDH_RC_MASK 0x000f /* revision code */ | |
| 456 | +#define SBIDH_RCE_MASK 0x7000 /* revision code extension field */ | |
| 457 | +#define SBIDH_RCE_SHIFT 8 | |
| 458 | +#define SBCOREREV(sbidh) \ | |
| 459 | + ((((sbidh) & SBIDH_RCE_MASK) >> SBIDH_RCE_SHIFT) | ((sbidh) & SBIDH_RC_MASK)) | |
| 460 | +#define SBIDH_CC_MASK 0x8ff0 /* core code */ | |
| 461 | +#define SBIDH_CC_SHIFT 4 | |
| 462 | +#define SBIDH_VC_MASK 0xffff0000 /* vendor code */ | |
| 463 | +#define SBIDH_VC_SHIFT 16 | |
| 464 | + | |
| 139 | 465 | /* |
| 140 | 466 | * Conversion of 802.1D priority to precedence level |
| 141 | 467 | */ |
| @@ -143,21 +469,130 @@ · 1 unmodified line | ||
| 143 | 469 | (((prio) == PRIO_8021D_NONE || (prio) == PRIO_8021D_BE) ? \ |
| 144 | 470 | ((prio^2)) : (prio)) |
| 145 | 471 | |
| 146 | −DHD_SPINWAIT_SLEEP_INIT(sdioh_spinwait_sleep); | |
| 147 | −extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf, | |
| 148 | − uint len); | |
| 472 | +BRCMF_SPINWAIT_SLEEP_INIT(sdioh_spinwait_sleep); | |
| 473 | + | |
| 474 | +/* | |
| 475 | + * Core reg address translation. | |
| 476 | + * Both macro's returns a 32 bits byte address on the backplane bus. | |
| 477 | + */ | |
| 478 | +#define CORE_CC_REG(base, field) (base + offsetof(chipcregs_t, field)) | |
| 479 | +#define CORE_BUS_REG(base, field) \ | |
| 480 | + (base + offsetof(struct sdpcmd_regs, field)) | |
| 481 | +#define CORE_SB(base, field) \ | |
| 482 | + (base + SBCONFIGOFF + offsetof(struct sbconfig, field)) | |
| 483 | + | |
| 484 | +/* core registers */ | |
| 485 | +struct sdpcmd_regs { | |
| 486 | + u32 corecontrol; /* 0x00, rev8 */ | |
| 487 | + u32 corestatus; /* rev8 */ | |
| 488 | + u32 PAD[1]; | |
| 489 | + u32 biststatus; /* rev8 */ | |
| 490 | + | |
| 491 | + /* PCMCIA access */ | |
| 492 | + u16 pcmciamesportaladdr; /* 0x010, rev8 */ | |
| 493 | + u16 PAD[1]; | |
| 494 | + u16 pcmciamesportalmask; /* rev8 */ | |
| 495 | + u16 PAD[1]; | |
| 496 | + u16 pcmciawrframebc; /* rev8 */ | |
| 497 | + u16 PAD[1]; | |
| 498 | + u16 pcmciaunderflowtimer; /* rev8 */ | |
| 499 | + u16 PAD[1]; | |
| 500 | + | |
| 501 | + /* interrupt */ | |
| 502 | + u32 intstatus; /* 0x020, rev8 */ | |
| 503 | + u32 hostintmask; /* rev8 */ | |
| 504 | + u32 intmask; /* rev8 */ | |
| 505 | + u32 sbintstatus; /* rev8 */ | |
| 506 | + u32 sbintmask; /* rev8 */ | |
| 507 | + u32 funcintmask; /* rev4 */ | |
| 508 | + u32 PAD[2]; | |
| 509 | + u32 tosbmailbox; /* 0x040, rev8 */ | |
| 510 | + u32 tohostmailbox; /* rev8 */ | |
| 511 | + u32 tosbmailboxdata; /* rev8 */ | |
| 512 | + u32 tohostmailboxdata; /* rev8 */ | |
| 513 | + | |
| 514 | + /* synchronized access to registers in SDIO clock domain */ | |
| 515 | + u32 sdioaccess; /* 0x050, rev8 */ | |
| 516 | + u32 PAD[3]; | |
| 517 | + | |
| 518 | + /* PCMCIA frame control */ | |
| 519 | + u8 pcmciaframectrl; /* 0x060, rev8 */ | |
| 520 | + u8 PAD[3]; | |
| 521 | + u8 pcmciawatermark; /* rev8 */ | |
| 522 | + u8 PAD[155]; | |
| 523 | + | |
| 524 | + /* interrupt batching control */ | |
| 525 | + u32 intrcvlazy; /* 0x100, rev8 */ | |
| 526 | + u32 PAD[3]; | |
| 527 | + | |
| 528 | + /* counters */ | |
| 529 | + u32 cmd52rd; /* 0x110, rev8 */ | |
| 530 | + u32 cmd52wr; /* rev8 */ | |
| 531 | + u32 cmd53rd; /* rev8 */ | |
| 532 | + u32 cmd53wr; /* rev8 */ | |
| 533 | + u32 abort; /* rev8 */ | |
| 534 | + u32 datacrcerror; /* rev8 */ | |
| 535 | + u32 rdoutofsync; /* rev8 */ | |
| 536 | + u32 wroutofsync; /* rev8 */ | |
| 537 | + u32 writebusy; /* rev8 */ | |
| 538 | + u32 readwait; /* rev8 */ | |
| 539 | + u32 readterm; /* rev8 */ | |
| 540 | + u32 writeterm; /* rev8 */ | |
| 541 | + u32 PAD[40]; | |
| 542 | + u32 clockctlstatus; /* rev8 */ | |
| 543 | + u32 PAD[7]; | |
| 544 | + | |
| 545 | + u32 PAD[128]; /* DMA engines */ | |
| 546 | + | |
| 547 | + /* SDIO/PCMCIA CIS region */ | |
| 548 | + char cis[512]; /* 0x400-0x5ff, rev6 */ | |
| 549 | + | |
| 550 | + /* PCMCIA function control registers */ | |
| 551 | + char pcmciafcr[256]; /* 0x600-6ff, rev6 */ | |
| 552 | + u16 PAD[55]; | |
| 553 | + | |
| 554 | + /* PCMCIA backplane access */ | |
| 555 | + u16 backplanecsr; /* 0x76E, rev6 */ | |
| 556 | + u16 backplaneaddr0; /* rev6 */ | |
| 557 | + u16 backplaneaddr1; /* rev6 */ | |
| 558 | + u16 backplaneaddr2; /* rev6 */ | |
| 559 | + u16 backplaneaddr3; /* rev6 */ | |
| 560 | + u16 backplanedata0; /* rev6 */ | |
| 561 | + u16 backplanedata1; /* rev6 */ | |
| 562 | + u16 backplanedata2; /* rev6 */ | |
| 563 | + u16 backplanedata3; /* rev6 */ | |
| 564 | + u16 PAD[31]; | |
| 565 | + | |
| 566 | + /* sprom "size" & "blank" info */ | |
| 567 | + u16 spromstatus; /* 0x7BE, rev2 */ | |
| 568 | + u32 PAD[464]; | |
| 569 | + | |
| 570 | + u16 PAD[0x80]; | |
| 571 | +}; | |
| 149 | 572 | |
| 150 | −#ifdef DHD_DEBUG | |
| 573 | +#ifdef BCMDBG | |
| 151 | 574 | /* Device console log buffer state */ |
| 152 | −typedef struct dhd_console { | |
| 575 | +struct brcmf_console { | |
| 153 | 576 | uint count; /* Poll interval msec counter */ |
| 154 | 577 | uint log_addr; /* Log struct address (fixed) */ |
| 155 | − hndrte_log_t log; /* Log struct (host copy) */ | |
| 578 | + struct rte_log log; /* Log struct (host copy) */ | |
| 156 | 579 | uint bufsize; /* Size of log buffer */ |
| 157 | 580 | u8 *buf; /* Log buffer (host copy) */ |
| 158 | 581 | uint last; /* Last buffer read index */ |
| 159 | −} dhd_console_t; | |
| 160 | −#endif /* DHD_DEBUG */ | |
| 582 | +}; | |
| 583 | +#endif /* BCMDBG */ | |
| 584 | + | |
| 585 | +struct sdpcm_shared { | |
| 586 | + u32 flags; | |
| 587 | + u32 trap_addr; | |
| 588 | + u32 assert_exp_addr; | |
| 589 | + u32 assert_file_addr; | |
| 590 | + u32 assert_line; | |
| 591 | + u32 console_addr; /* Address of struct rte_console */ | |
| 592 | + u32 msgtrace_addr; | |
| 593 | + u8 tag[32]; | |
| 594 | +}; | |
| 595 | + | |
| 161 | 596 | |
| 162 | 597 | /* misc chip info needed by some of the routines */ |
| 163 | 598 | struct chip_info { |
| @@ -166,7 +601,7 @@ struct chip_info { · 2 unmodified lines | ||
| 166 | 601 | u32 cccorebase; |
| 167 | 602 | u32 ccrev; |
| 168 | 603 | u32 cccaps; |
| 169 | − u32 buscorebase; | |
| 604 | + u32 buscorebase; /* 32 bits backplane bus address */ | |
| 170 | 605 | u32 buscorerev; |
| 171 | 606 | u32 buscoretype; |
| 172 | 607 | u32 ramcorebase; |
| @@ -176,19 +611,14 @@ struct chip_info { · 3 unmodified lines | ||
| 176 | 611 | }; |
| 177 | 612 | |
| 178 | 613 | /* Private data for SDIO bus interaction */ |
| 179 | −typedef struct dhd_bus { | |
| 180 | − dhd_pub_t *dhd; | |
| 614 | +struct brcmf_bus { | |
| 615 | + struct brcmf_pub *drvr; | |
| 181 | 616 | |
| 182 | − bcmsdh_info_t *sdh; /* Handle for BCMSDH calls */ | |
| 617 | + struct brcmf_sdio_card *card; /* Handle for sdio card calls */ | |
| 183 | 618 | struct chip_info *ci; /* Chip info struct */ |
| 184 | 619 | char *vars; /* Variables (from CIS and/or other) */ |
| 185 | 620 | uint varsz; /* Size of variables buffer */ |
| 186 | − u32 sbaddr; /* Current SB window pointer (-1, invalid) */ | |
| 187 | 621 | |
| 188 | − sdpcmd_regs_t *regs; /* Registers for SDIO core */ | |
| 189 | − uint sdpcmrev; /* SDIO core revision */ | |
| 190 | − uint armrev; /* CPU core revision */ | |
| 191 | − uint ramrev; /* SOCRAM core revision */ | |
| 192 | 622 | u32 ramsize; /* Size of RAM in SOCRAM (bytes) */ |
| 193 | 623 | u32 orig_ramsize; /* Size of RAM in SOCRAM (bytes) */ |
| 194 | 624 | |
| @@ -198,10 +628,7 @@ typedef struct dhd_bus { · 3 unmodified lines | ||
| 198 | 628 | bool dpc_sched; /* Indicates DPC schedule (intrpt rcvd) */ |
| 199 | 629 | bool fcstate; /* State of dongle flow-control */ |
| 200 | 630 | |
| 201 | − u16 cl_devid; /* cached devid for dhdsdio_probe_attach() */ | |
| 202 | − char *fw_path; /* module_param: path to firmware image */ | |
| 203 | − char *nv_path; /* module_param: path to nvram vars file */ | |
| 204 | − const char *nvram_params; /* user specified nvram params. */ | |
| 631 | + u16 cl_devid; /* cached devid for brcmf_sdio_probe_attach() */ | |
| 205 | 632 | |
| 206 | 633 | uint blocksize; /* Block size of SDIO transfers */ |
| 207 | 634 | uint roundup; /* Max roundup limit */ |
| @@ -211,7 +638,7 @@ typedef struct dhd_bus { · 3 unmodified lines | ||
| 211 | 638 | u8 tx_seq; /* Transmit sequence number (next) */ |
| 212 | 639 | u8 tx_max; /* Maximum transmit sequence allowed */ |
| 213 | 640 | |
| 214 | − u8 hdrbuf[MAX_HDR_READ + DHD_SDALIGN]; | |
| 641 | + u8 hdrbuf[MAX_HDR_READ + BRCMF_SDALIGN]; | |
| 215 | 642 | u8 *rxhdr; /* Header of current rx frame (in hdrbuf) */ |
| 216 | 643 | u16 nextlen; /* Next Read Len from last header */ |
| 217 | 644 | u8 rx_seq; /* Receive sequence number (expected) */ |
| @@ -241,27 +668,23 @@ typedef struct dhd_bus { · 23 unmodified lines | ||
| 241 | 668 | uint polltick; /* Tick counter */ |
| 242 | 669 | uint pollcnt; /* Count of active polls */ |
| 243 | 670 | |
| 244 | −#ifdef DHD_DEBUG | |
| 245 | − dhd_console_t console; /* Console output polling support */ | |
| 671 | +#ifdef BCMDBG | |
| 672 | + struct brcmf_console console; /* Console output polling support */ | |
| 246 | 673 | uint console_addr; /* Console address from shared struct */ |
| 247 | −#endif /* DHD_DEBUG */ | |
| 674 | +#endif /* BCMDBG */ | |
| 248 | 675 | |
| 249 | − uint regfails; /* Count of R_REG/W_REG failures */ | |
| 676 | + uint regfails; /* Count of R_REG failures */ | |
| 250 | 677 | |
| 251 | 678 | uint clkstate; /* State of sd and backplane clock(s) */ |
| 252 | 679 | bool activity; /* Activity flag for clock down */ |
| 253 | 680 | s32 idletime; /* Control for activity timeout */ |
| 254 | 681 | s32 idlecount; /* Activity timeout counter */ |
| 255 | 682 | s32 idleclock; /* How to set bus driver when idle */ |
| 256 | − s32 sd_divisor; /* Speed control to bus driver */ | |
| 257 | − s32 sd_mode; /* Mode control to bus driver */ | |
| 258 | − s32 sd_rxchain; /* If bcmsdh api accepts PKT chains */ | |
| 259 | − bool use_rxchain; /* If dhd should use PKT chains */ | |
| 683 | + s32 sd_rxchain; | |
| 684 | + bool use_rxchain; /* If brcmf should use PKT chains */ | |
| 260 | 685 | bool sleeping; /* Is SDIO bus sleeping? */ |
| 261 | 686 | bool rxflow_mode; /* Rx flow control mode */ |
| 262 | 687 | bool rxflow; /* Is rx flow control on */ |
| 263 | − uint prev_rxlim_hit; /* Is prev rx limit exceeded | |
| 264 | − (per dpc schedule) */ | |
| 265 | 688 | bool alp_only; /* Don't use HT clock (ALP only) */ |
| 266 | 689 | /* Field to decide if rx of control frames happen in rxbuf or lb-pool */ |
| 267 | 690 | bool usebufpool; |
| @@ -313,7 +736,68 @@ typedef struct dhd_bus { · 45 unmodified lines | ||
| 313 | 736 | u8 *ctrl_frame_buf; |
| 314 | 737 | u32 ctrl_frame_len; |
| 315 | 738 | bool ctrl_frame_stat; |
| 316 | −} dhd_bus_t; | |
| 739 | + | |
| 740 | + spinlock_t txqlock; | |
| 741 | + wait_queue_head_t ctrl_wait; | |
| 742 | + | |
| 743 | + struct timer_list timer; | |
| 744 | + struct completion watchdog_wait; | |
| 745 | + struct task_struct *watchdog_tsk; | |
| 746 | + bool wd_timer_valid; | |
| 747 | + | |
| 748 | + struct tasklet_struct tasklet; | |
| 749 | + struct task_struct *dpc_tsk; | |
| 750 | + struct completion dpc_wait; | |
| 751 | + | |
| 752 | + bool threads_only; | |
| 753 | + struct semaphore sdsem; | |
| 754 | + spinlock_t sdlock; | |
| 755 | + | |
| 756 | + const char *fw_name; | |
| 757 | + const struct firmware *firmware; | |
| 758 | + const char *nv_name; | |
| 759 | + u32 fw_ptr; | |
| 760 | +}; | |
| 761 | + | |
| 762 | +struct sbconfig { | |
| 763 | + u32 PAD[2]; | |
| 764 | + u32 sbipsflag; /* initiator port ocp slave flag */ | |
| 765 | + u32 PAD[3]; | |
| 766 | + u32 sbtpsflag; /* target port ocp slave flag */ | |
| 767 | + u32 PAD[11]; | |
| 768 | + u32 sbtmerrloga; /* (sonics >= 2.3) */ | |
| 769 | + u32 PAD; | |
| 770 | + u32 sbtmerrlog; /* (sonics >= 2.3) */ | |
| 771 | + u32 PAD[3]; | |
| 772 | + u32 sbadmatch3; /* address match3 */ | |
| 773 | + u32 PAD; | |
| 774 | + u32 sbadmatch2; /* address match2 */ | |
| 775 | + u32 PAD; | |
| 776 | + u32 sbadmatch1; /* address match1 */ | |
| 777 | + u32 PAD[7]; | |
| 778 | + u32 sbimstate; /* initiator agent state */ | |
| 779 | + u32 sbintvec; /* interrupt mask */ | |
| 780 | + u32 sbtmstatelow; /* target state */ | |
| 781 | + u32 sbtmstatehigh; /* target state */ | |
| 782 | + u32 sbbwa0; /* bandwidth allocation table0 */ | |
| 783 | + u32 PAD; | |
| 784 | + u32 sbimconfiglow; /* initiator configuration */ | |
| 785 | + u32 sbimconfighigh; /* initiator configuration */ | |
| 786 | + u32 sbadmatch0; /* address match0 */ | |
| 787 | + u32 PAD; | |
| 788 | + u32 sbtmconfiglow; /* target configuration */ | |
| 789 | + u32 sbtmconfighigh; /* target configuration */ | |
| 790 | + u32 sbbconfig; /* broadcast configuration */ | |
| 791 | + u32 PAD; | |
| 792 | + u32 sbbstate; /* broadcast state */ | |
| 793 | + u32 PAD[3]; | |
| 794 | + u32 sbactcnfg; /* activate configuration */ | |
| 795 | + u32 PAD[3]; | |
| 796 | + u32 sbflagst; /* current sbflags */ | |
| 797 | + u32 PAD[3]; | |
| 798 | + u32 sbidlow; /* identification */ | |
| 799 | + u32 sbidhigh; /* identification */ | |
| 800 | +}; | |
| 317 | 801 | |
| 318 | 802 | /* clkstate */ |
| 319 | 803 | #define CLK_NONE 0 |
| @@ -321,29 +805,45 @@ typedef struct dhd_bus { · 1 unmodified line | ||
| 321 | 805 | #define CLK_PENDING 2 /* Not used yet */ |
| 322 | 806 | #define CLK_AVAIL 3 |
| 323 | 807 | |
| 324 | −#define DHD_NOPMU(dhd) (false) | |
| 808 | +#define BRCMF_NOPMU(brcmf) (false) | |
| 325 | 809 | |
| 326 | −#ifdef DHD_DEBUG | |
| 810 | +#ifdef BCMDBG | |
| 327 | 811 | static int qcount[NUMPRIO]; |
| 328 | 812 | static int tx_packets[NUMPRIO]; |
| 329 | −#endif /* DHD_DEBUG */ | |
| 813 | +#endif /* BCMDBG */ | |
| 330 | 814 | |
| 331 | 815 | /* Deferred transmit */ |
| 332 | −const uint dhd_deferred_tx = 1; | |
| 816 | +uint brcmf_deferred_tx = 1; | |
| 817 | +module_param(brcmf_deferred_tx, uint, 0); | |
| 818 | + | |
| 819 | +/* Watchdog thread priority, -1 to use kernel timer */ | |
| 820 | +int brcmf_watchdog_prio = 97; | |
| 821 | +module_param(brcmf_watchdog_prio, int, 0); | |
| 333 | 822 | |
| 334 | −extern uint dhd_watchdog_ms; | |
| 335 | −extern void dhd_os_wd_timer(void *bus, uint wdtick); | |
| 823 | +/* Watchdog interval */ | |
| 824 | +uint brcmf_watchdog_ms = 10; | |
| 825 | +module_param(brcmf_watchdog_ms, uint, 0); | |
| 826 | + | |
| 827 | +/* DPC thread priority, -1 to use tasklet */ | |
| 828 | +int brcmf_dpc_prio = 98; | |
| 829 | +module_param(brcmf_dpc_prio, int, 0); | |
| 830 | + | |
| 831 | +#ifdef BCMDBG | |
| 832 | +/* Console poll interval */ | |
| 833 | +uint brcmf_console_ms; | |
| 834 | +module_param(brcmf_console_ms, uint, 0); | |
| 835 | +#endif /* BCMDBG */ | |
| 336 | 836 | |
| 337 | 837 | /* Tx/Rx bounds */ |
| 338 | −uint dhd_txbound; | |
| 339 | −uint dhd_rxbound; | |
| 340 | −uint dhd_txminmax; | |
| 838 | +uint brcmf_txbound; | |
| 839 | +uint brcmf_rxbound; | |
| 840 | +uint brcmf_txminmax; | |
| 341 | 841 | |
| 342 | 842 | /* override the RAM size if possible */ |
| 343 | 843 | #define DONGLE_MIN_MEMSIZE (128 * 1024) |
| 344 | −int dhd_dongle_memsize; | |
| 844 | +int brcmf_dongle_memsize; | |
| 345 | 845 | |
| 346 | −static bool dhd_alignctl; | |
| 846 | +static bool brcmf_alignctl; | |
| 347 | 847 | |
| 348 | 848 | static bool sd1idle; |
| 349 | 849 | |
| @@ -351,9 +851,7 @@ static bool retrydata; · 1 unmodified line | ||
| 351 | 851 | #define RETRYCHAN(chan) (((chan) == SDPCM_EVENT_CHANNEL) || retrydata) |
| 352 | 852 | |
| 353 | 853 | static const uint watermark = 8; |
| 354 | −static const uint firstread = DHD_FIRSTREAD; | |
| 355 | − | |
| 356 | −#define HDATLEN (firstread - (SDPCM_HDRLEN)) | |
| 854 | +static const uint firstread = BRCMF_FIRSTREAD; | |
| 357 | 855 | |
| 358 | 856 | /* Retry count for register access failures */ |
| 359 | 857 | static const uint retry_limit = 2; |
| @@ -363,20 +861,11 @@ static bool forcealign; · 3 unmodified lines | ||
| 363 | 861 | |
| 364 | 862 | #define ALIGNMENT 4 |
| 365 | 863 | |
| 366 | −#if defined(OOB_INTR_ONLY) && defined(HW_OOB) | |
| 367 | −extern void bcmsdh_enable_hw_oob_intr(void *sdh, bool enable); | |
| 368 | −#endif | |
| 369 | − | |
| 370 | −#if defined(OOB_INTR_ONLY) && defined(SDIO_ISR_THREAD) | |
| 371 | −#error OOB_INTR_ONLY is NOT working with SDIO_ISR_THREAD | |
| 372 | −#endif /* defined(OOB_INTR_ONLY) && defined(SDIO_ISR_THREAD) */ | |
| 373 | 864 | #define PKTALIGN(_p, _len, _align) \ |
| 374 | 865 | do { \ |
| 375 | 866 | uint datalign; \ |
| 376 | 867 | datalign = (unsigned long)((_p)->data); \ |
| 377 | 868 | datalign = roundup(datalign, (_align)) - datalign; \ |
| 378 | − ASSERT(datalign < (_align)); \ | |
| 379 | − ASSERT((_p)->len >= ((_len) + datalign)); \ | |
| 380 | 869 | if (datalign) \ |
| 381 | 870 | skb_pull((_p), datalign); \ |
| 382 | 871 | __skb_trim((_p), (_len)); \ |
| @@ -386,146 +875,166 @@ extern void bcmsdh_enable_hw_oob_intr(void *sdh, bool enable); · 3 unmodified lines | ||
| 386 | 875 | static const uint max_roundup = 512; |
| 387 | 876 | |
| 388 | 877 | /* Try doing readahead */ |
| 389 | −static bool dhd_readahead; | |
| 878 | +static bool brcmf_readahead; | |
| 390 | 879 | |
| 391 | 880 | /* To check if there's window offered */ |
| 392 | 881 | #define DATAOK(bus) \ |
| 393 | 882 | (((u8)(bus->tx_max - bus->tx_seq) != 0) && \ |
| 394 | 883 | (((u8)(bus->tx_max - bus->tx_seq) & 0x80) == 0)) |
| 395 | 884 | |
| 396 | −/* Macros to get register read/write status */ | |
| 397 | −/* NOTE: these assume a local dhdsdio_bus_t *bus! */ | |
| 398 | −#define R_SDREG(regvar, regaddr, retryvar) \ | |
| 399 | −do { \ | |
| 400 | − retryvar = 0; \ | |
| 401 | − do { \ | |
| 402 | − regvar = R_REG(regaddr); \ | |
| 403 | − } while (bcmsdh_regfail(bus->sdh) && (++retryvar <= retry_limit)); \ | |
| 404 | − if (retryvar) { \ | |
| 405 | − bus->regfails += (retryvar-1); \ | |
| 406 | − if (retryvar > retry_limit) { \ | |
| 407 | − DHD_ERROR(("%s: FAILED" #regvar "READ, LINE %d\n", \ | |
| 408 | − __func__, __LINE__)); \ | |
| 409 | − regvar = 0; \ | |
| 410 | − } \ | |
| 411 | − } \ | |
| 412 | −} while (0) | |
| 413 | − | |
| 414 | −#define W_SDREG(regval, regaddr, retryvar) \ | |
| 415 | −do { \ | |
| 416 | − retryvar = 0; \ | |
| 417 | − do { \ | |
| 418 | − W_REG(regaddr, regval); \ | |
| 419 | − } while (bcmsdh_regfail(bus->sdh) && (++retryvar <= retry_limit)); \ | |
| 420 | − if (retryvar) { \ | |
| 421 | − bus->regfails += (retryvar-1); \ | |
| 422 | − if (retryvar > retry_limit) \ | |
| 423 | − DHD_ERROR(("%s: FAILED REGISTER WRITE, LINE %d\n", \ | |
| 424 | − __func__, __LINE__)); \ | |
| 425 | − } \ | |
| 426 | −} while (0) | |
| 427 | − | |
| 428 | −#define DHD_BUS SDIO_BUS | |
| 885 | +/* | |
| 886 | + * Reads a register in the SDIO hardware block. This block occupies a series of | |
| 887 | + * adresses on the 32 bit backplane bus. | |
| 888 | + */ | |
| 889 | +static void | |
| 890 | +r_sdreg32(struct brcmf_bus *bus, u32 *regvar, u32 reg_offset, u32 *retryvar) | |
| 891 | +{ | |
| 892 | + *retryvar = 0; | |
| 893 | + do { | |
| 894 | + *regvar = R_REG(bus->ci->buscorebase + reg_offset, u32); | |
| 895 | + } while (brcmf_sdcard_regfail(bus->card) && | |
| 896 | + (++(*retryvar) <= retry_limit)); | |
| 897 | + if (*retryvar) { | |
| 898 | + bus->regfails += (*retryvar-1); | |
| 899 | + if (*retryvar > retry_limit) { | |
| 900 | + BRCMF_ERROR(("FAILED READ %Xh\n", reg_offset)); | |
| 901 | + *regvar = 0; | |
| 902 | + } | |
| 903 | + } | |
| 904 | +} | |
| 905 | + | |
| 906 | +static void | |
| 907 | +w_sdreg32(struct brcmf_bus *bus, u32 regval, u32 reg_offset, u32 *retryvar) | |
| 908 | +{ | |
| 909 | + *retryvar = 0; | |
| 910 | + do { | |
| 911 | + brcmf_sdcard_reg_write(NULL, bus->ci->buscorebase + reg_offset, | |
| 912 | + sizeof(u32), regval); | |
| 913 | + } while (brcmf_sdcard_regfail(bus->card) && | |
| 914 | + (++(*retryvar) <= retry_limit)); | |
| 915 | + if (*retryvar) { | |
| 916 | + bus->regfails += (*retryvar-1); | |
| 917 | + if (*retryvar > retry_limit) | |
| 918 | + BRCMF_ERROR(("FAILED REGISTER WRITE" | |
| 919 | + " %Xh\n", reg_offset)); | |
| 920 | + } | |
| 921 | +} | |
| 922 | + | |
| 923 | +#define BRCMF_BUS SDIO_BUS | |
| 429 | 924 | |
| 430 | 925 | #define PKT_AVAILABLE() (intstatus & I_HMB_FRAME_IND) |
| 431 | 926 | |
| 432 | 927 | #define HOSTINTMASK (I_HMB_SW_MASK | I_CHIPACTIVE) |
| 433 | 928 | |
| 434 | 929 | #ifdef SDTEST |
| 435 | −static void dhdsdio_testrcv(dhd_bus_t *bus, void *pkt, uint seq); | |
| 436 | −static void dhdsdio_sdtest_set(dhd_bus_t *bus, bool start); | |
| 930 | +static void brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, void *pkt, uint seq); | |
| 931 | +static void brcmf_sdbrcm_sdtest_set(struct brcmf_bus *bus, bool start); | |
| 437 | 932 | #endif |
| 438 | 933 | |
| 439 | −#ifdef DHD_DEBUG | |
| 440 | −static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size); | |
| 441 | −static int dhdsdio_mem_dump(dhd_bus_t *bus); | |
| 442 | −#endif /* DHD_DEBUG */ | |
| 443 | −static int dhdsdio_download_state(dhd_bus_t *bus, bool enter); | |
| 444 | − | |
| 445 | −static void dhdsdio_release(dhd_bus_t *bus); | |
| 446 | −static void dhdsdio_release_malloc(dhd_bus_t *bus); | |
| 447 | −static void dhdsdio_disconnect(void *ptr); | |
| 448 | −static bool dhdsdio_chipmatch(u16 chipid); | |
| 449 | −static bool dhdsdio_probe_attach(dhd_bus_t *bus, void *sdh, | |
| 450 | − void *regsva, u16 devid); | |
| 451 | −static bool dhdsdio_probe_malloc(dhd_bus_t *bus, void *sdh); | |
| 452 | −static bool dhdsdio_probe_init(dhd_bus_t *bus, void *sdh); | |
| 453 | −static void dhdsdio_release_dongle(dhd_bus_t *bus); | |
| 454 | − | |
| 455 | −static uint process_nvram_vars(char *varbuf, uint len); | |
| 456 | − | |
| 457 | −static void dhd_dongle_setmemsize(struct dhd_bus *bus, int mem_size); | |
| 458 | −static int dhd_bcmsdh_send_buf(dhd_bus_t *bus, u32 addr, uint fn, | |
| 934 | +#ifdef BCMDBG | |
| 935 | +static int brcmf_sdbrcm_bus_console_in(struct brcmf_pub *drvr, | |
| 936 | + unsigned char *msg, uint msglen); | |
| 937 | +static int brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, u8 *data, uint size); | |
| 938 | +static int brcmf_sdbrcm_mem_dump(struct brcmf_bus *bus); | |
| 939 | +#endif /* BCMDBG */ | |
| 940 | +static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter); | |
| 941 | + | |
| 942 | +static void brcmf_sdbrcm_release(struct brcmf_bus *bus); | |
| 943 | +static void brcmf_sdbrcm_release_malloc(struct brcmf_bus *bus); | |
| 944 | +static void brcmf_sdbrcm_disconnect(void *ptr); | |
| 945 | +static bool brcmf_sdbrcm_chipmatch(u16 chipid); | |
| 946 | +static bool brcmf_sdbrcm_probe_attach(struct brcmf_bus *bus, void *card, | |
| 947 | + u32 regsva, u16 devid); | |
| 948 | +static bool brcmf_sdbrcm_probe_malloc(struct brcmf_bus *bus, void *card); | |
| 949 | +static bool brcmf_sdbrcm_probe_init(struct brcmf_bus *bus, void *card); | |
| 950 | +static void brcmf_sdbrcm_release_dongle(struct brcmf_bus *bus); | |
| 951 | + | |
| 952 | +static uint brcmf_process_nvram_vars(char *varbuf, uint len); | |
| 953 | + | |
| 954 | +static void brcmf_sdbrcm_setmemsize(struct brcmf_bus *bus, int mem_size); | |
| 955 | +static int brcmf_sdbrcm_send_buf(struct brcmf_bus *bus, u32 addr, uint fn, | |
| 459 | 956 | uint flags, u8 *buf, uint nbytes, |
| 460 | − struct sk_buff *pkt, bcmsdh_cmplt_fn_t complete, | |
| 957 | + struct sk_buff *pkt, | |
| 958 | + void (*complete)(void *handle, int status, | |
| 959 | + bool sync_waiting), | |
| 461 | 960 | void *handle); |
| 462 | 961 | |
| 463 | −static bool dhdsdio_download_firmware(struct dhd_bus *bus, void *sdh); | |
| 464 | −static int _dhdsdio_download_firmware(struct dhd_bus *bus); | |
| 962 | +static bool brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus, void *card); | |
| 963 | +static int _brcmf_sdbrcm_download_firmware(struct brcmf_bus *bus); | |
| 465 | 964 | |
| 466 | −static int dhdsdio_download_code_file(struct dhd_bus *bus, char *image_path); | |
| 467 | −static int dhdsdio_download_nvram(struct dhd_bus *bus); | |
| 468 | −#ifdef BCMEMBEDIMAGE | |
| 469 | −static int dhdsdio_download_code_array(struct dhd_bus *bus); | |
| 470 | −#endif | |
| 471 | −static void dhdsdio_chip_disablecore(bcmsdh_info_t *sdh, u32 corebase); | |
| 472 | −static int dhdsdio_chip_attach(struct dhd_bus *bus, void *regs); | |
| 473 | −static void dhdsdio_chip_resetcore(bcmsdh_info_t *sdh, u32 corebase); | |
| 474 | −static void dhdsdio_sdiod_drive_strength_init(struct dhd_bus *bus, | |
| 965 | +static int brcmf_sdbrcm_download_code_file(struct brcmf_bus *bus); | |
| 966 | +static int brcmf_sdbrcm_download_nvram(struct brcmf_bus *bus); | |
| 967 | + | |
| 968 | +static void | |
| 969 | +brcmf_sdbrcm_chip_disablecore(struct brcmf_sdio_card *card, u32 corebase); | |
| 970 | + | |
| 971 | +static int brcmf_sdbrcm_chip_attach(struct brcmf_bus *bus, u32 regs); | |
| 972 | + | |
| 973 | +static void | |
| 974 | +brcmf_sdbrcm_chip_resetcore(struct brcmf_sdio_card *card, u32 corebase); | |
| 975 | + | |
| 976 | +static void brcmf_sdbrcm_sdiod_drive_strength_init(struct brcmf_bus *bus, | |
| 475 | 977 | u32 drivestrength); |
| 476 | −static void dhdsdio_chip_detach(struct dhd_bus *bus); | |
| 978 | +static void brcmf_sdbrcm_chip_detach(struct brcmf_bus *bus); | |
| 979 | +static void brcmf_sdbrcm_wait_for_event(struct brcmf_bus *bus, bool *lockvar); | |
| 980 | +static void brcmf_sdbrcm_wait_event_wakeup(struct brcmf_bus *bus); | |
| 981 | +static void brcmf_sdbrcm_watchdog(unsigned long data); | |
| 982 | +static int brcmf_sdbrcm_watchdog_thread(void *data); | |
| 983 | +static int brcmf_sdbrcm_dpc_thread(void *data); | |
| 984 | +static void brcmf_sdbrcm_dpc_tasklet(unsigned long data); | |
| 985 | +static void brcmf_sdbrcm_sched_dpc(struct brcmf_bus *bus); | |
| 986 | +static void brcmf_sdbrcm_sdlock(struct brcmf_bus *bus); | |
| 987 | +static void brcmf_sdbrcm_sdunlock(struct brcmf_bus *bus); | |
| 988 | +static int brcmf_sdbrcm_get_image(char *buf, int len, struct brcmf_bus *bus); | |
| 477 | 989 | |
| 478 | 990 | /* Packet free applicable unconditionally for sdio and sdspi. |
| 479 | 991 | * Conditional if bufpool was present for gspi bus. |
| 480 | 992 | */ |
| 481 | −static void dhdsdio_pktfree2(dhd_bus_t *bus, struct sk_buff *pkt) | |
| 993 | +static void brcmf_sdbrcm_pktfree2(struct brcmf_bus *bus, struct sk_buff *pkt) | |
| 482 | 994 | { |
| 483 | − dhd_os_sdlock_rxq(bus->dhd); | |
| 484 | 995 | if ((bus->bus != SPI_BUS) || bus->usebufpool) |
| 485 | − bcm_pkt_buf_free_skb(pkt); | |
| 486 | − dhd_os_sdunlock_rxq(bus->dhd); | |
| 996 | + brcmu_pkt_buf_free_skb(pkt); | |
| 487 | 997 | } |
| 488 | 998 | |
| 489 | −static void dhd_dongle_setmemsize(struct dhd_bus *bus, int mem_size) | |
| 999 | +static void brcmf_sdbrcm_setmemsize(struct brcmf_bus *bus, int mem_size) | |
| 490 | 1000 | { |
| 491 | 1001 | s32 min_size = DONGLE_MIN_MEMSIZE; |
| 492 | 1002 | /* Restrict the memsize to user specified limit */ |
| 493 | − DHD_ERROR(("user: Restrict the dongle ram size to %d, min %d\n", | |
| 494 | − dhd_dongle_memsize, min_size)); | |
| 495 | − if ((dhd_dongle_memsize > min_size) && | |
| 496 | − (dhd_dongle_memsize < (s32) bus->orig_ramsize)) | |
| 497 | − bus->ramsize = dhd_dongle_memsize; | |
| 1003 | + BRCMF_ERROR(("user: Restrict the dongle ram size to %d, min %d\n", | |
| 1004 | + brcmf_dongle_memsize, min_size)); | |
| 1005 | + if ((brcmf_dongle_memsize > min_size) && | |
| 1006 | + (brcmf_dongle_memsize < (s32) bus->orig_ramsize)) | |
| 1007 | + bus->ramsize = brcmf_dongle_memsize; | |
| 498 | 1008 | } |
| 499 | 1009 | |
| 500 | −static int dhdsdio_set_siaddr_window(dhd_bus_t *bus, u32 address) | |
| 1010 | +static int brcmf_sdbrcm_set_siaddr_window(struct brcmf_bus *bus, u32 address) | |
| 501 | 1011 | { |
| 502 | 1012 | int err = 0; |
| 503 | − bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW, | |
| 1013 | + brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRLOW, | |
| 504 | 1014 | (address >> 8) & SBSDIO_SBADDRLOW_MASK, &err); |
| 505 | 1015 | if (!err) |
| 506 | − bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRMID, | |
| 1016 | + brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, | |
| 1017 | + SBSDIO_FUNC1_SBADDRMID, | |
| 507 | 1018 | (address >> 16) & SBSDIO_SBADDRMID_MASK, &err); |
| 508 | 1019 | if (!err) |
| 509 | − bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_SBADDRHIGH, | |
| 510 | − (address >> 24) & SBSDIO_SBADDRHIGH_MASK, | |
| 511 | − &err); | |
| 1020 | + brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, | |
| 1021 | + SBSDIO_FUNC1_SBADDRHIGH, | |
| 1022 | + (address >> 24) & SBSDIO_SBADDRHIGH_MASK, | |
| 1023 | + &err); | |
| 512 | 1024 | return err; |
| 513 | 1025 | } |
| 514 | 1026 | |
| 515 | 1027 | /* Turn backplane clock on or off */ |
| 516 | −static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) | |
| 1028 | +static int brcmf_sdbrcm_htclk(struct brcmf_bus *bus, bool on, bool pendok) | |
| 517 | 1029 | { |
| 518 | 1030 | int err; |
| 519 | 1031 | u8 clkctl, clkreq, devctl; |
| 520 | − bcmsdh_info_t *sdh; | |
| 1032 | + struct brcmf_sdio_card *card; | |
| 521 | 1033 | |
| 522 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 1034 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 523 | 1035 | |
| 524 | −#if defined(OOB_INTR_ONLY) | |
| 525 | − pendok = false; | |
| 526 | −#endif | |
| 527 | 1036 | clkctl = 0; |
| 528 | − sdh = bus->sdh; | |
| 1037 | + card = bus->card; | |
| 529 | 1038 | |
| 530 | 1039 | if (on) { |
| 531 | 1040 | /* Request HT Avail */ |
| @@ -536,99 +1045,93 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) · 4 unmodified lines | ||
| 536 | 1045 | && (bus->ci->chiprev == 0)) |
| 537 | 1046 | clkreq |= SBSDIO_FORCE_ALP; |
| 538 | 1047 | |
| 539 | − bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, | |
| 540 | − clkreq, &err); | |
| 1048 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, | |
| 1049 | + SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err); | |
| 541 | 1050 | if (err) { |
| 542 | − DHD_ERROR(("%s: HT Avail request error: %d\n", | |
| 543 | − __func__, err)); | |
| 1051 | + BRCMF_ERROR(("%s: HT Avail request error: %d\n", | |
| 1052 | + __func__, err)); | |
| 544 | 1053 | return -EBADE; |
| 545 | 1054 | } |
| 546 | 1055 | |
| 547 | 1056 | if (pendok && ((bus->ci->buscoretype == PCMCIA_CORE_ID) |
| 548 | 1057 | && (bus->ci->buscorerev == 9))) { |
| 549 | 1058 | u32 dummy, retries; |
| 550 | − R_SDREG(dummy, &bus->regs->clockctlstatus, retries); | |
| 1059 | + r_sdreg32(bus, &dummy, | |
| 1060 | + offsetof(struct sdpcmd_regs, clockctlstatus), | |
| 1061 | + &retries); | |
| 551 | 1062 | } |
| 552 | 1063 | |
| 553 | 1064 | /* Check current status */ |
| 554 | − clkctl = | |
| 555 | − bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, | |
| 556 | − &err); | |
| 1065 | + clkctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, | |
| 1066 | + SBSDIO_FUNC1_CHIPCLKCSR, &err); | |
| 557 | 1067 | if (err) { |
| 558 | − DHD_ERROR(("%s: HT Avail read error: %d\n", | |
| 559 | − __func__, err)); | |
| 1068 | + BRCMF_ERROR(("%s: HT Avail read error: %d\n", | |
| 1069 | + __func__, err)); | |
| 560 | 1070 | return -EBADE; |
| 561 | 1071 | } |
| 562 | 1072 | |
| 563 | 1073 | /* Go to pending and await interrupt if appropriate */ |
| 564 | 1074 | if (!SBSDIO_CLKAV(clkctl, bus->alp_only) && pendok) { |
| 565 | 1075 | /* Allow only clock-available interrupt */ |
| 566 | − devctl = | |
| 567 | − bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, | |
| 568 | − &err); | |
| 1076 | + devctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, | |
| 1077 | + SBSDIO_DEVICE_CTL, &err); | |
| 569 | 1078 | if (err) { |
| 570 | − DHD_ERROR(("%s: Devctl error setting CA: %d\n", | |
| 571 | − __func__, err)); | |
| 1079 | + BRCMF_ERROR(("%s: Devctl error setting CA:" | |
| 1080 | + " %d\n", __func__, err)); | |
| 572 | 1081 | return -EBADE; |
| 573 | 1082 | } |
| 574 | 1083 | |
| 575 | 1084 | devctl |= SBSDIO_DEVCTL_CA_INT_ONLY; |
| 576 | − bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, | |
| 577 | − devctl, &err); | |
| 578 | − DHD_INFO(("CLKCTL: set PENDING\n")); | |
| 1085 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, | |
| 1086 | + SBSDIO_DEVICE_CTL, devctl, &err); | |
| 1087 | + BRCMF_INFO(("CLKCTL: set PENDING\n")); | |
| 579 | 1088 | bus->clkstate = CLK_PENDING; |
| 580 | 1089 | |
| 581 | 1090 | return 0; |
| 582 | 1091 | } else if (bus->clkstate == CLK_PENDING) { |
| 583 | 1092 | /* Cancel CA-only interrupt filter */ |
| 584 | 1093 | devctl = |
| 585 | − bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, | |
| 586 | − &err); | |
| 1094 | + brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, | |
| 1095 | + SBSDIO_DEVICE_CTL, &err); | |
| 587 | 1096 | devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; |
| 588 | − bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, | |
| 589 | − devctl, &err); | |
| 1097 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, | |
| 1098 | + SBSDIO_DEVICE_CTL, devctl, &err); | |
| 590 | 1099 | } |
| 591 | 1100 | |
| 592 | 1101 | /* Otherwise, wait here (polling) for HT Avail */ |
| 593 | 1102 | if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) { |
| 594 | − SPINWAIT_SLEEP(sdioh_spinwait_sleep, | |
| 595 | − ((clkctl = | |
| 596 | − bcmsdh_cfg_read(sdh, SDIO_FUNC_1, | |
| 597 | − SBSDIO_FUNC1_CHIPCLKCSR, | |
| 598 | − &err)), | |
| 599 | − !SBSDIO_CLKAV(clkctl, bus->alp_only)), | |
| 600 | − PMU_MAX_TRANSITION_DLY); | |
| 1103 | + BRCMF_SPINWAIT_SLEEP(sdioh_spinwait_sleep, | |
| 1104 | + ((clkctl = | |
| 1105 | + brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, | |
| 1106 | + SBSDIO_FUNC1_CHIPCLKCSR, | |
| 1107 | + &err)), | |
| 1108 | + !SBSDIO_CLKAV(clkctl, bus->alp_only)), | |
| 1109 | + PMU_MAX_TRANSITION_DLY); | |
| 601 | 1110 | } |
| 602 | 1111 | if (err) { |
| 603 | − DHD_ERROR(("%s: HT Avail request error: %d\n", | |
| 604 | − __func__, err)); | |
| 1112 | + BRCMF_ERROR(("%s: HT Avail request error: %d\n", | |
| 1113 | + __func__, err)); | |
| 605 | 1114 | return -EBADE; |
| 606 | 1115 | } |
| 607 | 1116 | if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) { |
| 608 | − DHD_ERROR(("%s: HT Avail timeout (%d): clkctl 0x%02x\n", | |
| 609 | − __func__, PMU_MAX_TRANSITION_DLY, clkctl)); | |
| 1117 | + BRCMF_ERROR(("%s: HT Avail timeout (%d): " | |
| 1118 | + "clkctl 0x%02x\n", __func__, | |
| 1119 | + PMU_MAX_TRANSITION_DLY, clkctl)); | |
| 610 | 1120 | return -EBADE; |
| 611 | 1121 | } |
| 612 | 1122 | |
| 613 | 1123 | /* Mark clock available */ |
| 614 | 1124 | bus->clkstate = CLK_AVAIL; |
| 615 | − DHD_INFO(("CLKCTL: turned ON\n")); | |
| 616 | − | |
| 617 | −#if defined(DHD_DEBUG) | |
| 618 | − if (bus->alp_only == true) { | |
| 619 | −#if !defined(BCMLXSDMMC) | |
| 620 | − if (!SBSDIO_ALPONLY(clkctl)) { | |
| 621 | − DHD_ERROR(("%s: HT Clock, when ALP Only\n", | |
| 622 | − __func__)); | |
| 623 | − } | |
| 624 | −#endif /* !defined(BCMLXSDMMC) */ | |
| 625 | − } else { | |
| 1125 | + BRCMF_INFO(("CLKCTL: turned ON\n")); | |
| 1126 | + | |
| 1127 | +#if defined(BCMDBG) | |
| 1128 | + if (bus->alp_only != true) { | |
| 626 | 1129 | if (SBSDIO_ALPONLY(clkctl)) { |
| 627 | − DHD_ERROR(("%s: HT Clock should be on.\n", | |
| 628 | − __func__)); | |
| 1130 | + BRCMF_ERROR(("%s: HT Clock should be on.\n", | |
| 1131 | + __func__)); | |
| 629 | 1132 | } |
| 630 | 1133 | } |
| 631 | −#endif /* defined (DHD_DEBUG) */ | |
| 1134 | +#endif /* defined (BCMDBG) */ | |
| 632 | 1135 | |
| 633 | 1136 | bus->activity = true; |
| 634 | 1137 | } else { |
| @@ -636,21 +1139,20 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) · 1 unmodified line | ||
| 636 | 1139 | |
| 637 | 1140 | if (bus->clkstate == CLK_PENDING) { |
| 638 | 1141 | /* Cancel CA-only interrupt filter */ |
| 639 | − devctl = | |
| 640 | − bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, | |
| 641 | − &err); | |
| 1142 | + devctl = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, | |
| 1143 | + SBSDIO_DEVICE_CTL, &err); | |
| 642 | 1144 | devctl &= ~SBSDIO_DEVCTL_CA_INT_ONLY; |
| 643 | − bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, | |
| 644 | − devctl, &err); | |
| 1145 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, | |
| 1146 | + SBSDIO_DEVICE_CTL, devctl, &err); | |
| 645 | 1147 | } |
| 646 | 1148 | |
| 647 | 1149 | bus->clkstate = CLK_SDONLY; |
| 648 | − bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, | |
| 649 | − clkreq, &err); | |
| 650 | − DHD_INFO(("CLKCTL: turned OFF\n")); | |
| 1150 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, | |
| 1151 | + SBSDIO_FUNC1_CHIPCLKCSR, clkreq, &err); | |
| 1152 | + BRCMF_INFO(("CLKCTL: turned OFF\n")); | |
| 651 | 1153 | if (err) { |
| 652 | − DHD_ERROR(("%s: Failed access turning clock off: %d\n", | |
| 653 | − __func__, err)); | |
| 1154 | + BRCMF_ERROR(("%s: Failed access turning clock off:" | |
| 1155 | + " %d\n", __func__, err)); | |
| 654 | 1156 | return -EBADE; |
| 655 | 1157 | } |
| 656 | 1158 | } |
| @@ -658,105 +1160,31 @@ static int dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) · 1 unmodified line | ||
| 658 | 1160 | } |
| 659 | 1161 | |
| 660 | 1162 | /* Change idle/active SD state */ |
| 661 | −static int dhdsdio_sdclk(dhd_bus_t *bus, bool on) | |
| 1163 | +static int brcmf_sdbrcm_sdclk(struct brcmf_bus *bus, bool on) | |
| 662 | 1164 | { |
| 663 | − int err; | |
| 664 | − s32 iovalue; | |
| 1165 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 665 | 1166 | |
| 666 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 667 | − | |
| 668 | − if (on) { | |
| 669 | − if (bus->idleclock == DHD_IDLE_STOP) { | |
| 670 | − /* Turn on clock and restore mode */ | |
| 671 | − iovalue = 1; | |
| 672 | − err = bcmsdh_iovar_op(bus->sdh, "sd_clock", NULL, 0, | |
| 673 | − &iovalue, sizeof(iovalue), true); | |
| 674 | − if (err) { | |
| 675 | − DHD_ERROR(("%s: error enabling sd_clock: %d\n", | |
| 676 | − __func__, err)); | |
| 677 | − return -EBADE; | |
| 678 | − } | |
| 679 | − | |
| 680 | − iovalue = bus->sd_mode; | |
| 681 | − err = bcmsdh_iovar_op(bus->sdh, "sd_mode", NULL, 0, | |
| 682 | − &iovalue, sizeof(iovalue), true); | |
| 683 | − if (err) { | |
| 684 | − DHD_ERROR(("%s: error changing sd_mode: %d\n", | |
| 685 | − __func__, err)); | |
| 686 | − return -EBADE; | |
| 687 | − } | |
| 688 | − } else if (bus->idleclock != DHD_IDLE_ACTIVE) { | |
| 689 | − /* Restore clock speed */ | |
| 690 | − iovalue = bus->sd_divisor; | |
| 691 | − err = bcmsdh_iovar_op(bus->sdh, "sd_divisor", NULL, 0, | |
| 692 | − &iovalue, sizeof(iovalue), true); | |
| 693 | − if (err) { | |
| 694 | − DHD_ERROR(("%s: error restoring sd_divisor: %d\n", | |
| 695 | − __func__, err)); | |
| 696 | − return -EBADE; | |
| 697 | − } | |
| 698 | − } | |
| 1167 | + if (on) | |
| 699 | 1168 | bus->clkstate = CLK_SDONLY; |
| 700 | − } else { | |
| 701 | − /* Stop or slow the SD clock itself */ | |
| 702 | − if ((bus->sd_divisor == -1) || (bus->sd_mode == -1)) { | |
| 703 | − DHD_TRACE(("%s: can't idle clock, divisor %d mode %d\n", | |
| 704 | − __func__, bus->sd_divisor, bus->sd_mode)); | |
| 705 | − return -EBADE; | |
| 706 | − } | |
| 707 | − if (bus->idleclock == DHD_IDLE_STOP) { | |
| 708 | − if (sd1idle) { | |
| 709 | − /* Change to SD1 mode and turn off clock */ | |
| 710 | − iovalue = 1; | |
| 711 | − err = | |
| 712 | − bcmsdh_iovar_op(bus->sdh, "sd_mode", NULL, | |
| 713 | − 0, &iovalue, | |
| 714 | − sizeof(iovalue), true); | |
| 715 | − if (err) { | |
| 716 | − DHD_ERROR(("%s: error changing sd_clock: %d\n", | |
| 717 | − __func__, err)); | |
| 718 | − return -EBADE; | |
| 719 | − } | |
| 720 | − } | |
| 721 | − | |
| 722 | − iovalue = 0; | |
| 723 | − err = bcmsdh_iovar_op(bus->sdh, "sd_clock", NULL, 0, | |
| 724 | − &iovalue, sizeof(iovalue), true); | |
| 725 | − if (err) { | |
| 726 | − DHD_ERROR(("%s: error disabling sd_clock: %d\n", | |
| 727 | − __func__, err)); | |
| 728 | − return -EBADE; | |
| 729 | − } | |
| 730 | − } else if (bus->idleclock != DHD_IDLE_ACTIVE) { | |
| 731 | − /* Set divisor to idle value */ | |
| 732 | − iovalue = bus->idleclock; | |
| 733 | − err = bcmsdh_iovar_op(bus->sdh, "sd_divisor", NULL, 0, | |
| 734 | − &iovalue, sizeof(iovalue), true); | |
| 735 | − if (err) { | |
| 736 | − DHD_ERROR(("%s: error changing sd_divisor: %d\n", | |
| 737 | − __func__, err)); | |
| 738 | − return -EBADE; | |
| 739 | − } | |
| 740 | − } | |
| 1169 | + else | |
| 741 | 1170 | bus->clkstate = CLK_NONE; |
| 742 | − } | |
| 743 | 1171 | |
| 744 | 1172 | return 0; |
| 745 | 1173 | } |
| 746 | 1174 | |
| 747 | 1175 | /* Transition SD and backplane clock readiness */ |
| 748 | −static int dhdsdio_clkctl(dhd_bus_t *bus, uint target, bool pendok) | |
| 1176 | +static int brcmf_sdbrcm_clkctl(struct brcmf_bus *bus, uint target, bool pendok) | |
| 749 | 1177 | { |
| 750 | −#ifdef DHD_DEBUG | |
| 1178 | +#ifdef BCMDBG | |
| 751 | 1179 | uint oldstate = bus->clkstate; |
| 752 | −#endif /* DHD_DEBUG */ | |
| 1180 | +#endif /* BCMDBG */ | |
| 753 | 1181 | |
| 754 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 1182 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 755 | 1183 | |
| 756 | 1184 | /* Early exit if we're already there */ |
| 757 | 1185 | if (bus->clkstate == target) { |
| 758 | 1186 | if (target == CLK_AVAIL) { |
| 759 | − dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms); | |
| 1187 | + brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms); | |
| 760 | 1188 | bus->activity = true; |
| 761 | 1189 | } |
| 762 | 1190 | return 0; |
| @@ -766,50 +1194,50 @@ static int dhdsdio_clkctl(dhd_bus_t *bus, uint target, bool pendok) · 3 unmodified lines | ||
| 766 | 1194 | case CLK_AVAIL: |
| 767 | 1195 | /* Make sure SD clock is available */ |
| 768 | 1196 | if (bus->clkstate == CLK_NONE) |
| 769 | − dhdsdio_sdclk(bus, true); | |
| 1197 | + brcmf_sdbrcm_sdclk(bus, true); | |
| 770 | 1198 | /* Now request HT Avail on the backplane */ |
| 771 | − dhdsdio_htclk(bus, true, pendok); | |
| 772 | − dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms); | |
| 1199 | + brcmf_sdbrcm_htclk(bus, true, pendok); | |
| 1200 | + brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms); | |
| 773 | 1201 | bus->activity = true; |
| 774 | 1202 | break; |
| 775 | 1203 | |
| 776 | 1204 | case CLK_SDONLY: |
| 777 | 1205 | /* Remove HT request, or bring up SD clock */ |
| 778 | 1206 | if (bus->clkstate == CLK_NONE) |
| 779 | − dhdsdio_sdclk(bus, true); | |
| 1207 | + brcmf_sdbrcm_sdclk(bus, true); | |
| 780 | 1208 | else if (bus->clkstate == CLK_AVAIL) |
| 781 | − dhdsdio_htclk(bus, false, false); | |
| 1209 | + brcmf_sdbrcm_htclk(bus, false, false); | |
| 782 | 1210 | else |
| 783 | − DHD_ERROR(("dhdsdio_clkctl: request for %d -> %d\n", | |
| 784 | − bus->clkstate, target)); | |
| 785 | − dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms); | |
| 1211 | + BRCMF_ERROR(("brcmf_sdbrcm_clkctl: request for %d -> %d" | |
| 1212 | + "\n", bus->clkstate, target)); | |
| 1213 | + brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms); | |
| 786 | 1214 | break; |
| 787 | 1215 | |
| 788 | 1216 | case CLK_NONE: |
| 789 | 1217 | /* Make sure to remove HT request */ |
| 790 | 1218 | if (bus->clkstate == CLK_AVAIL) |
| 791 | − dhdsdio_htclk(bus, false, false); | |
| 1219 | + brcmf_sdbrcm_htclk(bus, false, false); | |
| 792 | 1220 | /* Now remove the SD clock */ |
| 793 | − dhdsdio_sdclk(bus, false); | |
| 794 | − dhd_os_wd_timer(bus->dhd, 0); | |
| 1221 | + brcmf_sdbrcm_sdclk(bus, false); | |
| 1222 | + brcmf_sdbrcm_wd_timer(bus, 0); | |
| 795 | 1223 | break; |
| 796 | 1224 | } |
| 797 | −#ifdef DHD_DEBUG | |
| 798 | − DHD_INFO(("dhdsdio_clkctl: %d -> %d\n", oldstate, bus->clkstate)); | |
| 799 | −#endif /* DHD_DEBUG */ | |
| 1225 | +#ifdef BCMDBG | |
| 1226 | + BRCMF_INFO(("brcmf_sdbrcm_clkctl: %d -> %d\n", | |
| 1227 | + oldstate, bus->clkstate)); | |
| 1228 | +#endif /* BCMDBG */ | |
| 800 | 1229 | |
| 801 | 1230 | return 0; |
| 802 | 1231 | } |
| 803 | 1232 | |
| 804 | −int dhdsdio_bussleep(dhd_bus_t *bus, bool sleep) | |
| 1233 | +int brcmf_sdbrcm_bussleep(struct brcmf_bus *bus, bool sleep) | |
| 805 | 1234 | { |
| 806 | − bcmsdh_info_t *sdh = bus->sdh; | |
| 807 | − sdpcmd_regs_t *regs = bus->regs; | |
| 1235 | + struct brcmf_sdio_card *card = bus->card; | |
| 808 | 1236 | uint retries = 0; |
| 809 | 1237 | |
| 810 | − DHD_INFO(("dhdsdio_bussleep: request %s (currently %s)\n", | |
| 811 | − (sleep ? "SLEEP" : "WAKE"), | |
| 812 | − (bus->sleeping ? "SLEEP" : "WAKE"))); | |
| 1238 | + BRCMF_INFO(("brcmf_sdbrcm_bussleep: request %s (currently %s)\n", | |
| 1239 | + (sleep ? "SLEEP" : "WAKE"), | |
| 1240 | + (bus->sleeping ? "SLEEP" : "WAKE"))); | |
| 813 | 1241 | |
| 814 | 1242 | /* Done if we're already in the requested state */ |
| 815 | 1243 | if (sleep == bus->sleeping) |
| @@ -822,27 +1250,31 @@ int dhdsdio_bussleep(dhd_bus_t *bus, bool sleep) · 6 unmodified lines | ||
| 822 | 1250 | return -EBUSY; |
| 823 | 1251 | |
| 824 | 1252 | /* Disable SDIO interrupts (no longer interested) */ |
| 825 | − bcmsdh_intr_disable(bus->sdh); | |
| 1253 | + brcmf_sdcard_intr_disable(bus->card); | |
| 826 | 1254 | |
| 827 | 1255 | /* Make sure the controller has the bus up */ |
| 828 | − dhdsdio_clkctl(bus, CLK_AVAIL, false); | |
| 1256 | + brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); | |
| 829 | 1257 | |
| 830 | 1258 | /* Tell device to start using OOB wakeup */ |
| 831 | − W_SDREG(SMB_USE_OOB, ®s->tosbmailbox, retries); | |
| 1259 | + w_sdreg32(bus, SMB_USE_OOB, | |
| 1260 | + offsetof(struct sdpcmd_regs, tosbmailbox), &retries); | |
| 832 | 1261 | if (retries > retry_limit) |
| 833 | − DHD_ERROR(("CANNOT SIGNAL CHIP, WILL NOT WAKE UP!!\n")); | |
| 1262 | + BRCMF_ERROR(("CANNOT SIGNAL CHIP, " | |
| 1263 | + "WILL NOT WAKE UP!!\n")); | |
| 834 | 1264 | |
| 835 | 1265 | /* Turn off our contribution to the HT clock request */ |
| 836 | − dhdsdio_clkctl(bus, CLK_SDONLY, false); | |
| 1266 | + brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false); | |
| 837 | 1267 | |
| 838 | − bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, | |
| 839 | − SBSDIO_FORCE_HW_CLKREQ_OFF, NULL); | |
| 1268 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, | |
| 1269 | + SBSDIO_FUNC1_CHIPCLKCSR, | |
| 1270 | + SBSDIO_FORCE_HW_CLKREQ_OFF, NULL); | |
| 840 | 1271 | |
| 841 | 1272 | /* Isolate the bus */ |
| 842 | 1273 | if (bus->ci->chip != BCM4329_CHIP_ID |
| 843 | 1274 | && bus->ci->chip != BCM4319_CHIP_ID) { |
| 844 | − bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, | |
| 845 | − SBSDIO_DEVCTL_PADS_ISO, NULL); | |
| 1275 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, | |
| 1276 | + SBSDIO_DEVICE_CTL, | |
| 1277 | + SBSDIO_DEVCTL_PADS_ISO, NULL); | |
| 846 | 1278 | } |
| 847 | 1279 | |
| 848 | 1280 | /* Change state */ |
| @@ -851,82 +1283,55 @@ int dhdsdio_bussleep(dhd_bus_t *bus, bool sleep) · 2 unmodified lines | ||
| 851 | 1283 | } else { |
| 852 | 1284 | /* Waking up: bus power up is ok, set local state */ |
| 853 | 1285 | |
| 854 | − bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, | |
| 855 | − 0, NULL); | |
| 1286 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, | |
| 1287 | + SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL); | |
| 856 | 1288 | |
| 857 | 1289 | /* Force pad isolation off if possible |
| 858 | 1290 | (in case power never toggled) */ |
| 859 | 1291 | if ((bus->ci->buscoretype == PCMCIA_CORE_ID) |
| 860 | 1292 | && (bus->ci->buscorerev >= 10)) |
| 861 | − bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_DEVICE_CTL, 0, | |
| 862 | − NULL); | |
| 1293 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, | |
| 1294 | + SBSDIO_DEVICE_CTL, 0, NULL); | |
| 863 | 1295 | |
| 864 | 1296 | /* Make sure the controller has the bus up */ |
| 865 | − dhdsdio_clkctl(bus, CLK_AVAIL, false); | |
| 1297 | + brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); | |
| 866 | 1298 | |
| 867 | 1299 | /* Send misc interrupt to indicate OOB not needed */ |
| 868 | − W_SDREG(0, ®s->tosbmailboxdata, retries); | |
| 1300 | + w_sdreg32(bus, 0, offsetof(struct sdpcmd_regs, tosbmailboxdata), | |
| 1301 | + &retries); | |
| 869 | 1302 | if (retries <= retry_limit) |
| 870 | − W_SDREG(SMB_DEV_INT, ®s->tosbmailbox, retries); | |
| 1303 | + w_sdreg32(bus, SMB_DEV_INT, | |
| 1304 | + offsetof(struct sdpcmd_regs, tosbmailbox), | |
| 1305 | + &retries); | |
| 871 | 1306 | |
| 872 | 1307 | if (retries > retry_limit) |
| 873 | − DHD_ERROR(("CANNOT SIGNAL CHIP TO CLEAR OOB!!\n")); | |
| 1308 | + BRCMF_ERROR(("CANNOT SIGNAL CHIP TO CLEAR OOB!!\n")); | |
| 874 | 1309 | |
| 875 | 1310 | /* Make sure we have SD bus access */ |
| 876 | − dhdsdio_clkctl(bus, CLK_SDONLY, false); | |
| 1311 | + brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false); | |
| 877 | 1312 | |
| 878 | 1313 | /* Change state */ |
| 879 | 1314 | bus->sleeping = false; |
| 880 | 1315 | |
| 881 | 1316 | /* Enable interrupts again */ |
| 882 | − if (bus->intr && (bus->dhd->busstate == DHD_BUS_DATA)) { | |
| 1317 | + if (bus->intr && (bus->drvr->busstate == BRCMF_BUS_DATA)) { | |
| 883 | 1318 | bus->intdis = false; |
| 884 | − bcmsdh_intr_enable(bus->sdh); | |
| 1319 | + brcmf_sdcard_intr_enable(bus->card); | |
| 885 | 1320 | } |
| 886 | 1321 | } |
| 887 | 1322 | |
| 888 | 1323 | return 0; |
| 889 | 1324 | } |
| 890 | 1325 | |
| 891 | −#if defined(OOB_INTR_ONLY) | |
| 892 | −void dhd_enable_oob_intr(struct dhd_bus *bus, bool enable) | |
| 893 | −{ | |
| 894 | −#if defined(HW_OOB) | |
| 895 | − bcmsdh_enable_hw_oob_intr(bus->sdh, enable); | |
| 896 | −#else | |
| 897 | − sdpcmd_regs_t *regs = bus->regs; | |
| 898 | − uint retries = 0; | |
| 899 | − | |
| 900 | − dhdsdio_clkctl(bus, CLK_AVAIL, false); | |
| 901 | − if (enable == true) { | |
| 902 | − | |
| 903 | − /* Tell device to start using OOB wakeup */ | |
| 904 | − W_SDREG(SMB_USE_OOB, ®s->tosbmailbox, retries); | |
| 905 | − if (retries > retry_limit) | |
| 906 | − DHD_ERROR(("CANNOT SIGNAL CHIP, WILL NOT WAKE UP!!\n")); | |
| 907 | − | |
| 908 | − } else { | |
| 909 | − /* Send misc interrupt to indicate OOB not needed */ | |
| 910 | − W_SDREG(0, ®s->tosbmailboxdata, retries); | |
| 911 | − if (retries <= retry_limit) | |
| 912 | − W_SDREG(SMB_DEV_INT, ®s->tosbmailbox, retries); | |
| 913 | − } | |
| 914 | − | |
| 915 | − /* Turn off our contribution to the HT clock request */ | |
| 916 | − dhdsdio_clkctl(bus, CLK_SDONLY, false); | |
| 917 | −#endif /* !defined(HW_OOB) */ | |
| 918 | −} | |
| 919 | −#endif /* defined(OOB_INTR_ONLY) */ | |
| 920 | − | |
| 921 | 1326 | #define BUS_WAKE(bus) \ |
| 922 | 1327 | do { \ |
| 923 | 1328 | if ((bus)->sleeping) \ |
| 924 | − dhdsdio_bussleep((bus), false); \ | |
| 1329 | + brcmf_sdbrcm_bussleep((bus), false); \ | |
| 925 | 1330 | } while (0); |
| 926 | 1331 | |
| 927 | 1332 | /* Writes a HW/SW header into the packet and sends it. */ |
| 928 | 1333 | /* Assumes: (a) header space already there, (b) caller holds lock */ |
| 929 | −static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, | |
| 1334 | +static int brcmf_sdbrcm_txpkt(struct brcmf_bus *bus, struct sk_buff *pkt, uint chan, | |
| 930 | 1335 | bool free_pkt) |
| 931 | 1336 | { |
| 932 | 1337 | int ret; |
| @@ -934,15 +1339,15 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, · 1 unmodified line | ||
| 934 | 1339 | u16 len, pad = 0; |
| 935 | 1340 | u32 swheader; |
| 936 | 1341 | uint retries = 0; |
| 937 | − bcmsdh_info_t *sdh; | |
| 1342 | + struct brcmf_sdio_card *card; | |
| 938 | 1343 | struct sk_buff *new; |
| 939 | 1344 | int i; |
| 940 | 1345 | |
| 941 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 1346 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 942 | 1347 | |
| 943 | − sdh = bus->sdh; | |
| 1348 | + card = bus->card; | |
| 944 | 1349 | |
| 945 | − if (bus->dhd->dongle_reset) { | |
| 1350 | + if (bus->drvr->dongle_reset) { | |
| 946 | 1351 | ret = -EPERM; |
| 947 | 1352 | goto done; |
| 948 | 1353 | } |
| @@ -950,40 +1355,39 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, · 1 unmodified line | ||
| 950 | 1355 | frame = (u8 *) (pkt->data); |
| 951 | 1356 | |
| 952 | 1357 | /* Add alignment padding, allocate new packet if needed */ |
| 953 | − pad = ((unsigned long)frame % DHD_SDALIGN); | |
| 1358 | + pad = ((unsigned long)frame % BRCMF_SDALIGN); | |
| 954 | 1359 | if (pad) { |
| 955 | 1360 | if (skb_headroom(pkt) < pad) { |
| 956 | − DHD_INFO(("%s: insufficient headroom %d for %d pad\n", | |
| 957 | − __func__, skb_headroom(pkt), pad)); | |
| 958 | − bus->dhd->tx_realloc++; | |
| 959 | − new = bcm_pkt_buf_get_skb(pkt->len + DHD_SDALIGN); | |
| 1361 | + BRCMF_INFO(("%s: insufficient headroom %d for %d pad\n", | |
| 1362 | + __func__, skb_headroom(pkt), pad)); | |
| 1363 | + bus->drvr->tx_realloc++; | |
| 1364 | + new = brcmu_pkt_buf_get_skb(pkt->len + BRCMF_SDALIGN); | |
| 960 | 1365 | if (!new) { |
| 961 | − DHD_ERROR(("%s: couldn't allocate new %d-byte " | |
| 962 | − "packet\n", | |
| 963 | − __func__, pkt->len + DHD_SDALIGN)); | |
| 1366 | + BRCMF_ERROR(("%s: couldn't allocate new " | |
| 1367 | + "%d-byte packet\n", __func__, | |
| 1368 | + pkt->len + BRCMF_SDALIGN)); | |
| 964 | 1369 | ret = -ENOMEM; |
| 965 | 1370 | goto done; |
| 966 | 1371 | } |
| 967 | 1372 | |
| 968 | − PKTALIGN(new, pkt->len, DHD_SDALIGN); | |
| 1373 | + PKTALIGN(new, pkt->len, BRCMF_SDALIGN); | |
| 969 | 1374 | memcpy(new->data, pkt->data, pkt->len); |
| 970 | 1375 | if (free_pkt) |
| 971 | − bcm_pkt_buf_free_skb(pkt); | |
| 1376 | + brcmu_pkt_buf_free_skb(pkt); | |
| 972 | 1377 | /* free the pkt if canned one is not used */ |
| 973 | 1378 | free_pkt = true; |
| 974 | 1379 | pkt = new; |
| 975 | 1380 | frame = (u8 *) (pkt->data); |
| 976 | − ASSERT(((unsigned long)frame % DHD_SDALIGN) == 0); | |
| 1381 | + /* precondition: (frame % BRCMF_SDALIGN) == 0) */ | |
| 977 | 1382 | pad = 0; |
| 978 | 1383 | } else { |
| 979 | 1384 | skb_push(pkt, pad); |
| 980 | 1385 | frame = (u8 *) (pkt->data); |
| 981 | − | |
| 982 | − ASSERT((pad + SDPCM_HDRLEN) <= (int)(pkt->len)); | |
| 1386 | + /* precondition: pad + SDPCM_HDRLEN <= pkt->len */ | |
| 983 | 1387 | memset(frame, 0, pad + SDPCM_HDRLEN); |
| 984 | 1388 | } |
| 985 | 1389 | } |
| 986 | − ASSERT(pad < DHD_SDALIGN); | |
| 1390 | + /* precondition: pad < BRCMF_SDALIGN */ | |
| 987 | 1391 | |
| 988 | 1392 | /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ |
| 989 | 1393 | len = (u16) (pkt->len); |
| @@ -999,14 +1403,14 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, · 9 unmodified lines | ||
| 999 | 1403 | put_unaligned_le32(swheader, frame + SDPCM_FRAMETAG_LEN); |
| 1000 | 1404 | put_unaligned_le32(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader)); |
| 1001 | 1405 | |
| 1002 | −#ifdef DHD_DEBUG | |
| 1406 | +#ifdef BCMDBG | |
| 1003 | 1407 | tx_packets[pkt->priority]++; |
| 1004 | − if (DHD_BYTES_ON() && | |
| 1005 | − (((DHD_CTL_ON() && (chan == SDPCM_CONTROL_CHANNEL)) || | |
| 1006 | − (DHD_DATA_ON() && (chan != SDPCM_CONTROL_CHANNEL))))) { | |
| 1408 | + if (BRCMF_BYTES_ON() && | |
| 1409 | + (((BRCMF_CTL_ON() && (chan == SDPCM_CONTROL_CHANNEL)) || | |
| 1410 | + (BRCMF_DATA_ON() && (chan != SDPCM_CONTROL_CHANNEL))))) { | |
| 1007 | 1411 | printk(KERN_DEBUG "Tx Frame:\n"); |
| 1008 | 1412 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, frame, len); |
| 1009 | − } else if (DHD_HDRS_ON()) { | |
| 1413 | + } else if (BRCMF_HDRS_ON()) { | |
| 1010 | 1414 | printk(KERN_DEBUG "TxHdr:\n"); |
| 1011 | 1415 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, |
| 1012 | 1416 | frame, min_t(u16, len, 16)); |
| @@ -1017,53 +1421,40 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, · 4 unmodified lines | ||
| 1017 | 1421 | if (bus->roundup && bus->blocksize && (len > bus->blocksize)) { |
| 1018 | 1422 | u16 pad = bus->blocksize - (len % bus->blocksize); |
| 1019 | 1423 | if ((pad <= bus->roundup) && (pad < bus->blocksize)) |
| 1020 | −#ifdef NOTUSED | |
| 1021 | − if (pad <= skb_tailroom(pkt)) | |
| 1022 | −#endif /* NOTUSED */ | |
| 1023 | 1424 | len += pad; |
| 1024 | − } else if (len % DHD_SDALIGN) { | |
| 1025 | − len += DHD_SDALIGN - (len % DHD_SDALIGN); | |
| 1425 | + } else if (len % BRCMF_SDALIGN) { | |
| 1426 | + len += BRCMF_SDALIGN - (len % BRCMF_SDALIGN); | |
| 1026 | 1427 | } |
| 1027 | 1428 | |
| 1028 | 1429 | /* Some controllers have trouble with odd bytes -- round to even */ |
| 1029 | 1430 | if (forcealign && (len & (ALIGNMENT - 1))) { |
| 1030 | −#ifdef NOTUSED | |
| 1031 | − if (skb_tailroom(pkt)) | |
| 1032 | −#endif | |
| 1033 | 1431 | len = roundup(len, ALIGNMENT); |
| 1034 | −#ifdef NOTUSED | |
| 1035 | − else | |
| 1036 | − DHD_ERROR(("%s: sending unrounded %d-byte packet\n", | |
| 1037 | − __func__, len)); | |
| 1038 | −#endif | |
| 1039 | 1432 | } |
| 1040 | 1433 | |
| 1041 | 1434 | do { |
| 1042 | − ret = | |
| 1043 | − dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, | |
| 1044 | − F2SYNC, frame, len, pkt, NULL, NULL); | |
| 1435 | + ret = brcmf_sdbrcm_send_buf(bus, brcmf_sdcard_cur_sbwad(card), | |
| 1436 | + SDIO_FUNC_2, F2SYNC, frame, len, pkt, NULL, NULL); | |
| 1045 | 1437 | bus->f2txdata++; |
| 1046 | − ASSERT(ret != -BCME_PENDING); | |
| 1047 | 1438 | |
| 1048 | 1439 | if (ret < 0) { |
| 1049 | 1440 | /* On failure, abort the command |
| 1050 | 1441 | and terminate the frame */ |
| 1051 | − DHD_INFO(("%s: sdio error %d, abort command and " | |
| 1052 | − "terminate frame.\n", __func__, ret)); | |
| 1442 | + BRCMF_INFO(("%s: sdio error %d, abort command and " | |
| 1443 | + "terminate frame.\n", __func__, ret)); | |
| 1053 | 1444 | bus->tx_sderrs++; |
| 1054 | 1445 | |
| 1055 | − bcmsdh_abort(sdh, SDIO_FUNC_2); | |
| 1056 | − bcmsdh_cfg_write(sdh, SDIO_FUNC_1, | |
| 1446 | + brcmf_sdcard_abort(card, SDIO_FUNC_2); | |
| 1447 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, | |
| 1057 | 1448 | SBSDIO_FUNC1_FRAMECTRL, SFC_WF_TERM, |
| 1058 | 1449 | NULL); |
| 1059 | 1450 | bus->f1regdata++; |
| 1060 | 1451 | |
| 1061 | 1452 | for (i = 0; i < 3; i++) { |
| 1062 | 1453 | u8 hi, lo; |
| 1063 | − hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, | |
| 1454 | + hi = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, | |
| 1064 | 1455 | SBSDIO_FUNC1_WFRAMEBCHI, |
| 1065 | 1456 | NULL); |
| 1066 | − lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, | |
| 1457 | + lo = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, | |
| 1067 | 1458 | SBSDIO_FUNC1_WFRAMEBCLO, |
| 1068 | 1459 | NULL); |
| 1069 | 1460 | bus->f1regdata += 2; |
| @@ -1080,22 +1471,22 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan, · 10 unmodified lines | ||
| 1080 | 1471 | done: |
| 1081 | 1472 | /* restore pkt buffer pointer before calling tx complete routine */ |
| 1082 | 1473 | skb_pull(pkt, SDPCM_HDRLEN + pad); |
| 1083 | − dhd_os_sdunlock(bus->dhd); | |
| 1084 | − dhd_txcomplete(bus->dhd, pkt, ret != 0); | |
| 1085 | − dhd_os_sdlock(bus->dhd); | |
| 1474 | + brcmf_sdbrcm_sdunlock(bus); | |
| 1475 | + brcmf_txcomplete(bus->drvr, pkt, ret != 0); | |
| 1476 | + brcmf_sdbrcm_sdlock(bus); | |
| 1086 | 1477 | |
| 1087 | 1478 | if (free_pkt) |
| 1088 | − bcm_pkt_buf_free_skb(pkt); | |
| 1479 | + brcmu_pkt_buf_free_skb(pkt); | |
| 1089 | 1480 | |
| 1090 | 1481 | return ret; |
| 1091 | 1482 | } |
| 1092 | 1483 | |
| 1093 | −int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt) | |
| 1484 | +int brcmf_sdbrcm_bus_txdata(struct brcmf_bus *bus, struct sk_buff *pkt) | |
| 1094 | 1485 | { |
| 1095 | 1486 | int ret = -EBADE; |
| 1096 | 1487 | uint datalen, prec; |
| 1097 | 1488 | |
| 1098 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 1489 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 1099 | 1490 | |
| 1100 | 1491 | datalen = pkt->len; |
| 1101 | 1492 | |
| @@ -1115,79 +1506,80 @@ int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt) · 13 unmodified lines | ||
| 1115 | 1506 | |
| 1116 | 1507 | /* Add space for the header */ |
| 1117 | 1508 | skb_push(pkt, SDPCM_HDRLEN); |
| 1118 | − ASSERT(IS_ALIGNED((unsigned long)(pkt->data), 2)); | |
| 1509 | + /* precondition: IS_ALIGNED((unsigned long)(pkt->data), 2) */ | |
| 1119 | 1510 | |
| 1120 | 1511 | prec = PRIO2PREC((pkt->priority & PRIOMASK)); |
| 1121 | 1512 | |
| 1122 | 1513 | /* Check for existing queue, current flow-control, |
| 1123 | 1514 | pending event, or pending clock */ |
| 1124 | − if (dhd_deferred_tx || bus->fcstate || pktq_len(&bus->txq) | |
| 1515 | + if (brcmf_deferred_tx || bus->fcstate || pktq_len(&bus->txq) | |
| 1125 | 1516 | || bus->dpc_sched || (!DATAOK(bus)) |
| 1126 | 1517 | || (bus->flowcontrol & NBITVAL(prec)) |
| 1127 | 1518 | || (bus->clkstate != CLK_AVAIL)) { |
| 1128 | − DHD_TRACE(("%s: deferring pktq len %d\n", __func__, | |
| 1129 | − pktq_len(&bus->txq))); | |
| 1519 | + BRCMF_TRACE(("%s: deferring pktq len %d\n", __func__, | |
| 1520 | + pktq_len(&bus->txq))); | |
| 1130 | 1521 | bus->fcqueued++; |
| 1131 | 1522 | |
| 1132 | 1523 | /* Priority based enq */ |
| 1133 | − dhd_os_sdlock_txq(bus->dhd); | |
| 1134 | − if (dhd_prec_enq(bus->dhd, &bus->txq, pkt, prec) == false) { | |
| 1524 | + spin_lock_bh(&bus->txqlock); | |
| 1525 | + if (brcmf_c_prec_enq(bus->drvr, &bus->txq, pkt, prec) == false) { | |
| 1135 | 1526 | skb_pull(pkt, SDPCM_HDRLEN); |
| 1136 | − dhd_txcomplete(bus->dhd, pkt, false); | |
| 1137 | − bcm_pkt_buf_free_skb(pkt); | |
| 1138 | − DHD_ERROR(("%s: out of bus->txq !!!\n", __func__)); | |
| 1527 | + brcmf_txcomplete(bus->drvr, pkt, false); | |
| 1528 | + brcmu_pkt_buf_free_skb(pkt); | |
| 1529 | + BRCMF_ERROR(("%s: out of bus->txq !!!\n", __func__)); | |
| 1139 | 1530 | ret = -ENOSR; |
| 1140 | 1531 | } else { |
| 1141 | 1532 | ret = 0; |
| 1142 | 1533 | } |
| 1143 | − dhd_os_sdunlock_txq(bus->dhd); | |
| 1534 | + spin_unlock_bh(&bus->txqlock); | |
| 1144 | 1535 | |
| 1145 | 1536 | if (pktq_len(&bus->txq) >= TXHI) |
| 1146 | − dhd_txflowcontrol(bus->dhd, 0, ON); | |
| 1537 | + brcmf_txflowcontrol(bus->drvr, 0, ON); | |
| 1147 | 1538 | |
| 1148 | −#ifdef DHD_DEBUG | |
| 1539 | +#ifdef BCMDBG | |
| 1149 | 1540 | if (pktq_plen(&bus->txq, prec) > qcount[prec]) |
| 1150 | 1541 | qcount[prec] = pktq_plen(&bus->txq, prec); |
| 1151 | 1542 | #endif |
| 1152 | 1543 | /* Schedule DPC if needed to send queued packet(s) */ |
| 1153 | − if (dhd_deferred_tx && !bus->dpc_sched) { | |
| 1544 | + if (brcmf_deferred_tx && !bus->dpc_sched) { | |
| 1154 | 1545 | bus->dpc_sched = true; |
| 1155 | − dhd_sched_dpc(bus->dhd); | |
| 1546 | + brcmf_sdbrcm_sched_dpc(bus); | |
| 1156 | 1547 | } |
| 1157 | 1548 | } else { |
| 1158 | 1549 | /* Lock: we're about to use shared data/code (and SDIO) */ |
| 1159 | − dhd_os_sdlock(bus->dhd); | |
| 1550 | + brcmf_sdbrcm_sdlock(bus); | |
| 1160 | 1551 | |
| 1161 | 1552 | /* Otherwise, send it now */ |
| 1162 | 1553 | BUS_WAKE(bus); |
| 1163 | 1554 | /* Make sure back plane ht clk is on, no pending allowed */ |
| 1164 | − dhdsdio_clkctl(bus, CLK_AVAIL, true); | |
| 1555 | + brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, true); | |
| 1165 | 1556 | |
| 1166 | 1557 | #ifndef SDTEST |
| 1167 | − DHD_TRACE(("%s: calling txpkt\n", __func__)); | |
| 1168 | − ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true); | |
| 1558 | + BRCMF_TRACE(("%s: calling txpkt\n", __func__)); | |
| 1559 | + ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true); | |
| 1169 | 1560 | #else |
| 1170 | − ret = dhdsdio_txpkt(bus, pkt, | |
| 1561 | + ret = brcmf_sdbrcm_txpkt(bus, pkt, | |
| 1171 | 1562 | (bus->ext_loop ? SDPCM_TEST_CHANNEL : |
| 1172 | 1563 | SDPCM_DATA_CHANNEL), true); |
| 1173 | 1564 | #endif |
| 1174 | 1565 | if (ret) |
| 1175 | − bus->dhd->tx_errors++; | |
| 1566 | + bus->drvr->tx_errors++; | |
| 1176 | 1567 | else |
| 1177 | − bus->dhd->dstats.tx_bytes += datalen; | |
| 1568 | + bus->drvr->dstats.tx_bytes += datalen; | |
| 1178 | 1569 | |
| 1179 | − if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) { | |
| 1570 | + if (bus->idletime == BRCMF_IDLE_IMMEDIATE && | |
| 1571 | + !bus->dpc_sched) { | |
| 1180 | 1572 | bus->activity = false; |
| 1181 | − dhdsdio_clkctl(bus, CLK_NONE, true); | |
| 1573 | + brcmf_sdbrcm_clkctl(bus, CLK_NONE, true); | |
| 1182 | 1574 | } |
| 1183 | 1575 | |
| 1184 | − dhd_os_sdunlock(bus->dhd); | |
| 1576 | + brcmf_sdbrcm_sdunlock(bus); | |
| 1185 | 1577 | } |
| 1186 | 1578 | |
| 1187 | 1579 | return ret; |
| 1188 | 1580 | } |
| 1189 | 1581 | |
| 1190 | −static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes) | |
| 1582 | +static uint brcmf_sdbrcm_sendfromq(struct brcmf_bus *bus, uint maxframes) | |
| 1191 | 1583 | { |
| 1192 | 1584 | struct sk_buff *pkt; |
| 1193 | 1585 | u32 intstatus = 0; |
| @@ -1197,42 +1589,43 @@ static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes) · 3 unmodified lines | ||
| 1197 | 1589 | uint datalen; |
| 1198 | 1590 | u8 tx_prec_map; |
| 1199 | 1591 | |
| 1200 | − dhd_pub_t *dhd = bus->dhd; | |
| 1201 | − sdpcmd_regs_t *regs = bus->regs; | |
| 1592 | + struct brcmf_pub *drvr = bus->drvr; | |
| 1202 | 1593 | |
| 1203 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 1594 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 1204 | 1595 | |
| 1205 | 1596 | tx_prec_map = ~bus->flowcontrol; |
| 1206 | 1597 | |
| 1207 | 1598 | /* Send frames until the limit or some other event */ |
| 1208 | 1599 | for (cnt = 0; (cnt < maxframes) && DATAOK(bus); cnt++) { |
| 1209 | − dhd_os_sdlock_txq(bus->dhd); | |
| 1210 | − pkt = bcm_pktq_mdeq(&bus->txq, tx_prec_map, &prec_out); | |
| 1600 | + spin_lock_bh(&bus->txqlock); | |
| 1601 | + pkt = brcmu_pktq_mdeq(&bus->txq, tx_prec_map, &prec_out); | |
| 1211 | 1602 | if (pkt == NULL) { |
| 1212 | − dhd_os_sdunlock_txq(bus->dhd); | |
| 1603 | + spin_unlock_bh(&bus->txqlock); | |
| 1213 | 1604 | break; |
| 1214 | 1605 | } |
| 1215 | − dhd_os_sdunlock_txq(bus->dhd); | |
| 1606 | + spin_unlock_bh(&bus->txqlock); | |
| 1216 | 1607 | datalen = pkt->len - SDPCM_HDRLEN; |
| 1217 | 1608 | |
| 1218 | 1609 | #ifndef SDTEST |
| 1219 | − ret = dhdsdio_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true); | |
| 1610 | + ret = brcmf_sdbrcm_txpkt(bus, pkt, SDPCM_DATA_CHANNEL, true); | |
| 1220 | 1611 | #else |
| 1221 | − ret = dhdsdio_txpkt(bus, pkt, | |
| 1612 | + ret = brcmf_sdbrcm_txpkt(bus, pkt, | |
| 1222 | 1613 | (bus->ext_loop ? SDPCM_TEST_CHANNEL : |
| 1223 | 1614 | SDPCM_DATA_CHANNEL), true); |
| 1224 | 1615 | #endif |
| 1225 | 1616 | if (ret) |
| 1226 | − bus->dhd->tx_errors++; | |
| 1617 | + bus->drvr->tx_errors++; | |
| 1227 | 1618 | else |
| 1228 | − bus->dhd->dstats.tx_bytes += datalen; | |
| 1619 | + bus->drvr->dstats.tx_bytes += datalen; | |
| 1229 | 1620 | |
| 1230 | 1621 | /* In poll mode, need to check for other events */ |
| 1231 | 1622 | if (!bus->intr && cnt) { |
| 1232 | 1623 | /* Check device status, signal pending interrupt */ |
| 1233 | − R_SDREG(intstatus, ®s->intstatus, retries); | |
| 1624 | + r_sdreg32(bus, &intstatus, | |
| 1625 | + offsetof(struct sdpcmd_regs, intstatus), | |
| 1626 | + &retries); | |
| 1234 | 1627 | bus->f2txdata++; |
| 1235 | − if (bcmsdh_regfail(bus->sdh)) | |
| 1628 | + if (brcmf_sdcard_regfail(bus->card)) | |
| 1236 | 1629 | break; |
| 1237 | 1630 | if (intstatus & bus->hostintmask) |
| 1238 | 1631 | bus->ipend = true; |
| @@ -1240,27 +1633,28 @@ static uint dhdsdio_sendfromq(dhd_bus_t *bus, uint maxframes) · 1 unmodified line | ||
| 1240 | 1633 | } |
| 1241 | 1634 | |
| 1242 | 1635 | /* Deflow-control stack if needed */ |
| 1243 | − if (dhd->up && (dhd->busstate == DHD_BUS_DATA) && | |
| 1244 | − dhd->txoff && (pktq_len(&bus->txq) < TXLOW)) | |
| 1245 | − dhd_txflowcontrol(dhd, 0, OFF); | |
| 1636 | + if (drvr->up && (drvr->busstate == BRCMF_BUS_DATA) && | |
| 1637 | + drvr->txoff && (pktq_len(&bus->txq) < TXLOW)) | |
| 1638 | + brcmf_txflowcontrol(drvr, 0, OFF); | |
| 1246 | 1639 | |
| 1247 | 1640 | return cnt; |
| 1248 | 1641 | } |
| 1249 | 1642 | |
| 1250 | −int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) | |
| 1643 | +int | |
| 1644 | +brcmf_sdbrcm_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen) | |
| 1251 | 1645 | { |
| 1252 | 1646 | u8 *frame; |
| 1253 | 1647 | u16 len; |
| 1254 | 1648 | u32 swheader; |
| 1255 | 1649 | uint retries = 0; |
| 1256 | − bcmsdh_info_t *sdh = bus->sdh; | |
| 1650 | + struct brcmf_sdio_card *card = bus->card; | |
| 1257 | 1651 | u8 doff = 0; |
| 1258 | 1652 | int ret = -1; |
| 1259 | 1653 | int i; |
| 1260 | 1654 | |
| 1261 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 1655 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 1262 | 1656 | |
| 1263 | − if (bus->dhd->dongle_reset) | |
| 1657 | + if (bus->drvr->dongle_reset) | |
| 1264 | 1658 | return -EIO; |
| 1265 | 1659 | |
| 1266 | 1660 | /* Back the pointer to make a room for bus header */ |
| @@ -1268,15 +1662,15 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) · 1 unmodified line | ||
| 1268 | 1662 | len = (msglen += SDPCM_HDRLEN); |
| 1269 | 1663 | |
| 1270 | 1664 | /* Add alignment padding (optional for ctl frames) */ |
| 1271 | − if (dhd_alignctl) { | |
| 1272 | − doff = ((unsigned long)frame % DHD_SDALIGN); | |
| 1665 | + if (brcmf_alignctl) { | |
| 1666 | + doff = ((unsigned long)frame % BRCMF_SDALIGN); | |
| 1273 | 1667 | if (doff) { |
| 1274 | 1668 | frame -= doff; |
| 1275 | 1669 | len += doff; |
| 1276 | 1670 | msglen += doff; |
| 1277 | 1671 | memset(frame, 0, doff + SDPCM_HDRLEN); |
| 1278 | 1672 | } |
| 1279 | − ASSERT(doff < DHD_SDALIGN); | |
| 1673 | + /* precondition: doff < BRCMF_SDALIGN */ | |
| 1280 | 1674 | } |
| 1281 | 1675 | doff += SDPCM_HDRLEN; |
| 1282 | 1676 | |
| @@ -1285,23 +1679,23 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) · 2 unmodified lines | ||
| 1285 | 1679 | u16 pad = bus->blocksize - (len % bus->blocksize); |
| 1286 | 1680 | if ((pad <= bus->roundup) && (pad < bus->blocksize)) |
| 1287 | 1681 | len += pad; |
| 1288 | − } else if (len % DHD_SDALIGN) { | |
| 1289 | − len += DHD_SDALIGN - (len % DHD_SDALIGN); | |
| 1682 | + } else if (len % BRCMF_SDALIGN) { | |
| 1683 | + len += BRCMF_SDALIGN - (len % BRCMF_SDALIGN); | |
| 1290 | 1684 | } |
| 1291 | 1685 | |
| 1292 | 1686 | /* Satisfy length-alignment requirements */ |
| 1293 | 1687 | if (forcealign && (len & (ALIGNMENT - 1))) |
| 1294 | 1688 | len = roundup(len, ALIGNMENT); |
| 1295 | 1689 | |
| 1296 | − ASSERT(IS_ALIGNED((unsigned long)frame, 2)); | |
| 1690 | + /* precondition: IS_ALIGNED((unsigned long)frame, 2) */ | |
| 1297 | 1691 | |
| 1298 | 1692 | /* Need to lock here to protect txseq and SDIO tx calls */ |
| 1299 | − dhd_os_sdlock(bus->dhd); | |
| 1693 | + brcmf_sdbrcm_sdlock(bus); | |
| 1300 | 1694 | |
| 1301 | 1695 | BUS_WAKE(bus); |
| 1302 | 1696 | |
| 1303 | 1697 | /* Make sure backplane clock is on */ |
| 1304 | − dhdsdio_clkctl(bus, CLK_AVAIL, false); | |
| 1698 | + brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); | |
| 1305 | 1699 | |
| 1306 | 1700 | /* Hardware tag: 2 byte len followed by 2 byte ~len check (all LE) */ |
| 1307 | 1701 | *(u16 *) frame = cpu_to_le16((u16) msglen); |
| @@ -1317,31 +1711,33 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) · 9 unmodified lines | ||
| 1317 | 1711 | put_unaligned_le32(0, frame + SDPCM_FRAMETAG_LEN + sizeof(swheader)); |
| 1318 | 1712 | |
| 1319 | 1713 | if (!DATAOK(bus)) { |
| 1320 | − DHD_INFO(("%s: No bus credit bus->tx_max %d, bus->tx_seq %d\n", | |
| 1321 | − __func__, bus->tx_max, bus->tx_seq)); | |
| 1714 | + BRCMF_INFO(("%s: No bus credit bus->tx_max %d," | |
| 1715 | + " bus->tx_seq %d\n", __func__, | |
| 1716 | + bus->tx_max, bus->tx_seq)); | |
| 1322 | 1717 | bus->ctrl_frame_stat = true; |
| 1323 | 1718 | /* Send from dpc */ |
| 1324 | 1719 | bus->ctrl_frame_buf = frame; |
| 1325 | 1720 | bus->ctrl_frame_len = len; |
| 1326 | 1721 | |
| 1327 | − dhd_wait_for_event(bus->dhd, &bus->ctrl_frame_stat); | |
| 1722 | + brcmf_sdbrcm_wait_for_event(bus, &bus->ctrl_frame_stat); | |
| 1328 | 1723 | |
| 1329 | 1724 | if (bus->ctrl_frame_stat == false) { |
| 1330 | − DHD_INFO(("%s: ctrl_frame_stat == false\n", __func__)); | |
| 1725 | + BRCMF_INFO(("%s: ctrl_frame_stat == false\n", | |
| 1726 | + __func__)); | |
| 1331 | 1727 | ret = 0; |
| 1332 | 1728 | } else { |
| 1333 | − DHD_INFO(("%s: ctrl_frame_stat == true\n", __func__)); | |
| 1729 | + BRCMF_INFO(("%s: ctrl_frame_stat == true\n", __func__)); | |
| 1334 | 1730 | ret = -1; |
| 1335 | 1731 | } |
| 1336 | 1732 | } |
| 1337 | 1733 | |
| 1338 | 1734 | if (ret == -1) { |
| 1339 | −#ifdef DHD_DEBUG | |
| 1340 | − if (DHD_BYTES_ON() && DHD_CTL_ON()) { | |
| 1735 | +#ifdef BCMDBG | |
| 1736 | + if (BRCMF_BYTES_ON() && BRCMF_CTL_ON()) { | |
| 1341 | 1737 | printk(KERN_DEBUG "Tx Frame:\n"); |
| 1342 | 1738 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, |
| 1343 | 1739 | frame, len); |
| 1344 | − } else if (DHD_HDRS_ON()) { | |
| 1740 | + } else if (BRCMF_HDRS_ON()) { | |
| 1345 | 1741 | printk(KERN_DEBUG "TxHdr:\n"); |
| 1346 | 1742 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, |
| 1347 | 1743 | frame, min_t(u16, len, 16)); |
| @@ -1350,35 +1746,35 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) · 2 unmodified lines | ||
| 1350 | 1746 | |
| 1351 | 1747 | do { |
| 1352 | 1748 | bus->ctrl_frame_stat = false; |
| 1353 | − ret = | |
| 1354 | − dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), | |
| 1355 | − SDIO_FUNC_2, F2SYNC, frame, len, | |
| 1356 | − NULL, NULL, NULL); | |
| 1357 | − | |
| 1358 | − ASSERT(ret != -BCME_PENDING); | |
| 1749 | + ret = brcmf_sdbrcm_send_buf(bus, | |
| 1750 | + brcmf_sdcard_cur_sbwad(card), SDIO_FUNC_2, | |
| 1751 | + F2SYNC, frame, len, NULL, NULL, NULL); | |
| 1359 | 1752 | |
| 1360 | 1753 | if (ret < 0) { |
| 1361 | 1754 | /* On failure, abort the command and |
| 1362 | 1755 | terminate the frame */ |
| 1363 | − DHD_INFO(("%s: sdio error %d, abort command and terminate frame.\n", | |
| 1364 | − __func__, ret)); | |
| 1756 | + BRCMF_INFO(("%s: sdio error %d, abort command " | |
| 1757 | + "and terminate frame.\n", | |
| 1758 | + __func__, ret)); | |
| 1365 | 1759 | bus->tx_sderrs++; |
| 1366 | 1760 | |
| 1367 | − bcmsdh_abort(sdh, SDIO_FUNC_2); | |
| 1761 | + brcmf_sdcard_abort(card, SDIO_FUNC_2); | |
| 1368 | 1762 | |
| 1369 | − bcmsdh_cfg_write(sdh, SDIO_FUNC_1, | |
| 1763 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, | |
| 1370 | 1764 | SBSDIO_FUNC1_FRAMECTRL, |
| 1371 | 1765 | SFC_WF_TERM, NULL); |
| 1372 | 1766 | bus->f1regdata++; |
| 1373 | 1767 | |
| 1374 | 1768 | for (i = 0; i < 3; i++) { |
| 1375 | 1769 | u8 hi, lo; |
| 1376 | − hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, | |
| 1770 | + hi = brcmf_sdcard_cfg_read(card, | |
| 1771 | + SDIO_FUNC_1, | |
| 1377 | 1772 | SBSDIO_FUNC1_WFRAMEBCHI, |
| 1378 | 1773 | NULL); |
| 1379 | − lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, | |
| 1774 | + lo = brcmf_sdcard_cfg_read(card, | |
| 1775 | + SDIO_FUNC_1, | |
| 1380 | 1776 | SBSDIO_FUNC1_WFRAMEBCLO, |
| 1381 | − NULL); | |
| 1777 | + NULL); | |
| 1382 | 1778 | bus->f1regdata += 2; |
| 1383 | 1779 | if ((hi == 0) && (lo == 0)) |
| 1384 | 1780 | break; |
| @@ -1392,67 +1788,67 @@ int dhd_bus_txctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) · 7 unmodified lines | ||
| 1392 | 1788 | } while ((ret < 0) && retries++ < TXRETRIES); |
| 1393 | 1789 | } |
| 1394 | 1790 | |
| 1395 | − if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) { | |
| 1791 | + if ((bus->idletime == BRCMF_IDLE_IMMEDIATE) && !bus->dpc_sched) { | |
| 1396 | 1792 | bus->activity = false; |
| 1397 | − dhdsdio_clkctl(bus, CLK_NONE, true); | |
| 1793 | + brcmf_sdbrcm_clkctl(bus, CLK_NONE, true); | |
| 1398 | 1794 | } |
| 1399 | 1795 | |
| 1400 | − dhd_os_sdunlock(bus->dhd); | |
| 1796 | + brcmf_sdbrcm_sdunlock(bus); | |
| 1401 | 1797 | |
| 1402 | 1798 | if (ret) |
| 1403 | − bus->dhd->tx_ctlerrs++; | |
| 1799 | + bus->drvr->tx_ctlerrs++; | |
| 1404 | 1800 | else |
| 1405 | − bus->dhd->tx_ctlpkts++; | |
| 1801 | + bus->drvr->tx_ctlpkts++; | |
| 1406 | 1802 | |
| 1407 | 1803 | return ret ? -EIO : 0; |
| 1408 | 1804 | } |
| 1409 | 1805 | |
| 1410 | −int dhd_bus_rxctl(struct dhd_bus *bus, unsigned char *msg, uint msglen) | |
| 1806 | +int brcmf_sdbrcm_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint msglen) | |
| 1411 | 1807 | { |
| 1412 | 1808 | int timeleft; |
| 1413 | 1809 | uint rxlen = 0; |
| 1414 | 1810 | bool pending; |
| 1415 | 1811 | |
| 1416 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 1812 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 1417 | 1813 | |
| 1418 | − if (bus->dhd->dongle_reset) | |
| 1814 | + if (bus->drvr->dongle_reset) | |
| 1419 | 1815 | return -EIO; |
| 1420 | 1816 | |
| 1421 | 1817 | /* Wait until control frame is available */ |
| 1422 | − timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen, &pending); | |
| 1818 | + timeleft = brcmf_os_ioctl_resp_wait(bus->drvr, &bus->rxlen, &pending); | |
| 1423 | 1819 | |
| 1424 | − dhd_os_sdlock(bus->dhd); | |
| 1820 | + brcmf_sdbrcm_sdlock(bus); | |
| 1425 | 1821 | rxlen = bus->rxlen; |
| 1426 | 1822 | memcpy(msg, bus->rxctl, min(msglen, rxlen)); |
| 1427 | 1823 | bus->rxlen = 0; |
| 1428 | − dhd_os_sdunlock(bus->dhd); | |
| 1824 | + brcmf_sdbrcm_sdunlock(bus); | |
| 1429 | 1825 | |
| 1430 | 1826 | if (rxlen) { |
| 1431 | − DHD_CTL(("%s: resumed on rxctl frame, got %d expected %d\n", | |
| 1432 | − __func__, rxlen, msglen)); | |
| 1827 | + BRCMF_CTL(("%s: resumed on rxctl frame, got %d expected %d\n", | |
| 1828 | + __func__, rxlen, msglen)); | |
| 1433 | 1829 | } else if (timeleft == 0) { |
| 1434 | − DHD_ERROR(("%s: resumed on timeout\n", __func__)); | |
| 1435 | −#ifdef DHD_DEBUG | |
| 1436 | − dhd_os_sdlock(bus->dhd); | |
| 1437 | − dhdsdio_checkdied(bus, NULL, 0); | |
| 1438 | − dhd_os_sdunlock(bus->dhd); | |
| 1439 | −#endif /* DHD_DEBUG */ | |
| 1830 | + BRCMF_ERROR(("%s: resumed on timeout\n", __func__)); | |
| 1831 | +#ifdef BCMDBG | |
| 1832 | + brcmf_sdbrcm_sdlock(bus); | |
| 1833 | + brcmf_sdbrcm_checkdied(bus, NULL, 0); | |
| 1834 | + brcmf_sdbrcm_sdunlock(bus); | |
| 1835 | +#endif /* BCMDBG */ | |
| 1440 | 1836 | } else if (pending == true) { |
| 1441 | − DHD_CTL(("%s: cancelled\n", __func__)); | |
| 1837 | + BRCMF_CTL(("%s: cancelled\n", __func__)); | |
| 1442 | 1838 | return -ERESTARTSYS; |
| 1443 | 1839 | } else { |
| 1444 | − DHD_CTL(("%s: resumed for unknown reason?\n", __func__)); | |
| 1445 | −#ifdef DHD_DEBUG | |
| 1446 | − dhd_os_sdlock(bus->dhd); | |
| 1447 | − dhdsdio_checkdied(bus, NULL, 0); | |
| 1448 | − dhd_os_sdunlock(bus->dhd); | |
| 1449 | −#endif /* DHD_DEBUG */ | |
| 1840 | + BRCMF_CTL(("%s: resumed for unknown reason?\n", __func__)); | |
| 1841 | +#ifdef BCMDBG | |
| 1842 | + brcmf_sdbrcm_sdlock(bus); | |
| 1843 | + brcmf_sdbrcm_checkdied(bus, NULL, 0); | |
| 1844 | + brcmf_sdbrcm_sdunlock(bus); | |
| 1845 | +#endif /* BCMDBG */ | |
| 1450 | 1846 | } |
| 1451 | 1847 | |
| 1452 | 1848 | if (rxlen) |
| 1453 | − bus->dhd->rx_ctlpkts++; | |
| 1849 | + bus->drvr->rx_ctlpkts++; | |
| 1454 | 1850 | else |
| 1455 | − bus->dhd->rx_ctlerrs++; | |
| 1851 | + bus->drvr->rx_ctlerrs++; | |
| 1456 | 1852 | |
| 1457 | 1853 | return rxlen ? (int)rxlen : -ETIMEDOUT; |
| 1458 | 1854 | } |
| @@ -1466,8 +1862,10 @@ enum { · 7 unmodified lines | ||
| 1466 | 1862 | IOV_SDCIS, |
| 1467 | 1863 | IOV_MEMBYTES, |
| 1468 | 1864 | IOV_MEMSIZE, |
| 1469 | −#ifdef DHD_DEBUG | |
| 1865 | +#ifdef BCMDBG | |
| 1470 | 1866 | IOV_CHECKDIED, |
| 1867 | + IOV_CONS, | |
| 1868 | + IOV_DCONSOLE_POLL, | |
| 1471 | 1869 | #endif |
| 1472 | 1870 | IOV_DOWNLOAD, |
| 1473 | 1871 | IOV_FORCEEVEN, |
| @@ -1490,10 +1888,11 @@ enum { · 16 unmodified lines | ||
| 1490 | 1888 | IOV_IDLECLOCK, |
| 1491 | 1889 | IOV_SD1IDLE, |
| 1492 | 1890 | IOV_SLEEP, |
| 1891 | + IOV_WDTICK, | |
| 1493 | 1892 | IOV_VARS |
| 1494 | 1893 | }; |
| 1495 | 1894 | |
| 1496 | −const bcm_iovar_t dhdsdio_iovars[] = { | |
| 1895 | +const struct brcmu_iovar brcmf_sdio_iovars[] = { | |
| 1497 | 1896 | {"intr", IOV_INTR, 0, IOVT_BOOL, 0}, |
| 1498 | 1897 | {"sleep", IOV_SLEEP, 0, IOVT_BOOL, 0}, |
| 1499 | 1898 | {"pollrate", IOV_POLLRATE, 0, IOVT_UINT32, 0}, |
| @@ -1510,12 +1909,17 @@ const bcm_iovar_t dhdsdio_iovars[] = { · 10 unmodified lines | ||
| 1510 | 1909 | {"alignctl", IOV_ALIGNCTL, 0, IOVT_BOOL, 0}, |
| 1511 | 1910 | {"sdalign", IOV_SDALIGN, 0, IOVT_BOOL, 0}, |
| 1512 | 1911 | {"devreset", IOV_DEVRESET, 0, IOVT_BOOL, 0}, |
| 1513 | −#ifdef DHD_DEBUG | |
| 1514 | − {"sdreg", IOV_SDREG, 0, IOVT_BUFFER, sizeof(sdreg_t)} | |
| 1912 | + {"wdtick", IOV_WDTICK, 0, IOVT_UINT32, 0}, | |
| 1913 | +#ifdef BCMDBG | |
| 1914 | + {"cons", IOV_CONS, 0, IOVT_BUFFER, 0} | |
| 1915 | + , | |
| 1916 | + {"dconpoll", IOV_DCONSOLE_POLL, 0, IOVT_UINT32, 0} | |
| 1917 | + , | |
| 1918 | + {"sdreg", IOV_SDREG, 0, IOVT_BUFFER, sizeof(struct brcmf_sdreg)} | |
| 1515 | 1919 | , |
| 1516 | − {"sbreg", IOV_SBREG, 0, IOVT_BUFFER, sizeof(sdreg_t)} | |
| 1920 | + {"sbreg", IOV_SBREG, 0, IOVT_BUFFER, sizeof(struct brcmf_sdreg)} | |
| 1517 | 1921 | , |
| 1518 | − {"sd_cis", IOV_SDCIS, 0, IOVT_BUFFER, DHD_IOCTL_MAXLEN} | |
| 1922 | + {"sd_cis", IOV_SDCIS, 0, IOVT_BUFFER, BRCMF_IOCTL_MAXLEN} | |
| 1519 | 1923 | , |
| 1520 | 1924 | {"forcealign", IOV_FORCEEVEN, 0, IOVT_BOOL, 0} |
| 1521 | 1925 | , |
| @@ -1527,15 +1931,13 @@ const bcm_iovar_t dhdsdio_iovars[] = { · 5 unmodified lines | ||
| 1527 | 1931 | , |
| 1528 | 1932 | {"cpu", IOV_CPU, 0, IOVT_BOOL, 0} |
| 1529 | 1933 | , |
| 1530 | −#ifdef DHD_DEBUG | |
| 1531 | 1934 | {"checkdied", IOV_CHECKDIED, 0, IOVT_BUFFER, 0} |
| 1532 | 1935 | , |
| 1533 | −#endif /* DHD_DEBUG */ | |
| 1534 | −#endif /* DHD_DEBUG */ | |
| 1936 | +#endif /* BCMDBG */ | |
| 1535 | 1937 | #ifdef SDTEST |
| 1536 | 1938 | {"extloop", IOV_EXTLOOP, 0, IOVT_BOOL, 0} |
| 1537 | 1939 | , |
| 1538 | − {"pktgen", IOV_PKTGEN, 0, IOVT_BUFFER, sizeof(dhd_pktgen_t)} | |
| 1940 | + {"pktgen", IOV_PKTGEN, 0, IOVT_BUFFER, sizeof(struct brcmf_pktgen)} | |
| 1539 | 1941 | , |
| 1540 | 1942 | #endif /* SDTEST */ |
| 1541 | 1943 | |
| @@ -1543,122 +1945,122 @@ const bcm_iovar_t dhdsdio_iovars[] = { · 1 unmodified line | ||
| 1543 | 1945 | }; |
| 1544 | 1946 | |
| 1545 | 1947 | static void |
| 1546 | −dhd_dump_pct(struct bcmstrbuf *strbuf, char *desc, uint num, uint div) | |
| 1948 | +brcmf_dump_pct(struct brcmu_strbuf *strbuf, char *desc, uint num, uint div) | |
| 1547 | 1949 | { |
| 1548 | 1950 | uint q1, q2; |
| 1549 | 1951 | |
| 1550 | 1952 | if (!div) { |
| 1551 | − bcm_bprintf(strbuf, "%s N/A", desc); | |
| 1953 | + brcmu_bprintf(strbuf, "%s N/A", desc); | |
| 1552 | 1954 | } else { |
| 1553 | 1955 | q1 = num / div; |
| 1554 | 1956 | q2 = (100 * (num - (q1 * div))) / div; |
| 1555 | − bcm_bprintf(strbuf, "%s %d.%02d", desc, q1, q2); | |
| 1957 | + brcmu_bprintf(strbuf, "%s %d.%02d", desc, q1, q2); | |
| 1556 | 1958 | } |
| 1557 | 1959 | } |
| 1558 | 1960 | |
| 1559 | −void dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf) | |
| 1961 | +void brcmf_sdbrcm_bus_dump(struct brcmf_pub *drvr, struct brcmu_strbuf *strbuf) | |
| 1560 | 1962 | { |
| 1561 | − dhd_bus_t *bus = dhdp->bus; | |
| 1963 | + struct brcmf_bus *bus = drvr->bus; | |
| 1562 | 1964 | |
| 1563 | − bcm_bprintf(strbuf, "Bus SDIO structure:\n"); | |
| 1564 | − bcm_bprintf(strbuf, | |
| 1965 | + brcmu_bprintf(strbuf, "Bus SDIO structure:\n"); | |
| 1966 | + brcmu_bprintf(strbuf, | |
| 1565 | 1967 | "hostintmask 0x%08x intstatus 0x%08x sdpcm_ver %d\n", |
| 1566 | 1968 | bus->hostintmask, bus->intstatus, bus->sdpcm_ver); |
| 1567 | − bcm_bprintf(strbuf, | |
| 1969 | + brcmu_bprintf(strbuf, | |
| 1568 | 1970 | "fcstate %d qlen %d tx_seq %d, max %d, rxskip %d rxlen %d rx_seq %d\n", |
| 1569 | 1971 | bus->fcstate, pktq_len(&bus->txq), bus->tx_seq, bus->tx_max, |
| 1570 | 1972 | bus->rxskip, bus->rxlen, bus->rx_seq); |
| 1571 | − bcm_bprintf(strbuf, "intr %d intrcount %d lastintrs %d spurious %d\n", | |
| 1973 | + brcmu_bprintf(strbuf, "intr %d intrcount %d lastintrs %d spurious %d\n", | |
| 1572 | 1974 | bus->intr, bus->intrcount, bus->lastintrs, bus->spurious); |
| 1573 | − bcm_bprintf(strbuf, "pollrate %d pollcnt %d regfails %d\n", | |
| 1975 | + brcmu_bprintf(strbuf, "pollrate %d pollcnt %d regfails %d\n", | |
| 1574 | 1976 | bus->pollrate, bus->pollcnt, bus->regfails); |
| 1575 | 1977 | |
| 1576 | − bcm_bprintf(strbuf, "\nAdditional counters:\n"); | |
| 1577 | − bcm_bprintf(strbuf, | |
| 1978 | + brcmu_bprintf(strbuf, "\nAdditional counters:\n"); | |
| 1979 | + brcmu_bprintf(strbuf, | |
| 1578 | 1980 | "tx_sderrs %d fcqueued %d rxrtx %d rx_toolong %d rxc_errors %d\n", |
| 1579 | 1981 | bus->tx_sderrs, bus->fcqueued, bus->rxrtx, bus->rx_toolong, |
| 1580 | 1982 | bus->rxc_errors); |
| 1581 | − bcm_bprintf(strbuf, "rx_hdrfail %d badhdr %d badseq %d\n", | |
| 1983 | + brcmu_bprintf(strbuf, "rx_hdrfail %d badhdr %d badseq %d\n", | |
| 1582 | 1984 | bus->rx_hdrfail, bus->rx_badhdr, bus->rx_badseq); |
| 1583 | − bcm_bprintf(strbuf, "fc_rcvd %d, fc_xoff %d, fc_xon %d\n", bus->fc_rcvd, | |
| 1584 | − bus->fc_xoff, bus->fc_xon); | |
| 1585 | − bcm_bprintf(strbuf, "rxglomfail %d, rxglomframes %d, rxglompkts %d\n", | |
| 1985 | + brcmu_bprintf(strbuf, "fc_rcvd %d, fc_xoff %d, fc_xon %d\n", | |
| 1986 | + bus->fc_rcvd, bus->fc_xoff, bus->fc_xon); | |
| 1987 | + brcmu_bprintf(strbuf, "rxglomfail %d, rxglomframes %d, rxglompkts %d\n", | |
| 1586 | 1988 | bus->rxglomfail, bus->rxglomframes, bus->rxglompkts); |
| 1587 | − bcm_bprintf(strbuf, "f2rx (hdrs/data) %d (%d/%d), f2tx %d f1regs %d\n", | |
| 1588 | − (bus->f2rxhdrs + bus->f2rxdata), bus->f2rxhdrs, | |
| 1589 | − bus->f2rxdata, bus->f2txdata, bus->f1regdata); | |
| 1989 | + brcmu_bprintf(strbuf, "f2rx (hdrs/data) %d (%d/%d), f2tx %d f1regs" | |
| 1990 | + " %d\n", | |
| 1991 | + (bus->f2rxhdrs + bus->f2rxdata), bus->f2rxhdrs, | |
| 1992 | + bus->f2rxdata, bus->f2txdata, bus->f1regdata); | |
| 1590 | 1993 | { |
| 1591 | − dhd_dump_pct(strbuf, "\nRx: pkts/f2rd", bus->dhd->rx_packets, | |
| 1994 | + brcmf_dump_pct(strbuf, "\nRx: pkts/f2rd", bus->drvr->rx_packets, | |
| 1592 | 1995 | (bus->f2rxhdrs + bus->f2rxdata)); |
| 1593 | − dhd_dump_pct(strbuf, ", pkts/f1sd", bus->dhd->rx_packets, | |
| 1996 | + brcmf_dump_pct(strbuf, ", pkts/f1sd", bus->drvr->rx_packets, | |
| 1594 | 1997 | bus->f1regdata); |
| 1595 | − dhd_dump_pct(strbuf, ", pkts/sd", bus->dhd->rx_packets, | |
| 1998 | + brcmf_dump_pct(strbuf, ", pkts/sd", bus->drvr->rx_packets, | |
| 1596 | 1999 | (bus->f2rxhdrs + bus->f2rxdata + bus->f1regdata)); |
| 1597 | − dhd_dump_pct(strbuf, ", pkts/int", bus->dhd->rx_packets, | |
| 2000 | + brcmf_dump_pct(strbuf, ", pkts/int", bus->drvr->rx_packets, | |
| 1598 | 2001 | bus->intrcount); |
| 1599 | − bcm_bprintf(strbuf, "\n"); | |
| 2002 | + brcmu_bprintf(strbuf, "\n"); | |
| 1600 | 2003 | |
| 1601 | − dhd_dump_pct(strbuf, "Rx: glom pct", (100 * bus->rxglompkts), | |
| 1602 | − bus->dhd->rx_packets); | |
| 1603 | − dhd_dump_pct(strbuf, ", pkts/glom", bus->rxglompkts, | |
| 2004 | + brcmf_dump_pct(strbuf, "Rx: glom pct", (100 * bus->rxglompkts), | |
| 2005 | + bus->drvr->rx_packets); | |
| 2006 | + brcmf_dump_pct(strbuf, ", pkts/glom", bus->rxglompkts, | |
| 1604 | 2007 | bus->rxglomframes); |
| 1605 | − bcm_bprintf(strbuf, "\n"); | |
| 2008 | + brcmu_bprintf(strbuf, "\n"); | |
| 1606 | 2009 | |
| 1607 | − dhd_dump_pct(strbuf, "Tx: pkts/f2wr", bus->dhd->tx_packets, | |
| 2010 | + brcmf_dump_pct(strbuf, "Tx: pkts/f2wr", bus->drvr->tx_packets, | |
| 1608 | 2011 | bus->f2txdata); |
| 1609 | − dhd_dump_pct(strbuf, ", pkts/f1sd", bus->dhd->tx_packets, | |
| 2012 | + brcmf_dump_pct(strbuf, ", pkts/f1sd", bus->drvr->tx_packets, | |
| 1610 | 2013 | bus->f1regdata); |
| 1611 | − dhd_dump_pct(strbuf, ", pkts/sd", bus->dhd->tx_packets, | |
| 2014 | + brcmf_dump_pct(strbuf, ", pkts/sd", bus->drvr->tx_packets, | |
| 1612 | 2015 | (bus->f2txdata + bus->f1regdata)); |
| 1613 | − dhd_dump_pct(strbuf, ", pkts/int", bus->dhd->tx_packets, | |
| 2016 | + brcmf_dump_pct(strbuf, ", pkts/int", bus->drvr->tx_packets, | |
| 1614 | 2017 | bus->intrcount); |
| 1615 | − bcm_bprintf(strbuf, "\n"); | |
| 2018 | + brcmu_bprintf(strbuf, "\n"); | |
| 1616 | 2019 | |
| 1617 | − dhd_dump_pct(strbuf, "Total: pkts/f2rw", | |
| 1618 | − (bus->dhd->tx_packets + bus->dhd->rx_packets), | |
| 2020 | + brcmf_dump_pct(strbuf, "Total: pkts/f2rw", | |
| 2021 | + (bus->drvr->tx_packets + bus->drvr->rx_packets), | |
| 1619 | 2022 | (bus->f2txdata + bus->f2rxhdrs + bus->f2rxdata)); |
| 1620 | − dhd_dump_pct(strbuf, ", pkts/f1sd", | |
| 1621 | − (bus->dhd->tx_packets + bus->dhd->rx_packets), | |
| 2023 | + brcmf_dump_pct(strbuf, ", pkts/f1sd", | |
| 2024 | + (bus->drvr->tx_packets + bus->drvr->rx_packets), | |
| 1622 | 2025 | bus->f1regdata); |
| 1623 | − dhd_dump_pct(strbuf, ", pkts/sd", | |
| 1624 | − (bus->dhd->tx_packets + bus->dhd->rx_packets), | |
| 2026 | + brcmf_dump_pct(strbuf, ", pkts/sd", | |
| 2027 | + (bus->drvr->tx_packets + bus->drvr->rx_packets), | |
| 1625 | 2028 | (bus->f2txdata + bus->f2rxhdrs + bus->f2rxdata + |
| 1626 | 2029 | bus->f1regdata)); |
| 1627 | − dhd_dump_pct(strbuf, ", pkts/int", | |
| 1628 | − (bus->dhd->tx_packets + bus->dhd->rx_packets), | |
| 2030 | + brcmf_dump_pct(strbuf, ", pkts/int", | |
| 2031 | + (bus->drvr->tx_packets + bus->drvr->rx_packets), | |
| 1629 | 2032 | bus->intrcount); |
| 1630 | − bcm_bprintf(strbuf, "\n\n"); | |
| 2033 | + brcmu_bprintf(strbuf, "\n\n"); | |
| 1631 | 2034 | } |
| 1632 | 2035 | |
| 1633 | 2036 | #ifdef SDTEST |
| 1634 | 2037 | if (bus->pktgen_count) { |
| 1635 | − bcm_bprintf(strbuf, "pktgen config and count:\n"); | |
| 1636 | − bcm_bprintf(strbuf, | |
| 2038 | + brcmu_bprintf(strbuf, "pktgen config and count:\n"); | |
| 2039 | + brcmu_bprintf(strbuf, | |
| 1637 | 2040 | "freq %d count %d print %d total %d min %d len %d\n", |
| 1638 | 2041 | bus->pktgen_freq, bus->pktgen_count, |
| 1639 | 2042 | bus->pktgen_print, bus->pktgen_total, |
| 1640 | 2043 | bus->pktgen_minlen, bus->pktgen_maxlen); |
| 1641 | − bcm_bprintf(strbuf, "send attempts %d rcvd %d fail %d\n", | |
| 2044 | + brcmu_bprintf(strbuf, "send attempts %d rcvd %d fail %d\n", | |
| 1642 | 2045 | bus->pktgen_sent, bus->pktgen_rcvd, |
| 1643 | 2046 | bus->pktgen_fail); |
| 1644 | 2047 | } |
| 1645 | 2048 | #endif /* SDTEST */ |
| 1646 | −#ifdef DHD_DEBUG | |
| 1647 | − bcm_bprintf(strbuf, "dpc_sched %d host interrupt%spending\n", | |
| 1648 | − bus->dpc_sched, | |
| 1649 | − (bcmsdh_intr_pending(bus->sdh) ? " " : " not ")); | |
| 1650 | − bcm_bprintf(strbuf, "blocksize %d roundup %d\n", bus->blocksize, | |
| 2049 | +#ifdef BCMDBG | |
| 2050 | + brcmu_bprintf(strbuf, "dpc_sched %d host interrupt%spending\n", | |
| 2051 | + bus->dpc_sched, " not "); | |
| 2052 | + brcmu_bprintf(strbuf, "blocksize %d roundup %d\n", bus->blocksize, | |
| 1651 | 2053 | bus->roundup); |
| 1652 | −#endif /* DHD_DEBUG */ | |
| 1653 | − bcm_bprintf(strbuf, | |
| 2054 | +#endif /* BCMDBG */ | |
| 2055 | + brcmu_bprintf(strbuf, | |
| 1654 | 2056 | "clkstate %d activity %d idletime %d idlecount %d sleeping %d\n", |
| 1655 | 2057 | bus->clkstate, bus->activity, bus->idletime, bus->idlecount, |
| 1656 | 2058 | bus->sleeping); |
| 1657 | 2059 | } |
| 1658 | 2060 | |
| 1659 | −void dhd_bus_clearcounts(dhd_pub_t *dhdp) | |
| 2061 | +void brcmf_bus_clearcounts(struct brcmf_pub *drvr) | |
| 1660 | 2062 | { |
| 1661 | − dhd_bus_t *bus = (dhd_bus_t *) dhdp->bus; | |
| 2063 | + struct brcmf_bus *bus = (struct brcmf_bus *) drvr->bus; | |
| 1662 | 2064 | |
| 1663 | 2065 | bus->intrcount = bus->lastintrs = bus->spurious = bus->regfails = 0; |
| 1664 | 2066 | bus->rxrtx = bus->rx_toolong = bus->rxc_errors = 0; |
| @@ -1669,11 +2071,11 @@ void dhd_bus_clearcounts(dhd_pub_t *dhdp) · 4 unmodified lines | ||
| 1669 | 2071 | } |
| 1670 | 2072 | |
| 1671 | 2073 | #ifdef SDTEST |
| 1672 | −static int dhdsdio_pktgen_get(dhd_bus_t *bus, u8 *arg) | |
| 2074 | +static int brcmf_sdbrcm_pktgen_get(struct brcmf_bus *bus, u8 *arg) | |
| 1673 | 2075 | { |
| 1674 | − dhd_pktgen_t pktgen; | |
| 2076 | + struct brcmf_pktgen pktgen; | |
| 1675 | 2077 | |
| 1676 | − pktgen.version = DHD_PKTGEN_VERSION; | |
| 2078 | + pktgen.version = BRCMF_PKTGEN_VERSION; | |
| 1677 | 2079 | pktgen.freq = bus->pktgen_freq; |
| 1678 | 2080 | pktgen.count = bus->pktgen_count; |
| 1679 | 2081 | pktgen.print = bus->pktgen_print; |
| @@ -1691,13 +2093,13 @@ static int dhdsdio_pktgen_get(dhd_bus_t *bus, u8 *arg) · 11 unmodified lines | ||
| 1691 | 2093 | return 0; |
| 1692 | 2094 | } |
| 1693 | 2095 | |
| 1694 | −static int dhdsdio_pktgen_set(dhd_bus_t *bus, u8 *arg) | |
| 2096 | +static int brcmf_sdbrcm_pktgen_set(struct brcmf_bus *bus, u8 *arg) | |
| 1695 | 2097 | { |
| 1696 | − dhd_pktgen_t pktgen; | |
| 2098 | + struct brcmf_pktgen pktgen; | |
| 1697 | 2099 | uint oldcnt, oldmode; |
| 1698 | 2100 | |
| 1699 | 2101 | memcpy(&pktgen, arg, sizeof(pktgen)); |
| 1700 | − if (pktgen.version != DHD_PKTGEN_VERSION) | |
| 2102 | + if (pktgen.version != BRCMF_PKTGEN_VERSION) | |
| 1701 | 2103 | return -EINVAL; |
| 1702 | 2104 | |
| 1703 | 2105 | oldcnt = bus->pktgen_count; |
| @@ -1725,7 +2127,7 @@ static int dhdsdio_pktgen_set(dhd_bus_t *bus, u8 *arg) · 21 unmodified lines | ||
| 1725 | 2127 | #endif /* SDTEST */ |
| 1726 | 2128 | |
| 1727 | 2129 | static int |
| 1728 | −dhdsdio_membytes(dhd_bus_t *bus, bool write, u32 address, u8 *data, | |
| 2130 | +brcmf_sdbrcm_membytes(struct brcmf_bus *bus, bool write, u32 address, u8 *data, | |
| 1729 | 2131 | uint size) |
| 1730 | 2132 | { |
| 1731 | 2133 | int bcmerror = 0; |
| @@ -1740,21 +2142,22 @@ dhdsdio_membytes(dhd_bus_t *bus, bool write, u32 address, u8 *data, · 8 unmodified lines | ||
| 1740 | 2142 | dsize = size; |
| 1741 | 2143 | |
| 1742 | 2144 | /* Set the backplane window to include the start address */ |
| 1743 | − bcmerror = dhdsdio_set_siaddr_window(bus, address); | |
| 2145 | + bcmerror = brcmf_sdbrcm_set_siaddr_window(bus, address); | |
| 1744 | 2146 | if (bcmerror) { |
| 1745 | − DHD_ERROR(("%s: window change failed\n", __func__)); | |
| 2147 | + BRCMF_ERROR(("%s: window change failed\n", __func__)); | |
| 1746 | 2148 | goto xfer_done; |
| 1747 | 2149 | } |
| 1748 | 2150 | |
| 1749 | 2151 | /* Do the transfer(s) */ |
| 1750 | 2152 | while (size) { |
| 1751 | − DHD_INFO(("%s: %s %d bytes at offset 0x%08x in window 0x%08x\n", | |
| 1752 | − __func__, (write ? "write" : "read"), dsize, | |
| 1753 | − sdaddr, (address & SBSDIO_SBWINDOW_MASK))); | |
| 2153 | + BRCMF_INFO(("%s: %s %d bytes at offset 0x%08x in window" | |
| 2154 | + " 0x%08x\n", __func__, (write ? "write" : "read"), | |
| 2155 | + dsize, sdaddr, (address & SBSDIO_SBWINDOW_MASK))); | |
| 1754 | 2156 | bcmerror = |
| 1755 | − bcmsdh_rwdata(bus->sdh, write, sdaddr, data, dsize); | |
| 2157 | + brcmf_sdcard_rwdata(bus->card, write, sdaddr, data, dsize); | |
| 1756 | 2158 | if (bcmerror) { |
| 1757 | − DHD_ERROR(("%s: membytes transfer failed\n", __func__)); | |
| 2159 | + BRCMF_ERROR(("%s: membytes transfer failed\n", | |
| 2160 | + __func__)); | |
| 1758 | 2161 | break; |
| 1759 | 2162 | } |
| 1760 | 2163 | |
| @@ -1763,10 +2166,10 @@ dhdsdio_membytes(dhd_bus_t *bus, bool write, u32 address, u8 *data, · 2 unmodified lines | ||
| 1763 | 2166 | if (size) { |
| 1764 | 2167 | data += dsize; |
| 1765 | 2168 | address += dsize; |
| 1766 | − bcmerror = dhdsdio_set_siaddr_window(bus, address); | |
| 2169 | + bcmerror = brcmf_sdbrcm_set_siaddr_window(bus, address); | |
| 1767 | 2170 | if (bcmerror) { |
| 1768 | − DHD_ERROR(("%s: window change failed\n", | |
| 1769 | − __func__)); | |
| 2171 | + BRCMF_ERROR(("%s: window change failed\n", | |
| 2172 | + __func__)); | |
| 1770 | 2173 | break; |
| 1771 | 2174 | } |
| 1772 | 2175 | sdaddr = 0; |
| @@ -1776,43 +2179,45 @@ dhdsdio_membytes(dhd_bus_t *bus, bool write, u32 address, u8 *data, · 3 unmodified lines | ||
| 1776 | 2179 | |
| 1777 | 2180 | xfer_done: |
| 1778 | 2181 | /* Return the window to backplane enumeration space for core access */ |
| 1779 | − if (dhdsdio_set_siaddr_window(bus, bcmsdh_cur_sbwad(bus->sdh))) { | |
| 1780 | − DHD_ERROR(("%s: FAILED to set window back to 0x%x\n", | |
| 1781 | − __func__, bcmsdh_cur_sbwad(bus->sdh))); | |
| 2182 | + if (brcmf_sdbrcm_set_siaddr_window(bus, | |
| 2183 | + brcmf_sdcard_cur_sbwad(bus->card))) { | |
| 2184 | + BRCMF_ERROR(("%s: FAILED to set window back to 0x%x\n", | |
| 2185 | + __func__, brcmf_sdcard_cur_sbwad(bus->card))); | |
| 1782 | 2186 | } |
| 1783 | 2187 | |
| 1784 | 2188 | return bcmerror; |
| 1785 | 2189 | } |
| 1786 | 2190 | |
| 1787 | −#ifdef DHD_DEBUG | |
| 1788 | −static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh) | |
| 2191 | +#ifdef BCMDBG | |
| 2192 | +static int brcmf_sdbrcm_readshared(struct brcmf_bus *bus, struct sdpcm_shared *sh) | |
| 1789 | 2193 | { |
| 1790 | 2194 | u32 addr; |
| 1791 | 2195 | int rv; |
| 1792 | 2196 | |
| 1793 | 2197 | /* Read last word in memory to determine address of |
| 1794 | 2198 | sdpcm_shared structure */ |
| 1795 | − rv = dhdsdio_membytes(bus, false, bus->ramsize - 4, (u8 *)&addr, 4); | |
| 2199 | + rv = brcmf_sdbrcm_membytes(bus, false, bus->ramsize - 4, (u8 *)&addr, | |
| 2200 | + 4); | |
| 1796 | 2201 | if (rv < 0) |
| 1797 | 2202 | return rv; |
| 1798 | 2203 | |
| 1799 | 2204 | addr = le32_to_cpu(addr); |
| 1800 | 2205 | |
| 1801 | − DHD_INFO(("sdpcm_shared address 0x%08X\n", addr)); | |
| 2206 | + BRCMF_INFO(("sdpcm_shared address 0x%08X\n", addr)); | |
| 1802 | 2207 | |
| 1803 | 2208 | /* |
| 1804 | 2209 | * Check if addr is valid. |
| 1805 | 2210 | * NVRAM length at the end of memory should have been overwritten. |
| 1806 | 2211 | */ |
| 1807 | 2212 | if (addr == 0 || ((~addr >> 16) & 0xffff) == (addr & 0xffff)) { |
| 1808 | − DHD_ERROR(("%s: address (0x%08x) of sdpcm_shared invalid\n", | |
| 1809 | − __func__, addr)); | |
| 2213 | + BRCMF_ERROR(("%s: address (0x%08x) of sdpcm_shared invalid\n", | |
| 2214 | + __func__, addr)); | |
| 1810 | 2215 | return -EBADE; |
| 1811 | 2216 | } |
| 1812 | 2217 | |
| 1813 | − /* Read hndrte_shared structure */ | |
| 1814 | − rv = dhdsdio_membytes(bus, false, addr, (u8 *) sh, | |
| 1815 | − sizeof(sdpcm_shared_t)); | |
| 2218 | + /* Read rte_shared structure */ | |
| 2219 | + rv = brcmf_sdbrcm_membytes(bus, false, addr, (u8 *) sh, | |
| 2220 | + sizeof(struct sdpcm_shared)); | |
| 1816 | 2221 | if (rv < 0) |
| 1817 | 2222 | return rv; |
| 1818 | 2223 | |
| @@ -1826,28 +2231,28 @@ static int dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh) · 7 unmodified lines | ||
| 1826 | 2231 | sh->msgtrace_addr = le32_to_cpu(sh->msgtrace_addr); |
| 1827 | 2232 | |
| 1828 | 2233 | if ((sh->flags & SDPCM_SHARED_VERSION_MASK) != SDPCM_SHARED_VERSION) { |
| 1829 | − DHD_ERROR(("%s: sdpcm_shared version %d in dhd " | |
| 1830 | − "is different than sdpcm_shared version %d in dongle\n", | |
| 1831 | − __func__, SDPCM_SHARED_VERSION, | |
| 1832 | − sh->flags & SDPCM_SHARED_VERSION_MASK)); | |
| 2234 | + BRCMF_ERROR(("%s: sdpcm_shared version %d in brcmf " | |
| 2235 | + "is different than sdpcm_shared version %d in dongle\n", | |
| 2236 | + __func__, SDPCM_SHARED_VERSION, | |
| 2237 | + sh->flags & SDPCM_SHARED_VERSION_MASK)); | |
| 1833 | 2238 | return -EBADE; |
| 1834 | 2239 | } |
| 1835 | 2240 | |
| 1836 | 2241 | return 0; |
| 1837 | 2242 | } |
| 1838 | 2243 | |
| 1839 | −static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) | |
| 2244 | +static int brcmf_sdbrcm_checkdied(struct brcmf_bus *bus, u8 *data, uint size) | |
| 1840 | 2245 | { |
| 1841 | 2246 | int bcmerror = 0; |
| 1842 | 2247 | uint msize = 512; |
| 1843 | 2248 | char *mbuffer = NULL; |
| 1844 | 2249 | uint maxstrlen = 256; |
| 1845 | 2250 | char *str = NULL; |
| 1846 | − trap_t tr; | |
| 1847 | − sdpcm_shared_t sdpcm_shared; | |
| 1848 | − struct bcmstrbuf strbuf; | |
| 2251 | + struct brcmf_trap tr; | |
| 2252 | + struct sdpcm_shared sdpcm_shared; | |
| 2253 | + struct brcmu_strbuf strbuf; | |
| 1849 | 2254 | |
| 1850 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 2255 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 1851 | 2256 | |
| 1852 | 2257 | if (data == NULL) { |
| 1853 | 2258 | /* |
| @@ -1857,8 +2262,8 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) · 3 unmodified lines | ||
| 1857 | 2262 | size = msize; |
| 1858 | 2263 | mbuffer = data = kmalloc(msize, GFP_ATOMIC); |
| 1859 | 2264 | if (mbuffer == NULL) { |
| 1860 | − DHD_ERROR(("%s: kmalloc(%d) failed\n", __func__, | |
| 1861 | − msize)); | |
| 2265 | + BRCMF_ERROR(("%s: kmalloc(%d) failed\n", __func__, | |
| 2266 | + msize)); | |
| 1862 | 2267 | bcmerror = -ENOMEM; |
| 1863 | 2268 | goto done; |
| 1864 | 2269 | } |
| @@ -1866,18 +2271,18 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) · 1 unmodified line | ||
| 1866 | 2271 | |
| 1867 | 2272 | str = kmalloc(maxstrlen, GFP_ATOMIC); |
| 1868 | 2273 | if (str == NULL) { |
| 1869 | − DHD_ERROR(("%s: kmalloc(%d) failed\n", __func__, maxstrlen)); | |
| 2274 | + BRCMF_ERROR(("%s: kmalloc(%d) failed\n", __func__, maxstrlen)); | |
| 1870 | 2275 | bcmerror = -ENOMEM; |
| 1871 | 2276 | goto done; |
| 1872 | 2277 | } |
| 1873 | 2278 | |
| 1874 | − bcmerror = dhdsdio_readshared(bus, &sdpcm_shared); | |
| 2279 | + bcmerror = brcmf_sdbrcm_readshared(bus, &sdpcm_shared); | |
| 1875 | 2280 | if (bcmerror < 0) |
| 1876 | 2281 | goto done; |
| 1877 | 2282 | |
| 1878 | − bcm_binit(&strbuf, data, size); | |
| 2283 | + brcmu_binit(&strbuf, data, size); | |
| 1879 | 2284 | |
| 1880 | − bcm_bprintf(&strbuf, | |
| 2285 | + brcmu_bprintf(&strbuf, | |
| 1881 | 2286 | "msgtrace address : 0x%08X\nconsole address : 0x%08X\n", |
| 1882 | 2287 | sdpcm_shared.msgtrace_addr, sdpcm_shared.console_addr); |
| 1883 | 2288 | |
| @@ -1886,7 +2291,7 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) · 2 unmodified lines | ||
| 1886 | 2291 | * (Avoids conflict with real asserts for programmatic |
| 1887 | 2292 | * parsing of output.) |
| 1888 | 2293 | */ |
| 1889 | − bcm_bprintf(&strbuf, "Assrt not built in dongle\n"); | |
| 2294 | + brcmu_bprintf(&strbuf, "Assrt not built in dongle\n"); | |
| 1890 | 2295 | } |
| 1891 | 2296 | |
| 1892 | 2297 | if ((sdpcm_shared.flags & (SDPCM_SHARED_ASSERT | SDPCM_SHARED_TRAP)) == |
| @@ -1895,49 +2300,49 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) · 2 unmodified lines | ||
| 1895 | 2300 | * (Avoids conflict with real asserts for programmatic |
| 1896 | 2301 | * parsing of output.) |
| 1897 | 2302 | */ |
| 1898 | − bcm_bprintf(&strbuf, "No trap%s in dongle", | |
| 2303 | + brcmu_bprintf(&strbuf, "No trap%s in dongle", | |
| 1899 | 2304 | (sdpcm_shared.flags & SDPCM_SHARED_ASSERT_BUILT) |
| 1900 | 2305 | ? "/assrt" : ""); |
| 1901 | 2306 | } else { |
| 1902 | 2307 | if (sdpcm_shared.flags & SDPCM_SHARED_ASSERT) { |
| 1903 | 2308 | /* Download assert */ |
| 1904 | − bcm_bprintf(&strbuf, "Dongle assert"); | |
| 2309 | + brcmu_bprintf(&strbuf, "Dongle assert"); | |
| 1905 | 2310 | if (sdpcm_shared.assert_exp_addr != 0) { |
| 1906 | 2311 | str[0] = '\0'; |
| 1907 | − bcmerror = dhdsdio_membytes(bus, false, | |
| 2312 | + bcmerror = brcmf_sdbrcm_membytes(bus, false, | |
| 1908 | 2313 | sdpcm_shared.assert_exp_addr, |
| 1909 | 2314 | (u8 *) str, maxstrlen); |
| 1910 | 2315 | if (bcmerror < 0) |
| 1911 | 2316 | goto done; |
| 1912 | 2317 | |
| 1913 | 2318 | str[maxstrlen - 1] = '\0'; |
| 1914 | − bcm_bprintf(&strbuf, " expr \"%s\"", str); | |
| 2319 | + brcmu_bprintf(&strbuf, " expr \"%s\"", str); | |
| 1915 | 2320 | } |
| 1916 | 2321 | |
| 1917 | 2322 | if (sdpcm_shared.assert_file_addr != 0) { |
| 1918 | 2323 | str[0] = '\0'; |
| 1919 | − bcmerror = dhdsdio_membytes(bus, false, | |
| 2324 | + bcmerror = brcmf_sdbrcm_membytes(bus, false, | |
| 1920 | 2325 | sdpcm_shared.assert_file_addr, |
| 1921 | 2326 | (u8 *) str, maxstrlen); |
| 1922 | 2327 | if (bcmerror < 0) |
| 1923 | 2328 | goto done; |
| 1924 | 2329 | |
| 1925 | 2330 | str[maxstrlen - 1] = '\0'; |
| 1926 | − bcm_bprintf(&strbuf, " file \"%s\"", str); | |
| 2331 | + brcmu_bprintf(&strbuf, " file \"%s\"", str); | |
| 1927 | 2332 | } |
| 1928 | 2333 | |
| 1929 | − bcm_bprintf(&strbuf, " line %d ", | |
| 2334 | + brcmu_bprintf(&strbuf, " line %d ", | |
| 1930 | 2335 | sdpcm_shared.assert_line); |
| 1931 | 2336 | } |
| 1932 | 2337 | |
| 1933 | 2338 | if (sdpcm_shared.flags & SDPCM_SHARED_TRAP) { |
| 1934 | − bcmerror = dhdsdio_membytes(bus, false, | |
| 2339 | + bcmerror = brcmf_sdbrcm_membytes(bus, false, | |
| 1935 | 2340 | sdpcm_shared.trap_addr, (u8 *)&tr, |
| 1936 | − sizeof(trap_t)); | |
| 2341 | + sizeof(struct brcmf_trap)); | |
| 1937 | 2342 | if (bcmerror < 0) |
| 1938 | 2343 | goto done; |
| 1939 | 2344 | |
| 1940 | − bcm_bprintf(&strbuf, | |
| 2345 | + brcmu_bprintf(&strbuf, | |
| 1941 | 2346 | "Dongle trap type 0x%x @ epc 0x%x, cpsr 0x%x, spsr 0x%x, sp 0x%x," |
| 1942 | 2347 | "lp 0x%x, rpc 0x%x Trap offset 0x%x, " |
| 1943 | 2348 | "r0 0x%x, r1 0x%x, r2 0x%x, r3 0x%x, r4 0x%x, r5 0x%x, r6 0x%x, r7 0x%x\n", |
| @@ -1949,14 +2354,14 @@ static int dhdsdio_checkdied(dhd_bus_t *bus, u8 *data, uint size) · 5 unmodified lines | ||
| 1949 | 2354 | } |
| 1950 | 2355 | |
| 1951 | 2356 | if (sdpcm_shared.flags & (SDPCM_SHARED_ASSERT | SDPCM_SHARED_TRAP)) |
| 1952 | − DHD_ERROR(("%s: %s\n", __func__, strbuf.origbuf)); | |
| 2357 | + BRCMF_ERROR(("%s: %s\n", __func__, strbuf.origbuf)); | |
| 1953 | 2358 | |
| 1954 | −#ifdef DHD_DEBUG | |
| 2359 | +#ifdef BCMDBG | |
| 1955 | 2360 | if (sdpcm_shared.flags & SDPCM_SHARED_TRAP) { |
| 1956 | 2361 | /* Mem dump to a file on device */ |
| 1957 | − dhdsdio_mem_dump(bus); | |
| 2362 | + brcmf_sdbrcm_mem_dump(bus); | |
| 1958 | 2363 | } |
| 1959 | −#endif /* DHD_DEBUG */ | |
| 2364 | +#endif /* BCMDBG */ | |
| 1960 | 2365 | |
| 1961 | 2366 | done: |
| 1962 | 2367 | kfree(mbuffer); |
| @@ -1965,7 +2370,7 @@ done: · 2 unmodified lines | ||
| 1965 | 2370 | return bcmerror; |
| 1966 | 2371 | } |
| 1967 | 2372 | |
| 1968 | −static int dhdsdio_mem_dump(dhd_bus_t *bus) | |
| 2373 | +static int brcmf_sdbrcm_mem_dump(struct brcmf_bus *bus) | |
| 1969 | 2374 | { |
| 1970 | 2375 | int ret = 0; |
| 1971 | 2376 | int size; /* Full mem size */ |
| @@ -1977,7 +2382,7 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus) · 5 unmodified lines | ||
| 1977 | 2382 | size = bus->ramsize; |
| 1978 | 2383 | buf = kmalloc(size, GFP_ATOMIC); |
| 1979 | 2384 | if (!buf) { |
| 1980 | − DHD_ERROR(("%s: Out of memory (%d bytes)\n", __func__, size)); | |
| 2385 | + BRCMF_ERROR(("%s: Out of memory (%d bytes)\n", __func__, size)); | |
| 1981 | 2386 | return -1; |
| 1982 | 2387 | } |
| 1983 | 2388 | |
| @@ -1986,9 +2391,10 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus) · 2 unmodified lines | ||
| 1986 | 2391 | databuf = buf; |
| 1987 | 2392 | while (size) { |
| 1988 | 2393 | read_size = min(MEMBLOCK, size); |
| 1989 | − ret = dhdsdio_membytes(bus, false, start, databuf, read_size); | |
| 2394 | + ret = brcmf_sdbrcm_membytes(bus, false, start, databuf, | |
| 2395 | + read_size); | |
| 1990 | 2396 | if (ret) { |
| 1991 | − DHD_ERROR(("%s: Error membytes %d\n", __func__, ret)); | |
| 2397 | + BRCMF_ERROR(("%s: Error membytes %d\n", __func__, ret)); | |
| 1992 | 2398 | kfree(buf); |
| 1993 | 2399 | return -1; |
| 1994 | 2400 | } |
| @@ -2002,20 +2408,20 @@ static int dhdsdio_mem_dump(dhd_bus_t *bus) · 7 unmodified lines | ||
| 2002 | 2408 | printk(KERN_DEBUG "Done\n"); |
| 2003 | 2409 | |
| 2004 | 2410 | /* free buf before return !!! */ |
| 2005 | − if (write_to_file(bus->dhd, buf, bus->ramsize)) { | |
| 2006 | − DHD_ERROR(("%s: Error writing to files\n", __func__)); | |
| 2411 | + if (brcmf_write_to_file(bus->drvr, buf, bus->ramsize)) { | |
| 2412 | + BRCMF_ERROR(("%s: Error writing to files\n", __func__)); | |
| 2007 | 2413 | return -1; |
| 2008 | 2414 | } |
| 2009 | 2415 | |
| 2010 | − /* buf free handled in write_to_file, not here */ | |
| 2416 | + /* buf free handled in brcmf_write_to_file, not here */ | |
| 2011 | 2417 | return 0; |
| 2012 | 2418 | } |
| 2013 | 2419 | |
| 2014 | 2420 | #define CONSOLE_LINE_MAX 192 |
| 2015 | 2421 | |
| 2016 | −static int dhdsdio_readconsole(dhd_bus_t *bus) | |
| 2422 | +static int brcmf_sdbrcm_readconsole(struct brcmf_bus *bus) | |
| 2017 | 2423 | { |
| 2018 | − dhd_console_t *c = &bus->console; | |
| 2424 | + struct brcmf_console *c = &bus->console; | |
| 2019 | 2425 | u8 line[CONSOLE_LINE_MAX], ch; |
| 2020 | 2426 | u32 n, idx, addr; |
| 2021 | 2427 | int rv; |
| @@ -2025,8 +2431,8 @@ static int dhdsdio_readconsole(dhd_bus_t *bus) · 3 unmodified lines | ||
| 2025 | 2431 | return 0; |
| 2026 | 2432 | |
| 2027 | 2433 | /* Read console log struct */ |
| 2028 | − addr = bus->console_addr + offsetof(hndrte_cons_t, log); | |
| 2029 | − rv = dhdsdio_membytes(bus, false, addr, (u8 *)&c->log, | |
| 2434 | + addr = bus->console_addr + offsetof(struct rte_console, log); | |
| 2435 | + rv = brcmf_sdbrcm_membytes(bus, false, addr, (u8 *)&c->log, | |
| 2030 | 2436 | sizeof(c->log)); |
| 2031 | 2437 | if (rv < 0) |
| 2032 | 2438 | return rv; |
| @@ -2052,7 +2458,7 @@ static int dhdsdio_readconsole(dhd_bus_t *bus) · 19 unmodified lines | ||
| 2052 | 2458 | |
| 2053 | 2459 | /* Read the console buffer */ |
| 2054 | 2460 | addr = le32_to_cpu(c->log.buf); |
| 2055 | − rv = dhdsdio_membytes(bus, false, addr, c->buf, c->bufsize); | |
| 2461 | + rv = brcmf_sdbrcm_membytes(bus, false, addr, c->buf, c->bufsize); | |
| 2056 | 2462 | if (rv < 0) |
| 2057 | 2463 | return rv; |
| 2058 | 2464 | |
| @@ -2088,16 +2494,16 @@ break2: · 29 unmodified lines | ||
| 2088 | 2494 | |
| 2089 | 2495 | return 0; |
| 2090 | 2496 | } |
| 2091 | −#endif /* DHD_DEBUG */ | |
| 2497 | +#endif /* BCMDBG */ | |
| 2092 | 2498 | |
| 2093 | −int dhdsdio_downloadvars(dhd_bus_t *bus, void *arg, int len) | |
| 2499 | +int brcmf_sdbrcm_downloadvars(struct brcmf_bus *bus, void *arg, int len) | |
| 2094 | 2500 | { |
| 2095 | 2501 | int bcmerror = 0; |
| 2096 | 2502 | |
| 2097 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 2503 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 2098 | 2504 | |
| 2099 | 2505 | /* Basic sanity checks */ |
| 2100 | − if (bus->dhd->up) { | |
| 2506 | + if (bus->drvr->up) { | |
| 2101 | 2507 | bcmerror = -EISCONN; |
| 2102 | 2508 | goto err; |
| 2103 | 2509 | } |
| @@ -2124,7 +2530,7 @@ err: · 20 unmodified lines | ||
| 2124 | 2530 | } |
| 2125 | 2531 | |
| 2126 | 2532 | static int |
| 2127 | −dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, | |
| 2533 | +brcmf_sdbrcm_doiovar(struct brcmf_bus *bus, const struct brcmu_iovar *vi, u32 actionid, | |
| 2128 | 2534 | const char *name, void *params, int plen, void *arg, int len, |
| 2129 | 2535 | int val_size) |
| 2130 | 2536 | { |
| @@ -2132,11 +2538,11 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 1 unmodified line | ||
| 2132 | 2538 | s32 int_val = 0; |
| 2133 | 2539 | bool bool_val = 0; |
| 2134 | 2540 | |
| 2135 | − DHD_TRACE(("%s: Enter, action %d name %s params %p plen %d arg %p " | |
| 2136 | − "len %d val_size %d\n", | |
| 2137 | − __func__, actionid, name, params, plen, arg, len, val_size)); | |
| 2541 | + BRCMF_TRACE(("%s: Enter, action %d name %s params %p plen %d arg %p " | |
| 2542 | + "len %d val_size %d\n", __func__, actionid, name, params, | |
| 2543 | + plen, arg, len, val_size)); | |
| 2138 | 2544 | |
| 2139 | − bcmerror = bcm_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid)); | |
| 2545 | + bcmerror = brcmu_iovar_lencheck(vi, arg, len, IOV_ISSET(actionid)); | |
| 2140 | 2546 | if (bcmerror != 0) |
| 2141 | 2547 | goto exit; |
| 2142 | 2548 | |
| @@ -2146,10 +2552,10 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 3 unmodified lines | ||
| 2146 | 2552 | bool_val = (int_val != 0) ? true : false; |
| 2147 | 2553 | |
| 2148 | 2554 | /* Some ioctls use the bus */ |
| 2149 | − dhd_os_sdlock(bus->dhd); | |
| 2555 | + brcmf_sdbrcm_sdlock(bus); | |
| 2150 | 2556 | |
| 2151 | 2557 | /* Check if dongle is in reset. If so, only allow DEVRESET iovars */ |
| 2152 | − if (bus->dhd->dongle_reset && !(actionid == IOV_SVAL(IOV_DEVRESET) || | |
| 2558 | + if (bus->drvr->dongle_reset && !(actionid == IOV_SVAL(IOV_DEVRESET) || | |
| 2153 | 2559 | actionid == IOV_GVAL(IOV_DEVRESET))) { |
| 2154 | 2560 | bcmerror = -EPERM; |
| 2155 | 2561 | goto exit; |
| @@ -2158,7 +2564,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines | ||
| 2158 | 2564 | /* Handle sleep stuff before any clock mucking */ |
| 2159 | 2565 | if (vi->varid == IOV_SLEEP) { |
| 2160 | 2566 | if (IOV_ISSET(actionid)) { |
| 2161 | − bcmerror = dhdsdio_bussleep(bus, bool_val); | |
| 2567 | + bcmerror = brcmf_sdbrcm_bussleep(bus, bool_val); | |
| 2162 | 2568 | } else { |
| 2163 | 2569 | int_val = (s32) bus->sleeping; |
| 2164 | 2570 | memcpy(arg, &int_val, val_size); |
| @@ -2167,9 +2573,9 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines | ||
| 2167 | 2573 | } |
| 2168 | 2574 | |
| 2169 | 2575 | /* Request clock to allow SDIO accesses */ |
| 2170 | − if (!bus->dhd->dongle_reset) { | |
| 2576 | + if (!bus->drvr->dongle_reset) { | |
| 2171 | 2577 | BUS_WAKE(bus); |
| 2172 | − dhdsdio_clkctl(bus, CLK_AVAIL, false); | |
| 2578 | + brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); | |
| 2173 | 2579 | } |
| 2174 | 2580 | |
| 2175 | 2581 | switch (actionid) { |
| @@ -2181,15 +2587,13 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 5 unmodified lines | ||
| 2181 | 2587 | case IOV_SVAL(IOV_INTR): |
| 2182 | 2588 | bus->intr = bool_val; |
| 2183 | 2589 | bus->intdis = false; |
| 2184 | − if (bus->dhd->up) { | |
| 2590 | + if (bus->drvr->up) { | |
| 2591 | + BRCMF_INTR(("%s: %s SDIO interrupts\n", __func__, | |
| 2592 | + bus->intr ? "enable" : "disable")); | |
| 2185 | 2593 | if (bus->intr) { |
| 2186 | − DHD_INTR(("%s: enable SDIO device interrupts\n", | |
| 2187 | − __func__)); | |
| 2188 | − bcmsdh_intr_enable(bus->sdh); | |
| 2594 | + brcmf_sdcard_intr_enable(bus->card); | |
| 2189 | 2595 | } else { |
| 2190 | − DHD_INTR(("%s: disable SDIO interrupts\n", | |
| 2191 | − __func__)); | |
| 2192 | − bcmsdh_intr_disable(bus->sdh); | |
| 2596 | + brcmf_sdcard_intr_disable(bus->card); | |
| 2193 | 2597 | } |
| 2194 | 2598 | } |
| 2195 | 2599 | break; |
| @@ -2210,7 +2614,7 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 14 unmodified lines | ||
| 2210 | 2614 | break; |
| 2211 | 2615 | |
| 2212 | 2616 | case IOV_SVAL(IOV_IDLETIME): |
| 2213 | − if ((int_val < 0) && (int_val != DHD_IDLE_IMMEDIATE)) | |
| 2617 | + if ((int_val < 0) && (int_val != BRCMF_IDLE_IMMEDIATE)) | |
| 2214 | 2618 | bcmerror = -EINVAL; |
| 2215 | 2619 | else |
| 2216 | 2620 | bus->idletime = int_val; |
| @@ -2243,8 +2647,6 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 26 unmodified lines | ||
| 2243 | 2647 | |
| 2244 | 2648 | bool set = (actionid == IOV_SVAL(IOV_MEMBYTES)); |
| 2245 | 2649 | |
| 2246 | − ASSERT(plen >= 2 * sizeof(int)); | |
| 2247 | − | |
| 2248 | 2650 | address = (u32) int_val; |
| 2249 | 2651 | memcpy(&int_val, (char *)params + sizeof(int_val), |
| 2250 | 2652 | sizeof(int_val)); |
| @@ -2253,25 +2655,25 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines | ||
| 2253 | 2655 | /* Do some validation */ |
| 2254 | 2656 | dsize = set ? plen - (2 * sizeof(int)) : len; |
| 2255 | 2657 | if (dsize < size) { |
| 2256 | − DHD_ERROR(("%s: error on %s membytes, addr " | |
| 2257 | − "0x%08x size %d dsize %d\n", | |
| 2258 | − __func__, (set ? "set" : "get"), | |
| 2259 | − address, size, dsize)); | |
| 2658 | + BRCMF_ERROR(("%s: error on %s membytes, addr " | |
| 2659 | + "0x%08x size %d dsize %d\n", | |
| 2660 | + __func__, (set ? "set" : "get"), | |
| 2661 | + address, size, dsize)); | |
| 2260 | 2662 | bcmerror = -EINVAL; |
| 2261 | 2663 | break; |
| 2262 | 2664 | } |
| 2263 | 2665 | |
| 2264 | − DHD_INFO(("%s: Request to %s %d bytes at address " | |
| 2265 | − "0x%08x\n", | |
| 2266 | − __func__, (set ? "write" : "read"), size, address)); | |
| 2666 | + BRCMF_INFO(("%s: Request to %s %d bytes at address " | |
| 2667 | + "0x%08x\n", __func__, | |
| 2668 | + (set ? "write" : "read"), size, address)); | |
| 2267 | 2669 | |
| 2268 | 2670 | /* If we know about SOCRAM, check for a fit */ |
| 2269 | 2671 | if ((bus->orig_ramsize) && |
| 2270 | 2672 | ((address > bus->orig_ramsize) |
| 2271 | 2673 | || (address + size > bus->orig_ramsize))) { |
| 2272 | − DHD_ERROR(("%s: ramsize 0x%08x doesn't have %d " | |
| 2273 | − "bytes at 0x%08x\n", | |
| 2274 | − __func__, bus->orig_ramsize, size, address)); | |
| 2674 | + BRCMF_ERROR(("%s: ramsize 0x%08x doesn't have" | |
| 2675 | + " %d bytes at 0x%08x\n", __func__, | |
| 2676 | + bus->orig_ramsize, size, address)); | |
| 2275 | 2677 | bcmerror = -EINVAL; |
| 2276 | 2678 | break; |
| 2277 | 2679 | } |
| @@ -2282,8 +2684,8 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 4 unmodified lines | ||
| 2282 | 2684 | 2 * sizeof(int) : (u8 *) arg; |
| 2283 | 2685 | |
| 2284 | 2686 | /* Call to do the transfer */ |
| 2285 | − bcmerror = | |
| 2286 | − dhdsdio_membytes(bus, set, address, data, size); | |
| 2687 | + bcmerror = brcmf_sdbrcm_membytes(bus, set, address, | |
| 2688 | + data, size); | |
| 2287 | 2689 | |
| 2288 | 2690 | break; |
| 2289 | 2691 | } |
| @@ -2294,33 +2696,33 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 4 unmodified lines | ||
| 2294 | 2696 | break; |
| 2295 | 2697 | |
| 2296 | 2698 | case IOV_GVAL(IOV_SDIOD_DRIVE): |
| 2297 | − int_val = (s32) dhd_sdiod_drive_strength; | |
| 2699 | + int_val = (s32) brcmf_sdiod_drive_strength; | |
| 2298 | 2700 | memcpy(arg, &int_val, val_size); |
| 2299 | 2701 | break; |
| 2300 | 2702 | |
| 2301 | 2703 | case IOV_SVAL(IOV_SDIOD_DRIVE): |
| 2302 | − dhd_sdiod_drive_strength = int_val; | |
| 2303 | − dhdsdio_sdiod_drive_strength_init(bus, | |
| 2304 | − dhd_sdiod_drive_strength); | |
| 2704 | + brcmf_sdiod_drive_strength = int_val; | |
| 2705 | + brcmf_sdbrcm_sdiod_drive_strength_init(bus, | |
| 2706 | + brcmf_sdiod_drive_strength); | |
| 2305 | 2707 | break; |
| 2306 | 2708 | |
| 2307 | 2709 | case IOV_SVAL(IOV_DOWNLOAD): |
| 2308 | − bcmerror = dhdsdio_download_state(bus, bool_val); | |
| 2710 | + bcmerror = brcmf_sdbrcm_download_state(bus, bool_val); | |
| 2309 | 2711 | break; |
| 2310 | 2712 | |
| 2311 | 2713 | case IOV_SVAL(IOV_VARS): |
| 2312 | − bcmerror = dhdsdio_downloadvars(bus, arg, len); | |
| 2714 | + bcmerror = brcmf_sdbrcm_downloadvars(bus, arg, len); | |
| 2313 | 2715 | break; |
| 2314 | 2716 | |
| 2315 | 2717 | case IOV_GVAL(IOV_READAHEAD): |
| 2316 | − int_val = (s32) dhd_readahead; | |
| 2718 | + int_val = (s32) brcmf_readahead; | |
| 2317 | 2719 | memcpy(arg, &int_val, val_size); |
| 2318 | 2720 | break; |
| 2319 | 2721 | |
| 2320 | 2722 | case IOV_SVAL(IOV_READAHEAD): |
| 2321 | − if (bool_val && !dhd_readahead) | |
| 2723 | + if (bool_val && !brcmf_readahead) | |
| 2322 | 2724 | bus->nextlen = 0; |
| 2323 | − dhd_readahead = bool_val; | |
| 2725 | + brcmf_readahead = bool_val; | |
| 2324 | 2726 | break; |
| 2325 | 2727 | |
| 2326 | 2728 | case IOV_GVAL(IOV_SDRXCHAIN): |
| @@ -2335,40 +2737,56 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 8 unmodified lines | ||
| 2335 | 2737 | bus->use_rxchain = bool_val; |
| 2336 | 2738 | break; |
| 2337 | 2739 | case IOV_GVAL(IOV_ALIGNCTL): |
| 2338 | − int_val = (s32) dhd_alignctl; | |
| 2740 | + int_val = (s32) brcmf_alignctl; | |
| 2339 | 2741 | memcpy(arg, &int_val, val_size); |
| 2340 | 2742 | break; |
| 2341 | 2743 | |
| 2342 | 2744 | case IOV_SVAL(IOV_ALIGNCTL): |
| 2343 | − dhd_alignctl = bool_val; | |
| 2745 | + brcmf_alignctl = bool_val; | |
| 2344 | 2746 | break; |
| 2345 | 2747 | |
| 2346 | 2748 | case IOV_GVAL(IOV_SDALIGN): |
| 2347 | − int_val = DHD_SDALIGN; | |
| 2749 | + int_val = BRCMF_SDALIGN; | |
| 2348 | 2750 | memcpy(arg, &int_val, val_size); |
| 2349 | 2751 | break; |
| 2350 | 2752 | |
| 2351 | −#ifdef DHD_DEBUG | |
| 2753 | +#ifdef BCMDBG | |
| 2352 | 2754 | case IOV_GVAL(IOV_VARS): |
| 2353 | 2755 | if (bus->varsz < (uint) len) |
| 2354 | 2756 | memcpy(arg, bus->vars, bus->varsz); |
| 2355 | 2757 | else |
| 2356 | 2758 | bcmerror = -EOVERFLOW; |
| 2357 | 2759 | break; |
| 2358 | −#endif /* DHD_DEBUG */ | |
| 2760 | +#endif /* BCMDBG */ | |
| 2761 | + | |
| 2762 | +#ifdef BCMDBG | |
| 2763 | + case IOV_GVAL(IOV_DCONSOLE_POLL): | |
| 2764 | + int_val = (s32) brcmf_console_ms; | |
| 2765 | + memcpy(arg, &int_val, val_size); | |
| 2766 | + break; | |
| 2767 | + | |
| 2768 | + case IOV_SVAL(IOV_DCONSOLE_POLL): | |
| 2769 | + brcmf_console_ms = (uint) int_val; | |
| 2770 | + break; | |
| 2771 | + | |
| 2772 | + case IOV_SVAL(IOV_CONS): | |
| 2773 | + if (len > 0) | |
| 2774 | + bcmerror = brcmf_sdbrcm_bus_console_in(bus->drvr, | |
| 2775 | + arg, len - 1); | |
| 2776 | + break; | |
| 2359 | 2777 | |
| 2360 | −#ifdef DHD_DEBUG | |
| 2361 | 2778 | case IOV_GVAL(IOV_SDREG): |
| 2362 | 2779 | { |
| 2363 | − sdreg_t *sd_ptr; | |
| 2780 | + struct brcmf_sdreg *sd_ptr; | |
| 2364 | 2781 | u32 addr, size; |
| 2365 | 2782 | |
| 2366 | − sd_ptr = (sdreg_t *) params; | |
| 2783 | + sd_ptr = (struct brcmf_sdreg *) params; | |
| 2367 | 2784 | |
| 2368 | − addr = (unsigned long)bus->regs + sd_ptr->offset; | |
| 2785 | + addr = bus->ci->buscorebase + sd_ptr->offset; | |
| 2369 | 2786 | size = sd_ptr->func; |
| 2370 | − int_val = (s32) bcmsdh_reg_read(bus->sdh, addr, size); | |
| 2371 | − if (bcmsdh_regfail(bus->sdh)) | |
| 2787 | + int_val = (s32) brcmf_sdcard_reg_read(bus->card, addr, | |
| 2788 | + size); | |
| 2789 | + if (brcmf_sdcard_regfail(bus->card)) | |
| 2372 | 2790 | bcmerror = -EIO; |
| 2373 | 2791 | memcpy(arg, &int_val, sizeof(s32)); |
| 2374 | 2792 | break; |
| @@ -2376,15 +2794,16 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 1 unmodified line | ||
| 2376 | 2794 | |
| 2377 | 2795 | case IOV_SVAL(IOV_SDREG): |
| 2378 | 2796 | { |
| 2379 | − sdreg_t *sd_ptr; | |
| 2797 | + struct brcmf_sdreg *sd_ptr; | |
| 2380 | 2798 | u32 addr, size; |
| 2381 | 2799 | |
| 2382 | − sd_ptr = (sdreg_t *) params; | |
| 2800 | + sd_ptr = (struct brcmf_sdreg *) params; | |
| 2383 | 2801 | |
| 2384 | − addr = (unsigned long)bus->regs + sd_ptr->offset; | |
| 2802 | + addr = bus->ci->buscorebase + sd_ptr->offset; | |
| 2385 | 2803 | size = sd_ptr->func; |
| 2386 | − bcmsdh_reg_write(bus->sdh, addr, size, sd_ptr->value); | |
| 2387 | − if (bcmsdh_regfail(bus->sdh)) | |
| 2804 | + brcmf_sdcard_reg_write(bus->card, addr, size, | |
| 2805 | + sd_ptr->value); | |
| 2806 | + if (brcmf_sdcard_regfail(bus->card)) | |
| 2388 | 2807 | bcmerror = -EIO; |
| 2389 | 2808 | break; |
| 2390 | 2809 | } |
| @@ -2393,15 +2812,16 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines | ||
| 2393 | 2812 | (not SDIO core) */ |
| 2394 | 2813 | case IOV_GVAL(IOV_SBREG): |
| 2395 | 2814 | { |
| 2396 | − sdreg_t sdreg; | |
| 2815 | + struct brcmf_sdreg sdreg; | |
| 2397 | 2816 | u32 addr, size; |
| 2398 | 2817 | |
| 2399 | 2818 | memcpy(&sdreg, params, sizeof(sdreg)); |
| 2400 | 2819 | |
| 2401 | 2820 | addr = SI_ENUM_BASE + sdreg.offset; |
| 2402 | 2821 | size = sdreg.func; |
| 2403 | − int_val = (s32) bcmsdh_reg_read(bus->sdh, addr, size); | |
| 2404 | − if (bcmsdh_regfail(bus->sdh)) | |
| 2822 | + int_val = (s32) brcmf_sdcard_reg_read(bus->card, addr, | |
| 2823 | + size); | |
| 2824 | + if (brcmf_sdcard_regfail(bus->card)) | |
| 2405 | 2825 | bcmerror = -EIO; |
| 2406 | 2826 | memcpy(arg, &int_val, sizeof(s32)); |
| 2407 | 2827 | break; |
| @@ -2409,15 +2829,16 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 1 unmodified line | ||
| 2409 | 2829 | |
| 2410 | 2830 | case IOV_SVAL(IOV_SBREG): |
| 2411 | 2831 | { |
| 2412 | − sdreg_t sdreg; | |
| 2832 | + struct brcmf_sdreg sdreg; | |
| 2413 | 2833 | u32 addr, size; |
| 2414 | 2834 | |
| 2415 | 2835 | memcpy(&sdreg, params, sizeof(sdreg)); |
| 2416 | 2836 | |
| 2417 | 2837 | addr = SI_ENUM_BASE + sdreg.offset; |
| 2418 | 2838 | size = sdreg.func; |
| 2419 | − bcmsdh_reg_write(bus->sdh, addr, size, sdreg.value); | |
| 2420 | − if (bcmsdh_regfail(bus->sdh)) | |
| 2839 | + brcmf_sdcard_reg_write(bus->card, addr, size, | |
| 2840 | + sdreg.value); | |
| 2841 | + if (brcmf_sdcard_regfail(bus->card)) | |
| 2421 | 2842 | bcmerror = -EIO; |
| 2422 | 2843 | break; |
| 2423 | 2844 | } |
| @@ -2427,15 +2848,15 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 3 unmodified lines | ||
| 2427 | 2848 | *(char *)arg = 0; |
| 2428 | 2849 | |
| 2429 | 2850 | strcat(arg, "\nFunc 0\n"); |
| 2430 | − bcmsdh_cis_read(bus->sdh, 0x10, | |
| 2851 | + brcmf_sdcard_cis_read(bus->card, 0x10, | |
| 2431 | 2852 | (u8 *) arg + strlen(arg), |
| 2432 | 2853 | SBSDIO_CIS_SIZE_LIMIT); |
| 2433 | 2854 | strcat(arg, "\nFunc 1\n"); |
| 2434 | − bcmsdh_cis_read(bus->sdh, 0x11, | |
| 2855 | + brcmf_sdcard_cis_read(bus->card, 0x11, | |
| 2435 | 2856 | (u8 *) arg + strlen(arg), |
| 2436 | 2857 | SBSDIO_CIS_SIZE_LIMIT); |
| 2437 | 2858 | strcat(arg, "\nFunc 2\n"); |
| 2438 | − bcmsdh_cis_read(bus->sdh, 0x12, | |
| 2859 | + brcmf_sdcard_cis_read(bus->card, 0x12, | |
| 2439 | 2860 | (u8 *) arg + strlen(arg), |
| 2440 | 2861 | SBSDIO_CIS_SIZE_LIMIT); |
| 2441 | 2862 | break; |
| @@ -2451,32 +2872,32 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 9 unmodified lines | ||
| 2451 | 2872 | break; |
| 2452 | 2873 | |
| 2453 | 2874 | case IOV_GVAL(IOV_TXBOUND): |
| 2454 | − int_val = (s32) dhd_txbound; | |
| 2875 | + int_val = (s32) brcmf_txbound; | |
| 2455 | 2876 | memcpy(arg, &int_val, val_size); |
| 2456 | 2877 | break; |
| 2457 | 2878 | |
| 2458 | 2879 | case IOV_SVAL(IOV_TXBOUND): |
| 2459 | − dhd_txbound = (uint) int_val; | |
| 2880 | + brcmf_txbound = (uint) int_val; | |
| 2460 | 2881 | break; |
| 2461 | 2882 | |
| 2462 | 2883 | case IOV_GVAL(IOV_RXBOUND): |
| 2463 | − int_val = (s32) dhd_rxbound; | |
| 2884 | + int_val = (s32) brcmf_rxbound; | |
| 2464 | 2885 | memcpy(arg, &int_val, val_size); |
| 2465 | 2886 | break; |
| 2466 | 2887 | |
| 2467 | 2888 | case IOV_SVAL(IOV_RXBOUND): |
| 2468 | − dhd_rxbound = (uint) int_val; | |
| 2889 | + brcmf_rxbound = (uint) int_val; | |
| 2469 | 2890 | break; |
| 2470 | 2891 | |
| 2471 | 2892 | case IOV_GVAL(IOV_TXMINMAX): |
| 2472 | − int_val = (s32) dhd_txminmax; | |
| 2893 | + int_val = (s32) brcmf_txminmax; | |
| 2473 | 2894 | memcpy(arg, &int_val, val_size); |
| 2474 | 2895 | break; |
| 2475 | 2896 | |
| 2476 | 2897 | case IOV_SVAL(IOV_TXMINMAX): |
| 2477 | − dhd_txminmax = (uint) int_val; | |
| 2898 | + brcmf_txminmax = (uint) int_val; | |
| 2478 | 2899 | break; |
| 2479 | −#endif /* DHD_DEBUG */ | |
| 2900 | +#endif /* BCMDBG */ | |
| 2480 | 2901 | |
| 2481 | 2902 | #ifdef SDTEST |
| 2482 | 2903 | case IOV_GVAL(IOV_EXTLOOP): |
| @@ -2489,31 +2910,44 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 6 unmodified lines | ||
| 2489 | 2910 | break; |
| 2490 | 2911 | |
| 2491 | 2912 | case IOV_GVAL(IOV_PKTGEN): |
| 2492 | − bcmerror = dhdsdio_pktgen_get(bus, arg); | |
| 2913 | + bcmerror = brcmf_sdbrcm_pktgen_get(bus, arg); | |
| 2493 | 2914 | break; |
| 2494 | 2915 | |
| 2495 | 2916 | case IOV_SVAL(IOV_PKTGEN): |
| 2496 | − bcmerror = dhdsdio_pktgen_set(bus, arg); | |
| 2917 | + bcmerror = brcmf_sdbrcm_pktgen_set(bus, arg); | |
| 2497 | 2918 | break; |
| 2498 | 2919 | #endif /* SDTEST */ |
| 2499 | 2920 | |
| 2500 | 2921 | case IOV_SVAL(IOV_DEVRESET): |
| 2501 | − DHD_TRACE(("%s: Called set IOV_DEVRESET=%d dongle_reset=%d " | |
| 2502 | − "busstate=%d\n", | |
| 2503 | − __func__, bool_val, bus->dhd->dongle_reset, | |
| 2504 | − bus->dhd->busstate)); | |
| 2922 | + BRCMF_TRACE(("%s: Called set IOV_DEVRESET=%d dongle_reset=%d " | |
| 2923 | + "busstate=%d\n", | |
| 2924 | + __func__, bool_val, bus->drvr->dongle_reset, | |
| 2925 | + bus->drvr->busstate)); | |
| 2505 | 2926 | |
| 2506 | − dhd_bus_devreset(bus->dhd, (u8) bool_val); | |
| 2927 | + brcmf_bus_devreset(bus->drvr, (u8) bool_val); | |
| 2507 | 2928 | |
| 2508 | 2929 | break; |
| 2509 | 2930 | |
| 2510 | 2931 | case IOV_GVAL(IOV_DEVRESET): |
| 2511 | − DHD_TRACE(("%s: Called get IOV_DEVRESET\n", __func__)); | |
| 2932 | + BRCMF_TRACE(("%s: Called get IOV_DEVRESET\n", __func__)); | |
| 2512 | 2933 | |
| 2513 | 2934 | /* Get its status */ |
| 2514 | − int_val = (bool) bus->dhd->dongle_reset; | |
| 2935 | + int_val = (bool) bus->drvr->dongle_reset; | |
| 2936 | + memcpy(arg, &int_val, val_size); | |
| 2937 | + | |
| 2938 | + break; | |
| 2939 | + | |
| 2940 | + case IOV_GVAL(IOV_WDTICK): | |
| 2941 | + int_val = (s32) brcmf_watchdog_ms; | |
| 2515 | 2942 | memcpy(arg, &int_val, val_size); |
| 2943 | + break; | |
| 2516 | 2944 | |
| 2945 | + case IOV_SVAL(IOV_WDTICK): | |
| 2946 | + if (!bus->drvr->up) { | |
| 2947 | + bcmerror = -ENOLINK; | |
| 2948 | + break; | |
| 2949 | + } | |
| 2950 | + brcmf_sdbrcm_wd_timer(bus, (uint) int_val); | |
| 2517 | 2951 | break; |
| 2518 | 2952 | |
| 2519 | 2953 | default: |
| @@ -2522,29 +2956,29 @@ dhdsdio_doiovar(dhd_bus_t *bus, const bcm_iovar_t *vi, u32 actionid, · 2 unmodified lines | ||
| 2522 | 2956 | } |
| 2523 | 2957 | |
| 2524 | 2958 | exit: |
| 2525 | − if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) { | |
| 2959 | + if ((bus->idletime == BRCMF_IDLE_IMMEDIATE) && !bus->dpc_sched) { | |
| 2526 | 2960 | bus->activity = false; |
| 2527 | − dhdsdio_clkctl(bus, CLK_NONE, true); | |
| 2961 | + brcmf_sdbrcm_clkctl(bus, CLK_NONE, true); | |
| 2528 | 2962 | } |
| 2529 | 2963 | |
| 2530 | − dhd_os_sdunlock(bus->dhd); | |
| 2964 | + brcmf_sdbrcm_sdunlock(bus); | |
| 2531 | 2965 | |
| 2532 | 2966 | if (actionid == IOV_SVAL(IOV_DEVRESET) && bool_val == false) |
| 2533 | − dhd_preinit_ioctls((dhd_pub_t *) bus->dhd); | |
| 2967 | + brcmf_c_preinit_ioctls(bus->drvr); | |
| 2534 | 2968 | |
| 2535 | 2969 | return bcmerror; |
| 2536 | 2970 | } |
| 2537 | 2971 | |
| 2538 | −static int dhdsdio_write_vars(dhd_bus_t *bus) | |
| 2972 | +static int brcmf_sdbrcm_write_vars(struct brcmf_bus *bus) | |
| 2539 | 2973 | { |
| 2540 | 2974 | int bcmerror = 0; |
| 2541 | 2975 | u32 varsize; |
| 2542 | 2976 | u32 varaddr; |
| 2543 | 2977 | u8 *vbuffer; |
| 2544 | 2978 | u32 varsizew; |
| 2545 | −#ifdef DHD_DEBUG | |
| 2979 | +#ifdef BCMDBG | |
| 2546 | 2980 | char *nvram_ularray; |
| 2547 | −#endif /* DHD_DEBUG */ | |
| 2981 | +#endif /* BCMDBG */ | |
| 2548 | 2982 | |
| 2549 | 2983 | /* Even if there are no vars are to be written, we still |
| 2550 | 2984 | need to set the ramsize. */ |
| @@ -2560,10 +2994,10 @@ static int dhdsdio_write_vars(dhd_bus_t *bus) · 9 unmodified lines | ||
| 2560 | 2994 | |
| 2561 | 2995 | /* Write the vars list */ |
| 2562 | 2996 | bcmerror = |
| 2563 | − dhdsdio_membytes(bus, true, varaddr, vbuffer, varsize); | |
| 2564 | −#ifdef DHD_DEBUG | |
| 2997 | + brcmf_sdbrcm_membytes(bus, true, varaddr, vbuffer, varsize); | |
| 2998 | +#ifdef BCMDBG | |
| 2565 | 2999 | /* Verify NVRAM bytes */ |
| 2566 | − DHD_INFO(("Compare NVRAM dl & ul; varsize=%d\n", varsize)); | |
| 3000 | + BRCMF_INFO(("Compare NVRAM dl & ul; varsize=%d\n", varsize)); | |
| 2567 | 3001 | nvram_ularray = kmalloc(varsize, GFP_ATOMIC); |
| 2568 | 3002 | if (!nvram_ularray) |
| 2569 | 3003 | return -ENOMEM; |
| @@ -2573,30 +3007,31 @@ static int dhdsdio_write_vars(dhd_bus_t *bus) · 3 unmodified lines | ||
| 2573 | 3007 | |
| 2574 | 3008 | /* Read the vars list to temp buffer for comparison */ |
| 2575 | 3009 | bcmerror = |
| 2576 | − dhdsdio_membytes(bus, false, varaddr, nvram_ularray, | |
| 3010 | + brcmf_sdbrcm_membytes(bus, false, varaddr, nvram_ularray, | |
| 2577 | 3011 | varsize); |
| 2578 | 3012 | if (bcmerror) { |
| 2579 | − DHD_ERROR(("%s: error %d on reading %d nvram bytes at " | |
| 2580 | − "0x%08x\n", __func__, bcmerror, varsize, varaddr)); | |
| 3013 | + BRCMF_ERROR(("%s: error %d on reading %d nvram bytes" | |
| 3014 | + " at 0x%08x\n", __func__, bcmerror, | |
| 3015 | + varsize, varaddr)); | |
| 2581 | 3016 | } |
| 2582 | 3017 | /* Compare the org NVRAM with the one read from RAM */ |
| 2583 | 3018 | if (memcmp(vbuffer, nvram_ularray, varsize)) { |
| 2584 | − DHD_ERROR(("%s: Downloaded NVRAM image is corrupted.\n", | |
| 2585 | − __func__)); | |
| 3019 | + BRCMF_ERROR(("%s: Downloaded NVRAM image is " | |
| 3020 | + "corrupted.\n", __func__)); | |
| 2586 | 3021 | } else |
| 2587 | − DHD_ERROR(("%s: Download/Upload/Compare of NVRAM ok.\n", | |
| 2588 | − __func__)); | |
| 3022 | + BRCMF_ERROR(("%s: Download/Upload/Compare of" | |
| 3023 | + " NVRAM ok.\n", __func__)); | |
| 2589 | 3024 | |
| 2590 | 3025 | kfree(nvram_ularray); |
| 2591 | −#endif /* DHD_DEBUG */ | |
| 3026 | +#endif /* BCMDBG */ | |
| 2592 | 3027 | |
| 2593 | 3028 | kfree(vbuffer); |
| 2594 | 3029 | } |
| 2595 | 3030 | |
| 2596 | 3031 | /* adjust to the user specified RAM */ |
| 2597 | − DHD_INFO(("Physical memory size: %d, usable memory size: %d\n", | |
| 2598 | − bus->orig_ramsize, bus->ramsize)); | |
| 2599 | − DHD_INFO(("Vars are at %d, orig varsize is %d\n", varaddr, varsize)); | |
| 3032 | + BRCMF_INFO(("Physical memory size: %d, usable memory size: %d\n", | |
| 3033 | + bus->orig_ramsize, bus->ramsize)); | |
| 3034 | + BRCMF_INFO(("Vars are at %d, orig varsize is %d\n", varaddr, varsize)); | |
| 2600 | 3035 | varsize = ((bus->orig_ramsize - 4) - varaddr); |
| 2601 | 3036 | |
| 2602 | 3037 | /* |
| @@ -2612,17 +3047,17 @@ static int dhdsdio_write_vars(dhd_bus_t *bus) · 9 unmodified lines | ||
| 2612 | 3047 | varsizew = cpu_to_le32(varsizew); |
| 2613 | 3048 | } |
| 2614 | 3049 | |
| 2615 | − DHD_INFO(("New varsize is %d, length token=0x%08x\n", varsize, | |
| 2616 | − varsizew)); | |
| 3050 | + BRCMF_INFO(("New varsize is %d, length token=0x%08x\n", varsize, | |
| 3051 | + varsizew)); | |
| 2617 | 3052 | |
| 2618 | 3053 | /* Write the length token to the last word */ |
| 2619 | − bcmerror = dhdsdio_membytes(bus, true, (bus->orig_ramsize - 4), | |
| 3054 | + bcmerror = brcmf_sdbrcm_membytes(bus, true, (bus->orig_ramsize - 4), | |
| 2620 | 3055 | (u8 *)&varsizew, 4); |
| 2621 | 3056 | |
| 2622 | 3057 | return bcmerror; |
| 2623 | 3058 | } |
| 2624 | 3059 | |
| 2625 | −static int dhdsdio_download_state(dhd_bus_t *bus, bool enter) | |
| 3060 | +static int brcmf_sdbrcm_download_state(struct brcmf_bus *bus, bool enter) | |
| 2626 | 3061 | { |
| 2627 | 3062 | uint retries; |
| 2628 | 3063 | u32 regdata; |
| @@ -2634,139 +3069,114 @@ static int dhdsdio_download_state(dhd_bus_t *bus, bool enter) · 5 unmodified lines | ||
| 2634 | 3069 | if (enter) { |
| 2635 | 3070 | bus->alp_only = true; |
| 2636 | 3071 | |
| 2637 | − dhdsdio_chip_disablecore(bus->sdh, bus->ci->armcorebase); | |
| 3072 | + brcmf_sdbrcm_chip_disablecore(bus->card, bus->ci->armcorebase); | |
| 2638 | 3073 | |
| 2639 | − dhdsdio_chip_resetcore(bus->sdh, bus->ci->ramcorebase); | |
| 3074 | + brcmf_sdbrcm_chip_resetcore(bus->card, bus->ci->ramcorebase); | |
| 2640 | 3075 | |
| 2641 | 3076 | /* Clear the top bit of memory */ |
| 2642 | 3077 | if (bus->ramsize) { |
| 2643 | 3078 | u32 zeros = 0; |
| 2644 | − dhdsdio_membytes(bus, true, bus->ramsize - 4, | |
| 3079 | + brcmf_sdbrcm_membytes(bus, true, bus->ramsize - 4, | |
| 2645 | 3080 | (u8 *)&zeros, 4); |
| 2646 | 3081 | } |
| 2647 | 3082 | } else { |
| 2648 | − regdata = bcmsdh_reg_read(bus->sdh, | |
| 3083 | + regdata = brcmf_sdcard_reg_read(bus->card, | |
| 2649 | 3084 | CORE_SB(bus->ci->ramcorebase, sbtmstatelow), 4); |
| 2650 | 3085 | regdata &= (SBTML_RESET | SBTML_REJ_MASK | |
| 2651 | 3086 | (SICF_CLOCK_EN << SBTML_SICF_SHIFT)); |
| 2652 | 3087 | if ((SICF_CLOCK_EN << SBTML_SICF_SHIFT) != regdata) { |
| 2653 | − DHD_ERROR(("%s: SOCRAM core is down after reset?\n", | |
| 2654 | − __func__)); | |
| 3088 | + BRCMF_ERROR(("%s: SOCRAM core is down after reset?\n", | |
| 3089 | + __func__)); | |
| 2655 | 3090 | bcmerror = -EBADE; |
| 2656 | 3091 | goto fail; |
| 2657 | 3092 | } |
| 2658 | 3093 | |
| 2659 | − bcmerror = dhdsdio_write_vars(bus); | |
| 3094 | + bcmerror = brcmf_sdbrcm_write_vars(bus); | |
| 2660 | 3095 | if (bcmerror) { |
| 2661 | − DHD_ERROR(("%s: no vars written to RAM\n", __func__)); | |
| 3096 | + BRCMF_ERROR(("%s: no vars written to RAM\n", __func__)); | |
| 2662 | 3097 | bcmerror = 0; |
| 2663 | 3098 | } |
| 2664 | 3099 | |
| 2665 | − W_SDREG(0xFFFFFFFF, &bus->regs->intstatus, retries); | |
| 3100 | + w_sdreg32(bus, 0xFFFFFFFF, | |
| 3101 | + offsetof(struct sdpcmd_regs, intstatus), &retries); | |
| 2666 | 3102 | |
| 2667 | − dhdsdio_chip_resetcore(bus->sdh, bus->ci->armcorebase); | |
| 3103 | + brcmf_sdbrcm_chip_resetcore(bus->card, bus->ci->armcorebase); | |
| 2668 | 3104 | |
| 2669 | 3105 | /* Allow HT Clock now that the ARM is running. */ |
| 2670 | 3106 | bus->alp_only = false; |
| 2671 | 3107 | |
| 2672 | − bus->dhd->busstate = DHD_BUS_LOAD; | |
| 3108 | + bus->drvr->busstate = BRCMF_BUS_LOAD; | |
| 2673 | 3109 | } |
| 2674 | 3110 | fail: |
| 2675 | 3111 | return bcmerror; |
| 2676 | 3112 | } |
| 2677 | 3113 | |
| 2678 | 3114 | int |
| 2679 | −dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name, | |
| 2680 | − void *params, int plen, void *arg, int len, bool set) | |
| 3115 | +brcmf_sdbrcm_bus_iovar_op(struct brcmf_pub *drvr, const char *name, | |
| 3116 | + void *params, int plen, void *arg, int len, bool set) | |
| 2681 | 3117 | { |
| 2682 | − dhd_bus_t *bus = dhdp->bus; | |
| 2683 | − const bcm_iovar_t *vi = NULL; | |
| 3118 | + struct brcmf_bus *bus = drvr->bus; | |
| 3119 | + const struct brcmu_iovar *vi = NULL; | |
| 2684 | 3120 | int bcmerror = 0; |
| 2685 | 3121 | int val_size; |
| 2686 | 3122 | u32 actionid; |
| 2687 | 3123 | |
| 2688 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 3124 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 2689 | 3125 | |
| 2690 | − ASSERT(name); | |
| 2691 | − ASSERT(len >= 0); | |
| 3126 | + if (name == NULL || len <= 0) | |
| 3127 | + return -EINVAL; | |
| 2692 | 3128 | |
| 2693 | − /* Get MUST have return space */ | |
| 2694 | − ASSERT(set || (arg && len)); | |
| 3129 | + /* Set does not take qualifiers */ | |
| 3130 | + if (set && (params || plen)) | |
| 3131 | + return -EINVAL; | |
| 2695 | 3132 | |
| 2696 | − /* Set does NOT take qualifiers */ | |
| 2697 | − ASSERT(!set || (!params && !plen)); | |
| 3133 | + /* Get must have return space;*/ | |
| 3134 | + if (!set && !(arg && len)) | |
| 3135 | + return -EINVAL; | |
| 2698 | 3136 | |
| 2699 | 3137 | /* Look up var locally; if not found pass to host driver */ |
| 2700 | − vi = bcm_iovar_lookup(dhdsdio_iovars, name); | |
| 3138 | + vi = brcmu_iovar_lookup(brcmf_sdio_iovars, name); | |
| 2701 | 3139 | if (vi == NULL) { |
| 2702 | − dhd_os_sdlock(bus->dhd); | |
| 3140 | + brcmf_sdbrcm_sdlock(bus); | |
| 2703 | 3141 | |
| 2704 | 3142 | BUS_WAKE(bus); |
| 2705 | 3143 | |
| 2706 | 3144 | /* Turn on clock in case SD command needs backplane */ |
| 2707 | − dhdsdio_clkctl(bus, CLK_AVAIL, false); | |
| 3145 | + brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); | |
| 3146 | + | |
| 3147 | + bcmerror = brcmf_sdcard_iovar_op(bus->card, name, params, plen, | |
| 3148 | + arg, len, set); | |
| 2708 | 3149 | |
| 2709 | − bcmerror = | |
| 2710 | − bcmsdh_iovar_op(bus->sdh, name, params, plen, arg, len, | |
| 2711 | − set); | |
| 2712 | − | |
| 2713 | − /* Check for bus configuration changes of interest */ | |
| 2714 | − | |
| 2715 | − /* If it was divisor change, read the new one */ | |
| 2716 | − if (set && strcmp(name, "sd_divisor") == 0) { | |
| 2717 | − if (bcmsdh_iovar_op(bus->sdh, "sd_divisor", NULL, 0, | |
| 2718 | − &bus->sd_divisor, sizeof(s32), | |
| 2719 | − false) != 0) { | |
| 2720 | − bus->sd_divisor = -1; | |
| 2721 | − DHD_ERROR(("%s: fail on %s get\n", __func__, | |
| 2722 | − name)); | |
| 2723 | − } else { | |
| 2724 | − DHD_INFO(("%s: noted %s update, value now %d\n", | |
| 2725 | − __func__, name, bus->sd_divisor)); | |
| 2726 | − } | |
| 2727 | − } | |
| 2728 | − /* If it was a mode change, read the new one */ | |
| 2729 | − if (set && strcmp(name, "sd_mode") == 0) { | |
| 2730 | − if (bcmsdh_iovar_op(bus->sdh, "sd_mode", NULL, 0, | |
| 2731 | − &bus->sd_mode, sizeof(s32), | |
| 2732 | − false) != 0) { | |
| 2733 | − bus->sd_mode = -1; | |
| 2734 | − DHD_ERROR(("%s: fail on %s get\n", __func__, | |
| 2735 | − name)); | |
| 2736 | − } else { | |
| 2737 | − DHD_INFO(("%s: noted %s update, value now %d\n", | |
| 2738 | − __func__, name, bus->sd_mode)); | |
| 2739 | − } | |
| 2740 | − } | |
| 2741 | 3150 | /* Similar check for blocksize change */ |
| 2742 | 3151 | if (set && strcmp(name, "sd_blocksize") == 0) { |
| 2743 | 3152 | s32 fnum = 2; |
| 2744 | − if (bcmsdh_iovar_op | |
| 2745 | − (bus->sdh, "sd_blocksize", &fnum, sizeof(s32), | |
| 3153 | + if (brcmf_sdcard_iovar_op | |
| 3154 | + (bus->card, "sd_blocksize", &fnum, sizeof(s32), | |
| 2746 | 3155 | &bus->blocksize, sizeof(s32), |
| 2747 | 3156 | false) != 0) { |
| 2748 | 3157 | bus->blocksize = 0; |
| 2749 | − DHD_ERROR(("%s: fail on %s get\n", __func__, | |
| 2750 | − "sd_blocksize")); | |
| 3158 | + BRCMF_ERROR(("%s: fail on %s get\n", __func__, | |
| 3159 | + "sd_blocksize")); | |
| 2751 | 3160 | } else { |
| 2752 | − DHD_INFO(("%s: noted %s update, value now %d\n", | |
| 2753 | − __func__, "sd_blocksize", | |
| 2754 | − bus->blocksize)); | |
| 3161 | + BRCMF_INFO(("%s: noted sd_blocksize update," | |
| 3162 | + " value now %d\n", __func__, | |
| 3163 | + bus->blocksize)); | |
| 2755 | 3164 | } |
| 2756 | 3165 | } |
| 2757 | 3166 | bus->roundup = min(max_roundup, bus->blocksize); |
| 2758 | 3167 | |
| 2759 | − if ((bus->idletime == DHD_IDLE_IMMEDIATE) && !bus->dpc_sched) { | |
| 3168 | + if (bus->idletime == BRCMF_IDLE_IMMEDIATE && | |
| 3169 | + !bus->dpc_sched) { | |
| 2760 | 3170 | bus->activity = false; |
| 2761 | − dhdsdio_clkctl(bus, CLK_NONE, true); | |
| 3171 | + brcmf_sdbrcm_clkctl(bus, CLK_NONE, true); | |
| 2762 | 3172 | } |
| 2763 | 3173 | |
| 2764 | − dhd_os_sdunlock(bus->dhd); | |
| 3174 | + brcmf_sdbrcm_sdunlock(bus); | |
| 2765 | 3175 | goto exit; |
| 2766 | 3176 | } |
| 2767 | 3177 | |
| 2768 | − DHD_CTL(("%s: %s %s, len %d plen %d\n", __func__, | |
| 2769 | − name, (set ? "set" : "get"), len, plen)); | |
| 3178 | + BRCMF_CTL(("%s: %s %s, len %d plen %d\n", __func__, | |
| 3179 | + name, (set ? "set" : "get"), len, plen)); | |
| 2770 | 3180 | |
| 2771 | 3181 | /* set up 'params' pointer in case this is a set command so that |
| 2772 | 3182 | * the convenience int and bool code can be common to set and get |
| @@ -2785,168 +3195,188 @@ dhd_bus_iovar_op(dhd_pub_t *dhdp, const char *name, · 12 unmodified lines | ||
| 2785 | 3195 | val_size = sizeof(int); |
| 2786 | 3196 | |
| 2787 | 3197 | actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid); |
| 2788 | − bcmerror = | |
| 2789 | − dhdsdio_doiovar(bus, vi, actionid, name, params, plen, arg, len, | |
| 2790 | − val_size); | |
| 3198 | + bcmerror = brcmf_sdbrcm_doiovar(bus, vi, actionid, name, params, plen, | |
| 3199 | + arg, len, val_size); | |
| 2791 | 3200 | |
| 2792 | 3201 | exit: |
| 2793 | 3202 | return bcmerror; |
| 2794 | 3203 | } |
| 2795 | 3204 | |
| 2796 | −void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex) | |
| 3205 | +void brcmf_sdbrcm_bus_stop(struct brcmf_bus *bus, bool enforce_mutex) | |
| 2797 | 3206 | { |
| 2798 | 3207 | u32 local_hostintmask; |
| 2799 | 3208 | u8 saveclk; |
| 2800 | 3209 | uint retries; |
| 2801 | 3210 | int err; |
| 2802 | 3211 | |
| 2803 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 3212 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 2804 | 3213 | |
| 2805 | 3214 | if (enforce_mutex) |
| 2806 | − dhd_os_sdlock(bus->dhd); | |
| 3215 | + brcmf_sdbrcm_sdlock(bus); | |
| 2807 | 3216 | |
| 2808 | 3217 | BUS_WAKE(bus); |
| 2809 | 3218 | |
| 2810 | 3219 | /* Enable clock for device interrupts */ |
| 2811 | − dhdsdio_clkctl(bus, CLK_AVAIL, false); | |
| 3220 | + brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); | |
| 3221 | + | |
| 3222 | + if (bus->watchdog_tsk) { | |
| 3223 | + send_sig(SIGTERM, bus->watchdog_tsk, 1); | |
| 3224 | + kthread_stop(bus->watchdog_tsk); | |
| 3225 | + bus->watchdog_tsk = NULL; | |
| 3226 | + } | |
| 3227 | + | |
| 3228 | + if (bus->dpc_tsk) { | |
| 3229 | + send_sig(SIGTERM, bus->dpc_tsk, 1); | |
| 3230 | + kthread_stop(bus->dpc_tsk); | |
| 3231 | + bus->dpc_tsk = NULL; | |
| 3232 | + } else | |
| 3233 | + tasklet_kill(&bus->tasklet); | |
| 2812 | 3234 | |
| 2813 | 3235 | /* Disable and clear interrupts at the chip level also */ |
| 2814 | − W_SDREG(0, &bus->regs->hostintmask, retries); | |
| 3236 | + w_sdreg32(bus, 0, offsetof(struct sdpcmd_regs, hostintmask), &retries); | |
| 2815 | 3237 | local_hostintmask = bus->hostintmask; |
| 2816 | 3238 | bus->hostintmask = 0; |
| 2817 | 3239 | |
| 2818 | 3240 | /* Change our idea of bus state */ |
| 2819 | − bus->dhd->busstate = DHD_BUS_DOWN; | |
| 3241 | + bus->drvr->busstate = BRCMF_BUS_DOWN; | |
| 2820 | 3242 | |
| 2821 | 3243 | /* Force clocks on backplane to be sure F2 interrupt propagates */ |
| 2822 | − saveclk = | |
| 2823 | − bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, | |
| 2824 | − &err); | |
| 3244 | + saveclk = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1, | |
| 3245 | + SBSDIO_FUNC1_CHIPCLKCSR, &err); | |
| 2825 | 3246 | if (!err) { |
| 2826 | − bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, | |
| 2827 | − (saveclk | SBSDIO_FORCE_HT), &err); | |
| 3247 | + brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, | |
| 3248 | + SBSDIO_FUNC1_CHIPCLKCSR, | |
| 3249 | + (saveclk | SBSDIO_FORCE_HT), &err); | |
| 2828 | 3250 | } |
| 2829 | 3251 | if (err) { |
| 2830 | − DHD_ERROR(("%s: Failed to force clock for F2: err %d\n", | |
| 2831 | − __func__, err)); | |
| 3252 | + BRCMF_ERROR(("%s: Failed to force clock for F2: err %d\n", | |
| 3253 | + __func__, err)); | |
| 2832 | 3254 | } |
| 2833 | 3255 | |
| 2834 | 3256 | /* Turn off the bus (F2), free any pending packets */ |
| 2835 | − DHD_INTR(("%s: disable SDIO interrupts\n", __func__)); | |
| 2836 | − bcmsdh_intr_disable(bus->sdh); | |
| 2837 | − bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, | |
| 3257 | + BRCMF_INTR(("%s: disable SDIO interrupts\n", __func__)); | |
| 3258 | + brcmf_sdcard_intr_disable(bus->card); | |
| 3259 | + brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx, | |
| 2838 | 3260 | SDIO_FUNC_ENABLE_1, NULL); |
| 2839 | 3261 | |
| 2840 | 3262 | /* Clear any pending interrupts now that F2 is disabled */ |
| 2841 | − W_SDREG(local_hostintmask, &bus->regs->intstatus, retries); | |
| 3263 | + w_sdreg32(bus, local_hostintmask, | |
| 3264 | + offsetof(struct sdpcmd_regs, intstatus), &retries); | |
| 2842 | 3265 | |
| 2843 | 3266 | /* Turn off the backplane clock (only) */ |
| 2844 | − dhdsdio_clkctl(bus, CLK_SDONLY, false); | |
| 3267 | + brcmf_sdbrcm_clkctl(bus, CLK_SDONLY, false); | |
| 2845 | 3268 | |
| 2846 | 3269 | /* Clear the data packet queues */ |
| 2847 | − bcm_pktq_flush(&bus->txq, true, NULL, NULL); | |
| 3270 | + brcmu_pktq_flush(&bus->txq, true, NULL, NULL); | |
| 2848 | 3271 | |
| 2849 | 3272 | /* Clear any held glomming stuff */ |
| 2850 | 3273 | if (bus->glomd) |
| 2851 | − bcm_pkt_buf_free_skb(bus->glomd); | |
| 3274 | + brcmu_pkt_buf_free_skb(bus->glomd); | |
| 2852 | 3275 | |
| 2853 | 3276 | if (bus->glom) |
| 2854 | − bcm_pkt_buf_free_skb(bus->glom); | |
| 3277 | + brcmu_pkt_buf_free_skb(bus->glom); | |
| 2855 | 3278 | |
| 2856 | 3279 | bus->glom = bus->glomd = NULL; |
| 2857 | 3280 | |
| 2858 | 3281 | /* Clear rx control and wake any waiters */ |
| 2859 | 3282 | bus->rxlen = 0; |
| 2860 | − dhd_os_ioctl_resp_wake(bus->dhd); | |
| 3283 | + brcmf_os_ioctl_resp_wake(bus->drvr); | |
| 2861 | 3284 | |
| 2862 | 3285 | /* Reset some F2 state stuff */ |
| 2863 | 3286 | bus->rxskip = false; |
| 2864 | 3287 | bus->tx_seq = bus->rx_seq = 0; |
| 2865 | 3288 | |
| 2866 | 3289 | if (enforce_mutex) |
| 2867 | − dhd_os_sdunlock(bus->dhd); | |
| 3290 | + brcmf_sdbrcm_sdunlock(bus); | |
| 2868 | 3291 | } |
| 2869 | 3292 | |
| 2870 | −int dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex) | |
| 3293 | +int brcmf_sdbrcm_bus_init(struct brcmf_pub *drvr, bool enforce_mutex) | |
| 2871 | 3294 | { |
| 2872 | − dhd_bus_t *bus = dhdp->bus; | |
| 2873 | − dhd_timeout_t tmo; | |
| 3295 | + struct brcmf_bus *bus = drvr->bus; | |
| 3296 | + struct brcmf_timeout tmo; | |
| 2874 | 3297 | uint retries = 0; |
| 2875 | 3298 | u8 ready, enable; |
| 2876 | 3299 | int err, ret = 0; |
| 2877 | 3300 | u8 saveclk; |
| 2878 | 3301 | |
| 2879 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 3302 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 3303 | + | |
| 3304 | + /* try to download image and nvram to the dongle */ | |
| 3305 | + if (drvr->busstate == BRCMF_BUS_DOWN) { | |
| 3306 | + if (!(brcmf_sdbrcm_download_firmware(bus, bus->card))) | |
| 3307 | + return -1; | |
| 3308 | + } | |
| 2880 | 3309 | |
| 2881 | − ASSERT(bus->dhd); | |
| 2882 | − if (!bus->dhd) | |
| 3310 | + if (!bus->drvr) | |
| 2883 | 3311 | return 0; |
| 2884 | 3312 | |
| 3313 | + /* Start the watchdog timer */ | |
| 3314 | + bus->drvr->tickcnt = 0; | |
| 3315 | + brcmf_sdbrcm_wd_timer(bus, brcmf_watchdog_ms); | |
| 3316 | + | |
| 2885 | 3317 | if (enforce_mutex) |
| 2886 | − dhd_os_sdlock(bus->dhd); | |
| 3318 | + brcmf_sdbrcm_sdlock(bus); | |
| 2887 | 3319 | |
| 2888 | 3320 | /* Make sure backplane clock is on, needed to generate F2 interrupt */ |
| 2889 | − dhdsdio_clkctl(bus, CLK_AVAIL, false); | |
| 3321 | + brcmf_sdbrcm_clkctl(bus, CLK_AVAIL, false); | |
| 2890 | 3322 | if (bus->clkstate != CLK_AVAIL) |
| 2891 | 3323 | goto exit; |
| 2892 | 3324 | |
| 2893 | 3325 | /* Force clocks on backplane to be sure F2 interrupt propagates */ |
| 2894 | 3326 | saveclk = |
| 2895 | − bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, | |
| 2896 | − &err); | |
| 3327 | + brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_1, | |
| 3328 | + SBSDIO_FUNC1_CHIPCLKCSR, &err); | |
| 2897 | 3329 | if (!err) { |
| 2898 | − bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, | |
| 2899 | − (saveclk | SBSDIO_FORCE_HT), &err); | |
| 3330 | + brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, | |
| 3331 | + SBSDIO_FUNC1_CHIPCLKCSR, | |
| 3332 | + (saveclk | SBSDIO_FORCE_HT), &err); | |
| 2900 | 3333 | } |
| 2901 | 3334 | if (err) { |
| 2902 | − DHD_ERROR(("%s: Failed to force clock for F2: err %d\n", | |
| 2903 | − __func__, err)); | |
| 3335 | + BRCMF_ERROR(("%s: Failed to force clock for F2: err %d\n", | |
| 3336 | + __func__, err)); | |
| 2904 | 3337 | goto exit; |
| 2905 | 3338 | } |
| 2906 | 3339 | |
| 2907 | 3340 | /* Enable function 2 (frame transfers) */ |
| 2908 | − W_SDREG((SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT), | |
| 2909 | − &bus->regs->tosbmailboxdata, retries); | |
| 3341 | + w_sdreg32(bus, SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT, | |
| 3342 | + offsetof(struct sdpcmd_regs, tosbmailboxdata), &retries); | |
| 2910 | 3343 | enable = (SDIO_FUNC_ENABLE_1 | SDIO_FUNC_ENABLE_2); |
| 2911 | 3344 | |
| 2912 | − bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, enable, NULL); | |
| 3345 | + brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx, enable, | |
| 3346 | + NULL); | |
| 2913 | 3347 | |
| 2914 | 3348 | /* Give the dongle some time to do its thing and set IOR2 */ |
| 2915 | − dhd_timeout_start(&tmo, DHD_WAIT_F2RDY * 1000); | |
| 3349 | + brcmf_timeout_start(&tmo, BRCMF_WAIT_F2RDY * 1000); | |
| 2916 | 3350 | |
| 2917 | 3351 | ready = 0; |
| 2918 | − while (ready != enable && !dhd_timeout_expired(&tmo)) | |
| 2919 | − ready = | |
| 2920 | − bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IORDY, | |
| 2921 | − NULL); | |
| 3352 | + while (ready != enable && !brcmf_timeout_expired(&tmo)) | |
| 3353 | + ready = brcmf_sdcard_cfg_read(bus->card, SDIO_FUNC_0, | |
| 3354 | + SDIO_CCCR_IORx, NULL); | |
| 2922 | 3355 | |
| 2923 | − DHD_INFO(("%s: enable 0x%02x, ready 0x%02x (waited %uus)\n", | |
| 2924 | − __func__, enable, ready, tmo.elapsed)); | |
| 3356 | + BRCMF_INFO(("%s: enable 0x%02x, ready 0x%02x (waited %uus)\n", | |
| 3357 | + __func__, enable, ready, tmo.elapsed)); | |
| 2925 | 3358 | |
| 2926 | 3359 | /* If F2 successfully enabled, set core and enable interrupts */ |
| 2927 | 3360 | if (ready == enable) { |
| 2928 | 3361 | /* Set up the interrupt mask and enable interrupts */ |
| 2929 | 3362 | bus->hostintmask = HOSTINTMASK; |
| 2930 | − W_SDREG(bus->hostintmask, | |
| 2931 | − (unsigned int *)CORE_BUS_REG(bus->ci->buscorebase, | |
| 2932 | − hostintmask), retries); | |
| 3363 | + w_sdreg32(bus, bus->hostintmask, | |
| 3364 | + offsetof(struct sdpcmd_regs, hostintmask), &retries); | |
| 2933 | 3365 | |
| 2934 | − bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_WATERMARK, | |
| 3366 | + brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_WATERMARK, | |
| 2935 | 3367 | (u8) watermark, &err); |
| 2936 | 3368 | |
| 2937 | 3369 | /* Set bus state according to enable result */ |
| 2938 | − dhdp->busstate = DHD_BUS_DATA; | |
| 2939 | − | |
| 2940 | − /* bcmsdh_intr_unmask(bus->sdh); */ | |
| 3370 | + drvr->busstate = BRCMF_BUS_DATA; | |
| 2941 | 3371 | |
| 2942 | 3372 | bus->intdis = false; |
| 2943 | 3373 | if (bus->intr) { |
| 2944 | − DHD_INTR(("%s: enable SDIO device interrupts\n", | |
| 2945 | − __func__)); | |
| 2946 | − bcmsdh_intr_enable(bus->sdh); | |
| 3374 | + BRCMF_INTR(("%s: enable SDIO device interrupts\n", | |
| 3375 | + __func__)); | |
| 3376 | + brcmf_sdcard_intr_enable(bus->card); | |
| 2947 | 3377 | } else { |
| 2948 | − DHD_INTR(("%s: disable SDIO interrupts\n", __func__)); | |
| 2949 | − bcmsdh_intr_disable(bus->sdh); | |
| 3378 | + BRCMF_INTR(("%s: disable SDIO interrupts\n", __func__)); | |
| 3379 | + brcmf_sdcard_intr_disable(bus->card); | |
| 2950 | 3380 | } |
| 2951 | 3381 | |
| 2952 | 3382 | } |
| @@ -2954,75 +3384,90 @@ int dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex) · 1 unmodified line | ||
| 2954 | 3384 | else { |
| 2955 | 3385 | /* Disable F2 again */ |
| 2956 | 3386 | enable = SDIO_FUNC_ENABLE_1; |
| 2957 | − bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_IOEN, enable, | |
| 2958 | − NULL); | |
| 3387 | + brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_0, SDIO_CCCR_IOEx, | |
| 3388 | + enable, NULL); | |
| 2959 | 3389 | } |
| 2960 | 3390 | |
| 2961 | 3391 | /* Restore previous clock setting */ |
| 2962 | − bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, | |
| 3392 | + brcmf_sdcard_cfg_write(bus->card, SDIO_FUNC_1, SBSDIO_FUNC1_CHIPCLKCSR, | |
| 2963 | 3393 | saveclk, &err); |
| 2964 | 3394 | |
| 3395 | +#if defined(OOB_INTR_ONLY) | |
| 3396 | + /* Host registration for OOB interrupt */ | |
| 3397 | + if (brcmf_sdio_register_oob_intr(bus->dhd)) { | |
| 3398 | + brcmf_sdbrcm_wd_timer(bus, 0); | |
| 3399 | + BRCMF_ERROR(("%s Host failed to resgister for OOB\n", | |
| 3400 | + __func__)); | |
| 3401 | + ret = -ENODEV; | |
| 3402 | + goto exit; | |
| 3403 | + } | |
| 3404 | + | |
| 3405 | + /* Enable oob at firmware */ | |
| 3406 | + brcmf_sdbrcm_enable_oob_intr(bus, true); | |
| 3407 | +#endif /* defined(OOB_INTR_ONLY) */ | |
| 3408 | + | |
| 2965 | 3409 | /* If we didn't come up, turn off backplane clock */ |
| 2966 | − if (dhdp->busstate != DHD_BUS_DATA) | |
| 2967 | − dhdsdio_clkctl(bus, CLK_NONE, false); | |
| 3410 | + if (drvr->busstate != BRCMF_BUS_DATA) | |
| 3411 | + brcmf_sdbrcm_clkctl(bus, CLK_NONE, false); | |
| 2968 | 3412 | |
| 2969 | 3413 | exit: |
| 2970 | 3414 | if (enforce_mutex) |
| 2971 | − dhd_os_sdunlock(bus->dhd); | |
| 3415 | + brcmf_sdbrcm_sdunlock(bus); | |
| 2972 | 3416 | |
| 2973 | 3417 | return ret; |
| 2974 | 3418 | } |
| 2975 | 3419 | |
| 2976 | −static void dhdsdio_rxfail(dhd_bus_t *bus, bool abort, bool rtx) | |
| 3420 | +static void brcmf_sdbrcm_rxfail(struct brcmf_bus *bus, bool abort, bool rtx) | |
| 2977 | 3421 | { |
| 2978 | − bcmsdh_info_t *sdh = bus->sdh; | |
| 2979 | − sdpcmd_regs_t *regs = bus->regs; | |
| 3422 | + struct brcmf_sdio_card *card = bus->card; | |
| 2980 | 3423 | uint retries = 0; |
| 2981 | 3424 | u16 lastrbc; |
| 2982 | 3425 | u8 hi, lo; |
| 2983 | 3426 | int err; |
| 2984 | 3427 | |
| 2985 | − DHD_ERROR(("%s: %sterminate frame%s\n", __func__, | |
| 2986 | − (abort ? "abort command, " : ""), | |
| 2987 | − (rtx ? ", send NAK" : ""))); | |
| 3428 | + BRCMF_ERROR(("%s: %sterminate frame%s\n", __func__, | |
| 3429 | + (abort ? "abort command, " : ""), | |
| 3430 | + (rtx ? ", send NAK" : ""))); | |
| 2988 | 3431 | |
| 2989 | 3432 | if (abort) |
| 2990 | − bcmsdh_abort(sdh, SDIO_FUNC_2); | |
| 3433 | + brcmf_sdcard_abort(card, SDIO_FUNC_2); | |
| 2991 | 3434 | |
| 2992 | − bcmsdh_cfg_write(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL, SFC_RF_TERM, | |
| 2993 | − &err); | |
| 3435 | + brcmf_sdcard_cfg_write(card, SDIO_FUNC_1, SBSDIO_FUNC1_FRAMECTRL, | |
| 3436 | + SFC_RF_TERM, &err); | |
| 2994 | 3437 | bus->f1regdata++; |
| 2995 | 3438 | |
| 2996 | 3439 | /* Wait until the packet has been flushed (device/FIFO stable) */ |
| 2997 | 3440 | for (lastrbc = retries = 0xffff; retries > 0; retries--) { |
| 2998 | − hi = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_RFRAMEBCHI, | |
| 2999 | − NULL); | |
| 3000 | − lo = bcmsdh_cfg_read(sdh, SDIO_FUNC_1, SBSDIO_FUNC1_RFRAMEBCLO, | |
| 3001 | − NULL); | |
| 3441 | + hi = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, | |
| 3442 | + SBSDIO_FUNC1_RFRAMEBCHI, NULL); | |
| 3443 | + lo = brcmf_sdcard_cfg_read(card, SDIO_FUNC_1, | |
| 3444 | + SBSDIO_FUNC1_RFRAMEBCLO, NULL); | |
| 3002 | 3445 | bus->f1regdata += 2; |
| 3003 | 3446 | |
| 3004 | 3447 | if ((hi == 0) && (lo == 0)) |
| 3005 | 3448 | break; |
| 3006 | 3449 | |
| 3007 | 3450 | if ((hi > (lastrbc >> 8)) && (lo > (lastrbc & 0x00ff))) { |
| 3008 | − DHD_ERROR(("%s: count growing: last 0x%04x now " | |
| 3009 | − "0x%04x\n", | |
| 3010 | − __func__, lastrbc, ((hi << 8) + lo))); | |
| 3451 | + BRCMF_ERROR(("%s: count growing: last 0x%04x now " | |
| 3452 | + "0x%04x\n", | |
| 3453 | + __func__, lastrbc, ((hi << 8) + lo))); | |
| 3011 | 3454 | } |
| 3012 | 3455 | lastrbc = (hi << 8) + lo; |
| 3013 | 3456 | } |
| 3014 | 3457 | |
| 3015 | 3458 | if (!retries) { |
| 3016 | − DHD_ERROR(("%s: count never zeroed: last 0x%04x\n", | |
| 3017 | − __func__, lastrbc)); | |
| 3459 | + BRCMF_ERROR(("%s: count never zeroed: last 0x%04x\n", | |
| 3460 | + __func__, lastrbc)); | |
| 3018 | 3461 | } else { |
| 3019 | − DHD_INFO(("%s: flush took %d iterations\n", __func__, | |
| 3020 | − (0xffff - retries))); | |
| 3462 | + BRCMF_INFO(("%s: flush took %d iterations\n", __func__, | |
| 3463 | + (0xffff - retries))); | |
| 3021 | 3464 | } |
| 3022 | 3465 | |
| 3023 | 3466 | if (rtx) { |
| 3024 | 3467 | bus->rxrtx++; |
| 3025 | − W_SDREG(SMB_NAK, ®s->tosbmailbox, retries); | |
| 3468 | + w_sdreg32(bus, SMB_NAK, | |
| 3469 | + offsetof(struct sdpcmd_regs, tosbmailbox), &retries); | |
| 3470 | + | |
| 3026 | 3471 | bus->f1regdata++; |
| 3027 | 3472 | if (retries <= retry_limit) |
| 3028 | 3473 | bus->rxskip = true; |
| @@ -3032,35 +3477,33 @@ static void dhdsdio_rxfail(dhd_bus_t *bus, bool abort, bool rtx) · 3 unmodified lines | ||
| 3032 | 3477 | bus->nextlen = 0; |
| 3033 | 3478 | |
| 3034 | 3479 | /* If we can't reach the device, signal failure */ |
| 3035 | − if (err || bcmsdh_regfail(sdh)) | |
| 3036 | − bus->dhd->busstate = DHD_BUS_DOWN; | |
| 3480 | + if (err || brcmf_sdcard_regfail(card)) | |
| 3481 | + bus->drvr->busstate = BRCMF_BUS_DOWN; | |
| 3037 | 3482 | } |
| 3038 | 3483 | |
| 3039 | 3484 | static void |
| 3040 | −dhdsdio_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff) | |
| 3485 | +brcmf_sdbrcm_read_control(struct brcmf_bus *bus, u8 *hdr, uint len, uint doff) | |
| 3041 | 3486 | { |
| 3042 | − bcmsdh_info_t *sdh = bus->sdh; | |
| 3487 | + struct brcmf_sdio_card *card = bus->card; | |
| 3043 | 3488 | uint rdlen, pad; |
| 3044 | 3489 | |
| 3045 | 3490 | int sdret; |
| 3046 | 3491 | |
| 3047 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 3492 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 3048 | 3493 | |
| 3049 | 3494 | /* Control data already received in aligned rxctl */ |
| 3050 | 3495 | if ((bus->bus == SPI_BUS) && (!bus->usebufpool)) |
| 3051 | 3496 | goto gotpkt; |
| 3052 | 3497 | |
| 3053 | − ASSERT(bus->rxbuf); | |
| 3054 | 3498 | /* Set rxctl for frame (w/optional alignment) */ |
| 3055 | 3499 | bus->rxctl = bus->rxbuf; |
| 3056 | − if (dhd_alignctl) { | |
| 3500 | + if (brcmf_alignctl) { | |
| 3057 | 3501 | bus->rxctl += firstread; |
| 3058 | − pad = ((unsigned long)bus->rxctl % DHD_SDALIGN); | |
| 3502 | + pad = ((unsigned long)bus->rxctl % BRCMF_SDALIGN); | |
| 3059 | 3503 | if (pad) |
| 3060 | − bus->rxctl += (DHD_SDALIGN - pad); | |
| 3504 | + bus->rxctl += (BRCMF_SDALIGN - pad); | |
| 3061 | 3505 | bus->rxctl -= firstread; |
| 3062 | 3506 | } |
| 3063 | − ASSERT(bus->rxctl >= bus->rxbuf); | |
| 3064 | 3507 | |
| 3065 | 3508 | /* Copy the already-read portion over */ |
| 3066 | 3509 | memcpy(bus->rxctl, hdr, firstread); |
| @@ -3078,10 +3521,10 @@ dhdsdio_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff) · 11 unmodified lines | ||
| 3078 | 3521 | if (bus->roundup && bus->blocksize && (rdlen > bus->blocksize)) { |
| 3079 | 3522 | pad = bus->blocksize - (rdlen % bus->blocksize); |
| 3080 | 3523 | if ((pad <= bus->roundup) && (pad < bus->blocksize) && |
| 3081 | − ((len + pad) < bus->dhd->maxctl)) | |
| 3524 | + ((len + pad) < bus->drvr->maxctl)) | |
| 3082 | 3525 | rdlen += pad; |
| 3083 | − } else if (rdlen % DHD_SDALIGN) { | |
| 3084 | − rdlen += DHD_SDALIGN - (rdlen % DHD_SDALIGN); | |
| 3526 | + } else if (rdlen % BRCMF_SDALIGN) { | |
| 3527 | + rdlen += BRCMF_SDALIGN - (rdlen % BRCMF_SDALIGN); | |
| 3085 | 3528 | } |
| 3086 | 3529 | |
| 3087 | 3530 | /* Satisfy length-alignment requirements */ |
| @@ -3089,44 +3532,44 @@ dhdsdio_read_control(dhd_bus_t *bus, u8 *hdr, uint len, uint doff) · 1 unmodified line | ||
| 3089 | 3532 | rdlen = roundup(rdlen, ALIGNMENT); |
| 3090 | 3533 | |
| 3091 | 3534 | /* Drop if the read is too big or it exceeds our maximum */ |
| 3092 | − if ((rdlen + firstread) > bus->dhd->maxctl) { | |
| 3093 | − DHD_ERROR(("%s: %d-byte control read exceeds %d-byte buffer\n", | |
| 3094 | − __func__, rdlen, bus->dhd->maxctl)); | |
| 3095 | − bus->dhd->rx_errors++; | |
| 3096 | − dhdsdio_rxfail(bus, false, false); | |
| 3535 | + if ((rdlen + firstread) > bus->drvr->maxctl) { | |
| 3536 | + BRCMF_ERROR(("%s: %d-byte control read exceeds %d-byte" | |
| 3537 | + " buffer\n", __func__, rdlen, bus->drvr->maxctl)); | |
| 3538 | + bus->drvr->rx_errors++; | |
| 3539 | + brcmf_sdbrcm_rxfail(bus, false, false); | |
| 3097 | 3540 | goto done; |
| 3098 | 3541 | } |
| 3099 | 3542 | |
| 3100 | − if ((len - doff) > bus->dhd->maxctl) { | |
| 3101 | − DHD_ERROR(("%s: %d-byte ctl frame (%d-byte ctl data) exceeds " | |
| 3102 | − "%d-byte limit\n", | |
| 3103 | − __func__, len, (len - doff), bus->dhd->maxctl)); | |
| 3104 | − bus->dhd->rx_errors++; | |
| 3543 | + if ((len - doff) > bus->drvr->maxctl) { | |
| 3544 | + BRCMF_ERROR(("%s: %d-byte ctl frame (%d-byte ctl data) exceeds " | |
| 3545 | + "%d-byte limit\n", | |
| 3546 | + __func__, len, (len - doff), bus->drvr->maxctl)); | |
| 3547 | + bus->drvr->rx_errors++; | |
| 3105 | 3548 | bus->rx_toolong++; |
| 3106 | − dhdsdio_rxfail(bus, false, false); | |
| 3549 | + brcmf_sdbrcm_rxfail(bus, false, false); | |
| 3107 | 3550 | goto done; |
| 3108 | 3551 | } |
| 3109 | 3552 | |
| 3110 | 3553 | /* Read remainder of frame body into the rxctl buffer */ |
| 3111 | − sdret = bcmsdh_recv_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, | |
| 3554 | + sdret = brcmf_sdcard_recv_buf(card, brcmf_sdcard_cur_sbwad(card), | |
| 3555 | + SDIO_FUNC_2, | |
| 3112 | 3556 | F2SYNC, (bus->rxctl + firstread), rdlen, |
| 3113 | 3557 | NULL, NULL, NULL); |
| 3114 | 3558 | bus->f2rxdata++; |
| 3115 | − ASSERT(sdret != -BCME_PENDING); | |
| 3116 | 3559 | |
| 3117 | 3560 | /* Control frame failures need retransmission */ |
| 3118 | 3561 | if (sdret < 0) { |
| 3119 | − DHD_ERROR(("%s: read %d control bytes failed: %d\n", | |
| 3120 | − __func__, rdlen, sdret)); | |
| 3121 | − bus->rxc_errors++; /* dhd.rx_ctlerrs is higher level */ | |
| 3122 | − dhdsdio_rxfail(bus, true, true); | |
| 3562 | + BRCMF_ERROR(("%s: read %d control bytes failed: %d\n", | |
| 3563 | + __func__, rdlen, sdret)); | |
| 3564 | + bus->rxc_errors++; | |
| 3565 | + brcmf_sdbrcm_rxfail(bus, true, true); | |
| 3123 | 3566 | goto done; |
| 3124 | 3567 | } |
| 3125 | 3568 | |
| 3126 | 3569 | gotpkt: |
| 3127 | 3570 | |
| 3128 | −#ifdef DHD_DEBUG | |
| 3129 | − if (DHD_BYTES_ON() && DHD_CTL_ON()) { | |
| 3571 | +#ifdef BCMDBG | |
| 3572 | + if (BRCMF_BYTES_ON() && BRCMF_CTL_ON()) { | |
| 3130 | 3573 | printk(KERN_DEBUG "RxCtrl:\n"); |
| 3131 | 3574 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, bus->rxctl, len); |
| 3132 | 3575 | } |
| @@ -3138,10 +3581,10 @@ gotpkt: · 5 unmodified lines | ||
| 3138 | 3581 | |
| 3139 | 3582 | done: |
| 3140 | 3583 | /* Awake any waiters */ |
| 3141 | − dhd_os_ioctl_resp_wake(bus->dhd); | |
| 3584 | + brcmf_os_ioctl_resp_wake(bus->drvr); | |
| 3142 | 3585 | } |
| 3143 | 3586 | |
| 3144 | −static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) | |
| 3587 | +static u8 brcmf_sdbrcm_rxglom(struct brcmf_bus *bus, u8 rxseq) | |
| 3145 | 3588 | { |
| 3146 | 3589 | u16 dlen, totlen; |
| 3147 | 3590 | u8 *dptr, num = 0; |
| @@ -3159,19 +3602,18 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 11 unmodified lines | ||
| 3159 | 3602 | /* If packets, issue read(s) and send up packet chain */ |
| 3160 | 3603 | /* Return sequence numbers consumed? */ |
| 3161 | 3604 | |
| 3162 | − DHD_TRACE(("dhdsdio_rxglom: start: glomd %p glom %p\n", bus->glomd, | |
| 3163 | − bus->glom)); | |
| 3605 | + BRCMF_TRACE(("brcmf_sdbrcm_rxglom: start: glomd %p glom %p\n", | |
| 3606 | + bus->glomd, bus->glom)); | |
| 3164 | 3607 | |
| 3165 | 3608 | /* If there's a descriptor, generate the packet chain */ |
| 3166 | 3609 | if (bus->glomd) { |
| 3167 | − dhd_os_sdlock_rxq(bus->dhd); | |
| 3168 | − | |
| 3169 | 3610 | pfirst = plast = pnext = NULL; |
| 3170 | 3611 | dlen = (u16) (bus->glomd->len); |
| 3171 | 3612 | dptr = bus->glomd->data; |
| 3172 | 3613 | if (!dlen || (dlen & 1)) { |
| 3173 | − DHD_ERROR(("%s: bad glomd len(%d), ignore descriptor\n", | |
| 3174 | − __func__, dlen)); | |
| 3614 | + BRCMF_ERROR(("%s: bad glomd len(%d)," | |
| 3615 | + " ignore descriptor\n", | |
| 3616 | + __func__, dlen)); | |
| 3175 | 3617 | dlen = 0; |
| 3176 | 3618 | } |
| 3177 | 3619 | |
| @@ -3182,14 +3624,15 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 4 unmodified lines | ||
| 3182 | 3624 | dptr += sizeof(u16); |
| 3183 | 3625 | if ((sublen < SDPCM_HDRLEN) || |
| 3184 | 3626 | ((num == 0) && (sublen < (2 * SDPCM_HDRLEN)))) { |
| 3185 | − DHD_ERROR(("%s: descriptor len %d bad: %d\n", | |
| 3186 | − __func__, num, sublen)); | |
| 3627 | + BRCMF_ERROR(("%s: descriptor len %d bad: %d\n", | |
| 3628 | + __func__, num, sublen)); | |
| 3187 | 3629 | pnext = NULL; |
| 3188 | 3630 | break; |
| 3189 | 3631 | } |
| 3190 | − if (sublen % DHD_SDALIGN) { | |
| 3191 | − DHD_ERROR(("%s: sublen %d not multiple of %d\n", | |
| 3192 | − __func__, sublen, DHD_SDALIGN)); | |
| 3632 | + if (sublen % BRCMF_SDALIGN) { | |
| 3633 | + BRCMF_ERROR(("%s: sublen %d not multiple of" | |
| 3634 | + " %d\n", __func__, sublen, | |
| 3635 | + BRCMF_SDALIGN)); | |
| 3193 | 3636 | usechain = false; |
| 3194 | 3637 | } |
| 3195 | 3638 | totlen += sublen; |
| @@ -3203,123 +3646,120 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 7 unmodified lines | ||
| 3203 | 3646 | } |
| 3204 | 3647 | |
| 3205 | 3648 | /* Allocate/chain packet for next subframe */ |
| 3206 | − pnext = bcm_pkt_buf_get_skb(sublen + DHD_SDALIGN); | |
| 3649 | + pnext = brcmu_pkt_buf_get_skb(sublen + BRCMF_SDALIGN); | |
| 3207 | 3650 | if (pnext == NULL) { |
| 3208 | − DHD_ERROR(("%s: bcm_pkt_buf_get_skb failed, " | |
| 3209 | − "num %d len %d\n", __func__, | |
| 3210 | − num, sublen)); | |
| 3651 | + BRCMF_ERROR(("%s: bcm_pkt_buf_get_skb failed, " | |
| 3652 | + "num %d len %d\n", __func__, | |
| 3653 | + num, sublen)); | |
| 3211 | 3654 | break; |
| 3212 | 3655 | } |
| 3213 | − ASSERT(!(pnext->prev)); | |
| 3214 | 3656 | if (!pfirst) { |
| 3215 | − ASSERT(!plast); | |
| 3216 | 3657 | pfirst = plast = pnext; |
| 3217 | 3658 | } else { |
| 3218 | − ASSERT(plast); | |
| 3219 | 3659 | plast->next = pnext; |
| 3220 | 3660 | plast = pnext; |
| 3221 | 3661 | } |
| 3222 | 3662 | |
| 3223 | 3663 | /* Adhere to start alignment requirements */ |
| 3224 | − PKTALIGN(pnext, sublen, DHD_SDALIGN); | |
| 3664 | + PKTALIGN(pnext, sublen, BRCMF_SDALIGN); | |
| 3225 | 3665 | } |
| 3226 | 3666 | |
| 3227 | 3667 | /* If all allocations succeeded, save packet chain |
| 3228 | 3668 | in bus structure */ |
| 3229 | 3669 | if (pnext) { |
| 3230 | − DHD_GLOM(("%s: allocated %d-byte packet chain for %d " | |
| 3231 | − "subframes\n", __func__, totlen, num)); | |
| 3232 | − if (DHD_GLOM_ON() && bus->nextlen) { | |
| 3670 | + BRCMF_GLOM(("%s: allocated %d-byte packet chain for %d " | |
| 3671 | + "subframes\n", __func__, totlen, num)); | |
| 3672 | + if (BRCMF_GLOM_ON() && bus->nextlen) { | |
| 3233 | 3673 | if (totlen != bus->nextlen) { |
| 3234 | − DHD_GLOM(("%s: glomdesc mismatch: nextlen %d glomdesc %d " "rxseq %d\n", | |
| 3235 | − __func__, bus->nextlen, | |
| 3236 | − totlen, rxseq)); | |
| 3674 | + BRCMF_GLOM(("%s: glomdesc mismatch: " | |
| 3675 | + "nextlen %d glomdesc %d " | |
| 3676 | + "rxseq %d\n", __func__, | |
| 3677 | + bus->nextlen, | |
| 3678 | + totlen, rxseq)); | |
| 3237 | 3679 | } |
| 3238 | 3680 | } |
| 3239 | 3681 | bus->glom = pfirst; |
| 3240 | 3682 | pfirst = pnext = NULL; |
| 3241 | 3683 | } else { |
| 3242 | 3684 | if (pfirst) |
| 3243 | − bcm_pkt_buf_free_skb(pfirst); | |
| 3685 | + brcmu_pkt_buf_free_skb(pfirst); | |
| 3244 | 3686 | bus->glom = NULL; |
| 3245 | 3687 | num = 0; |
| 3246 | 3688 | } |
| 3247 | 3689 | |
| 3248 | 3690 | /* Done with descriptor packet */ |
| 3249 | − bcm_pkt_buf_free_skb(bus->glomd); | |
| 3691 | + brcmu_pkt_buf_free_skb(bus->glomd); | |
| 3250 | 3692 | bus->glomd = NULL; |
| 3251 | 3693 | bus->nextlen = 0; |
| 3252 | − | |
| 3253 | − dhd_os_sdunlock_rxq(bus->dhd); | |
| 3254 | 3694 | } |
| 3255 | 3695 | |
| 3256 | 3696 | /* Ok -- either we just generated a packet chain, |
| 3257 | 3697 | or had one from before */ |
| 3258 | 3698 | if (bus->glom) { |
| 3259 | − if (DHD_GLOM_ON()) { | |
| 3260 | − DHD_GLOM(("%s: try superframe read, packet chain:\n", | |
| 3261 | − __func__)); | |
| 3699 | + if (BRCMF_GLOM_ON()) { | |
| 3700 | + BRCMF_GLOM(("%s: try superframe read, packet chain:\n", | |
| 3701 | + __func__)); | |
| 3262 | 3702 | for (pnext = bus->glom; pnext; pnext = pnext->next) { |
| 3263 | − DHD_GLOM((" %p: %p len 0x%04x (%d)\n", | |
| 3264 | − pnext, (u8 *) (pnext->data), | |
| 3265 | − pnext->len, pnext->len)); | |
| 3703 | + BRCMF_GLOM((" %p: %p len 0x%04x (%d)\n", | |
| 3704 | + pnext, (u8 *) (pnext->data), | |
| 3705 | + pnext->len, pnext->len)); | |
| 3266 | 3706 | } |
| 3267 | 3707 | } |
| 3268 | 3708 | |
| 3269 | 3709 | pfirst = bus->glom; |
| 3270 | − dlen = (u16) bcm_pkttotlen(pfirst); | |
| 3710 | + dlen = (u16) brcmu_pkttotlen(pfirst); | |
| 3271 | 3711 | |
| 3272 | 3712 | /* Do an SDIO read for the superframe. Configurable iovar to |
| 3273 | 3713 | * read directly into the chained packet, or allocate a large |
| 3274 | 3714 | * packet and and copy into the chain. |
| 3275 | 3715 | */ |
| 3276 | 3716 | if (usechain) { |
| 3277 | − errcode = bcmsdh_recv_buf(bus, | |
| 3278 | − bcmsdh_cur_sbwad(bus->sdh), SDIO_FUNC_2, | |
| 3717 | + errcode = brcmf_sdcard_recv_buf(bus->card, | |
| 3718 | + brcmf_sdcard_cur_sbwad(bus->card), | |
| 3719 | + SDIO_FUNC_2, | |
| 3279 | 3720 | F2SYNC, (u8 *) pfirst->data, dlen, |
| 3280 | 3721 | pfirst, NULL, NULL); |
| 3281 | 3722 | } else if (bus->dataptr) { |
| 3282 | − errcode = bcmsdh_recv_buf(bus, | |
| 3283 | − bcmsdh_cur_sbwad(bus->sdh), SDIO_FUNC_2, | |
| 3723 | + errcode = brcmf_sdcard_recv_buf(bus->card, | |
| 3724 | + brcmf_sdcard_cur_sbwad(bus->card), | |
| 3725 | + SDIO_FUNC_2, | |
| 3284 | 3726 | F2SYNC, bus->dataptr, dlen, |
| 3285 | 3727 | NULL, NULL, NULL); |
| 3286 | − sublen = (u16) bcm_pktfrombuf(pfirst, 0, dlen, | |
| 3728 | + sublen = (u16) brcmu_pktfrombuf(pfirst, 0, dlen, | |
| 3287 | 3729 | bus->dataptr); |
| 3288 | 3730 | if (sublen != dlen) { |
| 3289 | − DHD_ERROR(("%s: FAILED TO COPY, dlen %d sublen %d\n", | |
| 3290 | − __func__, dlen, sublen)); | |
| 3731 | + BRCMF_ERROR(("%s: FAILED TO COPY, dlen %d " | |
| 3732 | + "sublen %d\n", | |
| 3733 | + __func__, dlen, sublen)); | |
| 3291 | 3734 | errcode = -1; |
| 3292 | 3735 | } |
| 3293 | 3736 | pnext = NULL; |
| 3294 | 3737 | } else { |
| 3295 | − DHD_ERROR(("COULDN'T ALLOC %d-BYTE GLOM, FORCE FAILURE\n", | |
| 3296 | − dlen)); | |
| 3738 | + BRCMF_ERROR(("COULDN'T ALLOC %d-BYTE GLOM, " | |
| 3739 | + "FORCE FAILURE\n", dlen)); | |
| 3297 | 3740 | errcode = -1; |
| 3298 | 3741 | } |
| 3299 | 3742 | bus->f2rxdata++; |
| 3300 | − ASSERT(errcode != -BCME_PENDING); | |
| 3301 | 3743 | |
| 3302 | 3744 | /* On failure, kill the superframe, allow a couple retries */ |
| 3303 | 3745 | if (errcode < 0) { |
| 3304 | − DHD_ERROR(("%s: glom read of %d bytes failed: %d\n", | |
| 3305 | − __func__, dlen, errcode)); | |
| 3306 | − bus->dhd->rx_errors++; | |
| 3746 | + BRCMF_ERROR(("%s: glom read of %d bytes failed: %d\n", | |
| 3747 | + __func__, dlen, errcode)); | |
| 3748 | + bus->drvr->rx_errors++; | |
| 3307 | 3749 | |
| 3308 | 3750 | if (bus->glomerr++ < 3) { |
| 3309 | − dhdsdio_rxfail(bus, true, true); | |
| 3751 | + brcmf_sdbrcm_rxfail(bus, true, true); | |
| 3310 | 3752 | } else { |
| 3311 | 3753 | bus->glomerr = 0; |
| 3312 | − dhdsdio_rxfail(bus, true, false); | |
| 3313 | − dhd_os_sdlock_rxq(bus->dhd); | |
| 3314 | − bcm_pkt_buf_free_skb(bus->glom); | |
| 3315 | − dhd_os_sdunlock_rxq(bus->dhd); | |
| 3754 | + brcmf_sdbrcm_rxfail(bus, true, false); | |
| 3755 | + brcmu_pkt_buf_free_skb(bus->glom); | |
| 3316 | 3756 | bus->rxglomfail++; |
| 3317 | 3757 | bus->glom = NULL; |
| 3318 | 3758 | } |
| 3319 | 3759 | return 0; |
| 3320 | 3760 | } |
| 3321 | −#ifdef DHD_DEBUG | |
| 3322 | − if (DHD_GLOM_ON()) { | |
| 3761 | +#ifdef BCMDBG | |
| 3762 | + if (BRCMF_GLOM_ON()) { | |
| 3323 | 3763 | printk(KERN_DEBUG "SUPERFRAME:\n"); |
| 3324 | 3764 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, |
| 3325 | 3765 | pfirst->data, min_t(int, pfirst->len, 48)); |
| @@ -3335,8 +3775,8 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 9 unmodified lines | ||
| 3335 | 3775 | seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]); |
| 3336 | 3776 | bus->nextlen = dptr[SDPCM_FRAMETAG_LEN + SDPCM_NEXTLEN_OFFSET]; |
| 3337 | 3777 | if ((bus->nextlen << 4) > MAX_RX_DATASZ) { |
| 3338 | − DHD_INFO(("%s: nextlen too large (%d) seq %d\n", | |
| 3339 | − __func__, bus->nextlen, seq)); | |
| 3778 | + BRCMF_INFO(("%s: nextlen too large (%d) seq %d\n", | |
| 3779 | + __func__, bus->nextlen, seq)); | |
| 3340 | 3780 | bus->nextlen = 0; |
| 3341 | 3781 | } |
| 3342 | 3782 | doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]); |
| @@ -3344,47 +3784,48 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 1 unmodified line | ||
| 3344 | 3784 | |
| 3345 | 3785 | errcode = 0; |
| 3346 | 3786 | if ((u16)~(sublen ^ check)) { |
| 3347 | − DHD_ERROR(("%s (superframe): HW hdr error: len/check " | |
| 3348 | − "0x%04x/0x%04x\n", __func__, sublen, check)); | |
| 3787 | + BRCMF_ERROR(("%s (superframe): HW hdr error: len/check " | |
| 3788 | + "0x%04x/0x%04x\n", __func__, sublen, | |
| 3789 | + check)); | |
| 3349 | 3790 | errcode = -1; |
| 3350 | 3791 | } else if (roundup(sublen, bus->blocksize) != dlen) { |
| 3351 | − DHD_ERROR(("%s (superframe): len 0x%04x, rounded " | |
| 3352 | − "0x%04x, expect 0x%04x\n", | |
| 3353 | − __func__, sublen, | |
| 3354 | − roundup(sublen, bus->blocksize), dlen)); | |
| 3792 | + BRCMF_ERROR(("%s (superframe): len 0x%04x, rounded " | |
| 3793 | + "0x%04x, expect 0x%04x\n", | |
| 3794 | + __func__, sublen, | |
| 3795 | + roundup(sublen, bus->blocksize), dlen)); | |
| 3355 | 3796 | errcode = -1; |
| 3356 | 3797 | } else if (SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]) != |
| 3357 | 3798 | SDPCM_GLOM_CHANNEL) { |
| 3358 | − DHD_ERROR(("%s (superframe): bad channel %d\n", | |
| 3799 | + BRCMF_ERROR(("%s (superframe): bad channel %d\n", | |
| 3359 | 3800 | __func__, |
| 3360 | 3801 | SDPCM_PACKET_CHANNEL(&dptr |
| 3361 | 3802 | [SDPCM_FRAMETAG_LEN]))); |
| 3362 | 3803 | errcode = -1; |
| 3363 | 3804 | } else if (SDPCM_GLOMDESC(&dptr[SDPCM_FRAMETAG_LEN])) { |
| 3364 | − DHD_ERROR(("%s (superframe): got second descriptor?\n", | |
| 3365 | − __func__)); | |
| 3805 | + BRCMF_ERROR(("%s (superframe): got 2nd descriptor?\n", | |
| 3806 | + __func__)); | |
| 3366 | 3807 | errcode = -1; |
| 3367 | 3808 | } else if ((doff < SDPCM_HDRLEN) || |
| 3368 | 3809 | (doff > (pfirst->len - SDPCM_HDRLEN))) { |
| 3369 | − DHD_ERROR(("%s (superframe): Bad data offset %d: HW %d " | |
| 3370 | − "pkt %d min %d\n", | |
| 3371 | − __func__, doff, sublen, | |
| 3372 | − pfirst->len, SDPCM_HDRLEN)); | |
| 3810 | + BRCMF_ERROR(("%s (superframe): Bad data offset %d: " | |
| 3811 | + "HW %d pkt %d min %d\n", | |
| 3812 | + __func__, doff, sublen, | |
| 3813 | + pfirst->len, SDPCM_HDRLEN)); | |
| 3373 | 3814 | errcode = -1; |
| 3374 | 3815 | } |
| 3375 | 3816 | |
| 3376 | 3817 | /* Check sequence number of superframe SW header */ |
| 3377 | 3818 | if (rxseq != seq) { |
| 3378 | − DHD_INFO(("%s: (superframe) rx_seq %d, expected %d\n", | |
| 3379 | − __func__, seq, rxseq)); | |
| 3819 | + BRCMF_INFO(("%s: (superframe) rx_seq %d, expected %d\n", | |
| 3820 | + __func__, seq, rxseq)); | |
| 3380 | 3821 | bus->rx_badseq++; |
| 3381 | 3822 | rxseq = seq; |
| 3382 | 3823 | } |
| 3383 | 3824 | |
| 3384 | 3825 | /* Check window for sanity */ |
| 3385 | 3826 | if ((u8) (txmax - bus->tx_seq) > 0x40) { |
| 3386 | − DHD_ERROR(("%s: unlikely tx max %d with tx_seq %d\n", | |
| 3387 | − __func__, txmax, bus->tx_seq)); | |
| 3827 | + BRCMF_ERROR(("%s: unlikely tx max %d with tx_seq %d\n", | |
| 3828 | + __func__, txmax, bus->tx_seq)); | |
| 3388 | 3829 | txmax = bus->tx_seq + 2; |
| 3389 | 3830 | } |
| 3390 | 3831 | bus->tx_max = txmax; |
| @@ -3402,8 +3843,8 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 11 unmodified lines | ||
| 3402 | 3843 | check = get_unaligned_le16(dptr + sizeof(u16)); |
| 3403 | 3844 | chan = SDPCM_PACKET_CHANNEL(&dptr[SDPCM_FRAMETAG_LEN]); |
| 3404 | 3845 | doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]); |
| 3405 | −#ifdef DHD_DEBUG | |
| 3406 | − if (DHD_GLOM_ON()) { | |
| 3846 | +#ifdef BCMDBG | |
| 3847 | + if (BRCMF_GLOM_ON()) { | |
| 3407 | 3848 | printk(KERN_DEBUG "subframe:\n"); |
| 3408 | 3849 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, |
| 3409 | 3850 | dptr, 32); |
| @@ -3411,24 +3852,25 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 1 unmodified line | ||
| 3411 | 3852 | #endif |
| 3412 | 3853 | |
| 3413 | 3854 | if ((u16)~(sublen ^ check)) { |
| 3414 | − DHD_ERROR(("%s (subframe %d): HW hdr error: " | |
| 3415 | − "len/check 0x%04x/0x%04x\n", | |
| 3416 | − __func__, num, sublen, check)); | |
| 3855 | + BRCMF_ERROR(("%s (subframe %d): HW hdr error: " | |
| 3856 | + "len/check 0x%04x/0x%04x\n", | |
| 3857 | + __func__, num, sublen, check)); | |
| 3417 | 3858 | errcode = -1; |
| 3418 | 3859 | } else if ((sublen > dlen) || (sublen < SDPCM_HDRLEN)) { |
| 3419 | − DHD_ERROR(("%s (subframe %d): length mismatch: " | |
| 3420 | − "len 0x%04x, expect 0x%04x\n", | |
| 3421 | − __func__, num, sublen, dlen)); | |
| 3860 | + BRCMF_ERROR(("%s (subframe %d): length mismatch" | |
| 3861 | + ": len 0x%04x, expect 0x%04x\n", | |
| 3862 | + __func__, num, sublen, dlen)); | |
| 3422 | 3863 | errcode = -1; |
| 3423 | 3864 | } else if ((chan != SDPCM_DATA_CHANNEL) && |
| 3424 | 3865 | (chan != SDPCM_EVENT_CHANNEL)) { |
| 3425 | − DHD_ERROR(("%s (subframe %d): bad channel %d\n", | |
| 3426 | − __func__, num, chan)); | |
| 3866 | + BRCMF_ERROR(("%s (subframe %d): bad channel" | |
| 3867 | + " %d\n", __func__, num, chan)); | |
| 3427 | 3868 | errcode = -1; |
| 3428 | 3869 | } else if ((doff < SDPCM_HDRLEN) || (doff > sublen)) { |
| 3429 | − DHD_ERROR(("%s (subframe %d): Bad data offset %d: HW %d min %d\n", | |
| 3430 | − __func__, num, doff, sublen, | |
| 3431 | − SDPCM_HDRLEN)); | |
| 3870 | + BRCMF_ERROR(("%s (subframe %d): Bad data offset" | |
| 3871 | + " %d: HW %d min %d\n", | |
| 3872 | + __func__, num, doff, sublen, | |
| 3873 | + SDPCM_HDRLEN)); | |
| 3432 | 3874 | errcode = -1; |
| 3433 | 3875 | } |
| 3434 | 3876 | } |
| @@ -3439,13 +3881,11 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 4 unmodified lines | ||
| 3439 | 3881 | if (bus->glomerr++ < 3) { |
| 3440 | 3882 | /* Restore superframe header space */ |
| 3441 | 3883 | skb_push(pfirst, sfdoff); |
| 3442 | − dhdsdio_rxfail(bus, true, true); | |
| 3884 | + brcmf_sdbrcm_rxfail(bus, true, true); | |
| 3443 | 3885 | } else { |
| 3444 | 3886 | bus->glomerr = 0; |
| 3445 | − dhdsdio_rxfail(bus, true, false); | |
| 3446 | − dhd_os_sdlock_rxq(bus->dhd); | |
| 3447 | − bcm_pkt_buf_free_skb(bus->glom); | |
| 3448 | − dhd_os_sdunlock_rxq(bus->dhd); | |
| 3887 | + brcmf_sdbrcm_rxfail(bus, true, false); | |
| 3888 | + brcmu_pkt_buf_free_skb(bus->glom); | |
| 3449 | 3889 | bus->rxglomfail++; |
| 3450 | 3890 | bus->glom = NULL; |
| 3451 | 3891 | } |
| @@ -3458,7 +3898,6 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 6 unmodified lines | ||
| 3458 | 3898 | bus->glom = NULL; |
| 3459 | 3899 | plast = NULL; |
| 3460 | 3900 | |
| 3461 | − dhd_os_sdlock_rxq(bus->dhd); | |
| 3462 | 3901 | for (num = 0; pfirst; rxseq++, pfirst = pnext) { |
| 3463 | 3902 | pnext = pfirst->next; |
| 3464 | 3903 | pfirst->next = NULL; |
| @@ -3469,22 +3908,22 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 4 unmodified lines | ||
| 3469 | 3908 | seq = SDPCM_PACKET_SEQUENCE(&dptr[SDPCM_FRAMETAG_LEN]); |
| 3470 | 3909 | doff = SDPCM_DOFFSET_VALUE(&dptr[SDPCM_FRAMETAG_LEN]); |
| 3471 | 3910 | |
| 3472 | − DHD_GLOM(("%s: Get subframe %d, %p(%p/%d), sublen %d " | |
| 3473 | − "chan %d seq %d\n", | |
| 3474 | − __func__, num, pfirst, pfirst->data, | |
| 3475 | − pfirst->len, sublen, chan, seq)); | |
| 3911 | + BRCMF_GLOM(("%s: Get subframe %d, %p(%p/%d), sublen %d " | |
| 3912 | + "chan %d seq %d\n", | |
| 3913 | + __func__, num, pfirst, pfirst->data, | |
| 3914 | + pfirst->len, sublen, chan, seq)); | |
| 3476 | 3915 | |
| 3477 | − ASSERT((chan == SDPCM_DATA_CHANNEL) | |
| 3478 | − || (chan == SDPCM_EVENT_CHANNEL)); | |
| 3916 | + /* precondition: chan == SDPCM_DATA_CHANNEL || | |
| 3917 | + chan == SDPCM_EVENT_CHANNEL */ | |
| 3479 | 3918 | |
| 3480 | 3919 | if (rxseq != seq) { |
| 3481 | − DHD_GLOM(("%s: rx_seq %d, expected %d\n", | |
| 3482 | − __func__, seq, rxseq)); | |
| 3920 | + BRCMF_GLOM(("%s: rx_seq %d, expected %d\n", | |
| 3921 | + __func__, seq, rxseq)); | |
| 3483 | 3922 | bus->rx_badseq++; |
| 3484 | 3923 | rxseq = seq; |
| 3485 | 3924 | } |
| 3486 | −#ifdef DHD_DEBUG | |
| 3487 | − if (DHD_BYTES_ON() && DHD_DATA_ON()) { | |
| 3925 | +#ifdef BCMDBG | |
| 3926 | + if (BRCMF_BYTES_ON() && BRCMF_DATA_ON()) { | |
| 3488 | 3927 | printk(KERN_DEBUG "Rx Subframe Data:\n"); |
| 3489 | 3928 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, |
| 3490 | 3929 | dptr, dlen); |
| @@ -3495,24 +3934,22 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 4 unmodified lines | ||
| 3495 | 3934 | skb_pull(pfirst, doff); |
| 3496 | 3935 | |
| 3497 | 3936 | if (pfirst->len == 0) { |
| 3498 | − bcm_pkt_buf_free_skb(pfirst); | |
| 3937 | + brcmu_pkt_buf_free_skb(pfirst); | |
| 3499 | 3938 | if (plast) { |
| 3500 | 3939 | plast->next = pnext; |
| 3501 | 3940 | } else { |
| 3502 | − ASSERT(save_pfirst == pfirst); | |
| 3503 | 3941 | save_pfirst = pnext; |
| 3504 | 3942 | } |
| 3505 | 3943 | continue; |
| 3506 | − } else if (dhd_prot_hdrpull(bus->dhd, &ifidx, pfirst) != | |
| 3507 | − 0) { | |
| 3508 | − DHD_ERROR(("%s: rx protocol error\n", | |
| 3509 | − __func__)); | |
| 3510 | − bus->dhd->rx_errors++; | |
| 3511 | − bcm_pkt_buf_free_skb(pfirst); | |
| 3944 | + } else if (brcmf_proto_hdrpull(bus->drvr, &ifidx, pfirst) | |
| 3945 | + != 0) { | |
| 3946 | + BRCMF_ERROR(("%s: rx protocol error\n", | |
| 3947 | + __func__)); | |
| 3948 | + bus->drvr->rx_errors++; | |
| 3949 | + brcmu_pkt_buf_free_skb(pfirst); | |
| 3512 | 3950 | if (plast) { |
| 3513 | 3951 | plast->next = pnext; |
| 3514 | 3952 | } else { |
| 3515 | − ASSERT(save_pfirst == pfirst); | |
| 3516 | 3953 | save_pfirst = pnext; |
| 3517 | 3954 | } |
| 3518 | 3955 | continue; |
| @@ -3524,24 +3961,23 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 5 unmodified lines | ||
| 3524 | 3961 | plast = pfirst; |
| 3525 | 3962 | num++; |
| 3526 | 3963 | |
| 3527 | −#ifdef DHD_DEBUG | |
| 3528 | − if (DHD_GLOM_ON()) { | |
| 3529 | − DHD_GLOM(("%s subframe %d to stack, %p(%p/%d) " | |
| 3530 | − "nxt/lnk %p/%p\n", | |
| 3531 | − __func__, num, pfirst, pfirst->data, | |
| 3532 | − pfirst->len, pfirst->next, | |
| 3533 | − pfirst->prev)); | |
| 3964 | +#ifdef BCMDBG | |
| 3965 | + if (BRCMF_GLOM_ON()) { | |
| 3966 | + BRCMF_GLOM(("%s subframe %d to stack, %p" | |
| 3967 | + "(%p/%d) nxt/lnk %p/%p\n", | |
| 3968 | + __func__, num, pfirst, pfirst->data, | |
| 3969 | + pfirst->len, pfirst->next, | |
| 3970 | + pfirst->prev)); | |
| 3534 | 3971 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, |
| 3535 | 3972 | pfirst->data, |
| 3536 | 3973 | min_t(int, pfirst->len, 32)); |
| 3537 | 3974 | } |
| 3538 | −#endif /* DHD_DEBUG */ | |
| 3975 | +#endif /* BCMDBG */ | |
| 3539 | 3976 | } |
| 3540 | − dhd_os_sdunlock_rxq(bus->dhd); | |
| 3541 | 3977 | if (num) { |
| 3542 | − dhd_os_sdunlock(bus->dhd); | |
| 3543 | − dhd_rx_frame(bus->dhd, ifidx, save_pfirst, num); | |
| 3544 | − dhd_os_sdlock(bus->dhd); | |
| 3978 | + brcmf_sdbrcm_sdunlock(bus); | |
| 3979 | + brcmf_rx_frame(bus->drvr, ifidx, save_pfirst, num); | |
| 3980 | + brcmf_sdbrcm_sdlock(bus); | |
| 3545 | 3981 | } |
| 3546 | 3982 | |
| 3547 | 3983 | bus->rxglomframes++; |
| @@ -3551,9 +3987,10 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq) · 3 unmodified lines | ||
| 3551 | 3987 | } |
| 3552 | 3988 | |
| 3553 | 3989 | /* Return true if there may be more frames to read */ |
| 3554 | −static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) | |
| 3990 | +static uint | |
| 3991 | +brcmf_sdbrcm_readframes(struct brcmf_bus *bus, uint maxframes, bool *finished) | |
| 3555 | 3992 | { |
| 3556 | − bcmsdh_info_t *sdh = bus->sdh; | |
| 3993 | + struct brcmf_sdio_card *card = bus->card; | |
| 3557 | 3994 | |
| 3558 | 3995 | u16 len, check; /* Extracted hardware header fields */ |
| 3559 | 3996 | u8 chan, seq, doff; /* Extracted software header fields */ |
| @@ -3564,7 +4001,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 4 unmodified lines | ||
| 3564 | 4001 | u16 rdlen; /* Total number of bytes to read */ |
| 3565 | 4002 | u8 rxseq; /* Next sequence number to expect */ |
| 3566 | 4003 | uint rxleft = 0; /* Remaining number of frames allowed */ |
| 3567 | − int sdret; /* Return code from bcmsdh calls */ | |
| 4004 | + int sdret; /* Return code from calls */ | |
| 3568 | 4005 | u8 txmax; /* Maximum tx sequence offered */ |
| 3569 | 4006 | bool len_consistent; /* Result of comparing readahead len and |
| 3570 | 4007 | len from hw-hdr */ |
| @@ -3572,17 +4009,15 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 1 unmodified line | ||
| 3572 | 4009 | int ifidx = 0; |
| 3573 | 4010 | uint rxcount = 0; /* Total frames read */ |
| 3574 | 4011 | |
| 3575 | −#if defined(DHD_DEBUG) || defined(SDTEST) | |
| 4012 | +#if defined(BCMDBG) || defined(SDTEST) | |
| 3576 | 4013 | bool sdtest = false; /* To limit message spew from test mode */ |
| 3577 | 4014 | #endif |
| 3578 | 4015 | |
| 3579 | − DHD_TRACE(("%s: Enter\n", __func__)); | |
| 3580 | − | |
| 3581 | − ASSERT(maxframes); | |
| 4016 | + BRCMF_TRACE(("%s: Enter\n", __func__)); | |
| 3582 | 4017 | |
| 3583 | 4018 | #ifdef SDTEST |
| 3584 | 4019 | /* Allow pktgen to override maxframes */ |
| 3585 | − if (bus->pktgen_count && (bus->pktgen_mode == DHD_PKTGEN_RECV)) { | |
| 4020 | + if (bus->pktgen_count && (bus->pktgen_mode == BRCMF_PKTGEN_RECV)) { | |
| 3586 | 4021 | maxframes = bus->pktgen_count; |
| 3587 | 4022 | sdtest = true; |
| 3588 | 4023 | } |
| @@ -3592,23 +4027,23 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 3 unmodified lines | ||
| 3592 | 4027 | *finished = false; |
| 3593 | 4028 | |
| 3594 | 4029 | for (rxseq = bus->rx_seq, rxleft = maxframes; |
| 3595 | − !bus->rxskip && rxleft && bus->dhd->busstate != DHD_BUS_DOWN; | |
| 4030 | + !bus->rxskip && rxleft && bus->drvr->busstate != BRCMF_BUS_DOWN; | |
| 3596 | 4031 | rxseq++, rxleft--) { |
| 3597 | 4032 | |
| 3598 | 4033 | /* Handle glomming separately */ |
| 3599 | 4034 | if (bus->glom || bus->glomd) { |
| 3600 | 4035 | u8 cnt; |
| 3601 | − DHD_GLOM(("%s: calling rxglom: glomd %p, glom %p\n", | |
| 3602 | − __func__, bus->glomd, bus->glom)); | |
| 3603 | − cnt = dhdsdio_rxglom(bus, rxseq); | |
| 3604 | − DHD_GLOM(("%s: rxglom returned %d\n", __func__, cnt)); | |
| 4036 | + BRCMF_GLOM(("%s: calling rxglom: glomd %p, glom %p\n", | |
| 4037 | + __func__, bus->glomd, bus->glom)); | |
| 4038 | + cnt = brcmf_sdbrcm_rxglom(bus, rxseq); | |
| 4039 | + BRCMF_GLOM(("%s: rxglom returned %d\n", __func__, cnt)); | |
| 3605 | 4040 | rxseq += cnt - 1; |
| 3606 | 4041 | rxleft = (rxleft > cnt) ? (rxleft - cnt) : 1; |
| 3607 | 4042 | continue; |
| 3608 | 4043 | } |
| 3609 | 4044 | |
| 3610 | 4045 | /* Try doing single read if we can */ |
| 3611 | − if (dhd_readahead && bus->nextlen) { | |
| 4046 | + if (brcmf_readahead && bus->nextlen) { | |
| 3612 | 4047 | u16 nextlen = bus->nextlen; |
| 3613 | 4048 | bus->nextlen = 0; |
| 3614 | 4049 | |
| @@ -3628,9 +4063,9 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 13 unmodified lines | ||
| 3628 | 4063 | && ((rdlen + pad + firstread) < |
| 3629 | 4064 | MAX_RX_DATASZ)) |
| 3630 | 4065 | rdlen += pad; |
| 3631 | − } else if (rdlen % DHD_SDALIGN) { | |
| 4066 | + } else if (rdlen % BRCMF_SDALIGN) { | |
| 3632 | 4067 | rdlen += |
| 3633 | − DHD_SDALIGN - (rdlen % DHD_SDALIGN); | |
| 4068 | + BRCMF_SDALIGN - (rdlen % BRCMF_SDALIGN); | |
| 3634 | 4069 | } |
| 3635 | 4070 | } |
| 3636 | 4071 | |
| @@ -3645,42 +4080,40 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 8 unmodified lines | ||
| 3645 | 4080 | * or non-data frame. |
| 3646 | 4081 | */ |
| 3647 | 4082 | /* Allocate a packet buffer */ |
| 3648 | − dhd_os_sdlock_rxq(bus->dhd); | |
| 3649 | − pkt = bcm_pkt_buf_get_skb(rdlen + DHD_SDALIGN); | |
| 4083 | + pkt = brcmu_pkt_buf_get_skb(rdlen + BRCMF_SDALIGN); | |
| 3650 | 4084 | if (!pkt) { |
| 3651 | 4085 | if (bus->bus == SPI_BUS) { |
| 3652 | 4086 | bus->usebufpool = false; |
| 3653 | 4087 | bus->rxctl = bus->rxbuf; |
| 3654 | − if (dhd_alignctl) { | |
| 4088 | + if (brcmf_alignctl) { | |
| 3655 | 4089 | bus->rxctl += firstread; |
| 3656 | 4090 | pad = ((unsigned long)bus->rxctl % |
| 3657 | − DHD_SDALIGN); | |
| 4091 | + BRCMF_SDALIGN); | |
| 3658 | 4092 | if (pad) |
| 3659 | 4093 | bus->rxctl += |
| 3660 | − (DHD_SDALIGN - pad); | |
| 4094 | + (BRCMF_SDALIGN - pad); | |
| 3661 | 4095 | bus->rxctl -= firstread; |
| 3662 | 4096 | } |
| 3663 | − ASSERT(bus->rxctl >= bus->rxbuf); | |
| 3664 | 4097 | rxbuf = bus->rxctl; |
| 3665 | 4098 | /* Read the entire frame */ |
| 3666 | − sdret = bcmsdh_recv_buf(bus, | |
| 3667 | − bcmsdh_cur_sbwad(sdh), | |
| 3668 | − SDIO_FUNC_2, F2SYNC, | |
| 3669 | − rxbuf, rdlen, | |
| 3670 | − NULL, NULL, NULL); | |
| 4099 | + sdret = brcmf_sdcard_recv_buf(card, | |
| 4100 | + brcmf_sdcard_cur_sbwad(card), | |
| 4101 | + SDIO_FUNC_2, F2SYNC, | |
| 4102 | + rxbuf, rdlen, | |
| 4103 | + NULL, NULL, NULL); | |
| 3671 | 4104 | bus->f2rxdata++; |
| 3672 | − ASSERT(sdret != -BCME_PENDING); | |
| 3673 | 4105 | |
| 3674 | 4106 | /* Control frame failures need |
| 3675 | 4107 | retransmission */ |
| 3676 | 4108 | if (sdret < 0) { |
| 3677 | − DHD_ERROR(("%s: read %d control bytes failed: %d\n", | |
| 3678 | − __func__, | |
| 3679 | − rdlen, sdret)); | |
| 4109 | + BRCMF_ERROR(("%s: read %d " | |
| 4110 | + "control bytes " | |
| 4111 | + "failed: %d\n", | |
| 4112 | + __func__, | |
| 4113 | + rdlen, sdret)); | |
| 3680 | 4114 | /* dhd.rx_ctlerrs is higher */ |
| 3681 | 4115 | bus->rxc_errors++; |
| 3682 | − dhd_os_sdunlock_rxq(bus->dhd); | |
| 3683 | − dhdsdio_rxfail(bus, true, | |
| 4116 | + brcmf_sdbrcm_rxfail(bus, true, | |
| 3684 | 4117 | (bus->bus == |
| 3685 | 4118 | SPI_BUS) ? false |
| 3686 | 4119 | : true); |
| @@ -3689,50 +4122,45 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 2 unmodified lines | ||
| 3689 | 4122 | } else { |
| 3690 | 4123 | /* Give up on data, |
| 3691 | 4124 | request rtx of events */ |
| 3692 | − DHD_ERROR(("%s (nextlen): " | |
| 3693 | − "bcm_pkt_buf_get_skb failed:" | |
| 3694 | − " len %d rdlen %d expected" | |
| 3695 | − " rxseq %d\n", __func__, | |
| 3696 | − len, rdlen, rxseq)); | |
| 3697 | − /* Just go try again w/normal | |
| 3698 | − header read */ | |
| 3699 | − dhd_os_sdunlock_rxq(bus->dhd); | |
| 4125 | + BRCMF_ERROR(("%s (nextlen): " | |
| 4126 | + "brcmu_pkt_buf_get_skb " | |
| 4127 | + "failed:" | |
| 4128 | + " len %d rdlen %d expected" | |
| 4129 | + " rxseq %d\n", __func__, | |
| 4130 | + len, rdlen, rxseq)); | |
| 3700 | 4131 | continue; |
| 3701 | 4132 | } |
| 3702 | 4133 | } else { |
| 3703 | 4134 | if (bus->bus == SPI_BUS) |
| 3704 | 4135 | bus->usebufpool = true; |
| 3705 | 4136 | |
| 3706 | − ASSERT(!(pkt->prev)); | |
| 3707 | − PKTALIGN(pkt, rdlen, DHD_SDALIGN); | |
| 4137 | + PKTALIGN(pkt, rdlen, BRCMF_SDALIGN); | |
| 3708 | 4138 | rxbuf = (u8 *) (pkt->data); |
| 3709 | 4139 | /* Read the entire frame */ |
| 3710 | − sdret = bcmsdh_recv_buf(bus, | |
| 3711 | − bcmsdh_cur_sbwad(sdh), | |
| 4140 | + sdret = brcmf_sdcard_recv_buf(card, | |
| 4141 | + brcmf_sdcard_cur_sbwad(card), | |
| 3712 | 4142 | SDIO_FUNC_2, F2SYNC, |
| 3713 | 4143 | rxbuf, rdlen, |
| 3714 | 4144 | pkt, NULL, NULL); |
| 3715 | 4145 | bus->f2rxdata++; |
| 3716 | − ASSERT(sdret != -BCME_PENDING); | |
| 3717 | 4146 | |
| 3718 | 4147 | if (sdret < 0) { |
| 3719 | − DHD_ERROR(("%s (nextlen): read %d bytes failed: %d\n", | |
| 3720 | − __func__, rdlen, sdret)); | |
| 3721 | − bcm_pkt_buf_free_skb(pkt); | |
| 3722 | − bus->dhd->rx_errors++; | |
| 3723 | − dhd_os_sdunlock_rxq(bus->dhd); | |
| 4148 | + BRCMF_ERROR(("%s (nextlen): read %d" | |
| 4149 | + " bytes failed: %d\n", | |
| 4150 | + __func__, rdlen, sdret)); | |
| 4151 | + brcmu_pkt_buf_free_skb(pkt); | |
| 4152 | + bus->drvr->rx_errors++; | |
| 3724 | 4153 | /* Force retry w/normal header read. |
| 3725 | 4154 | * Don't attempt NAK for |
| 3726 | 4155 | * gSPI |
| 3727 | 4156 | */ |
| 3728 | − dhdsdio_rxfail(bus, true, | |
| 4157 | + brcmf_sdbrcm_rxfail(bus, true, | |
| 3729 | 4158 | (bus->bus == |
| 3730 | 4159 | SPI_BUS) ? false : |
| 3731 | 4160 | true); |
| 3732 | 4161 | continue; |
| 3733 | 4162 | } |
| 3734 | 4163 | } |
| 3735 | − dhd_os_sdunlock_rxq(bus->dhd); | |
| 3736 | 4164 | |
| 3737 | 4165 | /* Now check the header */ |
| 3738 | 4166 | memcpy(bus->rxhdr, rxbuf, SDPCM_HDRLEN); |
| @@ -3743,29 +4171,29 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 4 unmodified lines | ||
| 3743 | 4171 | |
| 3744 | 4172 | /* All zeros means readahead info was bad */ |
| 3745 | 4173 | if (!(len | check)) { |
| 3746 | − DHD_INFO(("%s (nextlen): read zeros in HW " | |
| 3747 | − "header???\n", __func__)); | |
| 3748 | − dhdsdio_pktfree2(bus, pkt); | |
| 4174 | + BRCMF_INFO(("%s (nextlen): read zeros in HW " | |
| 4175 | + "header???\n", __func__)); | |
| 4176 | + brcmf_sdbrcm_pktfree2(bus, pkt); | |
| 3749 | 4177 | continue; |
| 3750 | 4178 | } |
| 3751 | 4179 | |
| 3752 | 4180 | /* Validate check bytes */ |
| 3753 | 4181 | if ((u16)~(len ^ check)) { |
| 3754 | − DHD_ERROR(("%s (nextlen): HW hdr error:" | |
| 3755 | − " nextlen/len/check" | |
| 3756 | − " 0x%04x/0x%04x/0x%04x\n", | |
| 3757 | − __func__, nextlen, len, check)); | |
| 4182 | + BRCMF_ERROR(("%s (nextlen): HW hdr error:" | |
| 4183 | + " nextlen/len/check" | |
| 4184 | + " 0x%04x/0x%04x/0x%04x\n", | |
| 4185 | + __func__, nextlen, len, check)); | |
| 3758 | 4186 | bus->rx_badhdr++; |
| 3759 | − dhdsdio_rxfail(bus, false, false); | |
| 3760 | − dhdsdio_pktfree2(bus, pkt); | |
| 4187 | + brcmf_sdbrcm_rxfail(bus, false, false); | |
| 4188 | + brcmf_sdbrcm_pktfree2(bus, pkt); | |
| 3761 | 4189 | continue; |
| 3762 | 4190 | } |
| 3763 | 4191 | |
| 3764 | 4192 | /* Validate frame length */ |
| 3765 | 4193 | if (len < SDPCM_HDRLEN) { |
| 3766 | − DHD_ERROR(("%s (nextlen): HW hdr length " | |
| 3767 | − "invalid: %d\n", __func__, len)); | |
| 3768 | − dhdsdio_pktfree2(bus, pkt); | |
| 4194 | + BRCMF_ERROR(("%s (nextlen): HW hdr length " | |
| 4195 | + "invalid: %d\n", __func__, len)); | |
| 4196 | + brcmf_sdbrcm_pktfree2(bus, pkt); | |
| 3769 | 4197 | continue; |
| 3770 | 4198 | } |
| 3771 | 4199 | |
| @@ -3774,13 +4202,14 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 2 unmodified lines | ||
| 3774 | 4202 | if (len_consistent) { |
| 3775 | 4203 | /* Mismatch, force retry w/normal |
| 3776 | 4204 | header (may be >4K) */ |
| 3777 | − DHD_ERROR(("%s (nextlen): mismatch, " | |
| 3778 | − "nextlen %d len %d rnd %d; " | |
| 3779 | − "expected rxseq %d\n", | |
| 3780 | − __func__, nextlen, | |
| 3781 | − len, roundup(len, 16), rxseq)); | |
| 3782 | − dhdsdio_rxfail(bus, true, (bus->bus != SPI_BUS)); | |
| 3783 | − dhdsdio_pktfree2(bus, pkt); | |
| 4205 | + BRCMF_ERROR(("%s (nextlen): mismatch, " | |
| 4206 | + "nextlen %d len %d rnd %d; " | |
| 4207 | + "expected rxseq %d\n", | |
| 4208 | + __func__, nextlen, | |
| 4209 | + len, roundup(len, 16), rxseq)); | |
| 4210 | + brcmf_sdbrcm_rxfail(bus, true, | |
| 4211 | + bus->bus != SPI_BUS); | |
| 4212 | + brcmf_sdbrcm_pktfree2(bus, pkt); | |
| 3784 | 4213 | continue; |
| 3785 | 4214 | } |
| 3786 | 4215 | |
| @@ -3798,12 +4227,13 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 11 unmodified lines | ||
| 3798 | 4227 | bus->rxhdr[SDPCM_FRAMETAG_LEN + |
| 3799 | 4228 | SDPCM_NEXTLEN_OFFSET]; |
| 3800 | 4229 | if ((bus->nextlen << 4) > MAX_RX_DATASZ) { |
| 3801 | − DHD_INFO(("%s (nextlen): got frame w/nextlen too large" " (%d), seq %d\n", | |
| 3802 | − __func__, bus->nextlen, seq)); | |
| 4230 | + BRCMF_INFO(("%s (nextlen): got frame w/nextlen" | |
| 4231 | + " too large (%d), seq %d\n", | |
| 4232 | + __func__, bus->nextlen, seq)); | |
| 3803 | 4233 | bus->nextlen = 0; |
| 3804 | 4234 | } |
| 3805 | 4235 | |
| 3806 | − bus->dhd->rx_readahead_cnt++; | |
| 4236 | + bus->drvr->rx_readahead_cnt++; | |
| 3807 | 4237 | |
| 3808 | 4238 | /* Handle Flow Control */ |
| 3809 | 4239 | fcbits = SDPCM_FCMASK_VALUE( |
| @@ -3822,27 +4252,27 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 12 unmodified lines | ||
| 3822 | 4252 | |
| 3823 | 4253 | /* Check and update sequence number */ |
| 3824 | 4254 | if (rxseq != seq) { |
| 3825 | − DHD_INFO(("%s (nextlen): rx_seq %d, expected " | |
| 3826 | − "%d\n", __func__, seq, rxseq)); | |
| 4255 | + BRCMF_INFO(("%s (nextlen): rx_seq %d, expected " | |
| 4256 | + "%d\n", __func__, seq, rxseq)); | |
| 3827 | 4257 | bus->rx_badseq++; |
| 3828 | 4258 | rxseq = seq; |
| 3829 | 4259 | } |
| 3830 | 4260 | |
| 3831 | 4261 | /* Check window for sanity */ |
| 3832 | 4262 | if ((u8) (txmax - bus->tx_seq) > 0x40) { |
| 3833 | − DHD_ERROR(("%s: got unlikely tx max %d with " | |
| 3834 | − "tx_seq %d\n", | |
| 3835 | − __func__, txmax, bus->tx_seq)); | |
| 4263 | + BRCMF_ERROR(("%s: got unlikely tx max %d with " | |
| 4264 | + "tx_seq %d\n", | |
| 4265 | + __func__, txmax, bus->tx_seq)); | |
| 3836 | 4266 | txmax = bus->tx_seq + 2; |
| 3837 | 4267 | } |
| 3838 | 4268 | bus->tx_max = txmax; |
| 3839 | 4269 | |
| 3840 | −#ifdef DHD_DEBUG | |
| 3841 | − if (DHD_BYTES_ON() && DHD_DATA_ON()) { | |
| 4270 | +#ifdef BCMDBG | |
| 4271 | + if (BRCMF_BYTES_ON() && BRCMF_DATA_ON()) { | |
| 3842 | 4272 | printk(KERN_DEBUG "Rx Data:\n"); |
| 3843 | 4273 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, |
| 3844 | 4274 | rxbuf, len); |
| 3845 | − } else if (DHD_HDRS_ON()) { | |
| 4275 | + } else if (BRCMF_HDRS_ON()) { | |
| 3846 | 4276 | printk(KERN_DEBUG "RxHdr:\n"); |
| 3847 | 4277 | print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, |
| 3848 | 4278 | bus->rxhdr, SDPCM_HDRLEN); |
| @@ -3851,31 +4281,35 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 2 unmodified lines | ||
| 3851 | 4281 | |
| 3852 | 4282 | if (chan == SDPCM_CONTROL_CHANNEL) { |
| 3853 | 4283 | if (bus->bus == SPI_BUS) { |
| 3854 | − dhdsdio_read_control(bus, rxbuf, len, | |
| 3855 | − doff); | |
| 4284 | + brcmf_sdbrcm_read_control(bus, rxbuf, | |
| 4285 | + len, doff); | |
| 3856 | 4286 | } else { |
| 3857 | − DHD_ERROR(("%s (nextlen): readahead on control" " packet %d?\n", | |
| 3858 | − __func__, seq)); | |
| 4287 | + BRCMF_ERROR(("%s (nextlen): readahead" | |
| 4288 | + " on control packet %d?\n", | |
| 4289 | + __func__, seq)); | |
| 3859 | 4290 | /* Force retry w/normal header read */ |
| 3860 | 4291 | bus->nextlen = 0; |
| 3861 | − dhdsdio_rxfail(bus, false, true); | |
| 4292 | + brcmf_sdbrcm_rxfail(bus, false, true); | |
| 3862 | 4293 | } |
| 3863 | − dhdsdio_pktfree2(bus, pkt); | |
| 4294 | + brcmf_sdbrcm_pktfree2(bus, pkt); | |
| 3864 | 4295 | continue; |
| 3865 | 4296 | } |
| 3866 | 4297 | |
| 3867 | 4298 | if ((bus->bus == SPI_BUS) && !bus->usebufpool) { |
| 3868 | − DHD_ERROR(("Received %d bytes on %d channel. Running out of " "rx pktbuf's or not yet malloced.\n", | |
| 3869 | − len, chan)); | |
| 4299 | + BRCMF_ERROR(("Received %d bytes on %d channel." | |
| 4300 | + " Running out of " "rx pktbuf's or" | |
| 4301 | + " not yet malloced.\n", | |
| 4302 | + len, chan)); | |
| 3870 | 4303 | continue; |
| 3871 | 4304 | } |
| 3872 | 4305 | |
| 3873 | 4306 | /* Validate data offset */ |
| 3874 | 4307 | if ((doff < SDPCM_HDRLEN) || (doff > len)) { |
| 3875 | − DHD_ERROR(("%s (nextlen): bad data offset %d: HW len %d min %d\n", | |
| 3876 | − __func__, doff, len, SDPCM_HDRLEN)); | |
| 3877 | − dhdsdio_rxfail(bus, false, false); | |
| 3878 | − dhdsdio_pktfree2(bus, pkt); | |
| 4308 | + BRCMF_ERROR(("%s (nextlen): bad data offset %d:" | |
| 4309 | + " HW len %d min %d\n", __func__, | |
| 4310 | + doff, len, SDPCM_HDRLEN)); | |
| 4311 | + brcmf_sdbrcm_rxfail(bus, false, false); | |
| 4312 | + brcmf_sdbrcm_pktfree2(bus, pkt); | |
| 3879 | 4313 | continue; |
| 3880 | 4314 | } |
| 3881 | 4315 | |
| @@ -3887,21 +4321,21 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) · 5 unmodified lines | ||
| 3887 | 4321 | break; |
| 3888 | 4322 | |
| 3889 | 4323 | /* Read frame header (hardware and software) */ |
| 3890 | − sdret = bcmsdh_recv_buf(bus, bcmsdh_cur_sbwad(sdh), | |
| 4324 | + sdret = brcmf_sdcard_recv_buf(card, | |
| 4325 | + brcmf_sdcard_cur_sbwad(card), | |
| 3891 | 4326 | SDIO_FUNC_2, F2SYNC, bus->rxhdr, firstread, |
| 3892 | 4327 | NULL, NULL, NULL); |
| 3893 | 4328 | bus->f2rxhdrs++; |
| 3894 | − ASSERT(sdret != -BCME_PENDING); | |
| 3895 | 4329 | |
| 3896 | 4330 | if (sdret < 0) { |
| 3897 | − DHD_ERROR(("%s: RXHEADER FAILED: %d\n", __func__, | |
| 3898 | − sdret)); | |
| 4331 | + BRCMF_ERROR(("%s: RXHEADER FAILED: %d\n", __func__, | |
| 4332 | + sdret)); | |
| 3899 | 4333 | bus->rx_hdrfail++; |
| 3900 | − dhdsdio_rxfail(bus, true, true); | |
3104 more lines aren’t shown here.
| @@ -1,100 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2010 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | − * purpose with or without fee is hereby granted, provided that the above | |
| 6 | − * copyright notice and this permission notice appear in all copies. | |
| 7 | − * | |
| 8 | − * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | − * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | − * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | − * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | − * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | − * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | − * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | − */ | |
| 16 | − | |
| 17 | −#ifndef _dhdioctl_h_ | |
| 18 | −#define _dhdioctl_h_ | |
| 19 | − | |
| 20 | −/* Linux network driver ioctl encoding */ | |
| 21 | −typedef struct dhd_ioctl { | |
| 22 | − uint cmd; /* common ioctl definition */ | |
| 23 | − void *buf; /* pointer to user buffer */ | |
| 24 | − uint len; /* length of user buffer */ | |
| 25 | − bool set; /* get or set request (optional) */ | |
| 26 | − uint used; /* bytes read or written (optional) */ | |
| 27 | − uint needed; /* bytes needed (optional) */ | |
| 28 | − uint driver; /* to identify target driver */ | |
| 29 | −} dhd_ioctl_t; | |
| 30 | − | |
| 31 | −/* per-driver magic numbers */ | |
| 32 | −#define DHD_IOCTL_MAGIC 0x00444944 | |
| 33 | − | |
| 34 | −/* bump this number if you change the ioctl interface */ | |
| 35 | −#define DHD_IOCTL_VERSION 1 | |
| 36 | − | |
| 37 | −#define DHD_IOCTL_MAXLEN 8192 /* max length ioctl buffer required */ | |
| 38 | −#define DHD_IOCTL_SMLEN 256 /* "small" length ioctl buffer required */ | |
| 39 | − | |
| 40 | −/* common ioctl definitions */ | |
| 41 | −#define DHD_GET_MAGIC 0 | |
| 42 | −#define DHD_GET_VERSION 1 | |
| 43 | −#define DHD_GET_VAR 2 | |
| 44 | −#define DHD_SET_VAR 3 | |
| 45 | − | |
| 46 | −/* message levels */ | |
| 47 | −#define DHD_ERROR_VAL 0x0001 | |
| 48 | −#define DHD_TRACE_VAL 0x0002 | |
| 49 | −#define DHD_INFO_VAL 0x0004 | |
| 50 | −#define DHD_DATA_VAL 0x0008 | |
| 51 | −#define DHD_CTL_VAL 0x0010 | |
| 52 | −#define DHD_TIMER_VAL 0x0020 | |
| 53 | −#define DHD_HDRS_VAL 0x0040 | |
| 54 | −#define DHD_BYTES_VAL 0x0080 | |
| 55 | −#define DHD_INTR_VAL 0x0100 | |
| 56 | −#define DHD_LOG_VAL 0x0200 | |
| 57 | −#define DHD_GLOM_VAL 0x0400 | |
| 58 | −#define DHD_EVENT_VAL 0x0800 | |
| 59 | −#define DHD_BTA_VAL 0x1000 | |
| 60 | −#define DHD_ISCAN_VAL 0x2000 | |
| 61 | − | |
| 62 | −#ifdef SDTEST | |
| 63 | −/* For pktgen iovar */ | |
| 64 | −typedef struct dhd_pktgen { | |
| 65 | − uint version; /* To allow structure change tracking */ | |
| 66 | − uint freq; /* Max ticks between tx/rx attempts */ | |
| 67 | − uint count; /* Test packets to send/rcv each attempt */ | |
| 68 | − uint print; /* Print counts every <print> attempts */ | |
| 69 | − uint total; /* Total packets (or bursts) */ | |
| 70 | − uint minlen; /* Minimum length of packets to send */ | |
| 71 | − uint maxlen; /* Maximum length of packets to send */ | |
| 72 | − uint numsent; /* Count of test packets sent */ | |
| 73 | − uint numrcvd; /* Count of test packets received */ | |
| 74 | − uint numfail; /* Count of test send failures */ | |
| 75 | − uint mode; /* Test mode (type of test packets) */ | |
| 76 | − uint stop; /* Stop after this many tx failures */ | |
| 77 | −} dhd_pktgen_t; | |
| 78 | − | |
| 79 | −/* Version in case structure changes */ | |
| 80 | −#define DHD_PKTGEN_VERSION 2 | |
| 81 | − | |
| 82 | −/* Type of test packets to use */ | |
| 83 | −#define DHD_PKTGEN_ECHO 1 /* Send echo requests */ | |
| 84 | −#define DHD_PKTGEN_SEND 2 /* Send discard packets */ | |
| 85 | −#define DHD_PKTGEN_RXBURST 3 /* Request dongle send N packets */ | |
| 86 | −#define DHD_PKTGEN_RECV 4 /* Continuous rx from continuous | |
| 87 | − tx dongle */ | |
| 88 | −#endif /* SDTEST */ | |
| 89 | − | |
| 90 | −/* Enter idle immediately (no timeout) */ | |
| 91 | −#define DHD_IDLE_IMMEDIATE (-1) | |
| 92 | − | |
| 93 | −/* Values for idleclock iovar: other values are the sd_divisor to use | |
| 94 | − when idle */ | |
| 95 | −#define DHD_IDLE_ACTIVE 0 /* Do not request any SD clock change | |
| 96 | − when idle */ | |
| 97 | −#define DHD_IDLE_STOP (-1) /* Request SD clock be stopped | |
| 98 | − (and use SD1 mode) */ | |
| 99 | − | |
| 100 | −#endif /* _dhdioctl_h_ */ | |
| @@ -1,32 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2010 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | − * purpose with or without fee is hereby granted, provided that the above | |
| 6 | − * copyright notice and this permission notice appear in all copies. | |
| 7 | − * | |
| 8 | − * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | − * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | − * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | − * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | − * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | − * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | − * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | − */ | |
| 16 | − | |
| 17 | −#ifndef _dngl_stats_h_ | |
| 18 | −#define _dngl_stats_h_ | |
| 19 | − | |
| 20 | −typedef struct { | |
| 21 | − unsigned long rx_packets; /* total packets received */ | |
| 22 | − unsigned long tx_packets; /* total packets transmitted */ | |
| 23 | − unsigned long rx_bytes; /* total bytes received */ | |
| 24 | − unsigned long tx_bytes; /* total bytes transmitted */ | |
| 25 | − unsigned long rx_errors; /* bad packets received */ | |
| 26 | − unsigned long tx_errors; /* packet transmit problems */ | |
| 27 | − unsigned long rx_dropped; /* packets dropped by dongle */ | |
| 28 | − unsigned long tx_dropped; /* packets dropped by dongle */ | |
| 29 | − unsigned long multicast; /* multicast packets received */ | |
| 30 | −} dngl_stats_t; | |
| 31 | − | |
| 32 | −#endif /* _dngl_stats_h_ */ | |
| @@ -1,75 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2010 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | − * purpose with or without fee is hereby granted, provided that the above | |
| 6 | − * copyright notice and this permission notice appear in all copies. | |
| 7 | − * | |
| 8 | − * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | − * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | − * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | − * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | − * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | − * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | − * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | − */ | |
| 16 | − | |
| 17 | −#ifndef _hndrte_armtrap_h | |
| 18 | −#define _hndrte_armtrap_h | |
| 19 | − | |
| 20 | −/* ARM trap handling */ | |
| 21 | − | |
| 22 | −/* Trap types defined by ARM (see arminc.h) */ | |
| 23 | − | |
| 24 | −/* Trap locations in lo memory */ | |
| 25 | −#define TRAP_STRIDE 4 | |
| 26 | −#define FIRST_TRAP TR_RST | |
| 27 | −#define LAST_TRAP (TR_FIQ * TRAP_STRIDE) | |
| 28 | − | |
| 29 | −#if defined(__ARM_ARCH_4T__) | |
| 30 | −#define MAX_TRAP_TYPE (TR_FIQ + 1) | |
| 31 | −#elif defined(__ARM_ARCH_7M__) | |
| 32 | −#define MAX_TRAP_TYPE (TR_ISR + ARMCM3_NUMINTS) | |
| 33 | −#endif /* __ARM_ARCH_7M__ */ | |
| 34 | − | |
| 35 | −/* The trap structure is defined here as offsets for assembly */ | |
| 36 | −#define TR_TYPE 0x00 | |
| 37 | −#define TR_EPC 0x04 | |
| 38 | −#define TR_CPSR 0x08 | |
| 39 | −#define TR_SPSR 0x0c | |
| 40 | −#define TR_REGS 0x10 | |
| 41 | −#define TR_REG(n) (TR_REGS + (n) * 4) | |
| 42 | −#define TR_SP TR_REG(13) | |
| 43 | −#define TR_LR TR_REG(14) | |
| 44 | −#define TR_PC TR_REG(15) | |
| 45 | − | |
| 46 | −#define TRAP_T_SIZE 80 | |
| 47 | − | |
| 48 | −#ifndef _LANGUAGE_ASSEMBLY | |
| 49 | − | |
| 50 | −typedef struct _trap_struct { | |
| 51 | − u32 type; | |
| 52 | − u32 epc; | |
| 53 | − u32 cpsr; | |
| 54 | − u32 spsr; | |
| 55 | − u32 r0; | |
| 56 | − u32 r1; | |
| 57 | − u32 r2; | |
| 58 | − u32 r3; | |
| 59 | − u32 r4; | |
| 60 | − u32 r5; | |
| 61 | − u32 r6; | |
| 62 | − u32 r7; | |
| 63 | − u32 r8; | |
| 64 | − u32 r9; | |
| 65 | − u32 r10; | |
| 66 | − u32 r11; | |
| 67 | − u32 r12; | |
| 68 | − u32 r13; | |
| 69 | − u32 r14; | |
| 70 | − u32 pc; | |
| 71 | −} trap_t; | |
| 72 | − | |
| 73 | −#endif /* !_LANGUAGE_ASSEMBLY */ | |
| 74 | − | |
| 75 | −#endif /* _hndrte_armtrap_h */ | |
| @@ -1,62 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2010 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | − * purpose with or without fee is hereby granted, provided that the above | |
| 6 | − * copyright notice and this permission notice appear in all copies. | |
| 7 | − * | |
| 8 | − * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | − * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | − * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | − * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | − * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | − * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | − * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | − */ | |
| 16 | −#ifndef _hndrte_cons_h | |
| 17 | −#define _hndrte_cons_h | |
| 18 | − | |
| 19 | −#define CBUF_LEN (128) | |
| 20 | − | |
| 21 | −#define LOG_BUF_LEN 1024 | |
| 22 | − | |
| 23 | −typedef struct { | |
| 24 | − u32 buf; /* Can't be pointer on (64-bit) hosts */ | |
| 25 | − uint buf_size; | |
| 26 | − uint idx; | |
| 27 | − char *_buf_compat; /* Redundant pointer for backward compat. */ | |
| 28 | −} hndrte_log_t; | |
| 29 | − | |
| 30 | −typedef struct { | |
| 31 | − /* Virtual UART | |
| 32 | − * When there is no UART (e.g. Quickturn), | |
| 33 | − * the host should write a complete | |
| 34 | − * input line directly into cbuf and then write | |
| 35 | − * the length into vcons_in. | |
| 36 | − * This may also be used when there is a real UART | |
| 37 | − * (at risk of conflicting with | |
| 38 | − * the real UART). vcons_out is currently unused. | |
| 39 | − */ | |
| 40 | − volatile uint vcons_in; | |
| 41 | − volatile uint vcons_out; | |
| 42 | − | |
| 43 | − /* Output (logging) buffer | |
| 44 | − * Console output is written to a ring buffer log_buf at index log_idx. | |
| 45 | − * The host may read the output when it sees log_idx advance. | |
| 46 | − * Output will be lost if the output wraps around faster than the host | |
| 47 | − * polls. | |
| 48 | − */ | |
| 49 | − hndrte_log_t log; | |
| 50 | − | |
| 51 | − /* Console input line buffer | |
| 52 | − * Characters are read one at a time into cbuf | |
| 53 | − * until <CR> is received, then | |
| 54 | − * the buffer is processed as a command line. | |
| 55 | − * Also used for virtual UART. | |
| 56 | − */ | |
| 57 | − uint cbuf_idx; | |
| 58 | − char cbuf[CBUF_LEN]; | |
| 59 | −} hndrte_cons_t; | |
| 60 | − | |
| 61 | −#endif /* _hndrte_cons_h */ | |
| 62 | − | |
| @@ -1,61 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2010 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | − * purpose with or without fee is hereby granted, provided that the above | |
| 6 | − * copyright notice and this permission notice appear in all copies. | |
| 7 | − * | |
| 8 | − * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | − * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | − * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | − * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | − * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | − * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | − * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | − */ | |
| 16 | − | |
| 17 | −#ifndef _MSGTRACE_H | |
| 18 | −#define _MSGTRACE_H | |
| 19 | − | |
| 20 | −#define MSGTRACE_VERSION 1 | |
| 21 | − | |
| 22 | −/* Message trace header */ | |
| 23 | −typedef struct msgtrace_hdr { | |
| 24 | − u8 version; | |
| 25 | − u8 spare; | |
| 26 | − u16 len; /* Len of the trace */ | |
| 27 | − u32 seqnum; /* Sequence number of message. Useful | |
| 28 | − * if the messsage has been lost | |
| 29 | − * because of DMA error or a bus reset | |
| 30 | − * (ex: SDIO Func2) | |
| 31 | − */ | |
| 32 | − u32 discarded_bytes; /* Number of discarded bytes because of | |
| 33 | − trace overflow */ | |
| 34 | − u32 discarded_printf; /* Number of discarded printf | |
| 35 | − because of trace overflow */ | |
| 36 | −} __attribute__((packed)) msgtrace_hdr_t; | |
| 37 | − | |
| 38 | −#define MSGTRACE_HDRLEN sizeof(msgtrace_hdr_t) | |
| 39 | − | |
| 40 | −/* The hbus driver generates traces when sending a trace message. | |
| 41 | − * This causes endless traces. | |
| 42 | − * This flag must be set to true in any hbus traces. | |
| 43 | − * The flag is reset in the function msgtrace_put. | |
| 44 | − * This prevents endless traces but generates hasardous | |
| 45 | − * lost of traces only in bus device code. | |
| 46 | − * It is recommendat to set this flag in macro SD_TRACE | |
| 47 | − * but not in SD_ERROR for avoiding missing | |
| 48 | − * hbus error traces. hbus error trace should not generates endless traces. | |
| 49 | − */ | |
| 50 | −extern bool msgtrace_hbus_trace; | |
| 51 | − | |
| 52 | −typedef void (*msgtrace_func_send_t) (void *hdl1, void *hdl2, u8 *hdr, | |
| 53 | − u16 hdrlen, u8 *buf, | |
| 54 | − u16 buflen); | |
| 55 | − | |
| 56 | −extern void msgtrace_sent(void); | |
| 57 | −extern void msgtrace_put(char *buf, int count); | |
| 58 | −extern void msgtrace_init(void *hdl1, void *hdl2, | |
| 59 | − msgtrace_func_send_t func_send); | |
| 60 | − | |
| 61 | −#endif /* _MSGTRACE_H */ | |
| @@ -0,0 +1,347 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 2010 Broadcom Corporation | |
| 3 | + * | |
| 4 | + * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | + * purpose with or without fee is hereby granted, provided that the above | |
| 6 | + * copyright notice and this permission notice appear in all copies. | |
| 7 | + * | |
| 8 | + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | + */ | |
| 16 | + | |
| 17 | +#ifndef _BRCM_SDH_H_ | |
| 18 | +#define _BRCM_SDH_H_ | |
| 19 | + | |
| 20 | +#include <linux/skbuff.h> | |
| 21 | +extern const uint brcmf_sdio_msglevel; | |
| 22 | + | |
| 23 | +#define SDIO_FUNC_0 0 | |
| 24 | +#define SDIO_FUNC_1 1 | |
| 25 | +#define SDIO_FUNC_2 2 | |
| 26 | + | |
| 27 | +#define SDIOD_FBR_SIZE 0x100 | |
| 28 | + | |
| 29 | +/* io_en */ | |
| 30 | +#define SDIO_FUNC_ENABLE_1 0x02 | |
| 31 | +#define SDIO_FUNC_ENABLE_2 0x04 | |
| 32 | + | |
| 33 | +/* io_rdys */ | |
| 34 | +#define SDIO_FUNC_READY_1 0x02 | |
| 35 | +#define SDIO_FUNC_READY_2 0x04 | |
| 36 | + | |
| 37 | +/* intr_status */ | |
| 38 | +#define INTR_STATUS_FUNC1 0x2 | |
| 39 | +#define INTR_STATUS_FUNC2 0x4 | |
| 40 | + | |
| 41 | +/* Maximum number of I/O funcs */ | |
| 42 | +#define SDIOD_MAX_IOFUNCS 7 | |
| 43 | + | |
| 44 | +#define SBSDIO_NUM_FUNCTION 3 /* as of sdiod rev 0, supports 3 functions */ | |
| 45 | + | |
| 46 | +/* function 1 miscellaneous registers */ | |
| 47 | +#define SBSDIO_SPROM_CS 0x10000 /* sprom command and status */ | |
| 48 | +#define SBSDIO_SPROM_INFO 0x10001 /* sprom info register */ | |
| 49 | +#define SBSDIO_SPROM_DATA_LOW 0x10002 /* sprom indirect access data byte 0 */ | |
| 50 | +#define SBSDIO_SPROM_DATA_HIGH 0x10003 /* sprom indirect access data byte 1 */ | |
| 51 | +#define SBSDIO_SPROM_ADDR_LOW 0x10004 /* sprom indirect access addr byte 0 */ | |
| 52 | +#define SBSDIO_SPROM_ADDR_HIGH 0x10005 /* sprom indirect access addr byte 0 */ | |
| 53 | +#define SBSDIO_CHIP_CTRL_DATA 0x10006 /* xtal_pu (gpio) output */ | |
| 54 | +#define SBSDIO_CHIP_CTRL_EN 0x10007 /* xtal_pu (gpio) enable */ | |
| 55 | +#define SBSDIO_WATERMARK 0x10008 /* rev < 7, watermark for sdio device */ | |
| 56 | +#define SBSDIO_DEVICE_CTL 0x10009 /* control busy signal generation */ | |
| 57 | + | |
| 58 | +/* registers introduced in rev 8, some content (mask/bits) defs in sbsdpcmdev.h */ | |
| 59 | +#define SBSDIO_FUNC1_SBADDRLOW 0x1000A /* SB Address Window Low (b15) */ | |
| 60 | +#define SBSDIO_FUNC1_SBADDRMID 0x1000B /* SB Address Window Mid (b23:b16) */ | |
| 61 | +#define SBSDIO_FUNC1_SBADDRHIGH 0x1000C /* SB Address Window High (b31:b24) */ | |
| 62 | +#define SBSDIO_FUNC1_FRAMECTRL 0x1000D /* Frame Control (frame term/abort) */ | |
| 63 | +#define SBSDIO_FUNC1_CHIPCLKCSR 0x1000E /* ChipClockCSR (ALP/HT ctl/status) */ | |
| 64 | +#define SBSDIO_FUNC1_SDIOPULLUP 0x1000F /* SdioPullUp (on cmd, d0-d2) */ | |
| 65 | +#define SBSDIO_FUNC1_WFRAMEBCLO 0x10019 /* Write Frame Byte Count Low */ | |
| 66 | +#define SBSDIO_FUNC1_WFRAMEBCHI 0x1001A /* Write Frame Byte Count High */ | |
| 67 | +#define SBSDIO_FUNC1_RFRAMEBCLO 0x1001B /* Read Frame Byte Count Low */ | |
| 68 | +#define SBSDIO_FUNC1_RFRAMEBCHI 0x1001C /* Read Frame Byte Count High */ | |
| 69 | + | |
| 70 | +#define SBSDIO_FUNC1_MISC_REG_START 0x10000 /* f1 misc register start */ | |
| 71 | +#define SBSDIO_FUNC1_MISC_REG_LIMIT 0x1001C /* f1 misc register end */ | |
| 72 | + | |
| 73 | +/* function 1 OCP space */ | |
| 74 | +#define SBSDIO_SB_OFT_ADDR_MASK 0x07FFF /* sb offset addr is <= 15 bits, 32k */ | |
| 75 | +#define SBSDIO_SB_OFT_ADDR_LIMIT 0x08000 | |
| 76 | +#define SBSDIO_SB_ACCESS_2_4B_FLAG 0x08000 /* with b15, maps to 32-bit SB access */ | |
| 77 | + | |
| 78 | +/* some duplication with sbsdpcmdev.h here */ | |
| 79 | +/* valid bits in SBSDIO_FUNC1_SBADDRxxx regs */ | |
| 80 | +#define SBSDIO_SBADDRLOW_MASK 0x80 /* Valid bits in SBADDRLOW */ | |
| 81 | +#define SBSDIO_SBADDRMID_MASK 0xff /* Valid bits in SBADDRMID */ | |
| 82 | +#define SBSDIO_SBADDRHIGH_MASK 0xffU /* Valid bits in SBADDRHIGH */ | |
| 83 | +#define SBSDIO_SBWINDOW_MASK 0xffff8000 /* Address bits from SBADDR regs */ | |
| 84 | + | |
| 85 | +#define SDIOH_READ 0 /* Read request */ | |
| 86 | +#define SDIOH_WRITE 1 /* Write request */ | |
| 87 | + | |
| 88 | +#define SDIOH_DATA_FIX 0 /* Fixed addressing */ | |
| 89 | +#define SDIOH_DATA_INC 1 /* Incremental addressing */ | |
| 90 | + | |
| 91 | +/* internal return code */ | |
| 92 | +#define SUCCESS 0 | |
| 93 | +#define ERROR 1 | |
| 94 | + | |
| 95 | +/* forward declarations */ | |
| 96 | +struct brcmf_sdio_card; | |
| 97 | + | |
| 98 | +struct brcmf_sdreg { | |
| 99 | + int func; | |
| 100 | + int offset; | |
| 101 | + int value; | |
| 102 | +}; | |
| 103 | + | |
| 104 | +struct sdioh_info { | |
| 105 | + struct osl_info *osh; /* osh handler */ | |
| 106 | + bool client_intr_enabled; /* interrupt connnected flag */ | |
| 107 | + bool intr_handler_valid; /* client driver interrupt handler valid */ | |
| 108 | + void (*intr_handler)(void *); /* registered interrupt handler */ | |
| 109 | + void *intr_handler_arg; /* argument to call interrupt handler */ | |
| 110 | + u16 intmask; /* Current active interrupts */ | |
| 111 | + void *sdos_info; /* Pointer to per-OS private data */ | |
| 112 | + | |
| 113 | + uint irq; /* Client irq */ | |
| 114 | + int intrcount; /* Client interrupts */ | |
| 115 | + bool sd_blockmode; /* sd_blockmode == false => 64 Byte Cmd 53s. */ | |
| 116 | + /* Must be on for sd_multiblock to be effective */ | |
| 117 | + bool use_client_ints; /* If this is false, make sure to restore */ | |
| 118 | + int client_block_size[SDIOD_MAX_IOFUNCS]; /* Blocksize */ | |
| 119 | + u8 num_funcs; /* Supported funcs on client */ | |
| 120 | + u32 com_cis_ptr; | |
| 121 | + u32 func_cis_ptr[SDIOD_MAX_IOFUNCS]; | |
| 122 | + uint max_dma_len; | |
| 123 | + uint max_dma_descriptors; /* DMA Descriptors supported by this controller. */ | |
| 124 | + /* SDDMA_DESCRIPTOR SGList[32]; *//* Scatter/Gather DMA List */ | |
| 125 | +}; | |
| 126 | + | |
| 127 | +struct brcmf_sdmmc_instance { | |
| 128 | + struct sdioh_info *sd; | |
| 129 | + struct sdio_func *func[SDIOD_MAX_IOFUNCS]; | |
| 130 | + u32 host_claimed; | |
| 131 | +}; | |
| 132 | + | |
| 133 | +/* Attach and build an interface to the underlying SD host driver. | |
| 134 | + * - Allocates resources (structs, arrays, mem, OS handles, etc) needed by | |
| 135 | + * brcmf_sdcard. | |
| 136 | + * - Returns the sdio card handle and virtual address base for register access. | |
| 137 | + * The returned handle should be used in all subsequent calls, but the bcmsh | |
| 138 | + * implementation may maintain a single "default" handle (e.g. the first or | |
| 139 | + * most recent one) to enable single-instance implementations to pass NULL. | |
| 140 | + */ | |
| 141 | +extern struct brcmf_sdio_card* | |
| 142 | +brcmf_sdcard_attach(void *cfghdl, u32 *regsva, uint irq); | |
| 143 | + | |
| 144 | +/* Detach - freeup resources allocated in attach */ | |
| 145 | +extern int brcmf_sdcard_detach(struct brcmf_sdio_card *card); | |
| 146 | + | |
| 147 | +/* Enable/disable SD interrupt */ | |
| 148 | +extern int brcmf_sdcard_intr_enable(struct brcmf_sdio_card *card); | |
| 149 | +extern int brcmf_sdcard_intr_disable(struct brcmf_sdio_card *card); | |
| 150 | + | |
| 151 | +/* Register/deregister device interrupt handler. */ | |
| 152 | +extern int | |
| 153 | +brcmf_sdcard_intr_reg(struct brcmf_sdio_card *card, | |
| 154 | + void (*fn)(void *), void *argh); | |
| 155 | + | |
| 156 | +extern int brcmf_sdcard_intr_dereg(struct brcmf_sdio_card *card); | |
| 157 | + | |
| 158 | +/* Access SDIO address space (e.g. CCCR) using CMD52 (single-byte interface). | |
| 159 | + * fn: function number | |
| 160 | + * addr: unmodified SDIO-space address | |
| 161 | + * data: data byte to write | |
| 162 | + * err: pointer to error code (or NULL) | |
| 163 | + */ | |
| 164 | +extern u8 brcmf_sdcard_cfg_read(struct brcmf_sdio_card *card, uint func, | |
| 165 | + u32 addr, int *err); | |
| 166 | +extern void brcmf_sdcard_cfg_write(struct brcmf_sdio_card *card, uint func, | |
| 167 | + u32 addr, u8 data, int *err); | |
| 168 | + | |
| 169 | +/* Read/Write 4bytes from/to cfg space */ | |
| 170 | +extern u32 | |
| 171 | +brcmf_sdcard_cfg_read_word(struct brcmf_sdio_card *card, uint fnc_num, | |
| 172 | + u32 addr, int *err); | |
| 173 | + | |
| 174 | +extern void brcmf_sdcard_cfg_write_word(struct brcmf_sdio_card *card, | |
| 175 | + uint fnc_num, u32 addr, | |
| 176 | + u32 data, int *err); | |
| 177 | + | |
| 178 | +/* Read CIS content for specified function. | |
| 179 | + * fn: function whose CIS is being requested (0 is common CIS) | |
| 180 | + * cis: pointer to memory location to place results | |
| 181 | + * length: number of bytes to read | |
| 182 | + * Internally, this routine uses the values from the cis base regs (0x9-0xB) | |
| 183 | + * to form an SDIO-space address to read the data from. | |
| 184 | + */ | |
| 185 | +extern int brcmf_sdcard_cis_read(struct brcmf_sdio_card *card, uint func, | |
| 186 | + u8 *cis, uint length); | |
| 187 | + | |
| 188 | +/* Synchronous access to device (client) core registers via CMD53 to F1. | |
| 189 | + * addr: backplane address (i.e. >= regsva from attach) | |
| 190 | + * size: register width in bytes (2 or 4) | |
| 191 | + * data: data for register write | |
| 192 | + */ | |
| 193 | +extern u32 | |
| 194 | +brcmf_sdcard_reg_read(struct brcmf_sdio_card *card, u32 addr, uint size); | |
| 195 | + | |
| 196 | +extern u32 | |
| 197 | +brcmf_sdcard_reg_write(struct brcmf_sdio_card *card, u32 addr, uint size, | |
| 198 | + u32 data); | |
| 199 | + | |
| 200 | +/* Indicate if last reg read/write failed */ | |
| 201 | +extern bool brcmf_sdcard_regfail(struct brcmf_sdio_card *card); | |
| 202 | + | |
| 203 | +/* Buffer transfer to/from device (client) core via cmd53. | |
| 204 | + * fn: function number | |
| 205 | + * addr: backplane address (i.e. >= regsva from attach) | |
| 206 | + * flags: backplane width, address increment, sync/async | |
| 207 | + * buf: pointer to memory data buffer | |
| 208 | + * nbytes: number of bytes to transfer to/from buf | |
| 209 | + * pkt: pointer to packet associated with buf (if any) | |
| 210 | + * complete: callback function for command completion (async only) | |
| 211 | + * handle: handle for completion callback (first arg in callback) | |
| 212 | + * Returns 0 or error code. | |
| 213 | + * NOTE: Async operation is not currently supported. | |
| 214 | + */ | |
| 215 | +extern int | |
| 216 | +brcmf_sdcard_send_buf(struct brcmf_sdio_card *card, u32 addr, uint fn, | |
| 217 | + uint flags, u8 *buf, uint nbytes, void *pkt, | |
| 218 | + void (*complete)(void *handle, int status, | |
| 219 | + bool sync_waiting), | |
| 220 | + void *handle); | |
| 221 | +extern int | |
| 222 | +brcmf_sdcard_recv_buf(struct brcmf_sdio_card *card, u32 addr, uint fn, | |
| 223 | + uint flags, u8 *buf, uint nbytes, struct sk_buff *pkt, | |
| 224 | + void (*complete)(void *handle, int status, | |
| 225 | + bool sync_waiting), | |
| 226 | + void *handle); | |
| 227 | + | |
| 228 | +/* Flags bits */ | |
| 229 | +#define SDIO_REQ_4BYTE 0x1 /* Four-byte target (backplane) width (vs. two-byte) */ | |
| 230 | +#define SDIO_REQ_FIXED 0x2 /* Fixed address (FIFO) (vs. incrementing address) */ | |
| 231 | +#define SDIO_REQ_ASYNC 0x4 /* Async request (vs. sync request) */ | |
| 232 | + | |
| 233 | +/* Pending (non-error) return code */ | |
| 234 | +#define BCME_PENDING 1 | |
| 235 | + | |
| 236 | +/* Read/write to memory block (F1, no FIFO) via CMD53 (sync only). | |
| 237 | + * rw: read or write (0/1) | |
| 238 | + * addr: direct SDIO address | |
| 239 | + * buf: pointer to memory data buffer | |
| 240 | + * nbytes: number of bytes to transfer to/from buf | |
| 241 | + * Returns 0 or error code. | |
| 242 | + */ | |
| 243 | +extern int brcmf_sdcard_rwdata(struct brcmf_sdio_card *card, uint rw, u32 addr, | |
| 244 | + u8 *buf, uint nbytes); | |
| 245 | + | |
| 246 | +/* Issue an abort to the specified function */ | |
| 247 | +extern int brcmf_sdcard_abort(struct brcmf_sdio_card *card, uint fn); | |
| 248 | + | |
| 249 | +/* Returns the "Device ID" of target device on the SDIO bus. */ | |
| 250 | +extern int brcmf_sdcard_query_device(struct brcmf_sdio_card *card); | |
| 251 | + | |
| 252 | +/* Miscellaneous knob tweaker. */ | |
| 253 | +extern int brcmf_sdcard_iovar_op(struct brcmf_sdio_card *card, const char *name, | |
| 254 | + void *params, int plen, void *arg, int len, | |
| 255 | + bool set); | |
| 256 | + | |
| 257 | +/* helper functions */ | |
| 258 | + | |
| 259 | +/* callback functions */ | |
| 260 | +struct brcmf_sdioh_driver { | |
| 261 | + /* attach to device */ | |
| 262 | + void *(*attach) (u16 vend_id, u16 dev_id, u16 bus, u16 slot, | |
| 263 | + u16 func, uint bustype, u32 regsva, void *param); | |
| 264 | + /* detach from device */ | |
| 265 | + void (*detach) (void *ch); | |
| 266 | +}; | |
| 267 | + | |
| 268 | +struct sdioh_info; | |
| 269 | + | |
| 270 | +/* platform specific/high level functions */ | |
| 271 | +extern int brcmf_sdio_function_init(void); | |
| 272 | +extern int brcmf_sdio_register(struct brcmf_sdioh_driver *driver); | |
| 273 | +extern void brcmf_sdio_unregister(void); | |
| 274 | +extern void brcmf_sdio_function_cleanup(void); | |
| 275 | +extern int brcmf_sdio_probe(struct device *dev); | |
| 276 | +extern int brcmf_sdio_remove(struct device *dev); | |
| 277 | + | |
| 278 | +/* Function to return current window addr */ | |
| 279 | +extern u32 brcmf_sdcard_cur_sbwad(struct brcmf_sdio_card *card); | |
| 280 | + | |
| 281 | +/* Allocate/init/free per-OS private data */ | |
| 282 | +extern int brcmf_sdioh_osinit(struct sdioh_info *sd); | |
| 283 | +extern void brcmf_sdioh_osfree(struct sdioh_info *sd); | |
| 284 | + | |
| 285 | +/* Core interrupt enable/disable of device interrupts */ | |
| 286 | +extern void brcmf_sdioh_dev_intr_on(struct sdioh_info *sd); | |
| 287 | +extern void brcmf_sdioh_dev_intr_off(struct sdioh_info *sd); | |
| 288 | + | |
| 289 | +/* attach, return handler on success, NULL if failed. | |
| 290 | + * The handler shall be provided by all subsequent calls. No local cache | |
| 291 | + * cfghdl points to the starting address of pci device mapped memory | |
| 292 | + */ | |
| 293 | +extern struct sdioh_info *brcmf_sdioh_attach(void *cfghdl, uint irq); | |
| 294 | +extern int brcmf_sdioh_detach(struct sdioh_info *si); | |
| 295 | + | |
| 296 | +extern int | |
| 297 | +brcmf_sdioh_interrupt_register(struct sdioh_info *si, | |
| 298 | + void (*sdioh_cb_fn)(void *), void *argh); | |
| 299 | + | |
| 300 | +extern int brcmf_sdioh_interrupt_deregister(struct sdioh_info *si); | |
| 301 | + | |
| 302 | +/* enable or disable SD interrupt */ | |
| 303 | +extern int | |
| 304 | +brcmf_sdioh_interrupt_set(struct sdioh_info *si, bool enable_disable); | |
| 305 | + | |
| 306 | +/* read or write one byte using cmd52 */ | |
| 307 | +extern int | |
| 308 | +brcmf_sdioh_request_byte(struct sdioh_info *si, uint rw, uint fnc, uint addr, | |
| 309 | + u8 *byte); | |
| 310 | + | |
| 311 | +/* read or write 2/4 bytes using cmd53 */ | |
| 312 | +extern int | |
| 313 | +brcmf_sdioh_request_word(struct sdioh_info *si, uint cmd_type, | |
| 314 | + uint rw, uint fnc, uint addr, | |
| 315 | + u32 *word, uint nbyte); | |
| 316 | + | |
| 317 | +/* read or write any buffer using cmd53 */ | |
| 318 | +extern int | |
| 319 | +brcmf_sdioh_request_buffer(struct sdioh_info *si, uint pio_dma, | |
| 320 | + uint fix_inc, uint rw, uint fnc_num, | |
| 321 | + u32 addr, uint regwidth, | |
| 322 | + u32 buflen, u8 *buffer, struct sk_buff *pkt); | |
| 323 | + | |
| 324 | +/* get cis data */ | |
| 325 | +extern int | |
| 326 | +brcmf_sdioh_cis_read(struct sdioh_info *si, uint fuc, u8 *cis, u32 length); | |
| 327 | + | |
| 328 | +extern int | |
| 329 | +brcmf_sdioh_cfg_read(struct sdioh_info *si, uint fuc, u32 addr, u8 *data); | |
| 330 | +extern int | |
| 331 | +brcmf_sdioh_cfg_write(struct sdioh_info *si, uint fuc, u32 addr, u8 *data); | |
| 332 | + | |
| 333 | +/* handle iovars */ | |
| 334 | +extern int brcmf_sdioh_iovar_op(struct sdioh_info *si, const char *name, | |
| 335 | + void *params, int plen, void *arg, int len, bool set); | |
| 336 | + | |
| 337 | +/* Issue abort to the specified function and clear controller as needed */ | |
| 338 | +extern int brcmf_sdioh_abort(struct sdioh_info *si, uint fnc); | |
| 339 | + | |
| 340 | +/* Watchdog timer interface for pm ops */ | |
| 341 | +extern void brcmf_sdio_wdtmr_enable(bool enable); | |
| 342 | + | |
| 343 | +extern uint sd_msglevel; /* Debug message level */ | |
| 344 | + | |
| 345 | +extern struct brcmf_sdmmc_instance *gInstance; | |
| 346 | + | |
| 347 | +#endif /* _BRCM_SDH_H_ */ | |
| @@ -1,63 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2010 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | − * purpose with or without fee is hereby granted, provided that the above | |
| 6 | − * copyright notice and this permission notice appear in all copies. | |
| 7 | − * | |
| 8 | − * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | − * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | − * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | − * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | − * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | − * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | − * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | − */ | |
| 16 | − | |
| 17 | −#ifndef _SDIOH_H | |
| 18 | −#define _SDIOH_H | |
| 19 | − | |
| 20 | −#define SD_SysAddr 0x000 | |
| 21 | −#define SD_BlockSize 0x004 | |
| 22 | −#define SD_BlockCount 0x006 | |
| 23 | −#define SD_Arg0 0x008 | |
| 24 | −#define SD_Arg1 0x00A | |
| 25 | −#define SD_TransferMode 0x00C | |
| 26 | −#define SD_Command 0x00E | |
| 27 | −#define SD_Response0 0x010 | |
| 28 | −#define SD_Response1 0x012 | |
| 29 | −#define SD_Response2 0x014 | |
| 30 | −#define SD_Response3 0x016 | |
| 31 | −#define SD_Response4 0x018 | |
| 32 | −#define SD_Response5 0x01A | |
| 33 | −#define SD_Response6 0x01C | |
| 34 | −#define SD_Response7 0x01E | |
| 35 | −#define SD_BufferDataPort0 0x020 | |
| 36 | −#define SD_BufferDataPort1 0x022 | |
| 37 | −#define SD_PresentState 0x024 | |
| 38 | −#define SD_HostCntrl 0x028 | |
| 39 | −#define SD_PwrCntrl 0x029 | |
| 40 | −#define SD_BlockGapCntrl 0x02A | |
| 41 | −#define SD_WakeupCntrl 0x02B | |
| 42 | −#define SD_ClockCntrl 0x02C | |
| 43 | −#define SD_TimeoutCntrl 0x02E | |
| 44 | −#define SD_SoftwareReset 0x02F | |
| 45 | −#define SD_IntrStatus 0x030 | |
| 46 | −#define SD_ErrorIntrStatus 0x032 | |
| 47 | −#define SD_IntrStatusEnable 0x034 | |
| 48 | −#define SD_ErrorIntrStatusEnable 0x036 | |
| 49 | −#define SD_IntrSignalEnable 0x038 | |
| 50 | −#define SD_ErrorIntrSignalEnable 0x03A | |
| 51 | −#define SD_CMD12ErrorStatus 0x03C | |
| 52 | −#define SD_Capabilities 0x040 | |
| 53 | −#define SD_Capabilities_Reserved 0x044 | |
| 54 | −#define SD_MaxCurCap 0x048 | |
| 55 | −#define SD_MaxCurCap_Reserved 0x04C | |
| 56 | −#define SD_ADMA_SysAddr 0x58 | |
| 57 | −#define SD_SlotInterruptStatus 0x0FC | |
| 58 | −#define SD_HostControllerVersion 0x0FE | |
| 59 | − | |
| 60 | −/* SD specific registers in PCI config space */ | |
| 61 | −#define SD_SlotInfo 0x40 | |
| 62 | − | |
| 63 | −#endif /* _SDIOH_H */ | |
| @@ -1,38 +0,0 @@ | ||
| 1 | −/* | |
| 2 | − * Copyright (c) 2010 Broadcom Corporation | |
| 3 | − * | |
| 4 | − * Permission to use, copy, modify, and/or distribute this software for any | |
| 5 | − * purpose with or without fee is hereby granted, provided that the above | |
| 6 | − * copyright notice and this permission notice appear in all copies. | |
| 7 | − * | |
| 8 | − * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 9 | − * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 10 | − * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 11 | − * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 12 | − * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | |
| 13 | − * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | |
| 14 | − * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | − */ | |
| 16 | − | |
| 17 | −#ifndef _sdiovar_h_ | |
| 18 | −#define _sdiovar_h_ | |
| 19 | − | |
| 20 | −typedef struct sdreg { | |
| 21 | − int func; | |
| 22 | − int offset; | |
| 23 | − int value; | |
| 24 | −} sdreg_t; | |
| 25 | − | |
| 26 | −/* Common msglevel constants */ | |
| 27 | −#define SDH_ERROR_VAL 0x0001 /* Error */ | |
| 28 | −#define SDH_TRACE_VAL 0x0002 /* Trace */ | |
| 29 | −#define SDH_INFO_VAL 0x0004 /* Info */ | |
| 30 | −#define SDH_DEBUG_VAL 0x0008 /* Debug */ | |
| 31 | −#define SDH_DATA_VAL 0x0010 /* Data */ | |
| 32 | −#define SDH_CTRL_VAL 0x0020 /* Control Regs */ | |
| 33 | −#define SDH_LOG_VAL 0x0040 /* Enable bcmlog */ | |
| 34 | −#define SDH_DMA_VAL 0x0080 /* DMA */ | |
| 35 | − | |
| 36 | −#define NUM_PREV_TRANSACTIONS 16 | |
| 37 | − | |
| 38 | −#endif /* _sdiovar_h_ */ | |
| @@ -16,336 +16,325 @@ · 15 unmodified lines | ||
| 16 | 16 | |
| 17 | 17 | #include <linux/kernel.h> |
| 18 | 18 | #include <linux/if_arp.h> |
| 19 | − | |
| 20 | −#include <bcmutils.h> | |
| 21 | − | |
| 22 | −#include <asm/uaccess.h> | |
| 23 | − | |
| 24 | −#include <dngl_stats.h> | |
| 25 | −#include <dhd.h> | |
| 26 | −#include <dhdioctl.h> | |
| 27 | −#include <wlioctl.h> | |
| 28 | − | |
| 19 | +#include <linux/sched.h> | |
| 29 | 20 | #include <linux/kthread.h> |
| 30 | 21 | #include <linux/netdevice.h> |
| 31 | 22 | #include <linux/sched.h> |
| 32 | 23 | #include <linux/etherdevice.h> |
| 33 | 24 | #include <linux/wireless.h> |
| 34 | 25 | #include <linux/ieee80211.h> |
| 26 | +#include <linux/mmc/sdio_func.h> | |
| 27 | +#include <linux/uaccess.h> | |
| 35 | 28 | #include <net/cfg80211.h> |
| 36 | − | |
| 37 | 29 | #include <net/rtnetlink.h> |
| 38 | −#include <linux/mmc/sdio_func.h> | |
| 39 | −#include <linux/firmware.h> | |
| 40 | −#include <wl_cfg80211.h> | |
| 41 | 30 | |
| 42 | −void sdioh_sdio_set_host_pm_flags(int flag); | |
| 31 | +#include <brcmu_utils.h> | |
| 32 | +#include <defs.h> | |
| 33 | +#include <brcmu_wifi.h> | |
| 34 | +#include "dhd.h" | |
| 35 | +#include "wl_cfg80211.h" | |
| 43 | 36 | |
| 44 | 37 | static struct sdio_func *cfg80211_sdio_func; |
| 45 | −static struct wl_dev *wl_cfg80211_dev; | |
| 38 | +static struct brcmf_cfg80211_dev *cfg80211_dev; | |
| 46 | 39 | static const u8 ether_bcast[ETH_ALEN] = {255, 255, 255, 255, 255, 255}; |
| 47 | 40 | |
| 48 | −u32 wl_dbg_level = WL_DBG_ERR; | |
| 49 | − | |
| 50 | −#define WL_4329_FW_FILE "brcm/bcm4329-fullmac-4.bin" | |
| 51 | −#define WL_4329_NVRAM_FILE "brcm/bcm4329-fullmac-4.txt" | |
| 41 | +u32 brcmf_dbg_level = WL_DBG_ERR; | |
| 52 | 42 | |
| 53 | 43 | /* |
| 54 | 44 | ** cfg80211_ops api/callback list |
| 55 | 45 | */ |
| 56 | −static s32 wl_cfg80211_change_iface(struct wiphy *wiphy, | |
| 57 | − struct net_device *ndev, | |
| 58 | − enum nl80211_iftype type, u32 *flags, | |
| 59 | − struct vif_params *params); | |
| 60 | −static s32 __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, | |
| 61 | − struct cfg80211_scan_request *request, | |
| 62 | − struct cfg80211_ssid *this_ssid); | |
| 63 | −static s32 wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, | |
| 64 | − struct cfg80211_scan_request *request); | |
| 65 | −static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed); | |
| 66 | −static s32 wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, | |
| 67 | − struct cfg80211_ibss_params *params); | |
| 68 | −static s32 wl_cfg80211_leave_ibss(struct wiphy *wiphy, | |
| 69 | − struct net_device *dev); | |
| 70 | −static s32 wl_cfg80211_get_station(struct wiphy *wiphy, | |
| 71 | − struct net_device *dev, u8 *mac, | |
| 72 | − struct station_info *sinfo); | |
| 73 | −static s32 wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, | |
| 74 | − struct net_device *dev, bool enabled, | |
| 75 | − s32 timeout); | |
| 76 | −static s32 wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, | |
| 77 | − struct net_device *dev, | |
| 78 | − const u8 *addr, | |
| 79 | − const struct cfg80211_bitrate_mask | |
| 80 | − *mask); | |
| 81 | −static int wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, | |
| 82 | − struct cfg80211_connect_params *sme); | |
| 83 | −static s32 wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, | |
| 84 | − u16 reason_code); | |
| 85 | −static s32 wl_cfg80211_set_tx_power(struct wiphy *wiphy, | |
| 46 | +static s32 brcmf_cfg80211_change_iface(struct wiphy *wiphy, | |
| 47 | + struct net_device *ndev, | |
| 48 | + enum nl80211_iftype type, u32 *flags, | |
| 49 | + struct vif_params *params); | |
| 50 | +static s32 __brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, | |
| 51 | + struct cfg80211_scan_request *request, | |
| 52 | + struct cfg80211_ssid *this_ssid); | |
| 53 | +static s32 brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, | |
| 54 | + struct cfg80211_scan_request *request); | |
| 55 | +static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed); | |
| 56 | +static s32 brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, | |
| 57 | + struct cfg80211_ibss_params *params); | |
| 58 | +static s32 brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, | |
| 59 | + struct net_device *dev); | |
| 60 | +static s32 brcmf_cfg80211_get_station(struct wiphy *wiphy, | |
| 61 | + struct net_device *dev, u8 *mac, | |
| 62 | + struct station_info *sinfo); | |
| 63 | +static s32 brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, | |
| 64 | + struct net_device *dev, bool enabled, | |
| 65 | + s32 timeout); | |
| 66 | +static s32 brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, | |
| 67 | + struct net_device *dev, | |
| 68 | + const u8 *addr, | |
| 69 | + const struct cfg80211_bitrate_mask | |
| 70 | + *mask); | |
| 71 | +static int brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, | |
| 72 | + struct cfg80211_connect_params *sme); | |
| 73 | +static s32 brcmf_cfg80211_disconnect(struct wiphy *wiphy, | |
| 74 | + struct net_device *dev, | |
| 75 | + u16 reason_code); | |
| 76 | +static s32 brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, | |
| 86 | 77 | enum nl80211_tx_power_setting type, |
| 87 | 78 | s32 dbm); |
| 88 | −static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm); | |
| 89 | −static s32 wl_cfg80211_config_default_key(struct wiphy *wiphy, | |
| 79 | +static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm); | |
| 80 | +static s32 brcmf_cfg80211_config_default_key(struct wiphy *wiphy, | |
| 90 | 81 | struct net_device *dev, u8 key_idx, |
| 91 | 82 | bool unicast, bool multicast); |
| 92 | −static s32 wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |
| 83 | +static s32 brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |
| 93 | 84 | u8 key_idx, bool pairwise, const u8 *mac_addr, |
| 94 | 85 | struct key_params *params); |
| 95 | −static s32 wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, | |
| 86 | +static s32 brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, | |
| 96 | 87 | u8 key_idx, bool pairwise, const u8 *mac_addr); |
| 97 | −static s32 wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, | |
| 88 | +static s32 brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, | |
| 98 | 89 | u8 key_idx, bool pairwise, const u8 *mac_addr, |
| 99 | 90 | void *cookie, void (*callback) (void *cookie, |
| 100 | 91 | struct |
| 101 | 92 | key_params * |
| 102 | 93 | params)); |
| 103 | −static s32 wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, | |
| 94 | +static s32 brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, | |
| 104 | 95 | struct net_device *dev, |
| 105 | 96 | u8 key_idx); |
| 106 | −static s32 wl_cfg80211_resume(struct wiphy *wiphy); | |
| 107 | −static s32 wl_cfg80211_suspend(struct wiphy *wiphy); | |
| 108 | −static s32 wl_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, | |
| 97 | +static s32 brcmf_cfg80211_resume(struct wiphy *wiphy); | |
| 98 | +static s32 brcmf_cfg80211_suspend(struct wiphy *wiphy, | |
| 99 | + struct cfg80211_wowlan *wow); | |
| 100 | +static s32 brcmf_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, | |
| 109 | 101 | struct cfg80211_pmksa *pmksa); |
| 110 | −static s32 wl_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, | |
| 102 | +static s32 brcmf_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *dev, | |
| 111 | 103 | struct cfg80211_pmksa *pmksa); |
| 112 | −static s32 wl_cfg80211_flush_pmksa(struct wiphy *wiphy, | |
| 104 | +static s32 brcmf_cfg80211_flush_pmksa(struct wiphy *wiphy, | |
| 113 | 105 | struct net_device *dev); |
| 114 | 106 | /* |
| 115 | 107 | ** event & event Q handlers for cfg80211 interfaces |
| 116 | 108 | */ |
| 117 | −static s32 wl_create_event_handler(struct wl_priv *wl); | |
| 118 | −static void wl_destroy_event_handler(struct wl_priv *wl); | |
| 119 | −static s32 wl_event_handler(void *data); | |
| 120 | −static void wl_init_eq(struct wl_priv *wl); | |
| 121 | −static void wl_flush_eq(struct wl_priv *wl); | |
| 122 | −static void wl_lock_eq(struct wl_priv *wl); | |
| 123 | −static void wl_unlock_eq(struct wl_priv *wl); | |
| 124 | −static void wl_init_eq_lock(struct wl_priv *wl); | |
| 125 | −static void wl_init_eloop_handler(struct wl_event_loop *el); | |
| 126 | −static struct wl_event_q *wl_deq_event(struct wl_priv *wl); | |
| 127 | −static s32 wl_enq_event(struct wl_priv *wl, u32 type, | |
| 128 | − const wl_event_msg_t *msg, void *data); | |
| 129 | −static void wl_put_event(struct wl_event_q *e); | |
| 130 | −static void wl_wakeup_event(struct wl_priv *wl); | |
| 131 | −static s32 wl_notify_connect_status(struct wl_priv *wl, | |
| 132 | − struct net_device *ndev, | |
| 133 | − const wl_event_msg_t *e, void *data); | |
| 134 | −static s32 wl_notify_roaming_status(struct wl_priv *wl, | |
| 135 | − struct net_device *ndev, | |
| 136 | − const wl_event_msg_t *e, void *data); | |
| 137 | −static s32 wl_notify_scan_status(struct wl_priv *wl, struct net_device *ndev, | |
| 138 | − const wl_event_msg_t *e, void *data); | |
| 139 | −static s32 wl_bss_connect_done(struct wl_priv *wl, struct net_device *ndev, | |
| 140 | − const wl_event_msg_t *e, void *data, | |
| 141 | − bool completed); | |
| 142 | −static s32 wl_bss_roaming_done(struct wl_priv *wl, struct net_device *ndev, | |
| 143 | − const wl_event_msg_t *e, void *data); | |
| 144 | −static s32 wl_notify_mic_status(struct wl_priv *wl, struct net_device *ndev, | |
| 145 | − const wl_event_msg_t *e, void *data); | |
| 109 | +static s32 brcmf_create_event_handler(struct brcmf_cfg80211_priv *cfg_priv); | |
| 110 | +static void brcmf_destroy_event_handler(struct brcmf_cfg80211_priv *cfg_priv); | |
| 111 | +static s32 brcmf_event_handler(void *data); | |
| 112 | +static void brcmf_init_eq(struct brcmf_cfg80211_priv *cfg_priv); | |
| 113 | +static void brcmf_flush_eq(struct brcmf_cfg80211_priv *cfg_priv); | |
| 114 | +static void brcmf_lock_eq(struct brcmf_cfg80211_priv *cfg_priv); | |
| 115 | +static void brcmf_unlock_eq(struct brcmf_cfg80211_priv *cfg_priv); | |
| 116 | +static void brcmf_init_eq_lock(struct brcmf_cfg80211_priv *cfg_priv); | |
| 117 | +static void brcmf_init_eloop_handler(struct brcmf_cfg80211_event_loop *el); | |
| 118 | +static struct brcmf_cfg80211_event_q * | |
| 119 | +brcmf_deq_event(struct brcmf_cfg80211_priv *cfg_priv); | |
| 120 | +static s32 brcmf_enq_event(struct brcmf_cfg80211_priv *cfg_priv, u32 type, | |
| 121 | + const struct brcmf_event_msg *msg, void *data); | |
| 122 | +static void brcmf_put_event(struct brcmf_cfg80211_event_q *e); | |
| 123 | +static void brcmf_wakeup_event(struct brcmf_cfg80211_priv *cfg_priv); | |
| 124 | +static s32 brcmf_notify_connect_status(struct brcmf_cfg80211_priv *cfg_priv, | |
| 125 | + struct net_device *ndev, | |
| 126 | + const struct brcmf_event_msg *e, | |
| 127 | + void *data); | |
| 128 | +static s32 brcmf_notify_roaming_status(struct brcmf_cfg80211_priv *cfg_priv, | |
| 129 | + struct net_device *ndev, | |
| 130 | + const struct brcmf_event_msg *e, | |
| 131 | + void *data); | |
| 132 | +static s32 brcmf_notify_scan_status(struct brcmf_cfg80211_priv *cfg_priv, | |
| 133 | + struct net_device *ndev, | |
| 134 | + const struct brcmf_event_msg *e, | |
| 135 | + void *data); | |
| 136 | +static s32 brcmf_bss_connect_done(struct brcmf_cfg80211_priv *cfg_priv, | |
| 137 | + struct net_device *ndev, | |
| 138 | + const struct brcmf_event_msg *e, void *data, | |
| 139 | + bool completed); | |
| 140 | +static s32 brcmf_bss_roaming_done(struct brcmf_cfg80211_priv *cfg_priv, | |
| 141 | + struct net_device *ndev, | |
| 142 | + const struct brcmf_event_msg *e, void *data); | |
| 143 | +static s32 brcmf_notify_mic_status(struct brcmf_cfg80211_priv *cfg_priv, | |
| 144 | + struct net_device *ndev, | |
| 145 | + const struct brcmf_event_msg *e, void *data); | |
| 146 | 146 | |
| 147 | 147 | /* |
| 148 | 148 | ** register/deregister sdio function |
| 149 | 149 | */ |
| 150 | −struct sdio_func *wl_cfg80211_get_sdio_func(void); | |
| 151 | −static void wl_clear_sdio_func(void); | |
| 150 | +static void brcmf_clear_sdio_func(void); | |
| 152 | 151 | |
| 153 | 152 | /* |
| 154 | 153 | ** ioctl utilites |
| 155 | 154 | */ |
| 156 | −static s32 wl_dev_bufvar_get(struct net_device *dev, s8 *name, s8 *buf, | |
| 155 | +static s32 brcmf_dev_bufvar_get(struct net_device *dev, s8 *name, s8 *buf, | |
| 157 | 156 | s32 buf_len); |
| 158 | −static __used s32 wl_dev_bufvar_set(struct net_device *dev, s8 *name, | |
| 157 | +static __used s32 brcmf_dev_bufvar_set(struct net_device *dev, s8 *name, | |
| 159 | 158 | s8 *buf, s32 len); |
| 160 | −static s32 wl_dev_intvar_set(struct net_device *dev, s8 *name, s32 val); | |
| 161 | −static s32 wl_dev_intvar_get(struct net_device *dev, s8 *name, | |
| 159 | +static s32 brcmf_dev_intvar_set(struct net_device *dev, s8 *name, s32 val); | |
| 160 | +static s32 brcmf_dev_intvar_get(struct net_device *dev, s8 *name, | |
| 162 | 161 | s32 *retval); |
| 163 | −static s32 wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, | |
| 162 | +static s32 brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, | |
| 164 | 163 | u32 len); |
| 165 | 164 | |
| 166 | 165 | /* |
| 167 | 166 | ** cfg80211 set_wiphy_params utilities |
| 168 | 167 | */ |
| 169 | −static s32 wl_set_frag(struct net_device *dev, u32 frag_threshold); | |
| 170 | −static s32 wl_set_rts(struct net_device *dev, u32 frag_threshold); | |
| 171 | −static s32 wl_set_retry(struct net_device *dev, u32 retry, bool l); | |
| 168 | +static s32 brcmf_set_frag(struct net_device *dev, u32 frag_threshold); | |
| 169 | +static s32 brcmf_set_rts(struct net_device *dev, u32 frag_threshold); | |
| 170 | +static s32 brcmf_set_retry(struct net_device *dev, u32 retry, bool l); | |
| 172 | 171 | |
| 173 | 172 | /* |
| 174 | 173 | ** wl profile utilities |
| 175 | 174 | */ |
| 176 | −static s32 wl_update_prof(struct wl_priv *wl, const wl_event_msg_t *e, | |
| 177 | − void *data, s32 item); | |
| 178 | −static void *wl_read_prof(struct wl_priv *wl, s32 item); | |
| 179 | −static void wl_init_prof(struct wl_profile *prof); | |
| 175 | +static s32 brcmf_update_prof(struct brcmf_cfg80211_priv *cfg_priv, | |
| 176 | + const struct brcmf_event_msg *e, | |
| 177 | + void *data, s32 item); | |
| 178 | +static void *brcmf_read_prof(struct brcmf_cfg80211_priv *cfg_priv, s32 item); | |
| 179 | +static void brcmf_init_prof(struct brcmf_cfg80211_profile *prof); | |
| 180 | 180 | |
| 181 | 181 | /* |
| 182 | 182 | ** cfg80211 connect utilites |
| 183 | 183 | */ |
| 184 | −static s32 wl_set_wpa_version(struct net_device *dev, | |
| 184 | +static s32 brcmf_set_wpa_version(struct net_device *dev, | |
| 185 | 185 | struct cfg80211_connect_params *sme); |
| 186 | −static s32 wl_set_auth_type(struct net_device *dev, | |
| 186 | +static s32 brcmf_set_auth_type(struct net_device *dev, | |
| 187 | 187 | struct cfg80211_connect_params *sme); |
| 188 | −static s32 wl_set_set_cipher(struct net_device *dev, | |
| 188 | +static s32 brcmf_set_set_cipher(struct net_device *dev, | |
| 189 | 189 | struct cfg80211_connect_params *sme); |
| 190 | −static s32 wl_set_key_mgmt(struct net_device *dev, | |
| 190 | +static s32 brcmf_set_key_mgmt(struct net_device *dev, | |
| 191 | 191 | struct cfg80211_connect_params *sme); |
| 192 | −static s32 wl_set_set_sharedkey(struct net_device *dev, | |
| 192 | +static s32 brcmf_set_set_sharedkey(struct net_device *dev, | |
| 193 | 193 | struct cfg80211_connect_params *sme); |
| 194 | −static s32 wl_get_assoc_ies(struct wl_priv *wl); | |
| 195 | −static void wl_clear_assoc_ies(struct wl_priv *wl); | |
| 196 | −static void wl_ch_to_chanspec(int ch, | |
| 197 | − struct wl_join_params *join_params, size_t *join_params_size); | |
| 194 | +static s32 brcmf_get_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv); | |
| 195 | +static void brcmf_clear_assoc_ies(struct brcmf_cfg80211_priv *cfg_priv); | |
| 196 | +static void brcmf_ch_to_chanspec(int ch, | |
| 197 | + struct brcmf_join_params *join_params, size_t *join_params_size); | |
| 198 | 198 | |
| 199 | 199 | /* |
| 200 | 200 | ** information element utilities |
| 201 | 201 | */ |
| 202 | −static __used s32 wl_add_ie(struct wl_priv *wl, u8 t, u8 l, u8 *v); | |
| 203 | −static s32 wl_mode_to_nl80211_iftype(s32 mode); | |
| 204 | −static struct wireless_dev *wl_alloc_wdev(s32 sizeof_iface, | |
| 202 | +static __used s32 brcmf_add_ie(struct brcmf_cfg80211_priv *cfg_priv, | |
| 203 | + u8 t, u8 l, u8 *v); | |
| 204 | +static s32 brcmf_mode_to_nl80211_iftype(s32 mode); | |
| 205 | +static struct wireless_dev *brcmf_alloc_wdev(s32 sizeof_iface, | |
| 205 | 206 | struct device *dev); |
| 206 | −static void wl_free_wdev(struct wl_priv *wl); | |
| 207 | −static s32 wl_inform_bss(struct wl_priv *wl); | |
| 208 | −static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi); | |
| 209 | −static s32 wl_update_bss_info(struct wl_priv *wl); | |
| 210 | −static s32 wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, | |
| 207 | +static void brcmf_free_wdev(struct brcmf_cfg80211_priv *cfg_priv); | |
| 208 | +static s32 brcmf_inform_bss(struct brcmf_cfg80211_priv *cfg_priv); | |
| 209 | +static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_priv *cfg_priv, | |
| 210 | + struct brcmf_bss_info *bi); | |
| 211 | +static s32 brcmf_update_bss_info(struct brcmf_cfg80211_priv *cfg_priv); | |
| 212 | +static s32 brcmf_add_keyext(struct wiphy *wiphy, struct net_device *dev, | |
| 211 | 213 | u8 key_idx, const u8 *mac_addr, |
| 212 | 214 | struct key_params *params); |
| 213 | 215 | |
| 214 | 216 | /* |
| 215 | 217 | ** key indianess swap utilities |
| 216 | 218 | */ |
| 217 | −static void swap_key_from_BE(struct wl_wsec_key *key); | |
| 218 | −static void swap_key_to_BE(struct wl_wsec_key *key); | |
| 219 | +static void swap_key_from_BE(struct brcmf_wsec_key *key); | |
| 220 | +static void swap_key_to_BE(struct brcmf_wsec_key *key); | |
| 219 | 221 | |
| 220 | 222 | /* |
| 221 | −** wl_priv memory init/deinit utilities | |
| 223 | +** brcmf_cfg80211_priv memory init/deinit utilities | |
| 222 | 224 | */ |
| 223 | −static s32 wl_init_priv_mem(struct wl_priv *wl); | |
| 224 | −static void wl_deinit_priv_mem(struct wl_priv *wl); | |
| 225 | +static s32 brcmf_init_priv_mem(struct brcmf_cfg80211_priv *cfg_priv); | |
| 226 | +static void brcmf_deinit_priv_mem(struct brcmf_cfg80211_priv *cfg_priv); | |
| 225 | 227 | |
| 226 | −static void wl_delay(u32 ms); | |
| 228 | +static void brcmf_delay(u32 ms); | |
| 227 | 229 | |
| 228 | 230 | /* |
| 229 | 231 | ** store/restore cfg80211 instance data |
| 230 | 232 | */ |
| 231 | −static void wl_set_drvdata(struct wl_dev *dev, void *data); | |
| 232 | −static void *wl_get_drvdata(struct wl_dev *dev); | |
| 233 | +static void brcmf_set_drvdata(struct brcmf_cfg80211_dev *dev, void *data); | |
| 234 | +static void *brcmf_get_drvdata(struct brcmf_cfg80211_dev *dev); | |
| 233 | 235 | |
| 234 | 236 | /* |
| 235 | 237 | ** ibss mode utilities |
| 236 | 238 | */ |
| 237 | −static bool wl_is_ibssmode(struct wl_priv *wl); | |
| 239 | +static bool brcmf_is_ibssmode(struct brcmf_cfg80211_priv *cfg_priv); | |
| 238 | 240 | |
| 239 | 241 | /* |
| 240 | 242 | ** dongle up/down , default configuration utilities |
| 241 | 243 | */ |
| 242 | −static bool wl_is_linkdown(struct wl_priv *wl, const wl_event_msg_t *e); | |
| 243 | −static bool wl_is_linkup(struct wl_priv *wl, const wl_event_msg_t *e); | |
| 244 | −static bool wl_is_nonetwork(struct wl_priv *wl, const wl_event_msg_t *e); | |
| 245 | −static void wl_link_down(struct wl_priv *wl); | |
| 246 | −static s32 wl_dongle_mode(struct net_device *ndev, s32 iftype); | |
| 247 | −static s32 __wl_cfg80211_up(struct wl_priv *wl); | |
| 248 | −static s32 __wl_cfg80211_down(struct wl_priv *wl); | |
| 249 | −static s32 wl_dongle_probecap(struct wl_priv *wl); | |
| 250 | −static void wl_init_conf(struct wl_conf *conf); | |
| 244 | +static bool brcmf_is_linkdown(struct brcmf_cfg80211_priv *cfg_priv, | |
| 245 | + const struct brcmf_event_msg *e); | |
| 246 | +static bool brcmf_is_linkup(struct brcmf_cfg80211_priv *cfg_priv, | |
| 247 | + const struct brcmf_event_msg *e); | |
| 248 | +static bool brcmf_is_nonetwork(struct brcmf_cfg80211_priv *cfg_priv, | |
| 249 | + const struct brcmf_event_msg *e); | |
| 250 | +static void brcmf_link_down(struct brcmf_cfg80211_priv *cfg_priv); | |
| 251 | +static s32 brcmf_dongle_mode(struct net_device *ndev, s32 iftype); | |
| 252 | +static s32 __brcmf_cfg80211_up(struct brcmf_cfg80211_priv *cfg_priv); | |
| 253 | +static s32 __brcmf_cfg80211_down(struct brcmf_cfg80211_priv *cfg_priv); | |
| 254 | +static s32 brcmf_dongle_probecap(struct brcmf_cfg80211_priv *cfg_priv); | |
| 255 | +static void brcmf_init_conf(struct brcmf_cfg80211_conf *conf); | |
| 251 | 256 | |
| 252 | 257 | /* |
| 253 | 258 | ** dongle configuration utilities |
| 254 | 259 | */ |
| 255 | −#ifndef EMBEDDED_PLATFORM | |
| 256 | −static s32 wl_dongle_mode(struct net_device *ndev, s32 iftype); | |
| 257 | −static s32 wl_dongle_country(struct net_device *ndev, u8 ccode); | |
| 258 | −static s32 wl_dongle_up(struct net_device *ndev, u32 up); | |
| 259 | −static s32 wl_dongle_power(struct net_device *ndev, u32 power_mode); | |
| 260 | −static s32 wl_dongle_glom(struct net_device *ndev, u32 glom, | |
| 261 | − u32 dongle_align); | |
| 262 | −static s32 wl_dongle_offload(struct net_device *ndev, s32 arpoe, | |
| 263 | − s32 arp_ol); | |
| 264 | −static s32 wl_pattern_atoh(s8 *src, s8 *dst); | |
| 265 | −static s32 wl_dongle_filter(struct net_device *ndev, u32 filter_mode); | |
| 266 | −static s32 wl_update_wiphybands(struct wl_priv *wl); | |
| 267 | −#endif /* !EMBEDDED_PLATFORM */ | |
| 268 | − | |
| 269 | −static s32 wl_dongle_eventmsg(struct net_device *ndev); | |
| 270 | −static s32 wl_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time, | |
| 271 | − s32 scan_unassoc_time, s32 scan_passive_time); | |
| 272 | −static s32 wl_config_dongle(struct wl_priv *wl, bool need_lock); | |
| 273 | −static s32 wl_dongle_roam(struct net_device *ndev, u32 roamvar, | |
| 260 | +static s32 brcmf_dongle_eventmsg(struct net_device *ndev); | |
| 261 | +static s32 brcmf_dongle_scantime(struct net_device *ndev, s32 scan_assoc_time, | |
| 262 | + s32 scan_unassoc_time, s32 scan_passive_time); | |
| 263 | +static s32 brcmf_config_dongle(struct brcmf_cfg80211_priv *cfg_priv, | |
| 264 | + bool need_lock); | |
| 265 | +static s32 brcmf_dongle_roam(struct net_device *ndev, u32 roamvar, | |
| 274 | 266 | u32 bcn_timeout); |
| 275 | 267 | |
| 276 | 268 | /* |
| 277 | 269 | ** iscan handler |
| 278 | 270 | */ |
| 279 | −static void wl_iscan_timer(unsigned long data); | |
| 280 | −static void wl_term_iscan(struct wl_priv *wl); | |
| 281 | −static s32 wl_init_iscan(struct wl_priv *wl); | |
| 282 | −static s32 wl_iscan_thread(void *data); | |
| 283 | −static s32 wl_dev_iovar_setbuf(struct net_device *dev, s8 *iovar, | |
| 271 | +static void brcmf_iscan_timer(unsigned long data); | |
| 272 | +static void brcmf_term_iscan(struct brcmf_cfg80211_priv *cfg_priv); | |
| 273 | +static s32 brcmf_init_iscan(struct brcmf_cfg80211_priv *cfg_priv); | |
| 274 | +static s32 brcmf_iscan_thread(void *data); | |
| 275 | +static s32 brcmf_dev_iovar_setbuf(struct net_device *dev, s8 *iovar, | |
| 284 | 276 | void *param, s32 paramlen, void *bufptr, |
| 285 | 277 | s32 buflen); |
| 286 | −static s32 wl_dev_iovar_getbuf(struct net_device *dev, s8 *iovar, | |
| 278 | +static s32 brcmf_dev_iovar_getbuf(struct net_device *dev, s8 *iovar, | |
| 287 | 279 | void *param, s32 paramlen, void *bufptr, |
| 288 | 280 | s32 buflen); |
| 289 | −static s32 wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid, | |
| 290 | − u16 action); | |
| 291 | −static s32 wl_do_iscan(struct wl_priv *wl); | |
| 292 | −static s32 wl_wakeup_iscan(struct wl_iscan_ctrl *iscan); | |
| 293 | −static s32 wl_invoke_iscan(struct wl_priv *wl); | |
| 294 | −static s32 wl_get_iscan_results(struct wl_iscan_ctrl *iscan, u32 *status, | |
| 295 | − struct wl_scan_results **bss_list); | |
| 296 | −static void wl_notify_iscan_complete(struct wl_iscan_ctrl *iscan, bool aborted); | |
| 297 | −static void wl_init_iscan_eloop(struct wl_iscan_eloop *el); | |
| 298 | −static s32 wl_iscan_done(struct wl_priv *wl); | |
| 299 | −static s32 wl_iscan_pending(struct wl_priv *wl); | |
| 300 | −static s32 wl_iscan_inprogress(struct wl_priv *wl); | |
| 301 | −static s32 wl_iscan_aborted(struct wl_priv *wl); | |
| 302 | − | |
| 303 | −/* | |
| 304 | −** fw/nvram downloading handler | |
| 305 | −*/ | |
| 306 | −static void wl_init_fw(struct wl_fw_ctrl *fw); | |
| 281 | +static s32 brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan, | |
| 282 | + struct brcmf_ssid *ssid, u16 action); | |
| 283 | +static s32 brcmf_do_iscan(struct brcmf_cfg80211_priv *cfg_priv); | |
| 284 | +static s32 brcmf_wakeup_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan); | |
| 285 | +static s32 brcmf_invoke_iscan(struct brcmf_cfg80211_priv *cfg_priv); | |
| 286 | +static s32 brcmf_get_iscan_results(struct brcmf_cfg80211_iscan_ctrl *iscan, | |
| 287 | + u32 *status, | |
| 288 | + struct brcmf_scan_results **bss_list); | |
| 289 | +static void brcmf_notify_iscan_complete(struct brcmf_cfg80211_iscan_ctrl *iscan, | |
| 290 | + bool aborted); | |
| 291 | +static void brcmf_init_iscan_eloop(struct brcmf_cfg80211_iscan_eloop *el); | |
| 292 | +static s32 brcmf_iscan_done(struct brcmf_cfg80211_priv *cfg_priv); | |
| 293 | +static s32 brcmf_iscan_pending(struct brcmf_cfg80211_priv *cfg_priv); | |
| 294 | +static s32 brcmf_iscan_inprogress(struct brcmf_cfg80211_priv *cfg_priv); | |
| 295 | +static s32 brcmf_iscan_aborted(struct brcmf_cfg80211_priv *cfg_priv); | |
| 307 | 296 | |
| 308 | 297 | /* |
| 309 | 298 | * find most significant bit set |
| 310 | 299 | */ |
| 311 | −static __used u32 wl_find_msb(u16 bit16); | |
| 300 | +static __used u32 brcmf_find_msb(u16 bit16); | |
| 312 | 301 | |
| 313 | 302 | /* |
| 314 | 303 | * update pmklist to dongle |
| 315 | 304 | */ |
| 316 | −static __used s32 wl_update_pmklist(struct net_device *dev, | |
| 317 | − struct wl_pmk_list *pmk_list, s32 err); | |
| 305 | +static __used s32 brcmf_update_pmklist(struct net_device *dev, | |
| 306 | + struct brcmf_cfg80211_pmk_list *pmk_list, | |
| 307 | + s32 err); | |
| 318 | 308 | |
| 319 | −static void wl_set_mpc(struct net_device *ndev, int mpc); | |
| 309 | +static void brcmf_set_mpc(struct net_device *ndev, int mpc); | |
| 320 | 310 | |
| 321 | 311 | /* |
| 322 | 312 | * debufs support |
| 323 | 313 | */ |
| 324 | −static int wl_debugfs_add_netdev_params(struct wl_priv *wl); | |
| 325 | −static void wl_debugfs_remove_netdev(struct wl_priv *wl); | |
| 314 | +static int | |
| 315 | +brcmf_debugfs_add_netdev_params(struct brcmf_cfg80211_priv *cfg_priv); | |
| 316 | +static void brcmf_debugfs_remove_netdev(struct brcmf_cfg80211_priv *cfg_priv); | |
| 326 | 317 | |
| 327 | −#define WL_PRIV_GET() \ | |
| 318 | +#define WL_PRIV_GET() \ | |
| 328 | 319 | ({ \ |
| 329 | − struct wl_iface *ci; \ | |
| 330 | − if (unlikely(!(wl_cfg80211_dev && \ | |
| 331 | − (ci = wl_get_drvdata(wl_cfg80211_dev))))) { \ | |
| 320 | + struct brcmf_cfg80211_iface *ci = brcmf_get_drvdata(cfg80211_dev); \ | |
| 321 | + if (unlikely(!ci)) { \ | |
| 332 | 322 | WL_ERR("wl_cfg80211_dev is unavailable\n"); \ |
| 333 | 323 | BUG(); \ |
| 334 | − } \ | |
| 335 | − ci_to_wl(ci); \ | |
| 324 | + } \ | |
| 325 | + ci->cfg_priv; \ | |
| 336 | 326 | }) |
| 337 | 327 | |
| 338 | 328 | #define CHECK_SYS_UP() \ |
| 339 | 329 | do { \ |
| 340 | − struct wl_priv *wl = wiphy_to_wl(wiphy); \ | |
| 341 | − if (unlikely(!test_bit(WL_STATUS_READY, &wl->status))) { \ | |
| 330 | + struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); \ | |
| 331 | + if (unlikely(!test_bit(WL_STATUS_READY, &cfg_priv->status))) { \ | |
| 342 | 332 | WL_INFO("device is not ready : status (%d)\n", \ |
| 343 | − (int)wl->status); \ | |
| 333 | + (int)cfg_priv->status); \ | |
| 344 | 334 | return -EIO; \ |
| 345 | 335 | } \ |
| 346 | 336 | } while (0) |
| 347 | 337 | |
| 348 | −extern int dhd_wait_pend8021x(struct net_device *dev); | |
| 349 | 338 | #define CHAN2G(_channel, _freq, _flags) { \ |
| 350 | 339 | .band = IEEE80211_BAND_2GHZ, \ |
| 351 | 340 | .center_freq = (_freq), \ |
| @@ -373,18 +362,18 @@ extern int dhd_wait_pend8021x(struct net_device *dev); · 21 unmodified lines | ||
| 373 | 362 | } |
| 374 | 363 | |
| 375 | 364 | static struct ieee80211_rate __wl_rates[] = { |
| 376 | − RATETAB_ENT(WLC_RATE_1M, 0), | |
| 377 | − RATETAB_ENT(WLC_RATE_2M, IEEE80211_RATE_SHORT_PREAMBLE), | |
| 378 | − RATETAB_ENT(WLC_RATE_5M5, IEEE80211_RATE_SHORT_PREAMBLE), | |
| 379 | − RATETAB_ENT(WLC_RATE_11M, IEEE80211_RATE_SHORT_PREAMBLE), | |
| 380 | − RATETAB_ENT(WLC_RATE_6M, 0), | |
| 381 | − RATETAB_ENT(WLC_RATE_9M, 0), | |
| 382 | − RATETAB_ENT(WLC_RATE_12M, 0), | |
| 383 | − RATETAB_ENT(WLC_RATE_18M, 0), | |
| 384 | − RATETAB_ENT(WLC_RATE_24M, 0), | |
| 385 | − RATETAB_ENT(WLC_RATE_36M, 0), | |
| 386 | − RATETAB_ENT(WLC_RATE_48M, 0), | |
| 387 | − RATETAB_ENT(WLC_RATE_54M, 0), | |
| 365 | + RATETAB_ENT(BRCM_RATE_1M, 0), | |
| 366 | + RATETAB_ENT(BRCM_RATE_2M, IEEE80211_RATE_SHORT_PREAMBLE), | |
| 367 | + RATETAB_ENT(BRCM_RATE_5M5, IEEE80211_RATE_SHORT_PREAMBLE), | |
| 368 | + RATETAB_ENT(BRCM_RATE_11M, IEEE80211_RATE_SHORT_PREAMBLE), | |
| 369 | + RATETAB_ENT(BRCM_RATE_6M, 0), | |
| 370 | + RATETAB_ENT(BRCM_RATE_9M, 0), | |
| 371 | + RATETAB_ENT(BRCM_RATE_12M, 0), | |
| 372 | + RATETAB_ENT(BRCM_RATE_18M, 0), | |
| 373 | + RATETAB_ENT(BRCM_RATE_24M, 0), | |
| 374 | + RATETAB_ENT(BRCM_RATE_36M, 0), | |
| 375 | + RATETAB_ENT(BRCM_RATE_48M, 0), | |
| 376 | + RATETAB_ENT(BRCM_RATE_54M, 0), | |
| 388 | 377 | }; |
| 389 | 378 | |
| 390 | 379 | #define wl_a_rates (__wl_rates + 4) |
| @@ -521,7 +510,7 @@ static const u32 __wl_cipher_suites[] = { · 130 unmodified lines | ||
| 521 | 510 | WLAN_CIPHER_SUITE_AES_CMAC, |
| 522 | 511 | }; |
| 523 | 512 | |
| 524 | −static void swap_key_from_BE(struct wl_wsec_key *key) | |
| 513 | +static void swap_key_from_BE(struct brcmf_wsec_key *key) | |
| 525 | 514 | { |
| 526 | 515 | key->index = cpu_to_le32(key->index); |
| 527 | 516 | key->len = cpu_to_le32(key->len); |
| @@ -532,7 +521,7 @@ static void swap_key_from_BE(struct wl_wsec_key *key) · 4 unmodified lines | ||
| 532 | 521 | key->iv_initialized = cpu_to_le32(key->iv_initialized); |
| 533 | 522 | } |
| 534 | 523 | |
| 535 | −static void swap_key_to_BE(struct wl_wsec_key *key) | |
| 524 | +static void swap_key_to_BE(struct brcmf_wsec_key *key) | |
| 536 | 525 | { |
| 537 | 526 | key->index = le32_to_cpu(key->index); |
| 538 | 527 | key->len = le32_to_cpu(key->len); |
| @@ -544,10 +533,10 @@ static void swap_key_to_BE(struct wl_wsec_key *key) · 5 unmodified lines | ||
| 544 | 533 | } |
| 545 | 534 | |
| 546 | 535 | static s32 |
| 547 | −wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len) | |
| 536 | +brcmf_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len) | |
| 548 | 537 | { |
| 549 | 538 | struct ifreq ifr; |
| 550 | − struct wl_ioctl ioc; | |
| 539 | + struct brcmf_ioctl ioc; | |
| 551 | 540 | mm_segment_t fs; |
| 552 | 541 | s32 err = 0; |
| 553 | 542 | |
| @@ -567,11 +556,11 @@ wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len) · 13 unmodified lines | ||
| 567 | 556 | } |
| 568 | 557 | |
| 569 | 558 | static s32 |
| 570 | −wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, | |
| 559 | +brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, | |
| 571 | 560 | enum nl80211_iftype type, u32 *flags, |
| 572 | 561 | struct vif_params *params) |
| 573 | 562 | { |
| 574 | − struct wl_priv *wl = wiphy_to_wl(wiphy); | |
| 563 | + struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); | |
| 575 | 564 | struct wireless_dev *wdev; |
| 576 | 565 | s32 infra = 0; |
| 577 | 566 | s32 err = 0; |
| @@ -586,11 +575,11 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, · 8 unmodified lines | ||
| 586 | 575 | type); |
| 587 | 576 | return -EOPNOTSUPP; |
| 588 | 577 | case NL80211_IFTYPE_ADHOC: |
| 589 | − wl->conf->mode = WL_MODE_IBSS; | |
| 578 | + cfg_priv->conf->mode = WL_MODE_IBSS; | |
| 590 | 579 | infra = 0; |
| 591 | 580 | break; |
| 592 | 581 | case NL80211_IFTYPE_STATION: |
| 593 | − wl->conf->mode = WL_MODE_BSS; | |
| 582 | + cfg_priv->conf->mode = WL_MODE_BSS; | |
| 594 | 583 | infra = 1; |
| 595 | 584 | break; |
| 596 | 585 | default: |
| @@ -599,7 +588,7 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, · 2 unmodified lines | ||
| 599 | 588 | } |
| 600 | 589 | |
| 601 | 590 | infra = cpu_to_le32(infra); |
| 602 | − err = wl_dev_ioctl(ndev, WLC_SET_INFRA, &infra, sizeof(infra)); | |
| 591 | + err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_INFRA, &infra, sizeof(infra)); | |
| 603 | 592 | if (unlikely(err)) { |
| 604 | 593 | WL_ERR("WLC_SET_INFRA error (%d)\n", err); |
| 605 | 594 | err = -EAGAIN; |
| @@ -609,7 +598,7 @@ wl_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, · 3 unmodified lines | ||
| 609 | 598 | } |
| 610 | 599 | |
| 611 | 600 | WL_INFO("IF Type = %s\n", |
| 612 | − (wl->conf->mode == WL_MODE_IBSS) ? "Adhoc" : "Infra"); | |
| 601 | + (cfg_priv->conf->mode == WL_MODE_IBSS) ? "Adhoc" : "Infra"); | |
| 613 | 602 | |
| 614 | 603 | done: |
| 615 | 604 | WL_TRACE("Exit\n"); |
| @@ -617,7 +606,8 @@ done: · 1 unmodified line | ||
| 617 | 606 | return err; |
| 618 | 607 | } |
| 619 | 608 | |
| 620 | −static void wl_iscan_prep(struct wl_scan_params *params, struct wlc_ssid *ssid) | |
| 609 | +static void wl_iscan_prep(struct brcmf_scan_params *params, | |
| 610 | + struct brcmf_ssid *ssid) | |
| 621 | 611 | { |
| 622 | 612 | memcpy(params->bssid, ether_bcast, ETH_ALEN); |
| 623 | 613 | params->bss_type = DOT11_BSSTYPE_ANY; |
| @@ -633,58 +623,59 @@ static void wl_iscan_prep(struct wl_scan_params *params, struct wlc_ssid *ssid) · 9 unmodified lines | ||
| 633 | 623 | params->passive_time = cpu_to_le32(params->passive_time); |
| 634 | 624 | params->home_time = cpu_to_le32(params->home_time); |
| 635 | 625 | if (ssid && ssid->SSID_len) |
| 636 | − memcpy(¶ms->ssid, ssid, sizeof(wlc_ssid_t)); | |
| 626 | + memcpy(¶ms->ssid, ssid, sizeof(struct brcmf_ssid)); | |
| 637 | 627 | |
| 638 | 628 | } |
| 639 | 629 | |
| 640 | 630 | static s32 |
| 641 | −wl_dev_iovar_setbuf(struct net_device *dev, s8 * iovar, void *param, | |
| 631 | +brcmf_dev_iovar_setbuf(struct net_device *dev, s8 * iovar, void *param, | |
| 642 | 632 | s32 paramlen, void *bufptr, s32 buflen) |
| 643 | 633 | { |
| 644 | 634 | s32 iolen; |
| 645 | 635 | |
| 646 | − iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen); | |
| 636 | + iolen = brcmu_mkiovar(iovar, param, paramlen, bufptr, buflen); | |
| 647 | 637 | BUG_ON(!iolen); |
| 648 | 638 | |
| 649 | − return wl_dev_ioctl(dev, WLC_SET_VAR, bufptr, iolen); | |
| 639 | + return brcmf_dev_ioctl(dev, BRCMF_C_SET_VAR, bufptr, iolen); | |
| 650 | 640 | } |
| 651 | 641 | |
| 652 | 642 | static s32 |
| 653 | −wl_dev_iovar_getbuf(struct net_device *dev, s8 * iovar, void *param, | |
| 643 | +brcmf_dev_iovar_getbuf(struct net_device *dev, s8 * iovar, void *param, | |
| 654 | 644 | s32 paramlen, void *bufptr, s32 buflen) |
| 655 | 645 | { |
| 656 | 646 | s32 iolen; |
| 657 | 647 | |
| 658 | − iolen = bcm_mkiovar(iovar, param, paramlen, bufptr, buflen); | |
| 648 | + iolen = brcmu_mkiovar(iovar, param, paramlen, bufptr, buflen); | |
| 659 | 649 | BUG_ON(!iolen); |
| 660 | 650 | |
| 661 | − return wl_dev_ioctl(dev, WLC_GET_VAR, bufptr, buflen); | |
| 651 | + return brcmf_dev_ioctl(dev, BRCMF_C_GET_VAR, bufptr, buflen); | |
| 662 | 652 | } |
| 663 | 653 | |
| 664 | 654 | static s32 |
| 665 | −wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid, u16 action) | |
| 655 | +brcmf_run_iscan(struct brcmf_cfg80211_iscan_ctrl *iscan, | |
| 656 | + struct brcmf_ssid *ssid, u16 action) | |
| 666 | 657 | { |
| 667 | − s32 params_size = | |
| 668 | − (WL_SCAN_PARAMS_FIXED_SIZE + offsetof(wl_iscan_params_t, params)); | |
| 669 | − struct wl_iscan_params *params; | |
| 658 | + s32 params_size = (BRCMF_SCAN_PARAMS_FIXED_SIZE + | |
| 659 | + offsetof(struct brcmf_iscan_params, params)); | |
| 660 | + struct brcmf_iscan_params *params; | |
| 670 | 661 | s32 err = 0; |
| 671 | 662 | |
| 672 | 663 | if (ssid && ssid->SSID_len) |
| 673 | − params_size += sizeof(struct wlc_ssid); | |
| 664 | + params_size += sizeof(struct brcmf_ssid); | |
| 674 | 665 | params = kzalloc(params_size, GFP_KERNEL); |
| 675 | 666 | if (unlikely(!params)) |
| 676 | 667 | return -ENOMEM; |
| 677 | − BUG_ON(params_size >= WLC_IOCTL_SMLEN); | |
| 668 | + BUG_ON(params_size >= BRCMF_C_IOCTL_SMLEN); | |
| 678 | 669 | |
| 679 | 670 | wl_iscan_prep(¶ms->params, ssid); |
| 680 | 671 | |
| 681 | − params->version = cpu_to_le32(ISCAN_REQ_VERSION); | |
| 672 | + params->version = cpu_to_le32(BRCMF_ISCAN_REQ_VERSION); | |
| 682 | 673 | params->action = cpu_to_le16(action); |
| 683 | 674 | params->scan_duration = cpu_to_le16(0); |
| 684 | 675 | |
| 685 | − /* params_size += offsetof(wl_iscan_params_t, params); */ | |
| 686 | − err = wl_dev_iovar_setbuf(iscan->dev, "iscan", params, params_size, | |
| 687 | − iscan->ioctl_buf, WLC_IOCTL_SMLEN); | |
| 676 | + /* params_size += offsetof(struct brcmf_iscan_params, params); */ | |
| 677 | + err = brcmf_dev_iovar_setbuf(iscan->dev, "iscan", params, params_size, | |
| 678 | + iscan->ioctl_buf, BRCMF_C_IOCTL_SMLEN); | |
| 688 | 679 | if (unlikely(err)) { |
| 689 | 680 | if (err == -EBUSY) { |
| 690 | 681 | WL_INFO("system busy : iscan canceled\n"); |
| @@ -696,11 +687,11 @@ wl_run_iscan(struct wl_iscan_ctrl *iscan, struct wlc_ssid *ssid, u16 action) · 5 unmodified lines | ||
| 696 | 687 | return err; |
| 697 | 688 | } |
| 698 | 689 | |
| 699 | −static s32 wl_do_iscan(struct wl_priv *wl) | |
| 690 | +static s32 brcmf_do_iscan(struct brcmf_cfg80211_priv *cfg_priv) | |
| 700 | 691 | { |
| 701 | − struct wl_iscan_ctrl *iscan = wl_to_iscan(wl); | |
| 702 | − struct net_device *ndev = wl_to_ndev(wl); | |
| 703 | − struct wlc_ssid ssid; | |
| 692 | + struct brcmf_cfg80211_iscan_ctrl *iscan = cfg_to_iscan(cfg_priv); | |
| 693 | + struct net_device *ndev = cfg_to_ndev(cfg_priv); | |
| 694 | + struct brcmf_ssid ssid; | |
| 704 | 695 | s32 passive_scan; |
| 705 | 696 | s32 err = 0; |
| 706 | 697 | |
| @@ -709,16 +700,16 @@ static s32 wl_do_iscan(struct wl_priv *wl) · 2 unmodified lines | ||
| 709 | 700 | |
| 710 | 701 | iscan->state = WL_ISCAN_STATE_SCANING; |
| 711 | 702 | |
| 712 | − passive_scan = wl->active_scan ? 0 : 1; | |
| 713 | − err = wl_dev_ioctl(wl_to_ndev(wl), WLC_SET_PASSIVE_SCAN, | |
| 703 | + passive_scan = cfg_priv->active_scan ? 0 : 1; | |
| 704 | + err = brcmf_dev_ioctl(cfg_to_ndev(cfg_priv), BRCMF_C_SET_PASSIVE_SCAN, | |
| 714 | 705 | &passive_scan, sizeof(passive_scan)); |
| 715 | 706 | if (unlikely(err)) { |
| 716 | 707 | WL_ERR("error (%d)\n", err); |
| 717 | 708 | return err; |
| 718 | 709 | } |
| 719 | − wl_set_mpc(ndev, 0); | |
| 720 | − wl->iscan_kickstart = true; | |
| 721 | − wl_run_iscan(iscan, &ssid, WL_SCAN_ACTION_START); | |
| 710 | + brcmf_set_mpc(ndev, 0); | |
| 711 | + cfg_priv->iscan_kickstart = true; | |
| 712 | + brcmf_run_iscan(iscan, &ssid, BRCMF_SCAN_ACTION_START); | |
| 722 | 713 | mod_timer(&iscan->timer, jiffies + iscan->timer_ms * HZ / 1000); |
| 723 | 714 | iscan->timer_on = 1; |
| 724 | 715 | |
| @@ -726,30 +717,30 @@ static s32 wl_do_iscan(struct wl_priv *wl) · 1 unmodified line | ||
| 726 | 717 | } |
| 727 | 718 | |
| 728 | 719 | static s32 |
| 729 | −__wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, | |
| 720 | +__brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, | |
| 730 | 721 | struct cfg80211_scan_request *request, |
| 731 | 722 | struct cfg80211_ssid *this_ssid) |
| 732 | 723 | { |
| 733 | − struct wl_priv *wl = ndev_to_wl(ndev); | |
| 724 | + struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(ndev); | |
| 734 | 725 | struct cfg80211_ssid *ssids; |
| 735 | − struct wl_scan_req *sr = wl_to_sr(wl); | |
| 726 | + struct brcmf_cfg80211_scan_req *sr = cfg_priv->scan_req_int; | |
| 736 | 727 | s32 passive_scan; |
| 737 | 728 | bool iscan_req; |
| 738 | 729 | bool spec_scan; |
| 739 | 730 | s32 err = 0; |
| 740 | 731 | |
| 741 | − if (unlikely(test_bit(WL_STATUS_SCANNING, &wl->status))) { | |
| 742 | − WL_ERR("Scanning already : status (%d)\n", (int)wl->status); | |
| 732 | + if (unlikely(test_bit(WL_STATUS_SCANNING, &cfg_priv->status))) { | |
| 733 | + WL_ERR("Scanning already : status (%lu)\n", cfg_priv->status); | |
| 743 | 734 | return -EAGAIN; |
| 744 | 735 | } |
| 745 | − if (unlikely(test_bit(WL_STATUS_SCAN_ABORTING, &wl->status))) { | |
| 746 | − WL_ERR("Scanning being aborted : status (%d)\n", | |
| 747 | − (int)wl->status); | |
| 736 | + if (unlikely(test_bit(WL_STATUS_SCAN_ABORTING, &cfg_priv->status))) { | |
| 737 | + WL_ERR("Scanning being aborted : status (%lu)\n", | |
| 738 | + cfg_priv->status); | |
| 748 | 739 | return -EAGAIN; |
| 749 | 740 | } |
| 750 | − if (test_bit(WL_STATUS_CONNECTING, &wl->status)) { | |
| 751 | − WL_ERR("Connecting : status (%d)\n", | |
| 752 | − (int)wl->status); | |
| 741 | + if (test_bit(WL_STATUS_CONNECTING, &cfg_priv->status)) { | |
| 742 | + WL_ERR("Connecting : status (%lu)\n", | |
| 743 | + cfg_priv->status); | |
| 753 | 744 | return -EAGAIN; |
| 754 | 745 | } |
| 755 | 746 | |
| @@ -758,7 +749,7 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 2 unmodified lines | ||
| 758 | 749 | if (request) { |
| 759 | 750 | /* scan bss */ |
| 760 | 751 | ssids = request->ssids; |
| 761 | − if (wl->iscan_on && (!ssids || !ssids->ssid_len)) | |
| 752 | + if (cfg_priv->iscan_on && (!ssids || !ssids->ssid_len)) | |
| 762 | 753 | iscan_req = true; |
| 763 | 754 | } else { |
| 764 | 755 | /* scan in ibss */ |
| @@ -766,10 +757,10 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 1 unmodified line | ||
| 766 | 757 | ssids = this_ssid; |
| 767 | 758 | } |
| 768 | 759 | |
| 769 | − wl->scan_request = request; | |
| 770 | − set_bit(WL_STATUS_SCANNING, &wl->status); | |
| 760 | + cfg_priv->scan_request = request; | |
| 761 | + set_bit(WL_STATUS_SCANNING, &cfg_priv->status); | |
| 771 | 762 | if (iscan_req) { |
| 772 | − err = wl_do_iscan(wl); | |
| 763 | + err = brcmf_do_iscan(cfg_priv); | |
| 773 | 764 | if (likely(!err)) |
| 774 | 765 | return err; |
| 775 | 766 | else |
| @@ -788,15 +779,15 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 12 unmodified lines | ||
| 788 | 779 | WL_SCAN("Broadcast scan\n"); |
| 789 | 780 | } |
| 790 | 781 | |
| 791 | − passive_scan = wl->active_scan ? 0 : 1; | |
| 792 | − err = wl_dev_ioctl(ndev, WLC_SET_PASSIVE_SCAN, | |
| 782 | + passive_scan = cfg_priv->active_scan ? 0 : 1; | |
| 783 | + err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_PASSIVE_SCAN, | |
| 793 | 784 | &passive_scan, sizeof(passive_scan)); |
| 794 | 785 | if (unlikely(err)) { |
| 795 | 786 | WL_ERR("WLC_SET_PASSIVE_SCAN error (%d)\n", err); |
| 796 | 787 | goto scan_out; |
| 797 | 788 | } |
| 798 | − wl_set_mpc(ndev, 0); | |
| 799 | − err = wl_dev_ioctl(ndev, WLC_SCAN, &sr->ssid, | |
| 789 | + brcmf_set_mpc(ndev, 0); | |
| 790 | + err = brcmf_dev_ioctl(ndev, BRCMF_C_SCAN, &sr->ssid, | |
| 800 | 791 | sizeof(sr->ssid)); |
| 801 | 792 | if (err) { |
| 802 | 793 | if (err == -EBUSY) { |
| @@ -805,7 +796,7 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 2 unmodified lines | ||
| 805 | 796 | } else { |
| 806 | 797 | WL_ERR("WLC_SCAN error (%d)\n", err); |
| 807 | 798 | } |
| 808 | − wl_set_mpc(ndev, 1); | |
| 799 | + brcmf_set_mpc(ndev, 1); | |
| 809 | 800 | goto scan_out; |
| 810 | 801 | } |
| 811 | 802 | } |
| @@ -813,13 +804,13 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 1 unmodified line | ||
| 813 | 804 | return 0; |
| 814 | 805 | |
| 815 | 806 | scan_out: |
| 816 | − clear_bit(WL_STATUS_SCANNING, &wl->status); | |
| 817 | − wl->scan_request = NULL; | |
| 807 | + clear_bit(WL_STATUS_SCANNING, &cfg_priv->status); | |
| 808 | + cfg_priv->scan_request = NULL; | |
| 818 | 809 | return err; |
| 819 | 810 | } |
| 820 | 811 | |
| 821 | 812 | static s32 |
| 822 | −wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, | |
| 813 | +brcmf_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, | |
| 823 | 814 | struct cfg80211_scan_request *request) |
| 824 | 815 | { |
| 825 | 816 | s32 err = 0; |
| @@ -828,7 +819,7 @@ wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 2 unmodified lines | ||
| 828 | 819 | |
| 829 | 820 | CHECK_SYS_UP(); |
| 830 | 821 | |
| 831 | − err = __wl_cfg80211_scan(wiphy, ndev, request, NULL); | |
| 822 | + err = __brcmf_cfg80211_scan(wiphy, ndev, request, NULL); | |
| 832 | 823 | if (unlikely(err)) |
| 833 | 824 | WL_ERR("scan error (%d)\n", err); |
| 834 | 825 | |
| @@ -836,17 +827,18 @@ wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, · 1 unmodified line | ||
| 836 | 827 | return err; |
| 837 | 828 | } |
| 838 | 829 | |
| 839 | −static s32 wl_dev_intvar_set(struct net_device *dev, s8 *name, s32 val) | |
| 830 | +static s32 brcmf_dev_intvar_set(struct net_device *dev, s8 *name, s32 val) | |
| 840 | 831 | { |
| 841 | − s8 buf[WLC_IOCTL_SMLEN]; | |
| 832 | + s8 buf[BRCMF_C_IOCTL_SMLEN]; | |
| 842 | 833 | u32 len; |
| 843 | 834 | s32 err = 0; |
| 844 | 835 | |
| 845 | 836 | val = cpu_to_le32(val); |
| 846 | − len = bcm_mkiovar(name, (char *)(&val), sizeof(val), buf, sizeof(buf)); | |
| 837 | + len = brcmu_mkiovar(name, (char *)(&val), sizeof(val), buf, | |
| 838 | + sizeof(buf)); | |
| 847 | 839 | BUG_ON(!len); |
| 848 | 840 | |
| 849 | − err = wl_dev_ioctl(dev, WLC_SET_VAR, buf, len); | |
| 841 | + err = brcmf_dev_ioctl(dev, BRCMF_C_SET_VAR, buf, len); | |
| 850 | 842 | if (unlikely(err)) |
| 851 | 843 | WL_ERR("error (%d)\n", err); |
| 852 | 844 | |
| @@ -854,10 +846,10 @@ static s32 wl_dev_intvar_set(struct net_device *dev, s8 *name, s32 val) · 1 unmodified line | ||
| 854 | 846 | } |
| 855 | 847 | |
| 856 | 848 | static s32 |
| 857 | −wl_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval) | |
| 849 | +brcmf_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval) | |
| 858 | 850 | { |
| 859 | 851 | union { |
| 860 | − s8 buf[WLC_IOCTL_SMLEN]; | |
| 852 | + s8 buf[BRCMF_C_IOCTL_SMLEN]; | |
| 861 | 853 | s32 val; |
| 862 | 854 | } var; |
| 863 | 855 | u32 len; |
| @@ -865,10 +857,10 @@ wl_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval) · 1 unmodified line | ||
| 865 | 857 | s32 err = 0; |
| 866 | 858 | |
| 867 | 859 | len = |
| 868 | − bcm_mkiovar(name, (char *)(&data_null), 0, (char *)(&var), | |
| 860 | + brcmu_mkiovar(name, (char *)(&data_null), 0, (char *)(&var), | |
| 869 | 861 | sizeof(var.buf)); |
| 870 | 862 | BUG_ON(!len); |
| 871 | − err = wl_dev_ioctl(dev, WLC_GET_VAR, &var, len); | |
| 863 | + err = brcmf_dev_ioctl(dev, BRCMF_C_GET_VAR, &var, len); | |
| 872 | 864 | if (unlikely(err)) |
| 873 | 865 | WL_ERR("error (%d)\n", err); |
| 874 | 866 | |
| @@ -877,35 +869,35 @@ wl_dev_intvar_get(struct net_device *dev, s8 *name, s32 *retval) · 2 unmodified lines | ||
| 877 | 869 | return err; |
| 878 | 870 | } |
| 879 | 871 | |
| 880 | −static s32 wl_set_rts(struct net_device *dev, u32 rts_threshold) | |
| 872 | +static s32 brcmf_set_rts(struct net_device *dev, u32 rts_threshold) | |
| 881 | 873 | { |
| 882 | 874 | s32 err = 0; |
| 883 | 875 | |
| 884 | − err = wl_dev_intvar_set(dev, "rtsthresh", rts_threshold); | |
| 876 | + err = brcmf_dev_intvar_set(dev, "rtsthresh", rts_threshold); | |
| 885 | 877 | if (unlikely(err)) |
| 886 | 878 | WL_ERR("Error (%d)\n", err); |
| 887 | 879 | |
| 888 | 880 | return err; |
| 889 | 881 | } |
| 890 | 882 | |
| 891 | −static s32 wl_set_frag(struct net_device *dev, u32 frag_threshold) | |
| 883 | +static s32 brcmf_set_frag(struct net_device *dev, u32 frag_threshold) | |
| 892 | 884 | { |
| 893 | 885 | s32 err = 0; |
| 894 | 886 | |
| 895 | − err = wl_dev_intvar_set(dev, "fragthresh", frag_threshold); | |
| 887 | + err = brcmf_dev_intvar_set(dev, "fragthresh", frag_threshold); | |
| 896 | 888 | if (unlikely(err)) |
| 897 | 889 | WL_ERR("Error (%d)\n", err); |
| 898 | 890 | |
| 899 | 891 | return err; |
| 900 | 892 | } |
| 901 | 893 | |
| 902 | −static s32 wl_set_retry(struct net_device *dev, u32 retry, bool l) | |
| 894 | +static s32 brcmf_set_retry(struct net_device *dev, u32 retry, bool l) | |
| 903 | 895 | { |
| 904 | 896 | s32 err = 0; |
| 905 | − u32 cmd = (l ? WLC_SET_LRL : WLC_SET_SRL); | |
| 897 | + u32 cmd = (l ? BRCM_SET_LRL : BRCM_SET_SRL); | |
| 906 | 898 | |
| 907 | 899 | retry = cpu_to_le32(retry); |
| 908 | − err = wl_dev_ioctl(dev, cmd, &retry, sizeof(retry)); | |
| 900 | + err = brcmf_dev_ioctl(dev, cmd, &retry, sizeof(retry)); | |
| 909 | 901 | if (unlikely(err)) { |
| 910 | 902 | WL_ERR("cmd (%d) , error (%d)\n", cmd, err); |
| 911 | 903 | return err; |
| @@ -913,40 +905,40 @@ static s32 wl_set_retry(struct net_device *dev, u32 retry, bool l) · 1 unmodified line | ||
| 913 | 905 | return err; |
| 914 | 906 | } |
| 915 | 907 | |
| 916 | −static s32 wl_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) | |
| 908 | +static s32 brcmf_cfg80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) | |
| 917 | 909 | { |
| 918 | − struct wl_priv *wl = wiphy_to_wl(wiphy); | |
| 919 | − struct net_device *ndev = wl_to_ndev(wl); | |
| 910 | + struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); | |
| 911 | + struct net_device *ndev = cfg_to_ndev(cfg_priv); | |
| 920 | 912 | s32 err = 0; |
| 921 | 913 | |
| 922 | 914 | WL_TRACE("Enter\n"); |
| 923 | 915 | CHECK_SYS_UP(); |
| 924 | 916 | |
| 925 | 917 | if (changed & WIPHY_PARAM_RTS_THRESHOLD && |
| 926 | − (wl->conf->rts_threshold != wiphy->rts_threshold)) { | |
| 927 | − wl->conf->rts_threshold = wiphy->rts_threshold; | |
| 928 | − err = wl_set_rts(ndev, wl->conf->rts_threshold); | |
| 918 | + (cfg_priv->conf->rts_threshold != wiphy->rts_threshold)) { | |
| 919 | + cfg_priv->conf->rts_threshold = wiphy->rts_threshold; | |
| 920 | + err = brcmf_set_rts(ndev, cfg_priv->conf->rts_threshold); | |
| 929 | 921 | if (!err) |
| 930 | 922 | goto done; |
| 931 | 923 | } |
| 932 | 924 | if (changed & WIPHY_PARAM_FRAG_THRESHOLD && |
| 933 | − (wl->conf->frag_threshold != wiphy->frag_threshold)) { | |
| 934 | − wl->conf->frag_threshold = wiphy->frag_threshold; | |
| 935 | − err = wl_set_frag(ndev, wl->conf->frag_threshold); | |
| 925 | + (cfg_priv->conf->frag_threshold != wiphy->frag_threshold)) { | |
| 926 | + cfg_priv->conf->frag_threshold = wiphy->frag_threshold; | |
| 927 | + err = brcmf_set_frag(ndev, cfg_priv->conf->frag_threshold); | |
| 936 | 928 | if (!err) |
| 937 | 929 | goto done; |
| 938 | 930 | } |
| 939 | 931 | if (changed & WIPHY_PARAM_RETRY_LONG |
| 940 | − && (wl->conf->retry_long != wiphy->retry_long)) { | |
| 941 | − wl->conf->retry_long = wiphy->retry_long; | |
| 942 | − err = wl_set_retry(ndev, wl->conf->retry_long, true); | |
| 932 | + && (cfg_priv->conf->retry_long != wiphy->retry_long)) { | |
| 933 | + cfg_priv->conf->retry_long = wiphy->retry_long; | |
| 934 | + err = brcmf_set_retry(ndev, cfg_priv->conf->retry_long, true); | |
| 943 | 935 | if (!err) |
| 944 | 936 | goto done; |
| 945 | 937 | } |
| 946 | 938 | if (changed & WIPHY_PARAM_RETRY_SHORT |
| 947 | − && (wl->conf->retry_short != wiphy->retry_short)) { | |
| 948 | − wl->conf->retry_short = wiphy->retry_short; | |
| 949 | − err = wl_set_retry(ndev, wl->conf->retry_short, false); | |
| 939 | + && (cfg_priv->conf->retry_short != wiphy->retry_short)) { | |
| 940 | + cfg_priv->conf->retry_short = wiphy->retry_short; | |
| 941 | + err = brcmf_set_retry(ndev, cfg_priv->conf->retry_short, false); | |
| 950 | 942 | if (!err) |
| 951 | 943 | goto done; |
| 952 | 944 | } |
| @@ -957,11 +949,11 @@ done: · 4 unmodified lines | ||
| 957 | 949 | } |
| 958 | 950 | |
| 959 | 951 | static s32 |
| 960 | −wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, | |
| 952 | +brcmf_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, | |
| 961 | 953 | struct cfg80211_ibss_params *params) |
| 962 | 954 | { |
| 963 | − struct wl_priv *wl = wiphy_to_wl(wiphy); | |
| 964 | − struct wl_join_params join_params; | |
| 955 | + struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); | |
| 956 | + struct brcmf_join_params join_params; | |
| 965 | 957 | size_t join_params_size = 0; |
| 966 | 958 | s32 err = 0; |
| 967 | 959 | s32 wsec = 0; |
| @@ -977,6 +969,8 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, · 9 unmodified lines | ||
| 977 | 969 | return -EOPNOTSUPP; |
| 978 | 970 | } |
| 979 | 971 | |
| 972 | + set_bit(WL_STATUS_CONNECTING, &cfg_priv->status); | |
| 973 | + | |
| 980 | 974 | if (params->bssid) |
| 981 | 975 | WL_CONN("BSSID: %02X %02X %02X %02X %02X %02X\n", |
| 982 | 976 | params->bssid[0], params->bssid[1], params->bssid[2], |
| @@ -1018,7 +1012,7 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, · 35 unmodified lines | ||
| 1018 | 1012 | if (params->privacy) |
| 1019 | 1013 | wsec |= WEP_ENABLED; |
| 1020 | 1014 | |
| 1021 | − err = wl_dev_intvar_set(dev, "wsec", wsec); | |
| 1015 | + err = brcmf_dev_intvar_set(dev, "wsec", wsec); | |
| 1022 | 1016 | if (unlikely(err)) { |
| 1023 | 1017 | WL_ERR("wsec failed (%d)\n", err); |
| 1024 | 1018 | goto done; |
| @@ -1030,14 +1024,14 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, · 5 unmodified lines | ||
| 1030 | 1024 | else |
| 1031 | 1025 | bcnprd = cpu_to_le32(100); |
| 1032 | 1026 | |
| 1033 | − err = wl_dev_ioctl(dev, WLC_SET_BCNPRD, &bcnprd, sizeof(bcnprd)); | |
| 1027 | + err = brcmf_dev_ioctl(dev, BRCM_SET_BCNPRD, &bcnprd, sizeof(bcnprd)); | |
| 1034 | 1028 | if (unlikely(err)) { |
| 1035 | 1029 | WL_ERR("WLC_SET_BCNPRD failed (%d)\n", err); |
| 1036 | 1030 | goto done; |
| 1037 | 1031 | } |
| 1038 | 1032 | |
| 1039 | 1033 | /* Configure required join parameter */ |
| 1040 | − memset(&join_params, 0, sizeof(wl_join_params_t)); | |
| 1034 | + memset(&join_params, 0, sizeof(struct brcmf_join_params)); | |
| 1041 | 1035 | |
| 1042 | 1036 | /* SSID */ |
| 1043 | 1037 | join_params.ssid.SSID_len = |
| @@ -1045,67 +1039,69 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, · 1 unmodified line | ||
| 1045 | 1039 | memcpy(join_params.ssid.SSID, params->ssid, join_params.ssid.SSID_len); |
| 1046 | 1040 | join_params.ssid.SSID_len = cpu_to_le32(join_params.ssid.SSID_len); |
| 1047 | 1041 | join_params_size = sizeof(join_params.ssid); |
| 1048 | − wl_update_prof(wl, NULL, &join_params.ssid, WL_PROF_SSID); | |
| 1042 | + brcmf_update_prof(cfg_priv, NULL, &join_params.ssid, WL_PROF_SSID); | |
| 1049 | 1043 | |
| 1050 | 1044 | /* BSSID */ |
| 1051 | 1045 | if (params->bssid) { |
| 1052 | 1046 | memcpy(join_params.params.bssid, params->bssid, ETH_ALEN); |
| 1053 | − join_params_size = | |
| 1054 | − sizeof(join_params.ssid) + WL_ASSOC_PARAMS_FIXED_SIZE; | |
| 1047 | + join_params_size = sizeof(join_params.ssid) + | |
| 1048 | + BRCMF_ASSOC_PARAMS_FIXED_SIZE; | |
| 1055 | 1049 | } else { |
| 1056 | 1050 | memcpy(join_params.params.bssid, ether_bcast, ETH_ALEN); |
| 1057 | 1051 | } |
| 1058 | − wl_update_prof(wl, NULL, &join_params.params.bssid, WL_PROF_BSSID); | |
| 1052 | + brcmf_update_prof(cfg_priv, NULL, | |
| 1053 | + &join_params.params.bssid, WL_PROF_BSSID); | |
| 1059 | 1054 | |
| 1060 | 1055 | /* Channel */ |
| 1061 | 1056 | if (params->channel) { |
| 1062 | 1057 | u32 target_channel; |
| 1063 | 1058 | |
| 1064 | − wl->channel = | |
| 1059 | + cfg_priv->channel = | |
| 1065 | 1060 | ieee80211_frequency_to_channel( |
| 1066 | 1061 | params->channel->center_freq); |
| 1067 | 1062 | if (params->channel_fixed) { |
| 1068 | 1063 | /* adding chanspec */ |
| 1069 | − wl_ch_to_chanspec(wl->channel, | |
| 1064 | + brcmf_ch_to_chanspec(cfg_priv->channel, | |
| 1070 | 1065 | &join_params, &join_params_size); |
| 1071 | 1066 | } |
| 1072 | 1067 | |
| 1073 | 1068 | /* set channel for starter */ |
| 1074 | − target_channel = cpu_to_le32(wl->channel); | |
| 1075 | − err = wl_dev_ioctl(dev, WLC_SET_CHANNEL, | |
| 1069 | + target_channel = cpu_to_le32(cfg_priv->channel); | |
| 1070 | + err = brcmf_dev_ioctl(dev, BRCM_SET_CHANNEL, | |
| 1076 | 1071 | &target_channel, sizeof(target_channel)); |
| 1077 | 1072 | if (unlikely(err)) { |
| 1078 | 1073 | WL_ERR("WLC_SET_CHANNEL failed (%d)\n", err); |
| 1079 | 1074 | goto done; |
| 1080 | 1075 | } |
| 1081 | 1076 | } else |
| 1082 | − wl->channel = 0; | |
| 1077 | + cfg_priv->channel = 0; | |
| 1083 | 1078 | |
| 1084 | − wl->ibss_starter = false; | |
| 1079 | + cfg_priv->ibss_starter = false; | |
| 1085 | 1080 | |
| 1086 | 1081 | |
| 1087 | − err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size); | |
| 1082 | + err = brcmf_dev_ioctl(dev, BRCMF_C_SET_SSID, | |
| 1083 | + &join_params, join_params_size); | |
| 1088 | 1084 | if (unlikely(err)) { |
| 1089 | 1085 | WL_ERR("WLC_SET_SSID failed (%d)\n", err); |
| 1090 | 1086 | goto done; |
| 1091 | 1087 | } |
| 1092 | 1088 | |
| 1093 | − set_bit(WL_STATUS_CONNECTING, &wl->status); | |
| 1094 | − | |
| 1095 | 1089 | done: |
| 1090 | + if (err) | |
| 1091 | + clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status); | |
| 1096 | 1092 | WL_TRACE("Exit\n"); |
| 1097 | 1093 | return err; |
| 1098 | 1094 | } |
| 1099 | 1095 | |
| 1100 | −static s32 wl_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) | |
| 1096 | +static s32 brcmf_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) | |
| 1101 | 1097 | { |
| 1102 | − struct wl_priv *wl = wiphy_to_wl(wiphy); | |
| 1098 | + struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); | |
| 1103 | 1099 | s32 err = 0; |
| 1104 | 1100 | |
| 1105 | 1101 | WL_TRACE("Enter\n"); |
| 1106 | 1102 | CHECK_SYS_UP(); |
| 1107 | 1103 | |
| 1108 | − wl_link_down(wl); | |
| 1104 | + brcmf_link_down(cfg_priv); | |
| 1109 | 1105 | |
| 1110 | 1106 | WL_TRACE("Exit\n"); |
| 1111 | 1107 | |
| @@ -1113,10 +1109,10 @@ static s32 wl_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) · 1 unmodified line | ||
| 1113 | 1109 | } |
| 1114 | 1110 | |
| 1115 | 1111 | static s32 |
| 1116 | −wl_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme) | |
| 1112 | +brcmf_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme) | |
| 1117 | 1113 | { |
| 1118 | − struct wl_priv *wl = ndev_to_wl(dev); | |
| 1119 | − struct wl_security *sec; | |
| 1114 | + struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev); | |
| 1115 | + struct brcmf_cfg80211_security *sec; | |
| 1120 | 1116 | s32 val = 0; |
| 1121 | 1117 | s32 err = 0; |
| 1122 | 1118 | |
| @@ -1127,21 +1123,21 @@ wl_set_wpa_version(struct net_device *dev, struct cfg80211_connect_params *sme) · 4 unmodified lines | ||
| 1127 | 1123 | else |
| 1128 | 1124 | val = WPA_AUTH_DISABLED; |
| 1129 | 1125 | WL_CONN("setting wpa_auth to 0x%0x\n", val); |
| 1130 | − err = wl_dev_intvar_set(dev, "wpa_auth", val); | |
| 1126 | + err = brcmf_dev_intvar_set(dev, "wpa_auth", val); | |
| 1131 | 1127 | if (unlikely(err)) { |
| 1132 | 1128 | WL_ERR("set wpa_auth failed (%d)\n", err); |
| 1133 | 1129 | return err; |
| 1134 | 1130 | } |
| 1135 | − sec = wl_read_prof(wl, WL_PROF_SEC); | |
| 1131 | + sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); | |
| 1136 | 1132 | sec->wpa_versions = sme->crypto.wpa_versions; |
| 1137 | 1133 | return err; |
| 1138 | 1134 | } |
| 1139 | 1135 | |
| 1140 | 1136 | static s32 |
| 1141 | −wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme) | |
| 1137 | +brcmf_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme) | |
| 1142 | 1138 | { |
| 1143 | − struct wl_priv *wl = ndev_to_wl(dev); | |
| 1144 | − struct wl_security *sec; | |
| 1139 | + struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev); | |
| 1140 | + struct brcmf_cfg80211_security *sec; | |
| 1145 | 1141 | s32 val = 0; |
| 1146 | 1142 | s32 err = 0; |
| 1147 | 1143 | |
| @@ -1166,21 +1162,21 @@ wl_set_auth_type(struct net_device *dev, struct cfg80211_connect_params *sme) · 18 unmodified lines | ||
| 1166 | 1162 | break; |
| 1167 | 1163 | } |
| 1168 | 1164 | |
| 1169 | − err = wl_dev_intvar_set(dev, "auth", val); | |
| 1165 | + err = brcmf_dev_intvar_set(dev, "auth", val); | |
| 1170 | 1166 | if (unlikely(err)) { |
| 1171 | 1167 | WL_ERR("set auth failed (%d)\n", err); |
| 1172 | 1168 | return err; |
| 1173 | 1169 | } |
| 1174 | − sec = wl_read_prof(wl, WL_PROF_SEC); | |
| 1170 | + sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); | |
| 1175 | 1171 | sec->auth_type = sme->auth_type; |
| 1176 | 1172 | return err; |
| 1177 | 1173 | } |
| 1178 | 1174 | |
| 1179 | 1175 | static s32 |
| 1180 | −wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme) | |
| 1176 | +brcmf_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme) | |
| 1181 | 1177 | { |
| 1182 | − struct wl_priv *wl = ndev_to_wl(dev); | |
| 1183 | − struct wl_security *sec; | |
| 1178 | + struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev); | |
| 1179 | + struct brcmf_cfg80211_security *sec; | |
| 1184 | 1180 | s32 pval = 0; |
| 1185 | 1181 | s32 gval = 0; |
| 1186 | 1182 | s32 err = 0; |
| @@ -1229,13 +1225,13 @@ wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme) · 42 unmodified lines | ||
| 1229 | 1225 | } |
| 1230 | 1226 | |
| 1231 | 1227 | WL_CONN("pval (%d) gval (%d)\n", pval, gval); |
| 1232 | − err = wl_dev_intvar_set(dev, "wsec", pval | gval); | |
| 1228 | + err = brcmf_dev_intvar_set(dev, "wsec", pval | gval); | |
| 1233 | 1229 | if (unlikely(err)) { |
| 1234 | 1230 | WL_ERR("error (%d)\n", err); |
| 1235 | 1231 | return err; |
| 1236 | 1232 | } |
| 1237 | 1233 | |
| 1238 | − sec = wl_read_prof(wl, WL_PROF_SEC); | |
| 1234 | + sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); | |
| 1239 | 1235 | sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0]; |
| 1240 | 1236 | sec->cipher_group = sme->crypto.cipher_group; |
| 1241 | 1237 | |
| @@ -1243,15 +1239,15 @@ wl_set_set_cipher(struct net_device *dev, struct cfg80211_connect_params *sme) · 1 unmodified line | ||
| 1243 | 1239 | } |
| 1244 | 1240 | |
| 1245 | 1241 | static s32 |
| 1246 | −wl_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme) | |
| 1242 | +brcmf_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme) | |
| 1247 | 1243 | { |
| 1248 | − struct wl_priv *wl = ndev_to_wl(dev); | |
| 1249 | − struct wl_security *sec; | |
| 1244 | + struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev); | |
| 1245 | + struct brcmf_cfg80211_security *sec; | |
| 1250 | 1246 | s32 val = 0; |
| 1251 | 1247 | s32 err = 0; |
| 1252 | 1248 | |
| 1253 | 1249 | if (sme->crypto.n_akm_suites) { |
| 1254 | − err = wl_dev_intvar_get(dev, "wpa_auth", &val); | |
| 1250 | + err = brcmf_dev_intvar_get(dev, "wpa_auth", &val); | |
| 1255 | 1251 | if (unlikely(err)) { |
| 1256 | 1252 | WL_ERR("could not get wpa_auth (%d)\n", err); |
| 1257 | 1253 | return err; |
| @@ -1285,31 +1281,31 @@ wl_set_key_mgmt(struct net_device *dev, struct cfg80211_connect_params *sme) · 27 unmodified lines | ||
| 1285 | 1281 | } |
| 1286 | 1282 | |
| 1287 | 1283 | WL_CONN("setting wpa_auth to %d\n", val); |
| 1288 | − err = wl_dev_intvar_set(dev, "wpa_auth", val); | |
| 1284 | + err = brcmf_dev_intvar_set(dev, "wpa_auth", val); | |
| 1289 | 1285 | if (unlikely(err)) { |
| 1290 | 1286 | WL_ERR("could not set wpa_auth (%d)\n", err); |
| 1291 | 1287 | return err; |
| 1292 | 1288 | } |
| 1293 | 1289 | } |
| 1294 | − sec = wl_read_prof(wl, WL_PROF_SEC); | |
| 1290 | + sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); | |
| 1295 | 1291 | sec->wpa_auth = sme->crypto.akm_suites[0]; |
| 1296 | 1292 | |
| 1297 | 1293 | return err; |
| 1298 | 1294 | } |
| 1299 | 1295 | |
| 1300 | 1296 | static s32 |
| 1301 | −wl_set_set_sharedkey(struct net_device *dev, | |
| 1297 | +brcmf_set_set_sharedkey(struct net_device *dev, | |
| 1302 | 1298 | struct cfg80211_connect_params *sme) |
| 1303 | 1299 | { |
| 1304 | − struct wl_priv *wl = ndev_to_wl(dev); | |
| 1305 | − struct wl_security *sec; | |
| 1306 | − struct wl_wsec_key key; | |
| 1300 | + struct brcmf_cfg80211_priv *cfg_priv = ndev_to_cfg(dev); | |
| 1301 | + struct brcmf_cfg80211_security *sec; | |
| 1302 | + struct brcmf_wsec_key key; | |
| 1307 | 1303 | s32 val; |
| 1308 | 1304 | s32 err = 0; |
| 1309 | 1305 | |
| 1310 | 1306 | WL_CONN("key len (%d)\n", sme->key_len); |
| 1311 | 1307 | if (sme->key_len) { |
| 1312 | − sec = wl_read_prof(wl, WL_PROF_SEC); | |
| 1308 | + sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); | |
| 1313 | 1309 | WL_CONN("wpa_versions 0x%x cipher_pairwise 0x%x\n", |
| 1314 | 1310 | sec->wpa_versions, sec->cipher_pairwise); |
| 1315 | 1311 | if (! |
| @@ -1325,7 +1321,7 @@ wl_set_set_sharedkey(struct net_device *dev, · 9 unmodified lines | ||
| 1325 | 1321 | return -EINVAL; |
| 1326 | 1322 | } |
| 1327 | 1323 | memcpy(key.data, sme->key, key.len); |
| 1328 | − key.flags = WL_PRIMARY_KEY; | |
| 1324 | + key.flags = BRCMF_PRIMARY_KEY; | |
| 1329 | 1325 | switch (sec->cipher_pairwise) { |
| 1330 | 1326 | case WLAN_CIPHER_SUITE_WEP40: |
| 1331 | 1327 | key.algo = CRYPTO_ALGO_WEP1; |
| @@ -1343,7 +1339,7 @@ wl_set_set_sharedkey(struct net_device *dev, · 11 unmodified lines | ||
| 1343 | 1339 | key.len, key.index, key.algo); |
| 1344 | 1340 | WL_CONN("key \"%s\"\n", key.data); |
| 1345 | 1341 | swap_key_from_BE(&key); |
| 1346 | − err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, | |
| 1342 | + err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key, | |
| 1347 | 1343 | sizeof(key)); |
| 1348 | 1344 | if (unlikely(err)) { |
| 1349 | 1345 | WL_ERR("WLC_SET_KEY error (%d)\n", err); |
| @@ -1352,7 +1348,7 @@ wl_set_set_sharedkey(struct net_device *dev, · 2 unmodified lines | ||
| 1352 | 1348 | if (sec->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) { |
| 1353 | 1349 | WL_CONN("set auth_type to shared key\n"); |
| 1354 | 1350 | val = 1; /* shared key */ |
| 1355 | − err = wl_dev_intvar_set(dev, "auth", val); | |
| 1351 | + err = brcmf_dev_intvar_set(dev, "auth", val); | |
| 1356 | 1352 | if (unlikely(err)) { |
| 1357 | 1353 | WL_ERR("set auth failed (%d)\n", err); |
| 1358 | 1354 | return err; |
| @@ -1364,12 +1360,12 @@ wl_set_set_sharedkey(struct net_device *dev, · 5 unmodified lines | ||
| 1364 | 1360 | } |
| 1365 | 1361 | |
| 1366 | 1362 | static s32 |
| 1367 | −wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, | |
| 1363 | +brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, | |
| 1368 | 1364 | struct cfg80211_connect_params *sme) |
| 1369 | 1365 | { |
| 1370 | − struct wl_priv *wl = wiphy_to_wl(wiphy); | |
| 1366 | + struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); | |
| 1371 | 1367 | struct ieee80211_channel *chan = sme->channel; |
| 1372 | − struct wl_join_params join_params; | |
| 1368 | + struct brcmf_join_params join_params; | |
| 1373 | 1369 | size_t join_params_size; |
| 1374 | 1370 | |
| 1375 | 1371 | s32 err = 0; |
| @@ -1382,37 +1378,49 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, · 6 unmodified lines | ||
| 1382 | 1378 | return -EOPNOTSUPP; |
| 1383 | 1379 | } |
| 1384 | 1380 | |
| 1381 | + set_bit(WL_STATUS_CONNECTING, &cfg_priv->status); | |
| 1382 | + | |
| 1385 | 1383 | if (chan) { |
| 1386 | − wl->channel = | |
| 1384 | + cfg_priv->channel = | |
| 1387 | 1385 | ieee80211_frequency_to_channel(chan->center_freq); |
| 1388 | 1386 | WL_CONN("channel (%d), center_req (%d)\n", |
| 1389 | − wl->channel, chan->center_freq); | |
| 1387 | + cfg_priv->channel, chan->center_freq); | |
| 1390 | 1388 | } else |
| 1391 | − wl->channel = 0; | |
| 1389 | + cfg_priv->channel = 0; | |
| 1392 | 1390 | |
| 1393 | 1391 | WL_INFO("ie (%p), ie_len (%zd)\n", sme->ie, sme->ie_len); |
| 1394 | 1392 | |
| 1395 | − err = wl_set_wpa_version(dev, sme); | |
| 1396 | − if (unlikely(err)) | |
| 1397 | − return err; | |
| 1393 | + err = brcmf_set_wpa_version(dev, sme); | |
| 1394 | + if (err) { | |
| 1395 | + WL_ERR("wl_set_wpa_version failed (%d)\n", err); | |
| 1396 | + goto done; | |
| 1397 | + } | |
| 1398 | 1398 | |
| 1399 | − err = wl_set_auth_type(dev, sme); | |
| 1400 | − if (unlikely(err)) | |
| 1401 | − return err; | |
| 1399 | + err = brcmf_set_auth_type(dev, sme); | |
| 1400 | + if (err) { | |
| 1401 | + WL_ERR("wl_set_auth_type failed (%d)\n", err); | |
| 1402 | + goto done; | |
| 1403 | + } | |
| 1402 | 1404 | |
| 1403 | − err = wl_set_set_cipher(dev, sme); | |
| 1404 | − if (unlikely(err)) | |
| 1405 | − return err; | |
| 1405 | + err = brcmf_set_set_cipher(dev, sme); | |
| 1406 | + if (err) { | |
| 1407 | + WL_ERR("wl_set_set_cipher failed (%d)\n", err); | |
| 1408 | + goto done; | |
| 1409 | + } | |
| 1406 | 1410 | |
| 1407 | − err = wl_set_key_mgmt(dev, sme); | |
| 1408 | − if (unlikely(err)) | |
| 1409 | − return err; | |
| 1411 | + err = brcmf_set_key_mgmt(dev, sme); | |
| 1412 | + if (err) { | |
| 1413 | + WL_ERR("wl_set_key_mgmt failed (%d)\n", err); | |
| 1414 | + goto done; | |
| 1415 | + } | |
| 1410 | 1416 | |
| 1411 | − err = wl_set_set_sharedkey(dev, sme); | |
| 1412 | − if (unlikely(err)) | |
| 1413 | − return err; | |
| 1417 | + err = brcmf_set_set_sharedkey(dev, sme); | |
| 1418 | + if (err) { | |
| 1419 | + WL_ERR("wl_set_set_sharedkey failed (%d)\n", err); | |
| 1420 | + goto done; | |
| 1421 | + } | |
| 1414 | 1422 | |
| 1415 | − wl_update_prof(wl, NULL, sme->bssid, WL_PROF_BSSID); | |
| 1423 | + brcmf_update_prof(cfg_priv, NULL, sme->bssid, WL_PROF_BSSID); | |
| 1416 | 1424 | /* |
| 1417 | 1425 | ** Join with specific BSSID and cached SSID |
| 1418 | 1426 | ** If SSID is zero join based on BSSID only |
| @@ -1423,7 +1431,7 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, · 4 unmodified lines | ||
| 1423 | 1431 | join_params.ssid.SSID_len = min(sizeof(join_params.ssid.SSID), sme->ssid_len); |
| 1424 | 1432 | memcpy(&join_params.ssid.SSID, sme->ssid, join_params.ssid.SSID_len); |
| 1425 | 1433 | join_params.ssid.SSID_len = cpu_to_le32(join_params.ssid.SSID_len); |
| 1426 | − wl_update_prof(wl, NULL, &join_params.ssid, WL_PROF_SSID); | |
| 1434 | + brcmf_update_prof(cfg_priv, NULL, &join_params.ssid, WL_PROF_SSID); | |
| 1427 | 1435 | |
| 1428 | 1436 | if (sme->bssid) |
| 1429 | 1437 | memcpy(join_params.params.bssid, sme->bssid, ETH_ALEN); |
| @@ -1435,52 +1443,54 @@ wl_cfg80211_connect(struct wiphy *wiphy, struct net_device *dev, · 5 unmodified lines | ||
| 1435 | 1443 | join_params.ssid.SSID, join_params.ssid.SSID_len); |
| 1436 | 1444 | } |
| 1437 | 1445 | |
| 1438 | − wl_ch_to_chanspec(wl->channel, &join_params, &join_params_size); | |
| 1439 | − err = wl_dev_ioctl(dev, WLC_SET_SSID, &join_params, join_params_size); | |
| 1440 | − if (unlikely(err)) { | |
| 1441 | − WL_ERR("error (%d)\n", err); | |
| 1442 | − return err; | |
| 1443 | − } | |
| 1444 | − set_bit(WL_STATUS_CONNECTING, &wl->status); | |
| 1446 | + brcmf_ch_to_chanspec(cfg_priv->channel, | |
| 1447 | + &join_params, &join_params_size); | |
| 1448 | + err = brcmf_dev_ioctl(dev, BRCMF_C_SET_SSID, | |
| 1449 | + &join_params, join_params_size); | |
| 1450 | + if (err) | |
| 1451 | + WL_ERR("WLC_SET_SSID failed (%d)\n", err); | |
| 1445 | 1452 | |
| 1453 | +done: | |
| 1454 | + if (err) | |
| 1455 | + clear_bit(WL_STATUS_CONNECTING, &cfg_priv->status); | |
| 1446 | 1456 | WL_TRACE("Exit\n"); |
| 1447 | 1457 | return err; |
| 1448 | 1458 | } |
| 1449 | 1459 | |
| 1450 | 1460 | static s32 |
| 1451 | −wl_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, | |
| 1461 | +brcmf_cfg80211_disconnect(struct wiphy *wiphy, struct net_device *dev, | |
| 1452 | 1462 | u16 reason_code) |
| 1453 | 1463 | { |
| 1454 | − struct wl_priv *wl = wiphy_to_wl(wiphy); | |
| 1455 | − scb_val_t scbval; | |
| 1464 | + struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); | |
| 1465 | + struct brcmf_scb_val scbval; | |
| 1456 | 1466 | s32 err = 0; |
| 1457 | 1467 | |
| 1458 | 1468 | WL_TRACE("Enter. Reason code = %d\n", reason_code); |
| 1459 | 1469 | CHECK_SYS_UP(); |
| 1460 | 1470 | |
| 1461 | − clear_bit(WL_STATUS_CONNECTED, &wl->status); | |
| 1471 | + clear_bit(WL_STATUS_CONNECTED, &cfg_priv->status); | |
| 1462 | 1472 | |
| 1463 | 1473 | scbval.val = reason_code; |
| 1464 | − memcpy(&scbval.ea, wl_read_prof(wl, WL_PROF_BSSID), ETH_ALEN); | |
| 1474 | + memcpy(&scbval.ea, brcmf_read_prof(cfg_priv, WL_PROF_BSSID), ETH_ALEN); | |
| 1465 | 1475 | scbval.val = cpu_to_le32(scbval.val); |
| 1466 | − err = wl_dev_ioctl(dev, WLC_DISASSOC, &scbval, | |
| 1467 | − sizeof(scb_val_t)); | |
| 1476 | + err = brcmf_dev_ioctl(dev, BRCMF_C_DISASSOC, &scbval, | |
| 1477 | + sizeof(struct brcmf_scb_val)); | |
| 1468 | 1478 | if (unlikely(err)) |
| 1469 | 1479 | WL_ERR("error (%d)\n", err); |
| 1470 | 1480 | |
| 1471 | − wl->link_up = false; | |
| 1481 | + cfg_priv->link_up = false; | |
| 1472 | 1482 | |
| 1473 | 1483 | WL_TRACE("Exit\n"); |
| 1474 | 1484 | return err; |
| 1475 | 1485 | } |
| 1476 | 1486 | |
| 1477 | 1487 | static s32 |
| 1478 | −wl_cfg80211_set_tx_power(struct wiphy *wiphy, | |
| 1488 | +brcmf_cfg80211_set_tx_power(struct wiphy *wiphy, | |
| 1479 | 1489 | enum nl80211_tx_power_setting type, s32 dbm) |
| 1480 | 1490 | { |
| 1481 | 1491 | |
| 1482 | − struct wl_priv *wl = wiphy_to_wl(wiphy); | |
| 1483 | − struct net_device *ndev = wl_to_ndev(wl); | |
| 1492 | + struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); | |
| 1493 | + struct net_device *ndev = cfg_to_ndev(cfg_priv); | |
| 1484 | 1494 | u16 txpwrmw; |
| 1485 | 1495 | s32 err = 0; |
| 1486 | 1496 | s32 disable = 0; |
| @@ -1509,7 +1519,7 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy, · 22 unmodified lines | ||
| 1509 | 1519 | /* Make sure radio is off or on as far as software is concerned */ |
| 1510 | 1520 | disable = WL_RADIO_SW_DISABLE << 16; |
| 1511 | 1521 | disable = cpu_to_le32(disable); |
| 1512 | − err = wl_dev_ioctl(ndev, WLC_SET_RADIO, &disable, sizeof(disable)); | |
| 1522 | + err = brcmf_dev_ioctl(ndev, BRCMF_C_SET_RADIO, &disable, sizeof(disable)); | |
| 1513 | 1523 | if (unlikely(err)) |
| 1514 | 1524 | WL_ERR("WLC_SET_RADIO error (%d)\n", err); |
| 1515 | 1525 | |
| @@ -1517,21 +1527,21 @@ wl_cfg80211_set_tx_power(struct wiphy *wiphy, · 1 unmodified line | ||
| 1517 | 1527 | txpwrmw = 0xffff; |
| 1518 | 1528 | else |
| 1519 | 1529 | txpwrmw = (u16) dbm; |
| 1520 | − err = wl_dev_intvar_set(ndev, "qtxpower", | |
| 1521 | − (s32) (bcm_mw_to_qdbm(txpwrmw))); | |
| 1530 | + err = brcmf_dev_intvar_set(ndev, "qtxpower", | |
| 1531 | + (s32) (brcmu_mw_to_qdbm(txpwrmw))); | |
| 1522 | 1532 | if (unlikely(err)) |
| 1523 | 1533 | WL_ERR("qtxpower error (%d)\n", err); |
| 1524 | − wl->conf->tx_power = dbm; | |
| 1534 | + cfg_priv->conf->tx_power = dbm; | |
| 1525 | 1535 | |
| 1526 | 1536 | done: |
| 1527 | 1537 | WL_TRACE("Exit\n"); |
| 1528 | 1538 | return err; |
| 1529 | 1539 | } |
| 1530 | 1540 | |
| 1531 | −static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm) | |
| 1541 | +static s32 brcmf_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm) | |
| 1532 | 1542 | { |
| 1533 | − struct wl_priv *wl = wiphy_to_wl(wiphy); | |
| 1534 | − struct net_device *ndev = wl_to_ndev(wl); | |
| 1543 | + struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); | |
| 1544 | + struct net_device *ndev = cfg_to_ndev(cfg_priv); | |
| 1535 | 1545 | s32 txpwrdbm; |
| 1536 | 1546 | u8 result; |
| 1537 | 1547 | s32 err = 0; |
| @@ -1539,14 +1549,14 @@ static s32 wl_cfg80211_get_tx_power(struct wiphy *wiphy, s32 *dbm) · 1 unmodified line | ||
| 1539 | 1549 | WL_TRACE("Enter\n"); |
| 1540 | 1550 | CHECK_SYS_UP(); |
| 1541 | 1551 | |
| 1542 | − err = wl_dev_intvar_get(ndev, "qtxpower", &txpwrdbm); | |
| 1552 | + err = brcmf_dev_intvar_get(ndev, "qtxpower", &txpwrdbm); | |
| 1543 | 1553 | if (unlikely(err)) { |
| 1544 | 1554 | WL_ERR("error (%d)\n", err); |
| 1545 | 1555 | goto done; |
| 1546 | 1556 | } |
| 1547 | 1557 | |
| 1548 | 1558 | result = (u8) (txpwrdbm & ~WL_TXPWR_OVERRIDE); |
| 1549 | − *dbm = (s32) bcm_qdbm_to_mw(result); | |
| 1559 | + *dbm = (s32) brcmu_qdbm_to_mw(result); | |
| 1550 | 1560 | |
| 1551 | 1561 | done: |
| 1552 | 1562 | WL_TRACE("Exit\n"); |
| @@ -1554,7 +1564,7 @@ done: · 1 unmodified line | ||
| 1554 | 1564 | } |
| 1555 | 1565 | |
| 1556 | 1566 | static s32 |
| 1557 | −wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, | |
| 1567 | +brcmf_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, | |
| 1558 | 1568 | u8 key_idx, bool unicast, bool multicast) |
| 1559 | 1569 | { |
| 1560 | 1570 | u32 index; |
| @@ -1565,7 +1575,7 @@ wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, · 4 unmodified lines | ||
| 1565 | 1575 | WL_CONN("key index (%d)\n", key_idx); |
| 1566 | 1576 | CHECK_SYS_UP(); |
| 1567 | 1577 | |
| 1568 | − err = wl_dev_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec)); | |
| 1578 | + err = brcmf_dev_ioctl(dev, BRCMF_C_GET_WSEC, &wsec, sizeof(wsec)); | |
| 1569 | 1579 | if (unlikely(err)) { |
| 1570 | 1580 | WL_ERR("WLC_GET_WSEC error (%d)\n", err); |
| 1571 | 1581 | goto done; |
| @@ -1576,7 +1586,7 @@ wl_cfg80211_config_default_key(struct wiphy *wiphy, struct net_device *dev, · 4 unmodified lines | ||
| 1576 | 1586 | /* Just select a new current key */ |
| 1577 | 1587 | index = (u32) key_idx; |
| 1578 | 1588 | index = cpu_to_le32(index); |
| 1579 | − err = wl_dev_ioctl(dev, WLC_SET_KEY_PRIMARY, &index, | |
| 1589 | + err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY_PRIMARY, &index, | |
| 1580 | 1590 | sizeof(index)); |
| 1581 | 1591 | if (unlikely(err)) |
| 1582 | 1592 | WL_ERR("error (%d)\n", err); |
| @@ -1587,10 +1597,10 @@ done: · 4 unmodified lines | ||
| 1587 | 1597 | } |
| 1588 | 1598 | |
| 1589 | 1599 | static s32 |
| 1590 | −wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, | |
| 1600 | +brcmf_add_keyext(struct wiphy *wiphy, struct net_device *dev, | |
| 1591 | 1601 | u8 key_idx, const u8 *mac_addr, struct key_params *params) |
| 1592 | 1602 | { |
| 1593 | − struct wl_wsec_key key; | |
| 1603 | + struct brcmf_wsec_key key; | |
| 1594 | 1604 | s32 err = 0; |
| 1595 | 1605 | |
| 1596 | 1606 | memset(&key, 0, sizeof(key)); |
| @@ -1604,7 +1614,7 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, · 7 unmodified lines | ||
| 1604 | 1614 | if (key.len == 0) { |
| 1605 | 1615 | /* key delete */ |
| 1606 | 1616 | swap_key_from_BE(&key); |
| 1607 | − err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)); | |
| 1617 | + err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key, sizeof(key)); | |
| 1608 | 1618 | if (unlikely(err)) { |
| 1609 | 1619 | WL_ERR("key delete error (%d)\n", err); |
| 1610 | 1620 | return err; |
| @@ -1663,8 +1673,8 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, · 52 unmodified lines | ||
| 1663 | 1673 | } |
| 1664 | 1674 | swap_key_from_BE(&key); |
| 1665 | 1675 | |
| 1666 | − dhd_wait_pend8021x(dev); | |
| 1667 | − err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)); | |
| 1676 | + brcmf_netdev_wait_pend8021x(dev); | |
| 1677 | + err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key, sizeof(key)); | |
| 1668 | 1678 | if (unlikely(err)) { |
| 1669 | 1679 | WL_ERR("WLC_SET_KEY error (%d)\n", err); |
| 1670 | 1680 | return err; |
| @@ -1674,11 +1684,11 @@ wl_add_keyext(struct wiphy *wiphy, struct net_device *dev, · 3 unmodified lines | ||
| 1674 | 1684 | } |
| 1675 | 1685 | |
| 1676 | 1686 | static s32 |
| 1677 | −wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |
| 1687 | +brcmf_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |
| 1678 | 1688 | u8 key_idx, bool pairwise, const u8 *mac_addr, |
| 1679 | 1689 | struct key_params *params) |
| 1680 | 1690 | { |
| 1681 | − struct wl_wsec_key key; | |
| 1691 | + struct brcmf_wsec_key key; | |
| 1682 | 1692 | s32 val; |
| 1683 | 1693 | s32 wsec; |
| 1684 | 1694 | s32 err = 0; |
| @@ -1690,7 +1700,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 5 unmodified lines | ||
| 1690 | 1700 | |
| 1691 | 1701 | if (mac_addr) { |
| 1692 | 1702 | WL_TRACE("Exit"); |
| 1693 | − return wl_add_keyext(wiphy, dev, key_idx, mac_addr, params); | |
| 1703 | + return brcmf_add_keyext(wiphy, dev, key_idx, mac_addr, params); | |
| 1694 | 1704 | } |
| 1695 | 1705 | memset(&key, 0, sizeof(key)); |
| 1696 | 1706 | |
| @@ -1704,7 +1714,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 7 unmodified lines | ||
| 1704 | 1714 | } |
| 1705 | 1715 | memcpy(key.data, params->key, key.len); |
| 1706 | 1716 | |
| 1707 | − key.flags = WL_PRIMARY_KEY; | |
| 1717 | + key.flags = BRCMF_PRIMARY_KEY; | |
| 1708 | 1718 | switch (params->cipher) { |
| 1709 | 1719 | case WLAN_CIPHER_SUITE_WEP40: |
| 1710 | 1720 | key.algo = CRYPTO_ALGO_WEP1; |
| @@ -1737,21 +1747,21 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 26 unmodified lines | ||
| 1737 | 1747 | |
| 1738 | 1748 | /* Set the new key/index */ |
| 1739 | 1749 | swap_key_from_BE(&key); |
| 1740 | − err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)); | |
| 1750 | + err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key, sizeof(key)); | |
| 1741 | 1751 | if (unlikely(err)) { |
| 1742 | 1752 | WL_ERR("WLC_SET_KEY error (%d)\n", err); |
| 1743 | 1753 | goto done; |
| 1744 | 1754 | } |
| 1745 | 1755 | |
| 1746 | 1756 | val = WEP_ENABLED; |
| 1747 | − err = wl_dev_intvar_get(dev, "wsec", &wsec); | |
| 1757 | + err = brcmf_dev_intvar_get(dev, "wsec", &wsec); | |
| 1748 | 1758 | if (unlikely(err)) { |
| 1749 | 1759 | WL_ERR("get wsec error (%d)\n", err); |
| 1750 | 1760 | goto done; |
| 1751 | 1761 | } |
| 1752 | 1762 | wsec &= ~(WEP_ENABLED); |
| 1753 | 1763 | wsec |= val; |
| 1754 | − err = wl_dev_intvar_set(dev, "wsec", wsec); | |
| 1764 | + err = brcmf_dev_intvar_set(dev, "wsec", wsec); | |
| 1755 | 1765 | if (unlikely(err)) { |
| 1756 | 1766 | WL_ERR("set wsec error (%d)\n", err); |
| 1757 | 1767 | goto done; |
| @@ -1759,7 +1769,7 @@ wl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *dev, · 1 unmodified line | ||
| 1759 | 1769 | |
| 1760 | 1770 | val = 1; /* assume shared key. otherwise 0 */ |
| 1761 | 1771 | val = cpu_to_le32(val); |
| 1762 | − err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val)); | |
| 1772 | + err = brcmf_dev_ioctl(dev, BRCMF_C_SET_AUTH, &val, sizeof(val)); | |
| 1763 | 1773 | if (unlikely(err)) |
| 1764 | 1774 | WL_ERR("WLC_SET_AUTH error (%d)\n", err); |
| 1765 | 1775 | done: |
| @@ -1768,10 +1778,10 @@ done: · 2 unmodified lines | ||
| 1768 | 1778 | } |
| 1769 | 1779 | |
| 1770 | 1780 | static s32 |
| 1771 | −wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, | |
| 1781 | +brcmf_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, | |
| 1772 | 1782 | u8 key_idx, bool pairwise, const u8 *mac_addr) |
| 1773 | 1783 | { |
| 1774 | − struct wl_wsec_key key; | |
| 1784 | + struct brcmf_wsec_key key; | |
| 1775 | 1785 | s32 err = 0; |
| 1776 | 1786 | s32 val; |
| 1777 | 1787 | s32 wsec; |
| @@ -1781,13 +1791,13 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, · 3 unmodified lines | ||
| 1781 | 1791 | memset(&key, 0, sizeof(key)); |
| 1782 | 1792 | |
| 1783 | 1793 | key.index = (u32) key_idx; |
| 1784 | − key.flags = WL_PRIMARY_KEY; | |
| 1794 | + key.flags = BRCMF_PRIMARY_KEY; | |
| 1785 | 1795 | key.algo = CRYPTO_ALGO_OFF; |
| 1786 | 1796 | |
| 1787 | 1797 | WL_CONN("key index (%d)\n", key_idx); |
| 1788 | 1798 | /* Set the new key/index */ |
| 1789 | 1799 | swap_key_from_BE(&key); |
| 1790 | − err = wl_dev_ioctl(dev, WLC_SET_KEY, &key, sizeof(key)); | |
| 1800 | + err = brcmf_dev_ioctl(dev, BRCMF_C_SET_KEY, &key, sizeof(key)); | |
| 1791 | 1801 | if (unlikely(err)) { |
| 1792 | 1802 | if (err == -EINVAL) { |
| 1793 | 1803 | if (key.index >= DOT11_MAX_DEFAULT_KEYS) |
| @@ -1802,7 +1812,7 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, · 8 unmodified lines | ||
| 1802 | 1812 | } |
| 1803 | 1813 | |
| 1804 | 1814 | val = 0; |
| 1805 | − err = wl_dev_intvar_get(dev, "wsec", &wsec); | |
| 1815 | + err = brcmf_dev_intvar_get(dev, "wsec", &wsec); | |
| 1806 | 1816 | if (unlikely(err)) { |
| 1807 | 1817 | WL_ERR("get wsec error (%d)\n", err); |
| 1808 | 1818 | /* Ignore this error, may happen during DISASSOC */ |
| @@ -1811,7 +1821,7 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, · 2 unmodified lines | ||
| 1811 | 1821 | } |
| 1812 | 1822 | wsec &= ~(WEP_ENABLED); |
| 1813 | 1823 | wsec |= val; |
| 1814 | − err = wl_dev_intvar_set(dev, "wsec", wsec); | |
| 1824 | + err = brcmf_dev_intvar_set(dev, "wsec", wsec); | |
| 1815 | 1825 | if (unlikely(err)) { |
| 1816 | 1826 | WL_ERR("set wsec error (%d)\n", err); |
| 1817 | 1827 | /* Ignore this error, may happen during DISASSOC */ |
| @@ -1821,7 +1831,7 @@ wl_cfg80211_del_key(struct wiphy *wiphy, struct net_device *dev, · 3 unmodified lines | ||
| 1821 | 1831 | |
| 1822 | 1832 | val = 0; /* assume open key. otherwise 1 */ |
| 1823 | 1833 | val = cpu_to_le32(val); |
| 1824 | − err = wl_dev_ioctl(dev, WLC_SET_AUTH, &val, sizeof(val)); | |
| 1834 | + err = brcmf_dev_ioctl(dev, BRCMF_C_SET_AUTH, &val, sizeof(val)); | |
| 1825 | 1835 | if (unlikely(err)) { |
| 1826 | 1836 | WL_ERR("WLC_SET_AUTH error (%d)\n", err); |
| 1827 | 1837 | /* Ignore this error, may happen during DISASSOC */ |
| @@ -1833,14 +1843,14 @@ done: · 5 unmodified lines | ||
| 1833 | 1843 | } |
| 1834 | 1844 | |
| 1835 | 1845 | static s32 |
| 1836 | −wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, | |
| 1846 | +brcmf_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, | |
| 1837 | 1847 | u8 key_idx, bool pairwise, const u8 *mac_addr, void *cookie, |
| 1838 | 1848 | void (*callback) (void *cookie, struct key_params * params)) |
| 1839 | 1849 | { |
| 1840 | 1850 | struct key_params params; |
| 1841 | − struct wl_wsec_key key; | |
| 1842 | − struct wl_priv *wl = wiphy_to_wl(wiphy); | |
| 1843 | − struct wl_security *sec; | |
| 1851 | + struct brcmf_wsec_key key; | |
| 1852 | + struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); | |
| 1853 | + struct brcmf_cfg80211_security *sec; | |
| 1844 | 1854 | s32 wsec; |
| 1845 | 1855 | s32 err = 0; |
| 1846 | 1856 | |
| @@ -1855,7 +1865,7 @@ wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, · 8 unmodified lines | ||
| 1855 | 1865 | params.key_len = (u8) min_t(u8, WLAN_MAX_KEY_LEN, key.len); |
| 1856 | 1866 | memcpy(params.key, key.data, params.key_len); |
| 1857 | 1867 | |
| 1858 | − err = wl_dev_ioctl(dev, WLC_GET_WSEC, &wsec, sizeof(wsec)); | |
| 1868 | + err = brcmf_dev_ioctl(dev, BRCMF_C_GET_WSEC, &wsec, sizeof(wsec)); | |
| 1859 | 1869 | if (unlikely(err)) { |
| 1860 | 1870 | WL_ERR("WLC_GET_WSEC error (%d)\n", err); |
| 1861 | 1871 | /* Ignore this error, may happen during DISASSOC */ |
| @@ -1865,7 +1875,7 @@ wl_cfg80211_get_key(struct wiphy *wiphy, struct net_device *dev, · 3 unmodified lines | ||
| 1865 | 1875 | wsec = le32_to_cpu(wsec); |
| 1866 | 1876 | switch (wsec) { |
| 1867 | 1877 | case WEP_ENABLED: |
| 1868 | − sec = wl_read_prof(wl, WL_PROF_SEC); | |
| 1878 | + sec = brcmf_read_prof(cfg_priv, WL_PROF_SEC); | |
| 1869 | 1879 | if (sec->cipher_pairwise & WLAN_CIPHER_SUITE_WEP40) { |
| 1870 | 1880 | params.cipher = WLAN_CIPHER_SUITE_WEP40; |
| 1871 | 1881 | WL_CONN("WLAN_CIPHER_SUITE_WEP40\n"); |
| @@ -1895,7 +1905,7 @@ done: · 23 unmodified lines | ||
| 1895 | 1905 | } |
| 1896 | 1906 | |
| 1897 | 1907 | static s32 |
| 1898 | −wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, | |
| 1908 | +brcmf_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, | |
| 1899 | 1909 | struct net_device *dev, u8 key_idx) |
| 1900 | 1910 | { |
| 1901 | 1911 | WL_INFO("Not supported\n"); |
| @@ -1905,15 +1915,15 @@ wl_cfg80211_config_default_mgmt_key(struct wiphy *wiphy, · 3 unmodified lines | ||
| 1905 | 1915 | } |
| 1906 | 1916 | |
| 1907 | 1917 | static s32 |
| 1908 | −wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, | |
| 1918 | +brcmf_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, | |
| 1909 | 1919 | u8 *mac, struct station_info *sinfo) |
| 1910 | 1920 | { |
| 1911 | − struct wl_priv *wl = wiphy_to_wl(wiphy); | |
| 1912 | − scb_val_t scb_val; | |
| 1921 | + struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); | |
| 1922 | + struct brcmf_scb_val scb_val; | |
| 1913 | 1923 | int rssi; |
| 1914 | 1924 | s32 rate; |
| 1915 | 1925 | s32 err = 0; |
| 1916 | − u8 *bssid = wl_read_prof(wl, WL_PROF_BSSID); | |
| 1926 | + u8 *bssid = brcmf_read_prof(cfg_priv, WL_PROF_BSSID); | |
| 1917 | 1927 | |
| 1918 | 1928 | WL_TRACE("Enter\n"); |
| 1919 | 1929 | CHECK_SYS_UP(); |
| @@ -1930,7 +1940,7 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, · 10 unmodified lines | ||
| 1930 | 1940 | } |
| 1931 | 1941 | |
| 1932 | 1942 | /* Report the current tx rate */ |
| 1933 | − err = wl_dev_ioctl(dev, WLC_GET_RATE, &rate, sizeof(rate)); | |
| 1943 | + err = brcmf_dev_ioctl(dev, BRCMF_C_GET_RATE, &rate, sizeof(rate)); | |
| 1934 | 1944 | if (err) { |
| 1935 | 1945 | WL_ERR("Could not get rate (%d)\n", err); |
| 1936 | 1946 | } else { |
| @@ -1940,10 +1950,10 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, · 3 unmodified lines | ||
| 1940 | 1950 | WL_CONN("Rate %d Mbps\n", rate / 2); |
| 1941 | 1951 | } |
| 1942 | 1952 | |
| 1943 | − if (test_bit(WL_STATUS_CONNECTED, &wl->status)) { | |
| 1953 | + if (test_bit(WL_STATUS_CONNECTED, &cfg_priv->status)) { | |
| 1944 | 1954 | scb_val.val = 0; |
| 1945 | − err = wl_dev_ioctl(dev, WLC_GET_RSSI, &scb_val, | |
| 1946 | − sizeof(scb_val_t)); | |
| 1955 | + err = brcmf_dev_ioctl(dev, BRCMF_C_GET_RSSI, &scb_val, | |
| 1956 | + sizeof(struct brcmf_scb_val)); | |
| 1947 | 1957 | if (unlikely(err)) { |
| 1948 | 1958 | WL_ERR("Could not get rssi (%d)\n", err); |
| 1949 | 1959 | } |
| @@ -1959,7 +1969,7 @@ done: · 9 unmodified lines | ||
| 1959 | 1969 | } |
| 1960 | 1970 | |
| 1961 | 1971 | static s32 |
| 1962 | −wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | |
| 1972 | +brcmf_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | |
| 1963 | 1973 | bool enabled, s32 timeout) |
| 1964 | 1974 | { |
| 1965 | 1975 | s32 pm; |
| @@ -1972,7 +1982,7 @@ wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, · 6 unmodified lines | ||
| 1972 | 1982 | pm = cpu_to_le32(pm); |
| 1973 | 1983 | WL_INFO("power save %s\n", (pm ? "enabled" : "disabled")); |
| 1974 | 1984 | |
| 1975 | − err = wl_dev_ioctl(dev, WLC_SET_PM, &pm, sizeof(pm)); | |
| 1985 | + err = brcmf_dev_ioctl(dev, BRCMF_C_SET_PM, &pm, sizeof(pm)); | |
| 1976 | 1986 | if (unlikely(err)) { |
| 1977 | 1987 | if (err == -ENODEV) |
| 1978 | 1988 | WL_ERR("net_device is not ready yet\n"); |
| @@ -1983,7 +1993,7 @@ wl_cfg80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, · 4 unmodified lines | ||
| 1983 | 1993 | return err; |
| 1984 | 1994 | } |
| 1985 | 1995 | |
| 1986 | −static __used u32 wl_find_msb(u16 bit16) | |
| 1996 | +static __used u32 brcmf_find_msb(u16 bit16) | |
| 1987 | 1997 | { |
| 1988 | 1998 | u32 ret = 0; |
| 1989 | 1999 | |
| @@ -2011,7 +2021,7 @@ static __used u32 wl_find_msb(u16 bit16) · 21 unmodified lines | ||
| 2011 | 2021 | } |
| 2012 | 2022 | |
| 2013 | 2023 | static s32 |
| 2014 | −wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, | |
| 2024 | +brcmf_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, | |
| 2015 | 2025 | const u8 *addr, |
| 2016 | 2026 | const struct cfg80211_bitrate_mask *mask) |
| 2017 | 2027 | { |
| @@ -2028,7 +2038,7 @@ wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, · 10 unmodified lines | ||
| 2028 | 2038 | |
| 2029 | 2039 | /* addr param is always NULL. ignore it */ |
| 2030 | 2040 | /* Get current rateset */ |
| 2031 | − err = wl_dev_ioctl(dev, WLC_GET_CURR_RATESET, &rateset, | |
| 2041 | + err = brcmf_dev_ioctl(dev, BRCM_GET_CURR_RATESET, &rateset, | |
| 2032 | 2042 | sizeof(rateset)); |
| 2033 | 2043 | if (unlikely(err)) { |
| 2034 | 2044 | WL_ERR("could not get current rateset (%d)\n", err); |
| @@ -2037,9 +2047,9 @@ wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, · 2 unmodified lines | ||
| 2037 | 2047 | |
| 2038 | 2048 | rateset.count = le32_to_cpu(rateset.count); |
| 2039 | 2049 | |
| 2040 | − legacy = wl_find_msb(mask->control[IEEE80211_BAND_2GHZ].legacy); | |
| 2050 | + legacy = brcmf_find_msb(mask->control[IEEE80211_BAND_2GHZ].legacy); | |
| 2041 | 2051 | if (!legacy) |
| 2042 | − legacy = wl_find_msb(mask->control[IEEE80211_BAND_5GHZ].legacy); | |
| 2052 | + legacy = brcmf_find_msb(mask->control[IEEE80211_BAND_5GHZ].legacy); | |
| 2043 | 2053 | |
| 2044 | 2054 | val = wl_g_rates[legacy - 1].bitrate * 100000; |
| 2045 | 2055 | |
| @@ -2057,8 +2067,8 @@ wl_cfg80211_set_bitrate_mask(struct wiphy *wiphy, struct net_device *dev, · 11 unmodified lines | ||
| 2057 | 2067 | * Set rate override, |
| 2058 | 2068 | * Since the is a/b/g-blind, both a/bg_rate are enforced. |
| 2059 | 2069 | */ |
| 2060 | − err_bg = wl_dev_intvar_set(dev, "bg_rate", rate); | |
| 2061 | − err_a = wl_dev_intvar_set(dev, "a_rate", rate); | |
| 2070 | + err_bg = brcmf_dev_intvar_set(dev, "bg_rate", rate); | |
| 2071 | + err_a = brcmf_dev_intvar_set(dev, "a_rate", rate); | |
| 2062 | 2072 | if (unlikely(err_bg && err_a)) { |
| 2063 | 2073 | WL_ERR("could not set fixed rate (%d) (%d)\n", err_bg, err_a); |
| 2064 | 2074 | err = err_bg | err_a; |
| @@ -2069,10 +2079,9 @@ done: · 4 unmodified lines | ||
| 2069 | 2079 | return err; |
| 2070 | 2080 | } |
| 2071 | 2081 | |
| 2072 | −static s32 wl_cfg80211_resume(struct wiphy *wiphy) | |
| 2082 | +static s32 brcmf_cfg80211_resume(struct wiphy *wiphy) | |
| 2073 | 2083 | { |
| 2074 | − struct wl_priv *wl = wiphy_to_wl(wiphy); | |
| 2075 | − struct net_device *ndev = wl_to_ndev(wl); | |
| 2084 | + struct brcmf_cfg80211_priv *cfg_priv = wiphy_to_cfg(wiphy); | |
| 2076 | 2085 | |
| 2077 | 2086 | /* |
| 2078 | 2087 | * Check for WL_STATUS_READY before any function call which |
| @@ -2082,23 +2091,21 @@ static s32 wl_cfg80211_resume(struct wiphy *wiphy) · 3 unmodified lines | ||
| 2082 | 2091 | WL_TRACE("Enter\n"); |
| 2083 | 2092 | |
| 2084 | 2093 | #if defined(CONFIG_PM_SLEEP) |
| 2085 | − atomic_set(&dhd_mmc_suspend, false); | |
| 2094 | + atomic_set(&brcmf_mmc_suspend, false); | |
| 2086 | 2095 | #endif /* defined(CONFIG_PM_SLEEP) */ |
| 2087 | 2096 | |
| 2088 | − if (test_bit(WL_STATUS_READY, &wl->status)) { | |
2688 more lines aren’t shown here.
This diff is large: its 395 lines aren’t shown here.
This diff is large: its 3690 lines aren’t shown here.
This diff is large: its 143 lines aren’t shown here.
This diff is large: its 53 lines aren’t shown here.
This diff is large: its 1296 lines aren’t shown here.
This diff is large: its 320 lines aren’t shown here.
This diff is large: its 333 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 902 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 230 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 937 lines aren’t shown here.
This diff is large: its 715 lines aren’t shown here.
This diff is large: its 2953 lines aren’t shown here.
This diff is large: its 175 lines aren’t shown here.
This diff is large: its 1281 lines aren’t shown here.
This diff is large: its 127 lines aren’t shown here.
This diff is large: its 385 lines aren’t shown here.
This diff is large: its 1258 lines aren’t shown here.
This diff is large: its 206 lines aren’t shown here.
This diff is large: its 1879 lines aren’t shown here.
This diff is large: its 124 lines aren’t shown here.
This diff is large: its 7555 lines aren’t shown here.
This diff is large: its 1163 lines aren’t shown here.
This diff is large: its 1040 lines aren’t shown here.
This diff is large: its 86 lines aren’t shown here.
This diff is large: its 216 lines aren’t shown here.
This diff is large: its 545 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 1856 lines aren’t shown here.
This diff is large: its 295 lines aren’t shown here.
This diff is large: its 806 lines aren’t shown here.
This diff is large: its 1639 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 2914 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 19 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 165 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 142 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 257 lines aren’t shown here.
This diff is large: its 219 lines aren’t shown here.
This diff is large: its 165 lines aren’t shown here.
This diff is large: its 475 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 620 lines aren’t shown here.
This diff is large: its 456 lines aren’t shown here.
This diff is large: its 171 lines aren’t shown here.
This diff is large: its 71 lines aren’t shown here.
This diff is large: its 929 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 468 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 399 lines aren’t shown here.
This diff is large: its 112 lines aren’t shown here.
This diff is large: its 28 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 179 lines aren’t shown here.
This diff is large: its 136 lines aren’t shown here.
This diff is large: its 281 lines aren’t shown here.
This diff is large: its 141 lines aren’t shown here.
This diff is large: its 244 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 1930 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 460 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 375 lines aren’t shown here.
This diff is large: its 151 lines aren’t shown here.
This diff is large: its 125 lines aren’t shown here.
This diff is large: its 154 lines aren’t shown here.
This diff is large: its 206 lines aren’t shown here.
This diff is large: its 209 lines aren’t shown here.
This diff is large: its 368 lines aren’t shown here.
This diff is large: its 501 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 302 lines aren’t shown here.
This diff is large: its 175 lines aren’t shown here.
This diff is large: its 282 lines aren’t shown here.
This diff is large: its 113 lines aren’t shown here.
This diff is large: its 200 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 123 lines aren’t shown here.
This diff is large: its 51 lines aren’t shown here.
This diff is large: its 300 lines aren’t shown here.
This diff is large: its 201 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 208 lines aren’t shown here.
This diff is large: its 1589 lines aren’t shown here.
This diff is large: its 273 lines aren’t shown here.
This diff is large: its 316 lines aren’t shown here.
This diff is large: its 153 lines aren’t shown here.
This diff is large: its 282 lines aren’t shown here.
This diff is large: its 553 lines aren’t shown here.
This diff is large: its 96 lines aren’t shown here.
This diff is large: its 1366 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 105 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 463 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 41 lines aren’t shown here.
This diff is large: its 189 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 74 lines aren’t shown here.
This diff is large: its 170 lines aren’t shown here.
This diff is large: its 137 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 2 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 261 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 787 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 115 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 335 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 955 lines aren’t shown here.
This diff is large: its 72 lines aren’t shown here.
This diff is large: its 533 lines aren’t shown here.
This diff is large: its 380 lines aren’t shown here.
This diff is large: its 111 lines aren’t shown here.
This diff is large: its 202 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 299 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 75 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 215 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 490 lines aren’t shown here.
This diff is large: its 291 lines aren’t shown here.
This diff is large: its 67 lines aren’t shown here.
This diff is large: its 790 lines aren’t shown here.
This diff is large: its 714 lines aren’t shown here.
This diff is large: its 61 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 455 lines aren’t shown here.
This diff is large: its 253 lines aren’t shown here.
This diff is large: its 46 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 845 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 133 lines aren’t shown here.
This diff is large: its 211 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 178 lines aren’t shown here.
This diff is large: its 308 lines aren’t shown here.
This diff is large: its 99 lines aren’t shown here.
This diff is large: its 144 lines aren’t shown here.
This diff is large: its 124 lines aren’t shown here.
This diff is large: its 97 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 99 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 82 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 143 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 180 lines aren’t shown here.
This diff is large: its 111 lines aren’t shown here.
This diff is large: its 209 lines aren’t shown here.
This diff is large: its 1205 lines aren’t shown here.
This diff is large: its 198 lines aren’t shown here.
This diff is large: its 276 lines aren’t shown here.
This diff is large: its 1114 lines aren’t shown here.
This diff is large: its 940 lines aren’t shown here.
This diff is large: its 1505 lines aren’t shown here.
This diff is large: its 139 lines aren’t shown here.
This diff is large: its 93 lines aren’t shown here.
This diff is large: its 422 lines aren’t shown here.
This diff is large: its 646 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 664 lines aren’t shown here.
This diff is large: its 1040 lines aren’t shown here.
This diff is large: its 155 lines aren’t shown here.
This diff is large: its 942 lines aren’t shown here.
This diff is large: its 655 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 52 lines aren’t shown here.
This diff is large: its 832 lines aren’t shown here.
This diff is large: its 203 lines aren’t shown here.
This diff is large: its 530 lines aren’t shown here.
This diff is large: its 307 lines aren’t shown here.
This diff is large: its 2895 lines aren’t shown here.
This diff is large: its 202 lines aren’t shown here.
This diff is large: its 207 lines aren’t shown here.
This diff is large: its 394 lines aren’t shown here.
This diff is large: its 1146 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 414 lines aren’t shown here.
This diff is large: its 50 lines aren’t shown here.
This diff is large: its 352 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 327 lines aren’t shown here.
This diff is large: its 1509 lines aren’t shown here.
This diff is large: its 377 lines aren’t shown here.
This diff is large: its 722 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 893 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 267 lines aren’t shown here.
This diff is large: its 111 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 492 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
File renamed without changes.
File renamed without changes.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 715 lines aren’t shown here.
This diff is large: its 761 lines aren’t shown here.
This diff is large: its 177 lines aren’t shown here.
This diff is large: its 779 lines aren’t shown here.
This diff is large: its 155 lines aren’t shown here.
This diff is large: its 801 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 1012 lines aren’t shown here.
This diff is large: its 139 lines aren’t shown here.
This diff is large: its 1485 lines aren’t shown here.
This diff is large: its 185 lines aren’t shown here.
This diff is large: its 1403 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 171 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 559 lines aren’t shown here.
This diff is large: its 207 lines aren’t shown here.
This diff is large: its 510 lines aren’t shown here.
This diff is large: its 141 lines aren’t shown here.
This diff is large: its 271 lines aren’t shown here.
This diff is large: its 270 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
File renamed without changes.
This diff is large: its 141 lines aren’t shown here.
This diff is large: its 120 lines aren’t shown here.
This diff is large: its 635 lines aren’t shown here.
This diff is large: its 853 lines aren’t shown here.
This diff is large: its 328 lines aren’t shown here.
This diff is large: its 202 lines aren’t shown here.
This diff is large: its 396 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 228 lines aren’t shown here.
This diff is large: its 354 lines aren’t shown here.
This diff is large: its 200 lines aren’t shown here.
This diff is large: its 743 lines aren’t shown here.
This diff is large: its 854 lines aren’t shown here.
This diff is large: its 423 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 381 lines aren’t shown here.
This diff is large: its 1544 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 186 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 980 lines aren’t shown here.
This diff is large: its 76 lines aren’t shown here.
This diff is large: its 280 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 107 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 222 lines aren’t shown here.
This diff is large: its 165 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 164 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 213 lines aren’t shown here.
This diff is large: its 313 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 286 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 158 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 158 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 159 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 231 lines aren’t shown here.
This diff is large: its 38 lines aren’t shown here.
This diff is large: its 160 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 194 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 312 lines aren’t shown here.
This diff is large: its 63 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 316 lines aren’t shown here.
This diff is large: its 237 lines aren’t shown here.
This diff is large: its 251 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 155 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 260 lines aren’t shown here.
This diff is large: its 988 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 195 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 261 lines aren’t shown here.
This diff is large: its 247 lines aren’t shown here.
This diff is large: its 377 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 836 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 174 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 193 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 164 lines aren’t shown here.
This diff is large: its 498 lines aren’t shown here.
This diff is large: its 231 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 94 lines aren’t shown here.
This diff is large: its 91 lines aren’t shown here.
This diff is large: its 120 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 158 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 87 lines aren’t shown here.
This diff is large: its 84 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 130 lines aren’t shown here.
This diff is large: its 105 lines aren’t shown here.
This diff is large: its 111 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 224 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 42 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 136 lines aren’t shown here.
This diff is large: its 57 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 129 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 34 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 6 lines aren’t shown here.
This diff is large: its 354 lines aren’t shown here.
This diff is large: its 267 lines aren’t shown here.
This diff is large: its 174 lines aren’t shown here.
This diff is large: its 147 lines aren’t shown here.
This diff is large: its 182 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 174 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 169 lines aren’t shown here.
This diff is large: its 23 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 110 lines aren’t shown here.
This diff is large: its 184 lines aren’t shown here.
This diff is large: its 48 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 273 lines aren’t shown here.
This diff is large: its 1199 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 92 lines aren’t shown here.
This diff is large: its 780 lines aren’t shown here.
This diff is large: its 1035 lines aren’t shown here.
This diff is large: its 402 lines aren’t shown here.
This diff is large: its 345 lines aren’t shown here.
This diff is large: its 18 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 358 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 197 lines aren’t shown here.
This diff is large: its 121 lines aren’t shown here.
This diff is large: its 157 lines aren’t shown here.
This diff is large: its 234 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 125 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is large: its 4 lines aren’t shown here.
This diff is large: its 570 lines aren’t shown here.
This diff is large: its 251 lines aren’t shown here.
This diff is large: its 1123 lines aren’t shown here.
This diff is large: its 249 lines aren’t shown here.
This diff is large: its 240 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 447 lines aren’t shown here.
This diff is large: its 89 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 291 lines aren’t shown here.
This diff is large: its 238 lines aren’t shown here.
This diff is large: its 375 lines aren’t shown here.
This diff is large: its 99 lines aren’t shown here.
This diff is large: its 376 lines aren’t shown here.
This diff is large: its 321 lines aren’t shown here.
This diff is large: its 92 lines aren’t shown here.
This diff is large: its 115 lines aren’t shown here.
This diff is large: its 893 lines aren’t shown here.
This diff is large: its 1742 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 137 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 378 lines aren’t shown here.
This diff is large: its 208 lines aren’t shown here.
This diff is large: its 64 lines aren’t shown here.
This diff is large: its 2240 lines aren’t shown here.
This diff is large: its 532 lines aren’t shown here.
This diff is large: its 1114 lines aren’t shown here.
This diff is large: its 680 lines aren’t shown here.
This diff is large: its 337 lines aren’t shown here.
This diff is large: its 176 lines aren’t shown here.
This diff is large: its 1260 lines aren’t shown here.
This diff is large: its 314 lines aren’t shown here.
This diff is large: its 255 lines aren’t shown here.
This diff is large: its 1687 lines aren’t shown here.
This diff is large: its 105 lines aren’t shown here.
This diff is large: its 562 lines aren’t shown here.
This diff is large: its 380 lines aren’t shown here.
This diff is large: its 140 lines aren’t shown here.
This diff is large: its 143 lines aren’t shown here.
This diff is large: its 721 lines aren’t shown here.
This diff is large: its 1503 lines aren’t shown here.
This diff is large: its 348 lines aren’t shown here.
This diff is large: its 70 lines aren’t shown here.
This diff is large: its 2487 lines aren’t shown here.
This diff is large: its 829 lines aren’t shown here.
This diff is large: its 390 lines aren’t shown here.
This diff is large: its 215 lines aren’t shown here.
This diff is large: its 62 lines aren’t shown here.
This diff is large: its 2355 lines aren’t shown here.
This diff is large: its 159 lines aren’t shown here.
This diff is large: its 80 lines aren’t shown here.
This diff is large: its 182 lines aren’t shown here.
This diff is large: its 137 lines aren’t shown here.
This diff is large: its 130 lines aren’t shown here.
This diff is large: its 246 lines aren’t shown here.
This diff is large: its 313 lines aren’t shown here.
This diff is large: its 164 lines aren’t shown here.
This diff is large: its 214 lines aren’t shown here.
This diff is large: its 297 lines aren’t shown here.
This diff is large: its 102 lines aren’t shown here.
This diff is large: its 44 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 78 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 39 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 30 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 69 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 29 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 135 lines aren’t shown here.
This diff is large: its 27 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 35 lines aren’t shown here.
This diff is large: its 13 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 168 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 5 lines aren’t shown here.
This diff is large: its 33 lines aren’t shown here.
This diff is large: its 79 lines aren’t shown here.
This diff is large: its 16 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 21 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 145 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 88 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 264 lines aren’t shown here.
This diff is large: its 101 lines aren’t shown here.
This diff is large: its 137 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 2785 lines aren’t shown here.
This diff is large: its 159 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 211 lines aren’t shown here.
This diff is large: its 631 lines aren’t shown here.
This diff is large: its 1404 lines aren’t shown here.
This diff is large: its 567 lines aren’t shown here.
This diff is large: its 653 lines aren’t shown here.
This diff is large: its 2215 lines aren’t shown here.
This diff is large: its 352 lines aren’t shown here.
This diff is large: its 365 lines aren’t shown here.
This diff is large: its 108 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 3235 lines aren’t shown here.
This diff is large: its 43 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 4508 lines aren’t shown here.
This diff is large: its 1561 lines aren’t shown here.
This diff is large: its 92 lines aren’t shown here.
This diff is large: its 255 lines aren’t shown here.
This diff is large: its 2490 lines aren’t shown here.
This diff is large: its 2369 lines aren’t shown here.
This diff is large: its 141 lines aren’t shown here.
This diff is large: its 4652 lines aren’t shown here.
This diff is large: its 7 lines aren’t shown here.
This diff is large: its 11 lines aren’t shown here.
This diff is large: its 144 lines aren’t shown here.
This diff is large: its 343 lines aren’t shown here.
This diff is large: its 22 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 105 lines aren’t shown here.
This diff is large: its 334 lines aren’t shown here.
This diff is large: its 4 lines aren’t shown here.
This diff is large: its 14 lines aren’t shown here.
This diff is large: its 358 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 58 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 392 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 106 lines aren’t shown here.
This diff is large: its 182 lines aren’t shown here.
This diff is large: its 402 lines aren’t shown here.
This diff is large: its 49 lines aren’t shown here.
This diff is large: its 380 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 20 lines aren’t shown here.
This diff is large: its 644 lines aren’t shown here.
This diff is large: its 866 lines aren’t shown here.
This diff is large: its 40 lines aren’t shown here.
This diff is large: its 229 lines aren’t shown here.
This diff is large: its 278 lines aren’t shown here.
This diff is large: its 104 lines aren’t shown here.
This diff is large: its 304 lines aren’t shown here.
This diff is large: its 342 lines aren’t shown here.
This diff is large: its 183 lines aren’t shown here.
This diff is large: its 187 lines aren’t shown here.
This diff is large: its 914 lines aren’t shown here.
This diff is large: its 308 lines aren’t shown here.
This diff is large: its 59 lines aren’t shown here.
This diff is large: its 13210 lines aren’t shown here.
This diff is large: its 25 lines aren’t shown here.
This diff is large: its 133 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 26 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 47 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 145 lines aren’t shown here.
This diff is large: its 17 lines aren’t shown here.
This diff is large: its 9 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is large: its 8 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 15 lines aren’t shown here.
This diff is large: its 1108 lines aren’t shown here.
This diff is large: its 144 lines aren’t shown here.
This diff is large: its 359 lines aren’t shown here.
This diff is large: its 1265 lines aren’t shown here.
This diff is large: its 3489 lines aren’t shown here.
This diff is large: its 1137 lines aren’t shown here.
This diff is large: its 4126 lines aren’t shown here.
This diff is large: its 3741 lines aren’t shown here.
This diff is large: its 2442 lines aren’t shown here.
This diff is large: its 56 lines aren’t shown here.
This diff is large: its 320 lines aren’t shown here.
This diff is large: its 559 lines aren’t shown here.
This diff is large: its 73 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 1632 lines aren’t shown here.
This diff is large: its 418 lines aren’t shown here.
This diff is large: its 65 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 24 lines aren’t shown here.
This diff is large: its 410 lines aren’t shown here.
This diff is large: its 10 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 2178 lines aren’t shown here.
This diff is large: its 194 lines aren’t shown here.
This diff is large: its 100 lines aren’t shown here.
This diff is large: its 419 lines aren’t shown here.
This diff is large: its 60 lines aren’t shown here.
This diff is large: its 615 lines aren’t shown here.
This diff is large: its 181 lines aren’t shown here.
This diff is large: its 31 lines aren’t shown here.
This diff is large: its 420 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 32 lines aren’t shown here.
This diff is large: its 620 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 12 lines aren’t shown here.
This diff is large: its 36 lines aren’t shown here.
This diff is large: its 1058 lines aren’t shown here.
This diff is large: its 376 lines aren’t shown here.
This diff is large: its 1095 lines aren’t shown here.
This diff is large: its 109 lines aren’t shown here.
This diff is large: its 45 lines aren’t shown here.
This diff is large: its 801 lines aren’t shown here.
This diff is large: its 105 lines aren’t shown here.
This diff is large: its 37 lines aren’t shown here.
This diff is large: its 367 lines aren’t shown here.
This diff is large: its 55 lines aren’t shown here.
This diff is large: its 1550 lines aren’t shown here.
This diff is large: its 54 lines aren’t shown here.
This diff is larger than a page shows: the files after these aren’t listed. Clone the repository to see all of it.