Skip to content

Commit 1ebab78

Browse files
committed
Merge tag 'mhi-for-v6.11' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mani/mhi into char-misc-next
Manivannan writes: MHI Host ======== - Used unique 'mhi_pci_dev_info' struct for product families instead of reusing a shared struct. This allows displaying the actual product name for the MHI devices during driver probe. - Added support for Foxconn SDX72 based modems, T99W515 and DW5934E. - Added a 'name' field to 'struct mhi_controller' for allowing the MHI client drivers to uniquely identify each MHI device based on its product/device name. This is useful in applying any device specific quirks in the client drivers. WWAN MHI Client driver ====================== - Due to the build dependency with the MHI patch exposing 'name' field to client drivers, the WWAN MHI client driver patch that is making use of the 'name' field to apply custom data mux id for Foxconn modems is also included. Collected Ack from Networking maintainer for this patch. MHI EP ====== - Fixed the MHI EP stack to not allocate memory for MHI objects from DMA zone. This was done accidentally while adding the slab cache support and causes the MHI EP stack to run out of memory while doing high bandwidth transfers. * tag 'mhi-for-v6.11' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mani/mhi: net: wwan: mhi: make default data link id configurable bus: mhi: host: Allow controller drivers to specify name for the MHI controller bus: mhi: host: Add support for Foxconn SDX72 modems bus: mhi: host: pci_generic: Use unique 'mhi_pci_dev_info' for product families bus: mhi: ep: Do not allocate memory for MHI objects from DMA zone
2 parents f7e46d4 + 65bc58c commit 1ebab78

File tree

4 files changed

+128
-28
lines changed

4 files changed

+128
-28
lines changed

drivers/bus/mhi/ep/main.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static int mhi_ep_send_completion_event(struct mhi_ep_cntrl *mhi_cntrl, struct m
9090
struct mhi_ring_element *event;
9191
int ret;
9292

93-
event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL | GFP_DMA);
93+
event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL);
9494
if (!event)
9595
return -ENOMEM;
9696

@@ -109,7 +109,7 @@ int mhi_ep_send_state_change_event(struct mhi_ep_cntrl *mhi_cntrl, enum mhi_stat
109109
struct mhi_ring_element *event;
110110
int ret;
111111

112-
event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL | GFP_DMA);
112+
event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL);
113113
if (!event)
114114
return -ENOMEM;
115115

@@ -127,7 +127,7 @@ int mhi_ep_send_ee_event(struct mhi_ep_cntrl *mhi_cntrl, enum mhi_ee_type exec_e
127127
struct mhi_ring_element *event;
128128
int ret;
129129

130-
event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL | GFP_DMA);
130+
event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL);
131131
if (!event)
132132
return -ENOMEM;
133133

@@ -146,7 +146,7 @@ static int mhi_ep_send_cmd_comp_event(struct mhi_ep_cntrl *mhi_cntrl, enum mhi_e
146146
struct mhi_ring_element *event;
147147
int ret;
148148

149-
event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL | GFP_DMA);
149+
event = kmem_cache_zalloc(mhi_cntrl->ev_ring_el_cache, GFP_KERNEL);
150150
if (!event)
151151
return -ENOMEM;
152152

