Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

i3c: mipi-i3c-hci-pci: Assign unique device names and IDs for Intel LPSS I3C

Simplify the code and ensure names and IDs align with device documentation.
Use explicit device names and IDs for Intel LPSS I3C controllers instead of
dynamically allocated values.

Add "intel-lpss-i3c" to the platform_device_id table in the mipi-i3c-hci
driver and use the same name for Intel I3C controllers in the
mipi_i3c_hci_pci driver. Assign hard-coded IDs to reflect the hardware
layout.

Intel SoCs include two I3C PCI devices in the Low Power Subsystem (LPSS),
each supporting up to two I3C buses. The second PCI device is assigned ID 2
(not 1) to match this topology. Additional IDs will be introduced when
Multi-Bus Instance support is implemented.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260106164416.67074-7-adrian.hunter@intel.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Adrian Hunter and committed by
Alexandre Belloni
35c0bfe8 b43181b7

+30 -20
+7
drivers/i3c/master/mipi-i3c-hci/core.c
··· 790 790 }; 791 791 MODULE_DEVICE_TABLE(acpi, i3c_hci_acpi_match); 792 792 793 + static const struct platform_device_id i3c_hci_driver_ids[] = { 794 + { .name = "intel-lpss-i3c" }, 795 + { /* sentinel */ } 796 + }; 797 + MODULE_DEVICE_TABLE(platform, i3c_hci_driver_ids); 798 + 793 799 static struct platform_driver i3c_hci_driver = { 794 800 .probe = i3c_hci_probe, 795 801 .remove = i3c_hci_remove, 802 + .id_table = i3c_hci_driver_ids, 796 803 .driver = { 797 804 .name = "mipi-i3c-hci", 798 805 .of_match_table = of_match_ptr(i3c_hci_of_match),
+23 -20
drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c
··· 27 27 struct mipi_i3c_hci_pci_info { 28 28 int (*init)(struct mipi_i3c_hci_pci *hci); 29 29 void (*exit)(struct mipi_i3c_hci_pci *hci); 30 + const char *name; 31 + int id; 30 32 }; 31 - 32 - static DEFINE_IDA(mipi_i3c_hci_pci_ida); 33 33 34 34 #define INTEL_PRIV_OFFSET 0x2b0 35 35 #define INTEL_PRIV_SIZE 0x28 ··· 179 179 intel_ltr_hide(&hci->pci->dev); 180 180 } 181 181 182 - static const struct mipi_i3c_hci_pci_info intel_info = { 182 + static const struct mipi_i3c_hci_pci_info intel_1_info = { 183 183 .init = intel_i3c_init, 184 184 .exit = intel_i3c_exit, 185 + .name = "intel-lpss-i3c", 186 + .id = 0, 187 + }; 188 + 189 + static const struct mipi_i3c_hci_pci_info intel_2_info = { 190 + .init = intel_i3c_init, 191 + .exit = intel_i3c_exit, 192 + .name = "intel-lpss-i3c", 193 + .id = 2, 185 194 }; 186 195 187 196 static int mipi_i3c_hci_pci_probe(struct pci_dev *pci, ··· 198 189 { 199 190 struct mipi_i3c_hci_pci *hci; 200 191 struct resource res[2]; 201 - int dev_id, ret; 192 + int ret; 202 193 203 194 hci = devm_kzalloc(&pci->dev, sizeof(*hci), GFP_KERNEL); 204 195 if (!hci) ··· 226 217 res[1].start = pci_irq_vector(hci->pci, 0); 227 218 res[1].end = res[1].start; 228 219 229 - dev_id = ida_alloc(&mipi_i3c_hci_pci_ida, GFP_KERNEL); 230 - if (dev_id < 0) 231 - return dev_id; 220 + hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data; 232 221 233 - hci->pdev = platform_device_alloc("mipi-i3c-hci", dev_id); 222 + hci->pdev = platform_device_alloc(hci->info->name, hci->info->id); 234 223 if (!hci->pdev) 235 224 return -ENOMEM; 236 225 ··· 239 232 if (ret) 240 233 goto err; 241 234 242 - hci->info = (const struct mipi_i3c_hci_pci_info *)id->driver_data; 243 235 if (hci->info->init) { 244 236 ret = hci->info->init(hci); 245 237 if (ret) ··· 258 252 hci->info->exit(hci); 259 253 err: 260 254 platform_device_put(hci->pdev); 261 - ida_free(&mipi_i3c_hci_pci_ida, dev_id); 262 255 return ret; 263 256 } 264 257 ··· 265 260 { 266 261 struct mipi_i3c_hci_pci *hci = pci_get_drvdata(pci); 267 262 struct platform_device *pdev = hci->pdev; 268 - int dev_id = pdev->id; 269 263 270 264 if (hci->info->exit) 271 265 hci->info->exit(hci); 272 266 273 267 platform_device_unregister(pdev); 274 - ida_free(&mipi_i3c_hci_pci_ida, dev_id); 275 268 } 276 269 277 270 static const struct pci_device_id mipi_i3c_hci_pci_devices[] = { 278 271 /* Wildcat Lake-U */ 279 - { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_info}, 280 - { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_info}, 272 + { PCI_VDEVICE(INTEL, 0x4d7c), (kernel_ulong_t)&intel_1_info}, 273 + { PCI_VDEVICE(INTEL, 0x4d6f), (kernel_ulong_t)&intel_2_info}, 281 274 /* Panther Lake-H */ 282 - { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_info}, 283 - { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_info}, 275 + { PCI_VDEVICE(INTEL, 0xe37c), (kernel_ulong_t)&intel_1_info}, 276 + { PCI_VDEVICE(INTEL, 0xe36f), (kernel_ulong_t)&intel_2_info}, 284 277 /* Panther Lake-P */ 285 - { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_info}, 286 - { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_info}, 278 + { PCI_VDEVICE(INTEL, 0xe47c), (kernel_ulong_t)&intel_1_info}, 279 + { PCI_VDEVICE(INTEL, 0xe46f), (kernel_ulong_t)&intel_2_info}, 287 280 /* Nova Lake-S */ 288 - { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_info}, 289 - { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_info}, 281 + { PCI_VDEVICE(INTEL, 0x6e2c), (kernel_ulong_t)&intel_1_info}, 282 + { PCI_VDEVICE(INTEL, 0x6e2d), (kernel_ulong_t)&intel_2_info}, 290 283 { }, 291 284 }; 292 285 MODULE_DEVICE_TABLE(pci, mipi_i3c_hci_pci_devices);