From patchwork Thu Jan 4 13:01:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13511072 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 09E1AC47073 for ; Thu, 4 Jan 2024 13:02:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=QdwRxfYcGIvg/3hAHsHoX5qj3osFT/sGNWQoSeG35Bg=; b=He2ugZyJuJq/TV 64IGPZ6O28bM4Bo/aYy0BxD52uwcKxEH/lliUW6FnvhM4PDG8UgI5WFTQuwYH6N63gGuu9sQzZ3NL IxuBNJy1kOfzgltnqfTuCH58gIrq8J8LcY5Ixt8LGPGIQLRyfdtVD5V/5AjxtUMAAbyZeW4bSLp0p mM47D85jOefRfEvBIxlarGAzIacYE3aENxdrIYM6dDrgoacAm65RzC8wFCLLYz2cUP3JEZSZvGWOY uYnawtV4Qt+zrO6Tmkdbk6GwY/ksX/iyN25kQA+n3nyGdGS2QYMQQF83fab1UuvQqtSc0hqcNRtKI Qy1jeJDjiHqOe7REOwhg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rLNMP-00E2pZ-0R; Thu, 04 Jan 2024 13:02:09 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rLNMM-00E2mY-0r for linux-arm-kernel@lists.infradead.org; Thu, 04 Jan 2024 13:02:08 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3366e78d872so414462f8f.3 for ; Thu, 04 Jan 2024 05:02:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1704373322; x=1704978122; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=opVDF4AOHQah3OrT16oGMK2ccRRJHeIMJXkpc+aZwFs=; b=Luk0iAFtFKQ6pO/r6yXO/fU8rHCiEAOC7eIWIpSEnTX+KnSGBwgNPFEb871Ttssubi QxMKTB1QGN55pNV0hI/4y6o8vHk/iO6tJXe5rTxFFs3oUk2FYPtHFie3fuN9AML47Kf6 cfnNREMg805kpd2UAFSCUu9OyV4m3gDTIWZNDUvk7r4yj+6ee3niH97k8Iq3xfd8wAIo ohFWcayRzGVeuxdaVUgAX4gSILnrkbnJ1edb5qx0VmMrkDyuaazZgdVZw/EOde1bba9O M0ODNnAda0j/Ik8ChoUdGs9MEdXY21YXmyU9LcbRjAv9+lmaTPOn1LzpnJ+kClc+11iX Dcvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704373322; x=1704978122; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=opVDF4AOHQah3OrT16oGMK2ccRRJHeIMJXkpc+aZwFs=; b=C9EYgBI2QQw+55weS32nc3VAkvTZSGI3ikR40qMESuEvaSOaikqpqxRQExoRoZ2+eg ToYrLfCq5U1RbdcYtASXUXNYyhyMzh50p3lmPtBTcOfXQk618RpJU73OUp/mAkLFcDrM 6qspRwnlIqvPAhRZUMDe/HVw8PMerHkqyfyyMEd30aecI9rdzeB/tyDbQ6oPnLne21WO BzLsjpFfSHfL3Pv/CzUxCnlSScSu/mLFA9QXcfiuj8o+y5TqhZaZioETr7oDphxyjCdq AA5bpif0h+JWxcSlsBYNXSnicr/86NVpv/gRwII+3eZi0+zyYcmToLMed2ym1Kbp8SP8 HMKQ== X-Gm-Message-State: AOJu0Yyg9y9wd5bIzm18ZMfKFogjZUz1yFQs6+uo7KsFzZw1r3CM/HiZ jw5g/t3zj25PLIfN8iv/mF6n2oCdiGGp0w== X-Google-Smtp-Source: AGHT+IFsoUaWFe3hNCg6/b09WcRv7wsIMJMlEiNm/lu4Y1OTN1yICGktvfbzMdrteuCPKZTBntbM6g== X-Received: by 2002:adf:cc86:0:b0:337:157:2d3e with SMTP id p6-20020adfcc86000000b0033701572d3emr161961wrj.222.1704373322145; Thu, 04 Jan 2024 05:02:02 -0800 (PST) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:5b69:3768:8459:8fee]) by smtp.gmail.com with ESMTPSA id w5-20020a5d5445000000b0033660f75d08sm32887387wrv.116.2024.01.04.05.02.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 05:02:01 -0800 (PST) From: Bartosz Golaszewski To: Kalle Valo , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , Catalin Marinas , Will Deacon , Bjorn Helgaas , Heiko Stuebner , Jernej Skrabec , Chris Morgan , Linus Walleij , Geert Uytterhoeven , Arnd Bergmann , Neil Armstrong , =?utf-8?q?N=C3=ADcolas_F_=2E_R_?= =?utf-8?q?=2E_A_=2E_Prado?= , Marek Szyprowski , Peng Fan , Robert Richter , Dan Williams , Jonathan Cameron , Terry Bowman , Kuppuswamy Sathyanarayanan , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Huacai Chen , Alex Elder , Srini Kandagatla , Greg Kroah-Hartman Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Bartosz Golaszewski Subject: [RFC 0/9] PCI: introduce the concept of power sequencing of PCIe devices Date: Thu, 4 Jan 2024 14:01:14 +0100 Message-Id: <20240104130123.37115-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240104_050206_541215_04C17195 X-CRM114-Status: GOOD ( 16.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Bartosz Golaszewski During last year's Linux Plumbers we had several discussions centered around the need to power-on PCI devices before they can be detected on the bus. The consensus during the conference was that we need to introduce a class of "PCI slot drivers" that would handle the power-sequencing. After some additional brain-storming with Manivannan and the realization that the DT maintainers won't like adding any "fake" nodes not representing actual devices, we decided to reuse the existing infrastructure provided by the PCIe port drivers. The general idea is to instantiate platform devices for child nodes of the PCIe port DT node. For those nodes for which a power-sequencing driver exists, we bind it and let it probe. The driver then triggers a rescan of the PCI bus with the aim of detecting the now powered-on device. The device will consume the same DT node as the platform, power-sequencing device. We use device links to make the latter become the parent of the former. The main advantage of this approach is not modifying the existing DT in any way and especially not adding any "fake" platform devices. Bartosz Golaszewski (9): arm64: dts: qcom: sm8250: describe the PCIe port arm64: dts: qcom: qrb5165-rb5: describe the WLAN module of QCA6390 PCI/portdrv: create platform devices for child OF nodes PCI: hold the rescan mutex when scanning for the first time PCI/pwrseq: add pwrseq core code dt-bindings: vendor-prefixes: add a PCI prefix for Qualcomm Atheros dt-bindings: wireless: ath11k: describe QCA6390 PCI/pwrseq: add a pwrseq driver for QCA6390 arm64: defconfig: enable the PCIe power sequencing for QCA6390 .../net/wireless/qcom,ath11k-pci.yaml | 14 ++ .../devicetree/bindings/vendor-prefixes.yaml | 1 + arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 24 +++ arch/arm64/boot/dts/qcom/sm8250.dtsi | 10 + arch/arm64/configs/defconfig | 2 + drivers/pci/pcie/Kconfig | 2 + drivers/pci/pcie/Makefile | 2 + drivers/pci/pcie/portdrv.c | 3 +- drivers/pci/pcie/pwrseq/Kconfig | 19 ++ drivers/pci/pcie/pwrseq/Makefile | 4 + drivers/pci/pcie/pwrseq/pcie-pwrseq-qca6390.c | 197 ++++++++++++++++++ drivers/pci/pcie/pwrseq/pwrseq.c | 83 ++++++++ drivers/pci/probe.c | 2 + include/linux/pcie-pwrseq.h | 24 +++ 14 files changed, 386 insertions(+), 1 deletion(-) create mode 100644 drivers/pci/pcie/pwrseq/Kconfig create mode 100644 drivers/pci/pcie/pwrseq/Makefile create mode 100644 drivers/pci/pcie/pwrseq/pcie-pwrseq-qca6390.c create mode 100644 drivers/pci/pcie/pwrseq/pwrseq.c create mode 100644 include/linux/pcie-pwrseq.h