summaryrefslogtreecommitdiff
path: root/drivers/scsi
diff options
context:
space:
mode:
authorAsutosh Das <asutoshd@codeaurora.org>2017-06-07 11:47:42 +0530
committerAsutosh Das <asutoshd@codeaurora.org>2017-06-14 10:55:47 +0530
commit86bb7105eafca7fd99f6eefd13a648e1f3f98625 (patch)
treef8927f17fabfc408e7c15853cd5cf1b4eb8ca67d /drivers/scsi
parentccde34ffb3f4e58f6885a6489c7e2eaeb7eca5e9 (diff)
scsi: ufs-qcom: Add check for ufs bootdevice
On qcom platforms, bootdevice is the primary storage device. The regulators to this device are left ON by the bootloaders. Detecting further in the init sequence that UFS is not the bootdevice entails turning-off of these regulators without sending PON. This is bad for the underlying storage device. Change-Id: I7e9231f0bcf90d8f329146ae2d831bbb5ef8190e Signed-off-by: Asutosh Das <asutoshd@codeaurora.org>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ufs/ufs-qcom.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index aadaef7d1bed..aae796678ffe 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -2093,9 +2093,6 @@ static int ufs_qcom_init(struct ufs_hba *hba)
struct ufs_qcom_host *host;
struct resource *res;
- if (strlen(android_boot_dev) && strcmp(android_boot_dev, dev_name(dev)))
- return -ENODEV;
-
host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
if (!host) {
err = -ENOMEM;
@@ -2787,6 +2784,24 @@ static int ufs_qcom_probe(struct platform_device *pdev)
{
int err;
struct device *dev = &pdev->dev;
+ struct device_node *np = dev->of_node;
+
+ /*
+ * On qcom platforms, bootdevice is the primary storage
+ * device. This device can either be eMMC or UFS.
+ * The type of device connected is detected at runtime.
+ * So, if an eMMC device is connected, and this function
+ * is invoked, it would turn-off the regulator if it detects
+ * that the storage device is not ufs.
+ * These regulators are turned ON by the bootloaders & turning
+ * them off without sending PON may damage the connected device.
+ * Hence, check for the connected device early-on & don't turn-off
+ * the regulators.
+ */
+ if (of_property_read_bool(np, "non-removable") &&
+ strlen(android_boot_dev) &&
+ strcmp(android_boot_dev, dev_name(dev)))
+ return -ENODEV;
/* Perform generic probe */
err = ufshcd_pltfrm_init(pdev, &ufs_hba_qcom_variant);