clk-ld11.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (C) 2016 Socionext Inc.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <spl.h>
  8. #include <linux/bitops.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_PINMON0) & BIT(27)) &&
  18. uniphier_boot_device_raw() != BOOT_DEVICE_USB) {
  19. writel(1, SG_ETPHYPSHUT);
  20. writel(1, SG_ETPHYCNT);
  21. udelay(1); /* wait for regulator level 1.1V -> 2.5V */
  22. writel(3, SG_ETPHYCNT);
  23. writel(3, SG_ETPHYPSHUT);
  24. writel(7, SG_ETPHYCNT);
  25. }
  26. /* TODO: use "mmc-pwrseq-emmc" */
  27. writel(1, SDCTRL_EMMC_HW_RESET);
  28. #ifdef CONFIG_USB_EHCI_HCD
  29. {
  30. /* FIXME: the current clk driver can not handle parents */
  31. u32 tmp;
  32. int ch;
  33. tmp = readl(SC_CLKCTRL4);
  34. tmp |= BIT(10) | BIT(8); /* MIO, STDMAC */
  35. writel(tmp, SC_CLKCTRL4);
  36. for (ch = 0; ch < 3; ch++) {
  37. void __iomem *phyctrl = (void __iomem *)SG_USBPHYCTRL;
  38. writel(0x82280600, phyctrl + 8 * ch);
  39. writel(0x00000106, phyctrl + 8 * ch + 4);
  40. }
  41. }
  42. #endif
  43. }