* [PATCH 0/3] phy: brcm-sata: Allow RX equalizer tuning
@ 2017-10-12 0:53 Florian Fainelli
2017-10-12 0:53 ` [PATCH 1/3] dt-bindings: phy: Add RX equalizer properties for Broadcom SATA PHY Florian Fainelli
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Florian Fainelli @ 2017-10-12 0:53 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Florian Fainelli, Rob Herring, Mark Rutland,
Kishon Vijay Abraham I, Ray Jui, Srinath Mannam, Vivek Gautam,
Viresh Kumar, Heiko Stuebner, Dan Carpenter,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w
Hi Kishon,
This patch series allows the tuning of the PHY RX equalizer which may
be necessary for particular board designs to pass compliance testing.
This is based off your next branch.
Please apply!
Thank you
Florian Fainelli (3):
dt-bindings: phy: Add RX equalizer properties for Broadcom SATA PHY
phy: brcm-sata: Prepare for doing more tuning
phy: brcm-sata: Allow RX equalizer tuning
.../devicetree/bindings/phy/brcm-sata-phy.txt | 11 +++-
drivers/phy/broadcom/phy-brcm-sata.c | 74 +++++++++++++++++++++-
2 files changed, 83 insertions(+), 2 deletions(-)
--
2.9.3
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] dt-bindings: phy: Add RX equalizer properties for Broadcom SATA PHY
2017-10-12 0:53 [PATCH 0/3] phy: brcm-sata: Allow RX equalizer tuning Florian Fainelli
@ 2017-10-12 0:53 ` Florian Fainelli
2017-10-17 20:26 ` Rob Herring
2017-10-12 0:53 ` [PATCH 2/3] phy: brcm-sata: Prepare for doing more tuning Florian Fainelli
[not found] ` <20171012005312.17363-1-f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2017-10-12 0:53 UTC (permalink / raw)
To: linux-kernel
Cc: Florian Fainelli, Rob Herring, Mark Rutland,
Kishon Vijay Abraham I, Ray Jui, Srinath Mannam, Vivek Gautam,
Viresh Kumar, Heiko Stuebner, Dan Carpenter,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
bcm-kernel-feedback-list
Define two new properties: brcm,rx-aeq-mode which allows configuring the
SATA PHY RX equalizers and when "manual" is used, brcm,rx-aeq can be
used to set the exact value.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Documentation/devicetree/bindings/phy/brcm-sata-phy.txt | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/phy/brcm-sata-phy.txt b/Documentation/devicetree/bindings/phy/brcm-sata-phy.txt
index 97977cd29a98..0aced97d8092 100644
--- a/Documentation/devicetree/bindings/phy/brcm-sata-phy.txt
+++ b/Documentation/devicetree/bindings/phy/brcm-sata-phy.txt
@@ -27,7 +27,16 @@ Sub-nodes optional properties:
This property is not applicable for "brcm,iproc-ns2-sata-phy",
"brcm,iproc-nsp-sata-phy" and "brcm,iproc-sr-sata-phy".
-Example:
+- brcm,rxaeq-mode: string that indicates the desired RX equalizer
+ mode, possible values are:
+ "off" (equivalent to not specifying the property)
+ "auto"
+ "manual" (brcm,rxaeq-value is used in that case)
+
+- brcm,rxaeq-value: when 'rxaeq-mode' is set to "manual", provides the RX
+ equalizer value that should be used. Allowed range is 0..63.
+
+Example
sata-phy@f0458100 {
compatible = "brcm,bcm7445-sata-phy", "brcm,phy-sata3";
reg = <0xf0458100 0x1e00>, <0xf045804c 0x10>;
--
2.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] phy: brcm-sata: Prepare for doing more tuning
2017-10-12 0:53 [PATCH 0/3] phy: brcm-sata: Allow RX equalizer tuning Florian Fainelli
2017-10-12 0:53 ` [PATCH 1/3] dt-bindings: phy: Add RX equalizer properties for Broadcom SATA PHY Florian Fainelli
@ 2017-10-12 0:53 ` Florian Fainelli
[not found] ` <20171012005312.17363-1-f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2017-10-12 0:53 UTC (permalink / raw)
To: linux-kernel
Cc: Florian Fainelli, Rob Herring, Mark Rutland,
Kishon Vijay Abraham I, Ray Jui, Srinath Mannam, Vivek Gautam,
Viresh Kumar, Heiko Stuebner, Dan Carpenter,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
bcm-kernel-feedback-list
Split the functional code in brcm_stb_sata_init() to a separate function
that actually does configure spread spectrum: brcm_stb_sata_ssc_init()
and make that function return void, since that function cannot fail.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/phy/broadcom/phy-brcm-sata.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/broadcom/phy-brcm-sata.c b/drivers/phy/broadcom/phy-brcm-sata.c
index 9d7f74fe3d7c..0152d0b32dae 100644
--- a/drivers/phy/broadcom/phy-brcm-sata.c
+++ b/drivers/phy/broadcom/phy-brcm-sata.c
@@ -190,7 +190,7 @@ static u32 brcm_sata_phy_rd(void __iomem *pcb_base, u32 bank, u32 ofs)
#define STB_FMAX_VAL_DEFAULT 0x3df
#define STB_FMAX_VAL_SSC 0x83
-static int brcm_stb_sata_init(struct brcm_sata_port *port)
+static void brcm_stb_sata_ssc_init(struct brcm_sata_port *port)
{
void __iomem *base = brcm_sata_pcb_base(port);
struct brcm_sata_phy *priv = port->phy_priv;
@@ -215,6 +215,11 @@ static int brcm_stb_sata_init(struct brcm_sata_port *port)
brcm_sata_phy_wr(base, TXPMD_REG_BANK, TXPMD_TX_FREQ_CTRL_CONTROL3,
~TXPMD_TX_FREQ_CTRL_CONTROL3_FMAX_MASK, tmp);
+}
+
+static int brcm_stb_sata_init(struct brcm_sata_port *port)
+{
+ brcm_stb_sata_ssc_init(port);
return 0;
}
--
2.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] phy: brcm-sata: Allow RX equalizer tuning
[not found] ` <20171012005312.17363-1-f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-10-12 0:53 ` Florian Fainelli
2017-10-18 12:18 ` [PATCH 0/3] " Kishon Vijay Abraham I
1 sibling, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2017-10-12 0:53 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Florian Fainelli, Rob Herring, Mark Rutland,
Kishon Vijay Abraham I, Ray Jui, Srinath Mannam, Vivek Gautam,
Viresh Kumar, Heiko Stuebner, Dan Carpenter,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w
Parse the DT properties brcm,rxaeq-mode and brcm,rxaeq-value to
correctly configure the RX equalizer of the PHY. This may be required to
resolve specific signal integrity issues.
Signed-off-by: Florian Fainelli <f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
drivers/phy/broadcom/phy-brcm-sata.c | 69 +++++++++++++++++++++++++++++++++++-
1 file changed, 68 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/broadcom/phy-brcm-sata.c b/drivers/phy/broadcom/phy-brcm-sata.c
index 0152d0b32dae..3f953db70288 100644
--- a/drivers/phy/broadcom/phy-brcm-sata.c
+++ b/drivers/phy/broadcom/phy-brcm-sata.c
@@ -49,11 +49,29 @@ enum brcm_sata_phy_version {
BRCM_SATA_PHY_IPROC_SR,
};
+enum brcm_sata_phy_rxaeq_mode {
+ RXAEQ_MODE_OFF = 0,
+ RXAEQ_MODE_AUTO,
+ RXAEQ_MODE_MANUAL,
+};
+
+static enum brcm_sata_phy_rxaeq_mode rxaeq_to_val(const char *m)
+{
+ if (!strcmp(m, "auto"))
+ return RXAEQ_MODE_AUTO;
+ else if (!strcmp(m, "manual"))
+ return RXAEQ_MODE_MANUAL;
+ else
+ return RXAEQ_MODE_OFF;
+}
+
struct brcm_sata_port {
int portnum;
struct phy *phy;
struct brcm_sata_phy *phy_priv;
bool ssc_en;
+ enum brcm_sata_phy_rxaeq_mode rxaeq_mode;
+ u32 rxaeq_val;
};
struct brcm_sata_phy {
@@ -93,6 +111,15 @@ enum sata_phy_regs {
TX_ACTRL0 = 0x80,
TX_ACTRL0_TXPOL_FLIP = BIT(6),
+ AEQRX_REG_BANK_0 = 0xd0,
+ AEQ_CONTROL1 = 0x81,
+ AEQ_CONTROL1_ENABLE = BIT(2),
+ AEQ_CONTROL1_FREEZE = BIT(3),
+ AEQ_FRC_EQ = 0x83,
+ AEQ_FRC_EQ_FORCE = BIT(0),
+ AEQ_FRC_EQ_FORCE_VAL = BIT(1),
+ AEQRX_REG_BANK_1 = 0xe0,
+
OOB_REG_BANK = 0x150,
OOB1_REG_BANK = 0x160,
OOB_CTRL1 = 0x80,
@@ -217,11 +244,43 @@ static void brcm_stb_sata_ssc_init(struct brcm_sata_port *port)
~TXPMD_TX_FREQ_CTRL_CONTROL3_FMAX_MASK, tmp);
}
+#define AEQ_FRC_EQ_VAL_SHIFT 2
+#define AEQ_FRC_EQ_VAL_MASK 0x3f
+
+static int brcm_stb_sata_rxaeq_init(struct brcm_sata_port *port)
+{
+ void __iomem *base = brcm_sata_pcb_base(port);
+ u32 tmp = 0, reg = 0;
+
+ switch (port->rxaeq_mode) {
+ case RXAEQ_MODE_OFF:
+ return 0;
+
+ case RXAEQ_MODE_AUTO:
+ reg = AEQ_CONTROL1;
+ tmp = AEQ_CONTROL1_ENABLE | AEQ_CONTROL1_FREEZE;
+ break;
+
+ case RXAEQ_MODE_MANUAL:
+ reg = AEQ_FRC_EQ;
+ tmp = AEQ_FRC_EQ_FORCE | AEQ_FRC_EQ_FORCE_VAL;
+ if (port->rxaeq_val > AEQ_FRC_EQ_VAL_MASK)
+ return -EINVAL;
+ tmp |= port->rxaeq_val << AEQ_FRC_EQ_VAL_SHIFT;
+ break;
+ }
+
+ brcm_sata_phy_wr(base, AEQRX_REG_BANK_0, reg, ~tmp, tmp);
+ brcm_sata_phy_wr(base, AEQRX_REG_BANK_1, reg, ~tmp, tmp);
+
+ return 0;
+}
+
static int brcm_stb_sata_init(struct brcm_sata_port *port)
{
brcm_stb_sata_ssc_init(port);
- return 0;
+ return brcm_stb_sata_rxaeq_init(port);
}
/* NS2 SATA PLL1 defaults were characterized by H/W group */
@@ -468,6 +527,7 @@ MODULE_DEVICE_TABLE(of, brcm_sata_phy_of_match);
static int brcm_sata_phy_probe(struct platform_device *pdev)
{
+ const char *rxaeq_mode;
struct device *dev = &pdev->dev;
struct device_node *dn = dev->of_node, *child;
const struct of_device_id *of_id;
@@ -530,6 +590,13 @@ static int brcm_sata_phy_probe(struct platform_device *pdev)
port->portnum = id;
port->phy_priv = priv;
port->phy = devm_phy_create(dev, child, &phy_ops);
+ port->rxaeq_mode = RXAEQ_MODE_OFF;
+ if (!of_property_read_string(child, "brcm,rxaeq-mode",
+ &rxaeq_mode))
+ port->rxaeq_mode = rxaeq_to_val(rxaeq_mode);
+ if (port->rxaeq_mode == RXAEQ_MODE_MANUAL)
+ of_property_read_u32(child, "brcm,rxaeq-value",
+ &port->rxaeq_val);
port->ssc_en = of_property_read_bool(child, "brcm,enable-ssc");
if (IS_ERR(port->phy)) {
dev_err(dev, "failed to create PHY\n");
--
2.9.3
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] dt-bindings: phy: Add RX equalizer properties for Broadcom SATA PHY
2017-10-12 0:53 ` [PATCH 1/3] dt-bindings: phy: Add RX equalizer properties for Broadcom SATA PHY Florian Fainelli
@ 2017-10-17 20:26 ` Rob Herring
0 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2017-10-17 20:26 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-kernel, Mark Rutland, Kishon Vijay Abraham I, Ray Jui,
Srinath Mannam, Vivek Gautam, Viresh Kumar, Heiko Stuebner,
Dan Carpenter,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
bcm-kernel-feedback-list
On Wed, Oct 11, 2017 at 05:53:10PM -0700, Florian Fainelli wrote:
> Define two new properties: brcm,rx-aeq-mode which allows configuring the
> SATA PHY RX equalizers and when "manual" is used, brcm,rx-aeq can be
> used to set the exact value.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> Documentation/devicetree/bindings/phy/brcm-sata-phy.txt | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] phy: brcm-sata: Allow RX equalizer tuning
[not found] ` <20171012005312.17363-1-f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-12 0:53 ` [PATCH 3/3] phy: brcm-sata: Allow RX equalizer tuning Florian Fainelli
@ 2017-10-18 12:18 ` Kishon Vijay Abraham I
1 sibling, 0 replies; 6+ messages in thread
From: Kishon Vijay Abraham I @ 2017-10-18 12:18 UTC (permalink / raw)
To: Florian Fainelli, linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Rob Herring, Mark Rutland, Ray Jui, Srinath Mannam, Vivek Gautam,
Viresh Kumar, Heiko Stuebner, Dan Carpenter,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w
On Thursday 12 October 2017 06:23 AM, Florian Fainelli wrote:
> Hi Kishon,
>
> This patch series allows the tuning of the PHY RX equalizer which may
> be necessary for particular board designs to pass compliance testing.
>
> This is based off your next branch.
>
> Please apply!
merged, thanks!
-Kishon
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-18 12:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-12 0:53 [PATCH 0/3] phy: brcm-sata: Allow RX equalizer tuning Florian Fainelli
2017-10-12 0:53 ` [PATCH 1/3] dt-bindings: phy: Add RX equalizer properties for Broadcom SATA PHY Florian Fainelli
2017-10-17 20:26 ` Rob Herring
2017-10-12 0:53 ` [PATCH 2/3] phy: brcm-sata: Prepare for doing more tuning Florian Fainelli
[not found] ` <20171012005312.17363-1-f.fainelli-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-12 0:53 ` [PATCH 3/3] phy: brcm-sata: Allow RX equalizer tuning Florian Fainelli
2017-10-18 12:18 ` [PATCH 0/3] " Kishon Vijay Abraham I
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).