diff options
-rw-r--r-- | Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt | 13 | ||||
-rw-r--r-- | arch/arm/Kconfig | 5 | ||||
-rw-r--r-- | arch/arm/boot/dts/bcm2835-rpi-b.dts | 15 | ||||
-rw-r--r-- | arch/arm/boot/dts/bcm2835.dtsi | 28 | ||||
-rw-r--r-- | arch/arm/mach-bcm2835/bcm2835.c | 46 | ||||
-rw-r--r-- | arch/arm/mach-bcm2835/include/mach/gpio.h | 1 |
6 files changed, 107 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt b/Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt new file mode 100644 index 000000000000..d209366b4a69 --- /dev/null +++ b/Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt | |||
@@ -0,0 +1,13 @@ | |||
1 | BCM2835 Watchdog timer | ||
2 | |||
3 | Required properties: | ||
4 | |||
5 | - compatible : should be "brcm,bcm2835-pm-wdt" | ||
6 | - reg : Specifies base physical address and size of the registers. | ||
7 | |||
8 | Example: | ||
9 | |||
10 | watchdog { | ||
11 | compatible = "brcm,bcm2835-pm-wdt"; | ||
12 | reg = <0x7e100000 0x28>; | ||
13 | }; | ||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 6c1d0198553d..69d2844dd507 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -336,7 +336,7 @@ config ARCH_AT91 | |||
336 | 336 | ||
337 | config ARCH_BCM2835 | 337 | config ARCH_BCM2835 |
338 | bool "Broadcom BCM2835 family" | 338 | bool "Broadcom BCM2835 family" |
339 | select ARCH_WANT_OPTIONAL_GPIOLIB | 339 | select ARCH_REQUIRE_GPIOLIB |
340 | select ARM_AMBA | 340 | select ARM_AMBA |
341 | select ARM_ERRATA_411920 | 341 | select ARM_ERRATA_411920 |
342 | select ARM_TIMER_SP804 | 342 | select ARM_TIMER_SP804 |
@@ -344,7 +344,10 @@ config ARCH_BCM2835 | |||
344 | select COMMON_CLK | 344 | select COMMON_CLK |
345 | select CPU_V6 | 345 | select CPU_V6 |
346 | select GENERIC_CLOCKEVENTS | 346 | select GENERIC_CLOCKEVENTS |
347 | select GENERIC_GPIO | ||
347 | select MULTI_IRQ_HANDLER | 348 | select MULTI_IRQ_HANDLER |
349 | select PINCTRL | ||
350 | select PINCTRL_BCM2835 | ||
348 | select SPARSE_IRQ | 351 | select SPARSE_IRQ |
349 | select USE_OF | 352 | select USE_OF |
350 | help | 353 | help |
diff --git a/arch/arm/boot/dts/bcm2835-rpi-b.dts b/arch/arm/boot/dts/bcm2835-rpi-b.dts index 7dd860f83f96..9b72054a0bc0 100644 --- a/arch/arm/boot/dts/bcm2835-rpi-b.dts +++ b/arch/arm/boot/dts/bcm2835-rpi-b.dts | |||
@@ -10,3 +10,18 @@ | |||
10 | reg = <0 0x10000000>; | 10 | reg = <0 0x10000000>; |
11 | }; | 11 | }; |
12 | }; | 12 | }; |
13 | |||
14 | &gpio { | ||
15 | pinctrl-names = "default"; | ||
16 | pinctrl-0 = <&alt0 &alt3>; | ||
17 | |||
18 | alt0: alt0 { | ||
19 | brcm,pins = <0 1 2 3 4 5 6 7 8 9 10 11 14 15 40 45>; | ||
20 | brcm,function = <4>; /* alt0 */ | ||
21 | }; | ||
22 | |||
23 | alt3: alt3 { | ||
24 | brcm,pins = <48 49 50 51 52 53>; | ||
25 | brcm,function = <7>; /* alt3 */ | ||
26 | }; | ||
27 | }; | ||
diff --git a/arch/arm/boot/dts/bcm2835.dtsi b/arch/arm/boot/dts/bcm2835.dtsi index 0b619398532c..8917550fd1bb 100644 --- a/arch/arm/boot/dts/bcm2835.dtsi +++ b/arch/arm/boot/dts/bcm2835.dtsi | |||
@@ -29,11 +29,39 @@ | |||
29 | #interrupt-cells = <2>; | 29 | #interrupt-cells = <2>; |
30 | }; | 30 | }; |
31 | 31 | ||
32 | watchdog { | ||
33 | compatible = "brcm,bcm2835-pm-wdt"; | ||
34 | reg = <0x7e100000 0x28>; | ||
35 | }; | ||
36 | |||
32 | uart@20201000 { | 37 | uart@20201000 { |
33 | compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell"; | 38 | compatible = "brcm,bcm2835-pl011", "arm,pl011", "arm,primecell"; |
34 | reg = <0x7e201000 0x1000>; | 39 | reg = <0x7e201000 0x1000>; |
35 | interrupts = <2 25>; | 40 | interrupts = <2 25>; |
36 | clock-frequency = <3000000>; | 41 | clock-frequency = <3000000>; |
37 | }; | 42 | }; |
43 | |||
44 | gpio: gpio { | ||
45 | compatible = "brcm,bcm2835-gpio"; | ||
46 | reg = <0x7e200000 0xb4>; | ||
47 | /* | ||
48 | * The GPIO IP block is designed for 3 banks of GPIOs. | ||
49 | * Each bank has a GPIO interrupt for itself. | ||
50 | * There is an overall "any bank" interrupt. | ||
51 | * In order, these are GIC interrupts 17, 18, 19, 20. | ||
52 | * Since the BCM2835 only has 2 banks, the 2nd bank | ||
53 | * interrupt output appears to be mirrored onto the | ||
54 | * 3rd bank's interrupt signal. | ||
55 | * So, a bank0 interrupt shows up on 17, 20, and | ||
56 | * a bank1 interrupt shows up on 18, 19, 20! | ||
57 | */ | ||
58 | interrupts = <2 17>, <2 18>, <2 19>, <2 20>; | ||
59 | |||
60 | gpio-controller; | ||
61 | #gpio-cells = <2>; | ||
62 | |||
63 | interrupt-controller; | ||
64 | #interrupt-cells = <2>; | ||
65 | }; | ||
38 | }; | 66 | }; |
39 | }; | 67 | }; |
diff --git a/arch/arm/mach-bcm2835/bcm2835.c b/arch/arm/mach-bcm2835/bcm2835.c index f6fea4933571..c4dd210f4db1 100644 --- a/arch/arm/mach-bcm2835/bcm2835.c +++ b/arch/arm/mach-bcm2835/bcm2835.c | |||
@@ -12,8 +12,10 @@ | |||
12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/delay.h> | ||
15 | #include <linux/init.h> | 16 | #include <linux/init.h> |
16 | #include <linux/irqchip/bcm2835.h> | 17 | #include <linux/irqchip/bcm2835.h> |
18 | #include <linux/of_address.h> | ||
17 | #include <linux/of_platform.h> | 19 | #include <linux/of_platform.h> |
18 | #include <linux/bcm2835_timer.h> | 20 | #include <linux/bcm2835_timer.h> |
19 | #include <linux/clk/bcm2835.h> | 21 | #include <linux/clk/bcm2835.h> |
@@ -23,6 +25,48 @@ | |||
23 | 25 | ||
24 | #include <mach/bcm2835_soc.h> | 26 | #include <mach/bcm2835_soc.h> |
25 | 27 | ||
28 | #define PM_RSTC 0x1c | ||
29 | #define PM_WDOG 0x24 | ||
30 | |||
31 | #define PM_PASSWORD 0x5a000000 | ||
32 | #define PM_RSTC_WRCFG_MASK 0x00000030 | ||
33 | #define PM_RSTC_WRCFG_FULL_RESET 0x00000020 | ||
34 | |||
35 | static void __iomem *wdt_regs; | ||
36 | |||
37 | /* | ||
38 | * The machine restart method can be called from an atomic context so we won't | ||
39 | * be able to ioremap the regs then. | ||
40 | */ | ||
41 | static void bcm2835_setup_restart(void) | ||
42 | { | ||
43 | struct device_node *np = of_find_compatible_node(NULL, NULL, | ||
44 | "brcm,bcm2835-pm-wdt"); | ||
45 | if (WARN(!np, "unable to setup watchdog restart")) | ||
46 | return; | ||
47 | |||
48 | wdt_regs = of_iomap(np, 0); | ||
49 | WARN(!wdt_regs, "failed to remap watchdog regs"); | ||
50 | } | ||
51 | |||
52 | static void bcm2835_restart(char mode, const char *cmd) | ||
53 | { | ||
54 | u32 val; | ||
55 | |||
56 | if (!wdt_regs) | ||
57 | return; | ||
58 | |||
59 | /* use a timeout of 10 ticks (~150us) */ | ||
60 | writel_relaxed(10 | PM_PASSWORD, wdt_regs + PM_WDOG); | ||
61 | val = readl_relaxed(wdt_regs + PM_RSTC); | ||
62 | val &= ~PM_RSTC_WRCFG_MASK; | ||
63 | val |= PM_PASSWORD | PM_RSTC_WRCFG_FULL_RESET; | ||
64 | writel_relaxed(val, wdt_regs + PM_RSTC); | ||
65 | |||
66 | /* No sleeping, possibly atomic. */ | ||
67 | mdelay(1); | ||
68 | } | ||
69 | |||
26 | static struct map_desc io_map __initdata = { | 70 | static struct map_desc io_map __initdata = { |
27 | .virtual = BCM2835_PERIPH_VIRT, | 71 | .virtual = BCM2835_PERIPH_VIRT, |
28 | .pfn = __phys_to_pfn(BCM2835_PERIPH_PHYS), | 72 | .pfn = __phys_to_pfn(BCM2835_PERIPH_PHYS), |
@@ -39,6 +83,7 @@ void __init bcm2835_init(void) | |||
39 | { | 83 | { |
40 | int ret; | 84 | int ret; |
41 | 85 | ||
86 | bcm2835_setup_restart(); | ||
42 | bcm2835_init_clocks(); | 87 | bcm2835_init_clocks(); |
43 | 88 | ||
44 | ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, | 89 | ret = of_platform_populate(NULL, of_default_bus_match_table, NULL, |
@@ -60,5 +105,6 @@ DT_MACHINE_START(BCM2835, "BCM2835") | |||
60 | .handle_irq = bcm2835_handle_irq, | 105 | .handle_irq = bcm2835_handle_irq, |
61 | .init_machine = bcm2835_init, | 106 | .init_machine = bcm2835_init, |
62 | .timer = &bcm2835_timer, | 107 | .timer = &bcm2835_timer, |
108 | .restart = bcm2835_restart, | ||
63 | .dt_compat = bcm2835_compat | 109 | .dt_compat = bcm2835_compat |
64 | MACHINE_END | 110 | MACHINE_END |
diff --git a/arch/arm/mach-bcm2835/include/mach/gpio.h b/arch/arm/mach-bcm2835/include/mach/gpio.h new file mode 100644 index 000000000000..40a8c178f10d --- /dev/null +++ b/arch/arm/mach-bcm2835/include/mach/gpio.h | |||
@@ -0,0 +1 @@ | |||
/* empty */ | |||