clk-ld11.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2016 Socionext Inc.
  4. */
  5. #include <common.h>
  6. #include <spl.h>
  7. #include <linux/bitops.h>
  8. #include <linux/delay.h>
  9. #include <linux/io.h>
  10. #include "../init.h"
  11. #include "../sc64-regs.h"
  12. #include "../sg-regs.h"
  13. #define SDCTRL_EMMC_HW_RESET 0x59810280
  14. void uniphier_ld11_clk_init(void)
  15. {
  16. /* if booted from a device other than USB, without stand-by MPU */
  17. if ((readl(sg_base + SG_PINMON0) & BIT(27)) &&
  18. uniphier_boot_device_raw() != BOOT_DEVICE_USB) {
  19. writel(1, sg_base + SG_ETPHYPSHUT);
  20. writel(1, sg_base + SG_ETPHYCNT);
  21. udelay(1); /* wait for regulator level 1.1V -> 2.5V */
  22. writel(3, sg_base + SG_ETPHYCNT);
  23. writel(3, sg_base + SG_ETPHYPSHUT);
  24. writel(7, sg_base + SG_ETPHYCNT);
  25. }
  26. /* TODO: use "mmc-pwrseq-emmc" */
  27. writel(1, SDCTRL_EMMC_HW_RESET);
  28. #ifdef CONFIG_USB_EHCI_HCD
  29. {
  30. int ch;
  31. for (ch = 0; ch < 3; ch++) {
  32. void __iomem *phyctrl = sg_base + SG_USBPHYCTRL;
  33. writel(0x82280600, phyctrl + 8 * ch);
  34. writel(0x00000106, phyctrl + 8 * ch + 4);
  35. }
  36. }
  37. #endif
  38. }