Commit c7137ddf authored by Matthias Schulz's avatar Matthias Schulz
Browse files

created a new nexdhd driver directory that should hold a minimal version of a...

created a new nexdhd driver directory that should hold a minimal version of a driver to access the chip, currently it is just a copy of the bcmdhd driver with some modifications with regard to configuration variables and global exports
parent 6d90e3d7
......@@ -71,12 +71,14 @@ kernel/arch/arm/boot/zImage-dtb: kernel/.config
bcmdhd: kernel/drivers/net/wireless/bcmdhd/bcmdhd.ko
kernel/drivers/net/wireless/bcmdhd/bcmdhd.ko : kernel/drivers/net/wireless/bcmdhd/*.c kernel/drivers/net/wireless/bcmdhd/*.h
kernel/drivers/net/wireless/bcmdhd/bcmdhd.ko : kernel/drivers/net/wireless/bcmdhd/*
cd kernel && make modules
kernel/drivers/net/wireless/nexdhd/nexdhd.ko : kernel/drivers/net/wireless/nexdhd/*
cd kernel && make modules
boot.img: kernel/arch/arm/boot/Image kernel/drivers/net/wireless/bcmdhd/bcmdhd.ko
boot.img: kernel/arch/arm/boot/Image kernel/drivers/net/wireless/bcmdhd/bcmdhd.ko kernel/drivers/net/wireless/nexdhd/nexdhd.ko
rm -Rf bootimg_tmp
mkdir bootimg_tmp
cd bootimg_tmp && \
......@@ -89,6 +91,7 @@ boot.img: kernel/arch/arm/boot/Image kernel/drivers/net/wireless/bcmdhd/bcmdhd.k
sed -i '/service p2p_supplicant/,+14 s/^/#/' init.hammerhead.rc
mkdir bootimg_tmp/ramdisk/nexmon
cp kernel/drivers/net/wireless/bcmdhd/bcmdhd.ko bootimg_tmp/ramdisk/nexmon/
cp kernel/drivers/net/wireless/nexdhd/nexdhd.ko bootimg_tmp/ramdisk/nexmon/
cp bootimg_src/firmware/fw_bcmdhd.bin bootimg_tmp/ramdisk/nexmon/
cp bootimg_src/firmware/bcmdhd.cal bootimg_tmp/ramdisk/nexmon/
mkdir bootimg_tmp/ramdisk/nexmon/bin
......
......@@ -1510,6 +1510,12 @@ CONFIG_BCMDHD_FW_PATH="/nexmon/fw_bcmdhd.bin"
CONFIG_BCMDHD_NVRAM_PATH="/nexmon/bcmdhd.cal"
# CONFIG_DHD_USE_STATIC_BUF is not set
CONFIG_DHD_USE_SCHED_SCAN=y
CONFIG_NEXDHD=m
CONFIG_NEX4339=m
CONFIG_NEXDHD_FW_PATH="/nexmon/fw_bcmdhd.bin"
CONFIG_NEXDHD_NVRAM_PATH="/nexmon/bcmdhd.cal"
# CONFIG_NEXDHD_USE_STATIC_BUF is not set
CONFIG_NEXDHD_USE_SCHED_SCAN=y
# CONFIG_BRCMFMAC is not set
# CONFIG_HOSTAP is not set
# CONFIG_IWM is not set
......
......@@ -94,7 +94,7 @@ static void __init msm8974_early_memory(void)
* into this category, and thus the driver should not be added here. The
* EPROBE_DEFER can satisfy most dependency problems.
*/
#if defined (CONFIG_BCMDHD) || defined (CONFIG_BCMDHD_MODULE)
#if defined (CONFIG_BCMDHD) || defined (CONFIG_BCMDHD_MODULE) || defined (CONFIG_NEXDHD) || defined (CONFIG_NEXDHD_MODULE)
extern void init_bcm_wifi(void);
#endif
......@@ -111,7 +111,7 @@ void __init msm8974_add_drivers(void)
tsens_tm_init_driver();
msm_thermal_device_init();
lge_add_persistent_device();
#if defined (CONFIG_BCMDHD) || defined (CONFIG_BCMDHD_MODULE)
#if defined (CONFIG_BCMDHD) || defined (CONFIG_BCMDHD_MODULE) || defined (CONFIG_NEXDHD) || defined (CONFIG_NEXDHD_MODULE)
init_bcm_wifi();
#endif
}
......
......@@ -318,6 +318,7 @@ source "drivers/net/wireless/ath/Kconfig"
source "drivers/net/wireless/b43/Kconfig"
source "drivers/net/wireless/b43legacy/Kconfig"
source "drivers/net/wireless/bcmdhd/Kconfig"
source "drivers/net/wireless/nexdhd/Kconfig"
source "drivers/net/wireless/brcm80211/Kconfig"
source "drivers/net/wireless/hostap/Kconfig"
source "drivers/net/wireless/ipw2x00/Kconfig"
......
......@@ -61,6 +61,8 @@ obj-$(CONFIG_MWIFIEX) += mwifiex/
obj-$(CONFIG_BCMDHD) += bcmdhd/
obj-$(CONFIG_NEXDHD) += nexdhd/
obj-$(CONFIG_BRCMFMAC) += brcm80211/
obj-$(CONFIG_BRCMSMAC) += brcm80211/
......
config NEXDHD
tristate "NEXMON Broadcom 4329/30 wireless cards support"
depends on MMC
---help---
This module adds support for wireless adapters based on
Broadcom 4329/30 chipset.
This driver uses the kernel's wireless extensions subsystem.
If you choose to build a module, it'll be called dhd. Say M if
unsure.
config NEX4339
tristate "NEXMON Broadcom 4339 wireless cards support"
depends on NEXDHD
---help---
This module adds support for wireless adapters based on
Broadcom 4339 chipset.
config NEXDHD_FW_PATH
depends on NEXDHD
string "NEXMON Firmware path"
default "/system/etc/firmware/fw_bcmdhd.bin"
---help---
Path to the firmware file.
config NEXDHD_NVRAM_PATH
depends on NEXDHD
string "NEXMON NVRAM path"
default "/system/etc/wifi/bcmdhd.cal"
---help---
Path to the calibration file.
config NEXDHD_WEXT
bool "NEXMON Enable WEXT support"
depends on NEXDHD && CFG80211 = n
select WIRELESS_EXT
select WEXT_PRIV
help
Enables WEXT support
config NEXDHD_USE_STATIC_BUF
bool "NEXMON Enable memory preallocation"
depends on NEXDHD
default n
---help---
Use memory preallocated in platform
config NEXDHD_USE_SCHED_SCAN
bool "NEXMON Use CFG80211 sched scan"
depends on NEXDHD && CFG80211
default n
---help---
Use CFG80211 sched scan
# nexdhd
#
#
#
#
#
DHDCFLAGS = -Wall -Wstrict-prototypes -lnl -Dlinux -DBCMDRIVER \
-DBCMDONGLEHOST -DUNRELEASEDCHIP -DBCMDMA32 -DBCMFILEIMAGE \
-DDHDTHREAD -DDHD_DEBUG -DSDTEST -DBDC \
-DDHD_BCMEVENTS -DSHOW_EVENTS -DPROP_TXSTATUS -DBCMDBG \
-DCUSTOMER_HW2 -DOOB_INTR_ONLY -DHW_OOB \
-DMMC_SDIO_ABORT -DBCMSDIO -DBCMLXSDMMC -DBCMPLATFORM_BUS -DWLP2P \
-DWIFI_ACT_FRAME -DARP_OFFLOAD_SUPPORT \
-DKEEP_ALIVE -DGET_CUSTOM_MAC_ENABLE -DPKT_FILTER_SUPPORT \
-DEMBEDDED_PLATFORM -DENABLE_INSMOD_NO_FW_LOAD -DPNO_SUPPORT \
-DDHD_USE_IDLECOUNT -DSET_RANDOM_MAC_SOFTAP -DROAM_ENABLE -DVSDB \
-DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST -DENABLE_FW_ROAM_SUSPEND \
-DESCAN_RESULT_PATCH -DSDIO_CRC_ERROR_FIX \
-DDHD_DONOT_FORWARD_BCMEVENT_AS_NETWORK_PKT -DRXFRAME_THREAD \
-DSUPPORT_PM2_ONLY -DWLTDLS \
-DMIRACAST_AMPDU_SIZE=8 \
-Idrivers/net/wireless/nexdhd -Idrivers/net/wireless/nexdhd/include \
-Idrivers/net/wireless/nexdhd/common/include
DHDOFILES = aiutils.o bcmsdh_sdmmc_linux.o nexmon.o dhd_linux.o siutils.o bcmutils.o \
dhd_linux_sched.o dhd_pno.o dhd_sdio.o bcmwifi_channels.o bcmevent.o hndpmu.o \
bcmsdh.o dhd_cdc.o bcmsdh_linux.o dhd_common.o dhd_wlfc.o dhd_ip.o linux_osl.o \
bcmsdh_sdmmc.o dhd_custom_gpio.o sbutils.o wldev_common.o wl_android.o
obj-$(CONFIG_NEXDHD) += nexdhd.o
nexdhd-objs += $(DHDOFILES)
ifneq ($(CONFIG_WIRELESS_EXT),)
nexdhd-objs += wl_iw.o
DHDCFLAGS += -DSOFTAP -DWL_WIRELESS_EXT -DUSE_IW
endif
ifneq ($(CONFIG_CFG80211),)
nexdhd-objs += wl_cfg80211.o wl_cfgp2p.o wl_linux_mon.o dhd_cfg80211.o wl_cfgvendor.o
DHDCFLAGS += -DWL_CFG80211 -DWL_CFG80211_STA_EVENT -DWL_ENABLE_P2P_IF
DHDCFLAGS += -DWL_VENDOR_EXT_SUPPORT
DHDCFLAGS += -DWL_IFACE_COMB_NUM_CHANNELS
DHDCFLAGS += -DCUSTOM_ROAM_TRIGGER_SETTING=-75
DHDCFLAGS += -DCUSTOM_ROAM_DELTA_SETTING=10
DHDCFLAGS += -DCUSTOM_KEEP_ALIVE_SETTING=28000
DHDCFLAGS += -DCUSTOM_PNO_EVENT_LOCK_xTIME=10
endif
ifneq ($(CONFIG_NEXDHD_USE_SCHED_SCAN),)
DHDCFLAGS += -DWL_SCHED_SCAN
endif
EXTRA_CFLAGS = $(DHDCFLAGS)
ifeq ($(CONFIG_NEXDHD),m)
EXTRA_LDFLAGS += --strip-debug
endif
#Gscan
DHDCFLAGS += -DGSCAN_SUPPORT
DHDCFLAGS += -DCUSTOM_TDLS_RSSI_THRESHOLD_HIGH=-60
DHDCFLAGS += -DCUSTOM_TDLS_RSSI_THRESHOLD_LOW=-70
DHDCFLAGS += -DCUSTOM_TDLS_IDLE_MODE_SETTING=40000
# debug info
DHDCFLAGS += -DDHD_WAKE_STATUS -DDHD_WAKE_RX_STATUS
DHDCFLAGS += -DDHD_WAKE_EVENT_STATUS
#########################
# Chip dependent feature
#########################
ifneq ($(CONFIG_NEX4339),)
DHDCFLAGS += -DCUSTOM_GLOM_SETTING=8 -DCUSTOM_RXCHAIN=1
DHDCFLAGS += -DUSE_DYNAMIC_F2_BLKSIZE -DDYNAMIC_F2_BLKSIZE_FOR_NONLEGACY=128
DHDCFLAGS += -DBCMSDIOH_TXGLOM -DCUSTOM_TXGLOM=1 -DBCMSDIOH_TXGLOM_HIGHSPEED
DHDCFLAGS += -DCUSTOM_SDIO_F2_BLKSIZE=512
DHDCFLAGS += -DDHDTCPACK_SUPPRESS
DHDCFLAGS += -DUSE_WL_TXBF
DHDCFLAGS += -DUSE_WL_FRAMEBURST
DHDCFLAGS += -DCUSTOM_AMPDU_BA_WSIZE=32
DHDCFLAGS += -DPROP_TXSTATUS_VSDB
DHDCFLAGS += -DCUSTOM_MAX_TXGLOM_SIZE=32
DHDCFLAGS += -DREPEAT_READFRAME
DHDCFLAGS += -DROAM_AP_ENV_DETECTION
DHDCFLAGS += -DWL11U
DHDCFLAGS += -DCUSTOM_DPC_PRIO_SETTING=0 -DCUSTOM_RXF_PRIO_SETTING=0
else
DHDCFLAGS += -DCUSTOM_SDIO_F2_BLKSIZE=128
endif
This diff is collapsed.
/*
* bcmevent read-only data shared by kernel or app layers
*
* Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
* you also meet, for each linked independent module, the terms and conditions of
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
* $Id: bcmevent.c 389384 2013-03-06 12:20:17Z $
*/
#include <typedefs.h>
#include <bcmutils.h>
#include <proto/ethernet.h>
#include <proto/bcmeth.h>
#include <proto/bcmevent.h>
#if WLC_E_LAST != 144
#error "You need to add an entry to bcmevent_names[] for the new event"
#endif
const bcmevent_name_t bcmevent_names[] = {
{ WLC_E_SET_SSID, "SET_SSID" },
{ WLC_E_JOIN, "JOIN" },
{ WLC_E_START, "START" },
{ WLC_E_AUTH, "AUTH" },
{ WLC_E_AUTH_IND, "AUTH_IND" },
{ WLC_E_DEAUTH, "DEAUTH" },
{ WLC_E_DEAUTH_IND, "DEAUTH_IND" },
{ WLC_E_ASSOC, "ASSOC" },
{ WLC_E_ASSOC_IND, "ASSOC_IND" },
{ WLC_E_REASSOC, "REASSOC" },
{ WLC_E_REASSOC_IND, "REASSOC_IND" },
{ WLC_E_DISASSOC, "DISASSOC" },
{ WLC_E_DISASSOC_IND, "DISASSOC_IND" },
{ WLC_E_QUIET_START, "START_QUIET" },
{ WLC_E_QUIET_END, "END_QUIET" },
{ WLC_E_BEACON_RX, "BEACON_RX" },
{ WLC_E_LINK, "LINK" },
{ WLC_E_MIC_ERROR, "MIC_ERROR" },
{ WLC_E_NDIS_LINK, "NDIS_LINK" },
{ WLC_E_ROAM, "ROAM" },
{ WLC_E_TXFAIL, "TXFAIL" },
{ WLC_E_PMKID_CACHE, "PMKID_CACHE" },
{ WLC_E_RETROGRADE_TSF, "RETROGRADE_TSF" },
{ WLC_E_PRUNE, "PRUNE" },
{ WLC_E_AUTOAUTH, "AUTOAUTH" },
{ WLC_E_EAPOL_MSG, "EAPOL_MSG" },
{ WLC_E_SCAN_COMPLETE, "SCAN_COMPLETE" },
{ WLC_E_ADDTS_IND, "ADDTS_IND" },
{ WLC_E_DELTS_IND, "DELTS_IND" },
{ WLC_E_BCNSENT_IND, "BCNSENT_IND" },
{ WLC_E_BCNRX_MSG, "BCNRX_MSG" },
{ WLC_E_BCNLOST_MSG, "BCNLOST_IND" },
{ WLC_E_ROAM_PREP, "ROAM_PREP" },
{ WLC_E_PFN_NET_FOUND, "PFNFOUND_IND" },
{ WLC_E_PFN_NET_LOST, "PFNLOST_IND" },
#if defined(IBSS_PEER_DISCOVERY_EVENT)
{ WLC_E_IBSS_ASSOC, "IBSS_ASSOC" },
#endif /* defined(IBSS_PEER_DISCOVERY_EVENT) */
{ WLC_E_RADIO, "RADIO" },
{ WLC_E_PSM_WATCHDOG, "PSM_WATCHDOG" },
{ WLC_E_PROBREQ_MSG, "PROBE_REQ_MSG" },
{ WLC_E_SCAN_CONFIRM_IND, "SCAN_CONFIRM_IND" },
{ WLC_E_PSK_SUP, "PSK_SUP" },
{ WLC_E_COUNTRY_CODE_CHANGED, "CNTRYCODE_IND" },
{ WLC_E_EXCEEDED_MEDIUM_TIME, "EXCEEDED_MEDIUM_TIME" },
{ WLC_E_ICV_ERROR, "ICV_ERROR" },
{ WLC_E_UNICAST_DECODE_ERROR, "UNICAST_DECODE_ERROR" },
{ WLC_E_MULTICAST_DECODE_ERROR, "MULTICAST_DECODE_ERROR" },
{ WLC_E_TRACE, "TRACE" },
{ WLC_E_IF, "IF" },
#ifdef WLP2P
{ WLC_E_P2P_DISC_LISTEN_COMPLETE, "WLC_E_P2P_DISC_LISTEN_COMPLETE" },
#endif
{ WLC_E_RSSI, "RSSI" },
{ WLC_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE" },
{ WLC_E_EXTLOG_MSG, "EXTERNAL LOG MESSAGE" },
#ifdef WIFI_ACT_FRAME
{ WLC_E_ACTION_FRAME, "ACTION_FRAME" },
{ WLC_E_ACTION_FRAME_RX, "ACTION_FRAME_RX" },
{ WLC_E_ACTION_FRAME_COMPLETE, "ACTION_FRAME_COMPLETE" },
#endif
#if 0 && (0>= 0x0620)
{ WLC_E_PRE_ASSOC_IND, "ASSOC_RECV" },
{ WLC_E_PRE_REASSOC_IND, "REASSOC_RECV" },
{ WLC_E_CHANNEL_ADOPTED, "CHANNEL_ADOPTED" },
{ WLC_E_AP_STARTED, "AP_STARTED" },
{ WLC_E_DFS_AP_STOP, "DFS_AP_STOP" },
{ WLC_E_DFS_AP_RESUME, "DFS_AP_RESUME" },
{ WLC_E_ASSOC_IND_NDIS, "ASSOC_IND_NDIS"},
{ WLC_E_REASSOC_IND_NDIS, "REASSOC_IND_NDIS"},
{ WLC_E_ACTION_FRAME_RX_NDIS, "WLC_E_ACTION_FRAME_RX_NDIS" },
{ WLC_E_AUTH_REQ, "WLC_E_AUTH_REQ" },
{ WLC_E_IBSS_COALESCE, "IBSS COALESCE" },
#endif
{ WLC_E_ESCAN_RESULT, "WLC_E_ESCAN_RESULT" },
{ WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE, "WLC_E_AF_OFF_CHAN_COMPLETE" },
#ifdef WLP2P
{ WLC_E_PROBRESP_MSG, "PROBE_RESP_MSG" },
{ WLC_E_P2P_PROBREQ_MSG, "P2P PROBE_REQ_MSG" },
#endif
#ifdef PROP_TXSTATUS
{ WLC_E_FIFO_CREDIT_MAP, "FIFO_CREDIT_MAP" },
#endif
{ WLC_E_WAKE_EVENT, "WAKE_EVENT" },
{ WLC_E_DCS_REQUEST, "DCS_REQUEST" },
{ WLC_E_RM_COMPLETE, "RM_COMPLETE" },
#ifdef WLMEDIA_HTSF
{ WLC_E_HTSFSYNC, "HTSF_SYNC_EVENT" },
#endif
{ WLC_E_OVERLAY_REQ, "OVERLAY_REQ_EVENT" },
{ WLC_E_CSA_COMPLETE_IND, "WLC_E_CSA_COMPLETE_IND"},
{ WLC_E_EXCESS_PM_WAKE_EVENT, "EXCESS_PM_WAKE_EVENT" },
{ WLC_E_PFN_SCAN_NONE, "PFN_SCAN_NONE" },
{ WLC_E_PFN_SCAN_ALLGONE, "PFN_SCAN_ALLGONE" },
#ifdef SOFTAP
{ WLC_E_GTK_PLUMBED, "GTK_PLUMBED" },
#endif
{ WLC_E_ASSOC_REQ_IE, "ASSOC_REQ_IE" },
{ WLC_E_ASSOC_RESP_IE, "ASSOC_RESP_IE" },
{ WLC_E_ACTION_FRAME_RX_NDIS, "WLC_E_ACTION_FRAME_RX_NDIS" },
#ifdef WLTDLS
{ WLC_E_TDLS_PEER_EVENT, "TDLS_PEER_EVENT" },
#endif /* WLTDLS */
{ WLC_E_NATIVE, "NATIVE" },
#ifdef WLPKTDLYSTAT
{ WLC_E_PKTDELAY_IND, "PKTDELAY_IND" },
#endif /* WLPKTDLYSTAT */
{ WLC_E_SERVICE_FOUND, "SERVICE_FOUND" },
{ WLC_E_GAS_FRAGMENT_RX, "GAS_FRAGMENT_RX" },
{ WLC_E_GAS_COMPLETE, "GAS_COMPLETE" },
{ WLC_E_P2PO_ADD_DEVICE, "P2PO_DEV_FOUND" },
{ WLC_E_P2PO_DEL_DEVICE, "P2PO_DEV_LOST" },
#ifdef WLWNM
{ WLC_E_WNM_STA_SLEEP, "WMM_STA_SLEEP" },
#endif /* WLWNM */
#if defined(WL_PROXDETECT)
{ WLC_E_PROXD, "WLC_E_PROXD" },
#endif
{ WLC_E_CCA_CHAN_QUAL, "CCA_BASED_CHANNEL_QUALITY" },
#ifdef GSCAN_SUPPORT
{ WLC_E_PFN_GSCAN_FULL_RESULT, "PFN_GSCAN_FULL_RESULT"},
{ WLC_E_PFN_SWC, "PFN_SIGNIFICANT_WIFI_CHANGE"},
{ WLC_E_PFN_SSID_EXT, "PFN_SSID_EXT"},
{ WLC_E_ROAM_EXP_EVENT, "ROAM_EXP_EVENT"},
#endif /* GSCAN_SUPPORT */
};
const int bcmevent_names_size = ARRAYSIZE(bcmevent_names);
const char *bcmevent_get_name(uint event_type)
{
const char *event_name = NULL;
uint idx;
for (idx = 0; idx < bcmevent_names_size; idx++) {
if (bcmevent_names[idx].event == event_type) {
event_name = bcmevent_names[idx].name;
break;
}
}
/* if we find an event name in the array, return it.
* otherwise return unknown string.
*/
return ((event_name) ? event_name : "Unknown Event");
}
/*
* BCMSDH interface glue
* implement bcmsdh API for SDIOH driver
*
* Copyright (C) 1999-2013, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
* you also meet, for each linked independent module, the terms and conditions of
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
* $Id: bcmsdh.c 373331 2012-12-07 04:46:22Z $
*/
/**
* @file bcmsdh.c
*/
/* ****************** BCMSDH Interface Functions *************************** */
#include <typedefs.h>
#include <bcmdevs.h>
#include <bcmendian.h>
#include <bcmutils.h>
#include <hndsoc.h>
#include <siutils.h>
#include <osl.h>
#include <bcmsdh.h> /* BRCM API for SDIO clients (such as wl, dhd) */
#include <bcmsdbus.h> /* common SDIO/controller interface */
#include <sbsdio.h> /* SDIO device core hardware definitions. */
#include <sdio.h> /* SDIO Device and Protocol Specs */
#define SDIOH_API_ACCESS_RETRY_LIMIT 2
const uint bcmsdh_msglevel = BCMSDH_ERROR_VAL;
/* local copy of bcm sd handler */
bcmsdh_info_t * l_bcmsdh = NULL;
#if defined(OOB_INTR_ONLY) && defined(HW_OOB)
extern int
sdioh_enable_hw_oob_intr(void *sdioh, bool enable);
void
bcmsdh_enable_hw_oob_intr(bcmsdh_info_t *sdh, bool enable)
{
sdioh_enable_hw_oob_intr(sdh->sdioh, enable);
}
#endif
/* Attach BCMSDH layer to SDIO Host Controller Driver
*
* @param osh OSL Handle.
* @param cfghdl Configuration Handle.
* @param regsva Virtual address of controller registers.
* @param irq Interrupt number of SDIO controller.
*
* @return bcmsdh_info_t Handle to BCMSDH context.
*/
bcmsdh_info_t *
bcmsdh_attach(osl_t *osh, void *cfghdl, void **regsva, uint irq)
{
bcmsdh_info_t *bcmsdh;
if ((bcmsdh = (bcmsdh_info_t *)MALLOC(osh, sizeof(bcmsdh_info_t))) == NULL) {
BCMSDH_ERROR(("bcmsdh_attach: out of memory, malloced %d bytes\n", MALLOCED(osh)));
return NULL;
}
bzero((char *)bcmsdh, sizeof(bcmsdh_info_t));
/* save the handler locally */
l_bcmsdh = bcmsdh;
if (!(bcmsdh->sdioh = sdioh_attach(osh, cfghdl, irq))) {
bcmsdh_detach(osh, bcmsdh);
return NULL;
}
bcmsdh->osh = osh;
bcmsdh->init_success = TRUE;
*regsva = (uint32 *)SI_ENUM_BASE;
/* Report the BAR, to fix if needed */
bcmsdh->sbwad = SI_ENUM_BASE;
return bcmsdh;
}
int
bcmsdh_detach(osl_t *osh, void *sdh)
{
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
if (bcmsdh != NULL) {
if (bcmsdh->sdioh) {
sdioh_detach(osh, bcmsdh->sdioh);
bcmsdh->sdioh = NULL;
}
MFREE(osh, bcmsdh, sizeof(bcmsdh_info_t));
}
l_bcmsdh = NULL;
return 0;
}
int
bcmsdh_iovar_op(void *sdh, const char *name,
void *params, int plen, void *arg, int len, bool set)
{
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
return sdioh_iovar_op(bcmsdh->sdioh, name, params, plen, arg, len, set);
}
bool
bcmsdh_intr_query(void *sdh)
{
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
SDIOH_API_RC status;
bool on;
ASSERT(bcmsdh);
status = sdioh_interrupt_query(bcmsdh->sdioh, &on);
if (SDIOH_API_SUCCESS(status))
return FALSE;
else
return on;
}
int
bcmsdh_intr_enable(void *sdh)
{
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
SDIOH_API_RC status;
ASSERT(bcmsdh);
status = sdioh_interrupt_set(bcmsdh->sdioh, TRUE);
return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
}
int
bcmsdh_intr_disable(void *sdh)
{
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
SDIOH_API_RC status;
ASSERT(bcmsdh);
status = sdioh_interrupt_set(bcmsdh->sdioh, FALSE);
return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
}
int
bcmsdh_intr_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh)
{
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
SDIOH_API_RC status;
ASSERT(bcmsdh);
status = sdioh_interrupt_register(bcmsdh->sdioh, fn, argh);
return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
}
int
bcmsdh_intr_dereg(void *sdh)
{
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
SDIOH_API_RC status;
ASSERT(bcmsdh);
status = sdioh_interrupt_deregister(bcmsdh->sdioh);
return (SDIOH_API_SUCCESS(status) ? 0 : BCME_ERROR);
}
#if defined(DHD_DEBUG)
bool
bcmsdh_intr_pending(void *sdh)
{
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
ASSERT(sdh);
return sdioh_interrupt_pending(bcmsdh->sdioh);
}
#endif
int
bcmsdh_devremove_reg(void *sdh, bcmsdh_cb_fn_t fn, void *argh)
{
ASSERT(sdh);
/* don't support yet */
return BCME_UNSUPPORTED;
}