From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) (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 C6FC4132807; Wed, 17 Apr 2024 14:35:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.11.138.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713364525; cv=none; b=Ht9efX8FOqBRudNgaM86zUChunbzmc2PpBX4n5kXFmxgLs/oyEWI0ibUcjYRivF+qZN7+E8ETGtIrP837umNzCRf1rMJFKhO/SUGCZzQqB5fhsuwhKfzfTWOQN5x/hBHapuDfcuGX4wZUpu4wnDjWIMIlqQxZCUDT6lRGMODsAI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713364525; c=relaxed/simple; bh=/m0XnVMz0BvDuqHBqE70SQPupIVTwefnijZ2fT9R74s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fBXxLne+7CNKJbzjRohbiPac9XHJ1AeXLN00y/yqIHpG6Tz22/x+9uuVwAhGPil+vTUwNeY1lqFNA7m2Ow9a3a6Ta+w4Wd7yUyUKk/B0s6KSP8Ghhnt/6OxH5ja0P/XfgOWOSvpMK7Y57tVL3olALXEKKc1bXbSzuDC7CjMFRrM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sntech.de; spf=pass smtp.mailfrom=sntech.de; arc=none smtp.client-ip=185.11.138.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sntech.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sntech.de Received: from i5e8616c3.versanet.de ([94.134.22.195] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rx6NP-0003y3-HQ; Wed, 17 Apr 2024 16:35:07 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Lorenzo Pieralisi , Krzysztof =?utf-8?B?V2lsY3p5xYRza2k=?= , Rob Herring , Bjorn Helgaas , Simon Xue , Shawn Lin , Niklas Cassel Cc: Damien Le Moal , Niklas Cassel , Jianfeng Liu , Manivannan Sadhasivam , stable@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: Re: [PATCH v2] PCI: dw-rockchip: Fix GPIO initialization flag Date: Wed, 17 Apr 2024 16:35:06 +0200 Message-ID: <3292185.44csPzL39Z@diego> In-Reply-To: <20240416121522.269972-1-cassel@kernel.org> References: <20240416121522.269972-1-cassel@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Am Dienstag, 16. April 2024, 14:15:22 CEST schrieb Niklas Cassel: > PERST is active low according to the PCIe specification. > > However, the existing pcie-dw-rockchip.c driver does: > gpiod_set_value(..., 0); msleep(100); gpiod_set_value(..., 1); > When asserting + deasserting PERST. > > This is of course wrong, but because all the device trees for this > compatible string have also incorrectly marked this GPIO as ACTIVE_HIGH: > $ git grep -B 10 reset-gpios arch/arm64/boot/dts/rockchip/rk3568* > $ git grep -B 10 reset-gpios arch/arm64/boot/dts/rockchip/rk3588* > > The actual toggling of PERST is correct. > (And we cannot change it anyway, since that would break device tree > compatibility.) > > However, this driver does request the GPIO to be initialized as > GPIOD_OUT_HIGH, which does cause a silly sequence where PERST gets > toggled back and forth for no good reason. > > Fix this by requesting the GPIO to be initialized as GPIOD_OUT_LOW > (which for this driver means PERST asserted). > > This will avoid an unnecessary signal change where PERST gets deasserted > (by devm_gpiod_get_optional()) and then gets asserted > (by rockchip_pcie_start_link()) just a few instructions later. > > Before patch, debug prints on EP side, when booting RC: > [ 845.606810] pci: PERST asserted by host! > [ 852.483985] pci: PERST de-asserted by host! > [ 852.503041] pci: PERST asserted by host! > [ 852.610318] pci: PERST de-asserted by host! > > After patch, debug prints on EP side, when booting RC: > [ 125.107921] pci: PERST asserted by host! > [ 132.111429] pci: PERST de-asserted by host! > > This extra, very short, PERST assertion + deassertion has been reported > to cause issues with certain WLAN controllers, e.g. RTL8822CE. > > Fixes: 0e898eb8df4e ("PCI: rockchip-dwc: Add Rockchip RK356X host controller driver") > Tested-by: Jianfeng Liu > Signed-off-by: Niklas Cassel > Reviewed-by: Manivannan Sadhasivam On rk3588-jaguar Tested-by: Heiko Stuebner