Commit 32341039 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/bios/pll: initial support for BIT 'C' version 2

Just enough to get at the PLL table.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 79bf9552
...@@ -77,15 +77,17 @@ g84_pll_mapping[] = { ...@@ -77,15 +77,17 @@ g84_pll_mapping[] = {
{} {}
}; };
static u16 static u32
pll_limits_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len) pll_limits_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len)
{ {
struct bit_entry bit_C; struct bit_entry bit_C;
u16 data = 0x0000; u32 data = 0x0000;
if (!bit_entry(bios, 'C', &bit_C)) { if (!bit_entry(bios, 'C', &bit_C)) {
if (bit_C.version == 1 && bit_C.length >= 10) if (bit_C.version == 1 && bit_C.length >= 10)
data = nvbios_rd16(bios, bit_C.offset + 8); data = nvbios_rd16(bios, bit_C.offset + 8);
if (bit_C.version == 2 && bit_C.length >= 4)
data = nvbios_rd32(bios, bit_C.offset + 0);
if (data) { if (data) {
*ver = nvbios_rd08(bios, data + 0); *ver = nvbios_rd08(bios, data + 0);
*hdr = nvbios_rd08(bios, data + 1); *hdr = nvbios_rd08(bios, data + 1);
...@@ -137,12 +139,12 @@ pll_map(struct nvkm_bios *bios) ...@@ -137,12 +139,12 @@ pll_map(struct nvkm_bios *bios)
} }
} }
static u16 static u32
pll_map_reg(struct nvkm_bios *bios, u32 reg, u32 *type, u8 *ver, u8 *len) pll_map_reg(struct nvkm_bios *bios, u32 reg, u32 *type, u8 *ver, u8 *len)
{ {
struct pll_mapping *map; struct pll_mapping *map;
u8 hdr, cnt; u8 hdr, cnt;
u16 data; u32 data;
data = pll_limits_table(bios, ver, &hdr, &cnt, len); data = pll_limits_table(bios, ver, &hdr, &cnt, len);
if (data && *ver >= 0x30) { if (data && *ver >= 0x30) {
...@@ -160,7 +162,7 @@ pll_map_reg(struct nvkm_bios *bios, u32 reg, u32 *type, u8 *ver, u8 *len) ...@@ -160,7 +162,7 @@ pll_map_reg(struct nvkm_bios *bios, u32 reg, u32 *type, u8 *ver, u8 *len)
map = pll_map(bios); map = pll_map(bios);
while (map && map->reg) { while (map && map->reg) {
if (map->reg == reg && *ver >= 0x20) { if (map->reg == reg && *ver >= 0x20) {
u16 addr = (data += hdr); u32 addr = (data += hdr);
*type = map->type; *type = map->type;
while (cnt--) { while (cnt--) {
if (nvbios_rd32(bios, data) == map->reg) if (nvbios_rd32(bios, data) == map->reg)
...@@ -179,12 +181,12 @@ pll_map_reg(struct nvkm_bios *bios, u32 reg, u32 *type, u8 *ver, u8 *len) ...@@ -179,12 +181,12 @@ pll_map_reg(struct nvkm_bios *bios, u32 reg, u32 *type, u8 *ver, u8 *len)
return 0x0000; return 0x0000;
} }
static u16 static u32
pll_map_type(struct nvkm_bios *bios, u8 type, u32 *reg, u8 *ver, u8 *len) pll_map_type(struct nvkm_bios *bios, u8 type, u32 *reg, u8 *ver, u8 *len)
{ {
struct pll_mapping *map; struct pll_mapping *map;
u8 hdr, cnt; u8 hdr, cnt;
u16 data; u32 data;
data = pll_limits_table(bios, ver, &hdr, &cnt, len); data = pll_limits_table(bios, ver, &hdr, &cnt, len);
if (data && *ver >= 0x30) { if (data && *ver >= 0x30) {
...@@ -202,7 +204,7 @@ pll_map_type(struct nvkm_bios *bios, u8 type, u32 *reg, u8 *ver, u8 *len) ...@@ -202,7 +204,7 @@ pll_map_type(struct nvkm_bios *bios, u8 type, u32 *reg, u8 *ver, u8 *len)
map = pll_map(bios); map = pll_map(bios);
while (map && map->reg) { while (map && map->reg) {
if (map->type == type && *ver >= 0x20) { if (map->type == type && *ver >= 0x20) {
u16 addr = (data += hdr); u32 addr = (data += hdr);
*reg = map->reg; *reg = map->reg;
while (cnt--) { while (cnt--) {
if (nvbios_rd32(bios, data) == map->reg) if (nvbios_rd32(bios, data) == map->reg)
...@@ -228,7 +230,7 @@ nvbios_pll_parse(struct nvkm_bios *bios, u32 type, struct nvbios_pll *info) ...@@ -228,7 +230,7 @@ nvbios_pll_parse(struct nvkm_bios *bios, u32 type, struct nvbios_pll *info)
struct nvkm_device *device = subdev->device; struct nvkm_device *device = subdev->device;
u8 ver, len; u8 ver, len;
u32 reg = type; u32 reg = type;
u16 data; u32 data;
if (type > PLL_MAX) { if (type > PLL_MAX) {
reg = type; reg = type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment