83f5bbf3d89c834cde909db83d37b833a709fc1a
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-4.1 / 0073-platform-Add-force_core-command-line-setting-to-boot.patch
1 From 8a609b1977da490cd177740e61169444383fd8c4 Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Tue, 16 Jun 2015 17:47:27 +0100
4 Subject: [PATCH 073/121] platform: Add force_core command line setting to boot
5 from a different core number
6
7 ---
8 arch/arm/mach-bcm2709/armctrl.c | 17 ++++++++++++++++-
9 arch/arm/mach-bcm2709/bcm2709.c | 2 ++
10 2 files changed, 18 insertions(+), 1 deletion(-)
11
12 --- a/arch/arm/mach-bcm2709/armctrl.c
13 +++ b/arch/arm/mach-bcm2709/armctrl.c
14 @@ -45,6 +45,8 @@ static unsigned int remap_irqs[(INTERRUP
15 INTERRUPT_VC_ARASANSDIO
16 };
17
18 +extern unsigned force_core;
19 +
20 static void armctrl_mask_irq(struct irq_data *d)
21 {
22 static const unsigned int disables[4] = {
23 @@ -92,7 +94,13 @@ static void armctrl_unmask_irq(struct ir
24 int i;
25 if (d->irq >= FIQ_START) {
26 unsigned int data;
27 - if (num_online_cpus() > 1) {
28 + if (force_core) {
29 + data = readl(__io_address(ARM_LOCAL_GPU_INT_ROUTING));
30 + data &= ~0xc;
31 + data |= ((force_core-1) << 2);
32 + writel(data, __io_address(ARM_LOCAL_GPU_INT_ROUTING));
33 + }
34 + else if (num_online_cpus() > 1) {
35 data = readl(__io_address(ARM_LOCAL_GPU_INT_ROUTING));
36 data &= ~0xc;
37 data |= (1 << 2);
38 @@ -119,6 +127,13 @@ static void armctrl_unmask_irq(struct ir
39 }
40 #endif
41 } else if (d->irq >= ARM_IRQ1_BASE && d->irq < ARM_IRQ_LOCAL_BASE) {
42 + if (force_core) {
43 + unsigned int data;
44 + data = readl(__io_address(ARM_LOCAL_GPU_INT_ROUTING));
45 + data &= ~0x3;
46 + data |= ((force_core-1) << 0);
47 + writel(data, __io_address(ARM_LOCAL_GPU_INT_ROUTING));
48 + }
49 unsigned int data = (unsigned int)irq_get_chip_data(d->irq);
50 writel(1 << (data & 0x1f), __io_address(enables[(data >> 5) & 0x3]));
51 } else if (d->irq == INTERRUPT_ARM_LOCAL_PMU_FAST) {
52 --- a/arch/arm/mach-bcm2709/bcm2709.c
53 +++ b/arch/arm/mach-bcm2709/bcm2709.c
54 @@ -96,6 +96,7 @@ static unsigned w1_gpio_pin = W1_GPIO;
55 static unsigned w1_gpio_pullup = W1_PULLUP;
56 static bool vc_i2c_override = false;
57 static int pps_gpio_pin = -1;
58 +unsigned force_core;
59
60 static unsigned use_dt = 0;
61
62 @@ -1305,6 +1306,7 @@ MACHINE_START(BCM2708, "BCM2709")
63 .dt_compat = bcm2709_compat,
64 MACHINE_END
65
66 +module_param(force_core, uint, 0644);
67 module_param(boardrev, uint, 0644);
68 module_param(serial, uint, 0644);
69 module_param(uart_clock, uint, 0644);