qcacmn: Fix kernel module check patch warnings in hif sdio files

Fix kernel module check patch warnings in hif sdio files

Change-Id: Ieb1bac5061969538095fad8f0311029b3d3161f0
CRs-fixed: 2033001
This commit is contained in:
Manikandan Mohan
2017-04-07 14:25:51 -07:00
committed by snandini
parent 6622bf43fc
commit a6d64a1dd6
17 changed files with 456 additions and 401 deletions

View File

@@ -696,7 +696,7 @@
#define AR6320V3_CPU_PLL_INIT_DONE_ADDR 0x404020 #define AR6320V3_CPU_PLL_INIT_DONE_ADDR 0x404020
#define AR6320V3_CPU_SPEED_ADDR 0x404024 #define AR6320V3_CPU_SPEED_ADDR 0x404024
typedef enum { enum a_refclk_speed_t {
SOC_REFCLK_UNKNOWN = -1, /* Unsupported ref clock -- use PLL Bypass */ SOC_REFCLK_UNKNOWN = -1, /* Unsupported ref clock -- use PLL Bypass */
SOC_REFCLK_48_MHZ = 0, SOC_REFCLK_48_MHZ = 0,
SOC_REFCLK_19_2_MHZ = 1, SOC_REFCLK_19_2_MHZ = 1,
@@ -706,7 +706,7 @@ typedef enum {
SOC_REFCLK_38_4_MHZ = 5, SOC_REFCLK_38_4_MHZ = 5,
SOC_REFCLK_40_MHZ = 6, SOC_REFCLK_40_MHZ = 6,
SOC_REFCLK_52_MHZ = 7, SOC_REFCLK_52_MHZ = 7,
} A_refclk_speed_t; };
#define A_REFCLK_UNKNOWN SOC_REFCLK_UNKNOWN #define A_REFCLK_UNKNOWN SOC_REFCLK_UNKNOWN
#define A_REFCLK_48_MHZ SOC_REFCLK_48_MHZ #define A_REFCLK_48_MHZ SOC_REFCLK_48_MHZ
@@ -728,21 +728,21 @@ struct wlan_pll_s {
}; };
struct cmnos_clock_s { struct cmnos_clock_s {
A_refclk_speed_t refclk_speed; enum a_refclk_speed_t refclk_speed;
uint32_t refclk_hz; uint32_t refclk_hz;
uint32_t pll_settling_time; /* 50us */ uint32_t pll_settling_time; /* 50us */
struct wlan_pll_s wlan_pll; struct wlan_pll_s wlan_pll;
}; };
typedef struct TGT_REG_SECTION { struct tgt_reg_section {
uint32_t start_addr; uint32_t start_addr;
uint32_t end_addr; uint32_t end_addr;
} tgt_reg_section; };
typedef struct TGT_REG_TABLE { struct tgt_reg_table {
tgt_reg_section *section; struct tgt_reg_section *section;
uint32_t section_size; uint32_t section_size;
} tgt_reg_table; };
struct hif_softc; struct hif_softc;
void hif_target_register_tbl_attach(struct hif_softc *scn, u32 target_type); void hif_target_register_tbl_attach(struct hif_softc *scn, u32 target_type);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
* *
***Previously licensed under the ISC license by Qualcomm Atheros, Inc. ***Previously licensed under the ISC license by Qualcomm Atheros, Inc.
* *
@@ -72,7 +72,8 @@ hif_bmi_buffer_send(struct hif_sdio_dev *device, char *buffer, uint32_t length)
* byte read will hit the counter and cause * byte read will hit the counter and cause
* a decrement, while the remaining 3 bytes has no effect. * a decrement, while the remaining 3 bytes has no effect.
* The rationale behind this is to make all HIF accesses * The rationale behind this is to make all HIF accesses
* 4-byte aligned */ * 4-byte aligned
*/
status = status =
hif_read_write(device, address, hif_read_write(device, address,
(uint8_t *) p_bmi_cmd_credits, 4, (uint8_t *) p_bmi_cmd_credits, 4,
@@ -84,7 +85,8 @@ hif_bmi_buffer_send(struct hif_sdio_dev *device, char *buffer, uint32_t length)
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
/* the counter is only 8=bits, ignore anything in the /* the counter is only 8=bits, ignore anything in the
*upper 3 bytes */ * upper 3 bytes
*/
(*p_bmi_cmd_credits) &= 0xFF; (*p_bmi_cmd_credits) &= 0xFF;
} }
@@ -135,6 +137,7 @@ hif_bmi_read_write(struct hif_sdio_dev *device,
char *buffer, uint32_t length) char *buffer, uint32_t length)
{ {
QDF_STATUS status; QDF_STATUS status;
status = hif_read_write(device, RX_LOOKAHEAD_VALID_ADDRESS, status = hif_read_write(device, RX_LOOKAHEAD_VALID_ADDRESS,
buffer, length, buffer, length,
HIF_RD_SYNC_BYTE_INC, NULL); HIF_RD_SYNC_BYTE_INC, NULL);
@@ -166,12 +169,14 @@ hif_bmi_buffer_receive(struct hif_sdio_dev *device,
uint32_t address; uint32_t address;
uint32_t mbox_address[HTC_MAILBOX_NUM_MAX]; uint32_t mbox_address[HTC_MAILBOX_NUM_MAX];
struct _HIF_PENDING_EVENTS_INFO hif_pending_events; struct _HIF_PENDING_EVENTS_INFO hif_pending_events;
static HIF_PENDING_EVENTS_FUNC get_pending_events_func; static HIF_PENDING_EVENTS_FUNC get_pending_events_func;
if (!pending_events_func_check) { if (!pending_events_func_check) {
/* see if the HIF layer implements an alternative /* see if the HIF layer implements an alternative
* function to get pending events * function to get pending events
* do this only once! */ * do this only once!
*/
hif_configure_device(device, hif_configure_device(device,
HIF_DEVICE_GET_PENDING_EVENTS_FUNC, HIF_DEVICE_GET_PENDING_EVENTS_FUNC,
&get_pending_events_func, &get_pending_events_func,
@@ -340,7 +345,8 @@ QDF_STATUS hif_reg_based_get_target_info(struct hif_opaque_softc *hif_ctx,
/* /*
* The Target's targ_info doesn't match the Host's targ_info. * The Target's targ_info doesn't match the Host's targ_info.
* We need to do some backwards compatibility work to make this * We need to do some backwards compatibility work to make this
* OK.*/ * OK.
*/
QDF_ASSERT(targ_info->target_info_byte_count == QDF_ASSERT(targ_info->target_info_byte_count ==
sizeof(*targ_info)); sizeof(*targ_info));
/* Read the remainder of the targ_info */ /* Read the remainder of the targ_info */
@@ -488,11 +494,9 @@ QDF_STATUS hif_bmi_write_scratch_register(struct hif_sdio_dev *device,
("%s: Unable to write to 0x%x\n", ("%s: Unable to write to 0x%x\n",
__func__, SDIO_SCRATCH_1_ADDRESS)); __func__, SDIO_SCRATCH_1_ADDRESS));
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} else {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("%s: wrote 0x%x to 0x%x\n", __func__,
buffer, SDIO_SCRATCH_1_ADDRESS));
} }
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: wrote 0x%x to 0x%x\n", __func__,
buffer, SDIO_SCRATCH_1_ADDRESS));
return status; return status;
} }
@@ -516,11 +520,9 @@ QDF_STATUS hif_bmi_read_scratch_register(struct hif_sdio_dev *device)
("%s: Unable to read from 0x%x\n", ("%s: Unable to read from 0x%x\n",
__func__, SDIO_SCRATCH_1_ADDRESS)); __func__, SDIO_SCRATCH_1_ADDRESS));
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} else {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("%s: read 0x%x from 0x%x\n", __func__,
buffer, SDIO_SCRATCH_1_ADDRESS));
} }
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: read 0x%x from 0x%x\n", __func__,
buffer, SDIO_SCRATCH_1_ADDRESS));
return status; return status;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
* *
* Previously licensed under the ISC license by Qualcomm Atheros, Inc. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
* *
@@ -41,7 +41,8 @@
#define WORD_NON_ALIGNMENT_MASK 0x03 #define WORD_NON_ALIGNMENT_MASK 0x03
/** /**
* hif_ar6000_set_address_window_register - set the window address register (using 4-byte register access ). * hif_ar6000_set_address_window_register - set the window address register
* (using 4-byte register access).
* @hif_device: hif context * @hif_device: hif context
* @register_addr: register address * @register_addr: register address
* @addr: addr * @addr: addr
@@ -174,7 +175,8 @@ QDF_STATUS hif_diag_write_access(struct hif_opaque_softc *hif_ctx,
} }
/** /**
* hif_diag_write_mem - Write a block data to the AR6000 through its diagnostic window. * hif_diag_write_mem - Write a block data to the AR6000 through its diagnostic
* window.
* @scn: hif context * @scn: hif context
* @address: address * @address: address
* @data: data * @data: data
@@ -195,8 +197,7 @@ QDF_STATUS hif_diag_write_mem(struct hif_opaque_softc *scn, uint32_t address,
if ((address & WORD_NON_ALIGNMENT_MASK) || if ((address & WORD_NON_ALIGNMENT_MASK) ||
(nbytes & WORD_NON_ALIGNMENT_MASK)) { (nbytes & WORD_NON_ALIGNMENT_MASK)) {
AR_DEBUG_PRINTF(ATH_LOG_ERR, AR_DEBUG_PRINTF(ATH_LOG_ERR,
("[%s]addr or length is not 4 bytes" ("[%s]addr or length is not 4 bytes align.addr[0x%08x] len[0x%08x]\n",
" align.addr[0x%08x] len[0x%08x]\n",
__func__, address, nbytes)); __func__, address, nbytes));
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
@@ -208,8 +209,7 @@ QDF_STATUS hif_diag_write_mem(struct hif_opaque_softc *scn, uint32_t address,
status = hif_diag_write_access(scn, address + i, tmp_data); status = hif_diag_write_access(scn, address + i, tmp_data);
if (status != QDF_STATUS_SUCCESS) { if (status != QDF_STATUS_SUCCESS) {
AR_DEBUG_PRINTF(ATH_LOG_ERR, AR_DEBUG_PRINTF(ATH_LOG_ERR,
("Diag Write mem failed.addr[0x%08x]" ("Diag Write mem failed.addr[0x%08x] value[0x%08x]\n",
" value[0x%08x]\n",
address + i, tmp_data)); address + i, tmp_data));
return status; return status;
} }
@@ -219,7 +219,8 @@ QDF_STATUS hif_diag_write_mem(struct hif_opaque_softc *scn, uint32_t address,
} }
/** /**
* hif_diag_read_mem - Read a block data to the AR6000 through its diagnostic window. * hif_diag_read_mem - Read a block data to the AR6000 through its diagnostic
* window.
* @scn: hif context * @scn: hif context
* @data: data * @data: data
* @nbytes: nbytes * @nbytes: nbytes
@@ -240,8 +241,7 @@ QDF_STATUS hif_diag_read_mem(struct hif_opaque_softc *scn,
if ((address & WORD_NON_ALIGNMENT_MASK) || if ((address & WORD_NON_ALIGNMENT_MASK) ||
(nbytes & WORD_NON_ALIGNMENT_MASK)) { (nbytes & WORD_NON_ALIGNMENT_MASK)) {
AR_DEBUG_PRINTF(ATH_LOG_ERR, AR_DEBUG_PRINTF(ATH_LOG_ERR,
("[%s]addr or length is not 4 bytes" ("[%s]addr or length is not 4 bytes align.addr[0x%08x] len[0x%08x]\n",
" align.addr[0x%08x] len[0x%08x]\n",
__func__, address, nbytes)); __func__, address, nbytes));
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
@@ -250,8 +250,7 @@ QDF_STATUS hif_diag_read_mem(struct hif_opaque_softc *scn,
status = hif_diag_read_access(scn, address + i, &tmp_data); status = hif_diag_read_access(scn, address + i, &tmp_data);
if (status != QDF_STATUS_SUCCESS) { if (status != QDF_STATUS_SUCCESS) {
AR_DEBUG_PRINTF(ATH_LOG_ERR, AR_DEBUG_PRINTF(ATH_LOG_ERR,
("Diag Write mem failed.addr[0x%08x]" ("Diag Write mem failed.addr[0x%08x] value[0x%08x]\n",
" value[0x%08x]\n",
address + i, tmp_data)); address + i, tmp_data));
return status; return status;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
* *
* Previously licensed under the ISC license by Qualcomm Atheros, Inc. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
* *
@@ -188,8 +188,6 @@ void hif_post_init(struct hif_opaque_softc *hif_ctx, void *target,
if (htc_sdio_device) if (htc_sdio_device)
hif_dev_setup(htc_sdio_device); hif_dev_setup(htc_sdio_device);
return;
} }
/** /**

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
* *
* Previously licensed under the ISC license by Qualcomm Atheros, Inc. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
* *
@@ -107,7 +107,8 @@
* requirement, but AR6003 support it, so the register * requirement, but AR6003 support it, so the register
* is placed in vendor specific field 0xF0(bit0) * is placed in vendor specific field 0xF0(bit0)
* In SDIO 3.0, the register is defined in SPEC, and its * In SDIO 3.0, the register is defined in SPEC, and its
* address is 0x16(bit1) */ * address is 0x16(bit1)
*/
/* interrupt mode register of AR6003 */ /* interrupt mode register of AR6003 */
#define CCCR_SDIO_IRQ_MODE_REG_AR6003 0xF0 #define CCCR_SDIO_IRQ_MODE_REG_AR6003 0xF0
/* mode to enable special 4-bit interrupt assertion without clock */ /* mode to enable special 4-bit interrupt assertion without clock */

View File

