2 * drivers/video/tegra/host/nvhost_cpuaccess.h
4 * Tegra Graphics Host Cpu Register Access
6 * Copyright (c) 2010, NVIDIA Corporation.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #ifndef __NVHOST_CPUACCESS_H
24 #define __NVHOST_CPUACCESS_H
26 #include "nvhost_hardware.h"
27 #include <linux/platform_device.h>
30 enum nvhost_module_id {
31 NVHOST_MODULE_DISPLAY_A = 0,
32 NVHOST_MODULE_DISPLAY_B,
37 /* TODO: [ahatala 2010-07-02] find out if these are needed */
39 NVHOST_MODULE_APB_MISC,
40 NVHOST_MODULE_CLK_RESET,
45 struct nvhost_cpuaccess {
46 struct resource *reg_mem[NVHOST_MODULE_NUM];
47 void __iomem *regs[NVHOST_MODULE_NUM];
50 int nvhost_cpuaccess_init(struct nvhost_cpuaccess *ctx,
51 struct platform_device *pdev);
53 void nvhost_cpuaccess_deinit(struct nvhost_cpuaccess *ctx);
55 int nvhost_mutex_try_lock(struct nvhost_cpuaccess *ctx, unsigned int idx);
57 void nvhost_mutex_unlock(struct nvhost_cpuaccess *ctx, unsigned int idx);
59 static inline bool nvhost_access_module_regs(
60 struct nvhost_cpuaccess *ctx, u32 module)
62 return (module < NVHOST_MODULE_NUM);
65 void nvhost_read_module_regs(struct nvhost_cpuaccess *ctx, u32 module,
66 u32 offset, size_t size, void *values);
68 void nvhost_write_module_regs(struct nvhost_cpuaccess *ctx, u32 module,
69 u32 offset, size_t size, const void *values);