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: Allow for Multi-Bus Instances

Add support for MIPI I3C Host Controllers with the Multi-Bus Instance
capability. These controllers can host multiple I3C buses (up to 15)
within a single hardware function (e.g., PCIe B/D/F), providing one
indepedent HCI register set and corresponding I3C bus controller logic
per bus.

A separate platform device will represent each instance, but it is
necessary to allow for shared resources.

Multi-bus instances share the same MMIO address space, but the ranges are
not guaranteed to be contiguous. To avoid overlapping mappings, pass
base_regs from the parent mapping to child devices.

Allow the IRQ to be shared among instances.

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

authored by

Adrian Hunter and committed by
Alexandre Belloni
b8460480 35c0bfe8

+32 -4
+17 -4
drivers/i3c/master/mipi-i3c-hci/core.c
··· 14 14 #include <linux/interrupt.h> 15 15 #include <linux/iopoll.h> 16 16 #include <linux/module.h> 17 + #include <linux/platform_data/mipi-i3c-hci.h> 17 18 #include <linux/platform_device.h> 18 19 19 20 #include "hci.h" ··· 738 737 739 738 static int i3c_hci_probe(struct platform_device *pdev) 740 739 { 740 + const struct mipi_i3c_hci_platform_data *pdata = pdev->dev.platform_data; 741 741 struct i3c_hci *hci; 742 742 int irq, ret; 743 743 744 744 hci = devm_kzalloc(&pdev->dev, sizeof(*hci), GFP_KERNEL); 745 745 if (!hci) 746 746 return -ENOMEM; 747 - hci->base_regs = devm_platform_ioremap_resource(pdev, 0); 748 - if (IS_ERR(hci->base_regs)) 749 - return PTR_ERR(hci->base_regs); 747 + 748 + /* 749 + * Multi-bus instances share the same MMIO address range, but not 750 + * necessarily in separate contiguous sub-ranges. To avoid overlapping 751 + * mappings, provide base_regs from the parent mapping. 752 + */ 753 + if (pdata) 754 + hci->base_regs = pdata->base_regs; 755 + 756 + if (!hci->base_regs) { 757 + hci->base_regs = devm_platform_ioremap_resource(pdev, 0); 758 + if (IS_ERR(hci->base_regs)) 759 + return PTR_ERR(hci->base_regs); 760 + } 750 761 751 762 platform_set_drvdata(pdev, hci); 752 763 /* temporary for dev_printk's, to be replaced in i3c_master_register */ ··· 772 759 773 760 irq = platform_get_irq(pdev, 0); 774 761 ret = devm_request_irq(&pdev->dev, irq, i3c_hci_irq_handler, 775 - 0, NULL, hci); 762 + IRQF_SHARED, NULL, hci); 776 763 if (ret) 777 764 return ret; 778 765
+15
include/linux/platform_data/mipi-i3c-hci.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + #ifndef INCLUDE_PLATFORM_DATA_MIPI_I3C_HCI_H 3 + #define INCLUDE_PLATFORM_DATA_MIPI_I3C_HCI_H 4 + 5 + #include <linux/compiler_types.h> 6 + 7 + /** 8 + * struct mipi_i3c_hci_platform_data - Platform-dependent data for mipi_i3c_hci 9 + * @base_regs: Register set base address (to support multi-bus instances) 10 + */ 11 + struct mipi_i3c_hci_platform_data { 12 + void __iomem *base_regs; 13 + }; 14 + 15 + #endif