2020-03-09 09:56:12

by Sandeep Maheswaram

[permalink] [raw]
Subject: [PATCH v5 0/9] Add QUSB2 PHY support for SC7180

Converting dt binding to yaml.
Adding compatible for SC7180 in dt bindings.
Added generic QUSB2 V2 PHY support and using the same SC7180 and SDM845.

Changes in v5:
*Added the dt bindings which are applicable only to QUSB2 V2 PHY in
separate block as per comments from Matthias in patch 1/9 and patch 4/9
and addressed Rob's comment in patch 1/9.
*Separated the patch for new override params and added a local variable
to access overrides as per comments from Matthias patch 5/9 and 6/9.

Changes in v4:
*Addressed Rob Herrings comments in dt bindings.
*Added new structure for all the overriding tuning params.
*Removed the sc7180 and sdm845 compatible from driver and added qusb2 v2 phy.
*Added the qusb2 v2 phy compatible in device tree for sc7180 and sdm845.

Changes in v3:
*Using the generic phy cfg table for QUSB2 V2 phy.
*Added support for overriding tuning parameters in QUSB2 V2 PHY
from device tree.

Changes in v2:
Sorted the compatible in driver.
Converted dt binding to yaml.
Added compatible in yaml.

Sandeep Maheswaram (9):
dt-bindings: phy: qcom,qusb2: Convert QUSB2 phy bindings to yaml
dt-bindings: phy: qcom,qusb2: Add compatibles for QUSB2 V2 phy and
SC7180
phy: qcom-qusb2: Add generic QUSB2 V2 PHY support
dt-bindings: phy: qcom-qusb2: Add support for overriding Phy tuning
parameters
phy: qcom-qusb2: Add support for overriding tuning parameters in QUSB2
V2 PHY
phy: qcom-qusb2: Add new overriding tuning parameters in QUSB2 V2 PHY
arm64: dts: qcom: sc7180: Add generic QUSB2 V2 Phy compatible
arm64: dts: qcom: sdm845: Add generic QUSB2 V2 Phy compatible
arm64: dts: qcom: sc7180: Update QUSB2 V2 Phy params for SC7180 IDP
device

.../devicetree/bindings/phy/qcom,qusb2-phy.yaml | 187 +++++++++++++++++++++
.../devicetree/bindings/phy/qcom-qusb2-phy.txt | 68 --------
arch/arm64/boot/dts/qcom/sc7180-idp.dts | 6 +-
arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +-
arch/arm64/boot/dts/qcom/sdm845.dtsi | 4 +-
drivers/phy/qualcomm/phy-qcom-qusb2.c | 144 +++++++++++-----
6 files changed, 297 insertions(+), 114 deletions(-)
create mode 100644 Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
delete mode 100644 Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt

--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


2020-03-09 09:56:20

by Sandeep Maheswaram

[permalink] [raw]
Subject: [PATCH v5 5/9] phy: qcom-qusb2: Add support for overriding tuning parameters in QUSB2 V2 PHY

Added new structure for overriding tuning parameters in QUSB2 V2 PHY as the
override params are increased due to usage of generic QUSB2 V2 phy table.