@@ -75,18 +75,16 @@ uint8_t hif_dev_map_pipe_to_mail_box(struct hif_sdio_device *pdev,
uint8_t pipeid) uint8_t pipeid)
{ {
/* TODO: temp version, should not hardcoded here, will be /* TODO: temp version, should not hardcoded here, will be
* updated after HIF design */ * updated after HIF design
*/
if (2 == pipeid || 3 == pipeid) if (2 == pipeid || 3 == pipeid)
return 1; return 1;
else if (0 == pipeid || 1 == pipeid) else if (0 == pipeid || 1 == pipeid)
return 0; return 0;
else { AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: pipeid=%d,should not happen\n",
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, __func__, pipeid));
("%s: pipeid=%d,should not happen\n", qdf_assert(0);
__func__, pipeid)); return INVALID_MAILBOX_NUMBER;
qdf_assert(0);
return INVALID_MAILBOX_NUMBER;
}
} }
/** /**
@@ -104,19 +102,17 @@ uint8_t hif_dev_map_mail_box_to_pipe(struct hif_sdio_device *pdev,
bool upload) bool upload)
{ {
/* TODO: temp version, should not hardcoded here, will be /* TODO: temp version, should not hardcoded here, will be
* updated after HIF design */ * updated after HIF design
if (mbox_index == 0) { */
if (mbox_index == 0)
return upload ? 1 : 0; return upload ? 1 : 0;
} else if (mbox_index == 1) { else if (mbox_index == 1)
return upload ? 3 : 2; return upload ? 3 : 2;
} else { AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s:-----mboxIndex=%d,upload=%d, should not happen\n",
("%s:--------------------mboxIndex=%d,upload=%d,"
" should not happen\n",
__func__, mbox_index, upload)); __func__, mbox_index, upload));
qdf_assert(0); qdf_assert(0);
return 0xff; return 0xff;
}
} }
/** /**
@@ -135,6 +131,7 @@ QDF_STATUS hif_dev_map_service_to_pipe(struct hif_sdio_device *pdev,
bool swap_mapping) bool swap_mapping)
{ {
QDF_STATUS status = QDF_STATUS_SUCCESS; QDF_STATUS status = QDF_STATUS_SUCCESS;
switch (service_id) { switch (service_id) {
case HTT_DATA_MSG_SVC: case HTT_DATA_MSG_SVC:
if (swap_mapping) { if (swap_mapping) {
@@ -284,6 +281,7 @@ struct hif_sdio_device *hif_dev_from_hif(struct hif_sdio_dev *hif_device)
{ {
struct hif_sdio_device *pdev = NULL; struct hif_sdio_device *pdev = NULL;
QDF_STATUS status; QDF_STATUS status;
status = hif_configure_device(hif_device, status = hif_configure_device(hif_device,
HIF_DEVICE_GET_HTC_CONTEXT, HIF_DEVICE_GET_HTC_CONTEXT,
(void **)&pdev, sizeof(struct hif_sdio_device)); (void **)&pdev, sizeof(struct hif_sdio_device));
@@ -306,6 +304,7 @@ QDF_STATUS hif_dev_disable_interrupts(struct hif_sdio_device *pdev)
{ {
struct MBOX_IRQ_ENABLE_REGISTERS regs; struct MBOX_IRQ_ENABLE_REGISTERS regs;
QDF_STATUS status = QDF_STATUS_SUCCESS; QDF_STATUS status = QDF_STATUS_SUCCESS;
HIF_ENTER(); HIF_ENTER();
LOCK_HIF_DEV(pdev); LOCK_HIF_DEV(pdev);
@@ -351,6 +350,7 @@ QDF_STATUS hif_dev_enable_interrupts(struct hif_sdio_device *pdev)
{ {
QDF_STATUS status; QDF_STATUS status;
struct MBOX_IRQ_ENABLE_REGISTERS regs; struct MBOX_IRQ_ENABLE_REGISTERS regs;
HIF_ENTER(); HIF_ENTER();
/* for good measure, make sure interrupt are disabled /* for good measure, make sure interrupt are disabled
@@ -360,7 +360,8 @@ QDF_STATUS hif_dev_enable_interrupts(struct hif_sdio_device *pdev)
* and when HTC is finally ready to handle interrupts, * and when HTC is finally ready to handle interrupts,
* other software can perform target "soft" resets. * other software can perform target "soft" resets.
* The AR6K interrupt enables reset back to an "enabled" * The AR6K interrupt enables reset back to an "enabled"
* state when this happens. */ * state when this happens.
*/
hif_dev_disable_interrupts(pdev); hif_dev_disable_interrupts(pdev);
/* Unmask the host controller interrupts */ /* Unmask the host controller interrupts */
@@ -369,7 +370,8 @@ QDF_STATUS hif_dev_enable_interrupts(struct hif_sdio_device *pdev)
LOCK_HIF_DEV(pdev); LOCK_HIF_DEV(pdev);
/* Enable all the interrupts except for the internal /* Enable all the interrupts except for the internal
* AR6000 CPU interrupt */ * AR6000 CPU interrupt
*/
pdev->IrqEnableRegisters.int_status_enable = pdev->IrqEnableRegisters.int_status_enable =
INT_STATUS_ENABLE_ERROR_SET(0x01) | INT_STATUS_ENABLE_ERROR_SET(0x01) |
INT_STATUS_ENABLE_CPU_SET(0x01) INT_STATUS_ENABLE_CPU_SET(0x01)
@@ -384,7 +386,7 @@ QDF_STATUS hif_dev_enable_interrupts(struct hif_sdio_device *pdev)
* CPU sourced interrupt #0, #1. * CPU sourced interrupt #0, #1.
* #0 is used for report assertion from target * #0 is used for report assertion from target
* #1 is used for inform host that credit arrived * #1 is used for inform host that credit arrived
* */ */
pdev->IrqEnableRegisters.cpu_int_status_enable = 0x03; pdev->IrqEnableRegisters.cpu_int_status_enable = 0x03;
/* Set up the Error Interrupt Status Register */ /* Set up the Error Interrupt Status Register */
@@ -393,7 +395,8 @@ QDF_STATUS hif_dev_enable_interrupts(struct hif_sdio_device *pdev)
| ERROR_STATUS_ENABLE_TX_OVERFLOW_SET(0x01)) >> 16; | ERROR_STATUS_ENABLE_TX_OVERFLOW_SET(0x01)) >> 16;
/* Set up the Counter Interrupt Status Register /* Set up the Counter Interrupt Status Register
* (only for debug interrupt to catch fatal errors) */ * (only for debug interrupt to catch fatal errors)
*/
pdev->IrqEnableRegisters.counter_int_status_enable = pdev->IrqEnableRegisters.counter_int_status_enable =
(COUNTER_INT_STATUS_ENABLE_BIT_SET(AR6K_TARGET_DEBUG_INTR_MASK)) >> (COUNTER_INT_STATUS_ENABLE_BIT_SET(AR6K_TARGET_DEBUG_INTR_MASK)) >>
24; 24;
@@ -504,7 +507,8 @@ QDF_STATUS hif_dev_setup(struct hif_sdio_device *pdev)
pdev->HifMaskUmaskRecvEvent = NULL; pdev->HifMaskUmaskRecvEvent = NULL;
/* see if the HIF layer implements the mask/unmask recv /* see if the HIF layer implements the mask/unmask recv
* events function */ * events function
*/
hif_configure_device(hif_device, hif_configure_device(hif_device,
HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC, HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC,
&pdev->HifMaskUmaskRecvEvent, &pdev->HifMaskUmaskRecvEvent,

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2014, 2016 The Linux Foundation. All rights reserved. * Copyright (c) 2013-2014, 2016-2017 The Linux Foundation. All rights reserved.
* *
* Previously licensed under the ISC license by Qualcomm Atheros, Inc. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
* *
@@ -114,12 +114,12 @@ struct hif_sdio_device {
void *pTarget; void *pTarget;
}; };
#define LOCK_HIF_DEV(device) qdf_spin_lock(&(device)->Lock); #define LOCK_HIF_DEV(device) qdf_spin_lock(&(device)->Lock)
#define UNLOCK_HIF_DEV(device) qdf_spin_unlock(&(device)->Lock); #define UNLOCK_HIF_DEV(device) qdf_spin_unlock(&(device)->Lock)
#define LOCK_HIF_DEV_RX(t) qdf_spin_lock(&(t)->RxLock); #define LOCK_HIF_DEV_RX(t) qdf_spin_lock(&(t)->RxLock)
#define UNLOCK_HIF_DEV_RX(t) qdf_spin_unlock(&(t)->RxLock); #define UNLOCK_HIF_DEV_RX(t) qdf_spin_unlock(&(t)->RxLock)
#define LOCK_HIF_DEV_TX(t) qdf_spin_lock(&(t)->TxLock); #define LOCK_HIF_DEV_TX(t) qdf_spin_lock(&(t)->TxLock)
#define UNLOCK_HIF_DEV_TX(t) qdf_spin_unlock(&(t)->TxLock); #define UNLOCK_HIF_DEV_TX(t) qdf_spin_unlock(&(t)->TxLock)
#define DEV_CALC_RECV_PADDED_LEN(pDev, length) \ #define DEV_CALC_RECV_PADDED_LEN(pDev, length) \
(((length) + (pDev)->BlockMask) & (~((pDev)->BlockMask))) (((length) + (pDev)->BlockMask) & (~((pDev)->BlockMask)))

View File

@@ -100,7 +100,8 @@ static void hif_dev_dump_registers(struct hif_sdio_device *pdev,
if (pdev->MailBoxInfo.gmbox_address != 0) { if (pdev->MailBoxInfo.gmbox_address != 0) {
/* if the target supports GMBOX hardware, /* if the target supports GMBOX hardware,
* dump some additional state */ * dump some additional state
*/
AR_DEBUG_PRINTF(ATH_DEBUG_ANY, AR_DEBUG_PRINTF(ATH_DEBUG_ANY,
("GMBOX-HostIntStatus2: 0x%x ", ("GMBOX-HostIntStatus2: 0x%x ",
irq_proc_regs->host_int_status2)); irq_proc_regs->host_int_status2));
@@ -121,6 +122,7 @@ static void hif_dev_dump_registers(struct hif_sdio_device *pdev,
if (mailbox_counter_registers != NULL) { if (mailbox_counter_registers != NULL) {
int i; int i;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
AR_DEBUG_PRINTF(ATH_DEBUG_ANY, AR_DEBUG_PRINTF(ATH_DEBUG_ANY,
("Counter[%d]: 0x%x\n", i, ("Counter[%d]: 0x%x\n", i,
@@ -176,17 +178,18 @@ QDF_STATUS hif_dev_alloc_and_prepare_rx_packets(struct hif_sdio_device *pdev,
} else { } else {
/* HTC header indicates that every packet to follow /* HTC header indicates that every packet to follow
* has the same padded length so that it can * has the same padded length so that it can
* be optimally fetched as a full bundle */ * be optimally fetched as a full bundle
*/
num_messages = num_messages =
(hdr->Flags & HTC_FLAGS_RECV_BUNDLE_CNT_MASK) (hdr->Flags & HTC_FLAGS_RECV_BUNDLE_CNT_MASK)
>> HTC_FLAGS_RECV_BUNDLE_CNT_SHIFT; >> HTC_FLAGS_RECV_BUNDLE_CNT_SHIFT;
/* the count doesn't include the starter frame, just /* the count doesn't include the starter frame, just
* a count of frames to follow */ * a count of frames to follow
*/
num_messages++; num_messages++;
/* A_ASSERT(numMessages <= target->MaxMsgPerBundle); */ /* A_ASSERT(numMessages <= target->MaxMsgPerBundle); */
AR_DEBUG_PRINTF(ATH_DEBUG_RECV, AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
("HTC header indicates :%d messages can be" ("HTC header indicates :%d messages can be fetched as a bundle\n",
" fetched as a bundle\n",
num_messages)); num_messages));
} }
@@ -197,25 +200,28 @@ QDF_STATUS hif_dev_alloc_and_prepare_rx_packets(struct hif_sdio_device *pdev,
/* get packet buffers for each message, if there was a /* get packet buffers for each message, if there was a
* bundle detected in the header, * bundle detected in the header,
* use pHdr as a template to fetch all packets in the bundle */ * use pHdr as a template to fetch all packets in the bundle
*/
for (j = 0; j < num_messages; j++) { for (j = 0; j < num_messages; j++) {
/* reset flag, any packets allocated using the /* reset flag, any packets allocated using the
* RecvAlloc() API cannot be recycled on cleanup, * RecvAlloc() API cannot be recycled on cleanup,
* they must be explicitly returned */ * they must be explicitly returned
*/
no_recycle = false; no_recycle = false;
packet = hif_dev_alloc_rx_buffer(pdev); packet = hif_dev_alloc_rx_buffer(pdev);
if (packet == NULL) { if (packet == NULL) {
/* No error, simply need to mark that /* No error, simply need to mark that
* we are waiting for buffers. */ * we are waiting for buffers.
*/
pdev->RecvStateFlags |= HTC_RECV_WAIT_BUFFERS; pdev->RecvStateFlags |= HTC_RECV_WAIT_BUFFERS;
/* pDev->EpWaitingForBuffers = pEndpoint->Id; */ /* pDev->EpWaitingForBuffers = pEndpoint->Id; */
status = QDF_STATUS_E_RESOURCES; status = QDF_STATUS_E_RESOURCES;
break; break;
} }
/* AR_DEBUG_ASSERT(pPacket->Endpoint == /* AR_DEBUG_ASSERT(pPacket->Endpoint == pEndpoint->Id);
pEndpoint->Id); */ */
/* clear flags */ /* clear flags */
packet->PktInfo.AsRx.HTCRxFlags = 0; packet->PktInfo.AsRx.HTCRxFlags = 0;
packet->PktInfo.AsRx.IndicationFlags = 0; packet->PktInfo.AsRx.IndicationFlags = 0;
@@ -223,25 +229,25 @@ QDF_STATUS hif_dev_alloc_and_prepare_rx_packets(struct hif_sdio_device *pdev,
if (no_recycle) if (no_recycle)
/* flag that these packets cannot be recycled, /* flag that these packets cannot be recycled,
* they have to be returned to the user */ * they have to be returned to the user
*/
packet->PktInfo.AsRx.HTCRxFlags |= packet->PktInfo.AsRx.HTCRxFlags |=
HTC_RX_PKT_NO_RECYCLE; HTC_RX_PKT_NO_RECYCLE;
/* add packet to queue (also incase we need to /* add packet to queue (also incase we need to
* cleanup down below) */ * cleanup down below)
*/
HTC_PACKET_ENQUEUE(queue, packet); HTC_PACKET_ENQUEUE(queue, packet);
/* /* if (HTC_STOPPING(target)) {
if (HTC_STOPPING(target)) { * status = QDF_STATUS_E_CANCELED;
status = QDF_STATUS_E_CANCELED; * break;
break; * }
}
*/ */
/* make sure message can fit in the endpoint buffer */ /* make sure message can fit in the endpoint buffer */
if ((uint32_t) full_length > packet->BufferLength) { if ((uint32_t) full_length > packet->BufferLength) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("Payload Length Error : header reports payload" ("Payload Length Error : header reports payload of: %d (%d) endpoint buffer size: %d\n",
" of: %d (%d) endpoint buffer size: %d\n",
hdr->PayloadLen, full_length, hdr->PayloadLen, full_length,
packet->BufferLength)); packet->BufferLength));
status = QDF_STATUS_E_PROTO; status = QDF_STATUS_E_PROTO;
@@ -252,7 +258,8 @@ QDF_STATUS hif_dev_alloc_and_prepare_rx_packets(struct hif_sdio_device *pdev,
/* for messages fetched in a bundle the expected /* for messages fetched in a bundle the expected
* lookahead is unknown as we are only using the * lookahead is unknown as we are only using the
* lookahead of the first packet as a template * lookahead of the first packet as a template
* of what to expect for lengths */ * of what to expect for lengths
*/
packet->PktInfo.AsRx.HTCRxFlags |= packet->PktInfo.AsRx.HTCRxFlags |=
HTC_RX_PKT_REFRESH_HDR; HTC_RX_PKT_REFRESH_HDR;
/* set it to something invalid */ /* set it to something invalid */
@@ -301,8 +308,7 @@ static inline QDF_STATUS hif_dev_recv_packet(struct hif_sdio_device *pdev,
if (padded_length > packet->BufferLength) { if (padded_length > packet->BufferLength) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("DevRecvPacket, Not enough space for" ("DevRecvPacket, Not enough space for padlen:%d recvlen:%d bufferlen:%d\n",
" padlen:%d recvlen:%d bufferlen:%d\n",
padded_length, recv_length, padded_length, recv_length,
packet->BufferLength)); packet->BufferLength));
if (packet->Completion != NULL) { if (packet->Completion != NULL) {
@@ -314,8 +320,7 @@ static inline QDF_STATUS hif_dev_recv_packet(struct hif_sdio_device *pdev,
/* mailbox index is saved in Endpoint member */ /* mailbox index is saved in Endpoint member */
AR_DEBUG_PRINTF(ATH_DEBUG_RECV, AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
("hif_dev_recv_packet (0x%lX : hdr:0x%X) Len:%d," ("hif_dev_recv_packet (0x%lX : hdr:0x%X) Len:%d, Padded Length: %d Mbox:0x%X\n",
" Padded Length: %d Mbox:0x%X\n",
(unsigned long)packet, (unsigned long)packet,
packet->PktInfo.AsRx.ExpectedHdr, recv_length, packet->PktInfo.AsRx.ExpectedHdr, recv_length,
padded_length, padded_length,
@@ -343,8 +348,7 @@ static inline QDF_STATUS hif_dev_recv_packet(struct hif_sdio_device *pdev,
HTC_FRAME_HDR *hdr = HTC_FRAME_HDR *hdr =
(HTC_FRAME_HDR *) packet->pBuffer; (HTC_FRAME_HDR *) packet->pBuffer;
AR_DEBUG_PRINTF(ATH_DEBUG_RECV, AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
("hif_dev_recv_packet " ("hif_dev_recv_packet EP:%d,Len:%d,Flag:%d,CB:0x%02X,0x%02X\n",
"EP:%d,Len:%d,Flag:%d,CB:0x%02X,0x%02X\n",
hdr->EndpointID, hdr->PayloadLen, hdr->EndpointID, hdr->PayloadLen,
hdr->Flags, hdr->ControlBytes0, hdr->Flags, hdr->ControlBytes0,
hdr->ControlBytes1)); hdr->ControlBytes1));
@@ -391,8 +395,7 @@ static inline QDF_STATUS hif_dev_process_trailer(struct hif_sdio_device *pdev,
if (record->Length > length) { if (record->Length > length) {
/* no room left in buffer for record */ /* no room left in buffer for record */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
(" invalid record len: %d (id:%d) buffer has:" (" invalid record len: %d (id:%d) buffer has:%d bytes left\n",
"%d bytes left\n",
record->Length, record->RecordID, record->Length, record->RecordID,
length)); length));
status = QDF_STATUS_E_PROTO; status = QDF_STATUS_E_PROTO;
@@ -414,8 +417,7 @@ static inline QDF_STATUS hif_dev_process_trailer(struct hif_sdio_device *pdev,
&& (next_look_aheads != NULL)) { && (next_look_aheads != NULL)) {
AR_DEBUG_PRINTF(ATH_DEBUG_RECV, AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
(" look_ahead Report (pre valid:0x%X," (" look_ahead Report (pre valid:0x%X, post valid:0x%X) %d %d\n",
" post valid:0x%X) %d %d\n",
look_ahead->PreValid, look_ahead->PreValid,
look_ahead->PostValid, look_ahead->PostValid,
from_endpoint, from_endpoint,
@@ -464,7 +466,8 @@ static inline QDF_STATUS hif_dev_process_trailer(struct hif_sdio_device *pdev,
> HTC_MAX_MSG_PER_BUNDLE) { > HTC_MAX_MSG_PER_BUNDLE) {
/* this should never happen, the target /* this should never happen, the target
* restricts the number of messages per * restricts the number of messages per
* bundle configured by the host */ * bundle configured by the host
*/
A_ASSERT(false); A_ASSERT(false);
status = QDF_STATUS_E_PROTO; status = QDF_STATUS_E_PROTO;
break; break;
@@ -515,7 +518,8 @@ static inline QDF_STATUS hif_dev_process_trailer(struct hif_sdio_device *pdev,
/* process a received message (i.e. strip off header, /* process a received message (i.e. strip off header,
* process any trailer data). * process any trailer data).
* note : locks must be released when this function is called */ * note : locks must be released when this function is called
*/
static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev, static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
HTC_PACKET *packet, HTC_PACKET *packet,
uint32_t *next_look_aheads, uint32_t *next_look_aheads,
@@ -541,7 +545,8 @@ static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
do { do {
/* note, we cannot assume the alignment of pBuffer, /* note, we cannot assume the alignment of pBuffer,
* so we use the safe macros to * so we use the safe macros to
* retrieve 16 bit fields */ * retrieve 16 bit fields
*/
payloadLen = HTC_GET_FIELD(buf, HTC_FRAME_HDR, payloadLen = HTC_GET_FIELD(buf, HTC_FRAME_HDR,
PAYLOADLEN); PAYLOADLEN);
@@ -553,20 +558,22 @@ static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
if (packet->PktInfo.AsRx.HTCRxFlags & HTC_RX_PKT_REFRESH_HDR) { if (packet->PktInfo.AsRx.HTCRxFlags & HTC_RX_PKT_REFRESH_HDR) {
/* refresh expected hdr, since this was unknown /* refresh expected hdr, since this was unknown
* at the time we grabbed the packets * at the time we grabbed the packets
* as part of a bundle */ * as part of a bundle
*/
packet->PktInfo.AsRx.ExpectedHdr = look_ahead; packet->PktInfo.AsRx.ExpectedHdr = look_ahead;
/* refresh actual length since we now have the /* refresh actual length since we now have the
* real header */ * real header
*/
packet->ActualLength = payloadLen + HTC_HDR_LENGTH; packet->ActualLength = payloadLen + HTC_HDR_LENGTH;
/* validate the actual header that was refreshed */ /* validate the actual header that was refreshed */
if (packet->ActualLength > packet->BufferLength) { if (packet->ActualLength > packet->BufferLength) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("Invalid HDR payload length (%d)" ("Invalid HDR payload length (%d) in bundled RECV (hdr: 0x%X)\n",
" in bundled RECV (hdr: 0x%X)\n",
payloadLen, look_ahead)); payloadLen, look_ahead));
/* limit this to max buffer just to print out /* limit this to max buffer just to print out
* some of the buffer */ * some of the buffer
*/
packet->ActualLength = packet->ActualLength =
min(packet->ActualLength, min(packet->ActualLength,
packet->BufferLength); packet->BufferLength);
@@ -577,8 +584,7 @@ static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
if (packet->Endpoint if (packet->Endpoint
!= HTC_GET_FIELD(buf, HTC_FRAME_HDR, ENDPOINTID)) { != HTC_GET_FIELD(buf, HTC_FRAME_HDR, ENDPOINTID)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("Refreshed HDR endpoint (%d) does not " ("Refreshed HDR endpoint (%d) does not match expected endpoint (%d)\n",
" match expected endpoint (%d)\n",
HTC_GET_FIELD(buf, HTC_GET_FIELD(buf,
HTC_FRAME_HDR, HTC_FRAME_HDR,
ENDPOINTID), ENDPOINTID),
@@ -591,10 +597,10 @@ static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
if (look_ahead != packet->PktInfo.AsRx.ExpectedHdr) { if (look_ahead != packet->PktInfo.AsRx.ExpectedHdr) {
/* somehow the lookahead that gave us the full read /* somehow the lookahead that gave us the full read
* length did not reflect the actual header * length did not reflect the actual header
* in the pending message */ * in the pending message
*/
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("hif_dev_process_recv_header, lookahead mismatch!" ("hif_dev_process_recv_header, lookahead mismatch! (pPkt:0x%lX flags:0x%X), 0x%08X != 0x%08X\n",
" (pPkt:0x%lX flags:0x%X), 0x%08X != 0x%08X\n",
(unsigned long)packet, (unsigned long)packet,
packet->PktInfo.AsRx.HTCRxFlags, packet->PktInfo.AsRx.HTCRxFlags,
look_ahead, look_ahead,
@@ -633,8 +639,7 @@ static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
if ((temp < sizeof(HTC_RECORD_HDR)) if ((temp < sizeof(HTC_RECORD_HDR))
|| (temp > payloadLen)) { || (temp > payloadLen)) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("hif_dev_process_recv_header, invalid header" ("hif_dev_process_recv_header, invalid header(payloadlength should be :%d, CB[0] is:%d)\n",
"(payloadlength should be :%d, CB[0] is:%d)\n",
payloadLen, temp)); payloadLen, temp));
status = QDF_STATUS_E_PROTO; status = QDF_STATUS_E_PROTO;
break; break;
@@ -645,13 +650,15 @@ static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
/* this packet was fetched as part of an HTC /* this packet was fetched as part of an HTC
* bundle as the lookahead is not valid. * bundle as the lookahead is not valid.
* Next packet may have already been fetched as * Next packet may have already been fetched as
* part of the bundle */ * part of the bundle
*/
next_look_aheads = NULL; next_look_aheads = NULL;
num_look_aheads = NULL; num_look_aheads = NULL;
} }
/* process trailer data that follows HDR and /* process trailer data that follows HDR and
* application payload */ * application payload
*/
status = hif_dev_process_trailer(pdev, status = hif_dev_process_trailer(pdev,
(buf + HTC_HDR_LENGTH + (buf + HTC_HDR_LENGTH +
payloadLen - temp), temp, payloadLen - temp), temp,
@@ -696,8 +703,8 @@ static QDF_STATUS hif_dev_issue_recv_packet_bundle(struct hif_sdio_device *pdev,
HTC_PACKET *packet, *packet_rx_bundle; HTC_PACKET *packet, *packet_rx_bundle;
HTC_TARGET *target = NULL; HTC_TARGET *target = NULL;
uint32_t padded_length; uint32_t padded_length;
int bundleSpaceRemaining = 0; int bundleSpaceRemaining = 0;
target = (HTC_TARGET *) pdev->pTarget; target = (HTC_TARGET *) pdev->pTarget;
if ((HTC_PACKET_QUEUE_DEPTH(recv_pkt_queue) - HTC_MAX_MSG_PER_BUNDLE) > if ((HTC_PACKET_QUEUE_DEPTH(recv_pkt_queue) - HTC_MAX_MSG_PER_BUNDLE) >
@@ -779,6 +786,24 @@ static QDF_STATUS hif_dev_issue_recv_packet_bundle(struct hif_sdio_device *pdev,
return status; return status;
} }
static inline void hif_dev_free_recv_pkt_queue(HTC_PACKET_QUEUE *recv_pkt_queue)
{
HTC_PACKET *packet;
qdf_nbuf_t netbuf;
while (!HTC_QUEUE_EMPTY(recv_pkt_queue)) {
packet = htc_packet_dequeue(recv_pkt_queue);
if (packet == NULL)
break;
netbuf = (qdf_nbuf_t) packet->
pNetBufContext;
if (netbuf)
qdf_nbuf_free(netbuf);
}
}
static
QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev, QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
uint8_t mail_box_index, uint8_t mail_box_index,
uint32_t msg_look_aheads[], uint32_t msg_look_aheads[],
@@ -807,7 +832,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
/* We use async mode to get the packets if the /* We use async mode to get the packets if the
* device layer supports it. The device layer * device layer supports it. The device layer
* interfaces with HIF in which HIF may have * interfaces with HIF in which HIF may have
* restrictions on how interrupts are processed */ * restrictions on how interrupts are processed
*/
asyncProc = true; asyncProc = true;
} }
@@ -832,7 +858,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
} }
/* first lookahead sets the expected endpoint IDs for /* first lookahead sets the expected endpoint IDs for
* all packets in a bundle */ * all packets in a bundle
*/
id = ((HTC_FRAME_HDR *) &look_aheads[0])->EndpointID; id = ((HTC_FRAME_HDR *) &look_aheads[0])->EndpointID;
if (id >= ENDPOINT_MAX) { if (id >= ENDPOINT_MAX) {
@@ -844,7 +871,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
} }
/* try to allocate as many HTC RX packets indicated /* try to allocate as many HTC RX packets indicated
* by the lookaheads these packets are stored * by the lookaheads these packets are stored
* in the recvPkt queue */ * in the recvPkt queue
*/
status = hif_dev_alloc_and_prepare_rx_packets(pdev, status = hif_dev_alloc_and_prepare_rx_packets(pdev,
look_aheads, look_aheads,
num_look_aheads, num_look_aheads,
@@ -854,7 +882,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
total_fetched += HTC_PACKET_QUEUE_DEPTH(&recv_pkt_queue); total_fetched += HTC_PACKET_QUEUE_DEPTH(&recv_pkt_queue);
/* we've got packet buffers for all we can currently fetch, /* we've got packet buffers for all we can currently fetch,
* this count is not valid anymore */ * this count is not valid anymore
*/
num_look_aheads = 0; num_look_aheads = 0;
partial_bundle = false; partial_bundle = false;
@@ -864,7 +893,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
pkts_fetched = 0; pkts_fetched = 0;
if ((HTC_PACKET_QUEUE_DEPTH(&recv_pkt_queue) > 1)) { if ((HTC_PACKET_QUEUE_DEPTH(&recv_pkt_queue) > 1)) {
/* there are enough packets to attempt a bundle /* there are enough packets to attempt a bundle
* transfer and recv bundling is allowed */ * transfer and recv bundling is allowed
*/
status = hif_dev_issue_recv_packet_bundle(pdev, status = hif_dev_issue_recv_packet_bundle(pdev,
&recv_pkt_queue, &recv_pkt_queue,
asyncProc ? asyncProc ?
@@ -874,19 +904,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
&pkts_fetched, &pkts_fetched,
partial_bundle); partial_bundle);
if (QDF_IS_STATUS_ERROR(status)) { if (QDF_IS_STATUS_ERROR(status)) {
while (!HTC_QUEUE_EMPTY( hif_dev_free_recv_pkt_queue(
&recv_pkt_queue)) { &recv_pkt_queue);
qdf_nbuf_t netbuf;
packet = htc_packet_dequeue(
&recv_pkt_queue);
if (packet == NULL)
break;
netbuf = (qdf_nbuf_t) packet->
pNetBufContext;
if (netbuf)
qdf_nbuf_free(netbuf);
}
break; break;
} }
@@ -894,13 +913,15 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
0) { 0) {
/* we couldn't fetch all packets at one, /* we couldn't fetch all packets at one,
* time this creates a broken * time this creates a broken
* bundle */ * bundle
*/
partial_bundle = true; partial_bundle = true;
} }
} }
/* see if the previous operation fetched any /* see if the previous operation fetched any
* packets using bundling */ * packets using bundling
*/
if (0 == pkts_fetched) { if (0 == pkts_fetched) {
/* dequeue one packet */ /* dequeue one packet */
packet = htc_packet_dequeue(&recv_pkt_queue); packet = htc_packet_dequeue(&recv_pkt_queue);
@@ -910,7 +931,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
if (HTC_PACKET_QUEUE_DEPTH(&recv_pkt_queue) > if (HTC_PACKET_QUEUE_DEPTH(&recv_pkt_queue) >
0) { 0) {
/* lookaheads in all packets except the /* lookaheads in all packets except the
* last one in must be ignored */ * last one in must be ignored
*/
packet->PktInfo.AsRx.HTCRxFlags |= packet->PktInfo.AsRx.HTCRxFlags |=
HTC_RX_PKT_IGNORE_LOOKAHEAD; HTC_RX_PKT_IGNORE_LOOKAHEAD;
} }
@@ -923,7 +945,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
if (QDF_IS_STATUS_ERROR(status)) if (QDF_IS_STATUS_ERROR(status))
break; break;
/* sent synchronously, queue this packet for /* sent synchronously, queue this packet for
* synchronous completion */ * synchronous completion
*/
HTC_PACKET_ENQUEUE(&sync_completed_pkts_queue, HTC_PACKET_ENQUEUE(&sync_completed_pkts_queue,
packet); packet);
} }
@@ -932,12 +955,14 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
/* synchronous handling */ /* synchronous handling */
if (pdev->DSRCanYield) { if (pdev->DSRCanYield) {
/* for the SYNC case, increment count that tracks /* for the SYNC case, increment count that tracks
* when the DSR should yield */ * when the DSR should yield
*/
pdev->CurrentDSRRecvCount++; pdev->CurrentDSRRecvCount++;
} }
/* in the sync case, all packet buffers are now filled, /* in the sync case, all packet buffers are now filled,
* we can process each packet, check lookahead , then repeat */ * we can process each packet, check lookahead , then repeat
*/
/* unload sync completion queue */ /* unload sync completion queue */
while (!HTC_QUEUE_EMPTY(&sync_completed_pkts_queue)) { while (!HTC_QUEUE_EMPTY(&sync_completed_pkts_queue)) {
@@ -980,7 +1005,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
} }
/* check whether other OS contexts have queued any WMI /* check whether other OS contexts have queued any WMI
* command/data for WLAN. This check is needed only if WLAN * command/data for WLAN. This check is needed only if WLAN
* Tx and Rx happens in same thread context */ * Tx and Rx happens in same thread context
*/
/* A_CHECK_DRV_TX(); */ /* A_CHECK_DRV_TX(); */
} }
if (num_pkts_fetched != NULL) if (num_pkts_fetched != NULL)
@@ -1020,7 +1046,8 @@ static QDF_STATUS hif_dev_service_cpu_interrupt(struct hif_sdio_device *pdev)
* to mitigate issues with host bus interconnects that * to mitigate issues with host bus interconnects that
* restrict bus transfer lengths to be a multiple of 4-bytes * restrict bus transfer lengths to be a multiple of 4-bytes
* set W1C value to clear the interrupt, this hits the register * set W1C value to clear the interrupt, this hits the register
* first */ * first
*/
reg_buffer[0] = cpu_int_status; reg_buffer[0] = cpu_int_status;
/* the remaining 4 values are set to zero which have no-effect */ /* the remaining 4 values are set to zero which have no-effect */
reg_buffer[1] = 0; reg_buffer[1] = 0;
@@ -1034,17 +1061,18 @@ static QDF_STATUS hif_dev_service_cpu_interrupt(struct hif_sdio_device *pdev)
A_ASSERT(status == QDF_STATUS_SUCCESS); A_ASSERT(status == QDF_STATUS_SUCCESS);
/* The Interrupt sent to the Host is generated via bit0 /* The Interrupt sent to the Host is generated via bit0
* of CPU INT register */ * of CPU INT register
*/
if (cpu_int_status & 0x1) { if (cpu_int_status & 0x1) {
if (pdev && pdev->hif_callbacks.fwEventHandler) if (pdev && pdev->hif_callbacks.fwEventHandler)
/* It calls into HTC which propagates this /* It calls into HTC which propagates this
* to ol_target_failure() */ * to ol_target_failure()
*/
pdev->hif_callbacks.fwEventHandler(pdev->hif_callbacks. pdev->hif_callbacks.fwEventHandler(pdev->hif_callbacks.
Context, QDF_STATUS_E_FAILURE); Context, QDF_STATUS_E_FAILURE);
} else } else
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("%s: Unable to call fwEventHandler," ("%s: Unable to call fwEventHandler, invalid input arguments\n",
" invalid input arguments\n",
__func__)); __func__));
return status; return status;
@@ -1092,7 +1120,8 @@ static QDF_STATUS hif_dev_service_error_interrupt(struct hif_sdio_device *pdev)
/* set up the register transfer buffer to hit the register /* set up the register transfer buffer to hit the register
* 4 times , this is done to make the access 4-byte * 4 times , this is done to make the access 4-byte
* aligned to mitigate issues with host bus interconnects that * aligned to mitigate issues with host bus interconnects that
* restrict bus transfer lengths to be a multiple of 4-bytes */ * restrict bus transfer lengths to be a multiple of 4-bytes
*/
/* set W1C value to clear the interrupt */ /* set W1C value to clear the interrupt */
reg_buffer[0] = error_int_status; reg_buffer[0] = error_int_status;
@@ -1125,9 +1154,9 @@ static QDF_STATUS hif_dev_service_debug_interrupt(struct hif_sdio_device *pdev)
/* Send a target failure event to the application */ /* Send a target failure event to the application */
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Target debug interrupt\n")); AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Target debug interrupt\n"));
/* clear the interrupt , the debug error interrupt is /* clear the interrupt , the debug error interrupt is counter 0
* counter 0 */ * read counter to clear interrupt
/* read counter to clear interrupt */ */
status = hif_read_write(pdev->HIFDevice, status = hif_read_write(pdev->HIFDevice,
COUNT_DEC_ADDRESS, COUNT_DEC_ADDRESS,
(uint8_t *) &dummy, (uint8_t *) &dummy,
@@ -1162,7 +1191,8 @@ QDF_STATUS hif_dev_service_counter_interrupt(struct hif_sdio_device *pdev)
/* Check if the debug interrupt is pending /* Check if the debug interrupt is pending
* NOTE: other modules like GMBOX may use the counter interrupt * NOTE: other modules like GMBOX may use the counter interrupt
* for credit flow control on other counters, we only need to * for credit flow control on other counters, we only need to
* check for the debug assertion counter interrupt */ * check for the debug assertion counter interrupt
*/
if (counter_int_status & AR6K_TARGET_DEBUG_INTR_MASK) if (counter_int_status & AR6K_TARGET_DEBUG_INTR_MASK)
return hif_dev_service_debug_interrupt(pdev); return hif_dev_service_debug_interrupt(pdev);
@@ -1196,14 +1226,16 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
* of this call allows us to perform SYNCHRONOUS I/O, * of this call allows us to perform SYNCHRONOUS I/O,
* that is we can block, sleep or call any API that * that is we can block, sleep or call any API that
* can block or switch thread/task ontexts. * can block or switch thread/task ontexts.
* This is a fully schedulable context. */ * This is a fully schedulable context.
*/
do { do {
if (pdev->IrqEnableRegisters.int_status_enable == 0) { if (pdev->IrqEnableRegisters.int_status_enable == 0) {
/* interrupt enables have been cleared, do not try /* interrupt enables have been cleared, do not try
* to process any pending interrupts that * to process any pending interrupts that
* may result in more bus transactions. * may result in more bus transactions.
* The target may be unresponsive at this point. */ * The target may be unresponsive at this point.
*/
break; break;
} }
status = hif_read_write(pdev->HIFDevice, status = hif_read_write(pdev->HIFDevice,
@@ -1228,18 +1260,21 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
/* only look at mailbox status if the HIF layer did not /* only look at mailbox status if the HIF layer did not
* provide this function, on some HIF interfaces reading * provide this function, on some HIF interfaces reading
* the RX lookahead is not valid to do */ * the RX lookahead is not valid to do
*/
for (i = 0; i < MAILBOX_USED_COUNT; i++) { for (i = 0; i < MAILBOX_USED_COUNT; i++) {
look_ahead[i] = 0; look_ahead[i] = 0;
if (host_int_status & (1 << i)) { if (host_int_status & (1 << i)) {
/* mask out pending mailbox value, we use /* mask out pending mailbox value, we use
* "lookAhead" as the real flag for * "lookAhead" as the real flag for
* mailbox processing below */ * mailbox processing below
*/
host_int_status &= ~(1 << i); host_int_status &= ~(1 << i);
if (pdev->IrqProcRegisters. if (pdev->IrqProcRegisters.
rx_lookahead_valid & (1 << i)) { rx_lookahead_valid & (1 << i)) {
/* mailbox has a message and the /* mailbox has a message and the
* look ahead is valid */ * look ahead is valid
*/
look_ahead[i] = look_ahead[i] =
pdev-> pdev->
IrqProcRegisters.rx_lookahead[ IrqProcRegisters.rx_lookahead[
@@ -1265,7 +1300,8 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
if ((0 == host_int_status) && !bLookAheadValid) { if ((0 == host_int_status) && !bLookAheadValid) {
/* nothing to process, the caller can use this /* nothing to process, the caller can use this
* to break out of a loop */ * to break out of a loop
*/
*done = true; *done = true;
break; break;
} }
@@ -1273,6 +1309,7 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
if (bLookAheadValid) { if (bLookAheadValid) {
for (i = 0; i < MAILBOX_USED_COUNT; i++) { for (i = 0; i < MAILBOX_USED_COUNT; i++) {
int fetched = 0; int fetched = 0;
if (look_ahead[i] == 0) if (look_ahead[i] == 0)
continue; continue;
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,
@@ -1285,7 +1322,8 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
* routine of the callers read request. * routine of the callers read request.
* This can improve performance by reducing * This can improve performance by reducing
* the context switching when we rapidly * the context switching when we rapidly
* pull packets */ * pull packets
*/
status = hif_dev_recv_message_pending_handler( status = hif_dev_recv_message_pending_handler(
pdev, i, pdev, i,
&look_ahead &look_ahead
@@ -1298,7 +1336,8 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
if (!fetched) { if (!fetched) {
/* HTC could not pull any messages out /* HTC could not pull any messages out
* due to lack of resources force DSR * due to lack of resources force DSR
* handle to ack the interrupt */ * handle to ack the interrupt
*/
*async_processing = false; *async_processing = false;
pdev->RecheckIRQStatusCnt = 0; pdev->RecheckIRQStatusCnt = 0;
} }
@@ -1343,7 +1382,8 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
* GetPendingEventsFunc, this optimization cannot be used due to * GetPendingEventsFunc, this optimization cannot be used due to
* possible side-effects. For example, SPI requires the host * possible side-effects. For example, SPI requires the host
* to drain all messages from the mailbox before exiting * to drain all messages from the mailbox before exiting
* the ISR routine. */ * the ISR routine.
*/
if (!(*async_processing) && (pdev->RecheckIRQStatusCnt == 0)) { if (!(*async_processing) && (pdev->RecheckIRQStatusCnt == 0)) {
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,
("Bypassing IRQ Status re-check, forcing done\n")); ("Bypassing IRQ Status re-check, forcing done\n"));
@@ -1380,10 +1420,12 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
(unsigned long)pdev)); (unsigned long)pdev));
/* reset the recv counter that tracks when we need /* reset the recv counter that tracks when we need
* to yield from the DSR */ * to yield from the DSR
*/
pdev->CurrentDSRRecvCount = 0; pdev->CurrentDSRRecvCount = 0;
/* reset counter used to flag a re-scan of IRQ /* reset counter used to flag a re-scan of IRQ
* status registers on the target */ * status registers on the target
*/
pdev->RecheckIRQStatusCnt = 0; pdev->RecheckIRQStatusCnt = 0;
while (!done) { while (!done) {
@@ -1393,19 +1435,22 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
if (HIF_DEVICE_IRQ_SYNC_ONLY == pdev->HifIRQProcessingMode) { if (HIF_DEVICE_IRQ_SYNC_ONLY == pdev->HifIRQProcessingMode) {
/* the HIF layer does not allow async IRQ processing, /* the HIF layer does not allow async IRQ processing,
* override the asyncProc flag */ * override the asyncProc flag
*/
async_proc = false; async_proc = false;
/* this will cause us to re-enter ProcessPendingIRQ() /* this will cause us to re-enter ProcessPendingIRQ()
* and re-read interrupt status registers. * and re-read interrupt status registers.
* This has a nice side effect of blocking us until all * This has a nice side effect of blocking us until all
* async read requests are completed. This behavior is * async read requests are completed. This behavior is
* required as we do not allow ASYNC processing * required as we do not allow ASYNC processing
* in interrupt handlers (like Windows CE) */ * in interrupt handlers (like Windows CE)
*/
if (pdev->DSRCanYield && DEV_CHECK_RECV_YIELD(pdev)) if (pdev->DSRCanYield && DEV_CHECK_RECV_YIELD(pdev))
/* ProcessPendingIRQs() pulled enough recv /* ProcessPendingIRQs() pulled enough recv
* messages to satisfy the yield count, stop * messages to satisfy the yield count, stop
* checking for more messages and return */ * checking for more messages and return
*/
break; break;
} }
@@ -1413,7 +1458,8 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
/* the function does some async I/O for performance, /* the function does some async I/O for performance,
* we need to exit the ISR immediately, the check below * we need to exit the ISR immediately, the check below
* will prevent the interrupt from being * will prevent the interrupt from being
* Ack'd while we handle it asynchronously */ * Ack'd while we handle it asynchronously
*/
break; break;
} }
@@ -1422,11 +1468,13 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
if (QDF_IS_STATUS_SUCCESS(status) && !async_proc) { if (QDF_IS_STATUS_SUCCESS(status) && !async_proc) {
/* Ack the interrupt only if : /* Ack the interrupt only if :
* 1. we did not get any errors in processing interrupts * 1. we did not get any errors in processing interrupts
* 2. there are no outstanding async processing requests */ * 2. there are no outstanding async processing requests
*/
if (pdev->DSRCanYield) { if (pdev->DSRCanYield) {
/* if the DSR can yield do not ACK the interrupt, there /* if the DSR can yield do not ACK the interrupt, there
* could be more pending messages. The HIF layer * could be more pending messages. The HIF layer
* must ACK the interrupt on behalf of HTC */ * must ACK the interrupt on behalf of HTC
*/
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,
(" Yield in effect (cur RX count: %d)\n", (" Yield in effect (cur RX count: %d)\n",
pdev->CurrentDSRRecvCount)); pdev->CurrentDSRRecvCount));
@@ -1440,3 +1488,4 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("-DevDsrHandler\n")); AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("-DevDsrHandler\n"));
return status; return status;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
* *
* Previously licensed under the ISC license by Qualcomm Atheros, Inc. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
* *
@@ -122,7 +122,8 @@ QDF_STATUS hif_dev_send_buffer(struct hif_sdio_device *pdev,
if (frag_count > 1) { if (frag_count > 1) {
/* header data length should be total sending length substract /* header data length should be total sending length substract
* internal data length of netbuf */ * internal data length of netbuf
*/
head_data_len = sizeof(struct hif_sendContext) + head_data_len = sizeof(struct hif_sendContext) +
(nbytes - qdf_nbuf_get_frag_len(buf, frag_count - 1)); (nbytes - qdf_nbuf_get_frag_len(buf, frag_count - 1));
} else { } else {
@@ -162,6 +163,7 @@ QDF_STATUS hif_dev_send_buffer(struct hif_sdio_device *pdev,
i++) { i++) {
int frag_len = qdf_nbuf_get_frag_len(buf, i); int frag_len = qdf_nbuf_get_frag_len(buf, i);
unsigned char *frag_addr = qdf_nbuf_get_frag_vaddr(buf, i); unsigned char *frag_addr = qdf_nbuf_get_frag_vaddr(buf, i);
if (frag_len > nbytes) if (frag_len > nbytes)
frag_len = nbytes; frag_len = nbytes;
memcpy(pData, frag_addr, frag_len); memcpy(pData, frag_addr, frag_len);

View File

@@ -62,11 +62,11 @@
#endif /* ATH_BUS_PM */ #endif /* ATH_BUS_PM */
#ifndef REMOVE_PKT_LOG #ifndef REMOVE_PKT_LOG
struct ol_pl_os_dep_funcs *g_ol_pl_os_dep_funcs = NULL; struct ol_pl_os_dep_funcs *g_ol_pl_os_dep_funcs;
#endif #endif
#define HIF_SDIO_LOAD_TIMEOUT 1000 #define HIF_SDIO_LOAD_TIMEOUT 1000
struct hif_sdio_softc *scn = NULL; struct hif_sdio_softc *scn;
struct hif_softc *ol_sc; struct hif_softc *ol_sc;
static atomic_t hif_sdio_load_state; static atomic_t hif_sdio_load_state;
/* Wait queue for MC thread */ /* Wait queue for MC thread */
@@ -86,8 +86,8 @@ static A_STATUS hif_sdio_probe(void *context, void *hif_handle)
struct sdio_func *func = NULL; struct sdio_func *func = NULL;
const struct sdio_device_id *id; const struct sdio_device_id *id;
uint32_t target_type; uint32_t target_type;
HIF_ENTER();
HIF_ENTER();
scn = (struct hif_sdio_softc *)qdf_mem_malloc(sizeof(*scn)); scn = (struct hif_sdio_softc *)qdf_mem_malloc(sizeof(*scn));
if (!scn) { if (!scn) {
ret = -ENOMEM; ret = -ENOMEM;
@@ -141,6 +141,7 @@ static A_STATUS hif_sdio_probe(void *context, void *hif_handle)
} else if ((id->device & MANUFACTURER_ID_AR6K_BASE_MASK) == } else if ((id->device & MANUFACTURER_ID_AR6K_BASE_MASK) ==
MANUFACTURER_ID_AR6320_BASE) { MANUFACTURER_ID_AR6320_BASE) {
int ar6kid = id->device & MANUFACTURER_ID_AR6K_REV_MASK; int ar6kid = id->device & MANUFACTURER_ID_AR6K_REV_MASK;
if (ar6kid >= 1) { if (ar6kid >= 1) {
/* v2 or higher silicon */ /* v2 or higher silicon */
hif_register_tbl_attach(ol_sc, hif_register_tbl_attach(ol_sc,
@@ -304,8 +305,8 @@ static int init_ath_hif_sdio(void)
static int probed; static int probed;
QDF_STATUS status; QDF_STATUS status;
struct osdrv_callbacks osdrv_callbacks; struct osdrv_callbacks osdrv_callbacks;
HIF_ENTER();
HIF_ENTER();
qdf_mem_zero(&osdrv_callbacks, sizeof(osdrv_callbacks)); qdf_mem_zero(&osdrv_callbacks, sizeof(osdrv_callbacks));
osdrv_callbacks.device_inserted_handler = hif_sdio_probe; osdrv_callbacks.device_inserted_handler = hif_sdio_probe;
osdrv_callbacks.device_removed_handler = hif_sdio_remove; osdrv_callbacks.device_removed_handler = hif_sdio_remove;
@@ -487,8 +488,7 @@ QDF_STATUS hif_sdio_enable_bus(struct hif_softc *hif_sc,
init_waitqueue_head(&sync_wait_queue); init_waitqueue_head(&sync_wait_queue);
if (hif_sdio_device_inserted(dev, id)) { if (hif_sdio_device_inserted(dev, id)) {
HIF_ERROR("wlan: %s hif_sdio_device_inserted" HIF_ERROR("wlan: %s hif_sdio_device_inserted failed", __func__);
"failed", __func__);
return QDF_STATUS_E_NOMEM; return QDF_STATUS_E_NOMEM;
} }
@@ -557,8 +557,8 @@ void hif_sdio_set_mailbox_swap(struct hif_softc *hif_sc)
{ {
struct hif_sdio_softc *scn = HIF_GET_SDIO_SOFTC(hif_sc); struct hif_sdio_softc *scn = HIF_GET_SDIO_SOFTC(hif_sc);
struct hif_sdio_dev *hif_device = scn->hif_handle; struct hif_sdio_dev *hif_device = scn->hif_handle;
hif_device->swap_mailbox = true; hif_device->swap_mailbox = true;
return;
} }
/** /**
@@ -571,8 +571,8 @@ void hif_sdio_claim_device(struct hif_softc *hif_sc)
{ {
struct hif_sdio_softc *scn = HIF_GET_SDIO_SOFTC(hif_sc); struct hif_sdio_softc *scn = HIF_GET_SDIO_SOFTC(hif_sc);
struct hif_sdio_dev *hif_device = scn->hif_handle; struct hif_sdio_dev *hif_device = scn->hif_handle;
hif_device->claimed_ctx = hif_sc; hif_device->claimed_ctx = hif_sc;
return;
} }
/** /**
@@ -585,8 +585,8 @@ void hif_sdio_mask_interrupt_call(struct hif_softc *scn)
{ {
struct hif_sdio_softc *hif_ctx = HIF_GET_SDIO_SOFTC(scn); struct hif_sdio_softc *hif_ctx = HIF_GET_SDIO_SOFTC(scn);
struct hif_sdio_dev *hif_device = hif_ctx->hif_handle; struct hif_sdio_dev *hif_device = hif_ctx->hif_handle;
hif_mask_interrupt(hif_device); hif_mask_interrupt(hif_device);
return;
} }
/** /**

View File

@@ -76,7 +76,6 @@ static inline int athdiag_procfs_init(void *scn)
static inline void athdiag_procfs_remove(void) static inline void athdiag_procfs_remove(void)
{ {
return;
} }
#endif #endif

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
* *
* Previously licensed under the ISC license by Qualcomm Atheros, Inc. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
* *
@@ -232,30 +232,35 @@ struct hif_mailbox_properties {
}; };
struct hif_device_irq_yield_params { struct hif_device_irq_yield_params {
int recv_packet_yield_count; /* max number of packets to force DSR int recv_packet_yield_count;
to return */ /* max number of packets to force DSR to return */
}; };
struct hif_device_mbox_info { struct hif_device_mbox_info {
u_int32_t mbox_addresses[4]; /*first element for legacy HIFs and u_int32_t mbox_addresses[4];
return the address and ARRAY of 32bit words */ /* first element for legacy HIFs and return the address and ARRAY of
* 32bit words
*/
struct hif_mailbox_properties mbox_prop[4]; struct hif_mailbox_properties mbox_prop[4];
u_int32_t gmbox_address; u_int32_t gmbox_address;
u_int32_t gmbox_size; u_int32_t gmbox_size;
u_int32_t flags; /* flags to describe mbox behavior or usage */ u_int32_t flags;
/* flags to describe mbox behavior or usage */
}; };
enum hif_device_irq_mode { enum hif_device_irq_mode {
HIF_DEVICE_IRQ_SYNC_ONLY, /* DSR to process all HIF_DEVICE_IRQ_SYNC_ONLY,
* interrupts before returning */ /* DSR to process all interrupts before returning */
HIF_DEVICE_IRQ_ASYNC_SYNC, /* DSR to process interrupts */ HIF_DEVICE_IRQ_ASYNC_SYNC, /* DSR to process interrupts */
}; };
struct osdrv_callbacks { struct osdrv_callbacks {
void *context; /* context to pass for all callbacks void *context;
* except device_removed_handler /* context to pass for all callbacks
* the device_removed_handler is only * except device_removed_handler
* called if the device is claimed */ * the device_removed_handler is only
* called if the device is claimed
*/
int (*device_inserted_handler)(void *context, void *hif_handle); int (*device_inserted_handler)(void *context, void *hif_handle);
int (*device_removed_handler)(void *claimed_ctx, int (*device_removed_handler)(void *claimed_ctx,
void *hif_handle); void *hif_handle);
@@ -349,8 +354,8 @@ struct _HIF_SCATTER_REQ {
struct _HIF_SCATTER_ITEM scatter_list[1]; /* start of scatter list */ struct _HIF_SCATTER_ITEM scatter_list[1]; /* start of scatter list */
}; };
typedef struct typedef struct _HIF_SCATTER_REQ * (*HIF_ALLOCATE_SCATTER_REQUEST)(
_HIF_SCATTER_REQ * (*HIF_ALLOCATE_SCATTER_REQUEST)(struct hif_sdio_dev *device); struct hif_sdio_dev *device);
typedef void (*HIF_FREE_SCATTER_REQUEST)(struct hif_sdio_dev *device, typedef void (*HIF_FREE_SCATTER_REQUEST)(struct hif_sdio_dev *device,
struct _HIF_SCATTER_REQ *request); struct _HIF_SCATTER_REQ *request);
typedef QDF_STATUS (*HIF_READWRITE_SCATTER)(struct hif_sdio_dev *device, typedef QDF_STATUS (*HIF_READWRITE_SCATTER)(struct hif_sdio_dev *device,

View File

@@ -49,7 +49,8 @@
/* by default setup a bounce buffer for the data packets, /* by default setup a bounce buffer for the data packets,
* if the underlying host controller driver * if the underlying host controller driver
* does not use DMA you may be able to skip this step * does not use DMA you may be able to skip this step
* and save the memory allocation and transfer time */ * and save the memory allocation and transfer time
*/
#define HIF_USE_DMA_BOUNCE_BUFFER 1 #define HIF_USE_DMA_BOUNCE_BUFFER 1
#define ATH_MODULE_NAME hif #define ATH_MODULE_NAME hif
#include "a_debug.h" #include "a_debug.h"
@@ -75,74 +76,70 @@
request->address < 0x1FFFF)) request->address < 0x1FFFF))
#endif #endif
extern struct hif_sdio_softc *sc; unsigned int mmcbuswidth;
/* PERM:S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH */
unsigned int mmcbuswidth = 0; module_param(mmcbuswidth, uint, 0644);
module_param(mmcbuswidth, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(mmcbuswidth, MODULE_PARM_DESC(mmcbuswidth,
"Set MMC driver Bus Width: 1-1Bit, 4-4Bit, 8-8Bit"); "Set MMC driver Bus Width: 1-1Bit, 4-4Bit, 8-8Bit");
unsigned int mmcclock = 0; unsigned int mmcclock;
module_param(mmcclock, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(mmcclock, uint, 0644);
MODULE_PARM_DESC(mmcclock, "Set MMC driver Clock value"); MODULE_PARM_DESC(mmcclock, "Set MMC driver Clock value");
unsigned int brokenirq = 0; unsigned int brokenirq;
module_param(brokenirq, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(brokenirq, uint, 0644);
MODULE_PARM_DESC(brokenirq, MODULE_PARM_DESC(brokenirq,
"Set as 1 to use polling method instead of interrupt mode"); "Set as 1 to use polling method instead of interrupt mode");
unsigned int forcesleepmode = 0; unsigned int forcesleepmode;
module_param(forcesleepmode, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(forcesleepmode, uint, 0644);
MODULE_PARM_DESC(forcesleepmode, MODULE_PARM_DESC(forcesleepmode,
"Set sleep mode: 0-host capbility, " "Set sleep mode: 0-host capbility, 1-force WOW, 2-force DeepSleep, 3-force CutPower");
"1-force WOW, 2-force DeepSleep, 3-force CutPower");
#ifdef CONFIG_X86 #ifdef CONFIG_X86
unsigned int asyncintdelay = 2; unsigned int asyncintdelay = 2;
module_param(asyncintdelay, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(asyncintdelay, uint, 0644);
MODULE_PARM_DESC(asyncintdelay, MODULE_PARM_DESC(asyncintdelay,
"Delay clock count for aysnc interrupt, " "Delay clock count for async interrupt, 2 is default, valid values are 1 and 2");
"2 is default, vaild values are 1 and 2");
#else #else
unsigned int asyncintdelay = 0; unsigned int asyncintdelay;
module_param(asyncintdelay, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(asyncintdelay, uint, 0644);
MODULE_PARM_DESC(asyncintdelay, MODULE_PARM_DESC(asyncintdelay,
"Delay clock count for aysnc interrupt, " "Delay clock count for async interrupt, 0 is default, valid values are 1 and 2");
"0 is default, vaild values are 1 and 2");
#endif #endif
unsigned int forcecard = 0; unsigned int forcecard;
module_param(forcecard, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(forcecard, uint, 0644);
MODULE_PARM_DESC(forcecard, MODULE_PARM_DESC(forcecard,
"Ignore card capabilities information to switch bus mode"); "Ignore card capabilities information to switch bus mode");
unsigned int debugcccr = 1; unsigned int debugcccr = 1;
module_param(debugcccr, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(debugcccr, uint, 0644);
MODULE_PARM_DESC(debugcccr, "Output this cccr values"); MODULE_PARM_DESC(debugcccr, "Output this cccr values");
unsigned int writecccr1 = 0; unsigned int writecccr1;
module_param(writecccr1, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(writecccr1, uint, 0644);
unsigned int writecccr1value = 0; unsigned int writecccr1value;
module_param(writecccr1value, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(writecccr1value, uint, 0644);
unsigned int writecccr2 = 0; unsigned int writecccr2;
module_param(writecccr2, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(writecccr2, uint, 0644);
unsigned int writecccr2value = 0; unsigned int writecccr2value;
module_param(writecccr2value, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(writecccr2value, uint, 0644);
unsigned int writecccr3 = 0; unsigned int writecccr3;
module_param(writecccr3, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(writecccr3, uint, 0644);
unsigned int writecccr3value = 0; unsigned int writecccr3value;
module_param(writecccr3value, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(writecccr3value, uint, 0644);
unsigned int writecccr4 = 0; unsigned int writecccr4;
module_param(writecccr4, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(writecccr4, uint, 0644);
unsigned int writecccr4value = 0; unsigned int writecccr4value;
module_param(writecccr4value, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(writecccr4value, uint, 0644);
unsigned int modstrength = 0; unsigned int modstrength;
module_param(modstrength, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); module_param(modstrength, uint, 0644);
MODULE_PARM_DESC(modstrength, "Adjust internal driver strength"); MODULE_PARM_DESC(modstrength, "Adjust internal driver strength");
#define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev) #define dev_to_sdio_func(d) container_of(d, struct sdio_func, dev)
@@ -158,7 +155,7 @@ static int func0_cmd52_write_byte(struct mmc_card *card, unsigned int address,
static int func0_cmd52_read_byte(struct mmc_card *card, unsigned int address, static int func0_cmd52_read_byte(struct mmc_card *card, unsigned int address,
unsigned char *byte); unsigned char *byte);
int reset_sdio_on_unload = 0; int reset_sdio_on_unload;
module_param(reset_sdio_on_unload, int, 0644); module_param(reset_sdio_on_unload, int, 0644);
uint32_t nohifscattersupport = 1; uint32_t nohifscattersupport = 1;
@@ -315,10 +312,9 @@ QDF_STATUS hif_init(struct osdrv_callbacks *callbacks)
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("%s sdio_register_driver failed!", __func__)); ("%s sdio_register_driver failed!", __func__));
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} else {
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s sdio_register_driver successful", __func__));
} }
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s sdio_register_driver successful", __func__));
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
@@ -389,6 +385,7 @@ __hif_read_write(struct hif_sdio_dev *device,
if (request & HIF_SDIO_WRITE) { if (request & HIF_SDIO_WRITE) {
struct hif_device_mbox_info MailBoxInfo; struct hif_device_mbox_info MailBoxInfo;
unsigned int mboxLength = 0; unsigned int mboxLength = 0;
hif_configure_device(device, hif_configure_device(device,
HIF_DEVICE_GET_MBOX_ADDR, HIF_DEVICE_GET_MBOX_ADDR,
&MailBoxInfo, sizeof(MailBoxInfo)); &MailBoxInfo, sizeof(MailBoxInfo));
@@ -416,8 +413,7 @@ __hif_read_write(struct hif_sdio_dev *device,
break; break;
} }
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("address:%08X, Length:0x%08X, Dummy:0x%04X, " ("address:%08X, Length:0x%08X, Dummy:0x%04X, Final:0x%08X\n",
"Final:0x%08X\n",
address, length, address, length,
(request & HIF_DUMMY_SPACE_MASK) >> 16, (request & HIF_DUMMY_SPACE_MASK) >> 16,
mboxLength == mboxLength ==
@@ -426,8 +422,7 @@ __hif_read_write(struct hif_sdio_dev *device,
if (mboxLength != 0) { if (mboxLength != 0) {
if (length > mboxLength) { if (length > mboxLength) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("%s: written length(0x%08X) " ("%s: written length(0x%08X) larger than mbox len(0x%08x)\n",
"larger than mbox len(0x%08x)\n",
__func__, length, mboxLength)); __func__, length, mboxLength));
break; break;
} }
@@ -467,8 +462,8 @@ __hif_read_write(struct hif_sdio_dev *device,
AR_DEBUG_ASSERT(length <= HIF_DMA_BUFFER_SIZE); AR_DEBUG_ASSERT(length <= HIF_DMA_BUFFER_SIZE);
if (length > HIF_DMA_BUFFER_SIZE) { if (length > HIF_DMA_BUFFER_SIZE) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("%s: Invalid write length:" ("%s: Invalid write length: %d\n",
"%d\n", __func__, length)); __func__, length));
status = QDF_STATUS_E_INVAL; status = QDF_STATUS_E_INVAL;
break; break;
} }
@@ -486,8 +481,7 @@ __hif_read_write(struct hif_sdio_dev *device,
tbuffer, tbuffer,
length); length);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: writesb ret=%d address:" ("%s: writesb ret=%d address: 0x%X, len: %d, 0x%X\n",
" 0x%X, len: %d, 0x%X\n",
__func__, ret, address, length, __func__, ret, address, length,
*(int *)tbuffer)); *(int *)tbuffer));
} else { } else {
@@ -495,8 +489,7 @@ __hif_read_write(struct hif_sdio_dev *device,
sdio_memcpy_toio(device->func, address, sdio_memcpy_toio(device->func, address,
tbuffer, length); tbuffer, length);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: writeio ret=%d address: " ("%s: writeio ret=%d address: 0x%X, len: %d, 0x%X\n",
" 0x%X, len: %d, 0x%X\n",
__func__, ret, address, length, __func__, ret, address, length,
*(int *)tbuffer)); *(int *)tbuffer));
} }
@@ -526,8 +519,7 @@ __hif_read_write(struct hif_sdio_dev *device,
address, address,
length); length);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: readsb ret=%d address:" ("%s: readsb ret=%d address: 0x%X, len: %d, 0x%X\n",
" 0x%X, len: %d, 0x%X\n",
__func__, ret, address, length, __func__, ret, address, length,
*(int *)tbuffer)); *(int *)tbuffer));
} else { } else {
@@ -536,8 +528,7 @@ __hif_read_write(struct hif_sdio_dev *device,
tbuffer, tbuffer,
address, length); address, length);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: readio ret=%d address: 0x%X," ("%s: readio ret=%d address: 0x%X, len: %d, 0x%X\n",
" len: %d, 0x%X\n",
__func__, ret, address, length, __func__, ret, address, length,
*(int *)tbuffer)); *(int *)tbuffer));
} }
@@ -555,12 +546,10 @@ __hif_read_write(struct hif_sdio_dev *device,
if (ret) { if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("%s: SDIO bus operation failed! " ("%s: SDIO bus operation failed! MMC stack returned : %d\n",
"MMC stack returned : %d\n",
__func__, ret)); __func__, ret));
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("__hif_read_write, addr:0X%06X, " ("__hif_read_write, addr:0X%06X, len:%08d, %s, %s\n",
"len:%08d, %s, %s\n",
address, length, address, length,
request & HIF_SDIO_READ ? "Read " : "Write", request & HIF_SDIO_READ ? "Read " : "Write",
request & HIF_ASYNCHRONOUS ? "Async" : request & HIF_ASYNCHRONOUS ? "Async" :
@@ -624,8 +613,7 @@ hif_read_write(struct hif_sdio_dev *device,
AR_DEBUG_ASSERT(device != NULL); AR_DEBUG_ASSERT(device != NULL);
AR_DEBUG_ASSERT(device->func != NULL); AR_DEBUG_ASSERT(device->func != NULL);
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: device 0x%p addr 0x%X buffer 0x%p " ("%s: device 0x%p addr 0x%X buffer 0x%p len %d req 0x%X context 0x%p",
"len %d req 0x%X context 0x%p",
__func__, device, address, buffer, __func__, device, address, buffer,
length, request, context)); length, request, context));
@@ -646,8 +634,7 @@ hif_read_write(struct hif_sdio_dev *device,
busrequest = hif_allocate_bus_request(device); busrequest = hif_allocate_bus_request(device);
if (busrequest == NULL) { if (busrequest == NULL) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("no async bus requests " ("no async bus requests available (%s, addr:0x%X, len:%d)\n",
"available (%s, addr:0x%X, len:%d)\n",
request & HIF_SDIO_READ ? "READ" : request & HIF_SDIO_READ ? "READ" :
"WRITE", address, length)); "WRITE", address, length));
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
@@ -673,6 +660,7 @@ hif_read_write(struct hif_sdio_dev *device,
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} else { } else {
QDF_STATUS status = busrequest->status; QDF_STATUS status = busrequest->status;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: sync return freeing 0x%lX: 0x%X\n", ("%s: sync return freeing 0x%lX: 0x%X\n",
__func__, __func__,
@@ -741,7 +729,8 @@ static int async_task(void *param)
} }
/* we want to hold the host over multiple cmds /* we want to hold the host over multiple cmds
* if possible, but holding the host blocks * if possible, but holding the host blocks
* card interrupts */ * card interrupts
*/
sdio_claim_host(device->func); sdio_claim_host(device->func);
qdf_spin_lock_irqsave(&device->asynclock); qdf_spin_lock_irqsave(&device->asynclock);
/* pull the request to work on */ /* pull the request to work on */
@@ -761,7 +750,8 @@ static int async_task(void *param)
/* pass the request to scatter routine which /* pass the request to scatter routine which
* executes it synchronously, note, no need * executes it synchronously, note, no need
* to free the request since scatter requests * to free the request since scatter requests
* are maintained on a separate list */ * are maintained on a separate list
*/
status = do_hif_read_write_scatter(device, status = do_hif_read_write_scatter(device,
request); request);
} else { } else {
@@ -777,6 +767,7 @@ static int async_task(void *param)
NULL); NULL);
if (request->request & HIF_ASYNCHRONOUS) { if (request->request & HIF_ASYNCHRONOUS) {
void *context = request->context; void *context = request->context;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: freeing req: 0x%lX\n", ("%s: freeing req: 0x%lX\n",
__func__, (unsigned long) __func__, (unsigned long)
@@ -892,8 +883,7 @@ QDF_STATUS reinit_sdio(struct hif_sdio_dev *device)
&cmd52_resp); &cmd52_resp);
if (err) { if (err) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("%s: CMD52 read to CCCR speed " ("%s: CMD52 read to CCCR speed register failed : %d\n",
"register failed : %d\n",
__func__, err)); __func__, err));
sdio_card_state(card); sdio_card_state(card);
/* no need to break */ /* no need to break */
@@ -903,8 +893,7 @@ QDF_STATUS reinit_sdio(struct hif_sdio_dev *device)
(cmd52_resp | SDIO_SPEED_EHS)); (cmd52_resp | SDIO_SPEED_EHS));
if (err) { if (err) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("%s: CMD52 write to CCCR speed" ("%s: CMD52 write to CCCR speed register failed : %d\n",
" register failed : %d\n",
__func__, err)); __func__, err));
break; break;
} }
@@ -940,8 +929,7 @@ QDF_STATUS reinit_sdio(struct hif_sdio_dev *device)
SDIO_BUS_CD_DISABLE | SDIO_BUS_WIDTH_4BIT); SDIO_BUS_CD_DISABLE | SDIO_BUS_WIDTH_4BIT);
if (err) { if (err) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("%s: CMD52 to set bus mode " ("%s: CMD52 to set bus mode failed : %d\n",
"failed : %d\n",
__func__, err)); __func__, err));
break; break;
} }
@@ -982,7 +970,8 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable)
device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK; device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK;
/* Re-enable 4-bit ASYNC interrupt on AR6003x /* Re-enable 4-bit ASYNC interrupt on AR6003x
* after system resume for some host controller */ * after system resume for some host controller
*/
if (manufacturer_id == MANUFACTURER_ID_AR6003_BASE) { if (manufacturer_id == MANUFACTURER_ID_AR6003_BASE) {
setAsyncIRQ = 1; setAsyncIRQ = 1;
ret = ret =
@@ -994,6 +983,7 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable)
} else if (manufacturer_id == MANUFACTURER_ID_AR6320_BASE } else if (manufacturer_id == MANUFACTURER_ID_AR6320_BASE
|| manufacturer_id == MANUFACTURER_ID_QCA9377_BASE) { || manufacturer_id == MANUFACTURER_ID_QCA9377_BASE) {
unsigned char data = 0; unsigned char data = 0;
setAsyncIRQ = 1; setAsyncIRQ = 1;
ret = ret =
func0_cmd52_read_byte(func->card, func0_cmd52_read_byte(func->card,
@@ -1001,8 +991,7 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable)
&data); &data);
if (ret) { if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("%s: failed to read interrupt " ("%s: failed to read interrupt extension register %d\n",
"extension register %d\n",
__func__, ret)); __func__, ret));
sdio_release_host(func); sdio_release_host(func);
return ret; return ret;
@@ -1019,13 +1008,11 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable)
if (setAsyncIRQ) { if (setAsyncIRQ) {
if (ret) { if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("%s: failed to setup 4-bit " ("%s: failed to setup 4-bit ASYNC IRQ mode into %d err %d\n",
"ASYNC IRQ mode into %d err %d\n",
__func__, enable, ret)); __func__, enable, ret));
} else { } else {
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
("%s: Setup 4-bit ASYNC " ("%s: Setup 4-bit ASYNC IRQ mode into %d successfully\n",
"IRQ mode into %d successfully\n",
__func__, enable)); __func__, enable));
} }
} }
@@ -1056,7 +1043,8 @@ power_state_change_notify(struct hif_sdio_dev *device,
switch (config) { switch (config) {
case HIF_DEVICE_POWER_DOWN: case HIF_DEVICE_POWER_DOWN:
/* Disable 4bits to allow SDIO bus to detect /* Disable 4bits to allow SDIO bus to detect
* DAT1 as interrupt source */ * DAT1 as interrupt source
*/
sdio_enable4bits(device, 0); sdio_enable4bits(device, 0);
break; break;
case HIF_DEVICE_POWER_CUT: case HIF_DEVICE_POWER_CUT:
@@ -1075,7 +1063,8 @@ power_state_change_notify(struct hif_sdio_dev *device,
status = reinit_sdio(device); status = reinit_sdio(device);
/* set power_config before EnableFunc to /* set power_config before EnableFunc to
* passthrough sdio r/w action when resuming * passthrough sdio r/w action when resuming
* from cut power */ * from cut power
*/
device->power_config = config; device->power_config = config;
if (status == QDF_STATUS_SUCCESS) if (status == QDF_STATUS_SUCCESS)
status = hif_enable_func(device, func); status = hif_enable_func(device, func);
@@ -1086,6 +1075,7 @@ power_state_change_notify(struct hif_sdio_dev *device,
} }
} else if (device->power_config == HIF_DEVICE_POWER_DOWN) { } else if (device->power_config == HIF_DEVICE_POWER_DOWN) {
int ret = sdio_enable4bits(device, 1); int ret = sdio_enable4bits(device, 1);
status = (ret == 0) ? QDF_STATUS_SUCCESS : status = (ret == 0) ? QDF_STATUS_SUCCESS :
QDF_STATUS_E_FAILURE; QDF_STATUS_E_FAILURE;
} }
@@ -1358,7 +1348,8 @@ void hif_sdio_shutdown(struct hif_softc *hif_ctx)
* externally powered and we are unloading the SDIO * externally powered and we are unloading the SDIO
* stack. This avoids the problem when the SDIO stack * stack. This avoids the problem when the SDIO stack
* is reloaded and attempts are made to re-enumerate * is reloaded and attempts are made to re-enumerate
* a card that is already enumerated */ * a card that is already enumerated
*/
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: hif_shut_down_device, resetting\n", ("%s: hif_shut_down_device, resetting\n",
__func__)); __func__));
@@ -1400,13 +1391,15 @@ static void hif_irq_handler(struct sdio_func *func)
{ {
QDF_STATUS status; QDF_STATUS status;
struct hif_sdio_dev *device; struct hif_sdio_dev *device;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: Enter\n", __func__)); ("%s: Enter\n", __func__));
device = get_hif_device(func); device = get_hif_device(func);
atomic_set(&device->irq_handling, 1); atomic_set(&device->irq_handling, 1);
/* release the host during intr so we can use /* release the host during intr so we can use
* it when we process cmds */ * it when we process cmds
*/
sdio_release_host(device->func); sdio_release_host(device->func);
status = device->htc_callbacks.dsrHandler(device->htc_callbacks status = device->htc_callbacks.dsrHandler(device->htc_callbacks
.context); .context);
@@ -1446,6 +1439,7 @@ static int startup_task(void *param)
static int enable_task(void *param) static int enable_task(void *param)
{ {
struct hif_sdio_dev *device; struct hif_sdio_dev *device;
device = (struct hif_sdio_dev *) param; device = (struct hif_sdio_dev *) param;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: call from resume_task\n", ("%s: call from resume_task\n",
@@ -1511,10 +1505,11 @@ static void foce_drive_strength(struct sdio_func *func)
(unsigned int) err)); (unsigned int) err));
} else { } else {
value = (value & value = (value &
(~CCCR_SDIO_DRIVER_STRENGTH_ENABLE_MASK)) (~CCCR_SDIO_DRIVER_STRENGTH_ENABLE_MASK)
| CCCR_SDIO_DRIVER_STRENGTH_ENABLE_A ) |
| CCCR_SDIO_DRIVER_STRENGTH_ENABLE_C CCCR_SDIO_DRIVER_STRENGTH_ENABLE_A |
| CCCR_SDIO_DRIVER_STRENGTH_ENABLE_D; CCCR_SDIO_DRIVER_STRENGTH_ENABLE_C |
CCCR_SDIO_DRIVER_STRENGTH_ENABLE_D;
err = func0_cmd52_write_byte(func->card, err = func0_cmd52_write_byte(func->card,
addr, value); addr, value);
if (err) { if (err) {
@@ -1623,21 +1618,20 @@ static int hif_device_inserted(struct sdio_func *func,
uint32_t clock, clock_set = 12500000; uint32_t clock, clock_set = 12500000;
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE, AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
("%s: Function: " ("%s: Function: 0x%X, Vendor ID: 0x%X, Device ID: 0x%X, block size: 0x%X/0x%X\n",
"0x%X, Vendor ID: 0x%X, Device ID: 0x%X, " __func__, func->num, func->vendor, id->device,
"block size: 0x%X/0x%X\n", func->max_blksize, func->cur_blksize));
__func__,
func->num, func->vendor, id->device,
func->max_blksize,
func->cur_blksize));
/* dma_mask should not be NULL, otherwise dma_map_single /* dma_mask should not be NULL, otherwise dma_map_single
* will crash. TODO: check why dma_mask is NULL here */ * will crash. TODO: check why dma_mask is NULL here
*/
if (func->dev.dma_mask == NULL) { if (func->dev.dma_mask == NULL) {
static u64 dma_mask = 0xFFFFFFFF; static u64 dma_mask = 0xFFFFFFFF;
func->dev.dma_mask = &dma_mask; func->dev.dma_mask = &dma_mask;
} }
for (i = 0; i < MAX_HIF_DEVICES; ++i) { for (i = 0; i < MAX_HIF_DEVICES; ++i) {
struct hif_sdio_dev *hifdevice = hif_devices[i]; struct hif_sdio_dev *hifdevice = hif_devices[i];
if (hifdevice && hifdevice->power_config == HIF_DEVICE_POWER_CUT if (hifdevice && hifdevice->power_config == HIF_DEVICE_POWER_CUT
&& hifdevice->host == func->card->host) { && hifdevice->host == func->card->host) {
hifdevice->func = func; hifdevice->func = func;
@@ -1668,15 +1662,16 @@ static int hif_device_inserted(struct sdio_func *func,
} }
if (i == MAX_HIF_DEVICES) { if (i == MAX_HIF_DEVICES) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("%s: No more hif_devices[] slot for %p", ("%s: No more hif_devices[] slot for %p",
__func__, device)); __func__, device));
} }
device->id = id; device->id = id;
device->host = func->card->host; device->host = func->card->host;
device->is_disabled = true; device->is_disabled = true;
/* TODO: MMC SDIO3.0 Setting should also be modified in ReInit() /* TODO: MMC SDIO3.0 Setting should also be modified in ReInit()
* function when Power Manage work. */ * function when Power Manage work.
*/
sdio_claim_host(func); sdio_claim_host(func);
/* force driver strength to type D */ /* force driver strength to type D */
if (forcedriverstrength == 1) if (forcedriverstrength == 1)
@@ -1723,8 +1718,7 @@ static int hif_device_inserted(struct sdio_func *func,
if (ret) { if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("%s: CMD52 to set bus width failed: %d\n", ("%s: CMD52 to set bus width failed: %d\n",
__func__, __func__, ret));
ret));
return ret; return ret;
} }
device->host->ios.bus_width = device->host->ios.bus_width =
@@ -1799,7 +1793,8 @@ static int hif_device_inserted(struct sdio_func *func,
if (!nohifscattersupport) { if (!nohifscattersupport) {
/* try to allow scatter operation on all instances, /* try to allow scatter operation on all instances,
* unless globally overridden */ * unless globally overridden
*/
device->scatter_enabled = true; device->scatter_enabled = true;
} else } else
device->scatter_enabled = false; device->scatter_enabled = false;
@@ -1855,7 +1850,8 @@ void hif_un_mask_interrupt(struct hif_sdio_dev *device)
/* /*
* On HP Elitebook 8460P, interrupt mode is not stable * On HP Elitebook 8460P, interrupt mode is not stable
* in high throughput, so polling method should be used * in high throughput, so polling method should be used
* instead of interrupt mode. */ * instead of interrupt mode.
*/
if (brokenirq) { if (brokenirq) {
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
("%s: Using broken IRQ mode\n", ("%s: Using broken IRQ mode\n",
@@ -1881,6 +1877,7 @@ void hif_un_mask_interrupt(struct hif_sdio_dev *device)
void hif_mask_interrupt(struct hif_sdio_dev *device) void hif_mask_interrupt(struct hif_sdio_dev *device)
{ {
int ret; int ret;
AR_DEBUG_ASSERT(device != NULL); AR_DEBUG_ASSERT(device != NULL);
AR_DEBUG_ASSERT(device->func != NULL); AR_DEBUG_ASSERT(device->func != NULL);
@@ -1986,13 +1983,15 @@ static QDF_STATUS hif_disable_func(struct hif_sdio_dev *device,
* where the card does not need to be removed at the end * where the card does not need to be removed at the end
* of the test. It is expected that the user will also * of the test. It is expected that the user will also
* un/reload the host controller driver to force the bus * un/reload the host controller driver to force the bus
* driver to re-enumerate the slot */ * driver to re-enumerate the slot
*/
AR_DEBUG_PRINTF(ATH_DEBUG_WARN, AR_DEBUG_PRINTF(ATH_DEBUG_WARN,
("%s: reseting SDIO card", ("%s: reseting SDIO card",
__func__)); __func__));
/* sdio_f0_writeb() cannot be used here, this allows access /* sdio_f0_writeb() cannot be used here, this allows access
* to undefined registers in the range of: 0xF0-0xFF */ * to undefined registers in the range of: 0xF0-0xFF
*/
ret = ret =
func0_cmd52_write_byte(device->func->card, func0_cmd52_write_byte(device->func->card,
@@ -2050,6 +2049,7 @@ static QDF_STATUS hif_enable_func(struct hif_sdio_dev *device,
} else if (manufacturer_id == MANUFACTURER_ID_AR6320_BASE } else if (manufacturer_id == MANUFACTURER_ID_AR6320_BASE
|| manufacturer_id == MANUFACTURER_ID_QCA9377_BASE) { || manufacturer_id == MANUFACTURER_ID_QCA9377_BASE) {
unsigned char data = 0; unsigned char data = 0;
setAsyncIRQ = 1; setAsyncIRQ = 1;
ret = ret =
func0_cmd52_read_byte(func->card, func0_cmd52_read_byte(func->card,
@@ -2082,13 +2082,14 @@ static QDF_STATUS hif_enable_func(struct hif_sdio_dev *device,
} }
/* set CCCR 0xF0[7:6] to increase async interrupt delay clock to /* set CCCR 0xF0[7:6] to increase async interrupt delay clock to
* fix interrupt missing issue on dell 8460p */ * fix interrupt missing issue on dell 8460p
*/
if (asyncintdelay != 0) { if (asyncintdelay != 0) {
unsigned char data = 0; unsigned char data = 0;
ret =
func0_cmd52_read_byte(func->card, ret = func0_cmd52_read_byte(func->card,
CCCR_SDIO_ASYNC_INT_DELAY_ADDRESS, CCCR_SDIO_ASYNC_INT_DELAY_ADDRESS,
&data); &data);
if (ret) { if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("%s: failed to read CCCR %d, val is %d\n", ("%s: failed to read CCCR %d, val is %d\n",
@@ -2135,8 +2136,8 @@ static QDF_STATUS hif_enable_func(struct hif_sdio_dev *device,
if (modstrength) { if (modstrength) {
unsigned int address = WINDOW_DATA_ADDRESS; unsigned int address = WINDOW_DATA_ADDRESS;
unsigned int value = 0x0FFF; unsigned int value = 0x0FFF;
ret =
sdio_memcpy_toio(device->func, address, ret = sdio_memcpy_toio(device->func, address,
&value, 4); &value, 4);
if (ret) { if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
@@ -2236,9 +2237,8 @@ int hif_device_suspend(struct device *dev)
if (device && device->claimed_ctx if (device && device->claimed_ctx
&& osdrv_callbacks.device_suspend_handler) { && osdrv_callbacks.device_suspend_handler) {
device->is_suspend = true; device->is_suspend = true;
status = status = osdrv_callbacks.device_suspend_handler(
osdrv_callbacks.device_suspend_handler(device->claimed_ctx); device->claimed_ctx);
#if defined(MMC_PM_KEEP_POWER) #if defined(MMC_PM_KEEP_POWER)
switch (forcesleepmode) { switch (forcesleepmode) {
case 0: /* depend on sdio host pm capbility */ case 0: /* depend on sdio host pm capbility */
@@ -2259,7 +2259,8 @@ int hif_device_suspend(struct device *dev)
if (!(pm_flag & MMC_PM_KEEP_POWER)) { if (!(pm_flag & MMC_PM_KEEP_POWER)) {
/* cut power support */ /* cut power support */
/* setting power_config before hif_configure_device to /* setting power_config before hif_configure_device to
* skip sdio r/w when suspending with cut power */ * skip sdio r/w when suspending with cut power
*/
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
("hif_device_suspend: cut power enter\n")); ("hif_device_suspend: cut power enter\n"));
config = HIF_DEVICE_POWER_CUT; config = HIF_DEVICE_POWER_CUT;
@@ -2288,70 +2289,65 @@ int hif_device_suspend(struct device *dev)
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
("hif_device_suspend: cut power success\n")); ("hif_device_suspend: cut power success\n"));
return ret; return ret;
} else { }
ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER); ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("%s: set sdio pm flags failed %d\n",
__func__, ret));
return ret;
}
/* TODO:WOW support */
if (pm_flag & MMC_PM_WAKE_SDIO_IRQ) {
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
("hif_device_suspend: wow enter\n"));
config = HIF_DEVICE_POWER_DOWN;
ret = hif_configure_device(device,
HIF_DEVICE_POWER_STATE_CHANGE,
&config,
sizeof
(HIF_DEVICE_POWER_CHANGE_TYPE));
if (ret) { if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR, AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("%s: set sdio pm flags failed %d\n", ("%s: hif config dev failed: %d\n",
__func__, ret)); __func__, ret));
return ret; return ret;
} }
ret =
/* TODO:WOW support */ sdio_set_host_pm_flags(func,
if (pm_flag & MMC_PM_WAKE_SDIO_IRQ) { MMC_PM_WAKE_SDIO_IRQ);
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, if (ret) {
("hif_device_suspend: wow enter\n")); AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
config = HIF_DEVICE_POWER_DOWN; ("%s: set sdio pm flags %d\n",
ret = hif_configure_device(device,
HIF_DEVICE_POWER_STATE_CHANGE,
&config,
sizeof
(HIF_DEVICE_POWER_CHANGE_TYPE));
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("%s: hif config dev failed: %d\n",
__func__, ret)); __func__, ret));
return ret;
}
ret =
sdio_set_host_pm_flags(func,
MMC_PM_WAKE_SDIO_IRQ);
if (ret) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
("%s: set sdio pm flags %d\n",
__func__, ret));
return ret;
}
hif_mask_interrupt(device);
device->device_state = HIF_DEVICE_STATE_WOW;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
("hif_device_suspend: wow success\n"));
return ret;
} else {
/* deep sleep support */
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
("%s: deep sleep enter\n",
__func__));
/*
* Wait for some async clean handler finished.
* These handlers are part of vdev disconnect.
* As handlers are async,sleep is not suggested,
* some blocking method may be a good choice.
* But before adding callback function to these
* handler, sleep wait is a simple method.
*/
msleep(100);
hif_mask_interrupt(device);
device->device_state =
HIF_DEVICE_STATE_DEEPSLEEP;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
("%s: deep sleep done\n",
__func__));
return ret; return ret;
} }
hif_mask_interrupt(device);
device->device_state = HIF_DEVICE_STATE_WOW;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
("hif_device_suspend: wow success\n"));
return ret;
} }
/* deep sleep support */
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: deep sleep enter\n",
__func__));
/*
* Wait for some async clean handler finished.
* These handlers are part of vdev disconnect.
* As handlers are async,sleep is not suggested,
* some blocking method may be a good choice.
* But before adding callback function to these
* handler, sleep wait is a simple method.
*/
msleep(100);
hif_mask_interrupt(device);
device->device_state = HIF_DEVICE_STATE_DEEPSLEEP;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: deep sleep done\n",
__func__));
return ret;
#endif #endif
} }
@@ -2442,21 +2438,19 @@ static void hif_device_removed(struct sdio_func *func)
{ {
QDF_STATUS status = QDF_STATUS_SUCCESS; QDF_STATUS status = QDF_STATUS_SUCCESS;
struct hif_sdio_dev *device; struct hif_sdio_dev *device;
int i;
AR_DEBUG_ASSERT(func != NULL); AR_DEBUG_ASSERT(func != NULL);
HIF_ENTER(); HIF_ENTER();
device = get_hif_device(func); device = get_hif_device(func);
if (device->power_config == HIF_DEVICE_POWER_CUT) { if (device->power_config == HIF_DEVICE_POWER_CUT) {
device->func = NULL; /* func will be free by mmc stack */ device->func = NULL; /* func will be free by mmc stack */
return; /* Just return for cut-off mode */ return; /* Just return for cut-off mode */
} else { }
int i; for (i = 0; i < MAX_HIF_DEVICES; ++i) {
for (i = 0; i < MAX_HIF_DEVICES; ++i) { if (hif_devices[i] == device)
if (hif_devices[i] == device) hif_devices[i] = NULL;
hif_devices[i] = NULL;
}
} }
if (device->claimed_ctx != NULL) if (device->claimed_ctx != NULL)

View File

@@ -160,7 +160,8 @@ QDF_STATUS do_hif_read_write_scatter(struct hif_sdio_dev *device,
/* setup each sg entry */ /* setup each sg entry */
if ((unsigned long)req->scatter_list[i].buffer & 0x3) { if ((unsigned long)req->scatter_list[i].buffer & 0x3) {
/* note some scatter engines can handle unaligned /* note some scatter engines can handle unaligned
* buffers, print this as informational only */ * buffers, print this as informational only
*/
AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER, AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER,
("HIF: (%s) Scatter Buf is unaligned 0x%lx\n", ("HIF: (%s) Scatter Buf is unaligned 0x%lx\n",
req-> req->
@@ -297,7 +298,8 @@ static QDF_STATUS hif_read_write_scatter(struct hif_sdio_dev *device,
} }
/* add bus request to the async list for the async /* add bus request to the async list for the async
* I/O thread to process */ * I/O thread to process
*/
add_to_async_list(device, req_priv->busrequest); add_to_async_list(device, req_priv->busrequest);
if (request & HIF_SYNCHRONOUS) { if (request & HIF_SYNCHRONOUS) {
@@ -313,15 +315,15 @@ static QDF_STATUS hif_read_write_scatter(struct hif_sdio_dev *device,
/* interrupted, exit */ /* interrupted, exit */
status = QDF_STATUS_E_FAILURE; status = QDF_STATUS_E_FAILURE;
break; break;
} else {
status = req->completion_status;
} }
status = req->completion_status;
} else { } else {
AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER, AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER,
("HIF-SCATTER: queued async req: 0x%lX\n", ("HIF-SCATTER: queued async req: 0x%lX\n",
(unsigned long)req_priv->busrequest)); (unsigned long)req_priv->busrequest));
/* wake thread, it will process and then take /* wake thread, it will process and then take
* care of the async callback */ * care of the async callback
*/
up(&device->sem_async); up(&device->sem_async);
status = QDF_STATUS_SUCCESS; status = QDF_STATUS_SUCCESS;
} }
@@ -356,8 +358,7 @@ QDF_STATUS setup_hif_scatter_support(struct hif_sdio_dev *device,
if (device->func->card->host->max_segs < if (device->func->card->host->max_segs <
MAX_SCATTER_ENTRIES_PER_REQ) { MAX_SCATTER_ENTRIES_PER_REQ) {
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
("host only supports scatter of : %d entries," ("host only supports scatter of : %d entries, need: %d\n",
"need: %d\n",
device->func->card->host->max_segs, device->func->card->host->max_segs,
MAX_SCATTER_ENTRIES_PER_REQ)); MAX_SCATTER_ENTRIES_PER_REQ));
status = QDF_STATUS_E_NOSUPPORT; status = QDF_STATUS_E_NOSUPPORT;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
* *
* Previously licensed under the ISC license by Qualcomm Atheros, Inc. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
* *

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
* *
* Previously licensed under the ISC license by Qualcomm Atheros, Inc. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
* *
@@ -834,7 +834,7 @@ struct hostdef_s {
#define AR6320V3_CPU_PLL_INIT_DONE_ADDR 0x404020 #define AR6320V3_CPU_PLL_INIT_DONE_ADDR 0x404020
#define AR6320V3_CPU_SPEED_ADDR 0x404024 #define AR6320V3_CPU_SPEED_ADDR 0x404024
typedef enum { enum a_refclk_speed_t {
SOC_REFCLK_UNKNOWN = -1, /* Unsupported ref clock -- use PLL Bypass */ SOC_REFCLK_UNKNOWN = -1, /* Unsupported ref clock -- use PLL Bypass */
SOC_REFCLK_48_MHZ = 0, SOC_REFCLK_48_MHZ = 0,
SOC_REFCLK_19_2_MHZ = 1, SOC_REFCLK_19_2_MHZ = 1,
@@ -844,7 +844,7 @@ typedef enum {
SOC_REFCLK_38_4_MHZ = 5, SOC_REFCLK_38_4_MHZ = 5,
SOC_REFCLK_40_MHZ = 6, SOC_REFCLK_40_MHZ = 6,
SOC_REFCLK_52_MHZ = 7, SOC_REFCLK_52_MHZ = 7,
} A_refclk_speed_t; };
#define A_REFCLK_UNKNOWN SOC_REFCLK_UNKNOWN #define A_REFCLK_UNKNOWN SOC_REFCLK_UNKNOWN
#define A_REFCLK_48_MHZ SOC_REFCLK_48_MHZ #define A_REFCLK_48_MHZ SOC_REFCLK_48_MHZ
@@ -866,20 +866,20 @@ struct wlan_pll_s {
}; };
struct cmnos_clock_s { struct cmnos_clock_s {
A_refclk_speed_t refclk_speed; enum a_refclk_speed_t refclk_speed;
uint32_t refclk_hz; uint32_t refclk_hz;
uint32_t pll_settling_time; /* 50us */ uint32_t pll_settling_time; /* 50us */
struct wlan_pll_s wlan_pll; struct wlan_pll_s wlan_pll;
}; };
typedef struct TGT_REG_SECTION { struct tgt_reg_section {
uint32_t start_addr; uint32_t start_addr;
uint32_t end_addr; uint32_t end_addr;
} tgt_reg_section; };
typedef struct TGT_REG_TABLE { struct tgt_reg_table {
tgt_reg_section *section; struct tgt_reg_section *section;
uint32_t section_size; uint32_t section_size;
} tgt_reg_table; };
#endif /* _REGTABLE_SDIO_H_ */ #endif /* _REGTABLE_SDIO_H_ */

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2016 The Linux Foundation. All rights reserved. * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
* *
* Previously licensed under the ISC license by Qualcomm Atheros, Inc. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
* *
@@ -1240,7 +1240,7 @@ typedef struct hostdef_s {
#define AR6320V3_CPU_PLL_INIT_DONE_ADDR 0x404020 #define AR6320V3_CPU_PLL_INIT_DONE_ADDR 0x404020
#define AR6320V3_CPU_SPEED_ADDR 0x404024 #define AR6320V3_CPU_SPEED_ADDR 0x404024
typedef enum { enum a_refclk_speed_t {
/* Unsupported ref clock -- use PLL Bypass */ /* Unsupported ref clock -- use PLL Bypass */
SOC_REFCLK_UNKNOWN = -1, SOC_REFCLK_UNKNOWN = -1,
SOC_REFCLK_48_MHZ = 0, SOC_REFCLK_48_MHZ = 0,
@@ -1251,7 +1251,7 @@ typedef enum {
SOC_REFCLK_38_4_MHZ = 5, SOC_REFCLK_38_4_MHZ = 5,
SOC_REFCLK_40_MHZ = 6, SOC_REFCLK_40_MHZ = 6,
SOC_REFCLK_52_MHZ = 7, SOC_REFCLK_52_MHZ = 7,
} A_refclk_speed_t; };
#define A_REFCLK_UNKNOWN SOC_REFCLK_UNKNOWN #define A_REFCLK_UNKNOWN SOC_REFCLK_UNKNOWN
#define A_REFCLK_48_MHZ SOC_REFCLK_48_MHZ #define A_REFCLK_48_MHZ SOC_REFCLK_48_MHZ
@@ -1273,21 +1273,22 @@ struct wlan_pll_s {
}; };
struct cmnos_clock_s { struct cmnos_clock_s {
A_refclk_speed_t refclk_speed; enum a_refclk_speed_t refclk_speed;
u_int32_t refclk_hz; u_int32_t refclk_hz;
u_int32_t pll_settling_time; /* 50us */ u_int32_t pll_settling_time; /* 50us */
struct wlan_pll_s wlan_pll; struct wlan_pll_s wlan_pll;
}; };
typedef struct TGT_REG_SECTION { struct tgt_reg_section {
u_int32_t start_addr; u_int32_t start_addr;
u_int32_t end_addr; u_int32_t end_addr;
} tgt_reg_section; };
typedef struct TGT_REG_TABLE { struct tgt_reg_table {
tgt_reg_section *section; struct tgt_reg_section *section;
u_int32_t section_size; u_int32_t section_size;
} tgt_reg_table; };
void target_register_tbl_attach(struct hif_softc *scn, void target_register_tbl_attach(struct hif_softc *scn,
uint32_t target_type); uint32_t target_type);
void hif_register_tbl_attach(struct hif_softc *scn, void hif_register_tbl_attach(struct hif_softc *scn,