From nobody Mon Feb 9 09:53:29 2026 Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D771247DE1; Sat, 18 Oct 2025 03:55:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760759741; cv=none; b=oCZSkyTltgSCP8NgE+I2lEZ4tX382g78k693olRqTqvF+vjOFAIW0a20JmV0bB5bRNsnXZBLQSp4xqXLx3kIvvP/5QglPFutbZmFBnjon9YDc26L/fnje+flBsOqJ+B+K8Kx3IDpG7pXRw6uj9WTJoA/Afj6u9eoh1JMTWSHyjU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760759741; c=relaxed/simple; bh=1KjPBXpllrt7gQWTe0vVJMze3JSCqr4z7wLJC/BXbP0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kx5dWoEaqLe4M0FI1olt4KbEj/Ha3GgofFhhzkYRvilX69EP953swalccG89ArUOYajagGz0smm3p6lzaCw/j/V0c1vyX0KXDflgbJxyw1uL2KyYqWfyrY0QJ1wJHk1TQG5XZnlm+nNfHiLQnveIo58CVfFNuM6Z721UdS9qIaE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp; spf=pass smtp.mailfrom=sakamocchi.jp; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b=aUTkoMUf; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Bz6JrJtL; arc=none smtp.client-ip=202.12.124.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="aUTkoMUf"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Bz6JrJtL" Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfout.stl.internal (Postfix) with ESMTP id 7B4991D00151; Fri, 17 Oct 2025 23:55:38 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Fri, 17 Oct 2025 23:55:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1760759738; x= 1760846138; bh=7hcYwfBrFq5jZc04hPPfE2gQ2RHVPgydmNVwQVUfXMM=; b=a UTkoMUfTLOtktLwlIWR8tes62PHTRtO8rr6071xdk/gxvKnyyUtmzeB9qn3QdeRq KUPUt3T6eOTqiuvGSOD3eL5lmTq2mJXs71BmLfMS+uE3aNH7C9rOQavFCB/rvFlL 5mrhLwdQSW84P9erhW5/a8aauTsJpxbom6DAOaistaA/YJfXWpCd7wi/tjuIo/jc 50ybN6NIJHLMuLDnBvNIK1Rdj022Nt+YZ8WR0LaRTrUOblTY0bHP3R4ujlzhUXZJ tsoGCW4OlLiS0bksXqKXYLIVEjYtUyvE+ClXavAdsp3i4k7z6WfZUFID6rxo7noO Y/AX6MK8OCruERLeRK0YA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1760759738; x=1760846138; bh=7 hcYwfBrFq5jZc04hPPfE2gQ2RHVPgydmNVwQVUfXMM=; b=Bz6JrJtLa5/Kkb2aI Nl0NbnQ7ok1WcO3mqXJm7j4vp4uw/brWUBXR4qqqmGI/I/A1qRaR/fbXpt/L/ujJ dR7gaGaIVT+un3x0Jg5DtaB8UJut9X9re7Q55Fofi15uL95zhTK4KGneCu5oGDMS A30fHZrcs87F3AmqK/gvL6KTylJA5NP1iDQChwEBoWHj5w9FbjudIXf3Cyr9lCbD 4ofa25sKU7MkEWnqg/NSHuTzuLB8eQITYeh6yp85O7teHdwAfvdl5cL/T9l+ZCr4 GB9kuD3dLACzSZzlhu/VlJdC1QekSZbqRyDnpUvSq3ZVzzBaViFvb6cT5xpFle2L Uchng== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddufedutdefucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgjeeuvd fguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrg hkrghmohgttghhihdrjhhppdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehlihhnuhigudefleegqdguvghvvghlsehlihhsthhsrdhsohhurh gtvghfohhrghgvrdhnvghtpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgv rhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqshhouhhnugesvhhgvg hrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Oct 2025 23:55:37 -0400 (EDT) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH 1/4] firewire: core: code refactoring to compute transaction speed Date: Sat, 18 Oct 2025 12:55:29 +0900 Message-ID: <20251018035532.287124-2-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251018035532.287124-1-o-takashi@sakamocchi.jp> References: <20251018035532.287124-1-o-takashi@sakamocchi.jp> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This commit refactors the helper function to read the content of configuration ROM with the passed speed. Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-device.c | 35 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index 33ce4cd357ed..c698d4ced7d7 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c @@ -605,8 +605,7 @@ static int detect_quirks_by_root_directory(const u32 *r= oot_directory, unsigned i return quirks; } =20 -static int read_rom(struct fw_device *device, - int generation, int index, u32 *data) +static int read_rom(struct fw_device *device, int generation, int speed, i= nt index, u32 *data) { u64 offset =3D (CSR_REGISTER_BASE | CSR_CONFIG_ROM) + index * 4; int i, rcode; @@ -617,7 +616,7 @@ static int read_rom(struct fw_device *device, for (i =3D 10; i < 100; i +=3D 10) { rcode =3D fw_run_transaction(device->card, TCODE_READ_QUADLET_REQUEST, device->node_id, - generation, device->max_speed, offset, data, 4); + generation, speed, offset, data, 4); if (rcode !=3D RCODE_BUSY) break; msleep(i); @@ -644,7 +643,7 @@ static int read_config_rom(struct fw_device *device, in= t generation) const u32 *old_rom, *new_rom; u32 *rom, *stack; u32 sp, key; - int i, end, length, ret; + int i, end, length, ret, speed; int quirks; =20 rom =3D kmalloc(sizeof(*rom) * MAX_CONFIG_ROM_SIZE + @@ -655,11 +654,11 @@ static int read_config_rom(struct fw_device *device, = int generation) stack =3D &rom[MAX_CONFIG_ROM_SIZE]; memset(rom, 0, sizeof(*rom) * MAX_CONFIG_ROM_SIZE); =20 - device->max_speed =3D SCODE_100; + speed =3D SCODE_100; =20 /* First read the bus info block. */ for (i =3D 0; i < 5; i++) { - ret =3D read_rom(device, generation, i, &rom[i]); + ret =3D read_rom(device, generation, speed, i, &rom[i]); if (ret !=3D RCODE_COMPLETE) goto out; /* @@ -681,7 +680,7 @@ static int read_config_rom(struct fw_device *device, in= t generation) // Just prevent from torn writing/reading. WRITE_ONCE(device->quirks, quirks); =20 - device->max_speed =3D device->node->max_speed; + speed =3D device->node->max_speed; =20 /* * Determine the speed of @@ -692,20 +691,18 @@ static int read_config_rom(struct fw_device *device, = int generation) * because some buggy firmwares set it lower than necessary and because * 1394-1995 nodes do not have the field. */ - if ((rom[2] & 0x7) < device->max_speed || - device->max_speed =3D=3D SCODE_BETA || - card->beta_repeaters_present) { + if ((rom[2] & 0x7) < speed || speed =3D=3D SCODE_BETA || card->beta_repea= ters_present) { u32 dummy; =20 /* for S1600 and S3200 */ - if (device->max_speed =3D=3D SCODE_BETA) - device->max_speed =3D card->link_speed; + if (speed =3D=3D SCODE_BETA) + speed =3D card->link_speed; =20 - while (device->max_speed > SCODE_100) { - if (read_rom(device, generation, 0, &dummy) =3D=3D + while (speed > SCODE_100) { + if (read_rom(device, generation, speed, 0, &dummy) =3D=3D RCODE_COMPLETE) break; - device->max_speed--; + --speed; } } =20 @@ -734,7 +731,7 @@ static int read_config_rom(struct fw_device *device, in= t generation) } =20 /* Read header quadlet for the block to get the length. */ - ret =3D read_rom(device, generation, i, &rom[i]); + ret =3D read_rom(device, generation, speed, i, &rom[i]); if (ret !=3D RCODE_COMPLETE) goto out; end =3D i + (rom[i] >> 16) + 1; @@ -758,7 +755,7 @@ static int read_config_rom(struct fw_device *device, in= t generation) * it references another block, and push it in that case. */ for (; i < end; i++) { - ret =3D read_rom(device, generation, i, &rom[i]); + ret =3D read_rom(device, generation, speed, i, &rom[i]); if (ret !=3D RCODE_COMPLETE) goto out; =20 @@ -785,6 +782,8 @@ static int read_config_rom(struct fw_device *device, in= t generation) length =3D i; } =20 + device->max_speed =3D speed; + quirks |=3D detect_quirks_by_root_directory(rom + ROOT_DIR_OFFSET, length= - ROOT_DIR_OFFSET); =20 // Just prevent from torn writing/reading. @@ -1234,7 +1233,7 @@ static int reread_config_rom(struct fw_device *device= , int generation, int i, rcode; =20 for (i =3D 0; i < 6; i++) { - rcode =3D read_rom(device, generation, i, &q); + rcode =3D read_rom(device, generation, device->max_speed, i, &q); if (rcode !=3D RCODE_COMPLETE) return rcode; =20 --=20 2.51.0 From nobody Mon Feb 9 09:53:29 2026 Received: from fhigh-b4-smtp.messagingengine.com (fhigh-b4-smtp.messagingengine.com [202.12.124.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69C1E283FCD; Sat, 18 Oct 2025 03:55:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.155 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760759743; cv=none; b=m9rlOqFY8YwI7jfOOWLi57fLqxm7U4TbvJwF9qxEytqHrRH0//1ptwivXP61+GWlFb06VhnJOcFpy1adr4LQUaco958NHHobGIXL4swsy0pMuTSAu9JM3vS88RGdrLXPgmAPivwCNAA7h9i53ad5MmiR/tfcfgle5SweWlIPpR8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760759743; c=relaxed/simple; bh=E6hanbGQUZFTn7iDKfN/WIfwn073f0TH4F1/RRVmj24=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qmrIkdGfXPzqHHEfIyp24OycJ1HhyumYM4gXN8Qa5GONAnsDIvWRSMl1AHzPRBv17U8JPGQS9hMbjHHVHCoNooBd8/sNXq15chivNpwO74YTbDOr+gEbolLa3T5B+pThJ7XEWGN65/NZ4ig4XnkeLddLBYfhS5eWRfqWHfdCBaw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp; spf=pass smtp.mailfrom=sakamocchi.jp; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b=asld1cgw; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=WiafUUXt; arc=none smtp.client-ip=202.12.124.155 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="asld1cgw"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="WiafUUXt" Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 5A3647A0140; Fri, 17 Oct 2025 23:55:40 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Fri, 17 Oct 2025 23:55:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1760759740; x= 1760846140; bh=yGRLVQuJIrWSADXY2lmb05uJei7Ja3Kf7eceuATqL44=; b=a sld1cgwe3nm/t5hVjfdXsZRcUZKW7J7KiUmfzWaFGfE/9VFELTRyurBiHvUojG8N Tszm0X2kAxlcHhs2/19cV2SF/31X+12y5gZZV+UmpO+qpKkpHVN91fo/Vg1N9UEZ aPK/fVcYBeSNFMLSQOnJmfggnhJ43LNIDP5DrlHoHAFnDS5eCEQH7jSyPc1h46m/ pgA8VgBeYp5SeLTLIntzFITRXbJBYCVfyIh7skO7Fs2Q80vWvTyliYmRk1g9nQL3 ekezbiGddkP3k2Zfn3NJsuZ1CGW8oEdQ6ZNI0mNrO+WkDvxqgramKdxl7HsKzMhN JFy/ZpH+dhobvL0APM4yg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1760759740; x=1760846140; bh=y GRLVQuJIrWSADXY2lmb05uJei7Ja3Kf7eceuATqL44=; b=WiafUUXt0pTbhRXpF Li3sQ5MvsqLO+w43amhexhcfBVG/5IxTMMkBWvZ1M58Djv23dEi0VA2sM4MCsODq WI6p/i8wfuHtT4iJiwcfkB1eWzxrF0Yc43+3ipJNgtmldnkWt+1HjpwjXAx+OGo/ 7be8XnViIwW/+lz4cvpc1RKIkinGcGtuoLI/h0/W0IXgsCdDTKwHjM4DWbZatf5X pmujMaxu7UYnjFxIdBGzazNI1cB309PsNaARbaN54/D+71aHfzGmBp59FKENFjgA 6k3HaePPRBFwHMK50ed9YHfwD251xV4lsHXzIy3YK4NC92b1qkOIAzxprTVZ4jrE n2tdw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddufedutddvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgjeeuvd fguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrg hkrghmohgttghhihdrjhhppdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehlihhnuhigudefleegqdguvghvvghlsehlihhsthhsrdhsohhurh gtvghfohhrghgvrdhnvghtpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgv rhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqshhouhhnugesvhhgvg hrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Oct 2025 23:55:38 -0400 (EDT) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH 2/4] firewire: core: determine transaction speed after detecting quirks Date: Sat, 18 Oct 2025 12:55:30 +0900 Message-ID: <20251018035532.287124-3-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251018035532.287124-1-o-takashi@sakamocchi.jp> References: <20251018035532.287124-1-o-takashi@sakamocchi.jp> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Current implementation determines the maximum transaction speed supported by the target device after reading bus information block of configuration ROM. The read operations for root directory block are then performed at the determined speed. However, some devices have quirks that cause issues when transactions are performed at the determined speed. In the first place, all devices are required to support the lowest speed (S100) and must respond successfully to any read request within the configuration ROM space. Therefore it is safe to postpone speed determination until the entire configuration ROM has been read. This commit moves the speed determination after reading root directory. Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-device.c | 53 ++++++++++++++++------------------ 1 file changed, 25 insertions(+), 28 deletions(-) diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index c698d4ced7d7..6a5740ed4934 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c @@ -680,32 +680,6 @@ static int read_config_rom(struct fw_device *device, i= nt generation) // Just prevent from torn writing/reading. WRITE_ONCE(device->quirks, quirks); =20 - speed =3D device->node->max_speed; - - /* - * Determine the speed of - * - devices with link speed less than PHY speed, - * - devices with 1394b PHY (unless only connected to 1394a PHYs), - * - all devices if there are 1394b repeaters. - * Note, we cannot use the bus info block's link_spd as starting point - * because some buggy firmwares set it lower than necessary and because - * 1394-1995 nodes do not have the field. - */ - if ((rom[2] & 0x7) < speed || speed =3D=3D SCODE_BETA || card->beta_repea= ters_present) { - u32 dummy; - - /* for S1600 and S3200 */ - if (speed =3D=3D SCODE_BETA) - speed =3D card->link_speed; - - while (speed > SCODE_100) { - if (read_rom(device, generation, speed, 0, &dummy) =3D=3D - RCODE_COMPLETE) - break; - --speed; - } - } - /* * Now parse the config rom. The config rom is a recursive * directory structure so we parse it using a stack of @@ -782,13 +756,36 @@ static int read_config_rom(struct fw_device *device, = int generation) length =3D i; } =20 - device->max_speed =3D speed; - quirks |=3D detect_quirks_by_root_directory(rom + ROOT_DIR_OFFSET, length= - ROOT_DIR_OFFSET); =20 // Just prevent from torn writing/reading. WRITE_ONCE(device->quirks, quirks); =20 + speed =3D device->node->max_speed; + + // Determine the speed of + // - devices with link speed less than PHY speed, + // - devices with 1394b PHY (unless only connected to 1394a PHYs), + // - all devices if there are 1394b repeaters. + // Note, we cannot use the bus info block's link_spd as starting point be= cause some buggy + // firmwares set it lower than necessary and because 1394-1995 nodes do n= ot have the field. + if ((rom[2] & 0x7) < speed || speed =3D=3D SCODE_BETA || card->beta_repea= ters_present) { + u32 dummy; + + // for S1600 and S3200. + if (speed =3D=3D SCODE_BETA) + speed =3D card->link_speed; + + while (speed > SCODE_100) { + if (read_rom(device, generation, speed, 0, &dummy) =3D=3D + RCODE_COMPLETE) + break; + --speed; + } + } + + device->max_speed =3D speed; + old_rom =3D device->config_rom; new_rom =3D kmemdup(rom, length * 4, GFP_KERNEL); if (new_rom =3D=3D NULL) { --=20 2.51.0 From nobody Mon Feb 9 09:53:29 2026 Received: from fhigh-b4-smtp.messagingengine.com (fhigh-b4-smtp.messagingengine.com [202.12.124.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE7E5286D40; Sat, 18 Oct 2025 03:55:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.155 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760759744; cv=none; b=NIY3Qva0bc88sA/hceUUdO+V1EIT7QNlQ5LVY7pA/XHSYjdfSndnUdf/lEhZYlPNpTmqMRNYYMhjX8TyO3VJBKEfrJ5ReRp1NoKpOyf6IRayGlCuWGMCcsnXoaVqq5xgT2zGkjoq2dIe46DE7cYtwhk3Pt2Yln/QfL0gaGd5BEo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760759744; c=relaxed/simple; bh=9q4ZenqssNuq566mSzIGMWY9TKVglICy5yTYQWSr0Xg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EJkS23bNcWCt1Uqc+nANPPm9CakBvjoYMB8JPIQKGmYbcJ3m/MRe+BUWJ7izSVIcYn7llJjZ02FFTj7ShzX907wRfZf1mg2v+/HGvBqMRnZlpoBnxXfsQwV6DUR/z2QGesN5DeY+3bDdJV/XQYRt/S96LOHO1rJFPcUqu4XdOKU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp; spf=pass smtp.mailfrom=sakamocchi.jp; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b=WJ3eawXd; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=vXKD/Saf; arc=none smtp.client-ip=202.12.124.155 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="WJ3eawXd"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="vXKD/Saf" Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.stl.internal (Postfix) with ESMTP id 168F97A0147; Fri, 17 Oct 2025 23:55:42 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-01.internal (MEProxy); Fri, 17 Oct 2025 23:55:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1760759741; x= 1760846141; bh=dm4H81ZdYiAnyPguz4Bgqq3z9wTH09vJcCXCWxJQJ8Y=; b=W J3eawXd2Sn10e3oevbtewhdQX6zvoVsPhvoppgBu2JraxuK6yD/5ss6xxTt/VymR pnGD1aUUlDnrdZKSOPrFyTOJLIBbg3JiqGywmwY3r/ETfVkrdy3MwBbSVJP8sibm KL2WCzPfpZDTBAVg4jUxOpYlCN6+2En793B7Es2twZwe0/rgRNv7808eRDeMuR3U C02HL7VvN1vBSbbngvs87K2Dqecrb39m/CEW6Hudx87ldca1V0s1g9OIWL1Hb8rp XqtsZiORqw9v36UrkGYPLCD2LB8nMw/qCn1ZuYkh84wAVpt3/OvI3FxAZvgueZTC edSdyrKYYwaWi0hZzR9+g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1760759741; x=1760846141; bh=d m4H81ZdYiAnyPguz4Bgqq3z9wTH09vJcCXCWxJQJ8Y=; b=vXKD/SafGXwIqQQDF TxTQsOsYXAUc1WhnBY7LAanehod+cIAthAHWczatomusNC2a0ptrd/JbCt48N8uU l+kDrUxveySkz7p5d+H9MtUfxR7kAlZO7hQtubCa5xWKZ1E4N7O08dLFlSLW/inQ 0j+8pGxqJ1nArssRHDRs0lxsBVpsDKjf71joWWVlRWB8B8EAszcI0sNTCOyFhbaS vkULi5F/KnSZ3yV+GjbhM9CAflO9avugusf6D4iXaG136q6m1uaGqID3nwnpgbZc sQ1DGCdLC13ncRvAF7qx4iucmHS68gdIxMz37cKfbqxVD0ntHN4lSVOUeh3cn2tW xwamg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddufedutddvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgjeeuvd fguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrg hkrghmohgttghhihdrjhhppdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehlihhnuhigudefleegqdguvghvvghlsehlihhsthhsrdhsohhurh gtvghfohhrghgvrdhnvghtpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgv rhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqshhouhhnugesvhhgvg hrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Oct 2025 23:55:40 -0400 (EDT) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH 3/4] firewire: core: handle device quirk of TASCAM FW-1884/FW-1804/FW-1082 Date: Sat, 18 Oct 2025 12:55:31 +0900 Message-ID: <20251018035532.287124-4-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251018035532.287124-1-o-takashi@sakamocchi.jp> References: <20251018035532.287124-1-o-takashi@sakamocchi.jp> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" TASCAM FW-1884/FW-1804/FW-1082 is too lazy to repspond to asynchronous request at S400. The asynchronous transaction often results in timeout. This is a problematic quirk. This commit adds support for the quirk. When identifying the new quirk flag, then the transaction speed is configured at S200. Signed-off-by: Takashi Sakamoto --- drivers/firewire/core-device.c | 18 +++++++++++++++++- include/linux/firewire.h | 3 +++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c index 6a5740ed4934..1674de477852 100644 --- a/drivers/firewire/core-device.c +++ b/drivers/firewire/core-device.c @@ -571,6 +571,14 @@ static const struct entry_match motu_audio_express_mat= ches[] =3D { { 8, 0x17104800 }, }; =20 +static const struct entry_match tascam_fw_series_matches[] =3D { + { 1, 0x0300022e }, + { 3, 0x8d000006 }, + { 4, 0xd1000001 }, + { 6, 0x1200022e }, + { 8, 0xd4000004 }, +}; + static int detect_quirks_by_root_directory(const u32 *root_directory, unsi= gned int length) { static const struct { @@ -583,6 +591,11 @@ static int detect_quirks_by_root_directory(const u32 *= root_directory, unsigned i .matches =3D motu_audio_express_matches, .match_count =3D ARRAY_SIZE(motu_audio_express_matches), }, + { + .quirk =3D FW_DEVICE_QUIRK_UNSTABLE_AT_S400, + .matches =3D tascam_fw_series_matches, + .match_count =3D ARRAY_SIZE(tascam_fw_series_matches), + }, }; int quirks =3D 0; int i; @@ -761,7 +774,10 @@ static int read_config_rom(struct fw_device *device, i= nt generation) // Just prevent from torn writing/reading. WRITE_ONCE(device->quirks, quirks); =20 - speed =3D device->node->max_speed; + if (unlikely(quirks & FW_DEVICE_QUIRK_UNSTABLE_AT_S400)) + speed =3D SCODE_200; + else + speed =3D device->node->max_speed; =20 // Determine the speed of // - devices with link speed less than PHY speed, diff --git a/include/linux/firewire.h b/include/linux/firewire.h index f1d8734c0ec6..6143b7d28eac 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h @@ -179,6 +179,9 @@ enum fw_device_quirk { =20 // MOTU Audio Express transfers acknowledge packet with 0x10 for pending = state. FW_DEVICE_QUIRK_ACK_PACKET_WITH_INVALID_PENDING_CODE =3D BIT(2), + + // TASCAM FW-1082/FW-1804/FW-1884 often freezes when receiving S400 packe= ts. + FW_DEVICE_QUIRK_UNSTABLE_AT_S400 =3D BIT(3), }; =20 enum fw_device_state { --=20 2.51.0 From nobody Mon Feb 9 09:53:29 2026 Received: from fout-b5-smtp.messagingengine.com (fout-b5-smtp.messagingengine.com [202.12.124.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD507288C34; Sat, 18 Oct 2025 03:55:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.12.124.148 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760759746; cv=none; b=K5ndWuV/45oNBnSmPRQ/aLS576OY7WUweyouYhc5Pjuag+Kjb0vuZFLH5a+5P6MvkelNc9sxXV+LksHWBEXcEb/QyOfX7RpqUz2CWzs5x4AMjBAvagpjjukOQndsKCc5WUv7r3pVG8uM3MM86YsRItv0f74XRaLbiridqS4csik= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760759746; c=relaxed/simple; bh=NoQB9jvo/lj/F4d2DrjGprzN8jy2Gy1DaI/zECBTSss=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hQ/nFAQEZe9X/RODiDg/NCkVkD6hXBSgG2p8TMjlEpyBi9JoW2ZAOoqiQwdf/A0qJlBj584NRjFOcesmKbm7qfkk7bUoPterpTXwoeTFxzTcD2ZUi0Zgd65wLLXKAwNfjuX6bg2etseO29VpWtU3AVyMyAkgEy133vDYO+VQDes= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp; spf=pass smtp.mailfrom=sakamocchi.jp; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b=Q3GvJEB2; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=JFsiRHb+; arc=none smtp.client-ip=202.12.124.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sakamocchi.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sakamocchi.jp header.i=@sakamocchi.jp header.b="Q3GvJEB2"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="JFsiRHb+" Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id EEC861D0014C; Fri, 17 Oct 2025 23:55:43 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Fri, 17 Oct 2025 23:55:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sakamocchi.jp; h=cc:cc:content-transfer-encoding:content-type:date:date:from :from:in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm2; t=1760759743; x= 1760846143; bh=O1OWHiw1ISX/XiaSgOMO5lUblMBfevYTme7V5wEqPbA=; b=Q 3GvJEB2TOTodbuldWv5xNSegMOP8BgIuxjug90YgXoUrBvz7RCZWiW0VnQwA/Lfn ULGPPwUnF1gHYeu2caoULUwVi9rwrNvWGMZuLbYyNvGnxgLWPVrRMp8rE2vfcDAA BVDv9Ehjuf7DUtk0r03Fb61feZDKhw4vizZYuPmbkjiVEythkv3OwVe15CByvpRw nkdA+s+/mGPdvQhnWYOqRYQHdU1NG1Es7WoRznlYl+mZSszkbC+73vx4ukBSSGrG 0qb8Nju1lWFSlFhaH/OoyQB2bVDGa2OuNosIXJU2xvVJilxvJzGvrieuaTiU2v7y aFeQ33DTlcyO2nLPZbvYA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1760759743; x=1760846143; bh=O 1OWHiw1ISX/XiaSgOMO5lUblMBfevYTme7V5wEqPbA=; b=JFsiRHb+IeRAUhjTY sbnKSLsbLEhv0fiIdBUBDTgxQPOoGK3gCqiuOt9BY1s+g56ZGk5OWxZRpLNUzkxI hxKYYjIeNp7V+n2Ngz5ExKt5z8Tt7Nfcfn4HVxvAeBAlLw63Dnls01XxBOpU1mkF 0G6AVOsAgeY4qthXgKf0I6+MoXW7gCGwjwSrYMdGagbbP1pfkfQ3nx/VKi3P6lgc pFOA/6p3ePKiM8laGWj7m587f7gMGoAwUjEUo1/yC0dp0snbr0mKgiNKR7eCdDl8 Wx+MrzD8mQANRvBu+qXH0oc4A+2NSqoLS41okGwZycaffb3By7A+TLgFdJmMJkfd 488lw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddufedutddvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkffojghfggfgsedtkeertd ertddtnecuhfhrohhmpefvrghkrghshhhiucfurghkrghmohhtohcuoehoqdhtrghkrghs hhhisehsrghkrghmohgttghhihdrjhhpqeenucggtffrrghtthgvrhhnpedvjefgjeeuvd fguddukeelveetgfdtvefhtdfffeeigfevueetffeivdffkedvtdenucevlhhushhtvghr ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehoqdhtrghkrghshhhisehsrg hkrghmohgttghhihdrjhhppdhnsggprhgtphhtthhopeefpdhmohguvgepshhmthhpohhu thdprhgtphhtthhopehlihhnuhigudefleegqdguvghvvghlsehlihhsthhsrdhsohhurh gtvghfohhrghgvrdhnvghtpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgv rhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqshhouhhnugesvhhgvg hrrdhkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: ie8e14432:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 17 Oct 2025 23:55:42 -0400 (EDT) From: Takashi Sakamoto To: linux1394-devel@lists.sourceforge.net Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org Subject: [PATCH 4/4] ALSA: firewire-tascam: reserve resources for transferred isochronous packets at S400 Date: Sat, 18 Oct 2025 12:55:32 +0900 Message-ID: <20251018035532.287124-5-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251018035532.287124-1-o-takashi@sakamocchi.jp> References: <20251018035532.287124-1-o-takashi@sakamocchi.jp> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" TASCAM FW-1884/FW-1804/FW-1082 have a quirk that they often freeze when receiving isochronous packets at S400. This behaviour is suppressed by a new quirk flag added in Linux FireWire core to restrict maximum speed. Consequently both of the asynchronous transactions and isochronous transmissions are done at S200. However, the device still transfers isochronous packet at S400, and the way to indicate the transmission speed is not cleared yet. This commit correctly reserves isochronous resources for the transferred packet stream at S400. As a beneficial side effect, the pair of isochronous transmissions for FW-1884 fits within the bandwidth capacity of the bus. Signed-off-by: Takashi Sakamoto --- sound/firewire/tascam/tascam-stream.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/sound/firewire/tascam/tascam-stream.c b/sound/firewire/tascam/= tascam-stream.c index 9c8fddd7dee1..4ecd151a46c1 100644 --- a/sound/firewire/tascam/tascam-stream.c +++ b/sound/firewire/tascam/tascam-stream.c @@ -282,20 +282,22 @@ static int keep_resources(struct snd_tscm *tscm, unsi= gned int rate, struct amdtp_stream *stream) { struct fw_iso_resources *resources; + int speed; int err; =20 - if (stream =3D=3D &tscm->tx_stream) + if (stream =3D=3D &tscm->tx_stream) { resources =3D &tscm->tx_resources; - else + speed =3D fw_parent_device(tscm->unit)->max_speed; + } else { resources =3D &tscm->rx_resources; + speed =3D SCODE_400; + } =20 err =3D amdtp_tscm_set_parameters(stream, rate); if (err < 0) return err; =20 - return fw_iso_resources_allocate(resources, - amdtp_stream_get_max_payload(stream), - fw_parent_device(tscm->unit)->max_speed); + return fw_iso_resources_allocate(resources, amdtp_stream_get_max_payload(= stream), speed); } =20 static int init_stream(struct snd_tscm *tscm, struct amdtp_stream *s) @@ -455,7 +457,6 @@ int snd_tscm_stream_start_duplex(struct snd_tscm *tscm,= unsigned int rate) } =20 if (!amdtp_stream_running(&tscm->rx_stream)) { - int spd =3D fw_parent_device(tscm->unit)->max_speed; unsigned int tx_init_skip_cycles; =20 err =3D set_stream_formats(tscm, rate); @@ -466,13 +467,13 @@ int snd_tscm_stream_start_duplex(struct snd_tscm *tsc= m, unsigned int rate) if (err < 0) goto error; =20 - err =3D amdtp_domain_add_stream(&tscm->domain, &tscm->rx_stream, - tscm->rx_resources.channel, spd); + err =3D amdtp_domain_add_stream(&tscm->domain, &tscm->rx_stream, tscm->r= x_resources.channel, + fw_parent_device(tscm->unit)->max_speed); if (err < 0) goto error; =20 - err =3D amdtp_domain_add_stream(&tscm->domain, &tscm->tx_stream, - tscm->tx_resources.channel, spd); + err =3D amdtp_domain_add_stream(&tscm->domain, &tscm->tx_stream, tscm->t= x_resources.channel, + SCODE_400); if (err < 0) goto error; =20 --=20 2.51.0