From 90e983fe3139e95c12cb2b82c7153c8e50c9a835 Mon Sep 17 00:00:00 2001 From: Ren Jianing Date: Wed, 18 Nov 2020 20:48:23 +0800 Subject: [PATCH] phy: rockchip: inno-usb2: add tuning function for rk3568 We turn off the differential reciver in suspend mode, which can save about 300uA at AVCC_1V8 in suspend mode. Signed-off-by: Ren Jianing Change-Id: Ic9f2b931d7ee3fc687d8bb3f3e9dfe2d966c6542 --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 615b285b1127..e140abdb07ce 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -2198,6 +2198,17 @@ static int rk3399_usb2phy_tuning(struct rockchip_usb2phy *rphy) return ret; } +static int rk3568_usb2phy_tuning(struct rockchip_usb2phy *rphy) +{ + u32 reg; + + reg = readl(rphy->phy_base + 0x30); + /* turn off differential reciver in suspend mode */ + writel(reg & ~BIT(2), rphy->phy_base + 0x30); + + return 0; +} + #ifdef CONFIG_PM_SLEEP static int rockchip_usb2phy_pm_suspend(struct device *dev) { @@ -2795,6 +2806,7 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { { .reg = 0xfe8a0000, .num_ports = 2, + .phy_tuning = rk3568_usb2phy_tuning, .clkout_ctl = { 0x0008, 4, 4, 1, 0 }, .port_cfgs = { [USB2PHY_PORT_OTG] = { @@ -2845,6 +2857,7 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { { .reg = 0xfe8b0000, .num_ports = 2, + .phy_tuning = rk3568_usb2phy_tuning, .clkout_ctl = { 0x0008, 4, 4, 1, 0 }, .port_cfgs = { [USB2PHY_PORT_OTG] = {