carl9170 firmware: rename cab_flush to bcn_ctrl and fix update delay
authorChristian Lamparter <chunkeey@googlemail.com>
Sat, 28 Aug 2010 22:43:04 +0000 (00:43 +0200)
committerChristian Lamparter <chunkeey@googlemail.com>
Sat, 28 Aug 2010 22:43:04 +0000 (00:43 +0200)
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 <chunkeey@googlemail.com>
carlfw/include/carl9170.h
carlfw/include/cmd.h
carlfw/src/cmd.c
carlfw/src/wlan.c
include/shared/fwcmd.h
include/shared/fwdesc.h

index 2ae4f630e3d10e717c21b318d64d3b157cd0c183..72b84b5f8da83a373b40b2e3ec4544d46e8c60c3 100644 (file)
@@ -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 */
 
index 8f943831633fb1bc71c52663e0fc2c2046da6c97..f99adedef27c791e4fee45483736772f3e7dbe6e 100644 (file)
@@ -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);
index 5cfd8705e44786cafd195401f438da71ba5a2239..6c9f45e91c06ef0dddfe6e2582e9e0f16c3915bd 100644 (file)
@@ -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;
index de13dbf317e57495428881e4d53196674e2b7e31..8bc3d4fa4dcc21cdb493d05357c7f941aa72dc1d 100644 (file)
@@ -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.
                         *
index b222260c757ec677a5c4dfda2e8d1cf1474d692c..bf163420b788c1e3a84b2ca390ab9b4ef0a52c9d 100644 (file)
@@ -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;
index 2bd4320845301117f50dfed19f48e8f31de460e5..54c48f59fa7fc88ec0f3c04607c1720769b5be44 100644 (file)
@@ -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;