blob: f21c444edd99f76db8b78ccd1b1bcfc1464c181b [file] [log] [blame]
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +01001/*
2 * Copyright (C) 2008-2009 ST-Ericsson
3 *
4 * Author: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2, as
8 * published by the Free Software Foundation.
9 *
10 */
11#include <linux/types.h>
12#include <linux/init.h>
13#include <linux/device.h>
14#include <linux/amba/bus.h>
15#include <linux/irq.h>
Rabin Vincent94bdc0e2010-03-03 04:54:37 +010016#include <linux/gpio.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010017#include <linux/platform_device.h>
Rabin Vincentcc2c1332010-03-01 05:03:31 +010018#include <linux/io.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010019
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010020#include <asm/mach/map.h>
21#include <mach/hardware.h>
Rabin Vincentcc2c1332010-03-01 05:03:31 +010022#include <mach/setup.h>
Rabin Vincent5b1f7dd2010-05-03 08:25:52 +010023#include <mach/devices.h>
Rabin Vincent94bdc0e2010-03-03 04:54:37 +010024
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010025static struct platform_device *platform_devs[] __initdata = {
Rabin Vincent94bdc0e2010-03-03 04:54:37 +010026 &u8500_gpio_devs[0],
27 &u8500_gpio_devs[1],
28 &u8500_gpio_devs[2],
29 &u8500_gpio_devs[3],
30 &u8500_gpio_devs[4],
31 &u8500_gpio_devs[5],
32 &u8500_gpio_devs[6],
33 &u8500_gpio_devs[7],
34 &u8500_gpio_devs[8],
Linus Walleij7b8ddb02010-05-27 15:21:26 -070035 &u8500_dma40_device,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010036};
37
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010038/* minimum static i/o mapping required to boot U8500 platforms */
39static struct map_desc u8500_io_desc[] __initdata = {
Rabin Vincent1df20af2010-03-01 05:07:47 +010040 __IO_DEV_DESC(U8500_PRCMU_BASE, SZ_4K),
Rabin Vincentc9c09572010-05-03 07:34:53 +010041 __IO_DEV_DESC(U8500_GPIO0_BASE, SZ_4K),
Rabin Vincent94bdc0e2010-03-03 04:54:37 +010042 __IO_DEV_DESC(U8500_GPIO1_BASE, SZ_4K),
43 __IO_DEV_DESC(U8500_GPIO2_BASE, SZ_4K),
44 __IO_DEV_DESC(U8500_GPIO3_BASE, SZ_4K),
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010045};
46
Rabin Vincent75a36ee2010-03-01 05:05:56 +010047static struct map_desc u8500ed_io_desc[] __initdata = {
48 __IO_DEV_DESC(U8500_MTU0_BASE_ED, SZ_4K),
Rabin Vincent1df20af2010-03-01 05:07:47 +010049 __IO_DEV_DESC(U8500_CLKRST7_BASE_ED, SZ_8K),
Rabin Vincent75a36ee2010-03-01 05:05:56 +010050};
51
52static struct map_desc u8500v1_io_desc[] __initdata = {
Rabin Vincentc9c09572010-05-03 07:34:53 +010053 __IO_DEV_DESC(U8500_MTU0_BASE, SZ_4K),
Rabin Vincent75a36ee2010-03-01 05:05:56 +010054};
55
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010056void __init u8500_map_io(void)
57{
Rabin Vincent178980f2010-05-03 07:39:02 +010058 ux500_map_io();
59
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010060 iotable_init(u8500_io_desc, ARRAY_SIZE(u8500_io_desc));
Rabin Vincent75a36ee2010-03-01 05:05:56 +010061
62 if (cpu_is_u8500ed())
63 iotable_init(u8500ed_io_desc, ARRAY_SIZE(u8500ed_io_desc));
64 else
65 iotable_init(u8500v1_io_desc, ARRAY_SIZE(u8500v1_io_desc));
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010066}
67
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010068/*
69 * This function is called from the board init
70 */
71void __init u8500_init_devices(void)
72{
Rabin Vincentd48fd002010-05-03 07:46:56 +010073 ux500_init_devices();
74
Linus Walleij7b8ddb02010-05-27 15:21:26 -070075 if (cpu_is_u8500ed())
76 dma40_u8500ed_fixup();
77
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010078 /* Register the platform devices */
79 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));
80
81 return ;
82}