ARM: uniphier: rework spl_boot_device() and related code
[platform/kernel/u-boot.git] / arch / arm / mach-uniphier / clk / clk-ld11.c
1 /*
2  * Copyright (C) 2016 Socionext Inc.
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6
7 #include <common.h>
8 #include <spl.h>
9 #include <linux/bitops.h>
10 #include <linux/io.h>
11
12 #include "../init.h"
13 #include "../sc64-regs.h"
14 #include "../sg-regs.h"
15
16 void uniphier_ld11_clk_init(void)
17 {
18         /* if booted from a device other than USB, without stand-by MPU */
19         if ((readl(SG_PINMON0) & BIT(27)) &&
20             uniphier_boot_device_raw() != BOOT_DEVICE_USB) {
21                 writel(1, SG_ETPHYPSHUT);
22                 writel(1, SG_ETPHYCNT);
23
24                 udelay(1); /* wait for regulator level 1.1V -> 2.5V */
25
26                 writel(3, SG_ETPHYCNT);
27                 writel(3, SG_ETPHYPSHUT);
28                 writel(7, SG_ETPHYCNT);
29         }
30
31 #ifdef CONFIG_USB_EHCI
32         {
33                 /* FIXME: the current clk driver can not handle parents */
34                 u32 tmp;
35                 tmp = readl(SC_CLKCTRL4);
36                 tmp |= SC_CLKCTRL4_MIO | SC_CLKCTRL4_STDMAC;
37                 writel(tmp, SC_CLKCTRL4);
38         }
39 #endif
40 }