From: Christian Lamparter Date: Sat, 28 Aug 2010 22:43:04 +0000 (+0200) Subject: carl9170 firmware: rename cab_flush to bcn_ctrl and fix update delay X-Git-Tag: 1.8.8~2 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=fa4d2c34ac5c90976d3821827e7dadb372ad0678;p=carl9170fw.git carl9170 firmware: rename cab_flush to bcn_ctrl and fix update delay Along with the renaming, this patch fixes the weird beacon update delay and removes the previously used workaround for the problem. Signed-off-by: Christian Lamparter --- diff --git a/carlfw/include/carl9170.h b/carlfw/include/carl9170.h index 2ae4f63..72b84b5 100644 --- a/carlfw/include/carl9170.h +++ b/carlfw/include/carl9170.h @@ -45,9 +45,8 @@ struct carl9170_bar_ctx { #ifdef CONFIG_CARL9170FW_CAB_QUEUE enum carl9170_cab_trigger { CARL9170_CAB_TRIGGER_EMPTY = 0, - CARL9170_CAB_TRIGGER_READY = BIT(0), - CARL9170_CAB_TRIGGER_ARMED = BIT(1), - CARL9170_CAB_TRIGGER_DEFER = BIT(2), + CARL9170_CAB_TRIGGER_ARMED = BIT(0), + CARL9170_CAB_TRIGGER_DEFER = BIT(1), }; #endif /* CONFIG_CARL9170FW_CAB_QUEUE */ diff --git a/carlfw/include/cmd.h b/carlfw/include/cmd.h index 8f94383..f99aded 100644 --- a/carlfw/include/cmd.h +++ b/carlfw/include/cmd.h @@ -42,7 +42,7 @@ static inline void __check(void) BUILD_BUG_ON(sizeof(struct carl9170_rf_init_result) != CARL9170_RF_INIT_RESULT_SIZE); BUILD_BUG_ON(sizeof(struct carl9170_psm) != CARL9170_PSM_SIZE); BUILD_BUG_ON(sizeof(struct carl9170_tsf_rsp) != CARL9170_TSF_RSP_SIZE); - BUILD_BUG_ON(sizeof(struct carl9170_cab_flush_cmd) != CARL9170_CAB_FLUSH_CMD_SIZE); + BUILD_BUG_ON(sizeof(struct carl9170_bcn_ctrl_cmd) != CARL9170_BCN_CTRL_CMD_SIZE); BUILD_BUG_ON(sizeof(struct carl9170_tx_status) != CARL9170_TX_STATUS_SIZE); BUILD_BUG_ON(sizeof(struct _carl9170_tx_status) != CARL9170_TX_STATUS_SIZE); BUILD_BUG_ON(sizeof(struct carl9170_gpio) != CARL9170_GPIO_SIZE); diff --git a/carlfw/src/cmd.c b/carlfw/src/cmd.c index 5cfd870..6c9f45e 100644 --- a/carlfw/src/cmd.c +++ b/carlfw/src/cmd.c @@ -82,14 +82,16 @@ void handle_cmd(struct carl9170_rsp *resp) break; #ifdef CONFIG_CARL9170FW_CAB_QUEUE - case CARL9170_CMD_FLUSH_CAB: + case CARL9170_CMD_BCN_CTRL: resp->hdr.len = 0; - if (cmd->cab_flush.mode & CARL9170_CAB_FLUSH_CAB_TRIGGER) { - wlan_cab_modify_dtim_beacon(cmd->cab_flush.vif_id); + if (cmd->bcn_ctrl.mode & CARL9170_BCN_CTRL_CAB_TRIGGER) { + wlan_cab_modify_dtim_beacon(cmd->bcn_ctrl.vif_id); + set(AR9170_MAC_REG_BCN_ADDR, cmd->bcn_ctrl.bcn_addr); + set(AR9170_MAC_REG_BCN_LENGTH, cmd->bcn_ctrl.bcn_len); set(AR9170_MAC_REG_BCN_CTRL, AR9170_BCN_CTRL_READY); } else { - wlan_cab_flush_queue(cmd->cab_flush.vif_id); + wlan_cab_flush_queue(cmd->bcn_ctrl.vif_id); fw.wlan.cab_flush_trigger[i] = CARL9170_CAB_TRIGGER_EMPTY; } break; diff --git a/carlfw/src/wlan.c b/carlfw/src/wlan.c index de13dbf..8bc3d4f 100644 --- a/carlfw/src/wlan.c +++ b/carlfw/src/wlan.c @@ -669,7 +669,7 @@ void wlan_cab_modify_dtim_beacon(const unsigned int vif) fw.wlan.cab_flush_trigger[vif] = CARL9170_CAB_TRIGGER_EMPTY; } - /* Triggered by CARL9170_CAB_TRIGGER_ARMED || CARL9170_CAB_TRIGGER_READY || CARL9170_CAB_TRIGGER_DEFER */ + /* Triggered by CARL9170_CAB_TRIGGER_ARMED || CARL9170_CAB_TRIGGER_DEFER */ if (fw.wlan.cab_flush_trigger[vif]) { /* Set the almighty Multicast Traffic Indication Bit. */ ie->bitmap_ctrl |= 0x1; @@ -685,26 +685,13 @@ static void handle_beacon_config(void) bcn_count = get(AR9170_MAC_REG_BCN_COUNT); send_cmd_to_host(4, CARL9170_RSP_BEACON_CONFIG, 0x00, (uint8_t *) &bcn_count); + + set(AR9170_MAC_REG_BCN_CTRL, AR9170_BCN_CTRL_READY); } static void handle_pretbtt(void) { #ifdef CONFIG_CARL9170FW_CAB_QUEUE -#if CARL9170_INTF_NUM != 2 - /* GCC BUG ? */ - unsigned int i; - - for (i = 0; i < CARL9170_INTF_NUM; i++) { - if (unlikely(fw.wlan.cab_flush_trigger[i] == CARL9170_CAB_TRIGGER_ARMED)) - fw.wlan.cab_flush_trigger[i] = CARL9170_CAB_TRIGGER_READY; - } -#else - if (unlikely(fw.wlan.cab_flush_trigger[0] == CARL9170_CAB_TRIGGER_ARMED)) - fw.wlan.cab_flush_trigger[0] = CARL9170_CAB_TRIGGER_READY; - if (unlikely(fw.wlan.cab_flush_trigger[1] == CARL9170_CAB_TRIGGER_ARMED)) - fw.wlan.cab_flush_trigger[1] = CARL9170_CAB_TRIGGER_READY; -#endif - fw.wlan.cab_flush_time = get_clock_counter(); #endif /* CONFIG_CARL9170FW_CAB_QUEUE */ @@ -745,7 +732,7 @@ static void wlan_janitor(void) unsigned int i; for (i = 0; i < CARL9170_INTF_NUM; i++) { - if (unlikely(fw.wlan.cab_flush_trigger[i] == CARL9170_CAB_TRIGGER_READY)) { + if (unlikely(fw.wlan.cab_flush_trigger[i] == CARL9170_CAB_TRIGGER_ARMED)) { /* * This is hardcoded into carl9170usb driver. * diff --git a/include/shared/fwcmd.h b/include/shared/fwcmd.h index b222260..bf16342 100644 --- a/include/shared/fwcmd.h +++ b/include/shared/fwcmd.h @@ -51,7 +51,7 @@ enum carl9170_cmd_oids { CARL9170_CMD_ECHO = 0x02, CARL9170_CMD_SWRST = 0x03, CARL9170_CMD_REBOOT = 0x04, - CARL9170_CMD_FLUSH_CAB = 0x05, + CARL9170_CMD_BCN_CTRL = 0x05, CARL9170_CMD_READ_TSF = 0x06, /* CAM */ @@ -71,7 +71,7 @@ enum carl9170_cmd_oids { CARL9170_CMD_ASYNC_FLAG), CARL9170_CMD_REBOOT_ASYNC = (CARL9170_CMD_REBOOT | CARL9170_CMD_ASYNC_FLAG), - CARL9170_CMD_FLUSH_CAB_ASYNC = (CARL9170_CMD_FLUSH_CAB | + CARL9170_CMD_BCN_CTRL_ASYNC = (CARL9170_CMD_BCN_CTRL | CARL9170_CMD_ASYNC_FLAG), CARL9170_CMD_PSM_ASYNC = (CARL9170_CMD_PSM | CARL9170_CMD_ASYNC_FLAG), @@ -153,14 +153,16 @@ struct carl9170_psm { } __packed; #define CARL9170_PSM_SIZE 4 -struct carl9170_cab_flush_cmd { +struct carl9170_bcn_ctrl_cmd { __le32 vif_id; __le32 mode; + __le32 bcn_addr; + __le32 bcn_len; } __packed; -#define CARL9170_CAB_FLUSH_CMD_SIZE 8 +#define CARL9170_BCN_CTRL_CMD_SIZE 16 -#define CARL9170_CAB_FLUSH_DRAIN 0 -#define CARL9170_CAB_FLUSH_CAB_TRIGGER 1 +#define CARL9170_BCN_CTRL_DRAIN 0 +#define CARL9170_BCN_CTRL_CAB_TRIGGER 1 struct carl9170_cmd_head { union { @@ -185,7 +187,7 @@ struct carl9170_cmd { struct carl9170_write_reg wreg; struct carl9170_rf_init rf_init; struct carl9170_psm psm; - struct carl9170_cab_flush_cmd cab_flush; + struct carl9170_bcn_ctrl_cmd bcn_ctrl; u8 data[CARL9170_MAX_CMD_PAYLOAD_LEN]; } __packed; } __packed; diff --git a/include/shared/fwdesc.h b/include/shared/fwdesc.h index 2bd4320..54c48f5 100644 --- a/include/shared/fwdesc.h +++ b/include/shared/fwdesc.h @@ -92,8 +92,8 @@ struct carl9170fw_desc_head { #define CARL9170FW_DESC_HEAD_SIZE \ (sizeof(struct carl9170fw_desc_head)) -#define CARL9170FW_OTUS_DESC_MIN_VER 5 -#define CARL9170FW_OTUS_DESC_CUR_VER 5 +#define CARL9170FW_OTUS_DESC_MIN_VER 6 +#define CARL9170FW_OTUS_DESC_CUR_VER 6 struct carl9170fw_otus_desc { struct carl9170fw_desc_head head; __le32 feature_set;