]> rtime.felk.cvut.cz Git - vajnamar/linux-xlnx.git/commitdiff
usb: gadget: f_tcm: support to set maxburst through configfs
authorRajnikant Bhojani <rajnikant.bhojani@xilinx.com>
Fri, 11 Aug 2017 08:54:16 +0000 (04:54 -0400)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 15 Aug 2017 10:56:59 +0000 (12:56 +0200)
support to change maxbust of endpoint through configfs is added

Signed-off-by: Rajnikant Bhojani <rajnikant.bhojani@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/usb/gadget/function/f_tcm.c

index f6b8772b2c4d5008a4ed5a4156257b26678336a5..f83ae1f2a118543b5f24f68f5c87fdfb50d7b829 100644 (file)
@@ -1790,9 +1790,11 @@ static ssize_t tcm_usbg_tpg_nexus_store(struct config_item *item,
 CONFIGFS_ATTR(tcm_usbg_tpg_, enable);
 CONFIGFS_ATTR(tcm_usbg_tpg_, nexus);
 
+static struct configfs_attribute tcm_usbg_tpg_attr_maxburst;
 static struct configfs_attribute *usbg_base_attrs[] = {
        &tcm_usbg_tpg_attr_enable,
        &tcm_usbg_tpg_attr_nexus,
+       &tcm_usbg_tpg_attr_maxburst,
        NULL,
 };
 
@@ -2102,6 +2104,32 @@ static struct usb_gadget_strings *tcm_strings[] = {
        NULL,
 };
 
+static ssize_t tcm_usbg_tpg_maxburst_show(struct config_item *item, char *page)
+{
+       return snprintf(page, PAGE_SIZE, "%u\n", uasp_cmd_comp_desc.bMaxBurst);
+}
+
+static ssize_t tcm_usbg_tpg_maxburst_store(struct config_item *item,
+                                          const char *page, size_t count)
+{
+       int value;
+       int ret;
+
+       ret = kstrtouint(page, 10, &value);
+       if (ret)
+               return ret;
+
+       uasp_bi_ep_comp_desc.bMaxBurst = value;
+       uasp_bo_ep_comp_desc.bMaxBurst = value;
+       uasp_status_in_ep_comp_desc.bMaxBurst = value;
+       uasp_cmd_comp_desc.bMaxBurst = value;
+       bot_bi_ep_comp_desc.bMaxBurst = value;
+       bot_bo_ep_comp_desc.bMaxBurst = value;
+
+       return count;
+}
+CONFIGFS_ATTR(tcm_usbg_tpg_, maxburst);
+
 static int tcm_bind(struct usb_configuration *c, struct usb_function *f)
 {
        struct f_uas            *fu = to_f_uas(f);