diff options
Diffstat (limited to 'drivers/net/wireless/bcmdhd/src/dhd')
7 files changed, 228 insertions, 184 deletions
diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd.h b/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd.h index 3b7f026..5095aba 100644 --- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd.h +++ b/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd.h @@ -83,7 +83,11 @@ enum dhd_bus_state { #define CONCURRENT_MASK (STA_MASK | WFD_MASK) /* max sequential rxcntl timeouts to set HANG event */ +#ifdef BCM4334_CHIP +#define MAX_CNTL_TIMEOUT 1 +#else #define MAX_CNTL_TIMEOUT 2 +#endif #define DHD_SCAN_ACTIVE_TIME 40 /* ms : Embedded default Active setting from DHD Driver */ #define DHD_SCAN_PASSIVE_TIME 130 /* ms: Embedded default Passive setting from DHD Driver */ @@ -258,9 +262,6 @@ typedef struct dhd_pub { int hang_was_sent; int rxcnt_timeout; /* counter rxcnt timeout to send HANG */ int txcnt_timeout; /* counter txcnt timeout to send HANG */ -#ifdef BCM4334_CHIP - int tx_seq_badcnt; -#endif #ifdef WLMEDIA_HTSF uint8 htsfdlystat_sz; /* Size of delay stats, max 255B */ #endif @@ -638,7 +639,11 @@ extern uint dhd_radio_up; /* Initial idletime ticks (may be -1 for immediate idle, 0 for no idle) */ extern int dhd_idletime; +#ifdef DHD_USE_IDLECOUNT +#define DHD_IDLETIME_TICKS 5 +#else #define DHD_IDLETIME_TICKS 1 +#endif /* DHD_USE_IDLECOUNT */ /* SDIO Drive Strength */ extern uint dhd_sdiod_drive_strength; diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_cfg80211.c b/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_cfg80211.c index 73760ef..c0ef0bd 100644 --- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_cfg80211.c +++ b/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_cfg80211.c @@ -507,10 +507,6 @@ int wl_cfg80211_set_btcoex_dhcp(struct net_device *dev, char *command) int i; #endif -#ifdef PASS_ALL_MCAST_PKTS - char iovbuf[20]; - uint32 allmultivar = 0; -#endif /* Figure out powermode 1 or o command */ strncpy((char *)&powermode_val, command + strlen("BTCOEXMODE") +1, 1); @@ -530,13 +526,6 @@ int wl_cfg80211_set_btcoex_dhcp(struct net_device *dev, char *command) dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i], 0, dhd_master_mode); } - -#ifdef PASS_ALL_MCAST_PKTS - allmultivar = 1; - bcm_mkiovar("allmulti", (char *)&allmultivar, 4, iovbuf, sizeof(iovbuf)); - dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0); - WL_ERR(("DHCP is progressing , allmulti value = %d \n", allmultivar)); -#endif /* PASS_ALL_MCAST_PKTS */ } #endif @@ -594,13 +583,6 @@ int wl_cfg80211_set_btcoex_dhcp(struct net_device *dev, char *command) dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i], 1, dhd_master_mode); } - -#ifdef PASS_ALL_MCAST_PKTS - allmultivar = 0; - bcm_mkiovar("allmulti", (char *)&allmultivar, 4, iovbuf, sizeof(iovbuf)); - dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0); - WL_ERR(("DHCP is complete , allmulti value = %d \n", allmultivar)); -#endif /* PASS_ALL_MCAST_PKTS */ } #endif diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_common.c b/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_common.c index 956c4e1..f9f8c20 100644 --- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_common.c +++ b/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_common.c @@ -267,36 +267,13 @@ int dhd_wl_ioctl_cmd(dhd_pub_t *dhd_pub, int cmd, void *arg, int len, uint8 set, int ifindex) { wl_ioctl_t ioc; -#ifdef CUSTOMER_HW_SAMSUNG - int ret; -#endif /* CUSTOMER_HW_SAMSUNG */ ioc.cmd = cmd; ioc.buf = arg; ioc.len = len; ioc.set = set; -#ifdef CUSTOMER_HW_SAMSUNG - ret = dhd_wl_ioctl(dhd_pub, ifindex, &ioc, arg, len); - if (ret < 0) { - if (ioc.cmd == WLC_GET_VAR) { - DHD_ERROR(("%s: WLC_GET_VAR: %s, error = %d\n", - __FUNCTION__, (char *)ioc.buf, ret)); - } else if (ioc.cmd == WLC_SET_VAR) { - char pkt_filter[] = "pkt_filter_add"; - if (strncmp(pkt_filter, ioc.buf, sizeof(pkt_filter)) != 0) { - DHD_ERROR(("%s: WLC_SET_VAR: %s, error = %d\n", - __FUNCTION__, (char *)ioc.buf, ret)); - } - } else { - DHD_ERROR(("%s: WLC_IOCTL: cmd:%d, error = %d\n", - __FUNCTION__, ioc.cmd, ret)); - } - } - return ret; -#else return dhd_wl_ioctl(dhd_pub, ifindex, &ioc, arg, len); -#endif /* CUSTOMER_HW_SAMSUNG */ } @@ -308,14 +285,26 @@ dhd_wl_ioctl(dhd_pub_t *dhd_pub, int ifindex, wl_ioctl_t *ioc, void *buf, int le dhd_os_proto_block(dhd_pub); ret = dhd_prot_ioctl(dhd_pub, ifindex, ioc, buf, len); -#ifdef BCM4334_CHIP - if (!ret || ret == -ETIMEDOUT || (dhd_pub->tx_seq_badcnt >= 2)) -#else - if (!ret || ret == -ETIMEDOUT) -#endif + if (!ret || ret == -ETIMEDOUT) { + /* Send hang event only if dhd_open() was success */ + if (dhd_pub->up) dhd_os_check_hang(dhd_pub, ifindex, ret); + } dhd_os_proto_unblock(dhd_pub); +#ifdef CUSTOMER_HW_SAMSUNG + if (ret < 0) { + if (ioc->cmd == WLC_GET_VAR) + DHD_ERROR(("%s: WLC_GET_VAR: %s, error = %d\n", + __FUNCTION__, (char *)ioc->buf, ret)); + else if (ioc->cmd == WLC_SET_VAR) + DHD_ERROR(("%s: WLC_SET_VAR: %s, error = %d\n", + __FUNCTION__, (char *)ioc->buf, ret)); + else + DHD_ERROR(("%s: WLC_IOCTL: cmd: %d, error = %d\n", + __FUNCTION__, ioc->cmd, ret)); + } +#endif /* CUSTOMER_HW_SAMSUNG */ return ret; } @@ -586,10 +575,8 @@ dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, void *pkt, int prec) if (pktq_pfull(q, prec)) eprec = prec; else if (pktq_full(q)) { -#if defined(BCMASSERT_LOG) p = pktq_peek_tail(q, &eprec); - ASSERT(p); -#endif +// ASSERT(p); if (eprec > prec || eprec < 0) return FALSE; } @@ -608,11 +595,9 @@ dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, void *pkt, int prec) PKTFREE(dhdp->osh, p, TRUE); } -#if defined(BCMASSERT_LOG) /* Enqueue */ p = pktq_penq(q, prec, pkt); - ASSERT(p); -#endif +// ASSERT(p); return TRUE; } diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_custom_sec.c b/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_custom_sec.c index 2e80890..4ef1dcb 100644 --- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_custom_sec.c +++ b/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_custom_sec.c @@ -1,3 +1,19 @@ +/* Function list + 1. Module Type + a. For CID - Use 'USE_CID_CHECK' Feature + dhd_write_cid_file(), dhd_dump_cis(), dhd_check_module_cid() + b. For MAC - Use 'GET_MAC_FROM_OTP' Feature + dhd_write_mac_file(), dhd_check_module_mac() + 2. COB Type + a. For MAC - Use 'READ_MACADDR' Feature + dhd_read_macaddr() + 3. Etc + a. Power Save Mode - Use 'CONFIG_CONTROL_PM' Feature + sec_control_pm() + b. U1 Module only - Use 'WRITE_MACADDR' Feature + dhd_write_macaddr +*/ + #include <typedefs.h> #include <linuxver.h> #include <osl.h> @@ -21,6 +37,9 @@ extern int _dhd_set_mac_address(struct dhd_info *dhd, #define MACINFO "/opt/etc/.mac.info" #define REVINFO "/data/.rev" #else +#define MACINFO "/data/.mac.info" +#define MACINFO_EFS "/efs/wifi/.mac.info" +#define NVMACINFO "/data/.nvmac.info" #define REVINFO "/data/.rev" #define CIDINFO "/data/.cid.info" #define PSMINFO "/data/.psm.info" @@ -34,21 +53,21 @@ int dhd_read_macaddr(struct dhd_info *dhd, struct ether_addr *mac) mm_segment_t oldfs = {0}; char randommac[3] = {0}; char buf[18] = {0}; - char *filepath = "/efs/wifi/.mac.info"; + char *filepath_efs = MACINFO_EFS; #ifdef CONFIG_TARGET_LOCALE_VZW char *nvfilepath = "/data/misc/wifi/.nvmac.info"; #else - char *nvfilepath = "/data/.nvmac.info"; + char *nvfilepath = NVMACINFO; #endif int ret = 0; - fp = filp_open(filepath, O_RDONLY, 0); + fp = filp_open(filepath_efs, O_RDONLY, 0); if (IS_ERR(fp)) { start_readmac: /* File Doesn't Exist. Create and write mac addr.*/ - fp = filp_open(filepath, O_RDWR | O_CREAT, 0666); + fp = filp_open(filepath_efs, O_RDWR | O_CREAT, 0666); if (IS_ERR(fp)) { - DHD_ERROR(("[WIFI] %s: File open error\n", filepath)); + DHD_ERROR(("[WIFI] %s: File open error\n", filepath_efs)); return -1; } oldfs = get_fs(); @@ -64,9 +83,9 @@ start_readmac: if (fp->f_mode & FMODE_WRITE) { ret = fp->f_op->write(fp, (const char *)macbuffer, sizeof(macbuffer), &fp->f_pos); if (ret < 0) - DHD_ERROR(("[WIFI]MAC address [%s] Failed to write into File: %s\n", macbuffer, filepath)); + DHD_ERROR(("[WIFI]MAC address [%s] Failed to write into File: %s\n", macbuffer, filepath_efs)); else - DHD_ERROR(("[WIFI]MAC address [%s] written into File: %s\n", macbuffer, filepath)); + DHD_ERROR(("[WIFI]MAC address [%s] written into File: %s\n", macbuffer, filepath_efs)); } set_fs(oldfs); /* Reading the MAC Address from .mac.info file( the existed file or just created file)*/ @@ -90,7 +109,7 @@ start_readmac: (unsigned int *)&(mac->octet[2]), (unsigned int *)&(mac->octet[3]), (unsigned int *)&(mac->octet[4]), (unsigned int *)&(mac->octet[5])); else - DHD_ERROR(("dhd_bus_start: Reading from the '%s' returns 0 bytes\n", filepath)); + DHD_ERROR(("dhd_bus_start: Reading from the '%s' returns 0 bytes\n", filepath_efs)); if (fp) filp_close(fp, NULL); @@ -119,8 +138,8 @@ enum { int dhd_write_rdwr_macaddr(struct ether_addr *mac) { - char *filepath_old = "/data/.mac.info"; - char *filepath = "/efs/wifi/.mac.info"; + char *filepath_data = MACINFO; + char *filepath_efs = MACINFO_EFS; struct file *fp_mac = NULL; char buf[18] = {0}; mm_segment_t oldfs = {0}; @@ -134,9 +153,9 @@ int dhd_write_rdwr_macaddr(struct ether_addr *mac) mac->octet[3], mac->octet[4], mac->octet[5]); /* /data/.mac.info will be created */ - fp_mac = filp_open(filepath_old, O_RDWR | O_CREAT, 0666); + fp_mac = filp_open(filepath_data, O_RDWR | O_CREAT, 0666); if (IS_ERR(fp_mac)) { - DHD_ERROR(("[WIFI] %s: File open error\n", filepath_old)); + DHD_ERROR(("[WIFI] %s: File open error\n", filepath_data)); return -1; } else { oldfs = get_fs(); @@ -147,18 +166,18 @@ int dhd_write_rdwr_macaddr(struct ether_addr *mac) sizeof(buf), &fp_mac->f_pos); if (ret < 0) DHD_ERROR(("[WIFI] Mac address [%s] Failed" - " to write into File: %s\n", buf, filepath_old)); + " to write into File: %s\n", buf, filepath_data)); else DHD_INFO(("[WIFI] Mac address [%s] written" - " into File: %s\n", buf, filepath_old)); + " into File: %s\n", buf, filepath_data)); } set_fs(oldfs); filp_close(fp_mac, NULL); } /* /efs/wifi/.mac.info will be created */ - fp_mac = filp_open(filepath, O_RDWR | O_CREAT, 0666); + fp_mac = filp_open(filepath_efs, O_RDWR | O_CREAT, 0666); if (IS_ERR(fp_mac)) { - DHD_ERROR(("[WIFI] %s: File open error\n", filepath)); + DHD_ERROR(("[WIFI] %s: File open error\n", filepath_efs)); return -1; } else { oldfs = get_fs(); @@ -169,10 +188,10 @@ int dhd_write_rdwr_macaddr(struct ether_addr *mac) sizeof(buf), &fp_mac->f_pos); if (ret < 0) DHD_ERROR(("[WIFI] Mac address [%s] Failed" - " to write into File: %s\n", buf, filepath)); + " to write into File: %s\n", buf, filepath_efs)); else DHD_INFO(("[WIFI] Mac address [%s] written" - " into File: %s\n", buf, filepath)); + " into File: %s\n", buf, filepath_efs)); } set_fs(oldfs); filp_close(fp_mac, NULL); @@ -190,12 +209,12 @@ int dhd_check_rdwr_macaddr(struct dhd_info *dhd, dhd_pub_t *dhdp, char macbuffer[18] = {0}; char randommac[3] = {0}; char buf[18] = {0}; - char *filepath_old = "/data/.mac.info"; - char *filepath = "/efs/wifi/.mac.info"; + char *filepath_data = MACINFO; + char *filepath_efs = MACINFO_EFS; #ifdef CONFIG_TARGET_LOCALE_NA char *nvfilepath = "/data/misc/wifi/.nvmac.info"; #else - char *nvfilepath = "/data/.nvmac.info"; + char *nvfilepath = NVMACINFO; #endif char cur_mac[128] = {0}; char dummy_mac[ETHER_ADDR_LEN] = {0x00, 0x90, 0x4C, 0xC5, 0x12, 0x38}; @@ -231,7 +250,7 @@ int dhd_check_rdwr_macaddr(struct dhd_info *dhd, dhd_pub_t *dhdp, cur_mac[0], cur_mac[1], cur_mac[2], cur_mac[3], cur_mac[4], cur_mac[5]); - fp_mac = filp_open(filepath_old, O_RDONLY, 0); + fp_mac = filp_open(filepath_data, O_RDONLY, 0); if (IS_ERR(fp_mac)) { /* file does not exist */ /* read mac is the dummy mac (00:90:4C:C5:12:38) */ if (memcmp(cur_mac, dummy_mac, ETHER_ADDR_LEN) == 0) @@ -280,7 +299,7 @@ int dhd_check_rdwr_macaddr(struct dhd_info *dhd, dhd_pub_t *dhdp, } } } - fp_mac = filp_open(filepath, O_RDONLY, 0); + fp_mac = filp_open(filepath_efs, O_RDONLY, 0); if (IS_ERR(fp_mac)) { /* file does not exist */ /* read mac is the dummy mac (00:90:4C:C5:12:38) */ if (memcmp(cur_mac, dummy_mac, ETHER_ADDR_LEN) == 0) @@ -402,18 +421,18 @@ int dhd_write_rdwr_korics_macaddr(struct dhd_info *dhd, struct ether_addr *mac) mm_segment_t oldfs = {0}; char randommac[3] = {0}; char buf[18] = {0}; - char *filepath = "/efs/wifi/.mac.info"; + char *filepath_efs = MACINFO_EFS; int is_zeromac = 0; int ret = 0; /* MAC address copied from efs/wifi.mac.info */ - fp = filp_open(filepath, O_RDONLY, 0); + fp = filp_open(filepath_efs, O_RDONLY, 0); if (IS_ERR(fp)) { /* File Doesn't Exist. Create and write mac addr.*/ - fp = filp_open(filepath, O_RDWR | O_CREAT, 0666); + fp = filp_open(filepath_efs, O_RDWR | O_CREAT, 0666); if (IS_ERR(fp)) { DHD_ERROR(("[WIFI] %s: File open error\n", - filepath)); + filepath_efs)); return -1; } @@ -438,11 +457,11 @@ int dhd_write_rdwr_korics_macaddr(struct dhd_info *dhd, struct ether_addr *mac) if (ret < 0) DHD_ERROR(("[WIFI] Mac address [%s]" " Failed to write into File:" - " %s\n", macbuffer, filepath)); + " %s\n", macbuffer, filepath_efs)); else DHD_ERROR(("[WIFI] Mac address [%s]" " written into File: %s\n", - macbuffer, filepath)); + macbuffer, filepath_efs)); } set_fs(oldfs); } else { @@ -473,7 +492,7 @@ int dhd_write_rdwr_korics_macaddr(struct dhd_info *dhd, struct ether_addr *mac) (unsigned int *)&(mac->octet[5])); else DHD_INFO(("dhd_bus_start: Reading from the" - " '%s' returns 0 bytes\n", filepath)); + " '%s' returns 0 bytes\n", filepath_efs)); if (fp) filp_close(fp, NULL); @@ -494,16 +513,16 @@ int dhd_write_rdwr_korics_macaddr(struct dhd_info *dhd, struct ether_addr *mac) #endif /* RDWR_KORICS_MACADDR */ #ifdef USE_CID_CHECK -static int dhd_write_cid_file(const char *filepath, const char *buf, int buf_len) +static int dhd_write_cid_file(const char *filepath_efs, const char *buf, int buf_len) { struct file *fp = NULL; mm_segment_t oldfs = {0}; int ret = 0; /* File is always created.*/ - fp = filp_open(filepath, O_RDWR | O_CREAT, 0666); + fp = filp_open(filepath_efs, O_RDWR | O_CREAT, 0666); if (IS_ERR(fp)) { - DHD_ERROR(("[WIFI] %s: File open error\n", filepath)); + DHD_ERROR(("[WIFI] %s: File open error\n", filepath_efs)); return -1; } else { oldfs = get_fs(); @@ -513,10 +532,10 @@ static int dhd_write_cid_file(const char *filepath, const char *buf, int buf_len ret = fp->f_op->write(fp, buf, buf_len, &fp->f_pos); if (ret < 0) DHD_ERROR(("[WIFI] Failed to write CIS[%s]" - " into '%s'\n", buf, filepath)); + " into '%s'\n", buf, filepath_efs)); else DHD_ERROR(("[WIFI] CID [%s] written into" - " '%s'\n", buf, filepath)); + " '%s'\n", buf, filepath_efs)); } set_fs(oldfs); } @@ -664,7 +683,7 @@ static int dhd_write_mac_file(const char *filepath, const char *buf, int buf_len fp = filp_open(filepath, O_RDWR | O_CREAT, 0666); /*File is always created.*/ if (IS_ERR(fp)) { - DHD_ERROR(("[WIFI] %s: File open error\n", filepath)); + DHD_ERROR(("[WIFI] File open error\n")); return -1; } else { oldfs = get_fs(); @@ -673,11 +692,9 @@ static int dhd_write_mac_file(const char *filepath, const char *buf, int buf_len if (fp->f_mode & FMODE_WRITE) { ret = fp->f_op->write(fp, buf, buf_len, &fp->f_pos); if (ret < 0) - DHD_ERROR(("[WIFI] Failed to write CIS[%s]\ -into '%s'\n", buf, filepath)); + DHD_ERROR(("[WIFI] Failed to write CIS. \n")); else - DHD_ERROR(("[WIFI] MAC [%s] written\ -into '%s'\n", buf, filepath)); + DHD_ERROR(("[WIFI] MAC written. \n")); } set_fs(oldfs); } @@ -693,19 +710,13 @@ int dhd_check_module_mac(dhd_pub_t *dhd) int ret = -1; unsigned char cis_buf[250] = {0}; unsigned char mac_buf[20] = {0}; - const char *macfilepath = "/efs/wifi/.mac.info"; + unsigned char otp_mac_buf[20] = {0}; + const char *macfilepath = MACINFO_EFS; /* Try reading out from CIS */ cis_rw_t *cish = (cis_rw_t *)&cis_buf[8]; struct file *fp_mac = NULL; - fp_mac = filp_open(macfilepath, O_RDONLY, 0); - if (!IS_ERR(fp_mac)) { - kernel_read(fp_mac, fp_mac->f_pos, mac_buf, sizeof(mac_buf)); - DHD_ERROR(("[WIFI].mac.info file already exist : [%s]\n", - mac_buf)); - return 0; - } cish->source = 0; cish->byteoff = 0; cish->nbytes = sizeof(cis_buf); @@ -716,6 +727,7 @@ int dhd_check_module_mac(dhd_pub_t *dhd) if (ret < 0) { DHD_ERROR(("%s: CIS reading failed, err=%d\n", __func__, ret)); + return ret; } else { unsigned char mac_id[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; #ifdef DUMP_CIS @@ -728,11 +740,21 @@ int dhd_check_module_mac(dhd_pub_t *dhd) mac_id[4] = cis_buf[CIS_MAC_OFFSET + 4]; mac_id[5] = cis_buf[CIS_MAC_OFFSET + 5]; - sprintf(mac_buf, "%02X:%02X:%02X:%02X:%02X:%02X\n", + sprintf(otp_mac_buf, "%02X:%02X:%02X:%02X:%02X:%02X\n", mac_id[0], mac_id[1], mac_id[2], mac_id[3], mac_id[4], mac_id[5]); - DHD_ERROR(("[WIFI]mac_id is setted from OTP: [%s]\n", mac_buf)); - dhd_write_mac_file(macfilepath, mac_buf, sizeof(mac_buf)); + DHD_ERROR(("[WIFI]mac_id is setted from OTP \n")); + } + + fp_mac = filp_open(macfilepath, O_RDONLY, 0); + if (!IS_ERR(fp_mac)) { + DHD_ERROR(("[WIFI]Check Mac address in .mac.info \n")); + kernel_read(fp_mac, fp_mac->f_pos, mac_buf, sizeof(mac_buf)); + + if (strncmp(mac_buf , otp_mac_buf , 17) != 0) { + DHD_ERROR(("[WIFI]file MAC is wrong. Write OTP MAC in .mac.info \n")); + dhd_write_mac_file(macfilepath, otp_mac_buf, sizeof(otp_mac_buf)); + } } return ret; @@ -742,8 +764,8 @@ int dhd_check_module_mac(dhd_pub_t *dhd) #ifdef WRITE_MACADDR int dhd_write_macaddr(struct ether_addr *mac) { - char *filepath_old = "/data/.mac.info"; - char *filepath = "/efs/wifi/.mac.info"; + char *filepath_data = MACINFO; + char *filepath_efs = MACINFO_EFS; struct file *fp_mac = NULL; char buf[18] = {0}; @@ -758,10 +780,10 @@ startwrite: mac->octet[3], mac->octet[4], mac->octet[5]); /* File will be created /data/.mac.info. */ - fp_mac = filp_open(filepath_old, O_RDWR | O_CREAT, 0666); + fp_mac = filp_open(filepath_data, O_RDWR | O_CREAT, 0666); if (IS_ERR(fp_mac)) { - DHD_ERROR(("[WIFI] %s: File open error\n", filepath_old)); + DHD_ERROR(("[WIFI] %s: File open error\n", filepath_data)); return -1; } else { oldfs = get_fs(); @@ -772,16 +794,16 @@ startwrite: sizeof(buf), &fp_mac->f_pos); if (ret < 0) DHD_ERROR(("[WIFI] Mac address [%s] Failed to" - " write into File: %s\n", buf, filepath_old)); + " write into File: %s\n", buf, filepath_data)); else DHD_INFO(("[WIFI] Mac address [%s] written" - " into File: %s\n", buf, filepath_old)); + " into File: %s\n", buf, filepath_data)); } set_fs(oldfs); filp_close(fp_mac, NULL); } /* check .mac.info file is 0 byte */ - fp_mac = filp_open(filepath_old, O_RDONLY, 0); + fp_mac = filp_open(filepath_data, O_RDONLY, 0); ret = kernel_read(fp_mac, 0, buf, 18); if ((ret == 0) && (retry_count++ < 3)) { @@ -793,10 +815,10 @@ startwrite: /* end of /data/.mac.info */ /* File will be created /efs/wifi/.mac.info. */ - fp_mac = filp_open(filepath, O_RDWR | O_CREAT, 0666); + fp_mac = filp_open(filepath_efs, O_RDWR | O_CREAT, 0666); if (IS_ERR(fp_mac)) { - DHD_ERROR(("[WIFI] %s: File open error\n", filepath)); + DHD_ERROR(("[WIFI] %s: File open error\n", filepath_efs)); return -1; } else { oldfs = get_fs(); @@ -807,17 +829,17 @@ startwrite: sizeof(buf), &fp_mac->f_pos); if (ret < 0) DHD_ERROR(("[WIFI] Mac address [%s] Failed to" - " write into File: %s\n", buf, filepath)); + " write into File: %s\n", buf, filepath_efs)); else DHD_INFO(("[WIFI] Mac address [%s] written" - " into File: %s\n", buf, filepath)); + " into File: %s\n", buf, filepath_efs)); } set_fs(oldfs); filp_close(fp_mac, NULL); } /* check .mac.info file is 0 byte */ - fp_mac = filp_open(filepath, O_RDONLY, 0); + fp_mac = filp_open(filepath_efs, O_RDONLY, 0); ret = kernel_read(fp_mac, 0, buf, 18); if ((ret == 0) && (retry_count++ < 3)) { diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_linux.c b/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_linux.c index d01b9fc..ca43dda 100644 --- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_linux.c +++ b/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_linux.c @@ -244,6 +244,10 @@ static uint32 maxdelay = 0, tspktcnt = 0, maxdelaypktno = 0; #endif /* WLMEDIA_HTSF */ +#if defined(CONFIG_PM_SLEEP) && defined(CUSTOMER_HW_SLP) +/*SLP_wakelock_alternative_code*/ +extern struct device *pm_dev; +#endif /* CONFIG_PM_SLEEP && CUSTOMER_HW_SLP */ #if defined(PKT_FILTER_SUPPORT) #if defined(CUSTOMER_HW_SAMSUNG) #define HEX_PREF_STR "0x" @@ -617,13 +621,17 @@ static int dhd_set_suspend(int value, dhd_pub_t *dhd) #ifdef BCM4334_CHIP int bcn_li_bcn; #endif +#ifdef PASS_ALL_MCAST_PKTS + uint32 allmulti; +#endif /* PASS_ALL_MCAST_PKTS */ DHD_ERROR(("%s: enter, value = %d in_suspend=%d\n", __FUNCTION__, value, dhd->in_suspend)); if (dhd && dhd->up) { if (value && dhd->in_suspend) { - + if (wl_cfgp2p_p2p_listen_suspend()) + DHD_ERROR(("failed to set WLC_E_P2P_PROBREQ_MSG\n")); #ifdef PKT_FILTER_SUPPORT dhd->early_suspended = 1; #endif @@ -637,7 +645,17 @@ static int dhd_set_suspend(int value, dhd_pub_t *dhd) #endif /* Enable packet filter, only allow unicast packet to send up */ - dhd_set_packet_filter(1, dhd); + if (dhd_pkt_filter_enable && !dhd->dhcp_in_progress) { + int i; + for (i = 0; i < dhd->pktfilter_count; i++) + dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i], + 1, dhd_master_mode); + } +#ifdef PASS_ALL_MCAST_PKTS + allmulti = 0; + bcm_mkiovar("allmulti", (char *)&allmulti, 4, iovbuf, sizeof(iovbuf)); + dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0); +#endif /* PASS_ALL_MCAST_PKTS */ #ifndef CUSTOMER_HW_SAMSUNG /* If DTIM skip is set up as default, force it to wake @@ -676,7 +694,17 @@ static int dhd_set_suspend(int value, dhd_pub_t *dhd) #endif /* disable pkt filter */ - dhd_set_packet_filter(0, dhd); + if (dhd_pkt_filter_enable && !dhd->dhcp_in_progress) { + int i; + for (i = 0; i < dhd->pktfilter_count; i++) + dhd_pktfilter_offload_enable(dhd, dhd->pktfilter[i], + 0, dhd_master_mode); + } +#ifdef PASS_ALL_MCAST_PKTS + allmulti = 1; + bcm_mkiovar("allmulti", (char *)&allmulti, 4, iovbuf, sizeof(iovbuf)); + dhd_wl_ioctl_cmd(dhd, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0); +#endif /* PASS_ALL_MCAST_PKTS */ #ifndef CUSTOMER_HW_SAMSUNG /* restore pre-suspend setting for dtim_skip */ @@ -1319,7 +1347,10 @@ _dhd_sysioc_thread(void *data) } if (dhd->set_macaddress == i+1) { dhd->set_macaddress = 0; - _dhd_set_mac_address(dhd, i, &dhd->macvalue); + if (0 == _dhd_set_mac_address(dhd, i, &dhd->macvalue)) + DHD_INFO(("dhd_sysioc_thread: MACID is overwritten\n")); + else + DHD_ERROR(("dhd_sysioc_thread: _dhd_set_mac_address() failed\n")); } } } @@ -2334,16 +2365,6 @@ static bool dhd_check_hang(struct net_device *net, dhd_pub_t *dhdp, int error) { if (!dhdp) return FALSE; -#ifdef BCM4334_CHIP - if ((error == -ETIMEDOUT) || (error == -EREMOTEIO) || (dhdp->tx_seq_badcnt >= 2) - || ((dhdp->busstate == DHD_BUS_DOWN)&&(!dhdp->dongle_reset))) { - DHD_ERROR(("%s: Event HANG send up due to re=%d te=%d e=%d s=%d tse=%d\n", - __FUNCTION__, dhdp->rxcnt_timeout, dhdp->txcnt_timeout, error, - dhdp->busstate, dhdp->tx_seq_badcnt)); - net_os_send_hang_message(net); - return TRUE; - } -#else if ((error == -ETIMEDOUT) || (error == -EREMOTEIO) || ((dhdp->busstate == DHD_BUS_DOWN)&&(!dhdp->dongle_reset))) { DHD_ERROR(("%s: Event HANG send up due to re=%d te=%d e=%d s=%d\n", __FUNCTION__, @@ -2351,7 +2372,6 @@ static bool dhd_check_hang(struct net_device *net, dhd_pub_t *dhdp, int error) net_os_send_hang_message(net); return TRUE; } -#endif return FALSE; } @@ -2680,9 +2700,6 @@ dhd_stop(struct net_device *net) dhd->pub.hang_was_sent = 0; dhd->pub.rxcnt_timeout = 0; dhd->pub.txcnt_timeout = 0; -#ifdef BCM4334_CHIP - dhd->pub.tx_seq_badcnt = 0; -#endif OLD_MOD_DEC_USE_COUNT; exit: DHD_OS_WAKE_UNLOCK(&dhd->pub); @@ -3457,6 +3474,9 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) #ifdef AUTOCOUNTRY int autocountry = 1; #endif +#ifdef VSDB + int interference_mode = 3; +#endif #ifdef PROP_TXSTATUS dhd->wlfc_enabled = FALSE; /* enable WLFC only if the firmware is VSDB */ @@ -3736,7 +3756,6 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) setbit(eventmask, WLC_E_ACTION_FRAME_RX); setbit(eventmask, WLC_E_ACTION_FRAME_COMPLETE); setbit(eventmask, WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE); - setbit(eventmask, WLC_E_P2P_PROBREQ_MSG); setbit(eventmask, WLC_E_P2P_DISC_LISTEN_COMPLETE); } #endif /* WL_CFG80211 */ @@ -3812,6 +3831,12 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) } } #endif /* defined(SOFTAP) */ + if (dhd->pktfilter_count) { + int i; + + for (i = 0; i < dhd->pktfilter_count; i++) + dhd_pktfilter_offload_set(dhd, dhd->pktfilter[i]); + } #endif /* PKT_FILTER_SUPPORT */ #ifdef VLAN_MODE_OFF @@ -3828,6 +3853,9 @@ dhd_preinit_ioctls(dhd_pub_t *dhd) DHD_ERROR(("%s Setting WL UP failed %d\n", __FUNCTION__, ret)); goto done; } +#ifdef VSDB + dhd_wl_ioctl_cmd(dhd, WLC_SET_INTERFERENCE_MODE, (int *)&interference_mode, sizeof(int), TRUE, 0); +#endif #ifdef BCM4334_CHIP bcm_mkiovar("bcn_li_bcn", (char *)&bcn_li_bcn, 4, iovbuf, sizeof(iovbuf)); @@ -4598,6 +4626,9 @@ dhd_os_wd_timer(void *bus, uint wdtick) DHD_TRACE(("%s: Enter\n", __FUNCTION__)); + if (!dhd) + return; + flags = dhd_os_spin_lock(pub); /* don't start the wd until fw is loaded */ @@ -4936,7 +4967,7 @@ void dhd_wait_for_event(dhd_pub_t *dhd, bool *lockvar) #if 1 && (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)) struct dhd_info *dhdinfo = dhd->info; dhd_os_sdunlock(dhd); - wait_event_interruptible_timeout(dhdinfo->ctrl_wait, (*lockvar == FALSE), HZ * 2); + wait_event_interruptible_timeout(dhdinfo->ctrl_wait, (*lockvar == FALSE), HZ * 5); dhd_os_sdlock(dhd); #endif return; @@ -5034,6 +5065,7 @@ int net_os_rxfilter_add_remove(struct net_device *dev, int add_remove, int num) } } dhd->pub.pktfilter[num] = filterp; + dhd_pktfilter_offload_set(&dhd->pub, dhd->pub.pktfilter[num]); return ret; #else return 0; @@ -5052,8 +5084,12 @@ int net_os_set_packet_filter(struct net_device *dev, int val) */ if (dhd && dhd->pub.up) { if (dhd->pub.in_suspend) { - if (!val || (val && !dhd->pub.suspend_disable_flag)) - dhd_set_packet_filter(val, &dhd->pub); + if (!val || (val && !dhd->pub.suspend_disable_flag)) { + int i; + for (i = 0; i < dhd->pub.pktfilter_count; i++) + dhd_pktfilter_offload_enable(&dhd->pub, dhd->pub.pktfilter[i], + val, dhd_master_mode); + } } } return ret; @@ -5337,6 +5373,9 @@ int dhd_os_wake_lock(dhd_pub_t *pub) #ifdef CONFIG_HAS_WAKELOCK if (!dhd->wakelock_counter) wake_lock(&dhd->wl_wifi); +#elif defined(CONFIG_PM_SLEEP) && defined(CUSTOMER_HW_SLP) + /*SLP_wakelock_alternative_code*/ + pm_stay_awake(pm_dev); #endif dhd->wakelock_counter++; ret = dhd->wakelock_counter; @@ -5369,6 +5408,9 @@ int dhd_os_wake_unlock(dhd_pub_t *pub) #ifdef CONFIG_HAS_WAKELOCK if (!dhd->wakelock_counter) wake_unlock(&dhd->wl_wifi); +#elif defined(CONFIG_PM_SLEEP) && defined(CUSTOMER_HW_SLP) + /*SLP_wakelock_alternative_code*/ + pm_relax(pm_dev); #endif ret = dhd->wakelock_counter; } @@ -5389,6 +5431,19 @@ int dhd_os_check_wakelock(void *dhdp) if (dhd && wake_lock_active(&dhd->wl_wifi)) return 1; +#elif defined(CONFIG_PM_SLEEP) && defined(CUSTOMER_HW_SLP) + /*SLP_wakelock_alternative_code*/ + dhd_pub_t *pub = (dhd_pub_t *)dhdp; + dhd_info_t *dhd; + + if (!pub) + return 0; + dhd = (dhd_info_t *)(pub->info); + + DHD_ERROR(("%s : wakelock_count = %d\n", __func__, dhd->wakelock_counter )); + + if (dhd && (dhd->wakelock_counter > 0)) + return 1; #endif return 0; } diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sdio.c b/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sdio.c index 2c411f8..052eaaf 100644 --- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sdio.c +++ b/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sdio.c @@ -265,9 +265,6 @@ typedef struct dhd_bus { bool activity; /* Activity flag for clock down */ int32 idletime; /* Control for activity timeout */ int32 idlecount; /* Activity timeout counter */ -#ifdef DHD_USE_IDLECOUNT - int32 dhd_idlecount; /* DHD idle count */ -#endif /* DHD_USE_IDLECOUNT */ int32 idleclock; /* How to set bus driver when idle */ int32 sd_divisor; /* Speed control to bus driver */ int32 sd_mode; /* Mode control to bus driver */ @@ -1034,7 +1031,7 @@ dhdsdio_htclk(dhd_bus_t *bus, bool on, bool pendok) bus->activity = TRUE; #ifdef DHD_USE_IDLECOUNT - bus->dhd_idlecount = 0; + bus->idlecount = 0; #endif /* DHD_USE_IDLECOUNT */ } else { clkreq = 0; @@ -1162,7 +1159,7 @@ dhdsdio_clkctl(dhd_bus_t *bus, uint target, bool pendok) dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms); bus->activity = TRUE; #ifdef DHD_USE_IDLECOUNT - bus->dhd_idlecount = 0; + bus->idlecount = 0; #endif /* DHD_USE_IDLECOUNT */ } return ret; @@ -1179,7 +1176,7 @@ dhdsdio_clkctl(dhd_bus_t *bus, uint target, bool pendok) dhd_os_wd_timer(bus->dhd, dhd_watchdog_ms); bus->activity = TRUE; #ifdef DHD_USE_IDLECOUNT - bus->dhd_idlecount = 0; + bus->idlecount = 0; #endif /* DHD_USE_IDLECOUNT */ } break; @@ -1828,8 +1825,13 @@ dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen) /* Send from dpc */ bus->ctrl_frame_buf = frame; bus->ctrl_frame_len = len; - - dhd_wait_for_event(bus->dhd, &bus->ctrl_frame_stat); + if(!bus->dpc_sched) { + bus->dpc_sched = TRUE; + dhd_sched_dpc(bus->dhd); + } + if (bus->ctrl_frame_stat) { + dhd_wait_for_event(bus->dhd, &bus->ctrl_frame_stat); + } if (bus->ctrl_frame_stat == FALSE) { DHD_INFO(("%s: ctrl_frame_stat == FALSE\n", __FUNCTION__)); @@ -4645,22 +4647,11 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) } /* Check window for sanity */ -#ifdef BCM4334_CHIP - if ((uint8)(txmax - bus->tx_seq) > 0x40) { - DHD_ERROR(("%s: got unlikely tx max %d with tx_seq %d\n", - __FUNCTION__, txmax, bus->tx_seq)); - txmax = bus->tx_max; - bus->dhd->tx_seq_badcnt++; - } - else - bus->dhd->tx_seq_badcnt = 0; -#else if ((uint8)(txmax - bus->tx_seq) > 0x40) { DHD_ERROR(("%s: got unlikely tx max %d with tx_seq %d\n", __FUNCTION__, txmax, bus->tx_seq)); txmax = bus->tx_max; } -#endif bus->tx_max = txmax; #ifdef DHD_DEBUG @@ -4813,22 +4804,11 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished) } /* Check window for sanity */ -#ifdef BCM4334_CHIP - if ((uint8)(txmax - bus->tx_seq) > 0x40) { - DHD_ERROR(("%s: got unlikely tx max %d with tx_seq %d\n", - __FUNCTION__, txmax, bus->tx_seq)); - txmax = bus->tx_max; - bus->dhd->tx_seq_badcnt++; - } - else - bus->dhd->tx_seq_badcnt = 0; -#else if ((uint8)(txmax - bus->tx_seq) > 0x40) { DHD_ERROR(("%s: got unlikely tx max %d with tx_seq %d\n", __FUNCTION__, txmax, bus->tx_seq)); txmax = bus->tx_max; } -#endif bus->tx_max = txmax; /* Call a separate function for control frames */ @@ -5296,6 +5276,13 @@ clkwait: if (TXCTLOK(bus) && bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL)) { int ret, i; + uint8* frame_seq = bus->ctrl_frame_buf + SDPCM_FRAMETAG_LEN; + if (*frame_seq != bus->tx_seq) { + DHD_INFO(("%s IOCTL frame seq lag detected!" + " frm_seq:%d != bus->tx_seq:%d, corrected\n", + __FUNCTION__, *frame_seq, bus->tx_seq)); + *frame_seq = bus->tx_seq; + } ret = dhd_bcmsdh_send_buf(bus, bcmsdh_cur_sbwad(sdh), SDIO_FUNC_2, F2SYNC, (uint8 *)bus->ctrl_frame_buf, (uint32)bus->ctrl_frame_len, @@ -5720,9 +5707,6 @@ dhd_disable_intr(dhd_pub_t *dhdp) bcmsdh_intr_disable(bus->sdh); } -#ifdef DHD_USE_IDLECOUNT -#define DHD_IDLE_TIMEOUT_MS (50) -#endif /* DHD_USE_IDLECOUNT */ extern bool dhd_bus_watchdog(dhd_pub_t *dhdp) @@ -5805,31 +5789,27 @@ dhd_bus_watchdog(dhd_pub_t *dhdp) #endif /* On idle timeout clear activity flag and/or turn off clock */ - if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) { #ifdef DHD_USE_IDLECOUNT - if (++bus->idlecount >= bus->idletime) { - bus->idlecount = 0; if (bus->activity) bus->activity = FALSE; else { - bus->dhd_idlecount++; + bus->idlecount++; - if (bus->dhd_idlecount >= (DHD_IDLE_TIMEOUT_MS/dhd_watchdog_ms)) { + if (bus->idlecount >= bus->idletime) { DHD_TIMER(("%s: DHD Idle state!!\n", __FUNCTION__)); if (SLPAUTO_ENAB(bus)) { if (dhdsdio_bussleep(bus, TRUE) != BCME_BUSY) dhd_os_wd_timer(bus->dhd, 0); - } - else + } else dhdsdio_clkctl(bus, CLK_NONE, FALSE); - bus->dhd_idlecount = 0; + bus->idlecount = 0; } } - } #else + if ((bus->idletime > 0) && (bus->clkstate == CLK_AVAIL)) { if (++bus->idlecount >= bus->idletime) { bus->idlecount = 0; if (bus->activity) { @@ -5840,8 +5820,8 @@ dhd_bus_watchdog(dhd_pub_t *dhdp) dhdsdio_clkctl(bus, CLK_NONE, FALSE); } } -#endif /* DHD_USE_IDLECOUNT */ } +#endif /* DHD_USE_IDLECOUNT */ return bus->ipend; } @@ -6147,6 +6127,12 @@ dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot, goto fail; } +#ifdef BCMHOST_XTAL_PU_TIME_MOD +#ifdef BCM4334_CHIP + bcmsdh_reg_write(bus->sdh, 0x18000620, 2, 11); + bcmsdh_reg_write(bus->sdh, 0x18000628, 4, 0x00A60001); +#endif +#endif #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)) mutex_unlock(&_dhd_sdio_mutex_lock_); DHD_ERROR(("%s : the lock is released.\n", __FUNCTION__)); diff --git a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sec_feature.h b/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sec_feature.h index 89fc7ee..2d1d200 100644 --- a/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sec_feature.h +++ b/drivers/net/wireless/bcmdhd/src/dhd/sys/dhd_sec_feature.h @@ -40,7 +40,8 @@ #define HW_OOB #endif -#ifdef CONFIG_MACH_U1 /* Q1 also uses this feature */ +/* Q1 also uses this feature */ +#if defined(CONFIG_MACH_U1) || defined(CONFIG_MACH_TRATS) #ifdef CONFIG_MACH_Q1_BD #define HW_OOB #endif @@ -48,6 +49,11 @@ #define WRITE_MACADDR #endif +#ifdef CONFIG_MACH_GC1 +#undef USE_CID_CHECK +#define READ_MACADDR +#endif + /* REGION CODE */ #if (WLAN_REGION_CODE >= 100) && (WLAN_REGION_CODE < 200) /*EUR*/ @@ -106,3 +112,6 @@ #define BCMWAPI_WAI #endif +#if !defined(READ_MACADDR) && !defined(WRITE_MACADDR) && !defined(RDWR_KORICS_MACADDR) && !defined(RDWR_MACADDR) +#define GET_MAC_FROM_OTP +#endif |