ARM: clps711x: Using a single definition for the PHYS and VIRT registers offset
authorAlexander Shiyan <shc_work@mail.ru>
Sun, 6 May 2012 05:21:57 +0000 (09:21 +0400)
committerArnd Bergmann <arnd@arndb.de>
Fri, 11 May 2012 14:18:01 +0000 (16:18 +0200)
Using a single definition for the physical and virtual address register for all
variants boards clps711x. This patch also includes the use of a single function
clps_read/write in some units.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
14 files changed:
arch/arm/include/asm/hardware/clps7111.h
arch/arm/include/asm/hardware/ep7211.h
arch/arm/include/asm/hardware/ep7212.h
arch/arm/mach-clps711x/common.c
arch/arm/mach-clps711x/include/mach/debug-macro.S
arch/arm/mach-clps711x/include/mach/entry-macro.S
arch/arm/mach-clps711x/include/mach/hardware.h
arch/arm/mach-clps711x/include/mach/time.h
arch/arm/mach-clps711x/include/mach/uncompress.h
arch/arm/mach-clps711x/p720t-leds.c
drivers/mtd/nand/autcpu12.c
drivers/mtd/nand/h1910.c
drivers/tty/serial/clps711x.c
drivers/video/clps711xfb.c

index 44477225aed60fdbc9f1ac56eba5853a3663ba7e..78e2856b06dc7adca2212d22736ade70a8a1e8c9 100644 (file)
 #ifndef __ASM_HARDWARE_CLPS7111_H
 #define __ASM_HARDWARE_CLPS7111_H
 
-#define CLPS7111_PHYS_BASE     (0x80000000)
-
-#ifndef __ASSEMBLY__
-#define clps_readb(off)                __raw_readb(CLPS7111_BASE + (off))
-#define clps_readw(off)                __raw_readw(CLPS7111_BASE + (off))
-#define clps_readl(off)                __raw_readl(CLPS7111_BASE + (off))
-#define clps_writeb(val,off)   __raw_writeb(val, CLPS7111_BASE + (off))
-#define clps_writew(val,off)   __raw_writew(val, CLPS7111_BASE + (off))
-#define clps_writel(val,off)   __raw_writel(val, CLPS7111_BASE + (off))
-#endif
+#define CLPS711X_PHYS_BASE     (0x80000000)
 
 #define PADR           (0x0000)
 #define PBDR           (0x0001)
index 654d5f625c49c4b938a6eede027869836c3e73ea..4b3f86bf1bfc69d3f5821dd8ca0ab0fc1acc2d4e 100644 (file)
 #ifndef __ASM_HARDWARE_EP7211_H
 #define __ASM_HARDWARE_EP7211_H
 
-#include <asm/hardware/clps7111.h>
-
-/*
- * define EP7211_BASE to be the base address of the region
- * you want to access.
- */
-
-#define EP7211_PHYS_BASE       (0x80000000)
-
 /*
  * XXX miket@bluemug.com: need to introduce EP7211 registers (those not
  * present in 7212) here.
index 3b43bbeaf1db453523254aaa241c3250c5ad1dbe..aad07f77dcffe40ddf49482382805cb31bed996c 100644 (file)
 #ifndef __ASM_HARDWARE_EP7212_H
 #define __ASM_HARDWARE_EP7212_H
 
-/*
- * define EP7212_BASE to be the base address of the region
- * you want to access.
- */
-
-#define EP7212_PHYS_BASE       (0x80000000)
-
-#ifndef __ASSEMBLY__
-#define ep_readl(off)          __raw_readl(EP7212_BASE + (off))
-#define ep_writel(val,off)     __raw_writel(val, EP7212_BASE + (off))
-#endif
-
 /*
  * These registers are specific to the EP7212 only
  */
