diff mbox series

[RFT] ufs: qcom: drop custom Android boot parameters

Message ID 20220320110616.18355-1-krzk@kernel.org
State Accepted
Commit 5ca0faf9c292029ec6f9edbfe7b42e97dcb87dca
Headers show
Series [RFT] ufs: qcom: drop custom Android boot parameters | expand

Commit Message

Krzysztof Kozlowski March 20, 2022, 11:06 a.m. UTC
The QCOM UFS driver requires an androidboot.bootdevice command line
argument matching the UFS device name.  If the name is different, it
refuses to probe.  Thise androidboot.bootdevice is provided by
stock/vendor (from an Android-based device) bootloader.

This does not make sense from Linux point of view.  Driver should be
able to boot regardless of bootloader.  Driver should not depend on some
Android custom environment data.

Cc: Luca Weiss <luca.weiss@fairphone.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

Not tested, please kindly provide tests.

See also:
https://lore.kernel.org/linux-devicetree/f61abc2b-3ce8-7b1f-3d28-8a4a03ec58eb@kernel.org/T/#u
---
 drivers/scsi/ufs/ufs-qcom.c | 15 ---------------
 1 file changed, 15 deletions(-)

Comments

Alim Akhtar March 21, 2022, 11:41 a.m. UTC | #1
>-----Original Message-----
>From: Krzysztof Kozlowski [mailto:krzk@kernel.org]
>Sent: Sunday, March 20, 2022 4:36 PM
>To: Andy Gross <agross@kernel.org>; Bjorn Andersson
><bjorn.andersson@linaro.org>; Alim Akhtar <alim.akhtar@samsung.com>;
>Avri Altman <avri.altman@wdc.com>; James E.J. Bottomley
><jejb@linux.ibm.com>; Martin K. Petersen <martin.petersen@oracle.com>;
>linux-arm-msm@vger.kernel.org; linux-scsi@vger.kernel.org; linux-
>kernel@vger.kernel.org
>Cc: Krzysztof Kozlowski <krzk@kernel.org>; Luca Weiss
><luca.weiss@fairphone.com>
>Subject: [RFT] ufs: qcom: drop custom Android boot parameters
>
>The QCOM UFS driver requires an androidboot.bootdevice command line
>argument matching the UFS device name.  If the name is different, it
refuses
>to probe.  Thise androidboot.bootdevice is provided by stock/vendor (from
an


In case you are resending 
s/thise/this

Rest looks good.

>Android-based device) bootloader.
>
>This does not make sense from Linux point of view.  Driver should be able
to
>boot regardless of bootloader.  Driver should not depend on some Android
>custom environment data.
>
>Cc: Luca Weiss <luca.weiss@fairphone.com>
>Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
>
>---
>
>Not tested, please kindly provide tests.
>
>See also:
>https://lore.kernel.org/linux-devicetree/f61abc2b-3ce8-7b1f-3d28-
>8a4a03ec58eb@kernel.org/T/#u
>---
> drivers/scsi/ufs/ufs-qcom.c | 15 ---------------
> 1 file changed, 15 deletions(-)
>
>diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index
>0d2e950d0865..586c0e567ff9 100644
>--- a/drivers/scsi/ufs/ufs-qcom.c
>+++ b/drivers/scsi/ufs/ufs-qcom.c
>@@ -957,18 +957,6 @@ static const struct reset_control_ops
>ufs_qcom_reset_ops = {
> 	.deassert = ufs_qcom_reset_deassert,
> };
>
>-#define	ANDROID_BOOT_DEV_MAX	30
>-static char android_boot_dev[ANDROID_BOOT_DEV_MAX];
>-
>-#ifndef MODULE
>-static int __init get_android_boot_dev(char *str) -{
>-	strlcpy(android_boot_dev, str, ANDROID_BOOT_DEV_MAX);
>-	return 1;
>-}
>-__setup("androidboot.bootdevice=", get_android_boot_dev); -#endif
>-
> /**
>  * ufs_qcom_init - bind phy with controller
>  * @hba: host controller instance
>@@ -988,9 +976,6 @@ static int ufs_qcom_init(struct ufs_hba *hba)
> 	struct resource *res;
> 	struct ufs_clk_info *clki;
>
>-	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;
>--
>2.32.0
Luca Weiss March 21, 2022, 11:58 a.m. UTC | #2
Hi Krzysztof,

On Sun Mar 20, 2022 at 12:06 PM CET, Krzysztof Kozlowski wrote:
> The QCOM UFS driver requires an androidboot.bootdevice command line
> argument matching the UFS device name.  If the name is different, it
> refuses to probe.  Thise androidboot.bootdevice is provided by
> stock/vendor (from an Android-based device) bootloader.
>
> This does not make sense from Linux point of view.  Driver should be
> able to boot regardless of bootloader.  Driver should not depend on some
> Android custom environment data.
>
> Cc: Luca Weiss <luca.weiss@fairphone.com>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

As expected this makes UFS probe even if the node is named ufs@1d84000
on my device.

While I don't know why the code existed in the first place, it was added
back in 2015 with the introduction of the driver, so probably it's just
some remains from downstream that weren't cleaned up back then.

With this commit also 6b9afd8f96c6 ("arm64: dts: qcom: sm8250: change
ufs node name to ufshc") could be reverted (but it would probably make
more sense to rename all ufshc@ to ufs@ in a new commit).

Tested-by: Luca Weiss <luca.weiss@fairphone.com>

Regards
Luca

>
> ---
>
> Not tested, please kindly provide tests.
>
> See also:
> https://lore.kernel.org/linux-devicetree/f61abc2b-3ce8-7b1f-3d28-8a4a03ec58eb@kernel.org/T/#u
> ---
>  drivers/scsi/ufs/ufs-qcom.c | 15 ---------------
>  1 file changed, 15 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
> index 0d2e950d0865..586c0e567ff9 100644
> --- a/drivers/scsi/ufs/ufs-qcom.c
> +++ b/drivers/scsi/ufs/ufs-qcom.c
> @@ -957,18 +957,6 @@ static const struct reset_control_ops ufs_qcom_reset_ops = {
>  	.deassert = ufs_qcom_reset_deassert,
>  };
>  
> -#define	ANDROID_BOOT_DEV_MAX	30
> -static char android_boot_dev[ANDROID_BOOT_DEV_MAX];
> -
> -#ifndef MODULE
> -static int __init get_android_boot_dev(char *str)
> -{
> -	strlcpy(android_boot_dev, str, ANDROID_BOOT_DEV_MAX);
> -	return 1;
> -}
> -__setup("androidboot.bootdevice=", get_android_boot_dev);
> -#endif
> -
>  /**
>   * ufs_qcom_init - bind phy with controller
>   * @hba: host controller instance
> @@ -988,9 +976,6 @@ static int ufs_qcom_init(struct ufs_hba *hba)
>  	struct resource *res;
>  	struct ufs_clk_info *clki;
>  
> -	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;
> -- 
> 2.32.0
Brian Masney March 21, 2022, 1:44 p.m. UTC | #3
On Sun, Mar 20, 2022 at 12:06:16PM +0100, Krzysztof Kozlowski wrote:
> The QCOM UFS driver requires an androidboot.bootdevice command line
> argument matching the UFS device name.  If the name is different, it
> refuses to probe.  Thise androidboot.bootdevice is provided by
> stock/vendor (from an Android-based device) bootloader.
> 
> This does not make sense from Linux point of view.  Driver should be
> able to boot regardless of bootloader.  Driver should not depend on some
> Android custom environment data.
> 
> Cc: Luca Weiss <luca.weiss@fairphone.com>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

I encountered that same code a few months ago and thought then that
this code doesn't belong here.

Reviewed-by: Brian Masney <bmasney@redhat.com>
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 0d2e950d0865..586c0e567ff9 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -957,18 +957,6 @@  static const struct reset_control_ops ufs_qcom_reset_ops = {
 	.deassert = ufs_qcom_reset_deassert,
 };
 
-#define	ANDROID_BOOT_DEV_MAX	30
-static char android_boot_dev[ANDROID_BOOT_DEV_MAX];
-
-#ifndef MODULE
-static int __init get_android_boot_dev(char *str)
-{
-	strlcpy(android_boot_dev, str, ANDROID_BOOT_DEV_MAX);
-	return 1;
-}
-__setup("androidboot.bootdevice=", get_android_boot_dev);
-#endif
-
 /**
  * ufs_qcom_init - bind phy with controller
  * @hba: host controller instance
@@ -988,9 +976,6 @@  static int ufs_qcom_init(struct ufs_hba *hba)
 	struct resource *res;
 	struct ufs_clk_info *clki;
 
-	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;