#include <asm/arch/usb.h>
 #include <asm/arch/board.h>
 
-#include "common.h"
+#include "../common.h"
 
 static int __initdata generic_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
 
 
 static void __init omap_generic_init(void)
 {
+       const struct omap_uart_config *uart_conf;
+
        /*
         * Make sure the serial ports are muxed on at this point.
         * You have to mux them off in device drivers later on
                generic_config[0].data = &generic1610_usb_config;
        }
 #endif
+
+       uart_conf = omap_get_config(OMAP_TAG_UART, struct omap_uart_config);
+       if (uart_conf != NULL) {
+               unsigned int enabled_ports, i;
+
+               enabled_ports = uart_conf->enabled_uarts;
+               for (i = 0; i < 3; i++) {
+                       if (!(enabled_ports & (1 << i)))
+                               generic_serial_ports[i] = 0;
+               }
+       }
+
        omap_board_config = generic_config;
        omap_board_config_size = ARRAY_SIZE(generic_config);
        omap_serial_init(generic_serial_ports);
 
 static void __init omap_generic_map_io(void)
 {
-       omap_map_io();
+       omap_map_common_io();
 }
 
 MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
 
 #include <asm/arch/tc.h>
 #include <asm/arch/usb.h>
 
-#include "common.h"
+#include "../common.h"
 
 extern int omap_gpio_init(void);
 
 };
 
 static struct resource h2_flash_resource = {
-       .start          = OMAP_CS2B_PHYS,
-       .end            = OMAP_CS2B_PHYS + OMAP_CS2B_SIZE - 1,
+       /* This is on CS3, wherever it's mapped */
        .flags          = IORESOURCE_MEM,
 };
 
        omap_set_gpio_edge_ctrl(0, OMAP_GPIO_FALLING_EDGE);
 }
 
-void h2_init_irq(void)
+static void __init h2_init_irq(void)
 {
        omap_init_irq();
        omap_gpio_init();
 
 static void __init h2_init(void)
 {
+       /* NOTE: revC boards support NAND-boot, which can put NOR on CS2B
+        * and NAND (either 16bit or 8bit) on CS3.
+        */
+       h2_flash_resource.end = h2_flash_resource.start = omap_cs3_phys();
+       h2_flash_resource.end += SZ_32M - 1;
+
        platform_add_devices(h2_devices, ARRAY_SIZE(h2_devices));
        omap_board_config = h2_config;
        omap_board_config_size = ARRAY_SIZE(h2_config);
 
 static void __init h2_map_io(void)
 {
-       omap_map_io();
+       omap_map_common_io();
        omap_serial_init(h2_serial_ports);
 }
 
 
 #include <asm/arch/tc.h>
 #include <asm/arch/usb.h>
 
-#include "common.h"
+#include "../common.h"
 
 extern int omap_gpio_init(void);
 
 };
 
 static struct resource h3_flash_resource = {
-       .start          = OMAP_CS2B_PHYS,
-       .end            = OMAP_CS2B_PHYS + OMAP_CS2B_SIZE - 1,
+       /* This is on CS3, wherever it's mapped */
        .flags          = IORESOURCE_MEM,
 };
 
        .pins[1]        = 3,
 };
 
+static struct omap_mmc_config h3_mmc_config __initdata_or_module = {
+       .mmc_blocks             = 1,
+       .mmc1_power_pin         = -1,   /* tps65010 GPIO4 */
+       .mmc1_switch_pin        = OMAP_MPUIO(1),
+};
+
 static struct omap_board_config_kernel h3_config[] = {
        { OMAP_TAG_USB,  &h3_usb_config },
+       { OMAP_TAG_MMC,  &h3_mmc_config },
 };
 
 static void __init h3_init(void)
 {
+       h3_flash_resource.end = h3_flash_resource.start = omap_cs3_phys();
+       h3_flash_resource.end += OMAP_CS3_SIZE - 1;
        (void) platform_add_devices(devices, ARRAY_SIZE(devices));
+       omap_board_config = h3_config;
+       omap_board_config_size = ARRAY_SIZE(h3_config);
 }
 
 static void __init h3_init_smc91x(void)
 
 static void __init h3_map_io(void)
 {
-       omap_map_io();
+       omap_map_common_io();
        omap_serial_init(h3_serial_ports);
 }
 
 
 #include <asm/arch/tc.h>
 #include <asm/arch/usb.h>
 
-#include "common.h"
+#include "../common.h"
 
 static int __initdata innovator_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
 
                        printk("Error requesting gpio 0 for smc91x irq\n");
                        return;
                }
