[U-Boot,v2] Aquantia: Print information about system interface and firmware version

Message ID 20181106121607.8063-1-valentin-catalin.neacsu@nxp.com
State Accepted
Commit 91c9cba
Delegated to: Joe Hershberger
Headers show
Series
  • [U-Boot,v2] Aquantia: Print information about system interface and firmware version
Related show

Commit Message

Valentin-catalin Neacsu Nov. 6, 2018, 12:16 p.m.
Print information about Aquantia firmware loaded on the phy.

Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
---
V2:
 - Fix typo in title. (Clement Peron)

 drivers/net/phy/aquantia.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

Comments

Joe Hershberger Jan. 22, 2019, 9:51 p.m. | #1
On Tue, Nov 6, 2018 at 6:17 AM Valentin-catalin Neacsu
<valentin-catalin.neacsu@nxp.com> wrote:
>
> Print information about Aquantia firmware loaded on the phy.
>
> Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Joe Hershberger Jan. 22, 2019, 11:14 p.m. | #2
On Tue, Nov 6, 2018 at 6:17 AM Valentin-catalin Neacsu
<valentin-catalin.neacsu@nxp.com> wrote:
>
> Print information about Aquantia firmware loaded on the phy.
>
> Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
> ---
> V2:
>  - Fix typo in title. (Clement Peron)
>
>  drivers/net/phy/aquantia.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>
> diff --git a/drivers/net/phy/aquantia.c b/drivers/net/phy/aquantia.c
> index 553069f3dc..2609664c69 100644
> --- a/drivers/net/phy/aquantia.c
> +++ b/drivers/net/phy/aquantia.c
> @@ -22,6 +22,11 @@
>
>  #define AQUANTIA_SYSTEM_INTERFACE_SR     0xe812
>  #define AQUANTIA_VENDOR_PROVISIONING_REG 0xC441
> +#define AQUANTIA_FIRMWARE_ID            0x20
> +#define AQUANTIA_RESERVED_STATUS        0xc885
> +#define AQUANTIA_FIRMWARE_MAJOR_MASK    0xff00
> +#define AQUANTIA_FIRMWARE_MINOR_MASK    0xff
> +#define AQUANTIA_FIRMWARE_BUILD_MASK    0xf0
>
>  #define AQUANTIA_USX_AUTONEG_CONTROL_ENA 0x0008
>  #define AQUANTIA_SI_IN_USE_MASK          0x0078
> @@ -30,6 +35,7 @@
>  int aquantia_config(struct phy_device *phydev)
>  {
>         u32 val = phy_read(phydev, MDIO_MMD_PMAPMD, MII_BMCR);
> +       u32 reg_val1 = 0;
>
>         if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
>                 /* 1000BASE-T mode */
> @@ -56,6 +62,11 @@ int aquantia_config(struct phy_device *phydev)
>                         phy_write(phydev, MDIO_MMD_PHYXS,
>                                   AQUANTIA_VENDOR_PROVISIONING_REG,
>                                   AQUANTIA_USX_AUTONEG_CONTROL_ENA);

Is this still needed? This hunk doesn't apply any more.

Thanks,
-Joe

> +                       printf("%s: system interface USXGMII\n",
> +                              phydev->dev->name);
> +               } else {
> +                       printf("%s: system interface XFI\n",
> +                              phydev->dev->name);
>                 }
>
>         } else if (phydev->interface == PHY_INTERFACE_MODE_SGMII_2500) {
> @@ -73,6 +84,16 @@ int aquantia_config(struct phy_device *phydev)
>                 val = (val & ~AQUNTIA_SPEED_MSB_MASK) | AQUNTIA_SPEED_LSB_MASK;
>                 phy_write(phydev, MDIO_MMD_PMAPMD, MII_BMCR, val);
>         }
> +
> +       val = phy_read(phydev, MDIO_MMD_VEND1, AQUANTIA_RESERVED_STATUS);
> +       reg_val1 = phy_read(phydev, MDIO_MMD_VEND1, AQUANTIA_FIRMWARE_ID);
> +
> +       printf("%s: %s Firmware Version %x.%x.%x\n", phydev->dev->name,
> +              phydev->drv->name,
> +              (reg_val1 & AQUANTIA_FIRMWARE_MAJOR_MASK) >> 8,
> +              reg_val1 & AQUANTIA_FIRMWARE_MINOR_MASK,
> +              (val & AQUANTIA_FIRMWARE_BUILD_MASK) >> 4);
> +
>         return 0;
>  }
>
> --
> 2.17.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
Joe Hershberger Jan. 22, 2019, 11:29 p.m. | #3
On Tue, Jan 22, 2019 at 5:14 PM Joe Hershberger
<joe.hershberger@gmail.com> wrote:
>
> On Tue, Nov 6, 2018 at 6:17 AM Valentin-catalin Neacsu
> <valentin-catalin.neacsu@nxp.com> wrote:
> >
> > Print information about Aquantia firmware loaded on the phy.
> >
> > Signed-off-by: Valentin Catalin Neacsu <valentin-catalin.neacsu@nxp.com>
> > ---
> > V2:
> >  - Fix typo in title. (Clement Peron)
> >
> >  drivers/net/phy/aquantia.c | 21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> >
> > diff --git a/drivers/net/phy/aquantia.c b/drivers/net/phy/aquantia.c
> > index 553069f3dc..2609664c69 100644
> > --- a/drivers/net/phy/aquantia.c
> > +++ b/drivers/net/phy/aquantia.c
> > @@ -22,6 +22,11 @@
> >
> >  #define AQUANTIA_SYSTEM_INTERFACE_SR     0xe812
> >  #define AQUANTIA_VENDOR_PROVISIONING_REG 0xC441
> > +#define AQUANTIA_FIRMWARE_ID            0x20
> > +#define AQUANTIA_RESERVED_STATUS        0xc885
> > +#define AQUANTIA_FIRMWARE_MAJOR_MASK    0xff00
> > +#define AQUANTIA_FIRMWARE_MINOR_MASK    0xff
> > +#define AQUANTIA_FIRMWARE_BUILD_MASK    0xf0
> >
> >  #define AQUANTIA_USX_AUTONEG_CONTROL_ENA 0x0008
> >  #define AQUANTIA_SI_IN_USE_MASK          0x0078
> > @@ -30,6 +35,7 @@
> >  int aquantia_config(struct phy_device *phydev)
> >  {
> >         u32 val = phy_read(phydev, MDIO_MMD_PMAPMD, MII_BMCR);
> > +       u32 reg_val1 = 0;
> >
> >         if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
> >                 /* 1000BASE-T mode */
> > @@ -56,6 +62,11 @@ int aquantia_config(struct phy_device *phydev)
> >                         phy_write(phydev, MDIO_MMD_PHYXS,
> >                                   AQUANTIA_VENDOR_PROVISIONING_REG,
> >                                   AQUANTIA_USX_AUTONEG_CONTROL_ENA);
>
> Is this still needed? This hunk doesn't apply any more.

I fixed up the conflict and will take it as is.

> Thanks,
> -Joe
>
> > +                       printf("%s: system interface USXGMII\n",
> > +                              phydev->dev->name);
> > +               } else {
> > +                       printf("%s: system interface XFI\n",
> > +                              phydev->dev->name);
> >                 }
> >
> >         } else if (phydev->interface == PHY_INTERFACE_MODE_SGMII_2500) {
> > @@ -73,6 +84,16 @@ int aquantia_config(struct phy_device *phydev)
> >                 val = (val & ~AQUNTIA_SPEED_MSB_MASK) | AQUNTIA_SPEED_LSB_MASK;
> >                 phy_write(phydev, MDIO_MMD_PMAPMD, MII_BMCR, val);
> >         }
> > +
> > +       val = phy_read(phydev, MDIO_MMD_VEND1, AQUANTIA_RESERVED_STATUS);
> > +       reg_val1 = phy_read(phydev, MDIO_MMD_VEND1, AQUANTIA_FIRMWARE_ID);
> > +
> > +       printf("%s: %s Firmware Version %x.%x.%x\n", phydev->dev->name,
> > +              phydev->drv->name,
> > +              (reg_val1 & AQUANTIA_FIRMWARE_MAJOR_MASK) >> 8,
> > +              reg_val1 & AQUANTIA_FIRMWARE_MINOR_MASK,
> > +              (val & AQUANTIA_FIRMWARE_BUILD_MASK) >> 4);
> > +
> >         return 0;
> >  }
> >
> > --
> > 2.17.1
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > https://lists.denx.de/listinfo/u-boot
Joe Hershberger Jan. 24, 2019, 5:39 p.m. | #4
Hi Valentin-catalin,

