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.

AM3352: USB on peripheral without PMIC like beagelbone black, what I have to do with the VBUS IRQ

Part Number: AM3352

The RNDIS gadget is not working at v5.10.35 (mainline kernel.org)

Our Board without PMIC , is this wrong ?

interrupts-extended = <&intc 18 &intc 0>;

BBB with PMIC:

interrupts-extended = <&intc 18 &tps 0>;





dts parts

ocp {
debugss: debugss@4b000000 {
compatible = "ti,debugss";
ti,hwmods = "debugss";
reg = <0x4b000000 1000000>;
status = "disabled";
};

musb: usb@47400000 {
status = "okay";

control@44e10620 {
status = "okay";
};

usb-phy@47401300 {
status = "okay";
};

usb-phy@47401b00 {
status = "okay";
};

usb@47401000 {
status = "okay";
dr_mode = "periphal";
};

usb@47401800 {
status = "okay";
dr_mode = "periphal";
};

dma-controller@47402000 {
status = "okay";
};
};

};



&usb0_phy {
status = "okay";
};

&usb0 {
dr_mode = "peripheral";
status = "okay";

interrupts-extended = <&intc 18 &intc 0>;
interrupt-names = "mc" ,"vbus";
};



&usb1 {
dr_mode = "host";
status = "disabled";
};


Log

