linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Broadcom Stingray SATA PHY support
@ 2017-06-08 11:31 Srinath Mannam
  2017-06-08 11:31 ` [PATCH v2 1/2] dt-bindings: Update documentation for stingray SATA phy Srinath Mannam
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Srinath Mannam @ 2017-06-08 11:31 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Kishon Vijay Abraham I
  Cc: Tejun Heo, Florian Fainelli, Ray Jui, devicetree, linux-kernel,
	bcm-kernel-feedback-list, Srinath Mannam

This patchset extends the Broadcom SATA PHY driver to add
support for Stingray SATA PHY.

All patches are based on linux-phy/next

Changes since v1:
 - Rebased patchset on linux-phy/next

Srinath Mannam (2):
  dt-bindings: Update documentation for stingray SATA phy
  phy: Add stingray SATA phy support

 .../devicetree/bindings/phy/brcm-sata-phy.txt      |  7 ++-
 drivers/phy/broadcom/phy-brcm-sata.c               | 73 ++++++++++++++++++++++
 2 files changed, 77 insertions(+), 3 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/2] dt-bindings: Update documentation for stingray SATA phy
  2017-06-08 11:31 [PATCH v2 0/2] Broadcom Stingray SATA PHY support Srinath Mannam
@ 2017-06-08 11:31 ` Srinath Mannam
  2017-06-08 16:33   ` Florian Fainelli
  2017-06-12 16:30   ` Rob Herring
  2017-06-08 11:31 ` [PATCH v2 2/2] phy: Add stingray SATA phy support Srinath Mannam
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Srinath Mannam @ 2017-06-08 11:31 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Kishon Vijay Abraham I
  Cc: Tejun Heo, Florian Fainelli, Ray Jui, devicetree, linux-kernel,
	bcm-kernel-feedback-list, Srinath Mannam

Update BRCM SATA phy dt-binding documentation for stingray.

Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Scott Branden <scott.branden@broadcom.com>
---
 Documentation/devicetree/bindings/phy/brcm-sata-phy.txt | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/phy/brcm-sata-phy.txt b/Documentation/devicetree/bindings/phy/brcm-sata-phy.txt
index 6ccce09..97977cd 100644
--- a/Documentation/devicetree/bindings/phy/brcm-sata-phy.txt
+++ b/Documentation/devicetree/bindings/phy/brcm-sata-phy.txt
@@ -7,12 +7,13 @@ Required properties:
      "brcm,iproc-ns2-sata-phy"
      "brcm,iproc-nsp-sata-phy"
      "brcm,phy-sata3"
+     "brcm,iproc-sr-sata-phy"
 - address-cells: should be 1
 - size-cells: should be 0
 - reg: register ranges for the PHY PCB interface
 - reg-names: should be "phy" and "phy-ctrl"
      The "phy-ctrl" registers are only required for
-     "brcm,iproc-ns2-sata-phy".
+     "brcm,iproc-ns2-sata-phy" and "brcm,iproc-sr-sata-phy".
 
 Sub-nodes:
   Each port's PHY should be represented as a sub-node.
@@ -23,8 +24,8 @@ Sub-nodes required properties:
 
 Sub-nodes optional properties:
 - brcm,enable-ssc: use spread spectrum clocking (SSC) on this port
-     This property is not applicable for "brcm,iproc-ns2-sata-phy" and
-     "brcm,iproc-nsp-sata-phy".
+     This property is not applicable for "brcm,iproc-ns2-sata-phy",
+     "brcm,iproc-nsp-sata-phy" and "brcm,iproc-sr-sata-phy".
 
 Example:
 	sata-phy@f0458100 {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] phy: Add stingray SATA phy support
  2017-06-08 11:31 [PATCH v2 0/2] Broadcom Stingray SATA PHY support Srinath Mannam
  2017-06-08 11:31 ` [PATCH v2 1/2] dt-bindings: Update documentation for stingray SATA phy Srinath Mannam
