2016-05-24 12:14:01 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 Socionext Inc.
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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);
|
|
|
|
|
2016-10-27 14:47:05 +00:00
|
|
|
#ifdef CONFIG_USB_EHCI
|
|
|
|
{
|
|
|
|
/* FIXME: the current clk driver can not handle parents */
|
|
|
|
u32 tmp;
|
|
|
|
tmp = readl(SC_CLKCTRL4);
|
|
|
|
tmp |= SC_CLKCTRL4_MIO | SC_CLKCTRL4_STDMAC;
|
|
|
|
writel(tmp, SC_CLKCTRL4);
|
|
|
|
}
|
|
|
|
#endif
|
2016-05-24 12:14:01 +00:00
|
|
|
}
|