carl9170 firmware: integrate firmware descriptors
authorChristian Lamparter <chunkeey@googlemail.com>
Wed, 4 Aug 2010 16:09:34 +0000 (18:09 +0200)
committerChristian Lamparter <chunkeey@googlemail.com>
Wed, 4 Aug 2010 16:09:34 +0000 (18:09 +0200)
Merge the USB firmware descriptor into OTAR.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
carlfw/include/fwdsc.h
carlfw/src/fw.c
include/shared/fwdesc.h
tools/carlu/src/fw.c
tools/src/fwinfo.c
tools/src/miniboot.c

index bebe970403c35fcef204c2eed2d8567cecc9b88c..efab7fc5e9edf932cf9890d24e460ba63b301b60 100644 (file)
@@ -30,7 +30,6 @@
 
 struct carl9170_firmware_descriptor {
        struct carl9170fw_otus_desc otus;
-       struct carl9170fw_usb_desc  usb;
        struct carl9170fw_motd_desc motd;
        struct carl9170fw_dbg_desc  dbg;
        struct carl9170fw_last_desc last;
index 7c3310627a8b2ea80e2b71a5f0d9639613fb397b..fe59db56c6a148c701ee842164560f63b62e1c22 100644 (file)
 
 const struct carl9170_firmware_descriptor __section(fwdsc) carl9170fw_desc = {
        FILL(otus, OTUS,
-            .fw_feature_set = cpu_to_le32(BIT(CARL9170FW_DUMMY_FEATURE) |
+            .feature_set = cpu_to_le32(BIT(CARL9170FW_DUMMY_FEATURE) |
+                                       BIT(CARL9170FW_USB_RESP_EP2) |
+#ifdef CONFIG_CARL9170FW_USB_INIT_FIRMWARE
+                                       BIT(CARL9170FW_USB_INIT_FIRMWARE) |
+# ifdef CONFIG_CARL9170FW_USB_UP_STREAM
+                                       BIT(CARL9170FW_USB_UP_STREAM) |
+# endif /* CONFIG_CARL9170FW_USB_UP_STREAM */
+# ifdef CONFIG_CARL9170FW_USB_DOWN_STREAM
+                                       BIT(CARL9170FW_USB_DOWN_STREAM) |
+# endif /* CONFIG_CARL9170FW_USB_DOWN_STREAM */
+#endif /* CONFIG_CARL9170FW_USB_INIT_FIRMWARE */
+#ifdef CONFIG_CARL9170FW_USB_WATCHDOG
+                                       BIT(CARL9170FW_USB_WATCHDOG) |
+#endif /* CONFIG_CARL9170FW_USB_WATCHDOG */
 #ifdef CONFIG_CARL9170FW_RADIO_FUNCTIONS
-                                          BIT(CARL9170FW_COMMAND_PHY) |
+                                       BIT(CARL9170FW_COMMAND_PHY) |
 #endif /* CONFIG_CARL9170FW_RADIO_FUNCTIONS */
 #ifdef CONFIG_CARL9170FW_SECURITY_ENGINE
-                                          BIT(CARL9170FW_COMMAND_CAM) |
+                                       BIT(CARL9170FW_COMMAND_CAM) |
 #endif /* CONFIG_CARL9170FW_SECURITY_ENGINE */
 #ifdef CONFIG_CARL9170FW_CAB_QUEUE
-                                          BIT(CARL9170FW_WLANTX_CAB) |
+                                       BIT(CARL9170FW_WLANTX_CAB) |
 #endif /* CONFIG_CARL9170FW_CAB_QUEUE */
 #ifdef CONFIG_CARL9170FW_HANDLE_BACK_REQ
-                                          BIT(CARL9170FW_HANDLE_BACK_REQ) |
+                                       BIT(CARL9170FW_HANDLE_BACK_REQ) |
 #endif /* CONFIG_CARL9170FW_HANDLE_BACK_REQ */
 #ifdef CONFIG_CARL9170FW_UNUSABLE
-                                          BIT(CARL9170FW_UNUSABLE) |
+                                       BIT(CARL9170FW_UNUSABLE) |
 #endif /* CONFIG_CARL9170FW_UNUSABLE */
 #ifdef CONFIG_CARL9170FW_GPIO_INTERRUPT
-                                          BIT(CARL9170FW_GPIO_INTERRUPT) |
+                                       BIT(CARL9170FW_GPIO_INTERRUPT) |
 #endif /* CONFIG_CARL9170FW_GPIO_INTERRUPT */
 #ifdef CONFIG_CARL9170FW_PSM
-                                          BIT(CARL9170FW_PSM) |
+                                       BIT(CARL9170FW_PSM) |
 #endif
                                           (0)),
-            .bcn_addr = (__le32) cpu_to_le32(&dma_mem.reserved.bcn),
-            .bcn_len = (__le16) cpu_to_le16(sizeof(dma_mem.reserved.bcn)),
-            .vif_num = CARL9170_INTF_NUM,
-            .api_ver = CONFIG_CARL9170FW_RELEASE_VERSION,
-       ),
-
-       FILL(usb, USB,
-            .usb_feature_set = cpu_to_le32(BIT(CARL9170FW_USB_DUMMY_FEATURE) |
-                                           BIT(CARL9170FW_USB_RESP_EP2) |
-#ifdef CONFIG_CARL9170FW_USB_INIT_FIRMWARE
-                                           BIT(CARL9170FW_USB_INIT_FIRMWARE) |
-# ifdef CONFIG_CARL9170FW_USB_UP_STREAM
-                                           BIT(CARL9170FW_USB_UP_STREAM) |
-# endif /* CONFIG_CARL9170FW_USB_UP_STREAM */
-# ifdef CONFIG_CARL9170FW_USB_DOWN_STREAM
-                                           BIT(CARL9170FW_USB_DOWN_STREAM) |
-# endif /* CONFIG_CARL9170FW_USB_DOWN_STREAM */
-#endif /* CONFIG_CARL9170FW_USB_INIT_FIRMWARE */
-#ifdef CONFIG_CARL9170FW_USB_WATCHDOG
-                                           BIT(CARL9170FW_USB_WATCHDOG) |
-#endif /* CONFIG_CARL9170FW_USB_WATCHDOG */
-                                           (0)),
 
             .miniboot_size = cpu_to_le16(0),
             .tx_descs = AR9170_TX_BLOCK_NUMBER,
@@ -85,6 +76,10 @@ const struct carl9170_firmware_descriptor __section(fwdsc) carl9170fw_desc = {
             .rx_max_frame_len = cpu_to_le16(CONFIG_CARL9170FW_RX_FRAME_LEN),
             .tx_frag_len = cpu_to_le16(AR9170_BLOCK_SIZE),
             .fw_address = cpu_to_le32(AR9170_PRAM_OFFSET),
+            .bcn_addr = (__le32) cpu_to_le32(&dma_mem.reserved.bcn),
+            .bcn_len = (__le16) cpu_to_le16(sizeof(dma_mem.reserved.bcn)),
+            .vif_num = CARL9170_INTF_NUM,
+            .api_ver = CONFIG_CARL9170FW_RELEASE_VERSION,
        ),
 
        FILL(motd, MOTD,
index cbf2fd129f05620a07b3d92614926eec4e1a8e1f..03b9ef24c5b91cc2731da34f5daf888a212d3f36 100644 (file)
@@ -25,6 +25,27 @@ enum carl9170fw_feature_list {
        /* Always set */
        CARL9170FW_DUMMY_FEATURE,
 
+       /*
+        * Indicates that this image has special boot block which prevents
+        * legacy drivers to drive the firmware.
+        */
+       CARL9170FW_MINIBOOT,
+
+       /* usb registers are initialized by the firmware */
+       CARL9170FW_USB_INIT_FIRMWARE,
+
+       /* command traps & notifications are send through EP2 */
+       CARL9170FW_USB_RESP_EP2,
+
+       /* usb download (app -> fw) stream */
+       CARL9170FW_USB_DOWN_STREAM,
+
+       /* usb upload (fw -> app) stream */
+       CARL9170FW_USB_UP_STREAM,
+
+       /* USB Watchdog */
+       CARL9170FW_USB_WATCHDOG,
+
        /* unusable - reserved to flag non-functional debug firmwares */
        CARL9170FW_UNUSABLE,
 
@@ -50,37 +71,7 @@ enum carl9170fw_feature_list {
        __CARL9170FW_FEATURE_NUM
 };
 
-enum carl9170fw_usb_feature_list {
-       /* Always set */
-       CARL9170FW_USB_DUMMY_FEATURE,
-
-       /*
-        * Indicates that this image has special boot block which prevents
-        * legacy drivers to drive the firmware.
-        */
-       CARL9170FW_USB_MINIBOOT,
-
-       /* usb registers are initialized by the firmware */
-       CARL9170FW_USB_INIT_FIRMWARE,
-
-       /* command traps & notifications are send through EP2 */
-       CARL9170FW_USB_RESP_EP2,
-
-       /* usb download (app -> fw) stream */
-       CARL9170FW_USB_DOWN_STREAM,
-
-       /* usb upload (fw -> app) stream */
-       CARL9170FW_USB_UP_STREAM,
-
-       /* USB Watchdog */
-       CARL9170FW_USB_WATCHDOG,
-
-       /* KEEP LAST */
-       __CARL9170FW_USB_FEATURE_NUM
-};
-
 #define OTUS_MAGIC     "OTAR"
-#define USB_MAGIC      "USB\0"
 #define MOTD_MAGIC     "MOTD"
 #define FIX_MAGIC      "FIX\0"
 #define DBG_MAGIC      "DBG\0"
@@ -104,33 +95,24 @@ struct carl9170fw_desc_head {
 #define CARL9170FW_DESC_HEAD_SIZE                      \
        (sizeof(struct carl9170fw_desc_head))
 
-#define CARL9170FW_OTUS_DESC_MIN_VER           2
-#define CARL9170FW_OTUS_DESC_CUR_VER           2
+#define CARL9170FW_OTUS_DESC_MIN_VER           3
+#define CARL9170FW_OTUS_DESC_CUR_VER           3
 struct carl9170fw_otus_desc {
        struct carl9170fw_desc_head head;
-       __le32 fw_feature_set;
+       __le32 feature_set;
+       __le32 fw_address;
        __le32 bcn_addr;
        __le16 bcn_len;
-       u8 api_ver;
-       u8 vif_num;
-} __packed;
-#define CARL9170FW_OTUS_DESC_SIZE                      \
-       (sizeof(struct carl9170fw_otus_desc))
-
-#define CARL9170FW_USB_DESC_MIN_VER            3
-#define CARL9170FW_USB_DESC_CUR_VER            3
-struct carl9170fw_usb_desc {
-       struct carl9170fw_desc_head head;
-       __le32 usb_feature_set;
-       __le32 fw_address;
+       __le16 miniboot_size;
        __le16 tx_frag_len;
        __le16 rx_max_frame_len;
-       __le16 miniboot_size;
        u8 tx_descs;
        u8 cmd_bufs;
+       u8 api_ver;
+       u8 vif_num;
 } __packed;
-#define CARL9170FW_USB_DESC_SIZE                       \
-       (sizeof(struct carl9170fw_usb_desc))
+#define CARL9170FW_OTUS_DESC_SIZE                      \
+       (sizeof(struct carl9170fw_otus_desc))
 
 #define CARL9170FW_MOTD_STRING_LEN                     24
 #define CARL9170FW_MOTD_RELEASE_LEN                    20
index 3c23e6c6cf8c8e4dea5d1d17595d01d54b0d5f50..cea5bba02716e73a8ba59c2d24ca3485734c3fad 100644 (file)
@@ -52,12 +52,12 @@ int carlu_fw_check(struct carlu *ar)
                return -EINVAL;
        }
 
-       if (!carl9170fw_supports(otus_desc->fw_feature_set, CARL9170FW_DUMMY_FEATURE)) {
+       if (!carl9170fw_supports(otus_desc->feature_set, CARL9170FW_DUMMY_FEATURE)) {
                err("Invalid Firmware Descriptor.\n");
                return -EIO;
        }
 
-       if (carl9170fw_supports(otus_desc->fw_feature_set, CARL9170FW_UNUSABLE))
+       if (carl9170fw_supports(otus_desc->feature_set, CARL9170FW_UNUSABLE))
                dbg("Firmware is marked as unuseable.\n");
 
        info("Firmware Version: %d.\n", otus_desc->api_ver);
@@ -67,47 +67,47 @@ int carlu_fw_check(struct carlu *ar)
 
 int carlusb_fw_check(struct carlusb *ar)
 {
-       struct carl9170fw_usb_desc *usb_desc;
+       struct carl9170fw_otus_desc *otus_desc;
 
-       usb_desc = carlfw_find_desc(ar->common.fw, (uint8_t *) USB_MAGIC,
-                                   sizeof(*usb_desc),
-                                   CARL9170FW_USB_DESC_CUR_VER);
+       otus_desc = carlfw_find_desc(ar->common.fw, (uint8_t *) OTUS_MAGIC,
+                                    sizeof(*otus_desc),
+                                    CARL9170FW_OTUS_DESC_CUR_VER);
 
-       if (!usb_desc) {
+       if (!otus_desc) {
                err("No valid USB descriptor found.\n");
                return -ENODATA;
        }
 
-       if (!carl9170fw_supports(usb_desc->usb_feature_set, CARL9170FW_USB_DUMMY_FEATURE)) {
+       if (!carl9170fw_supports(otus_desc->feature_set, CARL9170FW_DUMMY_FEATURE)) {
                err("Invalid Firmware Descriptor.\n");
                return -EINVAL;
        }
 
-       if (!carl9170fw_supports(usb_desc->usb_feature_set, CARL9170FW_USB_INIT_FIRMWARE)) {
+       if (!carl9170fw_supports(otus_desc->feature_set, CARL9170FW_USB_INIT_FIRMWARE)) {
                err("Firmware does not know how to initialize USB core.\n");
                return -EOPNOTSUPP;
        }
 
-       if (carl9170fw_supports(usb_desc->usb_feature_set, CARL9170FW_USB_DOWN_STREAM)) {
+       if (carl9170fw_supports(otus_desc->feature_set, CARL9170FW_USB_DOWN_STREAM)) {
                dbg("Enabled tx stream mode.\n");
                ar->common.tx_stream = true;
                ar->common.extra_headroom = sizeof(struct ar9170_stream);
        }
 
-       if (carl9170fw_supports(usb_desc->usb_feature_set, CARL9170FW_USB_UP_STREAM)) {
+       if (carl9170fw_supports(otus_desc->feature_set, CARL9170FW_USB_UP_STREAM)) {
                dbg("Enabled rx stream mode.\n");
                ar->common.rx_stream = true;
        }
 
-       if (carl9170fw_supports(usb_desc->usb_feature_set, CARL9170FW_USB_RESP_EP2))
+       if (carl9170fw_supports(otus_desc->feature_set, CARL9170FW_USB_RESP_EP2))
                dbg("Firmware sends traps over EP2.\n");
 
-       ar->common.dma_chunk_size = le16_to_cpu(usb_desc->tx_frag_len);
-       ar->common.dma_chunks = usb_desc->tx_descs;
-       ar->rx_max = le16_to_cpu(usb_desc->rx_max_frame_len);
+       ar->common.dma_chunk_size = le16_to_cpu(otus_desc->tx_frag_len);
+       ar->common.dma_chunks = otus_desc->tx_descs;
+       ar->rx_max = le16_to_cpu(otus_desc->rx_max_frame_len);
 
-       if (carl9170fw_supports(usb_desc->usb_feature_set, CARL9170FW_USB_MINIBOOT))
-               ar->miniboot_size = le16_to_cpu(usb_desc->miniboot_size);
+       if (carl9170fw_supports(otus_desc->feature_set, CARL9170FW_MINIBOOT))
+               ar->miniboot_size = le16_to_cpu(otus_desc->miniboot_size);
 
        return 0;
 }
index 28ddaca90ef72c4d6617d5c7487a49d4906124d6..3a1a5831db3806c4e6600c7bfcdbd8c215821ae4 100644 (file)
@@ -41,8 +41,22 @@ struct feature_list {
 #define CHECK_FOR_FEATURE_FUNC(feature_enum, _func)                    \
        { .id = feature_enum, .name = #feature_enum, .func = _func }
 
+static void show_miniboot_info(const struct carl9170fw_desc_head *head,
+                              struct carlfw *fw __unused)
+{
+       const struct carl9170fw_otus_desc *otus = (const void *) head;
+
+       fprintf(stdout, "\t\t\tminiboot size: %d Bytes\n", otus->miniboot_size);
+}
+
 static const struct feature_list known_otus_features_v1[] = {
        CHECK_FOR_FEATURE(CARL9170FW_DUMMY_FEATURE),
+       CHECK_FOR_FEATURE_FUNC(CARL9170FW_MINIBOOT, show_miniboot_info),
+       CHECK_FOR_FEATURE(CARL9170FW_USB_INIT_FIRMWARE),
+       CHECK_FOR_FEATURE(CARL9170FW_USB_RESP_EP2),
+       CHECK_FOR_FEATURE(CARL9170FW_USB_DOWN_STREAM),
+       CHECK_FOR_FEATURE(CARL9170FW_USB_UP_STREAM),
+       CHECK_FOR_FEATURE(CARL9170FW_USB_WATCHDOG),
        CHECK_FOR_FEATURE(CARL9170FW_UNUSABLE),
        CHECK_FOR_FEATURE(CARL9170FW_COMMAND_PHY),
        CHECK_FOR_FEATURE(CARL9170FW_COMMAND_CAM),
@@ -77,57 +91,24 @@ static void show_otus_desc(const struct carl9170fw_desc_head *head,
 
        BUILD_BUG_ON(ARRAY_SIZE(known_otus_features_v1) != __CARL9170FW_FEATURE_NUM);
 
+       fprintf(stdout, "\tFirmware upload pointer: 0x%x\n",
+               otus->fw_address);
        fprintf(stdout, "\tBeacon Address: %x, (reserved:%d Bytes)\n",
                le32_to_cpu(otus->bcn_addr), le16_to_cpu(otus->bcn_len));
-       fprintf(stdout, "\tFirmware API Version: %d\n", otus->api_ver);
-       fprintf(stdout, "\tSupported Firmware Interfaces: %d\n", otus->vif_num);
-
-       fprintf(stdout, "\tSupported Features: (raw:%.08x)\n",
-               le32_to_cpu(otus->fw_feature_set));
-
-       check_feature_list(head, otus->fw_feature_set, known_otus_features_v1,
-                          ARRAY_SIZE(known_otus_features_v1), fw);
-}
-
-static void show_miniboot_info(const struct carl9170fw_desc_head *head,
-                              struct carlfw *fw __unused)
-{
-       const struct carl9170fw_usb_desc *usb = (const void *) head;
-
-       fprintf(stdout, "\t\t\tminiboot size: %d Bytes\n", usb->miniboot_size);
-}
-
-static const struct feature_list known_usb_features_v1[] = {
-       CHECK_FOR_FEATURE(CARL9170FW_USB_DUMMY_FEATURE),
-       CHECK_FOR_FEATURE_FUNC(CARL9170FW_USB_MINIBOOT, show_miniboot_info),
-       CHECK_FOR_FEATURE(CARL9170FW_USB_INIT_FIRMWARE),
-       CHECK_FOR_FEATURE(CARL9170FW_USB_RESP_EP2),
-       CHECK_FOR_FEATURE(CARL9170FW_USB_DOWN_STREAM),
-       CHECK_FOR_FEATURE(CARL9170FW_USB_UP_STREAM),
-       CHECK_FOR_FEATURE(CARL9170FW_USB_WATCHDOG),
-};
-
-static void show_usb_desc(const struct carl9170fw_desc_head *head,
-                         struct carlfw *fw __unused)
-{
-       const struct carl9170fw_usb_desc *usb = (const void *) head;
-
-       BUILD_BUG_ON(ARRAY_SIZE(known_usb_features_v1) != __CARL9170FW_USB_FEATURE_NUM);
-
        fprintf(stdout, "\tTX DMA chunk size:%d Bytes, TX DMA chunks:%d\n",
-               usb->tx_frag_len, usb->tx_descs);
+               otus->tx_frag_len, otus->tx_descs);
        fprintf(stdout, "\t=> %d Bytes are reserved for the TX queues\n",
-               usb->tx_frag_len * usb->tx_descs);
-       fprintf(stdout, "\tCommand response buffers:%d\n", usb->cmd_bufs);
+               otus->tx_frag_len * otus->tx_descs);
+       fprintf(stdout, "\tCommand response buffers:%d\n", otus->cmd_bufs);
        fprintf(stdout, "\tMax. RX stream block size:%d Bytes\n",
-               usb->rx_max_frame_len);
-       fprintf(stdout, "\tFirmware upload pointer: 0x%x\n",
-               usb->fw_address);
+               otus->rx_max_frame_len);
+       fprintf(stdout, "\tSupported Firmware Interfaces: %d\n", otus->vif_num);
+       fprintf(stdout, "\tFirmware API Version: %d\n", otus->api_ver);
        fprintf(stdout, "\tSupported Features: (raw:%.08x)\n",
-               le32_to_cpu(usb->usb_feature_set));
+               le32_to_cpu(otus->feature_set));
 
-       check_feature_list(head, usb->usb_feature_set, known_usb_features_v1,
-                          ARRAY_SIZE(known_usb_features_v1), fw);
+       check_feature_list(head, otus->feature_set, known_otus_features_v1,
+                          ARRAY_SIZE(known_otus_features_v1), fw);
 }
 
 static void show_motd_desc(const struct carl9170fw_desc_head *head,
@@ -216,7 +197,6 @@ static const struct {
        uint16_t size;
 } known_magics[] = {
        ADD_HANDLER(OTUS, show_otus_desc),
-       ADD_HANDLER(USB, show_usb_desc),
        ADD_HANDLER(MOTD, show_motd_desc),
        ADD_HANDLER(DBG, show_dbg_desc),
        ADD_HANDLER(FIX, show_fix_desc),
index ca4630b9566423d66e98f0baf0cec69e729ae9cf..cd0beb448a5008e55909f5e560c1910dfbfd43c7 100644 (file)
@@ -48,7 +48,6 @@ static int add_mini(struct carlfw *fw, const char *mini)
 {
        struct stat file_stat;
        struct carl9170fw_otus_desc *otus_desc = NULL;
-       struct carl9170fw_usb_desc *usb_desc = NULL;
        FILE *m = NULL;
        char *buf = NULL;
        size_t extra;
@@ -79,21 +78,13 @@ static int add_mini(struct carlfw *fw, const char *mini)
                goto fail;
        }
 
-       usb_desc = carlfw_find_desc(fw, (uint8_t *) USB_MAGIC,
-                                   sizeof(*usb_desc),
-                                   CARL9170FW_USB_DESC_CUR_VER);
-       if (!usb_desc) {
-               fprintf(stderr, "Firmware is not for USB devices.\n");
-               goto fail;
-       }
-
-       if (carl9170fw_supports(usb_desc->usb_feature_set, CARL9170FW_USB_MINIBOOT)) {
+       if (carl9170fw_supports(otus_desc->feature_set, CARL9170FW_MINIBOOT)) {
                fprintf(stderr, "Firmware has already a miniboot image.\n");
                goto fail;
        }
 
-       usb_desc->usb_feature_set |= cpu_to_le32(BIT(CARL9170FW_USB_MINIBOOT));
-       usb_desc->miniboot_size = cpu_to_le16(extra);
+       otus_desc->feature_set |= cpu_to_le32(BIT(CARL9170FW_MINIBOOT));
+       otus_desc->miniboot_size = cpu_to_le16(extra);
 
        buf = carlfw_mod_headroom(fw, extra);
        if (IS_ERR_OR_NULL(buf)) {
@@ -121,24 +112,24 @@ fail:
 
 static int del_mini(struct carlfw *fw)
 {
-       struct carl9170fw_usb_desc *usb_desc = NULL;
+       struct carl9170fw_otus_desc *otus_desc = NULL;
        void *buf;
        int cut;
 
-       usb_desc = carlfw_find_desc(fw, (uint8_t *) USB_MAGIC,
-                                   sizeof(*usb_desc),
-                                   CARL9170FW_USB_DESC_CUR_VER);
-       if (!usb_desc) {
+       otus_desc = carlfw_find_desc(fw, (uint8_t *) OTUS_MAGIC,
+                                    sizeof(*otus_desc),
+                                    CARL9170FW_OTUS_DESC_CUR_VER);
+       if (!otus_desc) {
                fprintf(stderr, "Firmware is not for USB devices.\n");
                return -ENODATA;
        }
 
-       if (!carl9170fw_supports(usb_desc->usb_feature_set, CARL9170FW_USB_MINIBOOT)) {
+       if (!carl9170fw_supports(otus_desc->feature_set, CARL9170FW_MINIBOOT)) {
                fprintf(stderr, "Firmware has no miniboot image.\n");
                return -EINVAL;
        }
 
-       cut = le16_to_cpu(usb_desc->miniboot_size);
+       cut = le16_to_cpu(otus_desc->miniboot_size);
 
        buf = carlfw_mod_headroom(fw, -cut);
        if (IS_ERR_OR_NULL(buf)) {
@@ -146,8 +137,8 @@ static int del_mini(struct carlfw *fw)
                return PTR_ERR(buf);
        }
 
-       usb_desc->usb_feature_set &= cpu_to_le32(~BIT(CARL9170FW_USB_MINIBOOT));
-       usb_desc->miniboot_size = cpu_to_le16(0);
+       otus_desc->feature_set &= cpu_to_le32(~BIT(CARL9170FW_MINIBOOT));
+       otus_desc->miniboot_size = cpu_to_le16(0);
 
        carlfw_store(fw);
        return 0;