Commit 347631bcddbfb3041b84e9b3a1812b4874c66b2d
Committed by
Marek Vasut
1 parent
1ce5f1f933
Exists in
smarc_8mq_lf_v2020.04
and in
11 other branches
board: ti: am43xx: turn on USB clocks
Enable USB clocks in late init stage to support ports under DM_USB. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com>
Showing 1 changed file with 22 additions and 0 deletions Side-by-side Diff
board/ti/am43xx/board.c
... | ... | @@ -705,6 +705,19 @@ |
705 | 705 | } |
706 | 706 | |
707 | 707 | #ifdef CONFIG_BOARD_LATE_INIT |
708 | +#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL) | |
709 | +static int device_okay(const char *path) | |
710 | +{ | |
711 | + int node; | |
712 | + | |
713 | + node = fdt_path_offset(gd->fdt_blob, path); | |
714 | + if (node < 0) | |
715 | + return 0; | |
716 | + | |
717 | + return fdtdec_get_is_enabled(gd->fdt_blob, node); | |
718 | +} | |
719 | +#endif | |
720 | + | |
708 | 721 | int board_late_init(void) |
709 | 722 | { |
710 | 723 | #ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG |
711 | 724 | |
... | ... | @@ -717,10 +730,18 @@ |
717 | 730 | if (get_device_type() == HS_DEVICE) |
718 | 731 | env_set("boot_fit", "1"); |
719 | 732 | #endif |
733 | + | |
734 | +#if CONFIG_IS_ENABLED(DM_USB) && CONFIG_IS_ENABLED(OF_CONTROL) | |
735 | + if (device_okay("/ocp/omap_dwc3@48380000")) | |
736 | + enable_usb_clocks(0); | |
737 | + if (device_okay("/ocp/omap_dwc3@483c0000")) | |
738 | + enable_usb_clocks(1); | |
739 | +#endif | |
720 | 740 | return 0; |
721 | 741 | } |
722 | 742 | #endif |
723 | 743 | |
744 | +#if !CONFIG_IS_ENABLED(DM_USB_GADGET) | |
724 | 745 | #ifdef CONFIG_USB_DWC3 |
725 | 746 | static struct dwc3_device usb_otg_ss1 = { |
726 | 747 | .maximum_speed = USB_SPEED_HIGH, |
... | ... | @@ -823,6 +844,7 @@ |
823 | 844 | return 0; |
824 | 845 | } |
825 | 846 | #endif /* defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP) */ |
847 | +#endif /* !CONFIG_IS_ENABLED(DM_USB_GADGET) */ | |
826 | 848 | |
827 | 849 | #ifdef CONFIG_DRIVER_TI_CPSW |
828 | 850 |