[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c5067780-9dfe-2a3e-3498-22f3c1dadb87@ti.com>
Date: Fri, 23 Aug 2019 14:23:55 +0530
From: Vignesh Raghavendra <vigneshr@...com>
To: Pawel Laszczak <pawell@...ence.com>, <felipe.balbi@...ux.intel.com>
CC: <gregkh@...uxfoundation.org>, <linux-usb@...r.kernel.org>,
<rogerq@...com>, <linux-kernel@...r.kernel.org>,
<jbergsagel@...com>, <nsekhar@...com>, <nm@...com>,
<sureshp@...ence.com>, <jpawar@...ence.com>, <kurahul@...ence.com>,
<aniljoy@...ence.com>
Subject: Re: [PATCH v10 5/6] usb:cdns3 Add Cadence USB3 DRD Driver
Hi,
On 22/07/19 12:02 AM, Pawel Laszczak wrote:
> +
> +/**
> + * cdns3_req_ep0_get_status - Handling of GET_STATUS standard USB request
> + * @priv_dev: extended gadget object
> + * @ctrl_req: pointer to received setup packet
> + *
> + * Returns 0 if success, error code on error
> + */
> +static int cdns3_req_ep0_get_status(struct cdns3_device *priv_dev,
> + struct usb_ctrlrequest *ctrl)
> +{
> + __le16 *response_pkt;
> + u16 usb_status = 0;
> + u32 recip;
> + u32 reg;
> +
> + recip = ctrl->bRequestType & USB_RECIP_MASK;
> +
> + switch (recip) {
> + case USB_RECIP_DEVICE:
> + /* self powered */
> + if (priv_dev->is_selfpowered)
> + usb_status = BIT(USB_DEVICE_SELF_POWERED);
> +
> + if (priv_dev->wake_up_flag)
> + usb_status |= BIT(USB_DEVICE_REMOTE_WAKEUP);
> +
> + if (priv_dev->gadget.speed != USB_SPEED_SUPER)
> + break;
> +
> + reg = readl(&priv_dev->regs->usb_sts);
I see usb_sts is read, but never used in this function?
> +
> + if (priv_dev->u1_allowed)
> + usb_status |= BIT(USB_DEV_STAT_U1_ENABLED);
> +
> + if (priv_dev->u2_allowed)
> + usb_status |= BIT(USB_DEV_STAT_U2_ENABLED);
> +
> + break;
> + case USB_RECIP_INTERFACE:
> + return cdns3_ep0_delegate_req(priv_dev, ctrl);
> + case USB_RECIP_ENDPOINT:
> + /* check if endpoint is stalled */
> + cdns3_select_ep(priv_dev, ctrl->wIndex);
> + if (EP_STS_STALL(readl(&priv_dev->regs->ep_sts)))
> + usb_status = BIT(USB_ENDPOINT_HALT);
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + response_pkt = (__le16 *)priv_dev->setup_buf;
> + *response_pkt = cpu_to_le16(usb_status);
> +
> + cdns3_ep0_run_transfer(priv_dev, priv_dev->setup_dma,
> + sizeof(*response_pkt), 1, 0);
> + return 0;
> +}
> +
--
Regards
Vignesh
Powered by blists - more mailing lists