* [PATCH 0/2] ufs: host: ufs-qcom: Add support for SM8550 @ 2022-11-16 12:17 Abel Vesa 2022-11-16 12:17 ` [PATCH 1/2] ufs: host: ufs-qcom: Clear qunipro_g4_sel for HW version major 5 Abel Vesa 2022-11-16 12:17 ` [PATCH 2/2] dt-bindings: ufs: qcom: Add SM8550 compatible string Abel Vesa 0 siblings, 2 replies; 7+ messages in thread From: Abel Vesa @ 2022-11-16 12:17 UTC (permalink / raw) To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Alim Akhtar, James E . J . Bottomley, Martin K . Petersen, Avri Altman, Bart Van Assche, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski Cc: Linux Kernel Mailing List, devicetree, linux-arm-msm, linux-scsi This patchset adds UFS HC support for the new Qualcomm SM8550 SoC. This patchset depends on: https://lore.kernel.org/lkml/20221029141633.295650-1-manivannan.sadhasivam@linaro.org/ To: Andy Gross <agross@kernel.org> To: Bjorn Andersson <andersson@kernel.org> To: Konrad Dybcio <konrad.dybcio@linaro.org> To: Alim Akhtar <alim.akhtar@samsung.com> To: Avri Altman <avri.altman@wdc.com> To: Bart Van Assche <bvanassche@acm.org> To: Rob Herring <robh+dt@kernel.org> To: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org> To: "James E.J. Bottomley" <jejb@linux.ibm.com> To: "Martin K. Petersen" <martin.petersen@oracle.com> Cc: linux-arm-msm@vger.kernel.org Cc: linux-scsi@vger.kernel.org Cc: devicetree@vger.kernel.org Cc: linux-kernel@vger.kernel.org Abel Vesa (2): ufs: host: ufs-qcom: Clear qunipro_g4_sel for HW version major 5 dt-bindings: ufs: qcom: Add SM8550 compatible string Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++ drivers/ufs/host/ufs-qcom.c | 4 ++++ drivers/ufs/host/ufs-qcom.h | 2 ++ 3 files changed, 8 insertions(+) -- 2.34.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] ufs: host: ufs-qcom: Clear qunipro_g4_sel for HW version major 5 2022-11-16 12:17 [PATCH 0/2] ufs: host: ufs-qcom: Add support for SM8550 Abel Vesa @ 2022-11-16 12:17 ` Abel Vesa 2022-11-16 12:28 ` Konrad Dybcio 2022-11-22 15:05 ` Manivannan Sadhasivam 2022-11-16 12:17 ` [PATCH 2/2] dt-bindings: ufs: qcom: Add SM8550 compatible string Abel Vesa 1 sibling, 2 replies; 7+ messages in thread From: Abel Vesa @ 2022-11-16 12:17 UTC (permalink / raw) To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Alim Akhtar, James E . J . Bottomley, Martin K . Petersen, Avri Altman, Bart Van Assche, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski Cc: Linux Kernel Mailing List, devicetree, linux-arm-msm, linux-scsi On SM8550, depending on the Qunipro, we can run with G5 or G4. For now, when the major version is 5 or above, we go with G5. Therefore, we need to specifically tell UFS HC that. Signed-off-by: Abel Vesa <abel.vesa@linaro.org> --- drivers/ufs/host/ufs-qcom.c | 4 ++++ drivers/ufs/host/ufs-qcom.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index ca60a5b0292b..72334aefe81c 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -227,6 +227,10 @@ static void ufs_qcom_select_unipro_mode(struct ufs_qcom_host *host) ufshcd_rmwl(host->hba, QUNIPRO_SEL, ufs_qcom_cap_qunipro(host) ? QUNIPRO_SEL : 0, REG_UFS_CFG1); + + if (host->hw_ver.major == 0x05) + ufshcd_rmwl(host->hba, QUNIPRO_G4_SEL, 0, REG_UFS_CFG0); + /* make sure above configuration is applied before we return */ mb(); } diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h index 751ded3e3531..10621055bf7f 100644 --- a/drivers/ufs/host/ufs-qcom.h +++ b/drivers/ufs/host/ufs-qcom.h @@ -36,6 +36,7 @@ enum { /* On older UFS revisions, this register is called "RETRY_TIMER_REG" */ REG_UFS_PARAM0 = 0xD0, REG_UFS_PA_LINK_STARTUP_TIMER = 0xD8, + REG_UFS_CFG0 = 0xD8, REG_UFS_CFG1 = 0xDC, REG_UFS_CFG2 = 0xE0, REG_UFS_HW_VERSION = 0xE4, @@ -75,6 +76,7 @@ enum { /* bit definitions for REG_UFS_CFG1 register */ #define QUNIPRO_SEL BIT(0) +#define QUNIPRO_G4_SEL BIT(5) #define UFS_PHY_SOFT_RESET BIT(1) #define UTP_DBG_RAMS_EN BIT(17) #define TEST_BUS_EN BIT(18) -- 2.34.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ufs: host: ufs-qcom: Clear qunipro_g4_sel for HW version major 5 2022-11-16 12:17 ` [PATCH 1/2] ufs: host: ufs-qcom: Clear qunipro_g4_sel for HW version major 5 Abel Vesa @ 2022-11-16 12:28 ` Konrad Dybcio 2022-11-21 12:37 ` Abel Vesa 2022-11-22 15:05 ` Manivannan Sadhasivam 1 sibling, 1 reply; 7+ messages in thread From: Konrad Dybcio @ 2022-11-16 12:28 UTC (permalink / raw) To: Abel Vesa, Andy Gross, Bjorn Andersson, Alim Akhtar, James E . J . Bottomley, Martin K . Petersen, Avri Altman, Bart Van Assche, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski Cc: Linux Kernel Mailing List, devicetree, linux-arm-msm, linux-scsi On 16/11/2022 13:17, Abel Vesa wrote: > On SM8550, depending on the Qunipro, we can run with G5 or G4. > For now, when the major version is 5 or above, we go with G5. > Therefore, we need to specifically tell UFS HC that. > > Signed-off-by: Abel Vesa <abel.vesa@linaro.org> > --- > drivers/ufs/host/ufs-qcom.c | 4 ++++ > drivers/ufs/host/ufs-qcom.h | 2 ++ > 2 files changed, 6 insertions(+) > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > index ca60a5b0292b..72334aefe81c 100644 > --- a/drivers/ufs/host/ufs-qcom.c > +++ b/drivers/ufs/host/ufs-qcom.c > @@ -227,6 +227,10 @@ static void ufs_qcom_select_unipro_mode(struct ufs_qcom_host *host) > ufshcd_rmwl(host->hba, QUNIPRO_SEL, > ufs_qcom_cap_qunipro(host) ? QUNIPRO_SEL : 0, > REG_UFS_CFG1); > + > + if (host->hw_ver.major == 0x05) > + ufshcd_rmwl(host->hba, QUNIPRO_G4_SEL, 0, REG_UFS_CFG0); > + > /* make sure above configuration is applied before we return */ > mb(); > } > diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h > index 751ded3e3531..10621055bf7f 100644 > --- a/drivers/ufs/host/ufs-qcom.h > +++ b/drivers/ufs/host/ufs-qcom.h > @@ -36,6 +36,7 @@ enum { > /* On older UFS revisions, this register is called "RETRY_TIMER_REG" */ > REG_UFS_PARAM0 = 0xD0, > REG_UFS_PA_LINK_STARTUP_TIMER = 0xD8, > + REG_UFS_CFG0 = 0xD8, Are you sure these two should point to the same register? Maybe it deserves some kind of a comment? Konrad > REG_UFS_CFG1 = 0xDC, > REG_UFS_CFG2 = 0xE0, > REG_UFS_HW_VERSION = 0xE4, > @@ -75,6 +76,7 @@ enum { > > /* bit definitions for REG_UFS_CFG1 register */ > #define QUNIPRO_SEL BIT(0) > +#define QUNIPRO_G4_SEL BIT(5) > #define UFS_PHY_SOFT_RESET BIT(1) > #define UTP_DBG_RAMS_EN BIT(17) > #define TEST_BUS_EN BIT(18) ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ufs: host: ufs-qcom: Clear qunipro_g4_sel for HW version major 5 2022-11-16 12:28 ` Konrad Dybcio @ 2022-11-21 12:37 ` Abel Vesa 0 siblings, 0 replies; 7+ messages in thread From: Abel Vesa @ 2022-11-21 12:37 UTC (permalink / raw) To: Konrad Dybcio Cc: Andy Gross, Bjorn Andersson, Alim Akhtar, James E . J . Bottomley, Martin K . Petersen, Avri Altman, Bart Van Assche, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Linux Kernel Mailing List, devicetree, linux-arm-msm, linux-scsi On 22-11-16 13:28:53, Konrad Dybcio wrote: > > > On 16/11/2022 13:17, Abel Vesa wrote: > > On SM8550, depending on the Qunipro, we can run with G5 or G4. > > For now, when the major version is 5 or above, we go with G5. > > Therefore, we need to specifically tell UFS HC that. > > > > Signed-off-by: Abel Vesa <abel.vesa@linaro.org> > > --- > > drivers/ufs/host/ufs-qcom.c | 4 ++++ > > drivers/ufs/host/ufs-qcom.h | 2 ++ > > 2 files changed, 6 insertions(+) > > > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > > index ca60a5b0292b..72334aefe81c 100644 > > --- a/drivers/ufs/host/ufs-qcom.c > > +++ b/drivers/ufs/host/ufs-qcom.c > > @@ -227,6 +227,10 @@ static void ufs_qcom_select_unipro_mode(struct ufs_qcom_host *host) > > ufshcd_rmwl(host->hba, QUNIPRO_SEL, > > ufs_qcom_cap_qunipro(host) ? QUNIPRO_SEL : 0, > > REG_UFS_CFG1); > > + > > + if (host->hw_ver.major == 0x05) > > + ufshcd_rmwl(host->hba, QUNIPRO_G4_SEL, 0, REG_UFS_CFG0); > > + > > /* make sure above configuration is applied before we return */ > > mb(); > > } > > diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h > > index 751ded3e3531..10621055bf7f 100644 > > --- a/drivers/ufs/host/ufs-qcom.h > > +++ b/drivers/ufs/host/ufs-qcom.h > > @@ -36,6 +36,7 @@ enum { > > /* On older UFS revisions, this register is called "RETRY_TIMER_REG" */ > > REG_UFS_PARAM0 = 0xD0, > > REG_UFS_PA_LINK_STARTUP_TIMER = 0xD8, > > + REG_UFS_CFG0 = 0xD8, > Are you sure these two should point to the same register? Maybe it deserves > some kind of a comment? The REG_UFS_PA_LINK_STARTUP_TIMER is used by non qunipro variants. (UFS versions below 2.x) The REG_UFS_CFG0 is used by qunipro variants. (UFS versions above 2.x). Will add a comment to the later one that would look like this: "/* Found on UFS versions above 2.x only */" Thanks, Abel > > Konrad > > REG_UFS_CFG1 = 0xDC, > > REG_UFS_CFG2 = 0xE0, > > REG_UFS_HW_VERSION = 0xE4, > > @@ -75,6 +76,7 @@ enum { > > /* bit definitions for REG_UFS_CFG1 register */ > > #define QUNIPRO_SEL BIT(0) > > +#define QUNIPRO_G4_SEL BIT(5) > > #define UFS_PHY_SOFT_RESET BIT(1) > > #define UTP_DBG_RAMS_EN BIT(17) > > #define TEST_BUS_EN BIT(18) ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ufs: host: ufs-qcom: Clear qunipro_g4_sel for HW version major 5 2022-11-16 12:17 ` [PATCH 1/2] ufs: host: ufs-qcom: Clear qunipro_g4_sel for HW version major 5 Abel Vesa 2022-11-16 12:28 ` Konrad Dybcio @ 2022-11-22 15:05 ` Manivannan Sadhasivam 1 sibling, 0 replies; 7+ messages in thread From: Manivannan Sadhasivam @ 2022-11-22 15:05 UTC (permalink / raw) To: Abel Vesa Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Alim Akhtar, James E . J . Bottomley, Martin K . Petersen, Avri Altman, Bart Van Assche, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski, Linux Kernel Mailing List, devicetree, linux-arm-msm, linux-scsi On Wed, Nov 16, 2022 at 02:17:31PM +0200, Abel Vesa wrote: > On SM8550, depending on the Qunipro, we can run with G5 or G4. > For now, when the major version is 5 or above, we go with G5. > Therefore, we need to specifically tell UFS HC that. > > Signed-off-by: Abel Vesa <abel.vesa@linaro.org> > --- > drivers/ufs/host/ufs-qcom.c | 4 ++++ > drivers/ufs/host/ufs-qcom.h | 2 ++ > 2 files changed, 6 insertions(+) > > diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c > index ca60a5b0292b..72334aefe81c 100644 > --- a/drivers/ufs/host/ufs-qcom.c > +++ b/drivers/ufs/host/ufs-qcom.c > @@ -227,6 +227,10 @@ static void ufs_qcom_select_unipro_mode(struct ufs_qcom_host *host) > ufshcd_rmwl(host->hba, QUNIPRO_SEL, > ufs_qcom_cap_qunipro(host) ? QUNIPRO_SEL : 0, > REG_UFS_CFG1); > + > + if (host->hw_ver.major == 0x05) > + ufshcd_rmwl(host->hba, QUNIPRO_G4_SEL, 0, REG_UFS_CFG0); So this means, G5 will be used all the time even if the UFS device doesn't support it (ie., G4 device), which is not ideal. Since you have already based this series on my UFS gear 4 series, you should resend this on top of my next version that I'm about to submit. There I have proposed reinitializing the UFS device after switching to max gear supported by both controller and device. Based on that information, you could do: ``` if (host->hw_ver.major == 0x05) { if (host->hs_hear == UFS_HS_G5) ufshcd_rmwl(host->hba, QUNIPRO_G4_SEL, 0, REG_UFS_CFG0); else ufshcd_rmwl(host->hba, QUNIPRO_G4_SEL, 1, REG_UFS_CFG0); } ``` By this way, if the device doesn't support G5, G4 will be used. Btw, please use a valid definition instead of 0/1 above. > + > /* make sure above configuration is applied before we return */ > mb(); > } > diff --git a/drivers/ufs/host/ufs-qcom.h b/drivers/ufs/host/ufs-qcom.h > index 751ded3e3531..10621055bf7f 100644 > --- a/drivers/ufs/host/ufs-qcom.h > +++ b/drivers/ufs/host/ufs-qcom.h > @@ -36,6 +36,7 @@ enum { > /* On older UFS revisions, this register is called "RETRY_TIMER_REG" */ > REG_UFS_PARAM0 = 0xD0, > REG_UFS_PA_LINK_STARTUP_TIMER = 0xD8, > + REG_UFS_CFG0 = 0xD8, Hmm, so what is the offset of REG_UFS_PA_LINK_STARTUP_TIMER? > REG_UFS_CFG1 = 0xDC, > REG_UFS_CFG2 = 0xE0, > REG_UFS_HW_VERSION = 0xE4, > @@ -75,6 +76,7 @@ enum { > > /* bit definitions for REG_UFS_CFG1 register */ > #define QUNIPRO_SEL BIT(0) > +#define QUNIPRO_G4_SEL BIT(5) Since this bit belongs to CFG0 register, it should be added separately and not with CFG1 definitions. Thanks, Mani > #define UFS_PHY_SOFT_RESET BIT(1) > #define UTP_DBG_RAMS_EN BIT(17) > #define TEST_BUS_EN BIT(18) > -- > 2.34.1 > -- மணிவண்ணன் சதாசிவம் ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] dt-bindings: ufs: qcom: Add SM8550 compatible string 2022-11-16 12:17 [PATCH 0/2] ufs: host: ufs-qcom: Add support for SM8550 Abel Vesa 2022-11-16 12:17 ` [PATCH 1/2] ufs: host: ufs-qcom: Clear qunipro_g4_sel for HW version major 5 Abel Vesa @ 2022-11-16 12:17 ` Abel Vesa 2022-11-16 12:48 ` Krzysztof Kozlowski 1 sibling, 1 reply; 7+ messages in thread From: Abel Vesa @ 2022-11-16 12:17 UTC (permalink / raw) To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Alim Akhtar, James E . J . Bottomley, Martin K . Petersen, Avri Altman, Bart Van Assche, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski Cc: Linux Kernel Mailing List, devicetree, linux-arm-msm, linux-scsi Document the compatible for the UFS found on SM8550. Signed-off-by: Abel Vesa <abel.vesa@linaro.org> --- Documentation/devicetree/bindings/ufs/qcom,ufs.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml index f2d6298d926c..66554adeb515 100644 --- a/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml +++ b/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml @@ -33,6 +33,7 @@ properties: - qcom,sm8250-ufshc - qcom,sm8350-ufshc - qcom,sm8450-ufshc + - qcom,sm8550-ufshc - const: qcom,ufshc - const: jedec,ufs-2.0 @@ -103,6 +104,7 @@ allOf: - qcom,sm8250-ufshc - qcom,sm8350-ufshc - qcom,sm8450-ufshc + - qcom,sm8550-ufshc then: properties: clocks: -- 2.34.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] dt-bindings: ufs: qcom: Add SM8550 compatible string 2022-11-16 12:17 ` [PATCH 2/2] dt-bindings: ufs: qcom: Add SM8550 compatible string Abel Vesa @ 2022-11-16 12:48 ` Krzysztof Kozlowski 0 siblings, 0 replies; 7+ messages in thread From: Krzysztof Kozlowski @ 2022-11-16 12:48 UTC (permalink / raw) To: Abel Vesa, Andy Gross, Bjorn Andersson, Konrad Dybcio, Alim Akhtar, James E . J . Bottomley, Martin K . Petersen, Avri Altman, Bart Van Assche, Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski Cc: Linux Kernel Mailing List, devicetree, linux-arm-msm, linux-scsi On 16/11/2022 13:17, Abel Vesa wrote: > Document the compatible for the UFS found on SM8550. > > Signed-off-by: Abel Vesa <abel.vesa@linaro.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-11-22 15:06 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-11-16 12:17 [PATCH 0/2] ufs: host: ufs-qcom: Add support for SM8550 Abel Vesa 2022-11-16 12:17 ` [PATCH 1/2] ufs: host: ufs-qcom: Clear qunipro_g4_sel for HW version major 5 Abel Vesa 2022-11-16 12:28 ` Konrad Dybcio 2022-11-21 12:37 ` Abel Vesa 2022-11-22 15:05 ` Manivannan Sadhasivam 2022-11-16 12:17 ` [PATCH 2/2] dt-bindings: ufs: qcom: Add SM8550 compatible string Abel Vesa 2022-11-16 12:48 ` Krzysztof Kozlowski
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).