From 42de8afc40c97002fceb500e2331f6a722be3c14 Mon Sep 17 00:00:00 2001 From: Jules Maselbas Date: Thu, 9 May 2019 11:15:28 +0200 Subject: usb: dwc2: Use generic PHY width in params setup Setting params.phy_utmi_width in dwc2_lowlevel_hw_init() is pointless since it's value will be overwritten by dwc2_init_params(). This change make sure to take in account the generic PHY width information during paraminitialisation, done in dwc2_set_param_phy_utmi_width(). By doing so, the phy_utmi_width params can still be overrided by devicetree specific params and will also be checked against hardware capabilities. Fixes: 707d80f0a3c5 ("usb: dwc2: gadget: Replace phyif with phy_utmi_width") Acked-by: Minas Harutyunyan Tested-by: Marek Szyprowski Signed-off-by: Jules Maselbas Signed-off-by: Felipe Balbi --- drivers/usb/dwc2/params.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'drivers/usb/dwc2/params.c') diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c index 6900eea57526..5949262ff669 100644 --- a/drivers/usb/dwc2/params.c +++ b/drivers/usb/dwc2/params.c @@ -253,6 +253,15 @@ static void dwc2_set_param_phy_utmi_width(struct dwc2_hsotg *hsotg) val = (hsotg->hw_params.utmi_phy_data_width == GHWCFG4_UTMI_PHY_DATA_WIDTH_8) ? 8 : 16; + if (hsotg->phy) { + /* + * If using the generic PHY framework, check if the PHY bus + * width is 8-bit and set the phyif appropriately. + */ + if (phy_get_bus_width(hsotg->phy) == 8) + val = 8; + } + hsotg->params.phy_utmi_width = val; } -- cgit v1.2.3