USB role switch in Imx6q sabre AI

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USB role switch in Imx6q sabre AI

3,416 Views
shravansundarra
Contributor I
if you refer this document
it says the procedure to do role switch
/sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
/sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
nodes responsible for role switch
but these nodes doesnt exist in the sysfs.
What needs to be done to see these files in sysfs  ?
Any code changes or  any kernel features needs to be enabled?
0 Kudos
9 Replies

2,566 Views
art
NXP Employee
NXP Employee

Please refer to the Chapter 39 of the attached document. Hope it helps.


Have a great day,
Artur

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

2,566 Views
gillestalis
NXP Employee
NXP Employee

Hello,

Which version of kernel are you using?

This feature has been there since i.MX kernel 3.14.52 if I am not mistaken

Did you enable CONFIG_USB_OTG_FSM option in your kernel?

Gilles.

0 Kudos

2,566 Views
shravansundarra
Contributor I

Hi Gilles Talis,

    Using kernel version 4.1.15 and the option CONFIG_USB_OTG_FSM=y is enabled .

0 Kudos

2,566 Views
gillestalis
NXP Employee
NXP Employee

Hi,

Did you enable one of these options in the dts?

hnp-enable

srp-enable

Just changing hnp-disable to hnp-enable should do the trick.

However, the a_bus_req/a_bus_drop options do not appear there:

/sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req

but rather here for me:

/sys/devices/soc0/soc/2100000.aips-bus/2184000.usb/ci_hdrc.0/inputs/a_bus_req

Gilles.

0 Kudos

2,566 Views
shravansundarra
Contributor I

Hi Gilles Talis,

 

    Yes , the below configurations are updated in the dts file,

hnp-enable

srp-enable

and the a_bus_req node is not present in the path you mentioned in the above reply.

Is there any other requirement needed in 4.1.15 kernel ?

Thanks and Regards

  Shravan S

0 Kudos

2,566 Views
gillestalis
NXP Employee
NXP Employee

Hi Shravan S,

To my knowledge, there's no other requirement needed in 4.1.15 kernel.

Which SoC and board are you using?

thanks

Gilles.

0 Kudos

2,566 Views
shravansundarra
Contributor I

Hi Gilles Talis,

    I am able to see the nodes

/sys/devices/soc0/soc/2100000.aips-bus/2184000.usb/ci_hdrc.0/inputs/a_bus_req

as you mentioned in the previous mail.

But the role switching is not happening with my iPhone  after the below command

echo  1 >  /sys/devices/soc0/soc/2100000.aips-bus/2184000.usb/ci_hdrc.0/inputs/a_bus_req

I am following the procedure as per below

Linux/Documentation/usb/chipidea.txt - Linux Cross Reference - Free Electrons 

The  Board details :  iMx6q sabre Auto infotainment board

Thanks and Regards

  Shravan S

0 Kudos

2,566 Views
shravansundarra
Contributor I

Hi Gilles Talis,

 Below are the behaviour I am facing during role switching,

1) NXP board is in  host mode -By default ( echo host > /sys/kernel/debug/ci.hdrc0/role )

 

   on "lsusb" command  I am able to see the devices connected  = > Its a expected behaviour.

 

   The connected B-device ( Apple iPhone ) is getting charged.

2) NXP Board is in gadget mode ( echo gadget > /sys/kernel/debug/ci.hdrc0/role     )

    on "lsusb" command  I am not able to see the devices connected  = > Its a expected behaviour.

  

    The connected B-device ( Apple iPhone ) is not getting charged. As iPhone expects the power to be supplied from the connected device , when the iPhone is in host mode .

I am suspecting that vbus should be enabled even when the NXP device is in gadget mode .

Did some code modification (short cut way => not the proper fix) to enable to regulator to have the voltage supply in vbus in both the modes . The proper fix should be handling of gpio to enable vbus in both host and device(gadget) modes .

Even after we enable the vbus , we are not able to  perform role switch , the nodes responsible for role switch  (echo host > /sys/kernel/debug/ci.hdrc0/role) are updating with proper values  ,  but  we are not able to see the exact functionality of role switching.

And the documentation part of the kernel say the different nodes for the role switching as below

https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwizuoHnuO... 

 I am able to see the nodes

/sys/devices/soc0/soc/2100000.aips-bus/2184000.usb/ci_hdrc.0/inputs/a_bus_req

as you mentioned in the document

 

But the role switching is not happening with my iPhone  after the below command

echo  1 >  /sys/devices/soc0/soc/2100000.aips-bus/2184000.usb/ci_hdrc.0/inputs/a_bus_req

 

I am following the procedure as per below

 

Linux/Documentation/usb/chipidea.txt - Linux Cross Reference - Free Electrons 

 

The  Board details :  iMx6q sabre Auto infotainment board

Kernel Version : 4.1.15

Thanks and Regards

   Shravan S

0 Kudos

2,566 Views
gillestalis
NXP Employee
NXP Employee

Hi Shravan S,

Sorry for late reply.

This is beyond my knowledge. I was expecting this to work out of the box.

It is clear that something is missing, but I do not know what. It might be worth doing some debugging in the USB driver. From what I could see, the code is located in drivers/usb/chipidea/. There is a "otg_fsm.c" file, it might worth checking that the OTG state machine is implemented correctly or is not blocked in some weird state.

Sorry but I can't help more.

regards

Gilles.

0 Kudos