]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
phy: ti: phy-j721e-wiz: Allow reinitialization when SERDES is pre-configured
authorHrushikesh Salunke <h-salunke@ti.com>
Fri, 17 Oct 2025 05:25:19 +0000 (10:55 +0530)
committerTom Rini <trini@konsulko.com>
Fri, 24 Oct 2025 19:47:50 +0000 (13:47 -0600)
Move the SERDES configuration check after clock and reset initialization
and change it from a hard failure to a skip of WIZ initialization. This
allows the driver to probe successfully when the SERDES has been
pre-configured by a previous boot stage (e.g., ROM or SPL).

This approach aligns with how the Linux kernel handles pre-configured
SERDES, where the driver gracefully skips reinitialization rather than
failing to probe.

Signed-off-by: Hrushikesh Salunke <h-salunke@ti.com>
drivers/phy/ti/phy-j721e-wiz.c

index 6e2d4bc2b05014d5511a0ce4e01dffb2f14e4cd2..eaf68d18f3a18d765acef7e2f16ac0b6cc2520b1 100644 (file)
@@ -1180,6 +1180,7 @@ static int j721e_wiz_probe(struct udevice *dev)
        ofnode node;
        struct regmap *regmap;
        u32 num_lanes;
+       bool already_configured = false;
 
        node = get_child_by_name(dev, "serdes");
 
@@ -1243,15 +1244,6 @@ static int j721e_wiz_probe(struct udevice *dev)
                goto err_addr_to_resource;
        }
 
-       for (i = 0; i < wiz->num_lanes; i++) {
-               regmap_field_read(wiz->p_enable[i], &val);
-               if (val & (P_ENABLE | P_ENABLE_FORCE)) {
-                       dev_err(dev, "SERDES already configured\n");
-                       rc = -EBUSY;
-                       goto err_addr_to_resource;
-               }
-       }
-
        rc = j721e_wiz_bind_of_clocks(wiz);
        if (rc) {
                dev_err(dev, "Failed to bind clocks\n");
@@ -1270,10 +1262,21 @@ static int j721e_wiz_probe(struct udevice *dev)
                goto err_addr_to_resource;
        }
 
-       rc = wiz_init(wiz);
-       if (rc) {
-               dev_err(dev, "WIZ initialization failed\n");
-               goto err_addr_to_resource;
+       for (i = 0; i < wiz->num_lanes; i++) {
+               regmap_field_read(wiz->p_enable[i], &val);
+               if (val & (P_ENABLE | P_ENABLE_FORCE)) {
+                       dev_info(dev, "SERDES already configured, skipping wiz initialization\n");
+                       already_configured = true;
+                       break;
+               }
+       }
+
+       if (!already_configured) {
+               rc = wiz_init(wiz);
+               if (rc) {
+                       dev_err(dev, "WIZ initialization failed\n");
+                       goto err_addr_to_resource;
+               }
        }
 
        return 0;