Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / arm / mach-sa1100 / h3600.c
index 9868d41..b04d922 100644 (file)
@@ -25,6 +25,9 @@
 #include <linux/kernel.h>
 #include <linux/tty.h>
 #include <linux/pm.h>
+#include <linux/device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
 #include <linux/serial_core.h>
 
 #include <asm/irq.h>
@@ -34,6 +37,8 @@
 
 #include <asm/mach/irq.h>
 #include <asm/mach/arch.h>
+#include <asm/mach/flash.h>
+#include <asm/mach/irda.h>
 #include <asm/mach/map.h>
 #include <asm/mach/serial_sa1100.h>
 
 struct ipaq_model_ops ipaq_model_ops;
 EXPORT_SYMBOL(ipaq_model_ops);
 
+static struct mtd_partition h3xxx_partitions[] = {
+       {
+               .name           = "H3XXX boot firmware",
+               .size           = 0x00040000,
+               .offset         = 0,
+               .mask_flags     = MTD_WRITEABLE,  /* force read-only */
+       }, {
+#ifdef CONFIG_MTD_2PARTS_IPAQ
+               .name           = "H3XXX root jffs2",
+               .size           = MTDPART_SIZ_FULL,
+               .offset         = 0x00040000,
+#else
+               .name           = "H3XXX kernel",
+               .size           = 0x00080000,
+               .offset         = 0x00040000,
+       }, {
+               .name           = "H3XXX params",
+               .size           = 0x00040000,
+               .offset         = 0x000C0000,
+       }, {
+#ifdef CONFIG_JFFS2_FS
+               .name           = "H3XXX root jffs2",
+               .size           = MTDPART_SIZ_FULL,
+               .offset         = 0x00100000,
+#else
+               .name           = "H3XXX initrd",
+               .size           = 0x00100000,
+               .offset         = 0x00100000,
+       }, {
+               .name           = "H3XXX root cramfs",
+               .size           = 0x00300000,
+               .offset         = 0x00200000,
+       }, {
+               .name           = "H3XXX usr cramfs",
+               .size           = 0x00800000,
+               .offset         = 0x00500000,
+       }, {
+               .name           = "H3XXX usr local",
+               .size           = MTDPART_SIZ_FULL,
+               .offset         = 0x00d00000,
+#endif
+#endif
+       }
+};
+
+static void h3xxx_set_vpp(int vpp)
+{
+       assign_h3600_egpio(IPAQ_EGPIO_VPP_ON, vpp);
+}
+
+static struct flash_platform_data h3xxx_flash_data = {
+       .map_name       = "cfi_probe",
+       .set_vpp        = h3xxx_set_vpp,
+       .parts          = h3xxx_partitions,
+       .nr_parts       = ARRAY_SIZE(h3xxx_partitions),
+};
+
+static struct resource h3xxx_flash_resource = {
+       .start          = SA1100_CS0_PHYS,
+       .end            = SA1100_CS0_PHYS + SZ_32M - 1,
+       .flags          = IORESOURCE_MEM,
+};
+
+/*
+ * This turns the IRDA power on or off on the Compaq H3600
+ */
+static int h3600_irda_set_power(struct device *dev, unsigned int state)
+{
+       assign_h3600_egpio( IPAQ_EGPIO_IR_ON, state );
+
+       return 0;
+}
+
+static void h3600_irda_set_speed(struct device *dev, unsigned int speed)
+{
+       if (speed < 4000000) {
+               clr_h3600_egpio(IPAQ_EGPIO_IR_FSEL);
+       } else {
+               set_h3600_egpio(IPAQ_EGPIO_IR_FSEL);
+       }
+}
+
+static struct irda_platform_data h3600_irda_data = {
+       .set_power      = h3600_irda_set_power,
+       .set_speed      = h3600_irda_set_speed,
+};
+
+static void h3xxx_mach_init(void)
+{
+       sa11x0_set_flash_data(&h3xxx_flash_data, &h3xxx_flash_resource, 1);
+       sa11x0_set_irda_data(&h3600_irda_data);
+}
+
 /*
  * low-level UART features
  */