@ 2017-06-08 11:31 ` Srinath Mannam
  2017-06-08 16:33   ` Florian Fainelli
  2017-06-15  8:15   ` Srinath Mannam
  2017-06-08 16:34 ` [PATCH v2 0/2] Broadcom Stingray SATA PHY support Florian Fainelli
  2017-06-16  5:45 ` Kishon Vijay Abraham I
  3 siblings, 2 replies; 9+ messages in thread
From: Srinath Mannam @ 2017-06-08 11:31 UTC (permalink / raw)
  To: Rob Herring, Mark Rutland, Kishon Vijay Abraham I
  Cc: Tejun Heo, Florian Fainelli, Ray Jui, devicetree, linux-kernel,
	bcm-kernel-feedback-list, Srinath Mannam

This patch adds support for stingray SATA phy in the
SATA BRCM phy driver.

Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
---
 drivers/phy/broadcom/phy-brcm-sata.c | 73 ++++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)

diff --git a/drivers/phy/broadcom/phy-brcm-sata.c b/drivers/phy/broadcom/phy-brcm-sata.c
index ccbc3d9..e6544c8 100644
--- a/drivers/phy/broadcom/phy-brcm-sata.c
+++ b/drivers/phy/broadcom/phy-brcm-sata.c
@@ -46,6 +46,7 @@ enum brcm_sata_phy_version {
 	BRCM_SATA_PHY_STB_40NM,
 	BRCM_SATA_PHY_IPROC_NS2,
 	BRCM_SATA_PHY_IPROC_NSP,
+	BRCM_SATA_PHY_IPROC_SR,
 };
 
 struct brcm_sata_port {
@@ -81,12 +82,17 @@ enum sata_phy_regs {
 	PLL_ACTRL2				= 0x8b,
 	PLL_ACTRL2_SELDIV_MASK			= 0x1f,
 	PLL_ACTRL2_SELDIV_SHIFT			= 9,
+	PLL_ACTRL6				= 0x86,
 
 	PLL1_REG_BANK				= 0x060,
 	PLL1_ACTRL2				= 0x82,
 	PLL1_ACTRL3				= 0x83,
 	PLL1_ACTRL4				= 0x84,
 
+	TX_REG_BANK				= 0x070,
+	TX_ACTRL0				= 0x80,
+	TX_ACTRL0_TXPOL_FLIP			= BIT(6),
+
 	OOB_REG_BANK				= 0x150,
 	OOB1_REG_BANK				= 0x160,
 	OOB_CTRL1				= 0x80,
@@ -347,6 +353,68 @@ static int brcm_nsp_sata_init(struct brcm_sata_port *port)
 	return 0;
 }
 
+/* SR PHY PLL0 registers */
+#define SR_PLL0_ACTRL6_MAGIC			0xa
+
+/* SR PHY PLL1 registers */
+#define SR_PLL1_ACTRL2_MAGIC			0x32
+#define SR_PLL1_ACTRL3_MAGIC			0x2
+#define SR_PLL1_ACTRL4_MAGIC			0x3e8
+
+static int brcm_sr_sata_init(struct brcm_sata_port *port)
+{
+	struct brcm_sata_phy *priv = port->phy_priv;
+	struct device *dev = port->phy_priv->dev;
+	void __iomem *base = priv->phy_base;
+	unsigned int val, try;
+
+	/* Configure PHY PLL register bank 1 */
+	val = SR_PLL1_ACTRL2_MAGIC;
+	brcm_sata_phy_wr(base, PLL1_REG_BANK, PLL1_ACTRL2, 0x0, val);
+	val = SR_PLL1_ACTRL3_MAGIC;
+	brcm_sata_phy_wr(base, PLL1_REG_BANK, PLL1_ACTRL3, 0x0, val);
+	val = SR_PLL1_ACTRL4_MAGIC;
+	brcm_sata_phy_wr(base, PLL1_REG_BANK, PLL1_ACTRL4, 0x0, val);
+
+	/* Configure PHY PLL register bank 0 */
+	val = SR_PLL0_ACTRL6_MAGIC;
+	brcm_sata_phy_wr(base, PLL_REG_BANK_0, PLL_ACTRL6, 0x0, val);
+
+	/* Wait for PHY PLL lock by polling pll_lock bit */
+	try = 50;
+	do {
+		val = brcm_sata_phy_rd(base, BLOCK0_REG_BANK,
+					BLOCK0_XGXSSTATUS);
+		if (val & BLOCK0_XGXSSTATUS_PLL_LOCK)
+			break;
+		msleep(20);
+		try--;
+	} while (try);
+
+	if ((val & BLOCK0_XGXSSTATUS_PLL_LOCK) == 0) {
+		/* PLL did not lock; give up */
+		dev_err(dev, "port%d PLL did not lock\n", port->portnum);
+		return -ETIMEDOUT;
+	}
+
+	/* Invert Tx polarity */
+	brcm_sata_phy_wr(base, TX_REG_BANK, TX_ACTRL0,
+			 ~TX_ACTRL0_TXPOL_FLIP, TX_ACTRL0_TXPOL_FLIP);
+
+	/* Configure OOB control to handle 100MHz reference clock */
+	val = ((0xc << OOB_CTRL1_BURST_MAX_SHIFT) |
+		(0x4 << OOB_CTRL1_BURST_MIN_SHIFT) |
+		(0x8 << OOB_CTRL1_WAKE_IDLE_MAX_SHIFT) |
+		(0x3 << OOB_CTRL1_WAKE_IDLE_MIN_SHIFT));
+	brcm_sata_phy_wr(base, OOB_REG_BANK, OOB_CTRL1, 0x0, val);
+	val = ((0x1b << OOB_CTRL2_RESET_IDLE_MAX_SHIFT) |
+		(0x2 << OOB_CTRL2_BURST_CNT_SHIFT) |
+		(0x9 << OOB_CTRL2_RESET_IDLE_MIN_SHIFT));
+	brcm_sata_phy_wr(base, OOB_REG_BANK, OOB_CTRL2, 0x0, val);
+
+	return 0;
+}
+
 static int brcm_sata_phy_init(struct phy *phy)
 {
 	int rc;
@@ -363,6 +431,9 @@ static int brcm_sata_phy_init(struct phy *phy)
 	case BRCM_SATA_PHY_IPROC_NSP:
 		rc = brcm_nsp_sata_init(port);
 		break;
+	case BRCM_SATA_PHY_IPROC_SR:
+		rc = brcm_sr_sata_init(port);
+		break;
 	default:
 		rc = -ENODEV;
 	}
@@ -384,6 +455,8 @@ static const struct of_device_id brcm_sata_phy_of_match[] = {
 	  .data = (void *)BRCM_SATA_PHY_IPROC_NS2 },
 	{ .compatible = "brcm,iproc-nsp-sata-phy",
 	  .data = (void *)BRCM_SATA_PHY_IPROC_NSP },
+	{ .compatible	= "brcm,iproc-sr-sata-phy",
+	  .data = (void *)BRCM_SATA_PHY_IPROC_SR },
 	{},
 };
 MODULE_DEVICE_TABLE(of, brcm_sata_phy_of_match);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: Update documentation for stingray SATA phy
  2017-06-08 11:31 ` [PATCH v2 1/2] dt-bindings: Update documentation for stingray SATA phy Srinath Mannam
