Hi,
This series adds the interconnect bandwidth values for Gear 5 to the Qcom
driver and also adds the check for the unsupported gear/lane values.
- Mani
Signed-off-by: Manivannan Sadhasivam <[email protected]>
---
Changes in v2:
- Added sanity check for gear/lane values
- Collected tags
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Manivannan Sadhasivam (2):
scsi: ufs: qcom: Add missing interconnect bandwidth values for Gear 5
scsi: ufs: qcom: Add sanity checks for gear/lane values during ICC scaling
drivers/ufs/host/ufs-qcom.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
---
base-commit: 4cece764965020c22cff7665b18a012006359095
change-id: 20240401-ufs-icc-fix-123c7ca1be45
Best regards,
--
Manivannan Sadhasivam <[email protected]>
These entries are necessary to scale the interconnect bandwidth while
operating in Gear 5.
Cc: Amit Pundir <[email protected]>
Fixes: 03ce80a1bb86 ("scsi: ufs: qcom: Add support for scaling interconnects")
Tested-by: Amit Pundir <[email protected]>
Signed-off-by: Manivannan Sadhasivam <[email protected]>
---
drivers/ufs/host/ufs-qcom.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 8d68bd21ae73..696540ca835e 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -47,7 +47,7 @@ enum {
TSTBUS_MAX,
};
-#define QCOM_UFS_MAX_GEAR 4
+#define QCOM_UFS_MAX_GEAR 5
#define QCOM_UFS_MAX_LANE 2
enum {
@@ -67,26 +67,32 @@ static const struct __ufs_qcom_bw_table {
[MODE_PWM][UFS_PWM_G2][UFS_LANE_1] = { 1844, 1000 },
[MODE_PWM][UFS_PWM_G3][UFS_LANE_1] = { 3688, 1000 },
[MODE_PWM][UFS_PWM_G4][UFS_LANE_1] = { 7376, 1000 },
+ [MODE_PWM][UFS_PWM_G5][UFS_LANE_1] = { 14752, 1000 },
[MODE_PWM][UFS_PWM_G1][UFS_LANE_2] = { 1844, 1000 },
[MODE_PWM][UFS_PWM_G2][UFS_LANE_2] = { 3688, 1000 },
[MODE_PWM][UFS_PWM_G3][UFS_LANE_2] = { 7376, 1000 },
[MODE_PWM][UFS_PWM_G4][UFS_LANE_2] = { 14752, 1000 },
+ [MODE_PWM][UFS_PWM_G5][UFS_LANE_2] = { 29504, 1000 },
[MODE_HS_RA][UFS_HS_G1][UFS_LANE_1] = { 127796, 1000 },
[MODE_HS_RA][UFS_HS_G2][UFS_LANE_1] = { 255591, 1000 },
[MODE_HS_RA][UFS_HS_G3][UFS_LANE_1] = { 1492582, 102400 },
[MODE_HS_RA][UFS_HS_G4][UFS_LANE_1] = { 2915200, 204800 },
+ [MODE_HS_RA][UFS_HS_G5][UFS_LANE_1] = { 5836800, 409600 },
[MODE_HS_RA][UFS_HS_G1][UFS_LANE_2] = { 255591, 1000 },
[MODE_HS_RA][UFS_HS_G2][UFS_LANE_2] = { 511181, 1000 },
[MODE_HS_RA][UFS_HS_G3][UFS_LANE_2] = { 1492582, 204800 },
[MODE_HS_RA][UFS_HS_G4][UFS_LANE_2] = { 2915200, 409600 },
+ [MODE_HS_RA][UFS_HS_G5][UFS_LANE_2] = { 5836800, 819200 },
[MODE_HS_RB][UFS_HS_G1][UFS_LANE_1] = { 149422, 1000 },
[MODE_HS_RB][UFS_HS_G2][UFS_LANE_1] = { 298189, 1000 },
[MODE_HS_RB][UFS_HS_G3][UFS_LANE_1] = { 1492582, 102400 },
[MODE_HS_RB][UFS_HS_G4][UFS_LANE_1] = { 2915200, 204800 },
+ [MODE_HS_RB][UFS_HS_G5][UFS_LANE_1] = { 5836800, 409600 },
[MODE_HS_RB][UFS_HS_G1][UFS_LANE_2] = { 298189, 1000 },
[MODE_HS_RB][UFS_HS_G2][UFS_LANE_2] = { 596378, 1000 },
[MODE_HS_RB][UFS_HS_G3][UFS_LANE_2] = { 1492582, 204800 },
[MODE_HS_RB][UFS_HS_G4][UFS_LANE_2] = { 2915200, 409600 },
+ [MODE_HS_RB][UFS_HS_G5][UFS_LANE_2] = { 5836800, 819200 },
[MODE_MAX][0][0] = { 7643136, 307200 },
};
--
2.25.1
Let's add the checks to warn the user if the ICC scaling is not supported
for the gear/lane values and also fallback to the max value if that's the
case.
Signed-off-by: Manivannan Sadhasivam <[email protected]>
---
drivers/ufs/host/ufs-qcom.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 696540ca835e..79b4ce05f7c5 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -696,6 +696,16 @@ static struct __ufs_qcom_bw_table ufs_qcom_get_bw_table(struct ufs_qcom_host *ho
int gear = max_t(u32, p->gear_rx, p->gear_tx);
int lane = max_t(u32, p->lane_rx, p->lane_tx);
+ if (WARN_ONCE(gear > QCOM_UFS_MAX_GEAR,
+ "ICC scaling for UFS Gear (%d) not supported. Using Gear (%d) bandwidth\n",
+ gear, QCOM_UFS_MAX_GEAR))
+ gear = QCOM_UFS_MAX_GEAR;
+
+ if (WARN_ONCE(lane > QCOM_UFS_MAX_LANE,
+ "ICC scaling for UFS Lane (%d) not supported. Using Lane (%d) bandwidth\n",
+ lane, QCOM_UFS_MAX_LANE))
+ lane = QCOM_UFS_MAX_LANE;
+
if (ufshcd_is_hs_mode(p)) {
if (p->hs_rate == PA_HS_MODE_B)
return ufs_qcom_bw_table[MODE_HS_RB][gear][lane];
--
2.25.1
On Wed, Apr 03, 2024 at 06:50:04PM +0530, Manivannan Sadhasivam wrote:
> Let's add the checks to warn the user if the ICC scaling is not supported
> for the gear/lane values and also fallback to the max value if that's the
> case.
>
> Signed-off-by: Manivannan Sadhasivam <[email protected]>
Reviewed-by: Andrew Halaney <[email protected]>
> ---
> drivers/ufs/host/ufs-qcom.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
> index 696540ca835e..79b4ce05f7c5 100644
> --- a/drivers/ufs/host/ufs-qcom.c
> +++ b/drivers/ufs/host/ufs-qcom.c
> @@ -696,6 +696,16 @@ static struct __ufs_qcom_bw_table ufs_qcom_get_bw_table(struct ufs_qcom_host *ho
> int gear = max_t(u32, p->gear_rx, p->gear_tx);
> int lane = max_t(u32, p->lane_rx, p->lane_tx);
>
> + if (WARN_ONCE(gear > QCOM_UFS_MAX_GEAR,
> + "ICC scaling for UFS Gear (%d) not supported. Using Gear (%d) bandwidth\n",
> + gear, QCOM_UFS_MAX_GEAR))
> + gear = QCOM_UFS_MAX_GEAR;
> +
> + if (WARN_ONCE(lane > QCOM_UFS_MAX_LANE,
> + "ICC scaling for UFS Lane (%d) not supported. Using Lane (%d) bandwidth\n",
> + lane, QCOM_UFS_MAX_LANE))
> + lane = QCOM_UFS_MAX_LANE;
> +
> if (ufshcd_is_hs_mode(p)) {
> if (p->hs_rate == PA_HS_MODE_B)
> return ufs_qcom_bw_table[MODE_HS_RB][gear][lane];
>
> --
> 2.25.1
>
>
Manivannan,
> This series adds the interconnect bandwidth values for Gear 5 to the
> Qcom driver and also adds the check for the unsupported gear/lane
> values.
Applied to 6.10/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
On Fri, Apr 05, 2024 at 09:24:00PM -0400, Martin K. Petersen wrote:
>
> Manivannan,
>
> > This series adds the interconnect bandwidth values for Gear 5 to the
> > Qcom driver and also adds the check for the unsupported gear/lane
> > values.
>
> Applied to 6.10/scsi-staging, thanks!
>
Thanks Martin! But patch 1/2 is actually a fix that needs to be merged for 6.9,
since starting from 6.9 we are seeing the crash on some Qcom boards.
But patch 2/2 is just an improvement, so it can be part of 6.10.
- Mani
--
மணிவண்ணன் சதாசிவம்
Manivannan,
> Thanks Martin! But patch 1/2 is actually a fix that needs to be merged
> for 6.9, since starting from 6.9 we are seeing the crash on some Qcom
> boards.
>
> But patch 2/2 is just an improvement, so it can be part of 6.10.
OK, done!
--
Martin K. Petersen Oracle Linux Engineering
On Wed, 03 Apr 2024 18:50:02 +0530, Manivannan Sadhasivam wrote:
> This series adds the interconnect bandwidth values for Gear 5 to the Qcom
> driver and also adds the check for the unsupported gear/lane values.
>
> - Mani
>
>
Applied to 6.10/scsi-queue, thanks!
[2/2] scsi: ufs: qcom: Add sanity checks for gear/lane values during ICC scaling
https://git.kernel.org/mkp/scsi/c/33507b3964f1
--
Martin K. Petersen Oracle Linux Engineering