blob: aa5afbcc90f9a752dcc49f18010efe2e9315d0b6 [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
111static struct amba_device *amba_devs[] __initdata = {
112 &uart0_device,
113 &uart1_device,
114 &uart2_device,
115 &pl022_device,
116};
117
118static void __init u8500_timer_init(void)
119{
120#ifdef CONFIG_LOCAL_TIMERS
121 /* Setup the local timer base */
122 twd_base = __io_address(U8500_TWD_BASE);
123#endif
124 /* Setup the MTU base */
125 mtu_base = __io_address(U8500_MTU0_BASE);
126
127 nmdk_timer_init();
128}
129
130static struct sys_timer u8500_timer = {
131 .init = u8500_timer_init,
132};
133
134static void __init u8500_init_machine(void)
135{
136 int i;
137
138 /* Register the active AMBA devices on this board */
139 for (i = 0; i < ARRAY_SIZE(amba_devs); i++)
140 amba_device_register(amba_devs[i], &iomem_resource);
141
142 spi_register_board_info(u8500_spi_devices,
143 ARRAY_SIZE(u8500_spi_devices));
144
145 u8500_init_devices();
146}
147
148MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
149 /* Maintainer: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> */
150 .phys_io = U8500_UART2_BASE,
151 .io_pg_offst = (IO_ADDRESS(U8500_UART2_BASE) >> 18) & 0xfffc,
152 .boot_params = 0x100,
153 .map_io = u8500_map_io,
154 .init_irq = u8500_init_irq,
155 /* we re-use nomadik timer here */
156 .timer = &u8500_timer,
157 .init_machine = u8500_init_machine,
158MACHINE_END