All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiada Wang <jiada_wang@mentor.com>
To: Peter Chen <peter.chen@freescale.com>, <linux-usb@vger.kernel.org>
Cc: Li Jun <B47624@freescale.com>, Li Jun <jun.li@freescale.com>,
	<stable@vger.kernel.org>
Subject: Re: [PATCH 1/1] usb: chipidea: otg: gadget module load and unload support
Date: Thu, 22 Oct 2015 10:19:45 +0900	[thread overview]
Message-ID: <562839B1.9030703@mentor.com> (raw)
In-Reply-To: <1445397800-19980-1-git-send-email-peter.chen@freescale.com>

Hello


On 10/21/2015 12:23 PM, Peter Chen wrote:
> From: Li Jun <B47624@freescale.com>
>
> This patch is to support load and unload gadget driver in full OTG mode.
>
> Signed-off-by: Li Jun <jun.li@freescale.com>
> Signed-off-by: Peter Chen <peter.chen@freescale.com>
> Cc: Jiada Wang <jiada_wang@mentor.com>
> (Peter: it fixes a bug that the unload/reload gadget driver can't work
>   well at OTG FSM mode)
> Cc: <stable@vger.kernel.org> #v4.0+
> ---
>   drivers/usb/chipidea/udc.c | 17 +++++++++++++++++
>   1 file changed, 17 insertions(+)
>
> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> index e19d8b8..67cfa04 100644
> --- a/drivers/usb/chipidea/udc.c
> +++ b/drivers/usb/chipidea/udc.c
> @@ -1755,6 +1755,22 @@ static int ci_udc_start(struct usb_gadget *gadget,
>   	return retval;
>   }
>
> +static void ci_udc_stop_for_otg_fsm(struct ci_hdrc *ci)
> +{
> +	if (!ci_otg_is_fsm_mode(ci))
> +		return;
> +
> +	mutex_lock(&ci->fsm.lock);
> +	if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) {
> +		ci->fsm.a_bidl_adis_tmout = 1;
> +		ci_hdrc_otg_fsm_start(ci);
> +	} else if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) {
> +		ci->fsm.protocol = PROTO_UNDEF;
> +		ci->fsm.otg->state = OTG_STATE_UNDEFINED;
> +	}
> +	mutex_unlock(&ci->fsm.lock);
> +}
> +
>   /**
>    * ci_udc_stop: unregister a gadget driver
>    */
> @@ -1779,6 +1795,7 @@ static int ci_udc_stop(struct usb_gadget *gadget)
>   	ci->driver = NULL;
>   	spin_unlock_irqrestore(&ci->lock, flags);
>
> +	ci_udc_stop_for_otg_fsm(ci);
>   	return 0;
>   }
>
>
I have confirmed this patch resolves my issue with gadget module load/unload
please feel free to add my Tested-by

Thanks,
Jiada

  reply	other threads:[~2015-10-22  1:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21  3:23 [PATCH 1/1] usb: chipidea: otg: gadget module load and unload support Peter Chen
2015-10-22  1:19 ` Jiada Wang [this message]
2015-10-22  1:44   ` Peter Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=562839B1.9030703@mentor.com \
    --to=jiada_wang@mentor.com \
    --cc=B47624@freescale.com \
    --cc=jun.li@freescale.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter.chen@freescale.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.