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:

committed by
snandini

parent
6622bf43fc
commit
a6d64a1dd6
@@ -696,7 +696,7 @@
|
||||
#define AR6320V3_CPU_PLL_INIT_DONE_ADDR 0x404020
|
||||
#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_48_MHZ = 0,
|
||||
SOC_REFCLK_19_2_MHZ = 1,
|
||||
@@ -706,7 +706,7 @@ typedef enum {
|
||||
SOC_REFCLK_38_4_MHZ = 5,
|
||||
SOC_REFCLK_40_MHZ = 6,
|
||||
SOC_REFCLK_52_MHZ = 7,
|
||||
} A_refclk_speed_t;
|
||||
};
|
||||
|
||||
#define A_REFCLK_UNKNOWN SOC_REFCLK_UNKNOWN
|
||||
#define A_REFCLK_48_MHZ SOC_REFCLK_48_MHZ
|
||||
@@ -728,21 +728,21 @@ struct wlan_pll_s {
|
||||
};
|
||||
|
||||
struct cmnos_clock_s {
|
||||
A_refclk_speed_t refclk_speed;
|
||||
enum a_refclk_speed_t refclk_speed;
|
||||
uint32_t refclk_hz;
|
||||
uint32_t pll_settling_time; /* 50us */
|
||||
struct wlan_pll_s wlan_pll;
|
||||
};
|
||||
|
||||
typedef struct TGT_REG_SECTION {
|
||||
struct tgt_reg_section {
|
||||
uint32_t start_addr;
|
||||
uint32_t end_addr;
|
||||
} tgt_reg_section;
|
||||
};
|
||||
|
||||
typedef struct TGT_REG_TABLE {
|
||||
tgt_reg_section *section;
|
||||
struct tgt_reg_table {
|
||||
struct tgt_reg_section *section;
|
||||
uint32_t section_size;
|
||||
} tgt_reg_table;
|
||||
};
|
||||
|
||||
struct hif_softc;
|
||||
void hif_target_register_tbl_attach(struct hif_softc *scn, u32 target_type);
|
||||
|
@@ -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.
|
||||
*
|
||||
@@ -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
|
||||
* a decrement, while the remaining 3 bytes has no effect.
|
||||
* The rationale behind this is to make all HIF accesses
|
||||
* 4-byte aligned */
|
||||
* 4-byte aligned
|
||||
*/
|
||||
status =
|
||||
hif_read_write(device, address,
|
||||
(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;
|
||||
}
|
||||
/* the counter is only 8=bits, ignore anything in the
|
||||
*upper 3 bytes */
|
||||
* upper 3 bytes
|
||||
*/
|
||||
(*p_bmi_cmd_credits) &= 0xFF;
|
||||
}
|
||||
|
||||
@@ -135,6 +137,7 @@ hif_bmi_read_write(struct hif_sdio_dev *device,
|
||||
char *buffer, uint32_t length)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
|
||||
status = hif_read_write(device, RX_LOOKAHEAD_VALID_ADDRESS,
|
||||
buffer, length,
|
||||
HIF_RD_SYNC_BYTE_INC, NULL);
|
||||
@@ -166,12 +169,14 @@ hif_bmi_buffer_receive(struct hif_sdio_dev *device,
|
||||
uint32_t address;
|
||||
uint32_t mbox_address[HTC_MAILBOX_NUM_MAX];
|
||||
struct _HIF_PENDING_EVENTS_INFO hif_pending_events;
|
||||
|
||||
static HIF_PENDING_EVENTS_FUNC get_pending_events_func;
|
||||
|
||||
if (!pending_events_func_check) {
|
||||
/* see if the HIF layer implements an alternative
|
||||
* function to get pending events
|
||||
* do this only once! */
|
||||
* do this only once!
|
||||
*/
|
||||
hif_configure_device(device,
|
||||
HIF_DEVICE_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.
|
||||
* We need to do some backwards compatibility work to make this
|
||||
* OK.*/
|
||||
* OK.
|
||||
*/
|
||||
QDF_ASSERT(targ_info->target_info_byte_count ==
|
||||
sizeof(*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",
|
||||
__func__, SDIO_SCRATCH_1_ADDRESS));
|
||||
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;
|
||||
}
|
||||
@@ -516,11 +520,9 @@ QDF_STATUS hif_bmi_read_scratch_register(struct hif_sdio_dev *device)
|
||||
("%s: Unable to read from 0x%x\n",
|
||||
__func__, SDIO_SCRATCH_1_ADDRESS));
|
||||
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;
|
||||
}
|
||||
|
@@ -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.
|
||||
*
|
||||
@@ -41,7 +41,8 @@
|
||||
#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
|
||||
* @register_addr: register address
|
||||
* @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
|
||||
* @address: address
|
||||
* @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) ||
|
||||
(nbytes & WORD_NON_ALIGNMENT_MASK)) {
|
||||
AR_DEBUG_PRINTF(ATH_LOG_ERR,
|
||||
("[%s]addr or length is not 4 bytes"
|
||||
" align.addr[0x%08x] len[0x%08x]\n",
|
||||
("[%s]addr or length is not 4 bytes align.addr[0x%08x] len[0x%08x]\n",
|
||||
__func__, address, nbytes));
|
||||
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);
|
||||
if (status != QDF_STATUS_SUCCESS) {
|
||||
AR_DEBUG_PRINTF(ATH_LOG_ERR,
|
||||
("Diag Write mem failed.addr[0x%08x]"
|
||||
" value[0x%08x]\n",
|
||||
("Diag Write mem failed.addr[0x%08x] value[0x%08x]\n",
|
||||
address + i, tmp_data));
|
||||
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
|
||||
* @data: data
|
||||
* @nbytes: nbytes
|
||||
@@ -240,8 +241,7 @@ QDF_STATUS hif_diag_read_mem(struct hif_opaque_softc *scn,
|
||||
if ((address & WORD_NON_ALIGNMENT_MASK) ||
|
||||
(nbytes & WORD_NON_ALIGNMENT_MASK)) {
|
||||
AR_DEBUG_PRINTF(ATH_LOG_ERR,
|
||||
("[%s]addr or length is not 4 bytes"
|
||||
" align.addr[0x%08x] len[0x%08x]\n",
|
||||
("[%s]addr or length is not 4 bytes align.addr[0x%08x] len[0x%08x]\n",
|
||||
__func__, address, nbytes));
|
||||
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);
|
||||
if (status != QDF_STATUS_SUCCESS) {
|
||||
AR_DEBUG_PRINTF(ATH_LOG_ERR,
|
||||
("Diag Write mem failed.addr[0x%08x]"
|
||||
" value[0x%08x]\n",
|
||||
("Diag Write mem failed.addr[0x%08x] value[0x%08x]\n",
|
||||
address + i, tmp_data));
|
||||
return status;
|
||||
}
|
||||
|
@@ -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.
|
||||
*
|
||||
@@ -188,8 +188,6 @@ void hif_post_init(struct hif_opaque_softc *hif_ctx, void *target,
|
||||
|
||||
if (htc_sdio_device)
|
||||
hif_dev_setup(htc_sdio_device);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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.
|
||||
*
|
||||
@@ -107,7 +107,8 @@
|
||||
* requirement, but AR6003 support it, so the register
|
||||
* is placed in vendor specific field 0xF0(bit0)
|
||||
* 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 */
|
||||
#define CCCR_SDIO_IRQ_MODE_REG_AR6003 0xF0
|
||||
/* mode to enable special 4-bit interrupt assertion without clock */
|
||||
|
@@ -75,18 +75,16 @@ uint8_t hif_dev_map_pipe_to_mail_box(struct hif_sdio_device *pdev,
|
||||
uint8_t pipeid)
|
||||
{
|
||||
/* TODO: temp version, should not hardcoded here, will be
|
||||
* updated after HIF design */
|
||||
* updated after HIF design
|
||||
*/
|
||||
if (2 == pipeid || 3 == pipeid)
|
||||
return 1;
|
||||
else if (0 == pipeid || 1 == pipeid)
|
||||
return 0;
|
||||
else {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("%s: pipeid=%d,should not happen\n",
|
||||
__func__, pipeid));
|
||||
qdf_assert(0);
|
||||
return INVALID_MAILBOX_NUMBER;
|
||||
}
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("%s: pipeid=%d,should not happen\n",
|
||||
__func__, pipeid));
|
||||
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)
|
||||
{
|
||||
/* TODO: temp version, should not hardcoded here, will be
|
||||
* updated after HIF design */
|
||||
if (mbox_index == 0) {
|
||||
* updated after HIF design
|
||||
*/
|
||||
if (mbox_index == 0)
|
||||
return upload ? 1 : 0;
|
||||
} else if (mbox_index == 1) {
|
||||
else if (mbox_index == 1)
|
||||
return upload ? 3 : 2;
|
||||
} else {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("%s:--------------------mboxIndex=%d,upload=%d,"
|
||||
" should not happen\n",
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("%s:-----mboxIndex=%d,upload=%d, should not happen\n",
|
||||
__func__, mbox_index, upload));
|
||||
qdf_assert(0);
|
||||
return 0xff;
|
||||
}
|
||||
qdf_assert(0);
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,6 +131,7 @@ QDF_STATUS hif_dev_map_service_to_pipe(struct hif_sdio_device *pdev,
|
||||
bool swap_mapping)
|
||||
{
|
||||
QDF_STATUS status = QDF_STATUS_SUCCESS;
|
||||
|
||||
switch (service_id) {
|
||||
case HTT_DATA_MSG_SVC:
|
||||
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;
|
||||
QDF_STATUS status;
|
||||
|
||||
status = hif_configure_device(hif_device,
|
||||
HIF_DEVICE_GET_HTC_CONTEXT,
|
||||
(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;
|
||||
QDF_STATUS status = QDF_STATUS_SUCCESS;
|
||||
|
||||
HIF_ENTER();
|
||||
|
||||
LOCK_HIF_DEV(pdev);
|
||||
@@ -351,6 +350,7 @@ QDF_STATUS hif_dev_enable_interrupts(struct hif_sdio_device *pdev)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
struct MBOX_IRQ_ENABLE_REGISTERS regs;
|
||||
|
||||
HIF_ENTER();
|
||||
|
||||
/* 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,
|
||||
* other software can perform target "soft" resets.
|
||||
* The AR6K interrupt enables reset back to an "enabled"
|
||||
* state when this happens. */
|
||||
* state when this happens.
|
||||
*/
|
||||
hif_dev_disable_interrupts(pdev);
|
||||
|
||||
/* Unmask the host controller interrupts */
|
||||
@@ -369,7 +370,8 @@ QDF_STATUS hif_dev_enable_interrupts(struct hif_sdio_device *pdev)
|
||||
LOCK_HIF_DEV(pdev);
|
||||
|
||||
/* Enable all the interrupts except for the internal
|
||||
* AR6000 CPU interrupt */
|
||||
* AR6000 CPU interrupt
|
||||
*/
|
||||
pdev->IrqEnableRegisters.int_status_enable =
|
||||
INT_STATUS_ENABLE_ERROR_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.
|
||||
* #0 is used for report assertion from target
|
||||
* #1 is used for inform host that credit arrived
|
||||
* */
|
||||
*/
|
||||
pdev->IrqEnableRegisters.cpu_int_status_enable = 0x03;
|
||||
|
||||
/* 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;
|
||||
|
||||
/* 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 =
|
||||
(COUNTER_INT_STATUS_ENABLE_BIT_SET(AR6K_TARGET_DEBUG_INTR_MASK)) >>
|
||||
24;
|
||||
@@ -504,7 +507,8 @@ QDF_STATUS hif_dev_setup(struct hif_sdio_device *pdev)
|
||||
pdev->HifMaskUmaskRecvEvent = NULL;
|
||||
|
||||
/* see if the HIF layer implements the mask/unmask recv
|
||||
* events function */
|
||||
* events function
|
||||
*/
|
||||
hif_configure_device(hif_device,
|
||||
HIF_DEVICE_GET_RECV_EVENT_MASK_UNMASK_FUNC,
|
||||
&pdev->HifMaskUmaskRecvEvent,
|
||||
|
@@ -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.
|
||||
*
|
||||
@@ -114,12 +114,12 @@ struct hif_sdio_device {
|
||||
void *pTarget;
|
||||
};
|
||||
|
||||
#define LOCK_HIF_DEV(device) qdf_spin_lock(&(device)->Lock);
|
||||
#define UNLOCK_HIF_DEV(device) qdf_spin_unlock(&(device)->Lock);
|
||||
#define LOCK_HIF_DEV_RX(t) qdf_spin_lock(&(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 UNLOCK_HIF_DEV_TX(t) qdf_spin_unlock(&(t)->TxLock);
|
||||
#define LOCK_HIF_DEV(device) qdf_spin_lock(&(device)->Lock)
|
||||
#define UNLOCK_HIF_DEV(device) qdf_spin_unlock(&(device)->Lock)
|
||||
#define LOCK_HIF_DEV_RX(t) qdf_spin_lock(&(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 UNLOCK_HIF_DEV_TX(t) qdf_spin_unlock(&(t)->TxLock)
|
||||
|
||||
#define DEV_CALC_RECV_PADDED_LEN(pDev, length) \
|
||||
(((length) + (pDev)->BlockMask) & (~((pDev)->BlockMask)))
|
||||
|
@@ -100,7 +100,8 @@ static void hif_dev_dump_registers(struct hif_sdio_device *pdev,
|
||||
|
||||
if (pdev->MailBoxInfo.gmbox_address != 0) {
|
||||
/* if the target supports GMBOX hardware,
|
||||
* dump some additional state */
|
||||
* dump some additional state
|
||||
*/
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,
|
||||
("GMBOX-HostIntStatus2: 0x%x ",
|
||||
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) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ANY,
|
||||
("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 {
|
||||
/* HTC header indicates that every packet to follow
|
||||
* 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 =
|
||||
(hdr->Flags & HTC_FLAGS_RECV_BUNDLE_CNT_MASK)
|
||||
>> HTC_FLAGS_RECV_BUNDLE_CNT_SHIFT;
|
||||
/* the count doesn't include the starter frame, just
|
||||
* a count of frames to follow */
|
||||
* a count of frames to follow
|
||||
*/
|
||||
num_messages++;
|
||||
/* A_ASSERT(numMessages <= target->MaxMsgPerBundle); */
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
|
||||
("HTC header indicates :%d messages can be"
|
||||
" fetched as a bundle\n",
|
||||
("HTC header indicates :%d messages can be fetched as a bundle\n",
|
||||
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
|
||||
* 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++) {
|
||||
|
||||
/* reset flag, any packets allocated using the
|
||||
* RecvAlloc() API cannot be recycled on cleanup,
|
||||
* they must be explicitly returned */
|
||||
* they must be explicitly returned
|
||||
*/
|
||||
no_recycle = false;
|
||||
packet = hif_dev_alloc_rx_buffer(pdev);
|
||||
|
||||
if (packet == NULL) {
|
||||
/* No error, simply need to mark that
|
||||
* we are waiting for buffers. */
|
||||
* we are waiting for buffers.
|
||||
*/
|
||||
pdev->RecvStateFlags |= HTC_RECV_WAIT_BUFFERS;
|
||||
/* pDev->EpWaitingForBuffers = pEndpoint->Id; */
|
||||
status = QDF_STATUS_E_RESOURCES;
|
||||
break;
|
||||
}
|
||||
/* AR_DEBUG_ASSERT(pPacket->Endpoint ==
|
||||
pEndpoint->Id); */
|
||||
/* AR_DEBUG_ASSERT(pPacket->Endpoint == pEndpoint->Id);
|
||||
*/
|
||||
/* clear flags */
|
||||
packet->PktInfo.AsRx.HTCRxFlags = 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)
|
||||
/* 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 |=
|
||||
HTC_RX_PKT_NO_RECYCLE;
|
||||
/* add packet to queue (also incase we need to
|
||||
* cleanup down below) */
|
||||
* cleanup down below)
|
||||
*/
|
||||
HTC_PACKET_ENQUEUE(queue, packet);
|
||||
|
||||
/*
|
||||
if (HTC_STOPPING(target)) {
|
||||
status = QDF_STATUS_E_CANCELED;
|
||||
break;
|
||||
}
|
||||
/* if (HTC_STOPPING(target)) {
|
||||
* status = QDF_STATUS_E_CANCELED;
|
||||
* break;
|
||||
* }
|
||||
*/
|
||||
|
||||
/* make sure message can fit in the endpoint buffer */
|
||||
if ((uint32_t) full_length > packet->BufferLength) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("Payload Length Error : header reports payload"
|
||||
" of: %d (%d) endpoint buffer size: %d\n",
|
||||
("Payload Length Error : header reports payload of: %d (%d) endpoint buffer size: %d\n",
|
||||
hdr->PayloadLen, full_length,
|
||||
packet->BufferLength));
|
||||
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
|
||||
* lookahead is unknown as we are only using the
|
||||
* lookahead of the first packet as a template
|
||||
* of what to expect for lengths */
|
||||
* of what to expect for lengths
|
||||
*/
|
||||
packet->PktInfo.AsRx.HTCRxFlags |=
|
||||
HTC_RX_PKT_REFRESH_HDR;
|
||||
/* 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) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("DevRecvPacket, Not enough space for"
|
||||
" padlen:%d recvlen:%d bufferlen:%d\n",
|
||||
("DevRecvPacket, Not enough space for padlen:%d recvlen:%d bufferlen:%d\n",
|
||||
padded_length, recv_length,
|
||||
packet->BufferLength));
|
||||
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 */
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
|
||||
("hif_dev_recv_packet (0x%lX : hdr:0x%X) Len:%d,"
|
||||
" Padded Length: %d Mbox:0x%X\n",
|
||||
("hif_dev_recv_packet (0x%lX : hdr:0x%X) Len:%d, Padded Length: %d Mbox:0x%X\n",
|
||||
(unsigned long)packet,
|
||||
packet->PktInfo.AsRx.ExpectedHdr, recv_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 *) packet->pBuffer;
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
|
||||
("hif_dev_recv_packet "
|
||||
"EP:%d,Len:%d,Flag:%d,CB:0x%02X,0x%02X\n",
|
||||
("hif_dev_recv_packet EP:%d,Len:%d,Flag:%d,CB:0x%02X,0x%02X\n",
|
||||
hdr->EndpointID, hdr->PayloadLen,
|
||||
hdr->Flags, hdr->ControlBytes0,
|
||||
hdr->ControlBytes1));
|
||||
@@ -391,8 +395,7 @@ static inline QDF_STATUS hif_dev_process_trailer(struct hif_sdio_device *pdev,
|
||||
if (record->Length > length) {
|
||||
/* no room left in buffer for record */
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
(" invalid record len: %d (id:%d) buffer has:"
|
||||
"%d bytes left\n",
|
||||
(" invalid record len: %d (id:%d) buffer has:%d bytes left\n",
|
||||
record->Length, record->RecordID,
|
||||
length));
|
||||
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)) {
|
||||
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,
|
||||
(" look_ahead Report (pre valid:0x%X,"
|
||||
" post valid:0x%X) %d %d\n",
|
||||
(" look_ahead Report (pre valid:0x%X, post valid:0x%X) %d %d\n",
|
||||
look_ahead->PreValid,
|
||||
look_ahead->PostValid,
|
||||
from_endpoint,
|
||||
@@ -464,7 +466,8 @@ static inline QDF_STATUS hif_dev_process_trailer(struct hif_sdio_device *pdev,
|
||||
> HTC_MAX_MSG_PER_BUNDLE) {
|
||||
/* this should never happen, the target
|
||||
* restricts the number of messages per
|
||||
* bundle configured by the host */
|
||||
* bundle configured by the host
|
||||
*/
|
||||
A_ASSERT(false);
|
||||
status = QDF_STATUS_E_PROTO;
|
||||
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 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,
|
||||
HTC_PACKET *packet,
|
||||
uint32_t *next_look_aheads,
|
||||
@@ -541,7 +545,8 @@ static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
|
||||
do {
|
||||
/* note, we cannot assume the alignment of pBuffer,
|
||||
* so we use the safe macros to
|
||||
* retrieve 16 bit fields */
|
||||
* retrieve 16 bit fields
|
||||
*/
|
||||
payloadLen = HTC_GET_FIELD(buf, HTC_FRAME_HDR,
|
||||
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) {
|
||||
/* refresh expected hdr, since this was unknown
|
||||
* at the time we grabbed the packets
|
||||
* as part of a bundle */
|
||||
* as part of a bundle
|
||||
*/
|
||||
packet->PktInfo.AsRx.ExpectedHdr = look_ahead;
|
||||
/* refresh actual length since we now have the
|
||||
* real header */
|
||||
* real header
|
||||
*/
|
||||
packet->ActualLength = payloadLen + HTC_HDR_LENGTH;
|
||||
|
||||
/* validate the actual header that was refreshed */
|
||||
if (packet->ActualLength > packet->BufferLength) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("Invalid HDR payload length (%d)"
|
||||
" in bundled RECV (hdr: 0x%X)\n",
|
||||
("Invalid HDR payload length (%d) in bundled RECV (hdr: 0x%X)\n",
|
||||
payloadLen, look_ahead));
|
||||
/* limit this to max buffer just to print out
|
||||
* some of the buffer */
|
||||
* some of the buffer
|
||||
*/
|
||||
packet->ActualLength =
|
||||
min(packet->ActualLength,
|
||||
packet->BufferLength);
|
||||
@@ -577,8 +584,7 @@ static QDF_STATUS hif_dev_process_recv_header(struct hif_sdio_device *pdev,
|
||||
if (packet->Endpoint
|
||||
!= HTC_GET_FIELD(buf, HTC_FRAME_HDR, ENDPOINTID)) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("Refreshed HDR endpoint (%d) does not "
|
||||
" match expected endpoint (%d)\n",
|
||||
("Refreshed HDR endpoint (%d) does not match expected endpoint (%d)\n",
|
||||
HTC_GET_FIELD(buf,
|
||||
HTC_FRAME_HDR,
|
||||
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) {
|
||||
/* somehow the lookahead that gave us the full read
|
||||
* length did not reflect the actual header
|
||||
* in the pending message */
|
||||
* in the pending message
|
||||
*/
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("hif_dev_process_recv_header, lookahead mismatch!"
|
||||
" (pPkt:0x%lX flags:0x%X), 0x%08X != 0x%08X\n",
|
||||
("hif_dev_process_recv_header, lookahead mismatch! (pPkt:0x%lX flags:0x%X), 0x%08X != 0x%08X\n",
|
||||
(unsigned long)packet,
|
||||
packet->PktInfo.AsRx.HTCRxFlags,
|
||||
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))
|
||||
|| (temp > payloadLen)) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("hif_dev_process_recv_header, invalid header"
|
||||
"(payloadlength should be :%d, CB[0] is:%d)\n",
|
||||
("hif_dev_process_recv_header, invalid header(payloadlength should be :%d, CB[0] is:%d)\n",
|
||||
payloadLen, temp));
|
||||
status = QDF_STATUS_E_PROTO;
|
||||
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
|
||||
* bundle as the lookahead is not valid.
|
||||
* Next packet may have already been fetched as
|
||||
* part of the bundle */
|
||||
* part of the bundle
|
||||
*/
|
||||
next_look_aheads = NULL;
|
||||
num_look_aheads = NULL;
|
||||
}
|
||||
|
||||
/* process trailer data that follows HDR and
|
||||
* application payload */
|
||||
* application payload
|
||||
*/
|
||||
status = hif_dev_process_trailer(pdev,
|
||||
(buf + HTC_HDR_LENGTH +
|
||||
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_TARGET *target = NULL;
|
||||
uint32_t padded_length;
|
||||
|
||||
int bundleSpaceRemaining = 0;
|
||||
|
||||
target = (HTC_TARGET *) pdev->pTarget;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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,
|
||||
uint8_t mail_box_index,
|
||||
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
|
||||
* device layer supports it. The device layer
|
||||
* interfaces with HIF in which HIF may have
|
||||
* restrictions on how interrupts are processed */
|
||||
* restrictions on how interrupts are processed
|
||||
*/
|
||||
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
|
||||
* all packets in a bundle */
|
||||
* all packets in a bundle
|
||||
*/
|
||||
id = ((HTC_FRAME_HDR *) &look_aheads[0])->EndpointID;
|
||||
|
||||
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
|
||||
* by the lookaheads these packets are stored
|
||||
* in the recvPkt queue */
|
||||
* in the recvPkt queue
|
||||
*/
|
||||
status = hif_dev_alloc_and_prepare_rx_packets(pdev,
|
||||
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);
|
||||
|
||||
/* 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;
|
||||
partial_bundle = false;
|
||||
|
||||
@@ -864,7 +893,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
|
||||
pkts_fetched = 0;
|
||||
if ((HTC_PACKET_QUEUE_DEPTH(&recv_pkt_queue) > 1)) {
|
||||
/* 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,
|
||||
&recv_pkt_queue,
|
||||
asyncProc ?
|
||||
@@ -874,19 +904,8 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
|
||||
&pkts_fetched,
|
||||
partial_bundle);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
while (!HTC_QUEUE_EMPTY(
|
||||
&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);
|
||||
}
|
||||
hif_dev_free_recv_pkt_queue(
|
||||
&recv_pkt_queue);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -894,13 +913,15 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
|
||||
0) {
|
||||
/* we couldn't fetch all packets at one,
|
||||
* time this creates a broken
|
||||
* bundle */
|
||||
* bundle
|
||||
*/
|
||||
partial_bundle = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* see if the previous operation fetched any
|
||||
* packets using bundling */
|
||||
* packets using bundling
|
||||
*/
|
||||
if (0 == pkts_fetched) {
|
||||
/* dequeue one packet */
|
||||
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) >
|
||||
0) {
|
||||
/* lookaheads in all packets except the
|
||||
* last one in must be ignored */
|
||||
* last one in must be ignored
|
||||
*/
|
||||
packet->PktInfo.AsRx.HTCRxFlags |=
|
||||
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))
|
||||
break;
|
||||
/* sent synchronously, queue this packet for
|
||||
* synchronous completion */
|
||||
* synchronous completion
|
||||
*/
|
||||
HTC_PACKET_ENQUEUE(&sync_completed_pkts_queue,
|
||||
packet);
|
||||
}
|
||||
@@ -932,12 +955,14 @@ QDF_STATUS hif_dev_recv_message_pending_handler(struct hif_sdio_device *pdev,
|
||||
/* synchronous handling */
|
||||
if (pdev->DSRCanYield) {
|
||||
/* for the SYNC case, increment count that tracks
|
||||
* when the DSR should yield */
|
||||
* when the DSR should yield
|
||||
*/
|
||||
pdev->CurrentDSRRecvCount++;
|
||||
}
|
||||
|
||||
/* 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 */
|
||||
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
|
||||
* 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(); */
|
||||
}
|
||||
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
|
||||
* restrict bus transfer lengths to be a multiple of 4-bytes
|
||||
* set W1C value to clear the interrupt, this hits the register
|
||||
* first */
|
||||
* first
|
||||
*/
|
||||
reg_buffer[0] = cpu_int_status;
|
||||
/* the remaining 4 values are set to zero which have no-effect */
|
||||
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);
|
||||
|
||||
/* The Interrupt sent to the Host is generated via bit0
|
||||
* of CPU INT register */
|
||||
* of CPU INT register
|
||||
*/
|
||||
if (cpu_int_status & 0x1) {
|
||||
if (pdev && pdev->hif_callbacks.fwEventHandler)
|
||||
/* It calls into HTC which propagates this
|
||||
* to ol_target_failure() */
|
||||
* to ol_target_failure()
|
||||
*/
|
||||
pdev->hif_callbacks.fwEventHandler(pdev->hif_callbacks.
|
||||
Context, QDF_STATUS_E_FAILURE);
|
||||
} else
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
|
||||
("%s: Unable to call fwEventHandler,"
|
||||
" invalid input arguments\n",
|
||||
("%s: Unable to call fwEventHandler, invalid input arguments\n",
|
||||
__func__));
|
||||
|
||||
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
|
||||
* 4 times , this is done to make the access 4-byte
|
||||
* 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 */
|
||||
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 */
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR, ("Target debug interrupt\n"));
|
||||
|
||||
/* clear the interrupt , the debug error interrupt is
|
||||
* counter 0 */
|
||||
/* read counter to clear interrupt */
|
||||
/* clear the interrupt , the debug error interrupt is counter 0
|
||||
* read counter to clear interrupt
|
||||
*/
|
||||
status = hif_read_write(pdev->HIFDevice,
|
||||
COUNT_DEC_ADDRESS,
|
||||
(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
|
||||
* NOTE: other modules like GMBOX may use the counter interrupt
|
||||
* 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)
|
||||
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,
|
||||
* that is we can block, sleep or call any API that
|
||||
* can block or switch thread/task ontexts.
|
||||
* This is a fully schedulable context. */
|
||||
* This is a fully schedulable context.
|
||||
*/
|
||||
do {
|
||||
|
||||
if (pdev->IrqEnableRegisters.int_status_enable == 0) {
|
||||
/* interrupt enables have been cleared, do not try
|
||||
* to process any pending interrupts that
|
||||
* may result in more bus transactions.
|
||||
* The target may be unresponsive at this point. */
|
||||
* The target may be unresponsive at this point.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
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
|
||||
* 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++) {
|
||||
look_ahead[i] = 0;
|
||||
if (host_int_status & (1 << i)) {
|
||||
/* mask out pending mailbox value, we use
|
||||
* "lookAhead" as the real flag for
|
||||
* mailbox processing below */
|
||||
* mailbox processing below
|
||||
*/
|
||||
host_int_status &= ~(1 << i);
|
||||
if (pdev->IrqProcRegisters.
|
||||
rx_lookahead_valid & (1 << i)) {
|
||||
/* mailbox has a message and the
|
||||
* look ahead is valid */
|
||||
* look ahead is valid
|
||||
*/
|
||||
look_ahead[i] =
|
||||
pdev->
|
||||
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) {
|
||||
/* nothing to process, the caller can use this
|
||||
* to break out of a loop */
|
||||
* to break out of a loop
|
||||
*/
|
||||
*done = true;
|
||||
break;
|
||||
}
|
||||
@@ -1273,6 +1309,7 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
|
||||
if (bLookAheadValid) {
|
||||
for (i = 0; i < MAILBOX_USED_COUNT; i++) {
|
||||
int fetched = 0;
|
||||
|
||||
if (look_ahead[i] == 0)
|
||||
continue;
|
||||
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.
|
||||
* This can improve performance by reducing
|
||||
* the context switching when we rapidly
|
||||
* pull packets */
|
||||
* pull packets
|
||||
*/
|
||||
status = hif_dev_recv_message_pending_handler(
|
||||
pdev, i,
|
||||
&look_ahead
|
||||
@@ -1298,7 +1336,8 @@ static QDF_STATUS hif_dev_process_pending_irqs(struct hif_sdio_device *pdev,
|
||||
if (!fetched) {
|
||||
/* HTC could not pull any messages out
|
||||
* due to lack of resources force DSR
|
||||
* handle to ack the interrupt */
|
||||
* handle to ack the interrupt
|
||||
*/
|
||||
*async_processing = false;
|
||||
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
|
||||
* possible side-effects. For example, SPI requires the host
|
||||
* to drain all messages from the mailbox before exiting
|
||||
* the ISR routine. */
|
||||
* the ISR routine.
|
||||
*/
|
||||
if (!(*async_processing) && (pdev->RecheckIRQStatusCnt == 0)) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ,
|
||||
("Bypassing IRQ Status re-check, forcing done\n"));
|
||||
@@ -1380,10 +1420,12 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
|
||||
(unsigned long)pdev));
|
||||
|
||||
/* reset the recv counter that tracks when we need
|
||||
* to yield from the DSR */
|
||||
* to yield from the DSR
|
||||
*/
|
||||
pdev->CurrentDSRRecvCount = 0;
|
||||
/* reset counter used to flag a re-scan of IRQ
|
||||
* status registers on the target */
|
||||
* status registers on the target
|
||||
*/
|
||||
pdev->RecheckIRQStatusCnt = 0;
|
||||
|
||||
while (!done) {
|
||||
@@ -1393,19 +1435,22 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
|
||||
|
||||
if (HIF_DEVICE_IRQ_SYNC_ONLY == pdev->HifIRQProcessingMode) {
|
||||
/* the HIF layer does not allow async IRQ processing,
|
||||
* override the asyncProc flag */
|
||||
* override the asyncProc flag
|
||||
*/
|
||||
async_proc = false;
|
||||
/* this will cause us to re-enter ProcessPendingIRQ()
|
||||
* and re-read interrupt status registers.
|
||||
* This has a nice side effect of blocking us until all
|
||||
* async read requests are completed. This behavior is
|
||||
* 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))
|
||||
/* ProcessPendingIRQs() pulled enough recv
|
||||
* messages to satisfy the yield count, stop
|
||||
* checking for more messages and return */
|
||||
* checking for more messages and return
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1413,7 +1458,8 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
|
||||
/* the function does some async I/O for performance,
|
||||
* we need to exit the ISR immediately, the check below
|
||||
* will prevent the interrupt from being
|
||||
* Ack'd while we handle it asynchronously */
|
||||
* Ack'd while we handle it asynchronously
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1422,11 +1468,13 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
|
||||
if (QDF_IS_STATUS_SUCCESS(status) && !async_proc) {
|
||||
/* Ack the interrupt only if :
|
||||
* 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 the DSR can yield do not ACK the interrupt, there
|
||||
* 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,
|
||||
(" Yield in effect (cur RX count: %d)\n",
|
||||
pdev->CurrentDSRRecvCount));
|
||||
@@ -1440,3 +1488,4 @@ QDF_STATUS hif_dev_dsr_handler(void *context)
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_IRQ, ("-DevDsrHandler\n"));
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@@ -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.
|
||||
*
|
||||
@@ -122,7 +122,8 @@ QDF_STATUS hif_dev_send_buffer(struct hif_sdio_device *pdev,
|
||||
|
||||
if (frag_count > 1) {
|
||||
/* 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) +
|
||||
(nbytes - qdf_nbuf_get_frag_len(buf, frag_count - 1));
|
||||
} else {
|
||||
@@ -162,6 +163,7 @@ QDF_STATUS hif_dev_send_buffer(struct hif_sdio_device *pdev,
|
||||
i++) {
|
||||
int frag_len = qdf_nbuf_get_frag_len(buf, i);
|
||||
unsigned char *frag_addr = qdf_nbuf_get_frag_vaddr(buf, i);
|
||||
|
||||
if (frag_len > nbytes)
|
||||
frag_len = nbytes;
|
||||
memcpy(pData, frag_addr, frag_len);
|
||||
|
@@ -62,11 +62,11 @@
|
||||
#endif /* ATH_BUS_PM */
|
||||
|
||||
#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
|
||||
#define HIF_SDIO_LOAD_TIMEOUT 1000
|
||||
|
||||
struct hif_sdio_softc *scn = NULL;
|
||||
struct hif_sdio_softc *scn;
|
||||
struct hif_softc *ol_sc;
|
||||
static atomic_t hif_sdio_load_state;
|
||||
/* 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;
|
||||
const struct sdio_device_id *id;
|
||||
uint32_t target_type;
|
||||
HIF_ENTER();
|
||||
|
||||
HIF_ENTER();
|
||||
scn = (struct hif_sdio_softc *)qdf_mem_malloc(sizeof(*scn));
|
||||
if (!scn) {
|
||||
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) ==
|
||||
MANUFACTURER_ID_AR6320_BASE) {
|
||||
int ar6kid = id->device & MANUFACTURER_ID_AR6K_REV_MASK;
|
||||
|
||||
if (ar6kid >= 1) {
|
||||
/* v2 or higher silicon */
|
||||
hif_register_tbl_attach(ol_sc,
|
||||
@@ -304,8 +305,8 @@ static int init_ath_hif_sdio(void)
|
||||
static int probed;
|
||||
QDF_STATUS status;
|
||||
struct osdrv_callbacks osdrv_callbacks;
|
||||
HIF_ENTER();
|
||||
|
||||
HIF_ENTER();
|
||||
qdf_mem_zero(&osdrv_callbacks, sizeof(osdrv_callbacks));
|
||||
osdrv_callbacks.device_inserted_handler = hif_sdio_probe;
|
||||
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);
|
||||
if (hif_sdio_device_inserted(dev, id)) {
|
||||
HIF_ERROR("wlan: %s hif_sdio_device_inserted"
|
||||
"failed", __func__);
|
||||
HIF_ERROR("wlan: %s hif_sdio_device_inserted failed", __func__);
|
||||
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_dev *hif_device = scn->hif_handle;
|
||||
|
||||
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_dev *hif_device = scn->hif_handle;
|
||||
|
||||
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_dev *hif_device = hif_ctx->hif_handle;
|
||||
|
||||
hif_mask_interrupt(hif_device);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -76,7 +76,6 @@ static inline int athdiag_procfs_init(void *scn)
|
||||
|
||||
static inline void athdiag_procfs_remove(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@@ -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.
|
||||
*
|
||||
@@ -232,30 +232,35 @@ struct hif_mailbox_properties {
|
||||
};
|
||||
|
||||
struct hif_device_irq_yield_params {
|
||||
int recv_packet_yield_count; /* max number of packets to force DSR
|
||||
to return */
|
||||
int recv_packet_yield_count;
|
||||
/* max number of packets to force DSR to return */
|
||||
};
|
||||
|
||||
struct hif_device_mbox_info {
|
||||
u_int32_t mbox_addresses[4]; /*first element for legacy HIFs and
|
||||
return the address and ARRAY of 32bit words */
|
||||
u_int32_t mbox_addresses[4];
|
||||
/* first element for legacy HIFs and return the address and ARRAY of
|
||||
* 32bit words
|
||||
*/
|
||||
struct hif_mailbox_properties mbox_prop[4];
|
||||
u_int32_t gmbox_address;
|
||||
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 {
|
||||
HIF_DEVICE_IRQ_SYNC_ONLY, /* DSR to process all
|
||||
* interrupts before returning */
|
||||
HIF_DEVICE_IRQ_SYNC_ONLY,
|
||||
/* DSR to process all interrupts before returning */
|
||||
HIF_DEVICE_IRQ_ASYNC_SYNC, /* DSR to process interrupts */
|
||||
};
|
||||
|
||||
struct osdrv_callbacks {
|
||||
void *context; /* context to pass for all callbacks
|
||||
* except device_removed_handler
|
||||
* the device_removed_handler is only
|
||||
* called if the device is claimed */
|
||||
void *context;
|
||||
/* context to pass for all callbacks
|
||||
* except device_removed_handler
|
||||
* the device_removed_handler is only
|
||||
* called if the device is claimed
|
||||
*/
|
||||
int (*device_inserted_handler)(void *context, void *hif_handle);
|
||||
int (*device_removed_handler)(void *claimed_ctx,
|
||||
void *hif_handle);
|
||||
@@ -349,8 +354,8 @@ struct _HIF_SCATTER_REQ {
|
||||
struct _HIF_SCATTER_ITEM scatter_list[1]; /* start of scatter list */
|
||||
};
|
||||
|
||||
typedef struct
|
||||
_HIF_SCATTER_REQ * (*HIF_ALLOCATE_SCATTER_REQUEST)(struct hif_sdio_dev *device);
|
||||
typedef struct _HIF_SCATTER_REQ * (*HIF_ALLOCATE_SCATTER_REQUEST)(
|
||||
struct hif_sdio_dev *device);
|
||||
typedef void (*HIF_FREE_SCATTER_REQUEST)(struct hif_sdio_dev *device,
|
||||
struct _HIF_SCATTER_REQ *request);
|
||||
typedef QDF_STATUS (*HIF_READWRITE_SCATTER)(struct hif_sdio_dev *device,
|
||||
|
@@ -49,7 +49,8 @@
|
||||
/* by default setup a bounce buffer for the data packets,
|
||||
* if the underlying host controller driver
|
||||
* 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 ATH_MODULE_NAME hif
|
||||
#include "a_debug.h"
|
||||
@@ -75,74 +76,70 @@
|
||||
request->address < 0x1FFFF))
|
||||
#endif
|
||||
|
||||
extern struct hif_sdio_softc *sc;
|
||||
|
||||
unsigned int mmcbuswidth = 0;
|
||||
module_param(mmcbuswidth, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int mmcbuswidth;
|
||||
/* PERM:S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH */
|
||||
module_param(mmcbuswidth, uint, 0644);
|
||||
MODULE_PARM_DESC(mmcbuswidth,
|
||||
"Set MMC driver Bus Width: 1-1Bit, 4-4Bit, 8-8Bit");
|
||||
|
||||
unsigned int mmcclock = 0;
|
||||
module_param(mmcclock, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int mmcclock;
|
||||
module_param(mmcclock, uint, 0644);
|
||||
MODULE_PARM_DESC(mmcclock, "Set MMC driver Clock value");
|
||||
|
||||
unsigned int brokenirq = 0;
|
||||
module_param(brokenirq, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int brokenirq;
|
||||
module_param(brokenirq, uint, 0644);
|
||||
MODULE_PARM_DESC(brokenirq,
|
||||
"Set as 1 to use polling method instead of interrupt mode");
|
||||
|
||||
unsigned int forcesleepmode = 0;
|
||||
module_param(forcesleepmode, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int forcesleepmode;
|
||||
module_param(forcesleepmode, uint, 0644);
|
||||
MODULE_PARM_DESC(forcesleepmode,
|
||||
"Set sleep mode: 0-host capbility, "
|
||||
"1-force WOW, 2-force DeepSleep, 3-force CutPower");
|
||||
"Set sleep mode: 0-host capbility, 1-force WOW, 2-force DeepSleep, 3-force CutPower");
|
||||
|
||||
#ifdef CONFIG_X86
|
||||
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,
|
||||
"Delay clock count for aysnc interrupt, "
|
||||
"2 is default, vaild values are 1 and 2");
|
||||
"Delay clock count for async interrupt, 2 is default, valid values are 1 and 2");
|
||||
#else
|
||||
unsigned int asyncintdelay = 0;
|
||||
module_param(asyncintdelay, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int asyncintdelay;
|
||||
module_param(asyncintdelay, uint, 0644);
|
||||
MODULE_PARM_DESC(asyncintdelay,
|
||||
"Delay clock count for aysnc interrupt, "
|
||||
"0 is default, vaild values are 1 and 2");
|
||||
"Delay clock count for async interrupt, 0 is default, valid values are 1 and 2");
|
||||
#endif
|
||||
|
||||
unsigned int forcecard = 0;
|
||||
module_param(forcecard, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int forcecard;
|
||||
module_param(forcecard, uint, 0644);
|
||||
MODULE_PARM_DESC(forcecard,
|
||||
"Ignore card capabilities information to switch bus mode");
|
||||
|
||||
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");
|
||||
|
||||
unsigned int writecccr1 = 0;
|
||||
module_param(writecccr1, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int writecccr1value = 0;
|
||||
module_param(writecccr1value, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int writecccr1;
|
||||
module_param(writecccr1, uint, 0644);
|
||||
unsigned int writecccr1value;
|
||||
module_param(writecccr1value, uint, 0644);
|
||||
|
||||
unsigned int writecccr2 = 0;
|
||||
module_param(writecccr2, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int writecccr2value = 0;
|
||||
module_param(writecccr2value, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int writecccr2;
|
||||
module_param(writecccr2, uint, 0644);
|
||||
unsigned int writecccr2value;
|
||||
module_param(writecccr2value, uint, 0644);
|
||||
|
||||
unsigned int writecccr3 = 0;
|
||||
module_param(writecccr3, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int writecccr3value = 0;
|
||||
module_param(writecccr3value, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int writecccr3;
|
||||
module_param(writecccr3, uint, 0644);
|
||||
unsigned int writecccr3value;
|
||||
module_param(writecccr3value, uint, 0644);
|
||||
|
||||
unsigned int writecccr4 = 0;
|
||||
module_param(writecccr4, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int writecccr4;
|
||||
module_param(writecccr4, uint, 0644);
|
||||
|
||||
unsigned int writecccr4value = 0;
|
||||
module_param(writecccr4value, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int writecccr4value;
|
||||
module_param(writecccr4value, uint, 0644);
|
||||
|
||||
unsigned int modstrength = 0;
|
||||
module_param(modstrength, uint, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
unsigned int modstrength;
|
||||
module_param(modstrength, uint, 0644);
|
||||
MODULE_PARM_DESC(modstrength, "Adjust internal driver strength");
|
||||
|
||||
#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,
|
||||
unsigned char *byte);
|
||||
|
||||
int reset_sdio_on_unload = 0;
|
||||
int reset_sdio_on_unload;
|
||||
module_param(reset_sdio_on_unload, int, 0644);
|
||||
|
||||
uint32_t nohifscattersupport = 1;
|
||||
@@ -315,10 +312,9 @@ QDF_STATUS hif_init(struct osdrv_callbacks *callbacks)
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
|
||||
("%s sdio_register_driver failed!", __func__));
|
||||
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;
|
||||
|
||||
@@ -389,6 +385,7 @@ __hif_read_write(struct hif_sdio_dev *device,
|
||||
if (request & HIF_SDIO_WRITE) {
|
||||
struct hif_device_mbox_info MailBoxInfo;
|
||||
unsigned int mboxLength = 0;
|
||||
|
||||
hif_configure_device(device,
|
||||
HIF_DEVICE_GET_MBOX_ADDR,
|
||||
&MailBoxInfo, sizeof(MailBoxInfo));
|
||||
@@ -416,8 +413,7 @@ __hif_read_write(struct hif_sdio_dev *device,
|
||||
break;
|
||||
}
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
|
||||
("address:%08X, Length:0x%08X, Dummy:0x%04X, "
|
||||
"Final:0x%08X\n",
|
||||
("address:%08X, Length:0x%08X, Dummy:0x%04X, Final:0x%08X\n",
|
||||
address, length,
|
||||
(request & HIF_DUMMY_SPACE_MASK) >> 16,
|
||||
mboxLength ==
|
||||
@@ -426,8 +422,7 @@ __hif_read_write(struct hif_sdio_dev *device,
|
||||
if (mboxLength != 0) {
|
||||
if (length > mboxLength) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
|
||||
("%s: written length(0x%08X) "
|
||||
"larger than mbox len(0x%08x)\n",
|
||||
("%s: written length(0x%08X) larger than mbox len(0x%08x)\n",
|
||||
__func__, length, mboxLength));
|
||||
break;
|
||||
}
|
||||
@@ -467,8 +462,8 @@ __hif_read_write(struct hif_sdio_dev *device,
|
||||
AR_DEBUG_ASSERT(length <= HIF_DMA_BUFFER_SIZE);
|
||||
if (length > HIF_DMA_BUFFER_SIZE) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
|
||||
("%s: Invalid write length:"
|
||||
"%d\n", __func__, length));
|
||||
("%s: Invalid write length: %d\n",
|
||||
__func__, length));
|
||||
status = QDF_STATUS_E_INVAL;
|
||||
break;
|
||||
}
|
||||
@@ -486,8 +481,7 @@ __hif_read_write(struct hif_sdio_dev *device,
|
||||
tbuffer,
|
||||
length);
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
|
||||
("%s: writesb ret=%d address:"
|
||||
" 0x%X, len: %d, 0x%X\n",
|
||||
("%s: writesb ret=%d address: 0x%X, len: %d, 0x%X\n",
|
||||
__func__, ret, address, length,
|
||||
*(int *)tbuffer));
|
||||
} else {
|
||||
@@ -495,8 +489,7 @@ __hif_read_write(struct hif_sdio_dev *device,
|
||||
sdio_memcpy_toio(device->func, address,
|
||||
tbuffer, length);
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
|
||||
("%s: writeio ret=%d address: "
|
||||
" 0x%X, len: %d, 0x%X\n",
|
||||
("%s: writeio ret=%d address: 0x%X, len: %d, 0x%X\n",
|
||||
__func__, ret, address, length,
|
||||
*(int *)tbuffer));
|
||||
}
|
||||
@@ -526,8 +519,7 @@ __hif_read_write(struct hif_sdio_dev *device,
|
||||
address,
|
||||
length);
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
|
||||
("%s: readsb ret=%d address:"
|
||||
" 0x%X, len: %d, 0x%X\n",
|
||||
("%s: readsb ret=%d address: 0x%X, len: %d, 0x%X\n",
|
||||
__func__, ret, address, length,
|
||||
*(int *)tbuffer));
|
||||
} else {
|
||||
@@ -536,8 +528,7 @@ __hif_read_write(struct hif_sdio_dev *device,
|
||||
tbuffer,
|
||||
address, length);
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
|
||||
("%s: readio ret=%d address: 0x%X,"
|
||||
" len: %d, 0x%X\n",
|
||||
("%s: readio ret=%d address: 0x%X, len: %d, 0x%X\n",
|
||||
__func__, ret, address, length,
|
||||
*(int *)tbuffer));
|
||||
}
|
||||
@@ -555,12 +546,10 @@ __hif_read_write(struct hif_sdio_dev *device,
|
||||
|
||||
if (ret) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
|
||||
("%s: SDIO bus operation failed! "
|
||||
"MMC stack returned : %d\n",
|
||||
("%s: SDIO bus operation failed! MMC stack returned : %d\n",
|
||||
__func__, ret));
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
|
||||
("__hif_read_write, addr:0X%06X, "
|
||||
"len:%08d, %s, %s\n",
|
||||
("__hif_read_write, addr:0X%06X, len:%08d, %s, %s\n",
|
||||
address, length,
|
||||
request & HIF_SDIO_READ ? "Read " : "Write",
|
||||
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->func != NULL);
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
|
||||
("%s: device 0x%p addr 0x%X buffer 0x%p "
|
||||
"len %d req 0x%X context 0x%p",
|
||||
("%s: device 0x%p addr 0x%X buffer 0x%p len %d req 0x%X context 0x%p",
|
||||
__func__, device, address, buffer,
|
||||
length, request, context));
|
||||
|
||||
@@ -646,8 +634,7 @@ hif_read_write(struct hif_sdio_dev *device,
|
||||
busrequest = hif_allocate_bus_request(device);
|
||||
if (busrequest == NULL) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
|
||||
("no async bus requests "
|
||||
"available (%s, addr:0x%X, len:%d)\n",
|
||||
("no async bus requests available (%s, addr:0x%X, len:%d)\n",
|
||||
request & HIF_SDIO_READ ? "READ" :
|
||||
"WRITE", address, length));
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
@@ -673,6 +660,7 @@ hif_read_write(struct hif_sdio_dev *device,
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
} else {
|
||||
QDF_STATUS status = busrequest->status;
|
||||
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
|
||||
("%s: sync return freeing 0x%lX: 0x%X\n",
|
||||
__func__,
|
||||
@@ -741,7 +729,8 @@ static int async_task(void *param)
|
||||
}
|
||||
/* we want to hold the host over multiple cmds
|
||||
* if possible, but holding the host blocks
|
||||
* card interrupts */
|
||||
* card interrupts
|
||||
*/
|
||||
sdio_claim_host(device->func);
|
||||
qdf_spin_lock_irqsave(&device->asynclock);
|
||||
/* pull the request to work on */
|
||||
@@ -761,7 +750,8 @@ static int async_task(void *param)
|
||||
/* pass the request to scatter routine which
|
||||
* executes it synchronously, note, no need
|
||||
* 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,
|
||||
request);
|
||||
} else {
|
||||
@@ -777,6 +767,7 @@ static int async_task(void *param)
|
||||
NULL);
|
||||
if (request->request & HIF_ASYNCHRONOUS) {
|
||||
void *context = request->context;
|
||||
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
|
||||
("%s: freeing req: 0x%lX\n",
|
||||
__func__, (unsigned long)
|
||||
@@ -892,8 +883,7 @@ QDF_STATUS reinit_sdio(struct hif_sdio_dev *device)
|
||||
&cmd52_resp);
|
||||
if (err) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("%s: CMD52 read to CCCR speed "
|
||||
"register failed : %d\n",
|
||||
("%s: CMD52 read to CCCR speed register failed : %d\n",
|
||||
__func__, err));
|
||||
sdio_card_state(card);
|
||||
/* no need to break */
|
||||
@@ -903,8 +893,7 @@ QDF_STATUS reinit_sdio(struct hif_sdio_dev *device)
|
||||
(cmd52_resp | SDIO_SPEED_EHS));
|
||||
if (err) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("%s: CMD52 write to CCCR speed"
|
||||
" register failed : %d\n",
|
||||
("%s: CMD52 write to CCCR speed register failed : %d\n",
|
||||
__func__, err));
|
||||
break;
|
||||
}
|
||||
@@ -940,8 +929,7 @@ QDF_STATUS reinit_sdio(struct hif_sdio_dev *device)
|
||||
SDIO_BUS_CD_DISABLE | SDIO_BUS_WIDTH_4BIT);
|
||||
if (err) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("%s: CMD52 to set bus mode "
|
||||
"failed : %d\n",
|
||||
("%s: CMD52 to set bus mode failed : %d\n",
|
||||
__func__, err));
|
||||
break;
|
||||
}
|
||||
@@ -982,7 +970,8 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable)
|
||||
device->id->device & MANUFACTURER_ID_AR6K_BASE_MASK;
|
||||
|
||||
/* 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) {
|
||||
setAsyncIRQ = 1;
|
||||
ret =
|
||||
@@ -994,6 +983,7 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable)
|
||||
} else if (manufacturer_id == MANUFACTURER_ID_AR6320_BASE
|
||||
|| manufacturer_id == MANUFACTURER_ID_QCA9377_BASE) {
|
||||
unsigned char data = 0;
|
||||
|
||||
setAsyncIRQ = 1;
|
||||
ret =
|
||||
func0_cmd52_read_byte(func->card,
|
||||
@@ -1001,8 +991,7 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable)
|
||||
&data);
|
||||
if (ret) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("%s: failed to read interrupt "
|
||||
"extension register %d\n",
|
||||
("%s: failed to read interrupt extension register %d\n",
|
||||
__func__, ret));
|
||||
sdio_release_host(func);
|
||||
return ret;
|
||||
@@ -1019,13 +1008,11 @@ static int sdio_enable4bits(struct hif_sdio_dev *device, int enable)
|
||||
if (setAsyncIRQ) {
|
||||
if (ret) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("%s: failed to setup 4-bit "
|
||||
"ASYNC IRQ mode into %d err %d\n",
|
||||
("%s: failed to setup 4-bit ASYNC IRQ mode into %d err %d\n",
|
||||
__func__, enable, ret));
|
||||
} else {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
|
||||
("%s: Setup 4-bit ASYNC "
|
||||
"IRQ mode into %d successfully\n",
|
||||
("%s: Setup 4-bit ASYNC IRQ mode into %d successfully\n",
|
||||
__func__, enable));
|
||||
}
|
||||
}
|
||||
@@ -1056,7 +1043,8 @@ power_state_change_notify(struct hif_sdio_dev *device,
|
||||
switch (config) {
|
||||
case HIF_DEVICE_POWER_DOWN:
|
||||
/* Disable 4bits to allow SDIO bus to detect
|
||||
* DAT1 as interrupt source */
|
||||
* DAT1 as interrupt source
|
||||
*/
|
||||
sdio_enable4bits(device, 0);
|
||||
break;
|
||||
case HIF_DEVICE_POWER_CUT:
|
||||
@@ -1075,7 +1063,8 @@ power_state_change_notify(struct hif_sdio_dev *device,
|
||||
status = reinit_sdio(device);
|
||||
/* set power_config before EnableFunc to
|
||||
* passthrough sdio r/w action when resuming
|
||||
* from cut power */
|
||||
* from cut power
|
||||
*/
|
||||
device->power_config = config;
|
||||
if (status == QDF_STATUS_SUCCESS)
|
||||
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) {
|
||||
int ret = sdio_enable4bits(device, 1);
|
||||
|
||||
status = (ret == 0) ? QDF_STATUS_SUCCESS :
|
||||
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
|
||||
* stack. This avoids the problem when the SDIO stack
|
||||
* 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,
|
||||
("%s: hif_shut_down_device, resetting\n",
|
||||
__func__));
|
||||
@@ -1400,13 +1391,15 @@ static void hif_irq_handler(struct sdio_func *func)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
struct hif_sdio_dev *device;
|
||||
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
|
||||
("%s: Enter\n", __func__));
|
||||
|
||||
device = get_hif_device(func);
|
||||
atomic_set(&device->irq_handling, 1);
|
||||
/* release the host during intr so we can use
|
||||
* it when we process cmds */
|
||||
* it when we process cmds
|
||||
*/
|
||||
sdio_release_host(device->func);
|
||||
status = device->htc_callbacks.dsrHandler(device->htc_callbacks
|
||||
.context);
|
||||
@@ -1446,6 +1439,7 @@ static int startup_task(void *param)
|
||||
static int enable_task(void *param)
|
||||
{
|
||||
struct hif_sdio_dev *device;
|
||||
|
||||
device = (struct hif_sdio_dev *) param;
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
|
||||
("%s: call from resume_task\n",
|
||||
@@ -1511,10 +1505,11 @@ static void foce_drive_strength(struct sdio_func *func)
|
||||
(unsigned int) err));
|
||||
} else {
|
||||
value = (value &
|
||||
(~CCCR_SDIO_DRIVER_STRENGTH_ENABLE_MASK))
|
||||
| CCCR_SDIO_DRIVER_STRENGTH_ENABLE_A
|
||||
| CCCR_SDIO_DRIVER_STRENGTH_ENABLE_C
|
||||
| CCCR_SDIO_DRIVER_STRENGTH_ENABLE_D;
|
||||
(~CCCR_SDIO_DRIVER_STRENGTH_ENABLE_MASK)
|
||||
) |
|
||||
CCCR_SDIO_DRIVER_STRENGTH_ENABLE_A |
|
||||
CCCR_SDIO_DRIVER_STRENGTH_ENABLE_C |
|
||||
CCCR_SDIO_DRIVER_STRENGTH_ENABLE_D;
|
||||
err = func0_cmd52_write_byte(func->card,
|
||||
addr, value);
|
||||
if (err) {
|
||||
@@ -1623,21 +1618,20 @@ static int hif_device_inserted(struct sdio_func *func,
|
||||
uint32_t clock, clock_set = 12500000;
|
||||
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_TRACE,
|
||||
("%s: Function: "
|
||||
"0x%X, Vendor ID: 0x%X, Device ID: 0x%X, "
|
||||
"block size: 0x%X/0x%X\n",
|
||||
__func__,
|
||||
func->num, func->vendor, id->device,
|
||||
func->max_blksize,
|
||||
func->cur_blksize));
|
||||
("%s: Function: 0x%X, Vendor ID: 0x%X, Device ID: 0x%X, block size: 0x%X/0x%X\n",
|
||||
__func__, func->num, func->vendor, id->device,
|
||||
func->max_blksize, func->cur_blksize));
|
||||
/* 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) {
|
||||
static u64 dma_mask = 0xFFFFFFFF;
|
||||
|
||||
func->dev.dma_mask = &dma_mask;
|
||||
}
|
||||
for (i = 0; i < MAX_HIF_DEVICES; ++i) {
|
||||
struct hif_sdio_dev *hifdevice = hif_devices[i];
|
||||
|
||||
if (hifdevice && hifdevice->power_config == HIF_DEVICE_POWER_CUT
|
||||
&& hifdevice->host == func->card->host) {
|
||||
hifdevice->func = func;
|
||||
@@ -1668,15 +1662,16 @@ static int hif_device_inserted(struct sdio_func *func,
|
||||
}
|
||||
if (i == MAX_HIF_DEVICES) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
|
||||
("%s: No more hif_devices[] slot for %p",
|
||||
__func__, device));
|
||||
("%s: No more hif_devices[] slot for %p",
|
||||
__func__, device));
|
||||
}
|
||||
|
||||
device->id = id;
|
||||
device->host = func->card->host;
|
||||
device->is_disabled = true;
|
||||
/* TODO: MMC SDIO3.0 Setting should also be modified in ReInit()
|
||||
* function when Power Manage work. */
|
||||
/* TODO: MMC SDIO3.0 Setting should also be modified in ReInit()
|
||||
* function when Power Manage work.
|
||||
*/
|
||||
sdio_claim_host(func);
|
||||
/* force driver strength to type D */
|
||||
if (forcedriverstrength == 1)
|
||||
@@ -1723,8 +1718,7 @@ static int hif_device_inserted(struct sdio_func *func,
|
||||
if (ret) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("%s: CMD52 to set bus width failed: %d\n",
|
||||
__func__,
|
||||
ret));
|
||||
__func__, ret));
|
||||
return ret;
|
||||
}
|
||||
device->host->ios.bus_width =
|
||||
@@ -1799,7 +1793,8 @@ static int hif_device_inserted(struct sdio_func *func,
|
||||
|
||||
if (!nohifscattersupport) {
|
||||
/* try to allow scatter operation on all instances,
|
||||
* unless globally overridden */
|
||||
* unless globally overridden
|
||||
*/
|
||||
device->scatter_enabled = true;
|
||||
} else
|
||||
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
|
||||
* in high throughput, so polling method should be used
|
||||
* instead of interrupt mode. */
|
||||
* instead of interrupt mode.
|
||||
*/
|
||||
if (brokenirq) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
|
||||
("%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)
|
||||
{
|
||||
int ret;
|
||||
|
||||
AR_DEBUG_ASSERT(device != 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
|
||||
* of the test. It is expected that the user will also
|
||||
* 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,
|
||||
("%s: reseting SDIO card",
|
||||
__func__));
|
||||
|
||||
/* 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 =
|
||||
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
|
||||
|| manufacturer_id == MANUFACTURER_ID_QCA9377_BASE) {
|
||||
unsigned char data = 0;
|
||||
|
||||
setAsyncIRQ = 1;
|
||||
ret =
|
||||
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
|
||||
* fix interrupt missing issue on dell 8460p */
|
||||
* fix interrupt missing issue on dell 8460p
|
||||
*/
|
||||
if (asyncintdelay != 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,
|
||||
&data);
|
||||
&data);
|
||||
if (ret) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("%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) {
|
||||
unsigned int address = WINDOW_DATA_ADDRESS;
|
||||
unsigned int value = 0x0FFF;
|
||||
ret =
|
||||
sdio_memcpy_toio(device->func, address,
|
||||
|
||||
ret = sdio_memcpy_toio(device->func, address,
|
||||
&value, 4);
|
||||
if (ret) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
|
||||
@@ -2236,9 +2237,8 @@ int hif_device_suspend(struct device *dev)
|
||||
if (device && device->claimed_ctx
|
||||
&& osdrv_callbacks.device_suspend_handler) {
|
||||
device->is_suspend = true;
|
||||
status =
|
||||
osdrv_callbacks.device_suspend_handler(device->claimed_ctx);
|
||||
|
||||
status = osdrv_callbacks.device_suspend_handler(
|
||||
device->claimed_ctx);
|
||||
#if defined(MMC_PM_KEEP_POWER)
|
||||
switch (forcesleepmode) {
|
||||
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)) {
|
||||
/* cut power support */
|
||||
/* 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,
|
||||
("hif_device_suspend: cut power enter\n"));
|
||||
config = HIF_DEVICE_POWER_CUT;
|
||||
@@ -2288,70 +2289,65 @@ int hif_device_suspend(struct device *dev)
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,
|
||||
("hif_device_suspend: cut power success\n"));
|
||||
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) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
|
||||
("%s: set sdio pm flags failed %d\n",
|
||||
("%s: hif config dev 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) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,
|
||||
("%s: hif config dev failed: %d\n",
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
@@ -2442,21 +2438,19 @@ static void hif_device_removed(struct sdio_func *func)
|
||||
{
|
||||
QDF_STATUS status = QDF_STATUS_SUCCESS;
|
||||
struct hif_sdio_dev *device;
|
||||
int i;
|
||||
|
||||
AR_DEBUG_ASSERT(func != NULL);
|
||||
|
||||
HIF_ENTER();
|
||||
|
||||
device = get_hif_device(func);
|
||||
|
||||
if (device->power_config == HIF_DEVICE_POWER_CUT) {
|
||||
device->func = NULL; /* func will be free by mmc stack */
|
||||
return; /* Just return for cut-off mode */
|
||||
} else {
|
||||
int i;
|
||||
for (i = 0; i < MAX_HIF_DEVICES; ++i) {
|
||||
if (hif_devices[i] == device)
|
||||
hif_devices[i] = NULL;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < MAX_HIF_DEVICES; ++i) {
|
||||
if (hif_devices[i] == device)
|
||||
hif_devices[i] = NULL;
|
||||
}
|
||||
|
||||
if (device->claimed_ctx != NULL)
|
||||
|
@@ -160,7 +160,8 @@ QDF_STATUS do_hif_read_write_scatter(struct hif_sdio_dev *device,
|
||||
/* setup each sg entry */
|
||||
if ((unsigned long)req->scatter_list[i].buffer & 0x3) {
|
||||
/* 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,
|
||||
("HIF: (%s) Scatter Buf is unaligned 0x%lx\n",
|
||||
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
|
||||
* I/O thread to process */
|
||||
* I/O thread to process
|
||||
*/
|
||||
add_to_async_list(device, req_priv->busrequest);
|
||||
|
||||
if (request & HIF_SYNCHRONOUS) {
|
||||
@@ -313,15 +315,15 @@ static QDF_STATUS hif_read_write_scatter(struct hif_sdio_dev *device,
|
||||
/* interrupted, exit */
|
||||
status = QDF_STATUS_E_FAILURE;
|
||||
break;
|
||||
} else {
|
||||
status = req->completion_status;
|
||||
}
|
||||
status = req->completion_status;
|
||||
} else {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_SCATTER,
|
||||
("HIF-SCATTER: queued async req: 0x%lX\n",
|
||||
(unsigned long)req_priv->busrequest));
|
||||
/* wake thread, it will process and then take
|
||||
* care of the async callback */
|
||||
* care of the async callback
|
||||
*/
|
||||
up(&device->sem_async);
|
||||
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 <
|
||||
MAX_SCATTER_ENTRIES_PER_REQ) {
|
||||
AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
|
||||
("host only supports scatter of : %d entries,"
|
||||
"need: %d\n",
|
||||
("host only supports scatter of : %d entries, need: %d\n",
|
||||
device->func->card->host->max_segs,
|
||||
MAX_SCATTER_ENTRIES_PER_REQ));
|
||||
status = QDF_STATUS_E_NOSUPPORT;
|
||||
|
@@ -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.
|
||||
*
|
||||
|
@@ -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.
|
||||
*
|
||||
@@ -834,7 +834,7 @@ struct hostdef_s {
|
||||
#define AR6320V3_CPU_PLL_INIT_DONE_ADDR 0x404020
|
||||
#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_48_MHZ = 0,
|
||||
SOC_REFCLK_19_2_MHZ = 1,
|
||||
@@ -844,7 +844,7 @@ typedef enum {
|
||||
SOC_REFCLK_38_4_MHZ = 5,
|
||||
SOC_REFCLK_40_MHZ = 6,
|
||||
SOC_REFCLK_52_MHZ = 7,
|
||||
} A_refclk_speed_t;
|
||||
};
|
||||
|
||||
#define A_REFCLK_UNKNOWN SOC_REFCLK_UNKNOWN
|
||||
#define A_REFCLK_48_MHZ SOC_REFCLK_48_MHZ
|
||||
@@ -866,20 +866,20 @@ struct wlan_pll_s {
|
||||
};
|
||||
|
||||
struct cmnos_clock_s {
|
||||
A_refclk_speed_t refclk_speed;
|
||||
enum a_refclk_speed_t refclk_speed;
|
||||
uint32_t refclk_hz;
|
||||
uint32_t pll_settling_time; /* 50us */
|
||||
struct wlan_pll_s wlan_pll;
|
||||
};
|
||||
|
||||
typedef struct TGT_REG_SECTION {
|
||||
struct tgt_reg_section {
|
||||
uint32_t start_addr;
|
||||
uint32_t end_addr;
|
||||
} tgt_reg_section;
|
||||
};
|
||||
|
||||
|
||||
typedef struct TGT_REG_TABLE {
|
||||
tgt_reg_section *section;
|
||||
struct tgt_reg_table {
|
||||
struct tgt_reg_section *section;
|
||||
uint32_t section_size;
|
||||
} tgt_reg_table;
|
||||
};
|
||||
#endif /* _REGTABLE_SDIO_H_ */
|
||||
|
@@ -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.
|
||||
*
|
||||
@@ -1240,7 +1240,7 @@ typedef struct hostdef_s {
|
||||
#define AR6320V3_CPU_PLL_INIT_DONE_ADDR 0x404020
|
||||
#define AR6320V3_CPU_SPEED_ADDR 0x404024
|
||||
|
||||
typedef enum {
|
||||
enum a_refclk_speed_t {
|
||||
/* Unsupported ref clock -- use PLL Bypass */
|
||||
SOC_REFCLK_UNKNOWN = -1,
|
||||
SOC_REFCLK_48_MHZ = 0,
|
||||
@@ -1251,7 +1251,7 @@ typedef enum {
|
||||
SOC_REFCLK_38_4_MHZ = 5,
|
||||
SOC_REFCLK_40_MHZ = 6,
|
||||
SOC_REFCLK_52_MHZ = 7,
|
||||
} A_refclk_speed_t;
|
||||
};
|
||||
|
||||
#define A_REFCLK_UNKNOWN SOC_REFCLK_UNKNOWN
|
||||
#define A_REFCLK_48_MHZ SOC_REFCLK_48_MHZ
|
||||
@@ -1273,21 +1273,22 @@ struct wlan_pll_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 pll_settling_time; /* 50us */
|
||||
struct wlan_pll_s wlan_pll;
|
||||
};
|
||||
|
||||
typedef struct TGT_REG_SECTION {
|
||||
struct tgt_reg_section {
|
||||
u_int32_t start_addr;
|
||||
u_int32_t end_addr;
|
||||
} tgt_reg_section;
|
||||
};
|
||||
|
||||
typedef struct TGT_REG_TABLE {
|
||||
tgt_reg_section *section;
|
||||
struct tgt_reg_table {
|
||||
struct tgt_reg_section *section;
|
||||
u_int32_t section_size;
|
||||
} tgt_reg_table;
|
||||
};
|
||||
|
||||
void target_register_tbl_attach(struct hif_softc *scn,
|
||||
uint32_t target_type);
|
||||
void hif_register_tbl_attach(struct hif_softc *scn,
|
||||
|
Reference in New Issue
Block a user