kernel: backport support for Sierra Wireless EM919x modems
[openwrt/openwrt.git] / target / linux / generic / backport-5.15 / 780-v5.16-bus-mhi-pci_generic-Introduce-Sierra-EM919X-support.patch
1 Index: linux-5.15.58/drivers/bus/mhi/pci_generic.c
2 ===================================================================
3 --- linux-5.15.58.orig/drivers/bus/mhi/pci_generic.c
4 +++ linux-5.15.58/drivers/bus/mhi/pci_generic.c
5 @@ -406,6 +406,46 @@ static const struct mhi_pci_dev_info mhi
6 .mru_default = 32768,
7 };
8
9 +static const struct mhi_channel_config mhi_sierra_em919x_channels[] = {
10 + MHI_CHANNEL_CONFIG_UL_SBL(2, "SAHARA", 32, 0),
11 + MHI_CHANNEL_CONFIG_DL_SBL(3, "SAHARA", 256, 0),
12 + MHI_CHANNEL_CONFIG_UL(4, "DIAG", 32, 0),
13 + MHI_CHANNEL_CONFIG_DL(5, "DIAG", 32, 0),
14 + MHI_CHANNEL_CONFIG_UL(12, "MBIM", 128, 0),
15 + MHI_CHANNEL_CONFIG_DL(13, "MBIM", 128, 0),
16 + MHI_CHANNEL_CONFIG_UL(14, "QMI", 32, 0),
17 + MHI_CHANNEL_CONFIG_DL(15, "QMI", 32, 0),
18 + MHI_CHANNEL_CONFIG_UL(32, "DUN", 32, 0),
19 + MHI_CHANNEL_CONFIG_DL(33, "DUN", 32, 0),
20 + MHI_CHANNEL_CONFIG_HW_UL(100, "IP_HW0", 512, 1),
21 + MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 512, 2),
22 +};
23 +
24 +static struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
25 + /* first ring is control+data and DIAG ring */
26 + MHI_EVENT_CONFIG_CTRL(0, 2048),
27 + /* Hardware channels request dedicated hardware event rings */
28 + MHI_EVENT_CONFIG_HW_DATA(1, 2048, 100),
29 + MHI_EVENT_CONFIG_HW_DATA(2, 2048, 101)
30 +};
31 +
32 +static const struct mhi_controller_config modem_sierra_em919x_config = {
33 + .max_channels = 128,
34 + .timeout_ms = 24000,
35 + .num_channels = ARRAY_SIZE(mhi_sierra_em919x_channels),
36 + .ch_cfg = mhi_sierra_em919x_channels,
37 + .num_events = ARRAY_SIZE(modem_sierra_em919x_mhi_events),
38 + .event_cfg = modem_sierra_em919x_mhi_events,
39 +};
40 +
41 +static const struct mhi_pci_dev_info mhi_sierra_em919x_info = {
42 + .name = "sierra-em919x",
43 + .config = &modem_sierra_em919x_config,
44 + .bar_num = MHI_PCI_DEFAULT_BAR_NUM,
45 + .dma_data_width = 32,
46 + .sideband_wake = false,
47 +};
48 +
49 static const struct mhi_channel_config mhi_telit_fn980_hw_v1_channels[] = {
50 MHI_CHANNEL_CONFIG_UL(14, "QMI", 32, 0),
51 MHI_CHANNEL_CONFIG_DL(15, "QMI", 32, 0),
52 @@ -480,6 +520,9 @@ static const struct mhi_pci_dev_info mhi
53 };
54
55 static const struct pci_device_id mhi_pci_id_table[] = {
56 + /* EM919x (sdx55), use the same vid:pid as qcom-sdx55m */
57 + { PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0306, 0x18d7, 0x0200),
58 + .driver_data = (kernel_ulong_t) &mhi_sierra_em919x_info },
59 /* Telit FN980 hardware revision v1 */
60 { PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0306, 0x1C5D, 0x2000),
61 .driver_data = (kernel_ulong_t) &mhi_telit_fn980_hw_v1_info },