]> Git Repo - u-boot.git/blobdiff - drivers/phy/sandbox-phy.c
dm: treewide: Rename auto_alloc_size members to be shorter
[u-boot.git] / drivers / phy / sandbox-phy.c
index 9ad820c24c9dcc3179bcc2bb7725236160feb082..7b3d988613bd08bfc765eb0166c75845ac3e4e8a 100644 (file)
@@ -1,15 +1,14 @@
+// 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>
 
-DECLARE_GLOBAL_DATA_PTR;
+#define DRIVER_DATA 0x12345678
 
 struct sandbox_phy_priv {
        bool initialized;
@@ -74,14 +73,21 @@ 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);
 
        priv->initialized = false;
        priv->on = false;
-       priv->broken = fdtdec_get_bool(gd->fdt_blob, dev_of_offset(dev),
-                                      "broken");
+       priv->broken = dev_read_bool(dev, "broken");
 
        return 0;
 }
@@ -94,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.030977 seconds and 4 git commands to generate.