struct sdio_mmc_card *card = NULL;
pr_debug("info: vendor=0x%4.04X device=0x%4.04X class=%d function=%d\n",
- func->vendor, func->device, func->class, func->num);
+ func->vendor, func->device, func->class, func->num);
card = kzalloc(sizeof(struct sdio_mmc_card), GFP_KERNEL);
if (!card) {
{
struct sdio_mmc_card *card;
struct mwifiex_adapter *adapter;
+ struct mwifiex_private *priv;
int i;
pr_debug("info: SDIO func num=%d\n", func->num);
for (i = 0; i < adapter->priv_num; i++)
if ((GET_BSS_ROLE(adapter->priv[i]) ==
MWIFIEX_BSS_ROLE_STA) &&
- adapter->priv[i]->media_connected)
+ adapter->priv[i]->media_connected)
mwifiex_deauthenticate(adapter->priv[i], NULL);
- mwifiex_disable_auto_ds(mwifiex_get_priv(adapter,
- MWIFIEX_BSS_ROLE_ANY));
-
- mwifiex_init_shutdown_fw(mwifiex_get_priv(adapter,
- MWIFIEX_BSS_ROLE_ANY),
- MWIFIEX_FUNC_SHUTDOWN);
+ priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
+ mwifiex_disable_auto_ds(priv);
+ mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN);
}
mwifiex_remove_card(card->adapter, &add_remove_card_sem);
if (func) {
pm_flag = sdio_get_host_pm_caps(func);
pr_debug("cmd: %s: suspend: PM flag = 0x%x\n",
- sdio_func_id(func), pm_flag);
+ sdio_func_id(func), pm_flag);
if (!(pm_flag & MMC_PM_KEEP_POWER)) {
pr_err("%s: cannot remain alive while host is"
" suspended\n", sdio_func_id(func));
{
struct sdio_mmc_card *card = adapter->card;
int ret = -1;
- u8 blk_mode =
- (port & MWIFIEX_SDIO_BYTE_MODE_MASK) ? BYTE_MODE : BLOCK_MODE;
+ u8 blk_mode = (port & MWIFIEX_SDIO_BYTE_MODE_MASK) ? BYTE_MODE
+ : BLOCK_MODE;
u32 blk_size = (blk_mode == BLOCK_MODE) ? MWIFIEX_SDIO_BLOCK_SIZE : 1;
- u32 blk_cnt =
- (blk_mode ==
- BLOCK_MODE) ? (len / MWIFIEX_SDIO_BLOCK_SIZE) : len;
+ u32 blk_cnt = (blk_mode == BLOCK_MODE) ? (len / MWIFIEX_SDIO_BLOCK_SIZE)
+ : len;
u32 ioport = (port & MWIFIEX_SDIO_IO_PORT_MASK);
if (claim)
i++;
dev_err(adapter->dev, "host_to_card, write iomem"
" (%d) failed: %d\n", i, ret);
- if (mwifiex_write_reg(adapter,
- CONFIGURATION_REG, 0x04))
+ if (mwifiex_write_reg(adapter, CONFIGURATION_REG, 0x04))
dev_err(adapter->dev, "write CFG reg failed\n");
ret = -1;
card->mp_rd_bitmap &= (u16) (~CTRL_PORT_MASK);
*port = CTRL_PORT;
dev_dbg(adapter->dev, "data: port=%d mp_rd_bitmap=0x%04x\n",
- *port, card->mp_rd_bitmap);
+ *port, card->mp_rd_bitmap);
} else {
if (card->mp_rd_bitmap & (1 << card->curr_rd_port)) {
- card->mp_rd_bitmap &=
- (u16) (~(1 << card->curr_rd_port));
+ card->mp_rd_bitmap &= (u16)
+ (~(1 << card->curr_rd_port));
*port = card->curr_rd_port;
if (++card->curr_rd_port == MAX_PORT)
dev_dbg(adapter->dev,
"data: port=%d mp_rd_bitmap=0x%04x -> 0x%04x\n",
- *port, rd_bitmap, card->mp_rd_bitmap);
+ *port, rd_bitmap, card->mp_rd_bitmap);
}
return 0;
}
if (*port == CTRL_PORT) {
dev_err(adapter->dev, "invalid data port=%d cur port=%d"
- " mp_wr_bitmap=0x%04x -> 0x%04x\n",
- *port, card->curr_wr_port, wr_bitmap,
- card->mp_wr_bitmap);
+ " mp_wr_bitmap=0x%04x -> 0x%04x\n",
+ *port, card->curr_wr_port, wr_bitmap,
+ card->mp_wr_bitmap);
return -1;
}
dev_dbg(adapter->dev, "data: port=%d mp_wr_bitmap=0x%04x -> 0x%04x\n",
- *port, wr_bitmap, card->mp_wr_bitmap);
+ *port, wr_bitmap, card->mp_wr_bitmap);
return 0;
}
usleep_range(10, 20);
}
- dev_err(adapter->dev, "poll card status failed, tries = %d\n",
- tries);
+ dev_err(adapter->dev, "poll card status failed, tries = %d\n", tries);
+
return -1;
}
if (ret) {
dev_err(adapter->dev, "%s: read iomem failed: %d\n", __func__,
- ret);
+ ret);
return -1;
}
nb = le16_to_cpu(*(__le16 *) (buffer));
if (nb > npayload) {
- dev_err(adapter->dev, "%s: invalid packet, nb=%d, npayload=%d\n",
- __func__, nb, npayload);
+ dev_err(adapter->dev, "%s: invalid packet, nb=%d npayload=%d\n",
+ __func__, nb, npayload);
return -1;
}
u32 i = 0;
if (!firmware_len) {
- dev_err(adapter->dev, "firmware image not found!"
- " Terminating download\n");
+ dev_err(adapter->dev,
+ "firmware image not found! Terminating download\n");
return -1;
}
dev_dbg(adapter->dev, "info: downloading FW image (%d bytes)\n",
- firmware_len);
+ firmware_len);
/* Assume that the allocated buffer is 8-byte aligned */
fwbuf = kzalloc(MWIFIEX_UPLD_SIZE, GFP_KERNEL);
if (!fwbuf) {
- dev_err(adapter->dev, "unable to alloc buffer for firmware."
- " Terminating download\n");
+ dev_err(adapter->dev,
+ "unable to alloc buffer for FW. Terminating dnld\n");
return -ENOMEM;
}
DN_LD_CARD_RDY);
if (ret) {
dev_err(adapter->dev, "FW download with helper:"
- " poll status timeout @ %d\n", offset);
+ " poll status timeout @ %d\n", offset);
goto done;
}
ret = mwifiex_read_reg(adapter, HOST_F1_RD_BASE_0,
&base0);
if (ret) {
- dev_err(adapter->dev, "dev BASE0 register read"
- " failed: base0=0x%04X(%d). Terminating "
- "download\n", base0, base0);
+ dev_err(adapter->dev,
+ "dev BASE0 register read failed: "
+ "base0=%#04X(%d). Terminating dnld\n",
+ base0, base0);
goto done;
}
ret = mwifiex_read_reg(adapter, HOST_F1_RD_BASE_1,
&base1);
if (ret) {
- dev_err(adapter->dev, "dev BASE1 register read"
- " failed: base1=0x%04X(%d). Terminating "
- "download\n", base1, base1);
+ dev_err(adapter->dev,
+ "dev BASE1 register read failed: "
+ "base1=%#04X(%d). Terminating dnld\n",
+ base1, base1);
goto done;
}
len = (u16) (((base1 & 0xff) << 8) | (base0 & 0xff));
if (!len) {
break;
} else if (len > MWIFIEX_UPLD_SIZE) {
- dev_err(adapter->dev, "FW download failed @ %d,"
- " invalid length %d\n", offset, len);
+ dev_err(adapter->dev,
+ "FW dnld failed @ %d, invalid length %d\n",
+ offset, len);
ret = -1;
goto done;
}
if (len & BIT(0)) {
i++;
if (i > MAX_WRITE_IOMEM_RETRY) {
- dev_err(adapter->dev, "FW download failed @"
- " %d, over max retry count\n", offset);
+ dev_err(adapter->dev,
+ "FW dnld failed @ %d, over max retry\n",
+ offset);
ret = -1;
goto done;
}
dev_err(adapter->dev, "CRC indicated by the helper:"
- " len = 0x%04X, txlen = %d\n", len, txlen);
+ " len = 0x%04X, txlen = %d\n", len, txlen);
len &= ~BIT(0);
/* Setting this to 0 to resend from same offset */
txlen = 0;
if (firmware_len - offset < txlen)
txlen = firmware_len - offset;
- tx_blocks = (txlen + MWIFIEX_SDIO_BLOCK_SIZE -
- 1) / MWIFIEX_SDIO_BLOCK_SIZE;
+ tx_blocks = (txlen + MWIFIEX_SDIO_BLOCK_SIZE - 1)
+ / MWIFIEX_SDIO_BLOCK_SIZE;
/* Copy payload to buffer */
memmove(fwbuf, &firmware[offset], txlen);
MWIFIEX_SDIO_BLOCK_SIZE,
adapter->ioport);
if (ret) {
- dev_err(adapter->dev, "FW download, write iomem (%d)"
- " failed @ %d\n", i, offset);
+ dev_err(adapter->dev,
+ "FW download, write iomem (%d) failed @ %d\n",
+ i, offset);
if (mwifiex_write_reg(adapter, CONFIGURATION_REG, 0x04))
dev_err(adapter->dev, "write CFG reg failed\n");
} while (true);
dev_dbg(adapter->dev, "info: FW download over, size %d bytes\n",
- offset);
+ offset);
ret = 0;
done:
card = sdio_get_drvdata(func);
if (!card || !card->adapter) {
pr_debug("int: func=%p card=%p adapter=%p\n",
- func, card, card ? card->adapter : NULL);
+ func, card, card ? card->adapter : NULL);
return;
}
adapter = card->adapter;
if (adapter->ps_state == PS_STATE_SLEEP_CFM)
mwifiex_process_sleep_confirm_resp(adapter,
- skb->data, skb->len);
+ skb->data,
+ skb->len);
- memcpy(cmd_buf, skb->data, min_t(u32,
- MWIFIEX_SIZE_OF_CMD_BUFFER, skb->len));
+ memcpy(cmd_buf, skb->data,
+ min_t(u32, MWIFIEX_SIZE_OF_CMD_BUFFER,
+ skb->len));
dev_kfree_skb_any(skb);
} else {
if (port == CTRL_PORT) {
/* Read the command Resp without aggr */
dev_dbg(adapter->dev, "info: %s: no aggregation for cmd "
- "response\n", __func__);
+ "response\n", __func__);
f_do_rx_cur = 1;
goto rx_curr_single;
if (!card->mpa_rx.enabled) {
dev_dbg(adapter->dev, "info: %s: rx aggregation disabled\n",
- __func__);
+ __func__);
f_do_rx_cur = 1;
goto rx_curr_single;
if (MP_RX_AGGR_PKT_LIMIT_REACHED(card) ||
MP_RX_AGGR_PORT_LIMIT_REACHED(card)) {
dev_dbg(adapter->dev, "info: %s: aggregated packet "
- "limit reached\n", __func__);
+ "limit reached\n", __func__);
/* No more pkts allowed in Aggr buf, rx it */
f_do_rx_aggr = 1;
}
if (f_do_rx_aggr) {
/* do aggr RX now */
dev_dbg(adapter->dev, "info: do_rx_aggr: num of packets: %d\n",
- card->mpa_rx.pkt_cnt);
+ card->mpa_rx.pkt_cnt);
if (mwifiex_read_data_sync(adapter, card->mpa_rx.buf,
card->mpa_rx.buf_len,
card->mp_wr_bitmap = ((u16) card->mp_regs[WR_BITMAP_U]) << 8;
card->mp_wr_bitmap |= (u16) card->mp_regs[WR_BITMAP_L];
dev_dbg(adapter->dev, "int: DNLD: wr_bitmap=0x%04x\n",
- card->mp_wr_bitmap);
+ card->mp_wr_bitmap);
if (adapter->data_sent &&
(card->mp_wr_bitmap & card->mp_data_port_mask)) {
dev_dbg(adapter->dev,
}
dev_dbg(adapter->dev, "info: cmd_sent=%d data_sent=%d\n",
- adapter->cmd_sent, adapter->data_sent);
+ adapter->cmd_sent, adapter->data_sent);
if (sdio_ireg & UP_LD_HOST_INT_STATUS) {
card->mp_rd_bitmap = ((u16) card->mp_regs[RD_BITMAP_U]) << 8;
card->mp_rd_bitmap |= (u16) card->mp_regs[RD_BITMAP_L];
dev_dbg(adapter->dev, "int: UPLD: rd_bitmap=0x%04x\n",
- card->mp_rd_bitmap);
+ card->mp_rd_bitmap);
while (true) {
ret = mwifiex_get_rd_port(adapter, &port);
rx_len = ((u16) card->mp_regs[len_reg_u]) << 8;
rx_len |= (u16) card->mp_regs[len_reg_l];
dev_dbg(adapter->dev, "info: RX: port=%d rx_len=%u\n",
- port, rx_len);
+ port, rx_len);
rx_blocks =
(rx_len + MWIFIEX_SDIO_BLOCK_SIZE -
1) / MWIFIEX_SDIO_BLOCK_SIZE;
- if (rx_len <= INTF_HEADER_LEN
- || (rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE) >
- MWIFIEX_RX_DATA_BUF_SIZE) {
+ if (rx_len <= INTF_HEADER_LEN ||
+ (rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE) >
+ MWIFIEX_RX_DATA_BUF_SIZE) {
dev_err(adapter->dev, "invalid rx_len=%d\n",
- rx_len);
+ rx_len);
return -1;
}
rx_len = (u16) (rx_blocks * MWIFIEX_SDIO_BLOCK_SIZE);
if (!skb) {
dev_err(adapter->dev, "%s: failed to alloc skb",
- __func__);
+ __func__);
return -1;
}
skb_put(skb, rx_len);
dev_dbg(adapter->dev, "info: rx_len = %d skb->len = %d\n",
- rx_len, skb->len);
+ rx_len, skb->len);
if (mwifiex_sdio_card_to_host_mp_aggr(adapter, skb,
port)) {
u32 cr = 0;
dev_err(adapter->dev, "card_to_host_mpa failed:"
- " int status=%#x\n", sdio_ireg);
+ " int status=%#x\n", sdio_ireg);
if (mwifiex_read_reg(adapter,
CONFIGURATION_REG, &cr))
dev_err(adapter->dev,
- "read CFG reg failed\n");
+ "read CFG reg failed\n");
dev_dbg(adapter->dev,
- "info: CFG reg val = %d\n", cr);
+ "info: CFG reg val = %d\n", cr);
if (mwifiex_write_reg(adapter,
CONFIGURATION_REG,
(cr | 0x04)))
dev_err(adapter->dev,
- "write CFG reg failed\n");
+ "write CFG reg failed\n");
dev_dbg(adapter->dev, "info: write success\n");
if (mwifiex_read_reg(adapter,
CONFIGURATION_REG, &cr))
dev_err(adapter->dev,
- "read CFG reg failed\n");
+ "read CFG reg failed\n");
dev_dbg(adapter->dev,
- "info: CFG reg val =%x\n", cr);
+ "info: CFG reg val =%x\n", cr);
return -1;
}
}
if ((!card->mpa_tx.enabled) || (port == CTRL_PORT)) {
dev_dbg(adapter->dev, "info: %s: tx aggregation disabled\n",
- __func__);
+ __func__);
f_send_cur_buf = 1;
goto tx_curr_single;
if (next_pkt_len) {
/* More pkt in TX queue */
dev_dbg(adapter->dev, "info: %s: more packets in queue.\n",
- __func__);
+ __func__);
if (MP_TX_AGGR_IN_PROGRESS(card)) {
if (!MP_TX_AGGR_PORT_LIMIT_REACHED(card) &&
f_precopy_cur_buf = 1;
if (!(card->mp_wr_bitmap &
- (1 << card->curr_wr_port))
- || !MP_TX_AGGR_BUF_HAS_ROOM(
- card, pkt_len + next_pkt_len))
+ (1 << card->curr_wr_port)) ||
+ !MP_TX_AGGR_BUF_HAS_ROOM(
+ card, pkt_len + next_pkt_len))
f_send_aggr_buf = 1;
} else {
/* No room in Aggr buf, send it */
f_postcopy_cur_buf = 1;
}
} else {
- if (MP_TX_AGGR_BUF_HAS_ROOM(card, pkt_len)
- && (card->mp_wr_bitmap & (1 << card->curr_wr_port)))
+ if (MP_TX_AGGR_BUF_HAS_ROOM(card, pkt_len) &&
+ (card->mp_wr_bitmap & (1 << card->curr_wr_port)))
f_precopy_cur_buf = 1;
else
f_send_cur_buf = 1;
} else {
/* Last pkt in TX queue */
dev_dbg(adapter->dev, "info: %s: Last packet in Tx Queue.\n",
- __func__);
+ __func__);
if (MP_TX_AGGR_IN_PROGRESS(card)) {
/* some packs in Aggr buf already */
if (f_precopy_cur_buf) {
dev_dbg(adapter->dev, "data: %s: precopy current buffer\n",
- __func__);
+ __func__);
MP_TX_AGGR_BUF_PUT(card, payload, pkt_len, port);
if (MP_TX_AGGR_PKT_LIMIT_REACHED(card) ||
if (f_send_aggr_buf) {
dev_dbg(adapter->dev, "data: %s: send aggr buffer: %d %d\n",
- __func__,
+ __func__,
card->mpa_tx.start_port, card->mpa_tx.ports);
ret = mwifiex_write_data_to_card(adapter, card->mpa_tx.buf,
card->mpa_tx.buf_len,
tx_curr_single:
if (f_send_cur_buf) {
dev_dbg(adapter->dev, "data: %s: send current buffer %d\n",
- __func__, port);
+ __func__, port);
ret = mwifiex_write_data_to_card(adapter, payload, pkt_len,
adapter->ioport + port);
}
if (f_postcopy_cur_buf) {
dev_dbg(adapter->dev, "data: %s: postcopy current buffer\n",
- __func__);
+ __func__);
MP_TX_AGGR_BUF_PUT(card, payload, pkt_len, port);
}
ret = mwifiex_get_wr_port_data(adapter, &port);
if (ret) {
dev_err(adapter->dev, "%s: no wr_port available\n",
- __func__);
+ __func__);
return ret;
}
} else {
if (pkt_len <= INTF_HEADER_LEN ||
pkt_len > MWIFIEX_UPLD_SIZE)
dev_err(adapter->dev, "%s: payload=%p, nb=%d\n",
- __func__, payload, pkt_len);
+ __func__, payload, pkt_len);
}
/* Transfer data to card */
if (tx_param)
ret = mwifiex_host_to_card_mp_aggr(adapter, payload, pkt_len,
- port, tx_param->next_pkt_len);
+ port, tx_param->next_pkt_len
+ );
else
ret = mwifiex_host_to_card_mp_aggr(adapter, payload, pkt_len,
- port, 0);
+ port, 0);
if (ret) {
if (type == MWIFIEX_TYPE_CMD)
card->curr_wr_port = 1;
dev_dbg(adapter->dev, "cmd: mp_end_port %d, data port mask 0x%x\n",
- port, card->mp_data_port_mask);
+ port, card->mp_data_port_mask);
}
static struct mwifiex_if_ops sdio_ops = {