]>
git.ipfire.org Git - people/ms/u-boot.git/blob - drivers/usb/host/ehci-generic.c
2 * Copyright (C) 2015 Alexey Brodkin <abrodkin@synopsys.com>
4 * SPDX-License-Identifier: GPL-2.0+
15 * Even though here we don't explicitly use "struct ehci_ctrl"
16 * ehci_register() expects it to be the first thing that resides in
17 * device's private data.
20 struct ehci_ctrl ctrl
;
23 static int ehci_usb_probe(struct udevice
*dev
)
25 struct ehci_hccr
*hccr
;
26 struct ehci_hcor
*hcor
;
33 ret
= clk_get_by_index(dev
, i
, &clk
);
37 printf("failed to enable clock %d\n", i
);
42 struct reset_ctl reset
;
45 ret
= reset_get_by_index(dev
, i
, &reset
);
48 if (reset_deassert(&reset
))
49 printf("failed to deassert reset %d\n", i
);
53 hccr
= map_physmem(devfdt_get_addr(dev
), 0x100, MAP_NOCACHE
);
54 hcor
= (struct ehci_hcor
*)((uintptr_t)hccr
+
55 HC_LENGTH(ehci_readl(&hccr
->cr_capbase
)));
57 return ehci_register(dev
, hccr
, hcor
, NULL
, 0, USB_INIT_HOST
);
60 static const struct udevice_id ehci_usb_ids
[] = {
61 { .compatible
= "generic-ehci" },
65 U_BOOT_DRIVER(ehci_generic
) = {
66 .name
= "ehci_generic",
68 .of_match
= ehci_usb_ids
,
69 .probe
= ehci_usb_probe
,
70 .remove
= ehci_deregister
,
72 .priv_auto_alloc_size
= sizeof(struct generic_ehci
),
73 .flags
= DM_FLAG_ALLOC_PRIV_DMA
,