]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
rt2x00: Unify rt2800 WPDMA ready waiting functions.
authorGertjan van Wingerde <gwingerde@gmail.com>
Wed, 30 Dec 2009 10:36:32 +0000 (11:36 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 12 Jan 2010 18:51:23 +0000 (13:51 -0500)
The rt2800pci_wait_wpdma_ready and rt2800usb_wait_wpdma_ready functions are
exactly the same, so unify them into rt200lib.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/net/wireless/rt2x00/rt2800lib.h
drivers/net/wireless/rt2x00/rt2800pci.c
drivers/net/wireless/rt2x00/rt2800usb.c

index d300ff84b71797b74713bbcee9ea406fe088a8a2..ca700a402e640329f62ed056f9dcf0f943cd7adf 100644 (file)
@@ -245,6 +245,25 @@ void rt2800_mcu_request(struct rt2x00_dev *rt2x00dev,
 }
 EXPORT_SYMBOL_GPL(rt2800_mcu_request);
 
+int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev)
+{
+       unsigned int i;
+       u32 reg;
+
+       for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
+               rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
+               if (!rt2x00_get_field32(reg, WPDMA_GLO_CFG_TX_DMA_BUSY) &&
+                   !rt2x00_get_field32(reg, WPDMA_GLO_CFG_RX_DMA_BUSY))
+                       return 0;
+
+               msleep(1);
+       }
+
+       ERROR(rt2x00dev, "WPDMA TX/RX busy, aborting.\n");
+       return -EACCES;
+}
+EXPORT_SYMBOL_GPL(rt2800_wait_wpdma_ready);
+
 #ifdef CONFIG_RT2X00_LIB_DEBUGFS
 const struct rt2x00debug rt2800_rt2x00debug = {
        .owner  = THIS_MODULE,
index 535ce22f2ac8c6c20b8faa1d1932211d77e5c798..9adb3431374dd23a65578c26b81f44da29c001b3 100644 (file)
@@ -139,6 +139,7 @@ void rt2800_link_tuner(struct rt2x00_dev *rt2x00dev, struct link_qual *qual,
 int rt2800_init_registers(struct rt2x00_dev *rt2x00dev);
 int rt2800_init_bbp(struct rt2x00_dev *rt2x00dev);
 int rt2800_init_rfcsr(struct rt2x00_dev *rt2x00dev);
+int rt2800_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev);
 
 int rt2800_efuse_detect(struct rt2x00_dev *rt2x00dev);
 void rt2800_read_eeprom_efuse(struct rt2x00_dev *rt2x00dev);
index b93eabb4fbe10b7e65c11a77f916c5d0fe3b6da8..daea0b7c416eec5052ed084ed6a6c39cb8d2b4e0 100644 (file)
@@ -453,24 +453,6 @@ static void rt2800pci_toggle_irq(struct rt2x00_dev *rt2x00dev,
        rt2800_register_write(rt2x00dev, INT_MASK_CSR, reg);
 }
 
-static int rt2800pci_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev)
-{
-       unsigned int i;
-       u32 reg;
-
-       for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
-               rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
-               if (!rt2x00_get_field32(reg, WPDMA_GLO_CFG_TX_DMA_BUSY) &&
-                   !rt2x00_get_field32(reg, WPDMA_GLO_CFG_RX_DMA_BUSY))
-                       return 0;
-
-               msleep(1);
-       }
-
-       ERROR(rt2x00dev, "WPDMA TX/RX busy, aborting.\n");
-       return -EACCES;
-}
-
 static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev)
 {
        u32 reg;
@@ -479,10 +461,10 @@ static int rt2800pci_enable_radio(struct rt2x00_dev *rt2x00dev)
        /*
         * Initialize all registers.
         */
-       if (unlikely(rt2800pci_wait_wpdma_ready(rt2x00dev) ||
+       if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev) ||
                     rt2800pci_init_queues(rt2x00dev) ||
                     rt2800_init_registers(rt2x00dev) ||
-                    rt2800pci_wait_wpdma_ready(rt2x00dev) ||
+                    rt2800_wait_wpdma_ready(rt2x00dev) ||
                     rt2800_init_bbp(rt2x00dev) ||
                     rt2800_init_rfcsr(rt2x00dev)))
                return -EIO;
@@ -562,7 +544,7 @@ static void rt2800pci_disable_radio(struct rt2x00_dev *rt2x00dev)
        rt2800_register_write(rt2x00dev, PBF_SYS_CTRL, 0x00000e00);
 
        /* Wait for DMA, ignore error */
-       rt2800pci_wait_wpdma_ready(rt2x00dev);
+       rt2800_wait_wpdma_ready(rt2x00dev);
 }
 
 static int rt2800pci_set_state(struct rt2x00_dev *rt2x00dev,
index 0510f020dcf56abf48bd297a62e0598e4ad540c6..82755cf8b73e015e979406bd2b37f09f5cabfcc3 100644 (file)
@@ -248,24 +248,6 @@ static void rt2800usb_toggle_rx(struct rt2x00_dev *rt2x00dev,
        rt2800_register_write(rt2x00dev, MAC_SYS_CTRL, reg);
 }
 
-static int rt2800usb_wait_wpdma_ready(struct rt2x00_dev *rt2x00dev)
-{
-       unsigned int i;
-       u32 reg;
-
-       for (i = 0; i < REGISTER_BUSY_COUNT; i++) {
-               rt2800_register_read(rt2x00dev, WPDMA_GLO_CFG, &reg);
-               if (!rt2x00_get_field32(reg, WPDMA_GLO_CFG_TX_DMA_BUSY) &&
-                   !rt2x00_get_field32(reg, WPDMA_GLO_CFG_RX_DMA_BUSY))
-                       return 0;
-
-               msleep(1);
-       }
-
-       ERROR(rt2x00dev, "WPDMA TX/RX busy, aborting.\n");
-       return -EACCES;
-}
-
 static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev)
 {
        u32 reg;
@@ -274,7 +256,7 @@ static int rt2800usb_enable_radio(struct rt2x00_dev *rt2x00dev)
        /*
         * Initialize all registers.
         */
-       if (unlikely(rt2800usb_wait_wpdma_ready(rt2x00dev) ||
+       if (unlikely(rt2800_wait_wpdma_ready(rt2x00dev) ||
                     rt2800_init_registers(rt2x00dev) ||
                     rt2800_init_bbp(rt2x00dev) ||
                     rt2800_init_rfcsr(rt2x00dev)))
@@ -344,7 +326,7 @@ static void rt2800usb_disable_radio(struct rt2x00_dev *rt2x00dev)
        rt2800_register_write(rt2x00dev, TX_PIN_CFG, 0);
 
        /* Wait for DMA, ignore error */
-       rt2800usb_wait_wpdma_ready(rt2x00dev);
+       rt2800_wait_wpdma_ready(rt2x00dev);
 
        rt2x00usb_disable_radio(rt2x00dev);
 }