From ac98827c9d81746020dce689f9eb8c4018a8c148 Mon Sep 17 00:00:00 2001 From: Vinod G Date: Tue, 26 Jun 2018 18:09:57 -0700 Subject: gpu: nvgpu: Add L2 register read-backs following writes LTC register write is followed by a register read and if data doesn't match code will report the error. Renamed existing nvgpu_writel_check function as nvgpu_writel_loop as it loops until the write get success. nvgpu_writel_check function write and read back and compare the data. Bug 2039150 Change-Id: I0a49be36aad23936f2d58aa82872710827da1d32 Signed-off-by: Vinod G Reviewed-on: https://git-master.nvidia.com/r/1762344 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/io_common.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 drivers/gpu/nvgpu/common/io_common.c (limited to 'drivers/gpu/nvgpu/common/io_common.c') diff --git a/drivers/gpu/nvgpu/common/io_common.c b/drivers/gpu/nvgpu/common/io_common.c new file mode 100644 index 00000000..e7041eb7 --- /dev/null +++ b/drivers/gpu/nvgpu/common/io_common.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + */ + +#include +#include + +#include "gk20a/gk20a.h" + +void nvgpu_writel_check(struct gk20a *g, u32 r, u32 v) +{ + u32 read_val = 0U; + + nvgpu_writel(g, r, v); + read_val = nvgpu_readl(g, r); + if (v != read_val) { + nvgpu_log(g, gpu_dbg_reg, "r=0x%x rd=0x%x wr=0x%x (mismatch)", + r, read_val, v); + } +} -- cgit v1.2.2