From: Roger Quadros <rogerq@ti.com>
To: Pawel Laszczak <pawell@cadence.com>, devicetree@vger.kernel.org
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, adouglas@cadence.com,
jbergsagel@ti.com, nsekhar@ti.com, nm@ti.com,
sureshp@cadence.com, peter.chen@nxp.com, pjez@cadence.com,
kurahul@cadence.com
Subject: [RFC,v2,09/15] usb:cdns3: EpX operations part of the API
Date: Wed, 28 Nov 2018 14:46:10 +0200 [thread overview]
Message-ID: <5BFE8E12.9080307@ti.com> (raw)
On 18/11/18 12:09, Pawel Laszczak wrote:
> Patch implements callback functions for non-default endpoints
> defined in usb_ep_ops object.
>
> Signed-off-by: Pawel Laszczak <pawell@cadence.com>
> ---
> drivers/usb/cdns3/ep0.c | 18 ++
> drivers/usb/cdns3/gadget.c | 442 ++++++++++++++++++++++++++++++++++++-
> drivers/usb/cdns3/gadget.h | 3 +
> 3 files changed, 461 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c
> index c08d02665f9d..ca1795467155 100644
> --- a/drivers/usb/cdns3/ep0.c
> +++ b/drivers/usb/cdns3/ep0.c
> @@ -23,6 +23,24 @@ static void cdns3_prepare_setup_packet(struct cdns3_device *priv_dev)
> //TODO: Implements this function
> }
>
> +/**
> + * cdns3_gadget_ep_set_wedge Set wedge on selected endpoint
> + * @ep: endpoint object
> + *
> + * Returns 0
> + */
> +int cdns3_gadget_ep_set_wedge(struct usb_ep *ep)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> +
> + dev_dbg(&priv_dev->dev, "Wedge for %s\n", ep->name);
> + cdns3_gadget_ep_set_halt(ep, 1);
> + priv_ep->flags |= EP_WEDGE;
> +
> + return 0;
> +}
> +
> /**
> * cdns3_ep0_config - Configures default endpoint
> * @priv_dev: extended gadget object
> diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
> index 702a05faa664..1f2a434486dc 100644
> --- a/drivers/usb/cdns3/gadget.c
> +++ b/drivers/usb/cdns3/gadget.c
> @@ -58,6 +58,19 @@ void cdns3_set_register_bit(void __iomem *ptr, u32 mask)
> writel(mask, ptr);
> }
>
> +/**
> + * cdns3_next_request - returns next request from list
> + * @list: list containing requests
> + *
> + * Returns request or NULL if no requests in list
> + */
> +struct usb_request *cdns3_next_request(struct list_head *list)
> +{
> + if (list_empty(list))
> + return NULL;
> + return list_first_entry(list, struct usb_request, list);
> +}
> +
> /**
> * select_ep - selects endpoint
> * @priv_dev: extended gadget object
> @@ -73,6 +86,53 @@ void cdns3_select_ep(struct cdns3_device *priv_dev, u32 ep)
> writel(ep, &priv_dev->regs->ep_sel);
> }
>
> +/**
> + * cdns3_allocate_trb_pool - Allocates TRB's pool for selected endpoint
> + * @priv_ep: endpoint object
> + *
> + * Function will return 0 on success or -ENOMEM on allocation error
> + */
> +static int cdns3_allocate_trb_pool(struct cdns3_endpoint *priv_ep)
> +{
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + struct cdns3_trb *link_trb;
> +
> + if (!priv_ep->trb_pool) {
> + priv_ep->trb_pool = dma_zalloc_coherent(priv_dev->sysdev,
> + TRB_RIGN_SIZE,
TRB_RING_SIZE
> + &priv_ep->trb_pool_dma,
> + GFP_DMA);
> + if (!priv_ep->trb_pool)
> + return -ENOMEM;
> + } else {
> + memset(priv_ep->trb_pool, 0, TRB_RIGN_SIZE);
here too.
> + }
> +
> + if (!priv_ep->aligned_buff) {
> + priv_ep->aligned_buff = dma_alloc_coherent(priv_dev->sysdev,
> + CDNS3_UNALIGNED_BUF_SIZE,
CDNS3_ALIGNED_BUF_SIZE
> + &priv_ep->aligned_dma_addr,
> + GFP_DMA);
> + if (!priv_ep->aligned_buff) {
> + dma_free_coherent(priv_dev->sysdev,
> + TRB_RIGN_SIZE,
> + priv_ep->trb_pool,
> + priv_ep->trb_pool_dma);
> + priv_ep->trb_pool = NULL;
> +
> + return -ENOMEM;
> + }
> + }
> +
> + /* Initialize the last TRB as Link TRB */
> + link_trb = (priv_ep->trb_pool + TRBS_PER_SEGMENT - 1);
> + link_trb->buffer = TRB_BUFFER(priv_ep->trb_pool_dma);
> + link_trb->control = TRB_CYCLE | TRB_TYPE(TRB_LINK) |
> + TRB_CHAIN | TRB_TOGGLE;
> +
> + return 0;
> +}
> +
> static void cdns3_free_trb_pool(struct cdns3_endpoint *priv_ep)
> {
> struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> @@ -92,6 +152,73 @@ static void cdns3_free_trb_pool(struct cdns3_endpoint *priv_ep)
> }
> }
>
> +/**
> + * cdns3_data_flush - flush data at onchip buffer
> + * @priv_ep: endpoint object
> + *
> + * Endpoint must be selected before call to this function
> + *
> + * Returns zero on success or negative value on failure
> + */
> +static int cdns3_data_flush(struct cdns3_endpoint *priv_ep)
> +{
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> +
> + writel(EP_CMD_DFLUSH, &priv_dev->regs->ep_cmd);
> +
> + /* wait for DFLUSH cleared */
> + return cdns3_handshake(&priv_dev->regs->ep_cmd, EP_CMD_DFLUSH, 0, 100);
> +}
> +
> +/**
> + * cdns3_ep_stall_flush - Stalls and flushes selected endpoint
> + * @priv_ep: endpoint object
> + *
> + * Endpoint must be selected before call to this function
> + */
> +static void cdns3_ep_stall_flush(struct cdns3_endpoint *priv_ep)
> +{
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> +
> + writel(EP_CMD_DFLUSH | EP_CMD_ERDY | EP_CMD_SSTALL,
> + &priv_dev->regs->ep_cmd);
> +
> + /* wait for DFLUSH cleared */
> + cdns3_handshake(&priv_dev->regs->ep_cmd, EP_CMD_DFLUSH, 0, 100);
> + priv_ep->flags |= EP_STALL;
> +}
> +
> +/**
> + * cdns3_gadget_giveback - call struct usb_request's ->complete callback
> + * @priv_ep: The endpoint to whom the request belongs to
> + * @priv_req: The request we're giving back
> + * @status: completion code for the request
> + *
> + * Must be called with controller's lock held and interrupts disabled. This
> + * function will unmap @req and call its ->complete() callback to notify upper
> + * layers that it has completed.
> + */
> +void cdns3_gadget_giveback(struct cdns3_endpoint *priv_ep,
> + struct cdns3_request *priv_req,
> + int status)
> +{
> + //TODO: Implements this function.
> +}
> +
> +/**
> + * cdns3_ep_run_transfer - start transfer on no-default endpoint hardware
> + * @priv_ep: endpoint object
> + *
> + * Returns zero on success or negative value on failure
> + */
> +int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
> + struct usb_request *request)
> +{
> + //TODO: Implements this function.
> +
> + return 0;
> +}
> +
> /**
> * cdns3_irq_handler - irq line interrupt handler
> * @cdns: cdns3 instance
> @@ -170,6 +297,318 @@ static struct usb_ep *cdns3_gadget_match_ep(struct usb_gadget *gadget,
> return &priv_ep->endpoint;
> }
>
> +/**
> + * cdns3_gadget_ep_enable Enable endpoint
> + * @ep: endpoint object
> + * @desc: endpoint descriptor
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +static int cdns3_gadget_ep_enable(struct usb_ep *ep,
> + const struct usb_endpoint_descriptor *desc)
> +{
> + struct cdns3_endpoint *priv_ep;
> + struct cdns3_device *priv_dev;
> + unsigned long flags;
> + int ret;
> + u32 reg;
> +
> + priv_ep = ep_to_cdns3_ep(ep);
> + priv_dev = priv_ep->cdns3_dev;
> +
> + if (!ep || !desc || desc->bDescriptorType != USB_DT_ENDPOINT) {
> + dev_err(&priv_dev->dev, "usbss: invalid parameters\n");
dev_dbg()?
Gadget driver will be more verbose.
> + return -EINVAL;
> + }
> +
> + if (!desc->wMaxPacketSize) {
> + dev_err(&priv_dev->dev, "usbss: missing wMaxPacketSize\n");
> + return -EINVAL;
> + }
> +
> + if (dev_WARN_ONCE(&priv_dev->dev, priv_ep->flags & EP_ENABLED,
> + "%s is already enabled\n", priv_ep->name))
> + return 0;
> +
> + ret = cdns3_allocate_trb_pool(priv_ep);
> + if (ret)
> + return ret;
Why not allocate the TRB pool once for all endpoints at gadget init?
you don't seem to be calling cdns3_allocate_trb_pool() in cdns3_gadget_ep_disable().
> +
> + dev_dbg(&priv_dev->dev, "Enabling endpoint: %s\n", ep->name);
> + spin_lock_irqsave(&priv_dev->lock, flags);
> + cdns3_select_ep(priv_dev, desc->bEndpointAddress);
> + writel(EP_CMD_EPRST, &priv_dev->regs->ep_cmd);
> +
> + ret = cdns3_handshake(&priv_dev->regs->ep_cmd,
> + EP_CMD_CSTALL | EP_CMD_EPRST, 0, 100);
> +
> + cdns3_set_register_bit(&priv_dev->regs->ep_cfg, EP_CFG_ENABLE);
> +
> + ep->desc = desc;
> + priv_ep->flags &= ~(EP_PENDING_REQUEST | EP_STALL);
> + priv_ep->flags |= EP_ENABLED | EP_UPDATE_EP_TRBADDR;
> + priv_ep->enqueue = 0;
> + priv_ep->dequeue = 0;
> + reg = readl(&priv_dev->regs->ep_sts);
> + priv_ep->pcs = !!EP_STS_CCS(reg);
> + priv_ep->ccs = !!EP_STS_CCS(reg);
> + /* one TRB is reserved for link TRB used in DMULT mode*/
> + priv_ep->free_trbs = TRBS_PER_SEGMENT - 1;
> +
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> + return 0;
> +}
> +
> +/**
> + * cdns3_gadget_ep_disable Disable endpoint
> + * @ep: endpoint object
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +static int cdns3_gadget_ep_disable(struct usb_ep *ep)
> +{
> + struct cdns3_endpoint *priv_ep;
> + struct cdns3_device *priv_dev;
> + unsigned long flags;
> + int ret = 0;
> + struct usb_request *request;
> + u32 ep_cfg;
> +
> + if (!ep) {
> + pr_debug("usbss: invalid parameters\n");
> + return -EINVAL;
> + }
> +
> + priv_ep = ep_to_cdns3_ep(ep);
> + priv_dev = priv_ep->cdns3_dev;
> +
> + if (dev_WARN_ONCE(&priv_dev->dev, !(priv_ep->flags & EP_ENABLED),
> + "%s is already disabled\n", priv_ep->name))
> + return 0;
> +
> + spin_lock_irqsave(&priv_dev->lock, flags);
> + if (!priv_dev->start_gadget) {
> + dev_dbg(&priv_dev->dev,
> + "Disabling endpoint at disconnection: %s\n", ep->name);
This flag is looking very tricky.
What do you mean by "disabling at disconnection"?
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> + return 0;
EP is not yet disabled and we're returning 0. This will cause an unbalance.
I'd avoid that flag altogether.
> + }
> +
> + dev_dbg(&priv_dev->dev, "Disabling endpoint: %s\n", ep->name);
> +
> + cdns3_select_ep(priv_dev, ep->desc->bEndpointAddress);
> + ret = cdns3_data_flush(priv_ep);
> + while (!list_empty(&priv_ep->request_list)) {
> + request = cdns3_next_request(&priv_ep->request_list);
> +
> + cdns3_gadget_giveback(priv_ep, to_cdns3_request(request),
> + -ESHUTDOWN);
> + }
> +
> + ep_cfg = readl(&priv_dev->regs->ep_cfg);
> + ep_cfg &= ~EP_CFG_ENABLE;
> + writel(ep_cfg, &priv_dev->regs->ep_cfg);
> + ep->desc = NULL;
> + priv_ep->flags &= ~EP_ENABLED;
> +
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> +
> + return ret;
> +}
> +
> +/**
> + * cdns3_gadget_ep_alloc_request Allocates request
> + * @ep: endpoint object associated with request
> + * @gfp_flags: gfp flags
> + *
> + * Returns allocated request address, NULL on allocation error
> + */
> +struct usb_request *cdns3_gadget_ep_alloc_request(struct usb_ep *ep,
> + gfp_t gfp_flags)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_request *priv_req;
> +
> + priv_req = kzalloc(sizeof(*priv_req), gfp_flags);
> + if (!priv_req)
> + return NULL;
> +
> + priv_req->priv_ep = priv_ep;
> +
> + return &priv_req->request;
> +}
> +
> +/**
> + * cdns3_gadget_ep_free_request Free memory occupied by request
> + * @ep: endpoint object associated with request
> + * @request: request to free memory
> + */
> +void cdns3_gadget_ep_free_request(struct usb_ep *ep,
> + struct usb_request *request)
> +{
> + struct cdns3_request *priv_req = to_cdns3_request(request);
> +
> + kfree(priv_req);
> +}
> +
> +/**
> + * cdns3_gadget_ep_queue Transfer data on endpoint
> + * @ep: endpoint object
> + * @request: request object
> + * @gfp_flags: gfp flags
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +static int __cdns3_gadget_ep_queue(struct usb_ep *ep,
> + struct usb_request *request,
> + gfp_t gfp_flags)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + int ret = 0;
> +
> + request->actual = 0;
> + request->status = -EINPROGRESS;
> +
> + dev_dbg(&priv_dev->dev, "Queuing to endpoint: %s\n", priv_ep->name);
> +
> + ret = usb_gadget_map_request_by_dev(priv_dev->sysdev, request,
> + usb_endpoint_dir_in(ep->desc));
> +
> + if (ret)
> + return ret;
> +
> + if (!cdns3_ep_run_transfer(priv_ep, request))
> + list_add_tail(&request->list, &priv_ep->request_list);
how about catching the return value if cdns3_ep_run_transfer() fails?
> +
> + return ret;
> +}
> +
> +static int cdns3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
> + gfp_t gfp_flags)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + struct usb_request *zlp_request;
> + unsigned long flags;
> + int ret;
> +
> + spin_lock_irqsave(&priv_dev->lock, flags);
> + ret = __cdns3_gadget_ep_queue(ep, request, gfp_flags);
> +
> + if (ret == 0 && request->zero && request->length &&
> + (request->length % ep->maxpacket == 0)) {
> + zlp_request = cdns3_gadget_ep_alloc_request(ep, GFP_ATOMIC);
> + zlp_request->buf = priv_dev->zlp_buf;
> + zlp_request->length = 0;
> +
> + dev_dbg(&priv_dev->dev, "Queuing ZLP for endpoint: %s\n",
> + priv_ep->name);
> + ret = __cdns3_gadget_ep_queue(ep, zlp_request, gfp_flags);
Who is going to free this zlp_request?
> + }
> +
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> + return ret;
> +}
> +
> +/**
> + * cdns3_gadget_ep_dequeue Remove request from transfer queue
> + * @ep: endpoint object associated with request
> + * @request: request object
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +int cdns3_gadget_ep_dequeue(struct usb_ep *ep,
> + struct usb_request *request)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + struct usb_request *req, *req_temp;
> + unsigned long flags;
> + int ret = 0;
> +
> + if (!ep || !request || !ep->desc)
> + return -EINVAL;
> +
> + spin_lock_irqsave(&priv_dev->lock, flags);
> + dev_dbg(&priv_dev->dev, "Dequeue from %s\n", ep->name);
> +
> + cdns3_select_ep(priv_dev, ep->desc->bEndpointAddress);
> + if (priv_dev->start_gadget)
> + ret = cdns3_data_flush(priv_ep);
> +
> + list_for_each_entry_safe(req, req_temp, &priv_ep->request_list, list) {
> + if (request == req) {
> + cdns3_gadget_giveback(priv_ep,
> + to_cdns3_request(request),
> + -ECONNRESET);
> + break;
> + }
> + }
> +
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> + return ret;
> +}
> +
> +/**
> + * cdns3_gadget_ep_set_halt Sets/clears stall on selected endpoint
> + * @ep: endpoint object to set/clear stall on
> + * @value: 1 for set stall, 0 for clear stall
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +int cdns3_gadget_ep_set_halt(struct usb_ep *ep, int value)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + unsigned long flags;
> + int ret = 0;
> +
> + if (!(priv_ep->flags & EP_ENABLED))
> + return -EPERM;
> +
> + /* if actual transfer is pending defer setting stall on this endpoint */
> + if ((priv_ep->flags & EP_PENDING_REQUEST) && value) {
> + priv_ep->flags |= EP_STALL;
> + return 0;
> + }
> +
> + dev_dbg(&priv_dev->dev, "Halt endpoint %s\n", priv_ep->name);
> +
> + spin_lock_irqsave(&priv_dev->lock, flags);
How about grabbing the lock before checking for priv->ep->flags?
> +
> + cdns3_select_ep(priv_dev, ep->desc->bEndpointAddress);
> + if (value) {
> + cdns3_ep_stall_flush(priv_ep);
> + } else {
> + priv_ep->flags &= ~EP_WEDGE;
> + writel(EP_CMD_CSTALL | EP_CMD_EPRST, &priv_dev->regs->ep_cmd);
> +
> + /* wait for EPRST cleared */
> + ret = cdns3_handshake(&priv_dev->regs->ep_cmd,
> + EP_CMD_EPRST, 0, 100);
if there was an error we shouldn't be clearing the EP_STALL right
and leave the pending flag?
> + priv_ep->flags &= ~EP_STALL;
> + }
> +
> + priv_ep->flags &= ~EP_PENDING_REQUEST;
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> +
> + return ret;
> +}
> +
> +extern const struct usb_ep_ops cdns3_gadget_ep0_ops;
> +
> +static const struct usb_ep_ops cdns3_gadget_ep_ops = {
> + .enable = cdns3_gadget_ep_enable,
> + .disable = cdns3_gadget_ep_disable,
> + .alloc_request = cdns3_gadget_ep_alloc_request,
> + .free_request = cdns3_gadget_ep_free_request,
> + .queue = cdns3_gadget_ep_queue,
> + .dequeue = cdns3_gadget_ep_dequeue,
> + .set_halt = cdns3_gadget_ep_set_halt,
> + .set_wedge = cdns3_gadget_ep_set_wedge,
> +};
> +
> /**
> * cdns3_gadget_get_frame Returns number of actual ITP frame
> * @gadget: gadget object
> @@ -365,8 +804,7 @@ static int cdns3_init_ep(struct cdns3_device *priv_dev)
> usb_ep_set_maxpacket_limit(&priv_ep->endpoint,
> ENDPOINT_MAX_PACKET_LIMIT);
> priv_ep->endpoint.max_streams = ENDPOINT_MAX_STREAMS;
> - //TODO: Add implementation of cdns3_gadget_ep_ops
> - //priv_ep->endpoint.ops = &cdns3_gadget_ep_ops;
> + priv_ep->endpoint.ops = &cdns3_gadget_ep_ops;
> if (ep_dir)
> priv_ep->endpoint.caps.dir_in = 1;
> else
> diff --git a/drivers/usb/cdns3/gadget.h b/drivers/usb/cdns3/gadget.h
> index 3b0d4d2e4831..a4be288b34cb 100644
> --- a/drivers/usb/cdns3/gadget.h
> +++ b/drivers/usb/cdns3/gadget.h
> @@ -1072,4 +1072,7 @@ void cdns3_set_register_bit(void __iomem *ptr, u32 mask);
> int cdns3_init_ep0(struct cdns3_device *priv_dev);
> void cdns3_ep0_config(struct cdns3_device *priv_dev);
> void cdns3_select_ep(struct cdns3_device *priv_dev, u32 ep);
> +int cdns3_gadget_ep_set_wedge(struct usb_ep *ep);
> +int cdns3_gadget_ep_set_halt(struct usb_ep *ep, int value);
> +
> #endif /* __LINUX_CDNS3_GADGET */
>
cheers,
-roger
WARNING: multiple messages have this Message-ID (diff)
From: Roger Quadros <rogerq@ti.com>
To: Pawel Laszczak <pawell@cadence.com>, devicetree@vger.kernel.org
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, adouglas@cadence.com,
jbergsagel@ti.com, nsekhar@ti.com, nm@ti.com,
sureshp@cadence.com, peter.chen@nxp.com, pjez@cadence.com,
kurahul@cadence.com
Subject: Re: [RFC PATCH v2 09/15] usb:cdns3: EpX operations part of the API
Date: Wed, 28 Nov 2018 14:46:10 +0200 [thread overview]
Message-ID: <5BFE8E12.9080307@ti.com> (raw)
In-Reply-To: <1542535751-16079-10-git-send-email-pawell@cadence.com>
On 18/11/18 12:09, Pawel Laszczak wrote:
> Patch implements callback functions for non-default endpoints
> defined in usb_ep_ops object.
>
> Signed-off-by: Pawel Laszczak <pawell@cadence.com>
> ---
> drivers/usb/cdns3/ep0.c | 18 ++
> drivers/usb/cdns3/gadget.c | 442 ++++++++++++++++++++++++++++++++++++-
> drivers/usb/cdns3/gadget.h | 3 +
> 3 files changed, 461 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c
> index c08d02665f9d..ca1795467155 100644
> --- a/drivers/usb/cdns3/ep0.c
> +++ b/drivers/usb/cdns3/ep0.c
> @@ -23,6 +23,24 @@ static void cdns3_prepare_setup_packet(struct cdns3_device *priv_dev)
> //TODO: Implements this function
> }
>
> +/**
> + * cdns3_gadget_ep_set_wedge Set wedge on selected endpoint
> + * @ep: endpoint object
> + *
> + * Returns 0
> + */
> +int cdns3_gadget_ep_set_wedge(struct usb_ep *ep)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> +
> + dev_dbg(&priv_dev->dev, "Wedge for %s\n", ep->name);
> + cdns3_gadget_ep_set_halt(ep, 1);
> + priv_ep->flags |= EP_WEDGE;
> +
> + return 0;
> +}
> +
> /**
> * cdns3_ep0_config - Configures default endpoint
> * @priv_dev: extended gadget object
> diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
> index 702a05faa664..1f2a434486dc 100644
> --- a/drivers/usb/cdns3/gadget.c
> +++ b/drivers/usb/cdns3/gadget.c
> @@ -58,6 +58,19 @@ void cdns3_set_register_bit(void __iomem *ptr, u32 mask)
> writel(mask, ptr);
> }
>
> +/**
> + * cdns3_next_request - returns next request from list
> + * @list: list containing requests
> + *
> + * Returns request or NULL if no requests in list
> + */
> +struct usb_request *cdns3_next_request(struct list_head *list)
> +{
> + if (list_empty(list))
> + return NULL;
> + return list_first_entry(list, struct usb_request, list);
> +}
> +
> /**
> * select_ep - selects endpoint
> * @priv_dev: extended gadget object
> @@ -73,6 +86,53 @@ void cdns3_select_ep(struct cdns3_device *priv_dev, u32 ep)
> writel(ep, &priv_dev->regs->ep_sel);
> }
>
> +/**
> + * cdns3_allocate_trb_pool - Allocates TRB's pool for selected endpoint
> + * @priv_ep: endpoint object
> + *
> + * Function will return 0 on success or -ENOMEM on allocation error
> + */
> +static int cdns3_allocate_trb_pool(struct cdns3_endpoint *priv_ep)
> +{
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + struct cdns3_trb *link_trb;
> +
> + if (!priv_ep->trb_pool) {
> + priv_ep->trb_pool = dma_zalloc_coherent(priv_dev->sysdev,
> + TRB_RIGN_SIZE,
TRB_RING_SIZE
> + &priv_ep->trb_pool_dma,
> + GFP_DMA);
> + if (!priv_ep->trb_pool)
> + return -ENOMEM;
> + } else {
> + memset(priv_ep->trb_pool, 0, TRB_RIGN_SIZE);
here too.
> + }
> +
> + if (!priv_ep->aligned_buff) {
> + priv_ep->aligned_buff = dma_alloc_coherent(priv_dev->sysdev,
> + CDNS3_UNALIGNED_BUF_SIZE,
CDNS3_ALIGNED_BUF_SIZE
> + &priv_ep->aligned_dma_addr,
> + GFP_DMA);
> + if (!priv_ep->aligned_buff) {
> + dma_free_coherent(priv_dev->sysdev,
> + TRB_RIGN_SIZE,
> + priv_ep->trb_pool,
> + priv_ep->trb_pool_dma);
> + priv_ep->trb_pool = NULL;
> +
> + return -ENOMEM;
> + }
> + }
> +
> + /* Initialize the last TRB as Link TRB */
> + link_trb = (priv_ep->trb_pool + TRBS_PER_SEGMENT - 1);
> + link_trb->buffer = TRB_BUFFER(priv_ep->trb_pool_dma);
> + link_trb->control = TRB_CYCLE | TRB_TYPE(TRB_LINK) |
> + TRB_CHAIN | TRB_TOGGLE;
> +
> + return 0;
> +}
> +
> static void cdns3_free_trb_pool(struct cdns3_endpoint *priv_ep)
> {
> struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> @@ -92,6 +152,73 @@ static void cdns3_free_trb_pool(struct cdns3_endpoint *priv_ep)
> }
> }
>
> +/**
> + * cdns3_data_flush - flush data at onchip buffer
> + * @priv_ep: endpoint object
> + *
> + * Endpoint must be selected before call to this function
> + *
> + * Returns zero on success or negative value on failure
> + */
> +static int cdns3_data_flush(struct cdns3_endpoint *priv_ep)
> +{
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> +
> + writel(EP_CMD_DFLUSH, &priv_dev->regs->ep_cmd);
> +
> + /* wait for DFLUSH cleared */
> + return cdns3_handshake(&priv_dev->regs->ep_cmd, EP_CMD_DFLUSH, 0, 100);
> +}
> +
> +/**
> + * cdns3_ep_stall_flush - Stalls and flushes selected endpoint
> + * @priv_ep: endpoint object
> + *
> + * Endpoint must be selected before call to this function
> + */
> +static void cdns3_ep_stall_flush(struct cdns3_endpoint *priv_ep)
> +{
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> +
> + writel(EP_CMD_DFLUSH | EP_CMD_ERDY | EP_CMD_SSTALL,
> + &priv_dev->regs->ep_cmd);
> +
> + /* wait for DFLUSH cleared */
> + cdns3_handshake(&priv_dev->regs->ep_cmd, EP_CMD_DFLUSH, 0, 100);
> + priv_ep->flags |= EP_STALL;
> +}
> +
> +/**
> + * cdns3_gadget_giveback - call struct usb_request's ->complete callback
> + * @priv_ep: The endpoint to whom the request belongs to
> + * @priv_req: The request we're giving back
> + * @status: completion code for the request
> + *
> + * Must be called with controller's lock held and interrupts disabled. This
> + * function will unmap @req and call its ->complete() callback to notify upper
> + * layers that it has completed.
> + */
> +void cdns3_gadget_giveback(struct cdns3_endpoint *priv_ep,
> + struct cdns3_request *priv_req,
> + int status)
> +{
> + //TODO: Implements this function.
> +}
> +
> +/**
> + * cdns3_ep_run_transfer - start transfer on no-default endpoint hardware
> + * @priv_ep: endpoint object
> + *
> + * Returns zero on success or negative value on failure
> + */
> +int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
> + struct usb_request *request)
> +{
> + //TODO: Implements this function.
> +
> + return 0;
> +}
> +
> /**
> * cdns3_irq_handler - irq line interrupt handler
> * @cdns: cdns3 instance
> @@ -170,6 +297,318 @@ static struct usb_ep *cdns3_gadget_match_ep(struct usb_gadget *gadget,
> return &priv_ep->endpoint;
> }
>
> +/**
> + * cdns3_gadget_ep_enable Enable endpoint
> + * @ep: endpoint object
> + * @desc: endpoint descriptor
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +static int cdns3_gadget_ep_enable(struct usb_ep *ep,
> + const struct usb_endpoint_descriptor *desc)
> +{
> + struct cdns3_endpoint *priv_ep;
> + struct cdns3_device *priv_dev;
> + unsigned long flags;
> + int ret;
> + u32 reg;
> +
> + priv_ep = ep_to_cdns3_ep(ep);
> + priv_dev = priv_ep->cdns3_dev;
> +
> + if (!ep || !desc || desc->bDescriptorType != USB_DT_ENDPOINT) {
> + dev_err(&priv_dev->dev, "usbss: invalid parameters\n");
dev_dbg()?
Gadget driver will be more verbose.
> + return -EINVAL;
> + }
> +
> + if (!desc->wMaxPacketSize) {
> + dev_err(&priv_dev->dev, "usbss: missing wMaxPacketSize\n");
> + return -EINVAL;
> + }
> +
> + if (dev_WARN_ONCE(&priv_dev->dev, priv_ep->flags & EP_ENABLED,
> + "%s is already enabled\n", priv_ep->name))
> + return 0;
> +
> + ret = cdns3_allocate_trb_pool(priv_ep);
> + if (ret)
> + return ret;
Why not allocate the TRB pool once for all endpoints at gadget init?
you don't seem to be calling cdns3_allocate_trb_pool() in cdns3_gadget_ep_disable().
> +
> + dev_dbg(&priv_dev->dev, "Enabling endpoint: %s\n", ep->name);
> + spin_lock_irqsave(&priv_dev->lock, flags);
> + cdns3_select_ep(priv_dev, desc->bEndpointAddress);
> + writel(EP_CMD_EPRST, &priv_dev->regs->ep_cmd);
> +
> + ret = cdns3_handshake(&priv_dev->regs->ep_cmd,
> + EP_CMD_CSTALL | EP_CMD_EPRST, 0, 100);
> +
> + cdns3_set_register_bit(&priv_dev->regs->ep_cfg, EP_CFG_ENABLE);
> +
> + ep->desc = desc;
> + priv_ep->flags &= ~(EP_PENDING_REQUEST | EP_STALL);
> + priv_ep->flags |= EP_ENABLED | EP_UPDATE_EP_TRBADDR;
> + priv_ep->enqueue = 0;
> + priv_ep->dequeue = 0;
> + reg = readl(&priv_dev->regs->ep_sts);
> + priv_ep->pcs = !!EP_STS_CCS(reg);
> + priv_ep->ccs = !!EP_STS_CCS(reg);
> + /* one TRB is reserved for link TRB used in DMULT mode*/
> + priv_ep->free_trbs = TRBS_PER_SEGMENT - 1;
> +
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> + return 0;
> +}
> +
> +/**
> + * cdns3_gadget_ep_disable Disable endpoint
> + * @ep: endpoint object
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +static int cdns3_gadget_ep_disable(struct usb_ep *ep)
> +{
> + struct cdns3_endpoint *priv_ep;
> + struct cdns3_device *priv_dev;
> + unsigned long flags;
> + int ret = 0;
> + struct usb_request *request;
> + u32 ep_cfg;
> +
> + if (!ep) {
> + pr_debug("usbss: invalid parameters\n");
> + return -EINVAL;
> + }
> +
> + priv_ep = ep_to_cdns3_ep(ep);
> + priv_dev = priv_ep->cdns3_dev;
> +
> + if (dev_WARN_ONCE(&priv_dev->dev, !(priv_ep->flags & EP_ENABLED),
> + "%s is already disabled\n", priv_ep->name))
> + return 0;
> +
> + spin_lock_irqsave(&priv_dev->lock, flags);
> + if (!priv_dev->start_gadget) {
> + dev_dbg(&priv_dev->dev,
> + "Disabling endpoint at disconnection: %s\n", ep->name);
This flag is looking very tricky.
What do you mean by "disabling at disconnection"?
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> + return 0;
EP is not yet disabled and we're returning 0. This will cause an unbalance.
I'd avoid that flag altogether.
> + }
> +
> + dev_dbg(&priv_dev->dev, "Disabling endpoint: %s\n", ep->name);
> +
> + cdns3_select_ep(priv_dev, ep->desc->bEndpointAddress);
> + ret = cdns3_data_flush(priv_ep);
> + while (!list_empty(&priv_ep->request_list)) {
> + request = cdns3_next_request(&priv_ep->request_list);
> +
> + cdns3_gadget_giveback(priv_ep, to_cdns3_request(request),
> + -ESHUTDOWN);
> + }
> +
> + ep_cfg = readl(&priv_dev->regs->ep_cfg);
> + ep_cfg &= ~EP_CFG_ENABLE;
> + writel(ep_cfg, &priv_dev->regs->ep_cfg);
> + ep->desc = NULL;
> + priv_ep->flags &= ~EP_ENABLED;
> +
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> +
> + return ret;
> +}
> +
> +/**
> + * cdns3_gadget_ep_alloc_request Allocates request
> + * @ep: endpoint object associated with request
> + * @gfp_flags: gfp flags
> + *
> + * Returns allocated request address, NULL on allocation error
> + */
> +struct usb_request *cdns3_gadget_ep_alloc_request(struct usb_ep *ep,
> + gfp_t gfp_flags)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_request *priv_req;
> +
> + priv_req = kzalloc(sizeof(*priv_req), gfp_flags);
> + if (!priv_req)
> + return NULL;
> +
> + priv_req->priv_ep = priv_ep;
> +
> + return &priv_req->request;
> +}
> +
> +/**
> + * cdns3_gadget_ep_free_request Free memory occupied by request
> + * @ep: endpoint object associated with request
> + * @request: request to free memory
> + */
> +void cdns3_gadget_ep_free_request(struct usb_ep *ep,
> + struct usb_request *request)
> +{
> + struct cdns3_request *priv_req = to_cdns3_request(request);
> +
> + kfree(priv_req);
> +}
> +
> +/**
> + * cdns3_gadget_ep_queue Transfer data on endpoint
> + * @ep: endpoint object
> + * @request: request object
> + * @gfp_flags: gfp flags
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +static int __cdns3_gadget_ep_queue(struct usb_ep *ep,
> + struct usb_request *request,
> + gfp_t gfp_flags)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + int ret = 0;
> +
> + request->actual = 0;
> + request->status = -EINPROGRESS;
> +
> + dev_dbg(&priv_dev->dev, "Queuing to endpoint: %s\n", priv_ep->name);
> +
> + ret = usb_gadget_map_request_by_dev(priv_dev->sysdev, request,
> + usb_endpoint_dir_in(ep->desc));
> +
> + if (ret)
> + return ret;
> +
> + if (!cdns3_ep_run_transfer(priv_ep, request))
> + list_add_tail(&request->list, &priv_ep->request_list);
how about catching the return value if cdns3_ep_run_transfer() fails?
> +
> + return ret;
> +}
> +
> +static int cdns3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
> + gfp_t gfp_flags)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + struct usb_request *zlp_request;
> + unsigned long flags;
> + int ret;
> +
> + spin_lock_irqsave(&priv_dev->lock, flags);
> + ret = __cdns3_gadget_ep_queue(ep, request, gfp_flags);
> +
> + if (ret == 0 && request->zero && request->length &&
> + (request->length % ep->maxpacket == 0)) {
> + zlp_request = cdns3_gadget_ep_alloc_request(ep, GFP_ATOMIC);
> + zlp_request->buf = priv_dev->zlp_buf;
> + zlp_request->length = 0;
> +
> + dev_dbg(&priv_dev->dev, "Queuing ZLP for endpoint: %s\n",
> + priv_ep->name);
> + ret = __cdns3_gadget_ep_queue(ep, zlp_request, gfp_flags);
Who is going to free this zlp_request?
> + }
> +
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> + return ret;
> +}
> +
> +/**
> + * cdns3_gadget_ep_dequeue Remove request from transfer queue
> + * @ep: endpoint object associated with request
> + * @request: request object
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +int cdns3_gadget_ep_dequeue(struct usb_ep *ep,
> + struct usb_request *request)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + struct usb_request *req, *req_temp;
> + unsigned long flags;
> + int ret = 0;
> +
> + if (!ep || !request || !ep->desc)
> + return -EINVAL;
> +
> + spin_lock_irqsave(&priv_dev->lock, flags);
> + dev_dbg(&priv_dev->dev, "Dequeue from %s\n", ep->name);
> +
> + cdns3_select_ep(priv_dev, ep->desc->bEndpointAddress);
> + if (priv_dev->start_gadget)
> + ret = cdns3_data_flush(priv_ep);
> +
> + list_for_each_entry_safe(req, req_temp, &priv_ep->request_list, list) {
> + if (request == req) {
> + cdns3_gadget_giveback(priv_ep,
> + to_cdns3_request(request),
> + -ECONNRESET);
> + break;
> + }
> + }
> +
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> + return ret;
> +}
> +
> +/**
> + * cdns3_gadget_ep_set_halt Sets/clears stall on selected endpoint
> + * @ep: endpoint object to set/clear stall on
> + * @value: 1 for set stall, 0 for clear stall
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +int cdns3_gadget_ep_set_halt(struct usb_ep *ep, int value)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + unsigned long flags;
> + int ret = 0;
> +
> + if (!(priv_ep->flags & EP_ENABLED))
> + return -EPERM;
> +
> + /* if actual transfer is pending defer setting stall on this endpoint */
> + if ((priv_ep->flags & EP_PENDING_REQUEST) && value) {
> + priv_ep->flags |= EP_STALL;
> + return 0;
> + }
> +
> + dev_dbg(&priv_dev->dev, "Halt endpoint %s\n", priv_ep->name);
> +
> + spin_lock_irqsave(&priv_dev->lock, flags);
How about grabbing the lock before checking for priv->ep->flags?
> +
> + cdns3_select_ep(priv_dev, ep->desc->bEndpointAddress);
> + if (value) {
> + cdns3_ep_stall_flush(priv_ep);
> + } else {
> + priv_ep->flags &= ~EP_WEDGE;
> + writel(EP_CMD_CSTALL | EP_CMD_EPRST, &priv_dev->regs->ep_cmd);
> +
> + /* wait for EPRST cleared */
> + ret = cdns3_handshake(&priv_dev->regs->ep_cmd,
> + EP_CMD_EPRST, 0, 100);
if there was an error we shouldn't be clearing the EP_STALL right
and leave the pending flag?
> + priv_ep->flags &= ~EP_STALL;
> + }
> +
> + priv_ep->flags &= ~EP_PENDING_REQUEST;
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> +
> + return ret;
> +}
> +
> +extern const struct usb_ep_ops cdns3_gadget_ep0_ops;
> +
> +static const struct usb_ep_ops cdns3_gadget_ep_ops = {
> + .enable = cdns3_gadget_ep_enable,
> + .disable = cdns3_gadget_ep_disable,
> + .alloc_request = cdns3_gadget_ep_alloc_request,
> + .free_request = cdns3_gadget_ep_free_request,
> + .queue = cdns3_gadget_ep_queue,
> + .dequeue = cdns3_gadget_ep_dequeue,
> + .set_halt = cdns3_gadget_ep_set_halt,
> + .set_wedge = cdns3_gadget_ep_set_wedge,
> +};
> +
> /**
> * cdns3_gadget_get_frame Returns number of actual ITP frame
> * @gadget: gadget object
> @@ -365,8 +804,7 @@ static int cdns3_init_ep(struct cdns3_device *priv_dev)
> usb_ep_set_maxpacket_limit(&priv_ep->endpoint,
> ENDPOINT_MAX_PACKET_LIMIT);
> priv_ep->endpoint.max_streams = ENDPOINT_MAX_STREAMS;
> - //TODO: Add implementation of cdns3_gadget_ep_ops
> - //priv_ep->endpoint.ops = &cdns3_gadget_ep_ops;
> + priv_ep->endpoint.ops = &cdns3_gadget_ep_ops;
> if (ep_dir)
> priv_ep->endpoint.caps.dir_in = 1;
> else
> diff --git a/drivers/usb/cdns3/gadget.h b/drivers/usb/cdns3/gadget.h
> index 3b0d4d2e4831..a4be288b34cb 100644
> --- a/drivers/usb/cdns3/gadget.h
> +++ b/drivers/usb/cdns3/gadget.h
> @@ -1072,4 +1072,7 @@ void cdns3_set_register_bit(void __iomem *ptr, u32 mask);
> int cdns3_init_ep0(struct cdns3_device *priv_dev);
> void cdns3_ep0_config(struct cdns3_device *priv_dev);
> void cdns3_select_ep(struct cdns3_device *priv_dev, u32 ep);
> +int cdns3_gadget_ep_set_wedge(struct usb_ep *ep);
> +int cdns3_gadget_ep_set_halt(struct usb_ep *ep, int value);
> +
> #endif /* __LINUX_CDNS3_GADGET */
>
cheers,
-roger
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
WARNING: multiple messages have this Message-ID (diff)
From: Roger Quadros <rogerq@ti.com>
To: Pawel Laszczak <pawell@cadence.com>, <devicetree@vger.kernel.org>
Cc: <gregkh@linuxfoundation.org>, <linux-usb@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <adouglas@cadence.com>,
<jbergsagel@ti.com>, <nsekhar@ti.com>, <nm@ti.com>,
<sureshp@cadence.com>, <peter.chen@nxp.com>, <pjez@cadence.com>,
<kurahul@cadence.com>
Subject: Re: [RFC PATCH v2 09/15] usb:cdns3: EpX operations part of the API
Date: Wed, 28 Nov 2018 14:46:10 +0200 [thread overview]
Message-ID: <5BFE8E12.9080307@ti.com> (raw)
In-Reply-To: <1542535751-16079-10-git-send-email-pawell@cadence.com>
On 18/11/18 12:09, Pawel Laszczak wrote:
> Patch implements callback functions for non-default endpoints
> defined in usb_ep_ops object.
>
> Signed-off-by: Pawel Laszczak <pawell@cadence.com>
> ---
> drivers/usb/cdns3/ep0.c | 18 ++
> drivers/usb/cdns3/gadget.c | 442 ++++++++++++++++++++++++++++++++++++-
> drivers/usb/cdns3/gadget.h | 3 +
> 3 files changed, 461 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c
> index c08d02665f9d..ca1795467155 100644
> --- a/drivers/usb/cdns3/ep0.c
> +++ b/drivers/usb/cdns3/ep0.c
> @@ -23,6 +23,24 @@ static void cdns3_prepare_setup_packet(struct cdns3_device *priv_dev)
> //TODO: Implements this function
> }
>
> +/**
> + * cdns3_gadget_ep_set_wedge Set wedge on selected endpoint
> + * @ep: endpoint object
> + *
> + * Returns 0
> + */
> +int cdns3_gadget_ep_set_wedge(struct usb_ep *ep)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> +
> + dev_dbg(&priv_dev->dev, "Wedge for %s\n", ep->name);
> + cdns3_gadget_ep_set_halt(ep, 1);
> + priv_ep->flags |= EP_WEDGE;
> +
> + return 0;
> +}
> +
> /**
> * cdns3_ep0_config - Configures default endpoint
> * @priv_dev: extended gadget object
> diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
> index 702a05faa664..1f2a434486dc 100644
> --- a/drivers/usb/cdns3/gadget.c
> +++ b/drivers/usb/cdns3/gadget.c
> @@ -58,6 +58,19 @@ void cdns3_set_register_bit(void __iomem *ptr, u32 mask)
> writel(mask, ptr);
> }
>
> +/**
> + * cdns3_next_request - returns next request from list
> + * @list: list containing requests
> + *
> + * Returns request or NULL if no requests in list
> + */
> +struct usb_request *cdns3_next_request(struct list_head *list)
> +{
> + if (list_empty(list))
> + return NULL;
> + return list_first_entry(list, struct usb_request, list);
> +}
> +
> /**
> * select_ep - selects endpoint
> * @priv_dev: extended gadget object
> @@ -73,6 +86,53 @@ void cdns3_select_ep(struct cdns3_device *priv_dev, u32 ep)
> writel(ep, &priv_dev->regs->ep_sel);
> }
>
> +/**
> + * cdns3_allocate_trb_pool - Allocates TRB's pool for selected endpoint
> + * @priv_ep: endpoint object
> + *
> + * Function will return 0 on success or -ENOMEM on allocation error
> + */
> +static int cdns3_allocate_trb_pool(struct cdns3_endpoint *priv_ep)
> +{
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + struct cdns3_trb *link_trb;
> +
> + if (!priv_ep->trb_pool) {
> + priv_ep->trb_pool = dma_zalloc_coherent(priv_dev->sysdev,
> + TRB_RIGN_SIZE,
TRB_RING_SIZE
> + &priv_ep->trb_pool_dma,
> + GFP_DMA);
> + if (!priv_ep->trb_pool)
> + return -ENOMEM;
> + } else {
> + memset(priv_ep->trb_pool, 0, TRB_RIGN_SIZE);
here too.
> + }
> +
> + if (!priv_ep->aligned_buff) {
> + priv_ep->aligned_buff = dma_alloc_coherent(priv_dev->sysdev,
> + CDNS3_UNALIGNED_BUF_SIZE,
CDNS3_ALIGNED_BUF_SIZE
> + &priv_ep->aligned_dma_addr,
> + GFP_DMA);
> + if (!priv_ep->aligned_buff) {
> + dma_free_coherent(priv_dev->sysdev,
> + TRB_RIGN_SIZE,
> + priv_ep->trb_pool,
> + priv_ep->trb_pool_dma);
> + priv_ep->trb_pool = NULL;
> +
> + return -ENOMEM;
> + }
> + }
> +
> + /* Initialize the last TRB as Link TRB */
> + link_trb = (priv_ep->trb_pool + TRBS_PER_SEGMENT - 1);
> + link_trb->buffer = TRB_BUFFER(priv_ep->trb_pool_dma);
> + link_trb->control = TRB_CYCLE | TRB_TYPE(TRB_LINK) |
> + TRB_CHAIN | TRB_TOGGLE;
> +
> + return 0;
> +}
> +
> static void cdns3_free_trb_pool(struct cdns3_endpoint *priv_ep)
> {
> struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> @@ -92,6 +152,73 @@ static void cdns3_free_trb_pool(struct cdns3_endpoint *priv_ep)
> }
> }
>
> +/**
> + * cdns3_data_flush - flush data at onchip buffer
> + * @priv_ep: endpoint object
> + *
> + * Endpoint must be selected before call to this function
> + *
> + * Returns zero on success or negative value on failure
> + */
> +static int cdns3_data_flush(struct cdns3_endpoint *priv_ep)
> +{
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> +
> + writel(EP_CMD_DFLUSH, &priv_dev->regs->ep_cmd);
> +
> + /* wait for DFLUSH cleared */
> + return cdns3_handshake(&priv_dev->regs->ep_cmd, EP_CMD_DFLUSH, 0, 100);
> +}
> +
> +/**
> + * cdns3_ep_stall_flush - Stalls and flushes selected endpoint
> + * @priv_ep: endpoint object
> + *
> + * Endpoint must be selected before call to this function
> + */
> +static void cdns3_ep_stall_flush(struct cdns3_endpoint *priv_ep)
> +{
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> +
> + writel(EP_CMD_DFLUSH | EP_CMD_ERDY | EP_CMD_SSTALL,
> + &priv_dev->regs->ep_cmd);
> +
> + /* wait for DFLUSH cleared */
> + cdns3_handshake(&priv_dev->regs->ep_cmd, EP_CMD_DFLUSH, 0, 100);
> + priv_ep->flags |= EP_STALL;
> +}
> +
> +/**
> + * cdns3_gadget_giveback - call struct usb_request's ->complete callback
> + * @priv_ep: The endpoint to whom the request belongs to
> + * @priv_req: The request we're giving back
> + * @status: completion code for the request
> + *
> + * Must be called with controller's lock held and interrupts disabled. This
> + * function will unmap @req and call its ->complete() callback to notify upper
> + * layers that it has completed.
> + */
> +void cdns3_gadget_giveback(struct cdns3_endpoint *priv_ep,
> + struct cdns3_request *priv_req,
> + int status)
> +{
> + //TODO: Implements this function.
> +}
> +
> +/**
> + * cdns3_ep_run_transfer - start transfer on no-default endpoint hardware
> + * @priv_ep: endpoint object
> + *
> + * Returns zero on success or negative value on failure
> + */
> +int cdns3_ep_run_transfer(struct cdns3_endpoint *priv_ep,
> + struct usb_request *request)
> +{
> + //TODO: Implements this function.
> +
> + return 0;
> +}
> +
> /**
> * cdns3_irq_handler - irq line interrupt handler
> * @cdns: cdns3 instance
> @@ -170,6 +297,318 @@ static struct usb_ep *cdns3_gadget_match_ep(struct usb_gadget *gadget,
> return &priv_ep->endpoint;
> }
>
> +/**
> + * cdns3_gadget_ep_enable Enable endpoint
> + * @ep: endpoint object
> + * @desc: endpoint descriptor
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +static int cdns3_gadget_ep_enable(struct usb_ep *ep,
> + const struct usb_endpoint_descriptor *desc)
> +{
> + struct cdns3_endpoint *priv_ep;
> + struct cdns3_device *priv_dev;
> + unsigned long flags;
> + int ret;
> + u32 reg;
> +
> + priv_ep = ep_to_cdns3_ep(ep);
> + priv_dev = priv_ep->cdns3_dev;
> +
> + if (!ep || !desc || desc->bDescriptorType != USB_DT_ENDPOINT) {
> + dev_err(&priv_dev->dev, "usbss: invalid parameters\n");
dev_dbg()?
Gadget driver will be more verbose.
> + return -EINVAL;
> + }
> +
> + if (!desc->wMaxPacketSize) {
> + dev_err(&priv_dev->dev, "usbss: missing wMaxPacketSize\n");
> + return -EINVAL;
> + }
> +
> + if (dev_WARN_ONCE(&priv_dev->dev, priv_ep->flags & EP_ENABLED,
> + "%s is already enabled\n", priv_ep->name))
> + return 0;
> +
> + ret = cdns3_allocate_trb_pool(priv_ep);
> + if (ret)
> + return ret;
Why not allocate the TRB pool once for all endpoints at gadget init?
you don't seem to be calling cdns3_allocate_trb_pool() in cdns3_gadget_ep_disable().
> +
> + dev_dbg(&priv_dev->dev, "Enabling endpoint: %s\n", ep->name);
> + spin_lock_irqsave(&priv_dev->lock, flags);
> + cdns3_select_ep(priv_dev, desc->bEndpointAddress);
> + writel(EP_CMD_EPRST, &priv_dev->regs->ep_cmd);
> +
> + ret = cdns3_handshake(&priv_dev->regs->ep_cmd,
> + EP_CMD_CSTALL | EP_CMD_EPRST, 0, 100);
> +
> + cdns3_set_register_bit(&priv_dev->regs->ep_cfg, EP_CFG_ENABLE);
> +
> + ep->desc = desc;
> + priv_ep->flags &= ~(EP_PENDING_REQUEST | EP_STALL);
> + priv_ep->flags |= EP_ENABLED | EP_UPDATE_EP_TRBADDR;
> + priv_ep->enqueue = 0;
> + priv_ep->dequeue = 0;
> + reg = readl(&priv_dev->regs->ep_sts);
> + priv_ep->pcs = !!EP_STS_CCS(reg);
> + priv_ep->ccs = !!EP_STS_CCS(reg);
> + /* one TRB is reserved for link TRB used in DMULT mode*/
> + priv_ep->free_trbs = TRBS_PER_SEGMENT - 1;
> +
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> + return 0;
> +}
> +
> +/**
> + * cdns3_gadget_ep_disable Disable endpoint
> + * @ep: endpoint object
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +static int cdns3_gadget_ep_disable(struct usb_ep *ep)
> +{
> + struct cdns3_endpoint *priv_ep;
> + struct cdns3_device *priv_dev;
> + unsigned long flags;
> + int ret = 0;
> + struct usb_request *request;
> + u32 ep_cfg;
> +
> + if (!ep) {
> + pr_debug("usbss: invalid parameters\n");
> + return -EINVAL;
> + }
> +
> + priv_ep = ep_to_cdns3_ep(ep);
> + priv_dev = priv_ep->cdns3_dev;
> +
> + if (dev_WARN_ONCE(&priv_dev->dev, !(priv_ep->flags & EP_ENABLED),
> + "%s is already disabled\n", priv_ep->name))
> + return 0;
> +
> + spin_lock_irqsave(&priv_dev->lock, flags);
> + if (!priv_dev->start_gadget) {
> + dev_dbg(&priv_dev->dev,
> + "Disabling endpoint at disconnection: %s\n", ep->name);
This flag is looking very tricky.
What do you mean by "disabling at disconnection"?
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> + return 0;
EP is not yet disabled and we're returning 0. This will cause an unbalance.
I'd avoid that flag altogether.
> + }
> +
> + dev_dbg(&priv_dev->dev, "Disabling endpoint: %s\n", ep->name);
> +
> + cdns3_select_ep(priv_dev, ep->desc->bEndpointAddress);
> + ret = cdns3_data_flush(priv_ep);
> + while (!list_empty(&priv_ep->request_list)) {
> + request = cdns3_next_request(&priv_ep->request_list);
> +
> + cdns3_gadget_giveback(priv_ep, to_cdns3_request(request),
> + -ESHUTDOWN);
> + }
> +
> + ep_cfg = readl(&priv_dev->regs->ep_cfg);
> + ep_cfg &= ~EP_CFG_ENABLE;
> + writel(ep_cfg, &priv_dev->regs->ep_cfg);
> + ep->desc = NULL;
> + priv_ep->flags &= ~EP_ENABLED;
> +
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> +
> + return ret;
> +}
> +
> +/**
> + * cdns3_gadget_ep_alloc_request Allocates request
> + * @ep: endpoint object associated with request
> + * @gfp_flags: gfp flags
> + *
> + * Returns allocated request address, NULL on allocation error
> + */
> +struct usb_request *cdns3_gadget_ep_alloc_request(struct usb_ep *ep,
> + gfp_t gfp_flags)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_request *priv_req;
> +
> + priv_req = kzalloc(sizeof(*priv_req), gfp_flags);
> + if (!priv_req)
> + return NULL;
> +
> + priv_req->priv_ep = priv_ep;
> +
> + return &priv_req->request;
> +}
> +
> +/**
> + * cdns3_gadget_ep_free_request Free memory occupied by request
> + * @ep: endpoint object associated with request
> + * @request: request to free memory
> + */
> +void cdns3_gadget_ep_free_request(struct usb_ep *ep,
> + struct usb_request *request)
> +{
> + struct cdns3_request *priv_req = to_cdns3_request(request);
> +
> + kfree(priv_req);
> +}
> +
> +/**
> + * cdns3_gadget_ep_queue Transfer data on endpoint
> + * @ep: endpoint object
> + * @request: request object
> + * @gfp_flags: gfp flags
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +static int __cdns3_gadget_ep_queue(struct usb_ep *ep,
> + struct usb_request *request,
> + gfp_t gfp_flags)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + int ret = 0;
> +
> + request->actual = 0;
> + request->status = -EINPROGRESS;
> +
> + dev_dbg(&priv_dev->dev, "Queuing to endpoint: %s\n", priv_ep->name);
> +
> + ret = usb_gadget_map_request_by_dev(priv_dev->sysdev, request,
> + usb_endpoint_dir_in(ep->desc));
> +
> + if (ret)
> + return ret;
> +
> + if (!cdns3_ep_run_transfer(priv_ep, request))
> + list_add_tail(&request->list, &priv_ep->request_list);
how about catching the return value if cdns3_ep_run_transfer() fails?
> +
> + return ret;
> +}
> +
> +static int cdns3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request,
> + gfp_t gfp_flags)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + struct usb_request *zlp_request;
> + unsigned long flags;
> + int ret;
> +
> + spin_lock_irqsave(&priv_dev->lock, flags);
> + ret = __cdns3_gadget_ep_queue(ep, request, gfp_flags);
> +
> + if (ret == 0 && request->zero && request->length &&
> + (request->length % ep->maxpacket == 0)) {
> + zlp_request = cdns3_gadget_ep_alloc_request(ep, GFP_ATOMIC);
> + zlp_request->buf = priv_dev->zlp_buf;
> + zlp_request->length = 0;
> +
> + dev_dbg(&priv_dev->dev, "Queuing ZLP for endpoint: %s\n",
> + priv_ep->name);
> + ret = __cdns3_gadget_ep_queue(ep, zlp_request, gfp_flags);
Who is going to free this zlp_request?
> + }
> +
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> + return ret;
> +}
> +
> +/**
> + * cdns3_gadget_ep_dequeue Remove request from transfer queue
> + * @ep: endpoint object associated with request
> + * @request: request object
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +int cdns3_gadget_ep_dequeue(struct usb_ep *ep,
> + struct usb_request *request)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + struct usb_request *req, *req_temp;
> + unsigned long flags;
> + int ret = 0;
> +
> + if (!ep || !request || !ep->desc)
> + return -EINVAL;
> +
> + spin_lock_irqsave(&priv_dev->lock, flags);
> + dev_dbg(&priv_dev->dev, "Dequeue from %s\n", ep->name);
> +
> + cdns3_select_ep(priv_dev, ep->desc->bEndpointAddress);
> + if (priv_dev->start_gadget)
> + ret = cdns3_data_flush(priv_ep);
> +
> + list_for_each_entry_safe(req, req_temp, &priv_ep->request_list, list) {
> + if (request == req) {
> + cdns3_gadget_giveback(priv_ep,
> + to_cdns3_request(request),
> + -ECONNRESET);
> + break;
> + }
> + }
> +
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> + return ret;
> +}
> +
> +/**
> + * cdns3_gadget_ep_set_halt Sets/clears stall on selected endpoint
> + * @ep: endpoint object to set/clear stall on
> + * @value: 1 for set stall, 0 for clear stall
> + *
> + * Returns 0 on success, error code elsewhere
> + */
> +int cdns3_gadget_ep_set_halt(struct usb_ep *ep, int value)
> +{
> + struct cdns3_endpoint *priv_ep = ep_to_cdns3_ep(ep);
> + struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
> + unsigned long flags;
> + int ret = 0;
> +
> + if (!(priv_ep->flags & EP_ENABLED))
> + return -EPERM;
> +
> + /* if actual transfer is pending defer setting stall on this endpoint */
> + if ((priv_ep->flags & EP_PENDING_REQUEST) && value) {
> + priv_ep->flags |= EP_STALL;
> + return 0;
> + }
> +
> + dev_dbg(&priv_dev->dev, "Halt endpoint %s\n", priv_ep->name);
> +
> + spin_lock_irqsave(&priv_dev->lock, flags);
How about grabbing the lock before checking for priv->ep->flags?
> +
> + cdns3_select_ep(priv_dev, ep->desc->bEndpointAddress);
> + if (value) {
> + cdns3_ep_stall_flush(priv_ep);
> + } else {
> + priv_ep->flags &= ~EP_WEDGE;
> + writel(EP_CMD_CSTALL | EP_CMD_EPRST, &priv_dev->regs->ep_cmd);
> +
> + /* wait for EPRST cleared */
> + ret = cdns3_handshake(&priv_dev->regs->ep_cmd,
> + EP_CMD_EPRST, 0, 100);
if there was an error we shouldn't be clearing the EP_STALL right
and leave the pending flag?
> + priv_ep->flags &= ~EP_STALL;
> + }
> +
> + priv_ep->flags &= ~EP_PENDING_REQUEST;
> + spin_unlock_irqrestore(&priv_dev->lock, flags);
> +
> + return ret;
> +}
> +
> +extern const struct usb_ep_ops cdns3_gadget_ep0_ops;
> +
> +static const struct usb_ep_ops cdns3_gadget_ep_ops = {
> + .enable = cdns3_gadget_ep_enable,
> + .disable = cdns3_gadget_ep_disable,
> + .alloc_request = cdns3_gadget_ep_alloc_request,
> + .free_request = cdns3_gadget_ep_free_request,
> + .queue = cdns3_gadget_ep_queue,
> + .dequeue = cdns3_gadget_ep_dequeue,
> + .set_halt = cdns3_gadget_ep_set_halt,
> + .set_wedge = cdns3_gadget_ep_set_wedge,
> +};
> +
> /**
> * cdns3_gadget_get_frame Returns number of actual ITP frame
> * @gadget: gadget object
> @@ -365,8 +804,7 @@ static int cdns3_init_ep(struct cdns3_device *priv_dev)
> usb_ep_set_maxpacket_limit(&priv_ep->endpoint,
> ENDPOINT_MAX_PACKET_LIMIT);
> priv_ep->endpoint.max_streams = ENDPOINT_MAX_STREAMS;
> - //TODO: Add implementation of cdns3_gadget_ep_ops
> - //priv_ep->endpoint.ops = &cdns3_gadget_ep_ops;
> + priv_ep->endpoint.ops = &cdns3_gadget_ep_ops;
> if (ep_dir)
> priv_ep->endpoint.caps.dir_in = 1;
> else
> diff --git a/drivers/usb/cdns3/gadget.h b/drivers/usb/cdns3/gadget.h
> index 3b0d4d2e4831..a4be288b34cb 100644
> --- a/drivers/usb/cdns3/gadget.h
> +++ b/drivers/usb/cdns3/gadget.h
> @@ -1072,4 +1072,7 @@ void cdns3_set_register_bit(void __iomem *ptr, u32 mask);
> int cdns3_init_ep0(struct cdns3_device *priv_dev);
> void cdns3_ep0_config(struct cdns3_device *priv_dev);
> void cdns3_select_ep(struct cdns3_device *priv_dev, u32 ep);
> +int cdns3_gadget_ep_set_wedge(struct usb_ep *ep);
> +int cdns3_gadget_ep_set_halt(struct usb_ep *ep, int value);
> +
> #endif /* __LINUX_CDNS3_GADGET */
>
cheers,
-roger
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
next reply other threads:[~2018-11-28 12:46 UTC|newest]
Thread overview: 202+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-28 12:46 Roger Quadros [this message]
2018-11-28 12:46 ` [RFC PATCH v2 09/15] usb:cdns3: EpX operations part of the API Roger Quadros
2018-11-28 12:46 ` Roger Quadros
-- strict thread matches above, loose matches on Subject: below --
2018-12-16 13:31 [RFC,v2,08/15] usb:cdns3: Implements device " Pawel Laszczak
2018-12-16 13:31 ` [RFC PATCH v2 08/15] " Pawel Laszczak
2018-12-14 12:30 [RFC,v2,08/15] " Felipe Balbi
2018-12-14 12:30 ` [RFC PATCH v2 08/15] " Felipe Balbi
2018-12-14 12:20 [RFC,v2,08/15] " Sekhar Nori
2018-12-14 12:20 ` [RFC PATCH v2 08/15] " Sekhar Nori
2018-12-14 12:20 ` Sekhar Nori
2018-12-14 11:26 [RFC,v2,08/15] " Felipe Balbi
2018-12-14 11:26 ` [RFC PATCH v2 08/15] " Felipe Balbi
2018-12-14 11:13 [RFC,v2,08/15] " Sekhar Nori
2018-12-14 11:13 ` [RFC PATCH v2 08/15] " Sekhar Nori
2018-12-14 11:13 ` Sekhar Nori
2018-12-14 10:47 [RFC,v2,08/15] " Felipe Balbi
2018-12-14 10:47 ` [RFC PATCH v2 08/15] " Felipe Balbi
2018-12-14 10:39 [RFC,v2,08/15] " Sekhar Nori
2018-12-14 10:39 ` [RFC PATCH v2 08/15] " Sekhar Nori
2018-12-14 10:39 ` Sekhar Nori
2018-12-14 6:49 [RFC,v2,08/15] " Pawel Laszczak
2018-12-14 6:49 ` [RFC PATCH v2 08/15] " Pawel Laszczak
2018-12-14 1:34 [RFC,v2,08/15] " Peter Chen
2018-12-14 1:34 ` [RFC PATCH v2 08/15] " Peter Chen
2018-12-11 19:49 [RFC,v2,08/15] " Pawel Laszczak
2018-12-11 19:49 ` [RFC PATCH v2 08/15] " Pawel Laszczak
2018-12-11 11:26 [RFC,v2,08/15] " Sekhar Nori
2018-12-11 11:26 ` [RFC PATCH v2 08/15] " Sekhar Nori
2018-12-11 11:26 ` Sekhar Nori
2018-12-10 2:12 [RFC,v2,08/15] " Peter Chen
2018-12-10 2:12 ` [RFC PATCH v2 08/15] " Peter Chen
2018-12-06 10:26 [RFC,v2,03/15] dt-bindings: add binding for USBSS-DRD controller Pawel Laszczak
2018-12-06 10:26 ` [RFC PATCH v2 03/15] " Pawel Laszczak
2018-12-06 10:02 [RFC,v2,04/15] usb:cdns3: Driver initialization code Pawel Laszczak
2018-12-06 10:02 ` [RFC PATCH v2 04/15] " Pawel Laszczak
2018-12-06 9:31 [RFC,v2,04/15] " Pawel Laszczak
2018-12-06 9:31 ` [RFC PATCH v2 04/15] " Pawel Laszczak
2018-12-06 7:25 [RFC,v2,05/15] usb:cdns3: Added DRD support Pawel Laszczak
2018-12-06 7:25 ` [RFC PATCH v2 05/15] " Pawel Laszczak
2018-12-06 7:00 [RFC,v2,04/15] usb:cdns3: Driver initialization code Pawel Laszczak
2018-12-06 7:00 ` [RFC PATCH v2 04/15] " Pawel Laszczak
2018-12-05 19:42 [RFC,v2,04/15] " Pawel Laszczak
2018-12-05 19:42 ` [RFC PATCH v2 04/15] " Pawel Laszczak
2018-12-05 19:24 [RFC,v2,04/15] " Pawel Laszczak
2018-12-05 19:24 ` [RFC PATCH v2 04/15] " Pawel Laszczak
2018-12-05 9:07 [RFC,v2,04/15] " Peter Chen
2018-12-05 9:07 ` [RFC PATCH v2 04/15] " Peter Chen
2018-12-05 8:57 [RFC,v2,04/15] " Peter Chen
2018-12-05 8:57 ` [RFC PATCH v2 04/15] " Peter Chen
2018-12-05 8:55 [RFC,v2,04/15] " Alan Douglas
2018-12-05 8:55 ` [RFC PATCH v2 04/15] " Alan Douglas
2018-12-05 8:41 [RFC,v2,06/15] usb:cdns3: Adds Host support Peter Chen
2018-12-05 8:41 ` [RFC PATCH v2 06/15] " Peter Chen
2018-12-05 7:19 [RFC,v2,04/15] usb:cdns3: Driver initialization code Pawel Laszczak
2018-12-05 7:19 ` [RFC PATCH v2 04/15] " Pawel Laszczak
2018-12-04 22:41 [RFC,v2,03/15] dt-bindings: add binding for USBSS-DRD controller Rob Herring
2018-12-04 22:41 ` [RFC PATCH v2 03/15] " Rob Herring
2018-12-04 10:46 [RFC,v2,04/15] usb:cdns3: Driver initialization code Roger Quadros
2018-12-04 10:46 ` [RFC PATCH v2 04/15] " Roger Quadros
2018-12-04 10:46 ` Roger Quadros
2018-12-04 9:18 [RFC,v2,05/15] usb:cdns3: Added DRD support Peter Chen
2018-12-04 9:18 ` [RFC PATCH v2 05/15] " Peter Chen
2018-12-04 9:09 [RFC,v2,04/15] usb:cdns3: Driver initialization code Peter Chen
2018-12-04 9:09 ` [RFC PATCH v2 04/15] " Peter Chen
2018-12-04 8:50 [RFC,v2,04/15] " Peter Chen
2018-12-04 8:50 ` [RFC PATCH v2 04/15] " Peter Chen
2018-12-04 7:11 [RFC,v2,04/15] " Peter Chen
2018-12-04 7:11 ` [RFC PATCH v2 04/15] " Peter Chen
2018-12-03 10:19 [RFC,v2,08/15] usb:cdns3: Implements device operations part of the API Pawel Laszczak
2018-12-03 10:19 ` [RFC PATCH v2 08/15] " Pawel Laszczak
2018-12-02 20:34 [RFC,v2,04/15] usb:cdns3: Driver initialization code Pawel Laszczak
2018-12-02 20:34 ` [RFC PATCH v2 04/15] " Pawel Laszczak
2018-12-02 19:27 [RFC,v2,02/15] usb:cdns3: Device side header file Pawel Laszczak
2018-12-02 19:27 ` [RFC PATCH v2 02/15] " Pawel Laszczak
2018-12-02 16:39 [RFC,v2,12/15] usb:cdns3: Adds enumeration related function Pawel Laszczak
2018-12-02 16:39 ` [RFC PATCH v2 12/15] " Pawel Laszczak
2018-12-02 12:52 [RFC,v2,11/15] usb:cdns3: Implements ISR functionality Pawel Laszczak
2018-12-02 12:52 ` [RFC PATCH v2 11/15] " Pawel Laszczak
2018-12-02 11:49 [RFC,v2,11/15] " Pawel Laszczak
2018-12-02 11:49 ` [RFC PATCH v2 11/15] " Pawel Laszczak
2018-12-02 10:34 [RFC,v2,10/15] usb:cdns3: Ep0 operations part of the API Pawel Laszczak
2018-12-02 10:34 ` [RFC PATCH v2 10/15] " Pawel Laszczak
2018-12-02 10:34 ` Pawel Laszczak
2018-12-01 13:30 [RFC,v2,09/15] usb:cdns3: EpX " Pawel Laszczak
2018-12-01 13:30 ` [RFC PATCH v2 09/15] " Pawel Laszczak
2018-12-01 11:11 [RFC,v2,08/15] usb:cdns3: Implements device " Pawel Laszczak
2018-12-01 11:11 ` [RFC PATCH v2 08/15] " Pawel Laszczak
2018-11-30 14:36 [RFC,v2,07/15] usb:cdns3: Adds Device mode support - initialization Pawel Laszczak
2018-11-30 14:36 ` [RFC PATCH v2 07/15] " Pawel Laszczak
2018-11-30 7:32 [RFC,v2,04/15] usb:cdns3: Driver initialization code Peter Chen
2018-11-30 7:32 ` [RFC PATCH v2 04/15] " Peter Chen
2018-11-30 6:48 [RFC,v2,02/15] usb:cdns3: Device side header file Peter Chen
2018-11-30 6:48 ` [RFC PATCH v2 02/15] " PETER CHEN
2018-11-30 6:29 [RFC,v2,07/15] usb:cdns3: Adds Device mode support - initialization Pawel Laszczak
2018-11-30 6:29 ` [RFC PATCH v2 07/15] " Pawel Laszczak
2018-11-30 4:20 [RFC,v2,07/15] " Peter Chen
2018-11-30 4:20 ` [RFC PATCH v2 07/15] " PETER CHEN
2018-11-28 15:50 [RFC,v2,12/15] usb:cdns3: Adds enumeration related function Roger Quadros
2018-11-28 15:50 ` [RFC PATCH v2 12/15] " Roger Quadros
2018-11-28 15:50 ` Roger Quadros
2018-11-28 14:54 [RFC,v2,11/15] usb:cdns3: Implements ISR functionality Roger Quadros
2018-11-28 14:54 ` [RFC PATCH v2 11/15] " Roger Quadros
2018-11-28 14:54 ` Roger Quadros
2018-11-28 14:31 [RFC,v2,10/15] usb:cdns3: Ep0 operations part of the API Roger Quadros
2018-11-28 14:31 ` [RFC PATCH v2 10/15] " Roger Quadros
2018-11-28 14:31 ` Roger Quadros
2018-11-28 12:22 [RFC,v2,08/15] usb:cdns3: Implements device " Roger Quadros
2018-11-28 12:22 ` [RFC PATCH v2 08/15] " Roger Quadros
2018-11-28 12:22 ` Roger Quadros
2018-11-28 11:40 [RFC,v2,07/15] usb:cdns3: Adds Device mode support - initialization Felipe Balbi
2018-11-28 11:40 ` [RFC PATCH v2 07/15] " Felipe Balbi
2018-11-28 11:34 [RFC,v2,07/15] " Roger Quadros
2018-11-28 11:34 ` [RFC PATCH v2 07/15] " Roger Quadros
2018-11-28 11:34 ` Roger Quadros
2018-11-27 12:10 [RFC,v2,05/15] usb:cdns3: Added DRD support Roger Quadros
2018-11-27 12:10 ` [RFC PATCH v2 05/15] " Roger Quadros
2018-11-27 11:29 [RFC,v2,05/15] " Pawel Laszczak
2018-11-27 11:29 ` [RFC PATCH v2 05/15] " Pawel Laszczak
2018-11-26 10:17 [RFC,v2,06/15] usb:cdns3: Adds Host support Pawel Laszczak
2018-11-26 10:17 ` [RFC PATCH v2 06/15] " Pawel Laszczak
2018-11-26 10:15 [RFC,v2,05/15] usb:cdns3: Added DRD support Roger Quadros
2018-11-26 10:15 ` [RFC PATCH v2 05/15] " Roger Quadros
2018-11-26 10:09 [RFC,v2,05/15] " Pawel Laszczak
2018-11-26 10:09 ` [RFC PATCH v2 05/15] " Pawel Laszczak
2018-11-26 9:50 [RFC,v2,06/15] usb:cdns3: Adds Host support Roger Quadros
2018-11-26 9:50 ` [RFC PATCH v2 06/15] " Roger Quadros
2018-11-26 9:39 [RFC,v2,05/15] usb:cdns3: Added DRD support Roger Quadros
2018-11-26 9:39 ` [RFC PATCH v2 05/15] " Roger Quadros
2018-11-26 8:39 [RFC,v2,05/15] " Pawel Laszczak
2018-11-26 8:39 ` [RFC PATCH v2 05/15] " Pawel Laszczak
2018-11-26 8:24 [RFC,v2,06/15] usb:cdns3: Adds Host support Pawel Laszczak
2018-11-26 8:24 ` [RFC PATCH v2 06/15] " Pawel Laszczak
2018-11-26 8:07 [RFC,v2,05/15] usb:cdns3: Added DRD support Roger Quadros
2018-11-26 8:07 ` [RFC PATCH v2 05/15] " Roger Quadros
2018-11-26 7:23 [RFC,v2,05/15] " Pawel Laszczak
2018-11-26 7:23 ` [RFC PATCH v2 05/15] " Pawel Laszczak
2018-11-25 12:35 [RFC,v2,04/15] usb:cdns3: Driver initialization code Pawel Laszczak
2018-11-25 12:35 ` [RFC PATCH v2 04/15] " Pawel Laszczak
2018-11-25 7:33 [RFC,v2,03/15] dt-bindings: add binding for USBSS-DRD controller Pawel Laszczak
2018-11-25 7:33 ` [RFC PATCH v2 03/15] " Pawel Laszczak
2018-11-23 14:51 [RFC,v2,05/15] usb:cdns3: Added DRD support Roger Quadros
2018-11-23 14:51 ` [RFC PATCH v2 05/15] " Roger Quadros
2018-11-23 14:51 ` Roger Quadros
2018-11-23 14:23 [RFC,v2,06/15] usb:cdns3: Adds Host support Roger Quadros
2018-11-23 14:23 ` [RFC PATCH v2 06/15] " Roger Quadros
2018-11-23 14:23 ` Roger Quadros
2018-11-23 11:35 [RFC,v2,04/15] usb:cdns3: Driver initialization code Roger Quadros
2018-11-23 11:35 ` [RFC PATCH v2 04/15] " Roger Quadros
2018-11-23 11:35 ` Roger Quadros
2018-11-23 10:53 [RFC,v2,03/15] dt-bindings: add binding for USBSS-DRD controller Roger Quadros
2018-11-23 10:53 ` [RFC PATCH v2 03/15] " Roger Quadros
2018-11-23 10:53 ` Roger Quadros
2018-11-23 10:44 [RFC,v2,01/15] usb:cdns3: add pci to platform driver wrapper Roger Quadros
2018-11-23 10:44 ` [RFC PATCH v2 01/15] " Roger Quadros
2018-11-23 10:44 ` Roger Quadros
2018-11-18 10:09 [RFC,v2,15/15] usb:cdns3: Feature for changing role Pawel Laszczak
2018-11-18 10:09 ` [RFC PATCH v2 15/15] " Pawel Laszczak
2018-11-18 10:09 ` Pawel Laszczak
2018-11-18 10:09 [RFC,v2,14/15] usb:cdns3: Adds debugging function Pawel Laszczak
2018-11-18 10:09 ` [RFC PATCH v2 14/15] " Pawel Laszczak
2018-11-18 10:09 ` Pawel Laszczak
2018-11-18 10:09 [RFC,v2,13/15] usb:cdns3: Adds transfer related function Pawel Laszczak
2018-11-18 10:09 ` [RFC PATCH v2 13/15] " Pawel Laszczak
2018-11-18 10:09 ` Pawel Laszczak
2018-11-18 10:09 [RFC,v2,12/15] usb:cdns3: Adds enumeration " Pawel Laszczak
2018-11-18 10:09 ` [RFC PATCH v2 12/15] " Pawel Laszczak
2018-11-18 10:09 ` Pawel Laszczak
2018-11-18 10:09 [RFC,v2,11/15] usb:cdns3: Implements ISR functionality Pawel Laszczak
2018-11-18 10:09 ` [RFC PATCH v2 11/15] " Pawel Laszczak
2018-11-18 10:09 ` Pawel Laszczak
2018-11-18 10:09 [RFC,v2,10/15] usb:cdns3: Ep0 operations part of the API Pawel Laszczak
2018-11-18 10:09 ` [RFC PATCH v2 10/15] " Pawel Laszczak
2018-11-18 10:09 ` Pawel Laszczak
2018-11-18 10:09 [RFC,v2,09/15] usb:cdns3: EpX " Pawel Laszczak
2018-11-18 10:09 ` [RFC PATCH v2 09/15] " Pawel Laszczak
2018-11-18 10:09 ` Pawel Laszczak
2018-11-18 10:09 [RFC,v2,08/15] usb:cdns3: Implements device " Pawel Laszczak
2018-11-18 10:09 ` [RFC PATCH v2 08/15] " Pawel Laszczak
2018-11-18 10:09 ` Pawel Laszczak
2018-11-18 10:09 [RFC,v2,07/15] usb:cdns3: Adds Device mode support - initialization Pawel Laszczak
2018-11-18 10:09 ` [RFC PATCH v2 07/15] " Pawel Laszczak
2018-11-18 10:09 ` Pawel Laszczak
2018-11-18 10:09 [RFC,v2,06/15] usb:cdns3: Adds Host support Pawel Laszczak
2018-11-18 10:09 ` [RFC PATCH v2 06/15] " Pawel Laszczak
2018-11-18 10:09 ` Pawel Laszczak
2018-11-18 10:09 [RFC,v2,05/15] usb:cdns3: Added DRD support Pawel Laszczak
2018-11-18 10:09 ` [RFC PATCH v2 05/15] " Pawel Laszczak
2018-11-18 10:09 ` Pawel Laszczak
2018-11-18 10:09 [RFC,v2,04/15] usb:cdns3: Driver initialization code Pawel Laszczak
2018-11-18 10:09 ` [RFC PATCH v2 04/15] " Pawel Laszczak
2018-11-18 10:09 ` Pawel Laszczak
2018-11-18 10:08 [RFC,v2,03/15] dt-bindings: add binding for USBSS-DRD controller Pawel Laszczak
2018-11-18 10:08 ` [RFC PATCH v2 03/15] " Pawel Laszczak
2018-11-18 10:08 ` Pawel Laszczak
2018-11-18 10:08 [RFC,v2,02/15] usb:cdns3: Device side header file Pawel Laszczak
2018-11-18 10:08 ` [RFC PATCH v2 02/15] " Pawel Laszczak
2018-11-18 10:08 ` Pawel Laszczak
2018-11-18 10:08 [RFC,v2,01/15] usb:cdns3: add pci to platform driver wrapper Pawel Laszczak
2018-11-18 10:08 ` [RFC PATCH v2 01/15] " Pawel Laszczak
2018-11-18 10:08 ` Pawel Laszczak
2018-11-18 10:08 [RFC PATCH v2 00/15] Introduced new Cadence USBSS DRD Driver Pawel Laszczak
2018-11-18 10:08 ` Pawel Laszczak
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=5BFE8E12.9080307@ti.com \
--to=rogerq@ti.com \
--cc=adouglas@cadence.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jbergsagel@ti.com \
--cc=kurahul@cadence.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=nm@ti.com \
--cc=nsekhar@ti.com \
--cc=pawell@cadence.com \
--cc=peter.chen@nxp.com \
--cc=pjez@cadence.com \
--cc=sureshp@cadence.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.