diff mbox series

[U-Boot,4/4] net: fec: add fuse check

Message ID 20190719033721.5730-4-peng.fan@nxp.com
State Superseded
Delegated to: Stefano Babic
Headers show
Series [U-Boot,1/4] imx: add module fuse support | expand

Commit Message

Peng Fan July 19, 2019, 3:22 a.m. UTC
Add fuse check for fec. If the fuse indicate the module
not work in the SoC, let's fail the initialization.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/net/fec_mxc.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Joe Hershberger July 23, 2019, 3:27 a.m. UTC | #1
On Thu, Jul 18, 2019 at 10:24 PM Peng Fan <peng.fan@nxp.com> wrote:
>
> Add fuse check for fec. If the fuse indicate the module
> not work in the SoC, let's fail the initialization.

"indicates the module will not work"

>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/net/fec_mxc.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> index d7c080943a..602b655455 100644
> --- a/drivers/net/fec_mxc.c
> +++ b/drivers/net/fec_mxc.c
> @@ -1185,6 +1185,13 @@ int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
>  #endif
>         int ret;
>
> +       if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
> +               if (enet_fused(addr)) {
> +                       printf("Ethernet@0x%x is fused, disable it\n", addr);

Please reword this. Something like "SoC fuse indicates Ethernet@0x%x
is unavailable."

> +                       return -ENODEV;
> +               }
> +       }
> +
>  #ifdef CONFIG_FEC_MXC_MDIO_BASE
>         /*
>          * The i.MX28 has two ethernet interfaces, but they are not equal.
> @@ -1323,6 +1330,14 @@ static int fecmxc_probe(struct udevice *dev)
>         uint32_t start;
>         int ret;
>
> +       if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
> +               if (enet_fused((u32)priv->eth)) {
> +                       printf("Ethernet@0x%x is fused, disable it\n",

Same.

> +                              (u32)priv->eth);
> +                       return -ENODEV;
> +               }
> +       }
> +
>         if (IS_ENABLED(CONFIG_IMX8)) {
>                 ret = clk_get_by_name(dev, "ipg", &priv->ipg_clk);
>                 if (ret < 0) {
> --
> 2.16.4
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
Peng Fan July 23, 2019, 5:46 a.m. UTC | #2
> Subject: Re: [U-Boot] [PATCH 4/4] net: fec: add fuse check
> 
> On Thu, Jul 18, 2019 at 10:24 PM Peng Fan <peng.fan@nxp.com> wrote:
> >
> > Add fuse check for fec. If the fuse indicate the module not work in
> > the SoC, let's fail the initialization.
> 
> "indicates the module will not work"

Fix in V2.

> 
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >  drivers/net/fec_mxc.c | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> >
> > diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c index
> > d7c080943a..602b655455 100644
> > --- a/drivers/net/fec_mxc.c
> > +++ b/drivers/net/fec_mxc.c
> > @@ -1185,6 +1185,13 @@ int fecmxc_initialize_multi(bd_t *bd, int
> > dev_id, int phy_id, uint32_t addr)  #endif
> >         int ret;
> >
> > +       if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
> > +               if (enet_fused(addr)) {
> > +                       printf("Ethernet@0x%x is fused, disable it\n",
> > + addr);
> 
> Please reword this. Something like "SoC fuse indicates Ethernet@0x%x is
> unavailable."

Fix in v2.

> 
> > +                       return -ENODEV;
> > +               }
> > +       }
> > +
> >  #ifdef CONFIG_FEC_MXC_MDIO_BASE
> >         /*
> >          * The i.MX28 has two ethernet interfaces, but they are not
> equal.
> > @@ -1323,6 +1330,14 @@ static int fecmxc_probe(struct udevice *dev)
> >         uint32_t start;
> >         int ret;
> >
> > +       if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
> > +               if (enet_fused((u32)priv->eth)) {
> > +                       printf("Ethernet@0x%x is fused, disable it\n",
> 
> Same.

Fix in V2.

Thanks,
Peng.

> 
> > +                              (u32)priv->eth);
> > +                       return -ENODEV;
> > +               }
> > +       }
> > +
> >         if (IS_ENABLED(CONFIG_IMX8)) {
> >                 ret = clk_get_by_name(dev, "ipg", &priv->ipg_clk);
> >                 if (ret < 0) {
> > --
> > 2.16.4
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist
> >
> s.denx.de%2Flistinfo%2Fu-boot&amp;data=02%7C01%7Cpeng.fan%40nxp.co
> m%7C
> >
> e6ff4f39e3c4498965d308d70f1dabd6%7C686ea1d3bc2b4c6fa92cd99c5c301
> 635%7C
> >
> 0%7C0%7C636994492429835169&amp;sdata=IM0QAmsTXC%2BnpZOqtGW
> XGslK2VD5n7n
> > pehzJ6i1XqIo%3D&amp;reserved=0
diff mbox series

Patch

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index d7c080943a..602b655455 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1185,6 +1185,13 @@  int fecmxc_initialize_multi(bd_t *bd, int dev_id, int phy_id, uint32_t addr)
 #endif
 	int ret;
 
+	if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
+		if (enet_fused(addr)) {
+			printf("Ethernet@0x%x is fused, disable it\n", addr);
+			return -ENODEV;
+		}
+	}
+
 #ifdef CONFIG_FEC_MXC_MDIO_BASE
 	/*
 	 * The i.MX28 has two ethernet interfaces, but they are not equal.
@@ -1323,6 +1330,14 @@  static int fecmxc_probe(struct udevice *dev)
 	uint32_t start;
 	int ret;
 
+	if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
+		if (enet_fused((u32)priv->eth)) {
+			printf("Ethernet@0x%x is fused, disable it\n",
+			       (u32)priv->eth);
+			return -ENODEV;
+		}
+	}
+
 	if (IS_ENABLED(CONFIG_IMX8)) {
 		ret = clk_get_by_name(dev, "ipg", &priv->ipg_clk);
 		if (ret < 0) {