diff mbox series

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

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

Commit Message

Peng Fan Aug. 1, 2019, 8:45 a.m. UTC
Add fuse check for fec. If the fuse indicates the module
will not work in the SoC, let's fail the initialization.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
---

V2:
 Fix build for aarch64
 Add ACK tag

 drivers/net/fec_mxc.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Ye Li Aug. 2, 2019, 3 a.m. UTC | #1
Hi Peng,

> Add fuse check for fec. If the fuse indicates the module
> will not work in the SoC, let's fail the initialization.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> ---
> 
> V2:
>  Fix build for aarch64
>  Add ACK tag
> 
>  drivers/net/fec_mxc.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> index 96e3ad9a1a..afc82dd08a 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((ulong)addr)) {
> +			printf("SoC fuse indicates Ethernet@0x%x is unavailable.\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,13 @@ static int fecmxc_probe(struct udevice *dev)
>  	uint32_t start;
>  	int ret;
>  
> +	if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
> +		if (enet_fused((ulong)priv->eth)) {
> +			printf("SoC fuse indicates Ethernet@0x%lx is unavailable.\n", (ulong)priv->eth);
> +			return -ENODEV;
> +		}
> +	}
> +
>  	if (IS_ENABLED(CONFIG_IMX8)) {
>  		ret = clk_get_by_name(dev, "ipg", &priv->ipg_clk);
>  		if (ret < 0) {
> 
Reviewed-by: Ye Li <ye.li@nxp.com>

Best regards,
Ye Li
diff mbox series

Patch

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 96e3ad9a1a..afc82dd08a 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((ulong)addr)) {
+			printf("SoC fuse indicates Ethernet@0x%x is unavailable.\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,13 @@  static int fecmxc_probe(struct udevice *dev)
 	uint32_t start;
 	int ret;
 
+	if (IS_ENABLED(CONFIG_IMX_MODULE_FUSE)) {
+		if (enet_fused((ulong)priv->eth)) {
+			printf("SoC fuse indicates Ethernet@0x%lx is unavailable.\n", (ulong)priv->eth);
+			return -ENODEV;
+		}
+	}
+
 	if (IS_ENABLED(CONFIG_IMX8)) {
 		ret = clk_get_by_name(dev, "ipg", &priv->ipg_clk);
 		if (ret < 0) {