Re: Dual-Role switch with single input

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 31, 2017 at 06:07:39PM +0100, Stefan Agner wrote:
> Hi Peter,
> 
> I am currently trying to come up with a upstreamable solution for USB
> device/host switch for our NXP i.MX 7 CoM (Colibri iMX7). My colleague
> Sanchayan already posted on the mailing list in a earlier attempt for
> our Colibri VFxx modules (NXP Vybrid):
> http://www.spinics.net/lists/linux-usb/msg140810.html
> 
> The situation is very similar: The device is not OTG capable, but just
> allows to use a Micro-USB connector as Host when using a OTG cable. VBUS
> is enabled in hardware depending on ID-Pin. We have a single 3.3V input
> to the module "usbc_det". Back then your advice was to wait for the DCD
> framework, however, reading up on the mailing list discussion it seems
> that this did not make it mainline in a form it would be easily usable
> with the Chipidea IP:
> https://patchwork.kernel.org/patch/9172269/
> 
> Downstream we currently use a custom "state machine" which directly
> calls ci_role_stop/start and usb_gadget_vbus_(dis)connect:
> http://git.toradex.com/cgit/linux-toradex.git/commit/drivers/usb/chipidea/core.c?h=toradex_4.1-2.0.x-imx-next&id=1f43d373946ee34ce0cfeb667a9aa48d6995bfea
> 
> I tried to use the Chipidea OTG FSM and extcon. The device tree bindings
> state:
> > - extcon: phandles to external connector devices. First phandle should point to
> >   external connector, which provide "USB" cable events, the second should point
> >   to external connector device, which provide "USB-HOST" cable events. If one
> >   of the external connector devices is not required, empty <0> phandle should
> >   be specified.
> 
> It sounds like any of the two extcon are optional, also in
> drivers/usb/chipidea/core.c a comment notes: "Each one of them is not
> mandatory"
> 
> On Colibri iMX7 the usbc_det is also connected to USB_OTG1_VBUS, and it
> leads to a proper B Session Valid in OTGSC registers.
> 
> So I tried specifying ID only (since VBUS is switched in hardware and
> can be detected through B Session Valid), but this seems not to be stuck
> in the OTG FSM (with an additional debug print in ci_otg_fsm_event):
> [  264.327871] ci_otg_fsm_irq
> [  264.333153] ci_hdrc ci_hdrc.0: ci_otg_fsm_event a_wait_vrise
> [  264.347984] ci_cable_notifier, event 0
> [  264.354329] ci_otg_fsm_irq
> [  265.360930] ci_hdrc ci_hdrc.0: remove, state 4
> [  265.367862] usb usb1: USB disconnect, device number 1
> [  265.380912] ci_hdrc ci_hdrc.0: USB bus 1 deregistered
> 
> It seems to me that the CI OTG FSM is too complex for what I am trying
> to achieve. Any advice how I should go about it?
> 

Stefan, if you only search for solution for dual-role switch through
ID pin, you do not need OTG FSM. Just keep your vbus and ID value are
correct during every manual operation.

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux