Masahiro Yamada | 8bbbcbd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 Socionext Inc. |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #include <common.h> |
Masahiro Yamada | d3a6781 | 2016-10-27 23:47:06 +0900 | [diff] [blame^] | 8 | #include <spl.h> |
Masahiro Yamada | 8bbbcbd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 9 | #include <linux/bitops.h> |
| 10 | #include <linux/io.h> |
| 11 | |
Masahiro Yamada | d3a6781 | 2016-10-27 23:47:06 +0900 | [diff] [blame^] | 12 | #include "../boot-mode/boot-device.h" |
Masahiro Yamada | 8bbbcbd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 13 | #include "../init.h" |
Masahiro Yamada | 77857e2 | 2016-10-27 23:47:05 +0900 | [diff] [blame] | 14 | #include "../sc64-regs.h" |
Masahiro Yamada | 8bbbcbd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 15 | #include "../sg-regs.h" |
| 16 | |
| 17 | void uniphier_ld11_clk_init(void) |
| 18 | { |
Masahiro Yamada | d3a6781 | 2016-10-27 23:47:06 +0900 | [diff] [blame^] | 19 | /* if booted from a device other than USB, without stand-by MPU */ |
| 20 | if ((readl(SG_PINMON0) & BIT(27)) && |
| 21 | spl_boot_device_raw() != BOOT_DEVICE_USB) { |
Masahiro Yamada | 8bbbcbd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 22 | writel(1, SG_ETPHYPSHUT); |
| 23 | writel(1, SG_ETPHYCNT); |
| 24 | |
| 25 | udelay(1); /* wait for regulator level 1.1V -> 2.5V */ |
| 26 | |
| 27 | writel(3, SG_ETPHYCNT); |
| 28 | writel(3, SG_ETPHYPSHUT); |
| 29 | writel(7, SG_ETPHYCNT); |
| 30 | } |
Masahiro Yamada | 77857e2 | 2016-10-27 23:47:05 +0900 | [diff] [blame] | 31 | |
| 32 | #ifdef CONFIG_USB_EHCI |
| 33 | { |
| 34 | /* FIXME: the current clk driver can not handle parents */ |
| 35 | u32 tmp; |
| 36 | tmp = readl(SC_CLKCTRL4); |
| 37 | tmp |= SC_CLKCTRL4_MIO | SC_CLKCTRL4_STDMAC; |
| 38 | writel(tmp, SC_CLKCTRL4); |
| 39 | } |
| 40 | #endif |
Masahiro Yamada | 8bbbcbd | 2016-05-24 21:14:01 +0900 | [diff] [blame] | 41 | } |