Skip to content

Commit e3e5e65

Browse files
Loic PoulainMani-Sadhasivam
authored andcommitted
bus: mhi: pci_generic: No-Op for device_wake operations
The wake_db register presence is highly speculative and can fuze MHI devices. Indeed, currently the wake_db register address is defined at entry 127 of the 'Channel doorbell array', thus writing to this address is equivalent to ringing the doorbell for channel 127, causing trouble with some devics (e.g. SDX24 based modems) that get an unexpected channel 127 doorbell interrupt. This change fixes that issue by setting wake get/put as no-op for pci_generic devices. The wake device sideband mechanism seems really specific to each device, and is AFAIK not defined by the MHI spec. It also removes zeroing initialization of wake_db register during MMIO initialization, the register being set via wake_get/put accessors few cycles later during M0 transition. Signed-off-by: Loic Poulain <loic.poulain@linaro.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Link: https://lore.kernel.org/r/1614971808-22156-4-git-send-email-loic.poulain@linaro.org Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
1 parent 59d05b7 commit e3e5e65

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

drivers/bus/mhi/core/init.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,6 @@ int mhi_init_mmio(struct mhi_controller *mhi_cntrl)
508508

509509
/* Setup wake db */
510510
mhi_cntrl->wake_db = base + val + (8 * MHI_DEV_WAKE_DB);
511-
mhi_write_reg(mhi_cntrl, mhi_cntrl->wake_db, 4, 0);
512-
mhi_write_reg(mhi_cntrl, mhi_cntrl->wake_db, 0, 0);
513511
mhi_cntrl->wake_set = false;
514512

515513
/* Setup channel db address for each channel in tre_ring */

drivers/bus/mhi/pci_generic.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,21 @@ static void mhi_pci_status_cb(struct mhi_controller *mhi_cntrl,
313313
}
314314
}
315315

316+
static void mhi_pci_wake_get_nop(struct mhi_controller *mhi_cntrl, bool force)
317+
{
318+
/* no-op */
319+
}
320+
321+
static void mhi_pci_wake_put_nop(struct mhi_controller *mhi_cntrl, bool override)
322+
{
323+
/* no-op */
324+
}
325+
326+
static void mhi_pci_wake_toggle_nop(struct mhi_controller *mhi_cntrl)
327+
{
328+
/* no-op */
329+
}
330+
316331
static bool mhi_pci_is_alive(struct mhi_controller *mhi_cntrl)
317332
{
318333
struct pci_dev *pdev = to_pci_dev(mhi_cntrl->cntrl_dev);
@@ -516,6 +531,9 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
516531
mhi_cntrl->status_cb = mhi_pci_status_cb;
517532
mhi_cntrl->runtime_get = mhi_pci_runtime_get;
518533
mhi_cntrl->runtime_put = mhi_pci_runtime_put;
534+
mhi_cntrl->wake_get = mhi_pci_wake_get_nop;
535+
mhi_cntrl->wake_put = mhi_pci_wake_put_nop;
536+
mhi_cntrl->wake_toggle = mhi_pci_wake_toggle_nop;
519537

520538
err = mhi_pci_claim(mhi_cntrl, info->bar_num, DMA_BIT_MASK(info->dma_data_width));
521539
if (err)

0 commit comments

Comments
 (0)