1c39f472eSBen Skeggs /*
2c39f472eSBen Skeggs  * Copyright 2013 Red Hat Inc.
3c39f472eSBen Skeggs  *
4c39f472eSBen Skeggs  * Permission is hereby granted, free of charge, to any person obtaining a
5c39f472eSBen Skeggs  * copy of this software and associated documentation files (the "Software"),
6c39f472eSBen Skeggs  * to deal in the Software without restriction, including without limitation
7c39f472eSBen Skeggs  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8c39f472eSBen Skeggs  * and/or sell copies of the Software, and to permit persons to whom the
9c39f472eSBen Skeggs  * Software is furnished to do so, subject to the following conditions:
10c39f472eSBen Skeggs  *
11c39f472eSBen Skeggs  * The above copyright notice and this permission notice shall be included in
12c39f472eSBen Skeggs  * all copies or substantial portions of the Software.
13c39f472eSBen Skeggs  *
14c39f472eSBen Skeggs  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15c39f472eSBen Skeggs  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16c39f472eSBen Skeggs  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17c39f472eSBen Skeggs  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18c39f472eSBen Skeggs  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19c39f472eSBen Skeggs  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20c39f472eSBen Skeggs  * OTHER DEALINGS IN THE SOFTWARE.
21c39f472eSBen Skeggs  *
22c39f472eSBen Skeggs  * Authors: Ben Skeggs
23c39f472eSBen Skeggs  */
24c39f472eSBen Skeggs #include "nv50.h"
25c39f472eSBen Skeggs 
26a8c4362bSBen Skeggs #include <subdev/bios.h>
27a8c4362bSBen Skeggs #include <subdev/bios/init.h>
28a8c4362bSBen Skeggs 
29c39f472eSBen Skeggs u64
308ac3f64fSBen Skeggs gm107_devinit_disable(struct nvkm_devinit *init)
31c39f472eSBen Skeggs {
328ac3f64fSBen Skeggs 	struct nvkm_device *device = init->subdev.device;
338ac3f64fSBen Skeggs 	u32 r021c00 = nvkm_rd32(device, 0x021c00);
348ac3f64fSBen Skeggs 	u32 r021c04 = nvkm_rd32(device, 0x021c04);
35c39f472eSBen Skeggs 	u64 disable = 0ULL;
36c39f472eSBen Skeggs 
37c39f472eSBen Skeggs 	if (r021c00 & 0x00000001)
38aedf24ffSBen Skeggs 		disable |= (1ULL << NVDEV_ENGINE_CE0);
39c39f472eSBen Skeggs 	if (r021c00 & 0x00000004)
40aedf24ffSBen Skeggs 		disable |= (1ULL << NVDEV_ENGINE_CE2);
41c39f472eSBen Skeggs 	if (r021c04 & 0x00000001)
42c39f472eSBen Skeggs 		disable |= (1ULL << NVDEV_ENGINE_DISP);
43c39f472eSBen Skeggs 
44c39f472eSBen Skeggs 	return disable;
45c39f472eSBen Skeggs }
46c39f472eSBen Skeggs 
47a8c4362bSBen Skeggs struct nvkm_oclass *
48a8c4362bSBen Skeggs gm107_devinit_oclass = &(struct nvkm_devinit_impl) {
49c39f472eSBen Skeggs 	.base.handle = NV_SUBDEV(DEVINIT, 0x07),
50a8c4362bSBen Skeggs 	.base.ofuncs = &(struct nvkm_ofuncs) {
514d4d6f75SBen Skeggs 		.ctor = gf100_devinit_ctor,
52a8c4362bSBen Skeggs 		.dtor = _nvkm_devinit_dtor,
53c39f472eSBen Skeggs 		.init = nv50_devinit_init,
54a8c4362bSBen Skeggs 		.fini = _nvkm_devinit_fini,
55c39f472eSBen Skeggs 	},
56a8c4362bSBen Skeggs 	.pll_set = gf100_devinit_pll_set,
57c39f472eSBen Skeggs 	.disable = gm107_devinit_disable,
58c39f472eSBen Skeggs 	.post = nvbios_init,
59c39f472eSBen Skeggs }.base;
60