wlcore: remove some unnecessary event mailbox address reads
authorLuciano Coelho <coelho@ti.com>
Wed, 30 Nov 2011 13:02:47 +0000 (15:02 +0200)
committerLuciano Coelho <coelho@ti.com>
Thu, 12 Apr 2012 05:43:58 +0000 (08:43 +0300)
We were reading the even mailbox address three times, which was
completely unnecessary and complicated things regarding partition
selection.  Remove the unnecessry reads and set the address for
mailbox 1 and 2 after the first read.

Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/ti/wlcore/boot.c
drivers/net/wireless/ti/wlcore/event.c
drivers/net/wireless/ti/wlcore/event.h
drivers/net/wireless/ti/wlcore/wlcore.h

index 9520073cab55fcdf8248a38ae7adc46a546a1d70..3cb75db39b9e2ceaff648cd0f835ff40b2fcc68d 100644 (file)
@@ -399,14 +399,19 @@ int wlcore_boot_run_firmware(struct wl1271 *wl)
        /* get hardware config command mail box */
        wl->cmd_box_addr = wlcore_read_reg(wl, REG_COMMAND_MAILBOX_PTR);
 
+       wl1271_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x", wl->cmd_box_addr);
+
        /* get hardware config event mail box */
-       wl->event_box_addr = wlcore_read_reg(wl, REG_EVENT_MAILBOX_PTR);
+       wl->mbox_ptr[0] = wlcore_read_reg(wl, REG_EVENT_MAILBOX_PTR);
+       wl->mbox_ptr[1] = wl->mbox_ptr[0] + sizeof(struct event_mailbox);
 
-       /* set the working partition to its "running" mode offset */
-       wlcore_set_partition(wl, &wl->ptable[PART_WORK]);
+       wl1271_debug(DEBUG_MAILBOX, "MBOX ptrs: 0x%x 0x%x",
+                    wl->mbox_ptr[0], wl->mbox_ptr[1]);
 
-       wl1271_debug(DEBUG_MAILBOX, "cmd_box_addr 0x%x event_box_addr 0x%x",
-                    wl->cmd_box_addr, wl->event_box_addr);
+       /*
+        * TODO: wl12xx used to set the partition here, but it seems
+        * that it can be done later.  Make sure this is okay.
+        */
 
        wl1271_boot_fw_version(wl);
 
@@ -438,7 +443,8 @@ int wlcore_boot_run_firmware(struct wl1271 *wl)
                return ret;
        }
 
-       wl1271_event_mbox_config(wl);
+       /* set the working partition to its "running" mode offset */
+       wlcore_set_partition(wl, &wl->ptable[PART_WORK]);
 
        /* firmware startup completed */
        return 0;
index e3f572cbdf9a6019c085470138b5ee74a5fd9542..292632ddf8901c641a3df880bbb7d34c369a3942 100644 (file)
@@ -278,15 +278,6 @@ int wl1271_event_unmask(struct wl1271 *wl)
        return 0;
 }
 
-void wl1271_event_mbox_config(struct wl1271 *wl)
-{
-       wl->mbox_ptr[0] = wlcore_read_reg(wl, REG_EVENT_MAILBOX_PTR);
-       wl->mbox_ptr[1] = wl->mbox_ptr[0] + sizeof(struct event_mailbox);
-
-       wl1271_debug(DEBUG_EVENT, "MBOX ptrs: 0x%x 0x%x",
-                    wl->mbox_ptr[0], wl->mbox_ptr[1]);
-}
-
 int wl1271_event_handle(struct wl1271 *wl, u8 mbox_num)
 {
        int ret;
index 8acba0d439769b2c18568433d309ec5634eb56b2..8adf18d6c58f74c9bbdaa90474a83466ece2b50b 100644 (file)
@@ -135,7 +135,6 @@ struct event_mailbox {
 struct wl1271;
 
 int wl1271_event_unmask(struct wl1271 *wl);
-void wl1271_event_mbox_config(struct wl1271 *wl);
 int wl1271_event_handle(struct wl1271 *wl, u8 mbox);
 
 #endif
index 5f5dadbf909262ccbb4d922778aca13ea75bf4ad..984dda73134495ac1c59276a7b20d2b6acf29a6a 100644 (file)
@@ -111,7 +111,6 @@ struct wl1271 {
        struct wl1271_chip chip;
 
        int cmd_box_addr;
-       int event_box_addr;
 
        u8 *fw;
        size_t fw_len;