ARM: ICST: merge common ICST VCO structures
[safe/jmp/linux-2.6] / arch / arm / mach-realview / core.c
index 9ea9c05..ac50474 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/io.h>
 #include <linux/smsc911x.h>
 #include <linux/ata_platform.h>
+#include <linux/amba/mmci.h>
 
 #include <asm/clkdev.h>
 #include <asm/system.h>
@@ -44,7 +45,6 @@
 #include <asm/mach/flash.h>
 #include <asm/mach/irq.h>
 #include <asm/mach/map.h>
-#include <asm/mach/mmc.h>
 
 #include <asm/hardware/gic.h>
 
 /* used by entry-macro.S and platsmp.c */
 void __iomem *gic_cpu_base_addr;
 
+#ifdef CONFIG_ZONE_DMA
+/*
+ * Adjust the zones if there are restrictions for DMA access.
+ */
+void __init realview_adjust_zones(int node, unsigned long *size,
+                                 unsigned long *hole)
+{
+       unsigned long dma_size = SZ_256M >> PAGE_SHIFT;
+
+       if (!machine_is_realview_pbx() || node || (size[0] <= dma_size))
+               return;
+
+       size[ZONE_NORMAL] = size[0] - dma_size;
+       size[ZONE_DMA] = dma_size;
+       hole[ZONE_NORMAL] = hole[0];
+       hole[ZONE_DMA] = 0;
+}
+#endif
+
 /*
  * This is the RealView sched_clock implementation.  This has
  * a resolution of 41.7ns, and a maximum value of about 179s.
@@ -208,8 +227,7 @@ struct platform_device realview_i2c_device = {
 
 static struct i2c_board_info realview_i2c_board_info[] = {
        {
-               I2C_BOARD_INFO("rtc-ds1307", 0xd0 >> 1),
-               .type = "ds1338",
+               I2C_BOARD_INFO("ds1338", 0xd0 >> 1),
        },
 };
 
@@ -222,6 +240,9 @@ arch_initcall(realview_i2c_init);
 
 #define REALVIEW_SYSMCI        (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_MCI_OFFSET)
 
+/*
+ * This is only used if GPIOLIB support is disabled
+ */
 static unsigned int realview_mmc_status(struct device *dev)
 {
        struct amba_device *adev = container_of(dev, struct amba_device, dev);
@@ -235,20 +256,24 @@ static unsigned int realview_mmc_status(struct device *dev)
        return readl(REALVIEW_SYSMCI) & mask;
 }
 
-struct mmc_platform_data realview_mmc0_plat_data = {
+struct mmci_platform_data realview_mmc0_plat_data = {
        .ocr_mask       = MMC_VDD_32_33|MMC_VDD_33_34,
        .status         = realview_mmc_status,
+       .gpio_wp        = 17,
+       .gpio_cd        = 16,
 };
 
-struct mmc_platform_data realview_mmc1_plat_data = {
+struct mmci_platform_data realview_mmc1_plat_data = {
        .ocr_mask       = MMC_VDD_32_33|MMC_VDD_33_34,
        .status         = realview_mmc_status,
+       .gpio_wp        = 19,
+       .gpio_cd        = 18,
 };
 
 /*
  * Clock handling
  */
-static const struct icst307_params realview_oscvco_params = {
+static const struct icst_params realview_oscvco_params = {
        .ref            = 24000,
        .vco_max        = 200000,
        .vd_min         = 4 + 8,
@@ -257,7 +282,7 @@ static const struct icst307_params realview_oscvco_params = {
        .rd_max         = 127 + 2,
 };
 
-static void realview_oscvco_set(struct clk *clk, struct icst307_vco vco)
+static void realview_oscvco_set(struct clk *clk, struct icst_vco vco)
 {
        void __iomem *sys_lock = __io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LOCK_OFFSET;
        void __iomem *sys_osc;
@@ -290,41 +315,38 @@ static struct clk ref24_clk = {
 
 static struct clk_lookup lookups[] = {
        {       /* UART0 */
-               .dev_id         = "dev:f1",
+               .dev_id         = "dev:uart0",
                .clk            = &ref24_clk,
        }, {    /* UART1 */
-               .dev_id         = "dev:f2",
+               .dev_id         = "dev:uart1",
                .clk            = &ref24_clk,
        }, {    /* UART2 */
-               .dev_id         = "dev:f3",
+               .dev_id         = "dev:uart2",
                .clk            = &ref24_clk,
        }, {    /* UART3 */
-               .dev_id         = "fpga:09",
+               .dev_id         = "fpga:uart3",
                .clk            = &ref24_clk,
        }, {    /* KMI0 */
-               .dev_id         = "fpga:06",
+               .dev_id         = "fpga:kmi0",
                .clk            = &ref24_clk,
        }, {    /* KMI1 */
-               .dev_id         = "fpga:07",
+               .dev_id         = "fpga:kmi1",
                .clk            = &ref24_clk,
        }, {    /* MMC0 */
-               .dev_id         = "fpga:05",
+               .dev_id         = "fpga:mmc0",
                .clk            = &ref24_clk,
        }, {    /* EB:CLCD */
-               .dev_id         = "dev:20",
+               .dev_id         = "dev:clcd",
                .clk            = &oscvco_clk,
        }, {    /* PB:CLCD */
-               .dev_id         = "issp:20",
+               .dev_id         = "issp:clcd",
                .clk            = &oscvco_clk,
        }
 };
 
 static int __init clk_init(void)
 {
-       int i;
-
-       for (i = 0; i < ARRAY_SIZE(lookups); i++)
-               clkdev_add(&lookups[i]);
+       clkdev_add_table(lookups, ARRAY_SIZE(lookups));
        return 0;
 }
 arch_initcall(clk_init);
@@ -537,7 +559,7 @@ static int realview_clcd_setup(struct clcd_fb *fb)
        fb->panel               = realview_clcd_panel();
 
        fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, framesize,
-                                                   &dma, GFP_KERNEL);
+                                                   &dma, GFP_KERNEL | GFP_DMA);
        if (!fb->fb.screen_base) {
                printk(KERN_ERR "CLCD: unable to map framebuffer\n");
                return -ENOMEM;
@@ -782,3 +804,24 @@ void __init realview_timer_init(unsigned int timer_irq)
        realview_clocksource_init();
        realview_clockevents_init(timer_irq);
 }
+
+/*
+ * Setup the memory banks.
+ */
+void realview_fixup(struct machine_desc *mdesc, struct tag *tags, char **from,
+                   struct meminfo *meminfo)
+{
+       /*
+        * Most RealView platforms have 512MB contiguous RAM at 0x70000000.
+        * Half of this is mirrored at 0.
+        */
+#ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET
+       meminfo->bank[0].start = 0x70000000;
+       meminfo->bank[0].size = SZ_512M;
+       meminfo->nr_banks = 1;
+#else
+       meminfo->bank[0].start = 0;
+       meminfo->bank[0].size = SZ_256M;
+       meminfo->nr_banks = 1;
+#endif
+}