diff mbox series

[06/16] npu2-hw-procedures: Move some opencapi PHY settings in one-off init

Message ID 20190909123151.21944-7-fbarrat@linux.ibm.com
State Superseded
Headers show
Series opencapi: enable card reset and link retraining | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch master (470ffb5f29d741c3bed600f7bb7bf0cbb270e05a)
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot success Test snowpatch/job/snowpatch-skiboot on branch master
snowpatch_ozlabs/snowpatch_job_snowpatch-skiboot-dco success Signed-off-by present

Commit Message

Frederic Barrat Sept. 9, 2019, 12:31 p.m. UTC
The PHY_RX_AC_COUPLED and PHY_RX_SPEED_SELECT for opencapi are group
settings for the obus. They should be set in the one-off PHY init
function at boot and not on the link reset path, as they theoretically
impact more than one link.
Since we cannot mix link type and/or speed on an optical bus, it has
no pratical impact, it just looks cleaner.

Also use the OCAPIINF macro for the associated traces.

Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
---
 hw/npu2-hw-procedures.c | 35 ++++++++++++++++-------------------
 1 file changed, 16 insertions(+), 19 deletions(-)

Comments

Christophe Lombard Sept. 17, 2019, 9:13 a.m. UTC | #1
On 09/09/2019 14:31, Frederic Barrat wrote:
> The PHY_RX_AC_COUPLED and PHY_RX_SPEED_SELECT for opencapi are group
> settings for the obus. They should be set in the one-off PHY init
> function at boot and not on the link reset path, as they theoretically
> impact more than one link.
> Since we cannot mix link type and/or speed on an optical bus, it has
> no pratical impact, it just looks cleaner.
> 
> Also use the OCAPIINF macro for the associated traces.
> 
> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
> ---
>   hw/npu2-hw-procedures.c | 35 ++++++++++++++++-------------------
>   1 file changed, 16 insertions(+), 19 deletions(-)
>

Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Andrew Donnellan Sept. 24, 2019, 4:36 p.m. UTC | #2
On 9/9/19 2:31 pm, Frederic Barrat wrote:
> The PHY_RX_AC_COUPLED and PHY_RX_SPEED_SELECT for opencapi are group
> settings for the obus. They should be set in the one-off PHY init
> function at boot and not on the link reset path, as they theoretically
> impact more than one link.
> Since we cannot mix link type and/or speed on an optical bus, it has
> no pratical impact, it just looks cleaner.
> 
> Also use the OCAPIINF macro for the associated traces.
> 
> Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>

Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>

