Merge branch 'usb-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git

This commit is contained in:
Stephen Rothwell 2024-12-20 14:19:57 +11:00
commit 5cd9bc5cb9
15 changed files with 72 additions and 28 deletions

View File

@ -13,8 +13,12 @@ description: Maxim TCPCI Type-C PD controller
properties: properties:
compatible: compatible:
enum: oneOf:
- maxim,max33359 - enum:
- maxim,max33359
- items:
- const: maxim,max77759-tcpci
- const: maxim,max33359
reg: reg:
maxItems: 1 maxItems: 1

View File

@ -453,8 +453,10 @@ allOf:
then: then:
properties: properties:
interrupts: interrupts:
minItems: 3
maxItems: 4 maxItems: 4
interrupt-names: interrupt-names:
minItems: 3
items: items:
- const: pwr_event - const: pwr_event
- const: dp_hs_phy_irq - const: dp_hs_phy_irq

View File

@ -26,6 +26,7 @@ properties:
- renesas,usbhs-r9a07g043 # RZ/G2UL and RZ/Five - renesas,usbhs-r9a07g043 # RZ/G2UL and RZ/Five
- renesas,usbhs-r9a07g044 # RZ/G2{L,LC} - renesas,usbhs-r9a07g044 # RZ/G2{L,LC}
- renesas,usbhs-r9a07g054 # RZ/V2L - renesas,usbhs-r9a07g054 # RZ/V2L
- renesas,usbhs-r9a08g045 # RZ/G3S
- const: renesas,rzg2l-usbhs - const: renesas,rzg2l-usbhs
- items: - items:
@ -130,6 +131,7 @@ allOf:
- renesas,usbhs-r9a07g043 - renesas,usbhs-r9a07g043
- renesas,usbhs-r9a07g044 - renesas,usbhs-r9a07g044
- renesas,usbhs-r9a07g054 - renesas,usbhs-r9a07g054
- renesas,usbhs-r9a08g045
then: then:
properties: properties:
interrupts: interrupts:

View File

