Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / arch / arm / mach-sa1100 / cerf.c
index 00af122..31afe50 100644 (file)
  * Jan-2004 : Removed io map for flash [FB]
  */
 
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/tty.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <linux/irq.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
 
 #include <asm/irq.h>
 #include <asm/hardware.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
+#include <asm/mach/flash.h>
 #include <asm/mach/map.h>
 #include <asm/mach/serial_sa1100.h>
 
 #include <asm/arch/cerf.h>
+#include <asm/arch/mcp.h>
 #include "generic.h"
 
 static struct resource cerfuart2_resources[] = {
@@ -47,6 +51,48 @@ static struct platform_device *cerf_devices[] __initdata = {
        &cerfuart2_device,
 };
 
+#ifdef CONFIG_SA1100_CERF_FLASH_32MB
+#  define CERF_FLASH_SIZE      0x02000000
+#elif defined CONFIG_SA1100_CERF_FLASH_16MB
+#  define CERF_FLASH_SIZE      0x01000000
+#elif defined CONFIG_SA1100_CERF_FLASH_8MB
+#  define CERF_FLASH_SIZE      0x00800000
+#else
+#  error "Undefined flash size for CERF"
+#endif
+
+static struct mtd_partition cerf_partitions[] = {
+       {
+               .name           = "Bootloader",
+               .size           = 0x00020000,
+               .offset         = 0x00000000,
+       }, {
+               .name           = "Params",
+               .size           = 0x00040000,
+               .offset         = 0x00020000,
+       }, {
+               .name           = "Kernel",
+               .size           = 0x00100000,
+               .offset         = 0x00060000,
+       }, {
+               .name           = "Filesystem",
+               .size           = CERF_FLASH_SIZE-0x00160000,
+               .offset         = 0x00160000,
+       }
+};
+
+static struct flash_platform_data cerf_flash_data = {
+       .map_name       = "cfi_probe",
+       .parts          = cerf_partitions,
+       .nr_parts       = ARRAY_SIZE(cerf_partitions),
+};
+
+static struct resource cerf_flash_resource = {
+       .start          = SA1100_CS0_PHYS,
+       .end            = SA1100_CS0_PHYS + SZ_32M - 1,
+       .flags          = IORESOURCE_MEM,
+};
+
 static void __init cerf_init_irq(void)
 {
        sa1100_init_irq();
@@ -54,8 +100,12 @@ static void __init cerf_init_irq(void)
 }
 
 static struct map_desc cerf_io_desc[] __initdata = {
-  /* virtual    physical    length      type */
-  { 0xf0000000, 0x08000000, 0x00100000, MT_DEVICE }  /* Crystal Ethernet Chip */
+       {       /* Crystal Ethernet Chip */
+               .virtual        =  0xf0000000,
+               .pfn            = __phys_to_pfn(0x08000000),
+               .length         = 0x00100000,
+               .type           = MT_DEVICE
+       }
 };
 
 static void __init cerf_map_io(void)
@@ -71,25 +121,24 @@ static void __init cerf_map_io(void)
        GPDR |= CERF_GPIO_CF_RESET;
 }
 
-static int __init cerf_init(void)
-{
-       int ret;
-
-       if (!machine_is_cerf())
-               return -ENODEV;
-
-       ret = platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
-       if (ret < 0)
-               return ret;
+static struct mcp_plat_data cerf_mcp_data = {
+       .mccr0          = MCCR0_ADM,
+       .sclk_rate      = 11981000,
+};
 
-       return 0;
+static void __init cerf_init(void)
+{
+       platform_add_devices(cerf_devices, ARRAY_SIZE(cerf_devices));
+       sa11x0_set_flash_data(&cerf_flash_data, &cerf_flash_resource, 1);
+       sa11x0_set_mcp_data(&cerf_mcp_data);
 }
 
-arch_initcall(cerf_init);
-
 MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
-       MAINTAINER("support@intrinsyc.com")
-       BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
-       MAPIO(cerf_map_io)
-       INITIRQ(cerf_init_irq)
+       /* Maintainer: support@intrinsyc.com */
+       .phys_io        = 0x80000000,
+       .io_pg_offst    = ((0xf8000000) >> 18) & 0xfffc,
+       .map_io         = cerf_map_io,
+       .init_irq       = cerf_init_irq,
+       .timer          = &sa1100_timer,
+       .init_machine   = cerf_init,
 MACHINE_END