From nobody Fri Apr 3 02:58:09 2026 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 A87A43EDAC6; Wed, 25 Mar 2026 14:43:25 +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=1774449809; cv=none; b=t/rjUx71/LuUxAvJrqUd0jKxh8rDXMZrywlwsYPx39EFALpLvBC9TIFMWqwbJjYyigXdpraOllZd+dtZVCLH4kPKS2ZjSDFB49QTngJ38N81Pjg3JtwS2f4mg7F/EeIJqAGs4nYfY+XQs6KIw0v+0eCtI0D3V/45mjGoiGLUWSQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774449809; c=relaxed/simple; bh=NTK3i5tT9QWPEOEZ2JcdNqTuIHC5BhBkEo4P1dG/bNY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u2bDfLdkW3ctjJSYDlpu1pIL+Gd8kJ2oAVFc/JnZIX3bX9d6HiwyFob4zeETnJPt/CoLsYukVqj0HduaAvGxfIhwNA0bU2kdSfdYZ36YqptZQb4iGEfDfrkxwTtS7RaSUGLae9TUr6KkYwBFWMmnLoftjE3vn+3WYX3yZ7qIdzc= 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=eJ4BmFcA; 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="eJ4BmFcA" Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-03.galae.net (Postfix) with ESMTPS id 015BF4E427EF; Wed, 25 Mar 2026 14:43:24 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 9F3A3601FA; Wed, 25 Mar 2026 14:43:23 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 9A1EE10451522; Wed, 25 Mar 2026 15:43:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1774449800; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=dyU2PMsXAmj3EbT2+UZQ+YSlvbKU0N9ZIMJJlxdw490=; b=eJ4BmFcAjAHO1RljChWdOyoj3omI/HuwZmTpXXHQa1umyn9qPlvXMX0qFWHX41OtrKkEA1 GvBSGgfM4yrx92BviPWee8JItzhEODZaOjL49ET1ZPQJiTDPdWu67AmxZcwfgAM7RHexh8 BBfjF9gNBx3YobP5vg27CSbfUTTHQgebXMzwb/Y9URTy9Fp70//V99F42kh0Q7vhs0OoVB ZvGI2Rl+HJieKsxTPvtA4ZlBtkBHUg3o5akZuVa9XdzJTMNomY3mmyUIb3q7OOjh9BmaDO wfp9AO3ccuHOnRdShguOtsQSJoF8butGZEl8ck8Nswog14Pj0jSZOuIP7WrmCw== 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 v6 24/27] misc: lan966x_pci: Introduce board specific data Date: Wed, 25 Mar 2026 15:35:51 +0100 Message-ID: <20260325143555.451852-25-herve.codina@bootlin.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325143555.451852-1-herve.codina@bootlin.com> References: <20260325143555.451852-1-herve.codina@bootlin.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 Content-Type: text/plain; charset="utf-8" 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 =20 -/* 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_d= ev *pdev) return devm_add_action_or_reset(&pdev->dev, devm_pci_dev_remove_intr_ctrl= , intr_ctrl); } =20 +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; }; =20 static int lan966x_pci_load_overlay(struct lan966x_pci *data) { - u32 dtbo_size =3D __dtbo_lan966x_evb_lan9662_nic_end - __dtbo_lan966x_evb= _lan9662_nic_begin; - void *dtbo_start =3D __dtbo_lan966x_evb_lan9662_nic_begin; + const struct lan966x_pci_info *info =3D data->info; =20 - 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)); } =20 static void lan966x_pci_unload_overlay(struct lan966x_pci *data) @@ -169,6 +171,9 @@ static int lan966x_pci_probe(struct pci_dev *pdev, cons= t struct pci_device_id *i =20 pci_set_drvdata(pdev, data); data->dev =3D dev; + data->info =3D (const struct lan966x_pci_info *)id->driver_data; + if (!data->info) + return -EINVAL; =20 ret =3D 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); } =20 +/* 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 =3D { + .dtbo_begin =3D __dtbo_lan966x_evb_lan9662_nic_begin, + .dtbo_end =3D __dtbo_lan966x_evb_lan9662_nic_end, +}; + static struct pci_device_id lan966x_pci_ids[] =3D { - { 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); --=20 2.53.0