@@ -125,10 +223,22 @@ static void h3xxx_lcd_power(int enable)
 }
 
 static struct map_desc h3600_io_desc[] __initdata = {
- /* virtual           physical           length      type */
-  { H3600_BANK_2_VIRT, SA1100_CS2_PHYS,   0x02800000, MT_DEVICE }, /* static memory bank 2  CS#2 */
-  { H3600_BANK_4_VIRT, SA1100_CS4_PHYS,   0x00800000, MT_DEVICE }, /* static memory bank 4  CS#4 */
-  { H3600_EGPIO_VIRT,  H3600_EGPIO_PHYS,  0x01000000, MT_DEVICE }, /* EGPIO 0          CS#5 */
+       {       /* static memory bank 2  CS#2 */
+               .virtual        =  H3600_BANK_2_VIRT,
+               .pfn            = __phys_to_pfn(SA1100_CS2_PHYS),
+               .length         = 0x02800000,
+               .type           = MT_DEVICE
+       }, {    /* static memory bank 4  CS#4 */
+               .virtual        =  H3600_BANK_4_VIRT,
+               .pfn            = __phys_to_pfn(SA1100_CS4_PHYS),
+               .length         = 0x00800000,
+               .type           = MT_DEVICE
+       }, {    /* EGPIO 0              CS#5 */
+               .virtual        =  H3600_EGPIO_VIRT,
+               .pfn            = __phys_to_pfn(H3600_EGPIO_PHYS),
+               .length         = 0x01000000,
+               .type           = MT_DEVICE
+       }
 };
 
 /*
@@ -282,10 +392,13 @@ static void __init h3100_map_io(void)
 }
 
 MACHINE_START(H3100, "Compaq iPAQ H3100")
-       BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
-       BOOT_PARAMS(0xc0000100)
-       MAPIO(h3100_map_io)
-       INITIRQ(sa1100_init_irq)
+       .phys_io        = 0x80000000,
+       .io_pg_offst    = ((0xf8000000) >> 18) & 0xfffc,
+       .boot_params    = 0xc0000100,
+       .map_io         = h3100_map_io,
+       .init_irq       = sa1100_init_irq,
+       .timer          = &sa1100_timer,
+       .init_machine   = h3xxx_mach_init,
 MACHINE_END
 
 #endif /* CONFIG_SA1100_H3100 */
@@ -396,10 +509,13 @@ static void __init h3600_map_io(void)
 }
 
 MACHINE_START(H3600, "Compaq iPAQ H3600")
-       BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
-       BOOT_PARAMS(0xc0000100)
-       MAPIO(h3600_map_io)
-       INITIRQ(sa1100_init_irq)
+       .phys_io        = 0x80000000,
+       .io_pg_offst    = ((0xf8000000) >> 18) & 0xfffc,
+       .boot_params    = 0xc0000100,
+       .map_io         = h3600_map_io,
+       .init_irq       = sa1100_init_irq,
+       .timer          = &sa1100_timer,
+       .init_machine   = h3xxx_mach_init,
 MACHINE_END
 
 #endif /* CONFIG_SA1100_H3600 */
@@ -625,7 +741,7 @@ static void h3800_IRQ_demux(unsigned int irq, struct irqdesc *desc, struct pt_re
 static struct irqaction h3800_irq = {
        .name           = "h3800_asic",
        .handler        = h3800_IRQ_demux,
-       .flags          = SA_INTERRUPT,
+       .flags          = SA_INTERRUPT | SA_TIMER,
 };
 
 u32 kpio_int_shadow = 0;
@@ -779,10 +895,13 @@ static void __init h3800_map_io(void)
 }
 
 MACHINE_START(H3800, "Compaq iPAQ H3800")
-       BOOT_MEM(0xc0000000, 0x80000000, 0xf8000000)
-       BOOT_PARAMS(0xc0000100)
-       MAPIO(h3800_map_io)
-       INITIRQ(h3800_init_irq)
+       .phys_io        = 0x80000000,
+       .io_pg_offst    = ((0xf8000000) >> 18) & 0xfffc,
+       .boot_params    = 0xc0000100,
+       .map_io         = h3800_map_io,
+       .init_irq       = h3800_init_irq,
+       .timer          = &sa1100_timer,
+       .init_machine   = h3xxx_mach_init,
 MACHINE_END
 
 #endif /* CONFIG_SA1100_H3800 */