index 3c5b5bbf24e51e991bc142ae09f3016e5b7e294a..b6dfd2f22cd405c0d96a2f6ddc34db68e928cbc1 100644 (file)
@@ -36,7 +36,6 @@
 #include <asm/page.h>
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
-#include <asm/hardware/clps7111.h>
 #include <asm/system_misc.h>
 
 /*
@@ -44,8 +43,8 @@
  */
 static struct map_desc clps711x_io_desc[] __initdata = {
        {
-               .virtual        = CLPS7111_VIRT_BASE,
-               .pfn            = __phys_to_pfn(CLPS7111_PHYS_BASE),
+               .virtual        = (unsigned long)CLPS711X_VIRT_BASE,
+               .pfn            = __phys_to_pfn(CLPS711X_PHYS_BASE),
                .length         = SZ_1M,
                .type           = MT_DEVICE
        }
index b802e8a51831b8879d535de86561abbeacad0e33..118b3d9305730c2d213e15bd9fc1a10e773735b2 100644 (file)
@@ -12,7 +12,6 @@
 */
 
 #include <mach/hardware.h>
-#include <asm/hardware/clps7111.h>
 
                .macro  addruart, rp, rv, tmp
 #ifndef CONFIG_DEBUG_CLPS711X_UART2
@@ -20,8 +19,8 @@
 #else
                mov     \rp, #0x1000    @ UART2
 #endif
-               orr     \rv, \rp, #CLPS7111_VIRT_BASE
-               orr     \rp, \rp, #CLPS7111_PHYS_BASE
+               orr     \rv, \rp, #CLPS711X_VIRT_BASE
+               orr     \rp, \rp, #CLPS711X_PHYS_BASE
                .endm
 
                .macro  senduart,rd,rx
index 125af59d7a29f90089d16e10d669ead3297d44db..56e5c2c23504f8e476147b8df36cc5ed3e5aead4 100644 (file)
@@ -8,7 +8,6 @@
  * warranty of any kind, whether express or implied.
  */
 #include <mach/hardware.h>
-#include <asm/hardware/clps7111.h>
 
                .macro  get_irqnr_preamble, base, tmp
                .endm
@@ -18,7 +17,7 @@
 #endif
 
                .macro  get_irqnr_and_base, irqnr, stat, base, mask
-               mov     \base, #CLPS7111_BASE
+               mov     \base, #CLPS711X_VIRT_BASE
                ldr     \stat, [\base, #INTSR1]
                ldr     \mask, [\base, #INTMR1]
                mov     \irqnr, #4
index d0b7d870be9c82d0febc7e76a2c90d107c789340..1026ac9687063d8b887466249b705d1d9a996334 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#ifndef __ASM_ARCH_HARDWARE_H
-#define __ASM_ARCH_HARDWARE_H
+#ifndef __MACH_HARDWARE_H
+#define __MACH_HARDWARE_H
 
+#include <asm/hardware/clps7111.h>
+
+#define CLPS711X_VIRT_BASE     IOMEM(0xff000000)
 
-#define CLPS7111_VIRT_BASE     0xff000000
-#define CLPS7111_BASE          CLPS7111_VIRT_BASE
+#ifndef __ASSEMBLY__
+#define clps_readb(off)                readb(CLPS711X_VIRT_BASE + (off))
+#define clps_readw(off)                readw(CLPS711X_VIRT_BASE + (off))
+#define clps_readl(off)                readl(CLPS711X_VIRT_BASE + (off))
+#define clps_writeb(val,off)   writeb(val, CLPS711X_VIRT_BASE + (off))
+#define clps_writew(val,off)   writew(val, CLPS711X_VIRT_BASE + (off))
+#define clps_writel(val,off)   writel(val, CLPS711X_VIRT_BASE + (off))
+#endif
 
 /*
  * The physical addresses that the external chip select signals map to is
 
 #if defined (CONFIG_ARCH_EP7211)
 
-#define EP7211_VIRT_BASE       CLPS7111_VIRT_BASE
-#define EP7211_BASE            CLPS7111_VIRT_BASE
 #include <asm/hardware/ep7211.h>
 
 #elif defined (CONFIG_ARCH_EP7212)
 
-#define EP7212_VIRT_BASE       CLPS7111_VIRT_BASE
-#define EP7212_BASE            CLPS7111_VIRT_BASE
 #include <asm/hardware/ep7212.h>
 
 #endif
 
 #if  defined (CONFIG_ARCH_AUTCPU12)
 
-#define  CS89712_VIRT_BASE     CLPS7111_VIRT_BASE
-#define  CS89712_BASE          CLPS7111_VIRT_BASE
-
-#include <asm/hardware/clps7111.h>
 #include <asm/hardware/ep7212.h>
 #include <asm/hardware/cs89712.h>
 
 
 #if defined (CONFIG_ARCH_CDB89712)
 
-#include <asm/hardware/clps7111.h>
 #include <asm/hardware/ep7212.h>
 #include <asm/hardware/cs89712.h>
 
-/* static cdb89712_map_io() areas */
-#define REGISTER_START   0x80000000
-#define REGISTER_SIZE    0x4000
-#define REGISTER_BASE    0xff000000
-
 #define ETHER_START      0x20000000
 #define ETHER_SIZE       0x1000
 #define ETHER_BASE       0xfe000000
 
 #if defined (CONFIG_ARCH_CEIVA)
 
-#define  CEIVA_VIRT_BASE       CLPS7111_VIRT_BASE
-#define  CEIVA_BASE            CLPS7111_VIRT_BASE
-
-#include <asm/hardware/clps7111.h>
 #include <asm/hardware/ep7212.h>
 
-
 /*
  * The two flash banks are wired to chip selects 0 and 1. This is the mapping
  * for them.
index 61fef9129c6a09ecc33284665146414efede2e66..5f65865884cecec998fe1488f47ea11eecc9c16c 100644 (file)
@@ -18,7 +18,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 #include <asm/leds.h>
-#include <asm/hardware/clps7111.h>
+#include <mach/hardware.h>
 
 extern void clps711x_setup_timer(void);
 
index 35ed731b9f160e8476278964da62d040e3d83b60..263f8393ccb7d09f2b0029768db46ef81addb1af 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-#include <mach/hardware.h>
 #include <asm/hardware/clps7111.h>
 
-#undef CLPS7111_BASE
-#define CLPS7111_BASE CLPS7111_PHYS_BASE
-
-#define __raw_readl(p)         (*(unsigned long *)(p))
-#define __raw_writel(v,p)      (*(unsigned long *)(p) = (v))
-
 #ifdef CONFIG_DEBUG_CLPS711X_UART2
 #define SYSFLGx        SYSFLG2
 #define UARTDRx        UARTDR2
 #define UARTDRx        UARTDR1
 #endif
 
+#define phys_reg(x)    (*(volatile u32 *)(CLPS711X_PHYS_BASE + (x)))
+
 /*
+ * The following code assumes the serial port has already been
+ * initialized by the bootloader.  If you didn't setup a port in
+ * your bootloader then nothing will appear (which might be desired).
+ *
  * This does not append a newline
  */
 static inline void putc(int c)
 {
-       while (clps_readl(SYSFLGx) & SYSFLG_UTXFF)
+       while (phys_reg(SYSFLGx) & SYSFLG_UTXFF)
                barrier();
-       clps_writel(c, UARTDRx);
+       phys_reg(UARTDRx) = c;
 }
 
 static inline void flush(void)
 {
-       while (clps_readl(SYSFLGx) & SYSFLG_UBUSY)
+       while (phys_reg(SYSFLGx) & SYSFLG_UBUSY)
                barrier();
 }
 
index dd9a6cdbeb020ff169fccfb33965923e5e2680d8..bbc449fbe14a42fee5e8da951171f4f53f89a6ad 100644 (file)
@@ -27,9 +27,6 @@
 #include <asm/leds.h>
 #include <asm/mach-types.h>
 
-#include <asm/hardware/clps7111.h>
-#include <asm/hardware/ep7212.h>
-
 static void p720t_leds_event(led_event_t ledevt)
 {
        unsigned long flags;
index 2e42ec2e8ff48a285b939e7510ea91d22dd6035f..04769a49a7cbd1c6d60980ad651c241416f16d15 100644 (file)
@@ -102,10 +102,10 @@ static void autcpu12_hwcontrol(struct mtd_info *mtd, int cmd,
                void __iomem *addr;
                unsigned char bits;
 
-               addr = CS89712_VIRT_BASE + AUTCPU12_SMC_PORT_OFFSET;
-               bits = (ctrl & NAND_CLE) << 4;
+               bits = clps_readb(AUTCPU12_SMC_PORT_OFFSET) & ~0x30;
+               bits |= (ctrl & NAND_CLE) << 4;
                bits |= (ctrl & NAND_ALE) << 2;
-               writeb((readb(addr) & ~0x30) | bits, addr);
+               clps_writeb(bits, AUTCPU12_SMC_PORT_OFFSET);
 
                addr = autcpu12_fio_base + AUTCPU12_SMC_SELECT_OFFSET;
                writeb((readb(addr) & ~0x1) | (ctrl & NAND_NCE), addr);
@@ -120,9 +120,7 @@ static void autcpu12_hwcontrol(struct mtd_info *mtd, int cmd,
  */
 int autcpu12_device_ready(struct mtd_info *mtd)
 {
-       void __iomem *addr = CS89712_VIRT_BASE + AUTCPU12_SMC_PORT_OFFSET;
-
-       return readb(addr) & AUTCPU12_SMC_RDY;
+       return clps_readb(AUTCPU12_SMC_PORT_OFFSET) & AUTCPU12_SMC_RDY;
 }
 
 /*
index 11e487813428735082ce544ace9d150345ef68d1..9bf5ce5fa22d0a5c6ad67d0800131efd27157ebb 100644 (file)
@@ -24,7 +24,7 @@
 #include <linux/mtd/nand.h>
 #include <linux/mtd/partitions.h>
 #include <asm/io.h>
-#include <mach/hardware.h>     /* for CLPS7111_VIRT_BASE */
+#include <mach/hardware.h>
 #include <asm/sizes.h>
 #include <mach/h1900-gpio.h>
 #include <mach/ipaq.h>
index 836fe2731234bbeabe690ef41ee230588cedea1b..d0f719fafc841f07022adb734b0d2187360e6d05 100644 (file)
@@ -40,7 +40,6 @@
 
 #include <mach/hardware.h>
 #include <asm/irq.h>
-#include <asm/hardware/clps7111.h>
 
 #define UART_NR                2
 
index 99b354b8e2571db68f4a2d4f061829273d53de31..f994c8b8f10a4c14a2b1a4610eca1a4a8dfc3661 100644 (file)
@@ -33,7 +33,6 @@
 #include <asm/mach-types.h>
 #include <linux/uaccess.h>
 
-#include <asm/hardware/clps7111.h>
 #include <mach/syspld.h>
 
 struct fb_info *cfb;
This page took 0.036325 seconds and 5 git commands to generate.