blob: 51e9bf2d71e247d8805655597047f55c53d2f32d [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
Rabin Vincentcc2c1332010-03-01 05:03:31 +010020#include <asm/localtimer.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010021#include <asm/mach/map.h>
Rabin Vincentcc2c1332010-03-01 05:03:31 +010022#include <plat/mtu.h>
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010023#include <mach/hardware.h>
Rabin Vincentcc2c1332010-03-01 05:03:31 +010024#include <mach/setup.h>
Rabin Vincent5b1f7dd2010-05-03 08:25:52 +010025#include <mach/devices.h>
Rabin Vincent94bdc0e2010-03-03 04:54:37 +010026
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010027static struct platform_device *platform_devs[] __initdata = {
Rabin Vincent94bdc0e2010-03-03 04:54:37 +010028 &u8500_gpio_devs[0],
29 &u8500_gpio_devs[1],
30 &u8500_gpio_devs[2],
31 &u8500_gpio_devs[3],
32 &u8500_gpio_devs[4],
33 &u8500_gpio_devs[5],
34 &u8500_gpio_devs[6],
35 &u8500_gpio_devs[7],
36 &u8500_gpio_devs[8],
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010037};
38
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010039/* minimum static i/o mapping required to boot U8500 platforms */
40static struct map_desc u8500_io_desc[] __initdata = {
Rabin Vincent1df20af2010-03-01 05:07:47 +010041 __IO_DEV_DESC(U8500_PRCMU_BASE, SZ_4K),
Rabin Vincentc9c09572010-05-03 07:34:53 +010042 __IO_DEV_DESC(U8500_GPIO0_BASE, SZ_4K),
Rabin Vincent94bdc0e2010-03-03 04:54:37 +010043 __IO_DEV_DESC(U8500_GPIO1_BASE, SZ_4K),
44 __IO_DEV_DESC(U8500_GPIO2_BASE, SZ_4K),
45 __IO_DEV_DESC(U8500_GPIO3_BASE, SZ_4K),
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010046};
47
Rabin Vincent75a36ee2010-03-01 05:05:56 +010048static struct map_desc u8500ed_io_desc[] __initdata = {
49 __IO_DEV_DESC(U8500_MTU0_BASE_ED, SZ_4K),
Rabin Vincent1df20af2010-03-01 05:07:47 +010050 __IO_DEV_DESC(U8500_CLKRST7_BASE_ED, SZ_8K),
Rabin Vincent75a36ee2010-03-01 05:05:56 +010051};
52
53static struct map_desc u8500v1_io_desc[] __initdata = {
Rabin Vincentc9c09572010-05-03 07:34:53 +010054 __IO_DEV_DESC(U8500_MTU0_BASE, SZ_4K),
Rabin Vincent75a36ee2010-03-01 05:05:56 +010055};
56
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010057void __init u8500_map_io(void)
58{
Rabin Vincent178980f2010-05-03 07:39:02 +010059 ux500_map_io();
60
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010061 iotable_init(u8500_io_desc, ARRAY_SIZE(u8500_io_desc));
Rabin Vincent75a36ee2010-03-01 05:05:56 +010062
63 if (cpu_is_u8500ed())
64 iotable_init(u8500ed_io_desc, ARRAY_SIZE(u8500ed_io_desc));
65 else
66 iotable_init(u8500v1_io_desc, ARRAY_SIZE(u8500v1_io_desc));
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010067}
68
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010069/*
70 * This function is called from the board init
71 */
72void __init u8500_init_devices(void)
73{
Rabin Vincentd48fd002010-05-03 07:46:56 +010074 ux500_init_devices();
75
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +010076 /* Register the platform devices */
77 platform_add_devices(platform_devs, ARRAY_SIZE(platform_devs));
78
79 return ;
80}
Rabin Vincentcc2c1332010-03-01 05:03:31 +010081
82static void __init u8500_timer_init(void)
83{
84#ifdef CONFIG_LOCAL_TIMERS
85 /* Setup the local timer base */
86 twd_base = __io_address(U8500_TWD_BASE);
87#endif
88 /* Setup the MTU base */
Rabin Vincent75a36ee2010-03-01 05:05:56 +010089 if (cpu_is_u8500ed())
90 mtu_base = __io_address(U8500_MTU0_BASE_ED);
91 else
Rabin Vincentc9c09572010-05-03 07:34:53 +010092 mtu_base = __io_address(U8500_MTU0_BASE);
Rabin Vincentcc2c1332010-03-01 05:03:31 +010093
94 nmdk_timer_init();
95}
96
97struct sys_timer u8500_timer = {
98 .init = u8500_timer_init,
99};