@@ -438,7 +438,7 @@ static int mhi_ep_read_channel(struct mhi_ep_cntrl *mhi_cntrl,
438438
read_offset = mhi_chan->tre_size - mhi_chan->tre_bytes_left;
439439
write_offset = len - buf_left;
440440

441-
buf_addr = kmem_cache_zalloc(mhi_cntrl->tre_buf_cache, GFP_KERNEL | GFP_DMA);
441+
buf_addr = kmem_cache_zalloc(mhi_cntrl->tre_buf_cache, GFP_KERNEL);
442442
if (!buf_addr)
443443
return -ENOMEM;
444444

@@ -1481,14 +1481,14 @@ int mhi_ep_register_controller(struct mhi_ep_cntrl *mhi_cntrl,
14811481

14821482
mhi_cntrl->ev_ring_el_cache = kmem_cache_create("mhi_ep_event_ring_el",
14831483
sizeof(struct mhi_ring_element), 0,
1484-
SLAB_CACHE_DMA, NULL);
1484+
0, NULL);
14851485
if (!mhi_cntrl->ev_ring_el_cache) {
14861486
ret = -ENOMEM;
14871487
goto err_free_cmd;
14881488
}
14891489

14901490
mhi_cntrl->tre_buf_cache = kmem_cache_create("mhi_ep_tre_buf", MHI_EP_DEFAULT_MTU, 0,
1491-
SLAB_CACHE_DMA, NULL);
1491+
0, NULL);
14921492
if (!mhi_cntrl->tre_buf_cache) {
14931493
ret = -ENOMEM;
14941494
goto err_destroy_ev_ring_el_cache;

drivers/bus/mhi/host/pci_generic.c

Lines changed: 103 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,8 @@ static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] = {
399399
MHI_CHANNEL_CONFIG_DL(13, "MBIM", 32, 0),
400400
MHI_CHANNEL_CONFIG_UL(32, "DUN", 32, 0),
401401
MHI_CHANNEL_CONFIG_DL(33, "DUN", 32, 0),
402+
MHI_CHANNEL_CONFIG_UL_FP(34, "FIREHOSE", 32, 0),
403+
MHI_CHANNEL_CONFIG_DL_FP(35, "FIREHOSE", 32, 0),
402404
MHI_CHANNEL_CONFIG_HW_UL(100, "IP_HW0_MBIM", 128, 2),
403405
MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
404406
};
@@ -419,17 +421,29 @@ static const struct mhi_controller_config modem_foxconn_sdx55_config = {
419421
.event_cfg = mhi_foxconn_sdx55_events,
420422
};
421423

