Commit 0c77106095755c76de37dc51a0719dd7bb2c95ed

Authored by Nikhil Badola
Committed by York Sun
1 parent 98cb0efde8

drivers:usb: Add device-tree fixup to identify socs having dual phy

Identify soc(s) having dual phy so as to add "utmi_dual" as phy_mode
for all these socs. This is required for supporting deel-sleep feature
in linux for usb driver

Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
Signed-off-by: Nikhil Badola <nikhil.badola@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>

Showing 2 changed files with 38 additions and 1 deletions Side-by-side Diff

drivers/usb/host/ehci-fsl.c
... ... @@ -259,7 +259,7 @@
259 259 void fdt_fixup_dr_usb(void *blob, bd_t *bd)
260 260 {
261 261 static const char * const modes[] = { "host", "peripheral", "otg" };
262   - static const char * const phys[] = { "ulpi", "utmi" };
  262 + static const char * const phys[] = { "ulpi", "utmi", "utmi_dual" };
263 263 int usb_erratum_a006261_off = -1;
264 264 int usb_erratum_a007075_off = -1;
265 265 int usb_erratum_a007792_off = -1;
... ... @@ -303,6 +303,9 @@
303 303 dr_phy_type = phys[phy_idx];
304 304 }
305 305  
  306 + if (has_dual_phy())
  307 + dr_phy_type = phys[2];
  308 +
306 309 usb_mode_off = fdt_fixup_usb_mode_phy_type(blob,
307 310 dr_mode_type, NULL,
308 311 usb_mode_off);
... ... @@ -325,6 +328,7 @@
325 328 if (usb_erratum_a006261_off < 0)
326 329 return;
327 330 }
  331 +
328 332 if (has_erratum_a007075()) {
329 333 usb_erratum_a007075_off = fdt_fixup_usb_erratum
330 334 (blob,
... ... @@ -333,6 +337,7 @@
333 337 if (usb_erratum_a007075_off < 0)
334 338 return;
335 339 }
  340 +
336 341 if (has_erratum_a007792()) {
337 342 usb_erratum_a007792_off = fdt_fixup_usb_erratum
338 343 (blob,
... ... @@ -87,6 +87,33 @@
87 87  
88 88 /* USB Erratum Checking code */
89 89 #ifdef CONFIG_PPC
  90 +static inline bool has_dual_phy(void)
  91 +{
  92 + u32 svr = get_svr();
  93 + u32 soc = SVR_SOC_VER(svr);
  94 +
  95 + switch (soc) {
  96 + case SVR_T1023:
  97 + case SVR_T1024:
  98 + case SVR_T1013:
  99 + case SVR_T1014:
  100 + return IS_SVR_REV(svr, 1, 0);
  101 + case SVR_T1040:
  102 + case SVR_T1042:
  103 + case SVR_T1020:
  104 + case SVR_T1022:
  105 + case SVR_T2080:
  106 + case SVR_T2081:
  107 + return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 1, 1);
  108 + case SVR_T4240:
  109 + case SVR_T4160:
  110 + case SVR_T4080:
  111 + return IS_SVR_REV(svr, 1, 0) || IS_SVR_REV(svr, 2, 0);
  112 + }
  113 +
  114 + return false;
  115 +}
  116 +
90 117 static inline bool has_erratum_a006261(void)
91 118 {
92 119 u32 svr = get_svr();
... ... @@ -165,6 +192,11 @@
165 192 }
166 193  
167 194 #else
  195 +static inline bool has_dual_phy(void)
  196 +{
  197 + return false;
  198 +}
  199 +
168 200 static inline bool has_erratum_a006261(void)
169 201 {
170 202 return false;