diff options
author | Tejal Kudav <tkudav@nvidia.com> | 2018-05-25 07:41:14 -0400 |
---|---|---|
committer | Tejal Kudav <tkudav@nvidia.com> | 2018-06-14 09:44:06 -0400 |
commit | 1e889871bc0ec3af05280f27497c0e7bd7a023b5 (patch) | |
tree | a992e96bcfe9d88bef49076a644fbb13703e519b /drivers/gpu/nvgpu/gv100/nvlink_gv100.c | |
parent | 0b2f2f06a7d0424359d1b6e275789ceef1a8a8c3 (diff) |
gpu: nvgpu: nvlink: Add HAL for pll setup
Before nvlink 2.2, driver was responsible for setting the NVLink clocks
during NVLink initialization. For the purpose of security, NVLink PLL
handling is moved to Minion in nvlink 2.2 and driver should stop writing
to these registers.
JIRA NVLINK-167
Change-Id: I18392a29c322da55053037bfde62c8f74ee75288
Signed-off-by: Tejal Kudav <tkudav@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1730597
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv100/nvlink_gv100.c')
-rw-r--r-- | drivers/gpu/nvgpu/gv100/nvlink_gv100.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/gv100/nvlink_gv100.c b/drivers/gpu/nvgpu/gv100/nvlink_gv100.c index 098aae0e..7e25c946 100644 --- a/drivers/gpu/nvgpu/gv100/nvlink_gv100.c +++ b/drivers/gpu/nvgpu/gv100/nvlink_gv100.c | |||
@@ -219,7 +219,6 @@ static const char *__gv100_device_type_to_str(u32 type) | |||
219 | /* | 219 | /* |
220 | * Function prototypes | 220 | * Function prototypes |
221 | */ | 221 | */ |
222 | static int gv100_nvlink_setup_pll(struct gk20a *g, unsigned long mask); | ||
223 | static u32 __gv100_nvlink_get_link_reset_mask(struct gk20a *g); | 222 | static u32 __gv100_nvlink_get_link_reset_mask(struct gk20a *g); |
224 | static u32 gv100_nvlink_rxcal_en(struct gk20a *g, unsigned long mask); | 223 | static u32 gv100_nvlink_rxcal_en(struct gk20a *g, unsigned long mask); |
225 | static u32 gv100_nvlink_minion_data_ready_en(struct gk20a *g, | 224 | static u32 gv100_nvlink_minion_data_ready_en(struct gk20a *g, |
@@ -826,7 +825,7 @@ static u32 gv100_nvlink_minion_init_uphy(struct gk20a *g, unsigned long mask, | |||
826 | } | 825 | } |
827 | } | 826 | } |
828 | 827 | ||
829 | err = gv100_nvlink_setup_pll(g, mask); | 828 | err = g->ops.nvlink.setup_pll(g, mask); |
830 | if (err) { | 829 | if (err) { |
831 | nvgpu_err(g, "Error setting up PLL"); | 830 | nvgpu_err(g, "Error setting up PLL"); |
832 | return err; | 831 | return err; |
@@ -1462,7 +1461,7 @@ static u32 __gv100_nvlink_state_load_hal(struct gk20a *g) | |||
1462 | #define TRIM_SYS_NVLINK_CTRL(i) (trim_sys_nvlink0_ctrl_r() + 16*i) | 1461 | #define TRIM_SYS_NVLINK_CTRL(i) (trim_sys_nvlink0_ctrl_r() + 16*i) |
1463 | #define TRIM_SYS_NVLINK_STATUS(i) (trim_sys_nvlink0_status_r() + 16*i) | 1462 | #define TRIM_SYS_NVLINK_STATUS(i) (trim_sys_nvlink0_status_r() + 16*i) |
1464 | 1463 | ||
1465 | static int gv100_nvlink_setup_pll(struct gk20a *g, unsigned long mask) | 1464 | int gv100_nvlink_setup_pll(struct gk20a *g, unsigned long link_mask) |
1466 | { | 1465 | { |
1467 | u32 reg; | 1466 | u32 reg; |
1468 | u32 i; | 1467 | u32 i; |
@@ -1481,7 +1480,7 @@ static int gv100_nvlink_setup_pll(struct gk20a *g, unsigned long mask) | |||
1481 | pad_ctrl = top_nvhsclk_ctrl_e_clk_nvl_v(reg); | 1480 | pad_ctrl = top_nvhsclk_ctrl_e_clk_nvl_v(reg); |
1482 | swap_ctrl = top_nvhsclk_ctrl_swap_clk_nvl_v(reg); | 1481 | swap_ctrl = top_nvhsclk_ctrl_swap_clk_nvl_v(reg); |
1483 | 1482 | ||
1484 | for_each_set_bit(i, &mask, 32) { | 1483 | for_each_set_bit(i, &link_mask, 32) { |
1485 | /* There are 3 PLLs for 6 links. We have 3 bits for each PLL. | 1484 | /* There are 3 PLLs for 6 links. We have 3 bits for each PLL. |
1486 | * The PLL bit corresponding to a link is /2 of its master link. | 1485 | * The PLL bit corresponding to a link is /2 of its master link. |
1487 | */ | 1486 | */ |
@@ -1501,7 +1500,7 @@ static int gv100_nvlink_setup_pll(struct gk20a *g, unsigned long mask) | |||
1501 | 1500 | ||
1502 | gk20a_writel(g, top_nvhsclk_ctrl_r(), reg); | 1501 | gk20a_writel(g, top_nvhsclk_ctrl_r(), reg); |
1503 | 1502 | ||
1504 | for_each_set_bit(i, &mask, 32) { | 1503 | for_each_set_bit(i, &link_mask, 32) { |
1505 | reg = gk20a_readl(g, TRIM_SYS_NVLINK_CTRL(i)); | 1504 | reg = gk20a_readl(g, TRIM_SYS_NVLINK_CTRL(i)); |
1506 | reg = set_field(reg, | 1505 | reg = set_field(reg, |
1507 | trim_sys_nvlink0_ctrl_unit2clks_pll_turn_off_m(), | 1506 | trim_sys_nvlink0_ctrl_unit2clks_pll_turn_off_m(), |
@@ -1510,12 +1509,12 @@ static int gv100_nvlink_setup_pll(struct gk20a *g, unsigned long mask) | |||
1510 | } | 1509 | } |
1511 | 1510 | ||
1512 | /* Poll for links to go up */ | 1511 | /* Poll for links to go up */ |
1513 | links_off = mask; | 1512 | links_off = link_mask; |
1514 | 1513 | ||
1515 | nvgpu_timeout_init(g, &timeout, | 1514 | nvgpu_timeout_init(g, &timeout, |
1516 | NVLINK_PLL_ON_TIMEOUT_MS, NVGPU_TIMER_CPU_TIMER); | 1515 | NVLINK_PLL_ON_TIMEOUT_MS, NVGPU_TIMER_CPU_TIMER); |
1517 | do { | 1516 | do { |
1518 | for_each_set_bit(i, &mask, 32) { | 1517 | for_each_set_bit(i, &link_mask, 32) { |
1519 | reg = gk20a_readl(g, TRIM_SYS_NVLINK_STATUS(i)); | 1518 | reg = gk20a_readl(g, TRIM_SYS_NVLINK_STATUS(i)); |
1520 | if (trim_sys_nvlink0_status_pll_off_v(reg) == 0) | 1519 | if (trim_sys_nvlink0_status_pll_off_v(reg) == 0) |
1521 | links_off &= ~BIT(i); | 1520 | links_off &= ~BIT(i); |