Skip to contentSkip to conversation

phy: marvell: cp110: Support SATA invert polarity

PATCH In review Denis Odintsov 2 participants 3 messages Sep 15, 2021 – Sep 27, 2021 Generic PHY framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: marvell: cp110: Support SATA invert polarity

In commit b24bb99d cp110 configuration initially done in u-boot
was removed and delegated to atf firmware as smc call.
That commit didn't account for later introduced in d13b740c SATA invert polarity support.

This patch adds support of passing SATA invert polarity flags to atf firmware during the smc call.

Cc Baruch Siach <[email protected]>
Cc Rabeeh Khoury <[email protected]>
Cc Stefan Roese <[email protected]>
---
 drivers/phy/marvell/comphy_cp110.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/phy/marvell/comphy_cp110.c +6 -1
index 418318d12f..4fe2dfcdd1 100644
@@ -36,6 +36,10 @@ DECLARE_GLOBAL_DATA_PTR;
 			(COMPHY_CALLER_UBOOT | ((pcie_width) << 18) |	\
 			((clk_src) << 17) | COMPHY_FW_FORMAT(mode, 0, speeds))
 
+/* Invert polarity are bits 1-0 of the mode */
+#define COMPHY_FW_SATA_FORMAT(mode, invert)	\
+			((invert) | COMPHY_FW_MODE_FORMAT(mode))
+
 #define COMPHY_SATA_MODE	0x1
 #define COMPHY_SGMII_MODE	0x2	/* SGMII 1G */
 #define COMPHY_HS_SGMII_MODE	0x3	/* SGMII 2.5G */
@@ -607,7 +611,8 @@ int comphy_cp110_init(struct chip_serdes_phy_config *ptr_chip_cfg,
 			break;
 		case COMPHY_TYPE_SATA0:
 		case COMPHY_TYPE_SATA1:
-			mode =  COMPHY_FW_MODE_FORMAT(COMPHY_SATA_MODE);
+			mode = COMPHY_FW_SATA_FORMAT(COMPHY_SATA_MODE,
+						     serdes_map[lane].invert);
 			ret = comphy_sata_power_up(lane, hpipe_base_addr,
 						   comphy_base_addr,
 						   ptr_chip_cfg->cp_index,
Signature · 1 line
2.33.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Denis Odintsov

In commit b24bb99d cp110 configuration initially done in u-boot
was removed and delegated to atf firmware as smc call.
That commit didn't account for later introduced in d13b740c SATA invert polarity support.

This patch adds support of passing SATA invert polarity flags to atf firmware during the smc call.

Cc Baruch Siach <[email protected]>
Cc Rabeeh Khoury <[email protected]>
Cc Stefan Roese <[email protected]>

Thanks,
Stefan

Quoted 21 lines
---
  drivers/phy/marvell/comphy_cp110.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/phy/marvell/comphy_cp110.c +4 -0
index 418318d12f..4fe2dfcdd1 100644
@@ -36,6 +36,10 @@ DECLARE_GLOBAL_DATA_PTR;
  			(COMPHY_CALLER_UBOOT | ((pcie_width) << 18) |	\
  			((clk_src) << 17) | COMPHY_FW_FORMAT(mode, 0, speeds))
 
+/* Invert polarity are bits 1-0 of the mode */
+#define COMPHY_FW_SATA_FORMAT(mode, invert)	\
+			((invert) | COMPHY_FW_MODE_FORMAT(mode))
+
  #define COMPHY_SATA_MODE	0x1
  #define COMPHY_SGMII_MODE	0x2	/* SGMII 1G */
  #define COMPHY_HS_SGMII_MODE	0x3	/* SGMII 2.5G */

drivers/phy/marvell/comphy_cp110.c int comphy_cp110_init(struct chip_serdes_phy_config *ptr_chip_cfg, · line 618

Quoted 9 lines
drivers/phy/marvell/comphy_cp110.c +2 -1
@@ -607,7 +611,8 @@ int comphy_cp110_init(struct chip_serdes_phy_config *ptr_chip_cfg,
  			break;
  		case COMPHY_TYPE_SATA0:
  		case COMPHY_TYPE_SATA1:
-			mode =  COMPHY_FW_MODE_FORMAT(COMPHY_SATA_MODE);
+			mode = COMPHY_FW_SATA_FORMAT(COMPHY_SATA_MODE,
+						     serdes_map[lane].invert);
  			ret = comphy_sata_power_up(lane, hpipe_base_addr,
  						   comphy_base_addr,
  						   ptr_chip_cfg->cp_index,

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#2 lore raw
In reply to Denis Odintsov
Quoted 11 lines · Denis Odintsov

In commit b24bb99d cp110 configuration initially done in u-boot
was removed and delegated to atf firmware as smc call.
That commit didn't account for later introduced in d13b740c SATA invert polarity support.

This patch adds support of passing SATA invert polarity flags to atf firmware during the smc call.

Cc Baruch Siach <[email protected]>
Cc Rabeeh Khoury <[email protected]>
Cc Stefan Roese <[email protected]>

Applied to u-boot-marvell/master

Thanks,
Stefan

Quoted 21 lines
---
  drivers/phy/marvell/comphy_cp110.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
drivers/phy/marvell/comphy_cp110.c +4 -0
index 418318d12f..4fe2dfcdd1 100644
@@ -36,6 +36,10 @@ DECLARE_GLOBAL_DATA_PTR;
  			(COMPHY_CALLER_UBOOT | ((pcie_width) << 18) |	\
  			((clk_src) << 17) | COMPHY_FW_FORMAT(mode, 0, speeds))
 
+/* Invert polarity are bits 1-0 of the mode */
+#define COMPHY_FW_SATA_FORMAT(mode, invert)	\
+			((invert) | COMPHY_FW_MODE_FORMAT(mode))
+
  #define COMPHY_SATA_MODE	0x1
  #define COMPHY_SGMII_MODE	0x2	/* SGMII 1G */
  #define COMPHY_HS_SGMII_MODE	0x3	/* SGMII 2.5G */

drivers/phy/marvell/comphy_cp110.c int comphy_cp110_init(struct chip_serdes_phy_config *ptr_chip_cfg, · line 618

Quoted 9 lines
drivers/phy/marvell/comphy_cp110.c +2 -1
@@ -607,7 +611,8 @@ int comphy_cp110_init(struct chip_serdes_phy_config *ptr_chip_cfg,
  			break;
  		case COMPHY_TYPE_SATA0:
  		case COMPHY_TYPE_SATA1:
-			mode =  COMPHY_FW_MODE_FORMAT(COMPHY_SATA_MODE);
+			mode = COMPHY_FW_SATA_FORMAT(COMPHY_SATA_MODE,
+						     serdes_map[lane].invert);
  			ret = comphy_sata_power_up(lane, hpipe_base_addr,
  						   comphy_base_addr,
  						   ptr_chip_cfg->cp_index,

Viele Grüße,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]