LKML Archive on lore.kernel.org help / color / mirror / Atom feed
* [PATCH 0/3] (Qualcomm) UFS device reset support @ 2019-06-04 7:19 Bjorn Andersson 2019-06-04 7:19 ` [PATCH 1/3] pinctrl: qcom: sdm845: Expose ufs_reset as gpio Bjorn Andersson ` (3 more replies) 0 siblings, 4 replies; 21+ messages in thread From: Bjorn Andersson @ 2019-06-04 7:19 UTC (permalink / raw) Cc: Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-scsi This series exposes the ufs_reset line as a gpio, adds support for ufshcd to acquire and toggle this and then adds this to SDM845 MTP. Bjorn Andersson (3): pinctrl: qcom: sdm845: Expose ufs_reset as gpio scsi: ufs: Allow resetting the UFS device arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO .../bindings/pinctrl/qcom,sdm845-pinctrl.txt | 2 +- arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 2 + drivers/pinctrl/qcom/pinctrl-sdm845.c | 12 ++--- drivers/scsi/ufs/ufshcd.c | 44 +++++++++++++++++++ drivers/scsi/ufs/ufshcd.h | 4 ++ 5 files changed, 57 insertions(+), 7 deletions(-) -- 2.18.0 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 1/3] pinctrl: qcom: sdm845: Expose ufs_reset as gpio 2019-06-04 7:19 [PATCH 0/3] (Qualcomm) UFS device reset support Bjorn Andersson @ 2019-06-04 7:19 ` Bjorn Andersson 2019-06-07 21:26 ` Linus Walleij 2019-06-04 7:20 ` [PATCH 2/3] scsi: ufs: Allow resetting the UFS device Bjorn Andersson ` (2 subsequent siblings) 3 siblings, 1 reply; 21+ messages in thread From: Bjorn Andersson @ 2019-06-04 7:19 UTC (permalink / raw) To: Linus Walleij, Rob Herring Cc: Andy Gross, Mark Rutland, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-scsi The ufs_reset pin is expected to be wired to the reset pin of the primary UFS memory but is pretty much just a general purpose output pinr Reorder the pins and expose it as gpio 150, so that the UFS driver can toggle it. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> --- .../bindings/pinctrl/qcom,sdm845-pinctrl.txt | 2 +- drivers/pinctrl/qcom/pinctrl-sdm845.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,sdm845-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/qcom,sdm845-pinctrl.txt index 665aadb5ea28..33ae08aa4b89 100644 --- a/Documentation/devicetree/bindings/pinctrl/qcom,sdm845-pinctrl.txt +++ b/Documentation/devicetree/bindings/pinctrl/qcom,sdm845-pinctrl.txt @@ -79,7 +79,7 @@ to specify in a pin configuration subnode: gpio0-gpio149 Supports mux, bias and drive-strength - sdc2_clk, sdc2_cmd, sdc2_data + sdc2_clk, sdc2_cmd, sdc2_data, ufs_reset Supports bias and drive-strength - function: diff --git a/drivers/pinctrl/qcom/pinctrl-sdm845.c b/drivers/pinctrl/qcom/pinctrl-sdm845.c index c97f20fca5fd..e4e5acade086 100644 --- a/drivers/pinctrl/qcom/pinctrl-sdm845.c +++ b/drivers/pinctrl/qcom/pinctrl-sdm845.c @@ -420,10 +420,10 @@ DECLARE_MSM_GPIO_PINS(147); DECLARE_MSM_GPIO_PINS(148); DECLARE_MSM_GPIO_PINS(149); -static const unsigned int sdc2_clk_pins[] = { 150 }; -static const unsigned int sdc2_cmd_pins[] = { 151 }; -static const unsigned int sdc2_data_pins[] = { 152 }; -static const unsigned int ufs_reset_pins[] = { 153 }; +static const unsigned int ufs_reset_pins[] = { 150 }; +static const unsigned int sdc2_clk_pins[] = { 151 }; +static const unsigned int sdc2_cmd_pins[] = { 152 }; +static const unsigned int sdc2_data_pins[] = { 153 }; enum sdm845_functions { msm_mux_gpio, @@ -1271,10 +1271,10 @@ static const struct msm_pingroup sdm845_groups[] = { PINGROUP(147, NORTH, _, _, _, _, _, _, _, _, _, _), PINGROUP(148, NORTH, _, _, _, _, _, _, _, _, _, _), PINGROUP(149, NORTH, _, _, _, _, _, _, _, _, _, _), + UFS_RESET(ufs_reset, 0x99f000), SDC_QDSD_PINGROUP(sdc2_clk, 0x99a000, 14, 6), SDC_QDSD_PINGROUP(sdc2_cmd, 0x99a000, 11, 3), SDC_QDSD_PINGROUP(sdc2_data, 0x99a000, 9, 0), - UFS_RESET(ufs_reset, 0x99f000), }; static const struct msm_pinctrl_soc_data sdm845_pinctrl = { @@ -1284,7 +1284,7 @@ static const struct msm_pinctrl_soc_data sdm845_pinctrl = { .nfunctions = ARRAY_SIZE(sdm845_functions), .groups = sdm845_groups, .ngroups = ARRAY_SIZE(sdm845_groups), - .ngpios = 150, + .ngpios = 151, }; static int sdm845_pinctrl_probe(struct platform_device *pdev) -- 2.18.0 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 1/3] pinctrl: qcom: sdm845: Expose ufs_reset as gpio 2019-06-04 7:19 ` [PATCH 1/3] pinctrl: qcom: sdm845: Expose ufs_reset as gpio Bjorn Andersson @ 2019-06-07 21:26 ` Linus Walleij 0 siblings, 0 replies; 21+ messages in thread From: Linus Walleij @ 2019-06-07 21:26 UTC (permalink / raw) To: Bjorn Andersson Cc: Rob Herring, Andy Gross, Mark Rutland, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, MSM, open list:GPIO SUBSYSTEM, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, linux-kernel, linux-scsi On Tue, Jun 4, 2019 at 9:20 AM Bjorn Andersson <bjorn.andersson@linaro.org> wrote: > The ufs_reset pin is expected to be wired to the reset pin of the > primary UFS memory but is pretty much just a general purpose output pinr > > Reorder the pins and expose it as gpio 150, so that the UFS driver can > toggle it. > > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Patch applied. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 2/3] scsi: ufs: Allow resetting the UFS device 2019-06-04 7:19 [PATCH 0/3] (Qualcomm) UFS device reset support Bjorn Andersson 2019-06-04 7:19 ` [PATCH 1/3] pinctrl: qcom: sdm845: Expose ufs_reset as gpio Bjorn Andersson @ 2019-06-04 7:20 ` Bjorn Andersson 2019-06-04 8:13 ` [EXT] " Bean Huo (beanhuo) 2019-06-04 15:25 ` Stephen Boyd 2019-06-04 7:20 ` [PATCH 3/3] arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO Bjorn Andersson 2019-06-04 22:00 ` [PATCH 0/3] (Qualcomm) UFS device reset support John Stultz 3 siblings, 2 replies; 21+ messages in thread From: Bjorn Andersson @ 2019-06-04 7:20 UTC (permalink / raw) To: Pedro Sousa, James E.J. Bottomley, Martin K. Petersen Cc: Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-scsi Acquire the device-reset GPIO and toggle this to reset the UFS device during initialization and host reset. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> --- drivers/scsi/ufs/ufshcd.c | 44 +++++++++++++++++++++++++++++++++++++++ drivers/scsi/ufs/ufshcd.h | 4 ++++ 2 files changed, 48 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 8c1c551f2b42..951a0efee536 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -42,6 +42,7 @@ #include <linux/nls.h> #include <linux/of.h> #include <linux/bitfield.h> +#include <linux/gpio/consumer.h> #include "ufshcd.h" #include "ufs_quirks.h" #include "unipro.h" @@ -6104,6 +6105,25 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) return err; } +/** + ufshcd_device_reset() - toggle the (optional) device reset line + * @hba: per-adapter instance + * + * Toggles the (optional) reset line to reset the attached device. + */ +static void ufshcd_device_reset(struct ufs_hba *hba) +{ + /* + * The USB device shall detect reset pulses of 1us, sleep for 10us to + * be on the safe side. + */ + gpiod_set_value_cansleep(hba->device_reset, 1); + usleep_range(10, 15); + + gpiod_set_value_cansleep(hba->device_reset, 0); + usleep_range(10, 15); +} + /** * ufshcd_host_reset_and_restore - reset and restore host controller * @hba: per-adapter instance @@ -6159,6 +6179,9 @@ static int ufshcd_reset_and_restore(struct ufs_hba *hba) int retries = MAX_HOST_RESET_RETRIES; do { + /* Reset the attached device */ + ufshcd_device_reset(hba); + err = ufshcd_host_reset_and_restore(hba); } while (err && --retries); @@ -7355,6 +7378,18 @@ static void ufshcd_variant_hba_exit(struct ufs_hba *hba) ufshcd_vops_exit(hba); } +static int ufshcd_init_device_reset(struct ufs_hba *hba) +{ + hba->device_reset = devm_gpiod_get_optional(hba->dev, "device-reset", + GPIOD_OUT_HIGH); + if (IS_ERR(hba->device_reset)) { + dev_err(hba->dev, "failed to acquire reset gpio: %ld\n", + PTR_ERR(hba->device_reset)); + } + + return PTR_ERR_OR_ZERO(hba->device_reset); +} + static int ufshcd_hba_init(struct ufs_hba *hba) { int err; @@ -7394,9 +7429,15 @@ static int ufshcd_hba_init(struct ufs_hba *hba) if (err) goto out_disable_vreg; + err = ufshcd_init_device_reset(hba); + if (err) + goto out_disable_variant; + hba->is_powered = true; goto out; +out_disable_variant: + ufshcd_vops_setup_regulators(hba, false); out_disable_vreg: ufshcd_setup_vreg(hba, false); out_disable_clks: @@ -8290,6 +8331,9 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) goto exit_gating; } + /* Reset the attached device */ + ufshcd_device_reset(hba); + /* Host controller enable */ err = ufshcd_hba_enable(hba); if (err) { diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index ecfa898b9ccc..d8be67742168 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -72,6 +72,8 @@ #define UFSHCD "ufshcd" #define UFSHCD_DRIVER_VERSION "0.2" +struct gpio_desc; + struct ufs_hba; enum dev_cmd_type { @@ -706,6 +708,8 @@ struct ufs_hba { struct device bsg_dev; struct request_queue *bsg_queue; + + struct gpio_desc *device_reset; }; /* Returns true if clocks can be gated. Otherwise false */ -- 2.18.0 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* RE: [EXT] [PATCH 2/3] scsi: ufs: Allow resetting the UFS device 2019-06-04 7:20 ` [PATCH 2/3] scsi: ufs: Allow resetting the UFS device Bjorn Andersson @ 2019-06-04 8:13 ` Bean Huo (beanhuo) 2019-06-04 18:10 ` John Stultz 2019-06-04 22:30 ` Bjorn Andersson 2019-06-04 15:25 ` Stephen Boyd 1 sibling, 2 replies; 21+ messages in thread From: Bean Huo (beanhuo) @ 2019-06-04 8:13 UTC (permalink / raw) To: Bjorn Andersson, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen Cc: Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-scsi Hi, Bjorn >Acquire the device-reset GPIO and toggle this to reset the UFS device during >initialization and host reset. > >+/** >+ ufshcd_device_reset() - toggle the (optional) device reset line >+ * @hba: per-adapter instance >+ * >+ * Toggles the (optional) reset line to reset the attached device. >+ */ >+static void ufshcd_device_reset(struct ufs_hba *hba) { >+ /* >+ * The USB device shall detect reset pulses of 1us, sleep for 10us to >+ * be on the safe side. >+ */ >+ gpiod_set_value_cansleep(hba->device_reset, 1); >+ usleep_range(10, 15); >+ >+ gpiod_set_value_cansleep(hba->device_reset, 0); >+ usleep_range(10, 15); >+} >+ > /** > * ufshcd_host_reset_and_restore - reset and restore host controller > * @hba: per-adapter instance >@@ -6159,6 +6179,9 @@ static int ufshcd_reset_and_restore(struct ufs_hba >*hba) > int retries = MAX_HOST_RESET_RETRIES; > > do { >+ /* Reset the attached device */ >+ ufshcd_device_reset(hba); >+ what's problem you met, and you should reset UFS device here? could you give more info? It is true that we don't reset UFS device in case of device fatal error. According to UFS host spec, Host should be device reset except that in addition to resetting UIC. But as so far, We didn't experience any problems result from this missing reset. We have three UFS device reset ways. Comparing to this hardware reset, I prefer to use DME_ENDPOINTRESET.req software reset. > err = ufshcd_host_reset_and_restore(hba); > } while (err && --retries); > >@@ -7355,6 +7378,18 @@ static void ufshcd_variant_hba_exit(struct ufs_hba >*hba) > ufshcd_vops_exit(hba); > } > >+static int ufshcd_init_device_reset(struct ufs_hba *hba) { >+ hba->device_reset = devm_gpiod_get_optional(hba->dev, "device- >reset", >+ GPIOD_OUT_HIGH); >+ if (IS_ERR(hba->device_reset)) { >+ dev_err(hba->dev, "failed to acquire reset gpio: %ld\n", >+ PTR_ERR(hba->device_reset)); >+ } >+ >+ return PTR_ERR_OR_ZERO(hba->device_reset); >+} >+ > static int ufshcd_hba_init(struct ufs_hba *hba) { > int err; >@@ -7394,9 +7429,15 @@ static int ufshcd_hba_init(struct ufs_hba *hba) > if (err) > goto out_disable_vreg; > >+ err = ufshcd_init_device_reset(hba); >+ if (err) >+ goto out_disable_variant; >+ > hba->is_powered = true; > goto out; > >+out_disable_variant: >+ ufshcd_vops_setup_regulators(hba, false); > out_disable_vreg: > ufshcd_setup_vreg(hba, false); > out_disable_clks: >@@ -8290,6 +8331,9 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem >*mmio_base, unsigned int irq) > goto exit_gating; > } > >+ /* Reset the attached device */ >+ ufshcd_device_reset(hba); >+ > /* Host controller enable */ > err = ufshcd_hba_enable(hba); > if (err) { >diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index >ecfa898b9ccc..d8be67742168 100644 >--- a/drivers/scsi/ufs/ufshcd.h >+++ b/drivers/scsi/ufs/ufshcd.h >@@ -72,6 +72,8 @@ > #define UFSHCD "ufshcd" > #define UFSHCD_DRIVER_VERSION "0.2" > >+struct gpio_desc; >+ > struct ufs_hba; > > enum dev_cmd_type { >@@ -706,6 +708,8 @@ struct ufs_hba { > > struct device bsg_dev; > struct request_queue *bsg_queue; >+ >+ struct gpio_desc *device_reset; > }; > > /* Returns true if clocks can be gated. Otherwise false */ >-- >2.18.0 ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [EXT] [PATCH 2/3] scsi: ufs: Allow resetting the UFS device 2019-06-04 8:13 ` [EXT] " Bean Huo (beanhuo) @ 2019-06-04 18:10 ` John Stultz 2019-06-04 22:30 ` Bjorn Andersson 1 sibling, 0 replies; 21+ messages in thread From: John Stultz @ 2019-06-04 18:10 UTC (permalink / raw) To: Bean Huo (beanhuo) Cc: Bjorn Andersson, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-scsi, Subhash Jadavani On Tue, Jun 4, 2019 at 1:14 AM Bean Huo (beanhuo) <beanhuo@micron.com> wrote: > > Hi, Bjorn > > >Acquire the device-reset GPIO and toggle this to reset the UFS device during > >initialization and host reset. > > > >+/** > >+ ufshcd_device_reset() - toggle the (optional) device reset line > >+ * @hba: per-adapter instance > >+ * > >+ * Toggles the (optional) reset line to reset the attached device. > >+ */ > >+static void ufshcd_device_reset(struct ufs_hba *hba) { > >+ /* > >+ * The USB device shall detect reset pulses of 1us, sleep for 10us to > >+ * be on the safe side. > >+ */ > >+ gpiod_set_value_cansleep(hba->device_reset, 1); > >+ usleep_range(10, 15); > >+ > >+ gpiod_set_value_cansleep(hba->device_reset, 0); > >+ usleep_range(10, 15); > >+} > >+ > > /** > > * ufshcd_host_reset_and_restore - reset and restore host controller > > * @hba: per-adapter instance > >@@ -6159,6 +6179,9 @@ static int ufshcd_reset_and_restore(struct ufs_hba > >*hba) > > int retries = MAX_HOST_RESET_RETRIES; > > > > do { > >+ /* Reset the attached device */ > >+ ufshcd_device_reset(hba); > >+ > > what's problem you met, and you should reset UFS device here? could you give more info? On the pixel3, devices with micron UFS chips won't boot upstream kernels without this patch, which is a rewrite of an earlier patch: https://git.linaro.org/people/john.stultz/android-dev.git/commit/?h=dev/p3&id=99f3dd8519a848b752679584451c45f42c326a17 Which was pulled from the downstream tree from here: https://android.googlesource.com/kernel/msm.git/+/9c8077087e818017%5E%21/ CCing Subhash as he may have additional context. thanks -john ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [EXT] [PATCH 2/3] scsi: ufs: Allow resetting the UFS device 2019-06-04 8:13 ` [EXT] " Bean Huo (beanhuo) 2019-06-04 18:10 ` John Stultz @ 2019-06-04 22:30 ` Bjorn Andersson 2019-06-05 21:17 ` Bean Huo (beanhuo) 1 sibling, 1 reply; 21+ messages in thread From: Bjorn Andersson @ 2019-06-04 22:30 UTC (permalink / raw) To: Bean Huo (beanhuo) Cc: Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-scsi On Tue 04 Jun 01:13 PDT 2019, Bean Huo (beanhuo) wrote: > >@@ -6159,6 +6179,9 @@ static int ufshcd_reset_and_restore(struct ufs_hba > >*hba) > > int retries = MAX_HOST_RESET_RETRIES; > > > > do { > >+ /* Reset the attached device */ > >+ ufshcd_device_reset(hba); > >+ > > what's problem you met, and you should reset UFS device here? could you give more info? > > It is true that we don't reset UFS device in case of device fatal error. According to UFS host spec, > Host should be device reset except that in addition to resetting UIC. But as so far, > We didn't experience any problems result from this missing reset. > > We have three UFS device reset ways. Comparing to this hardware reset, > I prefer to use DME_ENDPOINTRESET.req software reset. > Hi Bean, Thanks for your questions. With some memories we see issues establishing the link during bootup, so that's the purpose of issuing this reset. Unfortunately the downstream Qualcomm patch [1] (which I should have remembered to attribute), does not mention why the reset during host controller reset is needed - but I'm fairly certain that this scenario would be similar to the handover from bootloader to kernel that we do see an issue with. [1] https://source.codeaurora.org/quic/la/kernel/msm-4.4/commit/?h=msm-4.4&id=0c82737188e2d63a08196e078e411032dbbc3b89 Regards, Bjorn ^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [EXT] [PATCH 2/3] scsi: ufs: Allow resetting the UFS device 2019-06-04 22:30 ` Bjorn Andersson @ 2019-06-05 21:17 ` Bean Huo (beanhuo) 0 siblings, 0 replies; 21+ messages in thread From: Bean Huo (beanhuo) @ 2019-06-05 21:17 UTC (permalink / raw) To: Bjorn Andersson Cc: Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-scsi Hi, Bjorn I think I should give up my preview suggestion DME_ENDPOINTRESET.req software reset, go back to your HW reset. Although SW reset can cover most of the requirement, and compatible with different vendor UFS device, for some device fatal error cases, UFS internal stuck and would not accept SW Reset. An HW reset is expected. Please go on your reset way. Thanks, //Bean >Andy Gross <agross@kernel.org>; Linus Walleij <linus.walleij@linaro.org>; >Rob Herring <robh+dt@kernel.org>; Mark Rutland <mark.rutland@arm.com>; >linux-arm-msm@vger.kernel.org; linux-gpio@vger.kernel.org; >devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; linux- >scsi@vger.kernel.org >Subject: Re: [EXT] [PATCH 2/3] scsi: ufs: Allow resetting the UFS device > >On Tue 04 Jun 01:13 PDT 2019, Bean Huo (beanhuo) wrote: >> >@@ -6159,6 +6179,9 @@ static int ufshcd_reset_and_restore(struct >> >ufs_hba >> >*hba) >> > int retries = MAX_HOST_RESET_RETRIES; >> > >> > do { >> >+ /* Reset the attached device */ >> >+ ufshcd_device_reset(hba); >> >+ >> >> what's problem you met, and you should reset UFS device here? could you >give more info? >> >> It is true that we don't reset UFS device in case of device fatal >> error. According to UFS host spec, Host should be device reset except >> that in addition to resetting UIC. But as so far, We didn't experience any >problems result from this missing reset. >> >> We have three UFS device reset ways. Comparing to this hardware >> reset, I prefer to use DME_ENDPOINTRESET.req software reset. >> > >Hi Bean, > >Thanks for your questions. With some memories we see issues establishing >the link during bootup, so that's the purpose of issuing this reset. > >Unfortunately the downstream Qualcomm patch [1] (which I should have >remembered to attribute), does not mention why the reset during host >controller reset is needed - but I'm fairly certain that this scenario would be >similar to the handover from bootloader to kernel that we do see an issue >with. > > >[1] >https://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsource >.codeaurora.org%2Fquic%2Fla%2Fkernel%2Fmsm- >4.4%2Fcommit%2F%3Fh%3Dmsm- >4.4%26id%3D0c82737188e2d63a08196e078e411032dbbc3b89&data=02% >7C01%7Cbeanhuo%40micron.com%7Cf72404eb906440e1f9c408d6e93c401d%7 >Cf38a5ecd28134862b11bac1d563c806f%7C0%7C0%7C636952842324926509&a >mp;sdata=I%2FH7km6b34jyoUa1RVEPApfYt5uSFtHqL3%2BvV1bvryM%3D& >;reserved=0 > >Regards, >Bjorn ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] scsi: ufs: Allow resetting the UFS device 2019-06-04 7:20 ` [PATCH 2/3] scsi: ufs: Allow resetting the UFS device Bjorn Andersson 2019-06-04 8:13 ` [EXT] " Bean Huo (beanhuo) @ 2019-06-04 15:25 ` Stephen Boyd 2019-06-04 22:20 ` Bjorn Andersson 1 sibling, 1 reply; 21+ messages in thread From: Stephen Boyd @ 2019-06-04 15:25 UTC (permalink / raw) To: James E.J. Bottomley, Martin K. Petersen, Bjorn Andersson, Pedro Sousa Cc: Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-scsi Quoting Bjorn Andersson (2019-06-04 00:20:00) > @@ -6104,6 +6105,25 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) > return err; > } > > +/** > + ufshcd_device_reset() - toggle the (optional) device reset line > + * @hba: per-adapter instance > + * > + * Toggles the (optional) reset line to reset the attached device. > + */ > +static void ufshcd_device_reset(struct ufs_hba *hba) > +{ > + /* > + * The USB device shall detect reset pulses of 1us, sleep for 10us to This isn't usb though. Can we have a gpio reset driver and then implement this in the reset framework instead? Or did that not work out for some reason? > + * be on the safe side. > + */ > + gpiod_set_value_cansleep(hba->device_reset, 1); > + usleep_range(10, 15); > + > + gpiod_set_value_cansleep(hba->device_reset, 0); > + usleep_range(10, 15); > +} > + > /** > * ufshcd_host_reset_and_restore - reset and restore host controller > * @hba: per-adapter instance ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 2/3] scsi: ufs: Allow resetting the UFS device 2019-06-04 15:25 ` Stephen Boyd @ 2019-06-04 22:20 ` Bjorn Andersson 0 siblings, 0 replies; 21+ messages in thread From: Bjorn Andersson @ 2019-06-04 22:20 UTC (permalink / raw) To: Stephen Boyd Cc: James E.J. Bottomley, Martin K. Petersen, Pedro Sousa, Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-scsi On Tue 04 Jun 08:25 PDT 2019, Stephen Boyd wrote: > Quoting Bjorn Andersson (2019-06-04 00:20:00) > > @@ -6104,6 +6105,25 @@ static int ufshcd_abort(struct scsi_cmnd *cmd) > > return err; > > } > > > > +/** > > + ufshcd_device_reset() - toggle the (optional) device reset line > > + * @hba: per-adapter instance > > + * > > + * Toggles the (optional) reset line to reset the attached device. > > + */ > > +static void ufshcd_device_reset(struct ufs_hba *hba) > > +{ > > + /* > > + * The USB device shall detect reset pulses of 1us, sleep for 10us to > > This isn't usb though. No, it is not. > Can we have a gpio reset driver and then > implement this in the reset framework instead? Or did that not work out > for some reason? > The reset DT binding document clearly describes that resets are for chip-internal resets, and this is a general purpose (output-only) pad on the SoC that's connected to the reset pin on the UFS memory. I actually see nothing preventing you to connect said reset pin to any other GPIO. Regards, Bjorn > > + * be on the safe side. > > + */ > > + gpiod_set_value_cansleep(hba->device_reset, 1); > > + usleep_range(10, 15); > > + > > + gpiod_set_value_cansleep(hba->device_reset, 0); > > + usleep_range(10, 15); > > +} > > + > > /** > > * ufshcd_host_reset_and_restore - reset and restore host controller > > * @hba: per-adapter instance ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 3/3] arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO 2019-06-04 7:19 [PATCH 0/3] (Qualcomm) UFS device reset support Bjorn Andersson 2019-06-04 7:19 ` [PATCH 1/3] pinctrl: qcom: sdm845: Expose ufs_reset as gpio Bjorn Andersson 2019-06-04 7:20 ` [PATCH 2/3] scsi: ufs: Allow resetting the UFS device Bjorn Andersson @ 2019-06-04 7:20 ` Bjorn Andersson 2019-06-04 16:22 ` Stephen Boyd 2019-06-07 22:20 ` Linus Walleij 2019-06-04 22:00 ` [PATCH 0/3] (Qualcomm) UFS device reset support John Stultz 3 siblings, 2 replies; 21+ messages in thread From: Bjorn Andersson @ 2019-06-04 7:20 UTC (permalink / raw) To: Andy Gross Cc: Linus Walleij, Rob Herring, Mark Rutland, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-scsi Specify the UFS device-reset gpio, so that the controller will issue a reset of the UFS device. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> --- arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts index 2e78638eb73b..d116a0956a9c 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts @@ -388,6 +388,8 @@ &ufs_mem_hc { status = "okay"; + device-reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>; + vcc-supply = <&vreg_l20a_2p95>; vcc-max-microamp = <600000>; }; -- 2.18.0 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 3/3] arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO 2019-06-04 7:20 ` [PATCH 3/3] arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO Bjorn Andersson @ 2019-06-04 16:22 ` Stephen Boyd 2019-06-04 22:09 ` Bjorn Andersson 2019-06-07 22:20 ` Linus Walleij 1 sibling, 1 reply; 21+ messages in thread From: Stephen Boyd @ 2019-06-04 16:22 UTC (permalink / raw) To: Andy Gross, Bjorn Andersson Cc: Linus Walleij, Rob Herring, Mark Rutland, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-scsi, Evan Green Quoting Bjorn Andersson (2019-06-04 00:20:01) > Specify the UFS device-reset gpio, so that the controller will issue a > reset of the UFS device. > > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> > --- > arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts > index 2e78638eb73b..d116a0956a9c 100644 > --- a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts > +++ b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts > @@ -388,6 +388,8 @@ > &ufs_mem_hc { > status = "okay"; > > + device-reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>; > + We had to do something similar on one particular brand of UFS that we had. I think it was an SK Hynix part that had trouble and wouldn't provision properly. Either way, we did this with a pinctrl toggle in the DTS where the "init" state has the UFS_RESET pin asserted and then "default" state has the pin deasserted. That was good enough to make this work. &ufs_mem_hc { pinctrl-names = "init", "default"; pinctrl-0 = <&ufs_dev_reset_assert>; pinctrl-1 = <&ufs_dev_reset_deassert>; }; ufs_dev_reset_assert: ufs_dev_reset_assert { config { pins = "ufs_reset"; bias-pull-down; /* default: pull down */ drive-strength = <8>; /* default: 3.1 mA */ output-low; /* active low reset */ }; }; ufs_dev_reset_deassert: ufs_dev_reset_deassert { config { pins = "ufs_reset"; bias-pull-down; /* default: pull down */ drive-strength = <8>; output-high; /* active low reset */ }; }; ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 3/3] arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO 2019-06-04 16:22 ` Stephen Boyd @ 2019-06-04 22:09 ` Bjorn Andersson 0 siblings, 0 replies; 21+ messages in thread From: Bjorn Andersson @ 2019-06-04 22:09 UTC (permalink / raw) To: Stephen Boyd Cc: Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, linux-arm-msm, linux-gpio, devicetree, linux-kernel, linux-scsi, Evan Green On Tue 04 Jun 09:22 PDT 2019, Stephen Boyd wrote: > Quoting Bjorn Andersson (2019-06-04 00:20:01) > > Specify the UFS device-reset gpio, so that the controller will issue a > > reset of the UFS device. > > > > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> > > --- > > arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts > > index 2e78638eb73b..d116a0956a9c 100644 > > --- a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts > > +++ b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts > > @@ -388,6 +388,8 @@ > > &ufs_mem_hc { > > status = "okay"; > > > > + device-reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>; > > + > > We had to do something similar on one particular brand of UFS that we had. I > think it was an SK Hynix part that had trouble and wouldn't provision properly. > Either way, we did this with a pinctrl toggle in the DTS where the "init" state > has the UFS_RESET pin asserted and then "default" state has the pin deasserted. > That was good enough to make this work. > Thanks for pointing this out, I forgot to attribute these downstream changes. I can see how this works, but I must say I find it quite hackish. The downstream solution seems to have evolved this into naming these states and jumping between them (with the appropriate sleeps) during a host reset as well. But thanks for the confirmation that there's more than John's memory that needs this. Regards, Bjorn > &ufs_mem_hc { > pinctrl-names = "init", "default"; > pinctrl-0 = <&ufs_dev_reset_assert>; > pinctrl-1 = <&ufs_dev_reset_deassert>; > }; > > ufs_dev_reset_assert: ufs_dev_reset_assert { > config { > pins = "ufs_reset"; > bias-pull-down; /* default: pull down */ > drive-strength = <8>; /* default: 3.1 mA */ > output-low; /* active low reset */ > }; > }; > > ufs_dev_reset_deassert: ufs_dev_reset_deassert { > config { > pins = "ufs_reset"; > bias-pull-down; /* default: pull down */ > drive-strength = <8>; > output-high; /* active low reset */ > }; > }; ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 3/3] arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO 2019-06-04 7:20 ` [PATCH 3/3] arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO Bjorn Andersson 2019-06-04 16:22 ` Stephen Boyd @ 2019-06-07 22:20 ` Linus Walleij 1 sibling, 0 replies; 21+ messages in thread From: Linus Walleij @ 2019-06-07 22:20 UTC (permalink / raw) To: Bjorn Andersson Cc: Andy Gross, Rob Herring, Mark Rutland, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, MSM, open list:GPIO SUBSYSTEM, open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS, linux-kernel, linux-scsi On Tue, Jun 4, 2019 at 9:20 AM Bjorn Andersson <bjorn.andersson@linaro.org> wrote: > Specify the UFS device-reset gpio, so that the controller will issue a > reset of the UFS device. > > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/3] (Qualcomm) UFS device reset support 2019-06-04 7:19 [PATCH 0/3] (Qualcomm) UFS device reset support Bjorn Andersson ` (2 preceding siblings ...) 2019-06-04 7:20 ` [PATCH 3/3] arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO Bjorn Andersson @ 2019-06-04 22:00 ` John Stultz 2019-06-05 5:50 ` Avri Altman 3 siblings, 1 reply; 21+ messages in thread From: John Stultz @ 2019-06-04 22:00 UTC (permalink / raw) To: Bjorn Andersson Cc: Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, linux-arm-msm, linux-gpio, devicetree, Linux Kernel Mailing List, linux-scsi On Tue, Jun 4, 2019 at 12:22 AM Bjorn Andersson <bjorn.andersson@linaro.org> wrote: > > This series exposes the ufs_reset line as a gpio, adds support for ufshcd to > acquire and toggle this and then adds this to SDM845 MTP. > > Bjorn Andersson (3): > pinctrl: qcom: sdm845: Expose ufs_reset as gpio > scsi: ufs: Allow resetting the UFS device > arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO Adding similar change as in sdm845-mtp to the not yet upstream blueline dts, I validated this allows my micron UFS pixel3 to boot. Tested-by: John Stultz <john.stultz@linaro.org> thanks -john ^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH 0/3] (Qualcomm) UFS device reset support 2019-06-04 22:00 ` [PATCH 0/3] (Qualcomm) UFS device reset support John Stultz @ 2019-06-05 5:50 ` Avri Altman 2019-06-05 6:01 ` Bjorn Andersson 0 siblings, 1 reply; 21+ messages in thread From: Avri Altman @ 2019-06-05 5:50 UTC (permalink / raw) To: John Stultz, Bjorn Andersson Cc: Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, linux-arm-msm, linux-gpio, devicetree, Linux Kernel Mailing List, linux-scsi Hi, > > On Tue, Jun 4, 2019 at 12:22 AM Bjorn Andersson > <bjorn.andersson@linaro.org> wrote: > > > > This series exposes the ufs_reset line as a gpio, adds support for ufshcd to > > acquire and toggle this and then adds this to SDM845 MTP. > > > > Bjorn Andersson (3): > > pinctrl: qcom: sdm845: Expose ufs_reset as gpio > > scsi: ufs: Allow resetting the UFS device > > arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO > > Adding similar change as in sdm845-mtp to the not yet upstream > blueline dts, I validated this allows my micron UFS pixel3 to boot. > > Tested-by: John Stultz <john.stultz@linaro.org> Maybe ufs_hba_variant_ops would be the proper place to add this? Thanks, Avri > > thanks > -john ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/3] (Qualcomm) UFS device reset support 2019-06-05 5:50 ` Avri Altman @ 2019-06-05 6:01 ` Bjorn Andersson 2019-06-05 9:32 ` Avri Altman 0 siblings, 1 reply; 21+ messages in thread From: Bjorn Andersson @ 2019-06-05 6:01 UTC (permalink / raw) To: Avri Altman Cc: John Stultz, Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, linux-arm-msm, linux-gpio, devicetree, Linux Kernel Mailing List, linux-scsi On Tue 04 Jun 22:50 PDT 2019, Avri Altman wrote: > Hi, > > > > > On Tue, Jun 4, 2019 at 12:22 AM Bjorn Andersson > > <bjorn.andersson@linaro.org> wrote: > > > > > > This series exposes the ufs_reset line as a gpio, adds support for ufshcd to > > > acquire and toggle this and then adds this to SDM845 MTP. > > > > > > Bjorn Andersson (3): > > > pinctrl: qcom: sdm845: Expose ufs_reset as gpio > > > scsi: ufs: Allow resetting the UFS device > > > arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO > > > > Adding similar change as in sdm845-mtp to the not yet upstream > > blueline dts, I validated this allows my micron UFS pixel3 to boot. > > > > Tested-by: John Stultz <john.stultz@linaro.org> > Maybe ufs_hba_variant_ops would be the proper place to add this? > Are you saying that these memories only need a reset when they are paired with the Qualcomm host controller? The way it's implemented it here is that the device-reset GPIO is optional and only if you specify it we'll toggle the reset. So if your board design has a UFS memory that requires a reset pulse during initialization you specify this, regardless of which vendor your SoC comes from. Regards, Bjorn ^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH 0/3] (Qualcomm) UFS device reset support 2019-06-05 6:01 ` Bjorn Andersson @ 2019-06-05 9:32 ` Avri Altman 2019-06-06 0:39 ` Bjorn Andersson 0 siblings, 1 reply; 21+ messages in thread From: Avri Altman @ 2019-06-05 9:32 UTC (permalink / raw) To: Bjorn Andersson Cc: John Stultz, Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, linux-arm-msm, linux-gpio, devicetree, Linux Kernel Mailing List, linux-scsi > > On Tue 04 Jun 22:50 PDT 2019, Avri Altman wrote: > > > Hi, > > > > > > > > On Tue, Jun 4, 2019 at 12:22 AM Bjorn Andersson > > > <bjorn.andersson@linaro.org> wrote: > > > > > > > > This series exposes the ufs_reset line as a gpio, adds support for ufshcd to > > > > acquire and toggle this and then adds this to SDM845 MTP. > > > > > > > > Bjorn Andersson (3): > > > > pinctrl: qcom: sdm845: Expose ufs_reset as gpio > > > > scsi: ufs: Allow resetting the UFS device > > > > arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO > > > > > > Adding similar change as in sdm845-mtp to the not yet upstream > > > blueline dts, I validated this allows my micron UFS pixel3 to boot. > > > > > > Tested-by: John Stultz <john.stultz@linaro.org> > > Maybe ufs_hba_variant_ops would be the proper place to add this? > > > > Are you saying that these memories only need a reset when they are > paired with the Qualcomm host controller? ufs_hba_variant_ops is for vendors to implement their own vops, and as you can see, many of them do. Adding hw_reset to that template seems like the proper way to do what you are doing. Thanks, Avri > > The way it's implemented it here is that the device-reset GPIO is > optional and only if you specify it we'll toggle the reset. So if your > board design has a UFS memory that requires a reset pulse during > initialization you specify this, regardless of which vendor your SoC > comes from. > > Regards, > Bjorn ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/3] (Qualcomm) UFS device reset support 2019-06-05 9:32 ` Avri Altman @ 2019-06-06 0:39 ` Bjorn Andersson 2019-06-06 6:32 ` Avri Altman 0 siblings, 1 reply; 21+ messages in thread From: Bjorn Andersson @ 2019-06-06 0:39 UTC (permalink / raw) To: Avri Altman Cc: John Stultz, Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, linux-arm-msm, linux-gpio, devicetree, Linux Kernel Mailing List, linux-scsi On Wed 05 Jun 02:32 PDT 2019, Avri Altman wrote: > > > > On Tue 04 Jun 22:50 PDT 2019, Avri Altman wrote: > > > > > Hi, > > > > > > > > > > > On Tue, Jun 4, 2019 at 12:22 AM Bjorn Andersson > > > > <bjorn.andersson@linaro.org> wrote: > > > > > > > > > > This series exposes the ufs_reset line as a gpio, adds support for ufshcd to > > > > > acquire and toggle this and then adds this to SDM845 MTP. > > > > > > > > > > Bjorn Andersson (3): > > > > > pinctrl: qcom: sdm845: Expose ufs_reset as gpio > > > > > scsi: ufs: Allow resetting the UFS device > > > > > arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO > > > > > > > > Adding similar change as in sdm845-mtp to the not yet upstream > > > > blueline dts, I validated this allows my micron UFS pixel3 to boot. > > > > > > > > Tested-by: John Stultz <john.stultz@linaro.org> > > > Maybe ufs_hba_variant_ops would be the proper place to add this? > > > > > > > Are you saying that these memories only need a reset when they are > > paired with the Qualcomm host controller? > ufs_hba_variant_ops is for vendors to implement their own vops, > and as you can see, many of them do. > Adding hw_reset to that template seems like the proper way > to do what you are doing. > Right, but the vops is operations related to the UFS controller, this property relates to the memory connected. E.g I have a Hynix memory and John have a Micron memory that needs this reset and my assumption is that these memories will need their RESET pin toggled regardless of which controller they are connected to. Regards, Bjorn ^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [PATCH 0/3] (Qualcomm) UFS device reset support 2019-06-06 0:39 ` Bjorn Andersson @ 2019-06-06 6:32 ` Avri Altman 2019-06-06 7:09 ` Bjorn Andersson 0 siblings, 1 reply; 21+ messages in thread From: Avri Altman @ 2019-06-06 6:32 UTC (permalink / raw) To: Bjorn Andersson Cc: John Stultz, Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, linux-arm-msm, linux-gpio, devicetree, Linux Kernel Mailing List, linux-scsi > > On Wed 05 Jun 02:32 PDT 2019, Avri Altman wrote: > > > > > > > On Tue 04 Jun 22:50 PDT 2019, Avri Altman wrote: > > > > > > > Hi, > > > > > > > > > > > > > > On Tue, Jun 4, 2019 at 12:22 AM Bjorn Andersson > > > > > <bjorn.andersson@linaro.org> wrote: > > > > > > > > > > > > This series exposes the ufs_reset line as a gpio, adds support for ufshcd > to > > > > > > acquire and toggle this and then adds this to SDM845 MTP. > > > > > > > > > > > > Bjorn Andersson (3): > > > > > > pinctrl: qcom: sdm845: Expose ufs_reset as gpio > > > > > > scsi: ufs: Allow resetting the UFS device > > > > > > arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO > > > > > > > > > > Adding similar change as in sdm845-mtp to the not yet upstream > > > > > blueline dts, I validated this allows my micron UFS pixel3 to boot. > > > > > > > > > > Tested-by: John Stultz <john.stultz@linaro.org> > > > > Maybe ufs_hba_variant_ops would be the proper place to add this? > > > > > > > > > > Are you saying that these memories only need a reset when they are > > > paired with the Qualcomm host controller? > > ufs_hba_variant_ops is for vendors to implement their own vops, > > and as you can see, many of them do. > > Adding hw_reset to that template seems like the proper way > > to do what you are doing. > > > > Right, but the vops is operations related to the UFS controller, this > property relates to the memory connected. This is not entirely accurate. Those are vendor/board specific, As the original commit log indicates: " vendor/board specific and hence determined with the help of compatible property in device tree." I would rather have this new vop: void (*device_reset)(struct ufs_hba *), Or whatever, actively set in ufs_hba_variant_ops, rather than ufshcd_init_device_reset failing as part of the default init flow. Thanks, Avri > > E.g I have a Hynix memory and John have a Micron memory that needs this > reset and my assumption is that these memories will need their RESET pin > toggled regardless of which controller they are connected to. > > Regards, > Bjorn ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/3] (Qualcomm) UFS device reset support 2019-06-06 6:32 ` Avri Altman @ 2019-06-06 7:09 ` Bjorn Andersson 0 siblings, 0 replies; 21+ messages in thread From: Bjorn Andersson @ 2019-06-06 7:09 UTC (permalink / raw) To: Avri Altman Cc: John Stultz, Andy Gross, Linus Walleij, Rob Herring, Mark Rutland, Pedro Sousa, James E.J. Bottomley, Martin K. Petersen, linux-arm-msm, linux-gpio, devicetree, Linux Kernel Mailing List, linux-scsi On Wed 05 Jun 23:32 PDT 2019, Avri Altman wrote: > > > > On Wed 05 Jun 02:32 PDT 2019, Avri Altman wrote: > > > > > > > > > > On Tue 04 Jun 22:50 PDT 2019, Avri Altman wrote: > > > > > > > > > Hi, > > > > > > > > > > > > > > > > > On Tue, Jun 4, 2019 at 12:22 AM Bjorn Andersson > > > > > > <bjorn.andersson@linaro.org> wrote: > > > > > > > > > > > > > > This series exposes the ufs_reset line as a gpio, adds support for ufshcd > > to > > > > > > > acquire and toggle this and then adds this to SDM845 MTP. > > > > > > > > > > > > > > Bjorn Andersson (3): > > > > > > > pinctrl: qcom: sdm845: Expose ufs_reset as gpio > > > > > > > scsi: ufs: Allow resetting the UFS device > > > > > > > arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO > > > > > > > > > > > > Adding similar change as in sdm845-mtp to the not yet upstream > > > > > > blueline dts, I validated this allows my micron UFS pixel3 to boot. > > > > > > > > > > > > Tested-by: John Stultz <john.stultz@linaro.org> > > > > > Maybe ufs_hba_variant_ops would be the proper place to add this? > > > > > > > > > > > > > Are you saying that these memories only need a reset when they are > > > > paired with the Qualcomm host controller? > > > ufs_hba_variant_ops is for vendors to implement their own vops, > > > and as you can see, many of them do. > > > Adding hw_reset to that template seems like the proper way > > > to do what you are doing. > > > > > > > Right, but the vops is operations related to the UFS controller, this > > property relates to the memory connected. > This is not entirely accurate. Those are vendor/board specific, > As the original commit log indicates: > " vendor/board specific and hence determined with > the help of compatible property in device tree." > > I would rather have this new vop: > void (*device_reset)(struct ufs_hba *), Or whatever, > actively set in ufs_hba_variant_ops, rather than ufshcd_init_device_reset > failing as part of the default init flow. > But such an vops would allow me to provide a Qualcomm-specific way of toggling the GPIO that is connected to the UFS_RESET pin on the Hynix/Micron memory. But acquiring and toggling GPIOs is not a Qualcomm thing, it's a completely generic thing, and as it's not a chip-internal line it is a GPIO and not a reset - regardless of SoC vendor. Further more, it's optional so boards that does not have this pin connected will just omit the property in their hardware description (DeviceTree). So I think the halting part here is that we don't have a representation of the memory device's resources, because this is really a matter of toggling the reset pin on the memory device. Regards, Bjorn ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2019-06-07 22:20 UTC | newest] Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-06-04 7:19 [PATCH 0/3] (Qualcomm) UFS device reset support Bjorn Andersson 2019-06-04 7:19 ` [PATCH 1/3] pinctrl: qcom: sdm845: Expose ufs_reset as gpio Bjorn Andersson 2019-06-07 21:26 ` Linus Walleij 2019-06-04 7:20 ` [PATCH 2/3] scsi: ufs: Allow resetting the UFS device Bjorn Andersson 2019-06-04 8:13 ` [EXT] " Bean Huo (beanhuo) 2019-06-04 18:10 ` John Stultz 2019-06-04 22:30 ` Bjorn Andersson 2019-06-05 21:17 ` Bean Huo (beanhuo) 2019-06-04 15:25 ` Stephen Boyd 2019-06-04 22:20 ` Bjorn Andersson 2019-06-04 7:20 ` [PATCH 3/3] arm64: dts: qcom: sdm845-mtp: Specify UFS device-reset GPIO Bjorn Andersson 2019-06-04 16:22 ` Stephen Boyd 2019-06-04 22:09 ` Bjorn Andersson 2019-06-07 22:20 ` Linus Walleij 2019-06-04 22:00 ` [PATCH 0/3] (Qualcomm) UFS device reset support John Stultz 2019-06-05 5:50 ` Avri Altman 2019-06-05 6:01 ` Bjorn Andersson 2019-06-05 9:32 ` Avri Altman 2019-06-06 0:39 ` Bjorn Andersson 2019-06-06 6:32 ` Avri Altman 2019-06-06 7:09 ` Bjorn Andersson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).