usb: ehci-generic: support reset control for generic EHCI
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 21 Sep 2016 02:29:02 +0000 (11:29 +0900)
committerTom Rini <trini@konsulko.com>
Sat, 24 Sep 2016 02:25:44 +0000 (22:25 -0400)
This driver is designed in a generic manner, so resets should be
handled generically as well.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
drivers/usb/host/ehci-generic.c

index 6291ed230bf66040090be1df1f3874a4cfbc61af..2190adba6777d849525efdf165ffed882cfd001a 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <clk.h>
+#include <reset.h>
 #include <asm/io.h>
 #include <dm.h>
 #include "ehci.h"
@@ -37,6 +38,18 @@ static int ehci_usb_probe(struct udevice *dev)
                clk_free(&clk);
        }
 
+       for (i = 0; ; i++) {
+               struct reset_ctl reset;
+               int ret;
+
+               ret = reset_get_by_index(dev, i, &reset);
+               if (ret < 0)
+                       break;
+               if (reset_deassert(&reset))
+                       printf("failed to deassert reset %d\n", i);
+               reset_free(&reset);
+       }
+
        hccr = map_physmem(dev_get_addr(dev), 0x100, MAP_NOCACHE);
        hcor = (struct ehci_hcor *)((uintptr_t)hccr +
                                    HC_LENGTH(ehci_readl(&hccr->cr_capbase)));