aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2012-07-11 03:23:43 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-07-12 15:27:18 -0400
commite1ac4b409037b128f9a3eca3b3ab5dbbb71a7e6f (patch)
tree33eb5d7bb0751f17f0968bdd29901df1807797fd /drivers/bcma
parent97cfda8fecacc40c5652b0924c4c0f5ab508dc9a (diff)
bcma: add trivial GBIT MAC COMMON driver
GMAC COMMON core is present on BCM4706 and is used for example to access board PHYs (PHYs can not be accessed directly using GBIT MAC core). Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma')
-rw-r--r--drivers/bcma/Kconfig9
-rw-r--r--drivers/bcma/Makefile1
-rw-r--r--drivers/bcma/driver_gmac_cmn.c14
-rw-r--r--drivers/bcma/main.c8
-rw-r--r--drivers/bcma/scan.c16
5 files changed, 42 insertions, 6 deletions
diff --git a/drivers/bcma/Kconfig b/drivers/bcma/Kconfig
index fb7c80fb721e..9319cde8d751 100644
--- a/drivers/bcma/Kconfig
+++ b/drivers/bcma/Kconfig
@@ -46,6 +46,15 @@ config BCMA_DRIVER_MIPS
46 46
47 If unsure, say N 47 If unsure, say N
48 48
49config BCMA_DRIVER_GMAC_CMN
50 bool "BCMA Broadcom GBIT MAC COMMON core driver"
51 depends on BCMA
52 help
53 Driver for the Broadcom GBIT MAC COMMON core attached to Broadcom
54 specific Advanced Microcontroller Bus.
55
56 If unsure, say N
57
49config BCMA_DEBUG 58config BCMA_DEBUG
50 bool "BCMA debugging" 59 bool "BCMA debugging"
51 depends on BCMA 60 depends on BCMA
diff --git a/drivers/bcma/Makefile b/drivers/bcma/Makefile
index 82de24e5340c..d13803faf1d6 100644
--- a/drivers/bcma/Makefile
+++ b/drivers/bcma/Makefile
@@ -3,6 +3,7 @@ bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o
3bcma-y += driver_pci.o 3bcma-y += driver_pci.o
4bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o 4bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o
5bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o 5bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o
6bcma-$(CONFIG_BCMA_DRIVER_GMAC_CMN) += driver_gmac_cmn.o
6bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o 7bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o
7bcma-$(CONFIG_BCMA_HOST_SOC) += host_soc.o 8bcma-$(CONFIG_BCMA_HOST_SOC) += host_soc.o
8obj-$(CONFIG_BCMA) += bcma.o 9obj-$(CONFIG_BCMA) += bcma.o
diff --git a/drivers/bcma/driver_gmac_cmn.c b/drivers/bcma/driver_gmac_cmn.c
new file mode 100644
index 000000000000..834225f65e8f
--- /dev/null
+++ b/drivers/bcma/driver_gmac_cmn.c
@@ -0,0 +1,14 @@
1/*
2 * Broadcom specific AMBA
3 * GBIT MAC COMMON Core
4 *
5 * Licensed under the GNU/GPL. See COPYING for details.
6 */
7
8#include "bcma_private.h"
9#include <linux/bcma/bcma.h>
10
11void __devinit bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc)
12{
13 mutex_init(&gc->phy_mutex);
14}
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 151bddc57e16..758af9ccdef0 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -103,6 +103,7 @@ static int bcma_register_cores(struct bcma_bus *bus)
103 case BCMA_CORE_PCI: 103 case BCMA_CORE_PCI:
104 case BCMA_CORE_PCIE: 104 case BCMA_CORE_PCIE:
105 case BCMA_CORE_MIPS_74K: 105 case BCMA_CORE_MIPS_74K:
106 case BCMA_CORE_4706_MAC_GBIT_COMMON:
106 continue; 107 continue;
107 } 108 }
108 109
@@ -185,6 +186,13 @@ int __devinit bcma_bus_register(struct bcma_bus *bus)
185 bcma_core_pci_init(&bus->drv_pci); 186 bcma_core_pci_init(&bus->drv_pci);
186 } 187 }
187 188
189 /* Init GBIT MAC COMMON core */
190 core = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON);
191 if (core) {
192 bus->drv_gmac_cmn.core = core;
193 bcma_core_gmac_cmn_init(&bus->drv_gmac_cmn);
194 }
195
188 /* Try to get SPROM */ 196 /* Try to get SPROM */
189 err = bcma_sprom_get(bus); 197 err = bcma_sprom_get(bus);
190 if (err == -ENOENT) { 198 if (err == -ENOENT) {
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
index a0272bbfc4f6..3bc3ec26fd0e 100644
--- a/drivers/bcma/scan.c
+++ b/drivers/bcma/scan.c
@@ -21,6 +21,7 @@ struct bcma_device_id_name {
21}; 21};
22 22
23static const struct bcma_device_id_name bcma_arm_device_names[] = { 23static const struct bcma_device_id_name bcma_arm_device_names[] = {
24 { BCMA_CORE_4706_MAC_GBIT_COMMON, "BCM4706 GBit MAC Common" },
24 { BCMA_CORE_ARM_1176, "ARM 1176" }, 25 { BCMA_CORE_ARM_1176, "ARM 1176" },
25 { BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" }, 26 { BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" },
26 { BCMA_CORE_ARM_CM3, "ARM CM3" }, 27 { BCMA_CORE_ARM_CM3, "ARM CM3" },
@@ -33,7 +34,6 @@ static const struct bcma_device_id_name bcma_bcm_device_names[] = {
33 { BCMA_CORE_4706_MAC_GBIT, "BCM4706 GBit MAC" }, 34 { BCMA_CORE_4706_MAC_GBIT, "BCM4706 GBit MAC" },
34 { BCMA_CORE_AMEMC, "AMEMC (DDR)" }, 35 { BCMA_CORE_AMEMC, "AMEMC (DDR)" },
35 { BCMA_CORE_ALTA, "ALTA (I2S)" }, 36 { BCMA_CORE_ALTA, "ALTA (I2S)" },
36 { BCMA_CORE_4706_MAC_GBIT_COMMON, "BCM4706 GBit MAC Common" },
37 { BCMA_CORE_INVALID, "Invalid" }, 37 { BCMA_CORE_INVALID, "Invalid" },
38 { BCMA_CORE_CHIPCOMMON, "ChipCommon" }, 38 { BCMA_CORE_CHIPCOMMON, "ChipCommon" },
39 { BCMA_CORE_ILINE20, "ILine 20" }, 39 { BCMA_CORE_ILINE20, "ILine 20" },
@@ -295,11 +295,15 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
295 295
296 /* check if component is a core at all */ 296 /* check if component is a core at all */
297 if (wrappers[0] + wrappers[1] == 0) { 297 if (wrappers[0] + wrappers[1] == 0) {
298 /* we could save addrl of the router 298 /* Some specific cores don't need wrappers */
299 if (cid == BCMA_CORE_OOB_ROUTER) 299 switch (core->id.id) {
300 */ 300 case BCMA_CORE_4706_MAC_GBIT_COMMON:
301 bcma_erom_skip_component(bus, eromptr); 301 /* Not used yet: case BCMA_CORE_OOB_ROUTER: */
302 return -ENXIO; 302 break;
303 default:
304 bcma_erom_skip_component(bus, eromptr);
305 return -ENXIO;
306 }
303 } 307 }
304 308
305 if (bcma_erom_is_bridge(bus, eromptr)) { 309 if (bcma_erom_is_bridge(bus, eromptr)) {