Skip to content

Commit

Permalink
npu2: hw-procedures: Add phy_rx_clock_sel()
Browse files Browse the repository at this point in the history
Change the RX clk mux control to be done by software instead of HW. This
avoids glitches caused by changing the mux setting.

Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
Reviewed-By: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
rarbab authored and stewartsmith committed Nov 13, 2017
1 parent d6f2505 commit ac6f159
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion hw/npu2-hw-procedures.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,23 @@ static uint32_t phy_rx_dccal_complete(struct npu2_dev *ndev)
return PROCEDURE_NEXT;
}

static uint32_t phy_rx_clock_sel(struct npu2_dev *ndev)
{
/*
* Change the RX clk mux control to be done by software instead of HW. This
* avoids glitches caused by changing the mux setting.
*
* Work around a known DL bug by doing these writes twice.
*/
npu2_write_mask_4b(ndev->npu, NPU2_NTL_DL_CLK_CTRL(ndev), 0x80000003, 0x80000003);
npu2_write_mask_4b(ndev->npu, NPU2_NTL_DL_CLK_CTRL(ndev), 0x80000003, 0x80000003);

npu2_write_mask_4b(ndev->npu, NPU2_NTL_DL_CLK_CTRL(ndev), 0x80000001, 0x80000003);
npu2_write_mask_4b(ndev->npu, NPU2_NTL_DL_CLK_CTRL(ndev), 0x80000001, 0x80000003);

return PROCEDURE_NEXT;
}

/* Procedure 1.2.5 - IO PHY Tx FIFO Init */
static uint32_t phy_tx_fifo_init(struct npu2_dev *ndev)
{
Expand All @@ -594,7 +611,8 @@ static uint32_t phy_tx_fifo_init(struct npu2_dev *ndev)

/* We group TX FIFO init in here mainly because that's what was done
* on NVLink1 */
DEFINE_PROCEDURE(phy_rx_dccal, phy_rx_dccal_complete, phy_tx_fifo_init);
DEFINE_PROCEDURE(phy_rx_dccal, phy_rx_dccal_complete, phy_rx_clock_sel,
phy_tx_fifo_init);

/* Procedure 1.2.7 - I/O PHY Upstream Link Training */
static uint32_t phy_rx_training(struct npu2_dev *ndev)
Expand Down
1 change: 1 addition & 0 deletions include/npu2-regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ void npu2_write_mask(struct npu2 *p, uint64_t reg, uint64_t val, uint64_t mask);
#define NPU2_NTL_CQ_FENCE_STATUS(ndev) NPU2_NTLU_REG_OFFSET(ndev, 0x500)
#define NPU2_NTL_DL_CONTROL(ndev) NPU2_DL_REG_OFFSET(ndev, 0xFFF4)
#define NPU2_NTL_DL_CONFIG(ndev) NPU2_DL_REG_OFFSET(ndev, 0xFFF8)
#define NPU2_NTL_DL_CLK_CTRL(ndev) NPU2_DL_REG_OFFSET(ndev, 0x001C)

/* Misc block registers. Unlike the SM/CTL/DAT/NTL registers above
* there is only a single instance of each of these in the NPU so we
Expand Down

0 comments on commit ac6f159

Please sign in to comment.