]> Git Repo - u-boot.git/blobdiff - drivers/phy/sandbox-phy.c
Merge tag 'v2023.10-rc3' into next
[u-boot.git] / drivers / phy / sandbox-phy.c
index 3ed6837e64a2c08b68b4ed96b44a5435d0041e94..7b3d988613bd08bfc765eb0166c75845ac3e4e8a 100644 (file)
@@ -1,14 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
  * Written by Jean-Jacques Hiblot  <[email protected]>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <dm.h>
 #include <generic-phy.h>
 
+#define DRIVER_DATA 0x12345678
+
 struct sandbox_phy_priv {
        bool initialized;
        bool on;
@@ -72,6 +73,14 @@ static int sandbox_phy_exit(struct phy *phy)
        return 0;
 }
 
+static int sandbox_phy_bind(struct udevice *dev)
+{
+       if (dev_get_driver_data(dev) != DRIVER_DATA)
+               return -ENODATA;
+
+       return 0;
+}
+
 static int sandbox_phy_probe(struct udevice *dev)
 {
        struct sandbox_phy_priv *priv = dev_get_priv(dev);
@@ -91,15 +100,21 @@ static struct phy_ops sandbox_phy_ops = {
 };
 
 static const struct udevice_id sandbox_phy_ids[] = {
-       { .compatible = "sandbox,phy" },
+       { .compatible = "sandbox,phy_no_driver_data",
+       },
+
+       { .compatible = "sandbox,phy",
+         .data = DRIVER_DATA
+       },
        { }
 };
 
 U_BOOT_DRIVER(phy_sandbox) = {
        .name           = "phy_sandbox",
        .id             = UCLASS_PHY,
+       .bind           = sandbox_phy_bind,
        .of_match       = sandbox_phy_ids,
        .ops            = &sandbox_phy_ops,
        .probe          = sandbox_phy_probe,
-       .priv_auto_alloc_size = sizeof(struct sandbox_phy_priv),
+       .priv_auto      = sizeof(struct sandbox_phy_priv),
 };
This page took 0.034598 seconds and 4 git commands to generate.