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

Commit a889db04 authored by Subhash Jadavani's avatar Subhash Jadavani
Browse files

scsi: ufs-qcom: increase max UFS host count to 2



Newer chipsets may have 2 instances of UFS host controllers, one for
embedded UFS device and another for removable UFS card. This change
increases the MAX_UFS_QCOM_HOSTS to 2 so it can hold the pointers
to data structures of both the UFS host controllers. To save the
pointers at relevant index, we will get alias id for the given
device_node using the "ufshcX" alias ids (where X is either 1 or 2).

Change-Id: I1bf47a499a64407b2d10fb36c5cd3e77c90b0bb8
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
parent 35c309a2
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -1832,6 +1832,24 @@ static void ufs_qcom_parse_lpm(struct ufs_qcom_host *host)
		pr_info("%s: will disable all LPM modes\n", __func__);
}

static void ufs_qcom_save_host_ptr(struct ufs_hba *hba)
{
	struct ufs_qcom_host *host = ufshcd_get_variant(hba);
	int id;

	if (!hba->dev->of_node)
		return;

	/* Extract platform data */
	id = of_alias_get_id(hba->dev->of_node, "ufshc");
	if (id <= 0)
		dev_err(hba->dev, "Failed to get host index %d\n", id);
	else if (id <= MAX_UFS_QCOM_HOSTS)
		ufs_qcom_hosts[id - 1] = host;
	else
		dev_err(hba->dev, "invalid host index %d\n", id);
}

/**
 * ufs_qcom_init - bind phy with controller
 * @hba: host controller instance
@@ -1968,9 +1986,6 @@ static int ufs_qcom_init(struct ufs_hba *hba)

	ufs_qcom_setup_clocks(hba, true, false);

	if (hba->dev->id < MAX_UFS_QCOM_HOSTS)
		ufs_qcom_hosts[hba->dev->id] = host;

	host->dbg_print_en |= UFS_QCOM_DEFAULT_DBG_PRINT_EN;
	ufs_qcom_get_default_testbus_cfg(host);
	err = ufs_qcom_testbus_config(host);
@@ -1980,6 +1995,8 @@ static int ufs_qcom_init(struct ufs_hba *hba)
		err = 0;
	}

	ufs_qcom_save_host_ptr(hba);

	goto out;

out_disable_phy:
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
#include <linux/pm_qos.h>
#include "ufshcd.h"

#define MAX_UFS_QCOM_HOSTS	1
#define MAX_UFS_QCOM_HOSTS	2
#define MAX_U32                 (~(u32)0)
#define MPHY_TX_FSM_STATE       0x41
#define TX_FSM_HIBERN8          0x1