ARM: uniphier: enable clocks to MIO/STDMAC on LD11 if USB is enabled
[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 <linux/bitops.h>
9 #include <linux/io.h>
10
11 #include "../init.h"
12 #include "../sc64-regs.h"
13 #include "../sg-regs.h"
14
15 void uniphier_ld11_clk_init(void)
16 {
17         if (readl(SG_PINMON0) & BIT(27)) {
18                 /* if booted without stand-by MPU */
19
20                 writel(1, SG_ETPHYPSHUT);
21                 writel(1, SG_ETPHYCNT);
22
23                 udelay(1); /* wait for regulator level 1.1V -> 2.5V */
24
25                 writel(3, SG_ETPHYCNT);
26                 writel(3, SG_ETPHYPSHUT);
27                 writel(7, SG_ETPHYCNT);
28         }
29
30 #ifdef CONFIG_USB_EHCI
31         {
32                 /* FIXME: the current clk driver can not handle parents */
33                 u32 tmp;
34                 tmp = readl(SC_CLKCTRL4);
35                 tmp |= SC_CLKCTRL4_MIO | SC_CLKCTRL4_STDMAC;
36                 writel(tmp, SC_CLKCTRL4);
37         }
38 #endif
39 }