All of lore.kernel.org
 help / color / mirror / Atom feed
From: igall at marvell.com <igall@marvell.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [v2, 02/13] phy: marvell: cp110: add support for end point configuration
Date: Mon, 24 Apr 2017 18:45:22 +0300	[thread overview]
Message-ID: <1493048733-22194-3-git-send-email-igall@marvell.com> (raw)
In-Reply-To: <1493048733-22194-1-git-send-email-igall@marvell.com>

From: Stefan Roese <sr@denx.de>

The serdes was always configured in root complex mode.
this patch add new entry in device tree (per serdes)
which indicates whether the serdes is in end point mode.
if so, it skips the root complex configuration.

Signed-off-by: Haim Boot <hayim@marvell.com>
Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Igal Liberman <igall@marvell.com>
---
 drivers/phy/marvell/comphy.h       |  1 +
 drivers/phy/marvell/comphy_core.c  |  2 ++
 drivers/phy/marvell/comphy_cp110.c | 16 ++++++++++------
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/phy/marvell/comphy.h b/drivers/phy/marvell/comphy.h
index 0a15692..8b05757 100644
--- a/drivers/phy/marvell/comphy.h
+++ b/drivers/phy/marvell/comphy.h
@@ -86,6 +86,7 @@ struct comphy_map {
 	u32 speed;
 	u32 invert;
 	bool clk_src;
+	bool end_point;
 };
 
 struct chip_serdes_phy_config {
diff --git a/drivers/phy/marvell/comphy_core.c b/drivers/phy/marvell/comphy_core.c
index ac084a6..db23bef 100644
--- a/drivers/phy/marvell/comphy_core.c
+++ b/drivers/phy/marvell/comphy_core.c
@@ -166,6 +166,8 @@ static int comphy_probe(struct udevice *dev)
 			blob, subnode, "phy-invert", PHY_POLARITY_NO_INVERT);
 		comphy_map_data[lane].clk_src = fdtdec_get_bool(blob, subnode,
 								"clk-src");
