xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g98.c (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1a8c4362bSBen Skeggs /*
2a8c4362bSBen Skeggs  * Copyright 2013 Red Hat Inc.
3a8c4362bSBen Skeggs  *
4a8c4362bSBen Skeggs  * Permission is hereby granted, free of charge, to any person obtaining a
5a8c4362bSBen Skeggs  * copy of this software and associated documentation files (the "Software"),
6a8c4362bSBen Skeggs  * to deal in the Software without restriction, including without limitation
7a8c4362bSBen Skeggs  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8a8c4362bSBen Skeggs  * and/or sell copies of the Software, and to permit persons to whom the
9a8c4362bSBen Skeggs  * Software is furnished to do so, subject to the following conditions:
10a8c4362bSBen Skeggs  *
11a8c4362bSBen Skeggs  * The above copyright notice and this permission notice shall be included in
12a8c4362bSBen Skeggs  * all copies or substantial portions of the Software.
13a8c4362bSBen Skeggs  *
14a8c4362bSBen Skeggs  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15a8c4362bSBen Skeggs  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16a8c4362bSBen Skeggs  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17a8c4362bSBen Skeggs  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18a8c4362bSBen Skeggs  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19a8c4362bSBen Skeggs  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20a8c4362bSBen Skeggs  * OTHER DEALINGS IN THE SOFTWARE.
21a8c4362bSBen Skeggs  *
22a8c4362bSBen Skeggs  * Authors: Ben Skeggs
23a8c4362bSBen Skeggs  */
24a8c4362bSBen Skeggs #include "nv50.h"
25a8c4362bSBen Skeggs 
26a8c4362bSBen Skeggs #include <subdev/bios.h>
27a8c4362bSBen Skeggs #include <subdev/bios/init.h>
28a8c4362bSBen Skeggs 
29*da2b1a0aSDeepak R Varma static void
g98_devinit_disable(struct nvkm_devinit * init)308ac3f64fSBen Skeggs g98_devinit_disable(struct nvkm_devinit *init)
31a8c4362bSBen Skeggs {
328ac3f64fSBen Skeggs 	struct nvkm_device *device = init->subdev.device;
338ac3f64fSBen Skeggs 	u32 r001540 = nvkm_rd32(device, 0x001540);
348ac3f64fSBen Skeggs 	u32 r00154c = nvkm_rd32(device, 0x00154c);
35a8c4362bSBen Skeggs 
36a8c4362bSBen Skeggs 	if (!(r001540 & 0x40000000)) {
3796321606SBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_MSPDEC, 0);
38b15147bdSBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_MSVLD, 0);
3907a356bbSBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_MSPPP, 0);
40a8c4362bSBen Skeggs 	}
41a8c4362bSBen Skeggs 
42a8c4362bSBen Skeggs 	if (!(r00154c & 0x00000004))
43a7f000ecSBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
44a8c4362bSBen Skeggs 	if (!(r00154c & 0x00000020))
45b15147bdSBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_MSVLD, 0);
46a8c4362bSBen Skeggs 	if (!(r00154c & 0x00000040))
47400c2a45SBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_SEC, 0);
48a8c4362bSBen Skeggs }
49a8c4362bSBen Skeggs 
50151abd44SBen Skeggs static const struct nvkm_devinit_func
51151abd44SBen Skeggs g98_devinit = {
52151abd44SBen Skeggs 	.preinit = nv50_devinit_preinit,
53a8c4362bSBen Skeggs 	.init = nv50_devinit_init,
54151abd44SBen Skeggs 	.post = nv04_devinit_post,
55a8c4362bSBen Skeggs 	.pll_set = nv50_devinit_pll_set,
56a8c4362bSBen Skeggs 	.disable = g98_devinit_disable,
57151abd44SBen Skeggs };
58151abd44SBen Skeggs 
59151abd44SBen Skeggs int
g98_devinit_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_devinit ** pinit)604a34fd0eSBen Skeggs g98_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
61151abd44SBen Skeggs 		struct nvkm_devinit **pinit)
62151abd44SBen Skeggs {
634a34fd0eSBen Skeggs 	return nv50_devinit_new_(&g98_devinit, device, type, inst, pinit);
64151abd44SBen Skeggs }
65