]>
git.ipfire.org Git - people/ms/u-boot.git/blob - drivers/usb/host/ohci-at91.c
3 * DENX Software Engineering <mk@denx.de>
5 * SPDX-License-Identifier: GPL-2.0+
10 #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT)
13 #include <asm/arch/hardware.h>
14 #include <asm/arch/at91_pmc.h>
15 #include <asm/arch/clk.h>
17 int usb_cpu_init(void)
19 at91_pmc_t
*pmc
= (at91_pmc_t
*)ATMEL_BASE_PMC
;
21 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
22 defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20) || \
23 defined(CONFIG_AT91SAM9261)
25 writel(get_pllb_init(), &pmc
->pllbr
);
26 while ((readl(&pmc
->sr
) & AT91_PMC_LOCKB
) != AT91_PMC_LOCKB
)
28 #elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) || \
29 defined(CONFIG_AT91SAM9X5) || defined(CONFIG_SAMA5D3)
31 writel(readl(&pmc
->uckr
) | AT91_PMC_UPLLEN
| AT91_PMC_BIASEN
,
33 while ((readl(&pmc
->sr
) & AT91_PMC_LOCKU
) != AT91_PMC_LOCKU
)
36 /* Select PLLA as input clock of OHCI */
37 writel(AT91_PMC_USBS_USB_UPLL
| AT91_PMC_USBDIV_10
, &pmc
->usb
);
40 /* Enable USB host clock. */
42 writel(1 << (ATMEL_ID_UHP
- 32), &pmc
->pcer1
);
44 writel(1 << ATMEL_ID_UHP
, &pmc
->pcer
);
47 #if defined(CONFIG_AT91SAM9261) || defined(CONFIG_AT91SAM9G10)
48 writel(ATMEL_PMC_UHP
| AT91_PMC_HCK0
, &pmc
->scer
);
50 writel(ATMEL_PMC_UHP
, &pmc
->scer
);
56 int usb_cpu_stop(void)
58 at91_pmc_t
*pmc
= (at91_pmc_t
*)ATMEL_BASE_PMC
;
60 /* Disable USB host clock. */
62 writel(1 << (ATMEL_ID_UHP
- 32), &pmc
->pcdr1
);
64 writel(1 << ATMEL_ID_UHP
, &pmc
->pcdr
);
67 #if defined(CONFIG_AT91SAM9261) || defined(CONFIG_AT91SAM9G10)
68 writel(ATMEL_PMC_UHP
| AT91_PMC_HCK0
, &pmc
->scdr
);
70 writel(ATMEL_PMC_UHP
, &pmc
->scdr
);
73 #if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
74 defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
76 writel(0, &pmc
->pllbr
);
77 while ((readl(&pmc
->sr
) & AT91_PMC_LOCKB
) != 0)
79 #elif defined(CONFIG_AT91SAM9G45) || defined(CONFIG_AT91SAM9M10G45) || \
80 defined(CONFIG_AT91SAM9X5) || defined(CONFIG_SAMA5D3)
82 writel(readl(&pmc
->uckr
) & (~AT91_PMC_UPLLEN
), &pmc
->uckr
);
83 while ((readl(&pmc
->sr
) & AT91_PMC_LOCKU
) == AT91_PMC_LOCKU
)
90 int usb_cpu_init_fail(void)
92 return usb_cpu_stop();
95 #endif /* defined(CONFIG_USB_OHCI) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT) */