]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
RealView: Move the UART definitions to EB specific files
authorCatalin Marinas <catalin.marinas@arm.com>
Fri, 18 Apr 2008 21:43:11 +0000 (22:43 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 18 Apr 2008 21:43:11 +0000 (22:43 +0100)
Since the PB1176 has different UART base addresses, this patch moves
the definitions form platorm.h to board-eb.h. It also modifies
uncompress.h to detect the platform type at run-time.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm/mach-realview/realview_eb.c
include/asm-arm/arch-realview/board-eb.h
include/asm-arm/arch-realview/platform.h
include/asm-arm/arch-realview/uncompress.h

index c5e5f07b5f5ea52a06630b6c45a6f2d11c835192..f970c9fb155a364b69e7e7a3927b64bd131d5e11 100644 (file)
@@ -78,8 +78,8 @@ static struct map_desc realview_eb_io_desc[] __initdata = {
        },
 #ifdef CONFIG_DEBUG_LL
        {
-               .virtual        = IO_ADDRESS(REALVIEW_UART0_BASE),
-               .pfn            = __phys_to_pfn(REALVIEW_UART0_BASE),
+               .virtual        = IO_ADDRESS(REALVIEW_EB_UART0_BASE),
+               .pfn            = __phys_to_pfn(REALVIEW_EB_UART0_BASE),
                .length         = SZ_4K,
                .type           = MT_DEVICE,
        }
@@ -164,14 +164,14 @@ static void __init realview_eb_map_io(void)
  */
 #define SCI_IRQ                { IRQ_EB_SCI, NO_IRQ }
 #define SCI_DMA                { 7, 6 }
-#define UART0_IRQ      { IRQ_EB_UART0, NO_IRQ }
-#define UART0_DMA      { 15, 14 }
-#define UART1_IRQ      { IRQ_EB_UART1, NO_IRQ }
-#define UART1_DMA      { 13, 12 }
-#define UART2_IRQ      { IRQ_EB_UART2, NO_IRQ }
-#define UART2_DMA      { 11, 10 }
-#define UART3_IRQ      { IRQ_EB_UART3, NO_IRQ }
-#define UART3_DMA      { 0x86, 0x87 }
+#define EB_UART0_IRQ   { IRQ_EB_UART0, NO_IRQ }
+#define EB_UART0_DMA   { 15, 14 }
+#define EB_UART1_IRQ   { IRQ_EB_UART1, NO_IRQ }
+#define EB_UART1_DMA   { 13, 12 }
+#define EB_UART2_IRQ   { IRQ_EB_UART2, NO_IRQ }
+#define EB_UART2_DMA   { 11, 10 }
+#define EB_UART3_IRQ   { IRQ_EB_UART3, NO_IRQ }
+#define EB_UART3_DMA   { 0x86, 0x87 }
 #define SSP_IRQ                { IRQ_EB_SSP, NO_IRQ }
 #define SSP_DMA                { 9, 8 }
 
@@ -180,7 +180,7 @@ AMBA_DEVICE(aaci,  "fpga:04", AACI,     NULL);
 AMBA_DEVICE(mmc0,  "fpga:05", MMCI0,    &realview_mmc0_plat_data);
 AMBA_DEVICE(kmi0,  "fpga:06", KMI0,     NULL);
 AMBA_DEVICE(kmi1,  "fpga:07", KMI1,     NULL);
-AMBA_DEVICE(uart3, "fpga:09", UART3,    NULL);
+AMBA_DEVICE(uart3, "fpga:09", EB_UART3, NULL);
 
 /* DevChip Primecells */
 AMBA_DEVICE(smc,   "dev:00",  SMC,      NULL);
@@ -193,9 +193,9 @@ AMBA_DEVICE(gpio1, "dev:e5",  GPIO1,    NULL);
 AMBA_DEVICE(gpio2, "dev:e6",  GPIO2,    NULL);
 AMBA_DEVICE(rtc,   "dev:e8",  RTC,      NULL);
 AMBA_DEVICE(sci0,  "dev:f0",  SCI,      NULL);
-AMBA_DEVICE(uart0, "dev:f1",  UART0,    NULL);
-AMBA_DEVICE(uart1, "dev:f2",  UART1,    NULL);
-AMBA_DEVICE(uart2, "dev:f3",  UART2,    NULL);
+AMBA_DEVICE(uart0, "dev:f1",  EB_UART0, NULL);
+AMBA_DEVICE(uart1, "dev:f2",  EB_UART1, NULL);
+AMBA_DEVICE(uart2, "dev:f3",  EB_UART2, NULL);
 AMBA_DEVICE(ssp0,  "dev:f4",  SSP,      NULL);
 
 static struct amba_device *amba_devs[] __initdata = {
@@ -388,8 +388,8 @@ static void __init realview_eb_init(void)
 
 MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
        /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
-       .phys_io        = REALVIEW_UART0_BASE,
-       .io_pg_offst    = (IO_ADDRESS(REALVIEW_UART0_BASE) >> 18) & 0xfffc,
+       .phys_io        = REALVIEW_EB_UART0_BASE,
+       .io_pg_offst    = (IO_ADDRESS(REALVIEW_EB_UART0_BASE) >> 18) & 0xfffc,
        .boot_params    = 0x00000100,
        .map_io         = realview_eb_map_io,
        .init_irq       = gic_init_irq,
index 142d77a72f39a465d3bb272574d96f42ed24e33d..565bb937ac86403ffedc808a7b615a62af81743e 100644 (file)
 /*
  * RealView EB + ARM11MPCore peripheral addresses
  */
+#define REALVIEW_EB_UART0_BASE         0x10009000      /* UART 0 */
+#define REALVIEW_EB_UART1_BASE         0x1000A000      /* UART 1 */
+#define REALVIEW_EB_UART2_BASE         0x1000B000      /* UART 2 */
+#define REALVIEW_EB_UART3_BASE         0x1000C000      /* UART 3 */
 #define REALVIEW_EB_TIMER0_1_BASE      0x10011000      /* Timer 0 and 1 */
 #define REALVIEW_EB_TIMER2_3_BASE      0x10012000      /* Timer 2 and 3 */
 #define REALVIEW_EB_GIC_CPU_BASE       0x10040000      /* Generic interrupt controller CPU interface */
index 7aa78a5ebc8865c868961cc233f73a309a421687..d18fb128ed9cd62749618acd204ae36f587b23a6 100644 (file)
 #define REALVIEW_KMI0_BASE            0x10006000       /* KMI interface */
 #define REALVIEW_KMI1_BASE            0x10007000       /* KMI 2nd interface */
 #define REALVIEW_CHAR_LCD_BASE        0x10008000       /* Character LCD */
-#define REALVIEW_UART0_BASE           0x10009000       /* UART 0 */
-#define REALVIEW_UART1_BASE           0x1000A000       /* UART 1 */
-#define REALVIEW_UART2_BASE           0x1000B000       /* UART 2 */
-#define REALVIEW_UART3_BASE           0x1000C000       /* UART 3 */
 #define REALVIEW_SSP_BASE             0x1000D000       /* Synchronous Serial Port */
 #define REALVIEW_SCI_BASE             0x1000E000       /* Smart card controller */
        /* Reserved 0x1000F000 */
index 3d5c2db07a2688c5b564a2ea046dda2e719d8a65..9b790a7e782dd3d6e69acc4dc7523e55ab198d59 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 #include <asm/hardware.h>
+#include <asm/mach-types.h>
 
-#include <asm/arch/platform.h>
+#include <asm/arch/board-eb.h>
 
-#define AMBA_UART_DR   (*(volatile unsigned char *) (REALVIEW_UART0_BASE + 0x00))
-#define AMBA_UART_LCRH (*(volatile unsigned char *) (REALVIEW_UART0_BASE + 0x2c))
-#define AMBA_UART_CR   (*(volatile unsigned char *) (REALVIEW_UART0_BASE + 0x30))
-#define AMBA_UART_FR   (*(volatile unsigned char *) (REALVIEW_UART0_BASE + 0x18))
+#define AMBA_UART_DR(base)     (*(volatile unsigned char *)((base) + 0x00))
+#define AMBA_UART_LCRH(base)   (*(volatile unsigned char *)((base) + 0x2c))
+#define AMBA_UART_CR(base)     (*(volatile unsigned char *)((base) + 0x30))
+#define AMBA_UART_FR(base)     (*(volatile unsigned char *)((base) + 0x18))
+
+/*
+ * Return the UART base address
+ */
+static inline unsigned long get_uart_base(void)
+{
+       if (machine_is_realview_eb())
+               return REALVIEW_EB_UART0_BASE;
+       else
+               return 0;
+}
 
 /*
  * This does not append a newline
  */
 static inline void putc(int c)
 {
-       while (AMBA_UART_FR & (1 << 5))
+       unsigned long base = get_uart_base();
+
+       while (AMBA_UART_FR(base) & (1 << 5))
                barrier();
 
-       AMBA_UART_DR = c;
+       AMBA_UART_DR(base) = c;
 }
 
 static inline void flush(void)
 {
-       while (AMBA_UART_FR & (1 << 3))
+       unsigned long base = get_uart_base();
+
+       while (AMBA_UART_FR(base) & (1 << 3))
                barrier();
 }