-               omap_set_gpio_edge_ctrl(0, OMAP_GPIO_RISING_EDGE);
+               omap_set_gpio_edge_ctrl(0, OMAP_GPIO_FALLING_EDGE);
        }
 }
 
 
 static void __init innovator_map_io(void)
 {
-       omap_map_io();
+       omap_map_common_io();
 
 #ifdef CONFIG_ARCH_OMAP1510
        if (cpu_is_omap1510()) {
 
 
 static void __init netstar_map_io(void)
 {
-       omap_map_io();
+       omap_map_common_io();
        omap_serial_init(omap_serial_ports);
 }
 
 
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/device.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
 
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
+#include <asm/mach/flash.h>
 
 #include <asm/arch/gpio.h>
 #include <asm/arch/usb.h>
 #include <asm/arch/mux.h>
 #include <asm/arch/tc.h>
 
-#include "common.h"
+#include "../common.h"
 
-static struct map_desc osk5912_io_desc[] __initdata = {
-{ OMAP_OSK_NOR_FLASH_BASE, OMAP_OSK_NOR_FLASH_START, OMAP_OSK_NOR_FLASH_SIZE,
-       MT_DEVICE },
-};
 
 static int __initdata osk_serial_ports[OMAP_MAX_NR_PORTS] = {1, 0, 0};
 
+static struct mtd_partition osk_partitions[] = {
+       /* bootloader (U-Boot, etc) in first sector */
+       {
+             .name             = "bootloader",
+             .offset           = 0,
+             .size             = SZ_128K,
+             .mask_flags       = MTD_WRITEABLE, /* force read-only */
+       },
+       /* bootloader params in the next sector */
+       {
+             .name             = "params",
+             .offset           = MTDPART_OFS_APPEND,
+             .size             = SZ_128K,
+             .mask_flags       = 0,
+       }, {
+             .name             = "kernel",
+             .offset           = MTDPART_OFS_APPEND,
+             .size             = SZ_2M,
+             .mask_flags       = 0
+       }, {
+             .name             = "filesystem",
+             .offset           = MTDPART_OFS_APPEND,
+             .size             = MTDPART_SIZ_FULL,
+             .mask_flags       = 0
+       }
+};
+
+static struct flash_platform_data osk_flash_data = {
+       .map_name       = "cfi_probe",
+       .width          = 2,
+       .parts          = osk_partitions,
+       .nr_parts       = ARRAY_SIZE(osk_partitions),
+};
+
+static struct resource osk_flash_resource = {
+       /* this is on CS3, wherever it's mapped */
+       .flags          = IORESOURCE_MEM,
+};
+
+static struct platform_device osk5912_flash_device = {
+       .name           = "omapflash",
+       .id             = 0,
+       .dev            = {
+               .platform_data  = &osk_flash_data,
+       },
+       .num_resources  = 1,
+       .resource       = &osk_flash_resource,
+};
+
 static struct resource osk5912_smc91x_resources[] = {
        [0] = {
                .start  = OMAP_OSK_ETHR_START,          /* Physical */
 };
 
 static struct platform_device *osk5912_devices[] __initdata = {
+       &osk5912_flash_device,
        &osk5912_smc91x_device,
        &osk5912_cf_device,
 };
        omap_set_gpio_edge_ctrl(62, OMAP_GPIO_FALLING_EDGE);
 }
 
-void osk_init_irq(void)
+static void __init osk_init_irq(void)
 {
        omap_init_irq();
        omap_gpio_init();
 
 static void __init osk_init(void)
 {
+       osk_flash_resource.end = osk_flash_resource.start = omap_cs3_phys();
+       osk_flash_resource.end += SZ_32M - 1;
        platform_add_devices(osk5912_devices, ARRAY_SIZE(osk5912_devices));
        omap_board_config = osk_config;
        omap_board_config_size = ARRAY_SIZE(osk_config);
 
 static void __init osk_map_io(void)
 {
-       omap_map_io();
-       iotable_init(osk5912_io_desc, ARRAY_SIZE(osk5912_io_desc));
+       omap_map_common_io();
        omap_serial_init(osk_serial_ports);
 }
 
 
 #include <asm/arch/mux.h>
 #include <asm/arch/fpga.h>
 
-#include "common.h"
+#include "../common.h"
 
 static struct resource smc91x_resources[] = {
        [0] = {
 
 static void __init omap_perseus2_map_io(void)
 {
-       omap_map_io();
+       omap_map_common_io();
        iotable_init(omap_perseus2_io_desc,
                     ARRAY_SIZE(omap_perseus2_io_desc));
 
 
 #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/gpio.h>
 #include <asm/arch/mux.h>
 #include <asm/arch/usb.h>
 
-#include "common.h"
+#include "../common.h"
 
 extern void omap_init_time(void);
 extern int omap_gpio_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,
 };
 
 static struct platform_device *voiceblue_devices[] __initdata = {
+       &voiceblue_flash_device,
        &voiceblue_smc91x_device,
 };
 
        .pins[2]        = 6,
 };
 
+static struct omap_mmc_config voiceblue_mmc_config = {
+       .mmc_blocks             = 1,
+       .mmc1_power_pin         = 2,
+       .mmc1_switch_pin        = -1,
+};
+
+static struct omap_boot_reason_config voiceblue_boot_reason;
+
 static struct omap_board_config_kernel voiceblue_config[] = {
        { OMAP_TAG_USB, &voiceblue_usb_config },
+       { OMAP_TAG_MMC, &voiceblue_mmc_config },
+       { OMAP_TAG_BOOT_REASON, &voiceblue_boot_reason },
 };
 
 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);
+       /* INIT button */
+       omap_request_gpio(1);
        /* smc91x reset */
        omap_request_gpio(7);
        omap_set_gpio_direction(7, 0);
        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};
 
 static void __init voiceblue_map_io(void)
 {
-       omap_map_io();
+       omap_map_common_io();
        omap_serial_init(omap_serial_ports);
 }
 
        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;
 }
        .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);
 
+       /* This information should come from bootloader. We do it here for
+        * now... Pushing "init" button (hangs on GPIO1) during power on
+        * resets device to factory defaults */
+       omap_set_gpio_direction(1, 1);
+       sprintf(voiceblue_boot_reason.reason_str, "poweron%s",
+               omap_get_gpio_datain(1) ? "" : "-R");
+
        return 0;
 }
-
-postcore_initcall(setup_notifier);
+postcore_initcall(voiceblue_setup);
 
 static int wdt_gpio_state;