blob: f6fea493357171fe362e8b4dbbdb75a6121ddf70 [file] [log] [blame]
Simon Arlottec9653b2012-05-26 01:04:43 -06001/*
2 * Copyright (C) 2010 Broadcom
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14
15#include <linux/init.h>
Simon Arlott89214f02012-09-12 19:57:26 -060016#include <linux/irqchip/bcm2835.h>
Simon Arlottec9653b2012-05-26 01:04:43 -060017#include <linux/of_platform.h>
Simon Arlottee4af562012-09-10 22:38:35 -060018#include <linux/bcm2835_timer.h>
Simon Arlott75fabc32012-09-10 23:26:15 -060019#include <linux/clk/bcm2835.h>
Simon Arlottec9653b2012-05-26 01:04:43 -060020
21#include <asm/mach/arch.h>
22#include <asm/mach/map.h>
Simon Arlottec9653b2012-05-26 01:04:43 -060023
24#include <mach/bcm2835_soc.h>
25
26static struct map_desc io_map __initdata = {
27 .virtual = BCM2835_PERIPH_VIRT,
28 .pfn = __phys_to_pfn(BCM2835_PERIPH_PHYS),
29 .length = BCM2835_PERIPH_SIZE,
30 .type = MT_DEVICE
31};
32
33void __init bcm2835_map_io(void)
34{
35 iotable_init(&io_map, 1);
36}
37
Simon Arlottec9653b2012-05-26 01:04:43 -060038void __init bcm2835_init(void)
39{
40 int ret;
41
Simon Arlott75fabc32012-09-10 23:26:15 -060042 bcm2835_init_clocks();
43
Simon Arlottec9653b2012-05-26 01:04:43 -060044 ret = of_platform_populate(NULL, of_default_bus_match_table, NULL,
45 NULL);
46 if (ret) {
47 pr_err("of_platform_populate failed: %d\n", ret);
48 BUG();
49 }
50}
51
Simon Arlottec9653b2012-05-26 01:04:43 -060052static const char * const bcm2835_compat[] = {
53 "brcm,bcm2835",
54 NULL
55};
56
57DT_MACHINE_START(BCM2835, "BCM2835")
58 .map_io = bcm2835_map_io,
59 .init_irq = bcm2835_init_irq,
60 .handle_irq = bcm2835_handle_irq,
61 .init_machine = bcm2835_init,
62 .timer = &bcm2835_timer,
63 .dt_compat = bcm2835_compat
64MACHINE_END