Support for Tegra 2D hardware
Subsystems (7)
cover Support for Tegra 2D hardware
This set of patches adds support for Tegra20 and Tegra30 host1x and 2D. It is based on Thierry Reding's tegra/next branch.
nvhost is the driver that controls host1x hardware. It supports host1x command channels, synchronization, run-time power management and memory management.
The patch set removes responsibility of host1x from tegradrm. At the same time, it moves all drm related infrastructure in host1x.c to other files.
The patch set also adds user space API to tegradrm for accessing features provided by nvhost to tegradrm. We have prepared also patches to libdrm, but they are not yet ready for sending out.
Please note that IOMMU support has effectively been disabled in this patch. The problem with IOMMU is that we should put all host1x devices under the same address space, but we haven't found a nice way of doing that in case of multiple drivers.
Arto Merilainen (3):
gpu: drm: tegra: Remove redundant host1x
gpu: drm: tegra: Free platform data on remove
gpu: drm: tegra: Prime support
Terje Bergstrom (3):
video: tegra: Add nvhost driver
ARM: tegra: Add auxiliary data for nvhost
drm: tegra: Add gr2d device
arch/arm/mach-tegra/board-dt-tegra20.c | 38 +- arch/arm/mach-tegra/board-dt-tegra30.c | 38 +- arch/arm/mach-tegra/tegra20_clocks_data.c | 8 +- arch/arm/mach-tegra/tegra30_clocks_data.c | 2 + drivers/gpu/drm/tegra/Kconfig | 8 +- drivers/gpu/drm/tegra/Makefile | 4 +- drivers/gpu/drm/tegra/dc.c | 25 +- drivers/gpu/drm/tegra/dmabuf.c | 150 ++++++ drivers/gpu/drm/tegra/drm.c | 444 ++++++++++++++-- drivers/gpu/drm/tegra/drm.h | 89 ++-- drivers/gpu/drm/tegra/dsi.c | 27 +- drivers/gpu/drm/tegra/fb.c | 26 +- drivers/gpu/drm/tegra/gr2d.c | 225 +++++++++ drivers/gpu/drm/tegra/hdmi.c | 27 +- drivers/gpu/drm/tegra/host1x.c | 343 ------------- drivers/gpu/drm/tegra/tvo.c | 36 +- drivers/video/Kconfig | 2 + drivers/video/Makefile | 2 + drivers/video/tegra/host/Kconfig | 20 + drivers/video/tegra/host/Makefile | 21 + drivers/video/tegra/host/bus_client.c | 101 ++++ drivers/video/tegra/host/bus_client.h | 32 ++ drivers/video/tegra/host/chip_support.c | 68 +++ drivers/video/tegra/host/chip_support.h | 179 +++++++ drivers/video/tegra/host/debug.c | 255 ++++++++++ drivers/video/tegra/host/debug.h | 50 ++ drivers/video/tegra/host/dev.c | 104 ++++ drivers/video/tegra/host/dev.h | 33 ++ drivers/video/tegra/host/dmabuf.c | 151 ++++++ drivers/video/tegra/host/dmabuf.h | 51 ++ drivers/video/tegra/host/host1x/Makefile | 6 + drivers/video/tegra/host/host1x/host1x.c | 320 ++++++++++++ drivers/video/tegra/host/host1x/host1x.h | 97 ++++ .../video/tegra/host/host1x/host1x01_hardware.h | 157 ++++++ drivers/video/tegra/host/host1x/host1x_cdma.c | 488 ++++++++++++++++++ drivers/video/tegra/host/host1x/host1x_cdma.h | 39 ++ drivers/video/tegra/host/host1x/host1x_channel.c | 157 ++++++ drivers/video/tegra/host/host1x/host1x_debug.c | 405 +++++++++++++++ drivers/video/tegra/host/host1x/host1x_intr.c | 263 ++++++++++ drivers/video/tegra/host/host1x/host1x_syncpt.c | 170 +++++++ .../video/tegra/host/host1x/hw_host1x01_channel.h | 182 +++++++ drivers/video/tegra/host/host1x/hw_host1x01_sync.h | 398 +++++++++++++++ .../video/tegra/host/host1x/hw_host1x01_uclass.h | 474 +++++++++++++++++ drivers/video/tegra/host/nvhost_acm.c | 532 ++++++++++++++++++++ drivers/video/tegra/host/nvhost_acm.h | 49 ++ drivers/video/tegra/host/nvhost_cdma.c | 473 +++++++++++++++++ drivers/video/tegra/host/nvhost_cdma.h | 116 +++++ drivers/video/tegra/host/nvhost_channel.c | 129 +++++ drivers/video/tegra/host/nvhost_channel.h | 65 +++ drivers/video/tegra/host/nvhost_intr.c | 391 ++++++++++++++ drivers/video/tegra/host/nvhost_intr.h | 110 ++++ drivers/video/tegra/host/nvhost_job.c | 398 +++++++++++++++ drivers/video/tegra/host/nvhost_memmgr.c | 252 ++++++++++ drivers/video/tegra/host/nvhost_memmgr.h | 66 +++ drivers/video/tegra/host/nvhost_syncpt.c | 453 +++++++++++++++++ drivers/video/tegra/host/nvhost_syncpt.h | 148 ++++++ drivers/video/tegra/host/t20/Makefile | 6 + drivers/video/tegra/host/t20/t20.c | 78 +++ drivers/video/tegra/host/t20/t20.h | 29 ++ drivers/video/tegra/host/t30/Makefile | 6 + drivers/video/tegra/host/t30/t30.c | 80 +++ drivers/video/tegra/host/t30/t30.h | 29 ++ include/drm/tegra_drm.h | 129 +++++ include/linux/nvhost.h | 302 +++++++++++ include/trace/events/nvhost.h | 249 +++++++++ 65 files changed, 9295 insertions(+), 510 deletions(-) create mode 100644 drivers/gpu/drm/tegra/dmabuf.c create mode 100644 drivers/gpu/drm/tegra/gr2d.c delete mode 100644 drivers/gpu/drm/tegra/host1x.c create mode 100644 drivers/video/tegra/host/Kconfig create mode 100644 drivers/video/tegra/host/Makefile create mode 100644 drivers/video/tegra/host/bus_client.c create mode 100644 drivers/video/tegra/host/bus_client.h create mode 100644 drivers/video/tegra/host/chip_support.c create mode 100644 drivers/video/tegra/host/chip_support.h create mode 100644 drivers/video/tegra/host/debug.c create mode 100644 drivers/video/tegra/host/debug.h create mode 100644 drivers/video/tegra/host/dev.c create mode 100644 drivers/video/tegra/host/dev.h create mode 100644 drivers/video/tegra/host/dmabuf.c create mode 100644 drivers/video/tegra/host/dmabuf.h create mode 100644 drivers/video/tegra/host/host1x/Makefile create mode 100644 drivers/video/tegra/host/host1x/host1x.c create mode 100644 drivers/video/tegra/host/host1x/host1x.h create mode 100644 drivers/video/tegra/host/host1x/host1x01_hardware.h create mode 100644 drivers/video/tegra/host/host1x/host1x_cdma.c create mode 100644 drivers/video/tegra/host/host1x/host1x_cdma.h create mode 100644 drivers/video/tegra/host/host1x/host1x_channel.c create mode 100644 drivers/video/tegra/host/host1x/host1x_debug.c create mode 100644 drivers/video/tegra/host/host1x/host1x_intr.c create mode 100644 drivers/video/tegra/host/host1x/host1x_syncpt.c create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_channel.h create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_sync.h create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_uclass.h create mode 100644 drivers/video/tegra/host/nvhost_acm.c create mode 100644 drivers/video/tegra/host/nvhost_acm.h create mode 100644 drivers/video/tegra/host/nvhost_cdma.c create mode 100644 drivers/video/tegra/host/nvhost_cdma.h create mode 100644 drivers/video/tegra/host/nvhost_channel.c create mode 100644 drivers/video/tegra/host/nvhost_channel.h create mode 100644 drivers/video/tegra/host/nvhost_intr.c create mode 100644 drivers/video/tegra/host/nvhost_intr.h create mode 100644 drivers/video/tegra/host/nvhost_job.c create mode 100644 drivers/video/tegra/host/nvhost_memmgr.c create mode 100644 drivers/video/tegra/host/nvhost_memmgr.h create mode 100644 drivers/video/tegra/host/nvhost_syncpt.c create mode 100644 drivers/video/tegra/host/nvhost_syncpt.h create mode 100644 drivers/video/tegra/host/t20/Makefile create mode 100644 drivers/video/tegra/host/t20/t20.c create mode 100644 drivers/video/tegra/host/t20/t20.h create mode 100644 drivers/video/tegra/host/t30/Makefile create mode 100644 drivers/video/tegra/host/t30/t30.c create mode 100644 drivers/video/tegra/host/t30/t30.h create mode 100644 include/drm/tegra_drm.h create mode 100644 include/linux/nvhost.h create mode 100644 include/trace/events/nvhost.h
Signature · 1 line
1.7.9.5
PATCH 1/6 video: tegra: Add nvhost driver
In reply to a message not in the archiveAdd nvhost, the driver for host1x and 2D, which is a client device for host1x.
--- drivers/video/Kconfig | 2 + drivers/video/Makefile | 2 + drivers/video/tegra/host/Kconfig | 20 + drivers/video/tegra/host/Makefile | 21 + drivers/video/tegra/host/bus_client.c | 101 ++++ drivers/video/tegra/host/bus_client.h | 32 ++ drivers/video/tegra/host/chip_support.c | 68 +++ drivers/video/tegra/host/chip_support.h | 179 +++++++ drivers/video/tegra/host/debug.c | 255 ++++++++++ drivers/video/tegra/host/debug.h | 50 ++ drivers/video/tegra/host/dev.c | 104 ++++ drivers/video/tegra/host/dev.h | 33 ++ drivers/video/tegra/host/dmabuf.c | 151 ++++++ drivers/video/tegra/host/dmabuf.h | 51 ++ drivers/video/tegra/host/host1x/Makefile | 6 + drivers/video/tegra/host/host1x/host1x.c | 320 ++++++++++++ drivers/video/tegra/host/host1x/host1x.h | 97 ++++ .../video/tegra/host/host1x/host1x01_hardware.h | 157 ++++++ drivers/video/tegra/host/host1x/host1x_cdma.c | 488 ++++++++++++++++++ drivers/video/tegra/host/host1x/host1x_cdma.h | 39 ++ drivers/video/tegra/host/host1x/host1x_channel.c | 157 ++++++ drivers/video/tegra/host/host1x/host1x_debug.c | 405 +++++++++++++++ drivers/video/tegra/host/host1x/host1x_intr.c | 263 ++++++++++ drivers/video/tegra/host/host1x/host1x_syncpt.c | 170 +++++++ .../video/tegra/host/host1x/hw_host1x01_channel.h | 182 +++++++ drivers/video/tegra/host/host1x/hw_host1x01_sync.h | 398 +++++++++++++++ .../video/tegra/host/host1x/hw_host1x01_uclass.h | 474 +++++++++++++++++ drivers/video/tegra/host/nvhost_acm.c | 532 ++++++++++++++++++++ drivers/video/tegra/host/nvhost_acm.h | 49 ++ drivers/video/tegra/host/nvhost_cdma.c | 473 +++++++++++++++++ drivers/video/tegra/host/nvhost_cdma.h | 116 +++++ drivers/video/tegra/host/nvhost_channel.c | 129 +++++ drivers/video/tegra/host/nvhost_channel.h | 65 +++ drivers/video/tegra/host/nvhost_intr.c | 391 ++++++++++++++ drivers/video/tegra/host/nvhost_intr.h | 110 ++++ drivers/video/tegra/host/nvhost_job.c | 398 +++++++++++++++ drivers/video/tegra/host/nvhost_memmgr.c | 252 ++++++++++ drivers/video/tegra/host/nvhost_memmgr.h | 66 +++ drivers/video/tegra/host/nvhost_syncpt.c | 453 +++++++++++++++++ drivers/video/tegra/host/nvhost_syncpt.h | 148 ++++++ drivers/video/tegra/host/t20/Makefile | 6 + drivers/video/tegra/host/t20/t20.c | 78 +++ drivers/video/tegra/host/t20/t20.h | 29 ++ drivers/video/tegra/host/t30/Makefile | 6 + drivers/video/tegra/host/t30/t30.c | 80 +++ drivers/video/tegra/host/t30/t30.h | 29 ++ include/linux/nvhost.h | 302 +++++++++++ include/trace/events/nvhost.h | 249 +++++++++ 48 files changed, 8186 insertions(+) create mode 100644 drivers/video/tegra/host/Kconfig create mode 100644 drivers/video/tegra/host/Makefile create mode 100644 drivers/video/tegra/host/bus_client.c create mode 100644 drivers/video/tegra/host/bus_client.h create mode 100644 drivers/video/tegra/host/chip_support.c create mode 100644 drivers/video/tegra/host/chip_support.h create mode 100644 drivers/video/tegra/host/debug.c create mode 100644 drivers/video/tegra/host/debug.h create mode 100644 drivers/video/tegra/host/dev.c create mode 100644 drivers/video/tegra/host/dev.h create mode 100644 drivers/video/tegra/host/dmabuf.c create mode 100644 drivers/video/tegra/host/dmabuf.h create mode 100644 drivers/video/tegra/host/host1x/Makefile create mode 100644 drivers/video/tegra/host/host1x/host1x.c create mode 100644 drivers/video/tegra/host/host1x/host1x.h create mode 100644 drivers/video/tegra/host/host1x/host1x01_hardware.h create mode 100644 drivers/video/tegra/host/host1x/host1x_cdma.c create mode 100644 drivers/video/tegra/host/host1x/host1x_cdma.h create mode 100644 drivers/video/tegra/host/host1x/host1x_channel.c create mode 100644 drivers/video/tegra/host/host1x/host1x_debug.c create mode 100644 drivers/video/tegra/host/host1x/host1x_intr.c create mode 100644 drivers/video/tegra/host/host1x/host1x_syncpt.c create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_channel.h create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_sync.h create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_uclass.h create mode 100644 drivers/video/tegra/host/nvhost_acm.c create mode 100644 drivers/video/tegra/host/nvhost_acm.h create mode 100644 drivers/video/tegra/host/nvhost_cdma.c create mode 100644 drivers/video/tegra/host/nvhost_cdma.h create mode 100644 drivers/video/tegra/host/nvhost_channel.c create mode 100644 drivers/video/tegra/host/nvhost_channel.h create mode 100644 drivers/video/tegra/host/nvhost_intr.c create mode 100644 drivers/video/tegra/host/nvhost_intr.h create mode 100644 drivers/video/tegra/host/nvhost_job.c create mode 100644 drivers/video/tegra/host/nvhost_memmgr.c create mode 100644 drivers/video/tegra/host/nvhost_memmgr.h create mode 100644 drivers/video/tegra/host/nvhost_syncpt.c create mode 100644 drivers/video/tegra/host/nvhost_syncpt.h create mode 100644 drivers/video/tegra/host/t20/Makefile create mode 100644 drivers/video/tegra/host/t20/t20.c create mode 100644 drivers/video/tegra/host/t20/t20.h create mode 100644 drivers/video/tegra/host/t30/Makefile create mode 100644 drivers/video/tegra/host/t30/t30.c create mode 100644 drivers/video/tegra/host/t30/t30.h create mode 100644 include/linux/nvhost.h create mode 100644 include/trace/events/nvhost.h
drivers/video/Kconfig +2 -0
@@ -2463,4 +2463,6 @@ config FB_SH_MOBILE_MERAM Up to 4 memory channels can be configured, allowing 4 RGB or 2 YCbCr framebuffers to be configured. +source "drivers/video/tegra/host/Kconfig" + endmenu
drivers/video/Makefile +2 -0
@@ -17,6 +17,8 @@ obj-y += backlight/ obj-$(CONFIG_EXYNOS_VIDEO) += exynos/ +obj-$(CONFIG_TEGRA_GRHOST) += tegra/host/ + obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o
drivers/video/tegra/host/Kconfig new file +20 -0
@@ -0,0 +1,20 @@ +config TEGRA_GRHOST + tristate "Tegra graphics host driver" + help + Driver for the Tegra graphics host hardware. + +config TEGRA_GRHOST_USE_DMABUF + depends on TEGRA_GRHOST + bool "Support dmabuf buffers" + default y + select DMA_SHARED_BUFFER + help + Support dmabuf buffers. + +config TEGRA_GRHOST_DEFAULT_TIMEOUT + depends on TEGRA_GRHOST + int "Default timeout for submits" + default 10000 + help + Default timeout for jobs in milliseconds. Set to zero for no timeout. +
drivers/video/tegra/host/Makefile new file +21 -0
@@ -0,0 +1,21 @@ +ccflags-y = -Idrivers/video/tegra/host -Iarch/arm/mach-tegra + +nvhost-objs = \ + nvhost_acm.o \ + nvhost_syncpt.o \ + nvhost_cdma.o \ + nvhost_intr.o \ + nvhost_channel.o \ + nvhost_job.o \ + dev.o \ + debug.o \ + bus_client.o \ + chip_support.o \ + nvhost_memmgr.o + +obj-$(CONFIG_TEGRA_GRHOST) += host1x/ +obj-$(CONFIG_TEGRA_GRHOST) += t20/ +obj-$(CONFIG_TEGRA_GRHOST) += t30/ +obj-$(CONFIG_TEGRA_GRHOST) += nvhost.o + +obj-$(CONFIG_TEGRA_GRHOST_USE_DMABUF) += dmabuf.o
drivers/video/tegra/host/bus_client.c new file +101 -0
101 lines not on this page · raw message
drivers/video/tegra/host/bus_client.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* drivers/video/tegra/host/bus_client.h +* +* Tegra Graphics Host client +* +* Copyright (c) 2010-2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __NVHOST_BUS_CLIENT_H +#define __NVHOST_BUS_CLIENT_H + +#include <linux/types.h> + +struct platform_device ; + +int nvhost_client_device_init (struct platform_device *dev); + +int nvhost_client_device_suspend (struct platform_device *dev); + +#endif
drivers/video/tegra/host/chip_support.c new file +68 -0
68 lines not on this page · raw message
drivers/video/tegra/host/chip_support.h new file +179 -0
179 lines not on this page · raw message
drivers/video/tegra/host/debug.c new file +255 -0
255 lines not on this page · raw message
drivers/video/tegra/host/debug.h new file +50 -0
50 lines not on this page · raw message
drivers/video/tegra/host/dev.c new file +104 -0
104 lines not on this page · raw message
drivers/video/tegra/host/dev.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* drivers/video/tegra/host/dev.h +* +* Copyright (c) 2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef NVHOST_DEV_H +#define NVHOST_DEV_H + +#include "host1x/host1x.h" + +struct platform_device ; + +void nvhost_device_list_init (void ); +int nvhost_device_list_add (struct platform_device *pdev); +void nvhost_device_list_for_all (void *data, +int (*fptr)(struct platform_device *pdev,void *fdata)); +struct platform_device *nvhost_device_list_match_by_id (u32 id); +void nvhost_device_list_remove (struct platform_device *pdev); + +#endif
drivers/video/tegra/host/dmabuf.c new file +151 -0
151 lines not on this page · raw message
drivers/video/tegra/host/dmabuf.h new file +51 -0
51 lines not on this page · raw message
drivers/video/tegra/host/host1x/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +ccflags-y = -Idrivers/video/tegra/host + +nvhost-host1x-objs = \ + host1x.o + +obj-$(CONFIG_TEGRA_GRHOST) += nvhost-host1x.o
drivers/video/tegra/host/host1x/host1x.c new file +320 -0
320 lines not on this page · raw message
drivers/video/tegra/host/host1x/host1x.h new file +97 -0
97 lines not on this page · raw message
drivers/video/tegra/host/host1x/host1x01_hardware.h new file +157 -0
157 lines not on this page · raw message
drivers/video/tegra/host/host1x/host1x_cdma.c new file +488 -0
488 lines not on this page · raw message
drivers/video/tegra/host/host1x/host1x_cdma.h new file +39 -0
@@ -0,0 +1,39 @@ +/* +* drivers/video/tegra/host/host1x/host1x_cdma.h +* +* Tegra Graphics Host Command DMA +* +* Copyright (c) 2011-2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __NVHOST_HOST1X_HOST1X_CDMA_H +#define __NVHOST_HOST1X_HOST1X_CDMA_H + +/* Size of the sync queue. If it is too small, we won't be able to queue up +* many command buffers. If it is too large, we waste memory. */ +#define NVHOST_SYNC_QUEUE_SIZE 512 + +/* Number of gathers we allow to be queued up per channel. Must be a +* power of two. Currently sized such that pushbuffer is 4KB (512*8B). */ +#define NVHOST_GATHER_QUEUE_SIZE 512 + +/* 8 bytes per slot. (This number does not include the final RESTART.) */ +#define PUSH_BUFFER_SIZE (NVHOST_GATHER_QUEUE_SIZE * 8) + +/* 4K page containing GATHERed methods to increment channel syncpts +* and replaces the original timed out contexts GATHER slots */ +#define SYNCPT_INCR_BUFFER_SIZE_WORDS (4096 / sizeof(u32)) + +#endif
drivers/video/tegra/host/host1x/host1x_channel.c new file +157 -0
157 lines not on this page · raw message
drivers/video/tegra/host/host1x/host1x_debug.c new file +405 -0
405 lines not on this page · raw message
drivers/video/tegra/host/host1x/host1x_intr.c new file +263 -0
252 lines not on this page · raw message
drivers/video/tegra/host/host1x/host1x_syncpt.c new file +170 -0
170 lines not on this page · raw message
drivers/video/tegra/host/host1x/hw_host1x01_channel.h new file +182 -0
182 lines not on this page · raw message
drivers/video/tegra/host/host1x/hw_host1x01_sync.h new file +398 -0
398 lines not on this page · raw message
drivers/video/tegra/host/host1x/hw_host1x01_uclass.h new file +474 -0
474 lines not on this page · raw message
drivers/video/tegra/host/nvhost_acm.c new file +532 -0
532 lines not on this page · raw message
drivers/video/tegra/host/nvhost_acm.h new file +49 -0
49 lines not on this page · raw message
drivers/video/tegra/host/nvhost_cdma.c new file +473 -0
473 lines not on this page · raw message
drivers/video/tegra/host/nvhost_cdma.h new file +116 -0
116 lines not on this page · raw message
drivers/video/tegra/host/nvhost_channel.c new file +129 -0
129 lines not on this page · raw message
drivers/video/tegra/host/nvhost_channel.h new file +65 -0
65 lines not on this page · raw message
drivers/video/tegra/host/nvhost_intr.c new file +391 -0
391 lines not on this page · raw message
drivers/video/tegra/host/nvhost_intr.h new file +110 -0
110 lines not on this page · raw message
drivers/video/tegra/host/nvhost_job.c new file +398 -0
398 lines not on this page · raw message
drivers/video/tegra/host/nvhost_memmgr.c new file +252 -0
252 lines not on this page · raw message
drivers/video/tegra/host/nvhost_memmgr.h new file +66 -0
66 lines not on this page · raw message
drivers/video/tegra/host/nvhost_syncpt.c new file +453 -0
453 lines not on this page · raw message
drivers/video/tegra/host/nvhost_syncpt.h new file +148 -0
148 lines not on this page · raw message
drivers/video/tegra/host/t20/Makefile new file +6 -0
Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/t20/t20.c new file +78 -0
78 lines not on this page · raw message
drivers/video/tegra/host/t20/t20.h new file +29 -0
Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/t30/Makefile new file +6 -0
Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/t30/t30.c new file +80 -0
80 lines not on this page · raw message
drivers/video/tegra/host/t30/t30.h new file +29 -0
Lines of this file are not shown. View the raw message.
include/linux/nvhost.h new file +302 -0
302 lines not on this page · raw message
include/trace/events/nvhost.h new file +249 -0
249 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.9.5
Part of the diff is not shown here. View the raw message.
PATCH 2/6 ARM: tegra: Add auxiliary data for nvhost
In reply to a message not in the archiveAdd SoC specific auxiliary data to host1x and gr2d. nvhost uses this data.
--- arch/arm/mach-tegra/board-dt-tegra20.c | 38 ++++++++++++++++++++++++++++- arch/arm/mach-tegra/board-dt-tegra30.c | 38 ++++++++++++++++++++++++++++- arch/arm/mach-tegra/tegra20_clocks_data.c | 8 +++--- arch/arm/mach-tegra/tegra30_clocks_data.c | 2 ++ 4 files changed, 80 insertions(+), 6 deletions(-)
arch/arm/mach-tegra/board-dt-tegra20.c +37 -1
@@ -33,6 +33,7 @@#include <linux/i2c.h> #include <linux/i2c-tegra.h> #include <linux/usb/tegra_usb_phy.h> +#include <linux/nvhost.h> #include <asm/hardware/gic.h> #include <asm/mach-types.h>
@@ -45,6 +46,38 @@#include "common.h" #include "iomap.h" +static const char *host1x_syncpt_names[32 ] = { + [0 ] ="gfx_host" , + [NVSYNCPT_2D_0 ] ="2d_0" , + [NVSYNCPT_2D_1 ] ="2d_1" , + [NVSYNCPT_VBLANK0 ] ="vblank0" , + [NVSYNCPT_VBLANK1 ] ="vblank1" , +}; + +static struct host1x_device_info host1x_info = { + .nb_channels =8 , + .nb_pts =32 , + .nb_mlocks =16 , + .nb_bases =8 , + .syncpt_names = host1x_syncpt_names, + .client_managed =NVSYNCPTS_CLIENT_MANAGED , +}; + +static struct nvhost_device_data tegra_host1x_info = { + .clocks = { {"host1x" ,UINT_MAX } }, +NVHOST_MODULE_NO_POWERGATE_IDS , + .private_data = &host1x_info, +}; + +static struct nvhost_device_data tegra_gr2d_info = { + .index =2 , + .syncpts =BIT (NVSYNCPT_2D_0 ) |BIT (NVSYNCPT_2D_1 ), + .clocks = { {"gr2d" ,UINT_MAX , true}, {"epp" ,UINT_MAX , true} }, +NVHOST_MODULE_NO_POWERGATE_IDS , + .clockgate_delay =0 , + .serialize = true, +}; +struct tegra_ehci_platform_data tegra_ehci1_pdata = { .operating_mode =TEGRA_USB_OTG , .power_down_on_bus_suspend =1 ,
@@ -94,13 +127,16 @@ struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {OF_DEV_AUXDATA ("nvidia,tegra20-slink" ,0x7000D600 ,"spi_tegra.1" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-slink" ,0x7000D800 ,"spi_tegra.2" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-slink" ,0x7000DA00 ,"spi_tegra.3" ,NULL ), -OF_DEV_AUXDATA ("nvidia,tegra20-host1x" ,0x50000000 ,"host1x" ,NULL ), +OF_DEV_AUXDATA ("nvidia,tegra20-host1x" ,0x50000000 ,"host1x" , + &tegra_host1x_info),OF_DEV_AUXDATA ("nvidia,tegra20-dc" ,0x54200000 ,"tegradc.0" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-dc" ,0x54240000 ,"tegradc.1" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-hdmi" ,0x54280000 ,"hdmi" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-dsi" ,0x54300000 ,"dsi" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-tvo" ,0x542c0000 ,"tvo" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-nand" ,0x70008000 ,"tegra-nand" ,NULL ), +OF_DEV_AUXDATA ("nvidia,tegra20-gr2d" ,0x54140000 ,"tegra-gr2d" , + &tegra_gr2d_info), {} };
arch/arm/mach-tegra/board-dt-tegra30.c +37 -1
@@ -29,6 +29,7 @@#include <linux/of_fdt.h> #include <linux/of_irq.h> #include <linux/of_platform.h> +#include <linux/nvhost.h> #include <asm/mach/arch.h> #include <asm/hardware/gic.h>
@@ -38,6 +39,38 @@#include "common.h" #include "iomap.h" +static const char *host1x_syncpt_names[32 ] = { + [0 ] ="gfx_host" , + [NVSYNCPT_2D_0 ] ="2d_0" , + [NVSYNCPT_2D_1 ] ="2d_1" , + [NVSYNCPT_VBLANK0 ] ="vblank0" , + [NVSYNCPT_VBLANK1 ] ="vblank1" , +}; + +static struct host1x_device_info host1x_info = { + .nb_channels =8 , + .nb_pts =32 , + .nb_mlocks =16 , + .nb_bases =8 , + .syncpt_names = host1x_syncpt_names, + .client_managed =NVSYNCPTS_CLIENT_MANAGED , +}; + +static struct nvhost_device_data tegra_host1x_info = { + .clocks = { {"host1x" ,UINT_MAX } }, +NVHOST_MODULE_NO_POWERGATE_IDS , + .private_data = &host1x_info, +}; + +static struct nvhost_device_data tegra_gr2d_info = { + .index =2 , + .syncpts =BIT (NVSYNCPT_2D_0 ) |BIT (NVSYNCPT_2D_1 ), + .clocks = { {"gr2d" ,UINT_MAX , true}, {"epp" ,UINT_MAX , true} }, +NVHOST_MODULE_NO_POWERGATE_IDS , + .clockgate_delay =0 , + .serialize = true, +}; +struct of_dev_auxdata tegra30_auxdata_lookup[]__initdata = {OF_DEV_AUXDATA ("nvidia,tegra20-sdhci" ,0x78000000 ,"sdhci-tegra.0" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra20-sdhci" ,0x78000200 ,"sdhci-tegra.1" ,NULL ),
@@ -57,12 +90,15 @@ struct of_dev_auxdata tegra30_auxdata_lookup[] __initdata = {OF_DEV_AUXDATA ("nvidia,tegra30-slink" ,0x7000DA00 ,"spi_tegra.3" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra30-slink" ,0x7000DC00 ,"spi_tegra.4" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra30-slink" ,0x7000DE00 ,"spi_tegra.5" ,NULL ), -OF_DEV_AUXDATA ("nvidia,tegra30-host1x" ,0x50000000 ,"host1x" ,NULL ), +OF_DEV_AUXDATA ("nvidia,tegra30-host1x" ,0x50000000 ,"host1x" , + &tegra_host1x_info),OF_DEV_AUXDATA ("nvidia,tegra30-dc" ,0x54200000 ,"tegradc.0" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra30-dc" ,0x54240000 ,"tegradc.1" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra30-hdmi" ,0x54280000 ,"hdmi" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra30-dsi" ,0x54300000 ,"dsi" ,NULL ),OF_DEV_AUXDATA ("nvidia,tegra30-tvo" ,0x542c0000 ,"tvo" ,NULL ), +OF_DEV_AUXDATA ("nvidia,tegra30-gr2d" ,0x54140000 ,"gr2d" , + &tegra_gr2d_info), {} };
arch/arm/mach-tegra/tegra20_clocks_data.c +4 -4
@@ -1041,10 +1041,10 @@ static struct clk_duplicate tegra_clk_duplicates[] = {CLK_DUPLICATE ("usbd" ,"utmip-pad" ,NULL ),CLK_DUPLICATE ("usbd" ,"tegra-ehci.0" ,NULL ),CLK_DUPLICATE ("usbd" ,"tegra-otg" ,NULL ), -CLK_DUPLICATE ("2d" ,"tegra_grhost" ,"gr2d" ), -CLK_DUPLICATE ("3d" ,"tegra_grhost" ,"gr3d" ), -CLK_DUPLICATE ("epp" ,"tegra_grhost" ,"epp" ), -CLK_DUPLICATE ("mpe" ,"tegra_grhost" ,"mpe" ), +CLK_DUPLICATE ("2d" ,NULL ,"gr2d" ), +CLK_DUPLICATE ("3d" ,NULL ,"gr3d" ), +CLK_DUPLICATE ("epp" ,NULL ,"epp" ), +CLK_DUPLICATE ("mpe" ,NULL ,"mpe" ),CLK_DUPLICATE ("cop" ,"tegra-avp" ,"cop" ),CLK_DUPLICATE ("vde" ,"tegra-aes" ,"vde" ), CLK_DUPLICATE("cclk", NULL, "cpu"),
arch/arm/mach-tegra/tegra30_clocks_data.c +2 -0
@@ -1338,6 +1338,8 @@ struct clk_duplicate tegra_clk_duplicates[] = {CLK_DUPLICATE ("pll_p" ,"tegradc.0" ,"parent" ),CLK_DUPLICATE ("pll_p" ,"tegradc.1" ,"parent" ),CLK_DUPLICATE ("pll_d2_out0" ,"hdmi" ,"parent" ), +CLK_DUPLICATE ("2d" ,NULL ,"gr2d" ), + CLK_DUPLICATE("epp", NULL, "epp"), }; struct clk *tegra_ptr_clks[] = {
Signature · 1 line
1.7.9.5
PATCH 3/6 gpu: drm: tegra: Remove redundant host1x
In reply to a message not in the archiveFrom: Arto Merilainen <[email protected]>
This patch removes the redundant host1x driver from tegradrm and makes necessary bindings to the separate host driver.
This modification introduces a regression: Because there is no general framework for attaching separate devices into the same address space, this patch removes the ability to use IOMMU in tegradrm.
--- drivers/gpu/drm/tegra/Kconfig | 8 +- drivers/gpu/drm/tegra/Makefile | 2 +- drivers/gpu/drm/tegra/dc.c | 22 +-- drivers/gpu/drm/tegra/drm.c | 206 +++++++++++++++++++----- drivers/gpu/drm/tegra/drm.h | 55 ++----- drivers/gpu/drm/tegra/dsi.c | 24 ++- drivers/gpu/drm/tegra/fb.c | 26 ++- drivers/gpu/drm/tegra/hdmi.c | 24 ++- drivers/gpu/drm/tegra/host1x.c | 343 ---------------------------------------- drivers/gpu/drm/tegra/tvo.c | 33 ++-- 10 files changed, 245 insertions(+), 498 deletions(-) delete mode 100644 drivers/gpu/drm/tegra/host1x.c
drivers/gpu/drm/tegra/Kconfig +1 -7
@@ -1,6 +1,6 @@ config DRM_TEGRA tristate "NVIDIA Tegra DRM" - depends on DRM && OF && ARCH_TEGRA + depends on DRM && OF && ARCH_TEGRA && TEGRA_GRHOST select DRM_KMS_HELPER select DRM_GEM_CMA_HELPER select DRM_KMS_CMA_HELPER
@@ -20,10 +20,4 @@ config DRM_TEGRA_DEBUG help Say yes here to enable debugging support. -config DRM_TEGRA_IOMMU - bool "NVIDIA Tegra DRM IOMMU support" - help - Say yes here to enable the use of the IOMMU to allocate and - map memory buffers. - endif
drivers/gpu/drm/tegra/Makefile +1 -1
@@ -1,7 +1,7 @@ ccflags-y := -Iinclude/drm ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG -tegra-drm-y := drm.o fb.o dc.o host1x.o +tegra-drm-y := drm.o fb.o dc.o tegra-drm-y += output.o rgb.o hdmi.o tvo.o dsi.o tegra-drm-y += plane.o
drivers/gpu/drm/tegra/dc.c +11 -11
@@ -12,6 +12,7 @@#include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> +#include <linux/nvhost.h> #include <mach/clk.h>
@@ -673,10 +674,10 @@ static int tegra_dc_debugfs_exit(struct tegra_dc *dc)return 0 ; } -static int tegra_dc_drm_init (struct host1x_client *client, +static int tegra_dc_drm_init (struct tegra_drm_client *client,struct drm_device *drm) { -struct tegra_dc *dc =host1x_client_to_dc (client); +struct tegra_dc *dc =tegra_drm_client_to_dc (client);int err; dc->pipe = drm->mode_config.num_crtc;
@@ -712,9 +713,9 @@ static int tegra_dc_drm_init(struct host1x_client *client,return 0 ; } -static int tegra_dc_drm_exit (struct host1x_client *client) +static int tegra_dc_drm_exit (struct tegra_drm_client *client) { -struct tegra_dc *dc =host1x_client_to_dc (client); +struct tegra_dc *dc =tegra_drm_client_to_dc (client);int err;devm_free_irq (dc->dev, dc->irq, dc);
@@ -734,14 +735,13 @@ static int tegra_dc_drm_exit(struct host1x_client *client)return 0 ; } -static const struct host1x_client_ops dc_client_ops = { +static const struct tegra_drm_client_ops dc_client_ops = { .drm_init = tegra_dc_drm_init, .drm_exit = tegra_dc_drm_exit, };static int tegra_dc_probe (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct resource *regs;struct tegra_dc *dc;int err;
@@ -791,13 +791,14 @@ static int tegra_dc_probe(struct platform_device *pdev)return err; } - err =host1x_register_client (host1x, &dc->client); + err =tegra_drm_register_client (&dc->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to register host1x client: %d\n" , +dev_err (&pdev->dev,"failed to register tegra drm client: %d\n" , err);return err; } +nvhost_module_busy_ext (pdev);platform_set_drvdata (pdev, dc);return 0 ;
@@ -805,13 +806,12 @@ static int tegra_dc_probe(struct platform_device *pdev)static int tegra_dc_remove (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_dc *dc =platform_get_drvdata (pdev);int err; - err =host1x_unregister_client (host1x, &dc->client); + err =tegra_drm_unregister_client (&dc->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , +dev_err (&pdev->dev,"failed to unregister tegra_drm client: %d\n" , err);return err; }
drivers/gpu/drm/tegra/drm.c +167 -39
239 lines not on this page · raw message
drivers/gpu/drm/tegra/drm.h +14 -41
88 lines not on this page · raw message
drivers/gpu/drm/tegra/dsi.c +11 -13
@@ -15,7 +15,7 @@#include "drm.h" struct tegra_dsi { -struct host1x_client client; +struct tegra_drm_client client;struct tegra_output output;void __iomem *regs;
@@ -23,7 +23,7 @@ struct tegra_dsi { };static inline struct tegra_dsi * -host1x_client_to_dsi (struct host1x_client *client) +tegra_drm_client_to_dsi (struct tegra_drm_client *client) { return container_of(client, struct tegra_dsi, client); }
@@ -59,10 +59,10 @@ static const struct tegra_output_ops dsi_ops = { .disable = tegra_output_dsi_disable, }; -static int tegra_dsi_drm_init (struct host1x_client *client, +static int tegra_dsi_drm_init (struct tegra_drm_client *client,struct drm_device *drm) { -struct tegra_dsi *dsi =host1x_client_to_dsi (client); +struct tegra_dsi *dsi =tegra_drm_client_to_dsi (client);int err; dsi->output.type =TEGRA_OUTPUT_DSI ;
@@ -78,9 +78,9 @@ static int tegra_dsi_drm_init(struct host1x_client *client,return 0 ; } -static int tegra_dsi_drm_exit (struct host1x_client *client) +static int tegra_dsi_drm_exit (struct tegra_drm_client *client) { -struct tegra_dsi *dsi =host1x_client_to_dsi (client); +struct tegra_dsi *dsi =tegra_drm_client_to_dsi (client);int err; err =tegra_output_exit (&dsi->output);
@@ -92,14 +92,13 @@ static int tegra_dsi_drm_exit(struct host1x_client *client)return 0 ; } -static const struct host1x_client_ops dsi_client_ops = { +static const struct tegra_drm_client_ops dsi_client_ops = { .drm_init = tegra_dsi_drm_init, .drm_exit = tegra_dsi_drm_exit, };static int tegra_dsi_probe (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_dsi *dsi;struct resource *regs;int err;
@@ -126,9 +125,9 @@ static int tegra_dsi_probe(struct platform_device *pdev)INIT_LIST_HEAD (&dsi->client.list); dsi->client.dev = &pdev->dev; - err =host1x_register_client (host1x, &dsi->client); + err =tegra_drm_register_client (&dsi->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to register host1x client: %d\n" , +dev_err (&pdev->dev,"failed to register tegra drm client: %d\n" , err);return err; }
@@ -140,13 +139,12 @@ static int tegra_dsi_probe(struct platform_device *pdev)static int tegra_dsi_remove (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_dsi *dsi =platform_get_drvdata (pdev);int err; - err =host1x_unregister_client (host1x, &dsi->client); + err =tegra_drm_unregister_client (&dsi->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , +dev_err (&pdev->dev,"failed to unregister tegra drm client: %d\n" , err);return err; }
drivers/gpu/drm/tegra/fb.c +12 -14
@@ -9,11 +9,11 @@#include "drm.h" +static struct drm_fbdev_cma *tegra_fbdev; +static void tegra_drm_fb_output_poll_changed (struct drm_device *drm) { -struct host1x *host1x = drm->dev_private; - -drm_fbdev_cma_hotplug_event (host1x->fbdev); +drm_fbdev_cma_hotplug_event (tegra_fbdev); }static const struct drm_mode_config_funcs tegra_drm_mode_funcs = {
@@ -23,9 +23,6 @@ static const struct drm_mode_config_funcs tegra_drm_mode_funcs = {int tegra_drm_fb_init (struct drm_device *drm) { -struct host1x *host1x = drm->dev_private; -struct drm_fbdev_cma *fbdev; - drm->mode_config.min_width =0 ; drm->mode_config.min_height =0 ;
@@ -34,23 +31,24 @@ int tegra_drm_fb_init(struct drm_device *drm) drm->mode_config.funcs = &tegra_drm_mode_funcs; - fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, + tegra_fbdev =drm_fbdev_cma_init (drm,32 , drm->mode_config.num_crtc, drm->mode_config.num_connector); -if (IS_ERR (fbdev)) -return PTR_ERR (fbdev); +if (IS_ERR (tegra_fbdev)) +return PTR_ERR (tegra_fbdev);#ifndef CONFIG_FRAMEBUFFER_CONSOLE -drm_fbdev_cma_restore_mode (fbdev); +drm_fbdev_cma_restore_mode (tegra_fbdev);#endif - host1x->fbdev = fbdev; -return 0 ; }void tegra_drm_fb_exit (struct drm_device *drm) { -struct host1x *host1x = drm->dev_private; +drm_fbdev_cma_fini (tegra_fbdev); +} -drm_fbdev_cma_fini (host1x->fbdev); +void tegra_drm_fb_restore (struct drm_device *drm) +{ +drm_fbdev_cma_restore_mode (tegra_fbdev); }
drivers/gpu/drm/tegra/hdmi.c +11 -13
@@ -22,7 +22,7 @@#include "dc.h" struct tegra_hdmi { -struct host1x_client client; +struct tegra_drm_client client;struct tegra_output output;struct device *dev;
@@ -46,7 +46,7 @@ struct tegra_hdmi { };static inline struct tegra_hdmi * -host1x_client_to_hdmi (struct host1x_client *client) +tegra_drm_client_to_hdmi (struct tegra_drm_client *client) { return container_of(client, struct tegra_hdmi, client); }
@@ -1152,10 +1152,10 @@ static int tegra_hdmi_debugfs_exit(struct tegra_hdmi *hdmi)return 0 ; } -static int tegra_hdmi_drm_init (struct host1x_client *client, +static int tegra_hdmi_drm_init (struct tegra_drm_client *client,struct drm_device *drm) { -struct tegra_hdmi *hdmi =host1x_client_to_hdmi (client); +struct tegra_hdmi *hdmi =tegra_drm_client_to_hdmi (client);int err; hdmi->output.type =TEGRA_OUTPUT_HDMI ;
@@ -1177,9 +1177,9 @@ static int tegra_hdmi_drm_init(struct host1x_client *client,return 0 ; } -static int tegra_hdmi_drm_exit (struct host1x_client *client) +static int tegra_hdmi_drm_exit (struct tegra_drm_client *client) { -struct tegra_hdmi *hdmi =host1x_client_to_hdmi (client); +struct tegra_hdmi *hdmi =tegra_drm_client_to_hdmi (client);int err;if (IS_ENABLED (CONFIG_DEBUG_FS )) {
@@ -1204,14 +1204,13 @@ static int tegra_hdmi_drm_exit(struct host1x_client *client)return 0 ; } -static const struct host1x_client_ops hdmi_client_ops = { +static const struct tegra_drm_client_ops hdmi_client_ops = { .drm_init = tegra_hdmi_drm_init, .drm_exit = tegra_hdmi_drm_exit, };static int tegra_hdmi_probe (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_hdmi *hdmi;struct resource *regs;int err;
@@ -1286,9 +1285,9 @@ static int tegra_hdmi_probe(struct platform_device *pdev)INIT_LIST_HEAD (&hdmi->client.list); hdmi->client.dev = &pdev->dev; - err =host1x_register_client (host1x, &hdmi->client); + err =tegra_drm_register_client (&hdmi->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to register host1x client: %d\n" , +dev_err (&pdev->dev,"failed to register tegra drm client: %d\n" , err);return err; }
@@ -1300,13 +1299,12 @@ static int tegra_hdmi_probe(struct platform_device *pdev)static int tegra_hdmi_remove (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_hdmi *hdmi =platform_get_drvdata (pdev);int err; - err =host1x_unregister_client (host1x, &hdmi->client); + err =tegra_drm_unregister_client (&hdmi->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , +dev_err (&pdev->dev,"failed to unregister tegra drm client: %d\n" , err);return err; }
drivers/gpu/drm/tegra/host1x.c deleted +0 -343
343 lines not on this page · raw message
drivers/gpu/drm/tegra/tvo.c +17 -16
@@ -15,7 +15,7 @@#include "drm.h" struct tegra_tvo { -struct host1x_client client; +struct tegra_drm_client client;struct tegra_output output;void __iomem *regs;
@@ -24,7 +24,7 @@ struct tegra_tvo { };static inline struct tegra_tvo * -host1x_client_to_tvo (struct host1x_client *client) +tegra_drm_client_to_tvo (struct tegra_drm_client *client) { return container_of(client, struct tegra_tvo, client); }
@@ -60,10 +60,10 @@ static const struct tegra_output_ops tvo_ops = { .disable = tegra_output_tvo_disable, }; -static int tegra_tvo_drm_init (struct host1x_client *client, +static int tegra_tvo_drm_init (struct tegra_drm_client *client,struct drm_device *drm) { -struct tegra_tvo *tvo =host1x_client_to_tvo (client); +struct tegra_tvo *tvo =tegra_drm_client_to_tvo (client);int err; tvo->output.type =TEGRA_OUTPUT_TVO ;
@@ -79,9 +79,9 @@ static int tegra_tvo_drm_init(struct host1x_client *client,return 0 ; } -static int tegra_tvo_drm_exit (struct host1x_client *client) +static int tegra_tvo_drm_exit (struct tegra_drm_client *client) { -struct tegra_tvo *tvo =host1x_client_to_tvo (client); +struct tegra_tvo *tvo =tegra_drm_client_to_tvo (client);int err; err =tegra_output_exit (&tvo->output);
@@ -93,14 +93,13 @@ static int tegra_tvo_drm_exit(struct host1x_client *client)return err; } -static const struct host1x_client_ops tvo_client_ops = { +static const struct tegra_drm_client_ops tvo_client_ops = { .drm_init = tegra_tvo_drm_init, .drm_exit = tegra_tvo_drm_exit, };static int tegra_tvo_probe (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_tvo *tvo;struct resource *regs;int err;
@@ -120,22 +119,25 @@ static int tegra_tvo_probe(struct platform_device *pdev)return -ENXIO ; err =platform_get_irq (pdev,0 ); -if (err <0 ) +if (err <0 ) { +dev_err (&pdev->dev,"failed to get tvo irq\n" );return err; - + } tvo->irq = err; tvo->regs =devm_request_and_ioremap (&pdev->dev, regs); -if (!tvo->regs) +if (!tvo->regs) { +dev_err (&pdev->dev,"failed to request tvo regs\n" );return -EADDRNOTAVAIL ; + } tvo->client.ops = &tvo_client_ops;INIT_LIST_HEAD (&tvo->client.list); tvo->client.dev = &pdev->dev; - err =host1x_register_client (host1x, &tvo->client); + err =tegra_drm_register_client (&tvo->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to register host1x client: %d\n" , +dev_err (&pdev->dev,"failed to register tegra drm client: %d\n" , err);return err; }
@@ -147,13 +149,12 @@ static int tegra_tvo_probe(struct platform_device *pdev)static int tegra_tvo_remove (struct platform_device *pdev) { -struct host1x *host1x =dev_get_drvdata (pdev->dev.parent);struct tegra_tvo *tvo =platform_get_drvdata (pdev);int err; - err =host1x_unregister_client (host1x, &tvo->client); + err =tegra_drm_unregister_client (&tvo->client);if (err <0 ) { -dev_err (&pdev->dev,"failed to unregister host1x client: %d\n" , +dev_err (&pdev->dev,"failed to unregister tegra drm client: %d\n" , err);return err; }
Signature · 1 line
1.7.9.5
PATCH 4/6 gpu: drm: tegra: Free platform data on remove
In reply to a message not in the archiveFrom: Arto Merilainen <[email protected]>
Platform data was not freed in device removal. This patch adds missing devm_kfree() calls.
--- drivers/gpu/drm/tegra/dc.c | 3 +++ drivers/gpu/drm/tegra/dsi.c | 3 +++ drivers/gpu/drm/tegra/hdmi.c | 3 +++ drivers/gpu/drm/tegra/tvo.c | 3 +++ 4 files changed, 12 insertions(+)
drivers/gpu/drm/tegra/dc.c +3 -0
@@ -818,6 +818,9 @@ static int tegra_dc_remove(struct platform_device *pdev)clk_disable_unprepare (dc->clk); +platform_set_drvdata (pdev,NULL ); +devm_kfree (&pdev->dev, dc); +return 0 ; }
drivers/gpu/drm/tegra/dsi.c +3 -0
@@ -149,6 +149,9 @@ static int tegra_dsi_remove(struct platform_device *pdev)return err; } +platform_set_drvdata (pdev,NULL ); +devm_kfree (&pdev->dev, dsi); +return 0 ; }
drivers/gpu/drm/tegra/hdmi.c +3 -0
@@ -1312,6 +1312,9 @@ static int tegra_hdmi_remove(struct platform_device *pdev)clk_unprepare (hdmi->clk_parent);clk_unprepare (hdmi->clk); +platform_set_drvdata (pdev,NULL ); +devm_kfree (&pdev->dev, hdmi); +return 0 ; }
drivers/gpu/drm/tegra/tvo.c +3 -0
@@ -159,6 +159,9 @@ static int tegra_tvo_remove(struct platform_device *pdev)return err; } +platform_set_drvdata (pdev,NULL ); +devm_kfree (&pdev->dev, tvo); +return 0 ; }
Signature · 1 line
1.7.9.5
PATCH 5/6 gpu: drm: tegra: Prime support
In reply to a message not in the archiveFrom: Arto Merilainen <[email protected]>
This patch introduces support for exporting allocated memory as dmabuf objects. Exported buffers are used for delivering data to nvhost driver.
--- drivers/gpu/drm/tegra/Makefile | 2 +- drivers/gpu/drm/tegra/dmabuf.c | 150 ++++++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/tegra/drm.c | 9 ++- drivers/gpu/drm/tegra/drm.h | 6 ++ 4 files changed, 165 insertions(+), 2 deletions(-) create mode 100644 drivers/gpu/drm/tegra/dmabuf.c
drivers/gpu/drm/tegra/Makefile +1 -1
@@ -3,6 +3,6 @@ ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG tegra-drm-y := drm.o fb.o dc.o tegra-drm-y += output.o rgb.o hdmi.o tvo.o dsi.o -tegra-drm-y += plane.o +tegra-drm-y += plane.o dmabuf.o obj-$(CONFIG_DRM_TEGRA) += tegra-drm.o
drivers/gpu/drm/tegra/dmabuf.c new file +150 -0
150 lines not on this page · raw message
drivers/gpu/drm/tegra/drm.c +8 -1
@@ -250,7 +250,8 @@ static const struct file_operations tegra_drm_fops = { };struct drm_driver tegra_drm_driver = { - .driver_features =DRIVER_BUS_PLATFORM |DRIVER_MODESET |DRIVER_GEM , + .driver_features =DRIVER_BUS_PLATFORM |DRIVER_MODESET |DRIVER_GEM | +DRIVER_PRIME , .load = tegra_drm_load, .unload = tegra_drm_unload, .open = tegra_drm_open,
@@ -266,6 +267,12 @@ struct drm_driver tegra_drm_driver = { .num_ioctls = ARRAY_SIZE(tegra_drm_ioctls), .fops = &tegra_drm_fops, + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, + + .gem_prime_export = tegra_dmabuf_export, + .gem_prime_import = tegra_dmabuf_import, + .name = DRIVER_NAME, .desc = DRIVER_DESC, .date = DRIVER_DATE,
drivers/gpu/drm/tegra/drm.h +6 -0
@@ -227,4 +227,10 @@ extern struct platform_driver tegra_dsi_driver;extern struct platform_driver tegra_dc_driver;extern struct drm_driver tegra_drm_driver; +/* from dmabuf.c */ +struct dma_buf *tegra_dmabuf_export (struct drm_device *drm_dev, +struct drm_gem_object *obj,int flags); +struct drm_gem_object *tegra_dmabuf_import (struct drm_device *drm_dev, +struct dma_buf *dmabuf); +#endif /* TEGRA_DRM_H */
Signature · 1 line
1.7.9.5
PATCH 6/6 drm: tegra: Add gr2d device
In reply to a message not in the archiveAdd client driver for 2D device.
--- drivers/gpu/drm/tegra/Makefile | 2 +- drivers/gpu/drm/tegra/drm.c | 231 +++++++++++++++++++++++++++++++++++++++- drivers/gpu/drm/tegra/drm.h | 42 ++++++-- drivers/gpu/drm/tegra/gr2d.c | 225 ++++++++++++++++++++++++++++++++++++++ include/drm/tegra_drm.h | 129 ++++++++++++++++++++++ 5 files changed, 616 insertions(+), 13 deletions(-) create mode 100644 drivers/gpu/drm/tegra/gr2d.c create mode 100644 include/drm/tegra_drm.h
drivers/gpu/drm/tegra/Makefile +1 -1
@@ -1,7 +1,7 @@ ccflags-y := -Iinclude/drm ccflags-$(CONFIG_DRM_TEGRA_DEBUG) += -DDEBUG -tegra-drm-y := drm.o fb.o dc.o +tegra-drm-y := drm.o fb.o dc.o gr2d.o tegra-drm-y += output.o rgb.o hdmi.o tvo.o dsi.o tegra-drm-y += plane.o dmabuf.o
drivers/gpu/drm/tegra/drm.c +229 -2
273 lines not on this page · raw message
drivers/gpu/drm/tegra/drm.h +32 -10
74 lines not on this page · raw message
drivers/gpu/drm/tegra/gr2d.c new file +225 -0
225 lines not on this page · raw message
include/drm/tegra_drm.h new file +129 -0
129 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH 3/6] gpu: drm: tegra: Remove redundant host1x
In reply to a message not in the archiveQuoted 2 lines · Terje Bergstrom
From: Arto Merilainen <[email protected]>
<snip>
drivers/gpu/drm/tegra/drm.c line 125
Quoted 11 lines
drivers/gpu/drm/tegra/drm.c +11
-0+ +int tegra_drm_unregister_client (struct tegra_drm_client *client) +{ +int ret =0 ; + +list_for_each_entry (client, &tegra_drm_subdrv_list, list) { + +struct platform_device *pdev =to_platform_device (client->dev); + +if (client->ops && client->ops->drm_exit) { +int err = client->ops->drm_exit (client);
Shadow error variable err (ret is not used)
Quoted 15 lines
drivers/gpu/drm/tegra/drm.c +15
-0+if (err <0 ) +dev_dbg (client->dev,"drm_exit() failed for %s: %d\n" , +dev_name (client->dev), err); + } + +/* if this is the last device, unregister the drm driver */ +if (client->list.next == &tegra_drm_subdrv_list) +drm_platform_exit (&tegra_drm_driver, pdev); + +list_del_init (&client->list); + } + +return ret; +} +
drivers/gpu/drm/tegra/drm.c line 150
Quoted 10 lines
drivers/gpu/drm/tegra/drm.c +10
-0+static int tegra_drm_load (struct drm_device *drm,unsigned long flags) +{ +struct tegra_drm_client *client; +int err; + +drm_mode_config_init (drm); + +list_for_each_entry (client, &tegra_drm_subdrv_list, list) { +if (client->ops && client->ops->drm_init) { +int err = client->ops->drm_init (client, drm);
Shadow variable
-Sivaram
Re: [PATCH 1/6] video: tegra: Add nvhost driver
In reply to a message not in the archiveQuoted 273 lines · Terje Bergstrom
Add nvhost, the driver for host1x and 2D, which is a client device for host1x.
Change-Id Id93a28491dc2d54049e0adce4ad287c5985b2bcaSigned-off-by Terje Bergstrom <[email protected]>Signed-off-by Arto Merilainen <[email protected]>--- drivers/video/Kconfig | 2 + drivers/video/Makefile | 2 + drivers/video/tegra/host/Kconfig | 20 + drivers/video/tegra/host/Makefile | 21 + drivers/video/tegra/host/bus_client.c | 101 ++++ drivers/video/tegra/host/bus_client.h | 32 ++ drivers/video/tegra/host/chip_support.c | 68 +++ drivers/video/tegra/host/chip_support.h | 179 +++++++ drivers/video/tegra/host/debug.c | 255 ++++++++++ drivers/video/tegra/host/debug.h | 50 ++ drivers/video/tegra/host/dev.c | 104 ++++ drivers/video/tegra/host/dev.h | 33 ++ drivers/video/tegra/host/dmabuf.c | 151 ++++++ drivers/video/tegra/host/dmabuf.h | 51 ++ drivers/video/tegra/host/host1x/Makefile | 6 + drivers/video/tegra/host/host1x/host1x.c | 320 ++++++++++++ drivers/video/tegra/host/host1x/host1x.h | 97 ++++ .../video/tegra/host/host1x/host1x01_hardware.h | 157 ++++++ drivers/video/tegra/host/host1x/host1x_cdma.c | 488 ++++++++++++++++++ drivers/video/tegra/host/host1x/host1x_cdma.h | 39 ++ drivers/video/tegra/host/host1x/host1x_channel.c | 157 ++++++ drivers/video/tegra/host/host1x/host1x_debug.c | 405 +++++++++++++++ drivers/video/tegra/host/host1x/host1x_intr.c | 263 ++++++++++ drivers/video/tegra/host/host1x/host1x_syncpt.c | 170 +++++++ .../video/tegra/host/host1x/hw_host1x01_channel.h | 182 +++++++ drivers/video/tegra/host/host1x/hw_host1x01_sync.h | 398 +++++++++++++++ .../video/tegra/host/host1x/hw_host1x01_uclass.h | 474 +++++++++++++++++ drivers/video/tegra/host/nvhost_acm.c | 532 ++++++++++++++++++++ drivers/video/tegra/host/nvhost_acm.h | 49 ++ drivers/video/tegra/host/nvhost_cdma.c | 473 +++++++++++++++++ drivers/video/tegra/host/nvhost_cdma.h | 116 +++++ drivers/video/tegra/host/nvhost_channel.c | 129 +++++ drivers/video/tegra/host/nvhost_channel.h | 65 +++ drivers/video/tegra/host/nvhost_intr.c | 391 ++++++++++++++ drivers/video/tegra/host/nvhost_intr.h | 110 ++++ drivers/video/tegra/host/nvhost_job.c | 398 +++++++++++++++ drivers/video/tegra/host/nvhost_memmgr.c | 252 ++++++++++ drivers/video/tegra/host/nvhost_memmgr.h | 66 +++ drivers/video/tegra/host/nvhost_syncpt.c | 453 +++++++++++++++++ drivers/video/tegra/host/nvhost_syncpt.h | 148 ++++++ drivers/video/tegra/host/t20/Makefile | 6 + drivers/video/tegra/host/t20/t20.c | 78 +++ drivers/video/tegra/host/t20/t20.h | 29 ++ drivers/video/tegra/host/t30/Makefile | 6 + drivers/video/tegra/host/t30/t30.c | 80 +++ drivers/video/tegra/host/t30/t30.h | 29 ++ include/linux/nvhost.h | 302 +++++++++++ include/trace/events/nvhost.h | 249 +++++++++ 48 files changed, 8186 insertions(+) create mode 100644 drivers/video/tegra/host/Kconfig create mode 100644 drivers/video/tegra/host/Makefile create mode 100644 drivers/video/tegra/host/bus_client.c create mode 100644 drivers/video/tegra/host/bus_client.h create mode 100644 drivers/video/tegra/host/chip_support.c create mode 100644 drivers/video/tegra/host/chip_support.h create mode 100644 drivers/video/tegra/host/debug.c create mode 100644 drivers/video/tegra/host/debug.h create mode 100644 drivers/video/tegra/host/dev.c create mode 100644 drivers/video/tegra/host/dev.h create mode 100644 drivers/video/tegra/host/dmabuf.c create mode 100644 drivers/video/tegra/host/dmabuf.h create mode 100644 drivers/video/tegra/host/host1x/Makefile create mode 100644 drivers/video/tegra/host/host1x/host1x.c create mode 100644 drivers/video/tegra/host/host1x/host1x.h create mode 100644 drivers/video/tegra/host/host1x/host1x01_hardware.h create mode 100644 drivers/video/tegra/host/host1x/host1x_cdma.c create mode 100644 drivers/video/tegra/host/host1x/host1x_cdma.h create mode 100644 drivers/video/tegra/host/host1x/host1x_channel.c create mode 100644 drivers/video/tegra/host/host1x/host1x_debug.c create mode 100644 drivers/video/tegra/host/host1x/host1x_intr.c create mode 100644 drivers/video/tegra/host/host1x/host1x_syncpt.c create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_channel.h create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_sync.h create mode 100644 drivers/video/tegra/host/host1x/hw_host1x01_uclass.h create mode 100644 drivers/video/tegra/host/nvhost_acm.c create mode 100644 drivers/video/tegra/host/nvhost_acm.h create mode 100644 drivers/video/tegra/host/nvhost_cdma.c create mode 100644 drivers/video/tegra/host/nvhost_cdma.h create mode 100644 drivers/video/tegra/host/nvhost_channel.c create mode 100644 drivers/video/tegra/host/nvhost_channel.h create mode 100644 drivers/video/tegra/host/nvhost_intr.c create mode 100644 drivers/video/tegra/host/nvhost_intr.h create mode 100644 drivers/video/tegra/host/nvhost_job.c create mode 100644 drivers/video/tegra/host/nvhost_memmgr.c create mode 100644 drivers/video/tegra/host/nvhost_memmgr.h create mode 100644 drivers/video/tegra/host/nvhost_syncpt.c create mode 100644 drivers/video/tegra/host/nvhost_syncpt.h create mode 100644 drivers/video/tegra/host/t20/Makefile create mode 100644 drivers/video/tegra/host/t20/t20.c create mode 100644 drivers/video/tegra/host/t20/t20.h create mode 100644 drivers/video/tegra/host/t30/Makefile create mode 100644 drivers/video/tegra/host/t30/t30.c create mode 100644 drivers/video/tegra/host/t30/t30.h create mode 100644 include/linux/nvhost.h create mode 100644 include/trace/events/nvhost.hdrivers/video/Kconfig +2
-0@@ -2463,4 +2463,6 @@ config FB_SH_MOBILE_MERAM Up to 4 memory channels can be configured, allowing 4 RGB or 2 YCbCr framebuffers to be configured. +source "drivers/video/tegra/host/Kconfig" + endmenudrivers/video/Makefile +2
-0@@ -17,6 +17,8 @@ obj-y += backlight/ obj-$(CONFIG_EXYNOS_VIDEO) += exynos/ +obj-$(CONFIG_TEGRA_GRHOST) += tegra/host/ + obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.odrivers/video/tegra/host/Kconfig new file +20
-0@@ -0,0 +1,20 @@ +config TEGRA_GRHOST + tristate "Tegra graphics host driver" + help + Driver for the Tegra graphics host hardware. + +config TEGRA_GRHOST_USE_DMABUF + depends on TEGRA_GRHOST + bool "Support dmabuf buffers" + default y + select DMA_SHARED_BUFFER + help + Support dmabuf buffers. + +config TEGRA_GRHOST_DEFAULT_TIMEOUT + depends on TEGRA_GRHOST + int "Default timeout for submits" + default 10000 + help + Default timeout for jobs in milliseconds. Set to zero for no timeout. +drivers/video/tegra/host/Makefile new file +21
-0@@ -0,0 +1,21 @@ +ccflags-y = -Idrivers/video/tegra/host -Iarch/arm/mach-tegra + +nvhost-objs = \ + nvhost_acm.o \ + nvhost_syncpt.o \ + nvhost_cdma.o \ + nvhost_intr.o \ + nvhost_channel.o \ + nvhost_job.o \ + dev.o \ + debug.o \ + bus_client.o \ + chip_support.o \ + nvhost_memmgr.o + +obj-$(CONFIG_TEGRA_GRHOST) += host1x/ +obj-$(CONFIG_TEGRA_GRHOST) += t20/ +obj-$(CONFIG_TEGRA_GRHOST) += t30/ +obj-$(CONFIG_TEGRA_GRHOST) += nvhost.o + +obj-$(CONFIG_TEGRA_GRHOST_USE_DMABUF) += dmabuf.odrivers/video/tegra/host/bus_client.c new file +87
-0@@ -0,0 +1,101 @@ +/* +* drivers/video/tegra/host/bus_client.c +* +* Tegra Graphics Host Client Module +* +* Copyright (c) 2010-2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <linux/module.h> +#include <linux/slab.h> +#include <linux/string.h> +#include <linux/spinlock.h> +#include <linux/fs.h> +#include <linux/cdev.h> +#include <linux/uaccess.h> +#include <linux/file.h> +#include <linux/clk.h> +#include <linux/hrtimer.h> +#include <linux/export.h> + +#include <trace/events/nvhost.h> + +#include <linux/io.h> +#include <linux/string.h> + +#include <linux/nvhost.h> + +#include "debug.h" +#include "bus_client.h" +#include "dev.h" +#include "nvhost_memmgr.h" +#include "chip_support.h" +#include "nvhost_acm.h" + +#include "nvhost_channel.h" + +int nvhost_client_device_init (struct platform_device *dev) +{ +int err; +struct nvhost_master *nvhost_master =nvhost_get_host (dev); +struct nvhost_channel *ch; +struct nvhost_device_data *pdata =platform_get_drvdata (dev); + + ch =nvhost_alloc_channel (dev); +if (ch ==NULL ) +return -ENODEV ; + +/* store the pointer to this device for channel */ + ch->dev = dev; + + err =nvhost_channel_init (ch, nvhost_master, pdata->index); +if (err) + goto fail; + + err =nvhost_module_init (dev); +if (err) + goto fail; + + err =nvhost_device_list_add (dev); +if (err) + goto fail; + +nvhost_device_debug_init (dev); + +dev_info (&dev->dev,"initialized\n" ); + +return 0 ; + +fail: +/* Add clean-up */ +nvhost_free_channel (ch); +return err; +} +EXPORT_SYMBOL (nvhost_client_device_init); +
drivers/video/tegra/host/bus_client.c line 97
Quoted 10 lines
drivers/video/tegra/host/bus_client.c new file +10
-0+int nvhost_client_device_suspend (struct platform_device *dev) +{ +int ret =0 ; +struct nvhost_device_data *pdata =platform_get_drvdata (dev); + + ret =nvhost_channel_suspend (pdata->channel); +if (ret) +return ret; + +dev_info (&dev->dev,"suspend status: %d\n" , ret);
Shouldn't this be placed before the if statement?
Quoted 70 lines
drivers/video/tegra/host/bus_client.c new file +4
-0+ +return ret; +} +EXPORT_SYMBOL (nvhost_client_device_suspend);drivers/video/tegra/host/bus_client.h new file +32
-0@@ -0,0 +1,32 @@ +/* +* drivers/video/tegra/host/bus_client.h +* +* Tegra Graphics Host client +* +* Copyright (c) 2010-2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __NVHOST_BUS_CLIENT_H +#define __NVHOST_BUS_CLIENT_H + +#include <linux/types.h> + +struct platform_device ; + +int nvhost_client_device_init (struct platform_device *dev); + +int nvhost_client_device_suspend (struct platform_device *dev); + +#endif drivers/video/tegra/host/chip_support.c new file +22
-0@@ -0,0 +1,68 @@ +/* +* drivers/video/tegra/host/chip_support.c +* +* Tegra Graphics Host Chip support module +* +* Copyright (c) 2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <linux/errno.h> +#include <linux/types.h>
drivers/video/tegra/host/chip_support.c line 32
Quoted 10 lines
drivers/video/tegra/host/chip_support.c new file +10
-0+#include <linux/bug.h> +#include <linux/slab.h> + +#include "chip_support.h" +#include "t20/t20.h" +#include "t30/t30.h" + +#include "fuse.h" + +struct nvhost_chip_support *nvhost_chip_ops;
Should this be static (considering that the below function exist)?
Quoted 629 lines
drivers/video/tegra/host/chip_support.c new file +36
-0+ +struct nvhost_chip_support *nvhost_get_chip_ops (void ) +{ +return nvhost_chip_ops; +} + +int nvhost_init_chip_support (struct nvhost_master *host) +{ +int err =0 ; + +if (nvhost_chip_ops ==NULL ) { + nvhost_chip_ops =kzalloc (sizeof (*nvhost_chip_ops),GFP_KERNEL ); +if (nvhost_chip_ops ==NULL ) { +pr_err ("%s: Cannot allocate nvhost_chip_support\n" , + __func__); +return 0 ; + } + } + +switch (tegra_chip_id) { +case TEGRA20 : + nvhost_chip_ops->soc_name ="tegra2x" ; + err =nvhost_init_t20_support (host, nvhost_chip_ops); +break ; + +case TEGRA30 : + nvhost_chip_ops->soc_name ="tegra3x" ; + err =nvhost_init_t30_support (host, nvhost_chip_ops); +break ; + +default : + err = -ENODEV ; + } + +return err; +}drivers/video/tegra/host/chip_support.h new file +179
-0@@ -0,0 +1,179 @@ +/* +* drivers/video/tegra/host/chip_support.h +* +* Tegra Graphics Host Chip Support +* +* Copyright (c) 2011-2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef _NVHOST_CHIP_SUPPORT_H_ +#define _NVHOST_CHIP_SUPPORT_H_ + +#include <linux/types.h> + +struct output ; + +struct nvhost_master ; +struct nvhost_intr ; +struct nvhost_syncpt ; +struct nvhost_userctx_timeout ; +struct nvhost_channel ; +struct nvhost_cdma ; +struct nvhost_job ; +struct push_buffer ; +struct nvhost_syncpt ; +struct dentry ; +struct nvhost_job ; +struct nvhost_job_unpin_data ; +struct nvhost_intr_syncpt ; +struct mem_handle ; +struct mem_mgr ; +struct platform_device ; + +struct nvhost_channel_ops { +const char *soc_name; +int (*init)(struct nvhost_channel *, +struct nvhost_master *, +int chid); +int (*submit)(struct nvhost_job *job); +}; + +struct nvhost_cdma_ops { +void (*start)(struct nvhost_cdma *); +void (*stop)(struct nvhost_cdma *); +void (*kick)(struct nvhost_cdma *); +int (*timeout_init)(struct nvhost_cdma *, +u32 syncpt_id); +void (*timeout_destroy)(struct nvhost_cdma *); +void (*timeout_teardown_begin)(struct nvhost_cdma *); +void (*timeout_teardown_end)(struct nvhost_cdma *, +u32 getptr); +void (*timeout_cpu_incr)(struct nvhost_cdma *, +u32 getptr, +u32 syncpt_incrs, +u32 syncval, +u32 nr_slots); +}; + +struct nvhost_pushbuffer_ops { +void (*reset)(struct push_buffer *); +int (*init)(struct push_buffer *); +void (*destroy)(struct push_buffer *); +void (*push_to)(struct push_buffer *, +struct mem_mgr *,struct mem_handle *, +u32 op1,u32 op2); +void (*pop_from)(struct push_buffer *, +unsigned int slots); +u32 (*space)(struct push_buffer *); +u32 (*putptr)(struct push_buffer *); +}; + +struct nvhost_debug_ops { +void (*debug_init)(struct dentry *de); +void (*show_channel_cdma)(struct nvhost_master *, +struct nvhost_channel *, +struct output *, +int chid); +void (*show_channel_fifo)(struct nvhost_master *, +struct nvhost_channel *, +struct output *, +int chid); +void (*show_mlocks)(struct nvhost_master *m, +struct output *o); + +}; + +struct nvhost_syncpt_ops { +void (*reset)(struct nvhost_syncpt *,u32 id); +void (*reset_wait_base)(struct nvhost_syncpt *,u32 id); +void (*read_wait_base)(struct nvhost_syncpt *,u32 id); +u32 (*update_min)(struct nvhost_syncpt *,u32 id); +void (*cpu_incr)(struct nvhost_syncpt *,u32 id); +int (*patch_wait)(struct nvhost_syncpt *sp, +void *patch_addr); +void (*debug)(struct nvhost_syncpt *); +const char * (*name)(struct nvhost_syncpt *,u32 id); +}; + +struct nvhost_intr_ops { +void (*init_host_sync)(struct nvhost_intr *); +void (*set_host_clocks_per_usec)( +struct nvhost_intr *,u32 clocks); +void (*set_syncpt_threshold)( +struct nvhost_intr *,u32 id,u32 thresh); +void (*enable_syncpt_intr)(struct nvhost_intr *,u32 id); +void (*disable_syncpt_intr)(struct nvhost_intr *,u32 id); +void (*disable_all_syncpt_intrs)(struct nvhost_intr *); +int (*request_host_general_irq)(struct nvhost_intr *); +void (*free_host_general_irq)(struct nvhost_intr *); +int (*free_syncpt_irq)(struct nvhost_intr *); +}; + +struct nvhost_dev_ops { +struct nvhost_channel *(*alloc_nvhost_channel)( +struct platform_device *dev); +void (*free_nvhost_channel)(struct nvhost_channel *ch); +}; + +struct nvhost_mem_ops { +struct mem_mgr *(*alloc_mgr)(void ); +void (*put_mgr)(struct mem_mgr *); +struct mem_mgr *(*get_mgr)(struct mem_mgr *); +struct mem_mgr *(*get_mgr_file)(int fd); +struct mem_handle *(*alloc)(struct mem_mgr *, +size_t size,size_t align, +int flags); +struct mem_handle *(*get)(struct mem_mgr *, +u32 id,struct platform_device *); +void (*put)(struct mem_mgr *,struct mem_handle *); +struct sg_table *(*pin)(struct mem_mgr *,struct mem_handle *); +void (*unpin)(struct mem_mgr *,struct mem_handle *,struct sg_table *); +void *(*mmap)(struct mem_handle *); +void (*munmap)(struct mem_handle *,void *); +void *(*kmap)(struct mem_handle *,unsigned int ); +void (*kunmap)(struct mem_handle *,unsigned int ,void *); +int (*pin_array_ids)(struct mem_mgr *, +struct platform_device *, +long unsigned *, +dma_addr_t *, +u32 , +struct nvhost_job_unpin_data *); +}; + +struct nvhost_chip_support { +const char *soc_name; +struct nvhost_channel_ops channel; +struct nvhost_cdma_ops cdma; +struct nvhost_pushbuffer_ops push_buffer; +struct nvhost_debug_ops debug; +struct nvhost_syncpt_ops syncpt; +struct nvhost_intr_ops intr; +struct nvhost_dev_ops nvhost_dev; +struct nvhost_mem_ops mem; +}; + +struct nvhost_chip_support *nvhost_get_chip_ops (void ); + +#define host_device_op () (nvhost_get_chip_ops()->nvhost_dev) +#define channel_cdma_op () (nvhost_get_chip_ops()->cdma) +#define channel_op () (nvhost_get_chip_ops()->channel) +#define syncpt_op () (nvhost_get_chip_ops()->syncpt) +#define intr_op () (nvhost_get_chip_ops()->intr) +#define cdma_op () (nvhost_get_chip_ops()->cdma) +#define cdma_pb_op () (nvhost_get_chip_ops()->push_buffer) +#define mem_op () (nvhost_get_chip_ops()->mem) + +int nvhost_init_chip_support (struct nvhost_master *host); + +#endif /* _NVHOST_CHIP_SUPPORT_H_ */ drivers/video/tegra/host/debug.c new file +255
-0@@ -0,0 +1,255 @@ +/* +* drivers/video/tegra/host/debug.c +* +* Copyright (C) 2010 Google, Inc. +* Author: Erik Gilling <[email protected]> +* +* Copyright (C) 2011-2012 NVIDIA Corporation +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that 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 <linux/debugfs.h> +#include <linux/seq_file.h> +#include <linux/uaccess.h> + +#include <linux/io.h> + +#include "dev.h" +#include "debug.h" +#include "nvhost_acm.h" +#include "nvhost_channel.h" +#include "chip_support.h" + +pid_t nvhost_debug_null_kickoff_pid; +unsigned int nvhost_debug_trace_cmdbuf; + +pid_t nvhost_debug_force_timeout_pid; +u32 nvhost_debug_force_timeout_val; +u32 nvhost_debug_force_timeout_channel; + +void nvhost_debug_output (struct output *o,const char *fmt, ...) +{ +va_list args; +int len; + +va_start (args, fmt); + len =vsnprintf (o->buf,sizeof (o->buf), fmt, args); +va_end (args); + o->fn (o->ctx, o->buf, len); +} + +static int show_channels (struct platform_device *pdev,void *data) +{ +struct nvhost_channel *ch; +struct output *o = data; +struct nvhost_master *m; +struct nvhost_device_data *pdata; + +if (pdev ==NULL ) +return 0 ; + + pdata =platform_get_drvdata (pdev); + m =nvhost_get_host (pdev); + ch = pdata->channel; +if (ch) { +mutex_lock (&ch->reflock); +if (ch->refcount) { +mutex_lock (&ch->cdma.lock); +nvhost_get_chip_ops ()->debug.show_channel_fifo ( + m, ch, o, pdata->index); +nvhost_get_chip_ops ()->debug.show_channel_cdma ( + m, ch, o, pdata->index); +mutex_unlock (&ch->cdma.lock); + } +mutex_unlock (&ch->reflock); + } + +return 0 ; +} + +static void show_syncpts (struct nvhost_master *m,struct output *o) +{ +int i; +nvhost_debug_output (o,"---- syncpts ----\n" ); +for (i =0 ; i <nvhost_syncpt_nb_pts (&m->syncpt); i++) { +u32 max =nvhost_syncpt_read_max (&m->syncpt, i); +u32 min =nvhost_syncpt_update_min (&m->syncpt, i); +if (!min && !max) +continue ; +nvhost_debug_output (o,"id %d (%s) min %d max %d\n" , + i,nvhost_get_chip_ops ()->syncpt.name (&m->syncpt, i), + min, max); + } + +for (i =0 ; i <nvhost_syncpt_nb_bases (&m->syncpt); i++) { +u32 base_val; + base_val =nvhost_syncpt_read_wait_base (&m->syncpt, i); +if (base_val) +nvhost_debug_output (o,"waitbase id %d val %d\n" , + i, base_val); + } + +nvhost_debug_output (o,"\n" ); +} + +static void show_all (struct nvhost_master *m,struct output *o) +{ +nvhost_module_busy (m->dev); + +nvhost_get_chip_ops ()->debug.show_mlocks (m, o); +show_syncpts (m, o); +nvhost_debug_output (o,"---- channels ----\n" ); +nvhost_device_list_for_all (o, show_channels); + +nvhost_module_idle (m->dev); +} + +#ifdef CONFIG_DEBUG_FS +static int show_channels_no_fifo (struct platform_device *pdev,void *data) +{ +struct nvhost_channel *ch; +struct output *o = data; +struct nvhost_master *m; +struct nvhost_device_data *pdata; + +if (pdev ==NULL ) +return 0 ; + + pdata =platform_get_drvdata (pdev); + m =nvhost_get_host (pdev); + ch = pdata->channel; +if (ch) { +mutex_lock (&ch->reflock); +if (ch->refcount) { +mutex_lock (&ch->cdma.lock); +nvhost_get_chip_ops ()->debug.show_channel_cdma (m, + ch, o, pdata->index); +mutex_unlock (&ch->cdma.lock); + } +mutex_unlock (&ch->reflock); + } + +return 0 ; +} + +static void show_all_no_fifo (struct nvhost_master *m,struct output *o) +{ +nvhost_module_busy (m->dev); + +nvhost_get_chip_ops ()->debug.show_mlocks (m, o); +show_syncpts (m, o); +nvhost_debug_output (o,"---- channels ----\n" ); +nvhost_device_list_for_all (o, show_channels_no_fifo); + +nvhost_module_idle (m->dev); +} + +static int nvhost_debug_show_all (struct seq_file *s,void *unused) +{ +struct output o = { + .fn = write_to_seqfile, + .ctx = s + }; +show_all (s->private, &o); +return 0 ; +} + +static int nvhost_debug_show (struct seq_file *s,void *unused) +{ +struct output o = { + .fn = write_to_seqfile, + .ctx = s + }; +show_all_no_fifo (s->private, &o); +return 0 ; +} + +static int nvhost_debug_open_all (struct inode *inode,struct file *file) +{ +return single_open (file, nvhost_debug_show_all, inode->i_private); +} + +static const struct file_operations nvhost_debug_all_fops = { + .open = nvhost_debug_open_all, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +static int nvhost_debug_open (struct inode *inode,struct file *file) +{ +return single_open (file, nvhost_debug_show, inode->i_private); +} + +static const struct file_operations nvhost_debug_fops = { + .open = nvhost_debug_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +void nvhost_device_debug_init (struct platform_device *dev) +{ +struct dentry *de =NULL ; +struct nvhost_device_data *pdata =platform_get_drvdata (dev); + + de =debugfs_create_dir (dev->name, de); + + pdata->debugfs = de; +} + +void nvhost_debug_init (struct nvhost_master *master) +{ +struct nvhost_device_data *pdata; +struct dentry *de =debugfs_create_dir ("tegra_host" ,NULL ); + +if (!de) +return ; + + pdata =platform_get_drvdata (master->dev); + +/* Store the created entry */ + pdata->debugfs = de; + +debugfs_create_file ("status" ,S_IRUGO , de, + master, &nvhost_debug_fops); +debugfs_create_file ("status_all" ,S_IRUGO , de, + master, &nvhost_debug_all_fops); + +debugfs_create_u32 ("null_kickoff_pid" ,S_IRUGO |S_IWUSR , de, + &nvhost_debug_null_kickoff_pid); +debugfs_create_u32 ("trace_cmdbuf" ,S_IRUGO |S_IWUSR , de, + &nvhost_debug_trace_cmdbuf); + +if (nvhost_get_chip_ops ()->debug.debug_init) +nvhost_get_chip_ops ()->debug.debug_init (de); + +debugfs_create_u32 ("force_timeout_pid" ,S_IRUGO |S_IWUSR , de, + &nvhost_debug_force_timeout_pid); +debugfs_create_u32 ("force_timeout_val" ,S_IRUGO |S_IWUSR , de, + &nvhost_debug_force_timeout_val); +debugfs_create_u32 ("force_timeout_channel" ,S_IRUGO |S_IWUSR , de, + &nvhost_debug_force_timeout_channel); +} +#else +void nvhost_debug_init (struct nvhost_master *master) +{ +} +#endif + +void nvhost_debug_dump (struct nvhost_master *master) +{ +struct output o = { + .fn = write_to_printk + }; +show_all (master, &o); +}drivers/video/tegra/host/debug.h new file +50
-0@@ -0,0 +1,50 @@ +/* +* drivers/video/tegra/host/debug.h +* +* Tegra Graphics Host Debug +* +* Copyright (c) 2011-2012 NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ +#ifndef __NVHOST_DEBUG_H +#define __NVHOST_DEBUG_H + +#include <linux/debugfs.h> +#include <linux/seq_file.h> + +struct output { +void (*fn)(void *ctx,const char *str,size_t len); +void *ctx; +char buf[256 ]; +}; + +static inline void write_to_seqfile (void *ctx,const char *str,size_t len) +{ +seq_write ((struct seq_file *)ctx, str, len); +} + +static inline void write_to_printk (void *ctx,const char *str,size_t len) +{ +pr_info ("%s" , str); +} + +void nvhost_debug_output (struct output *o,const char *fmt, ...); + +extern pid_t nvhost_debug_null_kickoff_pid; +extern pid_t nvhost_debug_force_timeout_pid; +extern u32 nvhost_debug_force_timeout_val; +extern u32 nvhost_debug_force_timeout_channel; +extern unsigned int nvhost_debug_trace_cmdbuf; + +#endif /*__NVHOST_DEBUG_H */ drivers/video/tegra/host/dev.c new file +85
-0@@ -0,0 +1,104 @@ +/* +* drivers/video/tegra/host/dev.c +* +* Tegra Graphics Host Driver Entrypoint +* +* Copyright (c) 2010-2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#define CREATE_TRACE_POINTS +#include <trace/events/nvhost.h> + +#include <linux/module.h> +#include <linux/io.h> +#include <linux/nvhost.h> +#include <linux/list.h> +#include <linux/slab.h> + +/* host1x device list is used in 2 places: +* 1. In ioctl(NVHOST_IOCTL_CTRL_MODULE_REGRDWR) of host1x device +* 2. debug-fs dump of host1x and client device +* as well as channel state */ +struct nvhost_device_list { +struct list_head list; +struct platform_device *pdev; +}; + +/* HEAD for the host1x device list */ +static struct nvhost_device_list ndev_head; + +/* Constructor for the host1x device list */ +void nvhost_device_list_init (void ) +{ +INIT_LIST_HEAD (&ndev_head.list); +} + +/* Adds a device to tail of host1x device list */ +int nvhost_device_list_add (struct platform_device *pdev) +{ +struct nvhost_device_list *list; + + list =kzalloc (sizeof (struct nvhost_device_list ),GFP_KERNEL ); +if (!list) +return -ENOMEM ; + + list->pdev = pdev; +list_add_tail (&list->list, &ndev_head.list); + +return 0 ; +} + +/* Iterator function for host1x device list +* It takes a fptr as an argument and calls that function for each +* device in the list */ +void nvhost_device_list_for_all (void *data, +int (*fptr)(struct platform_device *pdev,void *fdata)) +{ +struct list_head *pos; +struct nvhost_device_list *nlist; +int ret; + +list_for_each (pos, &ndev_head.list) { + nlist = list_entry(pos, struct nvhost_device_list, list); +if (nlist && nlist->pdev && fptr) { + ret =fptr (nlist->pdev, data); +if (ret) { +pr_info ("%s: iterator error\n" , __func__); +break ; + } + } + } +} + +/* Removes a device from the host1x device list */
drivers/video/tegra/host/dev.c line 95
Quoted 10 lines
drivers/video/tegra/host/dev.c new file +10
-0+void nvhost_device_list_remove (struct platform_device *pdev) +{ +struct list_head *pos; +struct nvhost_device_list *nlist; + +list_for_each (pos, &ndev_head.list) { + nlist = list_entry(pos, struct nvhost_device_list, list); +if (nlist && nlist->pdev == pdev) { +list_del (&nlist->list); +kfree (nlist);
Can there be multiple matches? If yes, shouldn't you be using list_for_each_safe, instead of list_for_each? If no, then the function should return immediately? Also, I think you can use nlist instead of pos and remove calling list_entry()?
Quoted 139 lines
drivers/video/tegra/host/dev.c new file +9
-0+ } + } +} + +MODULE_AUTHOR ("Terje Bergstrom <[email protected]>" ); +MODULE_DESCRIPTION ("Graphics host driver for Tegra products" ); +MODULE_VERSION ("1.0" ); +MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform-nvhost" );drivers/video/tegra/host/dev.h new file +33
-0@@ -0,0 +1,33 @@ +/* +* drivers/video/tegra/host/dev.h +* +* Copyright (c) 2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef NVHOST_DEV_H +#define NVHOST_DEV_H + +#include "host1x/host1x.h" + +struct platform_device ; + +void nvhost_device_list_init (void ); +int nvhost_device_list_add (struct platform_device *pdev); +void nvhost_device_list_for_all (void *data, +int (*fptr)(struct platform_device *pdev,void *fdata)); +struct platform_device *nvhost_device_list_match_by_id (u32 id); +void nvhost_device_list_remove (struct platform_device *pdev); + +#endif drivers/video/tegra/host/dmabuf.c new file +85
-0@@ -0,0 +1,151 @@ +/* +* drivers/video/tegra/host/dmabuf.c +* +* Tegra Graphics Host DMA-BUF support +* +* Copyright (c) 2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <linux/dma-buf.h> +#include <linux/nvhost.h> +#include "chip_support.h" +#include "nvhost_memmgr.h" + +static inline struct dma_buf_attachment *to_dmabuf_att (struct mem_handle *h) +{ +return (struct dma_buf_attachment *)(((u32 )h) & ~0x3 ); +} + +static inline struct dma_buf *to_dmabuf (struct mem_handle *h) +{ +return to_dmabuf_att (h)->dmabuf; +} + +static inline int to_dmabuf_fd (u32 id) +{ +return nvhost_memmgr_id (id) >>2 ; +} +struct mem_handle *nvhost_dmabuf_alloc (size_t size,size_t align,int flags) +{ +/* TODO: Add allocation via DMA Mapping API */ +return NULL ; +} + +void nvhost_dmabuf_put (struct mem_handle *handle) +{ +struct dma_buf_attachment *attach =to_dmabuf_att (handle); +struct dma_buf *dmabuf = attach->dmabuf; +dma_buf_detach (dmabuf, attach); +dma_buf_put (dmabuf); +} + +struct sg_table *nvhost_dmabuf_pin (struct mem_handle *handle) +{ +return dma_buf_map_attachment (to_dmabuf_att (handle), +DMA_BIDIRECTIONAL ); +} + +void nvhost_dmabuf_unpin (struct mem_handle *handle,struct sg_table *sgt) +{ +dma_buf_unmap_attachment (to_dmabuf_att (handle), sgt,DMA_BIDIRECTIONAL ); +} + + +void *nvhost_dmabuf_mmap (struct mem_handle *handle) +{ +return dma_buf_vmap (to_dmabuf (handle)); +} + +void nvhost_dmabuf_munmap (struct mem_handle *handle,void *addr) +{ +dma_buf_vunmap (to_dmabuf (handle), addr); +} + +void *nvhost_dmabuf_kmap (struct mem_handle *handle,unsigned int pagenum) +{ +return dma_buf_kmap (to_dmabuf (handle), pagenum); +} + +void nvhost_dmabuf_kunmap (struct mem_handle *handle,unsigned int pagenum, +void *addr) +{ +dma_buf_kunmap (to_dmabuf (handle), pagenum, addr); +}
drivers/video/tegra/host/dmabuf.c line 95
Quoted 10 lines
drivers/video/tegra/host/dmabuf.c new file +10
-0+ +struct mem_handle *nvhost_dmabuf_get (u32 id,struct platform_device *dev) +{ +struct mem_handle *h; +struct dma_buf *buf; + + buf =dma_buf_get (to_dmabuf_fd (id)); +if (IS_ERR_OR_NULL (buf)) +return (struct mem_handle *)buf; +else {
Redundant 'else'
Quoted 5 lines
drivers/video/tegra/host/dmabuf.c new file +5
-0+ h = (struct mem_handle *)dma_buf_attach (buf, &dev->dev); +if (IS_ERR_OR_NULL (h)) +dma_buf_put (buf); + } +
drivers/video/tegra/host/dmabuf.c line 110
Quoted 10 lines
drivers/video/tegra/host/dmabuf.c new file +10
-0+return (struct mem_handle *) ((u32 )h | mem_mgr_type_dmabuf); +} + +int nvhost_dmabuf_pin_array_ids (struct platform_device *dev, +long unsigned *ids, +long unsigned id_type_mask, +long unsigned id_type, +u32 count, +struct nvhost_job_unpin_data *unpin_data, +dma_addr_t *phys_addr) {
Nit: wrong bracket placement
drivers/video/tegra/host/nvhost_acm.c
Quoted 3,844 lines
drivers/video/tegra/host/dmabuf.c new file +41
-0+int i; +int pin_count =0 ; +int err; + +for (i =0 ; i < count; i++) { +struct mem_handle *handle; +struct sg_table *sgt; + +if ((ids[i] & id_type_mask) != id_type) +continue ; + + handle =nvhost_dmabuf_get (ids[i], dev); + +if (IS_ERR (handle)) { + err =PTR_ERR (handle); + goto fail; + } + + sgt =nvhost_dmabuf_pin (handle); +if (IS_ERR_OR_NULL (sgt)) { +nvhost_dmabuf_put (handle); + err =PTR_ERR (sgt); + goto fail; + } + + phys_addr[i] =sg_dma_address (sgt->sgl); + + unpin_data[pin_count].h = handle; + unpin_data[pin_count].mem = sgt; + pin_count++; + } +return pin_count; +fail: +while (pin_count) { + pin_count--; +nvhost_dmabuf_unpin (unpin_data[pin_count].h, + unpin_data[pin_count].mem); +nvhost_dmabuf_put (unpin_data[pin_count].h); + } +return err; +}drivers/video/tegra/host/dmabuf.h new file +51
-0@@ -0,0 +1,51 @@ +/* +* drivers/video/tegra/host/dmabuf.h +* +* Tegra Graphics Host dmabuf memory manager +* +* Copyright (c) 2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __NVHOST_DMABUF_H +#define __NVHOST_DMABUF_H + +#include "nvhost_memmgr.h" + +struct nvhost_chip_support ; +struct platform_device ; + +struct mem_mgr *nvhost_dmabuf_alloc_mgr (void ); +void nvhost_dmabuf_put_mgr (struct mem_mgr *mgr); +struct mem_mgr *nvhost_dmabuf_get_mgr (struct mem_mgr *mgr); +struct mem_mgr *nvhost_dmabuf_get_mgr_file (int fd); +struct mem_handle *nvhost_dmabuf_alloc (struct mem_mgr *mgr, +size_t size,size_t align,int flags); +void nvhost_dmabuf_put (struct mem_handle *handle); +struct sg_table *nvhost_dmabuf_pin (struct mem_handle *handle); +void nvhost_dmabuf_unpin (struct mem_handle *handle,struct sg_table *sgt); +void *nvhost_dmabuf_mmap (struct mem_handle *handle); +void nvhost_dmabuf_munmap (struct mem_handle *handle,void *addr); +void *nvhost_dmabuf_kmap (struct mem_handle *handle,unsigned int pagenum); +void nvhost_dmabuf_kunmap (struct mem_handle *handle,unsigned int pagenum, +void *addr); +int nvhost_dmabuf_get (u32 id,struct platform_device *dev); +int nvhost_dmabuf_pin_array_ids (struct platform_device *dev, +long unsigned *ids, +long unsigned id_type_mask, +long unsigned id_type, +u32 count, +struct nvhost_job_unpin_data *unpin_data, +dma_addr_t *phys_addr); +#endif drivers/video/tegra/host/host1x/Makefile new file +6
-0@@ -0,0 +1,6 @@ +ccflags-y = -Idrivers/video/tegra/host + +nvhost-host1x-objs = \ + host1x.o + +obj-$(CONFIG_TEGRA_GRHOST) += nvhost-host1x.odrivers/video/tegra/host/host1x/host1x.c new file +320
-0@@ -0,0 +1,320 @@ +/* +* drivers/video/tegra/host/dev.c +* +* Tegra Graphics Host Driver Entrypoint +* +* Copyright (c) 2010-2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <linux/slab.h> +#include <linux/fs.h> +#include <linux/cdev.h> +#include <linux/uaccess.h> +#include <linux/file.h> +#include <linux/clk.h> +#include <linux/hrtimer.h> +#include <linux/module.h> +#include <linux/of.h> + +#include "dev.h" +#include <trace/events/nvhost.h> + +#include <linux/nvhost.h> + +#include "debug.h" +#include "bus_client.h" +#include "nvhost_acm.h" +#include "nvhost_channel.h" +#include "chip_support.h" + +#define DRIVER_NAME "tegra-host1x" + +struct nvhost_master *nvhost; + +/* public sync point API */ +u32 host1x_syncpt_incr_max (u32 id,u32 incrs) +{ +struct nvhost_syncpt *sp = &nvhost->syncpt; +return nvhost_syncpt_incr_max (sp, id, incrs); +} +EXPORT_SYMBOL (host1x_syncpt_incr_max); + +void host1x_syncpt_incr (u32 id) +{ +struct nvhost_syncpt *sp = &nvhost->syncpt; +nvhost_syncpt_incr (sp, id); +} +EXPORT_SYMBOL (host1x_syncpt_incr); + +u32 host1x_syncpt_read (u32 id) +{ +struct nvhost_syncpt *sp = &nvhost->syncpt; +return nvhost_syncpt_read (sp, id); +} +EXPORT_SYMBOL (host1x_syncpt_read); + +int host1x_syncpt_wait (u32 id,u32 thresh, +u32 timeout,u32 *value) +{ +struct nvhost_syncpt *sp = &nvhost->syncpt; +return nvhost_syncpt_wait_timeout (sp, id, thresh, timeout, value); +} +EXPORT_SYMBOL (host1x_syncpt_wait); + +struct nvhost_ctrl_userctx { +struct nvhost_master *dev; +u32 *mod_locks; +}; + +static void power_on_host (struct platform_device *dev) +{ +struct nvhost_master *host =nvhost_get_private_data (dev); + +nvhost_syncpt_reset (&host->syncpt); +} + +static int power_off_host (struct platform_device *dev) +{ +struct nvhost_master *host =nvhost_get_private_data (dev); + +nvhost_syncpt_save (&host->syncpt); +return 0 ; +} + +static void clock_on_host (struct platform_device *dev) +{ +struct nvhost_device_data *pdata =platform_get_drvdata (dev); +struct nvhost_master *host =nvhost_get_private_data (dev); +nvhost_intr_start (&host->intr,clk_get_rate (pdata->clk[0 ])); +} + +static int clock_off_host (struct platform_device *dev) +{ +struct nvhost_master *host =nvhost_get_private_data (dev); +nvhost_intr_stop (&host->intr); +return 0 ; +} + +static int __devinit nvhost_user_init (struct nvhost_master *host) +{ +int err =0 ; + + host->nvhost_class =class_create (THIS_MODULE ,IFACE_NAME ); +if (IS_ERR (host->nvhost_class)) { + err =PTR_ERR (host->nvhost_class); +dev_err (&host->dev->dev,"failed to create class\n" ); + } + +return err; +} + +struct nvhost_channel *nvhost_alloc_channel (struct platform_device *dev) +{ +return host_device_op ().alloc_nvhost_channel (dev); +} + +void nvhost_free_channel (struct nvhost_channel *ch) +{ +host_device_op ().free_nvhost_channel (ch); +} + +static void nvhost_free_resources (struct nvhost_master *host) +{ +kfree (host->intr.syncpt); + host->intr.syncpt =0 ; +} + +static int __devinit nvhost_alloc_resources (struct nvhost_master *host) +{ +int err; + + err =nvhost_init_chip_support (host); +if (err) +return err; + + host->intr.syncpt =devm_kzalloc (&host->dev->dev, +sizeof (struct nvhost_intr_syncpt ) * +nvhost_syncpt_nb_pts (&host->syncpt), +GFP_KERNEL ); + +if (!host->intr.syncpt) { +/* frees happen in the support removal phase */ +return -ENOMEM ; + } + +return 0 ; +} + +static int __devinit nvhost_probe (struct platform_device *dev) +{ +struct nvhost_master *host; +struct resource *regs, *intr0, *intr1; +int i, err; +struct nvhost_device_data *pdata = + (struct nvhost_device_data *)dev->dev.platform_data; + + regs =platform_get_resource (dev,IORESOURCE_MEM ,0 ); + intr0 =platform_get_resource (dev,IORESOURCE_IRQ ,0 ); + intr1 =platform_get_resource (dev,IORESOURCE_IRQ ,1 ); + +if (!regs || !intr0 || !intr1) { +dev_err (&dev->dev,"missing required platform resources\n" ); +return -ENXIO ; + } + + host =devm_kzalloc (&dev->dev,sizeof (*host),GFP_KERNEL ); +if (!host) +return -ENOMEM ; + + nvhost = host; + + host->dev = dev; + +/* Copy host1x parameters. The private_data gets replaced +* by nvhost_master later */ +memcpy (&host->info, pdata->private_data, +sizeof (struct host1x_device_info )); + + pdata->finalize_poweron = power_on_host; + pdata->prepare_poweroff = power_off_host; + pdata->prepare_clockoff = clock_off_host; + pdata->finalize_clockon = clock_on_host; + + pdata->pdev = dev; + +/* set common host1x device data */ +platform_set_drvdata (dev, pdata); + +/* set private host1x device data */ +nvhost_set_private_data (dev, host); + + host->aperture =devm_request_and_ioremap (&dev->dev, regs); +if (!host->aperture) { +dev_err (&dev->dev,"failed to remap host registers\n" ); + err = -ENXIO ; + goto fail; + } + + err =nvhost_alloc_resources (host); +if (err) { +dev_err (&dev->dev,"failed to init chip support\n" ); + goto fail; + } + + host->memmgr =mem_op ().alloc_mgr (); +if (!host->memmgr) { +dev_err (&dev->dev,"unable to create memory client\n" ); + err = -EIO ; + goto fail; + } + + err =nvhost_syncpt_init (dev, &host->syncpt); +if (err) + goto fail; + + err =nvhost_intr_init (&host->intr, intr1->start, intr0->start); +if (err) + goto fail; + + err =nvhost_user_init (host); +if (err) + goto fail; + + err =nvhost_module_init (dev); +if (err) + goto fail; + +for (i =0 ; i < pdata->num_clks; i++) +clk_prepare_enable (pdata->clk[i]); +nvhost_syncpt_reset (&host->syncpt); +for (i =0 ; i < pdata->num_clks; i++) +clk_disable_unprepare (pdata->clk[i]); + +nvhost_device_list_init (); + err =nvhost_device_list_add (dev); +if (err) + goto fail; + +nvhost_debug_init (host); + +dev_info (&dev->dev,"initialized\n" ); + +return 0 ; + +fail: +nvhost_free_resources (host); +if (host->memmgr) +mem_op ().put_mgr (host->memmgr); +kfree (host); +return err; +} + +static int __exit nvhost_remove(struct platform_device *dev) +{ +struct nvhost_master *host =nvhost_get_private_data (dev); +nvhost_intr_deinit (&host->intr); +nvhost_syncpt_deinit (&host->syncpt); +nvhost_free_resources (host); +return 0 ; +} + +static int nvhost_suspend (struct platform_device *dev,pm_message_t state) +{ +struct nvhost_master *host =nvhost_get_private_data (dev); +int ret =0 ; + + ret =nvhost_module_suspend (host->dev); +dev_info (&dev->dev,"suspend status: %d\n" , ret); + +return ret; +} + +static int nvhost_resume (struct platform_device *dev) +{ +dev_info (&dev->dev,"resuming\n" ); +return 0 ; +} + +static struct of_device_id host1x_match[]__devinitdata = { + { .compatible ="nvidia,tegra20-host1x" , }, + { .compatible ="nvidia,tegra30-host1x" , }, + { }, +}; + +static struct platform_driver platform_driver = { + .probe = nvhost_probe, + .remove =__exit_p (nvhost_remove), + .suspend = nvhost_suspend, + .resume = nvhost_resume, + .driver = { + .owner =THIS_MODULE , + .name =DRIVER_NAME , + .of_match_table =of_match_ptr (host1x_match), + }, +}; + +static int __init nvhost_mod_init (void ) +{ +return platform_driver_register (&platform_driver); +} + +static void __exit nvhost_mod_exit(void) +{ +platform_driver_unregister (&platform_driver); +} + +module_init (nvhost_mod_init); +module_exit (nvhost_mod_exit); +drivers/video/tegra/host/host1x/host1x.h new file +97
-0@@ -0,0 +1,97 @@ +/* +* drivers/video/tegra/host/host1x/host1x.h +* +* Tegra Graphics Host Driver Entrypoint +* +* Copyright (c) 2010-2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __NVHOST_HOST1X_H +#define __NVHOST_HOST1X_H + +#include <linux/cdev.h> +#include <linux/nvhost.h> + +#include "nvhost_syncpt.h" +#include "nvhost_intr.h" + +#define TRACE_MAX_LENGTH 128U +#define IFACE_NAME "nvhost" + +struct nvhost_channel ; +struct mem_mgr ; + +struct nvhost_master { +void __iomem *aperture; +void __iomem *sync_aperture; +struct class *nvhost_class; +struct cdev cdev; +struct device *ctrl; +struct nvhost_syncpt syncpt; +struct mem_mgr *memmgr; +struct nvhost_intr intr; +struct platform_device *dev; +atomic_t clientid; +struct host1x_device_info info; +}; + +extern struct nvhost_master *nvhost; + +void nvhost_debug_init (struct nvhost_master *master); +void nvhost_device_debug_init (struct platform_device *dev); +void nvhost_debug_dump (struct nvhost_master *master); + +struct nvhost_channel *nvhost_alloc_channel (struct platform_device *dev); +void nvhost_free_channel (struct nvhost_channel *ch); + +extern pid_t nvhost_debug_null_kickoff_pid; + +static inline void *nvhost_get_private_data (struct platform_device *_dev) +{ +struct nvhost_device_data *pdata = + (struct nvhost_device_data *)platform_get_drvdata (_dev); +WARN_ON (!pdata); +return (pdata && pdata->private_data) ? pdata->private_data :NULL ; +} + +static inline void nvhost_set_private_data (struct platform_device *_dev, +void *priv_data) +{ +struct nvhost_device_data *pdata = + (struct nvhost_device_data *)platform_get_drvdata (_dev); +WARN_ON (!pdata); +if (pdata) + pdata->private_data = priv_data; +} + +static inline +struct nvhost_master *nvhost_get_host (struct platform_device *_dev) +{ +struct platform_device *pdev; + +if (_dev->dev.parent) { + pdev =to_platform_device (_dev->dev.parent); +return nvhost_get_private_data (pdev); + }else +return nvhost_get_private_data (_dev); +} + +static inline +struct platform_device *nvhost_get_parent (struct platform_device *_dev) +{ +return _dev->dev.parent ?to_platform_device (_dev->dev.parent) :NULL ; +} + +#endif drivers/video/tegra/host/host1x/host1x01_hardware.h new file +157
-0@@ -0,0 +1,157 @@ +/* +* drivers/video/tegra/host/host1x/host1x01_hardware.h +* +* Tegra Graphics Host Register Offsets for T20/T30 +* +* Copyright (c) 2010-2012 NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __NVHOST_HOST1X01_HARDWARE_H +#define __NVHOST_HOST1X01_HARDWARE_H + +#include <linux/types.h> +#include <linux/bitops.h> +#include "hw_host1x01_channel.h" +#include "hw_host1x01_sync.h" +#include "hw_host1x01_uclass.h" + +/* channel registers */ +#define NV_HOST1X_CHANNEL_MAP_SIZE_BYTES 16384 +#define NV_HOST1X_SYNC_MLOCK_NUM 16 + +/* sync registers */ +#define HOST1X_CHANNEL_SYNC_REG_BASE 0x3000 +#define NV_HOST1X_NB_MLOCKS 16 + +static inline u32 nvhost_class_host_wait_syncpt ( +unsigned indx,unsigned threshold) +{ +return host1x_uclass_wait_syncpt_indx_f (indx) + |host1x_uclass_wait_syncpt_thresh_f (threshold); +} + +static inline u32 nvhost_class_host_load_syncpt_base ( +unsigned indx,unsigned threshold) +{ +return host1x_uclass_load_syncpt_base_base_indx_f (indx) + |host1x_uclass_load_syncpt_base_value_f (threshold); +} + +static inline u32 nvhost_class_host_wait_syncpt_base ( +unsigned indx,unsigned base_indx,unsigned offset) +{ +return host1x_uclass_wait_syncpt_base_indx_f (indx) + |host1x_uclass_wait_syncpt_base_base_indx_f (base_indx) + |host1x_uclass_wait_syncpt_base_offset_f (offset); +} + +static inline u32 nvhost_class_host_incr_syncpt_base ( +unsigned base_indx,unsigned offset) +{ +return host1x_uclass_incr_syncpt_base_base_indx_f (base_indx) + |host1x_uclass_incr_syncpt_base_offset_f (offset); +} + +static inline u32 nvhost_class_host_incr_syncpt ( +unsigned cond,unsigned indx) +{ +return host1x_uclass_incr_syncpt_cond_f (cond) + |host1x_uclass_incr_syncpt_indx_f (indx); +} + +static inline u32 nvhost_class_host_indoff_reg_write ( +unsigned mod_id,unsigned offset,bool auto_inc) +{ +u32 v =host1x_uclass_indoff_indbe_f (0xf ) + |host1x_uclass_indoff_indmodid_f (mod_id) + |host1x_uclass_indoff_indroffset_f (offset); +if (auto_inc) + v |=host1x_uclass_indoff_autoinc_f (1 ); +return v; +} + +static inline u32 nvhost_class_host_indoff_reg_read ( +unsigned mod_id,unsigned offset,bool auto_inc) +{ +u32 v =host1x_uclass_indoff_indmodid_f (mod_id) + |host1x_uclass_indoff_indroffset_f (offset) + |host1x_uclass_indoff_rwn_read_v (); +if (auto_inc) + v |=host1x_uclass_indoff_autoinc_f (1 ); +return v; +} + + +/* cdma opcodes */ +static inline u32 nvhost_opcode_setclass ( +unsigned class_id,unsigned offset,unsigned mask) +{ +return (0 <<28 ) | (offset <<16 ) | (class_id <<6 ) | mask; +} + +static inline u32 nvhost_opcode_incr (unsigned offset,unsigned count) +{ +return (1 <<28 ) | (offset <<16 ) | count; +} + +static inline u32 nvhost_opcode_nonincr (unsigned offset,unsigned count) +{ +return (2 <<28 ) | (offset <<16 ) | count; +} + +static inline u32 nvhost_opcode_mask (unsigned offset,unsigned mask) +{ +return (3 <<28 ) | (offset <<16 ) | mask; +} + +static inline u32 nvhost_opcode_imm (unsigned offset,unsigned value) +{ +return (4 <<28 ) | (offset <<16 ) | value; +} + +static inline u32 nvhost_opcode_imm_incr_syncpt (unsigned cond,unsigned indx) +{ +return nvhost_opcode_imm (host1x_uclass_incr_syncpt_r (), +nvhost_class_host_incr_syncpt (cond, indx)); +} + +static inline u32 nvhost_opcode_restart (unsigned address) +{ +return (5 <<28 ) | (address >>4 ); +} + +static inline u32 nvhost_opcode_gather (unsigned count) +{ +return (6 <<28 ) | count; +} + +static inline u32 nvhost_opcode_gather_nonincr (unsigned offset,unsigned count) +{ +return (6 <<28 ) | (offset <<16 ) |BIT (15 ) | count; +} + +static inline u32 nvhost_opcode_gather_incr (unsigned offset,unsigned count) +{ +return (6 <<28 ) | (offset <<16 ) |BIT (15 ) |BIT (14 ) | count; +} + +#define NVHOST_OPCODE_NOOP nvhost_opcode_nonincr(0, 0) + +static inline u32 nvhost_mask2 (unsigned x,unsigned y) +{ +return 1 | (1 << (y - x)); +} + +#endif drivers/video/tegra/host/host1x/host1x_cdma.c new file +488
-0@@ -0,0 +1,488 @@ +/* +* drivers/video/tegra/host/host1x/host1x_cdma.c +* +* Tegra Graphics Host Command DMA +* +* Copyright (c) 2010-2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <linux/slab.h> +#include <linux/scatterlist.h> +#include <linux/dma-mapping.h> +#include "nvhost_acm.h" +#include "nvhost_cdma.h" +#include "nvhost_channel.h" +#include "dev.h" +#include "chip_support.h" +#include "nvhost_memmgr.h" + +#include "host1x_cdma.h" + +static inline u32 host1x_channel_dmactrl (int stop,int get_rst,int init_get) +{ +return host1x_channel_dmactrl_dmastop_f (stop) + |host1x_channel_dmactrl_dmagetrst_f (get_rst) + |host1x_channel_dmactrl_dmainitget_f (init_get); +} + +static void cdma_timeout_handler (struct work_struct *work); + +/* +* push_buffer +* +* The push buffer is a circular array of words to be fetched by command DMA. +* Note that it works slightly differently to the sync queue; fence == cur +* means that the push buffer is full, not empty. +*/ + + +/** +* Reset to empty push buffer +*/ +static void push_buffer_reset (struct push_buffer *pb) +{ + pb->fence =PUSH_BUFFER_SIZE -8 ; + pb->cur =0 ; +} + +/** +* Init push buffer resources +*/ +static void push_buffer_destroy (struct push_buffer *pb); +static int push_buffer_init (struct push_buffer *pb) +{ +struct nvhost_cdma *cdma =pb_to_cdma (pb); +struct nvhost_master *master =cdma_to_dev (cdma); + pb->mapped =NULL ; + pb->phys =0 ; + pb->client_handle =NULL ; + +cdma_pb_op ().reset (pb); + +/* allocate and map pushbuffer memory */ + pb->mapped =dma_alloc_writecombine (&master->dev->dev, +PUSH_BUFFER_SIZE +4 , &pb->phys,GFP_KERNEL ); +if (IS_ERR_OR_NULL (pb->mapped)) { + pb->mapped =NULL ; + goto fail; + } + +/* memory for storing mem client and handles for each opcode pair */ + pb->client_handle =kzalloc (NVHOST_GATHER_QUEUE_SIZE * +sizeof (struct mem_mgr_handle ), +GFP_KERNEL ); +if (!pb->client_handle) + goto fail; + +/* put the restart at the end of pushbuffer memory */ + *(pb->mapped + (PUSH_BUFFER_SIZE >>2 )) = +nvhost_opcode_restart (pb->phys); + +return 0 ; + +fail: +push_buffer_destroy (pb); +return -ENOMEM ; +} + +/** +* Clean up push buffer resources +*/ +static void push_buffer_destroy (struct push_buffer *pb) +{ +struct nvhost_cdma *cdma =pb_to_cdma (pb); +struct nvhost_master *master =cdma_to_dev (cdma); + +if (pb->phys !=0 ) +dma_free_writecombine (&master->dev->dev, +PUSH_BUFFER_SIZE +4 , + pb->mapped, pb->phys); + +kfree (pb->client_handle); + + pb->mapped =NULL ; + pb->phys =0 ; + pb->client_handle =0 ; +} + +/** +* Push two words to the push buffer +* Caller must ensure push buffer is not full +*/ +static void push_buffer_push_to (struct push_buffer *pb, +struct mem_mgr *client,struct mem_handle *handle, +u32 op1,u32 op2) +{ +u32 cur = pb->cur; +u32 *p = (u32 *)((u32 )pb->mapped + cur); +u32 cur_mem = (cur/8 ) & (NVHOST_GATHER_QUEUE_SIZE -1 ); +WARN_ON (cur == pb->fence); + *(p++) = op1; + *(p++) = op2; + pb->client_handle[cur_mem].client = client; + pb->client_handle[cur_mem].handle = handle; + pb->cur = (cur +8 ) & (PUSH_BUFFER_SIZE -1 ); +} + +/** +* Pop a number of two word slots from the push buffer +* Caller must ensure push buffer is not empty +*/ +static void push_buffer_pop_from (struct push_buffer *pb, +unsigned int slots) +{ +/* Clear the mem references for old items from pb */ +unsigned int i; +u32 fence_mem = pb->fence/8 ; +for (i =0 ; i < slots; i++) { +int cur_fence_mem = (fence_mem+i) + & (NVHOST_GATHER_QUEUE_SIZE -1 ); +struct mem_mgr_handle *h = &pb->client_handle[cur_fence_mem]; + h->client =NULL ; + h->handle =NULL ; + } +/* Advance the next write position */ + pb->fence = (pb->fence + slots *8 ) & (PUSH_BUFFER_SIZE -1 ); +} + +/** +* Return the number of two word slots free in the push buffer +*/ +static u32 push_buffer_space (struct push_buffer *pb) +{ +return ((pb->fence - pb->cur) & (PUSH_BUFFER_SIZE -1 )) /8 ; +} + +static u32 push_buffer_putptr (struct push_buffer *pb) +{ +return pb->phys + pb->cur; +} + +/* +* The syncpt incr buffer is filled with methods to increment syncpts, which +* is later GATHER-ed into the mainline PB. It's used when a timed out context +* is interleaved with other work, so needs to inline the syncpt increments +* to maintain the count (but otherwise does no work). +*/ + +/** +* Init timeout resources +*/ +static int cdma_timeout_init (struct nvhost_cdma *cdma, +u32 syncpt_id) +{ +if (syncpt_id ==NVSYNCPT_INVALID ) +return -EINVAL ; + +INIT_DELAYED_WORK (&cdma->timeout.wq, cdma_timeout_handler); + cdma->timeout.initialized = true; + +return 0 ; +} + +/** +* Clean up timeout resources +*/ +static void cdma_timeout_destroy (struct nvhost_cdma *cdma) +{ +if (cdma->timeout.initialized) +cancel_delayed_work (&cdma->timeout.wq); + cdma->timeout.initialized = false; +} + +/** +* Increment timedout buffer's syncpt via CPU. +*/ +static void cdma_timeout_cpu_incr (struct nvhost_cdma *cdma,u32 getptr, +u32 syncpt_incrs,u32 syncval,u32 nr_slots) +{ +struct nvhost_master *dev =cdma_to_dev (cdma); +struct push_buffer *pb = &cdma->push_buffer; +u32 i, getidx; + +for (i =0 ; i < syncpt_incrs; i++) +nvhost_syncpt_cpu_incr (&dev->syncpt, cdma->timeout.syncpt_id); + +/* after CPU incr, ensure shadow is up to date */ +nvhost_syncpt_update_min (&dev->syncpt, cdma->timeout.syncpt_id); + +/* NOP all the PB slots */ + getidx = getptr - pb->phys; +while (nr_slots--) { +u32 *p = (u32 *)((u32 )pb->mapped + getidx); + *(p++) =NVHOST_OPCODE_NOOP ; + *(p++) =NVHOST_OPCODE_NOOP ; +dev_dbg (&dev->dev->dev,"%s: NOP at 0x%x\n" , + __func__, pb->phys + getidx); + getidx = (getidx +8 ) & (PUSH_BUFFER_SIZE -1 ); + } +wmb (); +} + +/** +* Start channel DMA +*/ +static void cdma_start (struct nvhost_cdma *cdma) +{ +void __iomem *chan_regs =cdma_to_channel (cdma)->aperture; + +if (cdma->running) +return ; + + cdma->last_put =cdma_pb_op ().putptr (&cdma->push_buffer); + +writel (host1x_channel_dmactrl (true, false, false), + chan_regs +host1x_channel_dmactrl_r ()); + +/* set base, put, end pointer (all of memory) */ +writel (0 , chan_regs +host1x_channel_dmastart_r ()); +writel (cdma->last_put, chan_regs +host1x_channel_dmaput_r ()); +writel (0xFFFFFFFF , chan_regs +host1x_channel_dmaend_r ()); + +/* reset GET */ +writel (host1x_channel_dmactrl (true, true, true), + chan_regs +host1x_channel_dmactrl_r ()); + +/* start the command DMA */ +writel (host1x_channel_dmactrl (false, false, false), + chan_regs +host1x_channel_dmactrl_r ()); + + cdma->running = true; +} + +/** +* Similar to cdma_start(), but rather than starting from an idle +* state (where DMA GET is set to DMA PUT), on a timeout we restore +* DMA GET from an explicit value (so DMA may again be pending). +*/ +static void cdma_timeout_restart (struct nvhost_cdma *cdma,u32 getptr) +{ +struct nvhost_master *dev =cdma_to_dev (cdma); +void __iomem *chan_regs =cdma_to_channel (cdma)->aperture; + +if (cdma->running) +return ; + + cdma->last_put =cdma_pb_op ().putptr (&cdma->push_buffer); + +writel (host1x_channel_dmactrl (true, false, false), + chan_regs +host1x_channel_dmactrl_r ()); + +/* set base, end pointer (all of memory) */ +writel (0 , chan_regs +host1x_channel_dmastart_r ()); +writel (0xFFFFFFFF , chan_regs +host1x_channel_dmaend_r ()); + +/* set GET, by loading the value in PUT (then reset GET) */ +writel (getptr, chan_regs +host1x_channel_dmaput_r ()); +writel (host1x_channel_dmactrl (true, true, true), + chan_regs +host1x_channel_dmactrl_r ()); + +dev_dbg (&dev->dev->dev, +"%s: DMA GET 0x%x, PUT HW 0x%x / shadow 0x%x\n" , + __func__, +readl (chan_regs +host1x_channel_dmaget_r ()), +readl (chan_regs +host1x_channel_dmaput_r ()), + cdma->last_put); + +/* deassert GET reset and set PUT */ +writel (host1x_channel_dmactrl (true, false, false), + chan_regs +host1x_channel_dmactrl_r ()); +writel (cdma->last_put, chan_regs +host1x_channel_dmaput_r ()); + +/* start the command DMA */ +writel (host1x_channel_dmactrl (false, false, false), + chan_regs +host1x_channel_dmactrl_r ()); + + cdma->running = true; +} + +/** +* Kick channel DMA into action by writing its PUT offset (if it has changed) +*/ +static void cdma_kick (struct nvhost_cdma *cdma) +{ +u32 put; + + put =cdma_pb_op ().putptr (&cdma->push_buffer); + +if (put != cdma->last_put) { +void __iomem *chan_regs =cdma_to_channel (cdma)->aperture; +writel (put, chan_regs +host1x_channel_dmaput_r ()); + cdma->last_put = put; + } +} + +static void cdma_stop (struct nvhost_cdma *cdma) +{ +void __iomem *chan_regs =cdma_to_channel (cdma)->aperture; + +mutex_lock (&cdma->lock); +if (cdma->running) { +nvhost_cdma_wait_locked (cdma,CDMA_EVENT_SYNC_QUEUE_EMPTY ); +writel (host1x_channel_dmactrl (true, false, false), + chan_regs +host1x_channel_dmactrl_r ()); + cdma->running = false; + } +mutex_unlock (&cdma->lock); +} + +/** +* Stops both channel's command processor and CDMA immediately. +* Also, tears down the channel and resets corresponding module. +*/ +static void cdma_timeout_teardown_begin (struct nvhost_cdma *cdma) +{ +struct nvhost_master *dev =cdma_to_dev (cdma); +struct nvhost_channel *ch =cdma_to_channel (cdma); +u32 cmdproc_stop; + +if (cdma->torndown && !cdma->running) { +dev_warn (&dev->dev->dev,"Already torn down\n" ); +return ; + } + +dev_dbg (&dev->dev->dev, +"begin channel teardown (channel id %d)\n" , ch->chid); + + cmdproc_stop =readl (dev->sync_aperture +host1x_sync_cmdproc_stop_r ()); + cmdproc_stop |=BIT (ch->chid); +writel (cmdproc_stop, dev->sync_aperture +host1x_sync_cmdproc_stop_r ()); + +dev_dbg (&dev->dev->dev, +"%s: DMA GET 0x%x, PUT HW 0x%x / shadow 0x%x\n" , + __func__, +readl (ch->aperture +host1x_channel_dmaget_r ()), +readl (ch->aperture +host1x_channel_dmaput_r ()), + cdma->last_put); + +writel (host1x_channel_dmactrl (true, false, false), + ch->aperture +host1x_channel_dmactrl_r ()); + +writel (BIT (ch->chid), dev->sync_aperture +host1x_sync_ch_teardown_r ()); + + cdma->running = false; + cdma->torndown = true; +} + +static void cdma_timeout_teardown_end (struct nvhost_cdma *cdma,u32 getptr) +{ +struct nvhost_master *dev =cdma_to_dev (cdma); +struct nvhost_channel *ch =cdma_to_channel (cdma); +u32 cmdproc_stop; + +dev_dbg (&dev->dev->dev, +"end channel teardown (id %d, DMAGET restart = 0x%x)\n" , + ch->chid, getptr); + + cmdproc_stop =readl (dev->sync_aperture +host1x_sync_cmdproc_stop_r ()); + cmdproc_stop &= ~(BIT (ch->chid)); +writel (cmdproc_stop, dev->sync_aperture +host1x_sync_cmdproc_stop_r ()); + + cdma->torndown = false; +cdma_timeout_restart (cdma, getptr); +} + +/** +* If this timeout fires, it indicates the current sync_queue entry has +* exceeded its TTL and the userctx should be timed out and remaining +* submits already issued cleaned up (future submits return an error). +*/ +static void cdma_timeout_handler (struct work_struct *work) +{ +struct nvhost_cdma *cdma; +struct nvhost_master *dev; +struct nvhost_syncpt *sp; +struct nvhost_channel *ch; + +u32 syncpt_val; + +u32 prev_cmdproc, cmdproc_stop; + + cdma = container_of(to_delayed_work(work), struct nvhost_cdma, + timeout.wq); + dev =cdma_to_dev (cdma); + sp = &dev->syncpt; + ch =cdma_to_channel (cdma); + +nvhost_debug_dump (cdma_to_dev (cdma)); + +mutex_lock (&cdma->lock); + +if (!cdma->timeout.clientid) { +dev_dbg (&dev->dev->dev, +"cdma_timeout: expired, but has no clientid\n" ); +mutex_unlock (&cdma->lock); +return ; + } + +/* stop processing to get a clean snapshot */ + prev_cmdproc =readl (dev->sync_aperture +host1x_sync_cmdproc_stop_r ()); + cmdproc_stop = prev_cmdproc |BIT (ch->chid); +writel (cmdproc_stop, dev->sync_aperture +host1x_sync_cmdproc_stop_r ()); + +dev_dbg (&dev->dev->dev,"cdma_timeout: cmdproc was 0x%x is 0x%x\n" , + prev_cmdproc, cmdproc_stop); + + syncpt_val =nvhost_syncpt_update_min (&dev->syncpt, + cdma->timeout.syncpt_id); + +/* has buffer actually completed? */ +if ((s32)(syncpt_val - cdma->timeout.syncpt_val) >=0 ) { +dev_dbg (&dev->dev->dev, +"cdma_timeout: expired, but buffer had completed\n" ); +/* restore */ + cmdproc_stop = prev_cmdproc & ~(BIT (ch->chid)); +writel (cmdproc_stop, + dev->sync_aperture +host1x_sync_cmdproc_stop_r ()); +mutex_unlock (&cdma->lock); +return ; + } + +dev_warn (&dev->dev->dev, +"%s: timeout: %d (%s), HW thresh %d, done %d\n" , + __func__, + cdma->timeout.syncpt_id, +syncpt_op ().name (sp, cdma->timeout.syncpt_id), + syncpt_val, cdma->timeout.syncpt_val); + +/* stop HW, resetting channel/module */ +cdma_op ().timeout_teardown_begin (cdma); + +nvhost_cdma_update_sync_queue (cdma, sp, ch->dev); +mutex_unlock (&cdma->lock); +} + +static const struct nvhost_cdma_ops host1x_cdma_ops = { + .start = cdma_start, + .stop = cdma_stop, + .kick = cdma_kick, + + .timeout_init = cdma_timeout_init, + .timeout_destroy = cdma_timeout_destroy, + .timeout_teardown_begin = cdma_timeout_teardown_begin, + .timeout_teardown_end = cdma_timeout_teardown_end, + .timeout_cpu_incr = cdma_timeout_cpu_incr, +}; + +static const struct nvhost_pushbuffer_ops host1x_pushbuffer_ops = { + .reset = push_buffer_reset, + .init = push_buffer_init, + .destroy = push_buffer_destroy, + .push_to = push_buffer_push_to, + .pop_from = push_buffer_pop_from, + .space = push_buffer_space, + .putptr = push_buffer_putptr, +}; +drivers/video/tegra/host/host1x/host1x_cdma.h new file +39
-0@@ -0,0 +1,39 @@ +/* +* drivers/video/tegra/host/host1x/host1x_cdma.h +* +* Tegra Graphics Host Command DMA +* +* Copyright (c) 2011-2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __NVHOST_HOST1X_HOST1X_CDMA_H +#define __NVHOST_HOST1X_HOST1X_CDMA_H + +/* Size of the sync queue. If it is too small, we won't be able to queue up +* many command buffers. If it is too large, we waste memory. */ +#define NVHOST_SYNC_QUEUE_SIZE 512 + +/* Number of gathers we allow to be queued up per channel. Must be a +* power of two. Currently sized such that pushbuffer is 4KB (512*8B). */ +#define NVHOST_GATHER_QUEUE_SIZE 512 + +/* 8 bytes per slot. (This number does not include the final RESTART.) */ +#define PUSH_BUFFER_SIZE (NVHOST_GATHER_QUEUE_SIZE * 8) + +/* 4K page containing GATHERed methods to increment channel syncpts +* and replaces the original timed out contexts GATHER slots */ +#define SYNCPT_INCR_BUFFER_SIZE_WORDS (4096 / sizeof(u32)) + +#endif drivers/video/tegra/host/host1x/host1x_channel.c new file +157
-0@@ -0,0 +1,157 @@ +/* +* drivers/video/tegra/host/host1x/channel_host1x.c +* +* Tegra Graphics Host Channel +* +* Copyright (c) 2010-2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <linux/nvhost.h> +#include "nvhost_channel.h" +#include "dev.h" +#include "nvhost_acm.h" +#include <trace/events/nvhost.h> +#include <linux/slab.h> +#include "nvhost_intr.h" + +#define NV_FIFO_READ_TIMEOUT 200000 + +static void submit_gathers (struct nvhost_job *job) +{ +/* push user gathers */ +int i; +for (i =0 ; i < job->num_gathers; i++) { +struct nvhost_job_gather *g = &job->gathers[i]; +u32 op1 =nvhost_opcode_gather (g->words); +u32 op2 = g->mem_base + g->offset; +nvhost_cdma_push_gather (&job->ch->cdma, + job->memmgr, + job->gathers[i].ref, + job->gathers[i].offset, + op1, op2); + } +} + +static int host1x_channel_submit (struct nvhost_job *job) +{ +struct nvhost_channel *ch = job->ch; +struct nvhost_syncpt *sp = &nvhost_get_host (job->ch->dev)->syncpt; +u32 user_syncpt_incrs = job->syncpt_incrs; +u32 prev_max =0 ; +u32 syncval; +int err; +void *completed_waiter =NULL ; +struct nvhost_device_data *pdata =platform_get_drvdata (ch->dev); + +/* Turn on the client module and host1x */ +nvhost_module_busy (ch->dev); + +/* before error checks, return current max */ + prev_max = job->syncpt_end = +nvhost_syncpt_read_max (sp, job->syncpt_id); + +/* get submit lock */ + err =mutex_lock_interruptible (&ch->submitlock); +if (err) { +nvhost_module_idle (ch->dev); + goto error; + } + + completed_waiter =nvhost_intr_alloc_waiter (); +if (!completed_waiter) { +nvhost_module_idle (ch->dev); +mutex_unlock (&ch->submitlock); + err = -ENOMEM ; + goto error; + } + +/* begin a CDMA submit */ + err =nvhost_cdma_begin (&ch->cdma, job); +if (err) { +mutex_unlock (&ch->submitlock); +nvhost_module_idle (ch->dev); + goto error; + } + +if (pdata->serialize) { +/* Force serialization by inserting a host wait for the +* previous job to finish before this one can commence. */ +nvhost_cdma_push (&ch->cdma, +nvhost_opcode_setclass (NV_HOST1X_CLASS_ID , +host1x_uclass_wait_syncpt_r (), +1 ), +nvhost_class_host_wait_syncpt (job->syncpt_id, +nvhost_syncpt_read_max (sp, + job->syncpt_id))); + } + + syncval =nvhost_syncpt_incr_max (sp, + job->syncpt_id, user_syncpt_incrs); + + job->syncpt_end = syncval; + +/* add a setclass for modules that require it */ +if (pdata->class) +nvhost_cdma_push (&ch->cdma, +nvhost_opcode_setclass (pdata->class,0 ,0 ), +NVHOST_OPCODE_NOOP ); + +submit_gathers (job); + +/* end CDMA submit & stash pinned hMems into sync queue */ +nvhost_cdma_end (&ch->cdma, job); + +trace_nvhost_channel_submitted (ch->dev->name, + prev_max, syncval); + +/* schedule a submit complete interrupt */ + err =nvhost_intr_add_action (&nvhost_get_host (ch->dev)->intr, + job->syncpt_id, syncval, +NVHOST_INTR_ACTION_SUBMIT_COMPLETE , ch, + completed_waiter, +NULL ); + completed_waiter =NULL ; +WARN (err,"Failed to set submit complete interrupt" ); + +mutex_unlock (&ch->submitlock); + +return 0 ; + +error: +kfree (completed_waiter); +return err; +} + +static inline void __iomem *host1x_channel_aperture (void __iomem *p,int ndx) +{ + p += ndx *NV_HOST1X_CHANNEL_MAP_SIZE_BYTES ; +return p; +} + +static int host1x_channel_init (struct nvhost_channel *ch, +struct nvhost_master *dev,int index) +{ + ch->chid = index; +mutex_init (&ch->reflock); +mutex_init (&ch->submitlock); + + ch->aperture =host1x_channel_aperture (dev->aperture, index); +return 0 ; +} + +static const struct nvhost_channel_ops host1x_channel_ops = { + .init = host1x_channel_init, + .submit = host1x_channel_submit, +};drivers/video/tegra/host/host1x/host1x_debug.c new file +405
-0@@ -0,0 +1,405 @@ +/* +* drivers/video/tegra/host/host1x/host1x_debug.c +* +* Copyright (C) 2010 Google, Inc. +* Author: Erik Gilling <[email protected]> +* +* Copyright (C) 2011 NVIDIA Corporation +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that 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 <linux/debugfs.h> +#include <linux/seq_file.h> +#include <linux/mm.h> +#include <linux/scatterlist.h> + +#include <linux/io.h> + +#include "dev.h" +#include "debug.h" +#include "nvhost_cdma.h" +#include "nvhost_channel.h" +#include "chip_support.h" +#include "nvhost_memmgr.h" + +#define NVHOST_DEBUG_MAX_PAGE_OFFSET 102400 + +enum { +NVHOST_DBG_STATE_CMD =0 , +NVHOST_DBG_STATE_DATA =1 , +NVHOST_DBG_STATE_GATHER =2 +}; + +static int show_channel_command (struct output *o,u32 addr,u32 val,int *count) +{ +unsigned mask; +unsigned subop; + +switch (val >>28 ) { +case 0x0 : + mask = val &0x3f ; +if (mask) { +nvhost_debug_output (o, +"SETCL(class=%03x, offset=%03x, mask=%02x, [" , + val >>6 &0x3ff , val >>16 &0xfff , mask); + *count =hweight8 (mask); +return NVHOST_DBG_STATE_DATA ; + }else { +nvhost_debug_output (o,"SETCL(class=%03x)\n" , + val >>6 &0x3ff ); +return NVHOST_DBG_STATE_CMD ; + } + +case 0x1 : +nvhost_debug_output (o,"INCR(offset=%03x, [" , + val >>16 &0xfff ); + *count = val &0xffff ; +return NVHOST_DBG_STATE_DATA ; + +case 0x2 : +nvhost_debug_output (o,"NONINCR(offset=%03x, [" , + val >>16 &0xfff ); + *count = val &0xffff ; +return NVHOST_DBG_STATE_DATA ; + +case 0x3 : + mask = val &0xffff ; +nvhost_debug_output (o,"MASK(offset=%03x, mask=%03x, [" , + val >>16 &0xfff , mask); + *count =hweight16 (mask); +return NVHOST_DBG_STATE_DATA ; + +case 0x4 : +nvhost_debug_output (o,"IMM(offset=%03x, data=%03x)\n" , + val >>16 &0xfff , val &0xffff ); +return NVHOST_DBG_STATE_CMD ; + +case 0x5 : +nvhost_debug_output (o,"RESTART(offset=%08x)\n" , val <<4 ); +return NVHOST_DBG_STATE_CMD ; + +case 0x6 : +nvhost_debug_output (o, +"GATHER(offset=%03x, insert=%d, type=%d, count=%04x, addr=[" , + val >>16 &0xfff , val >>15 &0x1 , val >>14 &0x1 , + val &0x3fff ); + *count = val &0x3fff ;/* TODO: insert */ +return NVHOST_DBG_STATE_GATHER ; + +case 0xe : + subop = val >>24 &0xf ; +if (subop ==0 ) +nvhost_debug_output (o,"ACQUIRE_MLOCK(index=%d)\n" , + val &0xff ); +else if (subop ==1 ) +nvhost_debug_output (o,"RELEASE_MLOCK(index=%d)\n" , + val &0xff ); +else +nvhost_debug_output (o,"EXTEND_UNKNOWN(%08x)\n" , val); +return NVHOST_DBG_STATE_CMD ; + +default : +return NVHOST_DBG_STATE_CMD ; + } +} + +static void show_channel_gather (struct output *o,u32 addr, +phys_addr_t phys_addr,u32 words,struct nvhost_cdma *cdma); + +static void show_channel_word (struct output *o,int *state,int *count, +u32 addr,u32 val,struct nvhost_cdma *cdma) +{ +static int start_count, dont_print; + +switch (*state) { +case NVHOST_DBG_STATE_CMD : +if (addr) +nvhost_debug_output (o,"%08x: %08x:" , addr, val); +else +nvhost_debug_output (o,"%08x:" , val); + + *state =show_channel_command (o, addr, val, count); + dont_print =0 ; + start_count = *count; +if (*state ==NVHOST_DBG_STATE_DATA && *count ==0 ) { + *state =NVHOST_DBG_STATE_CMD ; +nvhost_debug_output (o,"])\n" ); + } +break ; + +case NVHOST_DBG_STATE_DATA : + (*count)--; +if (start_count - *count <64 ) +nvhost_debug_output (o,"%08x%s" , + val, *count >0 ?", " :"])\n" ); +else if (!dont_print && (*count >0 )) { +nvhost_debug_output (o,"[truncated; %d more words]\n" , + *count); + dont_print =1 ; + } +if (*count ==0 ) + *state =NVHOST_DBG_STATE_CMD ; +break ; + +case NVHOST_DBG_STATE_GATHER : + *state =NVHOST_DBG_STATE_CMD ; +nvhost_debug_output (o,"%08x]):\n" , val); +if (cdma) { +show_channel_gather (o, addr, val, + *count, cdma); + } +break ; + } +} + +static void do_show_channel_gather (struct output *o, +phys_addr_t phys_addr, +u32 words,struct nvhost_cdma *cdma, +phys_addr_t pin_addr,u32 *map_addr) +{ +/* Map dmaget cursor to corresponding mem handle */ +u32 offset; +int state, count, i; + + offset = phys_addr - pin_addr; +/* +* Sometimes we're given different hardware address to the same +* page - in these cases the offset will get an invalid number and +* we just have to bail out. +*/ +if (offset >NVHOST_DEBUG_MAX_PAGE_OFFSET ) { +nvhost_debug_output (o,"[address mismatch]\n" ); + }else { +/* GATHER buffer starts always with commands */ + state =NVHOST_DBG_STATE_CMD ; +for (i =0 ; i < words; i++) +show_channel_word (o, &state, &count, + phys_addr + i *4 , + *(map_addr + offset/4 + i), + cdma); + } +} + +static void show_channel_gather (struct output *o,u32 addr, +phys_addr_t phys_addr, +u32 words,struct nvhost_cdma *cdma) +{ +/* Map dmaget cursor to corresponding mem handle */ +struct push_buffer *pb = &cdma->push_buffer; +u32 cur = addr - pb->phys; +struct mem_mgr_handle *mem = &pb->client_handle[cur/8 ]; +u32 *map_addr, offset; +struct sg_table *sgt; + +if (!mem || !mem->handle || !mem->client) { +nvhost_debug_output (o,"[already deallocated]\n" ); +return ; + } + + map_addr =mem_op ().mmap (mem->handle); +if (!map_addr) { +nvhost_debug_output (o,"[could not mmap]\n" ); +return ; + } + +/* Get base address from mem */ + sgt =mem_op ().pin (mem->client, mem->handle); +if (IS_ERR (sgt)) { +nvhost_debug_output (o,"[couldn't pin]\n" ); +mem_op ().munmap (mem->handle, map_addr); +return ; + } + + offset = phys_addr -sg_dma_address (sgt->sgl); +do_show_channel_gather (o, phys_addr, words, cdma, +sg_dma_address (sgt->sgl), map_addr); +mem_op ().unpin (mem->client, mem->handle, sgt); +mem_op ().munmap (mem->handle, map_addr); +} + +static void show_channel_gathers (struct output *o,struct nvhost_cdma *cdma) +{ +struct nvhost_job *job; + +list_for_each_entry (job, &cdma->sync_queue, list) { +int i; +nvhost_debug_output (o,"\n%p: JOB, syncpt_id=%d, syncpt_val=%d," +" first_get=%08x, timeout=%d" +" num_slots=%d, num_handles=%d\n" , + job, + job->syncpt_id, + job->syncpt_end, + job->first_get, + job->timeout, + job->num_slots, + job->num_unpins); + +for (i =0 ; i < job->num_gathers; i++) { +struct nvhost_job_gather *g = &job->gathers[i]; +u32 *mapped =mem_op ().mmap (g->ref); +if (!mapped) { +nvhost_debug_output (o,"[could not mmap]\n" ); +continue ; + } + +nvhost_debug_output (o, +" GATHER at %08x+%04x, %d words\n" , + g->mem_base, g->offset, g->words); + +do_show_channel_gather (o, g->mem_base + g->offset, + g->words, cdma, g->mem_base, mapped); +mem_op ().munmap (g->ref, mapped); + } + } +} + +static void host1x_debug_show_channel_cdma (struct nvhost_master *m, +struct nvhost_channel *ch,struct output *o,int chid) +{ +struct nvhost_channel *channel = ch; +struct nvhost_cdma *cdma = &channel->cdma; +u32 dmaput, dmaget, dmactrl; +u32 cbstat, cbread; +u32 val, base, baseval; +struct nvhost_device_data *pdata =platform_get_drvdata (channel->dev); + + dmaput =readl (channel->aperture +host1x_channel_dmaput_r ()); + dmaget =readl (channel->aperture +host1x_channel_dmaget_r ()); + dmactrl =readl (channel->aperture +host1x_channel_dmactrl_r ()); + cbread =readl (m->sync_aperture +host1x_sync_cbread0_r () +4 * chid); + cbstat =readl (m->sync_aperture +host1x_sync_cbstat_0_r () +4 * chid); + +nvhost_debug_output (o,"%d-%s (%d): " , chid, + channel->dev->name, + pdata->refcount); + +if (host1x_channel_dmactrl_dmastop_v (dmactrl) + || !channel->cdma.push_buffer.mapped) { +nvhost_debug_output (o,"inactive\n\n" ); +return ; + } + +switch (cbstat) { +case 0x00010008 : +nvhost_debug_output (o,"waiting on syncpt %d val %d\n" , + cbread >>24 , cbread &0xffffff ); +break ; + +case 0x00010009 : + base = (cbread >>16 ) &0xff ; + baseval =readl (m->sync_aperture + +host1x_sync_syncpt_base_0_r () +4 * base); + val = cbread &0xffff ; +nvhost_debug_output (o,"waiting on syncpt %d val %d " +"(base %d = %d; offset = %d)\n" , + cbread >>24 , baseval + val, + base, baseval, val); +break ; + +default : +nvhost_debug_output (o, +"active class %02x, offset %04x, val %08x\n" , +host1x_sync_cbstat_0_cbclass0_v (cbstat), +host1x_sync_cbstat_0_cboffset0_v (cbstat), + cbread); +break ; + } + +nvhost_debug_output (o,"DMAPUT %08x, DMAGET %08x, DMACTL %08x\n" , + dmaput, dmaget, dmactrl); +nvhost_debug_output (o,"CBREAD %08x, CBSTAT %08x\n" , cbread, cbstat); + +show_channel_gathers (o, cdma); +nvhost_debug_output (o,"\n" ); +} + +static void host1x_debug_show_channel_fifo (struct nvhost_master *m, +struct nvhost_channel *ch,struct output *o,int chid) +{ +u32 val, rd_ptr, wr_ptr, start, end; +struct nvhost_channel *channel = ch; +int state, count; + +nvhost_debug_output (o,"%d: fifo:\n" , chid); + + val =readl (channel->aperture +host1x_channel_fifostat_r ()); +nvhost_debug_output (o,"FIFOSTAT %08x\n" , val); +if (host1x_channel_fifostat_cfempty_v (val)) { +nvhost_debug_output (o,"[empty]\n" ); +return ; + } + +writel (0x0 , m->sync_aperture +host1x_sync_cfpeek_ctrl_r ()); +writel (host1x_sync_cfpeek_ctrl_cfpeek_ena_f (1 ) + |host1x_sync_cfpeek_ctrl_cfpeek_channr_f (chid), + m->sync_aperture +host1x_sync_cfpeek_ctrl_r ()); + + val =readl (m->sync_aperture +host1x_sync_cfpeek_ptrs_r ()); + rd_ptr =host1x_sync_cfpeek_ptrs_cf_rd_ptr_v (val); + wr_ptr =host1x_sync_cfpeek_ptrs_cf_wr_ptr_v (val); + + val =readl (m->sync_aperture +host1x_sync_cf0_setup_r () +4 * chid); + start =host1x_sync_cf0_setup_cf0_base_v (val); + end =host1x_sync_cf0_setup_cf0_limit_v (val); + + state =NVHOST_DBG_STATE_CMD ; + +do { +writel (0x0 , m->sync_aperture +host1x_sync_cfpeek_ctrl_r ()); +writel (host1x_sync_cfpeek_ctrl_cfpeek_ena_f (1 ) + |host1x_sync_cfpeek_ctrl_cfpeek_channr_f (chid) + |host1x_sync_cfpeek_ctrl_cfpeek_addr_f (rd_ptr), + m->sync_aperture +host1x_sync_cfpeek_ctrl_r ()); + val =readl (m->sync_aperture +host1x_sync_cfpeek_read_r ()); + +show_channel_word (o, &state, &count,0 , val,NULL ); + +if (rd_ptr == end) + rd_ptr = start; +else + rd_ptr++; + }while (rd_ptr != wr_ptr); + +if (state ==NVHOST_DBG_STATE_DATA ) +nvhost_debug_output (o,", ...])\n" ); +nvhost_debug_output (o,"\n" ); + +writel (0x0 , m->sync_aperture +host1x_sync_cfpeek_ctrl_r ()); +} + +static void host1x_debug_show_mlocks (struct nvhost_master *m,struct output *o) +{ +u32 __iomem *mlo_regs = m->sync_aperture + +host1x_sync_mlock_owner_0_r (); +int i; + +nvhost_debug_output (o,"---- mlocks ----\n" ); +for (i =0 ; i <NV_HOST1X_NB_MLOCKS ; i++) { +u32 owner =readl (mlo_regs + i); +if (host1x_sync_mlock_owner_0_mlock_ch_owns_0_v (owner)) +nvhost_debug_output (o,"%d: locked by channel %d\n" , + i, +host1x_sync_mlock_owner_0_mlock_owner_chid_0_f ( + owner)); +else if (host1x_sync_mlock_owner_0_mlock_cpu_owns_0_v (owner)) +nvhost_debug_output (o,"%d: locked by cpu\n" , i); +else +nvhost_debug_output (o,"%d: unlocked\n" , i); + } +nvhost_debug_output (o,"\n" ); +} + +static const struct nvhost_debug_ops host1x_debug_ops = { + .show_channel_cdma = host1x_debug_show_channel_cdma, + .show_channel_fifo = host1x_debug_show_channel_fifo, + .show_mlocks = host1x_debug_show_mlocks, +};drivers/video/tegra/host/host1x/host1x_intr.c new file +263
-0@@ -0,0 +1,263 @@ +/* +* drivers/video/tegra/host/host1x/host1x_intr.c +* +* Tegra Graphics Host Interrupt Management +* +* Copyright (C) 2010 Google, Inc. +* Copyright (c) 2010-2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <linux/interrupt.h> +#include <linux/irq.h> +#include <linux/io.h> +#include <asm/mach/irq.h> + +#include "nvhost_intr.h" +#include "dev.h" + +/* Spacing between sync registers */ +#define REGISTER_STRIDE 4 + +static void host1x_intr_syncpt_thresh_isr (struct nvhost_intr_syncpt *syncpt); + +static void syncpt_thresh_cascade_fn (struct work_struct *work) +{ +struct nvhost_intr_syncpt *sp = + container_of(work, struct nvhost_intr_syncpt, work); +nvhost_syncpt_thresh_fn (sp->irq, sp); +} + +static irqreturn_t syncpt_thresh_cascade_isr (int irq,void *dev_id) +{ +struct nvhost_master *dev = dev_id; +void __iomem *sync_regs = dev->sync_aperture; +struct nvhost_intr *intr = &dev->intr; +unsigned long reg; +int i, id; + +for (i =0 ; i < dev->info.nb_pts /BITS_PER_LONG ; i++) { + reg =readl (sync_regs + +host1x_sync_syncpt_thresh_cpu0_int_status_r () + + i *REGISTER_STRIDE ); +for_each_set_bit (id, ®,BITS_PER_LONG ) { +struct nvhost_intr_syncpt *sp = + intr->syncpt + (i *BITS_PER_LONG + id); +host1x_intr_syncpt_thresh_isr (sp); +queue_work (intr->wq, &sp->work); + } + } + +return IRQ_HANDLED ; +} + +static void host1x_intr_init_host_sync (struct nvhost_intr *intr) +{ +struct nvhost_master *dev =intr_to_dev (intr); +void __iomem *sync_regs = dev->sync_aperture; +int i, err, irq; + +writel (0xffffffffUL , + sync_regs +host1x_sync_syncpt_thresh_int_disable_r ()); +writel (0xffffffffUL , + sync_regs +host1x_sync_syncpt_thresh_cpu0_int_status_r ()); + +for (i =0 ; i < dev->info.nb_pts; i++) +INIT_WORK (&intr->syncpt[i].work, syncpt_thresh_cascade_fn); + + irq =platform_get_irq (dev->dev,0 ); +WARN_ON (IS_ERR_VALUE (irq)); + err =devm_request_irq (&dev->dev->dev, irq, + syncpt_thresh_cascade_isr, +IRQF_SHARED ,"host_syncpt" , dev); +WARN_ON (IS_ERR_VALUE (err)); + +/* disable the ip_busy_timeout. this prevents write drops, etc. +* there's no real way to recover from a hung client anyway. +*/ +writel (0 , sync_regs +host1x_sync_ip_busy_timeout_r ()); + +/* increase the auto-ack timout to the maximum value. 2d will hang +* otherwise on Tegra2. +*/ +writel (0xff , sync_regs +host1x_sync_ctxsw_timeout_cfg_r ()); +} + +static void host1x_intr_set_host_clocks_per_usec (struct nvhost_intr *intr, +u32 cpm) +{ +struct nvhost_master *dev =intr_to_dev (intr); +void __iomem *sync_regs = dev->sync_aperture; +/* write microsecond clock register */ +writel (cpm, sync_regs +host1x_sync_usec_clk_r ()); +} + +static void host1x_intr_set_syncpt_threshold (struct nvhost_intr *intr, +u32 id,u32 thresh) +{ +struct nvhost_master *dev =intr_to_dev (intr); +void __iomem *sync_regs = dev->sync_aperture; +writel (thresh, sync_regs + + (host1x_sync_syncpt_int_thresh_0_r () + id *REGISTER_STRIDE )); +} + +static void host1x_intr_enable_syncpt_intr (struct nvhost_intr *intr,u32 id) +{ +struct nvhost_master *dev =intr_to_dev (intr); +void __iomem *sync_regs = dev->sync_aperture; + +writel (BIT_MASK (id), sync_regs + +host1x_sync_syncpt_thresh_int_enable_cpu0_r () + +BIT_WORD (id) *REGISTER_STRIDE ); +} + +static void host1x_intr_disable_syncpt_intr (struct nvhost_intr *intr,u32 id) +{ +struct nvhost_master *dev =intr_to_dev (intr); +void __iomem *sync_regs = dev->sync_aperture; + +writel (BIT_MASK (id), sync_regs + +host1x_sync_syncpt_thresh_int_disable_r () + +BIT_WORD (id) *REGISTER_STRIDE ); + +writel (BIT_MASK (id), sync_regs + +host1x_sync_syncpt_thresh_cpu0_int_status_r () + +BIT_WORD (id) *REGISTER_STRIDE ); +} + +static void host1x_intr_disable_all_syncpt_intrs (struct nvhost_intr *intr) +{ +struct nvhost_master *dev =intr_to_dev (intr); +void __iomem *sync_regs = dev->sync_aperture; +u32 reg; + +for (reg =0 ; reg <=BIT_WORD (dev->info.nb_pts) *REGISTER_STRIDE ; + reg +=REGISTER_STRIDE ) { +writel (0xffffffffu , sync_regs + +host1x_sync_syncpt_thresh_int_disable_r () + + reg); + +writel (0xffffffffu , sync_regs + +host1x_sync_syncpt_thresh_cpu0_int_status_r () + reg); + } +} + +/** +* Sync point threshold interrupt service function +* Handles sync point threshold triggers, in interrupt context +*/ +static void host1x_intr_syncpt_thresh_isr (struct nvhost_intr_syncpt *syncpt) +{ +unsigned int id = syncpt->id; +struct nvhost_intr *intr =intr_syncpt_to_intr (syncpt); + +void __iomem *sync_regs =intr_to_dev (intr)->sync_aperture; + +u32 reg =BIT_WORD (id) *REGISTER_STRIDE ; + +writel (BIT_MASK (id), sync_regs + +host1x_sync_syncpt_thresh_int_disable_r () + reg); +writel (BIT_MASK (id), sync_regs + +host1x_sync_syncpt_thresh_cpu0_int_status_r () + reg); +} + +/** +* Host general interrupt service function +* Handles read / write failures +*/ +static irqreturn_t host1x_intr_host1x_isr (int irq,void *dev_id) +{ +struct nvhost_intr *intr = dev_id; +void __iomem *sync_regs =intr_to_dev (intr)->sync_aperture; +u32 stat; +u32 ext_stat; +u32 addr; + + stat =readl (sync_regs +host1x_sync_hintstatus_r ()); + ext_stat =readl (sync_regs +host1x_sync_hintstatus_ext_r ()); + +if (host1x_sync_hintstatus_ext_ip_read_int_v (ext_stat)) { + addr =readl (sync_regs +host1x_sync_ip_read_timeout_addr_r ()); +pr_err ("Host read timeout at address %x\n" , addr); + } + +if (host1x_sync_hintstatus_ext_ip_write_int_v (ext_stat)) { + addr =readl (sync_regs +host1x_sync_ip_write_timeout_addr_r ()); +pr_err ("Host write timeout at address %x\n" , addr); + } + +writel (ext_stat, sync_regs +host1x_sync_hintstatus_ext_r ()); +writel (stat, sync_regs +host1x_sync_hintstatus_r ()); + +return IRQ_HANDLED ; +} +static int host1x_intr_request_host_general_irq (struct nvhost_intr *intr) +{ +void __iomem *sync_regs =intr_to_dev (intr)->sync_aperture; +int err; + +/* master disable for general (not syncpt) host interrupts */ +writel (0 , sync_regs +host1x_sync_intmask_r ()); + +/* clear status & extstatus */ +writel (0xfffffffful , sync_regs +host1x_sync_hintstatus_ext_r ()); +writel (0xfffffffful , sync_regs +host1x_sync_hintstatus_r ()); + + err =request_irq (intr->host_general_irq, host1x_intr_host1x_isr,0 , +"host_status" , intr); +if (err) +return err; + +/* enable extra interrupt sources IP_READ_INT and IP_WRITE_INT */ +writel (BIT (30 ) |BIT (31 ), sync_regs +host1x_sync_hintmask_ext_r ()); + +/* enable extra interrupt sources */ +writel (BIT (12 ) |BIT (31 ), sync_regs +host1x_sync_hintmask_r ()); + +/* enable host module interrupt to CPU0 */ +writel (BIT (0 ), sync_regs +host1x_sync_intc0mask_r ()); + +/* master enable for general (not syncpt) host interrupts */ +writel (BIT (0 ), sync_regs +host1x_sync_intmask_r ()); + +return err; +} + +static void host1x_intr_free_host_general_irq (struct nvhost_intr *intr) +{ +void __iomem *sync_regs =intr_to_dev (intr)->sync_aperture; + +/* master disable for general (not syncpt) host interrupts */ +writel (0 , sync_regs +host1x_sync_intmask_r ()); + +free_irq (intr->host_general_irq, intr); +} + +static int host1x_free_syncpt_irq (struct nvhost_intr *intr) +{ +flush_workqueue (intr->wq); +return 0 ; +} +Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/host1x/host1x_syncpt.c new file +170
-0Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/host1x/hw_host1x01_channel.h new file +182
-0Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/host1x/hw_host1x01_sync.h new file +398
-0Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/host1x/hw_host1x01_uclass.h new file +474
-0Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/nvhost_acm.c new file +506
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Is this intended not to be exported?
drivers/video/tegra/host/nvhost_acm.c
Quoted 26 lines
drivers/video/tegra/host/nvhost_acm.c new file +26
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Same as above.
drivers/video/tegra/host/nvhost_channel.c
Quoted 775 lines
drivers/video/tegra/host/nvhost_acm.h new file +49
-0Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/nvhost_cdma.c new file +473
-0Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/nvhost_cdma.h new file +116
-0Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/nvhost_channel.c new file +113
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Nit: redundant else.
drivers/video/tegra/host/nvhost_channel.c
Quoted 4 lines
drivers/video/tegra/host/nvhost_channel.c new file +4
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Nit: same as above.
drivers/video/tegra/host/nvhost_job.c
Quoted 714 lines
drivers/video/tegra/host/nvhost_channel.c new file +12
-0Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/nvhost_channel.h new file +65
-0Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/nvhost_intr.c new file +391
-0Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/nvhost_intr.h new file +110
-0Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/nvhost_job.c new file +112
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
EXPORT missing?
drivers/video/tegra/host/nvhost_memmgr.c
Quoted 326 lines
drivers/video/tegra/host/nvhost_job.c new file +286
-0Lines of this file are not shown. View the raw message.
drivers/video/tegra/host/nvhost_memmgr.c new file +34
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Perhaps a little explanation would help here (as to why 1 is being returned)
drivers/video/tegra/host/nvhost_memmgr.c
Quoted 9 lines
drivers/video/tegra/host/nvhost_memmgr.c new file +9
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Statement with no effect.
drivers/video/tegra/host/nvhost_memmgr.c
Quoted 160 lines
drivers/video/tegra/host/nvhost_memmgr.c new file +160
-0Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Redundant brace.
-Sivaram
Part of the diff is not shown here. View the raw message.
Re: [PATCH 1/6] video: tegra: Add nvhost driver
In reply to a message not in the archiveOn Thu, Nov 22, 2012 at 02:16:49PM +0200, Terje Bergstrom wrote:
[...]
Quoted 1,062 lines
drivers/video/tegra/host/host1x/hw_host1x01_channel.h new file +182
-0@@ -0,0 +1,182 @@ +/* +* drivers/video/tegra/host/host1x/hw_host1x_channel_host1x.h +* +* Copyright (c) 2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +/* +* Function naming determines intended use: +* +* <x>_r(void) : Returns the offset for register <x>. +* +* <x>_w(void) : Returns the word offset for word (4 byte) element <x>. +* +* <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits. +* +* <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted +* and masked to place it at field <y> of register <x>. This value +* can be |'d with others to produce a full register value for +* register <x>. +* +* <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This +* value can be ~'d and then &'d to clear the value of field <y> for +* register <x>. +* +* <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted +* to place it at field <y> of register <x>. This value can be |'d +* with others to produce a full register value for <x>. +* +* <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register +* <x> value 'r' after being shifted to place its LSB at bit 0. +* This value is suitable for direct comparison with other unshifted +* values appropriate for use in field <y> of register <x>. +* +* <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for +* field <y> of register <x>. This value is suitable for direct +* comparison with unshifted values appropriate for use in field <y> +* of register <x>. +*/ + +#ifndef __hw_host1x_channel_host1x_h__ +#define __hw_host1x_channel_host1x_h__ +/*This file is autogenerated. Do not edit. */ + +static inline u32 host1x_channel_fifostat_r (void ) +{ +return 0x0 ; +} +static inline u32 host1x_channel_fifostat_cfempty_s (void ) +{ +return 1 ; +} +static inline u32 host1x_channel_fifostat_cfempty_f (u32 v) +{ +return (v &0x1 ) <<10 ; +} +static inline u32 host1x_channel_fifostat_cfempty_m (void ) +{ +return 0x1 <<10 ; +} +static inline u32 host1x_channel_fifostat_cfempty_v (u32 r) +{ +return (r >>10 ) &0x1 ; +} +static inline u32 host1x_channel_fifostat_cfempty_notempty_v (void ) +{ +return 0 ; +} +static inline u32 host1x_channel_fifostat_cfempty_empty_v (void ) +{ +return 1 ; +} +static inline u32 host1x_channel_fifostat_outfentries_s (void ) +{ +return 5 ; +} +static inline u32 host1x_channel_fifostat_outfentries_f (u32 v) +{ +return (v &0x1f ) <<24 ; +} +static inline u32 host1x_channel_fifostat_outfentries_m (void ) +{ +return 0x1f <<24 ; +} +static inline u32 host1x_channel_fifostat_outfentries_v (u32 r) +{ +return (r >>24 ) &0x1f ; +} +static inline u32 host1x_channel_inddata_r (void ) +{ +return 0xc ; +} +static inline u32 host1x_channel_dmastart_r (void ) +{ +return 0x14 ; +} +static inline u32 host1x_channel_dmaput_r (void ) +{ +return 0x18 ; +} +static inline u32 host1x_channel_dmaget_r (void ) +{ +return 0x1c ; +} +static inline u32 host1x_channel_dmaend_r (void ) +{ +return 0x20 ; +} +static inline u32 host1x_channel_dmactrl_r (void ) +{ +return 0x24 ; +} +static inline u32 host1x_channel_dmactrl_dmastop_s (void ) +{ +return 1 ; +} +static inline u32 host1x_channel_dmactrl_dmastop_f (u32 v) +{ +return (v &0x1 ) <<0 ; +} +static inline u32 host1x_channel_dmactrl_dmastop_m (void ) +{ +return 0x1 <<0 ; +} +static inline u32 host1x_channel_dmactrl_dmastop_v (u32 r) +{ +return (r >>0 ) &0x1 ; +} +static inline u32 host1x_channel_dmactrl_dmastop_run_v (void ) +{ +return 0 ; +} +static inline u32 host1x_channel_dmactrl_dmastop_stop_v (void ) +{ +return 1 ; +} +static inline u32 host1x_channel_dmactrl_dmagetrst_s (void ) +{ +return 1 ; +} +static inline u32 host1x_channel_dmactrl_dmagetrst_f (u32 v) +{ +return (v &0x1 ) <<1 ; +} +static inline u32 host1x_channel_dmactrl_dmagetrst_m (void ) +{ +return 0x1 <<1 ; +} +static inline u32 host1x_channel_dmactrl_dmagetrst_v (u32 r) +{ +return (r >>1 ) &0x1 ; +} +static inline u32 host1x_channel_dmactrl_dmainitget_s (void ) +{ +return 1 ; +} +static inline u32 host1x_channel_dmactrl_dmainitget_f (u32 v) +{ +return (v &0x1 ) <<2 ; +} +static inline u32 host1x_channel_dmactrl_dmainitget_m (void ) +{ +return 0x1 <<2 ; +} +static inline u32 host1x_channel_dmactrl_dmainitget_v (u32 r) +{ +return (r >>2 ) &0x1 ; +} + +#endif /* __hw_host1x_channel_host1x_h__ */ drivers/video/tegra/host/host1x/hw_host1x01_sync.h new file +398
-0@@ -0,0 +1,398 @@ +/* +* drivers/video/tegra/host/host1x/hw_host1x_sync_host1x.h +* +* Copyright (c) 2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +/* +* Function naming determines intended use: +* +* <x>_r(void) : Returns the offset for register <x>. +* +* <x>_w(void) : Returns the word offset for word (4 byte) element <x>. +* +* <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits. +* +* <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted +* and masked to place it at field <y> of register <x>. This value +* can be |'d with others to produce a full register value for +* register <x>. +* +* <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This +* value can be ~'d and then &'d to clear the value of field <y> for +* register <x>. +* +* <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted +* to place it at field <y> of register <x>. This value can be |'d +* with others to produce a full register value for <x>. +* +* <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register +* <x> value 'r' after being shifted to place its LSB at bit 0. +* This value is suitable for direct comparison with other unshifted +* values appropriate for use in field <y> of register <x>. +* +* <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for +* field <y> of register <x>. This value is suitable for direct +* comparison with unshifted values appropriate for use in field <y> +* of register <x>. +*/ + +#ifndef __hw_host1x_sync_host1x_h__ +#define __hw_host1x_sync_host1x_h__ +/*This file is autogenerated. Do not edit. */ + +static inline u32 host1x_sync_intmask_r (void ) +{ +return 0x4 ; +} +static inline u32 host1x_sync_intc0mask_r (void ) +{ +return 0x8 ; +} +static inline u32 host1x_sync_hintstatus_r (void ) +{ +return 0x20 ; +} +static inline u32 host1x_sync_hintmask_r (void ) +{ +return 0x24 ; +} +static inline u32 host1x_sync_hintstatus_ext_r (void ) +{ +return 0x28 ; +} +static inline u32 host1x_sync_hintstatus_ext_ip_read_int_s (void ) +{ +return 1 ; +} +static inline u32 host1x_sync_hintstatus_ext_ip_read_int_f (u32 v) +{ +return (v &0x1 ) <<30 ; +} +static inline u32 host1x_sync_hintstatus_ext_ip_read_int_m (void ) +{ +return 0x1 <<30 ; +} +static inline u32 host1x_sync_hintstatus_ext_ip_read_int_v (u32 r) +{ +return (r >>30 ) &0x1 ; +} +static inline u32 host1x_sync_hintstatus_ext_ip_write_int_s (void ) +{ +return 1 ; +} +static inline u32 host1x_sync_hintstatus_ext_ip_write_int_f (u32 v) +{ +return (v &0x1 ) <<31 ; +} +static inline u32 host1x_sync_hintstatus_ext_ip_write_int_m (void ) +{ +return 0x1 <<31 ; +} +static inline u32 host1x_sync_hintstatus_ext_ip_write_int_v (u32 r) +{ +return (r >>31 ) &0x1 ; +} +static inline u32 host1x_sync_hintmask_ext_r (void ) +{ +return 0x2c ; +} +static inline u32 host1x_sync_syncpt_thresh_cpu0_int_status_r (void ) +{ +return 0x40 ; +} +static inline u32 host1x_sync_syncpt_thresh_cpu1_int_status_r (void ) +{ +return 0x48 ; +} +static inline u32 host1x_sync_syncpt_thresh_int_disable_r (void ) +{ +return 0x60 ; +} +static inline u32 host1x_sync_syncpt_thresh_int_enable_cpu0_r (void ) +{ +return 0x68 ; +} +static inline u32 host1x_sync_cf0_setup_r (void ) +{ +return 0x80 ; +} +static inline u32 host1x_sync_cf0_setup_cf0_base_s (void ) +{ +return 9 ; +} +static inline u32 host1x_sync_cf0_setup_cf0_base_f (u32 v) +{ +return (v &0x1ff ) <<0 ; +} +static inline u32 host1x_sync_cf0_setup_cf0_base_m (void ) +{ +return 0x1ff <<0 ; +} +static inline u32 host1x_sync_cf0_setup_cf0_base_v (u32 r) +{ +return (r >>0 ) &0x1ff ; +} +static inline u32 host1x_sync_cf0_setup_cf0_limit_s (void ) +{ +return 9 ; +} +static inline u32 host1x_sync_cf0_setup_cf0_limit_f (u32 v) +{ +return (v &0x1ff ) <<16 ; +} +static inline u32 host1x_sync_cf0_setup_cf0_limit_m (void ) +{ +return 0x1ff <<16 ; +} +static inline u32 host1x_sync_cf0_setup_cf0_limit_v (u32 r) +{ +return (r >>16 ) &0x1ff ; +} +static inline u32 host1x_sync_cmdproc_stop_r (void ) +{ +return 0xac ; +} +static inline u32 host1x_sync_ch_teardown_r (void ) +{ +return 0xb0 ; +} +static inline u32 host1x_sync_usec_clk_r (void ) +{ +return 0x1a4 ; +} +static inline u32 host1x_sync_ctxsw_timeout_cfg_r (void ) +{ +return 0x1a8 ; +} +static inline u32 host1x_sync_ip_busy_timeout_r (void ) +{ +return 0x1bc ; +} +static inline u32 host1x_sync_ip_read_timeout_addr_r (void ) +{ +return 0x1c0 ; +} +static inline u32 host1x_sync_ip_write_timeout_addr_r (void ) +{ +return 0x1c4 ; +} +static inline u32 host1x_sync_mlock_0_r (void ) +{ +return 0x2c0 ; +} +static inline u32 host1x_sync_mlock_owner_0_r (void ) +{ +return 0x340 ; +} +static inline u32 host1x_sync_mlock_owner_0_mlock_owner_chid_0_s (void ) +{ +return 4 ; +} +static inline u32 host1x_sync_mlock_owner_0_mlock_owner_chid_0_f (u32 v) +{ +return (v &0xf ) <<8 ; +} +static inline u32 host1x_sync_mlock_owner_0_mlock_owner_chid_0_m (void ) +{ +return 0xf <<8 ; +} +static inline u32 host1x_sync_mlock_owner_0_mlock_owner_chid_0_v (u32 r) +{ +return (r >>8 ) &0xf ; +} +static inline u32 host1x_sync_mlock_owner_0_mlock_cpu_owns_0_s (void ) +{ +return 1 ; +} +static inline u32 host1x_sync_mlock_owner_0_mlock_cpu_owns_0_f (u32 v) +{ +return (v &0x1 ) <<1 ; +} +static inline u32 host1x_sync_mlock_owner_0_mlock_cpu_owns_0_m (void ) +{ +return 0x1 <<1 ; +} +static inline u32 host1x_sync_mlock_owner_0_mlock_cpu_owns_0_v (u32 r) +{ +return (r >>1 ) &0x1 ; +} +static inline u32 host1x_sync_mlock_owner_0_mlock_ch_owns_0_s (void ) +{ +return 1 ; +} +static inline u32 host1x_sync_mlock_owner_0_mlock_ch_owns_0_f (u32 v) +{ +return (v &0x1 ) <<0 ; +} +static inline u32 host1x_sync_mlock_owner_0_mlock_ch_owns_0_m (void ) +{ +return 0x1 <<0 ; +} +static inline u32 host1x_sync_mlock_owner_0_mlock_ch_owns_0_v (u32 r) +{ +return (r >>0 ) &0x1 ; +} +static inline u32 host1x_sync_syncpt_0_r (void ) +{ +return 0x400 ; +} +static inline u32 host1x_sync_syncpt_int_thresh_0_r (void ) +{ +return 0x500 ; +} +static inline u32 host1x_sync_syncpt_base_0_r (void ) +{ +return 0x600 ; +} +static inline u32 host1x_sync_syncpt_cpu_incr_r (void ) +{ +return 0x700 ; +} +static inline u32 host1x_sync_cbread0_r (void ) +{ +return 0x720 ; +} +static inline u32 host1x_sync_cfpeek_ctrl_r (void ) +{ +return 0x74c ; +} +static inline u32 host1x_sync_cfpeek_ctrl_cfpeek_addr_s (void ) +{ +return 9 ; +} +static inline u32 host1x_sync_cfpeek_ctrl_cfpeek_addr_f (u32 v) +{ +return (v &0x1ff ) <<0 ; +} +static inline u32 host1x_sync_cfpeek_ctrl_cfpeek_addr_m (void ) +{ +return 0x1ff <<0 ; +} +static inline u32 host1x_sync_cfpeek_ctrl_cfpeek_addr_v (u32 r) +{ +return (r >>0 ) &0x1ff ; +} +static inline u32 host1x_sync_cfpeek_ctrl_cfpeek_channr_s (void ) +{ +return 3 ; +} +static inline u32 host1x_sync_cfpeek_ctrl_cfpeek_channr_f (u32 v) +{ +return (v &0x7 ) <<16 ; +} +static inline u32 host1x_sync_cfpeek_ctrl_cfpeek_channr_m (void ) +{ +return 0x7 <<16 ; +} +static inline u32 host1x_sync_cfpeek_ctrl_cfpeek_channr_v (u32 r) +{ +return (r >>16 ) &0x7 ; +} +static inline u32 host1x_sync_cfpeek_ctrl_cfpeek_ena_s (void ) +{ +return 1 ; +} +static inline u32 host1x_sync_cfpeek_ctrl_cfpeek_ena_f (u32 v) +{ +return (v &0x1 ) <<31 ; +} +static inline u32 host1x_sync_cfpeek_ctrl_cfpeek_ena_m (void ) +{ +return 0x1 <<31 ; +} +static inline u32 host1x_sync_cfpeek_ctrl_cfpeek_ena_v (u32 r) +{ +return (r >>31 ) &0x1 ; +} +static inline u32 host1x_sync_cfpeek_read_r (void ) +{ +return 0x750 ; +} +static inline u32 host1x_sync_cfpeek_ptrs_r (void ) +{ +return 0x754 ; +} +static inline u32 host1x_sync_cfpeek_ptrs_cf_rd_ptr_s (void ) +{ +return 9 ; +} +static inline u32 host1x_sync_cfpeek_ptrs_cf_rd_ptr_f (u32 v) +{ +return (v &0x1ff ) <<0 ; +} +static inline u32 host1x_sync_cfpeek_ptrs_cf_rd_ptr_m (void ) +{ +return 0x1ff <<0 ; +} +static inline u32 host1x_sync_cfpeek_ptrs_cf_rd_ptr_v (u32 r) +{ +return (r >>0 ) &0x1ff ; +} +static inline u32 host1x_sync_cfpeek_ptrs_cf_wr_ptr_s (void ) +{ +return 9 ; +} +static inline u32 host1x_sync_cfpeek_ptrs_cf_wr_ptr_f (u32 v) +{ +return (v &0x1ff ) <<16 ; +} +static inline u32 host1x_sync_cfpeek_ptrs_cf_wr_ptr_m (void ) +{ +return 0x1ff <<16 ; +} +static inline u32 host1x_sync_cfpeek_ptrs_cf_wr_ptr_v (u32 r) +{ +return (r >>16 ) &0x1ff ; +} +static inline u32 host1x_sync_cbstat_0_r (void ) +{ +return 0x758 ; +} +static inline u32 host1x_sync_cbstat_0_cboffset0_s (void ) +{ +return 16 ; +} +static inline u32 host1x_sync_cbstat_0_cboffset0_f (u32 v) +{ +return (v &0xffff ) <<0 ; +} +static inline u32 host1x_sync_cbstat_0_cboffset0_m (void ) +{ +return 0xffff <<0 ; +} +static inline u32 host1x_sync_cbstat_0_cboffset0_v (u32 r) +{ +return (r >>0 ) &0xffff ; +} +static inline u32 host1x_sync_cbstat_0_cbclass0_s (void ) +{ +return 10 ; +} +static inline u32 host1x_sync_cbstat_0_cbclass0_f (u32 v) +{ +return (v &0x3ff ) <<16 ; +} +static inline u32 host1x_sync_cbstat_0_cbclass0_m (void ) +{ +return 0x3ff <<16 ; +} +static inline u32 host1x_sync_cbstat_0_cbclass0_v (u32 r) +{ +return (r >>16 ) &0x3ff ; +} + +#endif /* __hw_host1x_sync_host1x_h__ */ drivers/video/tegra/host/host1x/hw_host1x01_uclass.h new file +464
-0@@ -0,0 +1,474 @@ +/* +* drivers/video/tegra/host/host1x/hw_host1x_uclass_host1x.h +* +* Copyright (c) 2012, NVIDIA Corporation. +* +* 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. +* +* You should have received a copy of the GNU General Public License +* along with this program. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +/* +* Function naming determines intended use: +* +* <x>_r(void) : Returns the offset for register <x>. +* +* <x>_w(void) : Returns the word offset for word (4 byte) element <x>. +* +* <x>_<y>_s(void) : Returns size of field <y> of register <x> in bits. +* +* <x>_<y>_f(u32 v) : Returns a value based on 'v' which has been shifted +* and masked to place it at field <y> of register <x>. This value +* can be |'d with others to produce a full register value for +* register <x>. +* +* <x>_<y>_m(void) : Returns a mask for field <y> of register <x>. This +* value can be ~'d and then &'d to clear the value of field <y> for +* register <x>. +* +* <x>_<y>_<z>_f(void) : Returns the constant value <z> after being shifted +* to place it at field <y> of register <x>. This value can be |'d +* with others to produce a full register value for <x>. +* +* <x>_<y>_v(u32 r) : Returns the value of field <y> from a full register +* <x> value 'r' after being shifted to place its LSB at bit 0. +* This value is suitable for direct comparison with other unshifted +* values appropriate for use in field <y> of register <x>. +* +* <x>_<y>_<z>_v(void) : Returns the constant value for <z> defined for +* field <y> of register <x>. This value is suitable for direct +* comparison with unshifted values appropriate for use in field <y> +* of register <x>. +*/ + +#ifndef __hw_host1x_uclass_host1x_h__ +#define __hw_host1x_uclass_host1x_h__ +/*This file is autogenerated. Do not edit. */ + +static inline u32 host1x_uclass_incr_syncpt_r (void ) +{ +return 0x0 ; +} +static inline u32 host1x_uclass_incr_syncpt_cond_s (void ) +{ +return 8 ; +} +static inline u32 host1x_uclass_incr_syncpt_cond_f (u32 v) +{ +return (v &0xff ) <<8 ; +} +static inline u32 host1x_uclass_incr_syncpt_cond_m (void ) +{ +return 0xff <<8 ; +} +static inline u32 host1x_uclass_incr_syncpt_cond_v (u32 r) +{ +return (r >>8 ) &0xff ; +} +static inline u32 host1x_uclass_incr_syncpt_cond_immediate_v (void ) +{ +return 0 ; +} +static inline u32 host1x_uclass_incr_syncpt_cond_op_done_v (void ) +{ +return 1 ; +} +static inline u32 host1x_uclass_incr_syncpt_cond_rd_done_v (void ) +{ +return 2 ; +} +static inline u32 host1x_uclass_incr_syncpt_cond_reg_wr_safe_v (void ) +{ +return 3 ; +} +static inline u32 host1x_uclass_incr_syncpt_indx_s (void ) +{ +return 8 ; +} +static inline u32 host1x_uclass_incr_syncpt_indx_f (u32 v) +{ +return (v &0xff ) <<0 ; +} +static inline u32 host1x_uclass_incr_syncpt_indx_m (void ) +{ +return 0xff <<0 ; +} +static inline u32 host1x_uclass_incr_syncpt_indx_v (u32 r) +{ +return (r >>0 ) &0xff ; +} +static inline u32 host1x_uclass_wait_syncpt_r (void ) +{ +return 0x8 ; +} +static inline u32 host1x_uclass_wait_syncpt_indx_s (void ) +{ +return 8 ; +} +static inline u32 host1x_uclass_wait_syncpt_indx_f (u32 v) +{ +return (v &0xff ) <<24 ; +} +static inline u32 host1x_uclass_wait_syncpt_indx_m (void ) +{ +return 0xff <<24 ; +} +static inline u32 host1x_uclass_wait_syncpt_indx_v (u32 r) +{ +return (r >>24 ) &0xff ; +} +static inline u32 host1x_uclass_wait_syncpt_thresh_s (void ) +{ +return 24 ; +} +static inline u32 host1x_uclass_wait_syncpt_thresh_f (u32 v) +{ +return (v &0xffffff ) <<0 ; +} +static inline u32 host1x_uclass_wait_syncpt_thresh_m (void ) +{ +return 0xffffff <<0 ; +} +static inline u32 host1x_uclass_wait_syncpt_thresh_v (u32 r) +{ +return (r >>0 ) &0xffffff ; +} +static inline u32 host1x_uclass_wait_syncpt_base_r (void ) +{ +return 0x9 ; +} +static inline u32 host1x_uclass_wait_syncpt_base_indx_s (void ) +{ +return 8 ; +} +static inline u32 host1x_uclass_wait_syncpt_base_indx_f (u32 v) +{ +return (v &0xff ) <<24 ; +} +static inline u32 host1x_uclass_wait_syncpt_base_indx_m (void ) +{ +return 0xff <<24 ; +} +static inline u32 host1x_uclass_wait_syncpt_base_indx_v (u32 r) +{ +return (r >>24 ) &0xff ; +} +static inline u32 host1x_uclass_wait_syncpt_base_base_indx_s (void ) +{ +return 8 ; +} +static inline u32 host1x_uclass_wait_syncpt_base_base_indx_f (u32 v) +{ +return (v &0xff ) <<16 ; +} +static inline u32 host1x_uclass_wait_syncpt_base_base_indx_m (void ) +{ +return 0xff <<16 ; +} +static inline u32 host1x_uclass_wait_syncpt_base_base_indx_v (u32 r) +{ +return (r >>16 ) &0xff ; +} +static inline u32 host1x_uclass_wait_syncpt_base_offset_s (void ) +{ +return 16 ; +} +static inline u32 host1x_uclass_wait_syncpt_base_offset_f (u32 v) +{ +return (v &0xffff ) <<0 ; +} +static inline u32 host1x_uclass_wait_syncpt_base_offset_m (void ) +{ +return 0xffff <<0 ; +} +static inline u32 host1x_uclass_wait_syncpt_base_offset_v (u32 r) +{ +return (r >>0 ) &0xffff ; +} +static inline u32 host1x_uclass_load_syncpt_base_r (void ) +{ +return 0xb ; +} +static inline u32 host1x_uclass_load_syncpt_base_base_indx_s (void ) +{ +return 8 ; +} +static inline u32 host1x_uclass_load_syncpt_base_base_indx_f (u32 v) +{ +return (v &0xff ) <<24 ; +} +static inline u32 host1x_uclass_load_syncpt_base_base_indx_m (void ) +{ +return 0xff <<24 ; +} +static inline u32 host1x_uclass_load_syncpt_base_base_indx_v (u32 r) +{ +return (r >>24 ) &0xff ; +} +static inline u32 host1x_uclass_load_syncpt_base_value_s (void ) +{ +return 24 ; +} +static inline u32 host1x_uclass_load_syncpt_base_value_f (u32 v) +{ +return (v &0xffffff ) <<0 ; +} +static inline u32 host1x_uclass_load_syncpt_base_value_m (void ) +{ +return 0xffffff <<0 ; +} +static inline u32 host1x_uclass_load_syncpt_base_value_v (u32 r) +{ +return (r >>0 ) &0xffffff ; +} +static inline u32 host1x_uclass_incr_syncpt_base_r (void ) +{ +return 0xc ; +} +static inline u32 host1x_uclass_incr_syncpt_base_base_indx_s (void ) +{ +return 8 ; +} +static inline u32 host1x_uclass_incr_syncpt_base_base_indx_f (u32 v) +{ +return (v &0xff ) <<24 ; +} +static inline u32 host1x_uclass_incr_syncpt_base_base_indx_m (void ) +{ +return 0xff <<24 ; +} +static inline u32 host1x_uclass_incr_syncpt_base_base_indx_v (u32 r) +{ +return (r >>24 ) &0xff ; +} +static inline u32 host1x_uclass_incr_syncpt_base_offset_s (void ) +{ +return 24 ; +} +static inline u32 host1x_uclass_incr_syncpt_base_offset_f (u32 v) +{ +return (v &0xffffff ) <<0 ; +} +static inline u32 host1x_uclass_incr_syncpt_base_offset_m (void ) +{ +return 0xffffff <<0 ; +} +static inline u32 host1x_uclass_incr_syncpt_base_offset_v (u32 r) +{ +return (r >>0 ) &0xffffff ; +} +static inline u32 host1x_uclass_indoff_r (void ) +{ +return 0x2d ; +} +static inline u32 host1x_uclass_indoff_indbe_s (void ) +{ +return 4 ; +} +static inline u32 host1x_uclass_indoff_indbe_f (u32 v) +{ +return (v &0xf ) <<28 ; +} +static inline u32 host1x_uclass_indoff_indbe_m (void ) +{ +return 0xf <<28 ; +} +static inline u32 host1x_uclass_indoff_indbe_v (u32 r) +{ +return (r >>28 ) &0xf ; +} +static inline u32 host1x_uclass_indoff_autoinc_s (void ) +{ +return 1 ; +} +static inline u32 host1x_uclass_indoff_autoinc_f (u32 v) +{ +return (v &0x1 ) <<27 ; +} +static inline u32 host1x_uclass_indoff_autoinc_m (void ) +{ +return 0x1 <<27 ; +} +static inline u32 host1x_uclass_indoff_autoinc_v (u32 r) +{ +return (r >>27 ) &0x1 ; +} +static inline u32 host1x_uclass_indoff_spool_s (void ) +{ +return 1 ; +} +static inline u32 host1x_uclass_indoff_spool_f (u32 v) +{ +return (v &0x1 ) <<26 ; +} +static inline u32 host1x_uclass_indoff_spool_m (void ) +{ +return 0x1 <<26 ; +} +static inline u32 host1x_uclass_indoff_spool_v (u32 r) +{ +return (r >>26 ) &0x1 ; +} +static inline u32 host1x_uclass_indoff_indoffset_s (void ) +{ +return 24 ; +} +static inline u32 host1x_uclass_indoff_indoffset_f (u32 v) +{ +return (v &0xffffff ) <<2 ; +} +static inline u32 host1x_uclass_indoff_indoffset_m (void ) +{ +return 0xffffff <<2 ; +} +static inline u32 host1x_uclass_indoff_indoffset_v (u32 r) +{ +return (r >>2 ) &0xffffff ; +} +static inline u32 host1x_uclass_indoff_indmodid_s (void ) +{ +return 8 ; +} +static inline u32 host1x_uclass_indoff_indmodid_f (u32 v) +{ +return (v &0xff ) <<18 ; +} +static inline u32 host1x_uclass_indoff_indmodid_m (void ) +{ +return 0xff <<18 ; +} +static inline u32 host1x_uclass_indoff_indmodid_v (u32 r) +{ +return (r >>18 ) &0xff ; +} +static inline u32 host1x_uclass_indoff_indmodid_host1x_v (void ) +{ +return 0 ; +} +static inline u32 host1x_uclass_indoff_indmodid_mpe_v (void ) +{ +return 1 ; +} +static inline u32 host1x_uclass_indoff_indmodid_vi_v (void ) +{ +return 2 ; +} +static inline u32 host1x_uclass_indoff_indmodid_epp_v (void ) +{ +return 3 ; +} +static inline u32 host1x_uclass_indoff_indmodid_isp_v (void ) +{ +return 4 ; +} +static inline u32 host1x_uclass_indoff_indmodid_gr2d_v (void ) +{ +return 5 ; +} +static inline u32 host1x_uclass_indoff_indmodid_gr3d_v (void ) +{ +return 6 ; +} +static inline u32 host1x_uclass_indoff_indmodid_display_v (void ) +{ +return 8 ; +} +static inline u32 host1x_uclass_indoff_indmodid_tvo_v (void ) +{ +return 11 ; +} +static inline u32 host1x_uclass_indoff_indmodid_displayb_v (void ) +{ +return 9 ; +} +static inline u32 host1x_uclass_indoff_indmodid_dsi_v (void ) +{ +return 12 ; +} +static inline u32 host1x_uclass_indoff_indmodid_hdmi_v (void ) +{ +return 10 ; +} +static inline u32 host1x_uclass_indoff_indmodid_dsib_v (void ) +{ +return 16 ; +} +static inline u32 host1x_uclass_indoff_indroffset_s (void ) +{ +return 16 ; +} +static inline u32 host1x_uclass_indoff_indroffset_f (u32 v) +{ +return (v &0xffff ) <<2 ; +} +static inline u32 host1x_uclass_indoff_indroffset_m (void ) +{ +return 0xffff <<2 ; +} +static inline u32 host1x_uclass_indoff_indroffset_v (u32 r) +{ +return (r >>2 ) &0xffff ; +} +static inline u32 host1x_uclass_indoff_acctype_s (void ) +{ +return 1 ; +} +static inline u32 host1x_uclass_indoff_acctype_f (u32 v) +{ +return (v &0x1 ) <<1 ; +} +static inline u32 host1x_uclass_indoff_acctype_m (void ) +{ +return 0x1 <<1 ; +} +static inline u32 host1x_uclass_indoff_acctype_v (u32 r) +{ +return (r >>1 ) &0x1 ; +} +static inline u32 host1x_uclass_indoff_acctype_reg_v (void ) +{ +return 0 ; +} +static inline u32 host1x_uclass_indoff_acctype_fb_v (void ) +{ +return 1 ; +} +static inline u32 host1x_uclass_indoff_rwn_s (void ) +{ +return 1 ; +} +static inline u32 host1x_uclass_indoff_rwn_f (u32 v) +{ +return (v &0x1 ) <<0 ; +} +static inline u32 host1x_uclass_indoff_rwn_m (void ) +{ +return 0x1 <<0 ; +} +static inline u32 host1x_uclass_indoff_rwn_v (u32 r) +{ +return (r >>0 ) &0x1 ; +} +static inline u32 host1x_uclass_indoff_rwn_write_v (void ) +{ +return 0 ; +}
drivers/video/tegra/host/host1x/hw_host1x01_uclass.h line 474
Quoted 10 lines
drivers/video/tegra/host/host1x/hw_host1x01_uclass.h new file +10
-0+static inline u32 host1x_uclass_indoff_rwn_read_v (void ) +{ +return 1 ; +} +static inline u32 host1x_uclass_inddata_r (void ) +{ +return 0x2e ; +} + +#endif /* __hw_host1x_uclass_host1x_h__ */
[...]
This is a joke, right?
Thierry
Re: [PATCH 1/6] video: tegra: Add nvhost driver
In reply to a message not in the archiveQuoted 1 line · Thierry Reding
This is a joke, right?
Nope.
Terje
Re: [PATCH 1/6] video: tegra: Add nvhost driver
In reply to Sivaram NairQuoted 1 line · Sivaram Nair
Should this be static (considering that the below function exist)?
(...)
All your comments were valid, and I fixed the code. Thanks.
I ended up ripping away the alloc memmgr call and mem_mgr pointers in functions. We use that call in downstream for allocating an instance of nvmap, but in dmabuf case there's no client to be allocated, and thus the calls were empty.
Terje
Re: [PATCH 1/6] video: tegra: Add nvhost driver
In reply to Sivaram NairQuoted 3 lines · Sivaram Nair
Quoted 2 lines · Terje Bergstrom
Add nvhost, the driver for host1x and 2D, which is a client device for host1x.
Sivaram,
If you could please only quote the small portions of the email that you're actually replying to, that would be incredibly helpful. Just quickly paging through this email to find your comments takes whole minutes since the patch is big, and there are only perhaps 5-10 1-line comments hidden in the patch, and very easy to miss...