From 1859542c94d23b3cd39ee0040cf05c4b710a78da Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 3 Mar 2016 14:15:16 +0530 Subject: [PATCH] gpu: host1x: API to load streamid registers Define host1x_dev_ops for T186 Add API load_streamid_regs() to load streamid registers Set this API to host1x_dev_ops.load_regs so that we set streamid registers during host1x_probe() Add a static table which includes streamid mappings for all the clients Bug 1704301 Change-Id: I7aeefc43776472a7ccf868bfa18c810f3b80b52b Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1023438 Reviewed-by: Arto Merilainen GVS: Gerrit_Virtual_Submit Reviewed-by: Shridhar Rasal --- drivers/gpu/host1x/hw/host1x05.c | 2 + drivers/gpu/host1x/hw/stremid_hw_t186.c | 95 +++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 drivers/gpu/host1x/hw/stremid_hw_t186.c diff --git a/drivers/gpu/host1x/hw/host1x05.c b/drivers/gpu/host1x/hw/host1x05.c index db64e7cf..3a790bee 100644 --- a/drivers/gpu/host1x/hw/host1x05.c +++ b/drivers/gpu/host1x/hw/host1x05.c @@ -24,11 +24,13 @@ #include "debug_hw_t186.c" #include "intr_hw_t186.c" #include "syncpt_hw_t186.c" +#include "stremid_hw_t186.c" #include "dev.h" int host1x05_init(struct host1x *host) { + host->dev_op = &host1x_dev_t186_ops; host->channel_op = &host1x_channel_t186_ops; host->cdma_op = &host1x_cdma_t186_ops; host->cdma_pb_op = &host1x_pushbuffer_t186_ops; diff --git a/drivers/gpu/host1x/hw/stremid_hw_t186.c b/drivers/gpu/host1x/hw/stremid_hw_t186.c new file mode 100644 index 00000000..9f4c3685 --- /dev/null +++ b/drivers/gpu/host1x/hw/stremid_hw_t186.c @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2016, 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 . + */ + + +#include "dev_t186.h" + +struct host1x_streamid_mapping { + u32 host1x_offset; + u32 client_offset; + u32 client_limit; +}; + +static struct host1x_streamid_mapping __attribute__((__unused__)) + t18x_host1x_streamid_mapping[] = { + /* HOST1X_THOST_COMMON_SE1_STRMID_0_OFFSET_BASE_0 */ + { 0x00001ac8, 0x00000090, 0x00000090}, + /* HOST1X_THOST_COMMON_SE2_STRMID_0_OFFSET_BASE_0 */ + { 0x00001ad0, 0x00000090, 0x00000090}, + /* HOST1X_THOST_COMMON_SE3_STRMID_0_OFFSET_BASE_0 */ + { 0x00001ad8, 0x00000090, 0x00000090}, + /* HOST1X_THOST_COMMON_SE4_STRMID_0_OFFSET_BASE_0 */ + { 0x00001ae0, 0x00000090, 0x00000090}, + /* HOST1X_THOST_COMMON_ISP_STRMID_0_OFFSET_BASE_0 */ + { 0x00001ae8, 0x00000050, 0x00000050}, + /* HOST1X_THOST_COMMON_VIC_STRMID_0_OFFSET_BASE_0 */ + { 0x00001af0, 0x00000030, 0x00000034}, + /* HOST1X_THOST_COMMON_NVENC_STRMID_0_OFFSET_BASE_0 */ + { 0x00001af8, 0x00000030, 0x00000034}, + /* HOST1X_THOST_COMMON_NVDEC_STRMID_0_OFFSET_BASE_0 */ + { 0x00001b00, 0x00000030, 0x00000034}, + /* HOST1X_THOST_COMMON_NVJPG_STRMID_0_OFFSET_BASE_0 */ + { 0x00001b08, 0x00000030, 0x00000034}, + /* HOST1X_THOST_COMMON_TSEC_STRMID_0_OFFSET_BASE_0 */ + { 0x00001b10, 0x00000030, 0x00000034}, + /* HOST1X_THOST_COMMON_TSECB_STRMID_0_OFFSET_BASE_0 */ + { 0x00001b18, 0x00000030, 0x00000034}, + /* HOST1X_THOST_COMMON_VI_STRMID_0_OFFSET_BASE_0 */ + { 0x00001b80, 0x00010000, 0x00010000}, + /* HOST1X_THOST_COMMON_VI_STRMID_1_OFFSET_BASE_0 */ + { 0x00001b88, 0x00020000, 0x00020000}, + /* HOST1X_THOST_COMMON_VI_STRMID_2_OFFSET_BASE_0 */ + { 0x00001b90, 0x00030000, 0x00030000}, + /* HOST1X_THOST_COMMON_VI_STRMID_3_OFFSET_BASE_0 */ + { 0x00001b98, 0x00040000, 0x00040000}, + /* HOST1X_THOST_COMMON_VI_STRMID_4_OFFSET_BASE_0 */ + { 0x00001ba0, 0x00050000, 0x00050000}, + /* HOST1X_THOST_COMMON_VI_STRMID_5_OFFSET_BASE_0 */ + { 0x00001ba8, 0x00060000, 0x00060000}, + /* HOST1X_THOST_COMMON_VI_STRMID_6_OFFSET_BASE_0 */ + { 0x00001bb0, 0x00070000, 0x00070000}, + /* HOST1X_THOST_COMMON_VI_STRMID_7_OFFSET_BASE_0 */ + { 0x00001bb8, 0x00080000, 0x00080000}, + /* HOST1X_THOST_COMMON_VI_STRMID_8_OFFSET_BASE_0 */ + { 0x00001bc0, 0x00090000, 0x00090000}, + /* HOST1X_THOST_COMMON_VI_STRMID_9_OFFSET_BASE_0 */ + { 0x00001bc8, 0x000a0000, 0x000a0000}, + /* HOST1X_THOST_COMMON_VI_STRMID_10_OFFSET_BASE_0 */ + { 0x00001bd0, 0x000b0000, 0x000b0000}, + /* HOST1X_THOST_COMMON_VI_STRMID_11_OFFSET_BASE_0 */ + { 0x00001bd8, 0x000c0000, 0x000c0000}, + {}, +}; + +static int load_streamid_regs(struct host1x *host) +{ + struct host1x_streamid_mapping *map_regs = t18x_host1x_streamid_mapping; + + while (map_regs->host1x_offset) { + host1x_writel(host, map_regs->client_offset, + map_regs->host1x_offset); + host1x_writel(host, map_regs->client_limit, + map_regs->host1x_offset + sizeof(u32)); + + map_regs++; + } + + return 0; +} + +static const struct host1x_dev_ops host1x_dev_t186_ops = { + .load_regs = load_streamid_regs, +};