Kconfig: tegra: Migrate USB_EHCI_TEGRA
[oweals/u-boot.git] / drivers / usb / host / ehci-atmel.c
index d65bbe986c9d3f07390d0041063bb77c8caf90e1..6900848df1e95cdb27e3c38675a94561b0fe35ed 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2012
  * Atmel Semiconductor <www.atmel.com>
  * Written-by: Bo Shen <voice.shen@atmel.com>
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -15,9 +14,7 @@
 
 #include "ehci.h"
 
-DECLARE_GLOBAL_DATA_PTR;
-
-#ifndef CONFIG_DM_USB
+#if !CONFIG_IS_ENABLED(DM_USB)
 
 int ehci_hcd_init(int index, enum usb_init_type init,
                struct ehci_hccr **hccr, struct ehci_hcor **hcor)
@@ -56,9 +53,7 @@ struct ehci_atmel_priv {
 
 static int ehci_atmel_enable_clk(struct udevice *dev)
 {
-       struct udevice *dev_clk;
        struct clk clk;
-       int periph;
        int ret;
 
        ret = clk_get_by_index(dev, 0, &clk);
@@ -73,19 +68,6 @@ static int ehci_atmel_enable_clk(struct udevice *dev)
        if (ret)
                return -EINVAL;
 
-       periph = fdtdec_get_uint(gd->fdt_blob, clk.dev->of_offset, "reg", -1);
-       if (periph < 0)
-               return -EINVAL;
-
-       dev_clk = dev_get_parent(clk.dev);
-       if (!dev_clk)
-               return -ENODEV;
-
-       ret = clk_request(dev_clk, &clk);
-       if (ret)
-               return ret;
-
-       clk.id = periph;
        ret = clk_enable(&clk);
        if (ret)
                return ret;
@@ -111,7 +93,7 @@ static int ehci_atmel_probe(struct udevice *dev)
        /*
         * Get the base address for EHCI controller from the device node
         */
-       hcd_base = dev_get_addr(dev);
+       hcd_base = devfdt_get_addr(dev);
        if (hcd_base == FDT_ADDR_T_NONE) {
                debug("Can't get the EHCI register base address\n");
                return -ENXIO;
@@ -128,17 +110,6 @@ static int ehci_atmel_probe(struct udevice *dev)
        return ehci_register(dev, hccr, hcor, NULL, 0, USB_INIT_HOST);
 }
 
-static int ehci_atmel_remove(struct udevice *dev)
-{
-       int ret;
-
-       ret = ehci_deregister(dev);
-       if (ret)
-               return ret;
-
-       return 0;
-}
-
 static const struct udevice_id ehci_usb_ids[] = {
        { .compatible = "atmel,at91sam9g45-ehci", },
        { }
@@ -149,7 +120,7 @@ U_BOOT_DRIVER(ehci_atmel) = {
        .id             = UCLASS_USB,
        .of_match       = ehci_usb_ids,
        .probe          = ehci_atmel_probe,
-       .remove         = ehci_atmel_remove,
+       .remove         = ehci_deregister,
        .ops            = &ehci_usb_ops,
        .platdata_auto_alloc_size = sizeof(struct usb_platdata),
        .priv_auto_alloc_size = sizeof(struct ehci_atmel_priv),