Skip to content

Commit d28b097

Browse files
committed
Merge tag 'mhi-for-v6.16' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mani/mhi into char-misc-next
Manivannan writes: MHI Host ======== - Fix conflict between MHI power up and SYSERR state transitions by issuing MHI reset only if the device is in SYSERR state while in SBL/PBL EEs. The device won't respond to reset if it is not in SYSERR state in SBL/PBL EEs. - Remove redundant call to pci_assign_resource() since PCI core calls this API internally. - Add Telit FN920C04 modem which is based on Qcom SDX35 chipset. * tag 'mhi-for-v6.16' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/mani/mhi: bus: mhi: host: pci_generic: Add Telit FN920C04 modem support bus: mhi: host: pci_generic: Remove redundant assign resource usage bus: mhi: host: Fix conflict between power_up and SYSERR
2 parents 2b0634c + 6348f62 commit d28b097

File tree

2 files changed

+56
-5
lines changed

2 files changed

+56
-5
lines changed

drivers/bus/mhi/host/pci_generic.c

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,42 @@ static const struct mhi_pci_dev_info mhi_telit_fe990a_info = {
782782
.mru_default = 32768,
783783
};
784784

785+
static const struct mhi_channel_config mhi_telit_fn920c04_channels[] = {
786+
MHI_CHANNEL_CONFIG_UL_SBL(2, "SAHARA", 32, 0),
787+
MHI_CHANNEL_CONFIG_DL_SBL(3, "SAHARA", 32, 0),
788+
MHI_CHANNEL_CONFIG_UL(4, "DIAG", 64, 1),
789+
MHI_CHANNEL_CONFIG_DL(5, "DIAG", 64, 1),
790+
MHI_CHANNEL_CONFIG_UL(14, "QMI", 32, 0),
791+
MHI_CHANNEL_CONFIG_DL(15, "QMI", 32, 0),
792+
MHI_CHANNEL_CONFIG_UL(32, "DUN", 32, 0),
793+
MHI_CHANNEL_CONFIG_DL(33, "DUN", 32, 0),
794+
MHI_CHANNEL_CONFIG_UL_FP(34, "FIREHOSE", 32, 0),
795+
MHI_CHANNEL_CONFIG_DL_FP(35, "FIREHOSE", 32, 0),
796+
MHI_CHANNEL_CONFIG_UL(92, "DUN2", 32, 1),
797+
MHI_CHANNEL_CONFIG_DL(93, "DUN2", 32, 1),
798+
MHI_CHANNEL_CONFIG_HW_UL(100, "IP_HW0", 128, 2),
799+
MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 3),
800+
};
801+
802+
static const struct mhi_controller_config modem_telit_fn920c04_config = {
803+
.max_channels = 128,
804+
.timeout_ms = 50000,
805+
.num_channels = ARRAY_SIZE(mhi_telit_fn920c04_channels),
806+
.ch_cfg = mhi_telit_fn920c04_channels,
807+
.num_events = ARRAY_SIZE(mhi_telit_fn990_events),
808+
.event_cfg = mhi_telit_fn990_events,
809+
};
810+
811+
static const struct mhi_pci_dev_info mhi_telit_fn920c04_info = {
812+
.name = "telit-fn920c04",
813+
.config = &modem_telit_fn920c04_config,
814+
.bar_num = MHI_PCI_DEFAULT_BAR_NUM,
815+
.dma_data_width = 32,
816+
.sideband_wake = false,
817+
.mru_default = 32768,
818+
.edl_trigger = true,
819+
};
820+
785821
static const struct mhi_pci_dev_info mhi_netprisma_lcur57_info = {
786822
.name = "netprisma-lcur57",
787823
.edl = "qcom/prog_firehose_sdx24.mbn",
@@ -806,6 +842,9 @@ static const struct mhi_pci_dev_info mhi_netprisma_fcun69_info = {
806842
static const struct pci_device_id mhi_pci_id_table[] = {
807843
{PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0116),
808844
.driver_data = (kernel_ulong_t) &mhi_qcom_sa8775p_info },
845+
/* Telit FN920C04 (sdx35) */
846+
{PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x011a, 0x1c5d, 0x2020),
847+
.driver_data = (kernel_ulong_t) &mhi_telit_fn920c04_info },
809848
{ PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0304),
810849
.driver_data = (kernel_ulong_t) &mhi_qcom_sdx24_info },
811850
{ PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x0306, PCI_VENDOR_ID_QCOM, 0x010c),
@@ -996,10 +1035,6 @@ static int mhi_pci_claim(struct mhi_controller *mhi_cntrl,
9961035
struct pci_dev *pdev = to_pci_dev(mhi_cntrl->cntrl_dev);
9971036
int err;
9981037

999-
err = pci_assign_resource(pdev, bar_num);
1000-
if (err)
1001-
return err;
1002-
10031038
err = pcim_enable_device(pdev);
10041039
if (err) {
10051040
dev_err(&pdev->dev, "failed to enable pci device: %d\n", err);

drivers/bus/mhi/host/pm.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ static void mhi_pm_sys_error_transition(struct mhi_controller *mhi_cntrl)
602602
struct mhi_cmd *mhi_cmd;
603603
struct mhi_event_ctxt *er_ctxt;
604604
struct device *dev = &mhi_cntrl->mhi_dev->dev;
605+
bool reset_device = false;
605606
int ret, i;
606607

607608
dev_dbg(dev, "Transitioning from PM state: %s to: %s\n",
@@ -630,8 +631,23 @@ static void mhi_pm_sys_error_transition(struct mhi_controller *mhi_cntrl)
630631
/* Wake up threads waiting for state transition */
631632
wake_up_all(&mhi_cntrl->state_event);
632633

633-
/* Trigger MHI RESET so that the device will not access host memory */
634634
if (MHI_REG_ACCESS_VALID(prev_state)) {
635+
/*
636+
* If the device is in PBL or SBL, it will only respond to
637+
* RESET if the device is in SYSERR state. SYSERR might
638+
* already be cleared at this point.
639+
*/
640+
enum mhi_state cur_state = mhi_get_mhi_state(mhi_cntrl);
641+
enum mhi_ee_type cur_ee = mhi_get_exec_env(mhi_cntrl);
642+
643+
if (cur_state == MHI_STATE_SYS_ERR)
644+
reset_device = true;
645+
else if (cur_ee != MHI_EE_PBL && cur_ee != MHI_EE_SBL)
646+
reset_device = true;
647+
}
648+
649+
/* Trigger MHI RESET so that the device will not access host memory */
650+
if (reset_device) {
635651
u32 in_reset = -1;
636652
unsigned long timeout = msecs_to_jiffies(mhi_cntrl->timeout_ms);
637653

0 commit comments

Comments
 (0)