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 void __init
dove_sata_init(struct mv_sata_platform_data
*sata_data
)
112 orion_sata_init(sata_data
, &dove_mbus_dram_info
,
113 DOVE_SATA_PHYS_BASE
, IRQ_DOVE_SATA
);
117 /*****************************************************************************
119 ****************************************************************************/
120 void __init
dove_uart0_init(void)
122 orion_uart0_init(DOVE_UART0_VIRT_BASE
, DOVE_UART0_PHYS_BASE
,
123 IRQ_DOVE_UART_0
, get_tclk());
126 /*****************************************************************************
128 ****************************************************************************/
129 void __init
dove_uart1_init(void)
131 orion_uart1_init(DOVE_UART1_VIRT_BASE
, DOVE_UART1_PHYS_BASE
,
132 IRQ_DOVE_UART_1
, get_tclk());
135 /*****************************************************************************
137 ****************************************************************************/
138 void __init
dove_uart2_init(void)
140 orion_uart2_init(DOVE_UART2_VIRT_BASE
, DOVE_UART2_PHYS_BASE
,
141 IRQ_DOVE_UART_2
, get_tclk());
144 /*****************************************************************************
146 ****************************************************************************/
147 void __init
dove_uart3_init(void)
149 orion_uart3_init(DOVE_UART3_VIRT_BASE
, DOVE_UART3_PHYS_BASE
,
150 IRQ_DOVE_UART_3
, get_tclk());
153 /*****************************************************************************
155 ****************************************************************************/
156 void __init
dove_spi0_init(void)
158 orion_spi_init(DOVE_SPI0_PHYS_BASE
, get_tclk());
161 void __init
dove_spi1_init(void)
163 orion_spi_init(DOVE_SPI1_PHYS_BASE
, get_tclk());
166 /*****************************************************************************
168 ****************************************************************************/
169 void __init
dove_i2c_init(void)
171 orion_i2c_init(DOVE_I2C_PHYS_BASE
, IRQ_DOVE_I2C
, 10);
174 /*****************************************************************************
176 ****************************************************************************/
177 void __init
dove_init_early(void)
179 orion_time_set_base(TIMER_VIRT_BASE
);
182 static int get_tclk(void)
184 /* use DOVE_RESET_SAMPLE_HI/LO to detect tclk */
188 static void dove_timer_init(void)
190 orion_time_init(BRIDGE_VIRT_BASE
, BRIDGE_INT_TIMER1_CLR
,
191 IRQ_DOVE_BRIDGE
, get_tclk());
194 struct sys_timer dove_timer
= {
195 .init
= dove_timer_init
,
198 /*****************************************************************************
200 ****************************************************************************/
201 void __init
dove_xor0_init(void)
203 orion_xor0_init(&dove_mbus_dram_info
,
204 DOVE_XOR0_PHYS_BASE
, DOVE_XOR0_HIGH_PHYS_BASE
,
205 IRQ_DOVE_XOR_00
, IRQ_DOVE_XOR_01
);
208 /*****************************************************************************
210 ****************************************************************************/
211 void __init
dove_xor1_init(void)
213 orion_xor1_init(DOVE_XOR1_PHYS_BASE
, DOVE_XOR1_HIGH_PHYS_BASE
,
214 IRQ_DOVE_XOR_10
, IRQ_DOVE_XOR_11
);
217 /*****************************************************************************
219 ****************************************************************************/
220 static u64 sdio_dmamask
= DMA_BIT_MASK(32);
222 static struct resource dove_sdio0_resources
[] = {
224 .start
= DOVE_SDIO0_PHYS_BASE
,
225 .end
= DOVE_SDIO0_PHYS_BASE
+ 0xff,
226 .flags
= IORESOURCE_MEM
,
228 .start
= IRQ_DOVE_SDIO0
,
229 .end
= IRQ_DOVE_SDIO0
,
230 .flags
= IORESOURCE_IRQ
,
234 static struct platform_device dove_sdio0
= {
235 .name
= "sdhci-dove",
238 .dma_mask
= &sdio_dmamask
,
239 .coherent_dma_mask
= DMA_BIT_MASK(32),
241 .resource
= dove_sdio0_resources
,
242 .num_resources
= ARRAY_SIZE(dove_sdio0_resources
),
245 void __init
dove_sdio0_init(void)
247 platform_device_register(&dove_sdio0
);
250 static struct resource dove_sdio1_resources
[] = {
252 .start
= DOVE_SDIO1_PHYS_BASE
,
253 .end
= DOVE_SDIO1_PHYS_BASE
+ 0xff,
254 .flags
= IORESOURCE_MEM
,
256 .start
= IRQ_DOVE_SDIO1
,
257 .end
= IRQ_DOVE_SDIO1
,
258 .flags
= IORESOURCE_IRQ
,
262 static struct platform_device dove_sdio1
= {
263 .name
= "sdhci-dove",
266 .dma_mask
= &sdio_dmamask
,
267 .coherent_dma_mask
= DMA_BIT_MASK(32),
269 .resource
= dove_sdio1_resources
,
270 .num_resources
= ARRAY_SIZE(dove_sdio1_resources
),
273 void __init
dove_sdio1_init(void)
275 platform_device_register(&dove_sdio1
);
278 void __init
dove_init(void)
284 printk(KERN_INFO
"Dove 88AP510 SoC, ");
285 printk(KERN_INFO
"TCLK = %dMHz\n", (tclk
+ 499999) / 1000000);
287 #ifdef CONFIG_CACHE_TAUROS2
290 dove_setup_cpu_mbus();
292 /* internal devices that every board has */