kernel: bgmac: move bgmac patches already applied in mainline kernel to generic
[openwrt/openwrt.git] / target / linux / bcm53xx / patches-3.10 / 122-bcma-add-arm-support.patch
1 bcma: add arm support
2
3
4 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
5 ---
6 drivers/bcma/Kconfig | 9 +++++
7 drivers/bcma/Makefile | 1 +
8 drivers/bcma/driver_arm.c | 61 ++++++++++++++++++++++++++++++++++
9 drivers/bcma/main.c | 7 ++++
10 include/linux/bcma/bcma.h | 2 ++
11 include/linux/bcma/bcma_driver_arm.h | 20 +++++++++++
12 6 files changed, 100 insertions(+)
13 create mode 100644 drivers/bcma/driver_arm.c
14 create mode 100644 include/linux/bcma/bcma_driver_arm.h
15
16 --- a/drivers/bcma/Kconfig
17 +++ b/drivers/bcma/Kconfig
18 @@ -54,6 +54,15 @@ config BCMA_DRIVER_MIPS
19
20 If unsure, say N
21
22 +config BCMA_DRIVER_ARM
23 + bool "BCMA Broadcom ARM core driver"
24 + depends on BCMA && ARM
25 + help
26 + Driver for the Broadcom MIPS core attached to Broadcom specific
27 + Advanced Microcontroller Bus.
28 +
29 + If unsure, say N
30 +
31 config BCMA_SFLASH
32 bool
33 depends on BCMA_DRIVER_MIPS
34 --- a/drivers/bcma/Makefile
35 +++ b/drivers/bcma/Makefile
36 @@ -5,6 +5,7 @@ bcma-$(CONFIG_BCMA_NFLASH) += driver_ch
37 bcma-y += driver_pci.o
38 bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o
39 bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o
40 +bcma-$(CONFIG_BCMA_DRIVER_ARM) += driver_arm.o
41 bcma-$(CONFIG_BCMA_DRIVER_GMAC_CMN) += driver_gmac_cmn.o
42 bcma-$(CONFIG_BCMA_DRIVER_GPIO) += driver_gpio.o
43 bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o
44 --- /dev/null
45 +++ b/drivers/bcma/driver_arm.c
46 @@ -0,0 +1,53 @@
47 +/*
48 + * Broadcom specific AMBA
49 + * Broadcom MIPS32 74K core driver
50 + *
51 + * Copyright 2009, Broadcom Corporation
52 + * Copyright 2006, 2007, Michael Buesch <mb@bu3sch.de>
53 + * Copyright 2010, Bernhard Loos <bernhardloos@googlemail.com>
54 + * Copyright 2011, Hauke Mehrtens <hauke@hauke-m.de>
55 + *
56 + * Licensed under the GNU/GPL. See COPYING for details.
57 + */
58 +
59 +#include "bcma_private.h"
60 +
61 +#include <linux/bcma/bcma.h>
62 +
63 +static void bcma_core_mips_set_irq_name(struct bcma_bus *bus, unsigned int irq,
64 + u16 coreid, u8 unit)
65 +{
66 + struct bcma_device *core;
67 +
68 + core = bcma_find_core_unit(bus, coreid, unit);
69 + if (!core) {
70 + bcma_warn(bus,
71 + "Can not find core (id: 0x%x, unit %i) for IRQ configuration.\n",
72 + coreid, unit);
73 + return;
74 + }
75 + core->irq = irq;
76 +}
77 +
78 +void bcma_core_arm_init(struct bcma_drv_arm *acore)
79 +{
80 + struct bcma_bus *bus;
81 + struct bcma_device *core;
82 + bus = acore->core->bus;
83 +
84 + if (acore->setup_done)
85 + return;
86 +
87 + bcma_core_mips_set_irq_name(bus, 111, BCMA_CORE_USB20, 0);
88 +
89 + bcma_core_mips_set_irq_name(bus, 179, BCMA_CORE_MAC_GBIT, 0);
90 + bcma_core_mips_set_irq_name(bus, 180, BCMA_CORE_MAC_GBIT, 1);
91 + bcma_core_mips_set_irq_name(bus, 181, BCMA_CORE_MAC_GBIT, 2);
92 + bcma_core_mips_set_irq_name(bus, 182, BCMA_CORE_MAC_GBIT, 3);
93 +
94 + bcma_core_mips_set_irq_name(bus, 112, BCMA_CORE_USB30, 0);
95 + bcma_debug(bus, "IRQ reconfiguration done\n");
96 +
97 +
98 + acore->setup_done = true;
99 +}
100 --- a/drivers/bcma/main.c
101 +++ b/drivers/bcma/main.c
102 @@ -269,6 +269,13 @@ int bcma_bus_register(struct bcma_bus *b
103 bcma_core_mips_init(&bus->drv_mips);
104 }
105
106 + /* Init ARM core */
107 + core = bcma_find_core(bus, BCMA_CORE_ARMCA9);
108 + if (core) {
109 + bus->drv_arm.core = core;
110 + bcma_core_arm_init(&bus->drv_arm);
111 + }
112 +
113 /* Init PCIE core */
114 core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 0);
115 if (core) {
116 --- a/include/linux/bcma/bcma.h
117 +++ b/include/linux/bcma/bcma.h
118 @@ -7,6 +7,7 @@
119 #include <linux/bcma/bcma_driver_chipcommon.h>
120 #include <linux/bcma/bcma_driver_pci.h>
121 #include <linux/bcma/bcma_driver_mips.h>
122 +#include <linux/bcma/bcma_driver_arm.h>
123 #include <linux/bcma/bcma_driver_gmac_cmn.h>
124 #include <linux/ssb/ssb.h> /* SPROM sharing */
125
126 @@ -334,6 +335,7 @@ struct bcma_bus {
127 struct bcma_drv_cc drv_cc;
128 struct bcma_drv_pci drv_pci[2];
129 struct bcma_drv_mips drv_mips;
130 + struct bcma_drv_arm drv_arm;
131 struct bcma_drv_gmac_cmn drv_gmac_cmn;
132
133 /* We decided to share SPROM struct with SSB as long as we do not need
134 --- /dev/null
135 +++ b/include/linux/bcma/bcma_driver_arm.h
136 @@ -0,0 +1,20 @@
137 +#ifndef LINUX_BCMA_DRIVER_ARM_H_
138 +#define LINUX_BCMA_DRIVER_ARM_H_
139 +
140 +struct bcma_device;
141 +
142 +struct bcma_drv_arm {
143 + struct bcma_device *core;
144 + u8 setup_done:1;
145 + u8 early_setup_done:1;
146 +};
147 +
148 +#ifdef CONFIG_BCMA_DRIVER_ARM
149 +extern void bcma_core_arm_init(struct bcma_drv_arm *acore);
150 +
151 +#else
152 +static inline void bcma_core_arm_init(struct bcma_drv_arm *acore) { }
153 +
154 +#endif
155 +
156 +#endif /* LINUX_BCMA_DRIVER_ARM_H_ */