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 */
|
2019-07-10 11:07:40 +00:00
|
|
|
if ((readl(sg_base + SG_PINMON0) & BIT(27)) &&
|
2017-02-13 16:24:26 +00:00
|
|
|
uniphier_boot_device_raw() != BOOT_DEVICE_USB) {
|
2019-07-10 11:07:40 +00:00
|
|
|
writel(1, sg_base + SG_ETPHYPSHUT);
|
|
|
|
writel(1, sg_base + SG_ETPHYCNT);
|
2016-05-24 12:14:01 +00:00
|
|
|
|
|
|
|
udelay(1); /* wait for regulator level 1.1V -> 2.5V */
|
|
|
|
|
2019-07-10 11:07:40 +00:00
|
|
|
writel(3, sg_base + SG_ETPHYCNT);
|
|
|
|
writel(3, sg_base + SG_ETPHYPSHUT);
|
|
|
|
writel(7, sg_base + SG_ETPHYCNT);
|
2016-05-24 12:14:01 +00:00
|
|
|
}
|
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
|
|
|
{
|
2017-04-14 02:30:05 +00:00
|
|
|
int ch;
|
|
|
|
|
|
|
|
for (ch = 0; ch < 3; ch++) {
|
2019-07-10 11:07:40 +00:00
|
|
|
void __iomem *phyctrl = sg_base + SG_USBPHYCTRL;
|
2017-04-14 02:30:05 +00:00
|
|
|
|
|
|
|
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
|
|
|
}
|