Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1220031

Re: [PATCH v4 13/13] usb: otg: Add dual-role device (DRD) support

From Roger Quadros <rogerq@ti.com>
Newsgroups linux.kernel
Subject Re: [PATCH v4 13/13] usb: otg: Add dual-role device (DRD) support
Date 2015-09-07 12:00 +0200
Message-ID <q61ns-1ZQ-15@gated-at.bofh.it> (permalink)
References <q0ZZ0-vR-3@gated-at.bofh.it> <q0ZZ2-vR-39@gated-at.bofh.it> <q61ns-1ZQ-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 07/09/15 10:53, Li Jun wrote:
> On Mon, Aug 24, 2015 at 04:21:24PM +0300, Roger Quadros wrote:
>> DRD mode is a reduced functionality OTG mode. In this mode
>> we don't support SRP, HNP and dynamic role-swap.
>>
>> In DRD operation, the controller mode (Host or Peripheral)
>> is decided based on the ID pin status. Once a cable plug (Type-A
>> or Type-B) is attached the controller selects the state
>> and doesn't change till the cable in unplugged and a different
>> cable type is inserted.
>>
>> As we don't need most of the complex OTG states and OTG timers
>> we implement a lean DRD state machine in usb-otg.c.
>> The DRD state machine is only interested in 2 hardware inputs
>> 'id' and 'b_sess_vld'.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  drivers/usb/common/usb-otg.c | 178 +++++++++++++++++++++++++++++++++++++++++--
>>  include/linux/usb/otg-fsm.h  |   5 ++
>>  include/linux/usb/otg.h      |   2 +
>>  3 files changed, 177 insertions(+), 8 deletions(-)
>>
> 
> ... ...
> 
>> +/* Called when entering a DRD state */
>> +static void drd_set_state(struct otg_fsm *fsm, enum usb_otg_state new_state)
>> +{
>> +	struct usb_otg *otgd = container_of(fsm, struct usb_otg, fsm);
>> +
>> +	if (fsm->otg->state == new_state)
>> +		return;
>> +
>> +	fsm->state_changed = 1;
>> +	dev_dbg(otgd->dev, "otg: set state: %s\n",
>> +		usb_otg_state_string(new_state));
>> +	switch (new_state) {
>> +	case OTG_STATE_B_IDLE:
>> +		drd_set_protocol(fsm, PROTO_UNDEF);
> 
> You didn't address this comment for your previous version.
> 
> otg_drv_vbus(fsm, 0);
> 
>> +		break;
>> +	case OTG_STATE_B_PERIPHERAL:
>> +		drd_set_protocol(fsm, PROTO_GADGET);
> 
> otg_drv_vbus(fsm, 0);
> 
>> +		break;
>> +	case OTG_STATE_A_HOST:
> 
> otg_drv_vbus(fsm, 1);
> 

Sorry, I missed it. Will add in next version.

--
cheers,
-roger

>> +		drd_set_protocol(fsm, PROTO_HOST);
>> +		break;
>> +	case OTG_STATE_UNDEFINED:
>> +	case OTG_STATE_B_SRP_INIT:
>> +	case OTG_STATE_B_WAIT_ACON:
>> +	case OTG_STATE_B_HOST:
>> +	case OTG_STATE_A_IDLE:
>> +	case OTG_STATE_A_WAIT_VRISE:
>> +	case OTG_STATE_A_WAIT_BCON:
>> +	case OTG_STATE_A_SUSPEND:
>> +	case OTG_STATE_A_PERIPHERAL:
>> +	case OTG_STATE_A_WAIT_VFALL:
>> +	case OTG_STATE_A_VBUS_ERR:
>> +	default:
>> +		dev_warn(otgd->dev, "%s: otg: invalid state: %s\n",
>> +			 __func__, usb_otg_state_string(new_state));
>> +		break;
>> +	}
>> +
>> +	fsm->otg->state = new_state;
>> +}
>> +
> ... ...
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v4 00/13]  USB: OTG/DRD Core functionality Roger Quadros <rogerq@ti.com> - 2015-08-24 15:30 +0200
  [PATCH v4 04/13] otg-fsm: move usb_bus_start_enum into otg-fsm->ops Roger Quadros <rogerq@ti.com> - 2015-08-24 15:30 +0200
    Re: [PATCH v4 04/13] otg-fsm: move usb_bus_start_enum into  otg-fsm->ops Roger Quadros <rogerq@ti.com> - 2015-09-07 12:00 +0200
      Re: [PATCH v4 04/13] otg-fsm: move usb_bus_start_enum into  otg-fsm->ops Roger Quadros <rogerq@ti.com> - 2015-09-08 10:30 +0200
  [PATCH v4 13/13] usb: otg: Add dual-role device (DRD) support Roger Quadros <rogerq@ti.com> - 2015-08-24 15:30 +0200
    Re: [PATCH v4 13/13] usb: otg: Add dual-role device (DRD) support Roger Quadros <rogerq@ti.com> - 2015-09-07 12:00 +0200
  Re: [PATCH v4 07/13] usb: otg: add OTG core Roger Quadros <rogerq@ti.com> - 2015-09-07 12:30 +0200
    Re: [PATCH v4 07/13] usb: otg: add OTG core Roger Quadros <rogerq@ti.com> - 2015-09-08 14:30 +0200
      Re: [PATCH v4 07/13] usb: otg: add OTG core Alan Stern <stern@rowland.harvard.edu> - 2015-09-08 16:40 +0200
        Re: [PATCH v4 07/13] usb: otg: add OTG core Roger Quadros <rogerq@ti.com> - 2015-09-08 19:40 +0200
      Re: [PATCH v4 07/13] usb: otg: add OTG core Roger Quadros <rogerq@ti.com> - 2015-09-09 11:10 +0200
        Re: [PATCH v4 07/13] usb: otg: add OTG core Roger Quadros <rogerq@ti.com> - 2015-09-09 11:40 +0200
          Re: [PATCH v4 07/13] usb: otg: add OTG core Roger Quadros <rogerq@ti.com> - 2015-09-09 12:30 +0200
            Re: [PATCH v4 07/13] usb: otg: add OTG core Roger Quadros <rogerq@ti.com> - 2015-09-10 16:20 +0200
  Re: [PATCH v4 07/13] usb: otg: add OTG core Roger Quadros <rogerq@ti.com> - 2015-09-07 13:00 +0200
    Re: [PATCH v4 07/13] usb: otg: add OTG core Roger Quadros <rogerq@ti.com> - 2015-09-09 12:10 +0200
      Re: [PATCH v4 07/13] usb: otg: add OTG core Roger Quadros <rogerq@ti.com> - 2015-09-10 16:20 +0200
  Re: [PATCH v4 00/13] USB: OTG/DRD Core functionality Roger Quadros <rogerq@ti.com> - 2015-09-07 13:50 +0200

csiph-web