All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Jack Pham <jackp@codeaurora.org>
Cc: Li Jun <jun.li@nxp.com>,
	peter.chen@kernel.org, stern@rowland.harvard.edu,
	mathias.nyman@intel.com, linux-usb@vger.kernel.org,
	linux-imx@nxp.com
Subject: Re: [PATCH 1/2] usb: host: move EH SINGLE_STEP_SET_FEATURE implementation to core
Date: Thu, 22 Apr 2021 10:46:41 +0200	[thread overview]
Message-ID: <YIE38ep8DwW6JMAC@kroah.com> (raw)
In-Reply-To: <20210412182215.GC17922@jackp-linux.qualcomm.com>

On Mon, Apr 12, 2021 at 11:22:16AM -0700, Jack Pham wrote:
> Hi Jun & Peter,
> 
> On Mon, Apr 12, 2021 at 03:22:13PM +0800, Li Jun wrote:
> > From: Peter Chen <peter.chen@nxp.com>
> > 
> > It is needed at USB Certification test for Embedded Host 2.0, and
> > the detail is at CH6.4.1.1 of On-The-Go and Embedded Host Supplement
> > to the USB Revision 2.0 Specification. Since other USB 2.0 capable
> > host like XHCI also need it, so move it to HCD core.
> > 
> > Signed-off-by: Peter Chen <peter.chen@nxp.com>
> > Signed-off-by: Jun Li <jun.li@nxp.com>
> > ---
> >  drivers/usb/core/hcd.c      | 134 ++++++++++++++++++++++++++++++++++
> >  drivers/usb/host/ehci-hcd.c |   4 ++
> >  drivers/usb/host/ehci-hub.c | 139 ------------------------------------
> >  drivers/usb/host/ehci-q.c   |   2 +-
> >  include/linux/usb/hcd.h     |  13 +++-
> >  5 files changed, 151 insertions(+), 141 deletions(-)
> > 
> > diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> > index 6119fb41d736..d7eb9f179ca6 100644
> > --- a/drivers/usb/core/hcd.c
> > +++ b/drivers/usb/core/hcd.c
> > @@ -2110,6 +2110,140 @@ int usb_hcd_get_frame_number (struct usb_device *udev)
> >  	return hcd->driver->get_frame_number (hcd);
> >  }
> >  
> > +/*-------------------------------------------------------------------------*/
> > +#ifdef CONFIG_USB_HCD_TEST_MODE
> > +
> > +static void usb_ehset_completion(struct urb *urb)
> > +{
> > +	struct completion  *done = urb->context;
> > +
> > +	complete(done);
> > +}
> > +/*
> > + * Allocate and initialize a control URB. This request will be used by the
> > + * EHSET SINGLE_STEP_SET_FEATURE test in which the DATA and STATUS stages
> > + * of the GetDescriptor request are sent 15 seconds after the SETUP stage.
> > + * Return NULL if failed.
> > + */
> > +static struct urb *request_single_step_set_feature_urb(
> > +	struct usb_device	*udev,
> > +	void			*dr,
> > +	void			*buf,
> > +	struct completion	*done)
> > +{
> > +	struct urb *urb;
> > +	struct usb_hcd *hcd = bus_to_hcd(udev->bus);
> > +	struct usb_host_endpoint *ep;
> > +
> > +	urb = usb_alloc_urb(0, GFP_KERNEL);
> > +	if (!urb)
> > +		return NULL;
> > +
> > +	urb->pipe = usb_rcvctrlpipe(udev, 0);
> > +	ep = (usb_pipein(urb->pipe) ? udev->ep_in : udev->ep_out)
> > +				[usb_pipeendpoint(urb->pipe)];
> > +	if (!ep) {
> > +		usb_free_urb(urb);
> > +		return NULL;
> > +	}
> > +
> > +	urb->ep = ep;
> > +	urb->dev = udev;
> > +	urb->setup_packet = (void *)dr;
> > +	urb->transfer_buffer = buf;
> > +	urb->transfer_buffer_length = USB_DT_DEVICE_SIZE;
> > +	urb->complete = usb_ehset_completion;
> > +	urb->status = -EINPROGRESS;
> > +	urb->actual_length = 0;
> > +	urb->transfer_flags = URB_DIR_IN;
> > +	usb_get_urb(urb);
> > +	atomic_inc(&urb->use_count);
> > +	atomic_inc(&urb->dev->urbnum);
> > +	urb->setup_dma = dma_map_single(
> > +			hcd->self.sysdev,
> > +			urb->setup_packet,
> > +			sizeof(struct usb_ctrlrequest),
> > +			DMA_TO_DEVICE);
> > +	urb->transfer_dma = dma_map_single(
> > +			hcd->self.sysdev,
> > +			urb->transfer_buffer,
> > +			urb->transfer_buffer_length,
> > +			DMA_FROM_DEVICE);
> 
> Maybe better to replace both of these dma_map_single() calls with
> one call to usb_hcd_map_urb_for_dma(hcd, urb, GFP_KERNEL)? 

In later patches, yes.  Not in this one that only moves code around.

thanks,

greg k-h

      reply	other threads:[~2021-04-22  8:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12  7:22 [PATCH 1/2] usb: host: move EH SINGLE_STEP_SET_FEATURE implementation to core Li Jun
2021-04-12  7:22 ` [PATCH 2/2] usb: host: xhci: add EH SINGLE_STEP_SET_FEATURE Test for USB2 Li Jun
2021-04-12 18:22 ` [PATCH 1/2] usb: host: move EH SINGLE_STEP_SET_FEATURE implementation to core Jack Pham
2021-04-22  8:46   ` Greg KH [this message]

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=YIE38ep8DwW6JMAC@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=jackp@codeaurora.org \
    --cc=jun.li@nxp.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=peter.chen@kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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.