]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
usb: dwc3: Specify maximum number of XHCI interrupters
authorWesley Cheng <quic_wcheng@quicinc.com>
Wed, 9 Apr 2025 19:47:39 +0000 (12:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Apr 2025 11:02:30 +0000 (13:02 +0200)
Allow for the DWC3 host driver to pass along XHCI property that defines
how many interrupters to allocate.  This is in relation for the number of
event rings that can be potentially used by other processors within the
system.

Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Tested-by: Puma Hsu <pumahsu@google.com>
Tested-by: Daehwan Jung <dh10.jung@samsung.com>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20250409194804.3773260-7-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/core.c
drivers/usb/dwc3/core.h
drivers/usb/dwc3/host.c

index 66a08b5271653abd458f9ec85ca730afd7779d71..17ae5c13fe3690c945bcdba108c84b4a38ed0d63 100644 (file)
@@ -1699,6 +1699,7 @@ static void dwc3_get_properties(struct dwc3 *dwc)
        u8                      tx_thr_num_pkt_prd = 0;
        u8                      tx_max_burst_prd = 0;
        u8                      tx_fifo_resize_max_num;
+       u16                     num_hc_interrupters;
 
        /* default to highest possible threshold */
        lpm_nyet_threshold = 0xf;
@@ -1719,6 +1720,9 @@ static void dwc3_get_properties(struct dwc3 *dwc)
         */
        tx_fifo_resize_max_num = 6;
 
+       /* default to a single XHCI interrupter */
+       num_hc_interrupters = 1;
+
        dwc->maximum_speed = usb_get_maximum_speed(dev);
        dwc->max_ssp_rate = usb_get_maximum_ssp_rate(dev);
        dwc->dr_mode = usb_get_dr_mode(dev);
@@ -1765,6 +1769,12 @@ static void dwc3_get_properties(struct dwc3 *dwc)
                                &tx_thr_num_pkt_prd);
        device_property_read_u8(dev, "snps,tx-max-burst-prd",
                                &tx_max_burst_prd);
+       device_property_read_u16(dev, "num-hc-interrupters",
+                                &num_hc_interrupters);
+       /* DWC3 core allowed to have a max of 8 interrupters */
+       if (num_hc_interrupters > 8)
+               num_hc_interrupters = 8;
+
        dwc->do_fifo_resize = device_property_read_bool(dev,
                                                        "tx-fifo-resize");
        if (dwc->do_fifo_resize)
@@ -1851,6 +1861,8 @@ static void dwc3_get_properties(struct dwc3 *dwc)
        dwc->tx_max_burst_prd = tx_max_burst_prd;
 
        dwc->tx_fifo_resize_max_num = tx_fifo_resize_max_num;
+
+       dwc->num_hc_interrupters = num_hc_interrupters;
 }
 
 /* check whether the core supports IMOD */
index aaa39e663f60a5f4f638c91d9d369a5913d1b967..fbe83914d9f98a40b1be8377f84227c77e063a08 100644 (file)
@@ -1083,6 +1083,7 @@ struct dwc3_scratchpad_array {
  * @tx_max_burst_prd: max periodic ESS transmit burst size
  * @tx_fifo_resize_max_num: max number of fifos allocated during txfifo resize
  * @clear_stall_protocol: endpoint number that requires a delayed status phase
+ * @num_hc_interrupters: number of host controller interrupters
  * @hsphy_interface: "utmi" or "ulpi"
  * @connected: true when we're connected to a host, false otherwise
  * @softconnect: true when gadget connect is called, false when disconnect runs
@@ -1330,6 +1331,7 @@ struct dwc3 {
        u8                      tx_max_burst_prd;
        u8                      tx_fifo_resize_max_num;
        u8                      clear_stall_protocol;
+       u16                     num_hc_interrupters;
 
        const char              *hsphy_interface;
 
index b48e108fc8fe7343446946e7babf9ba3bc0d2dc3..1c513bf8002ec9ec91b41bfd096cbd0da1dd2d2e 100644 (file)
@@ -182,6 +182,9 @@ int dwc3_host_init(struct dwc3 *dwc)
        if (DWC3_VER_IS_WITHIN(DWC3, ANY, 300A))
                props[prop_idx++] = PROPERTY_ENTRY_BOOL("quirk-broken-port-ped");
 
+       props[prop_idx++] = PROPERTY_ENTRY_U16("num-hc-interrupters",
+                                              dwc->num_hc_interrupters);
+
        if (prop_idx) {
                ret = device_create_managed_software_node(&xhci->dev, props, NULL);
                if (ret) {