@ 2017-06-08 16:33   ` Florian Fainelli
  2017-06-12 16:30   ` Rob Herring
  1 sibling, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2017-06-08 16:33 UTC (permalink / raw)
  To: Srinath Mannam, Rob Herring, Mark Rutland, Kishon Vijay Abraham I
  Cc: Tejun Heo, Florian Fainelli, Ray Jui, devicetree, linux-kernel,
	bcm-kernel-feedback-list

On 06/08/2017 04:31 AM, Srinath Mannam wrote:
> Update BRCM SATA phy dt-binding documentation for stingray.
> 
> Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
> Reviewed-by: Ray Jui <ray.jui@broadcom.com>
> Reviewed-by: Scott Branden <scott.branden@broadcom.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] phy: Add stingray SATA phy support
  2017-06-08 11:31 ` [PATCH v2 2/2] phy: Add stingray SATA phy support Srinath Mannam
@ 2017-06-08 16:33   ` Florian Fainelli
  2017-06-15  8:15   ` Srinath Mannam
  1 sibling, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2017-06-08 16:33 UTC (permalink / raw)
  To: Srinath Mannam, Rob Herring, Mark Rutland, Kishon Vijay Abraham I
  Cc: Tejun Heo, Florian Fainelli, Ray Jui, devicetree, linux-kernel,
	bcm-kernel-feedback-list

On 06/08/2017 04:31 AM, Srinath Mannam wrote:
> This patch adds support for stingray SATA phy in the
> SATA BRCM phy driver.
> 
> Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 0/2] Broadcom Stingray SATA PHY support
  2017-06-08 11:31 [PATCH v2 0/2] Broadcom Stingray SATA PHY support Srinath Mannam
  2017-06-08 11:31 ` [PATCH v2 1/2] dt-bindings: Update documentation for stingray SATA phy Srinath Mannam
  2017-06-08 11:31 ` [PATCH v2 2/2] phy: Add stingray SATA phy support Srinath Mannam
@ 2017-06-08 16:34 ` Florian Fainelli
  2017-06-16  5:45 ` Kishon Vijay Abraham I
  3 siblings, 0 replies; 9+ messages in thread
From: Florian Fainelli @ 2017-06-08 16:34 UTC (permalink / raw)
  To: Srinath Mannam, Rob Herring, Mark Rutland, Kishon Vijay Abraham I
  Cc: Tejun Heo, Florian Fainelli, Ray Jui, devicetree, linux-kernel,
	bcm-kernel-feedback-list

On 06/08/2017 04:31 AM, Srinath Mannam wrote:
> This patchset extends the Broadcom SATA PHY driver to add
> support for Stingray SATA PHY.
> 
> All patches are based on linux-phy/next

When you rebase and you don't make major changes to the patch, please
carry the Reviewed, Acked, etc. tags that you got from the previous
submission.

Thank you

> 
> Changes since v1:
>  - Rebased patchset on linux-phy/next
> 
> Srinath Mannam (2):
>   dt-bindings: Update documentation for stingray SATA phy
>   phy: Add stingray SATA phy support
> 
>  .../devicetree/bindings/phy/brcm-sata-phy.txt      |  7 ++-
>  drivers/phy/broadcom/phy-brcm-sata.c               | 73 ++++++++++++++++++++++
>  2 files changed, 77 insertions(+), 3 deletions(-)
> 


-- 
Florian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: Update documentation for stingray SATA phy
  2017-06-08 11:31 ` [PATCH v2 1/2] dt-bindings: Update documentation for stingray SATA phy Srinath Mannam
  2017-06-08 16:33   ` Florian Fainelli
@ 2017-06-12 16:30   ` Rob Herring
  1 sibling, 0 replies; 9+ messages in thread
