blob: f33dbb7b497b31ca9327f0ed6472b7f3ed392db3 [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/kernel.h>
12#include <linux/init.h>
13#include <linux/interrupt.h>
14#include <linux/platform_device.h>
15#include <linux/io.h>
16#include <linux/amba/bus.h>
17#include <linux/amba/pl022.h>
18#include <linux/spi/spi.h>
19
20#include <asm/localtimer.h>
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23
24#include <plat/mtu.h>
25
26#include <mach/hardware.h>
27#include <mach/setup.h>
28
29#define __MEM_4K_RESOURCE(x) \
30 .res = {.start = (x), .end = (x) + SZ_4K - 1, .flags = IORESOURCE_MEM}
31
32/* These are active devices on this board */
33static struct amba_device uart0_device = {
34 .dev = { .init_name = "uart0" },
35 __MEM_4K_RESOURCE(U8500_UART0_BASE),
36 .irq = {IRQ_UART0, NO_IRQ},
37};
38
39static struct amba_device uart1_device = {
40 .dev = { .init_name = "uart1" },
41 __MEM_4K_RESOURCE(U8500_UART1_BASE),
42 .irq = {IRQ_UART1, NO_IRQ},
43};
44
45static struct amba_device uart2_device = {
46 .dev = { .init_name = "uart2" },
47 __MEM_4K_RESOURCE(U8500_UART2_BASE),
48 .irq = {IRQ_UART2, NO_IRQ},
49};
50
51static void ab4500_spi_cs_control(u32 command)
52{
53 /* set the FRM signal, which is CS - TODO */
54}
55
56struct pl022_config_chip ab4500_chip_info = {
57 .lbm = LOOPBACK_DISABLED,
58 .com_mode = INTERRUPT_TRANSFER,
59 .iface = SSP_INTERFACE_MOTOROLA_SPI,
60 /* we can act as master only */
61 .hierarchy = SSP_MASTER,
62 .slave_tx_disable = 0,
63 .endian_rx = SSP_RX_MSB,
64 .endian_tx = SSP_TX_MSB,
65 .data_size = SSP_DATA_BITS_24,
66 .rx_lev_trig = SSP_RX_1_OR_MORE_ELEM,
67 .tx_lev_trig = SSP_TX_1_OR_MORE_EMPTY_LOC,
68 .clk_phase = SSP_CLK_SECOND_EDGE,
69 .clk_pol = SSP_CLK_POL_IDLE_HIGH,
70 .cs_control = ab4500_spi_cs_control,
71};
72
73static struct spi_board_info u8500_spi_devices[] = {
74 {
75 .modalias = "ab4500",
76 .controller_data = &ab4500_chip_info,
77 .max_speed_hz = 12000000,
78 .bus_num = 0,
79 .chip_select = 0,
80 .mode = SPI_MODE_0,
81 .irq = IRQ_AB4500,
82 },
83};
84
85static struct pl022_ssp_controller ssp0_platform_data = {
86 .bus_id = 0,
87 /* pl022 not yet supports dma */
88 .enable_dma = 0,
89 /* on this platform, gpio 31,142,144,214 &
90 * 224 are connected as chip selects
91 */
92 .num_chipselect = 5,
93};
94
95static struct amba_device pl022_device = {
96 .dev = {
97 .coherent_dma_mask = ~0,
98 .init_name = "pl022",
99 .platform_data = &ssp0_platform_data,
100 },
101 .res = {
102 .start = U8500_SSP0_BASE,
103 .end = U8500_SSP0_BASE + SZ_4K - 1,
104 .flags = IORESOURCE_MEM,
105 },
106 .irq = {IRQ_SSP0, NO_IRQ },
107 /* ST-Ericsson modified id */
108 .periphid = SSP_PER_ID,
109};
110
Linus Walleij8e58ed32010-02-04 12:50:58 +0100111static struct amba_device pl031_device = {
112 .dev = {
113 .init_name = "pl031",
114 },
115 .res = {
116 .start = U8500_RTC_BASE,
117 .end = U8500_RTC_BASE + SZ_4K - 1,
118 .flags = IORESOURCE_MEM,
119 },
120 .irq = {IRQ_RTC_RTT, NO_IRQ},
121};
122
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100123static struct amba_device *amba_devs[] __initdata = {
124 &uart0_device,
125 &uart1_device,
126 &uart2_device,
127 &pl022_device,
Linus Walleij8e58ed32010-02-04 12:50:58 +0100128 &pl031_device,
Srinidhi Kasagaraa44ef42009-11-28 08:17:18 +0100129};
130
131static void __init u8500_timer_init(void)
132{
133#ifdef CONFIG_LOCAL_TIMERS
134 /* Setup the local timer base */
135 twd_base = __io_address(U8500_TWD_BASE);
136#endif
137 /* Setup the MTU base */
138 mtu_base = __io_address(U8500_MTU0_BASE);
139
140 nmdk_timer_init();
141}
142
143static struct sys_timer u8500_timer = {
144 .init = u8500_timer_init,
145};
146
147static void __init u8500_init_machine(void)
148{
149 int i;
150
151 /* Register the active AMBA devices on this board */
152 for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
153 amba_device_register(amba_devs[i], &iomem_resource);
154
155 spi_register_board_info(u8500_spi_devices,
156 ARRAY_SIZE(u8500_spi_devices));
157
158 u8500_init_devices();
159}
160
161MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
162 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
163 .phys_io = U8500_UART2_BASE,
164 .io_pg_offst = (IO_ADDRESS(U8500_UART2_BASE) >> 18) & 0xfffc,
165 .boot_params = 0x100,
166 .map_io = u8500_map_io,
167 .init_irq = u8500_init_irq,
168 /* we re-use nomadik timer here */
169 .timer = &u8500_timer,
170 .init_machine = u8500_init_machine,
171MACHINE_END