1 From 456ed3c197e8aec439ebeca39060c204d2429896 Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Sun, 12 May 2013 12:24:19 +0100
4 Subject: [PATCH 036/454] Main bcm2708/bcm2709 linux port
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Signed-off-by: popcornmix <popcornmix@gmail.com>
10 Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
12 bcm2709: Drop platform smp and timer init code
14 irq-bcm2836 handles this through these functions:
15 bcm2835_init_local_timer_frequency()
16 bcm2836_arm_irqchip_smp_init()
18 Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
20 bcm270x: Use watchdog for reboot/poweroff
22 The watchdog driver already has support for reboot/poweroff.
23 Make use of this and remove the code from the platform files.
25 Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
27 arch/arm/mach-bcm/Kconfig | 1 +
28 arch/arm/mach-bcm/board_bcm2835.c | 9 +++++++++
29 arch/arm/mm/proc-v6.S | 15 ++++++++++++---
30 drivers/irqchip/irq-bcm2835.c | 7 ++++++-
31 drivers/mailbox/bcm2835-mailbox.c | 18 ++++++++++++++++--
32 5 files changed, 44 insertions(+), 6 deletions(-)
34 --- a/arch/arm/mach-bcm/Kconfig
35 +++ b/arch/arm/mach-bcm/Kconfig
36 @@ -158,6 +158,7 @@ config ARCH_BCM2835
39 select PINCTRL_BCM2835
40 + select MFD_SYSCON if ARCH_MULTI_V7
42 This enables support for the Broadcom BCM2835 and BCM2836 SoCs.
43 This SoC is used in the Raspberry Pi and Roku 2 devices.
44 --- a/arch/arm/mach-bcm/board_bcm2835.c
45 +++ b/arch/arm/mach-bcm/board_bcm2835.c
47 #include <asm/mach/arch.h>
48 #include <asm/mach/map.h>
50 +#include <linux/dma-mapping.h>
52 static void __init bcm2835_init(void)
54 struct device_node *np = of_find_node_by_path("/system");
55 @@ -35,6 +37,12 @@ static void __init bcm2835_init(void)
56 system_serial_low = val64;
59 +static void __init bcm2835_init_early(void)
61 + /* dwc_otg needs this for bounce buffers on non-aligned transfers */
62 + init_dma_coherent_pool_size(SZ_1M);
65 static const char * const bcm2835_compat[] = {
66 #ifdef CONFIG_ARCH_MULTI_V6
68 @@ -47,5 +55,6 @@ static const char * const bcm2835_compat
70 DT_MACHINE_START(BCM2835, "BCM2835")
71 .init_machine = bcm2835_init,
72 + .init_early = bcm2835_init_early,
73 .dt_compat = bcm2835_compat
75 --- a/arch/arm/mm/proc-v6.S
76 +++ b/arch/arm/mm/proc-v6.S
77 @@ -73,10 +73,19 @@ ENDPROC(cpu_v6_reset)
79 * IRQs are already disabled.
82 +/* See jira SW-5991 for details of this workaround */
85 - mcr p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode
86 - mcr p15, 0, r1, c7, c0, 4 @ wait for interrupt
91 + mcreq p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode
92 + mcreq p15, 0, r1, c7, c0, 4 @ wait for interrupt
99 ENTRY(cpu_v6_dcache_clean_area)
100 --- a/drivers/irqchip/irq-bcm2835.c
101 +++ b/drivers/irqchip/irq-bcm2835.c
103 #include <linux/regmap.h>
105 #include <asm/exception.h>
106 +#ifndef CONFIG_ARM64
107 #include <asm/mach/irq.h>
110 /* Put the bank and irq (32 bits) into the hwirq */
111 #define MAKE_HWIRQ(b, n) (((b) << 5) | (n))
114 #define IRQS_PER_BANK 32
115 #define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0)
117 #define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0))
119 static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 };
120 @@ -255,10 +258,12 @@ static int __init armctrl_of_init(struct
121 MAKE_HWIRQ(b, i) + NUMBER_IRQS);
123 irq_set_chip(irq, &armctrl_chip);
124 - set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
125 + irq_set_probe(irq);
128 +#ifndef CONFIG_ARM64
134 --- a/drivers/mailbox/bcm2835-mailbox.c
135 +++ b/drivers/mailbox/bcm2835-mailbox.c
137 #define MAIL1_WRT (ARM_0_MAIL1 + 0x00)
138 #define MAIL1_STA (ARM_0_MAIL1 + 0x18)
140 +/* On ARCH_BCM270x these come through <linux/interrupt.h> (arm_control.h ) */
142 /* Status register: FIFO state. */
143 #define ARM_MS_FULL BIT(31)
144 #define ARM_MS_EMPTY BIT(30)
146 /* Configuration register: Enable interrupts. */
147 #define ARM_MC_IHAVEDATAIRQEN BIT(0)
150 struct bcm2835_mbox {
152 @@ -151,7 +154,7 @@ static int bcm2835_mbox_probe(struct pla
154 spin_lock_init(&mbox->lock);
156 - ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0),
157 + ret = devm_request_irq(dev, platform_get_irq(pdev, 0),
158 bcm2835_mbox_irq, 0, dev_name(dev), mbox);
160 dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n",
161 @@ -209,7 +212,18 @@ static struct platform_driver bcm2835_mb
162 .probe = bcm2835_mbox_probe,
163 .remove = bcm2835_mbox_remove,
165 -module_platform_driver(bcm2835_mbox_driver);
167 +static int __init bcm2835_mbox_init(void)
169 + return platform_driver_register(&bcm2835_mbox_driver);
171 +arch_initcall(bcm2835_mbox_init);
173 +static void __init bcm2835_mbox_exit(void)
175 + platform_driver_unregister(&bcm2835_mbox_driver);
177 +module_exit(bcm2835_mbox_exit);
179 MODULE_AUTHOR("Lubomir Rintel <lkundrak@v3.sk>");
180 MODULE_DESCRIPTION("BCM2835 mailbox IPC driver");