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
mcp89_devinit_disable(struct nvkm_devinit * init)308ac3f64fSBen Skeggs mcp89_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);
3807a356bbSBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_MSPPP, 0);
39a8c4362bSBen Skeggs 	}
40a8c4362bSBen Skeggs 
41a8c4362bSBen Skeggs 	if (!(r00154c & 0x00000004))
42a7f000ecSBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
43a8c4362bSBen Skeggs 	if (!(r00154c & 0x00000020))
44b15147bdSBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_MSVLD, 0);
45a8c4362bSBen Skeggs 	if (!(r00154c & 0x00000040))
460fa5680cSBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_VIC, 0);
47a8c4362bSBen Skeggs 	if (!(r00154c & 0x00000200))
4850551b15SBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_CE, 0);
49a8c4362bSBen Skeggs }
50a8c4362bSBen Skeggs 
51151abd44SBen Skeggs static const struct nvkm_devinit_func
52151abd44SBen Skeggs mcp89_devinit = {
53151abd44SBen Skeggs 	.preinit = nv50_devinit_preinit,
54a8c4362bSBen Skeggs 	.init = nv50_devinit_init,
55151abd44SBen Skeggs 	.post = nv04_devinit_post,
56a8c4362bSBen Skeggs 	.pll_set = gt215_devinit_pll_set,
57a8c4362bSBen Skeggs 	.disable = mcp89_devinit_disable,
58151abd44SBen Skeggs };
59151abd44SBen Skeggs 
60151abd44SBen Skeggs int
mcp89_devinit_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_devinit ** pinit)614a34fd0eSBen Skeggs mcp89_devinit_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
62151abd44SBen Skeggs 		  struct nvkm_devinit **pinit)
63151abd44SBen Skeggs {
644a34fd0eSBen Skeggs 	return nv50_devinit_new_(&mcp89_devinit, device, type, inst, pinit);
65151abd44SBen Skeggs }
66