Merge master.kernel.org:/home/rmk/linux-2.6-serial
authorLinus Torvalds <torvalds@g5.osdl.org>
Thu, 8 Sep 2005 22:30:14 +0000 (15:30 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 8 Sep 2005 22:30:14 +0000 (15:30 -0700)
1  2 
arch/arm/mach-omap1/board-voiceblue.c
arch/arm/mach-omap1/serial.c

index 209d79ef1d5f0c89fee06e368a4e157a3ded3548,76176dd518bab55c385a57b566c2539060874287..bf30b1acda0b97a1c9795a0006622c7db6935265
  #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/arch/common.h>
  #include <asm/arch/gpio.h>
 -#include <asm/arch/tc.h>
  #include <asm/arch/mux.h>
 +#include <asm/arch/tc.h>
  #include <asm/arch/usb.h>
 -#include <asm/arch/common.h>
  
  extern void omap_init_time(void);
  extern int omap_gpio_init(void);
@@@ -75,7 -74,7 +75,7 @@@ static struct plat_serial8250_port voic
  
  static struct platform_device serial_device = {
        .name                   = "serial8250",
-       .id                     = 1,
+       .id                     = PLAT8250_DEV_PLATFORM1,
        .dev                    = {
                .platform_data  = voiceblue_ports,
        },
@@@ -87,27 -86,6 +87,27 @@@ static int __init ext_uart_init(void
  }
  arch_initcall(ext_uart_init);
  
 +static struct flash_platform_data voiceblue_flash_data = {
 +      .map_name       = "cfi_probe",
 +      .width          = 2,
 +};
 +
 +static struct resource voiceblue_flash_resource = {
 +      .start  = OMAP_CS0_PHYS,
 +      .end    = OMAP_CS0_PHYS + SZ_32M - 1,
 +      .flags  = IORESOURCE_MEM,
 +};
 +
 +static struct platform_device voiceblue_flash_device = {
 +      .name           = "omapflash",
 +      .id             = 0,
 +      .dev            = {
 +              .platform_data  = &voiceblue_flash_data,
 +      },
 +      .num_resources  = 1,
 +      .resource       = &voiceblue_flash_resource,
 +};
 +
  static struct resource voiceblue_smc91x_resources[] = {
        [0] = {
                .start  = OMAP_CS2_PHYS + 0x300,
@@@ -129,7 -107,6 +129,7 @@@ static struct platform_device voiceblue
  };
  
  static struct platform_device *voiceblue_devices[] __initdata = {
 +      &voiceblue_flash_device,
        &voiceblue_smc91x_device,
  };
  
@@@ -142,17 -119,8 +142,17 @@@ static struct omap_usb_config voiceblue
        .pins[2]        = 6,
  };
  
 +static struct omap_mmc_config voiceblue_mmc_config __initdata = {
 +      .mmc[0] = {
 +              .enabled        = 1,
 +              .power_pin      = 2,
 +              .switch_pin     = -1,
 +      },
 +};
 +
  static struct omap_board_config_kernel voiceblue_config[] = {
        { OMAP_TAG_USB, &voiceblue_usb_config },
 +      { OMAP_TAG_MMC, &voiceblue_mmc_config },
  };
  
  static void __init voiceblue_init_irq(void)
  
  static void __init voiceblue_init(void)
  {
 -      /* There is a good chance board is going up, so enable Power LED
 -       * (it is connected through invertor) */
 -      omap_writeb(0x00, OMAP_LPG1_LCR);
        /* Watchdog */
        omap_request_gpio(0);
        /* smc91x reset */
        mdelay(50);     /* 50ms until PHY ready */
        /* smc91x interrupt pin */
        omap_request_gpio(8);
 -      omap_set_gpio_edge_ctrl(8, OMAP_GPIO_RISING_EDGE);
        /* 16C554 reset*/
        omap_request_gpio(6);
        omap_set_gpio_direction(6, 0);
        omap_request_gpio(13);
        omap_request_gpio(14);
        omap_request_gpio(15);
 -      omap_set_gpio_edge_ctrl(12, OMAP_GPIO_RISING_EDGE);
 -      omap_set_gpio_edge_ctrl(13, OMAP_GPIO_RISING_EDGE);
 -      omap_set_gpio_edge_ctrl(14, OMAP_GPIO_RISING_EDGE);
 -      omap_set_gpio_edge_ctrl(15, OMAP_GPIO_RISING_EDGE);
 +      set_irq_type(OMAP_GPIO_IRQ(12), IRQT_RISING);
 +      set_irq_type(OMAP_GPIO_IRQ(13), IRQT_RISING);
 +      set_irq_type(OMAP_GPIO_IRQ(14), IRQT_RISING);
 +      set_irq_type(OMAP_GPIO_IRQ(15), IRQT_RISING);
  
        platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices));
        omap_board_config = voiceblue_config;
        omap_board_config_size = ARRAY_SIZE(voiceblue_config);
 +
 +      /* There is a good chance board is going up, so enable power LED
 +       * (it is connected through invertor) */
 +      omap_writeb(0x00, OMAP_LPG1_LCR);
 +      omap_writeb(0x00, OMAP_LPG1_PMR);       /* Disable clock */
  }
  
  static int __initdata omap_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
