2 * arch/arm/mach-dove/common.c
4 * Core functions for Marvell Dove 88AP510 System On Chip
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
11 #include <linux/kernel.h>
12 #include <linux/delay.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/pci.h>
16 #include <linux/serial_8250.h>
17 #include <linux/clk.h>
18 #include <linux/mbus.h>
19 #include <linux/ata_platform.h>
20 #include <linux/serial_8250.h>
21 #include <linux/gpio.h>
23 #include <asm/setup.h>
24 #include <asm/timex.h>
25 #include <asm/hardware/cache-tauros2.h>
26 #include <asm/mach/map.h>
27 #include <asm/mach/time.h>
28 #include <asm/mach/pci.h>
29 #include <mach/dove.h>
30 #include <mach/bridge-regs.h>
31 #include <asm/mach/arch.h>
32 #include <linux/irq.h>
33 #include <plat/time.h>
34 #include <plat/common.h>
37 static int get_tclk(void);
39 /*****************************************************************************
41 ****************************************************************************/
42 static struct map_desc dove_io_desc[] __initdata = {
44 .virtual = DOVE_SB_REGS_VIRT_BASE,
45 .pfn = __phys_to_pfn(DOVE_SB_REGS_PHYS_BASE),
46 .length = DOVE_SB_REGS_SIZE,
49 .virtual = DOVE_NB_REGS_VIRT_BASE,
50 .pfn = __phys_to_pfn(DOVE_NB_REGS_PHYS_BASE),
51 .length = DOVE_NB_REGS_SIZE,
54 .virtual = DOVE_PCIE0_IO_VIRT_BASE,
55 .pfn = __phys_to_pfn(DOVE_PCIE0_IO_PHYS_BASE),
56 .length = DOVE_PCIE0_IO_SIZE,
59 .virtual = DOVE_PCIE1_IO_VIRT_BASE,
60 .pfn = __phys_to_pfn(DOVE_PCIE1_IO_PHYS_BASE),
61 .length = DOVE_PCIE1_IO_SIZE,
66 void __init dove_map_io(void)
68 iotable_init(dove_io_desc, ARRAY_SIZE(dove_io_desc));
71 /*****************************************************************************
73 ****************************************************************************/
74 void __init dove_ehci0_init(void)
76 orion_ehci_init(&dove_mbus_dram_info,
77 DOVE_USB0_PHYS_BASE, IRQ_DOVE_USB0);
80 /*****************************************************************************
82 ****************************************************************************/
83 void __init dove_ehci1_init(void)
85 orion_ehci_1_init(&dove_mbus_dram_info,
86 DOVE_USB1_PHYS_BASE, IRQ_DOVE_USB1);
89 /*****************************************************************************
91 ****************************************************************************/
92 void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data)
94 orion_ge00_init(eth_data, &dove_mbus_dram_info,
95 DOVE_GE00_PHYS_BASE, IRQ_DOVE_GE00_SUM,
99 /*****************************************************************************
101 ****************************************************************************/
102 void __init dove_rtc_init(void)
104 orion_rtc_init(DOVE_RTC_PHYS_BASE, IRQ_DOVE_RTC);
107 /*****************************************************************************
109 ****************************************************************************/
110 static struct resource dove_sata_resources[] = {
113 .start = DOVE_SATA_PHYS_BASE,
114 .end = DOVE_SATA_PHYS_BASE + 0x5000 - 1,
115 .flags = IORESOURCE_MEM,
118 .start = IRQ_DOVE_SATA,
119 .end = IRQ_DOVE_SATA,
120 .flags = IORESOURCE_IRQ,
124 static struct platform_device dove_sata = {
128 .coherent_dma_mask = DMA_BIT_MASK(32),
130 .num_resources = ARRAY_SIZE(dove_sata_resources),
131 .resource = dove_sata_resources,
134 void __init dove_sata_init(struct mv_sata_platform_data *sata_data)
136 sata_data->dram = &dove_mbus_dram_info;
137 dove_sata.dev.platform_data = sata_data;
138 platform_device_register(&dove_sata);
141 /*****************************************************************************
143 ****************************************************************************/
144 void __init dove_uart0_init(void)
146 orion_uart0_init(DOVE_UART0_VIRT_BASE, DOVE_UART0_PHYS_BASE,
147 IRQ_DOVE_UART_0, get_tclk());
150 /*****************************************************************************
152 ****************************************************************************/
153 void __init dove_uart1_init(void)
155 orion_uart1_init(DOVE_UART1_VIRT_BASE, DOVE_UART1_PHYS_BASE,
156 IRQ_DOVE_UART_1, get_tclk());
159 /*****************************************************************************
161 ****************************************************************************/
162 void __init dove_uart2_init(void)
164 orion_uart2_init(DOVE_UART2_VIRT_BASE, DOVE_UART2_PHYS_BASE,
165 IRQ_DOVE_UART_2, get_tclk());
168 /*****************************************************************************
170 ****************************************************************************/
171 void __init dove_uart3_init(void)
173 orion_uart3_init(DOVE_UART3_VIRT_BASE, DOVE_UART3_PHYS_BASE,
174 IRQ_DOVE_UART_3, get_tclk());
177 /*****************************************************************************
179 ****************************************************************************/
180 void __init dove_spi0_init(void)
182 orion_spi_init(DOVE_SPI0_PHYS_BASE, get_tclk());
185 void __init dove_spi1_init(void)
187 orion_spi_init(DOVE_SPI1_PHYS_BASE, get_tclk());
190 /*****************************************************************************
192 ****************************************************************************/
193 void __init dove_i2c_init(void)
195 orion_i2c_init(DOVE_I2C_PHYS_BASE, IRQ_DOVE_I2C, 10);
198 /*****************************************************************************
200 ****************************************************************************/
201 void __init dove_init_early(void)
203 orion_time_set_base(TIMER_VIRT_BASE);
206 static int get_tclk(void)
208 /* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */
212 static void dove_timer_init(void)
214 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
215 IRQ_DOVE_BRIDGE, get_tclk());
218 struct sys_timer dove_timer = {
219 .init = dove_timer_init,
222 /*****************************************************************************
224 ****************************************************************************/
225 void __init dove_xor0_init(void)
227 orion_xor0_init(&dove_mbus_dram_info,
228 DOVE_XOR0_PHYS_BASE, DOVE_XOR0_HIGH_PHYS_BASE,
229 IRQ_DOVE_XOR_00, IRQ_DOVE_XOR_01);
232 /*****************************************************************************
234 ****************************************************************************/
235 void __init dove_xor1_init(void)
237 orion_xor1_init(DOVE_XOR1_PHYS_BASE, DOVE_XOR1_HIGH_PHYS_BASE,
238 IRQ_DOVE_XOR_10, IRQ_DOVE_XOR_11);
241 /*****************************************************************************
243 ****************************************************************************/
244 static u64 sdio_dmamask = DMA_BIT_MASK(32);
246 static struct resource dove_sdio0_resources[] = {
248 .start = DOVE_SDIO0_PHYS_BASE,
249 .end = DOVE_SDIO0_PHYS_BASE + 0xff,
250 .flags = IORESOURCE_MEM,
252 .start = IRQ_DOVE_SDIO0,
253 .end = IRQ_DOVE_SDIO0,
254 .flags = IORESOURCE_IRQ,
258 static struct platform_device dove_sdio0 = {
259 .name = "sdhci-dove",
262 .dma_mask = &sdio_dmamask,
263 .coherent_dma_mask = DMA_BIT_MASK(32),
265 .resource = dove_sdio0_resources,
266 .num_resources = ARRAY_SIZE(dove_sdio0_resources),
269 void __init dove_sdio0_init(void)
271 platform_device_register(&dove_sdio0);
274 static struct resource dove_sdio1_resources[] = {
276 .start = DOVE_SDIO1_PHYS_BASE,
277 .end = DOVE_SDIO1_PHYS_BASE + 0xff,
278 .flags = IORESOURCE_MEM,
280 .start = IRQ_DOVE_SDIO1,
281 .end = IRQ_DOVE_SDIO1,
282 .flags = IORESOURCE_IRQ,
286 static struct platform_device dove_sdio1 = {
287 .name = "sdhci-dove",
290 .dma_mask = &sdio_dmamask,
291 .coherent_dma_mask = DMA_BIT_MASK(32),
293 .resource = dove_sdio1_resources,
294 .num_resources = ARRAY_SIZE(dove_sdio1_resources),
297 void __init dove_sdio1_init(void)
299 platform_device_register(&dove_sdio1);
302 void __init dove_init(void)
308 printk(KERN_INFO "Dove 88AP510 SoC, ");
309 printk(KERN_INFO "TCLK = %dMHz\n", (tclk + 499999) / 1000000);
311 #ifdef CONFIG_CACHE_TAUROS2
314 dove_setup_cpu_mbus();
316 /* internal devices that every board has */