Skip to content

Commit 44cefdf

Browse files
committed
Merge tag 'mhi-for-v6.14' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mani/mhi into char-misc-next
Pull MHI update from Manivannan: MHI Host ======== - Free the "img_info::mhi_buf" in the error path of mhi_alloc_bhie_table() to avoid memory leak. - Add support for Qualcomm X100 5G RAN Accelerator card with relevant channel and event config. - Enable MSI-X if the endpoint supports. * tag 'mhi-for-v6.14' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mani/mhi: bus: mhi: host: pci_generic: Enable MSI-X if the endpoint supports bus: mhi: host: pci_generic: Add support for QDU100 device bus: mhi: host: Free mhi_buf vector inside mhi_alloc_bhie_table()
2 parents 6d699ca + 29904a4 commit 44cefdf

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

drivers/bus/mhi/host/boot.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl,
357357
for (--i, --mhi_buf; i >= 0; i--, mhi_buf--)
358358
dma_free_coherent(mhi_cntrl->cntrl_dev, mhi_buf->len,
359359
mhi_buf->buf, mhi_buf->dma_addr);
360+
kfree(img_info->mhi_buf);
360361

361362
error_alloc_mhi_buf:
362363
kfree(img_info);

drivers/bus/mhi/host/pci_generic.c

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,58 @@ struct mhi_pci_dev_info {
245245
.channel = ch_num, \
246246
}
247247

248+
static const struct mhi_channel_config mhi_qcom_qdu100_channels[] = {
249+
MHI_CHANNEL_CONFIG_UL(0, "LOOPBACK", 32, 2),
250+
MHI_CHANNEL_CONFIG_DL(1, "LOOPBACK", 32, 2),
251+
MHI_CHANNEL_CONFIG_UL_SBL(2, "SAHARA", 128, 1),
252+
MHI_CHANNEL_CONFIG_DL_SBL(3, "SAHARA", 128, 1),
253+
MHI_CHANNEL_CONFIG_UL(4, "DIAG", 64, 3),
254+
MHI_CHANNEL_CONFIG_DL(5, "DIAG", 64, 3),
255+
MHI_CHANNEL_CONFIG_UL(9, "QDSS", 64, 3),
256+
MHI_CHANNEL_CONFIG_UL(14, "NMEA", 32, 4),
257+
MHI_CHANNEL_CONFIG_DL(15, "NMEA", 32, 4),
258+
MHI_CHANNEL_CONFIG_UL(16, "CSM_CTRL", 32, 4),
259+
MHI_CHANNEL_CONFIG_DL(17, "CSM_CTRL", 32, 4),
260+
MHI_CHANNEL_CONFIG_UL(40, "MHI_PHC", 32, 4),
261+
MHI_CHANNEL_CONFIG_DL(41, "MHI_PHC", 32, 4),
262+
MHI_CHANNEL_CONFIG_UL(46, "IP_SW0", 256, 5),
263+
MHI_CHANNEL_CONFIG_DL(47, "IP_SW0", 256, 5),
264+
};
265+
266+
static struct mhi_event_config mhi_qcom_qdu100_events[] = {
267+
/* first ring is control+data ring */
268+
MHI_EVENT_CONFIG_CTRL(0, 64),
269+
/* SAHARA dedicated event ring */
270+
MHI_EVENT_CONFIG_SW_DATA(1, 256),
271+
/* Software channels dedicated event ring */
272+
MHI_EVENT_CONFIG_SW_DATA(2, 64),
273+
MHI_EVENT_CONFIG_SW_DATA(3, 256),
274+
MHI_EVENT_CONFIG_SW_DATA(4, 256),
275+
/* Software IP channels dedicated event ring */
276+
MHI_EVENT_CONFIG_SW_DATA(5, 512),
277+
MHI_EVENT_CONFIG_SW_DATA(6, 512),
278+
MHI_EVENT_CONFIG_SW_DATA(7, 512),
279+
};
280+
281+
static const struct mhi_controller_config mhi_qcom_qdu100_config = {
282+
.max_channels = 128,
283+
.timeout_ms = 120000,
284+
.num_channels = ARRAY_SIZE(mhi_qcom_qdu100_channels),
285+
.ch_cfg = mhi_qcom_qdu100_channels,
286+
.num_events = ARRAY_SIZE(mhi_qcom_qdu100_events),
287+
.event_cfg = mhi_qcom_qdu100_events,
288+
};
289+
290+
static const struct mhi_pci_dev_info mhi_qcom_qdu100_info = {
291+
.name = "qcom-qdu100",
292+
.fw = "qcom/qdu100/xbl_s.melf",
293+
.edl_trigger = true,
294+
.config = &mhi_qcom_qdu100_config,
295+
.bar_num = MHI_PCI_DEFAULT_BAR_NUM,
296+
.dma_data_width = 32,
297+
.sideband_wake = false,
298+
};
299+
248300
static const struct mhi_channel_config modem_qcom_v1_mhi_channels[] = {
249301
MHI_CHANNEL_CONFIG_UL(4, "DIAG", 16, 1),
250302
MHI_CHANNEL_CONFIG_DL(5, "DIAG", 16, 1),
@@ -742,6 +794,9 @@ static const struct pci_device_id mhi_pci_id_table[] = {
742794
.driver_data = (kernel_ulong_t) &mhi_qcom_sdx65_info },
743795
{ PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0309),
744796
.driver_data = (kernel_ulong_t) &mhi_qcom_sdx75_info },
797+
/* QDU100, x100-DU */
798+
{ PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0601),
799+
.driver_data = (kernel_ulong_t) &mhi_qcom_qdu100_info },
745800
{ PCI_DEVICE(PCI_VENDOR_ID_QUECTEL, 0x1001), /* EM120R-GL (sdx24) */
746801
.driver_data = (kernel_ulong_t) &mhi_quectel_em1xx_info },
747802
{ PCI_DEVICE(PCI_VENDOR_ID_QUECTEL, 0x1002), /* EM160R-GL (sdx24) */
@@ -949,7 +1004,7 @@ static int mhi_pci_get_irqs(struct mhi_controller *mhi_cntrl,
9491004
*/
9501005
mhi_cntrl->nr_irqs = 1 + mhi_cntrl_config->num_events;
9511006

952-
nr_vectors = pci_alloc_irq_vectors(pdev, 1, mhi_cntrl->nr_irqs, PCI_IRQ_MSI);
1007+
nr_vectors = pci_alloc_irq_vectors(pdev, 1, mhi_cntrl->nr_irqs, PCI_IRQ_MSIX | PCI_IRQ_MSI);
9531008
if (nr_vectors < 0) {
9541009
dev_err(&pdev->dev, "Error allocating MSI vectors %d\n",
9551010
nr_vectors);

0 commit comments

Comments
 (0)