diff mbox

[OpenWrt-Devel,V3] b53: define registers available and needed on BCM5301X

Message ID 1426708133-16931-1-git-send-email-zajec5@gmail.com
State Changes Requested
Delegated to: Jonas Gorski
Headers show

Commit Message

Rafał Miłecki March 18, 2015, 7:48 p.m. UTC
They are also present on some BCM63xx switches.

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
---
 .../generic/files/drivers/net/phy/b53/b53_regs.h   | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)

Comments

Jonas Gorski March 30, 2015, 8:43 p.m. UTC | #1
On Wed, Mar 18, 2015 at 8:48 PM, Rafał Miłecki <zajec5@gmail.com> wrote:
> They are also present on some BCM63xx switches.
>
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
>  .../generic/files/drivers/net/phy/b53/b53_regs.h   | 32 ++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>
> diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
> index 4899cc4..a4db1f1 100644
> --- a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
> +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
> @@ -50,6 +50,9 @@
>  /* Jumbo Frame Registers */
>  #define B53_JUMBO_PAGE                 0x40
>
> +/* CFP Configuration Registers Page */
> +#define B53_CFP_PAGE                   0xa1

How big is this page? What are its valid fields?

> +
>  /*************************************************************************
>   * Control Page registers
>   *************************************************************************/
> @@ -99,6 +102,24 @@
>  #define B53_MC_FLOOD_MASK              0x34
>  #define B53_IPMC_FLOOD_MASK            0x36
>
> +/*
> + * Overriding ports 0-7 on devices with xMII interfaces (8 bit)

I suggest adding a blank line here in the comment to separate name and
detailed explanation. Also let's call it "Override Port State
Register" or so. "Overriding ports" sounds like you could change the
port numbering or so.

> + * For port 8 still use B53_PORT_OVERRIDE_CTRL
> + * Please note that not all ports are available on every hardware, e.g. BCM5301X
> + * don't include overriding port 6, BCM63xx also have some limitations.
> + */
> +#define B53_GMII_PORT_OVERRIDE_CTRL(i) (0x58 + i)
> +#define   GMII_PORT_OVERRIDE_LINK              BIT(0)
> +#define   GMII_PORT_OVERRIDE_FULL_DUPLEX       BIT(1) /* 0 = Half Duplex */
> +#define   GMII_PORT_OVERRIDE_SPEED_S           2
> +#define   GMII_PORT_OVERRIDE_SPEED_10M         (0 << PORT_OVERRIDE_SPEED_S)
> +#define   GMII_PORT_OVERRIDE_SPEED_100M                (1 << PORT_OVERRIDE_SPEED_S)
> +#define   GMII_PORT_OVERRIDE_SPEED_1000M       (2 << PORT_OVERRIDE_SPEED_S)
> +#define   GMII_PORT_OVERRIDE_RX_FLOW           BIT(4)
> +#define   GMII_PORT_OVERRIDE_TX_FLOW           BIT(5)
> +#define   GMII_PORT_OVERRIDE_EN                        BIT(6) /* Use the register contents */
> +#define   GMII_PORT_OVERRIDE_SPEED_2000M       BIT(7) /* BCM5301X only, requires setting 1000M */

Can we shorten these names a bit? Broadcom calls them GMII_PO_*, which
I think is an acceptable abbreviation.

> +
>  /* Software reset register (8 bit) */
>  #define B53_SOFTRESET                  0x79
>
> @@ -156,6 +177,10 @@
>  #define   GC_FRM_MGMT_PORT_04          0x00
>  #define   GC_FRM_MGMT_PORT_MII         0x80
>
> +/* Enable BCM_HDR Tag on IMP port (8 bit) */

"Broadcom Header control register"? The comment belongs to BRCM_HDR_EN.

> +#define B53_BRCM_HDR                   0x03
> +#define   BRCM_HDR_EN                  BIT(0)
> +
>  /* Device ID register (8 or 32 bit) */
>  #define B53_DEVICE_ID                  0x30
>
> @@ -310,4 +335,11 @@
>  #define   JMS_MIN_SIZE                 1518
>  #define   JMS_MAX_SIZE                 9724
>
> +/*************************************************************************
> + * CFP Configuration Page Registers
> + *************************************************************************/
> +
> +/* CFP Control Register with ports map (8 bit) */
> +#define B53_CFP_CTRL                   0x00
> +
>  #endif /* !__B53_REGS_H */
> --
> 1.8.4.5


Jonas
Rafał Miłecki April 6, 2015, 10:53 a.m. UTC | #2
On 30 March 2015 at 22:43, Jonas Gorski <jogo@openwrt.org> wrote:
> On Wed, Mar 18, 2015 at 8:48 PM, Rafał Miłecki <zajec5@gmail.com> wrote:
>> They are also present on some BCM63xx switches.
>>
>> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
>> ---
>>  .../generic/files/drivers/net/phy/b53/b53_regs.h   | 32 ++++++++++++++++++++++
>>  1 file changed, 32 insertions(+)
>>
>> diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
>> index 4899cc4..a4db1f1 100644
>> --- a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
>> +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
>> @@ -50,6 +50,9 @@
>>  /* Jumbo Frame Registers */
>>  #define B53_JUMBO_PAGE                 0x40
>>
>> +/* CFP Configuration Registers Page */
>> +#define B53_CFP_PAGE                   0xa1
>
> How big is this page? What are its valid fields?

