xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/g84.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
g84_devinit_disable(struct nvkm_devinit * init)308ac3f64fSBen Skeggs g84_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)) {
37e5e95a76SBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_MPEG, 0);
38fcc08a7cSBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_VP, 0);
39fcc08a7cSBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_BSP, 0);
400b26ca68SBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_CIPHER, 0);
41a8c4362bSBen Skeggs 	}
42a8c4362bSBen Skeggs 
43a8c4362bSBen Skeggs 	if (!(r00154c & 0x00000004))
44a7f000ecSBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_DISP, 0);
45a8c4362bSBen Skeggs 	if (!(r00154c & 0x00000020))
46fcc08a7cSBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_BSP, 0);
47a8c4362bSBen Skeggs 	if (!(r00154c & 0x00000040))
480b26ca68SBen Skeggs 		nvkm_subdev_disable(device, NVKM_ENGINE_CIPHER, 0);
49a8c4362bSBen Skeggs }
50a8c4362bSBen Skeggs 
51151abd44SBen Skeggs static const struct nvkm_devinit_func
52151abd44SBen Skeggs g84_devinit = {
53151abd44SBen Skeggs 	.preinit = nv50_devinit_preinit,
54a8c4362bSBen Skeggs 	.init = nv50_devinit_init,
55151abd44SBen Skeggs 	.post = nv04_devinit_post,
56a8c4362bSBen Skeggs 	.pll_set = nv50_devinit_pll_set,
57a8c4362bSBen Skeggs 	.disable = g84_devinit_disable,
58151abd44SBen Skeggs };
59151abd44SBen Skeggs 
60151abd44SBen Skeggs int
g84_devinit_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_devinit ** pinit)614a34fd0eSBen Skeggs g84_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_(&g84_devinit, device, type, inst, pinit);
65151abd44SBen Skeggs }
66