Signed-off-by: Sandeep Maheswaram <[email protected]>
---
drivers/phy/qualcomm/phy-qcom-qusb2.c | 75 ++++++++++++++++++++---------------
1 file changed, 43 insertions(+), 32 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qusb2.c b/drivers/phy/qualcomm/phy-qcom-qusb2.c
index 70c9da6..44841c9 100644
--- a/drivers/phy/qualcomm/phy-qcom-qusb2.c
+++ b/drivers/phy/qualcomm/phy-qcom-qusb2.c
@@ -277,6 +277,28 @@ static const char * const qusb2_phy_vreg_names[] = {

#define QUSB2_NUM_VREGS ARRAY_SIZE(qusb2_phy_vreg_names)

+/* struct override_param - structure holding qusb2 v2 phy overriding param
+ * set override true if the device tree property exists and read and assign
+ * to value
+ */
+struct override_param {
+ bool override;
+ u8 value;
+};
+
+/*struct override_params - structure holding qusb2 v2 phy overriding params
+ * @imp_res_offset: rescode offset to be updated in IMP_CTRL1 register
+ * @hstx_trim: HSTX_TRIM to be updated in TUNE1 register
+ * @preemphasis: Amplitude Pre-Emphasis to be updated in TUNE1 register
+ * @preemphasis_width: half/full-width Pre-Emphasis updated via TUNE1
+ */
+struct override_params {
+ struct override_param imp_res_offset;
+ struct override_param hstx_trim;
+ struct override_param preemphasis;
+ struct override_param preemphasis_width;
+};
+
/**
* struct qusb2_phy - structure holding qusb2 phy attributes
*
@@ -292,14 +314,7 @@ static const char * const qusb2_phy_vreg_names[] = {
* @tcsr: TCSR syscon register map
* @cell: nvmem cell containing phy tuning value
*
- * @override_imp_res_offset: PHY should use different rescode offset
- * @imp_res_offset_value: rescode offset to be updated in IMP_CTRL1 register
- * @override_hstx_trim: PHY should use different HSTX o/p current value
- * @hstx_trim_value: HSTX_TRIM value to be updated in TUNE1 register
- * @override_preemphasis: PHY should use different pre-amphasis amplitude
- * @preemphasis_level: Amplitude Pre-Emphasis to be updated in TUNE1 register
- * @override_preemphasis_width: PHY should use different pre-emphasis duration
- * @preemphasis_width: half/full-width Pre-Emphasis updated via TUNE1
+ * @overrides: pointer to structure for all overriding tuning params
*
* @cfg: phy config data
* @has_se_clk_scheme: indicate if PHY has single-ended ref clock scheme
@@ -319,14 +334,7 @@ struct qusb2_phy {
struct regmap *tcsr;
struct nvmem_cell *cell;

- bool override_imp_res_offset;
- u8 imp_res_offset_value;
- bool override_hstx_trim;
- u8 hstx_trim_value;
- bool override_preemphasis;
- u8 preemphasis_level;
- bool override_preemphasis_width;
- u8 preemphasis_width;
+ struct override_params overrides;

const struct qusb2_phy_cfg *cfg;
bool has_se_clk_scheme;
@@ -394,24 +402,25 @@ void qcom_qusb2_phy_configure(void __iomem *base,
static void qusb2_phy_override_phy_params(struct qusb2_phy *qphy)
{
const struct qusb2_phy_cfg *cfg = qphy->cfg;
+ struct override_params *or = &qphy->overrides;

- if (qphy->override_imp_res_offset)
+ if (or->imp_res_offset.override)
qusb2_write_mask(qphy->base, QUSB2PHY_IMP_CTRL1,
- qphy->imp_res_offset_value << IMP_RES_OFFSET_SHIFT,
+ or->imp_res_offset.value << IMP_RES_OFFSET_SHIFT,
IMP_RES_OFFSET_MASK);

- if (qphy->override_hstx_trim)
+ if (or->hstx_trim.override)
qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1],
- qphy->hstx_trim_value << HSTX_TRIM_SHIFT,
+ or->hstx_trim.value << HSTX_TRIM_SHIFT,
HSTX_TRIM_MASK);

- if (qphy->override_preemphasis)
+ if (or->preemphasis.override)
qusb2_write_mask(qphy->base, cfg->regs[QUSB2PHY_PORT_TUNE1],
- qphy->preemphasis_level << PREEMPHASIS_EN_SHIFT,
+ or->preemphasis.value << PREEMPHASIS_EN_SHIFT,
PREEMPHASIS_EN_MASK);

- if (qphy->override_preemphasis_width) {
- if (qphy->preemphasis_width ==
+ if (or->preemphasis_width.override) {
+ if (or->preemphasis_width.value ==
QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT)
qusb2_setbits(qphy->base,
cfg->regs[QUSB2PHY_PORT_TUNE1],
@@ -796,10 +805,12 @@ static int qusb2_phy_probe(struct platform_device *pdev)
int ret, i;
int num;
u32 value;
+ struct override_params *or;

qphy = devm_kzalloc(dev, sizeof(*qphy), GFP_KERNEL);
if (!qphy)
return -ENOMEM;
+ or = &qphy->overrides;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
qphy->base = devm_ioremap_resource(dev, res);
@@ -864,26 +875,26 @@ static int qusb2_phy_probe(struct platform_device *pdev)

if (!of_property_read_u32(dev->of_node, "qcom,imp-res-offset-value",
&value)) {
- qphy->imp_res_offset_value = (u8)value;
- qphy->override_imp_res_offset = true;
+ or->imp_res_offset.value = (u8)value;
+ or->imp_res_offset.override = true;
}

if (!of_property_read_u32(dev->of_node, "qcom,hstx-trim-value",
&value)) {
- qphy->hstx_trim_value = (u8)value;
- qphy->override_hstx_trim = true;
+ or->hstx_trim.value = (u8)value;
+ or->hstx_trim.override = true;
}

if (!of_property_read_u32(dev->of_node, "qcom,preemphasis-level",
&value)) {
- qphy->preemphasis_level = (u8)value;
- qphy->override_preemphasis = true;
+ or->preemphasis.value = (u8)value;
+ or->preemphasis.override = true;
}

if (!of_property_read_u32(dev->of_node, "qcom,preemphasis-width",
&value)) {
- qphy->preemphasis_width = (u8)value;
- qphy->override_preemphasis_width = true;
+ or->preemphasis_width.value = (u8)value;
+ or->preemphasis_width.override = true;
}

pm_runtime_set_active(dev);
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

2020-03-09 19:32:20

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH v5 0/9] Add QUSB2 PHY support for SC7180

On Mon 09 Mar 02:53 PDT 2020, Sandeep Maheswaram wrote:

Kishon, let me know if/when you're picking up patch 1-6 and I can pick
the dts patches through the qcom soc tree.

Regards,
Bjorn

> Converting dt binding to yaml.
> Adding compatible for SC7180 in dt bindings.
> Added generic QUSB2 V2 PHY support and using the same SC7180 and SDM845.
>
> Changes in v5:
> *Added the dt bindings which are applicable only to QUSB2 V2 PHY in
> separate block as per comments from Matthias in patch 1/9 and patch 4/9
> and addressed Rob's comment in patch 1/9.
> *Separated the patch for new override params and added a local variable
> to access overrides as per comments from Matthias patch 5/9 and 6/9.
>
> Changes in v4:
> *Addressed Rob Herrings comments in dt bindings.
> *Added new structure for all the overriding tuning params.
> *Removed the sc7180 and sdm845 compatible from driver and added qusb2 v2 phy.
> *Added the qusb2 v2 phy compatible in device tree for sc7180 and sdm845.
>
> Changes in v3:
> *Using the generic phy cfg table for QUSB2 V2 phy.
> *Added support for overriding tuning parameters in QUSB2 V2 PHY
> from device tree.
>
> Changes in v2:
> Sorted the compatible in driver.
> Converted dt binding to yaml.
> Added compatible in yaml.
>
> Sandeep Maheswaram (9):
> dt-bindings: phy: qcom,qusb2: Convert QUSB2 phy bindings to yaml
> dt-bindings: phy: qcom,qusb2: Add compatibles for QUSB2 V2 phy and
> SC7180
> phy: qcom-qusb2: Add generic QUSB2 V2 PHY support
> dt-bindings: phy: qcom-qusb2: Add support for overriding Phy tuning
> parameters
> phy: qcom-qusb2: Add support for overriding tuning parameters in QUSB2
> V2 PHY
> phy: qcom-qusb2: Add new overriding tuning parameters in QUSB2 V2 PHY
> arm64: dts: qcom: sc7180: Add generic QUSB2 V2 Phy compatible
> arm64: dts: qcom: sdm845: Add generic QUSB2 V2 Phy compatible
> arm64: dts: qcom: sc7180: Update QUSB2 V2 Phy params for SC7180 IDP
> device
>
> .../devicetree/bindings/phy/qcom,qusb2-phy.yaml | 187 +++++++++++++++++++++
> .../devicetree/bindings/phy/qcom-qusb2-phy.txt | 68 --------
> arch/arm64/boot/dts/qcom/sc7180-idp.dts | 6 +-
> arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +-
> arch/arm64/boot/dts/qcom/sdm845.dtsi | 4 +-
> drivers/phy/qualcomm/phy-qcom-qusb2.c | 144 +++++++++++-----
> 6 files changed, 297 insertions(+), 114 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
> delete mode 100644 Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt
>
> --
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
>

2020-03-20 06:06:27

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: Re: [PATCH v5 0/9] Add QUSB2 PHY support for SC7180

Hi,

On 3/9/2020 3:23 PM, Sandeep Maheswaram wrote:
> Converting dt binding to yaml.
> Adding compatible for SC7180 in dt bindings.
> Added generic QUSB2 V2 PHY support and using the same SC7180 and SDM845.
>
> Changes in v5:
> *Added the dt bindings which are applicable only to QUSB2 V2 PHY in
> separate block as per comments from Matthias in patch 1/9 and patch 4/9
> and addressed Rob's comment in patch 1/9.
> *Separated the patch for new override params and added a local variable
> to access overrides as per comments from Matthias patch 5/9 and 6/9.
>
> Changes in v4:
> *Addressed Rob Herrings comments in dt bindings.
> *Added new structure for all the overriding tuning params.
> *Removed the sc7180 and sdm845 compatible from driver and added qusb2 v2 phy.
> *Added the qusb2 v2 phy compatible in device tree for sc7180 and sdm845.
>
> Changes in v3:
> *Using the generic phy cfg table for QUSB2 V2 phy.
> *Added support for overriding tuning parameters in QUSB2 V2 PHY
> from device tree.
>
> Changes in v2:
> Sorted the compatible in driver.
> Converted dt binding to yaml.
> Added compatible in yaml.
>
> Sandeep Maheswaram (9):
> dt-bindings: phy: qcom,qusb2: Convert QUSB2 phy bindings to yaml
> dt-bindings: phy: qcom,qusb2: Add compatibles for QUSB2 V2 phy and
> SC7180
> phy: qcom-qusb2: Add generic QUSB2 V2 PHY support
> dt-bindings: phy: qcom-qusb2: Add support for overriding Phy tuning
> parameters
> phy: qcom-qusb2: Add support for overriding tuning parameters in QUSB2
> V2 PHY
> phy: qcom-qusb2: Add new overriding tuning parameters in QUSB2 V2 PHY

merged the above patches to phy -next.

Thanks
Kishon
> arm64: dts: qcom: sc7180: Add generic QUSB2 V2 Phy compatible
> arm64: dts: qcom: sdm845: Add generic QUSB2 V2 Phy compatible
> arm64: dts: qcom: sc7180: Update QUSB2 V2 Phy params for SC7180 IDP
> device
>
> .../devicetree/bindings/phy/qcom,qusb2-phy.yaml | 187 +++++++++++++++++++++
> .../devicetree/bindings/phy/qcom-qusb2-phy.txt | 68 --------
> arch/arm64/boot/dts/qcom/sc7180-idp.dts | 6 +-
> arch/arm64/boot/dts/qcom/sc7180.dtsi | 2 +-
> arch/arm64/boot/dts/qcom/sdm845.dtsi | 4 +-
> drivers/phy/qualcomm/phy-qcom-qusb2.c | 144 +++++++++++-----
> 6 files changed, 297 insertions(+), 114 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml
> delete mode 100644 Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt
>