422-
static const struct mhi_pci_dev_info mhi_foxconn_sdx24_info = {
423-
.name = "foxconn-sdx24",
424+
static const struct mhi_controller_config modem_foxconn_sdx72_config = {
425+
.max_channels = 128,
426+
.timeout_ms = 20000,
427+
.ready_timeout_ms = 50000,
428+
.num_channels = ARRAY_SIZE(mhi_foxconn_sdx55_channels),
429+
.ch_cfg = mhi_foxconn_sdx55_channels,
430+
.num_events = ARRAY_SIZE(mhi_foxconn_sdx55_events),
431+
.event_cfg = mhi_foxconn_sdx55_events,
432+
};
433+
434+
static const struct mhi_pci_dev_info mhi_foxconn_sdx55_info = {
435+
.name = "foxconn-sdx55",
436+
.fw = "qcom/sdx55m/sbl1.mbn",
437+
.edl = "qcom/sdx55m/edl.mbn",
424438
.config = &modem_foxconn_sdx55_config,
425439
.bar_num = MHI_PCI_DEFAULT_BAR_NUM,
426440
.dma_data_width = 32,
427441
.mru_default = 32768,
428442
.sideband_wake = false,
429443
};
430444

431-
static const struct mhi_pci_dev_info mhi_foxconn_sdx55_info = {
432-
.name = "foxconn-sdx55",
445+
static const struct mhi_pci_dev_info mhi_foxconn_t99w175_info = {
446+
.name = "foxconn-t99w175",
433447
.fw = "qcom/sdx55m/sbl1.mbn",
434448
.edl = "qcom/sdx55m/edl.mbn",
435449
.config = &modem_foxconn_sdx55_config,
@@ -439,15 +453,75 @@ static const struct mhi_pci_dev_info mhi_foxconn_sdx55_info = {
439453
.sideband_wake = false,
440454
};
441455

442-
static const struct mhi_pci_dev_info mhi_foxconn_sdx65_info = {
443-
.name = "foxconn-sdx65",
456+
static const struct mhi_pci_dev_info mhi_foxconn_dw5930e_info = {
457+
.name = "foxconn-dw5930e",
458+
.fw = "qcom/sdx55m/sbl1.mbn",
459+
.edl = "qcom/sdx55m/edl.mbn",
460+
.config = &modem_foxconn_sdx55_config,
461+
.bar_num = MHI_PCI_DEFAULT_BAR_NUM,
462+
.dma_data_width = 32,
463+
.mru_default = 32768,
464+
.sideband_wake = false,
465+
};
466+
467+
static const struct mhi_pci_dev_info mhi_foxconn_t99w368_info = {
468+
.name = "foxconn-t99w368",
444469
.config = &modem_foxconn_sdx55_config,
445470
.bar_num = MHI_PCI_DEFAULT_BAR_NUM,
446471
.dma_data_width = 32,
447472
.mru_default = 32768,
448473
.sideband_wake = false,
449474
};
450475

476+
static const struct mhi_pci_dev_info mhi_foxconn_t99w373_info = {
477+
.name = "foxconn-t99w373",
478+
.config = &modem_foxconn_sdx55_config,
479+
.bar_num = MHI_PCI_DEFAULT_BAR_NUM,
480+
.dma_data_width = 32,
481+
.mru_default = 32768,
482+
.sideband_wake = false,
483+
};
484+
485+
static const struct mhi_pci_dev_info mhi_foxconn_t99w510_info = {
486+
.name = "foxconn-t99w510",
487+
.config = &modem_foxconn_sdx55_config,
488+
.bar_num = MHI_PCI_DEFAULT_BAR_NUM,
489+
.dma_data_width = 32,
490+
.mru_default = 32768,
491+
.sideband_wake = false,
492+
};
493+
494+
static const struct mhi_pci_dev_info mhi_foxconn_dw5932e_info = {
495+
.name = "foxconn-dw5932e",
496+
.config = &modem_foxconn_sdx55_config,
497+
.bar_num = MHI_PCI_DEFAULT_BAR_NUM,
498+
.dma_data_width = 32,
499+
.mru_default = 32768,
500+
.sideband_wake = false,
501+
};
502+
503+
static const struct mhi_pci_dev_info mhi_foxconn_t99w515_info = {
504+
.name = "foxconn-t99w515",
505+
.edl = "fox/sdx72m/edl.mbn",
506+
.edl_trigger = true,
507+
.config = &modem_foxconn_sdx72_config,
508+
.bar_num = MHI_PCI_DEFAULT_BAR_NUM,
509+
.dma_data_width = 32,
510+
.mru_default = 32768,
511+
.sideband_wake = false,
512+
};
513+
514+
static const struct mhi_pci_dev_info mhi_foxconn_dw5934e_info = {
515+
.name = "foxconn-dw5934e",
516+
.edl = "fox/sdx72m/edl.mbn",
517+
.edl_trigger = true,
518+
.config = &modem_foxconn_sdx72_config,
519+
.bar_num = MHI_PCI_DEFAULT_BAR_NUM,
520+
.dma_data_width = 32,
521+
.mru_default = 32768,
522+
.sideband_wake = false,
523+
};
524+
451525
static const struct mhi_channel_config mhi_mv3x_channels[] = {
452526
MHI_CHANNEL_CONFIG_UL(0, "LOOPBACK", 64, 0),
453527
MHI_CHANNEL_CONFIG_DL(1, "LOOPBACK", 64, 0),
@@ -646,40 +720,49 @@ static const struct pci_device_id mhi_pci_id_table[] = {
646720
.driver_data = (kernel_ulong_t) &mhi_quectel_em1xx_info },
647721
/* T99W175 (sdx55), Both for eSIM and Non-eSIM */
648722
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0ab),
649-
.driver_data = (kernel_ulong_t) &mhi_foxconn_sdx55_info },
723+
.driver_data = (kernel_ulong_t) &mhi_foxconn_t99w175_info },
650724
/* DW5930e (sdx55), With eSIM, It's also T99W175 */
651725
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0b0),
652-
.driver_data = (kernel_ulong_t) &mhi_foxconn_sdx55_info },
726+
.driver_data = (kernel_ulong_t) &mhi_foxconn_dw5930e_info },
653727
/* DW5930e (sdx55), Non-eSIM, It's also T99W175 */
654728
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0b1),
655-
.driver_data = (kernel_ulong_t) &mhi_foxconn_sdx55_info },
729+
.driver_data = (kernel_ulong_t) &mhi_foxconn_dw5930e_info },
656730
/* T99W175 (sdx55), Based on Qualcomm new baseline */
657731
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0bf),
658-
.driver_data = (kernel_ulong_t) &mhi_foxconn_sdx55_info },
732+
.driver_data = (kernel_ulong_t) &mhi_foxconn_t99w175_info },
659733
/* T99W175 (sdx55) */
660734
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0c3),
661-
.driver_data = (kernel_ulong_t) &mhi_foxconn_sdx55_info },
735+
.driver_data = (kernel_ulong_t) &mhi_foxconn_t99w175_info },
662736
/* T99W368 (sdx65) */
663737
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0d8),
664-
.driver_data = (kernel_ulong_t) &mhi_foxconn_sdx65_info },
738+
.driver_data = (kernel_ulong_t) &mhi_foxconn_t99w368_info },
665739
/* T99W373 (sdx62) */
666740
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0d9),
667-
.driver_data = (kernel_ulong_t) &mhi_foxconn_sdx65_info },
741+
.driver_data = (kernel_ulong_t) &mhi_foxconn_t99w373_info },
668742
/* T99W510 (sdx24), variant 1 */
669743
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0f0),
670-
.driver_data = (kernel_ulong_t) &mhi_foxconn_sdx24_info },
744+
.driver_data = (kernel_ulong_t) &mhi_foxconn_t99w510_info },
671745
/* T99W510 (sdx24), variant 2 */
672746
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0f1),
673-
.driver_data = (kernel_ulong_t) &mhi_foxconn_sdx24_info },
747+
.driver_data = (kernel_ulong_t) &mhi_foxconn_t99w510_info },
674748
/* T99W510 (sdx24), variant 3 */
675749
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0f2),
676-
.driver_data = (kernel_ulong_t) &mhi_foxconn_sdx24_info },
750+
.driver_data = (kernel_ulong_t) &mhi_foxconn_t99w510_info },
677751
/* DW5932e-eSIM (sdx62), With eSIM */
678752
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0f5),
679-
.driver_data = (kernel_ulong_t) &mhi_foxconn_sdx65_info },
753+
.driver_data = (kernel_ulong_t) &mhi_foxconn_dw5932e_info },
680754
/* DW5932e (sdx62), Non-eSIM */
681755
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0f9),
682-
.driver_data = (kernel_ulong_t) &mhi_foxconn_sdx65_info },
756+
.driver_data = (kernel_ulong_t) &mhi_foxconn_dw5932e_info },
757+
/* T99W515 (sdx72) */
758+
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe118),
759+
.driver_data = (kernel_ulong_t) &mhi_foxconn_t99w515_info },
760+
/* DW5934e(sdx72), With eSIM */
761+
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe11d),
762+
.driver_data = (kernel_ulong_t) &mhi_foxconn_dw5934e_info },
763+
/* DW5934e(sdx72), Non-eSIM */
764+
{ PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe11e),
765+
.driver_data = (kernel_ulong_t) &mhi_foxconn_dw5934e_info },
683766
/* MV31-W (Cinterion) */
684767
{ PCI_DEVICE(PCI_VENDOR_ID_THALES, 0x00b3),
685768
.driver_data = (kernel_ulong_t) &mhi_mv31_info },
@@ -694,7 +777,7 @@ static const struct pci_device_id mhi_pci_id_table[] = {
694777
.driver_data = (kernel_ulong_t) &mhi_mv32_info },
695778
/* T99W175 (sdx55), HP variant */
696779
{ PCI_DEVICE(0x03f0, 0x0a6c),
697-
.driver_data = (kernel_ulong_t) &mhi_foxconn_sdx55_info },
780+
.driver_data = (kernel_ulong_t) &mhi_foxconn_t99w175_info },
698781
{ }
699782
};
700783
MODULE_DEVICE_TABLE(pci, mhi_pci_id_table);
@@ -1003,6 +1086,7 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
10031086
mhi_cntrl->runtime_get = mhi_pci_runtime_get;
10041087
mhi_cntrl->runtime_put = mhi_pci_runtime_put;
10051088
mhi_cntrl->mru = info->mru_default;
1089+
mhi_cntrl->name = info->name;
10061090

