[PATCH] QE USB host fix for mpc832x

Ben Dubb ben.dubb at gmail.com
Thu Aug 23 13:54:25 EST 2012


This patch should be used to get QE USB host mode working on mpc832x and
mpc8360
based devices. It fixes the following issues:

- BRG divisor shall not be an add number greater than 3.
- USB param block in multi-user ram can't be accessed at default location
on mpc832x
  device. Allocate it dynamically.

These changes have been tested on mpc8360-rdk board as well as mpc8321e
based design.
On the mpc832x devices, the QE_USB3 microcode patch is required, and has to
be loaded
early during initialization sequence.

These changes are partially based on an earlier patch from Marcel Ziswiler,
[PATCH] QE USB Host Integration for
MPC832x"<http://lkml.indiana.edu/hypermail/linux/kernel/0904.0/00479.html>

-Ben
----

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
--- linux-2.6.34.13.orig/arch/powerpc/sysdev/qe_lib/qe.c        2012-08-20
14:45:22.000000000 -0400
+++ linux-2.6.34.13.new/arch/powerpc/sysdev/qe_lib/qe.c 2012-08-22
21:51:05.093065082 -0400
@@ -215,8 +215,8 @@

        /* Errata QE_General4, which affects some MPC832x and MPC836x SOCs,
says
           that the BRG divisor must be even if you're not using
divide-by-16
-          mode. */
-       if (!div16 && (divisor & 1))
+          mode, and is greater than 3. */
+       if (!div16 && (divisor & 1) && (divisor > 3))
                divisor++;

        tempval = ((divisor - 1) << QE_BRGC_DIVISOR_SHIFT) |
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
--- linux-2.6.34.13.orig/drivers/usb/host/fhci-hcd.c    2012-08-20
14:45:22.000000000 -0400
+++ linux-2.6.34.13.new/drivers/usb/host/fhci-hcd.c     2012-08-22
22:39:00.453065145 -0400
@@ -614,15 +614,8 @@
        }
        fhci->regs = hcd->regs;

-       /* Parameter RAM. */
-       iprop = of_get_property(node, "reg", &size);
-       if (!iprop || size < sizeof(*iprop) * 4) {
-               dev_err(dev, "can't get pram offset\n");
-               ret = -EINVAL;
-               goto err_pram;
-       }
-
-       pram_addr = cpm_muram_alloc_fixed(iprop[2], FHCI_PRAM_SIZE);
+       /* Dynamically allocate USB Parameter RAM. */
+       pram_addr = qe_muram_alloc(FHCI_PRAM_SIZE, 64);
        if (IS_ERR_VALUE(pram_addr)) {
                dev_err(dev, "failed to allocate usb pram\n");
                ret = -ENOMEM;
@@ -630,6 +623,11 @@
        }
        fhci->pram = cpm_muram_addr(pram_addr);

+       /* On mpc832x devices the usb param base address is outside the 16K
MURAM
+          space, and therefore must be remapped via QE Assign Page
command. */
+       qe_issue_cmd(QE_ASSIGN_PAGE_TO_DEVICE, QE_CR_SUBBLOCK_USB,


+               QE_CR_PROTOCOL_UNSPECIFIED, pi->pram_addr);
+
        /* GPIOs and pins */
        for (i = 0; i < NUM_GPIOS; i++) {
                int gpio;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20120822/d84363a0/attachment.html>


More information about the Linuxppc-dev mailing list