1c39f472eSBen Skeggs /* 2c39f472eSBen Skeggs * Copyright (C) 2010 Francisco Jerez. 3c39f472eSBen Skeggs * All Rights Reserved. 4c39f472eSBen Skeggs * 5c39f472eSBen Skeggs * Permission is hereby granted, free of charge, to any person obtaining 6c39f472eSBen Skeggs * a copy of this software and associated documentation files (the 7c39f472eSBen Skeggs * "Software"), to deal in the Software without restriction, including 8c39f472eSBen Skeggs * without limitation the rights to use, copy, modify, merge, publish, 9c39f472eSBen Skeggs * distribute, sublicense, and/or sell copies of the Software, and to 10c39f472eSBen Skeggs * permit persons to whom the Software is furnished to do so, subject to 11c39f472eSBen Skeggs * the following conditions: 12c39f472eSBen Skeggs * 13c39f472eSBen Skeggs * The above copyright notice and this permission notice (including the 14c39f472eSBen Skeggs * next paragraph) shall be included in all copies or substantial 15c39f472eSBen Skeggs * portions of the Software. 16c39f472eSBen Skeggs * 17c39f472eSBen Skeggs * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18c39f472eSBen Skeggs * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19c39f472eSBen Skeggs * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20c39f472eSBen Skeggs * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE 21c39f472eSBen Skeggs * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22c39f472eSBen Skeggs * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23c39f472eSBen Skeggs * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24c39f472eSBen Skeggs * 25c39f472eSBen Skeggs */ 26c39f472eSBen Skeggs #include "nv04.h" 27c39f472eSBen Skeggs 28c39f472eSBen Skeggs void 29639c308eSBen Skeggs nv41_fb_tile_prog(struct nvkm_fb *pfb, int i, struct nvkm_fb_tile *tile) 30c39f472eSBen Skeggs { 31c39f472eSBen Skeggs nv_wr32(pfb, 0x100604 + (i * 0x10), tile->limit); 32c39f472eSBen Skeggs nv_wr32(pfb, 0x100608 + (i * 0x10), tile->pitch); 33c39f472eSBen Skeggs nv_wr32(pfb, 0x100600 + (i * 0x10), tile->addr); 34c39f472eSBen Skeggs nv_rd32(pfb, 0x100600 + (i * 0x10)); 35c39f472eSBen Skeggs nv_wr32(pfb, 0x100700 + (i * 0x04), tile->zcomp); 36c39f472eSBen Skeggs } 37c39f472eSBen Skeggs 38c39f472eSBen Skeggs int 39639c308eSBen Skeggs nv41_fb_init(struct nvkm_object *object) 40c39f472eSBen Skeggs { 41c39f472eSBen Skeggs struct nv04_fb_priv *priv = (void *)object; 42c39f472eSBen Skeggs int ret; 43c39f472eSBen Skeggs 44639c308eSBen Skeggs ret = nvkm_fb_init(&priv->base); 45c39f472eSBen Skeggs if (ret) 46c39f472eSBen Skeggs return ret; 47c39f472eSBen Skeggs 48c39f472eSBen Skeggs nv_wr32(priv, 0x100800, 0x00000001); 49c39f472eSBen Skeggs return 0; 50c39f472eSBen Skeggs } 51c39f472eSBen Skeggs 52639c308eSBen Skeggs struct nvkm_oclass * 53c39f472eSBen Skeggs nv41_fb_oclass = &(struct nv04_fb_impl) { 54c39f472eSBen Skeggs .base.base.handle = NV_SUBDEV(FB, 0x41), 55639c308eSBen Skeggs .base.base.ofuncs = &(struct nvkm_ofuncs) { 56c39f472eSBen Skeggs .ctor = nv04_fb_ctor, 57639c308eSBen Skeggs .dtor = _nvkm_fb_dtor, 58c39f472eSBen Skeggs .init = nv41_fb_init, 59639c308eSBen Skeggs .fini = _nvkm_fb_fini, 60c39f472eSBen Skeggs }, 61c39f472eSBen Skeggs .base.memtype = nv04_fb_memtype_valid, 62c39f472eSBen Skeggs .base.ram = &nv41_ram_oclass, 63c39f472eSBen Skeggs .tile.regions = 12, 64c39f472eSBen Skeggs .tile.init = nv30_fb_tile_init, 65c39f472eSBen Skeggs .tile.comp = nv40_fb_tile_comp, 66c39f472eSBen Skeggs .tile.fini = nv20_fb_tile_fini, 67c39f472eSBen Skeggs .tile.prog = nv41_fb_tile_prog, 68c39f472eSBen Skeggs }.base.base; 69