Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba6dd9aa authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "cnss2: set rddm support boolean for MHI"

parents ff342945 cc96a973
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -403,6 +403,11 @@ static int mhi_force_suspend(struct mhi_controller *mhi_cntrl)

	MHI_CNTRL_LOG("Entered\n");

	if (debug_mode == MHI_DEBUG_NO_D3 || debug_mode == MHI_FWIMAGE_NO_D3) {
		MHI_CNTRL_LOG("Exited due to debug mode:%d\n", debug_mode);
		return ret;
	}

	mutex_lock(&mhi_cntrl->pm_mutex);

	for (; itr; itr--) {
@@ -676,7 +681,7 @@ static struct mhi_controller *mhi_register_controller(struct pci_dev *pci_dev)
	bool use_s1;
	u32 addr_win[2];
	const char *iommu_dma_type;
	int ret, i;
	int ret, i, len;

	if (!of_node)
		return ERR_PTR(-ENODEV);
@@ -752,14 +757,22 @@ static struct mhi_controller *mhi_register_controller(struct pci_dev *pci_dev)
	if (ret)
		goto error_register;

	for (i = 0; i < ARRAY_SIZE(firmware_table); i++) {
	len = ARRAY_SIZE(firmware_table);
	for (i = 0; i < len; i++) {
		firmware_info = firmware_table + i;

		/* debug mode always use default */
		if (!debug_mode && mhi_cntrl->dev_id == firmware_info->dev_id)
		if (mhi_cntrl->dev_id == firmware_info->dev_id)
			break;
	}

	if (debug_mode) {
		if (debug_mode <= MHI_DEBUG_D3)
			firmware_info = firmware_table + (len - 1);
		MHI_CNTRL_LOG("fw info: debug_mode:%d dev_id:%d image:%s\n",
			      debug_mode, firmware_info->dev_id,
			      firmware_info->fw_image);
	}

	mhi_cntrl->fw_image = firmware_info->fw_image;
	mhi_cntrl->edl_image = firmware_info->edl_image;

+9 −0
Original line number Diff line number Diff line
@@ -33,6 +33,15 @@
extern const char * const mhi_ee_str[MHI_EE_MAX];
#define TO_MHI_EXEC_STR(ee) (ee >= MHI_EE_MAX ? "INVALID_EE" : mhi_ee_str[ee])

enum mhi_debug_mode {
	MHI_DEBUG_MODE_OFF,
	MHI_DEBUG_NO_D3, /* use debug.mbn as fw image and skip first M3/D3 */
	MHI_DEBUG_D3, /* use debug.mbn as fw image and allow first M3/D3 */
	MHI_FWIMAGE_NO_D3, /* use fw image if found and skip first M3/D3 */
	MHI_FWIMAGE_D3, /* use fw image if found and allow first M3/D3 */
	MHI_DEBUG_MODE_MAX = MHI_FWIMAGE_D3,
};

enum mhi_suspend_mode {
	MHI_ACTIVE_STATE,
	MHI_DEFAULT_SUSPEND,
+4 −0
Original line number Diff line number Diff line
@@ -278,6 +278,10 @@ int mhi_download_rddm_img(struct mhi_controller *mhi_cntrl, bool in_panic)
	void __iomem *base = mhi_cntrl->bhie;
	u32 rx_status;

	/* device supports RDDM but controller wants to skip ramdumps */
	if (!mhi_cntrl->rddm_supported || !mhi_cntrl->rddm_image)
		return -EINVAL;

	if (in_panic)
		return __mhi_download_rddm_in_panic(mhi_cntrl);

+1 −1
Original line number Diff line number Diff line
@@ -1780,7 +1780,7 @@ int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl)
	 * allocate rddm table if specified, this table is for debug purpose
	 * so we'll ignore erros
	 */
	if (mhi_cntrl->rddm_size) {
	if (mhi_cntrl->rddm_supported && mhi_cntrl->rddm_size) {
		mhi_alloc_bhie_table(mhi_cntrl, &mhi_cntrl->rddm_image,
				     mhi_cntrl->rddm_size);

+11 −9
Original line number Diff line number Diff line
@@ -1212,7 +1212,7 @@ int mhi_process_ctrl_ev_ring(struct mhi_controller *mhi_cntrl,
				 * event instead of sys error state change event
				 */
				if (mhi_cntrl->ee == MHI_EE_RDDM ||
				    mhi_cntrl->rddm_image)
				    mhi_cntrl->rddm_supported)
					break;

				MHI_ERR("MHI system error detected\n");
@@ -1638,20 +1638,20 @@ irqreturn_t mhi_intvec_threaded_handlr(int irq_number, void *dev)
		TO_MHI_EXEC_STR(ee),
		TO_MHI_STATE_STR(state));

	if (mhi_cntrl->power_down) {
		write_unlock_irq(&mhi_cntrl->pm_lock);
		goto exit_intvec;
	}

	if (state == MHI_STATE_SYS_ERR) {
		MHI_ERR("MHI system error detected\n");
		pm_state = mhi_tryset_pm_state(mhi_cntrl,
					       MHI_PM_SYS_ERR_DETECT);
	}

	if (mhi_cntrl->rddm_supported) {
		/* exit as power down is already initiated */
		if (mhi_cntrl->power_down || ee != MHI_EE_RDDM) {
			write_unlock_irq(&mhi_cntrl->pm_lock);
			goto exit_intvec;
		}

	if (ee == MHI_EE_RDDM) {
		write_lock_irq(&mhi_cntrl->pm_lock);
		/* prevent multiple entries for RDDM execution environment */
		if (mhi_cntrl->ee == MHI_EE_RDDM) {
			write_unlock_irq(&mhi_cntrl->pm_lock);
			goto exit_intvec;
@@ -1671,6 +1671,8 @@ irqreturn_t mhi_intvec_threaded_handlr(int irq_number, void *dev)
		goto exit_intvec;
	}

	write_unlock_irq(&mhi_cntrl->pm_lock);

	/* if device is in RDDM, don't bother processing SYS_ERR */
	if (ee != MHI_EE_RDDM && pm_state == MHI_PM_SYS_ERR_DETECT) {
		wake_up_all(&mhi_cntrl->state_event);
Loading