Merge git://git.infradead.org/battery-2.6
[pandora-kernel.git] / arch / arm / mach-omap2 / board-h4.c
index 996aeda..f125f43 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/arch/arm/mach-omap/omap2/board-h4.c
+ * linux/arch/arm/mach-omap2/board-h4.c
  *
  * Copyright (C) 2005 Nokia Corporation
  * Author: Paul Mundt <paul.mundt@nokia.com>
@@ -39,7 +39,6 @@
 #include "prcm-regs.h"
 
 #include <asm/io.h>
-#include <asm/delay.h>
 
 static unsigned int row_gpios[6] = { 88, 89, 124, 11, 6, 96 };
 static unsigned int col_gpios[7] = { 90, 91, 100, 36, 12, 97, 98 };
@@ -132,26 +131,6 @@ static struct platform_device h4_flash_device = {
        .resource       = &h4_flash_resource,
 };
 
-static struct resource h4_smc91x_resources[] = {
-       [0] = {
-               .start  = OMAP24XX_ETHR_START,          /* Physical */
-               .end    = OMAP24XX_ETHR_START + 0xf,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
-               .end    = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device h4_smc91x_device = {
-       .name           = "smc91x",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(h4_smc91x_resources),
-       .resource       = h4_smc91x_resources,
-};
-
 /* Select between the IrDA and aGPS module
  */
 static int h4_select_irda(struct device *dev, int state)
@@ -179,9 +158,11 @@ static int h4_select_irda(struct device *dev, int state)
        return err;
 }
 
-static void set_trans_mode(void *data)
+static void set_trans_mode(struct work_struct *work)
 {
-       int *mode = data;
+       struct omap_irda_config *irda_config =
+               container_of(work, struct omap_irda_config, gpio_expa.work);
+       int mode = irda_config->mode;
        unsigned char expa;
        int err = 0;
 
@@ -191,7 +172,7 @@ static void set_trans_mode(void *data)
 
        expa &= ~0x01;
 
-       if (!(*mode & IR_SIRMODE)) { /* MIR/FIR */
+       if (!(mode & IR_SIRMODE)) { /* MIR/FIR */
                expa |= 0x01;
        }
 
@@ -204,9 +185,10 @@ static int h4_transceiver_mode(struct device *dev, int mode)
 {
        struct omap_irda_config *irda_config = dev->platform_data;
 
+       irda_config->mode = mode;
        cancel_delayed_work(&irda_config->gpio_expa);
-       PREPARE_WORK(&irda_config->gpio_expa, set_trans_mode, &mode);
-       schedule_work(&irda_config->gpio_expa);
+       PREPARE_DELAYED_WORK(&irda_config->gpio_expa, set_trans_mode);
+       schedule_delayed_work(&irda_config->gpio_expa, 0);
 
        return 0;
 }
@@ -265,14 +247,13 @@ static struct platform_device h4_lcd_device = {
 };
 
 static struct platform_device *h4_devices[] __initdata = {
-       &h4_smc91x_device,
        &h4_flash_device,
        &h4_irda_device,
        &h4_kp_device,
        &h4_lcd_device,
 };
 
-static inline void __init h4_init_smc91x(void)
+static inline void __init h4_init_debug(void)
 {
        /* Make sure CS1 timings are correct */
        GPMC_CONFIG1_1 = 0x00011200;
@@ -285,12 +266,8 @@ static inline void __init h4_init_smc91x(void)
        udelay(100);
 
        omap_cfg_reg(M15_24XX_GPIO92);
-       if (omap_request_gpio(OMAP24XX_ETHR_GPIO_IRQ) < 0) {
-               printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n",
-                       OMAP24XX_ETHR_GPIO_IRQ);
-               return;
-       }
-       omap_set_gpio_direction(OMAP24XX_ETHR_GPIO_IRQ, 1);
+       if (debug_card_init(cs_mem_base, OMAP24XX_ETHR_GPIO_IRQ) < 0)
+               gpmc_cs_free(eth_cs);
 }
 
 static void __init omap_h4_init_irq(void)
@@ -298,7 +275,6 @@ static void __init omap_h4_init_irq(void)
        omap2_init_common_hw();
        omap_init_irq();
        omap_gpio_init();
-       h4_init_smc91x();
 }
 
 static struct omap_uart_config h4_uart_config __initdata = {