[POWERPC] QE: implement qe_muram_offset
authorAnton Vorontsov <avorontsov@ru.mvista.com>
Tue, 11 Mar 2008 17:24:13 +0000 (20:24 +0300)
committerKumar Gala <galak@kernel.crashing.org>
Thu, 17 Apr 2008 06:01:39 +0000 (01:01 -0500)
qe_muram_offset is the reverse of the qe_muram_addr, will be
used for the Freescale QE USB Host Controller driver.

This patch also moves qe_muram_addr into the qe.h header, plus
adds __iomem hints to use with sparse.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/sysdev/qe_lib/qe.c
include/asm-powerpc/immap_qe.h
include/asm-powerpc/qe.h

index cc81fd1141b031ffe476a12f033a7c925aff8f79..addabcd443a6ba3db3c366d10455a5d1e6508232 100644 (file)
@@ -55,7 +55,7 @@ struct qe_snum {
 /* We allocate this here because it is used almost exclusively for
  * the communication processor devices.
  */
-struct qe_immap *qe_immr = NULL;
+struct qe_immap __iomem *qe_immr;
 EXPORT_SYMBOL(qe_immr);
 
 static struct qe_snum snums[QE_NUM_OF_SNUM];   /* Dynamically allocated SNUMs */
@@ -415,12 +415,6 @@ void qe_muram_dump(void)
 }
 EXPORT_SYMBOL(qe_muram_dump);
 
-void *qe_muram_addr(unsigned long offset)
-{
-       return (void *)&qe_immr->muram[offset];
-}
-EXPORT_SYMBOL(qe_muram_addr);
-
 /* The maximum number of RISCs we support */
 #define MAX_QE_RISC     2
 
index 82a452615097abe24be4ee29281b5a2c16476e0c..924aefbd6a8ed952956a1fdeaafb60412d237a2f 100644 (file)
@@ -468,7 +468,7 @@ struct qe_immap {
        u8                      res18[0xC0000]; /* 0x140000 - 0x200000 */
 } __attribute__ ((packed));
 
-extern struct qe_immap *qe_immr;
+extern struct qe_immap __iomem *qe_immr;
 extern phys_addr_t get_qe_base(void);
 
 static inline unsigned long immrbar_virt_to_phys(void *address)
index 430dc77b35fcbb73f1509326d794f64f1a990970..398534c15cc7294fdb9c41887080557410b548d7 100644 (file)
@@ -92,7 +92,16 @@ unsigned long qe_muram_alloc(int size, int align);
 int qe_muram_free(unsigned long offset);
 unsigned long qe_muram_alloc_fixed(unsigned long offset, int size);
 void qe_muram_dump(void);
-void *qe_muram_addr(unsigned long offset);
+
+static inline void __iomem *qe_muram_addr(unsigned long offset)
+{
+       return (void __iomem *)&qe_immr->muram[offset];
+}
+
+static inline unsigned long qe_muram_offset(void __iomem *addr)
+{
+       return addr - (void __iomem *)qe_immr->muram;
+}
 
 /* Structure that defines QE firmware binary files.
  *