From: Rob Herring @ 2017-06-12 16:30 UTC (permalink / raw)
  To: Srinath Mannam
  Cc: Mark Rutland, Kishon Vijay Abraham I, Tejun Heo,
	Florian Fainelli, Ray Jui, devicetree, linux-kernel,
	bcm-kernel-feedback-list

On Thu, Jun 08, 2017 at 05:01:38PM +0530, Srinath Mannam wrote:
> Update BRCM SATA phy dt-binding documentation for stingray.
> 
> Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
> Reviewed-by: Ray Jui <ray.jui@broadcom.com>
> Reviewed-by: Scott Branden <scott.branden@broadcom.com>
> ---
>  Documentation/devicetree/bindings/phy/brcm-sata-phy.txt | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Acked-by: Rob Herring <rob@kernel.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] phy: Add stingray SATA phy support
  2017-06-08 11:31 ` [PATCH v2 2/2] phy: Add stingray SATA phy support Srinath Mannam
  2017-06-08 16:33   ` Florian Fainelli
@ 2017-06-15  8:15   ` Srinath Mannam
  1 sibling, 0 replies; 9+ messages in thread
From: Srinath Mannam @ 2017-06-15  8:15 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Tejun Heo, Florian Fainelli, Ray Jui, devicetree, linux-kernel,
	BCM Kernel Feedback, Srinath Mannam, Rob Herring, Mark Rutland

Hi Kishon,

I have re-based this patch to "linux-phy -next".
Please review this.

Thank you.

Regards,
Srinath.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 0/2] Broadcom Stingray SATA PHY support
  2017-06-08 11:31 [PATCH v2 0/2] Broadcom Stingray SATA PHY support Srinath Mannam
                   ` (2 preceding siblings ...)
  2017-06-08 16:34 ` [PATCH v2 0/2] Broadcom Stingray SATA PHY support Florian Fainelli
@ 2017-06-16  5:45 ` Kishon Vijay Abraham I
  3 siblings, 0 replies; 9+ messages in thread
From: Kishon Vijay Abraham I @ 2017-06-16  5:45 UTC (permalink / raw)
  To: Srinath Mannam, Rob Herring, Mark Rutland
  Cc: Tejun Heo, Florian Fainelli, Ray Jui, devicetree, linux-kernel,
	bcm-kernel-feedback-list



On Thursday 08 June 2017 05:01 PM, Srinath Mannam wrote:
> This patchset extends the Broadcom SATA PHY driver to add
> support for Stingray SATA PHY.
> 
> All patches are based on linux-phy/next
> 
> Changes since v1:
>  - Rebased patchset on linux-phy/next
> 

merged, thanks!

-Kishon
> Srinath Mannam (2):
>   dt-bindings: Update documentation for stingray SATA phy
>   phy: Add stingray SATA phy support
> 
>  .../devicetree/bindings/phy/brcm-sata-phy.txt      |  7 ++-
>  drivers/phy/broadcom/phy-brcm-sata.c               | 73 ++++++++++++++++++++++
>  2 files changed, 77 insertions(+), 3 deletions(-)
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-06-16  5:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-08 11:31 [PATCH v2 0/2] Broadcom Stingray SATA PHY support Srinath Mannam
2017-06-08 11:31 ` [PATCH v2 1/2] dt-bindings: Update documentation for stingray SATA phy Srinath Mannam
2017-06-08 16:33   ` Florian Fainelli
2017-06-12 16:30   ` Rob Herring
2017-06-08 11:31 ` [PATCH v2 2/2] phy: Add stingray SATA phy support Srinath Mannam
2017-06-08 16:33   ` Florian Fainelli
2017-06-15  8:15   ` Srinath Mannam
2017-06-08 16:34 ` [PATCH v2 0/2] Broadcom Stingray SATA PHY support Florian Fainelli
2017-06-16  5:45 ` 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).