@ -256,8 +256,14 @@ static int ci_ehci_hub_control(
struct device *dev = hcd->self.controller; struct device *dev = hcd->self.controller;
struct ci_hdrc *ci = dev_get_drvdata(dev); struct ci_hdrc *ci = dev_get_drvdata(dev);
port_index = wIndex & 0xff; /*
port_index -= (port_index > 0); * Avoid out-of-bounds values while calculating the port index
* from wIndex. The compiler doesn't like pointers to invalid
* addresses, even if they are never used.
*/
port_index = (wIndex - 1) & 0xff;
if (port_index >= HCS_N_PORTS_MAX)
port_index = 0;
status_reg = &ehci->regs->port_status[port_index]; status_reg = &ehci->regs->port_status[port_index];
spin_lock_irqsave(&ehci->lock, flags); spin_lock_irqsave(&ehci->lock, flags);

View File

@ -422,7 +422,12 @@ static int suspend_common(struct device *dev, pm_message_t msg)
bool do_wakeup; bool do_wakeup;
int retval; int retval;
do_wakeup = PMSG_IS_AUTO(msg) ? true : device_may_wakeup(dev); if (PMSG_IS_AUTO(msg))
do_wakeup = true;
else if (PMSG_NO_WAKEUP(msg))
do_wakeup = false;
else
do_wakeup = device_may_wakeup(dev);
/* Root hub suspend should have stopped all downstream traffic, /* Root hub suspend should have stopped all downstream traffic,
* and all bus master traffic. And done so for both the interface * and all bus master traffic. And done so for both the interface
@ -521,6 +526,11 @@ static int hcd_pci_suspend(struct device *dev)
return suspend_common(dev, PMSG_SUSPEND); return suspend_common(dev, PMSG_SUSPEND);
} }
static int hcd_pci_freeze(struct device *dev)
{
return suspend_common(dev, PMSG_FREEZE);
}
static int hcd_pci_suspend_noirq(struct device *dev) static int hcd_pci_suspend_noirq(struct device *dev)
{ {
struct pci_dev *pci_dev = to_pci_dev(dev); struct pci_dev *pci_dev = to_pci_dev(dev);
@ -590,6 +600,7 @@ static int hcd_pci_restore(struct device *dev)
#else #else
#define hcd_pci_suspend NULL #define hcd_pci_suspend NULL
#define hcd_pci_freeze NULL
#define hcd_pci_suspend_noirq NULL #define hcd_pci_suspend_noirq NULL
#define hcd_pci_poweroff_late NULL #define hcd_pci_poweroff_late NULL
#define hcd_pci_resume_noirq NULL #define hcd_pci_resume_noirq NULL
@ -624,7 +635,7 @@ const struct dev_pm_ops usb_hcd_pci_pm_ops = {
.suspend_noirq = hcd_pci_suspend_noirq, .suspend_noirq = hcd_pci_suspend_noirq,
.resume_noirq = hcd_pci_resume_noirq, .resume_noirq = hcd_pci_resume_noirq,
.resume = hcd_pci_resume, .resume = hcd_pci_resume,
.freeze = hcd_pci_suspend, .freeze = hcd_pci_freeze,
.freeze_noirq = check_root_hub_suspended, .freeze_noirq = check_root_hub_suspended,
.thaw_noirq = NULL, .thaw_noirq = NULL,
.thaw = hcd_pci_resume, .thaw = hcd_pci_resume,

View File

@ -1479,6 +1479,26 @@ static int dwc3_core_init(struct dwc3 *dwc)
} }
} }
/*
* STAR 9001346572: This issue affects DWC_usb31 versions 1.80a and
* prior. When an active endpoint not currently cached in the host
* controller is chosen to be cached to the same index as an endpoint
* receiving NAKs, the endpoint receiving NAKs enters continuous
* retry mode. This prevents it from being evicted from the host
* controller cache, blocking the new endpoint from being cached and
* serviced.
*
* To resolve this, for controller versions 1.70a and 1.80a, set the
* GUCTL3 bit[16] (USB2.0 Internal Retry Disable) to 1. This bit
* disables the USB2.0 internal retry feature. The GUCTL3[16] register
* function is available only from version 1.70a.
*/
if (DWC3_VER_IS_WITHIN(DWC31, 170A, 180A)) {
reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
reg |= DWC3_GUCTL3_USB20_RETRY_DISABLE;
dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
}
return 0; return 0;
err_power_off_phy: err_power_off_phy:

View File

@ -425,6 +425,7 @@
/* Global User Control Register 3 */ /* Global User Control Register 3 */
#define DWC3_GUCTL3_SPLITDISABLE BIT(14) #define DWC3_GUCTL3_SPLITDISABLE BIT(14)
#define DWC3_GUCTL3_USB20_RETRY_DISABLE BIT(16)
/* Device Configuration Register */ /* Device Configuration Register */
#define DWC3_DCFG_NUMLANES(n) (((n) & 0x3) << 30) /* DWC_usb32 only */ #define DWC3_DCFG_NUMLANES(n) (((n) & 0x3) << 30) /* DWC_usb32 only */
@ -956,7 +957,6 @@ struct dwc3_request {
struct usb_request request; struct usb_request request;
struct list_head list; struct list_head list;
struct dwc3_ep *dep; struct dwc3_ep *dep;
struct scatterlist *sg;
struct scatterlist *start_sg; struct scatterlist *start_sg;
unsigned int num_pending_sgs; unsigned int num_pending_sgs;

View File

@ -441,14 +441,10 @@ static int usbg_bot_setup(struct usb_function *f,
pr_err("No LUNs configured?\n"); pr_err("No LUNs configured?\n");
return -EINVAL; return -EINVAL;
} }
/*
* If 4 LUNs are present we return 3 i.e. LUN 0..3 can be
* accessed. The upper limit is 0xf
*/
luns--; luns--;
if (luns > 0xf) { if (luns > US_BULK_MAX_LUN_LIMIT) {
pr_info_once("Limiting the number of luns to 16\n"); pr_info_once("Limiting the number of luns to 16\n");
luns = 0xf; luns = US_BULK_MAX_LUN_LIMIT;
} }
ret_lun = cdev->req->buf; ret_lun = cdev->req->buf;
*ret_lun = luns; *ret_lun = luns;

View File

@ -131,7 +131,7 @@ static inline bool fsg_lun_is_open(struct fsg_lun *curlun)
#define FSG_BUFLEN ((u32)16384) #define FSG_BUFLEN ((u32)16384)
/* Maximal number of LUNs supported in mass storage function */ /* Maximal number of LUNs supported in mass storage function */
#define FSG_MAX_LUNS 16 #define FSG_MAX_LUNS (US_BULK_MAX_LUN_LIMIT + 1)
enum fsg_buffer_state { enum fsg_buffer_state {
BUF_STATE_SENDING = -2, BUF_STATE_SENDING = -2,

View File

@ -3,8 +3,7 @@
# USB Storage driver configuration # USB Storage driver configuration
# #
comment "NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may" comment "NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed; see USB_STORAGE Help for more info"
comment "also be needed; see USB_STORAGE Help for more info"
config USB_STORAGE config USB_STORAGE
tristate "USB Mass Storage support" tristate "USB Mass Storage support"

View File

@ -1087,13 +1087,9 @@ int usb_stor_Bulk_max_lun(struct us_data *us)
usb_stor_dbg(us, "GetMaxLUN command result is %d, data is %d\n", usb_stor_dbg(us, "GetMaxLUN command result is %d, data is %d\n",
result, us->iobuf[0]); result, us->iobuf[0]);
/* /* If we have a successful request, return the result if valid. */
* If we have a successful request, return the result if valid. The
* CBW LUN field is 4 bits wide, so the value reported by the device
* should fit into that.
*/
if (result > 0) { if (result > 0) {
if (us->iobuf[0] < 16) { if (us->iobuf[0] <= US_BULK_MAX_LUN_LIMIT) {
return us->iobuf[0]; return us->iobuf[0];
} else { } else {
dev_info(&us->pusb_intf->dev, dev_info(&us->pusb_intf->dev,

View File

@ -11,7 +11,6 @@
#include <linux/mod_devicetable.h> #include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_wakeup.h>
#include <linux/pm_wakeirq.h> #include <linux/pm_wakeirq.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>

View File

@ -570,7 +570,8 @@ const struct dev_pm_ops name = { \
{ .event = PM_EVENT_AUTO_RESUME, }) { .event = PM_EVENT_AUTO_RESUME, })
#define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0) #define PMSG_IS_AUTO(msg) (((msg).event & PM_EVENT_AUTO) != 0)
#define PMSG_NO_WAKEUP(msg) (((msg).event & \
(PM_EVENT_FREEZE | PM_EVENT_QUIESCE)) != 0)
/* /*
* Device run-time power management status. * Device run-time power management status.
* *

View File

@ -82,4 +82,12 @@ struct bulk_cs_wrap {
#define US_BULK_RESET_REQUEST 0xff #define US_BULK_RESET_REQUEST 0xff
#define US_BULK_GET_MAX_LUN 0xfe #define US_BULK_GET_MAX_LUN 0xfe
/*
* If 4 LUNs are supported then the LUNs would be
* numbered from 0 to 3, and the return value for
* US_BULK_GET_MAX_LUN request would be 3. The valid
* LUN field is 4 bits wide, the upper limit is 0x0f.
*/
#define US_BULK_MAX_LUN_LIMIT 0x0f
#endif #endif

View File

@ -206,7 +206,7 @@ struct usb_ffs_dmabuf_transfer_req {
* +-----+-----------------+------+--------------------------+ * +-----+-----------------+------+--------------------------+
* | off | name | type | description | * | off | name | type | description |
* +-----+-----------------+------+--------------------------+ * +-----+-----------------+------+--------------------------+
* | 0 | inteface | U8 | related interface number | * | 0 | interface | U8 | related interface number |
* +-----+-----------------+------+--------------------------+ * +-----+-----------------+------+--------------------------+
* | 1 | dwLength | U32 | length of the descriptor | * | 1 | dwLength | U32 | length of the descriptor |
* +-----+-----------------+------+--------------------------+ * +-----+-----------------+------+--------------------------+
@ -224,7 +224,7 @@ struct usb_ffs_dmabuf_transfer_req {
* +-----+-----------------+------+--------------------------+ * +-----+-----------------+------+--------------------------+
* | off | name | type | description | * | off | name | type | description |
* +-----+-----------------+------+--------------------------+ * +-----+-----------------+------+--------------------------+
* | 0 | inteface | U8 | related interface number | * | 0 | interface | U8 | related interface number |
* +-----+-----------------+------+--------------------------+ * +-----+-----------------+------+--------------------------+
* | 1 | dwLength | U32 | length of the descriptor | * | 1 | dwLength | U32 | length of the descriptor |
* +-----+-----------------+------+--------------------------+ * +-----+-----------------+------+--------------------------+
@ -237,7 +237,7 @@ struct usb_ffs_dmabuf_transfer_req {
* | 11 | ExtProp[] | | list of ext. prop. d. | * | 11 | ExtProp[] | | list of ext. prop. d. |
* +-----+-----------------+------+--------------------------+ * +-----+-----------------+------+--------------------------+
* *
* ExtCompat[] is an array of valid Extended Compatiblity descriptors * ExtCompat[] is an array of valid Extended Compatibility descriptors
* which have the following format: * which have the following format:
* *
* +-----+-----------------------+------+-------------------------------------+ * +-----+-----------------------+------+-------------------------------------+
@ -295,7 +295,7 @@ struct usb_functionfs_strings_head {
* | 16 | stringtab | StringTab[lang_count] | table of strings per lang | * | 16 | stringtab | StringTab[lang_count] | table of strings per lang |
* *
* For each language there is one stringtab entry (ie. there are lang_count * For each language there is one stringtab entry (ie. there are lang_count
* stringtab entires). Each StringTab has following format: * stringtab entries). Each StringTab has following format:
* *
* | off | name | type | description | * | off | name | type | description |
* |-----+---------+-------------------+------------------------------------| * |-----+---------+-------------------+------------------------------------|