--- zzzz-none-000/linux-4.1.38/drivers/usb/storage/scsiglue.c 2017-01-18 18:48:06.000000000 +0000 +++ bcm63-7582-715/linux-4.1.38/drivers/usb/storage/scsiglue.c 2020-11-25 10:06:48.000000000 +0000 @@ -531,9 +531,38 @@ } static DEVICE_ATTR_RW(max_sectors); +#if defined (CONFIG_AVM_USB_SUSPEND) +/* Output routine for the sysfs max_spinup_ms file */ +static ssize_t show_max_spinup_ms(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct us_data *us = host_to_us(dev_to_shost(dev)); + + return sprintf(buf, "%u\n", us->max_spinup_ms); +} + +/* Input routine for the sysfs max_sectors file */ +static ssize_t store_max_spinup_ms(struct device *dev, struct device_attribute *attr, const char *buf, + size_t count) +{ + struct us_data *us = host_to_us(dev_to_shost(dev)); + unsigned int ms; + + if (sscanf(buf, "%u", &ms) > 0) { + us->max_spinup_ms = ms; + return count; + } + return -EINVAL; +} + +static DEVICE_ATTR(max_spinup_ms, S_IRUGO | S_IWUSR, show_max_spinup_ms, store_max_spinup_ms); +#endif + static struct device_attribute *sysfs_device_attr_list[] = { - &dev_attr_max_sectors, - NULL, + &dev_attr_max_sectors, +#if defined (CONFIG_AVM_USB_SUSPEND) + &dev_attr_max_spinup_ms, +#endif + NULL, }; /* @@ -570,8 +599,13 @@ /* lots of sg segments can be handled */ .sg_tablesize = SCSI_MAX_SG_CHAIN_SEGMENTS, +#if defined(CONFIG_BCM_KF_USB_STORAGE) + /* limit the total size of a transfer to 256 KB */ + .max_sectors = 512, +#else /* limit the total size of a transfer to 120 KB */ .max_sectors = 240, +#endif /* merge commands... this seems to help performance, but * periodically someone should test to see which setting is more