+		comphy_map_data[lane].end_point = fdtdec_get_bool(blob, subnode,
+								  "end_point");
 		if (comphy_map_data[lane].type == PHY_TYPE_INVALID) {
 			printf("no phy type for lane %d, setting lane as unconnected\n",
 			       lane + 1);
diff --git a/drivers/phy/marvell/comphy_cp110.c b/drivers/phy/marvell/comphy_cp110.c
index cd3cf96..70554fe 100644
--- a/drivers/phy/marvell/comphy_cp110.c
+++ b/drivers/phy/marvell/comphy_cp110.c
@@ -87,8 +87,8 @@ static u32 polling_with_timeout(void __iomem *addr, u32 val,
 	return 0;
 }
 
-static int comphy_pcie_power_up(u32 lane, u32 pcie_width,
-				bool clk_src, void __iomem *hpipe_base,
+static int comphy_pcie_power_up(u32 lane, u32 pcie_width, bool clk_src,
+				bool is_end_point, void __iomem *hpipe_base,
 				void __iomem *comphy_base)
 {
 	u32 mask, data, ret = 1;
@@ -109,6 +109,7 @@ static int comphy_pcie_power_up(u32 lane, u32 pcie_width,
 	 * and SerDes Lane 0 got PCIe ref-clock #0
 	 */
 	debug("PCIe clock = %x\n", pcie_clk);
+	debug("PCIe RC    = %d\n", !is_end_point);
 	debug("PCIe width = %d\n", pcie_width);
 
 	/* enable PCIe by4 and by2 */
@@ -384,10 +385,12 @@ static int comphy_pcie_power_up(u32 lane, u32 pcie_width,
 	data |= 0x1 << HPIPE_G3_FFE_LOAD_RES_LEVEL_OFFSET;
 	reg_set(hpipe_addr + HPIPE_G3_SETTING_3_REG, data, mask);
 
-	/* Set phy in root complex mode */
-	mask = HPIPE_CFG_PHY_RC_EP_MASK;
-	data = 0x1 << HPIPE_CFG_PHY_RC_EP_OFFSET;
-	reg_set(hpipe_addr + HPIPE_LANE_EQU_CONFIG_0_REG, data, mask);
+	if (!is_end_point) {
+		/* Set phy in root complex mode */
+		mask = HPIPE_CFG_PHY_RC_EP_MASK;
+		data = 0x1 << HPIPE_CFG_PHY_RC_EP_OFFSET;
+		reg_set(hpipe_addr + HPIPE_LANE_EQU_CONFIG_0_REG, data, mask);
+	}
 
 	debug("stage: Comphy power up\n");
 
@@ -1667,6 +1670,7 @@ int comphy_cp110_init(struct chip_serdes_phy_config *ptr_chip_cfg,
 		case PHY_TYPE_PEX3:
 			ret = comphy_pcie_power_up(
 				lane, pcie_width, ptr_comphy_map->clk_src,
+				serdes_map->end_point,
 				hpipe_base_addr, comphy_base_addr);
 			break;
 		case PHY_TYPE_SATA0:
-- 
2.7.4

  parent reply	other threads:[~2017-04-24 15:45 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24 15:45 [U-Boot] [v2, 00/13] phy: marvell: cp110: varius comphy updates igall at marvell.com
2017-04-24 15:45 ` [U-Boot] [v2, 01/13] phy: marvell: Replace PHY_TYPE_KR with PHY_TYPE_SFI igall at marvell.com
2017-05-08  9:49   ` Stefan Roese
2017-04-24 15:45 ` igall at marvell.com [this message]
2017-05-08  9:49   ` [U-Boot] [v2, 02/13] phy: marvell: cp110: add support for end point configuration Stefan Roese
2017-04-24 15:45 ` [U-Boot] [v2, 03/13] phy: marvell: cp110: update utmi phy connection type igall at marvell.com
2017-05-08  9:50   ` Stefan Roese
2017-04-24 15:45 ` [U-Boot] [v2, 04/13] phy: marvell: add IGNORE COMPHY type igall at marvell.com
2017-05-08  9:50   ` Stefan Roese
2017-04-24 15:45 ` [U-Boot] [v2, 05/13] fix: phy: marvell: cp110: fix the KR/SFI line 4 selector igall at marvell.com
2017-05-08  9:51   ` Stefan Roese
2017-04-24 15:45 ` [U-Boot] [v2, 06/13] fix: phy: marvell: cp110: sata: update analog parameters according to latest ETP igall at marvell.com
2017-05-08  9:51   ` Stefan Roese
2017-04-24 15:45 ` [U-Boot] [v2, 07/13] fix: phy: marvell: cp110: update comphy selector option igall at marvell.com
2017-05-08  9:51   ` Stefan Roese
2017-04-24 15:45 ` [U-Boot] [v2, 08/13] phy: marvell: cp110: add 5G XFI mode igall at marvell.com
2017-05-08  9:52   ` Stefan Roese
2017-04-24 15:45 ` [U-Boot] [v2, 09/13] fix: phy: marvell: cp110: fix comphy lane 4 selection options igall at marvell.com
2017-05-08  9:52   ` Stefan Roese
2017-04-24 15:45 ` [U-Boot] [v2, 10/13] phy: marvell: print comphy status even when it's disconnected igall at marvell.com
2017-05-08  9:52   ` Stefan Roese
2017-04-24 15:45 ` [U-Boot] [v2, 11/13] fix: phy: marvell: cp110: sfi: update analog parameters according to latest ETP igall at marvell.com
2017-05-08  9:53   ` Stefan Roese
2017-04-24 15:45 ` [U-Boot] [v2, 12/13] fix: phy: marvell: cp110: rename comphy_index to cp_index igall at marvell.com
2017-05-08  9:53   ` Stefan Roese
2017-04-24 15:45 ` [U-Boot] [v2, 13/13] fix: phy: marvell: cp110: pcie: update analog parameters according to latest ETP igall at marvell.com
2017-05-08  9:54   ` Stefan Roese
2017-05-09 14:37 ` [U-Boot] [v2, 00/13] phy: marvell: cp110: varius comphy updates Stefan Roese

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1493048733-22194-3-git-send-email-igall@marvell.com \
    --to=igall@marvell.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.