I don't know, obviously. Is this a real problem? :| It didn't stop you
from defining e.g. B53_QOS_PAGE and may bits. Let's just document
registers we know/can.


>> +
>>  /*************************************************************************
>>   * Control Page registers
>>   *************************************************************************/
>> @@ -99,6 +102,24 @@
>>  #define B53_MC_FLOOD_MASK              0x34
>>  #define B53_IPMC_FLOOD_MASK            0x36
>>
>> +/*
>> + * Overriding ports 0-7 on devices with xMII interfaces (8 bit)
>
> I suggest adding a blank line here in the comment to separate name and
> detailed explanation. Also let's call it "Override Port State
> Register" or so. "Overriding ports" sounds like you could change the
> port numbering or so.
>
>> + * For port 8 still use B53_PORT_OVERRIDE_CTRL
>> + * Please note that not all ports are available on every hardware, e.g. BCM5301X
>> + * don't include overriding port 6, BCM63xx also have some limitations.
>> + */
>> +#define B53_GMII_PORT_OVERRIDE_CTRL(i) (0x58 + i)
>> +#define   GMII_PORT_OVERRIDE_LINK              BIT(0)
>> +#define   GMII_PORT_OVERRIDE_FULL_DUPLEX       BIT(1) /* 0 = Half Duplex */
>> +#define   GMII_PORT_OVERRIDE_SPEED_S           2
>> +#define   GMII_PORT_OVERRIDE_SPEED_10M         (0 << PORT_OVERRIDE_SPEED_S)
>> +#define   GMII_PORT_OVERRIDE_SPEED_100M                (1 << PORT_OVERRIDE_SPEED_S)
>> +#define   GMII_PORT_OVERRIDE_SPEED_1000M       (2 << PORT_OVERRIDE_SPEED_S)
>> +#define   GMII_PORT_OVERRIDE_RX_FLOW           BIT(4)
>> +#define   GMII_PORT_OVERRIDE_TX_FLOW           BIT(5)
>> +#define   GMII_PORT_OVERRIDE_EN                        BIT(6) /* Use the register contents */
>> +#define   GMII_PORT_OVERRIDE_SPEED_2000M       BIT(7) /* BCM5301X only, requires setting 1000M */
>
> Can we shorten these names a bit? Broadcom calls them GMII_PO_*, which
> I think is an acceptable abbreviation.

I was just trying to follow B53_PORT_OVERRIDE_CTRL, but I like GMII_PO_* too.
diff mbox

Patch

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
index 4899cc4..a4db1f1 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h
@@ -50,6 +50,9 @@ 
 /* Jumbo Frame Registers */
 #define B53_JUMBO_PAGE			0x40
 
+/* CFP Configuration Registers Page */
+#define B53_CFP_PAGE			0xa1
+
 /*************************************************************************
  * Control Page registers
  *************************************************************************/
@@ -99,6 +102,24 @@ 
 #define B53_MC_FLOOD_MASK		0x34
 #define B53_IPMC_FLOOD_MASK		0x36
 
+/*
+ * Overriding ports 0-7 on devices with xMII interfaces (8 bit)
+ * For port 8 still use B53_PORT_OVERRIDE_CTRL
+ * Please note that not all ports are available on every hardware, e.g. BCM5301X
+ * don't include overriding port 6, BCM63xx also have some limitations.
+ */
+#define B53_GMII_PORT_OVERRIDE_CTRL(i)	(0x58 + i)
+#define   GMII_PORT_OVERRIDE_LINK		BIT(0)
+#define   GMII_PORT_OVERRIDE_FULL_DUPLEX	BIT(1) /* 0 = Half Duplex */
+#define   GMII_PORT_OVERRIDE_SPEED_S		2
+#define   GMII_PORT_OVERRIDE_SPEED_10M		(0 << PORT_OVERRIDE_SPEED_S)
+#define   GMII_PORT_OVERRIDE_SPEED_100M		(1 << PORT_OVERRIDE_SPEED_S)
+#define   GMII_PORT_OVERRIDE_SPEED_1000M	(2 << PORT_OVERRIDE_SPEED_S)
+#define   GMII_PORT_OVERRIDE_RX_FLOW		BIT(4)
+#define   GMII_PORT_OVERRIDE_TX_FLOW		BIT(5)
+#define   GMII_PORT_OVERRIDE_EN			BIT(6) /* Use the register contents */
+#define   GMII_PORT_OVERRIDE_SPEED_2000M	BIT(7) /* BCM5301X only, requires setting 1000M */
+
 /* Software reset register (8 bit) */
 #define B53_SOFTRESET			0x79
 
@@ -156,6 +177,10 @@ 
 #define   GC_FRM_MGMT_PORT_04		0x00
 #define   GC_FRM_MGMT_PORT_MII		0x80
 
+/* Enable BCM_HDR Tag on IMP port (8 bit) */
+#define B53_BRCM_HDR			0x03
+#define   BRCM_HDR_EN			BIT(0)
+
 /* Device ID register (8 or 32 bit) */
 #define B53_DEVICE_ID			0x30
 
@@ -310,4 +335,11 @@ 
 #define   JMS_MIN_SIZE			1518
 #define   JMS_MAX_SIZE			9724
 
+/*************************************************************************
+ * CFP Configuration Page Registers
+ *************************************************************************/
+
+/* CFP Control Register with ports map (8 bit) */
+#define B53_CFP_CTRL			0x00
+
 #endif /* !__B53_REGS_H */