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