https://patchwork.ozlabs.org/patch/993651/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

Patch

diff --git a/drivers/net/phy/aquantia.c b/drivers/net/phy/aquantia.c
index 553069f3dc..2609664c69 100644
--- a/drivers/net/phy/aquantia.c
+++ b/drivers/net/phy/aquantia.c
@@ -22,6 +22,11 @@ 
 
 #define AQUANTIA_SYSTEM_INTERFACE_SR     0xe812
 #define AQUANTIA_VENDOR_PROVISIONING_REG 0xC441
+#define AQUANTIA_FIRMWARE_ID		 0x20
+#define AQUANTIA_RESERVED_STATUS	 0xc885
+#define AQUANTIA_FIRMWARE_MAJOR_MASK	 0xff00
+#define AQUANTIA_FIRMWARE_MINOR_MASK	 0xff
+#define AQUANTIA_FIRMWARE_BUILD_MASK	 0xf0
 
 #define AQUANTIA_USX_AUTONEG_CONTROL_ENA 0x0008
 #define AQUANTIA_SI_IN_USE_MASK          0x0078
@@ -30,6 +35,7 @@ 
 int aquantia_config(struct phy_device *phydev)
 {
 	u32 val = phy_read(phydev, MDIO_MMD_PMAPMD, MII_BMCR);
+	u32 reg_val1 = 0;
 
 	if (phydev->interface == PHY_INTERFACE_MODE_SGMII) {
 		/* 1000BASE-T mode */
@@ -56,6 +62,11 @@  int aquantia_config(struct phy_device *phydev)
 			phy_write(phydev, MDIO_MMD_PHYXS,
 				  AQUANTIA_VENDOR_PROVISIONING_REG,
 				  AQUANTIA_USX_AUTONEG_CONTROL_ENA);
+			printf("%s: system interface USXGMII\n",
+			       phydev->dev->name);
+		} else {
+			printf("%s: system interface XFI\n",
+			       phydev->dev->name);
 		}
 
 	} else if (phydev->interface == PHY_INTERFACE_MODE_SGMII_2500) {
@@ -73,6 +84,16 @@  int aquantia_config(struct phy_device *phydev)
 		val = (val & ~AQUNTIA_SPEED_MSB_MASK) | AQUNTIA_SPEED_LSB_MASK;
 		phy_write(phydev, MDIO_MMD_PMAPMD, MII_BMCR, val);
 	}
+
+	val = phy_read(phydev, MDIO_MMD_VEND1, AQUANTIA_RESERVED_STATUS);
+	reg_val1 = phy_read(phydev, MDIO_MMD_VEND1, AQUANTIA_FIRMWARE_ID);
+
+	printf("%s: %s Firmware Version %x.%x.%x\n", phydev->dev->name,
+	       phydev->drv->name,
+	       (reg_val1 & AQUANTIA_FIRMWARE_MAJOR_MASK) >> 8,
+	       reg_val1 & AQUANTIA_FIRMWARE_MINOR_MASK,
+	       (val & AQUANTIA_FIRMWARE_BUILD_MASK) >> 4);
+
 	return 0;
 }