MPC8313E-RDB and USB OTG

Michael Bergandi mbergandi at gmail.com
Thu Feb 26 06:51:52 EST 2009


Hi all,

I am hoping someone can shed some light on the state of the USB support in
the
2.6.28 kernel for USB OTG on the MPC8313E RDB. The configuration options are
a bit different than the ones from the provided LTIB kernel--- for obvious
reasons---
and I am trying to figure out how to get OTG working in this version of the
kernel
on my board.

I have tried to configure the kernel as close as I could to the config for
the LTIB
kernel (2.6.23). This is what it looks like right now:

Kernel config
Device drivers --->
[*]   USB support --->
        --- USB support
        <*>   Support for Host-side USB
        [*]     USB verbose debug messages
        [*]     USB announce new devices

                 *** Miscellaneous USB options ***
        [*]     USB device filesystem
        [*]     USB device class-devices (DEPRECATED)
        [*]     USB Monitor

                    *** USB Host Controller Drivers ***
        <*>     EHCI HCD (USB 2.0) support
        -*-       Root Hub Transaction Translators
        [*]       Support for Freescale on-chip EHCI USB controller
        [*]       EHCI support for PPC USB controller on OF platform bus

                  *** USB Device Class drivers ***
        <*>   USB Mass Storage support
         [*]     USB Mass Storage verbose debug

                  *** USB Miscelaneous drivers ***
        <*>   USB Gadget Support  --->
                  --- USB gadget support
                  (2)   Maximum VBUS Power usage (2-500 mA)
                         USB Peripheral Controller (Freescale Highspeed USB
DR Peripheral Controller)  --->
                                 Freescale Highspeed USB DR Peripheral
Controller
                  <*>   USB Gadget Drivers (Ethernet Gadget (with CDC
Ethernet support))  --->
                                 Ethernet Gadget (with CDC Ethernet support)
                   [*]       RNDIS support

The device tree node seems to be pretty straight forward.
Device tree node:

        usb at 23000 {
            compatible = "fsl-usb2-dr";
            reg = <0x23000 0x1000>;
            #address-cells = <1>;
            #size-cells = <0>;
            interrupt-parent = <&ipic>;
            interrupts = <38 0x8>;
            phy_type = "ulpi";
            dr_mode = "otg";
            sleep = <&pmc 0x00300000>;
        };

Here is the output I get from the kernel when bringing up the USB:

usbmon: debugfs is not available
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
fsl-ehci fsl-ehci.0: Freescale On-Chip EHCI Host Controller
fsl-ehci fsl-ehci.0: new USB bus registered, assigned bus number 1
fsl-ehci fsl-ehci.0: irq 38, io base 0xe0023000
fsl-ehci fsl-ehci.0: USB 2.0 started, EHCI 1.00
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
usb usb1: Product: Freescale On-Chip EHCI Host Controller
usb usb1: Manufacturer: Linux 2.6.28 ehci_hcd
usb usb1: SerialNumber: fsl-ehci.0
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
Freescale High-Speed USB SOC Device Controller driver (Apr 20, 2007)
udc: request mem region for fsl-usb2-udc failed
fsl-usb2-udc: probe of fsl-usb2-udc.0 failed with error -16

I tracked down the error to the fsl_udc_probe function in fsl_usb2_udc.c:

static int __init fsl_udc_probe(struct platform_device *pdev)
{
    struct resource *res;
    int ret = -ENODEV;
    unsigned int i;
    u32 dccparams;

    if (strcmp(pdev->name, driver_name)) {
        VDBG("Wrong device");
        return -ENODEV;
    }

    udc_controller = kzalloc(sizeof(struct fsl_udc), GFP_KERNEL);
    if (udc_controller == NULL) {
        ERR("malloc udc failed\n");
        return -ENOMEM;
    }

    spin_lock_init(&udc_controller->lock);
    udc_controller->stopped = 1;

    res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
    if (!res) {
        ret = -ENXIO;
        goto err_kfree;
    }

    if (!request_mem_region(res->start, res->end - res->start + 1,
                driver_name)) {
        ERR("request mem region for %s failed\n", pdev->name);
        ret = -EBUSY;
        goto err_kfree;
    }
...


Now, I can stick in a USB flash drive and mount it. So, I know the host side

is working fine. The gadget driver doesn't appear to be able to load,
presumably because the host driver has already registered its memory
resources and will not release/share them.

What is the correct configuration to have real OTG working? Specifically,
what is the configuration that will allow me to plug in a flash drive and
mount it, unmount it, plug in a host (laptop or such) and have it think it
is connected to a USB Ethernet gadget WITHOUT having to manually
load and unload modules?

Thanks any help you can provide.

Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20090225/53f483e2/attachment.htm>


More information about the Linuxppc-dev mailing list