1c39f472eSBen Skeggs /*
2c39f472eSBen Skeggs * Copyright 2012 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 "priv.h"
25c39f472eSBen Skeggs
2670bc7182SBen Skeggs static void
gk104_ltc_init(struct nvkm_ltc * ltc)2770bc7182SBen Skeggs gk104_ltc_init(struct nvkm_ltc *ltc)
28c39f472eSBen Skeggs {
2970bc7182SBen Skeggs struct nvkm_device *device = ltc->subdev.device;
3099336ed3SBen Skeggs u32 lpg128 = !(nvkm_rd32(device, 0x100c80) & 0x00000001);
31c39f472eSBen Skeggs
3299336ed3SBen Skeggs nvkm_wr32(device, 0x17e8d8, ltc->ltc_nr);
3399336ed3SBen Skeggs nvkm_wr32(device, 0x17e000, ltc->ltc_nr);
3499336ed3SBen Skeggs nvkm_wr32(device, 0x17e8d4, ltc->tag_base);
3599336ed3SBen Skeggs nvkm_mask(device, 0x17e8c0, 0x00000002, lpg128 ? 0x00000002 : 0x00000000);
36c39f472eSBen Skeggs }
37c39f472eSBen Skeggs
3870bc7182SBen Skeggs static const struct nvkm_ltc_func
3970bc7182SBen Skeggs gk104_ltc = {
4070bc7182SBen Skeggs .oneinit = gf100_ltc_oneinit,
41c39f472eSBen Skeggs .init = gk104_ltc_init,
42c39f472eSBen Skeggs .intr = gf100_ltc_intr,
43c39f472eSBen Skeggs .cbc_clear = gf100_ltc_cbc_clear,
44c39f472eSBen Skeggs .cbc_wait = gf100_ltc_cbc_wait,
45*4500031fSBen Skeggs .zbc_color = 16,
46*4500031fSBen Skeggs .zbc_depth = 16,
47c39f472eSBen Skeggs .zbc_clear_color = gf100_ltc_zbc_clear_color,
48c39f472eSBen Skeggs .zbc_clear_depth = gf100_ltc_zbc_clear_depth,
49a0a49bacSAlexandre Courbot .invalidate = gf100_ltc_invalidate,
50a0a49bacSAlexandre Courbot .flush = gf100_ltc_flush,
5170bc7182SBen Skeggs };
5270bc7182SBen Skeggs
5370bc7182SBen Skeggs int
gk104_ltc_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_ltc ** pltc)540afc1c4cSBen Skeggs gk104_ltc_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
550afc1c4cSBen Skeggs struct nvkm_ltc **pltc)
5670bc7182SBen Skeggs {
570afc1c4cSBen Skeggs return nvkm_ltc_new_(&gk104_ltc, device, type, inst, pltc);
5870bc7182SBen Skeggs }
59