scsi: ufs-qcom: add number of lanes for Tx and Rx links
Subsystems (3)
PATCH v2 1/1 scsi: ufs-qcom: add number of lanes for Tx and Rx links
From: Gilad Broner <[email protected]>
Different platforms may have different number of lanes for the UFS Tx/Rx links. Add parameter to device tree specifying how many lanes should be configured for the UFS Tx/Rx links. And don't print err message for clocks that are optional, this leads to unnecessary confusion about failure.
---
Changes since v1:
- Change commit subject for better description.
- Incorporated Rob's review comments to use lanes-tx and lanes-rx to handle asymmetric Tx/Rx links.
.../devicetree/bindings/ufs/ufshcd-pltfrm.txt | 4 ++ drivers/scsi/ufs/ufs-qcom.c | 65 +++++++++++++--------- drivers/scsi/ufs/ufshcd.c | 29 ++++++++++ drivers/scsi/ufs/ufshcd.h | 5 ++ 4 files changed, 78 insertions(+), 25 deletions(-)
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt +4 -0
@@ -31,6 +31,10 @@ Optional properties: defined or a value in the array is "0" then it is assumed that the frequency is set by the parent clock or a fixed rate clock source. +- lanes-tx : Number of lanes available for Tx direction - either 1 or 2. + If not specified, default is 2 lanes. +- lanes-rx : Number of lanes available for Rx direction - either 1 or 2. + If not specified, default is 2 lanes. Note: If above properties are not defined it can be assumed that the supply regulators or clocks are always on.
drivers/scsi/ufs/ufs-qcom.c +40 -25
104 lines not on this page · raw message
drivers/scsi/ufs/ufshcd.c +29 -0
@@ -39,6 +39,7 @@#include <linux/async.h> #include <linux/devfreq.h> +#include <linux/of.h> #include "ufshcd.h" #include "unipro.h"
@@ -74,6 +75,8 @@/* Interrupt aggregation default timeout, unit: 40us */ #define INT_AGGR_DEF_TO 0x02 +#define UFSHCD_DEFAULT_LANES_PER_DIRECTION 2 +#define ufshcd_toggle_vreg (_dev, _vreg, _on) \ ({ \ int _ret; \
@@ -5530,6 +5533,30 @@ static struct devfreq_dev_profile ufs_devfreq_profile = { .get_dev_status = ufshcd_devfreq_get_dev_status, }; +static void ufshcd_init_lanes_per_dir (struct ufs_hba *hba) +{ +struct device *dev = hba->dev; +int ret; + + ret =of_property_read_u32 (dev->of_node,"lanes-tx" , + &hba->lanes_tx); +if (ret) { +dev_dbg (hba->dev, +"%s: failed to read lanes-tx, ret=%d\n" , + __func__, ret); + hba->lanes_tx =UFSHCD_DEFAULT_LANES_PER_DIRECTION ; + } + + ret =of_property_read_u32 (dev->of_node,"lanes-rx" , + &hba->lanes_rx); +if (ret) { +dev_dbg (hba->dev, +"%s: failed to read lanes-rx, ret=%d\n" , + __func__, ret); + hba->lanes_rx =UFSHCD_DEFAULT_LANES_PER_DIRECTION ; + } +} +/** * ufshcd_init - Driver initialization routine * @hba: per-adapter instance
@@ -5553,6 +5580,8 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) hba->mmio_base = mmio_base; hba->irq = irq; +ufshcd_init_lanes_per_dir (hba); + err =ufshcd_hba_init (hba);if (err) goto out_error;
drivers/scsi/ufs/ufshcd.h +5 -0
@@ -500,6 +500,11 @@ struct ufs_hba {bool wlun_dev_clr_ua; +/* Number of lanes available (1 or 2) for Tx */ +u32 lanes_tx; +/* Number of lanes available (1 or 2) for Rx */ +u32 lanes_rx; +struct ufs_pa_layer_attr pwr_info;struct ufs_pwr_mode_info max_pwr_info;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Can,
Quoted 5 lines
Different platforms may have different number of lanes for the UFS Tx/Rx links. Add parameter to device tree specifying how many lanes should be configured for the UFS Tx/Rx links. And don't print err message for clocks that are optional, this leads to unnecessary confusion about failure.
Does not apply to 4.17/scsi-queue. Please rebase and repost.
Thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Quoted 10 lines · Can Guo
From: Gilad Broner <[email protected]>
Different platforms may have different number of lanes for the UFS Tx/Rx links. Add parameter to device tree specifying how many lanes should be configured for the UFS Tx/Rx links. And don't print err message for clocks that are optional, this leads to unnecessary confusion about failure.
Signed-off-by Gilad Broner <[email protected]>Signed-off-by Subhash Jadavani <[email protected]>Signed-off-by Can Guo <[email protected]>
Quoted 8 lines
---
Changes since v1:
- Change commit subject for better description.
- Incorporated Rob's review comments to use lanes-tx and lanes-rx to handle asymmetric Tx/Rx links..../devicetree/bindings/ufs/ufshcd-pltfrm.txt | 4 ++
Quoted 4 lines
drivers/scsi/ufs/ufs-qcom.c | 65 +++++++++++++--------- drivers/scsi/ufs/ufshcd.c | 29 ++++++++++ drivers/scsi/ufs/ufshcd.h | 5 ++ 4 files changed, 78 insertions(+), 25 deletions(-)