From patchwork Thu Jan 4 13:01:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13511083 X-Patchwork-Delegate: kvalo@adurom.com Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) (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 343AA22313 for ; Thu, 4 Jan 2024 13:02:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="e1s7/3EE" Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-336c5b5c163so256516f8f.1 for ; Thu, 04 Jan 2024 05:02:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1704373324; x=1704978124; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=HQIEpNJctaz16RzA/leTZqNcUN7vsgkXc8Xvi93qAho=; b=e1s7/3EE+MeuNW95g+yb4nI2EfzKykj8shaTLoibDu7D3m/ffNrI6tEAU6DA6QSoTA mbnGXGkLbXqOvSFgn1mDXvBUqyIV91SKIGuKK7zJPhRjRXPwh4eMBYE9UOX9lndUWwPw fCfoSjPUPU4PGZn2Q3DO5UfmCX8Ql7GfM1BtQ4AfGNg9CxcR40b4tn5XkYVhadTUsCpJ TFaJULVT6u5l6SYVa9Z9hqAzB6+liviUn725RIMw31MnRlyZFwUpIjUIKQN6BF2+NDnZ O4CwH+t/AGZoWaEy/u3AAn2Ug/tiCKBUj4FeAjcxA/5pwS+ZB9sYFG1Zkht3aWPNu4Gl lncA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704373324; x=1704978124; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HQIEpNJctaz16RzA/leTZqNcUN7vsgkXc8Xvi93qAho=; b=cjrqLybIohpnME7JsvQDp+8G6WQT/popTW5j8r1D94VDBXZPLcR/WxVAq5TP/SpV3p fK+IgY4YYGF2s7/e+PxQhpkIc8ZzCKBOoQdNx+WoswYm2TYFmXPHVjcg4VbIGKB4jpdn Wodlt8jKYRRsZ6od+3xEYRVYd6vrngfVvUVQasQHr3TDZ5AUH3mScfhf1kOqLPjpA4Wd PDwSP1MOEhOTROn2z1+1b+O+QIfvZ0j0sT1SFMkpHq0PXnR8AW1+AWgqUR12OZC6QlB8 ERcbPmuJcYYj7osq43tdKGe2sGDjYhzo7FGTHS8tk+MWRXgGIOWSdAJejcarPaYFhkPU dreg== X-Gm-Message-State: AOJu0Yxkpxjk1XyyTNPJcqyS4AbN3J1gFbJP4SON4iEkMez+Ra2eUxSl a1poPuL7XKG7uWAD3ljQRfUdvyio4M/fUw== X-Google-Smtp-Source: AGHT+IEYrrjaOaf5/IBZBDz2VUcMEHweLF977kWhWHW+xRF7Tv9rMBKm8dg3stU9d6EnW3pR2nQiEQ== X-Received: by 2002:a5d:4576:0:b0:337:4f04:933c with SMTP id a22-20020a5d4576000000b003374f04933cmr318898wrc.54.1704373323681; Thu, 04 Jan 2024 05:02:03 -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.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 05:02:03 -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 1/9] arm64: dts: qcom: sm8250: describe the PCIe port Date: Thu, 4 Jan 2024 14:01:15 +0100 Message-Id: <20240104130123.37115-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240104130123.37115-1-brgl@bgdev.pl> References: <20240104130123.37115-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski Improve the description of the PCIe topology by defining the port node at the SoC level. Signed-off-by: Bartosz Golaszewski --- arch/arm64/boot/dts/qcom/sm8250.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi index 760501c1301a..fef9c314ce55 100644 --- a/arch/arm64/boot/dts/qcom/sm8250.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi @@ -2197,6 +2197,16 @@ pcie0: pcie@1c00000 { dma-coherent; status = "disabled"; + + pcieport0: pcie@0 { + device_type = "pci"; + reg = <0x0 0x0 0x0 0x0 0x0>; + #address-cells = <3>; + #size-cells = <2>; + ranges; + + bus-range = <0x01 0xff>; + }; }; pcie0_phy: phy@1c06000 { From patchwork Thu Jan 4 13:01:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13511084 X-Patchwork-Delegate: kvalo@adurom.com Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 490F0224EC for ; Thu, 4 Jan 2024 13:02:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="LwzpOVgJ" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3368b9bbeb4so414609f8f.2 for ; Thu, 04 Jan 2024 05:02:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1704373325; x=1704978125; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ef54oPQshoe7Gm//fznSEK5vgc/1PN5IaLbwIyajU/k=; b=LwzpOVgJodhygxDlW6YFe6csiuO+9HxvTvMHgGSzjBIotXkjlmxdDH3aG+0f0SCygj 8iO0lsFZaljaKCf2O7KwfuE6l4VsiYEvzEuhIJm9FrVNVmBxCVZMMXqaz+W/RKf8Kju3 P0Zw5wJCvw6Ptw27/ujtAnAcdeLNIp0Tdv6hOGIyU2tm0Nq4ned+ArRXem8ESSlTUYXw MLgAMP4F8kB2EpWj05qdk6X2udED2FidzfFIeKDOQ08loU2GFowMTWowMofcG67t4lbo TrkaRJLuqmU7/Vei5ZS/M3gvByPAJNrJzfRvUTZTa4bMx9Yy65LlHOOe2XdPD78QaK/A dKtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704373325; x=1704978125; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ef54oPQshoe7Gm//fznSEK5vgc/1PN5IaLbwIyajU/k=; b=O78pNXj3xXFCik9rdbJxJVqC4DFM8CylOXBNlMepUvVMWq2I7lLKB7bqUhx/Ym2KaR V/1lI/8Yu7e1i15CHsBefeXBJpxYwyq6hYySWZjvyhegHqB2YZ2RfELxDX0s3XsOE51Q VbrQZmbYoJo2I9OMzu14uPl4soz002v3Y1tfoe/hQ0GDQhqkKg2EeExP10HrgcggmiI2 3AAwIUq8za9fFheBKO5VgVSoOocllfJo3H9uq4dmykDAcBXyWgaZ3XXSzyfLQucOopzc 8hwL3tr3xGgbDafOYnWRCPLXDTYhmoIbDv308pHshwUDt0GnF86VG8bzL97K3FMkJLVg J5ZQ== X-Gm-Message-State: AOJu0YyQANu4XwTxlTl6i3PtNNe6mPsxyqrZravYwI5eSPwkUOaGU5Ge lW+0p025B6l2nOv5Pb5+8m171MDZzKAVMg== X-Google-Smtp-Source: AGHT+IE3hMjwAGjPrVJAC4uAAQmbYFgXxxZo1RNc4JRLcmBIwG0h5ZwWYvnldKAKE5zO1xwte3fjeQ== X-Received: by 2002:adf:ef47:0:b0:336:7d86:113e with SMTP id c7-20020adfef47000000b003367d86113emr232689wrp.80.1704373325566; Thu, 04 Jan 2024 05:02:05 -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.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 05:02:04 -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 2/9] arm64: dts: qcom: qrb5165-rb5: describe the WLAN module of QCA6390 Date: Thu, 4 Jan 2024 14:01:16 +0100 Message-Id: <20240104130123.37115-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240104130123.37115-1-brgl@bgdev.pl> References: <20240104130123.37115-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski Describe the ath11k WLAN on-board the QCA6390 module. Include the relevant regulators and the enable GPIO. Signed-off-by: Bartosz Golaszewski --- arch/arm64/boot/dts/qcom/qrb5165-rb5.dts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts index cd0db4f31d4a..721f86af952b 100644 --- a/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts +++ b/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts @@ -734,6 +734,22 @@ &pcie0_phy { vdda-pll-supply = <&vreg_l9a_1p2>; }; +&pcieport0 { + wifi@0 { + compatible = "pci17cb,1101"; + reg = <0x10000 0x0 0x0 0x0 0x0>; + + pinctrl-names = "default"; + pinctrl-0 = <&wlan_en_state>; + + enable-gpios = <&tlmm 20 GPIO_ACTIVE_HIGH>; + + vddpmu-supply = <&vreg_s2f_0p95>; + vddpcie1-supply = <&vreg_s8c_1p3>; + vddpcie2-supply = <&vreg_s5a_1p9>; + }; +}; + &pcie1 { status = "okay"; }; @@ -1303,6 +1319,14 @@ sdc2_card_det_n: sd-card-det-n-state { function = "gpio"; bias-pull-up; }; + + wlan_en_state: wlan-default-state { + pins = "gpio20"; + function = "gpio"; + drive-strength = <16>; + output-low; + bias-pull-up; + }; }; &uart6 { From patchwork Thu Jan 4 13:01:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13511085 X-Patchwork-Delegate: kvalo@adurom.com Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (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 A721C22EE8 for ; Thu, 4 Jan 2024 13:02:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="zESwugOz" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3368d1c7b23so374143f8f.0 for ; Thu, 04 Jan 2024 05:02:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1704373327; x=1704978127; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dm8mMOJsxux6ZmWUG3F7cuu+H2vgOte3WZWDy9og3kI=; b=zESwugOzZQWroLH3AzdFt7/hlzlCWNPWAY42tOmmQ1m+tQ1HgQT13NHkIGN54DaX3O w1aYnbe//4y09pGoNAkqCGL45RrOrRJQBEkvTkizscaQkkbH7nJA/HXjqdYkssHhCUzG aWLRnX93EEBj8JC2RHltW+mnbFvDKrfA8TSLxDjpo0xofw0MTHAsJsnEG1T0PSl90ZHY uX35iKTLEbTNFcMkes0gJ7taDIqUR06yYePDmN1YjJO6/0nlWcxgt5iIHWNAXfwXePJX n3mTT8jWJkaCoGeZ2n2uE2FQ85t68XGguhZCYoSMf0glh68o34oOtdEF21pVeDD2+Dyv iRKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704373327; x=1704978127; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dm8mMOJsxux6ZmWUG3F7cuu+H2vgOte3WZWDy9og3kI=; b=Tk0tHjI5q10BvZwtyvYmYa+iDg2PEofd9lhMXMdZNntSS7yxdpHdbYoHAIezHvBUrk kDbyacc1Ux5LEIS0BDZ9snLfSEWplAnUE3hE9B2taIVR36RKOCt4Uz2UWJQTaOzHs6Pu ungE02tack53eBYvZVXmtMX5iG9Qk9vLRmdh0Nlmx16hsxDZk4B/IRZCqXzyDpLjw7QK jvsVu68XWGP5jxHrQ2QHKyfYCISDMdz1SAUGpI870/IL0GeBYRE+poFZcilAaKoxpOCr ipqD0TW3cUfscBC9vk+6I0sA2/Ekx/zX9X/PEG6qmnZaYeTI4vgr8QtgzBBjzN+RjnHJ /RuA== X-Gm-Message-State: AOJu0YxZmPUJRL57YLL12YcyBOom4Fgtsm0Eqy4RFActnlfjMvi/pvyG DEFs4BdDcFMDYnvjF4flY9TjWccNxwdbfA== X-Google-Smtp-Source: AGHT+IEAmqT1dLhz8yMZPRNlwfwkfnr08tFlrQ2qx2EHGz1pEWzlFjlA+PDg16ga3IpH7ARH2S4IxQ== X-Received: by 2002:adf:b199:0:b0:337:175:a079 with SMTP id q25-20020adfb199000000b003370175a079mr327095wra.80.1704373327126; Thu, 04 Jan 2024 05:02:07 -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.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 05:02:06 -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 3/9] PCI/portdrv: create platform devices for child OF nodes Date: Thu, 4 Jan 2024 14:01:17 +0100 Message-Id: <20240104130123.37115-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240104130123.37115-1-brgl@bgdev.pl> References: <20240104130123.37115-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski In order to introduce PCIe power-sequencing, we need to create platform devices for child nodes of the port driver node. They will get matched against the pwrseq drivers (if one exists) and then the actuak PCIe device will reuse the node once it's detected on the bus. Signed-off-by: Bartosz Golaszewski --- drivers/pci/pcie/portdrv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c index 14a4b89a3b83..401fb731009d 100644 --- a/drivers/pci/pcie/portdrv.c +++ b/drivers/pci/pcie/portdrv.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -715,7 +716,7 @@ static int pcie_portdrv_probe(struct pci_dev *dev, pm_runtime_allow(&dev->dev); } - return 0; + return devm_of_platform_populate(&dev->dev); } static void pcie_portdrv_remove(struct pci_dev *dev) From patchwork Thu Jan 4 13:01:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13511086 X-Patchwork-Delegate: kvalo@adurom.com Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 3BB2F23748 for ; Thu, 4 Jan 2024 13:02:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="qDAKAE9T" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3368d1c7b23so374167f8f.0 for ; Thu, 04 Jan 2024 05:02:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1704373328; x=1704978128; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ko9AldsNAGIySQ6r8IsXSCtLQ9r/1ys0AWCrWCqKA/w=; b=qDAKAE9TbUQIkcoKTZtSY0WnsUGIVQYmcduoDIK0xckAbAwmxwmFXB4AWvibjMdYYo aHW7vr9A+l3jDthupCARLI5lxAm3VBqCodkR7/R4H4D0/iCjyAgskyFjHHXw5R1/wnRb L6xinfTzmbRP5M8plryQr/jzRPFgvnrY2jN5ymG+7Mx9CX1P3DSNnkUfXmswZOKE2S9h 8hiiEjZCIFevEUYRcAddjo5IoeH53GKB+12G6Mta0Zhq9roMq7itKAXT9BzZXnmn7IsP 6OkbDcLCHnsulClebByr5ufXmmymyNSC+LY46xZFukP9mrdmqSSepY+Sd4DKvqqBfj7D gDLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704373328; x=1704978128; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ko9AldsNAGIySQ6r8IsXSCtLQ9r/1ys0AWCrWCqKA/w=; b=beeATb1Pj8BD8HoVqF0uCbnkkH+iKAFPgb99qB7RiTuxnxdmKg4vlWkzX1XahBayj+ n7LshhmBFpHSoOl1CJszMGdPv64nu4rkDWXRmml8E/Co6FCgmMgXaT/g9zlOHD43dozk NufvtyYE6+KFjbqT5yYvhCjPsR1X0LLYWwE49VDUCvM3mhzv8lgp1KHwnaZRcoEMSVyZ 2f2w3hTOwgXtK94TTq1AbHL8lsCy5gBtx7WIpLqX5ksvu8ECbJgWfjwvqjZ5MwjGjgmc 0KpkqqfPpi2kvyg1XlpXvUbRvqfoFVi4VX1TOoLYHJkDCrVhPf+ZAfo4iUFmALz7F7vy Dagw== X-Gm-Message-State: AOJu0YzNrconAMA8QyODdDZdKF0wjqVWXDc4KzZqNNChad6eA2Gbu9Wc cLqufNe4sHnba2NSDi+toM7Y0ECeqgdVBg== X-Google-Smtp-Source: AGHT+IFUjxl+akq5qBUWz1Hq2UkXunszpKE6K042Vn3Nvy8yjJ9A6yhdSklCJkd/SLfWbEWSuN0qWg== X-Received: by 2002:adf:f1c7:0:b0:336:7f93:3dcc with SMTP id z7-20020adff1c7000000b003367f933dccmr292279wro.81.1704373328663; Thu, 04 Jan 2024 05:02:08 -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.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 05:02:08 -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 4/9] PCI: hold the rescan mutex when scanning for the first time Date: Thu, 4 Jan 2024 14:01:18 +0100 Message-Id: <20240104130123.37115-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240104130123.37115-1-brgl@bgdev.pl> References: <20240104130123.37115-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski With the introduction of the power sequencing drivers that will be able to trigger the port rescan, we need to hold the rescan mutex during the initial pci_host_probe() too or the two could get in each other's way. Signed-off-by: Bartosz Golaszewski --- drivers/pci/probe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index b7335be56008..957f7afee7ba 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -3122,7 +3122,9 @@ int pci_host_probe(struct pci_host_bridge *bridge) struct pci_bus *bus, *child; int ret; + pci_lock_rescan_remove(); ret = pci_scan_root_bus_bridge(bridge); + pci_unlock_rescan_remove(); if (ret < 0) { dev_err(bridge->dev.parent, "Scanning root bridge failed"); return ret; From patchwork Thu Jan 4 13:01:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13511087 X-Patchwork-Delegate: kvalo@adurom.com Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 D1D91241F1 for ; Thu, 4 Jan 2024 13:02:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="QVSdXkKS" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-336c8ab0b20so448408f8f.1 for ; Thu, 04 Jan 2024 05:02:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1704373330; x=1704978130; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C0/NJ7KYEulil2Xeyr0vkcKQVIe4dXTk2WHu1Aal+GM=; b=QVSdXkKSrGsr/Oael23krHCfZal44tTq1nlfWdZZHrbCwSePZZM9VdnKpJS0ssNA2D gTpPNYMRrg7t6O2KPZWDqj0lZD+PoNlHkUKzzKRp7GCMWa4KzBY4F5yRz9fnVno1emGL jDMQVB8/C8zsMvpY+WRj2fSdL5wPhEU0sHT81qfAOvVaxZiQKwwDM/boHYRy0ZvqXoi8 lzT0JjScoJt8MsJeeWWs3IkS+ZVdP9ZY8SmnyYuxXpqJxXvXq7K89oRhD0JCSZ+e8fnE O5UctSqi6JDo9rtbjHS0jSHddF6ZiI/tJ71PX/nPrUdUKx+A9fhqx2puXedraOtIDloe rD9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704373330; x=1704978130; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C0/NJ7KYEulil2Xeyr0vkcKQVIe4dXTk2WHu1Aal+GM=; b=bUnSqKokBpOd6QhJI8d5m2crPxcy3uy6S4UaAR+oXL1N2ZeV04hjzEfnTgCzwcAoSD XcYvl8QzjM+djldNIAyq4g5VftjsEDQkvTftnpiNiKuAaXKN8Q/QScYNGwHDDnmKcnPR brre4IF+//K2XivL4WzYlKrbZqeeCxARvN7tQ6P/VqxNlpvWvfGTEqyJ1K4SZFtWunTP jkdUXomRBRifObc7oQ4dlyeTdsOf3I+k1J/WK0t6DbNN+kDM7ZwGhlucp9psp0OUbm7j 3YfSdwWY7Kb82f4jQm6En/XTUMXYrNiy732/MzF/4zfcfIn+/fcaQkhgAMic7T/U1/CN oW8Q== X-Gm-Message-State: AOJu0Yz0ywMaix7fLeJ8yh6vdg2PbQdL65eM4iDbwGfEJdUu7BVMxIJE wQGaDqOKqsVjE2+Bt2qF3opVKdrHETROjA== X-Google-Smtp-Source: AGHT+IH1sAH1RUXIP7DjQNVAHdST7oR7mT24OIBd+gWvZXVas72o61+b25pqunGvVU+Vz6z5WhqhXQ== X-Received: by 2002:adf:ce88:0:b0:336:7590:bd34 with SMTP id r8-20020adfce88000000b003367590bd34mr378455wrn.6.1704373330194; Thu, 04 Jan 2024 05:02:10 -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.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 05:02:09 -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 5/9] PCI/pwrseq: add pwrseq core code Date: Thu, 4 Jan 2024 14:01:19 +0100 Message-Id: <20240104130123.37115-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240104130123.37115-1-brgl@bgdev.pl> References: <20240104130123.37115-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski Some PCIe devices must be powered-on before they can be detected on the bus. Introduce a simple framework built around the PCIe port driver which now instantiates its child devices from device-tree. The way this works is: a DT node representing a PCIe device connected to the port can be matched against its power sequencing platform driver. If the match succeeds, the driver is responsible for powering-up the device and calling pcie_pwrseq_device_enable() which will trigger a PCI bus rescan as well as subscribe to PCI bus notifications. When the device is detected and created, we'll make it consume the same DT node that the platform device did. When the device is bound, we'll create a device link between it and the parent power sequencing device. Signed-off-by: Bartosz Golaszewski --- drivers/pci/pcie/Kconfig | 2 + drivers/pci/pcie/Makefile | 2 + drivers/pci/pcie/pwrseq/Kconfig | 8 +++ drivers/pci/pcie/pwrseq/Makefile | 3 ++ drivers/pci/pcie/pwrseq/pwrseq.c | 83 ++++++++++++++++++++++++++++++++ include/linux/pcie-pwrseq.h | 24 +++++++++ 6 files changed, 122 insertions(+) create mode 100644 drivers/pci/pcie/pwrseq/Kconfig create mode 100644 drivers/pci/pcie/pwrseq/Makefile create mode 100644 drivers/pci/pcie/pwrseq/pwrseq.c create mode 100644 include/linux/pcie-pwrseq.h diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig index 8999fcebde6a..064843ab6866 100644 --- a/drivers/pci/pcie/Kconfig +++ b/drivers/pci/pcie/Kconfig @@ -155,3 +155,5 @@ config PCIE_EDR the PCI Firmware Specification r3.2. Enable this if you want to support hybrid DPC model which uses both firmware and OS to implement DPC. + +source "drivers/pci/pcie/pwrseq/Kconfig" diff --git a/drivers/pci/pcie/Makefile b/drivers/pci/pcie/Makefile index 8de4ed5f98f1..ace91384113d 100644 --- a/drivers/pci/pcie/Makefile +++ b/drivers/pci/pcie/Makefile @@ -13,3 +13,5 @@ obj-$(CONFIG_PCIE_PME) += pme.o obj-$(CONFIG_PCIE_DPC) += dpc.o obj-$(CONFIG_PCIE_PTM) += ptm.o obj-$(CONFIG_PCIE_EDR) += edr.o + +obj-$(CONFIG_PCIEPORTBUS) += pwrseq/ diff --git a/drivers/pci/pcie/pwrseq/Kconfig b/drivers/pci/pcie/pwrseq/Kconfig new file mode 100644 index 000000000000..010e31f432c9 --- /dev/null +++ b/drivers/pci/pcie/pwrseq/Kconfig @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 + +menuconfig PCIE_PWRSEQ + bool "PCIe Power Sequencing support" + depends on PCIEPORTBUS + help + Say yes here to enable support for PCIe power sequencing + drivers. diff --git a/drivers/pci/pcie/pwrseq/Makefile b/drivers/pci/pcie/pwrseq/Makefile new file mode 100644 index 000000000000..da99566594f6 --- /dev/null +++ b/drivers/pci/pcie/pwrseq/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_PCIE_PWRSEQ) += pwrseq.o diff --git a/drivers/pci/pcie/pwrseq/pwrseq.c b/drivers/pci/pcie/pwrseq/pwrseq.c new file mode 100644 index 000000000000..c4f7958074c9 --- /dev/null +++ b/drivers/pci/pcie/pwrseq/pwrseq.c @@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2024 Linaro Ltd. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +static int pcie_pwrseq_notify(struct notifier_block *nb, unsigned long action, + void *data) +{ + struct pcie_pwrseq *pwrseq = container_of(nb, struct pcie_pwrseq, nb); + struct device *dev = data; + + if (dev_fwnode(dev) != dev_fwnode(pwrseq->dev)) + return NOTIFY_DONE; + + switch (action) { + case BUS_NOTIFY_ADD_DEVICE: + device_set_of_node_from_dev(dev, pwrseq->dev); + break; + case BUS_NOTIFY_BOUND_DRIVER: + pwrseq->link = device_link_add(dev, pwrseq->dev, + DL_FLAG_AUTOREMOVE_CONSUMER); + if (!pwrseq->link) + dev_err(pwrseq->dev, "Failed to add device link\n"); + break; + case BUS_NOTIFY_UNBOUND_DRIVER: + device_link_del(pwrseq->link); + break; + } + + return NOTIFY_DONE; +} + +int pcie_pwrseq_device_enable(struct pcie_pwrseq *pwrseq) +{ + if (!pwrseq->dev) + return -ENODEV; + + pwrseq->nb.notifier_call = pcie_pwrseq_notify; + bus_register_notifier(&pci_bus_type, &pwrseq->nb); + + pci_lock_rescan_remove(); + pci_rescan_bus(to_pci_dev(pwrseq->dev->parent)->bus); + pci_unlock_rescan_remove(); + + return 0; +} +EXPORT_SYMBOL_GPL(pcie_pwrseq_device_enable); + +void pcie_pwrseq_device_disable(struct pcie_pwrseq *pwrseq) +{ + bus_unregister_notifier(&pci_bus_type, &pwrseq->nb); +} +EXPORT_SYMBOL_GPL(pcie_pwrseq_device_disable); + +static void devm_pcie_pwrseq_device_disable(void *data) +{ + struct pcie_pwrseq *pwrseq = data; + + pcie_pwrseq_device_disable(pwrseq); +} + +int devm_pcie_pwrseq_device_enable(struct device *dev, + struct pcie_pwrseq *pwrseq) +{ + int ret; + + ret = pcie_pwrseq_device_enable(pwrseq); + if (ret) + return ret; + + return devm_add_action_or_reset(dev, devm_pcie_pwrseq_device_disable, + pwrseq); +} +EXPORT_SYMBOL_GPL(devm_pcie_pwrseq_device_enable); diff --git a/include/linux/pcie-pwrseq.h b/include/linux/pcie-pwrseq.h new file mode 100644 index 000000000000..6abb5796754e --- /dev/null +++ b/include/linux/pcie-pwrseq.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2024 Linaro Ltd. + */ + +#ifndef __PCIE_PWRSEQ_H__ +#define __PCIE_PWRSEQ_H__ + +#include + +struct device; + +struct pcie_pwrseq { + struct notifier_block nb; + struct device *dev; + struct device_link *link; +}; + +int pcie_pwrseq_device_enable(struct pcie_pwrseq *pwrseq); +void pcie_pwrseq_device_disable(struct pcie_pwrseq *pwrseq); +int devm_pcie_pwrseq_device_enable(struct device *dev, + struct pcie_pwrseq *pwrseq); + +#endif /* __PCIE_PWRSEQ_H__ */ From patchwork Thu Jan 4 13:01:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13511088 X-Patchwork-Delegate: kvalo@adurom.com Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 26F8524A00 for ; Thu, 4 Jan 2024 13:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="DJZleFYX" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2ccbded5aa4so5631751fa.1 for ; Thu, 04 Jan 2024 05:02:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1704373332; x=1704978132; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DA5aHFJ46r457gaZ61RwpP8TkLsec2lgKs71JTHrGEQ=; b=DJZleFYXxWZY9pk+c/Ehi5OSl4NVSFuUu0j6/9cSWmaVsDXtL+d0AQVaTqQW/o4yPM WdIHaj4c4UsRzaN/lYeVhjzLv3/EOXF7yrgMQW42nEQJT6xgoO/ZhlR8tlJ3jvsK3rpu ph8iby0pvdvmWGu7eaqSJPd4trBW03ILPcVsOfSEA1ynVrf8IIbWTajurqnnVSp7AK4D pgikgrkCWXfgAqDkPT6Y+YwanUmfQ9cEVRbcSWY7DRowbuht9QlZ79B3u5N2DkCjaVsg UuDiLboYKrUsnxfLIp/YVPG0Xa798MDz3yABbVRGL9y/GccdLVm/F0NJ+h4OvGDp130p EwAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704373332; x=1704978132; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DA5aHFJ46r457gaZ61RwpP8TkLsec2lgKs71JTHrGEQ=; b=geiRHpDlj2naFEnDFMPVEj24UUvmmm6CdfXljJCaLN9d729YdEdJ/3W39qXU00jf2H Q0AbhOoC5ALjLVy7pgOf5oZR1d5L+O6y9NNb9vBXFYATdAyRZ2Ve/bfNhhFvnIxZeaOZ 0+tL1M8fm+VEP8l6ASjowIyfXQpeR2GJM2uf1nmZAVeEzdUw+CZVZdiHACZKigI00/y9 y0YkCWvL+jHxcJyEm5EW0EaPNvLwPfvfKDvQEpNp24uEwKaEzRWzepFnpunoKhMmNYW9 SN6XpmBEzLTO3mbGssiXMScU6l1dvSxhWS1/xSFayGHdUCpdugHj3+3+CMteS8MxIXGq RumQ== X-Gm-Message-State: AOJu0Yxg3sn1hIpa12TEXl7nmUpd2BEzjR8klnVqG/E+YS26uFJ3f7pg 4D1gOAo2W2c0cOizTeqUWBAebY5ufGkn6Q== X-Google-Smtp-Source: AGHT+IEDdRsPhWrWa3EOX7GzwSp1+D8RAfZyh7Y4UQZnWMuUFL0QHtHvjG9EaWqRMVvXI0CWBZWV0Q== X-Received: by 2002:a2e:7d07:0:b0:2cc:d574:6057 with SMTP id y7-20020a2e7d07000000b002ccd5746057mr314367ljc.73.1704373331828; Thu, 04 Jan 2024 05:02:11 -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.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 05:02:11 -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 6/9] dt-bindings: vendor-prefixes: add a PCI prefix for Qualcomm Atheros Date: Thu, 4 Jan 2024 14:01:20 +0100 Message-Id: <20240104130123.37115-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240104130123.37115-1-brgl@bgdev.pl> References: <20240104130123.37115-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski Document the PCI vendor prefix for Qualcomm Atheros so that we can define the QCA PCI devices on device tree. Signed-off-by: Bartosz Golaszewski --- Documentation/devicetree/bindings/vendor-prefixes.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml index 2dc098b39234..297d6037cd12 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml @@ -1128,6 +1128,7 @@ patternProperties: "^purism,.*": description: Purism, SPC "^qca,.*": + "^pci17cb,.*": description: Qualcomm Atheros, Inc. "^qcom,.*": description: Qualcomm Technologies, Inc From patchwork Thu Jan 4 13:01:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13511089 X-Patchwork-Delegate: kvalo@adurom.com Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 EAA3224B21 for ; Thu, 4 Jan 2024 13:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="i1fH9UTd" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-33674f60184so432885f8f.1 for ; Thu, 04 Jan 2024 05:02:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1704373333; x=1704978133; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tjubhM9aoU69uzCwJp4rB5H4DPxtKhGSNuyfkMH8Lnk=; b=i1fH9UTdejynp/wbaJS2KLYILgwYmbsa7NRCM3iJpWuOMnZncABvbv3F8YBK46xZZT U3X2und5/Gwz4PCDRlDiihQ02XgLZIjwU788KEs+dPPXeZdoM5MqPjP7D84AE/WKUtO0 c36CITX8IkPdkPrGMce7UzAg70milTpZEO6bLR4OMJjZojI81boIxrInBIPGMQ5jJKm1 02wHC70LNiJBZ7ULF2hz6U2Gq7ygHp1XXA8nzYeBcv6sNb9TZ83tU5zkXoKf0MWp5vCY aur/7ZeC7uQQ9I04WYr0ALo0sfnP0SQRkunCQLzJLW6/aT1G+NaxjS5Nr5g6e+YXPL9x VBdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704373333; x=1704978133; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tjubhM9aoU69uzCwJp4rB5H4DPxtKhGSNuyfkMH8Lnk=; b=Z1sNCHkRlwMSufZcpoG+RGNm0dMHqf0Wya+8LdbevvHTFVvJWi9LmfwZ/zQ8e4WEY9 48H4sNROOxgotJHpCfbccnhK8G8E7VfDjZxUtnkiS2IWntUNkCrWNkbdc7FRvtXajg64 9LcCNjqFQgxQaNGmcBrbOhvlCOsTfQgWqGC/cZos2qSoR8VK96MTncpf3c562vjad3jd lLK9N6uL7AW6qkLmNBzx5Uen9Amjcx+hhOejkaHKCGpWcsNtEI0l/1b74eQdhPoV3bbJ m06OeqWh2oOUWx0y5wwWRCsvrBCZZKwPl4seSryb1LlETlKlOguLuEsW1jDEjM5woULm RAPw== X-Gm-Message-State: AOJu0Yy91gTygVJYcZfWdlFzhnNIWTtQZBx0HhVnpdy924aDBT4m1FiD Cbbq3iOoC8hyW2XfSvNq/DkIgSj2OIh0kQ== X-Google-Smtp-Source: AGHT+IFaPrn2+5L/iSvaHGDXgCK1xkrpwFHBcvyt0keh9Su0XYw0Bar2ua6Y0uTWwzoul73MoCE/cw== X-Received: by 2002:a5d:530b:0:b0:333:2e15:632c with SMTP id e11-20020a5d530b000000b003332e15632cmr447162wrv.10.1704373333369; Thu, 04 Jan 2024 05:02:13 -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.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 05:02:13 -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 7/9] dt-bindings: wireless: ath11k: describe QCA6390 Date: Thu, 4 Jan 2024 14:01:21 +0100 Message-Id: <20240104130123.37115-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240104130123.37115-1-brgl@bgdev.pl> References: <20240104130123.37115-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski Describe the ath11k variant present on the QCA6390 module. Signed-off-by: Bartosz Golaszewski --- .../bindings/net/wireless/qcom,ath11k-pci.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k-pci.yaml b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k-pci.yaml index 817f02a8b481..f584c25f4276 100644 --- a/Documentation/devicetree/bindings/net/wireless/qcom,ath11k-pci.yaml +++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath11k-pci.yaml @@ -16,6 +16,7 @@ description: | properties: compatible: enum: + - pci17cb,1101 # QCA6390 - pci17cb,1103 # WCN6855 reg: @@ -27,6 +28,19 @@ properties: string to uniquely identify variant of the calibration data for designs with colliding bus and device ids + enable-gpios: + description: GPIO line enabling the ATH11K module when asserted. + maxItems: 1 + + vddpmu-supply: + description: VDD_PMU supply regulator handle + + vddpcie1-supply: + description: VDD_PCIE1 supply regulator handle + + vddpcie2-supply: + description: VDD_PCIE2 supply regulator handle + required: - compatible - reg From patchwork Thu Jan 4 13:01:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13511090 X-Patchwork-Delegate: kvalo@adurom.com Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 7195E24B48 for ; Thu, 4 Jan 2024 13:02:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="dH8srkkZ" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3374eb61cbcso454626f8f.0 for ; Thu, 04 Jan 2024 05:02:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1704373335; x=1704978135; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3E4Vbkb/LrKV7uJsCtqtIqNAbn7WFp6GN2T7jU5w+KA=; b=dH8srkkZC12Yni1cdQmwYzTHLQPkXZNRUh5Opjrh+o80Wt0pEMRfUghmtWh/0N/P29 qvNRDlWe13YKYOQLVhGbYd6/lmRnj60zmPhArYWzhraqy0cMT4WjRiCLrRZ3j1OSvADE c+rtAMqhImveO5kli7DtpD+09Pnv9ogfpf5ErACTwu6qyca5unzBIFRYL147jHbas3zX 6GHlQW3raMYx5J5rV+UN9Ttkc5W7c9HwuLqZwdQoAW2/NYnGmyVxbqlYng+qqABPeCHi kIM3l29YIyi4zAipG58ab1QSwCGrY0CSIwoWX1RLDq3OvEY5H9v+504B9HaOHoi94M7A oSZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704373335; x=1704978135; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3E4Vbkb/LrKV7uJsCtqtIqNAbn7WFp6GN2T7jU5w+KA=; b=Nt1KcviFYh5FsbXw1it4d6YRCQUA9qy8qR7k/1H33clCq32q+z00R6RN1m/tDR9DX3 TI6y0vO98Sd7BX7VMSiyJVm6LcHNadEwt9I8DWPdNzfY1J77nT6lwOt3pWmVoucCsLja hgPYteSJDGb0i8YntW4Vu7utar8CWGYXnnsOvyYHLruuKehC62QFrFpsY9ctFH8h4S0s dD+aCJ/8Pnh4GmDImCbpkCZQEMkyFV77ebri3twxQKYvou++OCJlK8yN4pj578Rj9ZaK 7yB8FAgNaEPoqZ8VOmtvj61zZhyKOIZB12iOy7MWupieqJ5IB7zksE5YrbNtRE+hOLQb FZzw== X-Gm-Message-State: AOJu0Yx+D8xSpnmq0tbwiJZH6EtETI9yltP9/1x00ZDRii4yAu+FSOSK B+UBrGy1Ij30kE+cEqH63SiqrpmDaMmD0w== X-Google-Smtp-Source: AGHT+IHHXVpRs7QMqS9kg1ok0JTc8TTEP2DuD/O7GN8bhaZdGEhV9MHAS2mTz+G8GWP6ubM9PTmRyw== X-Received: by 2002:a05:600c:300b:b0:40d:f9c8:887f with SMTP id j11-20020a05600c300b00b0040df9c8887fmr331173wmh.51.1704373334899; Thu, 04 Jan 2024 05:02:14 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 05:02:14 -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 8/9] PCI/pwrseq: add a pwrseq driver for QCA6390 Date: Thu, 4 Jan 2024 14:01:22 +0100 Message-Id: <20240104130123.37115-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240104130123.37115-1-brgl@bgdev.pl> References: <20240104130123.37115-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski Add a PCIe power sequencing driver that's capable of correctly powering up the ath11k module on QCA6390 using the PCIe pwrseq functionality. Signed-off-by: Bartosz Golaszewski --- drivers/pci/pcie/pwrseq/Kconfig | 11 + drivers/pci/pcie/pwrseq/Makefile | 1 + drivers/pci/pcie/pwrseq/pcie-pwrseq-qca6390.c | 197 ++++++++++++++++++ 3 files changed, 209 insertions(+) create mode 100644 drivers/pci/pcie/pwrseq/pcie-pwrseq-qca6390.c diff --git a/drivers/pci/pcie/pwrseq/Kconfig b/drivers/pci/pcie/pwrseq/Kconfig index 010e31f432c9..f9fe555b8506 100644 --- a/drivers/pci/pcie/pwrseq/Kconfig +++ b/drivers/pci/pcie/pwrseq/Kconfig @@ -6,3 +6,14 @@ menuconfig PCIE_PWRSEQ help Say yes here to enable support for PCIe power sequencing drivers. + +if PCIE_PWRSEQ + +config PCIE_PWRSEQ_QCA6390 + tristate "PCIe Power Sequencing driver for QCA6390" + depends on ARCH_QCOM || COMPILE_TEST + help + Enable support for the PCIe power sequencing driver for the + ath11k module of the QCA6390 WLAN/BT chip. + +endif diff --git a/drivers/pci/pcie/pwrseq/Makefile b/drivers/pci/pcie/pwrseq/Makefile index da99566594f6..da3e02063404 100644 --- a/drivers/pci/pcie/pwrseq/Makefile +++ b/drivers/pci/pcie/pwrseq/Makefile @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_PCIE_PWRSEQ) += pwrseq.o +obj-$(CONFIG_PCIE_PWRSEQ_QCA6390) += pcie-pwrseq-qca6390.o diff --git a/drivers/pci/pcie/pwrseq/pcie-pwrseq-qca6390.c b/drivers/pci/pcie/pwrseq/pcie-pwrseq-qca6390.c new file mode 100644 index 000000000000..e9fddbb642fe --- /dev/null +++ b/drivers/pci/pcie/pwrseq/pcie-pwrseq-qca6390.c @@ -0,0 +1,197 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Copyright (C) 2023 Linaro Ltd. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct pcie_pwrseq_qca6390_vreg { + const char *name; + unsigned int load_uA; +}; + +struct pcie_pwrseq_qca6390_pdata { + struct pcie_pwrseq_qca6390_vreg *vregs; + size_t num_vregs; + unsigned int delay_msec; +}; + +struct pcie_pwrseq_qca6390_ctx { + struct pcie_pwrseq pwrseq; + const struct pcie_pwrseq_qca6390_pdata *pdata; + struct regulator_bulk_data *regs; + struct gpio_descs *en_gpios; + unsigned long *en_gpios_values; +}; + +static struct pcie_pwrseq_qca6390_vreg pcie_pwrseq_qca6390_vregs[] = { + { + .name = "vddpmu", + .load_uA = 1250000, + }, + { + .name = "vddpcie1", + .load_uA = 35000, + }, + { + .name = "vddpcie2", + .load_uA = 15000, + }, +}; + +static struct pcie_pwrseq_qca6390_pdata pcie_pwrseq_qca6390_of_data = { + .vregs = pcie_pwrseq_qca6390_vregs, + .num_vregs = ARRAY_SIZE(pcie_pwrseq_qca6390_vregs), + .delay_msec = 16, +}; + +static int pcie_pwrseq_qca6390_power_on(struct pcie_pwrseq_qca6390_ctx *ctx) +{ + int ret; + + ret = regulator_bulk_enable(ctx->pdata->num_vregs, ctx->regs); + if (ret) + return ret; + + bitmap_fill(ctx->en_gpios_values, ctx->en_gpios->ndescs); + + ret = gpiod_set_array_value_cansleep(ctx->en_gpios->ndescs, + ctx->en_gpios->desc, + ctx->en_gpios->info, + ctx->en_gpios_values); + if (ret) { + regulator_bulk_disable(ctx->pdata->num_vregs, ctx->regs); + return ret; + } + + if (ctx->pdata->delay_msec) + msleep(ctx->pdata->delay_msec); + + return 0; +} + +static int pcie_pwrseq_qca6390_power_off(struct pcie_pwrseq_qca6390_ctx *ctx) +{ + int ret; + + bitmap_zero(ctx->en_gpios_values, ctx->en_gpios->ndescs); + + ret = gpiod_set_array_value_cansleep(ctx->en_gpios->ndescs, + ctx->en_gpios->desc, + ctx->en_gpios->info, + ctx->en_gpios_values); + if (ret) + return ret; + + return regulator_bulk_disable(ctx->pdata->num_vregs, ctx->regs); +} + +static void devm_pcie_pwrseq_qca6390_power_off(void *data) +{ + struct pcie_pwrseq_qca6390_ctx *ctx = data; + + pcie_pwrseq_qca6390_power_off(ctx); +} + +static int pcie_pwrseq_qca6309_probe(struct platform_device *pdev) +{ + struct pcie_pwrseq_qca6390_ctx *ctx; + struct device *dev = &pdev->dev; + int ret, i; + + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return -ENOMEM; + + ctx->pdata = of_device_get_match_data(dev); + if (!ctx->pdata) + return dev_err_probe(dev, -ENODEV, + "Failed to obtain platform data\n"); + + if (ctx->pdata->vregs) { + ctx->regs = devm_kcalloc(dev, ctx->pdata->num_vregs, + sizeof(*ctx->regs), GFP_KERNEL); + if (!ctx->regs) + return -ENOMEM; + + for (i = 0; i < ctx->pdata->num_vregs; i++) + ctx->regs[i].supply = ctx->pdata->vregs[i].name; + + ret = devm_regulator_bulk_get(dev, ctx->pdata->num_vregs, + ctx->regs); + if (ret < 0) + return dev_err_probe(dev, ret, + "Failed to get all regulators\n"); + + for (i = 0; i < ctx->pdata->num_vregs; i++) { + ret = regulator_set_load(ctx->regs[i].consumer, + ctx->pdata->vregs[i].load_uA); + if (ret) + return dev_err_probe(dev, ret, + "Failed to set vreg load\n"); + } + } + + ctx->en_gpios = devm_gpiod_get_array_optional(dev, "enable", + GPIOD_OUT_LOW); + if (IS_ERR(ctx->en_gpios)) + return dev_err_probe(dev, PTR_ERR(ctx->en_gpios), + "Failed to get enable GPIOs\n"); + + ctx->en_gpios_values = devm_bitmap_zalloc(dev, ctx->en_gpios->ndescs, + GFP_KERNEL); + if (!ctx->en_gpios_values) + return -ENOMEM; + + ret = pcie_pwrseq_qca6390_power_on(ctx); + if (ret) + return dev_err_probe(dev, ret, + "Failed to power on the device\n"); + + ret = devm_add_action_or_reset(dev, devm_pcie_pwrseq_qca6390_power_off, + ctx); + if (ret) + return ret; + + ctx->pwrseq.dev = dev; + + ret = devm_pcie_pwrseq_device_enable(dev, &ctx->pwrseq); + if (ret) + return dev_err_probe(dev, ret, + "Failed to register the pwrseq wrapper\n"); + + return 0; +} + +static const struct of_device_id pcie_pwrseq_qca6309_of_match[] = { + { + .compatible = "pci17cb,1101", + .data = &pcie_pwrseq_qca6390_of_data, + }, + { } +}; +MODULE_DEVICE_TABLE(of, pcie_pwrseq_qca6309_of_match); + +static struct platform_driver pcie_pwrseq_qca6309_driver = { + .driver = { + .name = "pcie-pwrseq-qca6390", + .of_match_table = pcie_pwrseq_qca6309_of_match, + }, + .probe = pcie_pwrseq_qca6309_probe, +}; +module_platform_driver(pcie_pwrseq_qca6309_driver); + +MODULE_AUTHOR("Bartosz Golaszewski "); +MODULE_DESCRIPTION("PCIe Power Sequencing module for QCA6390"); +MODULE_LICENSE("GPL"); From patchwork Thu Jan 4 13:01:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13511091 X-Patchwork-Delegate: kvalo@adurom.com Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 27E3A2555B for ; Thu, 4 Jan 2024 13:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="UhqynyYG" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-33723ad790cso384688f8f.1 for ; Thu, 04 Jan 2024 05:02:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1704373336; x=1704978136; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3qJnh8AIcAKZQaw54XikqgZNFVCwv53vFvEp1sREEes=; b=UhqynyYG1cNDNg/fEPcXwN+p9G5KyL12APCnP4H/JxuDZ5JsGtXDEhxvPzO2racoXy MEdyfvrgHzBGxJtRrPpzthabhuxASCa/PbGQ32Ww8dTQAzuLNpb2Mk9WbHartKlEwGq2 EYRKFqkDj0FH1N632N3cZRGpqPDjomrr4J8kYPD1a5pV/f13Thz8DvH7VTgSdlsm66PB fcv5QwxPc/QPehh7mkJnc9hn5R971W+eIYHeazoadTce4aRUP0lKaXfyHz5INW8//UcG k8pbJh+F46ufTQ6Ij9/Us6M2qjmB3c+KlTTeIULks2gP89LK1Jlae96Z8/iiw+qLZVNj 5dFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704373336; x=1704978136; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3qJnh8AIcAKZQaw54XikqgZNFVCwv53vFvEp1sREEes=; b=fVoJIl7NMiXt8af09lTn1Dszrcc9MdrSj344HEaEk6eLLaD9dq55U3jGdvssdYUAOr 3Ir1L2KsEidnQGonQrvdzMsdFU4VWAsYPqcNQFrdxc4Tt7uRWQYh+1rOQG5EBroGUnyZ n8fY8O6nTTwDVy/QkthyAP8+To7RZtuoiNOR4ELDZbWqdFx0FITsPLFOrFdp+bZQB1sF gv/8s3KuvDv5YvgMveIyVyLqrAw66wIR7VJ3vVmsu29VzgdY7AefO5RNGFMcU1zGAfg5 J25Fw4LVZoMFmLQxdur7Vog7yk/fTDXl05/8CiS37Diis5ezlmIg7Om3oQ1H1m42e+TD msGQ== X-Gm-Message-State: AOJu0YzDZMt8jewi1s2jBvACP6LESwthIKy/HpNHAJi0ZaIiFMYH+wOU 6FDs6J0bM/Aw7qXZksQ0uPioeNn6hCC8Zw== X-Google-Smtp-Source: AGHT+IEqja+u1Zepunc8yCe1PWCPYTJaRhSPQH3gTIMidcrQA/WboeRZVVunuvMn3vOkG/I8lK1Owg== X-Received: by 2002:adf:f6d1:0:b0:336:74aa:d78b with SMTP id y17-20020adff6d1000000b0033674aad78bmr238945wrp.145.1704373336434; Thu, 04 Jan 2024 05:02:16 -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.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 05:02:16 -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 9/9] arm64: defconfig: enable the PCIe power sequencing for QCA6390 Date: Thu, 4 Jan 2024 14:01:23 +0100 Message-Id: <20240104130123.37115-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240104130123.37115-1-brgl@bgdev.pl> References: <20240104130123.37115-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Bartosz Golaszewski Build the QCA6390 PCIe power sequencing module by default. Signed-off-by: Bartosz Golaszewski --- arch/arm64/configs/defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index 361c31b5d064..7daa863f25e5 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig @@ -210,6 +210,8 @@ CONFIG_NFC_S3FWRN5_I2C=m CONFIG_PCI=y CONFIG_PCIEPORTBUS=y CONFIG_PCIEAER=y +CONFIG_PCIE_PWRSEQ=y +CONFIG_PCIE_PWRSEQ_QCA6390=m CONFIG_PCI_IOV=y CONFIG_PCI_PASID=y CONFIG_HOTPLUG_PCI=y