blob: 72449eeaa6ae94e7ce42c5784bfc28a1e8905df8 [file] [log] [blame]
viresh kumarbc4e8142010-04-01 12:30:58 +01001/*
2 * arch/arm/mach-spear3xx/spear300.c
3 *
4 * SPEAr300 machine source file
5 *
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +05306 * Copyright (C) 2009-2012 ST Microelectronics
Viresh Kumar10d89352012-06-20 12:53:02 -07007 * Viresh Kumar <viresh.linux@gmail.com>
viresh kumarbc4e8142010-04-01 12:30:58 +01008 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
Viresh Kumar5fb00f92012-03-26 10:39:43 +053014#define pr_fmt(fmt) "SPEAr300: " fmt
15
Viresh Kumar0b7ee712012-03-26 10:29:23 +053016#include <linux/amba/pl08x.h>
Rob Herringe9c51552013-01-02 09:37:56 -060017#include <linux/irqchip.h>
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +053018#include <linux/of_platform.h>
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +053019#include <asm/mach/arch.h>
viresh kumarbc4e8142010-04-01 12:30:58 +010020#include <mach/generic.h>
Arnd Bergmann5019f0b2012-04-11 17:30:11 +000021#include <mach/spear.h>
22
Viresh Kumar0b7ee712012-03-26 10:29:23 +053023/* DMAC platform data's slave info */
24struct pl08x_channel_data spear300_dma_info[] = {
25 {
26 .bus_id = "uart0_rx",
27 .min_signal = 2,
28 .max_signal = 2,
29 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053030 .periph_buses = PL08X_AHB1,
31 }, {
32 .bus_id = "uart0_tx",
33 .min_signal = 3,
34 .max_signal = 3,
35 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053036 .periph_buses = PL08X_AHB1,
37 }, {
38 .bus_id = "ssp0_rx",
39 .min_signal = 8,
40 .max_signal = 8,
41 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053042 .periph_buses = PL08X_AHB1,
43 }, {
44 .bus_id = "ssp0_tx",
45 .min_signal = 9,
46 .max_signal = 9,
47 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053048 .periph_buses = PL08X_AHB1,
49 }, {
50 .bus_id = "i2c_rx",
51 .min_signal = 10,
52 .max_signal = 10,
53 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053054 .periph_buses = PL08X_AHB1,
55 }, {
56 .bus_id = "i2c_tx",
57 .min_signal = 11,
58 .max_signal = 11,
59 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053060 .periph_buses = PL08X_AHB1,
61 }, {
62 .bus_id = "irda",
63 .min_signal = 12,
64 .max_signal = 12,
65 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053066 .periph_buses = PL08X_AHB1,
67 }, {
68 .bus_id = "adc",
69 .min_signal = 13,
70 .max_signal = 13,
71 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053072 .periph_buses = PL08X_AHB1,
73 }, {
74 .bus_id = "to_jpeg",
75 .min_signal = 14,
76 .max_signal = 14,
77 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053078 .periph_buses = PL08X_AHB1,
79 }, {
80 .bus_id = "from_jpeg",
81 .min_signal = 15,
82 .max_signal = 15,
83 .muxval = 0,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053084 .periph_buses = PL08X_AHB1,
85 }, {
86 .bus_id = "ras0_rx",
87 .min_signal = 0,
88 .max_signal = 0,
89 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053090 .periph_buses = PL08X_AHB1,
91 }, {
92 .bus_id = "ras0_tx",
93 .min_signal = 1,
94 .max_signal = 1,
95 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +053096 .periph_buses = PL08X_AHB1,
97 }, {
98 .bus_id = "ras1_rx",
99 .min_signal = 2,
100 .max_signal = 2,
101 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530102 .periph_buses = PL08X_AHB1,
103 }, {
104 .bus_id = "ras1_tx",
105 .min_signal = 3,
106 .max_signal = 3,
107 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530108 .periph_buses = PL08X_AHB1,
109 }, {
110 .bus_id = "ras2_rx",
111 .min_signal = 4,
112 .max_signal = 4,
113 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530114 .periph_buses = PL08X_AHB1,
115 }, {
116 .bus_id = "ras2_tx",
117 .min_signal = 5,
118 .max_signal = 5,
119 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530120 .periph_buses = PL08X_AHB1,
121 }, {
122 .bus_id = "ras3_rx",
123 .min_signal = 6,
124 .max_signal = 6,
125 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530126 .periph_buses = PL08X_AHB1,
127 }, {
128 .bus_id = "ras3_tx",
129 .min_signal = 7,
130 .max_signal = 7,
131 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530132 .periph_buses = PL08X_AHB1,
133 }, {
134 .bus_id = "ras4_rx",
135 .min_signal = 8,
136 .max_signal = 8,
137 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530138 .periph_buses = PL08X_AHB1,
139 }, {
140 .bus_id = "ras4_tx",
141 .min_signal = 9,
142 .max_signal = 9,
143 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530144 .periph_buses = PL08X_AHB1,
145 }, {
146 .bus_id = "ras5_rx",
147 .min_signal = 10,
148 .max_signal = 10,
149 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530150 .periph_buses = PL08X_AHB1,
151 }, {
152 .bus_id = "ras5_tx",
153 .min_signal = 11,
154 .max_signal = 11,
155 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530156 .periph_buses = PL08X_AHB1,
157 }, {
158 .bus_id = "ras6_rx",
159 .min_signal = 12,
160 .max_signal = 12,
161 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530162 .periph_buses = PL08X_AHB1,
163 }, {
164 .bus_id = "ras6_tx",
165 .min_signal = 13,
166 .max_signal = 13,
167 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530168 .periph_buses = PL08X_AHB1,
169 }, {
170 .bus_id = "ras7_rx",
171 .min_signal = 14,
172 .max_signal = 14,
173 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530174 .periph_buses = PL08X_AHB1,
175 }, {
176 .bus_id = "ras7_tx",
177 .min_signal = 15,
178 .max_signal = 15,
179 .muxval = 1,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530180 .periph_buses = PL08X_AHB1,
181 },
182};
183
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530184/* Add SPEAr300 auxdata to pass platform data */
185static struct of_dev_auxdata spear300_auxdata_lookup[] __initdata = {
186 OF_DEV_AUXDATA("arm,pl022", SPEAR3XX_ICM1_SSP_BASE, NULL,
187 &pl022_plat_data),
Arnd Bergmannd42799b2012-12-02 14:45:27 +0100188 OF_DEV_AUXDATA("arm,pl080", SPEAR_ICM3_DMA_BASE, NULL,
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530189 &pl080_plat_data),
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530190 {}
191};
viresh kumarc2c07832011-03-07 05:57:05 +0100192
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530193static void __init spear300_dt_init(void)
viresh kumarbc4e8142010-04-01 12:30:58 +0100194{
Viresh Kumar0b7ee712012-03-26 10:29:23 +0530195 pl080_plat_data.slave_channels = spear300_dma_info;
196 pl080_plat_data.num_slave_channels = ARRAY_SIZE(spear300_dma_info);
197
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530198 of_platform_populate(NULL, of_default_bus_match_table,
199 spear300_auxdata_lookup, NULL);
viresh kumar70f4c0b2010-04-01 12:31:29 +0100200}
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530201
202static const char * const spear300_dt_board_compat[] = {
203 "st,spear300",
204 "st,spear300-evb",
205 NULL,
206};
207
208static void __init spear300_map_io(void)
209{
210 spear3xx_map_io();
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530211}
212
213DT_MACHINE_START(SPEAR300_DT, "ST SPEAr300 SoC with Flattened Device Tree")
214 .map_io = spear300_map_io,
Rob Herringe9c51552013-01-02 09:37:56 -0600215 .init_irq = irqchip_init,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700216 .init_time = spear3xx_timer_init,
Viresh Kumarc5fa4fd2012-03-23 00:17:43 +0530217 .init_machine = spear300_dt_init,
218 .restart = spear_restart,
219 .dt_compat = spear300_dt_board_compat,
220MACHINE_END