@@@ -217,9 -184,9 +217,9 @@@ static int panic_event(struct notifier_
        if (test_and_set_bit(MACHINE_PANICED, &machine_state))
                return NOTIFY_DONE;
  
 -      /* Flash Power LED
 -       * (TODO: Enable clock right way (enabled in bootloader already)) */
 +      /* Flash power LED */
        omap_writeb(0x78, OMAP_LPG1_LCR);
 +      omap_writeb(0x01, OMAP_LPG1_PMR);       /* Enable clock */
  
        return NOTIFY_DONE;
  }
@@@ -228,14 -195,15 +228,14 @@@ static struct notifier_block panic_bloc
        .notifier_call  = panic_event,
  };
  
 -static int __init setup_notifier(void)
 +static int __init voiceblue_setup(void)
  {
        /* Setup panic notifier */
        notifier_chain_register(&panic_notifier_list, &panic_block);
  
        return 0;
  }
 -
 -postcore_initcall(setup_notifier);
 +postcore_initcall(voiceblue_setup);
  
  static int wdt_gpio_state;
  
index e702e0cb899e251c40f77de2eeef64f1de1d6ced,1446bf332e4c589ed2aa98e609aa21245a4ff575..40c4f7c40e73369d6b7f052ca66e966012b99d67
  
  #include <asm/arch/board.h>
  #include <asm/arch/mux.h>
 +#include <asm/arch/gpio.h>
  #include <asm/arch/fpga.h>
 +#ifdef CONFIG_PM
 +#include <asm/arch/pm.h>
 +#endif
  
  static struct clk * uart1_ck = NULL;
  static struct clk * uart2_ck = NULL;
@@@ -98,7 -94,7 +98,7 @@@ static struct plat_serial8250_port seri
  
  static struct platform_device serial_device = {
        .name                   = "serial8250",
-       .id                     = 0,
+       .id                     = PLAT8250_DEV_PLATFORM,
        .dev                    = {
                .platform_data  = serial_platform_data,
        },
@@@ -197,86 -193,6 +197,86 @@@ void __init omap_serial_init(int ports[
        }
  }
  
 +#ifdef CONFIG_OMAP_SERIAL_WAKE
 +
 +static irqreturn_t omap_serial_wake_interrupt(int irq, void *dev_id,
 +                                            struct pt_regs *regs)
 +{
 +      /* Need to do something with serial port right after wake-up? */
 +      return IRQ_HANDLED;
 +}
 +
 +/*
 + * Reroutes serial RX lines to GPIO lines for the duration of
 + * sleep to allow waking up the device from serial port even
 + * in deep sleep.
 + */
 +void omap_serial_wake_trigger(int enable)
 +{
 +      if (!cpu_is_omap16xx())
 +              return;
 +
 +      if (uart1_ck != NULL) {
 +              if (enable)
 +                      omap_cfg_reg(V14_16XX_GPIO37);
 +              else
 +                      omap_cfg_reg(V14_16XX_UART1_RX);
 +      }
 +      if (uart2_ck != NULL) {
 +              if (enable)
 +                      omap_cfg_reg(R9_16XX_GPIO18);
 +              else
 +                      omap_cfg_reg(R9_16XX_UART2_RX);
 +      }
 +      if (uart3_ck != NULL) {
 +              if (enable)
 +                      omap_cfg_reg(L14_16XX_GPIO49);
 +              else
 +                      omap_cfg_reg(L14_16XX_UART3_RX);
 +      }
 +}
 +
 +static void __init omap_serial_set_port_wakeup(int gpio_nr)
 +{
 +      int ret;
 +
 +      ret = omap_request_gpio(gpio_nr);
 +      if (ret < 0) {
 +              printk(KERN_ERR "Could not request UART wake GPIO: %i\n",
 +                     gpio_nr);
 +              return;
 +      }
 +      omap_set_gpio_direction(gpio_nr, 1);
 +      set_irq_type(OMAP_GPIO_IRQ(gpio_nr), IRQT_RISING);
 +      ret = request_irq(OMAP_GPIO_IRQ(gpio_nr), &omap_serial_wake_interrupt,
 +                        0, "serial wakeup", NULL);
 +      if (ret) {
 +              omap_free_gpio(gpio_nr);
 +              printk(KERN_ERR "No interrupt for UART wake GPIO: %i\n",
 +                     gpio_nr);
 +              return;
 +      }
 +      enable_irq_wake(OMAP_GPIO_IRQ(gpio_nr));
 +}
 +
 +static int __init omap_serial_wakeup_init(void)
 +{
 +      if (!cpu_is_omap16xx())
 +              return 0;
 +
 +      if (uart1_ck != NULL)
 +              omap_serial_set_port_wakeup(37);
 +      if (uart2_ck != NULL)
 +              omap_serial_set_port_wakeup(18);
 +      if (uart3_ck != NULL)
 +              omap_serial_set_port_wakeup(49);
 +
 +      return 0;
 +}
 +late_initcall(omap_serial_wakeup_init);
 +
 +#endif        /* CONFIG_OMAP_SERIAL_WAKE */
 +
  static int __init omap_init(void)
  {
        return platform_device_register(&serial_device);