4 #include <linux/device.h>
27 #include <asm/sizes.h>
46 #define V2M_PA_CS0 0x40000000
47 #define V2M_PA_CS1 0x44000000
48 #define V2M_PA_CS2 0x48000000
49 #define V2M_PA_CS3 0x4c000000
50 #define V2M_PA_CS7 0x10000000
61 static void __iomem *v2m_sysreg_base;
77 static void __init v2m_sp804_init(
void __iomem *base,
unsigned int irq)
85 sp804_clocksource_init(base +
TIMER_2_BASE,
"v2m-timer1");
97 printk(
"%s: writing %08x to %08x\n", __func__, data, devfn);
101 spin_lock(&v2m_cfg_lock);
111 spin_unlock(&v2m_cfg_lock);
122 spin_lock(&v2m_cfg_lock);
134 spin_unlock(&v2m_cfg_lock);
153 static struct resource v2m_pcie_i2c_resource = {
160 .name =
"versatile-i2c",
163 .resource = &v2m_pcie_i2c_resource,
166 static struct resource v2m_ddc_i2c_resource = {
173 .name =
"versatile-i2c",
176 .resource = &v2m_ddc_i2c_resource,
179 static struct resource v2m_eth_resources[] = {
201 .resource = v2m_eth_resources,
202 .num_resources =
ARRAY_SIZE(v2m_eth_resources),
203 .dev.platform_data = &v2m_eth_config,
211 static struct resource v2m_usb_resources[] = {
225 .bus_width_16 =
false,
228 .dack_polarity_high =
false,
229 .dreq_polarity_high =
false,
235 .resource = v2m_usb_resources,
236 .num_resources =
ARRAY_SIZE(v2m_usb_resources),
237 .dev.platform_data = &v2m_usb_config,
247 .set_vpp = v2m_flash_set_vpp,
250 static struct resource v2m_flash_resources[] = {
263 .name =
"physmap-flash",
265 .resource = v2m_flash_resources,
266 .num_resources =
ARRAY_SIZE(v2m_flash_resources),
267 .dev.platform_data = &v2m_flash_data,
274 static struct resource v2m_pata_resources[] = {
287 .name =
"pata_platform",
289 .resource = v2m_pata_resources,
290 .num_resources =
ARRAY_SIZE(v2m_pata_resources),
291 .dev.platform_data = &v2m_pata_data,
294 static unsigned int v2m_mmci_status(
struct device *
dev)
301 .status = v2m_mmci_status,
315 static struct amba_device *v2m_amba_devs[] __initdata = {
329 static unsigned long v2m_osc_recalc_rate(
struct clk_hw *
hw,
330 unsigned long parent_rate)
337 static long v2m_osc_round_rate(
struct clk_hw *
hw,
unsigned long rate,
338 unsigned long *parent_rate)
351 static int v2m_osc_set_rate(
struct clk_hw *hw,
unsigned long rate,
352 unsigned long parent_rate)
362 static struct clk_ops v2m_osc_ops = {
363 .recalc_rate = v2m_osc_recalc_rate,
364 .round_rate = v2m_osc_round_rate,
365 .set_rate = v2m_osc_set_rate,
370 struct clk_init_data init;
377 init.ops = &v2m_osc_ops;
378 init.flags = CLK_IS_ROOT;
379 init.num_parents = 0;
386 static struct v2m_osc v2m_mb_osc1 = {
389 .rate_min = 23750000,
390 .rate_max = 63500000,
391 .rate_default = 23750000,
394 static const char *v2m_ref_clk_periphs[]
__initconst = {
395 "mb:wdt",
"1000f000.wdt",
"1c0f0000.wdt",
398 static const char *v2m_osc1_periphs[] __initconst = {
399 "mb:clcd",
"1001f000.clcd",
"1c1f0000.clcd",
402 static const char *v2m_osc2_periphs[] __initconst = {
403 "mb:mmci",
"10005000.mmci",
"1c050000.mmci",
404 "mb:kmi0",
"10006000.kmi",
"1c060000.kmi",
405 "mb:kmi1",
"10007000.kmi",
"1c070000.kmi",
406 "mb:uart0",
"10009000.uart",
"1c090000.uart",
407 "mb:uart1",
"1000a000.uart",
"1c0a0000.uart",
408 "mb:uart2",
"1000b000.uart",
"1c0b0000.uart",
409 "mb:uart3",
"1000c000.uart",
"1c0c0000.uart",
412 static void __init v2m_clk_init(
void)
423 for (i = 0; i <
ARRAY_SIZE(v2m_ref_clk_periphs); i++)
427 CLK_IS_ROOT, 1000000);
432 for (i = 0; i <
ARRAY_SIZE(v2m_osc1_periphs); i++)
436 CLK_IS_ROOT, 24000000);
437 for (i = 0; i <
ARRAY_SIZE(v2m_osc2_periphs); i++)
441 static void __init v2m_timer_init(
void)
449 .init = v2m_timer_init,
452 static void __init v2m_init_early(
void)
459 static void v2m_power_off(
void)
465 static void v2m_restart(
char str,
const char *
cmd)
473 static struct ct_desc *ct_descs[] __initdata = {
474 #ifdef CONFIG_ARCH_VEXPRESS_CA9X4
479 static void __init v2m_populate_ct_desc(
void)
489 if (ct_descs[i]->
id == current_tile_id)
490 ct_desc = ct_descs[
i];
493 panic(
"vexpress: this kernel does not support core tile ID 0x%08x when booting via ATAGs.\n"
494 "You may need a device tree blob or a different kernel to boot on this board.\n",
498 static void __init v2m_map_io(
void)
502 v2m_populate_ct_desc();
506 static void __init v2m_init_irq(
void)
511 static void __init v2m_init(
void)
525 for (i = 0; i <
ARRAY_SIZE(v2m_amba_devs); i++)
534 .atag_offset = 0x100,
536 .map_io = v2m_map_io,
537 .init_early = v2m_init_early,
538 .init_irq = v2m_init_irq,
541 .init_machine = v2m_init,
542 .restart = v2m_restart,
545 static struct map_desc v2m_rs1_io_desc __initdata = {
552 static int __init v2m_dt_scan_memory_map(
unsigned long node,
const char *uname,
557 if (
strcmp(uname,
"motherboard") != 0)
560 *map = of_get_flat_dt_prop(node,
"arm,v2m-memory-map",
NULL);
567 const char *map =
NULL;
569 of_scan_flat_dt(v2m_dt_scan_memory_map, &map);
571 if (map &&
strcmp(map,
"rs1") == 0)
576 #if defined(CONFIG_SMP)
587 v2m_sysreg_base =
of_iomap(node, 0);
592 if (of_property_read_u32(
allnodes,
"arm,hbi", &dt_hbi) == 0) {
599 pr_warning(
"vexpress: DT HBI (%x) is not matching "
600 "hardware (%x)!\n", dt_hbi, hbi);
604 static struct of_device_id vexpress_irq_match[] __initdata = {
605 { .compatible =
"arm,cortex-a9-gic", .data =
gic_of_init, },
609 static void __init v2m_dt_init_irq(
void)
614 static void __init v2m_dt_timer_init(
void)
631 twd_local_timer_of_register();
638 .init = v2m_dt_timer_init,
641 static struct of_dev_auxdata v2m_dt_auxdata_lookup[] __initdata = {
642 OF_DEV_AUXDATA(
"arm,vexpress-flash",
V2M_NOR0,
"physmap-flash",
644 OF_DEV_AUXDATA(
"arm,primecell",
V2M_MMCI,
"mb:mmci", &v2m_mmci_data),
646 OF_DEV_AUXDATA(
"arm,vexpress-flash", 0x08000000,
"physmap-flash",
648 OF_DEV_AUXDATA(
"arm,primecell", 0x1c050000,
"mb:mmci", &v2m_mmci_data),
652 static void __init v2m_dt_init(
void)
654 l2x0_of_init(0x00400000, 0xfe0fffff);
656 v2m_dt_auxdata_lookup,
NULL);
660 const static char *v2m_dt_match[] __initconst = {
667 .dt_compat = v2m_dt_match,
671 .init_irq = v2m_dt_init_irq,
672 .timer = &v2m_dt_timer,
673 .init_machine = v2m_dt_init,
675 .restart = v2m_restart,