Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp113460lqj; Thu, 11 Apr 2024 11:18:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVSVjpQb0skmPprvku7F6cALsb3okKLWIXP7LMpAv/QpqTPbZBl1OL0E9shTOwAtJ/3m3Vah64zoSP9fQdA5ifA/oE6NkaoG/MYvhOZxw== X-Google-Smtp-Source: AGHT+IGkJo2KUU5BO6mbUTWSDb6+4HUePjDw/zSu5OeKiS8uQaLvqKAAHey+rGXMtREm3WZNY9Wb X-Received: by 2002:a50:d50a:0:b0:56d:fc50:ec50 with SMTP id u10-20020a50d50a000000b0056dfc50ec50mr364538edi.13.1712859499671; Thu, 11 Apr 2024 11:18:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712859499; cv=pass; d=google.com; s=arc-20160816; b=kiU+6I5eEw95WG6vUsQeiLD6mfTn20gROqT8yIt8SSFbECFBi4haYFT+OsyPV2te6B /wpRNoMMp9pMk+d1ivP+IKxQNIGAljMNmfxZusKke6POyocqMV3g7ShXBGarRAECHtlP 5moSr+QMA29Z17+CGU6akdxgzh5prt8xwyIFnpqLw6AAfYk0+nksSdZ9QzfmYdSzy8ak mGYt3d8msQHaUpLEWGuB96De8drNuKHzqGOLEIdchYoT8eBz60XW/hIn+oR1Bserc0Ws JtbVHkV5MF3CDzf7XDgQ8im/tv5JRS5t3DCaMxJ31LMk5rf8gg+kgu7FbPfNljcohsdn zTOA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:sender :dkim-signature; bh=0T8rtoqQ92EDxuwLceugcaPWhIqaMxutxDInAl4oXOs=; fh=xd9hO2dHYJkyFV537JKkuNTvq6j3lnC6kW6ARoSL/7Y=; b=z0wUR1mqLry6kNwcnE9huD9Q5KAaasRDwMeJaVvQs9qijT64s/zIth0Kq0GUgkeHcD u73DYcsSXcu+MdHzUOkk/UP5T1NuFCjepyPZ4tF2TZ8kU3TsbeKtnBkJ7CjRKuZ1qZaR 1y3WTHi6LWYIiykK5J2YJl/sfddJ4w1RvBTgeA7TzJJsnQUIEGW1qRmN+tmuiwaeWEj0 NNwt+HAZdULuvTnPJ6K2RRNne3KBfE2cxe6bczp9hUu8Y+JdnpzwQzsLWrc1kB84QSvE I6ODRfeqhJ2PaQw46sRTG55BwnigYblXRgS5ryD2DWYiIZvwg1NeRWAA1yYa6LtEpg1N n/LA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=G8s+UbqG; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-6197-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6197-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id m29-20020a50931d000000b0056fe7c54757si890364eda.182.2024.04.11.11.18.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 11:18:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6197-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=G8s+UbqG; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-6197-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6197-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 3C71F1F265B0 for ; Thu, 11 Apr 2024 18:18:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 866A9205E39; Thu, 11 Apr 2024 17:28:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="G8s+UbqG" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (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 5B17056458 for ; Thu, 11 Apr 2024 17:28:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712856517; cv=none; b=GskjjQvj/x1y3tTHriP3CkZJB4vua6ufYU0ZZz6eK0QDnlh8qifrPvIUhK1TjtRqT9YtF6mTZnsv6VOBjL7bqPIkhDjldsR2bxyMQKmJwKFHS3MY+3AareBAPGmLj8xwXS/AvaHzOXP4sE0OjL6o0j1CnmdWbkNXRmCheVD7mKc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712856517; c=relaxed/simple; bh=YEGi9Jy+zH0Fbu65l8woHH0AF4eBEty5nu13kp4o6d8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=qkLqa0yanpM+/slNbNVYVNtXHdlVSO6L0bEqg75hjuBx5VxPSeKqcIiJrXGkgYpBXBbvrVZHvy1E3KLdg5weDU1TkcaeFXpY2189HhTHE4nG5phjYrjowTMCHR/ZXjmsX8tyW/MFulAVhO5K+4rHhyTLQXf6ABKFcPTys6DuofI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lwfinger.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=G8s+UbqG; arc=none smtp.client-ip=209.85.161.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=lwfinger.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-5a7d6bc81c6so58511eaf.2 for ; Thu, 11 Apr 2024 10:28:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712856514; x=1713461314; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=0T8rtoqQ92EDxuwLceugcaPWhIqaMxutxDInAl4oXOs=; b=G8s+UbqG8h0kHmqn35Y7JN+oh8ZHC8SrZzQDo/nXl81kp29Ea4AERjhTfgA2T1DFOD 77G1f1y69A/nFqxwhfKpu6W7Du54QJV6WnJCwY6gSywyWP51zGbUBMYoqRF6FRXYUc1K 5NhdHsK6lC7AdYE+ycAO1vkp9rfTtbxZK+LWaTWj3+pidHmJVpiFcKc39I9GhbBEFPj2 v1Q/ajTwZkm9tVuIwgdFvuaa5T6BCKIBcPRCoUY/0RRMQ/gOVIHM/gL96qUHjGP+/pCh kz7XIXkVmPvS5V0PyHtPl2BehzoAA47vMwPDiyUdK2BIoNRy3MCLGT22mMogF6am/Wir D5gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712856514; x=1713461314; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0T8rtoqQ92EDxuwLceugcaPWhIqaMxutxDInAl4oXOs=; b=p3Q6ATjuqrzzD7QBAMoAp+3AXXvurEO/OHyeVkwwM0xvi5fPZf9X5Ybkt7iSk0gNU+ IztrlKmJxII+g3YAer2u4hQuwn+eBcPIkFwuXcxQEez435VzSWGfQrOXHkn5qyQiXkST pqistVZH2nrIWgDkWMqOJZSICCqaQXUh7HAXTGKopcS/oobRiDwM9dbNfxcFHKHzip7M n83jCV37dqTPxWE+n7Q7Y8Tja3lFobge6eg37Eqf7Z5OXS9aAd9SHhfdh64zwRtjvtFY jyoIwY8w7qyhg6wVJz47Hw8STaYyJuW5HMhpwrh7x+sUSO0WmAycSRfgBXUXDXwmgmfX 7UgA== X-Forwarded-Encrypted: i=1; AJvYcCVMBcJ57sLTFE0vozE3kc0u+MwYuvh4lY4Np6bkYo5MBalPrU858aFCRDujgxvcj3D3Mq6hNKAWdZiT081C0/lfpW/bz+pg8Gdnk9JQ06s= X-Gm-Message-State: AOJu0YwgD8WN2OmrLR8BZ6cD9uRMge/JGmm4bIhsfgz2Qg2LRhcmNpil KkOSAwOqz7qBPJj52ZeTLXj77Xfu2LT5j8CGPdWWNNti9/DohZ1i X-Received: by 2002:a05:6870:972a:b0:220:bd1c:6c21 with SMTP id n42-20020a056870972a00b00220bd1c6c21mr145816oaq.39.1712856514381; Thu, 11 Apr 2024 10:28:34 -0700 (PDT) Received: from [192.168.1.119] ([216.130.59.33]) by smtp.gmail.com with ESMTPSA id wz2-20020a0568707ec200b0022e9ffdb5a5sm434641oab.24.2024.04.11.10.28.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Apr 2024 10:28:33 -0700 (PDT) Sender: Larry Finger Message-ID: <46745fe7-a43d-4f7c-b247-f0fde01ee63e@lwfinger.net> Date: Thu, 11 Apr 2024 12:28:33 -0500 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC] rtw88: Fix startup problems for SDIO wifi plus UART Bluetooth To: Kalle Valo Cc: Ping-Ke Shih , Larry Finger , Johannes Berg , "linux-wireless@vger.kernel.org" References: <4umro86wvv84.MjDfYvt4P5uZryt8boBK8Q2@1EHFQ.trk.elasticemail.com> <5af71338f3904aac9d2c237637c851e7@realtek.com> <287e9d4e-316a-4579-961e-58e75abea534@lwfinger.net> <87o7agjs00.fsf@kernel.org> Content-Language: en-US From: Larry Finger In-Reply-To: <87o7agjs00.fsf@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/11/24 2:08 AM, Kalle Valo wrote: > (dropping stable list from cc) > > Larry Finger writes: > >> On 4/10/24 9:13 PM, Ping-Ke Shih wrote: >>> Larry Finger wrote: >>> >>>> As discussed in the links below, the SDIO part of RTW8821CS fails to >>>> start correctly if such startup happens while the UART portion of >>>> the chip is initializing. >>> I checked with SDIO team internally, but they didn't meet this case, >>> so we may >>> take this workaround. >>> SDIO team wonder if something other than BT cause this failure, and >>> after >>> system boots everything will be well. Could you boot the system without WiFi/BT >>> drivers, but insmod drivers manually after booting? >> >> I sent the request to the user with the problem. I do not have any SDIO devices. >> >>> >>>> --- >>>> drivers/net/wireless/realtek/rtw88/sdio.c | 28 +++++++++++++++++++++++ >>>> 1 file changed, 28 insertions(+) >>>> >>>> diff --git a/drivers/net/wireless/realtek/rtw88/sdio.c b/drivers/net/wireless/realtek/rtw88/sdio.c >>>> index 0cae5746f540..eec0ad85be72 100644 >>>> --- a/drivers/net/wireless/realtek/rtw88/sdio.c >>>> +++ b/drivers/net/wireless/realtek/rtw88/sdio.c >>>> @@ -1325,6 +1325,34 @@ int rtw_sdio_probe(struct sdio_func *sdio_func, >>> [...] >>> >>>> + mdelay(500); >>> Will it better to use sleep function? >> >> My thoughts were that a sleep function would tie up a CPU, whereas the >> delay would not. > > It's actually the opposite, msleep() allows other processes to run. > > "In general, use of mdelay is discouraged and code should be refactored > to allow for the use of msleep." > > https://docs.kernel.org/timers/timers-howto.html Kalle and Ping-ke, Sorry that I got that wrong. I have become just another confused old man. :) The OP at GitHub has tested kernels where he blacklisted the BT drivers. The wifi failed every time (3 tries with a delay and 3 times without). When he built a kernel with BT built-in rather than as a module, it worked (again 3 tries). There definitely is an interaction between the BT initialization and the wifi setup. If the BT part is not started and has not completed the UART initialization, SDIO wifi does not initialize correctly. When it fails, unloading the wifi driver and reloading it restores wifi. I originally wondered if there was a power problem when both were simultaneously started, but I see that is not the case. To reiterate, the BT must start first and complete UART initialization before the wifi starts initializing. It seems to me that a suitable msleep() at the start of the SDIO probe routine seems to be a viable workaround even though it is not aesthetically pleasing. A sleep of 150 ms is too short, but 500 seems to work reliably. Perhaps the SDIO experts at Realtek may be able to offer a more satisfying explanation. The OP at GitHub and I will try to answer any questions they might have. Note that I do not have the hardware, but my contact at GitHub is knowledgeable, and seems eager to help. Larry