{"id":2232035,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2232035/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260502101319.2364052-2-inochiama@gmail.com/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.1/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260502101319.2364052-2-inochiama@gmail.com>","date":"2026-05-02T10:13:14","name":"[1/5] PCI: spacemit-k1: Add device data support","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"1509c0d6dbb05b69172eb8c50eb404337b2d234a","submitter":{"id":89342,"url":"http://patchwork.ozlabs.org/api/1.1/people/89342/?format=json","name":"Inochi Amaoto","email":"inochiama@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260502101319.2364052-2-inochiama@gmail.com/mbox/","series":[{"id":502524,"url":"http://patchwork.ozlabs.org/api/1.1/series/502524/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=502524","date":"2026-05-02T10:13:13","name":"riscv: spacemit: Add PCIe RC controller support for K3","version":1,"mbox":"http://patchwork.ozlabs.org/series/502524/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2232035/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2232035/checks/","tags":{},"headers":{"Return-Path":"\n <linux-pci+bounces-53619-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=r+SDHlH0;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=linux-pci+bounces-53619-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"r+SDHlH0\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.214.172","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com"],"Received":["from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g73fg03MMz1yJw\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 02 May 2026 20:14:18 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 957E63019B8C\n\tfor <incoming@patchwork.ozlabs.org>; Sat,  2 May 2026 10:13:52 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id C813E325726;\n\tSat,  2 May 2026 10:13:48 +0000 (UTC)","from mail-pl1-f172.google.com (mail-pl1-f172.google.com\n [209.85.214.172])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id A22FE324716\n\tfor <linux-pci@vger.kernel.org>; Sat,  2 May 2026 10:13:45 +0000 (UTC)","by mail-pl1-f172.google.com with SMTP id\n d9443c01a7336-2b788a98557so22600295ad.2\n        for <linux-pci@vger.kernel.org>; Sat, 02 May 2026 03:13:45 -0700 (PDT)","from localhost ([2001:19f0:8001:1b2d:5400:5ff:fefa:a95d])\n        by smtp.gmail.com with ESMTPSA id\n d9443c01a7336-2b9cae68476sm45629345ad.80.2026.05.02.03.13.43\n        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n        Sat, 02 May 2026 03:13:43 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1777716828; cv=none;\n b=khFelIQEUjDrg6EZpKoWhakSNDRX7vVd3YP8m4UwGXXO1KPplmQI8GhAiYxqcWsR2QOTeIZnfKybAzs6wb2srLORhLm7weG92vo0UFb6wMQyGMPGmcGzkZWg+20gfLqJe/jjX9jtmmj/UcWyYqDK07TjnLtdnoyHM470YOkpPV8=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1777716828; c=relaxed/simple;\n\tbh=gEjev9liaNaMDJWD4B3vuXkcNGIuaztQH3cR5GkLXz8=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=bwd+1eEx07sMPjdvyOu8/GtAATuvSn9ku5JUuLx2Icu7mewTxJVLv+9IqGE3ESyf4IyJ1cOTUaWxXMJZpW2HgLZPHHCBQtPCFegIQh5jfgLyKDPHUv5UPz/+SG19GTH+EsNPTTzrORj1M792fBZVn2lVxJ/ekWKPm90APQS5iR0=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=r+SDHlH0; arc=none smtp.client-ip=209.85.214.172","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1777716824; x=1778321624;\n darn=vger.kernel.org;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=WcMticRbbnlhc13eC+umkLKNNwt7Hul0SNRld9/CX3o=;\n        b=r+SDHlH0xQkfOXSRpsDx9ariCPBW2itqBHi0j3/5svsATKlEC9QtJzthMWaXtvkn1y\n         IHBoPiPotV6WnoysyPAMsG+aSiTiW2GEg0yksiFgIJ7C22FNtBWTnya99jbtlpG1vaHD\n         TLLUWaDb+xeyAL3fUA7D6YFHfmGrouZFW93RREvi9lfDYNAIqAEw2JIA/LEdz+xu8vSM\n         wsnyAhY2FxxDfws/PlK6gLLCW3P9SsLP9nXAnu82/BNAFiddpZ5bmM7GwERPJqjIOqFW\n         sVP7TTlWd8DHs624Z6KL+CWUeN3KrGZBAkjg6zv/TI/KiOJFpxDnA7IEefThQyUPg8S8\n         hRBw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777716824; x=1778321624;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=WcMticRbbnlhc13eC+umkLKNNwt7Hul0SNRld9/CX3o=;\n        b=saZyEQKVVq+TuiFikhEYrNRzBP6L2RuBG0a2M2GVuaxYOenNBsS2D5TaOt6OC4BO+8\n         PDuenfM+Cmv6z49XAaIwtU40krOVqUMu7XPl5i6xcGy8h2Rrh2uUnxgstsyYkCZxLMhl\n         tYnFl2BPDEKgA5azBQ3McYtpAgjIPNz09N5pUfbgCShnCw03NdiqMIAIcurA45jg0K1/\n         +0iiwMvdzzbCH0VKxx9NpJOF+fnSq+WFc4Vk60nmVsGYIYNc8fVHe4TjRiSCJb3HaVQC\n         yE9fVaryiy2M8JdFionLOLG/IDydwyQHMYHGRY2rk1Re35PnyIlYemW12seR5mj/KbxG\n         bt7Q==","X-Gm-Message-State":"AOJu0YwNB8IkYFGHrd8zrwqXvdkszv2wM86keF1unhuLG9H5DFObJIhI\n\tC3zay5K1NBqjbfBEhXG3mlR+jQQpxlu2aAGSIkbdr0nJhoKxj3SbVNFr","X-Gm-Gg":"AeBDietBmqQeMJBhVXYhcbIBhCfRxqoCWt+9QyBDifIJf4rWy1UQYDUjk2usGfklTLH\n\tah49o4eRpU3V9laUd8bmcwyZC8HW5lGlrygKsAUezVIAn012inMNZmesmaulu7LCGhbI33cgTVW\n\tTcX6B4K5MXJlg+1ld8kZRc27kuFYOjkLHG/eKxXATlgrZqWVDu99wHaT/vXNTgACOhHck452nnp\n\t5tNrqrCNpP6ti27Ex7NEpPB3Xjk5CjBxtVi3/7KjWc7I+HDAsnzN0ThbfTnen9ovkvlDoGHJCSV\n\tyUZiW4KpsaGrbusYwSj+vx6h7ZF5x03rMw75vmtJRMxTXGBAvioprOZAAvSMbPbVoq+kjMI7RAM\n\tNzxw4SNu9TXhWU/QL2aOG4e+vIJmoWlkhOEvuIcInGQOtoZClWYotRCQJlQXF/aTGL8G2C3j/xi\n\tOqcYAs7QTnRaOsOZWjtHgGvetARuQiHnpY/g==","X-Received":"by 2002:a17:903:2ecc:b0:2b2:4dd2:dcf5 with SMTP id\n d9443c01a7336-2b9f260b757mr24434785ad.20.1777716824197;\n        Sat, 02 May 2026 03:13:44 -0700 (PDT)","From":"Inochi Amaoto <inochiama@gmail.com>","To":"Jingoo Han <jingoohan1@gmail.com>,\n Manivannan Sadhasivam <mani@kernel.org>, Bjorn Helgaas <bhelgaas@google.com>,\n Lorenzo Pieralisi <lpieralisi@kernel.org>, =?utf-8?q?Krzysztof_Wilczy=C5=84?=\n\t=?utf-8?q?ski?= <kwilczynski@kernel.org>, Rob Herring <robh@kernel.org>,\n Krzysztof Kozlowski <krzk+dt@kernel.org>, Conor Dooley <conor+dt@kernel.org>,\n Yixun Lan <dlan@kernel.org>, Paul Walmsley <pjw@kernel.org>,\n Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>,\n Alexandre Ghiti <alex@ghiti.fr>, Inochi Amaoto <inochiama@gmail.com>,\n Alex Elder <elder@riscstar.com>,\n Gustavo Pimentel <gustavo.pimentel@synopsys.com>","Cc":"linux-pci@vger.kernel.org,\n\tdevicetree@vger.kernel.org,\n\tlinux-kernel@vger.kernel.org,\n\tlinux-riscv@lists.infradead.org,\n\tspacemit@lists.linux.dev,\n\tYixun Lan <dlan@gentoo.org>,\n\tLongbin Li <looong.bin@gmail.com>","Subject":"[PATCH 1/5] PCI: spacemit-k1: Add device data support","Date":"Sat,  2 May 2026 18:13:14 +0800","Message-ID":"<20260502101319.2364052-2-inochiama@gmail.com>","X-Mailer":"git-send-email 2.54.0","In-Reply-To":"<20260502101319.2364052-1-inochiama@gmail.com>","References":"<20260502101319.2364052-1-inochiama@gmail.com>","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"To reuse the K1 PCIe driver logic for K3 PCIe controller, add device\ndata to handle the K1 specific logic and make room for the incoming\nlogic for K3.\n\nSigned-off-by: Inochi Amaoto <inochiama@gmail.com>\n---\n drivers/pci/controller/dwc/pcie-spacemit-k1.c | 35 ++++++++++++++++---\n 1 file changed, 31 insertions(+), 4 deletions(-)","diff":"diff --git a/drivers/pci/controller/dwc/pcie-spacemit-k1.c b/drivers/pci/controller/dwc/pcie-spacemit-k1.c\nindex be20a520255b..cd3cd038ad2b 100644\n--- a/drivers/pci/controller/dwc/pcie-spacemit-k1.c\n+++ b/drivers/pci/controller/dwc/pcie-spacemit-k1.c\n@@ -57,6 +57,13 @@ struct k1_pcie {\n \tu32 pmu_off;\n };\n \n+struct k1_pcie_device_data {\n+\tconst struct dw_pcie_host_ops *host_ops;\n+\tconst struct dw_pcie_ops *ops;\n+\tint (*parse_port)(struct k1_pcie *k1);\n+\tint (*post_init)(struct k1_pcie *k1);\n+};\n+\n #define to_k1_pcie(dw_pcie) \\\n \t\tplatform_get_drvdata(to_platform_device((dw_pcie)->dev))\n \n@@ -278,10 +285,15 @@ static int k1_pcie_parse_port(struct k1_pcie *k1)\n \n static int k1_pcie_probe(struct platform_device *pdev)\n {\n+\tconst struct k1_pcie_device_data *data;\n \tstruct device *dev = &pdev->dev;\n \tstruct k1_pcie *k1;\n \tint ret;\n \n+\tdata = device_get_match_data(dev);\n+\tif (!data)\n+\t\treturn -ENODEV;\n+\n \tk1 = devm_kzalloc(dev, sizeof(*k1), GFP_KERNEL);\n \tif (!k1)\n \t\treturn -ENOMEM;\n@@ -299,11 +311,11 @@ static int k1_pcie_probe(struct platform_device *pdev)\n \t\t\t\t     \"failed to map \\\"link\\\" registers\\n\");\n \n \tk1->pci.dev = dev;\n-\tk1->pci.ops = &k1_pcie_ops;\n+\tk1->pci.ops = data->ops;\n \tk1->pci.pp.num_vectors = MAX_MSI_IRQS;\n \tdw_pcie_cap_set(&k1->pci, REQ_RES);\n \n-\tk1->pci.pp.ops = &k1_pcie_host_ops;\n+\tk1->pci.pp.ops = data->host_ops;\n \n \t/* Hold the PHY in reset until we start the link */\n \tregmap_set_bits(k1->pmu, k1->pmu_off + PCIE_CLK_RESET_CONTROL,\n@@ -320,7 +332,7 @@ static int k1_pcie_probe(struct platform_device *pdev)\n \n \tplatform_set_drvdata(pdev, k1);\n \n-\tret = k1_pcie_parse_port(k1);\n+\tret = data->parse_port(k1);\n \tif (ret)\n \t\treturn dev_err_probe(dev, ret, \"failed to parse root port\\n\");\n \n@@ -328,6 +340,15 @@ static int k1_pcie_probe(struct platform_device *pdev)\n \tif (ret)\n \t\treturn dev_err_probe(dev, ret, \"failed to initialize host\\n\");\n \n+\tif (data->post_init) {\n+\t\tret = data->post_init(k1);\n+\t\tif (ret) {\n+\t\t\tdw_pcie_host_deinit(&k1->pci.pp);\n+\t\t\treturn dev_err_probe(dev, ret,\n+\t\t\t\t\t     \"Failed to post init\\n\");\n+\t\t}\n+\t}\n+\n \treturn 0;\n }\n \n@@ -338,8 +359,14 @@ static void k1_pcie_remove(struct platform_device *pdev)\n \tdw_pcie_host_deinit(&k1->pci.pp);\n }\n \n+static const struct k1_pcie_device_data k1_pcie_device_data = {\n+\t.host_ops\t= &k1_pcie_host_ops,\n+\t.ops\t\t= &k1_pcie_ops,\n+\t.parse_port\t= k1_pcie_parse_port,\n+};\n+\n static const struct of_device_id k1_pcie_of_match_table[] = {\n-\t{ .compatible = \"spacemit,k1-pcie\", },\n+\t{ .compatible = \"spacemit,k1-pcie\", .data = &k1_pcie_device_data},\n \t{ }\n };\n \n","prefixes":["1/5"]}