All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Chen <peter.chen@kernel.org>
To: Piyush Mehta <piyush.mehta@xilinx.com>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org, git@xilinx.com, sgoud@xilinx.com,
	michal.simek@xilinx.com
Subject: Re: [PATCH] usb: chipidea: udc: make controller hardware endpoint primed
Date: Sun, 12 Sep 2021 15:41:05 +0800	[thread overview]
Message-ID: <20210912074105.GA4808@Peter> (raw)
In-Reply-To: <20210908084321.375662-1-piyush.mehta@xilinx.com>

On 21-09-08 14:13:21, Piyush Mehta wrote:
> Root-cause:
> There is an issue like endpoint is not recognized as primed, when bus
> have more pressure and the add dTD tripwire semaphore (ATDTW bit in
> USBCMD register) that can cause the controller to ignore a dTD that is
> added to a primed endpoint.
> This issue observed with the Windows10 host machine.
> 
> Workaround:
> The software must implement a periodic cycle, and check for each dTD,
> if the endpoint is primed. It can do this by reading the corresponding
> bits in the ENDPTPRIME and ENDPTSTAT registers. If these bits are read
> at 0, the software needs to re-prime the endpoint by writing 1 to the
> corresponding bit in the ENDPTPRIME register.
> 
> Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>
> ---
>  drivers/usb/chipidea/udc.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> index 8834ca6..d970f45 100644
> --- a/drivers/usb/chipidea/udc.c
> +++ b/drivers/usb/chipidea/udc.c
> @@ -49,6 +49,8 @@ ctrl_endpt_in_desc = {
>  	.wMaxPacketSize  = cpu_to_le16(CTRL_PAYLOAD_MAX),
>  };
>  
> +static int reprime_dtd(struct ci_hdrc *ci, struct ci_hw_ep *hwep,
> +		       struct td_node *node);
>  /**
>   * hw_ep_bit: calculates the bit number
>   * @num: endpoint number
> @@ -599,8 +601,15 @@ static int _hardware_enqueue(struct ci_hw_ep *hwep, struct ci_hw_req *hwreq)
>  
>  		prevlastnode->ptr->next = cpu_to_le32(next);
>  		wmb();
> +
> +		if (ci->rev == CI_REVISION_22) {
> +			if (!hw_read(ci, OP_ENDPTSTAT, BIT(n)))
> +				reprime_dtd(ci, hwep, prevlastnode);
> +		}
> +

Only for version 2.2?

>  		if (hw_read(ci, OP_ENDPTPRIME, BIT(n)))
>  			goto done;
> +

No blank line.

>  		do {
>  			hw_write(ci, OP_USBCMD, USBCMD_ATDTW, USBCMD_ATDTW);
>  			tmp_stat = hw_read(ci, OP_ENDPTSTAT, BIT(n));
> -- 
> 2.7.4
> 

-- 

Thanks,
Peter Chen


  reply	other threads:[~2021-09-12  7:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-08  8:43 [PATCH] usb: chipidea: udc: make controller hardware endpoint primed Piyush Mehta
2021-09-12  7:41 ` Peter Chen [this message]
2021-09-13  9:49   ` Piyush Mehta

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=20210912074105.GA4808@Peter \
    --to=peter.chen@kernel.org \
    --cc=git@xilinx.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=piyush.mehta@xilinx.com \
    --cc=sgoud@xilinx.com \
    /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.