From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtpout-03.galae.net (smtpout-03.galae.net [185.246.85.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 847864219E4 for ; Fri, 27 Feb 2026 14:02:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.246.85.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772200938; cv=none; b=ifV4sNsQQsrMCNxJVg0NxFsFzofCb8fwbL4H96P0Q1jzkXvRadXFwhz/wAjheU23A8RO18oJbKCHk+ghmNTPUfCsG28bnpwnrAhu5/h13rRz176AOhFdabqIry6iU0Ths/T068LLYWX4WQQHfuhwb2rl7s2HXnnLdIRL6y5mfM0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772200938; c=relaxed/simple; bh=NTK3i5tT9QWPEOEZ2JcdNqTuIHC5BhBkEo4P1dG/bNY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=C/9GyPEk7cjhVMBSK3iZx3wsHGvc+2FfS77rSZyFaGv1zf7Wj23H8OUz1cQ7SqvZXuZNBRZ77g6x9Kb6QPL0HkbCrH8NyEQgqhCCw5Ryv6HTnPZr3xRd6TNso5uns/Bh4Fy9EDbA+xq1lD3hfAWX5wa8XdkygrWn1BJA7pKBR5g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=hgPdNY1e; arc=none smtp.client-ip=185.246.85.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="hgPdNY1e" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 5E67F4E418EF; Fri, 27 Feb 2026 14:02:15 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 2950C5FE46; Fri, 27 Feb 2026 14:02:15 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C11261036946A; Fri, 27 Feb 2026 15:01:54 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1772200930; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=dyU2PMsXAmj3EbT2+UZQ+YSlvbKU0N9ZIMJJlxdw490=; b=hgPdNY1epJFmWUUcKpP0uBDbcIe1BWXcfKoYCIpkPBH3z90bmPhZRren578yNJ2SWXn9wQ HYKjIXu/wG09r9j4+wEEHxsJiitX9YM1VEekQODoG7Sr2RrNP3tN1aBkMsIYmjyp9pVK7I aY6BbRf0Tsx8TjcrRrmwajRCf3Ot/kfZAmULFn3YOC2yQOyI2Qmeh7KPYR7IGpVdxNWTEM X+tML3CBs+4vuzfs2ePzNe5QvJPjmpTo1EPNjNq4+xFKHg1ousNpdTIGL1j4lToTWdCeNq bKKNylJ49ukAgvC5Qf0PLuUMJuVj9OiWpWDNJVeV7swyNNxRv96XUTzpfUE5eA== From: Herve Codina To: Andrew Lunn , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Geert Uytterhoeven , Kalle Niemi , Matti Vaittinen , Greg Kroah-Hartman , "Rafael J. Wysocki" , Danilo Krummrich , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Michael Turquette , Stephen Boyd , Andi Shyti , Wolfram Sang , Peter Rosin , Arnd Bergmann , Herve Codina , Saravana Kannan , Bjorn Helgaas , Charles Keepax , Richard Fitzgerald , David Rhodes , Linus Walleij , Ulf Hansson , Mark Brown , Len Brown , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Sakari Ailus , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , Shawn Guo Cc: Wolfram Sang , linux-kernel@vger.kernel.org, driver-core@lists.linux.dev, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, patches@opensource.cirrus.com, linux-gpio@vger.kernel.org, linux-pm@vger.kernel.org, linux-spi@vger.kernel.org, linux-acpi@vger.kernel.org, linux-cxl@vger.kernel.org, Allan Nielsen , Horatiu Vultur , Steen Hegelund , Luca Ceresoli , Thomas Petazzoni Subject: [PATCH v5 25/28] misc: lan966x_pci: Introduce board specific data Date: Fri, 27 Feb 2026 14:54:22 +0100 Message-ID: <20260227135428.783983-26-herve.codina@bootlin.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260227135428.783983-1-herve.codina@bootlin.com> References: <20260227135428.783983-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 Only one device-tree overlay (lan966x_evb_lan9662_nic.dtbo) is handled and this overlay is directly referenced in lan966x_pci_load_overlay(). This avoid to use the code for an other board. In order to be more generic and to allow support for other boards (PCI Vendor/Device IDs), introduce the lan966x_pci_info structure and attach it to PCI Vendor/Device IDs handled by the driver. This structure contains information related to the PCI board such as information related to the dtbo describing the board we have to load. Signed-off-by: Herve Codina Reviewed-by: Andrew Lunn --- drivers/misc/lan966x_pci.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/drivers/misc/lan966x_pci.c b/drivers/misc/lan966x_pci.c index e6d1fce0b116..041e92f924c4 100644 --- a/drivers/misc/lan966x_pci.c +++ b/drivers/misc/lan966x_pci.c @@ -18,10 +18,6 @@ #include #include -/* Embedded dtbo symbols created by cmd_wrap_S_dtb in scripts/Makefile.lib */ -extern char __dtbo_lan966x_evb_lan9662_nic_begin[]; -extern char __dtbo_lan966x_evb_lan9662_nic_end[]; - struct pci_dev_intr_ctrl { struct pci_dev *pci_dev; struct irq_domain *irq_domain; @@ -118,17 +114,23 @@ static int devm_pci_dev_create_intr_ctrl(struct pci_dev *pdev) return devm_add_action_or_reset(&pdev->dev, devm_pci_dev_remove_intr_ctrl, intr_ctrl); } +struct lan966x_pci_info { + void *dtbo_begin; + void *dtbo_end; +}; + struct lan966x_pci { struct device *dev; int ovcs_id; + const struct lan966x_pci_info *info; }; static int lan966x_pci_load_overlay(struct lan966x_pci *data) { - u32 dtbo_size = __dtbo_lan966x_evb_lan9662_nic_end - __dtbo_lan966x_evb_lan9662_nic_begin; - void *dtbo_start = __dtbo_lan966x_evb_lan9662_nic_begin; + const struct lan966x_pci_info *info = data->info; - return of_overlay_fdt_apply(dtbo_start, dtbo_size, &data->ovcs_id, dev_of_node(data->dev)); + return of_overlay_fdt_apply(info->dtbo_begin, info->dtbo_end - info->dtbo_begin, + &data->ovcs_id, dev_of_node(data->dev)); } static void lan966x_pci_unload_overlay(struct lan966x_pci *data) @@ -169,6 +171,9 @@ static int lan966x_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i pci_set_drvdata(pdev, data); data->dev = dev; + data->info = (const struct lan966x_pci_info *)id->driver_data; + if (!data->info) + return -EINVAL; ret = lan966x_pci_load_overlay(data); if (ret) @@ -196,8 +201,17 @@ static void lan966x_pci_remove(struct pci_dev *pdev) lan966x_pci_unload_overlay(data); } +/* Embedded dtbo symbols created by cmd_wrap_S_dtb in scripts/Makefile.lib */ +extern char __dtbo_lan966x_evb_lan9662_nic_begin[]; +extern char __dtbo_lan966x_evb_lan9662_nic_end[]; + +static struct lan966x_pci_info evb_lan9662_nic_info = { + .dtbo_begin = __dtbo_lan966x_evb_lan9662_nic_begin, + .dtbo_end = __dtbo_lan966x_evb_lan9662_nic_end, +}; + static struct pci_device_id lan966x_pci_ids[] = { - { PCI_DEVICE(PCI_VENDOR_ID_EFAR, PCI_DEVICE_ID_EFAR_LAN9662) }, + { PCI_DEVICE_DATA(EFAR, LAN9662, &evb_lan9662_nic_info) }, { } }; MODULE_DEVICE_TABLE(pci, lan966x_pci_ids); -- 2.53.0