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/clk.h>
17 #include <linux/ata_platform.h>
18 #include <linux/gpio.h>
20 #include <asm/setup.h>
21 #include <asm/timex.h>
22 #include <asm/hardware/cache-tauros2.h>
23 #include <asm/mach/map.h>
24 #include <asm/mach/time.h>
25 #include <asm/mach/pci.h>
26 #include <mach/dove.h>
27 #include <mach/bridge-regs.h>
28 #include <asm/mach/arch.h>
29 #include <linux/irq.h>
30 #include <plat/time.h>
31 #include <plat/common.h>
32 #include <plat/addr-map.h>
35 static int get_tclk(void);
37 /*****************************************************************************
39 ****************************************************************************/
40 static struct map_desc dove_io_desc[] __initdata = {
42 .virtual = DOVE_SB_REGS_VIRT_BASE,
43 .pfn = __phys_to_pfn(DOVE_SB_REGS_PHYS_BASE),
44 .length = DOVE_SB_REGS_SIZE,
47 .virtual = DOVE_NB_REGS_VIRT_BASE,
48 .pfn = __phys_to_pfn(DOVE_NB_REGS_PHYS_BASE),
49 .length = DOVE_NB_REGS_SIZE,
52 .virtual = DOVE_PCIE0_IO_VIRT_BASE,
53 .pfn = __phys_to_pfn(DOVE_PCIE0_IO_PHYS_BASE),
54 .length = DOVE_PCIE0_IO_SIZE,
57 .virtual = DOVE_PCIE1_IO_VIRT_BASE,
58 .pfn = __phys_to_pfn(DOVE_PCIE1_IO_PHYS_BASE),
59 .length = DOVE_PCIE1_IO_SIZE,
64 void __init dove_map_io(void)
66 iotable_init(dove_io_desc, ARRAY_SIZE(dove_io_desc));
69 /*****************************************************************************
71 ****************************************************************************/
72 void __init dove_ehci0_init(void)
74 orion_ehci_init(DOVE_USB0_PHYS_BASE, IRQ_DOVE_USB0);
77 /*****************************************************************************
79 ****************************************************************************/
80 void __init dove_ehci1_init(void)
82 orion_ehci_1_init(DOVE_USB1_PHYS_BASE, IRQ_DOVE_USB1);
85 /*****************************************************************************
87 ****************************************************************************/
88 void __init dove_ge00_init(struct mv643xx_eth_platform_data *eth_data)
90 orion_ge00_init(eth_data,
91 DOVE_GE00_PHYS_BASE, IRQ_DOVE_GE00_SUM,
95 /*****************************************************************************
97 ****************************************************************************/
98 void __init dove_rtc_init(void)
100 orion_rtc_init(DOVE_RTC_PHYS_BASE, IRQ_DOVE_RTC);
103 /*****************************************************************************
105 ****************************************************************************/
106 void __init dove_sata_init(struct mv_sata_platform_data *sata_data)
108 orion_sata_init(sata_data, DOVE_SATA_PHYS_BASE, IRQ_DOVE_SATA);
112 /*****************************************************************************
114 ****************************************************************************/
115 void __init dove_uart0_init(void)
117 orion_uart0_init(DOVE_UART0_VIRT_BASE, DOVE_UART0_PHYS_BASE,
118 IRQ_DOVE_UART_0, get_tclk());
121 /*****************************************************************************
123 ****************************************************************************/
124 void __init dove_uart1_init(void)
126 orion_uart1_init(DOVE_UART1_VIRT_BASE, DOVE_UART1_PHYS_BASE,
127 IRQ_DOVE_UART_1, get_tclk());
130 /*****************************************************************************
132 ****************************************************************************/
133 void __init dove_uart2_init(void)
135 orion_uart2_init(DOVE_UART2_VIRT_BASE, DOVE_UART2_PHYS_BASE,
136 IRQ_DOVE_UART_2, get_tclk());
139 /*****************************************************************************
141 ****************************************************************************/
142 void __init dove_uart3_init(void)
144 orion_uart3_init(DOVE_UART3_VIRT_BASE, DOVE_UART3_PHYS_BASE,
145 IRQ_DOVE_UART_3, get_tclk());
148 /*****************************************************************************
150 ****************************************************************************/
151 void __init dove_spi0_init(void)
153 orion_spi_init(DOVE_SPI0_PHYS_BASE, get_tclk());
156 void __init dove_spi1_init(void)
158 orion_spi_1_init(DOVE_SPI1_PHYS_BASE, get_tclk());
161 /*****************************************************************************
163 ****************************************************************************/
164 void __init dove_i2c_init(void)
166 orion_i2c_init(DOVE_I2C_PHYS_BASE, IRQ_DOVE_I2C, 10);
169 /*****************************************************************************
171 ****************************************************************************/
172 void __init dove_init_early(void)
174 orion_time_set_base(TIMER_VIRT_BASE);
177 static int get_tclk(void)
179 /* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */
183 static void dove_timer_init(void)
185 orion_time_init(BRIDGE_VIRT_BASE, BRIDGE_INT_TIMER1_CLR,
186 IRQ_DOVE_BRIDGE, get_tclk());
189 struct sys_timer dove_timer = {
190 .init = dove_timer_init,
193 /*****************************************************************************
195 ****************************************************************************/
196 void __init dove_xor0_init(void)
198 orion_xor0_init(DOVE_XOR0_PHYS_BASE, DOVE_XOR0_HIGH_PHYS_BASE,
199 IRQ_DOVE_XOR_00, IRQ_DOVE_XOR_01);
202 /*****************************************************************************
204 ****************************************************************************/
205 void __init dove_xor1_init(void)
207 orion_xor1_init(DOVE_XOR1_PHYS_BASE, DOVE_XOR1_HIGH_PHYS_BASE,
208 IRQ_DOVE_XOR_10, IRQ_DOVE_XOR_11);
211 /*****************************************************************************
213 ****************************************************************************/
214 static u64 sdio_dmamask = DMA_BIT_MASK(32);
216 static struct resource dove_sdio0_resources[] = {
218 .start = DOVE_SDIO0_PHYS_BASE,
219 .end = DOVE_SDIO0_PHYS_BASE + 0xff,
220 .flags = IORESOURCE_MEM,
222 .start = IRQ_DOVE_SDIO0,
223 .end = IRQ_DOVE_SDIO0,
224 .flags = IORESOURCE_IRQ,
228 static struct platform_device dove_sdio0 = {
229 .name = "sdhci-dove",
232 .dma_mask = &sdio_dmamask,
233 .coherent_dma_mask = DMA_BIT_MASK(32),
235 .resource = dove_sdio0_resources,
236 .num_resources = ARRAY_SIZE(dove_sdio0_resources),
239 void __init dove_sdio0_init(void)
241 platform_device_register(&dove_sdio0);
244 static struct resource dove_sdio1_resources[] = {
246 .start = DOVE_SDIO1_PHYS_BASE,
247 .end = DOVE_SDIO1_PHYS_BASE + 0xff,
248 .flags = IORESOURCE_MEM,
250 .start = IRQ_DOVE_SDIO1,
251 .end = IRQ_DOVE_SDIO1,
252 .flags = IORESOURCE_IRQ,
256 static struct platform_device dove_sdio1 = {
257 .name = "sdhci-dove",
260 .dma_mask = &sdio_dmamask,
261 .coherent_dma_mask = DMA_BIT_MASK(32),
263 .resource = dove_sdio1_resources,
264 .num_resources = ARRAY_SIZE(dove_sdio1_resources),
267 void __init dove_sdio1_init(void)
269 platform_device_register(&dove_sdio1);
272 void __init dove_init(void)
278 printk(KERN_INFO "Dove 88AP510 SoC, ");
279 printk(KERN_INFO "TCLK = %dMHz\n", (tclk + 499999) / 1000000);
281 #ifdef CONFIG_CACHE_TAUROS2
284 dove_setup_cpu_mbus();
286 /* internal devices that every board has */
292 void dove_restart(char mode, const char *cmd)
295 * Enable soft reset to assert RSTOUTn.
297 writel(SOFT_RESET_OUT_EN, RSTOUTn_MASK);
302 writel(SOFT_RESET, SYSTEM_SOFT_RESET);