10071091
if (info->edl_trigger)
10081092
mhi_cntrl->edl_trigger = mhi_pci_generic_edl_trigger;

drivers/net/wwan/mhi_wwan_mbim.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
#define MHI_MBIM_LINK_HASH_SIZE 8
4343
#define LINK_HASH(session) ((session) % MHI_MBIM_LINK_HASH_SIZE)
4444

45+
#define WDS_BIND_MUX_DATA_PORT_MUX_ID 112
46+
4547
struct mhi_mbim_link {
4648
struct mhi_mbim_context *mbim;
4749
struct net_device *ndev;
@@ -93,6 +95,15 @@ static struct mhi_mbim_link *mhi_mbim_get_link_rcu(struct mhi_mbim_context *mbim
9395
return NULL;
9496
}
9597

98+
static int mhi_mbim_get_link_mux_id(struct mhi_controller *cntrl)
99+
{
100+
if (strcmp(cntrl->name, "foxconn-dw5934e") == 0 ||
101+
strcmp(cntrl->name, "foxconn-t99w515") == 0)
102+
return WDS_BIND_MUX_DATA_PORT_MUX_ID;
103+
104+
return 0;
105+
}
106+
96107
static struct sk_buff *mbim_tx_fixup(struct sk_buff *skb, unsigned int session,
97108
u16 tx_seq)
98109
{
@@ -596,7 +607,7 @@ static int mhi_mbim_probe(struct mhi_device *mhi_dev, const struct mhi_device_id
596607
{
597608
struct mhi_controller *cntrl = mhi_dev->mhi_cntrl;
598609
struct mhi_mbim_context *mbim;
599-
int err;
610+
int err, link_id;
600611

601612
mbim = devm_kzalloc(&mhi_dev->dev, sizeof(*mbim), GFP_KERNEL);
602613
if (!mbim)
@@ -617,8 +628,11 @@ static int mhi_mbim_probe(struct mhi_device *mhi_dev, const struct mhi_device_id
617628
/* Number of transfer descriptors determines size of the queue */
618629
mbim->rx_queue_sz = mhi_get_free_desc_count(mhi_dev, DMA_FROM_DEVICE);
619630

631+
/* Get the corresponding mux_id from mhi */
632+
link_id = mhi_mbim_get_link_mux_id(cntrl);
633+
620634
/* Register wwan link ops with MHI controller representing WWAN instance */
621-
return wwan_register_ops(&cntrl->mhi_dev->dev, &mhi_mbim_wwan_ops, mbim, 0);
635+
return wwan_register_ops(&cntrl->mhi_dev->dev, &mhi_mbim_wwan_ops, mbim, link_id);
622636
}
623637

624638
static void mhi_mbim_remove(struct mhi_device *mhi_dev)

include/linux/mhi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ struct mhi_controller_config {
290290

291291
/**
292292
* struct mhi_controller - Master MHI controller structure
293+
* @name: Device name of the MHI controller
293294
* @cntrl_dev: Pointer to the struct device of physical bus acting as the MHI
294295
* controller (required)
295296
* @mhi_dev: MHI device instance for the controller
@@ -367,6 +368,7 @@ struct mhi_controller_config {
367368
* they can be populated depending on the usecase.
368369
*/
369370
struct mhi_controller {
371+
const char *name;
370372
struct device *cntrl_dev;
371373
struct mhi_device *mhi_dev;
372374
struct dentry *debugfs_dentry;

0 commit comments

Comments
 (0)