From patchwork Sun Nov 15 09:25:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QW50dGkgU2VwcMOkbMOk?= X-Patchwork-Id: 544815 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 472B11402A6 for ; Sun, 15 Nov 2015 21:10:39 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=V53X/cty; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id C589828C649; Sun, 15 Nov 2015 11:08:29 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 6BB5228C649 for ; Sun, 15 Nov 2015 11:08:20 +0100 (CET) X-policyd-weight: using cached result; rate: -8.5 Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Sun, 15 Nov 2015 11:08:18 +0100 (CET) Received: by lffu14 with SMTP id u14so72736481lff.1 for ; Sun, 15 Nov 2015 02:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=sr6OSCkAIPal+FJFBMbdbfSI9idiG7e9pgAW3XDnUv8=; b=V53X/ctyuaLk3JxNH1eWH4LWA88an6clZSOovdUz+eYMQVDqMIuWggV7A+fa72M/Ro HGqYNFTtgxrkQZOa5/F7p2a3w5Ut1yqbeLPSqh/dGcp3VQIgGYaN6Ogh8Ud3rQy8Wzxs 6JAUfE5BN0XiUzUlW9Cydudn0zbYDD6Br28pzepAM//vOuNnCg0g+R/tonbULutIPMuC dctLu56HmRXfL+yu4oJ/hNdTVHv1klTGP4WlIxXq7MvXFWPaGkz0XC3nrpRgI2WZv6EP zJxhWnAQBaBfsvjq29hSrERNvVvfFcC2VKwuyoxDJ9RWrJBtGMsOtsmu3BAGHVJVSart rOOQ== X-Received: by 10.25.21.145 with SMTP id 17mr13624271lfv.61.1447582214726; Sun, 15 Nov 2015 02:10:14 -0800 (PST) Received: from griffin.lan (a88-115-235-125.elisa-laajakaista.fi. [88.115.235.125]) by smtp.gmail.com with ESMTPSA id l67sm4654268lfd.43.2015.11.15.02.10.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 15 Nov 2015 02:10:14 -0800 (PST) From: =?UTF-8?q?Antti=20Sepp=C3=A4l=C3=A4?= To: openwrt-devel@lists.openwrt.org Date: Sun, 15 Nov 2015 11:25:05 +0200 Message-Id: <1447579505-8999-1-git-send-email-a.seppala@gmail.com> X-Mailer: git-send-email 2.4.9 MIME-Version: 1.0 Cc: Vincent Pelletier Subject: [OpenWrt-Devel] [PATCH] lantiq: tweak DWC2 default parameters X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" This patch improves the default configuration of DWC2 on lantiq SoCs somewhat: * Set maximum packet count to largest allowed value by the DWC2 (511) * Use 16-bit DMA bursts * Divide fifo buffers more evenly Default fifo buffer sizes from original ltq-hcd driver seem really irrational. For example according to DWC2 data book rxfifo size of 240 will not fit even a single full length USB packet. On the other hand non-periodic tx fifo size of 240 is more than enough to fit one complete packet. Change the sizes around to improve the situation and to fix some issues especially with isochronous USB transfers. Signed-off-by: Antti Seppälä --- Notes: After positive feedback and test reports from openwrt forum[1] I'm sending the patch for official inclusion in openwrt tree. [1] https://forum.openwrt.org/viewtopic.php?pid=299041#p299041 .../lantiq/patches-3.18/0041-USB-DWC2-add-ltq-params.patch | 10 +++++----- .../lantiq/patches-4.1/0041-USB-DWC2-add-ltq-params.patch | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/target/linux/lantiq/patches-3.18/0041-USB-DWC2-add-ltq-params.patch b/target/linux/lantiq/patches-3.18/0041-USB-DWC2-add-ltq-params.patch index a0af123..2d9cb0f 100644 --- a/target/linux/lantiq/patches-3.18/0041-USB-DWC2-add-ltq-params.patch +++ b/target/linux/lantiq/patches-3.18/0041-USB-DWC2-add-ltq-params.patch @@ -12,11 +12,11 @@ + .speed = -1, + .enable_dynamic_fifo = -1, + .en_multiple_tx_fifo = -1, -+ .host_rx_fifo_size = 240, /* 240 DWORDs */ -+ .host_nperio_tx_fifo_size = 240, /* 240 DWORDs */ -+ .host_perio_tx_fifo_size = 32, /* 32 DWORDs */ ++ .host_rx_fifo_size = 288, /* 288 DWORDs */ ++ .host_nperio_tx_fifo_size = 128, /* 128 DWORDs */ ++ .host_perio_tx_fifo_size = 96, /* 96 DWORDs */ + .max_transfer_size = -1, -+ .max_packet_count = -1, ++ .max_packet_count = 511, + .host_channels = -1, + .phy_type = -1, + .phy_utmi_width = -1, @@ -28,7 +28,7 @@ + .host_ls_low_power_phy_clk = -1, + .ts_dline = -1, + .reload_ctl = -1, -+ .ahbcfg = -1, ++ .ahbcfg = GAHBCFG_HBSTLEN_INCR16 << GAHBCFG_HBSTLEN_SHIFT, + .uframe_sched = -1, +}; + diff --git a/target/linux/lantiq/patches-4.1/0041-USB-DWC2-add-ltq-params.patch b/target/linux/lantiq/patches-4.1/0041-USB-DWC2-add-ltq-params.patch index c55f5b6..0b5d09b 100644 --- a/target/linux/lantiq/patches-4.1/0041-USB-DWC2-add-ltq-params.patch +++ b/target/linux/lantiq/patches-4.1/0041-USB-DWC2-add-ltq-params.patch @@ -12,11 +12,11 @@ + .speed = -1, + .enable_dynamic_fifo = -1, + .en_multiple_tx_fifo = -1, -+ .host_rx_fifo_size = 240, /* 240 DWORDs */ -+ .host_nperio_tx_fifo_size = 240, /* 240 DWORDs */ -+ .host_perio_tx_fifo_size = 32, /* 32 DWORDs */ ++ .host_rx_fifo_size = 288, /* 288 DWORDs */ ++ .host_nperio_tx_fifo_size = 128, /* 128 DWORDs */ ++ .host_perio_tx_fifo_size = 96, /* 96 DWORDs */ + .max_transfer_size = -1, -+ .max_packet_count = -1, ++ .max_packet_count = 511, + .host_channels = -1, + .phy_type = -1, + .phy_utmi_width = -1, @@ -28,7 +28,7 @@ + .host_ls_low_power_phy_clk = -1, + .ts_dline = -1, + .reload_ctl = -1, -+ .ahbcfg = -1, ++ .ahbcfg = GAHBCFG_HBSTLEN_INCR16 << GAHBCFG_HBSTLEN_SHIFT, + .uframe_sched = -1, +}; +