* [PATCH V2] bcma: add trivial GBIT MAC COMMON driver
@ 2012-07-11 7:23 Rafał Miłecki
2012-07-11 8:29 ` Hauke Mehrtens
0 siblings, 1 reply; 3+ messages in thread
From: Rafał Miłecki @ 2012-07-11 7:23 UTC (permalink / raw)
To: linux-wireless, John W. Linville; +Cc: Hauke Mehrtens, Rafał Miłecki
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>
---
V2: Fix printing GMAC Common name. Core's manufacturer is ARM not BCM!
---
drivers/bcma/Kconfig | 9 +++
drivers/bcma/Makefile | 1 +
drivers/bcma/driver_gmac_cmn.c | 14 ++++
drivers/bcma/main.c | 8 ++
drivers/bcma/scan.c | 16 +++--
include/linux/bcma/bcma.h | 2 +
include/linux/bcma/bcma_driver_gmac_cmn.h | 100 +++++++++++++++++++++++++++++
7 files changed, 144 insertions(+), 6 deletions(-)
create mode 100644 drivers/bcma/driver_gmac_cmn.c
create mode 100644 include/linux/bcma/bcma_driver_gmac_cmn.h
diff --git a/drivers/bcma/Kconfig b/drivers/bcma/Kconfig
index 1c31433..d878e03 100644
--- a/drivers/bcma/Kconfig
+++ b/drivers/bcma/Kconfig
@@ -47,6 +47,15 @@ config BCMA_DRIVER_MIPS
If unsure, say N
+config BCMA_DRIVER_GMAC_CMN
+ bool "BCMA Broadcom GBIT MAC COMMON core driver"
+ depends on BCMA
+ help
+ Driver for the Broadcom GBIT MAC COMMON core attached to Broadcom
+ specific Advanced Microcontroller Bus.
+
+ If unsure, say N
+
config BCMA_DEBUG
bool "BCMA debugging"
depends on BCMA
diff --git a/drivers/bcma/Makefile b/drivers/bcma/Makefile
index 82de24e..d13803f 100644
--- a/drivers/bcma/Makefile
+++ b/drivers/bcma/Makefile
@@ -3,6 +3,7 @@ bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o
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_GMAC_CMN) += driver_gmac_cmn.o
bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o
bcma-$(CONFIG_BCMA_HOST_SOC) += host_soc.o
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 0000000..834225f
--- /dev/null
+++ b/drivers/bcma/driver_gmac_cmn.c
@@ -0,0 +1,14 @@
+/*
+ * Broadcom specific AMBA
+ * GBIT MAC COMMON Core
+ *
+ * Licensed under the GNU/GPL. See COPYING for details.
+ */
+
+#include "bcma_private.h"
+#include <linux/bcma/bcma.h>
+
+void __devinit bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc)
+{
+ mutex_init(&gc->phy_mutex);
+}
diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 151bddc..758af9c 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -103,6 +103,7 @@ static int bcma_register_cores(struct bcma_bus *bus)
case BCMA_CORE_PCI:
case BCMA_CORE_PCIE:
case BCMA_CORE_MIPS_74K:
+ case BCMA_CORE_4706_MAC_GBIT_COMMON:
continue;
}
@@ -185,6 +186,13 @@ int __devinit bcma_bus_register(struct bcma_bus *bus)
bcma_core_pci_init(&bus->drv_pci);
}
+ /* Init GBIT MAC COMMON core */
+ core = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON);
+ if (core) {
+ bus->drv_gmac_cmn.core = core;
+ bcma_core_gmac_cmn_init(&bus->drv_gmac_cmn);
+ }
+
/* Try to get SPROM */
err = bcma_sprom_get(bus);
if (err == -ENOENT) {
diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
index a0272bb..3bc3ec2 100644
--- a/drivers/bcma/scan.c
+++ b/drivers/bcma/scan.c
@@ -21,6 +21,7 @@ struct bcma_device_id_name {
};
static const struct bcma_device_id_name bcma_arm_device_names[] = {
+ { BCMA_CORE_4706_MAC_GBIT_COMMON, "BCM4706 GBit MAC Common" },
{ BCMA_CORE_ARM_1176, "ARM 1176" },
{ BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" },
{ BCMA_CORE_ARM_CM3, "ARM CM3" },
@@ -33,7 +34,6 @@ static const struct bcma_device_id_name bcma_bcm_device_names[] = {
{ BCMA_CORE_4706_MAC_GBIT, "BCM4706 GBit MAC" },
{ BCMA_CORE_AMEMC, "AMEMC (DDR)" },
{ BCMA_CORE_ALTA, "ALTA (I2S)" },
- { BCMA_CORE_4706_MAC_GBIT_COMMON, "BCM4706 GBit MAC Common" },
{ BCMA_CORE_INVALID, "Invalid" },
{ BCMA_CORE_CHIPCOMMON, "ChipCommon" },
{ BCMA_CORE_ILINE20, "ILine 20" },
@@ -295,11 +295,15 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
/* check if component is a core at all */
if (wrappers[0] + wrappers[1] == 0) {
- /* we could save addrl of the router
- if (cid == BCMA_CORE_OOB_ROUTER)
- */
- bcma_erom_skip_component(bus, eromptr);
- return -ENXIO;
+ /* Some specific cores don't need wrappers */
+ switch (core->id.id) {
+ case BCMA_CORE_4706_MAC_GBIT_COMMON:
+ /* Not used yet: case BCMA_CORE_OOB_ROUTER: */
+ break;
+ default:
+ bcma_erom_skip_component(bus, eromptr);
+ return -ENXIO;
+ }
}
if (bcma_erom_is_bridge(bus, eromptr)) {
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
index 03b2f30..1954a4e 100644
--- 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_gmac_cmn.h>
#include <linux/ssb/ssb.h> /* SPROM sharing */
#include "bcma_regs.h"
@@ -252,6 +253,7 @@ struct bcma_bus {
struct bcma_drv_cc drv_cc;
struct bcma_drv_pci drv_pci;
struct bcma_drv_mips drv_mips;
+ struct bcma_drv_gmac_cmn drv_gmac_cmn;
/* We decided to share SPROM struct with SSB as long as we do not need
* 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 0000000..def894b
--- /dev/null
+++ b/include/linux/bcma/bcma_driver_gmac_cmn.h
@@ -0,0 +1,100 @@
+#ifndef LINUX_BCMA_DRIVER_GMAC_CMN_H_
+#define LINUX_BCMA_DRIVER_GMAC_CMN_H_
+
+#include <linux/types.h>
+
+#define BCMA_GMAC_CMN_STAG0 0x000
+#define BCMA_GMAC_CMN_STAG1 0x004
+#define BCMA_GMAC_CMN_STAG2 0x008
+#define BCMA_GMAC_CMN_STAG3 0x00C
+#define BCMA_GMAC_CMN_PARSER_CTL 0x020
+#define BCMA_GMAC_CMN_MIB_MAX_LEN 0x024
+#define BCMA_GMAC_CMN_PHY_ACCESS 0x100
+#define BCMA_GMAC_CMN_PA_DATA_MASK 0x0000ffff
+#define BCMA_GMAC_CMN_PA_ADDR_MASK 0x001f0000
+#define BCMA_GMAC_CMN_PA_ADDR_SHIFT 16
+#define BCMA_GMAC_CMN_PA_REG_MASK 0x1f000000
+#define BCMA_GMAC_CMN_PA_REG_SHIFT 24
+#define BCMA_GMAC_CMN_PA_WRITE 0x20000000
+#define BCMA_GMAC_CMN_PA_START 0x40000000
+#define BCMA_GMAC_CMN_PHY_CTL 0x104
+#define BCMA_GMAC_CMN_PC_EPA_MASK 0x0000001f
+#define BCMA_GMAC_CMN_PC_MCT_MASK 0x007f0000
+#define BCMA_GMAC_CMN_PC_MCT_SHIFT 16
+#define BCMA_GMAC_CMN_PC_MTE 0x00800000
+#define BCMA_GMAC_CMN_GMAC0_RGMII_CTL 0x110
+#define BCMA_GMAC_CMN_CFP_ACCESS 0x200
+#define BCMA_GMAC_CMN_CFP_TCAM_DATA0 0x210
+#define BCMA_GMAC_CMN_CFP_TCAM_DATA1 0x214
+#define BCMA_GMAC_CMN_CFP_TCAM_DATA2 0x218
+#define BCMA_GMAC_CMN_CFP_TCAM_DATA3 0x21C
+#define BCMA_GMAC_CMN_CFP_TCAM_DATA4 0x220
+#define BCMA_GMAC_CMN_CFP_TCAM_DATA5 0x224
+#define BCMA_GMAC_CMN_CFP_TCAM_DATA6 0x228
+#define BCMA_GMAC_CMN_CFP_TCAM_DATA7 0x22C
+#define BCMA_GMAC_CMN_CFP_TCAM_MASK0 0x230
+#define BCMA_GMAC_CMN_CFP_TCAM_MASK1 0x234
+#define BCMA_GMAC_CMN_CFP_TCAM_MASK2 0x238
+#define BCMA_GMAC_CMN_CFP_TCAM_MASK3 0x23C
+#define BCMA_GMAC_CMN_CFP_TCAM_MASK4 0x240
+#define BCMA_GMAC_CMN_CFP_TCAM_MASK5 0x244
+#define BCMA_GMAC_CMN_CFP_TCAM_MASK6 0x248
+#define BCMA_GMAC_CMN_CFP_TCAM_MASK7 0x24C
+#define BCMA_GMAC_CMN_CFP_ACTION_DATA 0x250
+#define BCMA_GMAC_CMN_TCAM_BIST_CTL 0x2A0
+#define BCMA_GMAC_CMN_TCAM_BIST_STATUS 0x2A4
+#define BCMA_GMAC_CMN_TCAM_CMP_STATUS 0x2A8
+#define BCMA_GMAC_CMN_TCAM_DISABLE 0x2AC
+#define BCMA_GMAC_CMN_TCAM_TEST_CTL 0x2F0
+#define BCMA_GMAC_CMN_UDF_0_A3_A0 0x300
+#define BCMA_GMAC_CMN_UDF_0_A7_A4 0x304
+#define BCMA_GMAC_CMN_UDF_0_A8 0x308
+#define BCMA_GMAC_CMN_UDF_1_A3_A0 0x310
+#define BCMA_GMAC_CMN_UDF_1_A7_A4 0x314
+#define BCMA_GMAC_CMN_UDF_1_A8 0x318
+#define BCMA_GMAC_CMN_UDF_2_A3_A0 0x320
+#define BCMA_GMAC_CMN_UDF_2_A7_A4 0x324
+#define BCMA_GMAC_CMN_UDF_2_A8 0x328
+#define BCMA_GMAC_CMN_UDF_0_B3_B0 0x330
+#define BCMA_GMAC_CMN_UDF_0_B7_B4 0x334
+#define BCMA_GMAC_CMN_UDF_0_B8 0x338
+#define BCMA_GMAC_CMN_UDF_1_B3_B0 0x340
+#define BCMA_GMAC_CMN_UDF_1_B7_B4 0x344
+#define BCMA_GMAC_CMN_UDF_1_B8 0x348
+#define BCMA_GMAC_CMN_UDF_2_B3_B0 0x350
+#define BCMA_GMAC_CMN_UDF_2_B7_B4 0x354
+#define BCMA_GMAC_CMN_UDF_2_B8 0x358
+#define BCMA_GMAC_CMN_UDF_0_C3_C0 0x360
+#define BCMA_GMAC_CMN_UDF_0_C7_C4 0x364
+#define BCMA_GMAC_CMN_UDF_0_C8 0x368
+#define BCMA_GMAC_CMN_UDF_1_C3_C0 0x370
+#define BCMA_GMAC_CMN_UDF_1_C7_C4 0x374
+#define BCMA_GMAC_CMN_UDF_1_C8 0x378
+#define BCMA_GMAC_CMN_UDF_2_C3_C0 0x380
+#define BCMA_GMAC_CMN_UDF_2_C7_C4 0x384
+#define BCMA_GMAC_CMN_UDF_2_C8 0x388
+#define BCMA_GMAC_CMN_UDF_0_D3_D0 0x390
+#define BCMA_GMAC_CMN_UDF_0_D7_D4 0x394
+#define BCMA_GMAC_CMN_UDF_0_D11_D8 0x394
+
+struct bcma_drv_gmac_cmn {
+ struct bcma_device *core;
+
+ /* Drivers accessing BCMA_GMAC_CMN_PHY_ACCESS and
+ * BCMA_GMAC_CMN_PHY_CTL need to take that mutex first. */
+ struct mutex phy_mutex;
+};
+
+/* Register access */
+#define gmac_cmn_read16(gc, offset) bcma_read16((gc)->core, offset)
+#define gmac_cmn_read32(gc, offset) bcma_read32((gc)->core, offset)
+#define gmac_cmn_write16(gc, offset, val) bcma_write16((gc)->core, offset, val)
+#define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val)
+
+#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
+extern void __devinit bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
+#else
+static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { }
+#endif
+
+#endif /* LINUX_BCMA_DRIVER_GMAC_CMN_H_ */
--
1.7.7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] bcma: add trivial GBIT MAC COMMON driver
2012-07-11 7:23 [PATCH V2] bcma: add trivial GBIT MAC COMMON driver Rafał Miłecki
@ 2012-07-11 8:29 ` Hauke Mehrtens
2012-07-11 8:54 ` Rafał Miłecki
0 siblings, 1 reply; 3+ messages in thread
From: Hauke Mehrtens @ 2012-07-11 8:29 UTC (permalink / raw)
To: Rafał Miłecki; +Cc: linux-wireless, John W. Linville
On 07/11/2012 09:23 AM, Rafał Miłecki wrote:
> 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>
> ---
> V2: Fix printing GMAC Common name. Core's manufacturer is ARM not BCM!
This is strange.
> ---
> drivers/bcma/Kconfig | 9 +++
> drivers/bcma/Makefile | 1 +
> drivers/bcma/driver_gmac_cmn.c | 14 ++++
> drivers/bcma/main.c | 8 ++
> drivers/bcma/scan.c | 16 +++--
> include/linux/bcma/bcma.h | 2 +
> include/linux/bcma/bcma_driver_gmac_cmn.h | 100 +++++++++++++++++++++++++++++
> 7 files changed, 144 insertions(+), 6 deletions(-)
> create mode 100644 drivers/bcma/driver_gmac_cmn.c
> create mode 100644 include/linux/bcma/bcma_driver_gmac_cmn.h
>
> diff --git a/drivers/bcma/Kconfig b/drivers/bcma/Kconfig
> index 1c31433..d878e03 100644
> --- a/drivers/bcma/Kconfig
> +++ b/drivers/bcma/Kconfig
> @@ -47,6 +47,15 @@ config BCMA_DRIVER_MIPS
>
> If unsure, say N
>
> +config BCMA_DRIVER_GMAC_CMN
> + bool "BCMA Broadcom GBIT MAC COMMON core driver"
> + depends on BCMA
> + help
> + Driver for the Broadcom GBIT MAC COMMON core attached to Broadcom
> + specific Advanced Microcontroller Bus.
> +
> + If unsure, say N
> +
> config BCMA_DEBUG
> bool "BCMA debugging"
> depends on BCMA
> diff --git a/drivers/bcma/Makefile b/drivers/bcma/Makefile
> index 82de24e..d13803f 100644
> --- a/drivers/bcma/Makefile
> +++ b/drivers/bcma/Makefile
> @@ -3,6 +3,7 @@ bcma-y += driver_chipcommon.o driver_chipcommon_pmu.o
> 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_GMAC_CMN) += driver_gmac_cmn.o
> bcma-$(CONFIG_BCMA_HOST_PCI) += host_pci.o
> bcma-$(CONFIG_BCMA_HOST_SOC) += host_soc.o
> 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 0000000..834225f
> --- /dev/null
> +++ b/drivers/bcma/driver_gmac_cmn.c
> @@ -0,0 +1,14 @@
> +/*
> + * Broadcom specific AMBA
> + * GBIT MAC COMMON Core
> + *
> + * Licensed under the GNU/GPL. See COPYING for details.
> + */
> +
> +#include "bcma_private.h"
> +#include <linux/bcma/bcma.h>
> +
> +void __devinit bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc)
> +{
> + mutex_init(&gc->phy_mutex);
> +}
> diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
> index 151bddc..758af9c 100644
> --- a/drivers/bcma/main.c
> +++ b/drivers/bcma/main.c
> @@ -103,6 +103,7 @@ static int bcma_register_cores(struct bcma_bus *bus)
> case BCMA_CORE_PCI:
> case BCMA_CORE_PCIE:
> case BCMA_CORE_MIPS_74K:
> + case BCMA_CORE_4706_MAC_GBIT_COMMON:
> continue;
> }
>
> @@ -185,6 +186,13 @@ int __devinit bcma_bus_register(struct bcma_bus *bus)
> bcma_core_pci_init(&bus->drv_pci);
> }
>
> + /* Init GBIT MAC COMMON core */
> + core = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON);
> + if (core) {
> + bus->drv_gmac_cmn.core = core;
> + bcma_core_gmac_cmn_init(&bus->drv_gmac_cmn);
> + }
> +
> /* Try to get SPROM */
> err = bcma_sprom_get(bus);
> if (err == -ENOENT) {
> diff --git a/drivers/bcma/scan.c b/drivers/bcma/scan.c
> index a0272bb..3bc3ec2 100644
> --- a/drivers/bcma/scan.c
> +++ b/drivers/bcma/scan.c
> @@ -21,6 +21,7 @@ struct bcma_device_id_name {
> };
>
> static const struct bcma_device_id_name bcma_arm_device_names[] = {
> + { BCMA_CORE_4706_MAC_GBIT_COMMON, "BCM4706 GBit MAC Common" },
> { BCMA_CORE_ARM_1176, "ARM 1176" },
> { BCMA_CORE_ARM_7TDMI, "ARM 7TDMI" },
> { BCMA_CORE_ARM_CM3, "ARM CM3" },
> @@ -33,7 +34,6 @@ static const struct bcma_device_id_name bcma_bcm_device_names[] = {
> { BCMA_CORE_4706_MAC_GBIT, "BCM4706 GBit MAC" },
> { BCMA_CORE_AMEMC, "AMEMC (DDR)" },
> { BCMA_CORE_ALTA, "ALTA (I2S)" },
> - { BCMA_CORE_4706_MAC_GBIT_COMMON, "BCM4706 GBit MAC Common" },
> { BCMA_CORE_INVALID, "Invalid" },
> { BCMA_CORE_CHIPCOMMON, "ChipCommon" },
> { BCMA_CORE_ILINE20, "ILine 20" },
> @@ -295,11 +295,15 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,
>
> /* check if component is a core at all */
> if (wrappers[0] + wrappers[1] == 0) {
> - /* we could save addrl of the router
> - if (cid == BCMA_CORE_OOB_ROUTER)
> - */
> - bcma_erom_skip_component(bus, eromptr);
> - return -ENXIO;
> + /* Some specific cores don't need wrappers */
> + switch (core->id.id) {
> + case BCMA_CORE_4706_MAC_GBIT_COMMON:
> + /* Not used yet: case BCMA_CORE_OOB_ROUTER: */
> + break;
> + default:
> + bcma_erom_skip_component(bus, eromptr);
> + return -ENXIO;
> + }
> }
>
> if (bcma_erom_is_bridge(bus, eromptr)) {
> diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h
> index 03b2f30..1954a4e 100644
> --- 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_gmac_cmn.h>
> #include <linux/ssb/ssb.h> /* SPROM sharing */
>
> #include "bcma_regs.h"
> @@ -252,6 +253,7 @@ struct bcma_bus {
> struct bcma_drv_cc drv_cc;
> struct bcma_drv_pci drv_pci;
> struct bcma_drv_mips drv_mips;
> + struct bcma_drv_gmac_cmn drv_gmac_cmn;
>
> /* We decided to share SPROM struct with SSB as long as we do not need
> * 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 0000000..def894b
> --- /dev/null
> +++ b/include/linux/bcma/bcma_driver_gmac_cmn.h
> @@ -0,0 +1,100 @@
> +#ifndef LINUX_BCMA_DRIVER_GMAC_CMN_H_
> +#define LINUX_BCMA_DRIVER_GMAC_CMN_H_
> +
> +#include <linux/types.h>
> +
> +#define BCMA_GMAC_CMN_STAG0 0x000
> +#define BCMA_GMAC_CMN_STAG1 0x004
> +#define BCMA_GMAC_CMN_STAG2 0x008
> +#define BCMA_GMAC_CMN_STAG3 0x00C
> +#define BCMA_GMAC_CMN_PARSER_CTL 0x020
> +#define BCMA_GMAC_CMN_MIB_MAX_LEN 0x024
> +#define BCMA_GMAC_CMN_PHY_ACCESS 0x100
> +#define BCMA_GMAC_CMN_PA_DATA_MASK 0x0000ffff
> +#define BCMA_GMAC_CMN_PA_ADDR_MASK 0x001f0000
> +#define BCMA_GMAC_CMN_PA_ADDR_SHIFT 16
> +#define BCMA_GMAC_CMN_PA_REG_MASK 0x1f000000
> +#define BCMA_GMAC_CMN_PA_REG_SHIFT 24
> +#define BCMA_GMAC_CMN_PA_WRITE 0x20000000
> +#define BCMA_GMAC_CMN_PA_START 0x40000000
> +#define BCMA_GMAC_CMN_PHY_CTL 0x104
> +#define BCMA_GMAC_CMN_PC_EPA_MASK 0x0000001f
> +#define BCMA_GMAC_CMN_PC_MCT_MASK 0x007f0000
> +#define BCMA_GMAC_CMN_PC_MCT_SHIFT 16
> +#define BCMA_GMAC_CMN_PC_MTE 0x00800000
> +#define BCMA_GMAC_CMN_GMAC0_RGMII_CTL 0x110
> +#define BCMA_GMAC_CMN_CFP_ACCESS 0x200
> +#define BCMA_GMAC_CMN_CFP_TCAM_DATA0 0x210
> +#define BCMA_GMAC_CMN_CFP_TCAM_DATA1 0x214
> +#define BCMA_GMAC_CMN_CFP_TCAM_DATA2 0x218
> +#define BCMA_GMAC_CMN_CFP_TCAM_DATA3 0x21C
> +#define BCMA_GMAC_CMN_CFP_TCAM_DATA4 0x220
> +#define BCMA_GMAC_CMN_CFP_TCAM_DATA5 0x224
> +#define BCMA_GMAC_CMN_CFP_TCAM_DATA6 0x228
> +#define BCMA_GMAC_CMN_CFP_TCAM_DATA7 0x22C
> +#define BCMA_GMAC_CMN_CFP_TCAM_MASK0 0x230
> +#define BCMA_GMAC_CMN_CFP_TCAM_MASK1 0x234
> +#define BCMA_GMAC_CMN_CFP_TCAM_MASK2 0x238
> +#define BCMA_GMAC_CMN_CFP_TCAM_MASK3 0x23C
> +#define BCMA_GMAC_CMN_CFP_TCAM_MASK4 0x240
> +#define BCMA_GMAC_CMN_CFP_TCAM_MASK5 0x244
> +#define BCMA_GMAC_CMN_CFP_TCAM_MASK6 0x248
> +#define BCMA_GMAC_CMN_CFP_TCAM_MASK7 0x24C
> +#define BCMA_GMAC_CMN_CFP_ACTION_DATA 0x250
> +#define BCMA_GMAC_CMN_TCAM_BIST_CTL 0x2A0
> +#define BCMA_GMAC_CMN_TCAM_BIST_STATUS 0x2A4
> +#define BCMA_GMAC_CMN_TCAM_CMP_STATUS 0x2A8
> +#define BCMA_GMAC_CMN_TCAM_DISABLE 0x2AC
> +#define BCMA_GMAC_CMN_TCAM_TEST_CTL 0x2F0
> +#define BCMA_GMAC_CMN_UDF_0_A3_A0 0x300
> +#define BCMA_GMAC_CMN_UDF_0_A7_A4 0x304
> +#define BCMA_GMAC_CMN_UDF_0_A8 0x308
> +#define BCMA_GMAC_CMN_UDF_1_A3_A0 0x310
> +#define BCMA_GMAC_CMN_UDF_1_A7_A4 0x314
> +#define BCMA_GMAC_CMN_UDF_1_A8 0x318
> +#define BCMA_GMAC_CMN_UDF_2_A3_A0 0x320
> +#define BCMA_GMAC_CMN_UDF_2_A7_A4 0x324
> +#define BCMA_GMAC_CMN_UDF_2_A8 0x328
> +#define BCMA_GMAC_CMN_UDF_0_B3_B0 0x330
> +#define BCMA_GMAC_CMN_UDF_0_B7_B4 0x334
> +#define BCMA_GMAC_CMN_UDF_0_B8 0x338
> +#define BCMA_GMAC_CMN_UDF_1_B3_B0 0x340
> +#define BCMA_GMAC_CMN_UDF_1_B7_B4 0x344
> +#define BCMA_GMAC_CMN_UDF_1_B8 0x348
> +#define BCMA_GMAC_CMN_UDF_2_B3_B0 0x350
> +#define BCMA_GMAC_CMN_UDF_2_B7_B4 0x354
> +#define BCMA_GMAC_CMN_UDF_2_B8 0x358
> +#define BCMA_GMAC_CMN_UDF_0_C3_C0 0x360
> +#define BCMA_GMAC_CMN_UDF_0_C7_C4 0x364
> +#define BCMA_GMAC_CMN_UDF_0_C8 0x368
> +#define BCMA_GMAC_CMN_UDF_1_C3_C0 0x370
> +#define BCMA_GMAC_CMN_UDF_1_C7_C4 0x374
> +#define BCMA_GMAC_CMN_UDF_1_C8 0x378
> +#define BCMA_GMAC_CMN_UDF_2_C3_C0 0x380
> +#define BCMA_GMAC_CMN_UDF_2_C7_C4 0x384
> +#define BCMA_GMAC_CMN_UDF_2_C8 0x388
> +#define BCMA_GMAC_CMN_UDF_0_D3_D0 0x390
> +#define BCMA_GMAC_CMN_UDF_0_D7_D4 0x394
> +#define BCMA_GMAC_CMN_UDF_0_D11_D8 0x394
> +
> +struct bcma_drv_gmac_cmn {
> + struct bcma_device *core;
> +
> + /* Drivers accessing BCMA_GMAC_CMN_PHY_ACCESS and
> + * BCMA_GMAC_CMN_PHY_CTL need to take that mutex first. */
> + struct mutex phy_mutex;
> +};
> +
> +/* Register access */
> +#define gmac_cmn_read16(gc, offset) bcma_read16((gc)->core, offset)
> +#define gmac_cmn_read32(gc, offset) bcma_read32((gc)->core, offset)
> +#define gmac_cmn_write16(gc, offset, val) bcma_write16((gc)->core, offset, val)
> +#define gmac_cmn_write32(gc, offset, val) bcma_write32((gc)->core, offset, val)
> +
> +#ifdef CONFIG_BCMA_DRIVER_GMAC_CMN
> +extern void __devinit bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc);
> +#else
> +static inline void bcma_core_gmac_cmn_init(struct bcma_drv_gmac_cmn *gc) { }
> +#endif
> +
> +#endif /* LINUX_BCMA_DRIVER_GMAC_CMN_H_ */
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH V2] bcma: add trivial GBIT MAC COMMON driver
2012-07-11 8:29 ` Hauke Mehrtens
@ 2012-07-11 8:54 ` Rafał Miłecki
0 siblings, 0 replies; 3+ messages in thread
From: Rafał Miłecki @ 2012-07-11 8:54 UTC (permalink / raw)
To: Hauke Mehrtens; +Cc: linux-wireless, John W. Linville
[-- Attachment #1: Type: text/plain, Size: 691 bytes --]
2012/7/11 Hauke Mehrtens <hauke@hauke-m.de>:
> On 07/11/2012 09:23 AM, Rafał Miłecki wrote:
>> 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>
>> ---
>> V2: Fix printing GMAC Common name. Core's manufacturer is ARM not BCM!
> This is strange.
Yup... but I'm really sure of that, look at this line:
bcma: bus0: Core 10 found: BCM4706 GBit MAC Common (manuf 0x43B, id
0x5DC, rev 0x00, class 0x0)
I also attach my WNDR4500 eprom if you wish to see it detailed.
--
Rafał
[-- Attachment #2: eprom-wndr450.txt --]
[-- Type: text/plain, Size: 3644 bytes --]
0x4BF50001 TAG==CI CID==0x500==4706_CHIPCOMMON
0x1F084411 TAG==CI PORTS==1+2 WRAPPERS==1+1
0x00000003 TAG==MST_PORT
0x18000005 TAG==ADDR
0x1FC00135 TAG==ADDR
0x00400000
0x1C000135 TAG==ADDR
0x03C00000
0x20000135 TAG==ADDR
0x10000000
0x181000C5 TAG==ADDR
0x1810A185 TAG==ADDR
0x4BF52D01 TAG==CI CID==0x52D==4706_MAC_GBIT
0x00004211 TAG==CI PORTS==1+1 WRAPPERS==1+0
0x00000103 TAG==MST_PORT
0x18002005 TAG==ADDR
0x181020C5 TAG==ADDR
0x4BF52D01 TAG==CI CID==0x52D==4706_MAC_GBIT
0x00004211 TAG==CI PORTS==1+1 WRAPPERS==1+0
0x00000203 TAG==MST_PORT
0x1800D005 TAG==ADDR
0x182000C5 TAG==ADDR
0x4A782C01 TAG==CI CID==0x82C==MIPS_74K
0x00004211 TAG==CI PORTS==1+1 WRAPPERS==1+0
0x00000303 TAG==MST_PORT
0x18003005 TAG==ADDR
0x181030C5 TAG==ADDR
0x4BF81901 TAG==CI CID==0x819==USB20_HOST
0x04004211 TAG==CI PORTS==1+1 WRAPPERS==1+0
0x00000403 TAG==MST_PORT
0x18004005 TAG==ADDR
0x18009005 TAG==ADDR
0x181040C5 TAG==ADDR
0x4BF82001 TAG==CI CID==0x820==USB20_DEV
0x0E084411 TAG==CI PORTS==1+2 WRAPPERS==1+1
0x00000503 TAG==MST_PORT
0x18005005 TAG==ADDR
0x08000135 TAG==ADDR
0x08000000
0x0000013D
0x80000000
0x00000008
0x40000000
0x181050C5 TAG==ADDR
0x18109185 TAG==ADDR
0x4BF82001 TAG==CI CID==0x820==USB20_DEV
0x0E084411 TAG==CI PORTS==1+2 WRAPPERS==1+1
0x00000603 TAG==MST_PORT
0x1800E005 TAG==ADDR
0x40000135 TAG==ADDR
0x08000000
0x0000013D
0xC0000000
0x00000008
0x40000000
0x182010C5 TAG==ADDR
0x18202185 TAG==ADDR
0x4BF52E01 TAG==CI CID==0x52E==AMEMC
0x00080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
0x18006005 TAG==ADDR
0x00000035 TAG==ADDR
0x08000000
0x10000035 TAG==ADDR
0x08000000
0x80000035 TAG==ADDR
0x40000000
0x18106085 TAG==ADDR
0x4BF50E01 TAG==CI CID==0x50E==4706_SOC_RAM
0x05100601 TAG==CI PORTS==0+3 WRAPPERS==0+2
0x18007005 TAG==ADDR
0x19000035 TAG==ADDR
0x00080000
0x19800035 TAG==ADDR
0x00080000
0x19000135 TAG==ADDR
0x00080000
0x19800135 TAG==ADDR
0x00080000
0x19000235 TAG==ADDR
0x00080000
0x19800235 TAG==ADDR
0x00080000
0x18107185 TAG==ADDR
0x18204285 TAG==ADDR
0x4BF53401 TAG==CI CID==0x534==ALTA
0x00004211 TAG==CI PORTS==1+1 WRAPPERS==1+0
0x00000703 TAG==MST_PORT
0x18008005 TAG==ADDR
0x181080C5 TAG==ADDR
0x43B13501 TAG==CI CID==0x135 TAG==ADDR
0x00080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
0x18000075 TAG==ADDR
0x00010000
0x1810B085 TAG==ADDR
0x43B13501 TAG==CI CID==0x135 TAG==ADDR
0x00080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
0x18100075 TAG==ADDR
0x00010000
0x1810C085 TAG==ADDR
0x43B13501 TAG==CI CID==0x135 TAG==ADDR
0x00080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
0x18200075 TAG==ADDR
0x00010000
0x18203085 TAG==ADDR
0x43B36701 TAG==CI CID==0x367==OOB_ROUTER
0x00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
0x1810D005 TAG==ADDR
0x43B36601 TAG==CI CID==0x366
0x00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
0x1810E005 TAG==ADDR
0x43B01A01 TAG==CI CID==0x01A
0x00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
0x1800C005 TAG==ADDR
0x43B01B01 TAG==CI CID==0x01B
0x00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
0x1800A005 TAG==ADDR
0x43B01C01 TAG==CI CID==0x01C
0x00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
0x1800B005 TAG==ADDR
0x43BFFF01 TAG==CI CID==0xFFF
0x00080201 TAG==CI PORTS==0+1 WRAPPERS==0+1
0x18110035 TAG==ADDR
0x000F0000
0x18210035 TAG==ADDR
0x00DF0000
0x19080035 TAG==ADDR
0x00780000
0x19880035 TAG==ADDR
0x02780000
0x30000035 TAG==ADDR
0x10000000
0x48000035 TAG==ADDR
0x38000000
0xC0000035 TAG==ADDR
0x40000008
0x7FFFFFFF
0x1810F085 TAG==ADDR
0x43B5DC01 TAG==CI CID==0x5DC==4706_MAC_GBIT_COMMON
0x00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
0x18001005 TAG==ADDR
0x43B5DD01 TAG==CI CID==0x5DD==DDR23_PHY
0x00000201 TAG==CI PORTS==0+1 WRAPPERS==0+0
0x1800F005 TAG==ADDR
0x0000000F
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-07-11 8:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-11 7:23 [PATCH V2] bcma: add trivial GBIT MAC COMMON driver Rafał Miłecki
2012-07-11 8:29 ` Hauke Mehrtens
2012-07-11 8:54 ` Rafał Miłecki
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.