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.

Linux/AM3352: USB power setting

Part Number: AM3352
Other Parts Discussed in Thread: TPS22945

Tool/software: Linux

Hello,

I am using the AM3352 part and wanted to know how to set the USB current level. By default, USB Host provides 100mA @ 5V to begin and then after negotiations can provide upto 500mA. Is there a way in software (USB driver) to ensure that during negotiations the USB Host (AM3352) only allows upto 100mA and no more.

I understand that this is not USB 2.0 compliant - but in my system I'm unable to provide more than 0.5W of power to USB devices. We plan to use only USB memory stick as acceptable devices.

Can you please help me with the setup or modifications needed to the USB driver?

Thank you

Regards

Santhosh

  • Hi,

    AM335x provides VBUS power by controlling a VBUS load switch via an on/off signal USBx_DRVVBUS. As I see it the only way to limit provided power is to use a switch with current limit.
  • Hello Biser,

    Thank you for your reply. Yes, VBUS power control allows for On/Off - however, are there any settings in the USB driver to ensure that if a device requests for additional current the driver denies the request. 

    Regards

    Santhosh

  • Santhosh,

    USB driver doesn't directly control the VBUS power supply. But your system is only capable to provide VBUS no more than 100mA, why you have to let USB driver to control it? Can you just statically shutdown the VBUS power supply if the current is over 100mA?
  • Hi Bin,

    Thank you for your quick reply. Yes, that is exactly what I'm doing right now with TPS22945; it limits current to 100mA. However, I was hoping there is a way for the USB Host to indicate to the device (during negotiation, as part of enumeration) that it cannot supply for than 100mA (if the device requests for additional current).

    I'm thinking it's more complete - if there is a way to do it. Thank you for your help.

    Regards

    Santhosh

  • Santhosh,

    You could use the following patch, then if any device which requires more than 100mA is attached, the enumeration will stop and device is not usable.

    diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
    index e58fab8aec5d..a80ba6d93859 100644
    --- a/arch/arm/boot/dts/am33xx.dtsi
    +++ b/arch/arm/boot/dts/am33xx.dtsi
    @@ -643,7 +643,7 @@
                                    mentor,multipoint = <1>;
                                    mentor,num-eps = <16>;
                                    mentor,ram-bits = <12>;
    -                               mentor,power = <500>;
    +                               mentor,power = <100>;
                                    phys = <&usb0_phy>;
     
                                    dmas = <&cppi41dma  0 0 &cppi41dma  1 0
    @@ -690,7 +690,7 @@
                                    mentor,multipoint = <1>;
                                    mentor,num-eps = <16>;
                                    mentor,ram-bits = <12>;
    -                               mentor,power = <500>;
    +                               mentor,power = <100>;
                                    phys = <&usb1_phy>;
     
                                    dmas = <&cppi41dma 15 0 &cppi41dma 16 0
    
  • Thanks - exactly what I was hoping. I was going to look at the device tree but then your email beat me to it.

    Thank you so much Bin :)
    Regards

    Santhosh