This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM62: USB driver on linux, what interrupts are used ?

Part Number: SK-AM62

Hi TI experts,

I've been experimenting with the USB driver of am62x on Linux. it has its own dwc3 driver in usb/dwc3/dwc-am62.c. Can you elaborate on this further ? I explored the driver further and it seems it sets the pll reference clock and voltage divider. It doesn't do much in terms of enabling or clearing the IRQ interrupts, so I was wondering if interrupts for USB are enabled by default?

So in general, I was wondering (especially in host mode) what things need to be done by the so-called dec wrapper before XHCI takes over? is it just the stuff I mentioned in dwc-am62.c ?

  • Hi Seyed,

    The USB module on AM62x is handled by multiple kernel USB drivers. You would get an idea if check the output of 'lsmod' command, since most (if not all) USB drivers are built as modules.

    dwc3/dwc3-am62x.c: this is the DWC3 platform driver, mainly handles the power/clock to the USB module;

    dwc3/{core,drd,ep0,gadget,host}.c handles the USB controller in device mode and dual-role mode transitions;

    host/xhci*.c handles the USB in host mode.

    So in general, I was wondering (especially in host mode) what things need to be done by the so-called dec wrapper before XHCI takes over? is it just the stuff I mentioned in dwc-am62.c ?

    Yes, plus come routines in dwc3/* drivers.

  • Thanks for the information. 

    I still don't know the role IRQ0 (which is set in the device tree for sk-am62) plays. Is there a callback function set for this interrupt (ISR) ? or is this interrupt mostly for internal purposes? I'm asking specifically because in the TRM of am62, page 9441 of Rev.A,  table 12-1400, there is no mention of IRQ0 or IRQn in general, and only IRQ_MISC which is miscellaneous interrupts is documented. So I thought maybe that's because this IRQ0 is enabled by default and no ISR is needed. Can you explain this a bit? 

    Thanks.

  • Can you please provide the context of IRQ0? which line in sk-am62 device tree refer to it? I don't find it in kernel source:

    dev@udb:k3-64$ git grep -i irq0 arch/arm64/boot/dts/ti/k3-am62*
    dev@udb:k3-64$

  • checkout k3-am62-main.dtsi

    usbss0: dwc3-usb@f900000 {
    compatible = "ti,am62-usb";
    reg = <0x00 0x0f900000 0x00 0x800>;
    clocks = <&k3_clks 161 3>;
    clock-names = "ref";
    ti,syscon-phy-pll-refclk = <&wkup_conf 0x4008>;
    #address-cells = <2>;
    #size-cells = <2>;
    power-domains = <&k3_pds 178 TI_SCI_PD_EXCLUSIVE>;
    ranges;

    usb0: usb@31000000 {
    compatible = "snps,dwc3";
    reg =<0x00 0x31000000 0x00 0x50000>;
    interrupts = <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>, /* irq.0 */
    <GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>; /* irq.0 */
    interrupt-names = "host", "peripheral";
    maximum-speed = "high-speed";
    dr_mode = "otg";
    };
    };
    my question is this:
    1. what should happen on the ISR of this IRQ?
    2. does it get triggered for every interrupt that the USB generates during setup or transfer?
    3. does it need to be disabled, cleared, and enabled every time it's called? or does the underlying hardware take care of that? I'm specifically asking because am62 has its own dec driver in Linux, so I think some things about it are special.
  • This IRQ is to trigger interrupts to xHCI driver when the USB controller works in host mode, or to DWC3 gadget controller driver when the USB controller works in device mode.

    The initialization of thie IRQ is in drivers/usb/dwc3/host.c and drivers/usb/dwc3/gadget.c. The interrupt event handling is in the xHCI driver and DWC3 core driver respectively.

  • is this IRQ self clearing ? Or do we need to clear it every time it happens ?