/* * arch/ppc/platforms/dbox2.c * * setup routines for the dbox2 board * * Copyright (C) 2004 Andreas Oberritter * */ #include #include #include #include #include #include enum dbox2_mid { MID_NOKIA = 1, MID_PHILIPS = 2, MID_SAGEM = 3, }; const char *manuf_name[3] = { "Nokia", "Philips", "Sagem", }; static struct resource enx_resources[] = { [0] = { .start = 0x08000000, .end = 0x080033ff, .flags = IORESOURCE_MEM, }, [1] = { .start = 0x09000000, .end = 0x091fffff, .flags = IORESOURCE_MEM, }, [2] = { .start = SIU_IRQ1, .end = SIU_IRQ1, .flags = IORESOURCE_IRQ, }, }; static struct platform_device enx_device = { .name = "enx", .id = 0, .num_resources = ARRAY_SIZE(enx_resources), .resource = enx_resources, }; static struct resource gtx_resources[] = { [0] = { .start = 0x08400000, .end = 0x08402fff, .flags = IORESOURCE_MEM, }, [1] = { .start = 0x08000000, .end = 0x081fffff, .flags = IORESOURCE_MEM, }, [2] = { .start = SIU_IRQ1, .end = SIU_IRQ1, .flags = IORESOURCE_IRQ, }, }; static struct platform_device gtx_device = { .name = "gtx", .id = 0, .num_resources = ARRAY_SIZE(gtx_resources), .resource = gtx_resources, }; static struct resource fp_resources[] = { [0] = { .start = SIU_IRQ2, .end = SIU_IRQ2, .flags = IORESOURCE_IRQ, }, }; static struct platform_device fp_device = { .name = "fp", .id = 0, .num_resources = ARRAY_SIZE(fp_resources), .resource = fp_resources, }; static struct resource cam_resources[] = { [0] = { .start = 0x0c000000, .end = 0x0c01ffff, .flags = IORESOURCE_MEM, }, [1] = { .start = SIU_IRQ3, .end = SIU_IRQ3, .flags = IORESOURCE_IRQ, }, }; static struct platform_device cam_device = { .name = "cam", .id = 0, .num_resources = ARRAY_SIZE(cam_resources), .resource = cam_resources, }; static struct resource avia_resources[] = { [0] = { .start = 0x0a000000, .end = 0x0a0001ff, .flags = IORESOURCE_MEM, }, [1] = { .start = SIU_IRQ4, .end = SIU_IRQ4, .flags = IORESOURCE_IRQ, }, }; static struct platform_device avia_device = { .name = "avia", .id = 0, .num_resources = ARRAY_SIZE(avia_resources), .resource = avia_resources, }; static struct platform_device *dbox2_devs[] __initdata = { &enx_device, &fp_device, &cam_device, &avia_device, }; static int __init dbox2_add_devices(void) { u8 *config_area; int manuf_id; config_area = ioremap(0x1001ffe0, 0x20); if (!config_area) { printk(KERN_ERR "dbox2: could not map config area!\n"); return -EIO; } manuf_id = config_area[0]; iounmap(config_area); if ((manuf_id < MID_NOKIA) || (manuf_id > MID_SAGEM)) { printk(KERN_ERR "dbox2: invalid config area!\n"); return -EIO; } printk(KERN_INFO "dbox2: %s board detected.\n", manuf_name[manuf_id - 1]); if (manuf_id == MID_NOKIA) { dbox2_devs[0] = >x_device; } else if (manuf_id == MID_PHILIPS) { cam_resources[0].start += 0x40000; cam_resources[0].end += 0x40000; } return platform_add_devices(dbox2_devs, ARRAY_SIZE(dbox2_devs)); } static void __init dbox2_setup_arch(void) { m8xx_setup_arch(); device_initcall(dbox2_add_devices); } void __init platform_init(unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7) { m8xx_init(r3, r4, r5, r6, r7); ppc_md.setup_arch = dbox2_setup_arch; }