]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/arm/mach-pxa/corgi.c
[ARM] 3068/1: Add corgi irda platform support
[karo-tx-linux.git] / arch / arm / mach-pxa / corgi.c
index 3678d1e0e82698c60d07fce8aec8dd9df7e8ad36..656f73bbcb5a9d6c80fb130b95c1cf6e954764ce 100644 (file)
 
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/irq.h>
+#include <asm/arch/irda.h>
 #include <asm/arch/mmc.h>
 #include <asm/arch/udc.h>
 #include <asm/arch/corgi.h>
+#include <asm/arch/sharpsl.h>
 
 #include <asm/mach/sharpsl_param.h>
 #include <asm/hardware/scoop.h>
@@ -109,10 +111,16 @@ struct corgissp_machinfo corgi_ssp_machinfo = {
 /*
  * Corgi Backlight Device
  */
+static struct corgibl_machinfo corgi_bl_machinfo = {
+       .max_intensity = 0x2f,
+       .set_bl_intensity = corgi_bl_set_intensity,
+};
+
 static struct platform_device corgibl_device = {
        .name           = "corgi-bl",
        .dev            = {
                .parent = &corgifb_device.dev,
+               .platform_data  = &corgi_bl_machinfo,
        },
        .id             = -1,
 };
@@ -130,12 +138,29 @@ static struct platform_device corgikbd_device = {
 /*
  * Corgi Touch Screen Device
  */
+static struct resource corgits_resources[] = {
+       [0] = {
+               .start          = CORGI_IRQ_GPIO_TP_INT,
+               .end            = CORGI_IRQ_GPIO_TP_INT,
+               .flags          = IORESOURCE_IRQ,
+       },
+};
+
+static struct corgits_machinfo  corgi_ts_machinfo = {
+       .get_hsync_len   = corgi_get_hsync_len,
+       .put_hsync       = corgi_put_hsync,
+       .wait_hsync      = corgi_wait_hsync,
+};
+
 static struct platform_device corgits_device = {
        .name           = "corgi-ts",
        .dev            = {
                .parent = &corgissp_device.dev,
+               .platform_data  = &corgi_ts_machinfo,
        },
        .id             = -1,
+       .num_resources  = ARRAY_SIZE(corgits_resources),
+       .resource       = corgits_resources,
 };
 
 
@@ -175,13 +200,10 @@ static void corgi_mci_setpower(struct device *dev, unsigned int vdd)
 {
        struct pxamci_platform_data* p_d = dev->platform_data;
 
-       if (( 1 << vdd) & p_d->ocr_mask) {
-               printk(KERN_DEBUG "%s: on\n", __FUNCTION__);
+       if (( 1 << vdd) & p_d->ocr_mask)
                GPSR1 = GPIO_bit(CORGI_GPIO_SD_PWR);
-       } else {
-               printk(KERN_DEBUG "%s: off\n", __FUNCTION__);
+       else
                GPCR1 = GPIO_bit(CORGI_GPIO_SD_PWR);
-       }
 }
 
 static int corgi_mci_get_ro(struct device *dev)
@@ -203,6 +225,22 @@ static struct pxamci_platform_data corgi_mci_platform_data = {
 };
 
 
+/*
+ * Irda
+ */
+static void corgi_irda_transceiver_mode(struct device *dev, int mode)
+{
+       if (mode & IR_OFF)
+               GPSR(CORGI_GPIO_IR_ON) = GPIO_bit(CORGI_GPIO_IR_ON);
+       else
+               GPCR(CORGI_GPIO_IR_ON) = GPIO_bit(CORGI_GPIO_IR_ON);
+}
+
+static struct pxaficp_platform_data corgi_ficp_platform_data = {
+       .transceiver_cap  = IR_SIRMODE | IR_OFF,
+       .transceiver_mode = corgi_irda_transceiver_mode,
+};
+
 
 /*
  * USB Device Controller
@@ -236,11 +274,25 @@ static struct platform_device *devices[] __initdata = {
 
 static void __init corgi_init(void)
 {
+       /* setup sleep mode values */
+       PWER  = 0x00000002;
+       PFER  = 0x00000000;
+       PRER  = 0x00000002;
+       PGSR0 = 0x0158C000;
+       PGSR1 = 0x00FF0080;
+       PGSR2 = 0x0001C004;
+       /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
+       PCFR |= PCFR_OPDE;
+
        corgi_ssp_set_machinfo(&corgi_ssp_machinfo);
 
+       pxa_gpio_mode(CORGI_GPIO_IR_ON | GPIO_OUT);
        pxa_gpio_mode(CORGI_GPIO_USB_PULLUP | GPIO_OUT);
+       pxa_gpio_mode(CORGI_GPIO_HSYNC | GPIO_IN);
+
        pxa_set_udc_info(&udc_info);
        pxa_set_mci_info(&corgi_mci_platform_data);
+       pxa_set_ficp_info(&corgi_ficp_platform_data);
 
        scoop_num = 1;
        scoop_devs = &corgi_pcmcia_scoop[0];
@@ -261,42 +313,14 @@ static void __init fixup_corgi(struct machine_desc *desc,
                mi->bank[0].size = (64*1024*1024);
 }
 
-static void __init corgi_init_irq(void)
-{
-       pxa_init_irq();
-}
-
-static struct map_desc corgi_io_desc[] __initdata = {
-/*    virtual     physical    length      */
-/*     { 0xf1000000, 0x08000000, 0x01000000, MT_DEVICE },*/ /* LCDC (readable for Qt driver) */
-/*     { 0xef700000, 0x10800000, 0x00001000, MT_DEVICE },*/  /* SCOOP */
-       { 0xef800000, 0x00000000, 0x00800000, MT_DEVICE }, /* Boot Flash */
-};
-
-static void __init corgi_map_io(void)
-{
-       pxa_map_io();
-       iotable_init(corgi_io_desc,ARRAY_SIZE(corgi_io_desc));
-
-       /* setup sleep mode values */
-       PWER  = 0x00000002;
-       PFER  = 0x00000000;
-       PRER  = 0x00000002;
-       PGSR0 = 0x0158C000;
-       PGSR1 = 0x00FF0080;
-       PGSR2 = 0x0001C004;
-       /* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
-       PCFR |= PCFR_OPDE;
-}
-
 #ifdef CONFIG_MACH_CORGI
 MACHINE_START(CORGI, "SHARP Corgi")
        .phys_ram       = 0xa0000000,
        .phys_io        = 0x40000000,
        .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
        .fixup          = fixup_corgi,
-       .map_io         = corgi_map_io,
-       .init_irq       = corgi_init_irq,
+       .map_io         = pxa_map_io,
+       .init_irq       = pxa_init_irq,
        .init_machine   = corgi_init,
        .timer          = &pxa_timer,
 MACHINE_END
@@ -308,8 +332,8 @@ MACHINE_START(SHEPHERD, "SHARP Shepherd")
        .phys_io        = 0x40000000,
        .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
        .fixup          = fixup_corgi,
-       .map_io         = corgi_map_io,
-       .init_irq       = corgi_init_irq,
+       .map_io         = pxa_map_io,
+       .init_irq       = pxa_init_irq,
        .init_machine   = corgi_init,
        .timer          = &pxa_timer,
 MACHINE_END
@@ -321,8 +345,8 @@ MACHINE_START(HUSKY, "SHARP Husky")
        .phys_io        = 0x40000000,
        .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
        .fixup          = fixup_corgi,
-       .map_io         = corgi_map_io,
-       .init_irq       = corgi_init_irq,
+       .map_io         = pxa_map_io,
+       .init_irq       = pxa_init_irq,
        .init_machine   = corgi_init,
        .timer          = &pxa_timer,
 MACHINE_END