<div>This patch should be used to get QE USB host mode working on mpc832x and mpc8360 </div><div>based devices. It fixes the following issues:</div><div><br></div><div>- BRG divisor shall not be an add number greater than 3.</div>

<div>- USB param block in multi-user ram can't be accessed at default location on mpc832x </div><div>  device. Allocate it dynamically.</div><div><br></div><div>These changes have been tested on mpc8360-rdk board as well as mpc8321e based design.</div>

<div>On the mpc832x devices, the QE_USB3 microcode patch is required, and has to be loaded </div><div>early during initialization sequence.</div><div><br></div><div>These changes are partially based on an earlier patch from Marcel Ziswiler, </div>

<div><a href="http://lkml.indiana.edu/hypermail/linux/kernel/0904.0/00479.html" style="font-family:Times;font-size:medium;background-color:rgb(255,255,255)">[PATCH] QE USB Host Integration for MPC832x"</a></div><div>

<br></div><div>-Ben</div><div>----</div><div><br></div><div>diff -Naur linux-2.6.34.13.orig/arch/powerpc/sysdev/qe_lib/qe.c linux-2.6.34.13.new/arch/powerpc/sysdev/qe_lib/qe.c</div><div>--- linux-2.6.34.13.orig/arch/powerpc/sysdev/qe_lib/qe.c        2012-08-20 14:45:22.000000000 -0400</div>

<div>+++ linux-2.6.34.13.new/arch/powerpc/sysdev/qe_lib/qe.c 2012-08-22 21:51:05.093065082 -0400</div><div>@@ -215,8 +215,8 @@</div><div> </div><div>        /* Errata QE_General4, which affects some MPC832x and MPC836x SOCs, says</div>

<div>           that the BRG divisor must be even if you're not using divide-by-16</div><div>-          mode. */</div><div>-       if (!div16 && (divisor & 1))</div><div>+          mode, and is greater than 3. */</div>

<div>+       if (!div16 && (divisor & 1) && (divisor > 3))</div><div>                divisor++;</div><div> </div><div>        tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) |</div><div>diff -Naur linux-2.6.34.13.orig/drivers/usb/host/fhci-hcd.c linux-2.6.34.13.new/drivers/usb/host/fhci-hcd.c</div>

<div>--- linux-2.6.34.13.orig/drivers/usb/host/fhci-hcd.c    2012-08-20 14:45:22.000000000 -0400</div><div>+++ linux-2.6.34.13.new/drivers/usb/host/fhci-hcd.c     2012-08-22 22:39:00.453065145 -0400</div><div>@@ -614,15 +614,8 @@</div>

<div>        }</div><div>        fhci->regs = hcd->regs;</div><div> </div><div>-       /* Parameter RAM. */</div><div>-       iprop = of_get_property(node, "reg", &size);</div><div>-       if (!iprop || size < sizeof(*iprop) * 4) {</div>

<div>-               dev_err(dev, "can't get pram offset\n");</div><div>-               ret = -EINVAL;</div><div>-               goto err_pram;</div><div>-       }</div><div>-</div><div>-       pram_addr = cpm_muram_alloc_fixed(iprop[2], FHCI_PRAM_SIZE);</div>

<div>+       /* Dynamically allocate USB Parameter RAM. */</div><div>+       pram_addr = qe_muram_alloc(FHCI_PRAM_SIZE, 64);</div><div>        if (IS_ERR_VALUE(pram_addr)) {</div><div>                dev_err(dev, "failed to allocate usb pram\n");</div>

<div>                ret = -ENOMEM;</div><div>@@ -630,6 +623,11 @@</div><div>        }</div><div>        fhci->pram = cpm_muram_addr(pram_addr);</div><div> </div><div>+       /* On mpc832x devices the usb param base address is outside the 16K MURAM</div>

<div>+          space, and therefore must be remapped via QE Assign Page command. */</div><div>+       qe_issue_cmd(QE_ASSIGN_PAGE_TO_DEVICE, QE_CR_SUBBLOCK_USB,                                                                                           </div>

<div>+               QE_CR_PROTOCOL_UNSPECIFIED, pi->pram_addr);   </div><div>+</div><div>        /* GPIOs and pins */</div><div>        for (i = 0; i < NUM_GPIOS; i++) {</div><div>                int gpio;</div>