xref: /openbmc/linux/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gk104.c (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
133537d6fSBen Skeggs /*
233537d6fSBen Skeggs  * Copyright 2016 Red Hat Inc.
333537d6fSBen Skeggs  *
433537d6fSBen Skeggs  * Permission is hereby granted, free of charge, to any person obtaining a
533537d6fSBen Skeggs  * copy of this software and associated documentation files (the "Software"),
633537d6fSBen Skeggs  * to deal in the Software without restriction, including without limitation
733537d6fSBen Skeggs  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
833537d6fSBen Skeggs  * and/or sell copies of the Software, and to permit persons to whom the
933537d6fSBen Skeggs  * Software is furnished to do so, subject to the following conditions:
1033537d6fSBen Skeggs  *
1133537d6fSBen Skeggs  * The above copyright notice and this permission notice shall be included in
1233537d6fSBen Skeggs  * all copies or substantial portions of the Software.
1333537d6fSBen Skeggs  *
1433537d6fSBen Skeggs  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1533537d6fSBen Skeggs  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1633537d6fSBen Skeggs  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1733537d6fSBen Skeggs  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
1833537d6fSBen Skeggs  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1933537d6fSBen Skeggs  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2033537d6fSBen Skeggs  * OTHER DEALINGS IN THE SOFTWARE.
2133537d6fSBen Skeggs  *
2233537d6fSBen Skeggs  * Authors: Ben Skeggs
2333537d6fSBen Skeggs  */
2433537d6fSBen Skeggs #include "priv.h"
2533537d6fSBen Skeggs 
2633537d6fSBen Skeggs const struct nvkm_mc_map
2733537d6fSBen Skeggs gk104_mc_reset[] = {
2833537d6fSBen Skeggs 	{ 0x00000100, NVKM_ENGINE_FIFO },
29c653ab83SBen Skeggs 	{ 0x00002000, NVKM_SUBDEV_PMU, 0, true },
3033537d6fSBen Skeggs 	{}
3133537d6fSBen Skeggs };
3233537d6fSBen Skeggs 
33fe76fe49SBen Skeggs const struct nvkm_intr_data
34fe76fe49SBen Skeggs gk104_mc_intrs[] = {
35fe76fe49SBen Skeggs 	{ NVKM_ENGINE_DISP    , 0, 0, 0x04000000, true },
362fc71a05SBen Skeggs 	{ NVKM_ENGINE_FIFO    , 0, 0, 0x00000100 },
37fe76fe49SBen Skeggs 	{ NVKM_SUBDEV_PRIVRING, 0, 0, 0x40000000, true },
38fe76fe49SBen Skeggs 	{ NVKM_SUBDEV_BUS     , 0, 0, 0x10000000, true },
39fe76fe49SBen Skeggs 	{ NVKM_SUBDEV_FB      , 0, 0, 0x08002000, true },
40fe76fe49SBen Skeggs 	{ NVKM_SUBDEV_LTC     , 0, 0, 0x02000000, true },
41fe76fe49SBen Skeggs 	{ NVKM_SUBDEV_PMU     , 0, 0, 0x01000000, true },
42fe76fe49SBen Skeggs 	{ NVKM_SUBDEV_GPIO    , 0, 0, 0x00200000, true },
43fe76fe49SBen Skeggs 	{ NVKM_SUBDEV_I2C     , 0, 0, 0x00200000, true },
44fe76fe49SBen Skeggs 	{ NVKM_SUBDEV_TIMER   , 0, 0, 0x00100000, true },
45fe76fe49SBen Skeggs 	{ NVKM_SUBDEV_THERM   , 0, 0, 0x00040000, true },
46*9aa3faceSBen Skeggs 	{ NVKM_SUBDEV_TOP     , 0, 0, 0x00001000 },
47*9aa3faceSBen Skeggs 	{ NVKM_SUBDEV_TOP     , 0, 0, 0xffffefff, true },
4833537d6fSBen Skeggs 	{},
4933537d6fSBen Skeggs };
5033537d6fSBen Skeggs 
5133537d6fSBen Skeggs static const struct nvkm_mc_func
5233537d6fSBen Skeggs gk104_mc = {
5333537d6fSBen Skeggs 	.init = nv50_mc_init,
54fe76fe49SBen Skeggs 	.intr = &gt215_mc_intr,
55fe76fe49SBen Skeggs 	.intrs = gk104_mc_intrs,
56fe76fe49SBen Skeggs 	.intr_nonstall = true,
5733537d6fSBen Skeggs 	.reset = gk104_mc_reset,
58ebb195dbSBen Skeggs 	.device = &nv04_mc_device,
5933537d6fSBen Skeggs 	.unk260 = gf100_mc_unk260,
6033537d6fSBen Skeggs };
6133537d6fSBen Skeggs 
6233537d6fSBen Skeggs int
gk104_mc_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_mc ** pmc)631fc2fddfSBen Skeggs gk104_mc_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_mc **pmc)
6433537d6fSBen Skeggs {
651fc2fddfSBen Skeggs 	return nvkm_mc_new_(&gk104_mc, device, type, inst, pmc);
6633537d6fSBen Skeggs }
67