From ca9f99df1563b2d00ffacfe0775e83f89c629f25 Mon Sep 17 00:00:00 2001 From: Frank Wang Date: Wed, 6 Mar 2019 16:48:06 +0800 Subject: [PATCH] phy: rockchip-inno-usb2: add rk3328 tuning support Due to usb-phy tuning framework is not added in UPSTREAM codes, so rk3328 tuning is striped in mainline, this commit make a supplement. Change-Id: Id8103d65951515b9b21baab14f7125420cea78eb Signed-off-by: Frank Wang --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index d7263ae54b20..2371ad98cabc 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1873,6 +1873,31 @@ static int rk312x_usb2phy_tuning(struct rockchip_usb2phy *rphy) return 0; } +static int rk3328_usb2phy_tuning(struct rockchip_usb2phy *rphy) +{ + int ret; + + /* Open debug mode for tuning */ + ret = regmap_write(rphy->grf, 0x2c, 0xffff0400); + if (ret) + return ret; + + /* + * Open HS pre-emphasize function to increase + * HS slew rate for host port + */ + ret = regmap_write(rphy->grf, 0x30, 0xffff851d); + if (ret) + return ret; + + /* Turn off differential receiver in suspend mode */ + ret = regmap_write(rphy->grf, 0x18, 0x00040000); + if (ret) + return ret; + + return 0; +} + static int rk3366_usb2phy_tuning(struct rockchip_usb2phy *rphy) { unsigned int open_pre_emphasize = 0xffff851f; @@ -2186,6 +2211,7 @@ static const struct rockchip_usb2phy_cfg rk3328_phy_cfgs[] = { { .reg = 0x100, .num_ports = 2, + .phy_tuning = rk3328_usb2phy_tuning, .clkout_ctl = { 0x108, 4, 4, 1, 0 }, .port_cfgs = { [USB2PHY_PORT_OTG] = {