From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B32ACAC585 for ; Tue, 17 Sep 2024 15:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iCYHskEI+GQ9Ix+yOkIDZ3w1IkWzSol0a0DLeDR1+R0=; b=Jy11NfS2gD+u3Z87DLihnhyREl 5PDxOEr8QPRHJiSsjcLr2ffEO+GlpYGI/4epdrGoq/znK/WCM3kPpvVgvHJnRYzn5UVGzqwGSljm/ p9U9b2a5QI5TtK26MCT3AtrioHsATdEfU7xV3n0VQhBFk1xzZiB45/Lhrr5LWp5BsmLFbixjYGnRg G0j0aXxCg5TAP2iUliF6CBlYsY1n/AmUuDdQw/zKogtkcJOTMSDRvsNg/vqlY3TqrsaOk0rnpHGua 30y1l9HGm7l5gmPbfAOwuIUpke4O9WvhIs7EZthRfzO25hWyVwtdydVSocLL99nfAu1bgyCrpLUiH pMJ0evLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sqZrG-00000006MYV-2hYT; Tue, 17 Sep 2024 15:11:14 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sqZqA-00000006MVV-413j for linux-arm-kernel@lists.infradead.org; Tue, 17 Sep 2024 15:10:08 +0000 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-718e11e4186so5497522b3a.2 for ; Tue, 17 Sep 2024 08:10:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1726585805; x=1727190605; darn=lists.infradead.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=iCYHskEI+GQ9Ix+yOkIDZ3w1IkWzSol0a0DLeDR1+R0=; b=Tjpjz+DB9AEWRmGA3UOd/Em33+Vz/g0d8MhioMZ+jAV4gPfpUNrAoemSL5URd/v95H QT6gS4xfILdn6eVAsxO5TkN90IVFHEyXiqsD8iN0LVJAXvwI/nzVsxtJwzqCgfzyiTta IKKfSx5W37iiDlEGBmMq9IHpDFi8TWbTm+Mw+BL/PTppC8poNIaPEmx0mQt8UskKsgc6 WUL5C6zXmtfFLhKhA7JBW0+AKwSest0DeFo5X+KJukpUKnayL9ZGC9oIB8kIkCvVzGjU H6hG9T5UMDmxIkMidnOS+fnl7IUz7dRi4PnUVD6niUtssnvxlHYR8qI3Rd34cUWdRtqh 7pWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726585805; x=1727190605; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=iCYHskEI+GQ9Ix+yOkIDZ3w1IkWzSol0a0DLeDR1+R0=; b=Uj7v5M2Vp038CMEyzbhm6u012+IWHMvN8ZibFlVn0G771XgzgaTAPcQn3FQNPN+Vwb lRA0k4xSqzmrgwM3xkIP+w3QI1FmpF2FodysWWbHg+4+00nUChcXbPuYAOK3PcNBT00Y 92QsK7Go8vvAQuyHeug4SZ61I88LRxlgkl2rruiHr9aSkCZMJm5G4IQWGycUsFjic8NR tHsUGY7HEkxZD9OvL7nQA4gFyjMpe0k8w2iUGc1aceT02AbvZwbwegvOLBbG2ho7LvNu zMMMaUURzTLjaNV22rqoOEsLLukyBjst9AECro5K5lIBBvjJe/I6Uzxdq3UB92rrQIgr 3Vcg== X-Forwarded-Encrypted: i=1; AJvYcCWoaEM/PzVsAXctrUbOAETdad7esilhEp6fIviL7npIToQF2iHB7x+OgyAi6hnQHOs2vWI4qFSY+W81KS0Hx1AB@lists.infradead.org X-Gm-Message-State: AOJu0YyLZHIEKYsV+OqMHIwHctM5rSp+HXR7P6+dw6/ZkFrm4w/gSG3A q1WWDk9yJ44jcr0yrFG3hkonY9LJEBDLwJkkCwjKZhOzrMN5DoWpgHBp2ymdIQ== X-Google-Smtp-Source: AGHT+IFLZcWjrqjoZmsI4ZpaPNRFceD/PPRyGcVrqh1UCItMr9SJpLdCzWP/+3tdf5QVyfDeA87z/g== X-Received: by 2002:a05:6a20:8420:b0:1cf:d745:d641 with SMTP id adf61e73a8af0-1cfd745d677mr30630257637.18.1726585804735; Tue, 17 Sep 2024 08:10:04 -0700 (PDT) Received: from thinkpad ([103.174.21.175]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7db49911546sm5948153a12.40.2024.09.17.08.10.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 08:10:04 -0700 (PDT) Date: Tue, 17 Sep 2024 20:39:59 +0530 From: Manivannan Sadhasivam To: Thippeswamy Havalige Cc: robh@kernel.org, linux-pci@vger.kernel.org, bhelgaas@google.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org, bharat.kumar.gogada@amd.com, michal.simek@amd.com, lpieralisi@kernel.org, kw@linux.com Subject: Re: [PATCH v2 2/2] PCI: xilinx-cpm: Add support for Versal CPM5 Root Port controller 1 Message-ID: <20240917150959.3fsytm4xguoit2xd@thinkpad> References: <20240916163748.2223815-1-thippesw@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240916163748.2223815-1-thippesw@amd.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240917_081007_040263_49745DC9 X-CRM114-Status: GOOD ( 36.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 16, 2024 at 10:07:48PM +0530, Thippeswamy Havalige wrote: For some reason, this patch is not threaded and not part of the series: [PATCH v2 0/2] Add support for CPM5 controller 1 > This patch adds support for the Xilinx Versal CPM5 Root Port Controller 1. s/patch/commit Once this patch gets merged, it will become a commit. > The key difference between Controller 0 and Controller 1 lies in the > platform-specific error interrupt bits, which are located at different > register offsets. > > To handle these differences, a variant structure is introduced that holds > the following platform-specific details: > The variant structure is already present in the driver. Hence not introduced in *this* patch. > - Interrupt status register offset (ir_status) > - Interrupt enable register offset (ir_enable) > - Miscellaneous interrupt values (ir_misc_value) > > The driver differentiates between Controller 0 and Controller 1 using the > compatible string in the device tree. This ensures that the appropriate > register offsets are used for each controller, allowing for correct > handling of platform-specific interrupts and initialization. > > Signed-off-by: Thippeswamy Havalige > --- > changes in v2: > -------------- > 1. Introduced new constants for Controller 1. > 2. Extended the xilinx_cpm_variant structure to support > a. ir_status, > b. ir_enable, and > c. ir_misc_value for different controllers. > 3. Updated IRQ handling and initialization to use the variant structure. > 4. Added a new device tree match entry for Controller 1. > --- > drivers/pci/controller/pcie-xilinx-cpm.c | 47 ++++++++++++++++++------ > 1 file changed, 36 insertions(+), 11 deletions(-) > > diff --git a/drivers/pci/controller/pcie-xilinx-cpm.c b/drivers/pci/controller/pcie-xilinx-cpm.c > index a0f5e1d67b04..b783fff27c9d 100644 > --- a/drivers/pci/controller/pcie-xilinx-cpm.c > +++ b/drivers/pci/controller/pcie-xilinx-cpm.c > @@ -30,11 +30,14 @@ > #define XILINX_CPM_PCIE_REG_IDRN_MASK 0x00000E3C > #define XILINX_CPM_PCIE_MISC_IR_STATUS 0x00000340 > #define XILINX_CPM_PCIE_MISC_IR_ENABLE 0x00000348 > -#define XILINX_CPM_PCIE_MISC_IR_LOCAL BIT(1) > +#define XILINX_CPM_PCIE0_MISC_IR_LOCAL BIT(1) > +#define XILINX_CPM_PCIE1_MISC_IR_LOCAL BIT(2) > > -#define XILINX_CPM_PCIE_IR_STATUS 0x000002A0 > -#define XILINX_CPM_PCIE_IR_ENABLE 0x000002A8 > -#define XILINX_CPM_PCIE_IR_LOCAL BIT(0) > +#define XILINX_CPM_PCIE0_IR_STATUS 0x000002A0 > +#define XILINX_CPM_PCIE1_IR_STATUS 0x000002B4 > +#define XILINX_CPM_PCIE0_IR_ENABLE 0x000002A8 > +#define XILINX_CPM_PCIE1_IR_ENABLE 0x000002BC > +#define XILINX_CPM_PCIE_IR_LOCAL BIT(0) > > #define IMR(x) BIT(XILINX_PCIE_INTR_ ##x) > > @@ -80,6 +83,7 @@ > enum xilinx_cpm_version { > CPM, > CPM5, > + CPM5_HOST1, > }; > > /** > @@ -88,6 +92,9 @@ enum xilinx_cpm_version { > */ > struct xilinx_cpm_variant { > enum xilinx_cpm_version version; > + u32 ir_status; > + u32 ir_enable; > + u32 ir_misc_value; Kdoc comments missing for these members. > }; > > /** > @@ -269,6 +276,7 @@ static void xilinx_cpm_pcie_event_flow(struct irq_desc *desc) > { > struct xilinx_cpm_pcie *port = irq_desc_get_handler_data(desc); > struct irq_chip *chip = irq_desc_get_chip(desc); > + const struct xilinx_cpm_variant *variant = port->variant; > unsigned long val; > int i; > > @@ -279,11 +287,11 @@ static void xilinx_cpm_pcie_event_flow(struct irq_desc *desc) > generic_handle_domain_irq(port->cpm_domain, i); > pcie_write(port, val, XILINX_CPM_PCIE_REG_IDR); > > - if (port->variant->version == CPM5) { > - val = readl_relaxed(port->cpm_base + XILINX_CPM_PCIE_IR_STATUS); > + if (variant->ir_status) { > + val = readl_relaxed(port->cpm_base + variant->ir_status); > if (val) > writel_relaxed(val, port->cpm_base + > - XILINX_CPM_PCIE_IR_STATUS); > + variant->ir_status); > } > > /* > @@ -465,6 +473,8 @@ static int xilinx_cpm_setup_irq(struct xilinx_cpm_pcie *port) > */ > static void xilinx_cpm_pcie_init_port(struct xilinx_cpm_pcie *port) > { > + const struct xilinx_cpm_variant *variant = port->variant; > + > if (cpm_pcie_link_up(port)) > dev_info(port->dev, "PCIe Link is UP\n"); > else > @@ -483,15 +493,15 @@ static void xilinx_cpm_pcie_init_port(struct xilinx_cpm_pcie *port) > * XILINX_CPM_PCIE_MISC_IR_ENABLE register is mapped to > * CPM SLCR block. > */ > - writel(XILINX_CPM_PCIE_MISC_IR_LOCAL, > + writel(variant->ir_misc_value, > port->cpm_base + XILINX_CPM_PCIE_MISC_IR_ENABLE); > > - if (port->variant->version == CPM5) { > + if (variant->ir_enable) { > writel(XILINX_CPM_PCIE_IR_LOCAL, > - port->cpm_base + XILINX_CPM_PCIE_IR_ENABLE); > + port->cpm_base + variant->ir_enable); > } > > - /* Enable the Bridge enable bit */ > + /* Set Bridge enable bit */ This changes doesn't belong to this patch. > pcie_write(port, pcie_read(port, XILINX_CPM_PCIE_REG_RPSC) | > XILINX_CPM_PCIE_REG_RPSC_BEN, > XILINX_CPM_PCIE_REG_RPSC); > @@ -609,10 +619,21 @@ static int xilinx_cpm_pcie_probe(struct platform_device *pdev) > > static const struct xilinx_cpm_variant cpm_host = { > .version = CPM, > + .ir_misc_value = XILINX_CPM_PCIE0_MISC_IR_LOCAL, > }; > > static const struct xilinx_cpm_variant cpm5_host = { > .version = CPM5, > + .ir_misc_value = XILINX_CPM_PCIE0_MISC_IR_LOCAL, > + .ir_status = XILINX_CPM_PCIE0_IR_STATUS, > + .ir_enable = XILINX_CPM_PCIE0_IR_ENABLE, > +}; > + > +static const struct xilinx_cpm_variant cpm5_host1 = { > + .version = CPM5_HOST1, > + .ir_misc_value = XILINX_CPM_PCIE1_MISC_IR_LOCAL, > + .ir_status = XILINX_CPM_PCIE1_IR_STATUS, > + .ir_enable = XILINX_CPM_PCIE1_IR_ENABLE, > }; > > static const struct of_device_id xilinx_cpm_pcie_of_match[] = { > @@ -624,6 +645,10 @@ static const struct of_device_id xilinx_cpm_pcie_of_match[] = { > .compatible = "xlnx,versal-cpm5-host", > .data = &cpm5_host, > }, > + { > + .compatible = "xlnx,versal-cpm5-host1-1", This doesn't look like a valid compatible name. Please use the compatible as per the IP version. - Mani -- மணிவண்ணன் சதாசிவம்