goldfish: clean up staging ifdefs
authorAlan <alan@linux.intel.com>
Mon, 12 May 2014 15:56:56 +0000 (16:56 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 May 2014 20:20:41 +0000 (13:20 -0700)
Use the write helpers and add an audio helper

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/goldfish/goldfish_audio.c
drivers/staging/goldfish/goldfish_nand.c
drivers/staging/goldfish/goldfish_nand_reg.h

index 383bee687151fc889dee4e8c51d99b0f318ce318..cbd456770af09cb64a07f73b9ccc4e9772ce092c 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/sched.h>
 #include <linux/dma-mapping.h>
 #include <linux/uaccess.h>
+#include <linux/goldfish.h>
 
 MODULE_AUTHOR("Google, Inc.");
 MODULE_DESCRIPTION("Android QEMU Audio Driver");
@@ -60,6 +61,8 @@ struct goldfish_audio {
 
 #define AUDIO_READ(data, addr)         (readl(data->reg_base + addr))
 #define AUDIO_WRITE(data, addr, x)     (writel(x, data->reg_base + addr))
+#define AUDIO_WRITE64(data, addr, addr2, x)    \
+       (gf_write64((u64)(x), data->reg_base + addr, data->reg_base+addr2))
 
 /*
  *  temporary variable used between goldfish_audio_probe() and
@@ -78,18 +81,14 @@ enum {
        /* set number of bytes in buffer to write */
        AUDIO_WRITE_BUFFER_1  = 0x10,
        AUDIO_WRITE_BUFFER_2  = 0x14,
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
        AUDIO_SET_WRITE_BUFFER_1_HIGH = 0x28,
        AUDIO_SET_WRITE_BUFFER_2_HIGH = 0x30,
-#endif
 
        /* true if audio input is supported */
        AUDIO_READ_SUPPORTED = 0x18,
        /* buffer to use for audio input */
        AUDIO_SET_READ_BUFFER = 0x1C,
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
        AUDIO_SET_READ_BUFFER_HIGH = 0x34,
-#endif
 
        /* driver writes number of bytes to read */
        AUDIO_START_READ  = 0x20,
@@ -274,9 +273,6 @@ static int goldfish_audio_probe(struct platform_device *pdev)
        struct resource *r;
        struct goldfish_audio *data;
        dma_addr_t buf_addr;
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
-       u32 buf_addr_high, buf_addr_low;
-#endif
 
        data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (data == NULL) {
@@ -332,37 +328,19 @@ static int goldfish_audio_probe(struct platform_device *pdev)
                goto err_misc_register_failed;
        }
 
-#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
-       buf_addr_low = (u32)(buf_addr);
-       buf_addr_high = (u32)((buf_addr) >> 32);
+       AUDIO_WRITE64(data, AUDIO_SET_WRITE_BUFFER_1,
+                               AUDIO_SET_WRITE_BUFFER_1_HIGH, buf_addr);
+       buf_addr += WRITE_BUFFER_SIZE;
 
-       AUDIO_WRITE(data, AUDIO_SET_WRITE_BUFFER_1, buf_addr_low);
-       AUDIO_WRITE(data, AUDIO_SET_WRITE_BUFFER_1_HIGH, buf_addr_high);
+       AUDIO_WRITE64(data, AUDIO_SET_WRITE_BUFFER_2,
+                               AUDIO_SET_WRITE_BUFFER_2_HIGH, buf_addr);
 
-       buf_addr_low = (u32)(buf_addr + WRITE_BUFFER_SIZE);
-       buf_addr_high = (u32)((buf_addr + WRITE_BUFFER_SIZE) >> 32);
-
-       AUDIO_WRITE(data, AUDIO_SET_WRITE_BUFFER_2, buf_addr_low);
-       AUDIO_WRITE(data, AUDIO_SET_WRITE_BUFFER_2_HIGH, buf_addr_high);
-
-       buf_addr_low = (u32)(buf_addr + 2 * WRITE_BUFFER_SIZE);
-       buf_addr_high = (u32)((buf_addr + 2 * WRITE_BUFFER_SIZE) >> 32);
-
-       data->read_supported = AUDIO_READ(data, AUDIO_READ_SUPPORTED);
-       if (data->read_supported){
-                AUDIO_WRITE(data, AUDIO_SET_READ_BUFFER, buf_addr_low);
-                AUDIO_WRITE(data, AUDIO_SET_READ_BUFFER_HIGH, buf_addr_high);
-       }
-#else
-       AUDIO_WRITE(data, AUDIO_SET_WRITE_BUFFER_1, buf_addr);
-       AUDIO_WRITE(data, AUDIO_SET_WRITE_BUFFER_2,
-                                               buf_addr + WRITE_BUFFER_SIZE);
+       buf_addr += WRITE_BUFFER_SIZE;
 
        data->read_supported = AUDIO_READ(data, AUDIO_READ_SUPPORTED);
        if (data->read_supported)
-               AUDIO_WRITE(data, AUDIO_SET_READ_BUFFER,
-                                       buf_addr + 2 * WRITE_BUFFER_SIZE);
-#endif
+               AUDIO_WRITE64(data, AUDIO_SET_READ_BUFFER,
+                               AUDIO_SET_READ_BUFFER_HIGH, buf_addr);
 
        audio_data = data;
        return 0;
index b7ca553dfa29d1fe597f87dd31f74be7fc46b8c0..092604c698b63800046b8453dda5278b61ad52af 100644 (file)
@@ -25,7 +25,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/platform_device.h>
 #include <linux/mutex.h>
-
+#include <linux/goldfish.h>
 #include <asm/div64.h>
 
 #include "goldfish_nand_reg.h"
@@ -86,10 +86,7 @@ static u32 goldfish_nand_cmd(struct mtd_info *mtd, enum nand_cmd cmd,
                writel((u32)(addr >> 32), base + NAND_ADDR_HIGH);
                writel((u32)addr, base + NAND_ADDR_LOW);
                writel(len, base + NAND_TRANSFER_SIZE);
-               writel((u32)ptr, base + NAND_DATA);
-#ifdef CONFIG_64BIT
-               writel((u32)((u64)ptr >> 32), base + NAND_DATA_HIGH);
-#endif
+               gf_write64((u64)ptr, base + NAND_DATA, base + NAND_DATA_HIGH);
                writel(cmd, base + NAND_COMMAND);
                rv = readl(base + NAND_RESULT);
        }
index 60ab91f74be7ee542a33708705525d70ace21cdd..fe7f47c7a5c881670de0a174ac551c03837d58f0 100644 (file)
@@ -57,9 +57,7 @@ enum nand_reg {
        NAND_RESULT         = 0x040,
        NAND_COMMAND        = 0x044,
        NAND_DATA           = 0x048,
-#ifdef CONFIG_64BIT
        NAND_DATA_HIGH      = 0x100,
-#endif
        NAND_TRANSFER_SIZE  = 0x04c,
        NAND_ADDR_LOW       = 0x050,
        NAND_ADDR_HIGH      = 0x054,