From f14ef60afd2683311fd525f4d4efa80159dc1347 Mon Sep 17 00:00:00 2001 From: William Wu Date: Fri, 11 Mar 2022 17:23:34 +0800 Subject: [PATCH] phy: rockchip: inno-usb2: set bvalid to high by grf for rv1103 RV1103 doesn't have VBUSDET pin for the usb phy to detect the USB VBUS, and the default status of bvalid is inactive(low level), it cause the dwc3 controller fail to start usb device connection, so it needs to set bvalid to high by grf for RV1103. Signed-off-by: William Wu Change-Id: If63c68270c14ff8fa402805a33ce3061f6f796ab --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index a1e1c3d31dda..26c27e56a446 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -2053,9 +2053,22 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy, rport->mode == USB_DR_MODE_UNKNOWN) goto out; - /* Select bvalid of usb phy as bvalid of usb controller */ - if (rport->port_cfg->bvalid_grf_sel.enable != 0) - property_enable(base, &rport->port_cfg->bvalid_grf_sel, false); + /* + * Set the utmi bvalid come from the usb phy or grf. + * For most of Rockchip SoCs, them have VBUSDET pin + * for the usb phy to detect the USB VBUS and set + * the bvalid signal, so select the bvalid from the + * usb phy by default. And for those SoCs which don't + * have VBUSDET pin (e.g. RV1103), it needs to select + * the bvaid from the grf and set bvalid to be valid + * (high) by default. + */ + if (rport->port_cfg->bvalid_grf_sel.enable != 0) { + if (of_machine_is_compatible("rockchip,rv1103")) + property_enable(base, &rport->port_cfg->bvalid_grf_sel, true); + else + property_enable(base, &rport->port_cfg->bvalid_grf_sel, false); + } wake_lock_init(&rport->wakelock, WAKE_LOCK_SUSPEND, "rockchip_otg"); INIT_DELAYED_WORK(&rport->bypass_uart_work,