From patchwork Sun Feb 2 03:50:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Badhri Jagan Sridharan X-Patchwork-Id: 13956413 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 426371C6B4 for ; Sun, 2 Feb 2025 03:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738468265; cv=none; b=PwnOMQTRepVgoLbXOTm65Oe/rB+AcFVEbF8tjTUcVvfBei/OeyFb0ls/wv1YwgZKlwgGQNdlr5HGTF4pMpJS9PzLG3NDnR2nva8T3BOj4C67XBi8wqXvRORMOC3be5JCzXctgn3Ce+HUDcOyjKdQuVQV07cGSFkbXbdtWoY/MMQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738468265; c=relaxed/simple; bh=ThuQSdfaKBpcDXqt8wGsv78oL2BN2jQmseobtTxhhbg=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=goYbHrs2NmcDe0mCZ7MdGY9sggL+QclmPs9A7HqyIfdt3c49q/mWFBj6DrsW5uVlEML5lDzYLuzTN6Z/gXyd+sdis8L48a3gkVAv5+w5oKhzdeeKpk1kp0c+QpMun6XnXliuKxK0oys4psQDSYM0WJqtjGnXQrIGHcN9zBmJWKU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--badhri.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=EM6ChZcQ; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--badhri.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="EM6ChZcQ" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2ef9b9981f1so9466206a91.3 for ; Sat, 01 Feb 2025 19:51:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1738468263; x=1739073063; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=tLQvG5TnFcXOemXaUB33YPT8JnYY7IUsNv0/RBB9dNA=; b=EM6ChZcQDonl4Hau+k1dDHSCiLC/vmWxDa9pKY5GXQ1YfZhRK0b7K7ZoW258jhP9fO y5tvEv6NigLAQd1B30gwqxfXHBOUWv6OoJ4DNdIfYqxFcG94hlDLuI8Wetb4eRCIr2EP fGq2fi6FND0nPRncVVA7ZdqqGo6VshVuDOYO9qa2aSYs8q5xN+Ie5/OeArsXAZNWMtgD A5qgtNHEA4hyOXmC1Hu9QZF106jK0+7GO0CFva8kTxWPFNlCQOV2A8JzvlsD5PDX92qp HNs/wl1XpsU7ehlSVIgaPEpC/jmCl5/29RXYQmR1t/65i9lKc0VgNS9LtuZHHGlRGkvD vnBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738468263; x=1739073063; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=tLQvG5TnFcXOemXaUB33YPT8JnYY7IUsNv0/RBB9dNA=; b=erm6sFde4CSt+3T2QiSQWW3bKPCamOuW2XFYzKo8d6/DL6DODj6Yw/oPZkNnyu2jhh 3EPSq6olLLAxAZMshinZo4gFyv9qHDYj0t/CC98U90x3q08iM+b3+aBMk7YaBu25I1Ie NGkTWRBHudAGkcTSNBLlU3b0Nku5AhB/tbL8+cx/Qdnjc3JUi5A6mHjrmG3mnYb9GZwP mPErDw+X+0xJrQs7gPmMoGT1nDSkzFjBCsUI/EztTWxAO+fFHf73zFkbzWKgKxqo6oJm w48Ujz6+sxdBgL4icI9q9wBip6oQvZjL22eR3ygbW8o83CRxvxxsCBkuYxoWYY3pYGvw JPcw== X-Gm-Message-State: AOJu0YxFIilk5iDPZZX35uW+Ic339h0uRUmsKA78jG/2oNnpgKm2+DdD IOiPXP4ZRJAC7rxXB91uSLOBV5SGej0Q0z42s5g7xIzpC0T8Y4OhkQan6Nr5LuNRBR5fALk0A3+ MKQ== X-Google-Smtp-Source: AGHT+IEiw45d1/cmdFgJV1d7Z6blmkpea4G+wd4Ucnyh5wS54em9mWU7qFTZa3sEXs/P4HN3AUDWT8EAxCU= X-Received: from pjbnc13.prod.google.com ([2002:a17:90b:37cd:b0:2ea:46ed:5d3b]) (user=badhri job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:37c3:b0:2ee:8ea0:6b9c with SMTP id 98e67ed59e1d1-2f83abda22dmr29831867a91.12.1738468263511; Sat, 01 Feb 2025 19:51:03 -0800 (PST) Date: Sun, 2 Feb 2025 03:50:59 +0000 Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.48.1.362.g079036d154-goog Message-ID: <20250202035100.31235-1-badhri@google.com> Subject: [PATCH v1 1/2] dt-bindings: usb: snps,dwc3: Add property for imod From: Badhri Jagan Sridharan To: Thinh.Nguyen@synopsys.com, gregkh@linuxfoundation.org, felipe.balbi@linux.intel.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, johnyoun@synopsys.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, jameswei@google.com, Badhri Jagan Sridharan , stable@kernel.org This change adds `snps,device-mode-intrpt-mod-interval` which allows enabling interrupt moderation through snps,dwc3 node. `snps,device-mode-intrpt-mod-interval`specifies the minimum inter-interrupt interval in 250ns increments during device mode operation. A value of 0 disables the interrupt throttling logic and interrupts are generated immediately if event count becomes non-zero. Otherwise, the interrupt is signaled when all of the following conditons are met which are, EVNT_HANDLER_BUSY is 0, event count is non-zero and at least 250ns increments of this value has elapsed since the last time interrupt was de-asserted. Cc: stable@kernel.org Fixes: cf40b86b6ef6 ("usb: dwc3: Implement interrupt moderation") Signed-off-by: Badhri Jagan Sridharan --- .../devicetree/bindings/usb/snps,dwc3-common.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) base-commit: 72deda0abee6e705ae71a93f69f55e33be5bca5c diff --git a/Documentation/devicetree/bindings/usb/snps,dwc3-common.yaml b/Documentation/devicetree/bindings/usb/snps,dwc3-common.yaml index c956053fd036..3957f1dac3c4 100644 --- a/Documentation/devicetree/bindings/usb/snps,dwc3-common.yaml +++ b/Documentation/devicetree/bindings/usb/snps,dwc3-common.yaml @@ -375,6 +375,19 @@ properties: items: enum: [1, 4, 8, 16, 32, 64, 128, 256] + snps,device-mode-intrpt-mod-interval: + description: + Specifies the minimum inter-interrupt interval in 250ns increments + during device mode operation. A value of 0 disables the interrupt + throttling logic and interrupts are generated immediately if event + count becomes non-zero. Otherwise, the interrupt is signaled when + all of the following conditons are met which are, EVNT_HANDLER_BUSY + is 0, event count is non-zero and at least 250ns increments of this + value has elapsed since the last time interrupt was de-asserted. + $ref: /schemas/types.yaml#/definitions/uint16 + minimum: 0 + maximum: 255 + num-hc-interrupters: maximum: 8 default: 1 From patchwork Sun Feb 2 03:51:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Badhri Jagan Sridharan X-Patchwork-Id: 13956414 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63D2B4F21D for ; Sun, 2 Feb 2025 03:51:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738468269; cv=none; b=XFSBXso9fR6/PHEXhE8RO6GxXK+UOmAS1M8dCpK9779OaufZuNLRtYUdzKL/CwnHyLD+Oltep/x4fDEaLOVNS9qLL8VOsje9zAhzRSf6TJlT4JkmNpNVzdZpty1EOn61Tr9XQavYcglXZN7GEETV2m43uzYyYuMXwRIY5iQRL84= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738468269; c=relaxed/simple; bh=PbYtkom+gUHlGGx+5lwLVcI6JHpDbOhVcKFC5fhJ7Ko=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=JYMRjqj1PxYBRHjvqBcQd3/JGDqmEzzHxYkmYw9SLTLeTJBVUJ808KLHRyZIkQp9vAEjWI2cVlbLJGhhHVuJhxl5F9kx3Ec7oetjRXdogo+umY8MbrmIUFDOjB0c+BmdbbdZU220PtxbIa2f1lrcd0okhCLBOg3sVko0yqZwFJg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--badhri.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=O0FJ9g41; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--badhri.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="O0FJ9g41" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2efa74481fdso6528917a91.1 for ; Sat, 01 Feb 2025 19:51:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1738468267; x=1739073067; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=jGPnG/KaEKlAC+3m4DMkOr6QTvoaVn2cl6V4SfgkOEE=; b=O0FJ9g41UMHT8oGEwe3X1wiiRoaRXaRsfF6OT1RHO0wPhprYSg4jQBMTv4oW3BG2JO T85CaMCzYONSAA3AmyciOQDtd16grx/jOCZ9caxKJSbxtnh82ek7G8cfctWChC2FmTkx whn3eXm06mZ58cLRbBkRAgeJgQz1huqG/PV0wc0EsDK7wGDCWUcciyY17ijGyqrzyVQ8 5QFu6NA/KoikvZtu//Ssc4Plk1RBj7ge7aSwdhrnOBTHmfFsDn/tlVqi7b026/TfbjQL yhOlXo7APZEix83AGkpuzVgX4ijRLpZqThXlQdBZITO3n3smDS0zVXKPzDZIQXbw8mQz FuHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738468267; x=1739073067; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jGPnG/KaEKlAC+3m4DMkOr6QTvoaVn2cl6V4SfgkOEE=; b=B8wgBpfv8UmIjzVzAQu1qeVJCG045Jy5MaW7N4qC6bNTkfH7HnNeuduUihhlknZKEW 9bKt+qAiGbMs/eRjTlUP7ho4HrYSmZJnAf6WJbYgikrey2L6psRVBn7iaBtpQRb5zdjV 3RM5r8Wi9nnXTzwCxcagvdARuwgRPlvfE1opiqYTK3K77k/nOujevHbBR0Eo0oF4tCli iV9ex8F8uFUnvLIO8GNgwokVfd5FOyAn4xjd4+Lkm3l6YazQoP/Yu6/bnut+NnXNCClJ DvIwLwxK56j3sYidw+jOhdhyePKC6S2GWy0s8LOPmClHt1zEu7X8UAzKtubqI8C735kL CheQ== X-Gm-Message-State: AOJu0YwE6aOx9e+paN6K6WqiJRK0me5iqNRiF0HCJikgqVX+59WERo41 W1DLiZSGVZ5i5AzhHOYlGTmEj3PSqTC56m8G1GRcEA0hlQ/cLhvMDL2plwmqKsOM4TPuKo4wzKJ q6Q== X-Google-Smtp-Source: AGHT+IEDIyLl95Xc6h9Y3VLVPAJilJvXKmnIGcbZt/ClsnL8T/o4SlEvGEsvbwbDOYzS8l6z1Htv/m+Mu+8= X-Received: from pjbsw11.prod.google.com ([2002:a17:90b:2c8b:b0:2ef:a732:f48d]) (user=badhri job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:2802:b0:2f7:ef57:c7df with SMTP id 98e67ed59e1d1-2f83abaf38bmr27062123a91.7.1738468265303; Sat, 01 Feb 2025 19:51:05 -0800 (PST) Date: Sun, 2 Feb 2025 03:51:00 +0000 In-Reply-To: <20250202035100.31235-1-badhri@google.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250202035100.31235-1-badhri@google.com> X-Mailer: git-send-email 2.48.1.362.g079036d154-goog Message-ID: <20250202035100.31235-2-badhri@google.com> Subject: [PATCH v1 2/2] usb: dwc3: core: Obtain imod_interval from device tree From: Badhri Jagan Sridharan To: Thinh.Nguyen@synopsys.com, gregkh@linuxfoundation.org, felipe.balbi@linux.intel.com, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, johnyoun@synopsys.com Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, jameswei@google.com, Badhri Jagan Sridharan , stable@kernel.org Although commit cf40b86b6ef6 ("usb: dwc3: Implement interrupt moderation") adds support for interrupt moderation in device mode, it does not add an option to enable interrupt moderation unless the version of the controller is 3.00a where the interrupt moderation is automatically enabled. This patch reads the interrupt moderation interval counter value from device tree so that the interrupt moderation can be enabled through the device tree. The explicit initialization to 0 can be avoided as the dwc3 struct is kzalloc'ed. Cc: stable@kernel.org Fixes: cf40b86b6ef6 ("usb: dwc3: Implement interrupt moderation") Signed-off-by: Badhri Jagan Sridharan --- drivers/usb/dwc3/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index dfa1b5fe48dc..be0d302bbab7 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -1818,6 +1818,9 @@ static void dwc3_get_properties(struct dwc3 *dwc) dwc->dis_split_quirk = device_property_read_bool(dev, "snps,dis-split-quirk"); + device_property_read_u16(dev, "snps,device-mode-intrpt-mod-interval", + &dwc->imod_interval); + dwc->lpm_nyet_threshold = lpm_nyet_threshold; dwc->tx_de_emphasis = tx_de_emphasis; @@ -1835,8 +1838,6 @@ static void dwc3_get_properties(struct dwc3 *dwc) dwc->tx_thr_num_pkt_prd = tx_thr_num_pkt_prd; dwc->tx_max_burst_prd = tx_max_burst_prd; - dwc->imod_interval = 0; - dwc->tx_fifo_resize_max_num = tx_fifo_resize_max_num; }