From patchwork Wed May 1 04:07:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 13650175 Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) (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 2DC8F29405; Wed, 1 May 2024 04:08:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536486; cv=none; b=Fc69fDF2ber33a2aoSDDQv6oIouvyeFsEFcxapE3A0+PPF4d/5lNTGmvqqE2+YPbNASSw5S6OBbjd8yzMyyVhSz257ZtbNUHvExYEzJldyMaEk95FIBi9OUCzY7pjB6lxdE6hEGUlBKmoAYwN4i/4VE2pC7Jfe6CvEwOwI9MPAU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536486; c=relaxed/simple; bh=/LW5UP24d3M9gnDJHKsZY3AjzrEnrgPIA21IZxGWV+o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=hg85xoN8iUbfK/ZAvhqDzawEq3FNpfo3tP1Vf8ZTovQHsEjH1RfL86G9tpxOLfZEq5VhnNIV4vAuqoVkxBuu1TiIT21jKyq/I1uLaP+DfaZGJkGe3khTu0jomldc6YnP1A+W6/k3+ZvqERMPsOruGtFU+n4TquvDXLGzhiW1WMQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ocd66zqi; arc=none smtp.client-ip=209.85.167.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ocd66zqi" Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-3c7513a991cso4345129b6e.1; Tue, 30 Apr 2024 21:08:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714536484; x=1715141284; 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=eQII4bd5vU3iEBUOJRNxIf3Y2tkmIxs3qzEGZCMfEv8=; b=Ocd66zqifgVp9HxefgdAMCefTDJd9e2cCw8L27JdontZ8JktuR5FfT0u3wsuw+PP8J N9bnhh4HMxEf+Epep8aQ4tQhKsE2yHvVtuU3jY3OOFhn5YHTHDhpa2GXxeywVgiTdtZA xRFF/JXxZZ40/wpRobARQssej4QT6UIT2OdGFROfdnAE0PBhJu67LRt2pRKMAbVcpt42 u3o+LyCkogNknSjjMXpvFiCezF+hi0iiUeBrD9NJwNKU+mNHEqUKV8q09fjPHg1nR4FJ 3JY5+KySHMchLtQPtZmFQzAA+rT2C2mOz5CGn1hlF1v+MAFyp6or6zxp01VxNl21bbUo rubw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714536484; x=1715141284; 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=eQII4bd5vU3iEBUOJRNxIf3Y2tkmIxs3qzEGZCMfEv8=; b=gCsVJ3Pfq2sWfG9qcPejQFpBsM46lQvsKmutOt3/pWKwGDn+WR9NiYvUo/j41k76Fm ugue+GcuP5t4OFXWgBaAWKEywrPEA+rfzpi32KcXjqsnXyiNGaqbEnPcPOo+SRoV0RJR MVSKMAxi5YMABFUStSTx5bvNb9Qzir82NUI3dzN59cz7pMcZrAM0rMw1kl31JOCXIlag bwMuaWdfJFKTDnc58wpdlicDZUGJ7yIxseDAjfFsH39sLmDHcBqrmFMF3rN9kwZc8BI9 HkE97ef5dTRpkjT2hHiV2uclLVH80P7rYpCDh07Ii/PKWMUqMTgXTs0RSqR/SBXYIUXK kMMQ== X-Forwarded-Encrypted: i=1; AJvYcCUqSxe2e3eYKO58oz79LyPdIlr8oRQqr9X7A0cZ4C73J7Tdn+PX7AB9IFrCirywPMe162S3fbXfAc7ecaz8veFDEauYapA1KazKuQnCGKWIE3iw/uLPsPij8MNieV5iF/QYVJGmwjdJyxcv2NQlaUHOud4MNiItC+RrRuQjhwd9syMMViE= X-Gm-Message-State: AOJu0Yyeuvj8UuKce++CjVFebV9OoOithA/+5EORgAyM2xldtImmZ7Dj teGRS7Ulz3H3A4LCHpVhmjIipJf1BwJi3W/iprNpM8YHbiFKCx3mJffonEi+7kk= X-Google-Smtp-Source: AGHT+IHhxTl5k/+evzZ/7myhhtGs4Q+NGdUipnNMPy+mJqCCxGveYPCkAbK/AwpAGhGYlE5UDRtZ1Q== X-Received: by 2002:a05:6808:15a2:b0:3c7:3af6:1cb5 with SMTP id t34-20020a05680815a200b003c73af61cb5mr1916976oiw.46.1714536483873; Tue, 30 Apr 2024 21:08:03 -0700 (PDT) Received: from nukework.lan (c-98-197-58-203.hsd1.tx.comcast.net. [98.197.58.203]) by smtp.gmail.com with ESMTPSA id w2-20020a056808018200b003c8643f0e5csm1067872oic.16.2024.04.30.21.08.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 21:08:03 -0700 (PDT) From: Alexandru Gagniuc To: Bjorn Andersson , Konrad Dybcio , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-kernel@vger.kernel.org, quic_kathirav@quicinc.com, Alexandru Gagniuc , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v4 1/8] dt-bindings: clock: Add PCIe pipe related clocks for IPQ9574 Date: Tue, 30 Apr 2024 23:07:43 -0500 Message-Id: <20240501040800.1542805-2-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240501040800.1542805-1-mr.nuke.me@gmail.com> References: <20240501040800.1542805-1-mr.nuke.me@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add defines for the missing PCIe PIPE clocks. Signed-off-by: Alexandru Gagniuc Acked-by: Krzysztof Kozlowski --- include/dt-bindings/clock/qcom,ipq9574-gcc.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/dt-bindings/clock/qcom,ipq9574-gcc.h b/include/dt-bindings/clock/qcom,ipq9574-gcc.h index 08fd3a37acaa..52123c5a09fa 100644 --- a/include/dt-bindings/clock/qcom,ipq9574-gcc.h +++ b/include/dt-bindings/clock/qcom,ipq9574-gcc.h @@ -216,4 +216,8 @@ #define GCC_CRYPTO_AHB_CLK 207 #define GCC_USB0_PIPE_CLK 208 #define GCC_USB0_SLEEP_CLK 209 +#define GCC_PCIE0_PIPE_CLK 210 +#define GCC_PCIE1_PIPE_CLK 211 +#define GCC_PCIE2_PIPE_CLK 212 +#define GCC_PCIE3_PIPE_CLK 213 #endif From patchwork Wed May 1 04:07:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 13650176 Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) (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 8872437165; Wed, 1 May 2024 04:08:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536488; cv=none; b=lfGbnNWaFsvamkIThWAZ6j2jhbFnOgFEcQvbdKvwixfbPsMpBoL6M5ki52pWOIlZBkhBkh/TqPuReq9C/zy6F7sZdL1h45nI3/ozKTV+75lP2dCk/azPP3xK8ctAm5N9YnL/vP7FAVThMLv+iq35MRvt7UkMla0Ervksaml6KP4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536488; c=relaxed/simple; bh=hXqcsPpRih55X6qbkKifrC4azWi5ZS32nt4esjIky/M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=d5lsjFAxNpT8P2Oz3fOKOs2dAC2JA1P+9PzxrDjmmH/PPtjIA01aaF78wNq0BRihqjZ0BQAJ+wWQmrbeVsmuZfqsKZSek8s3nSWIge4vyAPvAuMsxSopclVjJ9vPIKcEo13V4gWk+hw1e/LE8iMxrsHmqkxKtsyxyvTEWBlPkpg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ED+p0tN4; arc=none smtp.client-ip=209.85.167.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ED+p0tN4" Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-3c5ed7fdbb1so266621b6e.0; Tue, 30 Apr 2024 21:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714536485; x=1715141285; 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=xzHEIPYot6c8NAo7TIBriZfyyuOfBQrBEKWQMBGEIB8=; b=ED+p0tN4Wl0p+XnMSVhQcwCMgZ3f4qVBQe9g233mmvGm5sp71Oibh1ErwL5Ybz4oDu X23e9waaAPbkC6RZn/5RhH/nMGh9aBVVP+/hdobRemraa/wCLfRk8OYvD4LQn9ljw/b/ hl9Aqf5cs12faI91nGoHKP1xGbNoKtSc0ZKWeZLffAOZw9MG2uO1KF/O1QovNeAxxstL C0E09hsU/+8Cko9EwMWraYP1ROkOereCKVXAmoXWdJtpN0obcGfQHOGPRZYQJEIHbRTN jcusNa6n0JaO6IwIXWhOD+gI5O7cc8wKr5DKuBcYsGNzFbVj/iUYD0VxErkb41Wu6HXC yCEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714536485; x=1715141285; 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=xzHEIPYot6c8NAo7TIBriZfyyuOfBQrBEKWQMBGEIB8=; b=SKEl0tb7TqbRnukBtOkafKf0VB5cTZ0P8f/w9fq8dJaq0AOxfeiH5jOSwfKdK/5Wum Nf1QiM0eqRrPVQsehaA79mrj1En32WdcEZtnVCv9QAmR+6vGXAukCnsLjEmhX+Na+kXK 1pJoYcUgMBAXfkk9gGXszlx816FY7iSbi//FoMTBFJTrYBXV44Rr3a6b9v3wZgddiGKt g8egFJYVsS+J5Du8VmJPIX8t1aBoQBv0Fr1TDM+mpHocXSMitLYcF0i/hZSUh5wijZ1l mXaaGFQis7Dx3T0V3b0+PtxRJH/bEFPwgkDEsEpp6fyZlrVQ160zDW9mWsyD2+7kHTWP Mb0Q== X-Forwarded-Encrypted: i=1; AJvYcCVFOt/H4sbp+xLZSYjZHw6lzbgOID8DneLhhJssXzN2cYxZYXHOsx0rDYAZl+jdaS3Xzvpn4YiYXinrc/zIf3yCGN1SxPpFEbDlNw37c33Ls/N1j+yE/mLPGw+duFddjE3PveMVgF2IJQ== X-Gm-Message-State: AOJu0Yy8upDEM7Oi30BPX5QtdgcNPvA3WyiGX3bec7+oYrVfyouCrnw3 Cwq6xr4t+WEXKUCohmAVm4e3WUVOe1zC9B+QEKJFerVQaBmzbfWl X-Google-Smtp-Source: AGHT+IHJQwbzX9N72JdRoLScn+lsQNa+nuWXZcpHm2Ahi34mCftug1KHXAKzZdB8EagfC76klg3PQg== X-Received: by 2002:a05:6808:3088:b0:3c8:4cf8:a969 with SMTP id bl8-20020a056808308800b003c84cf8a969mr2143976oib.23.1714536485695; Tue, 30 Apr 2024 21:08:05 -0700 (PDT) Received: from nukework.lan (c-98-197-58-203.hsd1.tx.comcast.net. [98.197.58.203]) by smtp.gmail.com with ESMTPSA id w2-20020a056808018200b003c8643f0e5csm1067872oic.16.2024.04.30.21.08.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 21:08:04 -0700 (PDT) From: Alexandru Gagniuc To: Bjorn Andersson , Konrad Dybcio , Michael Turquette , Stephen Boyd Cc: linux-kernel@vger.kernel.org, quic_kathirav@quicinc.com, Alexandru Gagniuc , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH v4 2/8] clk: qcom: gcc-ipq9574: Add PCIe pipe clocks Date: Tue, 30 Apr 2024 23:07:44 -0500 Message-Id: <20240501040800.1542805-3-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240501040800.1542805-1-mr.nuke.me@gmail.com> References: <20240501040800.1542805-1-mr.nuke.me@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The IPQ9574 has four PCIe "pipe" clocks. These clocks are required by PCIe PHYs. Port the pipe clocks from the downstream 5.4 kernel. Signed-off-by: Alexandru Gagniuc Reviewed-by: Dmitry Baryshkov --- drivers/clk/qcom/gcc-ipq9574.c | 76 ++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/drivers/clk/qcom/gcc-ipq9574.c b/drivers/clk/qcom/gcc-ipq9574.c index 0a3f846695b8..bc3e17f34295 100644 --- a/drivers/clk/qcom/gcc-ipq9574.c +++ b/drivers/clk/qcom/gcc-ipq9574.c @@ -1569,6 +1569,24 @@ static struct clk_regmap_phy_mux pcie0_pipe_clk_src = { }, }; +static struct clk_branch gcc_pcie0_pipe_clk = { + .halt_reg = 0x28044, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x28044, + .enable_mask = BIT(0), + .hw.init = &(const struct clk_init_data) { + .name = "gcc_pcie0_pipe_clk", + .parent_hws = (const struct clk_hw *[]) { + &pcie0_pipe_clk_src.clkr.hw + }, + .num_parents = 1, + .flags = CLK_SET_RATE_PARENT, + .ops = &clk_branch2_ops, + }, + }, +}; + static struct clk_regmap_phy_mux pcie1_pipe_clk_src = { .reg = 0x29064, .clkr = { @@ -1583,6 +1601,24 @@ static struct clk_regmap_phy_mux pcie1_pipe_clk_src = { }, }; +static struct clk_branch gcc_pcie1_pipe_clk = { + .halt_reg = 0x29044, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x29044, + .enable_mask = BIT(0), + .hw.init = &(const struct clk_init_data) { + .name = "gcc_pcie1_pipe_clk", + .parent_hws = (const struct clk_hw *[]) { + &pcie1_pipe_clk_src.clkr.hw + }, + .num_parents = 1, + .flags = CLK_SET_RATE_PARENT, + .ops = &clk_branch2_ops, + }, + }, +}; + static struct clk_regmap_phy_mux pcie2_pipe_clk_src = { .reg = 0x2a064, .clkr = { @@ -1597,6 +1633,24 @@ static struct clk_regmap_phy_mux pcie2_pipe_clk_src = { }, }; +static struct clk_branch gcc_pcie2_pipe_clk = { + .halt_reg = 0x2a044, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x2a044, + .enable_mask = BIT(0), + .hw.init = &(const struct clk_init_data) { + .name = "gcc_pcie2_pipe_clk", + .parent_hws = (const struct clk_hw *[]) { + &pcie2_pipe_clk_src.clkr.hw + }, + .num_parents = 1, + .flags = CLK_SET_RATE_PARENT, + .ops = &clk_branch2_ops, + }, + }, +}; + static struct clk_regmap_phy_mux pcie3_pipe_clk_src = { .reg = 0x2b064, .clkr = { @@ -1611,6 +1665,24 @@ static struct clk_regmap_phy_mux pcie3_pipe_clk_src = { }, }; +static struct clk_branch gcc_pcie3_pipe_clk = { + .halt_reg = 0x2b044, + .halt_check = BRANCH_HALT_DELAY, + .clkr = { + .enable_reg = 0x2b044, + .enable_mask = BIT(0), + .hw.init = &(const struct clk_init_data) { + .name = "gcc_pcie3_pipe_clk", + .parent_hws = (const struct clk_hw *[]) { + &pcie3_pipe_clk_src.clkr.hw + }, + .num_parents = 1, + .flags = CLK_SET_RATE_PARENT, + .ops = &clk_branch2_ops, + }, + }, +}; + static const struct freq_tbl ftbl_pcie_rchng_clk_src[] = { F(24000000, P_XO, 1, 0, 0), F(100000000, P_GPLL0, 8, 0, 0), @@ -4141,6 +4213,10 @@ static struct clk_regmap *gcc_ipq9574_clks[] = { [GCC_SNOC_PCIE1_1LANE_S_CLK] = &gcc_snoc_pcie1_1lane_s_clk.clkr, [GCC_SNOC_PCIE2_2LANE_S_CLK] = &gcc_snoc_pcie2_2lane_s_clk.clkr, [GCC_SNOC_PCIE3_2LANE_S_CLK] = &gcc_snoc_pcie3_2lane_s_clk.clkr, + [GCC_PCIE0_PIPE_CLK] = &gcc_pcie0_pipe_clk.clkr, + [GCC_PCIE1_PIPE_CLK] = &gcc_pcie1_pipe_clk.clkr, + [GCC_PCIE2_PIPE_CLK] = &gcc_pcie2_pipe_clk.clkr, + [GCC_PCIE3_PIPE_CLK] = &gcc_pcie3_pipe_clk.clkr, }; static const struct qcom_reset_map gcc_ipq9574_resets[] = { From patchwork Wed May 1 04:07:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 13650177 Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) (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 61557433CB; Wed, 1 May 2024 04:08:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536489; cv=none; b=nK+F4B8US0CXVf9usmiDLieVCRXbSIXVaug0+DP4kdmBjRObG/0ksB37ip0Q3ZXnRloUCSyK27J6Hv+VhJHcfdU5L/4l6k3f6lGkGV85XJO0XSpckioH5ybGwcGJ/oqLmftIfhiMcskTsL679vQZMMeTuMdHhoZsTcPgPXegf3M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536489; c=relaxed/simple; bh=hTXTBAcEL8gMHMEYQjxjqOhus0GQvyCJWh1hLepjz8Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F342le+1lJD/jXA0U7JHK7tICzWbVUrhm7X7MLYWiIKK860s7c5xGH01nA/8Wu2bV7nUGOLxcO7O9oC+VGenzl4KCwc/d0NMnP3pJCWal8tvKECu8TD1JilkPL+uGLEM84E5on+S4Mou3PWDiFD1OF3TT9YcLYvv9UWEptbmHTM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZmfRuR4T; arc=none smtp.client-ip=209.85.167.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZmfRuR4T" Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-3c8644aa3feso1980658b6e.1; Tue, 30 Apr 2024 21:08:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714536487; x=1715141287; 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=53QnHnVF7bqkRAf/NYE3eZQ50tFTHOIRODlZaYfoSVE=; b=ZmfRuR4TxvkC5Vw0zjiIH8r9kBSFptuxZtGqLDKqce8S+UBRTaKuPi4xpXIt4ssChj tly43tHHFaul6HZW4AWrl0Q9PwBJCiR5uGJBclE4vpMIMO9wYKcaGTcrJSenNep4T/gs gKfeJgnQXHBKru0q4kiMUm6fzu4X4niBETYbh9GfvBBNyUnC1SvDvc/9vvOvioAJ7NpM u6D/C7qoqhMjUP8ys4I5xQ61JBOCB0+NbfRoMpoIMevBmTD6X+X/iGuSN0P+hK1eoKo3 80vumvo4/JLVPQZEdv6/gFO3X99GZJkYHwV9QkEXQO+mgAvZpnqvyRD0AUXb0Iol3GdM EsKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714536487; x=1715141287; 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=53QnHnVF7bqkRAf/NYE3eZQ50tFTHOIRODlZaYfoSVE=; b=lPQ1T4DwHvb8L6SkAW++CnZNC8DD7p95dYiA1ElgkHPbCygNClgXhCXwJvwwyZ9ywN d6dy12ZRzLhAFDtqf4WIxeSIhS4/DM/Sp8fb8UBvNt4LFSq6msr7c7fPnmmFDTMDlgB/ L5U5cDyZ4nh3cWKpqpXal48A438p22QMwgmdADUcJvt7UktpxC/+moUfCc5wEQx8tCmJ JvRk5J/asVL4+hawF+ZRM1dEYcj505LVapIqH1lvmhA4BGOlkYkwclZayrzc5QuXqCeM VU6h5G2wXGTtitfnmZx5OlSz3+Onpn5HuZrwKP06ACMlzqPknZX8FqChqF9auLuNyicO C0Cw== X-Forwarded-Encrypted: i=1; AJvYcCW0Thr0sbAsybsR0e3WLzM8qBMhMhb4VouLHpLCN5eL3OErpFrBgvS374yJf+HE22iSKoGgSKIpb9UfDEaL9ByseK2l2TvI/6DkxYByGyceK4Dbmjg/NgfWPTicLS3glFpUgL1iQB2Lspz5rQpwQKX6hv5HvCDesQk9Z3Y9dQTCxzIlx1Q= X-Gm-Message-State: AOJu0YxwCoMpoZWq0UHiVw6CLXPuEgm161zTD1ECusFhsf0ycTBlw9p1 /woCMNmgDecOxGrAwj8axq80lcwNanc8rdAmyUAwZeA5xtFQMgkr X-Google-Smtp-Source: AGHT+IHLjsBG7zzyJ43r+52W9nzgFGgnrrXmfIif9WOG2DGC2hwDYnPkLo+V/3KvGIUkIklJJw+RdQ== X-Received: by 2002:a05:6808:d9:b0:3c5:fa5c:7762 with SMTP id t25-20020a05680800d900b003c5fa5c7762mr1514306oic.44.1714536487474; Tue, 30 Apr 2024 21:08:07 -0700 (PDT) Received: from nukework.lan (c-98-197-58-203.hsd1.tx.comcast.net. [98.197.58.203]) by smtp.gmail.com with ESMTPSA id w2-20020a056808018200b003c8643f0e5csm1067872oic.16.2024.04.30.21.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 21:08:07 -0700 (PDT) From: Alexandru Gagniuc To: Bjorn Andersson , Konrad Dybcio , Bjorn Helgaas , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Manivannan Sadhasivam Cc: linux-kernel@vger.kernel.org, quic_kathirav@quicinc.com, Alexandru Gagniuc , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v4 3/8] dt-bindings: PCI: qcom: Add IPQ9574 PCIe controller Date: Tue, 30 Apr 2024 23:07:45 -0500 Message-Id: <20240501040800.1542805-4-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240501040800.1542805-1-mr.nuke.me@gmail.com> References: <20240501040800.1542805-1-mr.nuke.me@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 IPQ9574 has PCIe controllers which are almost identical to IPQ6018. The difference is that the "iface" clock is replaced by the "snoc", and "anoc". The "sleep" reset is replaced by an "aux" reset. Document these differences along with the compatible string. Signed-off-by: Alexandru Gagniuc Acked-by: Rob Herring (Arm) --- .../devicetree/bindings/pci/qcom,pcie.yaml | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/Documentation/devicetree/bindings/pci/qcom,pcie.yaml b/Documentation/devicetree/bindings/pci/qcom,pcie.yaml index cf9a6910b542..ac6d2b1b8702 100644 --- a/Documentation/devicetree/bindings/pci/qcom,pcie.yaml +++ b/Documentation/devicetree/bindings/pci/qcom,pcie.yaml @@ -26,6 +26,7 @@ properties: - qcom,pcie-ipq8064-v2 - qcom,pcie-ipq8074 - qcom,pcie-ipq8074-gen3 + - qcom,pcie-ipq9574 - qcom,pcie-msm8996 - qcom,pcie-qcs404 - qcom,pcie-sdm845 @@ -161,6 +162,7 @@ allOf: enum: - qcom,pcie-ipq6018 - qcom,pcie-ipq8074-gen3 + - qcom,pcie-ipq9574 then: properties: reg: @@ -397,6 +399,39 @@ allOf: - const: axi_m_sticky # AXI Master Sticky reset - const: axi_s_sticky # AXI Slave Sticky reset + - if: + properties: + compatible: + contains: + enum: + - qcom,pcie-ipq9574 + then: + properties: + clocks: + minItems: 4 + maxItems: 4 + clock-names: + items: + - const: axi_m # AXI Master clock + - const: axi_s # AXI Slave clock + - const: axi_bridge # AXI bridge clock + - const: anoc + - const: snoc + - const: rchng + resets: + minItems: 8 + maxItems: 8 + reset-names: + items: + - const: pipe # PIPE reset + - const: aux # AUX reset + - const: sticky # Core Sticky reset + - const: axi_m # AXI Master reset + - const: axi_s # AXI Slave reset + - const: axi_s_sticky # AXI Slave Sticky reset + - const: axi_m_sticky # AXI Master Sticky reset + - const: ahb # AHB Reset + - if: properties: compatible: @@ -507,6 +542,7 @@ allOf: - qcom,pcie-ipq8064v2 - qcom,pcie-ipq8074 - qcom,pcie-ipq8074-gen3 + - qcom,pcie-ipq9574 - qcom,pcie-qcs404 then: required: @@ -566,6 +602,7 @@ allOf: - qcom,pcie-ipq8064-v2 - qcom,pcie-ipq8074 - qcom,pcie-ipq8074-gen3 + - qcom,pcie-ipq9574 - qcom,pcie-qcs404 then: properties: From patchwork Wed May 1 04:07:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 13650178 Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) (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 48F644596F; Wed, 1 May 2024 04:08:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536492; cv=none; b=JnmF2kbNlYYdRUFFt8AZU6uLgpcJBGYA6ULgYc2cPndpNGKXbxu9QFFo7xeJ8VQXzZMIKoHk5WFhufn0OfrL+68DtFLba31gXwptg7X0uht+OsEwNOA1vv+qC+B8O8jdjjY7XXAmWJ6lKegsl8PNhwt36LgSapsult9pZkneBSc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536492; c=relaxed/simple; bh=q/n7/c+QbGO75Lsgh28Q9qhp+mrAJbfJBpNBP1WUkQ8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=vFECc3MQ3LmJYIghCz/57eP7MDz4yS5NbbJlUxS8zOK6LjJCiZLLEk24VxJwnAUgsLOqmrHxjzc3VzGeVHfCHSKONGJ9gZExMK3D6+D+9zLA/IwIaXMSFamaLPoowviqPYZRLTqdXDIWpXf27ti8trsZ3YHhXVCPKJ87kNVlVbw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GLTIPTY0; arc=none smtp.client-ip=209.85.167.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GLTIPTY0" Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-3c74b643aebso3805049b6e.0; Tue, 30 Apr 2024 21:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714536489; x=1715141289; 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=rKfzhKYKdzfcfGJdATuhwe4qCNYS9PL4DLkhaYC5y3s=; b=GLTIPTY0Hq1pWXnypyihlap6eKW7ljBXZcbnJajrEE0UMNxDFIf3K6sumgzcJGMRY2 PGcM0B93V/7SM6CAyyZAAyIb3knLUOMEq7E8EugSRvTUn2w83jR6a8KVjPqmAI8sn+3g /x2nAerIt0BNnp2eC5QrN3ja4Z9El/ldBrI7+WxsiFHbJ3LndYR8sS3FS1Jt3+sOQ69/ DWVGomdipebJkhoJHKHblnC8UiJ2Wh+Pq6veQQyjTK3Q1IDuiRjKtZv/Vwgy73x4yAL4 pFll/cpPzykymPjYweNo+hvRiGgBTTjnYels3/PcwHHcKrh0eQylEUurbvz2TXjqJNqD BtHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714536489; x=1715141289; 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=rKfzhKYKdzfcfGJdATuhwe4qCNYS9PL4DLkhaYC5y3s=; b=n+65mTkijXY7VRp05hwE7i/oKLchxr6XceNgK65fl580nBYIioCHUKBL49yxB6PFU/ p7dfjGiQlMx0zb0at5cXk0Aye2lI3lOLh8v4TVRcMERrQbTGsNRbKXEP90YF6KS8UJ7E XGvX9ocvbTNlzYq0b1pzUiU0s2+tLx9suSNCiSJKWEoRNoxSO1hrz/nKXDSxypVRj5IP iULdqiBGp8B19fMHLayLYmvCCPd9G9FGMZdJN+d9AO8X/Y2DyNe8MD4fdr+XM3Cuwu6Q z4Dv5+d4MOq5y5rYXA8Eq2DTi76PsJuGhYTWfBdRJD7k2gJYBXSSymm8PNA3folDNyRS fz+A== X-Forwarded-Encrypted: i=1; AJvYcCX+JMqfeaYbLTWv1uJoic4oMJDLMALbsimts42ujGfJ3c8MHxqxYfL+SODO0+HNht0tRitG5Lx66890YgMut/QFpOe3ZZ9X2zXVg1E+Av3XK3hr0yWJ3TQyHtS0A2vrVPsQoXhFA2LzXQ== X-Gm-Message-State: AOJu0YxmO7gKKY2RWYS023pCfeJZDRgaweHebtE+IXxQN6WmCLJZIGNH 8T74Aw6O5xpSqr9t5atvoKFPXPNwp5atfvsXb30ZTMJPn0x7gk3u X-Google-Smtp-Source: AGHT+IHhb4n32OpjOv3XR6FHqiHxm6BXcmLCYIZ5hupKrkDUI/unZnOrBPNzjlAFDWnwTmmk31JHng== X-Received: by 2002:a05:6808:6089:b0:3c5:dd52:fd6f with SMTP id de9-20020a056808608900b003c5dd52fd6fmr1651690oib.31.1714536489204; Tue, 30 Apr 2024 21:08:09 -0700 (PDT) Received: from nukework.lan (c-98-197-58-203.hsd1.tx.comcast.net. [98.197.58.203]) by smtp.gmail.com with ESMTPSA id w2-20020a056808018200b003c8643f0e5csm1067872oic.16.2024.04.30.21.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 21:08:08 -0700 (PDT) From: Alexandru Gagniuc To: Manivannan Sadhasivam , Bjorn Andersson , Konrad Dybcio , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Bjorn Helgaas Cc: linux-kernel@vger.kernel.org, quic_kathirav@quicinc.com, Alexandru Gagniuc , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v4 4/8] PCI: qcom: Switch to devm_clk_bulk_get_all() API to get the clocks from Devicetree Date: Tue, 30 Apr 2024 23:07:46 -0500 Message-Id: <20240501040800.1542805-5-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240501040800.1542805-1-mr.nuke.me@gmail.com> References: <20240501040800.1542805-1-mr.nuke.me@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Manivannan Sadhasivam There is no need for the device drivers to validate the clocks defined in Devicetree. The validation should be performed by the DT schema and the drivers should just get all the clocks from DT. Right now the driver hardcodes the clock info and validates them against DT which is redundant. So use devm_clk_bulk_get_all() that just gets all the clocks defined in DT and get rid of all static clocks info from the driver. This simplifies the driver. Signed-off-by: Manivannan Sadhasivam Signed-off-by: Alexandru Gagniuc [moved clks to struct qcom_pcie to reduce code duplication] --- drivers/pci/controller/dwc/pcie-qcom.c | 163 ++++--------------------- 1 file changed, 25 insertions(+), 138 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index 14772edcf0d3..ea81ff68d433 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -154,58 +154,42 @@ #define QCOM_PCIE_LINK_SPEED_TO_BW(speed) \ Mbps_to_icc(PCIE_SPEED2MBS_ENC(pcie_link_speed[speed])) -#define QCOM_PCIE_1_0_0_MAX_CLOCKS 4 struct qcom_pcie_resources_1_0_0 { - struct clk_bulk_data clks[QCOM_PCIE_1_0_0_MAX_CLOCKS]; struct reset_control *core; struct regulator *vdda; }; -#define QCOM_PCIE_2_1_0_MAX_CLOCKS 5 #define QCOM_PCIE_2_1_0_MAX_RESETS 6 #define QCOM_PCIE_2_1_0_MAX_SUPPLY 3 struct qcom_pcie_resources_2_1_0 { - struct clk_bulk_data clks[QCOM_PCIE_2_1_0_MAX_CLOCKS]; struct reset_control_bulk_data resets[QCOM_PCIE_2_1_0_MAX_RESETS]; int num_resets; struct regulator_bulk_data supplies[QCOM_PCIE_2_1_0_MAX_SUPPLY]; }; -#define QCOM_PCIE_2_3_2_MAX_CLOCKS 4 #define QCOM_PCIE_2_3_2_MAX_SUPPLY 2 struct qcom_pcie_resources_2_3_2 { - struct clk_bulk_data clks[QCOM_PCIE_2_3_2_MAX_CLOCKS]; struct regulator_bulk_data supplies[QCOM_PCIE_2_3_2_MAX_SUPPLY]; }; -#define QCOM_PCIE_2_3_3_MAX_CLOCKS 5 #define QCOM_PCIE_2_3_3_MAX_RESETS 7 struct qcom_pcie_resources_2_3_3 { - struct clk_bulk_data clks[QCOM_PCIE_2_3_3_MAX_CLOCKS]; struct reset_control_bulk_data rst[QCOM_PCIE_2_3_3_MAX_RESETS]; }; -#define QCOM_PCIE_2_4_0_MAX_CLOCKS 4 #define QCOM_PCIE_2_4_0_MAX_RESETS 12 struct qcom_pcie_resources_2_4_0 { - struct clk_bulk_data clks[QCOM_PCIE_2_4_0_MAX_CLOCKS]; - int num_clks; struct reset_control_bulk_data resets[QCOM_PCIE_2_4_0_MAX_RESETS]; int num_resets; }; -#define QCOM_PCIE_2_7_0_MAX_CLOCKS 15 #define QCOM_PCIE_2_7_0_MAX_SUPPLIES 2 struct qcom_pcie_resources_2_7_0 { - struct clk_bulk_data clks[QCOM_PCIE_2_7_0_MAX_CLOCKS]; - int num_clks; struct regulator_bulk_data supplies[QCOM_PCIE_2_7_0_MAX_SUPPLIES]; struct reset_control *rst; }; -#define QCOM_PCIE_2_9_0_MAX_CLOCKS 5 struct qcom_pcie_resources_2_9_0 { - struct clk_bulk_data clks[QCOM_PCIE_2_9_0_MAX_CLOCKS]; struct reset_control *rst; }; @@ -247,6 +231,8 @@ struct qcom_pcie { struct icc_path *icc_mem; const struct qcom_pcie_cfg *cfg; struct dentry *debugfs; + struct clk_bulk_data *clks; + int num_clks; bool suspended; }; @@ -337,22 +323,6 @@ static int qcom_pcie_get_resources_2_1_0(struct qcom_pcie *pcie) if (ret) return ret; - res->clks[0].id = "iface"; - res->clks[1].id = "core"; - res->clks[2].id = "phy"; - res->clks[3].id = "aux"; - res->clks[4].id = "ref"; - - /* iface, core, phy are required */ - ret = devm_clk_bulk_get(dev, 3, res->clks); - if (ret < 0) - return ret; - - /* aux, ref are optional */ - ret = devm_clk_bulk_get_optional(dev, 2, res->clks + 3); - if (ret < 0) - return ret; - res->resets[0].id = "pci"; res->resets[1].id = "axi"; res->resets[2].id = "ahb"; @@ -373,7 +343,7 @@ static void qcom_pcie_deinit_2_1_0(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; - clk_bulk_disable_unprepare(ARRAY_SIZE(res->clks), res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); reset_control_bulk_assert(res->num_resets, res->resets); writel(1, pcie->parf + PARF_PHY_CTRL); @@ -413,7 +383,6 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) static int qcom_pcie_post_init_2_1_0(struct qcom_pcie *pcie) { - struct qcom_pcie_resources_2_1_0 *res = &pcie->res.v2_1_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; struct device_node *node = dev->of_node; @@ -425,7 +394,7 @@ static int qcom_pcie_post_init_2_1_0(struct qcom_pcie *pcie) val &= ~PHY_TEST_PWR_DOWN; writel(val, pcie->parf + PARF_PHY_CTRL); - ret = clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks); + ret = clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); if (ret) return ret; @@ -476,21 +445,11 @@ static int qcom_pcie_get_resources_1_0_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_1_0_0 *res = &pcie->res.v1_0_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; - int ret; res->vdda = devm_regulator_get(dev, "vdda"); if (IS_ERR(res->vdda)) return PTR_ERR(res->vdda); - res->clks[0].id = "iface"; - res->clks[1].id = "aux"; - res->clks[2].id = "master_bus"; - res->clks[3].id = "slave_bus"; - - ret = devm_clk_bulk_get(dev, ARRAY_SIZE(res->clks), res->clks); - if (ret < 0) - return ret; - res->core = devm_reset_control_get_exclusive(dev, "core"); return PTR_ERR_OR_ZERO(res->core); } @@ -500,7 +459,7 @@ static void qcom_pcie_deinit_1_0_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_1_0_0 *res = &pcie->res.v1_0_0; reset_control_assert(res->core); - clk_bulk_disable_unprepare(ARRAY_SIZE(res->clks), res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); regulator_disable(res->vdda); } @@ -517,7 +476,7 @@ static int qcom_pcie_init_1_0_0(struct qcom_pcie *pcie) return ret; } - ret = clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks); + ret = clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); if (ret) { dev_err(dev, "cannot prepare/enable clocks\n"); goto err_assert_reset; @@ -532,7 +491,7 @@ static int qcom_pcie_init_1_0_0(struct qcom_pcie *pcie) return 0; err_disable_clks: - clk_bulk_disable_unprepare(ARRAY_SIZE(res->clks), res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); err_assert_reset: reset_control_assert(res->core); @@ -580,15 +539,6 @@ static int qcom_pcie_get_resources_2_3_2(struct qcom_pcie *pcie) if (ret) return ret; - res->clks[0].id = "aux"; - res->clks[1].id = "cfg"; - res->clks[2].id = "bus_master"; - res->clks[3].id = "bus_slave"; - - ret = devm_clk_bulk_get(dev, ARRAY_SIZE(res->clks), res->clks); - if (ret < 0) - return ret; - return 0; } @@ -596,7 +546,7 @@ static void qcom_pcie_deinit_2_3_2(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_3_2 *res = &pcie->res.v2_3_2; - clk_bulk_disable_unprepare(ARRAY_SIZE(res->clks), res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); } @@ -613,7 +563,7 @@ static int qcom_pcie_init_2_3_2(struct qcom_pcie *pcie) return ret; } - ret = clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks); + ret = clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); if (ret) { dev_err(dev, "cannot prepare/enable clocks\n"); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); @@ -661,18 +611,6 @@ static int qcom_pcie_get_resources_2_4_0(struct qcom_pcie *pcie) bool is_ipq = of_device_is_compatible(dev->of_node, "qcom,pcie-ipq4019"); int ret; - res->clks[0].id = "aux"; - res->clks[1].id = "master_bus"; - res->clks[2].id = "slave_bus"; - res->clks[3].id = "iface"; - - /* qcom,pcie-ipq4019 is defined without "iface" */ - res->num_clks = is_ipq ? 3 : 4; - - ret = devm_clk_bulk_get(dev, res->num_clks, res->clks); - if (ret < 0) - return ret; - res->resets[0].id = "axi_m"; res->resets[1].id = "axi_s"; res->resets[2].id = "axi_m_sticky"; @@ -700,7 +638,7 @@ static void qcom_pcie_deinit_2_4_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_2_4_0 *res = &pcie->res.v2_4_0; reset_control_bulk_assert(res->num_resets, res->resets); - clk_bulk_disable_unprepare(res->num_clks, res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); } static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie) @@ -726,7 +664,7 @@ static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie) usleep_range(10000, 12000); - ret = clk_bulk_prepare_enable(res->num_clks, res->clks); + ret = clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); if (ret) { reset_control_bulk_assert(res->num_resets, res->resets); return ret; @@ -742,16 +680,6 @@ static int qcom_pcie_get_resources_2_3_3(struct qcom_pcie *pcie) struct device *dev = pci->dev; int ret; - res->clks[0].id = "iface"; - res->clks[1].id = "axi_m"; - res->clks[2].id = "axi_s"; - res->clks[3].id = "ahb"; - res->clks[4].id = "aux"; - - ret = devm_clk_bulk_get(dev, ARRAY_SIZE(res->clks), res->clks); - if (ret < 0) - return ret; - res->rst[0].id = "axi_m"; res->rst[1].id = "axi_s"; res->rst[2].id = "pipe"; @@ -769,9 +697,7 @@ static int qcom_pcie_get_resources_2_3_3(struct qcom_pcie *pcie) static void qcom_pcie_deinit_2_3_3(struct qcom_pcie *pcie) { - struct qcom_pcie_resources_2_3_3 *res = &pcie->res.v2_3_3; - - clk_bulk_disable_unprepare(ARRAY_SIZE(res->clks), res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); } static int qcom_pcie_init_2_3_3(struct qcom_pcie *pcie) @@ -801,7 +727,7 @@ static int qcom_pcie_init_2_3_3(struct qcom_pcie *pcie) */ usleep_range(2000, 2500); - ret = clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks); + ret = clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); if (ret) { dev_err(dev, "cannot prepare/enable clocks\n"); goto err_assert_resets; @@ -862,8 +788,6 @@ static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; - unsigned int num_clks, num_opt_clks; - unsigned int idx; int ret; res->rst = devm_reset_control_array_get_exclusive(dev); @@ -877,37 +801,6 @@ static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) if (ret) return ret; - idx = 0; - res->clks[idx++].id = "aux"; - res->clks[idx++].id = "cfg"; - res->clks[idx++].id = "bus_master"; - res->clks[idx++].id = "bus_slave"; - res->clks[idx++].id = "slave_q2a"; - - num_clks = idx; - - ret = devm_clk_bulk_get(dev, num_clks, res->clks); - if (ret < 0) - return ret; - - res->clks[idx++].id = "tbu"; - res->clks[idx++].id = "ddrss_sf_tbu"; - res->clks[idx++].id = "aggre0"; - res->clks[idx++].id = "aggre1"; - res->clks[idx++].id = "noc_aggr"; - res->clks[idx++].id = "noc_aggr_4"; - res->clks[idx++].id = "noc_aggr_south_sf"; - res->clks[idx++].id = "cnoc_qx"; - res->clks[idx++].id = "sleep"; - res->clks[idx++].id = "cnoc_sf_axi"; - - num_opt_clks = idx - num_clks; - res->num_clks = idx; - - ret = devm_clk_bulk_get_optional(dev, num_opt_clks, res->clks + num_clks); - if (ret < 0) - return ret; - return 0; } @@ -925,7 +818,7 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) return ret; } - ret = clk_bulk_prepare_enable(res->num_clks, res->clks); + ret = clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); if (ret < 0) goto err_disable_regulators; @@ -977,7 +870,7 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie) return 0; err_disable_clocks: - clk_bulk_disable_unprepare(res->num_clks, res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); err_disable_regulators: regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); @@ -1015,7 +908,7 @@ static void qcom_pcie_deinit_2_7_0(struct qcom_pcie *pcie) { struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0; - clk_bulk_disable_unprepare(res->num_clks, res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); regulator_bulk_disable(ARRAY_SIZE(res->supplies), res->supplies); } @@ -1101,17 +994,6 @@ static int qcom_pcie_get_resources_2_9_0(struct qcom_pcie *pcie) struct qcom_pcie_resources_2_9_0 *res = &pcie->res.v2_9_0; struct dw_pcie *pci = pcie->pci; struct device *dev = pci->dev; - int ret; - - res->clks[0].id = "iface"; - res->clks[1].id = "axi_m"; - res->clks[2].id = "axi_s"; - res->clks[3].id = "axi_bridge"; - res->clks[4].id = "rchng"; - - ret = devm_clk_bulk_get(dev, ARRAY_SIZE(res->clks), res->clks); - if (ret < 0) - return ret; res->rst = devm_reset_control_array_get_exclusive(dev); if (IS_ERR(res->rst)) @@ -1122,9 +1004,7 @@ static int qcom_pcie_get_resources_2_9_0(struct qcom_pcie *pcie) static void qcom_pcie_deinit_2_9_0(struct qcom_pcie *pcie) { - struct qcom_pcie_resources_2_9_0 *res = &pcie->res.v2_9_0; - - clk_bulk_disable_unprepare(ARRAY_SIZE(res->clks), res->clks); + clk_bulk_disable_unprepare(pcie->num_clks, pcie->clks); } static int qcom_pcie_init_2_9_0(struct qcom_pcie *pcie) @@ -1153,7 +1033,7 @@ static int qcom_pcie_init_2_9_0(struct qcom_pcie *pcie) usleep_range(2000, 2500); - return clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks); + return clk_bulk_prepare_enable(pcie->num_clks, pcie->clks); } static int qcom_pcie_post_init_2_9_0(struct qcom_pcie *pcie) @@ -1561,6 +1441,13 @@ static int qcom_pcie_probe(struct platform_device *pdev) goto err_pm_runtime_put; } + pcie->num_clks = devm_clk_bulk_get_all(dev, &pcie->clks); + if (pcie->num_clks < 0) { + ret = pcie->num_clks; + dev_err(dev, "Failed to get clocks\n"); + goto err_pm_runtime_put; + } + ret = qcom_pcie_icc_init(pcie); if (ret) goto err_pm_runtime_put; From patchwork Wed May 1 04:07:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 13650179 Received: from mail-oi1-f182.google.com (mail-oi1-f182.google.com [209.85.167.182]) (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 027F547A62; Wed, 1 May 2024 04:08:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536493; cv=none; b=LQqplOL0AM6azzb6EyffmQGNO7upaDDZQ5TQH4OQnWgNO1buNnbEuw6euamCUso1xvu06mM/+fJey6I8ALCF6W+uHMnT35AHNXuZ8lPRg9cYnjonFiqCzTpmsCNedWSOZNFO7WxUp5/vpVLTzL64HMhJIl/95nv7nyqrAwjSqEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536493; c=relaxed/simple; bh=2cKONyUhvqsDbdbaoKbjY2AvnOp4SE0Z8KCFA6jaKJI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qw3RJCyoEtUNt6RaQc5SbTj9mF5imFiRWj17p3O/T25i05k9VXUaAw7vAmlfdjrkYQZOYfEKZ8BBOK41xdrTXNMrbJmZT8nigLLrFms99Z6RWm6Rkz+3rKXKtwL0JMdJJbfYVm5uXipcC41EMQ2I4DLxeSRaWA3svTe1rwVFHg0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XqnpAGDR; arc=none smtp.client-ip=209.85.167.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XqnpAGDR" Received: by mail-oi1-f182.google.com with SMTP id 5614622812f47-3c7513a991cso4345180b6e.1; Tue, 30 Apr 2024 21:08:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714536491; x=1715141291; 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=SI71NoupknAET1jl5DuELYiP8ivpPOCBg6fYut4RUIg=; b=XqnpAGDRNHbXKbPJJSilIy+sOtTlD8kQtWYsSlzUgjFOnrh28qSQah6cThcb2FheXI 9eyBJo8QtRdg/kQ4Sv5Uvz8gTd2297GG1FSQz9Lny5SmrCRNN74G/S7MgVAG9k0StXfr bhA8BNjBfE3bRwdA4X905JY4554UhaVzDfAs45QJRVbwnEyoGML6K3BTPghmxcl3JXTx Evc+XJR3KXosZedpZOtu6+nw2pN0FKtjf4h34kwCq2oP8XbvKI4aSrV34rMH350kOPg5 tUrocuKpVSXATO348ZTe+N39F4qoObJ+U36DltZA7jTrNWgfn6Nt/tbhif5HntUok5Sp O9Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714536491; x=1715141291; 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=SI71NoupknAET1jl5DuELYiP8ivpPOCBg6fYut4RUIg=; b=mX8QHka32BhMQJa+ViHbqpKQZq8BH+aG8E78q19jG+14bC5mekGtP9VVkLTlsOD1O4 QwGNr8w3f81kjNtxRQOV008hNjsz63bitZieDoReSmWO+5AFhjJ9Uqw9pkHj6+1Guy5l Ckgia4xFfSpu2brhmZKcDJ4Nh2aSD2UjASqw6XMhBdbR1MaGlYW4Ys79C2atkm1dUSwS a8en5FI21zxxe60cXnVqNzMsiMGmsmWyhG8WygNSvidzjJclKLUdu8nK3vr0kkMrNXnt DMm2FI1AClj79OAbgdtBaLZQ2H7to6KIsbtEIg0E1faiBsslqSpgsUF0LHsgWCBr4iIg 747A== X-Forwarded-Encrypted: i=1; AJvYcCXzhOYLpHFPnGbcMIRaJ2EaJItYjPARiaOj4R3ygusvQTgGv8nIRcrljhVNbl8hIshaDKNDTJiJtj5VkUpfl3JL4ciquxqLyTZeQQXoDmmjBfZoYnLrDbo2uTePczvRIylGbs3jBZsFMQ== X-Gm-Message-State: AOJu0YwQ49WXPQmHBt/49nsB1B2uirDu1fmQ1/PuuOSR5Wo2UolgKwRf g4SvjfiY9cLvR+l5zsvy4wxIhTlCcLFKUUkpvd+WxYFhCoj5LtPp X-Google-Smtp-Source: AGHT+IGWkFSZCO+ZZ/YO1r4ABUoLVDbfdhiB69s9e2f41K99hiJkGkFuG2kvrL0k3rjMtPTuJWCe5w== X-Received: by 2002:a05:6808:1919:b0:3c8:4228:e6d4 with SMTP id bf25-20020a056808191900b003c84228e6d4mr1973871oib.9.1714536490966; Tue, 30 Apr 2024 21:08:10 -0700 (PDT) Received: from nukework.lan (c-98-197-58-203.hsd1.tx.comcast.net. [98.197.58.203]) by smtp.gmail.com with ESMTPSA id w2-20020a056808018200b003c8643f0e5csm1067872oic.16.2024.04.30.21.08.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 21:08:10 -0700 (PDT) From: Alexandru Gagniuc To: Manivannan Sadhasivam , Bjorn Andersson , Konrad Dybcio , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= , Rob Herring , Bjorn Helgaas Cc: linux-kernel@vger.kernel.org, quic_kathirav@quicinc.com, Alexandru Gagniuc , linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH v4 5/8] PCI: qcom: Add support for IPQ9574 Date: Tue, 30 Apr 2024 23:07:47 -0500 Message-Id: <20240501040800.1542805-6-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240501040800.1542805-1-mr.nuke.me@gmail.com> References: <20240501040800.1542805-1-mr.nuke.me@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 IPQ9574 has four PCIe controllers: two single-lane Gen3, and two dual-lane Gen3. The controllers are identical from a software perspective, with the differences appearing in the PHYs. Add a compatible for the PCIe on IPQ9574. Signed-off-by: Alexandru Gagniuc --- drivers/pci/controller/dwc/pcie-qcom.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c index ea81ff68d433..e61888e6c63d 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1551,6 +1551,7 @@ static const struct of_device_id qcom_pcie_match[] = { { .compatible = "qcom,pcie-ipq8064-v2", .data = &cfg_2_1_0 }, { .compatible = "qcom,pcie-ipq8074", .data = &cfg_2_3_3 }, { .compatible = "qcom,pcie-ipq8074-gen3", .data = &cfg_2_9_0 }, + { .compatible = "qcom,pcie-ipq9574", .data = &cfg_2_9_0 }, { .compatible = "qcom,pcie-msm8996", .data = &cfg_2_3_2 }, { .compatible = "qcom,pcie-qcs404", .data = &cfg_2_4_0 }, { .compatible = "qcom,pcie-sa8540p", .data = &cfg_sc8280xp }, From patchwork Wed May 1 04:07:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 13650180 Received: from mail-oi1-f180.google.com (mail-oi1-f180.google.com [209.85.167.180]) (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 7AFDA433CB; Wed, 1 May 2024 04:08:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536494; cv=none; b=N9GqG/FqQoce5vwV60h4+ggh6193ITR+evfFwASvY0vUSBoIL1GPhbTbKc6g8UAwD4N1Cll9XKyelgXky8RAqpbDYFjIkqYgmqRp9tEz2tSQxyzGOrFPiRVnzHP1AvK64k5fL2wvxkmY3gB5xv9ycu/eB91Vx5W2S8Td7bVnmxE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536494; c=relaxed/simple; bh=l8wNOtYhNTub8tqUC0hD6JfTNva6XfYe64dArOyPXTg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QkZhSpNayp8DdJPw0gz7H9ln1qfAE75OWZoRhjW59XJpqMaKx0HRpJ5sjKLhciPBWq8VZlvwuKlpMeS4A1qD8PCexUU1fqYcF4LpJt/uAoJzRMB8HgNolAw7nn3F1hSrotVzfREMGQD83j2BpXZ5HXGpWzPwekVRTbDpGLxZMRY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=mp7h8ruc; arc=none smtp.client-ip=209.85.167.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mp7h8ruc" Received: by mail-oi1-f180.google.com with SMTP id 5614622812f47-3c750fd1202so3717089b6e.2; Tue, 30 Apr 2024 21:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714536492; x=1715141292; 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=ghcu5svxDDMwf9Ya6V/1d6nG/9vm8dM7H011zLAoFaA=; b=mp7h8ruc2G8+KmHuNWHATB7aKmhcJNzgql1ob3o48MArIROiGGPvswpJ6E/6SfO9wD B49J5SXW9MBF1f9TiaUK9Mc1Dq1bcnPJqACS77TUBJtaxjWrZvRvA08LQNL8IAb1SLQ/ ohVOjYh2C77Cl5KutYvL6z6YAzptvBHOzGeXPQaApqzKAtUV83yM3YG4axSxWVPVnvd0 WMYsqX2Yx2re1Bx5QeP/A0D14rpVpySNy/QxaGNJpOV6vnanSgy9FMEb6BIgZxf1bfMj Mk48ZEAdlcM4zPLgkIed5YO4EUcelTje+zipiZ/uEVf9ExyZ3r4x6hyg6VGJzNd4j5f4 swEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714536492; x=1715141292; 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=ghcu5svxDDMwf9Ya6V/1d6nG/9vm8dM7H011zLAoFaA=; b=FAUNLXxVbaSh2elZfcf3OUH7KQ6EVJF+lWmxXBPN0FAbzLtLxaj76zb9A62E38ueIs /sbf2Ezb4VXZsXrNQjC4/h9PC41p1Y5AJyorUbdEox5qoWHzpm2idp4ByK1O26aUiFJc NTnttVXsTp1tQJS8sYuxBB4iZZ6pdRep+BN4NbPDin/61KguVmsp4f2CNmZKDaSKLTdm zQbGvhOG8OidsF+cAPwMGhdH+tzscexPQlx7dHFGkcICvjB2ZuyItZK9MIlWsJMXXL03 8gQqyxEVpoQ+3neXZLGUxvlvBitbfGfuiMtb+CYUo7B+Ufo1khD4dJG2tAX73Q/N/HUc gzbQ== X-Forwarded-Encrypted: i=1; AJvYcCXH8zGdwaBZLoEWDTcpsuHqqdUe+IfWjmSWv6bO2hJrWgBgaTqcYTliOK/Gv7zSVxs2/XZFjNfBE8vSOXar4CIkM3LPTzYxmJReo9+kTOTrBgyw6ieQ2vtI7tAQE+yDo0Lj01WBb4aSaag= X-Gm-Message-State: AOJu0YxBa53fOHDz1GDPSH8C5wBUkuCtPurOly0k0JDsBoI74k2dbjdd ZVMCWF28ZD6Jr7ny1MZPi/wnJL9G3UUdCr3MJ80z6Q5RHTq/q31sKRViJtabat8= X-Google-Smtp-Source: AGHT+IE0E0/DvAkXZtkuPvqDWjEfhTKVpwqRMdFGJ93BhhRobghlUJxth/c+MqrZ9nW0kZnouPr8mA== X-Received: by 2002:a05:6808:5c6:b0:3c8:5c8e:72db with SMTP id d6-20020a05680805c600b003c85c8e72dbmr1526720oij.56.1714536492481; Tue, 30 Apr 2024 21:08:12 -0700 (PDT) Received: from nukework.lan (c-98-197-58-203.hsd1.tx.comcast.net. [98.197.58.203]) by smtp.gmail.com with ESMTPSA id w2-20020a056808018200b003c8643f0e5csm1067872oic.16.2024.04.30.21.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 21:08:12 -0700 (PDT) From: Alexandru Gagniuc To: Bjorn Andersson , Konrad Dybcio , Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-kernel@vger.kernel.org, quic_kathirav@quicinc.com, Alexandru Gagniuc , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org Subject: [PATCH v4 6/8] dt-bindings: phy: qcom,ipq8074-qmp-pcie: add ipq9574 gen3x2 PHY Date: Tue, 30 Apr 2024 23:07:48 -0500 Message-Id: <20240501040800.1542805-7-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240501040800.1542805-1-mr.nuke.me@gmail.com> References: <20240501040800.1542805-1-mr.nuke.me@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The IPQ9574 gen3x2 PHY is very similar to IPQ6018. It requires the same parameters as IPQ6018. Add a new compatible string for this PHY. Signed-off-by: Alexandru Gagniuc --- .../devicetree/bindings/phy/qcom,ipq8074-qmp-pcie-phy.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/phy/qcom,ipq8074-qmp-pcie-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,ipq8074-qmp-pcie-phy.yaml index 634cec5d57ea..8a8e23282d1c 100644 --- a/Documentation/devicetree/bindings/phy/qcom,ipq8074-qmp-pcie-phy.yaml +++ b/Documentation/devicetree/bindings/phy/qcom,ipq8074-qmp-pcie-phy.yaml @@ -19,6 +19,7 @@ properties: - qcom,ipq6018-qmp-pcie-phy - qcom,ipq8074-qmp-gen3-pcie-phy - qcom,ipq8074-qmp-pcie-phy + - qcom,ipq9574-qmp-gen3x2-pcie-phy reg: items: From patchwork Wed May 1 04:07:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 13650181 Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (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 15C5E495E5; Wed, 1 May 2024 04:08:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536496; cv=none; b=gvshkbbowJVcmzAKfiMS4DotWEw3cxkbCUALyc9HUQUO3QXsaKhu9Dfmd9Jcqsb6jI/1RdDyExNUFqWDnbjkWMF84NMflJw/2NTE7jWjePnhSKvLdWhphmA+GwGOg8/UTqlt6RavYrX0rAzo67ac8WTVXbXcjKM9jyjh97Cj8xc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536496; c=relaxed/simple; bh=0BfEtfmjkngC0ceF0AlrchQUuHHooF2cpIxhIeT/QuQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QcIZty6Mki08ScgXzYysLLdo+ctxl5+V/2NyvI4pTVsgmWPfntm+IbuYL//gsad3PNvykhMvDCZuVC7SD0z3ZW8U49KKGpipUf0nZMSJP6l+wLm3hKQCsUfy5L+KRjrKcUmiNsNNV8m0g9v/P8JiYOPHLtjeyHZsyzA+Rasd+Yg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gigGCmiG; arc=none smtp.client-ip=209.85.167.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gigGCmiG" Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3c6f785208dso1241009b6e.1; Tue, 30 Apr 2024 21:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714536494; x=1715141294; 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=VmjrDrgf8IhRX/sC5LhfboQGEOFKZ/tJGIYEXDMm4jU=; b=gigGCmiGEmr7GVKFT171oY41Io+msHvq24sgqI4AXdngYbZ91itP1uh7Yz8B0f2M5T GmMAL4397HhgtoOFk7lUeBqJ7Mqd9JupyeJFv78qxmusmF2IJ3jO64oUyQwZjGqABedY 2HBwqTHN0DOHLa7d2Ub2F1t1Vz86iUyfxHV+uNq6kFCBJO/czhOhrOqCIsU998JtbJ5Q KmxtlMeUa3d/815Rwlov9EImhTfZVZJ0GJv9WkLe6PivOcjI0RZueujYhc3v2hbVz4EI rNrTPmXNBKcGP+H6HKNeyALNqytzIE0HP4c9T2hwoQueeWAdizx7HeDo9CXdj+oxxGSQ Y0sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714536494; x=1715141294; 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=VmjrDrgf8IhRX/sC5LhfboQGEOFKZ/tJGIYEXDMm4jU=; b=D8zi9bXiiNNHwQBp1T6GEgUR4UkID5RhYvjnXtVYdT5LcPJB0hFi4IHzSGVN9BcwVr DFEDqUjzY5RGPp3MXpuCF9DEjgN93+6vDrRGb9MRsUpJoKLST28zaGFIpNO6WR0gKTKF +zKs1rfReX1pr7+5IwNGJBQ+/4rq8e3cTWMWL/WdGw72WTz4MdFgYfISs1lTYSzYKxPT FXFHezlkNLKzCJFZhIxHE8MXk5o+tTNY3v6Za9jEWIECsWeINkClbwtkHxll4NffEFfB xvX1PWHiRZAK1GgZNxykrnBQONn6fcDtFu/gg16UwZlTrmNOrGKXpeYFzdN63r0l/7Ma qJwA== X-Forwarded-Encrypted: i=1; AJvYcCVHh7r4ky+lm0nh15acRQ8iEjT0RLUqysDSB4UgWPX0lUYZZp6W+gXqZfocFYJeikG5E7bUtr4/iTgb55syoUc1OKRyMOa1aZJCz5LORA== X-Gm-Message-State: AOJu0YxoCIBfGIbAawGn26jSrN5EgTo17MwhYydqbak5jXGzbo6yqS3w AaipNz4FE4QWsJAGj2JIY8Nkb5UAzuvTqaYOlIk1fiF36IHqkDRa X-Google-Smtp-Source: AGHT+IE059yWmz4HptKAGSGfQKQOEVyacMWcAj9Y+NXGhMtevC2Bwf7I3EeelHtLc6y7L0oe7xS4oA== X-Received: by 2002:a05:6808:15a9:b0:3c8:6238:8c38 with SMTP id t41-20020a05680815a900b003c862388c38mr2070514oiw.11.1714536494106; Tue, 30 Apr 2024 21:08:14 -0700 (PDT) Received: from nukework.lan (c-98-197-58-203.hsd1.tx.comcast.net. [98.197.58.203]) by smtp.gmail.com with ESMTPSA id w2-20020a056808018200b003c8643f0e5csm1067872oic.16.2024.04.30.21.08.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 21:08:13 -0700 (PDT) From: Alexandru Gagniuc To: Bjorn Andersson , Konrad Dybcio , Vinod Koul , Kishon Vijay Abraham I Cc: linux-kernel@vger.kernel.org, quic_kathirav@quicinc.com, Alexandru Gagniuc , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH v4 7/8] phy: qcom-qmp-pcie: add support for ipq9574 gen3x2 PHY Date: Tue, 30 Apr 2024 23:07:49 -0500 Message-Id: <20240501040800.1542805-8-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240501040800.1542805-1-mr.nuke.me@gmail.com> References: <20240501040800.1542805-1-mr.nuke.me@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add support for the gen3x2 PCIe PHY on IPQ9574, ported form downstream 5.4 kernel. Only the serdes and pcs_misc tables are new, the others being reused from IPQ8074 and IPQ6018 PHYs. Signed-off-by: Alexandru Gagniuc --- drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 136 +++++++++++++++++- .../phy/qualcomm/phy-qcom-qmp-pcs-pcie-v5.h | 14 ++ 2 files changed, 149 insertions(+), 1 deletion(-) diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c index 8836bb1ff0cc..055d04d0c9b6 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c @@ -487,6 +487,100 @@ static const struct qmp_phy_init_tbl ipq8074_pcie_gen3_pcs_misc_tbl[] = { QMP_PHY_INIT_CFG(QPHY_V4_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1), }; +static const struct qmp_phy_init_tbl ipq9574_gen3x2_pcie_serdes_tbl[] = { + QMP_PHY_INIT_CFG(QSERDES_PLL_BIAS_EN_CLKBUFLR_EN, 0x18), + QMP_PHY_INIT_CFG(QSERDES_PLL_BIAS_EN_CTRL_BY_PSM, 0x01), + QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_SELECT, 0x31), + QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_IVCO, 0x0f), + QMP_PHY_INIT_CFG(QSERDES_PLL_BG_TRIM, 0x0f), + QMP_PHY_INIT_CFG(QSERDES_PLL_CMN_CONFIG, 0x06), + QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP_EN, 0x42), + QMP_PHY_INIT_CFG(QSERDES_PLL_RESETSM_CNTRL, 0x20), + QMP_PHY_INIT_CFG(QSERDES_PLL_SVS_MODE_CLK_SEL, 0x01), + QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE_MAP, 0x04), + QMP_PHY_INIT_CFG(QSERDES_PLL_SVS_MODE_CLK_SEL, 0x05), + QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE_TIMER1, 0xff), + QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE_TIMER2, 0x3f), + QMP_PHY_INIT_CFG(QSERDES_PLL_CORE_CLK_EN, 0x30), + QMP_PHY_INIT_CFG(QSERDES_PLL_HSCLK_SEL, 0x21), + QMP_PHY_INIT_CFG(QSERDES_PLL_DEC_START_MODE0, 0x68), + QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START3_MODE0, 0x02), + QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START2_MODE0, 0xaa), + QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START1_MODE0, 0xab), + QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP2_MODE0, 0x14), + QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP1_MODE0, 0xd4), + QMP_PHY_INIT_CFG(QSERDES_PLL_CP_CTRL_MODE0, 0x09), + QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_RCTRL_MODE0, 0x16), + QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_CCTRL_MODE0, 0x28), + QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN1_MODE0, 0x00), + QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN0_MODE0, 0xa0), + QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE2_MODE0, 0x02), + QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE1_MODE0, 0x24), + QMP_PHY_INIT_CFG(QSERDES_PLL_SVS_MODE_CLK_SEL, 0x05), + QMP_PHY_INIT_CFG(QSERDES_PLL_CORE_CLK_EN, 0x00), + QMP_PHY_INIT_CFG(QSERDES_PLL_CORECLK_DIV, 0x0a), + QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_SELECT, 0x32), + QMP_PHY_INIT_CFG(QSERDES_PLL_SYS_CLK_CTRL, 0x02), + QMP_PHY_INIT_CFG(QSERDES_PLL_SYSCLK_BUF_ENABLE, 0x07), + QMP_PHY_INIT_CFG(QSERDES_PLL_SYSCLK_EN_SEL, 0x08), + QMP_PHY_INIT_CFG(QSERDES_PLL_BG_TIMER, 0x0a), + QMP_PHY_INIT_CFG(QSERDES_PLL_HSCLK_SEL, 0x01), + QMP_PHY_INIT_CFG(QSERDES_PLL_DEC_START_MODE1, 0x53), + QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START3_MODE1, 0x05), + QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START2_MODE1, 0x55), + QMP_PHY_INIT_CFG(QSERDES_PLL_DIV_FRAC_START1_MODE1, 0x55), + QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP2_MODE1, 0x29), + QMP_PHY_INIT_CFG(QSERDES_PLL_LOCK_CMP1_MODE1, 0xaa), + QMP_PHY_INIT_CFG(QSERDES_PLL_CP_CTRL_MODE1, 0x09), + QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_RCTRL_MODE1, 0x16), + QMP_PHY_INIT_CFG(QSERDES_PLL_PLL_CCTRL_MODE1, 0x28), + QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN1_MODE1, 0x00), + QMP_PHY_INIT_CFG(QSERDES_PLL_INTEGLOOP_GAIN0_MODE1, 0xa0), + QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE2_MODE1, 0x03), + QMP_PHY_INIT_CFG(QSERDES_PLL_VCO_TUNE1_MODE1, 0xb4), + QMP_PHY_INIT_CFG(QSERDES_PLL_SVS_MODE_CLK_SEL, 0x05), + QMP_PHY_INIT_CFG(QSERDES_PLL_CORE_CLK_EN, 0x00), + QMP_PHY_INIT_CFG(QSERDES_PLL_CORECLK_DIV_MODE1, 0x08), + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_EN_CENTER, 0x01), + QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_PER1, 0x7d), + QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_PER2, 0x01), + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_ADJ_PER1, 0x00), + QMP_PHY_INIT_CFG(QSERDES_COM_SSC_ADJ_PER2, 0x00), + QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_STEP_SIZE1_MODE0, 0x0a), + QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_STEP_SIZE2_MODE0, 0x05), + QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_STEP_SIZE1_MODE1, 0x08), + QMP_PHY_INIT_CFG(QSERDES_PLL_SSC_STEP_SIZE2_MODE1, 0x04), + QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_EP_DIV_MODE0, 0x19), + QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_EP_DIV_MODE1, 0x28), + QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_ENABLE1, 0x90), + QMP_PHY_INIT_CFG(QSERDES_PLL_HSCLK_SEL, 0x89), + QMP_PHY_INIT_CFG(QSERDES_PLL_CLK_ENABLE1, 0x10), +}; + +static const struct qmp_phy_init_tbl ipq9574_gen3x2_pcie_pcs_misc_tbl[] = { + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_OSC_DTCT_ACTIONS, 0x00), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_POWER_STATE_CONFIG2, 0x1d), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_H, 0x00), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_H, 0x00), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_L, 0x01), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_EQ_CONFIG1, 0x14), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_EQ_CONFIG1, 0x10), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_EQ_CONFIG2, 0x0b), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_PRESET_P10_PRE, 0x00), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_PRESET_P10_POST, 0x58), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_POWER_STATE_CONFIG4, 0x07), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_OSC_DTCT_CONFIG1, 0x00), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_OSC_DTCT_CONFIG2, 0x52), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_OSC_DTCT_CONFIG4, 0x19), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_INT_AUX_CLK_CONFIG1, 0x00), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_OSC_DTCT_MODE2_CONFIG2, 0x49), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_OSC_DTCT_MODE2_CONFIG4, 0x2a), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_OSC_DTCT_MODE2_CONFIG5, 0x02), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_OSC_DTCT_MODE2_CONFIG6, 0x03), + QMP_PHY_INIT_CFG(QPHY_V5_PCS_PCIE_ENDPOINT_REFCLK_DRIVE, 0xc1), +}; + static const struct qmp_phy_init_tbl sdm845_qmp_pcie_serdes_tbl[] = { QMP_PHY_INIT_CFG(QSERDES_V3_COM_BIAS_EN_CLKBUFLR_EN, 0x14), QMP_PHY_INIT_CFG(QSERDES_V3_COM_CLK_SELECT, 0x30), @@ -2448,7 +2542,7 @@ static inline void qphy_clrbits(void __iomem *base, u32 offset, u32 val) /* list of clocks required by phy */ static const char * const qmp_pciephy_clk_l[] = { - "aux", "cfg_ahb", "ref", "refgen", "rchng", "phy_aux", + "aux", "cfg_ahb", "ref", "refgen", "rchng", "phy_aux", "anoc", "snoc" }; /* list of regulators */ @@ -2519,6 +2613,16 @@ static const struct qmp_pcie_offsets qmp_pcie_offsets_v4_20 = { .rx2 = 0x0a00, }; +static const struct qmp_pcie_offsets qmp_pcie_offsets_ipq9574 = { + .serdes = 0, + .pcs = 0x1000, + .pcs_misc = 0x1400, + .tx = 0x0200, + .rx = 0x0400, + .tx2 = 0x0600, + .rx2 = 0x0800, +}; + static const struct qmp_pcie_offsets qmp_pcie_offsets_v5 = { .serdes = 0, .pcs = 0x0200, @@ -2728,6 +2832,33 @@ static const struct qmp_phy_cfg sm8250_qmp_gen3x1_pciephy_cfg = { .phy_status = PHYSTATUS, }; +static const struct qmp_phy_cfg ipq9574_pciephy_gen3x2_cfg = { + .lanes = 2, + + .offsets = &qmp_pcie_offsets_ipq9574, + + .tbls = { + .serdes = ipq9574_gen3x2_pcie_serdes_tbl, + .serdes_num = ARRAY_SIZE(ipq9574_gen3x2_pcie_serdes_tbl), + .tx = ipq8074_pcie_gen3_tx_tbl, + .tx_num = ARRAY_SIZE(ipq8074_pcie_gen3_tx_tbl), + .rx = ipq6018_pcie_rx_tbl, + .rx_num = ARRAY_SIZE(ipq6018_pcie_rx_tbl), + .pcs = ipq6018_pcie_pcs_tbl, + .pcs_num = ARRAY_SIZE(ipq6018_pcie_pcs_tbl), + .pcs_misc = ipq9574_gen3x2_pcie_pcs_misc_tbl, + .pcs_misc_num = ARRAY_SIZE(ipq9574_gen3x2_pcie_pcs_misc_tbl), + }, + .reset_list = ipq8074_pciephy_reset_l, + .num_resets = ARRAY_SIZE(ipq8074_pciephy_reset_l), + .vreg_list = NULL, + .num_vregs = 0, + .regs = pciephy_v5_regs_layout, + + .pwrdn_ctrl = SW_PWRDN | REFCLK_DRV_DSBL, + .phy_status = PHYSTATUS, +}; + static const struct qmp_phy_cfg sm8250_qmp_gen3x2_pciephy_cfg = { .lanes = 2, @@ -3935,6 +4066,9 @@ static const struct of_device_id qmp_pcie_of_match_table[] = { }, { .compatible = "qcom,ipq8074-qmp-pcie-phy", .data = &ipq8074_pciephy_cfg, + }, { + .compatible = "qcom,ipq9574-qmp-gen3x2-pcie-phy", + .data = &ipq9574_pciephy_gen3x2_cfg, }, { .compatible = "qcom,msm8998-qmp-pcie-phy", .data = &msm8998_pciephy_cfg, diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v5.h b/drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v5.h index a469ae2a10a1..fa15a03055de 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v5.h +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcs-pcie-v5.h @@ -11,8 +11,22 @@ #define QPHY_V5_PCS_PCIE_POWER_STATE_CONFIG2 0x0c #define QPHY_V5_PCS_PCIE_POWER_STATE_CONFIG4 0x14 #define QPHY_V5_PCS_PCIE_ENDPOINT_REFCLK_DRIVE 0x20 +#define QPHY_V5_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_L 0x44 +#define QPHY_V5_PCS_PCIE_L1P1_WAKEUP_DLY_TIME_AUXCLK_H 0x48 +#define QPHY_V5_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_L 0x4c +#define QPHY_V5_PCS_PCIE_L1P2_WAKEUP_DLY_TIME_AUXCLK_H 0x50 #define QPHY_V5_PCS_PCIE_INT_AUX_CLK_CONFIG1 0x54 +#define QPHY_V5_PCS_PCIE_OSC_DTCT_CONFIG1 0x5c +#define QPHY_V5_PCS_PCIE_OSC_DTCT_CONFIG2 0x60 +#define QPHY_V5_PCS_PCIE_OSC_DTCT_CONFIG4 0x68 +#define QPHY_V5_PCS_PCIE_OSC_DTCT_MODE2_CONFIG2 0x7c +#define QPHY_V5_PCS_PCIE_OSC_DTCT_MODE2_CONFIG4 0x84 +#define QPHY_V5_PCS_PCIE_OSC_DTCT_MODE2_CONFIG5 0x88 +#define QPHY_V5_PCS_PCIE_OSC_DTCT_MODE2_CONFIG6 0x8c #define QPHY_V5_PCS_PCIE_OSC_DTCT_ACTIONS 0x94 +#define QPHY_V5_PCS_PCIE_EQ_CONFIG1 0xa4 #define QPHY_V5_PCS_PCIE_EQ_CONFIG2 0xa8 +#define QPHY_V5_PCS_PCIE_PRESET_P10_PRE 0xc0 +#define QPHY_V5_PCS_PCIE_PRESET_P10_POST 0xe4 #endif From patchwork Wed May 1 04:07:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Alex G." X-Patchwork-Id: 13650182 Received: from mail-oi1-f176.google.com (mail-oi1-f176.google.com [209.85.167.176]) (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 01BF94CE05; Wed, 1 May 2024 04:08:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536498; cv=none; b=Hy8RdB3K+/55lC2MX4/q9yiFxGuC2cvYdGosseunOwinEUJvTYwdh243s+py6UNlXtGSued0s5yG2DiaDlDSEEvesSzqBjJ3ySQpL56wm+pYDjTGkUZijWNk0fU6HhHeki4fDO5zifPhjRWMr9hUb/LLwZkXu2PHekgfIZ9yqxo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714536498; c=relaxed/simple; bh=SGFo0nYVaGclh6uWy9vzUTrAnYsZxkd5dvKmm42KMDw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BBAT0hUvAMGu/ufeKm+RUCGrlE7yXR2ZKJ7N09Y/O7p3nIWLAoR0vCFtPtuJh4ghYUArL2CaIP6AqX1PfBU09Un3jcSa7rPV8cc2wcCO8IaCYLZc/Dd6tn2OdQRp634fp5eq68ynuMZhy4Anlc6p9hq4KzxlrN81RLAcQukfYm8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=T1pDOQAE; arc=none smtp.client-ip=209.85.167.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T1pDOQAE" Received: by mail-oi1-f176.google.com with SMTP id 5614622812f47-3c862c613fcso2220234b6e.3; Tue, 30 Apr 2024 21:08:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714536496; x=1715141296; 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=lS+64DkLIQ8nbNaGoMXOJ1Gbc+Q4ngs9pfz0WhHIiSc=; b=T1pDOQAEv7RwHS4b+GYQUz04Hpyh3x2B1UXjvZt4xW8Gp+GU3H19Y9QO4tYr3i4de/ Owik5EoZi+D1HP17Q0DTxHOccqRX97W5ti1hi3+CICMoutcofpY6frq6wNR6GD5xMd2a zGywuYW+M9WAIg66elQPEYSnFNIJdJwKe00DjmXnsRLba4hux+ItfsEP1iUuuSp9xyKv YSJD0fxM5M6T0VxtKH4y4hAC6qyaH+bN2+xu154QMcYO9e8sMODliuH+jwUs0GgSYuBf rzbCUQOyvhECfZaoU0cAD/hAM1wXEdGmG0bHqbkegb862WsQ9Y/j+kRmPk8SV5nVJ6cJ 8w8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714536496; x=1715141296; 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=lS+64DkLIQ8nbNaGoMXOJ1Gbc+Q4ngs9pfz0WhHIiSc=; b=P0vJsT+owM15Poy0dHhmbeW1JDUlHiRR6Zlf6kEnr3PZrvO6sqz4mizuvi+TY3KqnU O13k/mzrpCLfgeCZBX3vAvDYX6JmtSnUrttjFXdHhlf3PRVvkB+y8Sb3MOfexcff4HdZ v/j4B1SyBvy3HafXOs+t5LxHa0NXqigd1m1qmrRWbMXsIFsR28eRvIY1dBU3sOTayAj9 5rx3QwNRtt2h6DIiK8zjv1ZC3b/T8ZxrtyTVXjki0CdXZfEPanAtujvXQYiP+S8zPSCe Fd+KBri8nulTsC+ZCulTXrP65Ig4h47vE1S8gW/5xuX2PN4DUxMRitySEGNJ5kP8avK9 tiHQ== X-Forwarded-Encrypted: i=1; AJvYcCXGHWysZLZVxUOjRohDtmH6QYYkyBBZ3PYZaKtfevqMG2cykpgwnAOETUpYjNy8/Szev+/qzGOOrlLFEHqUEsCzWhli6nwV0hijrCKvh78kAUERNqqsef+yefgSZJgb7m/YM9Bd2GvgdoM= X-Gm-Message-State: AOJu0Yy+641c+w49sxMN2izlvlsprfQMdtI6FuviTm0hRm73CQOkJcb7 hm3Ve+VC6S+kfS6qM5NE3jNgCLputC2NyaoTY6833yD0MlUXviTZ X-Google-Smtp-Source: AGHT+IGkOYYdIKQz+4ta3HQIj2EhnM9ZNT2U/H8O9PWsU4LE1bdETO3BcBN0MlmC8qyrh0Lf05ugTw== X-Received: by 2002:a05:6808:1a90:b0:3c8:2ccb:84ac with SMTP id bm16-20020a0568081a9000b003c82ccb84acmr1426880oib.37.1714536495731; Tue, 30 Apr 2024 21:08:15 -0700 (PDT) Received: from nukework.lan (c-98-197-58-203.hsd1.tx.comcast.net. [98.197.58.203]) by smtp.gmail.com with ESMTPSA id w2-20020a056808018200b003c8643f0e5csm1067872oic.16.2024.04.30.21.08.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 21:08:15 -0700 (PDT) From: Alexandru Gagniuc To: Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-kernel@vger.kernel.org, quic_kathirav@quicinc.com, Alexandru Gagniuc , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v4 8/8] arm64: dts: qcom: ipq9574: add PCIe2 and PCIe3 nodes Date: Tue, 30 Apr 2024 23:07:50 -0500 Message-Id: <20240501040800.1542805-9-mr.nuke.me@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240501040800.1542805-1-mr.nuke.me@gmail.com> References: <20240501040800.1542805-1-mr.nuke.me@gmail.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On ipq9574, there are 4 PCIe controllers. Describe the pcie2 and pcie3 nodes, and their PHYs in devicetree. The pcie0 and pcie1 controllers use a gen3x1 PHY, which is not currently supported. Hence, only pcie2 and pcie3 are described. Only pcie2 was tested because my devboard only has conenctions to pcie2. Signed-off-by: Alexandru Gagniuc --- arch/arm64/boot/dts/qcom/ipq9574.dtsi | 178 +++++++++++++++++++++++++- 1 file changed, 176 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/ipq9574.dtsi b/arch/arm64/boot/dts/qcom/ipq9574.dtsi index 7f2e5cbf3bbb..c391886cf9ab 100644 --- a/arch/arm64/boot/dts/qcom/ipq9574.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq9574.dtsi @@ -300,8 +300,8 @@ gcc: clock-controller@1800000 { <0>, <0>, <0>, - <0>, - <0>, + <&pcie2_phy>, + <&pcie3_phy>, <0>; #clock-cells = <1>; #reset-cells = <1>; @@ -745,6 +745,180 @@ frame@b128000 { status = "disabled"; }; }; + + pcie2_phy: phy@8c000 { + compatible = "qcom,ipq9574-qmp-gen3x2-pcie-phy"; + reg = <0x0008c000 0x14f4>; + + clocks = <&gcc GCC_PCIE2_AUX_CLK>, + <&gcc GCC_PCIE2_AHB_CLK>, + <&gcc GCC_PCIE2_PIPE_CLK>; + clock-names = "aux", + "cfg_ahb", + "pipe"; + + clock-output-names = "pcie_phy2_pipe_clk"; + #clock-cells = <0>; + #phy-cells = <0>; + + resets = <&gcc GCC_PCIE2_PHY_BCR>, + <&gcc GCC_PCIE2PHY_PHY_BCR>; + reset-names = "phy", + "common"; + status = "disabled"; + }; + + pcie3_phy: phy@f4000 { + compatible = "qcom,ipq9574-qmp-gen3x2-pcie-phy"; + reg = <0x000f4000 0x14f4>; + + clocks = <&gcc GCC_PCIE3_AUX_CLK>, + <&gcc GCC_PCIE3_AHB_CLK>, + <&gcc GCC_PCIE3_PIPE_CLK>; + clock-names = "aux", + "cfg_ahb", + "pipe"; + + clock-output-names = "pcie_phy3_pipe_clk"; + #clock-cells = <0>; + #phy-cells = <0>; + + resets = <&gcc GCC_PCIE3_PHY_BCR>, + <&gcc GCC_PCIE3PHY_PHY_BCR>; + reset-names = "phy", + "common"; + status = "disabled"; + }; + + /* TODO: Populate pcie0/pcie1 when gen3x1 phy support is added. */ + + pcie2: pcie@20000000 { + compatible = "qcom,pcie-ipq9574"; + reg = <0x20000000 0xf1d>, + <0x20000f20 0xa8>, + <0x20001000 0x1000>, + <0x00088000 0x4000>, + <0x20100000 0x1000>; + reg-names = "dbi", "elbi", "atu", "parf", "config"; + + ranges = <0x81000000 0x0 0x20200000 0x20200000 0x0 0x00100000>, + <0x82000000 0x0 0x20300000 0x20300000 0x0 0x07d00000>; + + device_type = "pci"; + linux,pci-domain = <3>; + bus-range = <0x00 0xff>; + num-lanes = <2>; + max-link-speed = <3>; + #address-cells = <3>; + #size-cells = <2>; + + phys = <&pcie2_phy>; + phy-names = "pciephy"; + + interrupts = ; + interrupt-names = "msi"; + + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0x7>; + interrupt-map = <0 0 0 1 &intc 0 0 164 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 2 &intc 0 0 165 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 3 &intc 0 0 186 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 4 &intc 0 0 187 IRQ_TYPE_LEVEL_HIGH>; + + clocks = <&gcc GCC_PCIE2_AXI_M_CLK>, + <&gcc GCC_PCIE2_AXI_S_CLK>, + <&gcc GCC_PCIE2_AXI_S_BRIDGE_CLK>, + <&gcc GCC_ANOC_PCIE2_2LANE_M_CLK>, + <&gcc GCC_SNOC_PCIE2_2LANE_S_CLK>, + <&gcc GCC_PCIE2_RCHNG_CLK>; + clock-names = "axi_m", + "axi_s", + "axi_bridge", + "rchng"; + + resets = <&gcc GCC_PCIE2_PIPE_ARES>, + <&gcc GCC_PCIE2_AUX_ARES>, + <&gcc GCC_PCIE2_CORE_STICKY_ARES>, + <&gcc GCC_PCIE2_AXI_M_ARES>, + <&gcc GCC_PCIE2_AXI_S_ARES>, + <&gcc GCC_PCIE2_AXI_S_STICKY_ARES>, + <&gcc GCC_PCIE2_AXI_M_STICKY_ARES>, + <&gcc GCC_PCIE2_AHB_ARES>; + reset-names = "pipe", + "aux", + "sticky", + "axi_m", + "axi_s", + "axi_s_sticky", + "axi_m_sticky", + "ahb"; + status = "disabled"; + }; + + pcie3: pcie@18000000 { + compatible = "qcom,pcie-ipq9574"; + reg = <0x18000000 0xf1d>, + <0x18000f20 0xa8>, + <0x18001000 0x1000>, + <0x000f0000 0x4000>, + <0x18100000 0x1000>; + reg-names = "dbi", "elbi", "atu", "parf", "config"; + + ranges = <0x81000000 0x0 0x18200000 0x18200000 0x0 0x00100000>, + <0x82000000 0x0 0x18300000 0x18300000 0x0 0x07d00000>; + + device_type = "pci"; + linux,pci-domain = <4>; + bus-range = <0x00 0xff>; + num-lanes = <2>; + max-link-speed = <3>; + #address-cells = <3>; + #size-cells = <2>; + + phys = <&pcie3_phy>; + phy-names = "pciephy"; + + interrupts = ; + interrupt-names = "msi"; + + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 0x7>; + interrupt-map = <0 0 0 1 &intc 0 0 189 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 2 &intc 0 0 190 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 3 &intc 0 0 192 IRQ_TYPE_LEVEL_HIGH>, + <0 0 0 4 &intc 0 0 192 IRQ_TYPE_LEVEL_HIGH>; + + clocks = <&gcc GCC_PCIE3_AXI_M_CLK>, + <&gcc GCC_PCIE3_AXI_S_CLK>, + <&gcc GCC_PCIE3_AXI_S_BRIDGE_CLK>, + <&gcc GCC_ANOC_PCIE3_2LANE_M_CLK>, + <&gcc GCC_SNOC_PCIE3_2LANE_S_CLK>, + <&gcc GCC_PCIE3_RCHNG_CLK>; + clock-names = "axi_m", + "axi_s", + "axi_bridge", + "anoc", + "snoc", + "rchng"; + + resets = <&gcc GCC_PCIE3_PIPE_ARES>, + <&gcc GCC_PCIE3_AUX_ARES>, + <&gcc GCC_PCIE3_CORE_STICKY_ARES>, + <&gcc GCC_PCIE3_AXI_M_ARES>, + <&gcc GCC_PCIE3_AXI_S_ARES>, + <&gcc GCC_PCIE3_AXI_S_STICKY_ARES>, + <&gcc GCC_PCIE3_AXI_M_STICKY_ARES>, + <&gcc GCC_PCIE3_AHB_ARES>; + reset-names = "pipe", + "aux", + "sticky", + "axi_m", + "axi_s", + "axi_s_sticky", + "axi_m_sticky", + "ahb"; + status = "disabled"; + }; }; thermal-zones {