> ---
>   hw/npu2-hw-procedures.c | 35 ++++++++++++++++-------------------
>   1 file changed, 16 insertions(+), 19 deletions(-)
> 
> diff --git a/hw/npu2-hw-procedures.c b/hw/npu2-hw-procedures.c
> index c1ae8f11..6cd780cc 100644
> --- a/hw/npu2-hw-procedures.c
> +++ b/hw/npu2-hw-procedures.c
> @@ -418,25 +418,6 @@ static uint32_t phy_reset_complete(struct npu2_dev *ndev)
>   {
>   	int lane;
>   
> -	if (ndev->type == NPU2_DEV_TYPE_OPENCAPI) {
> -		phy_write(ndev, &NPU2_PHY_RX_AC_COUPLED, 1);
> -
> -		switch (ndev->link_speed) {
> -		case 20000000000UL:
> -			prlog(PR_INFO, "OCAPI: Link speed set at 20Gb/s\n");
> -			phy_write(ndev, &NPU2_PHY_RX_SPEED_SELECT, 1);
> -			break;
> -		case 25000000000UL:
> -		case 25781250000UL:
> -			prlog(PR_INFO, "OCAPI: Link speed set at 25.xGb/s\n");
> -			phy_write(ndev, &NPU2_PHY_RX_SPEED_SELECT, 0);
> -			break;
> -		default:
> -			prlog(PR_CRIT, "OCAPI: Invalid link speed!\n");
> -			assert(false);
> -		}
> -	}
> -
>   	FOR_EACH_LANE(ndev, lane) {
>   		phy_write_lane(ndev, &NPU2_PHY_RX_LANE_ANA_PDWN, lane, 0);
>   		phy_write_lane(ndev, &NPU2_PHY_RX_LANE_DIG_PDWN, lane, 0);
> @@ -1026,6 +1007,22 @@ void npu2_opencapi_phy_init(struct npu2_dev *dev)
>   	 * Witherspoon it needs to be done in skiboot after device detection.
>   	 */
>   	phy_write(dev, &NPU2_PHY_RX_RC_ENABLE_AUTO_RECAL, 0x1);
> +	phy_write(dev, &NPU2_PHY_RX_AC_COUPLED, 1);
> +
> +	switch (dev->link_speed) {
> +	case 20000000000UL:
> +		OCAPIINF(dev, "Link speed set at 20Gb/s\n");
> +		phy_write(dev, &NPU2_PHY_RX_SPEED_SELECT, 1);
> +		break;
> +	case 25000000000UL:
> +	case 25781250000UL:
> +		OCAPIINF(dev, "Link speed set at 25.xGb/s\n");
> +		phy_write(dev, &NPU2_PHY_RX_SPEED_SELECT, 0);
> +		break;
> +	default:
> +		OCAPIERR(dev, "Invalid link speed!\n");
> +		assert(false);
> +	}
>   }
>   
>   void npu2_opencapi_phy_reset(struct npu2_dev *dev)
>
diff mbox series

Patch

diff --git a/hw/npu2-hw-procedures.c b/hw/npu2-hw-procedures.c
index c1ae8f11..6cd780cc 100644
--- a/hw/npu2-hw-procedures.c
+++ b/hw/npu2-hw-procedures.c
@@ -418,25 +418,6 @@  static uint32_t phy_reset_complete(struct npu2_dev *ndev)
 {
 	int lane;
 
-	if (ndev->type == NPU2_DEV_TYPE_OPENCAPI) {
-		phy_write(ndev, &NPU2_PHY_RX_AC_COUPLED, 1);
-
-		switch (ndev->link_speed) {
-		case 20000000000UL:
-			prlog(PR_INFO, "OCAPI: Link speed set at 20Gb/s\n");
-			phy_write(ndev, &NPU2_PHY_RX_SPEED_SELECT, 1);
-			break;
-		case 25000000000UL:
-		case 25781250000UL:
-			prlog(PR_INFO, "OCAPI: Link speed set at 25.xGb/s\n");
-			phy_write(ndev, &NPU2_PHY_RX_SPEED_SELECT, 0);
-			break;
-		default:
-			prlog(PR_CRIT, "OCAPI: Invalid link speed!\n");
-			assert(false);
-		}
-	}
-
 	FOR_EACH_LANE(ndev, lane) {
 		phy_write_lane(ndev, &NPU2_PHY_RX_LANE_ANA_PDWN, lane, 0);
 		phy_write_lane(ndev, &NPU2_PHY_RX_LANE_DIG_PDWN, lane, 0);
@@ -1026,6 +1007,22 @@  void npu2_opencapi_phy_init(struct npu2_dev *dev)
 	 * Witherspoon it needs to be done in skiboot after device detection.
 	 */
 	phy_write(dev, &NPU2_PHY_RX_RC_ENABLE_AUTO_RECAL, 0x1);
+	phy_write(dev, &NPU2_PHY_RX_AC_COUPLED, 1);
+
+	switch (dev->link_speed) {
+	case 20000000000UL:
+		OCAPIINF(dev, "Link speed set at 20Gb/s\n");
+		phy_write(dev, &NPU2_PHY_RX_SPEED_SELECT, 1);
+		break;
+	case 25000000000UL:
+	case 25781250000UL:
+		OCAPIINF(dev, "Link speed set at 25.xGb/s\n");
+		phy_write(dev, &NPU2_PHY_RX_SPEED_SELECT, 0);
+		break;
+	default:
+		OCAPIERR(dev, "Invalid link speed!\n");
+		assert(false);
+	}
 }
 
 void npu2_opencapi_phy_reset(struct npu2_dev *dev)