phy: rockchip: inno-usb2: set bvalid and id filter time for rk356x

This patch sets the bvalid and id filter time to 10ms for rk356x
USB 2.0 PHY0 which is used for OTG. The filter count is base on
the USB 2.0 PHY GRF pclk 100MHz.

With this patch, it can avoid trigger the bvalid rising edge irq
when unplug the OTG cable.

Change-Id: I95794510921e6c065f4ec1102ab6c1f35994bf42
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2021-02-01 20:14:19 +08:00
committed by Tao Huang
parent 04d2305960
commit bc2fd405a7

View File

@@ -43,6 +43,7 @@
#define SCHEDULE_DELAY (60 * HZ)
#define OTG_SCHEDULE_DELAY (1 * HZ)
#define BYPASS_SCHEDULE_DELAY (2 * HZ)
#define FILTER_COUNTER 0xF4240
struct rockchip_usb2phy;
@@ -2232,12 +2233,27 @@ static int rk3399_usb2phy_tuning(struct rockchip_usb2phy *rphy)
static int rk3568_usb2phy_tuning(struct rockchip_usb2phy *rphy)
{
u32 reg;
int ret = 0;
reg = readl(rphy->phy_base + 0x30);
/* turn off differential reciver in suspend mode */
writel(reg & ~BIT(2), rphy->phy_base + 0x30);
return 0;
if (rphy->phy_cfg->reg == 0xfe8a0000) {
/*
* Set the bvalid filter time to 10ms
* based on the usb2 phy grf pclk 100MHz.
*/
ret |= regmap_write(rphy->grf, 0x0048, FILTER_COUNTER);
/*
* Set the id filter time to 10ms based
* on the usb2 phy grf pclk 100MHz.
*/
ret |= regmap_write(rphy->grf, 0x004c, FILTER_COUNTER);
}
return ret;
}
static int rk3568_vbus_detect_control(struct rockchip_usb2phy *rphy, bool en)