lkml.org 
[lkml]   [2019]   [Aug]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v10 5/6] usb:cdns3 Add Cadence USB3 DRD Driver
From
Date
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

\
 
 \ /
  Last update: 2019-08-23 10:54    [W:0.598 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site