root@pxc4:~# lsusb
root@pxc4:~# dmesg | grep usb
[    2.523154] device: '47401300.usb-phy': device_add
[    2.523190] bus: 'platform': add device 47401300.usb-phy
[    2.523744] device: '47401400.usb': device_add
[    2.523780] bus: 'platform': add device 47401400.usb
[    2.524010] device: 'platform:47401300.usb-phy--platform:47401400.usb': device_add
[    2.524114] platform 47401400.usb: Linked as a sync state only consumer to 47401300.usb-phy
[    2.524752] device: '47401b00.usb-phy': device_add
[    2.524789] bus: 'platform': add device 47401b00.usb-phy
[    2.526193] device: 'platform:47400000.dma-controller--platform:47401400.usb': device_add
[    2.526287] platform 47401400.usb: Linked as a sync state only consumer to 47400000.dma-controller
[    3.311250] bus: 'platform': add driver am335x-control-usb
[    3.311569] bus: 'platform': driver_probe_device: matched device 44e10620.control with driver am335x-control-usb
[    3.311594] bus: 'platform': really_probe: probing driver am335x-control-usb with device 44e10620.control
[    3.311631] am335x-control-usb 44e10620.control: no pinctrl handle
[    3.311723] driver: 'am335x-control-usb': driver_bound: bound to device '44e10620.control'
[    3.311808] bus: 'platform': really_probe: bound device 44e10620.control to driver am335x-control-usb
[    3.312210] bus: 'platform': driver_probe_device: matched device 47401300.usb-phy with driver am335x-phy-driver
[    3.312275] bus: 'platform': really_probe: probing driver am335x-phy-driver with device 47401300.usb-phy
[    3.312308] am335x-phy-driver 47401300.usb-phy: no pinctrl handle
[    3.313154] am335x-phy-driver 47401300.usb-phy: supply vcc not found, using dummy regulator
[    3.322305] device: 'regulator:regulator.0--platform:47401300.usb-phy': device_add
[    3.322455] devices_kset: Moving 47401300.usb-phy to end of list
[    3.322474] am335x-phy-driver 47401300.usb-phy: Linked as a consumer to regulator.0
[    3.322503] driver: 'am335x-phy-driver': driver_bound: bound to device '47401300.usb-phy'
[    3.322589] bus: 'platform': really_probe: bound device 47401300.usb-phy to driver am335x-phy-driver
[    3.322706] bus: 'platform': driver_probe_device: matched device 47401b00.usb-phy with driver am335x-phy-driver
[    3.322755] bus: 'platform': really_probe: probing driver am335x-phy-driver with device 47401b00.usb-phy
[    3.322788] am335x-phy-driver 47401b00.usb-phy: no pinctrl handle
[    3.323582] am335x-phy-driver 47401b00.usb-phy: supply vcc not found, using dummy regulator
[    3.332685] device: 'regulator:regulator.0--platform:47401b00.usb-phy': device_add
[    3.332821] devices_kset: Moving 47401b00.usb-phy to end of list
[    3.332839] am335x-phy-driver 47401b00.usb-phy: Linked as a consumer to regulator.0
[    3.332862] driver: 'am335x-phy-driver': driver_bound: bound to device '47401b00.usb-phy'
[    3.332947] bus: 'platform': really_probe: bound device 47401b00.usb-phy to driver am335x-phy-driver
[    3.346040] bus: 'platform': add driver musb-hdrc
[    3.346165] bus: 'platform': add driver musb-dsps
[    3.346452] bus: 'platform': driver_probe_device: matched device 47401400.usb with driver musb-dsps
[    3.346522] bus: 'platform': really_probe: probing driver musb-dsps with device 47401400.usb
[    3.346561] musb-dsps 47401400.usb: no pinctrl handle
[    3.347099] Registering platform device 'musb-hdrc.0'. Parent at 47401400.usb
[    3.347119] device: 'musb-hdrc.0': device_add
[    3.347164] bus: 'platform': add device musb-hdrc.0
[    3.347525] bus: 'platform': driver_probe_device: matched device musb-hdrc.0 with driver musb-hdrc
[    3.347549] bus: 'platform': really_probe: probing driver musb-hdrc with device musb-hdrc.0
[    3.349002] device: 'musb-hdrc.0': device_add
[    3.349278] driver: 'musb-hdrc': driver_bound: bound to device 'musb-hdrc.0'
[    3.349363] bus: 'platform': really_probe: bound device musb-hdrc.0 to driver musb-hdrc
[    3.349425] driver: 'musb-dsps': driver_bound: bound to device '47401400.usb'
[    3.349447] musb-dsps 47401400.usb: Dropping the link to 47401300.usb-phy
[    3.349459] device: 'platform:47401300.usb-phy--platform:47401400.usb': device_unregister
[    3.349587] musb-dsps 47401400.usb: Dropping the link to 47400000.dma-controller
[    3.349600] device: 'platform:47400000.dma-controller--platform:47401400.usb': device_unregister
[    3.349723] bus: 'platform': really_probe: bound device 47401400.usb to driver musb-dsps
[    3.384211] bus: 'usb': add driver usbhid
[    3.384282] usbcore: registered new interface driver usbhid
[    3.390254] usbhid: USB HID core driver

  • doing it this way does not work too

    usb_pins_default: usb_pins_default{
    pinctrl-single,pins = <
    AM33XX_PADCONF(AM335X_PIN_USB0_DRVVBUS, PIN_INPUT, MUX_MODE0)
    >;
    };

    &usb0_phy {
    pinctrl-names = "default";
    pinctrl-0 = <&usb_pins_default>;
    status = "okay";
    };

    &usb0 {
    dr_mode = "peripheral";
    status = "okay";

    interrupts-extended = <&intc 18 &intc 0>;
    interrupt-names = "mc", "vbus";
    };

    &usb1 {
    dr_mode = "host";
    status = "disabled";
    };

    pin 135 (PIN135): 47401300.usb-phy (GPIO UNCLAIMED) function usb_pins_default group usb_pins_default


    root@pxc4:~# dmesg | grep usb
    [ 2.541726] device: '47401300.usb-phy': device_add
    [ 2.541769] bus: 'platform': add device 47401300.usb-phy
    [ 2.542009] device: 'platform:44e10800.pinmux--platform:47401300.usb-phy': device_add
    [ 2.542129] platform 47401300.usb-phy: Linked as a sync state only consumer to 44e10800.pinmux
    [ 2.542530] device: '47401400.usb': device_add
    [ 2.542563] bus: 'platform': add device 47401400.usb
    [ 2.542798] device: 'platform:47401300.usb-phy--platform:47401400.usb': device_add
    [ 2.542901] platform 47401400.usb: Linked as a sync state only consumer to 47401300.usb-phy
    [ 2.543535] device: '47401b00.usb-phy': device_add
    [ 2.543570] bus: 'platform': add device 47401b00.usb-phy
    [ 2.544811] device: 'platform:47400000.dma-controller--platform:47401400.usb': device_add
    [ 2.544917] platform 47401400.usb: Linked as a sync state only consumer to 47400000.dma-controller
    [ 3.332068] bus: 'platform': add driver am335x-control-usb
    [ 3.332397] bus: 'platform': driver_probe_device: matched device 44e10620.control with driver am335x-control-usb
    [ 3.332421] bus: 'platform': really_probe: probing driver am335x-control-usb with device 44e10620.control
    [ 3.332459] am335x-control-usb 44e10620.control: no pinctrl handle
    [ 3.332559] driver: 'am335x-control-usb': driver_bound: bound to device '44e10620.control'
    [ 3.332645] bus: 'platform': really_probe: bound device 44e10620.control to driver am335x-control-usb
    [ 3.333040] bus: 'platform': driver_probe_device: matched device 47401300.usb-phy with driver am335x-phy-driver
    [ 3.333108] bus: 'platform': really_probe: probing driver am335x-phy-driver with device 47401300.usb-phy
    [ 3.333230] am335x-phy-driver 47401300.usb-phy: no init pinctrl state
    [ 3.333257] am335x-phy-driver 47401300.usb-phy: no sleep pinctrl state
    [ 3.333268] am335x-phy-driver 47401300.usb-phy: no idle pinctrl state
    [ 3.334127] am335x-phy-driver 47401300.usb-phy: supply vcc not found, using dummy regulator
    [ 3.343199] device: 'regulator:regulator.0--platform:47401300.usb-phy': device_add
    [ 3.343342] devices_kset: Moving 47401300.usb-phy to end of list
    [ 3.343361] am335x-phy-driver 47401300.usb-phy: Linked as a consumer to regulator.0
    [ 3.343388] driver: 'am335x-phy-driver': driver_bound: bound to device '47401300.usb-phy'
    [ 3.343410] am335x-phy-driver 47401300.usb-phy: Dropping the link to 44e10800.pinmux
    [ 3.343421] device: 'platform:44e10800.pinmux--platform:47401300.usb-phy': device_unregister
    [ 3.343601] bus: 'platform': really_probe: bound device 47401300.usb-phy to driver am335x-phy-driver
    [ 3.343742] bus: 'platform': driver_probe_device: matched device 47401b00.usb-phy with driver am335x-phy-driver
    [ 3.343797] bus: 'platform': really_probe: probing driver am335x-phy-driver with device 47401b00.usb-phy
    [ 3.343830] am335x-phy-driver 47401b00.usb-phy: no pinctrl handle
    [ 3.344632] am335x-phy-driver 47401b00.usb-phy: supply vcc not found, using dummy regulator
    [ 3.353755] device: 'regulator:regulator.0--platform:47401b00.usb-phy': device_add
    [ 3.353895] devices_kset: Moving 47401b00.usb-phy to end of list
    [ 3.353914] am335x-phy-driver 47401b00.usb-phy: Linked as a consumer to regulator.0
    [ 3.353938] driver: 'am335x-phy-driver': driver_bound: bound to device '47401b00.usb-phy'
    [ 3.354022] bus: 'platform': really_probe: bound device 47401b00.usb-phy to driver am335x-phy-driver
    [ 3.367050] bus: 'platform': add driver musb-hdrc
    [ 3.367180] bus: 'platform': add driver musb-dsps
    [ 3.367466] bus: 'platform': driver_probe_device: matched device 47401400.usb with driver musb-dsps
    [ 3.367533] bus: 'platform': really_probe: probing driver musb-dsps with device 47401400.usb
    [ 3.367572] musb-dsps 47401400.usb: no pinctrl handle
    [ 3.368105] Registering platform device 'musb-hdrc.0'. Parent at 47401400.usb
    [ 3.368126] device: 'musb-hdrc.0': device_add
    [ 3.368172] bus: 'platform': add device musb-hdrc.0
    [ 3.368529] bus: 'platform': driver_probe_device: matched device musb-hdrc.0 with driver musb-hdrc
    [ 3.368551] bus: 'platform': really_probe: probing driver musb-hdrc with device musb-hdrc.0
    [ 3.370009] device: 'musb-hdrc.0': device_add
    [ 3.370290] driver: 'musb-hdrc': driver_bound: bound to device 'musb-hdrc.0'
    [ 3.370374] bus: 'platform': really_probe: bound device musb-hdrc.0 to driver musb-hdrc
    [ 3.370441] driver: 'musb-dsps': driver_bound: bound to device '47401400.usb'
    [ 3.370463] musb-dsps 47401400.usb: Dropping the link to 47401300.usb-phy
    [ 3.370475] device: 'platform:47401300.usb-phy--platform:47401400.usb': device_unregister
    [ 3.370601] musb-dsps 47401400.usb: Dropping the link to 47400000.dma-controller
    [ 3.370615] device: 'platform:47400000.dma-controller--platform:47401400.usb': device_unregister
    [ 3.370738] bus: 'platform': really_probe: bound device 47401400.usb to driver musb-dsps
    [ 3.405355] bus: 'usb': add driver usbhid
    [ 3.405422] usbcore: registered new interface driver usbhid
    [ 3.411278] usbhid: USB HID core driver

  • &usb0_phy {
    pinctrl-names = "default";
    pinctrl-0 = <&usb_pins_default>;
    pinctrl-1 = <&usb_pins_init>;
    pinctrl-2 = <&usb_pins_sleep>;
    pinctrl-3 = <&usb_pins_idle>;
    status = "okay";
    };

    &usb0 {
    dr_mode = "peripheral";
    status = "okay";

    interrupts-extended = <&intc 18 &intc 0>;
    interrupt-names = "mc", "vbus";
    };

    at power up at host the gadget is avaliable

    Bus 001 Device 020: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget

    but after plug event it is lost .. interrupt type / level to add ?

  • USB0_VBUS is an analog pin with mux mode 0 only.
    T19 could not be muxed as GPIO with IRQ !

    so what should be added for vbus irq in interruts-extended = <&intc 18 ? ?>

    Kernel 4.4 dts didnt has this new "interrupts-extended" gimmick and gadget worked !

  • Hi Boris,

    The VBUS IRQ (as that on BBB) is optional. If you check the AM335x GP EVM schematics and its board dts, there is no VBUS IRQ defined.

  • I talk not about kernel 4.4.y  without interrupt-extended
    I talk about kernel 5.10.y (mainline from kernel.org) with "new" interrupt-extended

    Without interrupt-extended for interupt-names "vbus" driver does not work at power up (warning vbus missing)
    Without interrupt-extended for interupt-names "mbus" driver does not start (error)
    Without interrupt-extended and  interupt-names usb driver does not start (error)

    This way RNDIS Gadget works a power up.. but plug event does not work... after unplug you will never see RNDIS again at USB host (Bus 001 Device 020: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget)

    &usb0_phy {
    status = "okay";
    };

    &usb0 {
    dr_mode = "peripheral";
    status = "okay";

    interrupts-extended = <&intc 18 &intc 7>;
    interrupt-names = "mc", "vbus";
    };



    If you look at https://elixir.bootlin.com/linux/v5.10.35/source/arch/arm/boot/dts/am33xx.dtsi#L368

    mc IRQ is 18 but what IRQ does vbus requires to wake up at plug event.
    vbus is analog pin and has Bit 7 in Table 16-116. USB1IRQSTAT1 Register Field Descriptions

    how is the VBUS (analog pin) plug event working correctly with interrupt-extended. We have 5V at VBUS if cable is connected and 0 V if not. Was working with 4.4 now 5.10 we have no plug detection

    How "vbus" &intc ? is mapped to Bit 7 in Table 16-116. USB1IRQSTAT1 Register Field Descriptions ?

    We do not have a PMIC with interrupt-extended = <&intc 18 &tps 0> for "vbus"

  • Where does the DT screenshot come from? The Beaglebone board DTS or your board? Like I said, the interrupts-extended for VBUS is optional, it is only used in mainline kernel Beaglebone but not other AM335x boards.

    Line #844-846 in musb_dsps.c driver checks if VBUS interrupt is defined. The driver does nothing if it is not defined. Also the function name is called dsps_setup_optional_vbus_irq() which suggests the vbus interrupt is opitonal.

    https://elixir.bootlin.com/linux/v5.10.35/source/drivers/usb/musb/musb_dsps.c#L844

    Line 368 in am33xx.dtsi defines the usb register locations, it doesn't talk about interrupts-extended. What do you want to tell with Line 368 here?

  • Where does the DT screenshot come from?

    dts is from our AM3352 module

    VBUS is optional, it is only used in mainline kernel Beaglebone but not other AM335x boards.

    do you have a link for 5.10 dts where VBUS is not used at &usb0 with dr_mode ="peripheral" ?

    I used this as example
    elixir.bootlin.com/.../am335x-osd3358-sm-red.dts

    The driver does nothing if it is not defined.

    Yes - In theory if not defined not Gadget on my real hardware. May you can remove the option on BBB and check if still plug event is working.

    Line 368 in am33xx.dtsi defines the usb register locations, it doesn't talk about interrupts-extended. What do you want to tell with Line 368 here?

    2 lines below 368 I can see mc and 18 .. both part of interrupts-extends section in dts .. see example

    elixir.bootlin.com/.../am335x-osd3358-sm-red.dts

  • BBB not working RNDIS with default device tree and defconfig, is there a kernel module missing i have to load ?

    I use the sato image with modules.dep

    root@beaglebone-yocto:/lib/modules/5.10.63-yocto-standard/kernel/drivers/net/usb# lsmod
    Module Size Used by
    cdc_eem 16384 0
    cdc_subset 16384 0
    cdc_ncm 28672 0
    usb_f_ncm 20480 0
    libcomposite 57344 1 usb_f_ncm
    configfs 36864 3 usb_f_ncm,libcomposite
    rndis_host 16384 0
    cdc_ether 16384 2 rndis_host,cdc_ncm
    usbnet 36864 5 rndis_host,cdc_eem,cdc_ether,cdc_ncm,cdc_subset
    u_ether 24576 1 usb_f_ncm
    snd_soc_simple_card 20480 0
    snd_soc_simple_card_utils 20480 1 snd_soc_simple_card
    snd_soc_davinci_mcasp 28672 2
    snd_soc_ti_udma 16384 1 snd_soc_davinci_mcasp
    snd_soc_ti_edma 16384 1 snd_soc_davinci_mcasp
    snd_soc_ti_sdma 16384 1 snd_soc_davinci_mcasp
    snd_soc_hdmi_codec 16384 1
    snd_soc_core 200704 7 snd_soc_davinci_mcasp,snd_soc_hdmi_codec,snd_soc_simple_card_utils,snd_soc_ti_sdma,snd_soc_ti_edma,snd_soc_ti_udma,snd_soc_simple_card
    snd_pcm_dmaengine 16384 1 snd_soc_core
    snd_pcm 102400 4 snd_soc_davinci_mcasp,snd_pcm_dmaengine,snd_soc_hdmi_codec,snd_soc_core
    snd_timer 32768 1 snd_pcm
    snd 65536 4 snd_soc_hdmi_codec,snd_timer,snd_soc_core,snd_pcm
    soundcore 16384 1 snd
    root@beaglebone-yocto:/lib/modules/5.10.63-yocto-standard/kernel/drivers/net/usb# uname -a
    Linux beaglebone-yocto 5.10.63-yocto-standard #1 PREEMPT Thu Sep 9 02:58:22 UTC 2021 armv7l GNU/Linux

  • How do you enable the ethernet (RNDIS) gadget on BBB?

    I do see u_ether module in 'lsmod', but I expect to see 'g_ether' module as well if the ethernet gadget driver is loaded from command 'modprobe g_ether'.

  • At 5.10 there is no g_ether.ko and there is no CONFIG for g_ether. only CONFIG_USB_U_ETHER.
    Is there a module missing in default omap2plus_defconfig ?

  • Correct, omap2plus_defconfig has many modules (not limited to USB) not enabled.

    To enable USB gadget drivers, including g_ether, you can do it in kernel make menuconfig:

    make menuconfig
    
    Device Drivers --->
        USB support --->
            USB Gadget Support --->
                USB Gadget precomposed configurations  --->
                   ...

  • yocto-linux is on 5.10.63
    we are on 5.10.35

    there are to more patches on musb_core.c at 5.10.63 and that will  resolve the plug unplug event

    see last 2 commits are missing at 5.1035

    https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/log/drivers/usb/musb/musb_core.c?h=v5.10.102




    we upgrade our kernel to 5.10.latest as fix

    yes  an option in dts and can be removed  .. the vbus warning is normal

     &usb0 {
            dr_mode = "peripheral";
    -       interrupts-extended = <&intc 18 &tps 0>;
    -       interrupt-names = "mc", "vbus";
     };

  • yes  an option in dts and can be removed  .. the vbus warning is normal

     &usb0 {
            dr_mode = "peripheral";
    -       interrupts-extended = <&intc 18 &tps 0>;
    -       interrupt-names = "mc", "vbus";
     };

    Yes, this interrupts-extended shouldn't be defined for your board, which doesn't have a PMIC. This VBUS interrupt doesn't exist on your board.