diff options
| author | Rafał Miłecki <zajec5@gmail.com> | 2012-07-11 03:23:43 -0400 |
|---|---|---|
| committer | John W. Linville <linville@tuxdriver.com> | 2012-07-12 15:27:18 -0400 |
| commit | e1ac4b409037b128f9a3eca3b3ab5dbbb71a7e6f (patch) | |
| tree | 33eb5d7bb0751f17f0968bdd29901df1807797fd | |
| parent | 97cfda8fecacc40c5652b0924c4c0f5ab508dc9a (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>
| -rw-r--r-- | drivers/bcma/Kconfig | 9 | ||||
| -rw-r--r-- | drivers/bcma/Makefile | 1 | ||||
| -rw-r--r-- | drivers/bcma/driver_gmac_cmn.c | 14 | ||||
| -rw-r--r-- | drivers/bcma/main.c | 8 | ||||
| -rw-r--r-- | drivers/bcma/scan.c | 16 | ||||
| -rw-r--r-- | include/linux/bcma/bcma.h | 2 | ||||
| -rw-r--r-- | include/linux/bcma/bcma_driver_gmac_cmn.h | 100 |
7 files changed, 144 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 | ||
| 49 | config 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 | |||
| 49 | config BCMA_DEBUG | 58 | config 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 | |||
| 3 | bcma-y += driver_pci.o | 3 | bcma-y += driver_pci.o |
| 4 | bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o | 4 | bcma-$(CONFIG_BCMA_DRIVER_PCI_HOSTMODE) += driver_pci_host.o |
| 5 | bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o | 5 | bcma-$(CONFIG_BCMA_DRIVER_MIPS) += driver_mips.o |
| 6 | bcma-$(CONFIG_BCMA_DRIVER_GMAC_CMN) += driver_gmac_cmn.o | ||
| 6 | bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o | 7 | bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o |
| 7 | bcma-$(CONFIG_BCMA_HOST_SOC) += host_soc.o | 8 | bcma-$(CONFIG_BCMA_HOST_SOC) += host_soc.o |
| 8 | obj-$(CONFIG_BCMA) += bcma.o | 9 | obj-$(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 | |||
| 11 | void __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 | ||
| 23 | static const struct bcma_device_id_name bcma_arm_device_names[] = { | 23 | static 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)) { |
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 03b2f30d2ace..1954a4e305a3 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <linux/bcma/bcma_driver_chipcommon.h> | 7 | #include <linux/bcma/bcma_driver_chipcommon.h> |
| 8 | #include <linux/bcma/bcma_driver_pci.h> | 8 | #include <linux/bcma/bcma_driver_pci.h> |
| 9 | #include <linux/bcma/bcma_driver_mips.h> | 9 | #include <linux/bcma/bcma_driver_mips.h> |
| 10 | #include <linux/bcma/bcma_driver_gmac_cmn.h> | ||
| 10 | #include <linux/ssb/ssb.h> /* SPROM sharing */ | 11 | #include <linux/ssb/ssb.h> /* SPROM sharing */ |
| 11 | 12 | ||
| 12 | #include "bcma_regs.h" | 13 | #include "bcma_regs.h" |
| @@ -252,6 +253,7 @@ struct bcma_bus { | |||
| 252 | struct bcma_drv_cc drv_cc; | 253 | struct bcma_drv_cc drv_cc; |
| 253 | struct bcma_drv_pci drv_pci; | 254 | struct bcma_drv_pci drv_pci; |
| 254 | struct bcma_drv_mips drv_mips; | 255 | struct bcma_drv_mips drv_mips; |
| 256 | struct bcma_drv_gmac_cmn drv_gmac_cmn; | ||
| 255 | 257 | ||
| 256 | /* We decided to share SPROM struct with SSB as long as we do not need | 258 | /* We decided to share SPROM struct with SSB as long as we do not need |
| 257 | * any hacks for BCMA. This simplifies drivers code. */ | 259 | * any hacks for BCMA. This simplifies drivers code. */ |
diff --git a/include/linux/bcma/bcma_driver_gmac_cmn.h b/include/linux/bcma/bcma_driver_gmac_cmn.h new file mode 100644 index 000000000000..def894b83b0d --- /dev/null +++ b/include/linux/bcma/bcma_driver_gmac_cmn.h | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | #ifndef LINUX_BCMA_DRIVER_GMAC_CMN_H_ | ||
| 2 | #define LINUX_BCMA_DRIVER_GMAC_CMN_H_ | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 6 | #define BCMA_GMAC_CMN_STAG0 0x000 | ||
| 7 | #define BCMA_GMAC_CMN_STAG1 0x004 | ||
| 8 | #define BCMA_GMAC_CMN_STAG2 0x008 | ||
| 9 | #define BCMA_GMAC_CMN_STAG3 0x00C | ||
| 10 | #define BCMA_GMAC_CMN_PARSER_CTL 0x020 | ||
| 11 | #define BCMA_GMAC_CMN_MIB_MAX_LEN 0x024 | ||
| 12 | #define BCMA_GMAC_CMN_PHY_ACCESS 0x100 | ||
| 13 | #define BCMA_GMAC_CMN_PA_DATA_MASK 0x0000ffff | ||
| 14 | #define BCMA_GMAC_CMN_PA_ADDR_MASK 0x001f0000 | ||
| 15 | #define BCMA_GMAC_CMN_PA_ADDR_SHIFT 16 | ||
| 16 | #define BCMA_GMAC_CMN_PA_REG_MASK 0x1f000000 | ||
| 17 | #define BCMA_GMAC_CMN_PA_REG_SHIFT 24 | ||
| 18 | #define BCMA_GMAC_CMN_PA_WRITE 0x20000000 | ||
| 19 | #define BCMA_GMAC_CMN_PA_START 0x40000000 | ||
| 20 | #define BCMA_GMAC_CMN_PHY_CTL 0x104 | ||
| 21 | #define BCMA_GMAC_CMN_PC_EPA_MASK 0x0000001f | ||
| 22 | #define BCMA_GMAC_CMN_PC_MCT_MASK 0x007f0000 | ||
| 23 | #define BCMA_GMAC_CMN_PC_MCT_SHIFT 16 | ||
| 24 | #define BCMA_GMAC_CMN_PC_MTE 0x00800000 | ||
| 25 | #define BCMA_GMAC_CMN_GMAC0_RGMII_CTL 0x110 | ||
| 26 | #define BCMA_GMAC_CMN_CFP_ACCESS 0x200 | ||
| 27 | #define BCMA_GMAC_CMN_CFP_TCAM_DATA0 0x210 | ||
| 28 | #define BCMA_GMAC_CMN_CFP_TCAM_DATA1 0x214 | ||
| 29 | #define BCMA_GMAC_CMN_CFP_TCAM_DATA2 0x218 | ||
| 30 | #define BCMA_GMAC_CMN_CFP_TCAM_DATA3 0x21C | ||
| 31 | #define BCMA_GMAC_CMN_CFP_TCAM_DATA4 0x220 | ||
| 32 | #define BCMA_GMAC_CMN_CFP_TCAM_DATA5 0x224 | ||
| 33 | #define BCMA_GMAC_CMN_CFP_TCAM_DATA6 0x228 | ||
| 34 | #define BCMA_GMAC_CMN_CFP_TCAM_DATA7 0x22C | ||
| 35 | #define BCMA_GMAC_CMN_CFP_TCAM_MASK0 0x230 | ||
| 36 | #define BCMA_GMAC_CMN_CFP_TCAM_MASK1 0x234 | ||
| 37 | #define BCMA_GMAC_CMN_CFP_TCAM_MASK2 0x238 | ||
| 38 | #define BCMA_GM | ||
