Skip to content

Commit 2513e0b

Browse files
committed
Main bcm2708/bcm2709 linux port
Signed-off-by: popcornmix <[email protected]> Signed-off-by: Noralf Trønnes <[email protected]> bcm2709: Drop platform smp and timer init code irq-bcm2836 handles this through these functions: bcm2835_init_local_timer_frequency() bcm2836_arm_irqchip_smp_init() Signed-off-by: Noralf Trønnes <[email protected]> bcm270x: Use watchdog for reboot/poweroff The watchdog driver already has support for reboot/poweroff. Make use of this and remove the code from the platform files. Signed-off-by: Noralf Trønnes <[email protected]>
1 parent d7a51e1 commit 2513e0b

File tree

5 files changed

+44
-6
lines changed

5 files changed

+44
-6
lines changed

arch/arm/mach-bcm/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ config ARCH_BCM2835
158158
select FIQ
159159
select PINCTRL
160160
select PINCTRL_BCM2835
161+
select MFD_SYSCON if ARCH_MULTI_V7
161162
help
162163
This enables support for the Broadcom BCM2835 and BCM2836 SoCs.
163164
This SoC is used in the Raspberry Pi and Roku 2 devices.

arch/arm/mach-bcm/board_bcm2835.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include <asm/mach/arch.h>
2222
#include <asm/mach/map.h>
2323

24+
#include <linux/dma-mapping.h>
25+
2426
static void __init bcm2835_init(void)
2527
{
2628
struct device_node *np = of_find_node_by_path("/system");
@@ -35,6 +37,12 @@ static void __init bcm2835_init(void)
3537
system_serial_low = val64;
3638
}
3739

40+
static void __init bcm2835_init_early(void)
41+
{
42+
/* dwc_otg needs this for bounce buffers on non-aligned transfers */
43+
init_dma_coherent_pool_size(SZ_1M);
44+
}
45+
3846
static const char * const bcm2835_compat[] = {
3947
#ifdef CONFIG_ARCH_MULTI_V6
4048
"brcm,bcm2835",
@@ -47,5 +55,6 @@ static const char * const bcm2835_compat[] = {
4755

4856
DT_MACHINE_START(BCM2835, "BCM2835")
4957
.init_machine = bcm2835_init,
58+
.init_early = bcm2835_init_early,
5059
.dt_compat = bcm2835_compat
5160
MACHINE_END

arch/arm/mm/proc-v6.S

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,19 @@ ENDPROC(cpu_v6_reset)
7373
*
7474
* IRQs are already disabled.
7575
*/
76+
77+
/* See jira SW-5991 for details of this workaround */
7678
ENTRY(cpu_v6_do_idle)
77-
mov r1, #0
78-
mcr p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode
79-
mcr p15, 0, r1, c7, c0, 4 @ wait for interrupt
79+
.align 5
80+
mov r1, #2
81+
1: subs r1, #1
82+
nop
83+
mcreq p15, 0, r1, c7, c10, 4 @ DWB - WFI may enter a low-power mode
84+
mcreq p15, 0, r1, c7, c0, 4 @ wait for interrupt
85+
nop
86+
nop
87+
nop
88+
bne 1b
8089
ret lr
8190

8291
ENTRY(cpu_v6_dcache_clean_area)

drivers/irqchip/irq-bcm2835.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@
5454
#include <linux/regmap.h>
5555

5656
#include <asm/exception.h>
57+
#ifndef CONFIG_ARM64
5758
#include <asm/mach/irq.h>
59+
#endif
5860

5961
/* Put the bank and irq (32 bits) into the hwirq */
6062
#define MAKE_HWIRQ(b, n) (((b) << 5) | (n))
@@ -82,6 +84,7 @@
8284
#define NR_BANKS 3
8385
#define IRQS_PER_BANK 32
8486
#define NUMBER_IRQS MAKE_HWIRQ(NR_BANKS, 0)
87+
#undef FIQ_START
8588
#define FIQ_START (NR_IRQS_BANK0 + MAKE_HWIRQ(NR_BANKS - 1, 0))
8689

8790
static const int reg_pending[] __initconst = { 0x00, 0x04, 0x08 };
@@ -255,10 +258,12 @@ static int __init armctrl_of_init(struct device_node *node,
255258
MAKE_HWIRQ(b, i) + NUMBER_IRQS);
256259
BUG_ON(irq <= 0);
257260
irq_set_chip(irq, &armctrl_chip);
258-
set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
261+
irq_set_probe(irq);
259262
}
260263
}
264+
#ifndef CONFIG_ARM64
261265
init_FIQ(FIQ_START);
266+
#endif
262267

263268
return 0;
264269
}

drivers/mailbox/bcm2835-mailbox.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,15 @@
5151
#define MAIL1_WRT (ARM_0_MAIL1 + 0x00)
5252
#define MAIL1_STA (ARM_0_MAIL1 + 0x18)
5353

54+
/* On ARCH_BCM270x these come through <linux/interrupt.h> (arm_control.h ) */
55+
#ifndef ARM_MS_FULL
5456
/* Status register: FIFO state. */
5557
#define ARM_MS_FULL BIT(31)
5658
#define ARM_MS_EMPTY BIT(30)
5759

5860
/* Configuration register: Enable interrupts. */
5961
#define ARM_MC_IHAVEDATAIRQEN BIT(0)
62+
#endif
6063

6164
struct bcm2835_mbox {
6265
void __iomem *regs;
@@ -151,7 +154,7 @@ static int bcm2835_mbox_probe(struct platform_device *pdev)
151154
return -ENOMEM;
152155
spin_lock_init(&mbox->lock);
153156

154-
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),
155158
bcm2835_mbox_irq, 0, dev_name(dev), mbox);
156159
if (ret) {
157160
dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n",
@@ -209,7 +212,18 @@ static struct platform_driver bcm2835_mbox_driver = {
209212
.probe = bcm2835_mbox_probe,
210213
.remove = bcm2835_mbox_remove,
211214
};
212-
module_platform_driver(bcm2835_mbox_driver);
215+
216+
static int __init bcm2835_mbox_init(void)
217+
{
218+
return platform_driver_register(&bcm2835_mbox_driver);
219+
}
220+
arch_initcall(bcm2835_mbox_init);
221+
222+
static void __init bcm2835_mbox_exit(void)
223+
{
224+
platform_driver_unregister(&bcm2835_mbox_driver);
225+
}
226+
module_exit(bcm2835_mbox_exit);
213227

214228
MODULE_AUTHOR("Lubomir Rintel <[email protected]>");
215229
MODULE_DESCRIPTION("BCM2835 mailbox IPC driver");

0 commit comments

Comments
 (0)