aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm53xx/patches-3.10/122-bcma-add-arm-support.patch
blob: 37b7311f74d166c662307bbb7f8bd1c63394c58f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
bcma: add arm support


Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/bcma/Kconfig                 |    9 +++++
 drivers/bcma/Makefile                |    1 +
 drivers/bcma/driver_arm.c            |   61 ++++++++++++++++++++++++++++++++++
 drivers/bcma/main.c                  |    7 ++++
 include/linux/bcma/bcma.h            |    2 ++
 include/linux/bcma/bcma_driver_arm.h |   20 +++++++++++
 6 files changed, 100 insertions(+)
 create mode 100644 drivers/bcma/driver_arm.c
 create mode 100644 include/linux/bcma/bcma_driver_arm.h

--- a/drivers/bcma/Kconfig
+++ b/drivers/bcma/Kconfig
@@ -54,6 +54,15 @@ config BCMA_DRIVER_MIPS
 
 	  If unsure, say N
 
+config BCMA_DRIVER_ARM
+	bool "BCMA Broadcom ARM core driver"
+	depends on BCMA && ARM
+	help
+	  Driver for the Broadcom MIPS core attached to Broadcom specific
+	  Advanced Microcontroller Bus.
+
+	  If unsure, say N
+
 config BCMA_SFLASH
 	bool
 	depends on BCMA_DRIVER_MIPS
--- a/drivers/bcma/Makefile
+++ b/drivers/bcma/Makefile
@@ -5,6 +5,7 @@ bcma-$(CONFIG_BCMA_NFLASH)		+= driver_ch
 bcma-y					+= driver_pci.o
 bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE)	+= driver_pci_host.o
 bcma-$(CONFIG_BCMA_DRIVER_MIPS)		+= driver_mips.o
+bcma-$(CONFIG_BCMA_DRIVER_ARM)		+= driver_arm.o
 bcma-$(CONFIG_BCMA_DRIVER_GMAC_CMN)	+= driver_gmac_cmn.o
 bcma-$(CONFIG_BCMA_DRIVER_GPIO)		+= driver_gpio.o
 bcma-$(CONFIG_BCMA_HOST_PCI)		+= host_pci.o
--- /dev/null
+++ b/drivers/bcma/driver_arm.c
@@ -0,0 +1,53 @@
+/*
+ * Broadcom specific AMBA
+ * Broadcom MIPS32 74K core driver
+ *
+ * Copyright 2009, Broadcom Corporation
+ * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de>
+ * Copyright 2010, Bernhard Loos <bernhardloos@googlemail.com>
+ * Copyright 2011, Hauke Mehrtens <hauke@hauke-m.de>
+ *
+ * Licensed under the GNU/GPL. See COPYING for details.
+ */
+
+#include "bcma_private.h"
+
+#include <linux/bcma/bcma.h>
+
+static void bcma_core_mips_set_irq_name(struct bcma_bus *bus, unsigned int irq,
+					u16 coreid, u8 unit)
+{
+	struct bcma_device *core;
+
+	core = bcma_find_core_unit(bus, coreid, unit);
+	if (!core) {
+		bcma_warn(bus,
+			  "Can not find core (id: 0x%x, unit %i) for IRQ configuration.\n",
+			  coreid, unit);
+		return;
+	}
+	core->irq = irq;
+}
+
+void bcma_core_arm_init(struct bcma_drv_arm *acore)
+{
+	struct bcma_bus *bus;
+	struct bcma_device *core;
+	bus = acore->core->bus;
+
+	if (acore->setup_done)
+		return;
+
+	bcma_core_mips_set_irq_name(bus, 111, BCMA_CORE_USB20, 0);
+	
+	bcma_core_mips_set_irq_name(bus, 179, BCMA_CORE_MAC_GBIT, 0);
+	bcma_core_mips_set_irq_name(bus, 180, BCMA_CORE_MAC_GBIT, 1);
+	bcma_core_mips_set_irq_name(bus, 181, BCMA_CORE_MAC_GBIT, 2);
+	bcma_core_mips_set_irq_name(bus, 182, BCMA_CORE_MAC_GBIT, 3);
+	
+	bcma_core_mips_set_irq_name(bus, 112, BCMA_CORE_USB30, 0);
+	bcma_debug(bus, "IRQ reconfiguration done\n");
+
+
+	acore->setup_done = true;
+}
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -258,6 +258,13 @@ int bcma_bus_register(struct bcma_bus *b
 		bcma_core_mips_init(&bus->drv_mips);
 	}
 
+	/* Init ARM core */
+	core = bcma_find_core(bus, BCMA_CORE_ARMCA9);
+	if (core) {
+		bus->drv_arm.core = core;
+		bcma_core_arm_init(&bus->drv_arm);
+	}
+
 	/* Init PCIE core */
 	core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 0);
 	if (core) {
--- a/include/linux/bcma/bcma.h
+++ b/include/linux/bcma/bcma.h
@@ -7,6 +7,7 @@
 #include <linux/bcma/bcma_driver_chipcommon.h>
 #include <linux/bcma/bcma_driver_pci.h>
 #include <linux/bcma/bcma_driver_mips.h>
+#include <linux/bcma/bcma_driver_arm.h>
 #include <linux/bcma/bcma_driver_gmac_cmn.h>
 #include <linux/ssb/ssb.h> /* SPROM sharing */
 
@@ -334,6 +335,7 @@ struct bcma_bus {
 	struct bcma_drv_cc drv_cc;
 	struct bcma_drv_pci drv_pci[2];
 	struct bcma_drv_mips drv_mips;
+	struct bcma_drv_arm drv_arm;
 	struct bcma_drv_gmac_cmn drv_gmac_cmn;
 
 	/* We decided to share SPROM struct with SSB as long as we do not need
--- /dev/null
+++ b/include/linux/bcma/bcma_driver_arm.h
@@ -0,0 +1,20 @@
+#ifndef LINUX_BCMA_DRIVER_ARM_H_
+#define LINUX_BCMA_DRIVER_ARM_H_
+
+struct bcma_device;
+
+struct bcma_drv_arm {
+	struct bcma_device *core;
+	u8 setup_done:1;
+	u8 early_setup_done:1;
+};
+
+#ifdef CONFIG_BCMA_DRIVER_ARM
+extern void bcma_core_arm_init(struct bcma_drv_arm *acore);
+
+#else
+static inline void bcma_core_arm_init(struct bcma_drv_arm *acore) { }
+
+#endif
+
+#endif /* LINUX_BCMA_DRIVER_ARM_H_ */