Skip to content

Commit

Permalink
npu2-hw-procedures: Move some opencapi PHY settings in one-off init
Browse files Browse the repository at this point in the history
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.

Reviewed-by: Christophe Lombard <clombard@linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Frederic Barrat <fbarrat@linux.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
  • Loading branch information
fbarrat authored and oohal committed Oct 22, 2019
1 parent 94bc2d7 commit 13e1a7e
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions hw/npu2-hw-procedures.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 13e1a7e

Please sign in to comment.