From fa68aa53efc5048247e975820e3d1207f54ed550 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 17 May 2017 15:03:33 +0530 Subject: gpu: nvgpu: add common fuse APIs Add a new file common/linux/fuse.c for common fuse operations with below APIs nvgpu_tegra_fuse_read() nvgpu_tegra_fuse_write() nvgpu_tegra_get_gpu_speedo_id() Export the APIs in header Jira NVGPU-49 Jira NVGPU-75 Change-Id: I5b0b0772584a5d408b23e629df9c5f73ecc05f6b Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1483860 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/Makefile.nvgpu | 1 + drivers/gpu/nvgpu/common/linux/fuse.c | 31 +++++++++++++++++++++++++++++++ drivers/gpu/nvgpu/include/nvgpu/fuse.h | 21 +++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 drivers/gpu/nvgpu/common/linux/fuse.c create mode 100644 drivers/gpu/nvgpu/include/nvgpu/fuse.h diff --git a/drivers/gpu/nvgpu/Makefile.nvgpu b/drivers/gpu/nvgpu/Makefile.nvgpu index 6bbf49a5..8bb64af7 100644 --- a/drivers/gpu/nvgpu/Makefile.nvgpu +++ b/drivers/gpu/nvgpu/Makefile.nvgpu @@ -36,6 +36,7 @@ nvgpu-y := \ common/linux/nvgpu_mem.o \ common/linux/dma.o \ common/linux/soc.o \ + common/linux/fuse.o \ common/linux/driver_common.o \ common/linux/firmware.o \ common/linux/thread.o \ diff --git a/drivers/gpu/nvgpu/common/linux/fuse.c b/drivers/gpu/nvgpu/common/linux/fuse.c new file mode 100644 index 00000000..5c832a2a --- /dev/null +++ b/drivers/gpu/nvgpu/common/linux/fuse.c @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2017, 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 + +int nvgpu_tegra_fuse_read(unsigned long offset, u32 *value) +{ + return tegra_fuse_readl(offset, value); +} + +void nvgpu_tegra_fuse_write(u32 value, unsigned long offset) +{ + tegra_fuse_control_write(value, offset); +} + +int nvgpu_tegra_get_gpu_speedo_id(void) +{ + return tegra_sku_info.gpu_speedo_id; +} diff --git a/drivers/gpu/nvgpu/include/nvgpu/fuse.h b/drivers/gpu/nvgpu/include/nvgpu/fuse.h new file mode 100644 index 00000000..1e306b2d --- /dev/null +++ b/drivers/gpu/nvgpu/include/nvgpu/fuse.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2017, 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. + */ +#ifndef __NVGPU_FUSE_H__ +#define __NVGPU_FUSE_H__ + +int nvgpu_tegra_fuse_read(unsigned long offset, u32 *value); +void nvgpu_tegra_fuse_write(u32 value, unsigned long offset); + +int nvgpu_tegra_get_gpu_speedo_id(void); + +#endif -- cgit v1.2.2