diff options
author | Markus Mayer <markus.mayer@linaro.org> | 2014-02-20 19:16:11 -0500 |
---|---|---|
committer | Stephen Warren <swarren@wwwdotorg.org> | 2014-02-24 21:42:35 -0500 |
commit | d30fe6272183f3cc8b9f3f111cd36271332e4cec (patch) | |
tree | b687736f4e0c2fc441c40db4dc917c7b1e47730c /arch/arm/mach-bcm | |
parent | 38dbfb59d1175ef458d006556061adeaa8751b72 (diff) |
ARM: bcm2835: Move to mach-bcm directory
Move the bcm2835 board file into the mach-bcm directory. This allows us
to get rid of the mach-bcm2835 directory with the associated Kconfig
and Makefile.
Signed-off-by: Markus Mayer <markus.mayer@linaro.org>
[swarren, adjust defconfig so ARCH_BCM2835 still gets enabled]
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Diffstat (limited to 'arch/arm/mach-bcm')
-rw-r--r-- | arch/arm/mach-bcm/Kconfig | 16 | ||||
-rw-r--r-- | arch/arm/mach-bcm/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-bcm/board_bcm2835.c | 137 |
3 files changed, 155 insertions, 0 deletions
diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig index b1aa6a9b3bd1..4e466e9eef44 100644 --- a/arch/arm/mach-bcm/Kconfig +++ b/arch/arm/mach-bcm/Kconfig | |||
@@ -32,6 +32,22 @@ config ARCH_BCM_MOBILE | |||
32 | BCM11130, BCM11140, BCM11351, BCM28145 and | 32 | BCM11130, BCM11140, BCM11351, BCM28145 and |
33 | BCM28155 variants. | 33 | BCM28155 variants. |
34 | 34 | ||
35 | config ARCH_BCM2835 | ||
36 | bool "Broadcom BCM2835 family" if ARCH_MULTI_V6 | ||
37 | select ARCH_REQUIRE_GPIOLIB | ||
38 | select ARM_AMBA | ||
39 | select ARM_ERRATA_411920 | ||
40 | select ARM_TIMER_SP804 | ||
41 | select CLKDEV_LOOKUP | ||
42 | select CLKSRC_OF | ||
43 | select CPU_V6 | ||
44 | select GENERIC_CLOCKEVENTS | ||
45 | select PINCTRL | ||
46 | select PINCTRL_BCM2835 | ||
47 | help | ||
48 | This enables support for the Broadcom BCM2835 SoC. This SoC is | ||
49 | used in the Raspberry Pi and Roku 2 devices. | ||
50 | |||
35 | endmenu | 51 | endmenu |
36 | 52 | ||
37 | endif | 53 | endif |
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile index c2ccd5a0f772..0ad293882079 100644 --- a/arch/arm/mach-bcm/Makefile +++ b/arch/arm/mach-bcm/Makefile | |||
@@ -11,5 +11,7 @@ | |||
11 | # GNU General Public License for more details. | 11 | # GNU General Public License for more details. |
12 | 12 | ||
13 | obj-$(CONFIG_ARCH_BCM_MOBILE) := board_bcm281xx.o bcm_kona_smc.o bcm_kona_smc_asm.o kona.o | 13 | obj-$(CONFIG_ARCH_BCM_MOBILE) := board_bcm281xx.o bcm_kona_smc.o bcm_kona_smc_asm.o kona.o |
14 | obj-$(CONFIG_ARCH_BCM2835) += board_bcm2835.o | ||
15 | |||
14 | plus_sec := $(call as-instr,.arch_extension sec,+sec) | 16 | plus_sec := $(call as-instr,.arch_extension sec,+sec) |
15 | AFLAGS_bcm_kona_smc_asm.o :=-Wa,-march=armv7-a$(plus_sec) | 17 | AFLAGS_bcm_kona_smc_asm.o :=-Wa,-march=armv7-a$(plus_sec) |
diff --git a/arch/arm/mach-bcm/board_bcm2835.c b/arch/arm/mach-bcm/board_bcm2835.c new file mode 100644 index 000000000000..70f2f3925f0e --- /dev/null +++ b/arch/arm/mach-bcm/board_bcm2835.c | |||
@@ -0,0 +1,137 @@ | |||
1 | /* | ||
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/delay.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/irqchip.h> | ||
18 | #include <linux/of_address.h> | ||
19 | #include <linux/of_platform.h> | ||
20 | #include <linux/clk/bcm2835.h> | ||
21 | |||
22 | #include <asm/mach/arch.h> | ||
23 | #include <asm/mach/map.h> | ||
24 | |||
25 | #define PM_RSTC 0x1c | ||
26 | #define PM_RSTS 0x20 | ||
27 | #define PM_WDOG 0x24 | ||
28 | |||
29 | #define PM_PASSWORD 0x5a000000 | ||
30 | #define PM_RSTC_WRCFG_MASK 0x00000030 | ||
31 | #define PM_RSTC_WRCFG_FULL_RESET 0x00000020 | ||
32 | #define PM_RSTS_HADWRH_SET 0x00000040 | ||
33 | |||
34 | #define BCM2835_PERIPH_PHYS 0x20000000 | ||
35 | #define BCM2835_PERIPH_VIRT 0xf0000000 | ||
36 | #define BCM2835_PERIPH_SIZE SZ_16M | ||
37 | |||
38 | static void __iomem *wdt_regs; | ||
39 | |||
40 | /* | ||
41 | * The machine restart method can be called from an atomic context so we won't | ||
42 | * be able to ioremap the regs then. | ||
43 | */ | ||
44 | static void bcm2835_setup_restart(void) | ||
45 | { | ||
46 | struct device_node *np = of_find_compatible_node(NULL, NULL, | ||
47 | "brcm,bcm2835-pm-wdt"); | ||
48 | if (WARN(!np, "unable to setup watchdog restart")) | ||
49 | return; | ||
50 | |||
51 | wdt_regs = of_iomap(np, 0); | ||
52 | WARN(!wdt_regs, "failed to remap watchdog regs"); | ||
53 | } | ||
54 | |||
55 | static void bcm2835_restart(enum reboot_mode mode, const char *cmd) | ||
56 | { | ||
57 | u32 val; | ||
58 | |||
59 | if (!wdt_regs) | ||
60 | return; | ||
61 | |||
62 | /* use a timeout of 10 ticks (~150us) */ | ||
63 | writel_relaxed(10 | PM_PASSWORD, wdt_regs + PM_WDOG); | ||
64 | val = readl_relaxed(wdt_regs + PM_RSTC); | ||
65 | val &= ~PM_RSTC_WRCFG_MASK; | ||
66 | val |= PM_PASSWORD | PM_RSTC_WRCFG_FULL_RESET; | ||
67 | writel_relaxed(val, wdt_regs + PM_RSTC); | ||
68 | |||
69 | /* No sleeping, possibly atomic. */ | ||
70 | mdelay(1); | ||
71 | } | ||
72 | |||
73 | /* | ||
74 | * We can't really power off, but if we do the normal reset scheme, and | ||
75 | * indicate to bootcode.bin not to reboot, then most of the chip will be | ||
76 | * powered off. | ||
77 | */ | ||
78 | static void bcm2835_power_off(void) | ||
79 | { | ||
80 | u32 val; | ||
81 | |||
82 | /* | ||
83 | * We set the watchdog hard reset bit here to distinguish this reset | ||
84 | * from the normal (full) reset. bootcode.bin will not reboot after a | ||
85 | * hard reset. | ||
86 | */ | ||
87 | val = readl_relaxed(wdt_regs + PM_RSTS); | ||
88 | val &= ~PM_RSTC_WRCFG_MASK; | ||
89 | val |= PM_PASSWORD | PM_RSTS_HADWRH_SET; | ||
90 | writel_relaxed(val, wdt_regs + PM_RSTS); | ||
91 | |||
92 | /* Continue with normal reset mechanism */ | ||
93 | bcm2835_restart(REBOOT_HARD, ""); | ||
94 | } | ||
95 | |||
96 | static struct map_desc io_map __initdata = { | ||
97 | .virtual = BCM2835_PERIPH_VIRT, | ||
98 | .pfn = __phys_to_pfn(BCM2835_PERIPH_PHYS), | ||
99 | .length = BCM2835_PERIPH_SIZE, | ||
100 | .type = MT_DEVICE | ||
101 | }; | ||
102 | |||
103 | static void __init bcm2835_map_io(void) | ||
104 | { | ||
105 | iotable_init(&io_map, 1); | ||
106 | } | ||
107 | |||
108 | static void __init bcm2835_init(void) | ||
109 | { | ||
110 | int ret; | ||
111 | |||
112 | bcm2835_setup_restart(); | ||
113 | if (wdt_regs) | ||
114 | pm_power_off = bcm2835_power_off; | ||
115 | |||
116 | bcm2835_init_clocks(); | ||
117 | |||
118 | ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, | ||
119 | NULL); | ||
120 | if (ret) { | ||
121 | pr_err("of_platform_populate failed: %d\n", ret); | ||
122 | BUG(); | ||
123 | } | ||
124 | } | ||
125 | |||
126 | static const char * const bcm2835_compat[] = { | ||
127 | "brcm,bcm2835", | ||
128 | NULL | ||
129 | }; | ||
130 | |||
131 | DT_MACHINE_START(BCM2835, "BCM2835") | ||
132 | .map_io = bcm2835_map_io, | ||
133 | .init_irq = irqchip_init, | ||
134 | .init_machine = bcm2835_init, | ||
135 | .restart = bcm2835_restart, | ||
136 | .dt_compat = bcm2835_compat | ||
137 | MACHINE_END | ||