Orion: initialise mbus DRAM target info on boot
authorLennert Buytenhek <buytenh@wantstofly.org>
Thu, 27 Mar 2008 18:51:39 +0000 (14:51 -0400)
committerNicolas Pitre <nico@marvell.com>
Thu, 27 Mar 2008 18:51:39 +0000 (14:51 -0400)
Initialise orion_mbus_dram_info on boot, and prepare for passing
this info into peripheral drivers.

Signed-off-by: Lennert Buytenhek <buytenh@marvell.com>
Reviewed-by: Tzachi Perelstein <tzachi@marvell.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Nicolas Pitre <nico@marvell.com>
arch/arm/mach-orion/addr-map.c
arch/arm/mach-orion/common.c
arch/arm/mach-orion/common.h

index 58cc3c0333b6b3ee46a2db6f852d865f3dddf147..ab4484cc14b770a53ccaf57d385a975ce5efb96d 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
+#include <linux/mbus.h>
 #include <asm/hardware.h>
 #include "common.h"
 
 #define SATA_WIN_BASE(win)     ORION_SATA_REG(0x34 + ((win) * 0x10))
 #define SATA_MAX_WIN           4
 
+
+struct mbus_dram_target_info orion_mbus_dram_info;
+
 static int __init orion_cpu_win_can_remap(u32 win)
 {
        u32 dev, rev;
@@ -257,6 +261,7 @@ void __init orion_setup_cpu_win(enum orion_target target, u32 base, u32 size, in
 void __init orion_setup_cpu_wins(void)
 {
        int i;
+       int cs;
 
        /*
         * First, disable and clear windows
@@ -281,6 +286,30 @@ void __init orion_setup_cpu_wins(void)
                                ORION_PCIE_MEM_SIZE, -1);
        orion_setup_cpu_win(ORION_PCI_MEM, ORION_PCI_MEM_PHYS_BASE,
                                ORION_PCI_MEM_SIZE, -1);
+
+       /*
+        * Setup MBUS dram target info.
+        */
+       orion_mbus_dram_info.mbus_dram_target_id = TARGET_DDR;
+
+       for (i = 0, cs = 0; i < 4; i++) {
+               u32 base = readl(DDR_BASE_CS(i));
+               u32 size = readl(DDR_SIZE_CS(i));
+
+               /*
+                * Chip select enabled?
+                */
+               if (size & 1) {
+                       struct mbus_dram_window *w;
+
+                       w = &orion_mbus_dram_info.cs[cs++];
+                       w->cs_index = i;
+                       w->mbus_attr = 0xf & ~(1 << i);
+                       w->base = base & 0xff000000;
+                       w->size = (size | 0x00ffffff) + 1;
+               }
+       }
+       orion_mbus_dram_info.num_cs = cs;
 }
 
 /*
index bbc2b4ec932ca8a407188a3810a3dcbcfd317840..cd9aa43bb47405549c0a576aa76a2d3dfe9bd936 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/serial_8250.h>
+#include <linux/mbus.h>
 #include <linux/mv643xx_eth.h>
 #include <linux/mv643xx_i2c.h>
 #include <asm/page.h>
index 501497cc2c4df431658a0b036358d374d5f86c5a..2718245ec4ae2b8e402af272b4ae268709e34fa5 100644 (file)
@@ -29,6 +29,7 @@ enum orion_target {
        ORION_MAX_TARGETS
 };
 
+extern struct mbus_dram_target_info orion_mbus_dram_info;
 void orion_setup_cpu_win(enum orion_target target, u32 base, u32 size, int remap);
 void orion_setup_cpu_wins(void);
 void orion_setup_eth_wins(void);