The phy utmi width information is already set in hsotg params,
phyif is only used in few places and I don't see any reason to
not use hsotg's params.

Moreover the utmi width was being forced to 16 bits by platform
initialization which doesn't take in account HW configuration.

Signed-off-by: Jules Maselbas <jmasel...@kalray.eu>
---
 drivers/usb/dwc2/core.h     | 2 --
 drivers/usb/dwc2/gadget.c   | 4 ++--
 drivers/usb/dwc2/platform.c | 5 +----
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 1fad5dcbcd81..96cf645e53fe 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -869,7 +869,6 @@ struct dwc2_hregs_backup {
  *                      removed once all SoCs support usb transceiver.
  * @supplies:           Definition of USB power supplies
  * @vbus_supply:        Regulator supplying vbus.
- * @phyif:              PHY interface width
  * @lock:              Spinlock that protects all the driver data structures
  * @priv:              Stores a pointer to the struct usb_hcd
  * @queuing_high_bandwidth: True if multiple packets of a high-bandwidth
@@ -1052,7 +1051,6 @@ struct dwc2_hsotg {
        struct dwc2_hsotg_plat *plat;
        struct regulator_bulk_data supplies[DWC2_NUM_SUPPLIES];
        struct regulator *vbus_supply;
-       u32 phyif;
 
        spinlock_t lock;
        void *priv;
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 36ba391a715f..41efe1b859ff 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3324,8 +3324,8 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg 
*hsotg,
                usbcfg |= GUSBCFG_PHYSEL;
        } else {
                /* set the PLL on, remove the HNP/SRP and set the PHY */
-               val = (hsotg->phyif == GUSBCFG_PHYIF8) ? 9 : 5;
-               usbcfg |= hsotg->phyif | GUSBCFG_TOUTCAL(7) |
+               val = (hsotg->params.phy_utmi_width == GUSBCFG_PHYIF8) ? 9 : 5;
+               usbcfg |= hsotg->params.phy_utmi_width | GUSBCFG_TOUTCAL(7) |
                        (val << GUSBCFG_USBTRDTIM_SHIFT);
        }
        dwc2_writel(hsotg, usbcfg, GUSBCFG);
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index c0b64d483552..f126591f06b0 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -230,9 +230,6 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
 
        reset_control_deassert(hsotg->reset_ecc);
 
-       /* Set default UTMI width */
-       hsotg->phyif = GUSBCFG_PHYIF16;
-
        /*
         * Attempt to find a generic PHY, then look for an old style
         * USB PHY and then fall back to pdata
@@ -280,7 +277,7 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
                 * width is 8-bit and set the phyif appropriately.
                 */
                if (phy_get_bus_width(hsotg->phy) == 8)
-                       hsotg->phyif = GUSBCFG_PHYIF8;
+                       hsotg->params.phy_utmi_width = 8;
        }
 
        /* Clock */
-- 
2.21.0.196.g041f5ea

Reply via email to