Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 2 | /* |
| 3 | * MHI PCI driver - MHI over PCI controller driver |
| 4 | * |
| 5 | * This module is a generic driver for registering MHI-over-PCI devices, |
| 6 | * such as PCIe QCOM modems. |
| 7 | * |
| 8 | * Copyright (C) 2020 Linaro Ltd <loic.poulain@linaro.org> |
| 9 | */ |
| 10 | |
Loic Poulain | b012ee6 | 2021-01-04 17:14:55 +0100 | [diff] [blame] | 11 | #include <linux/aer.h> |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 12 | #include <linux/delay.h> |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 13 | #include <linux/device.h> |
| 14 | #include <linux/mhi.h> |
| 15 | #include <linux/module.h> |
| 16 | #include <linux/pci.h> |
Loic Poulain | 8562d4f | 2021-01-04 17:14:56 +0100 | [diff] [blame] | 17 | #include <linux/timer.h> |
Loic Poulain | 7389337 | 2021-01-04 17:14:54 +0100 | [diff] [blame] | 18 | #include <linux/workqueue.h> |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 19 | |
| 20 | #define MHI_PCI_DEFAULT_BAR_NUM 0 |
| 21 | |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 22 | #define MHI_POST_RESET_DELAY_MS 500 |
Loic Poulain | 8562d4f | 2021-01-04 17:14:56 +0100 | [diff] [blame] | 23 | |
| 24 | #define HEALTH_CHECK_PERIOD (HZ * 2) |
| 25 | |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 26 | /** |
| 27 | * struct mhi_pci_dev_info - MHI PCI device specific information |
| 28 | * @config: MHI controller configuration |
| 29 | * @name: name of the PCI module |
| 30 | * @fw: firmware path (if any) |
| 31 | * @edl: emergency download mode firmware path (if any) |
| 32 | * @bar_num: PCI base address register to use for MHI MMIO register space |
| 33 | * @dma_data_width: DMA transfer word size (32 or 64 bits) |
| 34 | */ |
| 35 | struct mhi_pci_dev_info { |
| 36 | const struct mhi_controller_config *config; |
| 37 | const char *name; |
| 38 | const char *fw; |
| 39 | const char *edl; |
| 40 | unsigned int bar_num; |
| 41 | unsigned int dma_data_width; |
| 42 | }; |
| 43 | |
| 44 | #define MHI_CHANNEL_CONFIG_UL(ch_num, ch_name, el_count, ev_ring) \ |
| 45 | { \ |
| 46 | .num = ch_num, \ |
| 47 | .name = ch_name, \ |
| 48 | .num_elements = el_count, \ |
| 49 | .event_ring = ev_ring, \ |
| 50 | .dir = DMA_TO_DEVICE, \ |
| 51 | .ee_mask = BIT(MHI_EE_AMSS), \ |
| 52 | .pollcfg = 0, \ |
| 53 | .doorbell = MHI_DB_BRST_DISABLE, \ |
| 54 | .lpm_notify = false, \ |
| 55 | .offload_channel = false, \ |
| 56 | .doorbell_mode_switch = false, \ |
| 57 | } \ |
| 58 | |
| 59 | #define MHI_CHANNEL_CONFIG_DL(ch_num, ch_name, el_count, ev_ring) \ |
| 60 | { \ |
| 61 | .num = ch_num, \ |
| 62 | .name = ch_name, \ |
| 63 | .num_elements = el_count, \ |
| 64 | .event_ring = ev_ring, \ |
| 65 | .dir = DMA_FROM_DEVICE, \ |
| 66 | .ee_mask = BIT(MHI_EE_AMSS), \ |
| 67 | .pollcfg = 0, \ |
| 68 | .doorbell = MHI_DB_BRST_DISABLE, \ |
| 69 | .lpm_notify = false, \ |
| 70 | .offload_channel = false, \ |
| 71 | .doorbell_mode_switch = false, \ |
| 72 | } |
| 73 | |
Loic Poulain | 9ea48ef | 2021-03-05 20:16:43 +0100 | [diff] [blame] | 74 | #define MHI_EVENT_CONFIG_CTRL(ev_ring, el_count) \ |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 75 | { \ |
Loic Poulain | 9ea48ef | 2021-03-05 20:16:43 +0100 | [diff] [blame] | 76 | .num_elements = el_count, \ |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 77 | .irq_moderation_ms = 0, \ |
| 78 | .irq = (ev_ring) + 1, \ |
| 79 | .priority = 1, \ |
| 80 | .mode = MHI_DB_BRST_DISABLE, \ |
| 81 | .data_type = MHI_ER_CTRL, \ |
| 82 | .hardware_event = false, \ |
| 83 | .client_managed = false, \ |
| 84 | .offload_channel = false, \ |
| 85 | } |
| 86 | |
Loic Poulain | eb96787 | 2021-01-04 17:14:52 +0100 | [diff] [blame] | 87 | #define MHI_CHANNEL_CONFIG_HW_UL(ch_num, ch_name, el_count, ev_ring) \ |
| 88 | { \ |
| 89 | .num = ch_num, \ |
| 90 | .name = ch_name, \ |
| 91 | .num_elements = el_count, \ |
| 92 | .event_ring = ev_ring, \ |
| 93 | .dir = DMA_TO_DEVICE, \ |
| 94 | .ee_mask = BIT(MHI_EE_AMSS), \ |
| 95 | .pollcfg = 0, \ |
| 96 | .doorbell = MHI_DB_BRST_ENABLE, \ |
| 97 | .lpm_notify = false, \ |
| 98 | .offload_channel = false, \ |
| 99 | .doorbell_mode_switch = true, \ |
| 100 | } \ |
| 101 | |
| 102 | #define MHI_CHANNEL_CONFIG_HW_DL(ch_num, ch_name, el_count, ev_ring) \ |
| 103 | { \ |
| 104 | .num = ch_num, \ |
| 105 | .name = ch_name, \ |
| 106 | .num_elements = el_count, \ |
| 107 | .event_ring = ev_ring, \ |
| 108 | .dir = DMA_FROM_DEVICE, \ |
| 109 | .ee_mask = BIT(MHI_EE_AMSS), \ |
| 110 | .pollcfg = 0, \ |
| 111 | .doorbell = MHI_DB_BRST_ENABLE, \ |
| 112 | .lpm_notify = false, \ |
| 113 | .offload_channel = false, \ |
| 114 | .doorbell_mode_switch = true, \ |
| 115 | } |
| 116 | |
Loic Poulain | ac4bf60 | 2021-03-05 20:16:44 +0100 | [diff] [blame^] | 117 | #define MHI_CHANNEL_CONFIG_UL_SBL(ch_num, ch_name, el_count, ev_ring) \ |
| 118 | { \ |
| 119 | .num = ch_num, \ |
| 120 | .name = ch_name, \ |
| 121 | .num_elements = el_count, \ |
| 122 | .event_ring = ev_ring, \ |
| 123 | .dir = DMA_TO_DEVICE, \ |
| 124 | .ee_mask = BIT(MHI_EE_SBL), \ |
| 125 | .pollcfg = 0, \ |
| 126 | .doorbell = MHI_DB_BRST_DISABLE, \ |
| 127 | .lpm_notify = false, \ |
| 128 | .offload_channel = false, \ |
| 129 | .doorbell_mode_switch = false, \ |
| 130 | } \ |
| 131 | |
| 132 | #define MHI_CHANNEL_CONFIG_DL_SBL(ch_num, ch_name, el_count, ev_ring) \ |
| 133 | { \ |
| 134 | .num = ch_num, \ |
| 135 | .name = ch_name, \ |
| 136 | .num_elements = el_count, \ |
| 137 | .event_ring = ev_ring, \ |
| 138 | .dir = DMA_FROM_DEVICE, \ |
| 139 | .ee_mask = BIT(MHI_EE_SBL), \ |
| 140 | .pollcfg = 0, \ |
| 141 | .doorbell = MHI_DB_BRST_DISABLE, \ |
| 142 | .lpm_notify = false, \ |
| 143 | .offload_channel = false, \ |
| 144 | .doorbell_mode_switch = false, \ |
| 145 | } |
| 146 | |
Loic Poulain | 9ea48ef | 2021-03-05 20:16:43 +0100 | [diff] [blame] | 147 | #define MHI_EVENT_CONFIG_DATA(ev_ring, el_count) \ |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 148 | { \ |
Loic Poulain | 9ea48ef | 2021-03-05 20:16:43 +0100 | [diff] [blame] | 149 | .num_elements = el_count, \ |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 150 | .irq_moderation_ms = 5, \ |
| 151 | .irq = (ev_ring) + 1, \ |
| 152 | .priority = 1, \ |
| 153 | .mode = MHI_DB_BRST_DISABLE, \ |
| 154 | .data_type = MHI_ER_DATA, \ |
| 155 | .hardware_event = false, \ |
| 156 | .client_managed = false, \ |
| 157 | .offload_channel = false, \ |
| 158 | } |
| 159 | |
Loic Poulain | 9ea48ef | 2021-03-05 20:16:43 +0100 | [diff] [blame] | 160 | #define MHI_EVENT_CONFIG_HW_DATA(ev_ring, el_count, ch_num) \ |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 161 | { \ |
Loic Poulain | 9ea48ef | 2021-03-05 20:16:43 +0100 | [diff] [blame] | 162 | .num_elements = el_count, \ |
Loic Poulain | ec751369 | 2021-01-04 17:14:59 +0100 | [diff] [blame] | 163 | .irq_moderation_ms = 1, \ |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 164 | .irq = (ev_ring) + 1, \ |
| 165 | .priority = 1, \ |
| 166 | .mode = MHI_DB_BRST_DISABLE, \ |
| 167 | .data_type = MHI_ER_DATA, \ |
| 168 | .hardware_event = true, \ |
| 169 | .client_managed = false, \ |
| 170 | .offload_channel = false, \ |
| 171 | .channel = ch_num, \ |
| 172 | } |
| 173 | |
| 174 | static const struct mhi_channel_config modem_qcom_v1_mhi_channels[] = { |
Loic Poulain | 4da3d07 | 2021-01-04 17:14:58 +0100 | [diff] [blame] | 175 | MHI_CHANNEL_CONFIG_UL(4, "DIAG", 16, 1), |
| 176 | MHI_CHANNEL_CONFIG_DL(5, "DIAG", 16, 1), |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 177 | MHI_CHANNEL_CONFIG_UL(12, "MBIM", 4, 0), |
| 178 | MHI_CHANNEL_CONFIG_DL(13, "MBIM", 4, 0), |
| 179 | MHI_CHANNEL_CONFIG_UL(14, "QMI", 4, 0), |
| 180 | MHI_CHANNEL_CONFIG_DL(15, "QMI", 4, 0), |
| 181 | MHI_CHANNEL_CONFIG_UL(20, "IPCR", 8, 0), |
| 182 | MHI_CHANNEL_CONFIG_DL(21, "IPCR", 8, 0), |
Loic Poulain | 4da3d07 | 2021-01-04 17:14:58 +0100 | [diff] [blame] | 183 | MHI_CHANNEL_CONFIG_HW_UL(100, "IP_HW0", 128, 2), |
| 184 | MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 3), |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 185 | }; |
| 186 | |
Loic Poulain | b91c3b3 | 2021-01-05 17:44:36 +0100 | [diff] [blame] | 187 | static struct mhi_event_config modem_qcom_v1_mhi_events[] = { |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 188 | /* first ring is control+data ring */ |
Loic Poulain | 9ea48ef | 2021-03-05 20:16:43 +0100 | [diff] [blame] | 189 | MHI_EVENT_CONFIG_CTRL(0, 64), |
Loic Poulain | 4da3d07 | 2021-01-04 17:14:58 +0100 | [diff] [blame] | 190 | /* DIAG dedicated event ring */ |
Loic Poulain | 9ea48ef | 2021-03-05 20:16:43 +0100 | [diff] [blame] | 191 | MHI_EVENT_CONFIG_DATA(1, 128), |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 192 | /* Hardware channels request dedicated hardware event rings */ |
Loic Poulain | 9ea48ef | 2021-03-05 20:16:43 +0100 | [diff] [blame] | 193 | MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100), |
| 194 | MHI_EVENT_CONFIG_HW_DATA(3, 2048, 101) |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 195 | }; |
| 196 | |
Loic Poulain | b91c3b3 | 2021-01-05 17:44:36 +0100 | [diff] [blame] | 197 | static struct mhi_controller_config modem_qcom_v1_mhiv_config = { |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 198 | .max_channels = 128, |
Loic Poulain | 84026a5 | 2021-01-04 17:14:57 +0100 | [diff] [blame] | 199 | .timeout_ms = 8000, |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 200 | .num_channels = ARRAY_SIZE(modem_qcom_v1_mhi_channels), |
| 201 | .ch_cfg = modem_qcom_v1_mhi_channels, |
| 202 | .num_events = ARRAY_SIZE(modem_qcom_v1_mhi_events), |
| 203 | .event_cfg = modem_qcom_v1_mhi_events, |
| 204 | }; |
| 205 | |
| 206 | static const struct mhi_pci_dev_info mhi_qcom_sdx55_info = { |
| 207 | .name = "qcom-sdx55m", |
| 208 | .fw = "qcom/sdx55m/sbl1.mbn", |
| 209 | .edl = "qcom/sdx55m/edl.mbn", |
| 210 | .config = &modem_qcom_v1_mhiv_config, |
| 211 | .bar_num = MHI_PCI_DEFAULT_BAR_NUM, |
| 212 | .dma_data_width = 32 |
| 213 | }; |
| 214 | |
Loic Poulain | ac4bf60 | 2021-03-05 20:16:44 +0100 | [diff] [blame^] | 215 | static const struct mhi_channel_config mhi_quectel_em1xx_channels[] = { |
| 216 | MHI_CHANNEL_CONFIG_UL(0, "NMEA", 32, 0), |
| 217 | MHI_CHANNEL_CONFIG_DL(1, "NMEA", 32, 0), |
| 218 | MHI_CHANNEL_CONFIG_UL_SBL(2, "SAHARA", 32, 0), |
| 219 | MHI_CHANNEL_CONFIG_DL_SBL(3, "SAHARA", 32, 0), |
| 220 | MHI_CHANNEL_CONFIG_UL(4, "DIAG", 32, 1), |
| 221 | MHI_CHANNEL_CONFIG_DL(5, "DIAG", 32, 1), |
| 222 | MHI_CHANNEL_CONFIG_UL(12, "MBIM", 32, 0), |
| 223 | MHI_CHANNEL_CONFIG_DL(13, "MBIM", 32, 0), |
| 224 | MHI_CHANNEL_CONFIG_UL(32, "DUN", 32, 0), |
| 225 | MHI_CHANNEL_CONFIG_DL(33, "DUN", 32, 0), |
| 226 | MHI_CHANNEL_CONFIG_HW_UL(100, "IP_HW0_MBIM", 128, 2), |
| 227 | MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3), |
| 228 | }; |
| 229 | |
| 230 | static struct mhi_event_config mhi_quectel_em1xx_events[] = { |
| 231 | MHI_EVENT_CONFIG_CTRL(0, 128), |
| 232 | MHI_EVENT_CONFIG_DATA(1, 128), |
| 233 | MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100), |
| 234 | MHI_EVENT_CONFIG_HW_DATA(3, 1024, 101) |
| 235 | }; |
| 236 | |
| 237 | static struct mhi_controller_config modem_quectel_em1xx_config = { |
| 238 | .max_channels = 128, |
| 239 | .timeout_ms = 20000, |
| 240 | .num_channels = ARRAY_SIZE(mhi_quectel_em1xx_channels), |
| 241 | .ch_cfg = mhi_quectel_em1xx_channels, |
| 242 | .num_events = ARRAY_SIZE(mhi_quectel_em1xx_events), |
| 243 | .event_cfg = mhi_quectel_em1xx_events, |
| 244 | }; |
| 245 | |
| 246 | static const struct mhi_pci_dev_info mhi_quectel_em1xx_info = { |
| 247 | .name = "quectel-em1xx", |
| 248 | .edl = "qcom/prog_firehose_sdx24.mbn", |
| 249 | .config = &modem_quectel_em1xx_config, |
| 250 | .bar_num = MHI_PCI_DEFAULT_BAR_NUM, |
| 251 | .dma_data_width = 32 |
| 252 | }; |
| 253 | |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 254 | static const struct pci_device_id mhi_pci_id_table[] = { |
| 255 | { PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0306), |
| 256 | .driver_data = (kernel_ulong_t) &mhi_qcom_sdx55_info }, |
Loic Poulain | ac4bf60 | 2021-03-05 20:16:44 +0100 | [diff] [blame^] | 257 | { PCI_DEVICE(0x1eac, 0x1001), /* EM120R-GL (sdx24) */ |
| 258 | .driver_data = (kernel_ulong_t) &mhi_quectel_em1xx_info }, |
| 259 | { PCI_DEVICE(0x1eac, 0x1002), /* EM160R-GL (sdx24) */ |
| 260 | .driver_data = (kernel_ulong_t) &mhi_quectel_em1xx_info }, |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 261 | { } |
| 262 | }; |
| 263 | MODULE_DEVICE_TABLE(pci, mhi_pci_id_table); |
| 264 | |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 265 | enum mhi_pci_device_status { |
| 266 | MHI_PCI_DEV_STARTED, |
| 267 | }; |
| 268 | |
| 269 | struct mhi_pci_device { |
| 270 | struct mhi_controller mhi_cntrl; |
| 271 | struct pci_saved_state *pci_state; |
Loic Poulain | 7389337 | 2021-01-04 17:14:54 +0100 | [diff] [blame] | 272 | struct work_struct recovery_work; |
Loic Poulain | 8562d4f | 2021-01-04 17:14:56 +0100 | [diff] [blame] | 273 | struct timer_list health_check_timer; |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 274 | unsigned long status; |
| 275 | }; |
| 276 | |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 277 | static int mhi_pci_read_reg(struct mhi_controller *mhi_cntrl, |
| 278 | void __iomem *addr, u32 *out) |
| 279 | { |
| 280 | *out = readl(addr); |
| 281 | return 0; |
| 282 | } |
| 283 | |
| 284 | static void mhi_pci_write_reg(struct mhi_controller *mhi_cntrl, |
| 285 | void __iomem *addr, u32 val) |
| 286 | { |
| 287 | writel(val, addr); |
| 288 | } |
| 289 | |
| 290 | static void mhi_pci_status_cb(struct mhi_controller *mhi_cntrl, |
| 291 | enum mhi_callback cb) |
| 292 | { |
Loic Poulain | 1e2f29b | 2021-02-03 17:39:42 +0100 | [diff] [blame] | 293 | struct pci_dev *pdev = to_pci_dev(mhi_cntrl->cntrl_dev); |
| 294 | |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 295 | /* Nothing to do for now */ |
Loic Poulain | 1e2f29b | 2021-02-03 17:39:42 +0100 | [diff] [blame] | 296 | switch (cb) { |
| 297 | case MHI_CB_FATAL_ERROR: |
| 298 | case MHI_CB_SYS_ERROR: |
| 299 | dev_warn(&pdev->dev, "firmware crashed (%u)\n", cb); |
| 300 | break; |
| 301 | default: |
| 302 | break; |
| 303 | } |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 304 | } |
| 305 | |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 306 | static bool mhi_pci_is_alive(struct mhi_controller *mhi_cntrl) |
| 307 | { |
| 308 | struct pci_dev *pdev = to_pci_dev(mhi_cntrl->cntrl_dev); |
| 309 | u16 vendor = 0; |
| 310 | |
| 311 | if (pci_read_config_word(pdev, PCI_VENDOR_ID, &vendor)) |
| 312 | return false; |
| 313 | |
| 314 | if (vendor == (u16) ~0 || vendor == 0) |
| 315 | return false; |
| 316 | |
| 317 | return true; |
| 318 | } |
| 319 | |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 320 | static int mhi_pci_claim(struct mhi_controller *mhi_cntrl, |
| 321 | unsigned int bar_num, u64 dma_mask) |
| 322 | { |
| 323 | struct pci_dev *pdev = to_pci_dev(mhi_cntrl->cntrl_dev); |
| 324 | int err; |
| 325 | |
| 326 | err = pci_assign_resource(pdev, bar_num); |
| 327 | if (err) |
| 328 | return err; |
| 329 | |
| 330 | err = pcim_enable_device(pdev); |
| 331 | if (err) { |
| 332 | dev_err(&pdev->dev, "failed to enable pci device: %d\n", err); |
| 333 | return err; |
| 334 | } |
| 335 | |
| 336 | err = pcim_iomap_regions(pdev, 1 << bar_num, pci_name(pdev)); |
| 337 | if (err) { |
| 338 | dev_err(&pdev->dev, "failed to map pci region: %d\n", err); |
| 339 | return err; |
| 340 | } |
| 341 | mhi_cntrl->regs = pcim_iomap_table(pdev)[bar_num]; |
| 342 | |
| 343 | err = pci_set_dma_mask(pdev, dma_mask); |
| 344 | if (err) { |
| 345 | dev_err(&pdev->dev, "Cannot set proper DMA mask\n"); |
| 346 | return err; |
| 347 | } |
| 348 | |
| 349 | err = pci_set_consistent_dma_mask(pdev, dma_mask); |
| 350 | if (err) { |
| 351 | dev_err(&pdev->dev, "set consistent dma mask failed\n"); |
| 352 | return err; |
| 353 | } |
| 354 | |
| 355 | pci_set_master(pdev); |
| 356 | |
| 357 | return 0; |
| 358 | } |
| 359 | |
| 360 | static int mhi_pci_get_irqs(struct mhi_controller *mhi_cntrl, |
| 361 | const struct mhi_controller_config *mhi_cntrl_config) |
| 362 | { |
| 363 | struct pci_dev *pdev = to_pci_dev(mhi_cntrl->cntrl_dev); |
| 364 | int nr_vectors, i; |
| 365 | int *irq; |
| 366 | |
| 367 | /* |
| 368 | * Alloc one MSI vector for BHI + one vector per event ring, ideally... |
| 369 | * No explicit pci_free_irq_vectors required, done by pcim_release. |
| 370 | */ |
| 371 | mhi_cntrl->nr_irqs = 1 + mhi_cntrl_config->num_events; |
| 372 | |
| 373 | nr_vectors = pci_alloc_irq_vectors(pdev, 1, mhi_cntrl->nr_irqs, PCI_IRQ_MSI); |
| 374 | if (nr_vectors < 0) { |
| 375 | dev_err(&pdev->dev, "Error allocating MSI vectors %d\n", |
| 376 | nr_vectors); |
| 377 | return nr_vectors; |
| 378 | } |
| 379 | |
| 380 | if (nr_vectors < mhi_cntrl->nr_irqs) { |
Loic Poulain | b91c3b3 | 2021-01-05 17:44:36 +0100 | [diff] [blame] | 381 | dev_warn(&pdev->dev, "using shared MSI\n"); |
| 382 | |
| 383 | /* Patch msi vectors, use only one (shared) */ |
| 384 | for (i = 0; i < mhi_cntrl_config->num_events; i++) |
| 385 | mhi_cntrl_config->event_cfg[i].irq = 0; |
| 386 | mhi_cntrl->nr_irqs = 1; |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 387 | } |
| 388 | |
| 389 | irq = devm_kcalloc(&pdev->dev, mhi_cntrl->nr_irqs, sizeof(int), GFP_KERNEL); |
| 390 | if (!irq) |
| 391 | return -ENOMEM; |
| 392 | |
| 393 | for (i = 0; i < mhi_cntrl->nr_irqs; i++) { |
| 394 | int vector = i >= nr_vectors ? (nr_vectors - 1) : i; |
| 395 | |
| 396 | irq[i] = pci_irq_vector(pdev, vector); |
| 397 | } |
| 398 | |
| 399 | mhi_cntrl->irq = irq; |
| 400 | |
| 401 | return 0; |
| 402 | } |
| 403 | |
| 404 | static int mhi_pci_runtime_get(struct mhi_controller *mhi_cntrl) |
| 405 | { |
| 406 | /* no PM for now */ |
| 407 | return 0; |
| 408 | } |
| 409 | |
| 410 | static void mhi_pci_runtime_put(struct mhi_controller *mhi_cntrl) |
| 411 | { |
| 412 | /* no PM for now */ |
| 413 | } |
| 414 | |
Loic Poulain | 7389337 | 2021-01-04 17:14:54 +0100 | [diff] [blame] | 415 | static void mhi_pci_recovery_work(struct work_struct *work) |
| 416 | { |
| 417 | struct mhi_pci_device *mhi_pdev = container_of(work, struct mhi_pci_device, |
| 418 | recovery_work); |
| 419 | struct mhi_controller *mhi_cntrl = &mhi_pdev->mhi_cntrl; |
| 420 | struct pci_dev *pdev = to_pci_dev(mhi_cntrl->cntrl_dev); |
| 421 | int err; |
| 422 | |
| 423 | dev_warn(&pdev->dev, "device recovery started\n"); |
| 424 | |
Loic Poulain | 8562d4f | 2021-01-04 17:14:56 +0100 | [diff] [blame] | 425 | del_timer(&mhi_pdev->health_check_timer); |
| 426 | |
Loic Poulain | 7389337 | 2021-01-04 17:14:54 +0100 | [diff] [blame] | 427 | /* Clean up MHI state */ |
| 428 | if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) { |
| 429 | mhi_power_down(mhi_cntrl, false); |
| 430 | mhi_unprepare_after_power_down(mhi_cntrl); |
| 431 | } |
| 432 | |
| 433 | /* Check if we can recover without full reset */ |
| 434 | pci_set_power_state(pdev, PCI_D0); |
| 435 | pci_load_saved_state(pdev, mhi_pdev->pci_state); |
| 436 | pci_restore_state(pdev); |
| 437 | |
| 438 | if (!mhi_pci_is_alive(mhi_cntrl)) |
| 439 | goto err_try_reset; |
| 440 | |
| 441 | err = mhi_prepare_for_power_up(mhi_cntrl); |
| 442 | if (err) |
| 443 | goto err_try_reset; |
| 444 | |
| 445 | err = mhi_sync_power_up(mhi_cntrl); |
| 446 | if (err) |
| 447 | goto err_unprepare; |
| 448 | |
| 449 | dev_dbg(&pdev->dev, "Recovery completed\n"); |
| 450 | |
| 451 | set_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status); |
Loic Poulain | 8562d4f | 2021-01-04 17:14:56 +0100 | [diff] [blame] | 452 | mod_timer(&mhi_pdev->health_check_timer, jiffies + HEALTH_CHECK_PERIOD); |
Loic Poulain | 7389337 | 2021-01-04 17:14:54 +0100 | [diff] [blame] | 453 | return; |
| 454 | |
| 455 | err_unprepare: |
| 456 | mhi_unprepare_after_power_down(mhi_cntrl); |
| 457 | err_try_reset: |
| 458 | if (pci_reset_function(pdev)) |
| 459 | dev_err(&pdev->dev, "Recovery failed\n"); |
| 460 | } |
| 461 | |
Loic Poulain | 8562d4f | 2021-01-04 17:14:56 +0100 | [diff] [blame] | 462 | static void health_check(struct timer_list *t) |
| 463 | { |
| 464 | struct mhi_pci_device *mhi_pdev = from_timer(mhi_pdev, t, health_check_timer); |
| 465 | struct mhi_controller *mhi_cntrl = &mhi_pdev->mhi_cntrl; |
| 466 | |
| 467 | if (!mhi_pci_is_alive(mhi_cntrl)) { |
| 468 | dev_err(mhi_cntrl->cntrl_dev, "Device died\n"); |
| 469 | queue_work(system_long_wq, &mhi_pdev->recovery_work); |
| 470 | return; |
| 471 | } |
| 472 | |
| 473 | /* reschedule in two seconds */ |
| 474 | mod_timer(&mhi_pdev->health_check_timer, jiffies + HEALTH_CHECK_PERIOD); |
| 475 | } |
| 476 | |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 477 | static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
| 478 | { |
| 479 | const struct mhi_pci_dev_info *info = (struct mhi_pci_dev_info *) id->driver_data; |
| 480 | const struct mhi_controller_config *mhi_cntrl_config; |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 481 | struct mhi_pci_device *mhi_pdev; |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 482 | struct mhi_controller *mhi_cntrl; |
| 483 | int err; |
| 484 | |
| 485 | dev_dbg(&pdev->dev, "MHI PCI device found: %s\n", info->name); |
| 486 | |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 487 | /* mhi_pdev.mhi_cntrl must be zero-initialized */ |
| 488 | mhi_pdev = devm_kzalloc(&pdev->dev, sizeof(*mhi_pdev), GFP_KERNEL); |
| 489 | if (!mhi_pdev) |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 490 | return -ENOMEM; |
| 491 | |
Loic Poulain | 7389337 | 2021-01-04 17:14:54 +0100 | [diff] [blame] | 492 | INIT_WORK(&mhi_pdev->recovery_work, mhi_pci_recovery_work); |
Loic Poulain | 8562d4f | 2021-01-04 17:14:56 +0100 | [diff] [blame] | 493 | timer_setup(&mhi_pdev->health_check_timer, health_check, 0); |
Loic Poulain | 7389337 | 2021-01-04 17:14:54 +0100 | [diff] [blame] | 494 | |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 495 | mhi_cntrl_config = info->config; |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 496 | mhi_cntrl = &mhi_pdev->mhi_cntrl; |
| 497 | |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 498 | mhi_cntrl->cntrl_dev = &pdev->dev; |
| 499 | mhi_cntrl->iova_start = 0; |
Loic Poulain | 4ea6fa2 | 2020-12-02 09:12:30 +0100 | [diff] [blame] | 500 | mhi_cntrl->iova_stop = (dma_addr_t)DMA_BIT_MASK(info->dma_data_width); |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 501 | mhi_cntrl->fw_image = info->fw; |
| 502 | mhi_cntrl->edl_image = info->edl; |
| 503 | |
| 504 | mhi_cntrl->read_reg = mhi_pci_read_reg; |
| 505 | mhi_cntrl->write_reg = mhi_pci_write_reg; |
| 506 | mhi_cntrl->status_cb = mhi_pci_status_cb; |
| 507 | mhi_cntrl->runtime_get = mhi_pci_runtime_get; |
| 508 | mhi_cntrl->runtime_put = mhi_pci_runtime_put; |
| 509 | |
| 510 | err = mhi_pci_claim(mhi_cntrl, info->bar_num, DMA_BIT_MASK(info->dma_data_width)); |
| 511 | if (err) |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 512 | return err; |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 513 | |
| 514 | err = mhi_pci_get_irqs(mhi_cntrl, mhi_cntrl_config); |
| 515 | if (err) |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 516 | return err; |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 517 | |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 518 | pci_set_drvdata(pdev, mhi_pdev); |
| 519 | |
| 520 | /* Have stored pci confspace at hand for restore in sudden PCI error */ |
| 521 | pci_save_state(pdev); |
| 522 | mhi_pdev->pci_state = pci_store_saved_state(pdev); |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 523 | |
Loic Poulain | b012ee6 | 2021-01-04 17:14:55 +0100 | [diff] [blame] | 524 | pci_enable_pcie_error_reporting(pdev); |
| 525 | |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 526 | err = mhi_register_controller(mhi_cntrl, mhi_cntrl_config); |
| 527 | if (err) |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 528 | return err; |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 529 | |
| 530 | /* MHI bus does not power up the controller by default */ |
| 531 | err = mhi_prepare_for_power_up(mhi_cntrl); |
| 532 | if (err) { |
| 533 | dev_err(&pdev->dev, "failed to prepare MHI controller\n"); |
| 534 | goto err_unregister; |
| 535 | } |
| 536 | |
| 537 | err = mhi_sync_power_up(mhi_cntrl); |
| 538 | if (err) { |
| 539 | dev_err(&pdev->dev, "failed to power up MHI controller\n"); |
| 540 | goto err_unprepare; |
| 541 | } |
| 542 | |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 543 | set_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status); |
| 544 | |
Loic Poulain | 8562d4f | 2021-01-04 17:14:56 +0100 | [diff] [blame] | 545 | /* start health check */ |
| 546 | mod_timer(&mhi_pdev->health_check_timer, jiffies + HEALTH_CHECK_PERIOD); |
| 547 | |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 548 | return 0; |
| 549 | |
| 550 | err_unprepare: |
| 551 | mhi_unprepare_after_power_down(mhi_cntrl); |
| 552 | err_unregister: |
| 553 | mhi_unregister_controller(mhi_cntrl); |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 554 | |
| 555 | return err; |
| 556 | } |
| 557 | |
| 558 | static void mhi_pci_remove(struct pci_dev *pdev) |
| 559 | { |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 560 | struct mhi_pci_device *mhi_pdev = pci_get_drvdata(pdev); |
| 561 | struct mhi_controller *mhi_cntrl = &mhi_pdev->mhi_cntrl; |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 562 | |
Loic Poulain | 8562d4f | 2021-01-04 17:14:56 +0100 | [diff] [blame] | 563 | del_timer(&mhi_pdev->health_check_timer); |
Loic Poulain | 7389337 | 2021-01-04 17:14:54 +0100 | [diff] [blame] | 564 | cancel_work_sync(&mhi_pdev->recovery_work); |
| 565 | |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 566 | if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) { |
| 567 | mhi_power_down(mhi_cntrl, true); |
| 568 | mhi_unprepare_after_power_down(mhi_cntrl); |
| 569 | } |
| 570 | |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 571 | mhi_unregister_controller(mhi_cntrl); |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 572 | } |
| 573 | |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 574 | static void mhi_pci_reset_prepare(struct pci_dev *pdev) |
| 575 | { |
| 576 | struct mhi_pci_device *mhi_pdev = pci_get_drvdata(pdev); |
| 577 | struct mhi_controller *mhi_cntrl = &mhi_pdev->mhi_cntrl; |
| 578 | |
| 579 | dev_info(&pdev->dev, "reset\n"); |
| 580 | |
Loic Poulain | 8562d4f | 2021-01-04 17:14:56 +0100 | [diff] [blame] | 581 | del_timer(&mhi_pdev->health_check_timer); |
| 582 | |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 583 | /* Clean up MHI state */ |
| 584 | if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) { |
| 585 | mhi_power_down(mhi_cntrl, false); |
| 586 | mhi_unprepare_after_power_down(mhi_cntrl); |
| 587 | } |
| 588 | |
| 589 | /* cause internal device reset */ |
| 590 | mhi_soc_reset(mhi_cntrl); |
| 591 | |
| 592 | /* Be sure device reset has been executed */ |
| 593 | msleep(MHI_POST_RESET_DELAY_MS); |
| 594 | } |
| 595 | |
| 596 | static void mhi_pci_reset_done(struct pci_dev *pdev) |
| 597 | { |
| 598 | struct mhi_pci_device *mhi_pdev = pci_get_drvdata(pdev); |
| 599 | struct mhi_controller *mhi_cntrl = &mhi_pdev->mhi_cntrl; |
| 600 | int err; |
| 601 | |
| 602 | /* Restore initial known working PCI state */ |
| 603 | pci_load_saved_state(pdev, mhi_pdev->pci_state); |
| 604 | pci_restore_state(pdev); |
| 605 | |
| 606 | /* Is device status available ? */ |
| 607 | if (!mhi_pci_is_alive(mhi_cntrl)) { |
| 608 | dev_err(&pdev->dev, "reset failed\n"); |
| 609 | return; |
| 610 | } |
| 611 | |
| 612 | err = mhi_prepare_for_power_up(mhi_cntrl); |
| 613 | if (err) { |
| 614 | dev_err(&pdev->dev, "failed to prepare MHI controller\n"); |
| 615 | return; |
| 616 | } |
| 617 | |
| 618 | err = mhi_sync_power_up(mhi_cntrl); |
| 619 | if (err) { |
| 620 | dev_err(&pdev->dev, "failed to power up MHI controller\n"); |
| 621 | mhi_unprepare_after_power_down(mhi_cntrl); |
| 622 | return; |
| 623 | } |
| 624 | |
| 625 | set_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status); |
Loic Poulain | 8562d4f | 2021-01-04 17:14:56 +0100 | [diff] [blame] | 626 | mod_timer(&mhi_pdev->health_check_timer, jiffies + HEALTH_CHECK_PERIOD); |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 627 | } |
| 628 | |
Loic Poulain | b012ee6 | 2021-01-04 17:14:55 +0100 | [diff] [blame] | 629 | static pci_ers_result_t mhi_pci_error_detected(struct pci_dev *pdev, |
| 630 | pci_channel_state_t state) |
| 631 | { |
| 632 | struct mhi_pci_device *mhi_pdev = pci_get_drvdata(pdev); |
| 633 | struct mhi_controller *mhi_cntrl = &mhi_pdev->mhi_cntrl; |
| 634 | |
| 635 | dev_err(&pdev->dev, "PCI error detected, state = %u\n", state); |
| 636 | |
| 637 | if (state == pci_channel_io_perm_failure) |
| 638 | return PCI_ERS_RESULT_DISCONNECT; |
| 639 | |
| 640 | /* Clean up MHI state */ |
| 641 | if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) { |
| 642 | mhi_power_down(mhi_cntrl, false); |
| 643 | mhi_unprepare_after_power_down(mhi_cntrl); |
| 644 | } else { |
| 645 | /* Nothing to do */ |
| 646 | return PCI_ERS_RESULT_RECOVERED; |
| 647 | } |
| 648 | |
| 649 | pci_disable_device(pdev); |
| 650 | |
| 651 | return PCI_ERS_RESULT_NEED_RESET; |
| 652 | } |
| 653 | |
| 654 | static pci_ers_result_t mhi_pci_slot_reset(struct pci_dev *pdev) |
| 655 | { |
| 656 | if (pci_enable_device(pdev)) { |
| 657 | dev_err(&pdev->dev, "Cannot re-enable PCI device after reset.\n"); |
| 658 | return PCI_ERS_RESULT_DISCONNECT; |
| 659 | } |
| 660 | |
| 661 | return PCI_ERS_RESULT_RECOVERED; |
| 662 | } |
| 663 | |
| 664 | static void mhi_pci_io_resume(struct pci_dev *pdev) |
| 665 | { |
| 666 | struct mhi_pci_device *mhi_pdev = pci_get_drvdata(pdev); |
| 667 | |
| 668 | dev_err(&pdev->dev, "PCI slot reset done\n"); |
| 669 | |
| 670 | queue_work(system_long_wq, &mhi_pdev->recovery_work); |
| 671 | } |
| 672 | |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 673 | static const struct pci_error_handlers mhi_pci_err_handler = { |
Loic Poulain | b012ee6 | 2021-01-04 17:14:55 +0100 | [diff] [blame] | 674 | .error_detected = mhi_pci_error_detected, |
| 675 | .slot_reset = mhi_pci_slot_reset, |
| 676 | .resume = mhi_pci_io_resume, |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 677 | .reset_prepare = mhi_pci_reset_prepare, |
| 678 | .reset_done = mhi_pci_reset_done, |
| 679 | }; |
| 680 | |
Loic Poulain | 7389337 | 2021-01-04 17:14:54 +0100 | [diff] [blame] | 681 | static int __maybe_unused mhi_pci_suspend(struct device *dev) |
| 682 | { |
| 683 | struct pci_dev *pdev = to_pci_dev(dev); |
| 684 | struct mhi_pci_device *mhi_pdev = dev_get_drvdata(dev); |
| 685 | struct mhi_controller *mhi_cntrl = &mhi_pdev->mhi_cntrl; |
| 686 | |
Loic Poulain | 8562d4f | 2021-01-04 17:14:56 +0100 | [diff] [blame] | 687 | del_timer(&mhi_pdev->health_check_timer); |
Loic Poulain | 7389337 | 2021-01-04 17:14:54 +0100 | [diff] [blame] | 688 | cancel_work_sync(&mhi_pdev->recovery_work); |
| 689 | |
| 690 | /* Transition to M3 state */ |
| 691 | mhi_pm_suspend(mhi_cntrl); |
| 692 | |
| 693 | pci_save_state(pdev); |
| 694 | pci_disable_device(pdev); |
| 695 | pci_wake_from_d3(pdev, true); |
| 696 | pci_set_power_state(pdev, PCI_D3hot); |
| 697 | |
| 698 | return 0; |
| 699 | } |
| 700 | |
| 701 | static int __maybe_unused mhi_pci_resume(struct device *dev) |
| 702 | { |
| 703 | struct pci_dev *pdev = to_pci_dev(dev); |
| 704 | struct mhi_pci_device *mhi_pdev = dev_get_drvdata(dev); |
| 705 | struct mhi_controller *mhi_cntrl = &mhi_pdev->mhi_cntrl; |
| 706 | int err; |
| 707 | |
| 708 | pci_set_power_state(pdev, PCI_D0); |
| 709 | pci_restore_state(pdev); |
| 710 | pci_set_master(pdev); |
| 711 | |
| 712 | err = pci_enable_device(pdev); |
| 713 | if (err) |
| 714 | goto err_recovery; |
| 715 | |
| 716 | /* Exit M3, transition to M0 state */ |
| 717 | err = mhi_pm_resume(mhi_cntrl); |
| 718 | if (err) { |
| 719 | dev_err(&pdev->dev, "failed to resume device: %d\n", err); |
| 720 | goto err_recovery; |
| 721 | } |
| 722 | |
Loic Poulain | 8562d4f | 2021-01-04 17:14:56 +0100 | [diff] [blame] | 723 | /* Resume health check */ |
| 724 | mod_timer(&mhi_pdev->health_check_timer, jiffies + HEALTH_CHECK_PERIOD); |
| 725 | |
Loic Poulain | 7389337 | 2021-01-04 17:14:54 +0100 | [diff] [blame] | 726 | return 0; |
| 727 | |
| 728 | err_recovery: |
| 729 | /* The device may have loose power or crashed, try recovering it */ |
| 730 | queue_work(system_long_wq, &mhi_pdev->recovery_work); |
| 731 | |
| 732 | return err; |
| 733 | } |
| 734 | |
| 735 | static const struct dev_pm_ops mhi_pci_pm_ops = { |
| 736 | SET_SYSTEM_SLEEP_PM_OPS(mhi_pci_suspend, mhi_pci_resume) |
| 737 | }; |
| 738 | |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 739 | static struct pci_driver mhi_pci_driver = { |
| 740 | .name = "mhi-pci-generic", |
| 741 | .id_table = mhi_pci_id_table, |
| 742 | .probe = mhi_pci_probe, |
Loic Poulain | 8ccc327 | 2021-01-04 17:14:53 +0100 | [diff] [blame] | 743 | .remove = mhi_pci_remove, |
| 744 | .err_handler = &mhi_pci_err_handler, |
Loic Poulain | 7389337 | 2021-01-04 17:14:54 +0100 | [diff] [blame] | 745 | .driver.pm = &mhi_pci_pm_ops |
Loic Poulain | 855a70c | 2020-10-21 19:18:19 +0200 | [diff] [blame] | 746 | }; |
| 747 | module_pci_driver(mhi_pci_driver); |
| 748 | |
| 749 | MODULE_AUTHOR("Loic Poulain <loic.poulain@linaro.org>"); |
| 750 | MODULE_DESCRIPTION("Modem Host Interface (MHI) PCI controller driver"); |
| 751 | MODULE_LICENSE("GPL"); |