ARM: s3c2410_defconfig: Add new machines
[safe/jmp/linux-2.6] / arch / arm / mach-omap1 / board-voiceblue.c
index 52e4a9d..87b9436 100644 (file)
 #include <linux/delay.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
+#include <linux/mtd/physmap.h>
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/serial_8250.h>
 #include <linux/serial_reg.h>
+#include <linux/smc91x.h>
 
-#include <asm/hardware.h>
+#include <mach/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/mux.h>
-#include <asm/arch/tc.h>
-#include <asm/arch/usb.h>
-
-extern void omap_init_time(void);
-extern int omap_gpio_init(void);
+#include <plat/common.h>
+#include <mach/gpio.h>
+#include <plat/flash.h>
+#include <plat/mux.h>
+#include <plat/tc.h>
+#include <plat/usb.h>
 
 static struct plat_serial8250_port voiceblue_ports[] = {
        {
@@ -87,9 +87,9 @@ static int __init ext_uart_init(void)
 }
 arch_initcall(ext_uart_init);
 
-static struct flash_platform_data voiceblue_flash_data = {
-       .map_name       = "cfi_probe",
+static struct physmap_flash_data voiceblue_flash_data = {
        .width          = 2,
+       .set_vpp        = omap1_set_vpp,
 };
 
 static struct resource voiceblue_flash_resource = {
@@ -99,7 +99,7 @@ static struct resource voiceblue_flash_resource = {
 };
 
 static struct platform_device voiceblue_flash_device = {
-       .name           = "omapflash",
+       .name           = "physmap-flash",
        .id             = 0,
        .dev            = {
                .platform_data  = &voiceblue_flash_data,
@@ -108,6 +108,12 @@ static struct platform_device voiceblue_flash_device = {
        .resource       = &voiceblue_flash_resource,
 };
 
+static struct smc91x_platdata voiceblue_smc91x_info = {
+       .flags  = SMC91X_USE_16BIT | SMC91X_NOWAIT,
+       .leda   = RPC_LED_100_10,
+       .ledb   = RPC_LED_TX_RX,
+};
+
 static struct resource voiceblue_smc91x_resources[] = {
        [0] = {
                .start  = OMAP_CS2_PHYS + 0x300,
@@ -117,13 +123,16 @@ static struct resource voiceblue_smc91x_resources[] = {
        [1] = {
                .start  = OMAP_GPIO_IRQ(8),
                .end    = OMAP_GPIO_IRQ(8),
-               .flags  = IORESOURCE_IRQ,
+               .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
        },
 };
 
 static struct platform_device voiceblue_smc91x_device = {
        .name           = "smc91x",
        .id             = 0,
+       .dev    = {
+               .platform_data  = &voiceblue_smc91x_info,
+       },
        .num_resources  = ARRAY_SIZE(voiceblue_smc91x_resources),
        .resource       = voiceblue_smc91x_resources,
 };
@@ -142,22 +151,7 @@ static struct omap_usb_config voiceblue_usb_config __initdata = {
        .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_uart_config voiceblue_uart_config __initdata = {
-       .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
-};
-
 static struct omap_board_config_kernel voiceblue_config[] = {
-       { OMAP_TAG_USB, &voiceblue_usb_config },
-       { OMAP_TAG_MMC, &voiceblue_mmc_config },
-       { OMAP_TAG_UART,        &voiceblue_uart_config },
 };
 
 static void __init voiceblue_init_irq(void)
@@ -169,35 +163,43 @@ static void __init voiceblue_init_irq(void)
 
 static void __init voiceblue_init(void)
 {
+       /* mux pins for uarts */
+       omap_cfg_reg(UART1_TX);
+       omap_cfg_reg(UART1_RTS);
+       omap_cfg_reg(UART2_TX);
+       omap_cfg_reg(UART2_RTS);
+       omap_cfg_reg(UART3_TX);
+       omap_cfg_reg(UART3_RX);
+
        /* Watchdog */
-       omap_request_gpio(0);
+       gpio_request(0, "Watchdog");
        /* smc91x reset */
-       omap_request_gpio(7);
-       omap_set_gpio_direction(7, 0);
-       omap_set_gpio_dataout(7, 1);
+       gpio_request(7, "SMC91x reset");
+       gpio_direction_output(7, 1);
        udelay(2);      /* wait at least 100ns */
-       omap_set_gpio_dataout(7, 0);
+       gpio_set_value(7, 0);
        mdelay(50);     /* 50ms until PHY ready */
        /* smc91x interrupt pin */
-       omap_request_gpio(8);
+       gpio_request(8, "SMC91x irq");
        /* 16C554 reset*/
-       omap_request_gpio(6);
-       omap_set_gpio_direction(6, 0);
-       omap_set_gpio_dataout(6, 0);
+       gpio_request(6, "16C554 reset");
+       gpio_direction_output(6, 0);
        /* 16C554 interrupt pins */
-       omap_request_gpio(12);
-       omap_request_gpio(13);
-       omap_request_gpio(14);
-       omap_request_gpio(15);
-       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);
+       gpio_request(12, "16C554 irq");
+       gpio_request(13, "16C554 irq");
+       gpio_request(14, "16C554 irq");
+       gpio_request(15, "16C554 irq");
+       set_irq_type(gpio_to_irq(12), IRQ_TYPE_EDGE_RISING);
+       set_irq_type(gpio_to_irq(13), IRQ_TYPE_EDGE_RISING);
+       set_irq_type(gpio_to_irq(14), IRQ_TYPE_EDGE_RISING);
+       set_irq_type(gpio_to_irq(15), IRQ_TYPE_EDGE_RISING);
 
        platform_add_devices(voiceblue_devices, ARRAY_SIZE(voiceblue_devices));
        omap_board_config = voiceblue_config;
        omap_board_config_size = ARRAY_SIZE(voiceblue_config);
        omap_serial_init();
+       omap_usb_init(&voiceblue_usb_config);
+       omap_register_i2c_bus(1, 100, NULL, 0);
 
        /* There is a good chance board is going up, so enable power LED
         * (it is connected through invertor) */
@@ -245,19 +247,18 @@ static int wdt_gpio_state;
 
 void voiceblue_wdt_enable(void)
 {
-       omap_set_gpio_direction(0, 0);
-       omap_set_gpio_dataout(0, 0);
-       omap_set_gpio_dataout(0, 1);
-       omap_set_gpio_dataout(0, 0);
+       gpio_direction_output(0, 0);
+       gpio_set_value(0, 1);
+       gpio_set_value(0, 0);
        wdt_gpio_state = 0;
 }
 
 void voiceblue_wdt_disable(void)
 {
-       omap_set_gpio_dataout(0, 0);
-       omap_set_gpio_dataout(0, 1);
-       omap_set_gpio_dataout(0, 0);
-       omap_set_gpio_direction(0, 1);
+       gpio_set_value(0, 0);
+       gpio_set_value(0, 1);
+       gpio_set_value(0, 0);
+       gpio_direction_input(0);
 }
 
 void voiceblue_wdt_ping(void)
@@ -266,7 +267,7 @@ void voiceblue_wdt_ping(void)
                return;
 
        wdt_gpio_state = !wdt_gpio_state;
-       omap_set_gpio_dataout(0, wdt_gpio_state);
+       gpio_set_value(0, wdt_gpio_state);
 }
 
 void voiceblue_reset(void)