xref: /linux/drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgm107.c (revision 8dd06ef34b6e2f41b29fbf5fc1663780f2524285)
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  */
24d36a99d2SBen Skeggs #include "ram.h"
25c39f472eSBen Skeggs 
2697e5268dSBen Skeggs u32
gm107_ram_probe_fbp(const struct nvkm_ram_func * func,struct nvkm_device * device,int fbp,int * pltcs)2797e5268dSBen Skeggs gm107_ram_probe_fbp(const struct nvkm_ram_func *func,
2897e5268dSBen Skeggs 		    struct nvkm_device *device, int fbp, int *pltcs)
2997e5268dSBen Skeggs {
3097e5268dSBen Skeggs 	u32 fbpao = nvkm_rd32(device, 0x021c14);
3197e5268dSBen Skeggs 	return func->probe_fbp_amount(func, fbpao, device, fbp, pltcs);
3297e5268dSBen Skeggs }
3397e5268dSBen Skeggs 
34fcb371a1SBen Skeggs static const struct nvkm_ram_func
35fcb371a1SBen Skeggs gm107_ram = {
36*2cf3c8bcSWambui Karuga 	.upper = 0x1000000000ULL,
3797e5268dSBen Skeggs 	.probe_fbp = gm107_ram_probe_fbp,
3897e5268dSBen Skeggs 	.probe_fbp_amount = gf108_ram_probe_fbp_amount,
3997e5268dSBen Skeggs 	.probe_fbpa_amount = gf100_ram_probe_fbpa_amount,
40fcb371a1SBen Skeggs 	.dtor = gk104_ram_dtor,
41fcb371a1SBen Skeggs 	.init = gk104_ram_init,
42fcb371a1SBen Skeggs 	.calc = gk104_ram_calc,
43fcb371a1SBen Skeggs 	.prog = gk104_ram_prog,
44fcb371a1SBen Skeggs 	.tidy = gk104_ram_tidy,
45fcb371a1SBen Skeggs };
46fcb371a1SBen Skeggs 
47d36a99d2SBen Skeggs int
gm107_ram_new(struct nvkm_fb * fb,struct nvkm_ram ** pram)48d36a99d2SBen Skeggs gm107_ram_new(struct nvkm_fb *fb, struct nvkm_ram **pram)
49d36a99d2SBen Skeggs {
5097e5268dSBen Skeggs 	return gk104_ram_new_(&gm107_ram, fb, pram);
51d36a99d2SBen Skeggs }
52