2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2016-05-24 12:14:01 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Socionext Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2016-10-27 14:47:06 +00:00
|
|
|
#include <spl.h>
|
2016-05-24 12:14:01 +00:00
|
|
|
#include <linux/bitops.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
|
|
|
|
#include "../init.h"
|
2016-10-27 14:47:05 +00:00
|
|
|
#include "../sc64-regs.h"
|
2016-05-24 12:14:01 +00:00
|
|
|
#include "../sg-regs.h"
|
|
|
|
|
2017-02-17 07:17:22 +00:00
|
|
|
#define SDCTRL_EMMC_HW_RESET 0x59810280
|
|
|
|
|
2016-05-24 12:14:01 +00:00
|
|
|
void uniphier_ld11_clk_init(void)
|
|
|
|
{
|
2016-10-27 14:47:06 +00:00
|
|
|
/* if booted from a device other than USB, without stand-by MPU */
|
|
|
|
if ((readl(SG_PINMON0) & BIT(27)) &&
|
2017-02-13 16:24:26 +00:00
|
|
|
uniphier_boot_device_raw() != BOOT_DEVICE_USB) {
|
2016-05-24 12:14:01 +00:00
|
|
|
writel(1, SG_ETPHYPSHUT);
|
|
|
|
writel(1, SG_ETPHYCNT);
|
|
|
|
|
|
|
|
udelay(1); /* wait for regulator level 1.1V -> 2.5V */
|
|
|
|
|
|
|
|
writel(3, SG_ETPHYCNT);
|
|
|
|
writel(3, SG_ETPHYPSHUT);
|
|
|
|
writel(7, SG_ETPHYCNT);
|
|
|
|
}
|
2016-10-27 14:47:05 +00:00
|
|
|
|
2017-02-17 07:17:22 +00:00
|
|
|
/* TODO: use "mmc-pwrseq-emmc" */
|
|
|
|
writel(1, SDCTRL_EMMC_HW_RESET);
|
|
|
|
|
2017-05-13 02:33:27 +00:00
|
|
|
#ifdef CONFIG_USB_EHCI_HCD
|
2016-10-27 14:47:05 +00:00
|
|
|
{
|
|
|
|
/* FIXME: the current clk driver can not handle parents */
|
|
|
|
u32 tmp;
|
2017-04-14 02:30:05 +00:00
|
|
|
int ch;
|
|
|
|
|
2016-10-27 14:47:05 +00:00
|
|
|
tmp = readl(SC_CLKCTRL4);
|
2017-09-15 12:43:21 +00:00
|
|
|
tmp |= BIT(10) | BIT(8); /* MIO, STDMAC */
|
2016-10-27 14:47:05 +00:00
|
|
|
writel(tmp, SC_CLKCTRL4);
|
2017-04-14 02:30:05 +00:00
|
|
|
|
|
|
|
for (ch = 0; ch < 3; ch++) {
|
|
|
|
void __iomem *phyctrl = (void __iomem *)SG_USBPHYCTRL;
|
|
|
|
|
|
|
|
writel(0x82280600, phyctrl + 8 * ch);
|
|
|
|
writel(0x00000106, phyctrl + 8 * ch + 4);
|
|
|
|
}
|
2016-10-27 14:47:05 +00:00
|
|
|
}
|
|
|
|
#endif
|
2016-05-24 12:14:01 +00:00
|
|
|
}
|