Vladimir Serbinenko | 6481e10 | 2014-08-10 23:48:11 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2011 Chromium OS Authors |
| 5 | * Copyright (C) 2013 Vladimir Serbinenko |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Vladimir Serbinenko | 6481e10 | 2014-08-10 23:48:11 +0200 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <arch/io.h> |
| 18 | #include <console/console.h> |
| 19 | #include <delay.h> |
| 20 | #include <device/device.h> |
| 21 | #include <device/pci.h> |
| 22 | #include <device/pci_ids.h> |
| 23 | #include <string.h> |
| 24 | #include <device/pci_ops.h> |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 25 | #include <commonlib/helpers.h> |
Patrick Rudolph | f6aa7d9 | 2017-09-29 18:28:23 +0200 | [diff] [blame] | 26 | #include <cbmem.h> |
| 27 | #include <southbridge/intel/i82801ix/nvs.h> |
Vladimir Serbinenko | 6481e10 | 2014-08-10 23:48:11 +0200 | [diff] [blame] | 28 | |
| 29 | #include "drivers/intel/gma/i915_reg.h" |
| 30 | #include "chip.h" |
| 31 | #include "gm45.h" |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 32 | #include <drivers/intel/gma/intel_bios.h> |
| 33 | #include <drivers/intel/gma/edid.h> |
| 34 | #include <drivers/intel/gma/i915.h> |
Patrick Rudolph | f6aa7d9 | 2017-09-29 18:28:23 +0200 | [diff] [blame] | 35 | #include <drivers/intel/gma/opregion.h> |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 36 | #include <pc80/vga.h> |
| 37 | #include <pc80/vga_io.h> |
Nico Huber | f2dd049 | 2017-10-29 15:42:44 +0100 | [diff] [blame] | 38 | #include <drivers/intel/gma/libgfxinit.h> |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 39 | |
Arthur Heymans | fe3eabc | 2016-09-26 08:44:46 +0200 | [diff] [blame] | 40 | #define BASE_FREQUENCY 96000 |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 41 | |
Vladimir Serbinenko | 6481e10 | 2014-08-10 23:48:11 +0200 | [diff] [blame] | 42 | static struct resource *gtt_res = NULL; |
| 43 | |
Nico Huber | b851cc6 | 2016-01-09 23:27:16 +0100 | [diff] [blame] | 44 | u32 gtt_read(u32 reg) |
| 45 | { |
| 46 | return read32(res2mmio(gtt_res, reg, 0)); |
| 47 | } |
| 48 | |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 49 | void gtt_write(u32 reg, u32 data) |
Vladimir Serbinenko | 6481e10 | 2014-08-10 23:48:11 +0200 | [diff] [blame] | 50 | { |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 51 | write32(res2mmio(gtt_res, reg, 0), data); |
Vladimir Serbinenko | 6481e10 | 2014-08-10 23:48:11 +0200 | [diff] [blame] | 52 | } |
| 53 | |
Patrick Rudolph | f6aa7d9 | 2017-09-29 18:28:23 +0200 | [diff] [blame] | 54 | uintptr_t gma_get_gnvs_aslb(const void *gnvs) |
| 55 | { |
| 56 | const global_nvs_t *gnvs_ptr = gnvs; |
| 57 | return (uintptr_t)(gnvs_ptr ? gnvs_ptr->aslb : 0); |
| 58 | } |
| 59 | |
| 60 | void gma_set_gnvs_aslb(void *gnvs, uintptr_t aslb) |
| 61 | { |
| 62 | global_nvs_t *gnvs_ptr = gnvs; |
| 63 | if (gnvs_ptr) |
| 64 | gnvs_ptr->aslb = aslb; |
| 65 | } |
| 66 | |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 67 | static void gma_init_lvds(const struct northbridge_intel_gm45_config *info, |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 68 | u8 *mmio, u32 physbase, u16 piobase, u32 lfb, |
| 69 | struct edid *edid) |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 70 | { |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 71 | int i; |
Audrey Pearson | bd0dab2 | 2015-09-29 12:36:52 -0500 | [diff] [blame] | 72 | struct edid_mode *mode; |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 73 | u32 hactive, vactive, right_border, bottom_border; |
| 74 | int hpolarity, vpolarity; |
| 75 | u32 vsync, hsync, vblank, hblank, hfront_porch, vfront_porch; |
Arthur Heymans | fe3eabc | 2016-09-26 08:44:46 +0200 | [diff] [blame] | 76 | u32 smallest_err = 0xffffffff; |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 77 | u32 target_frequency; |
| 78 | u32 pixel_p1 = 1; |
| 79 | u32 pixel_n = 1; |
| 80 | u32 pixel_m1 = 1; |
| 81 | u32 pixel_m2 = 1; |
Arthur Heymans | fe3eabc | 2016-09-26 08:44:46 +0200 | [diff] [blame] | 82 | u32 pixel_p2; |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 83 | |
| 84 | vga_gr_write(0x18, 0); |
| 85 | |
| 86 | /* Setup GTT. */ |
| 87 | for (i = 0; i < 0x2000; i++) |
| 88 | { |
| 89 | outl((i << 2) | 1, piobase); |
| 90 | outl(physbase + (i << 12) + 1, piobase + 4); |
| 91 | } |
| 92 | |
Timothy Pearson | 61942de | 2015-04-06 21:54:56 -0500 | [diff] [blame] | 93 | write32(mmio + ADPA, 0x40008c18); |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 94 | write32(mmio + 0x7041c, 0x0); |
Timothy Pearson | 61942de | 2015-04-06 21:54:56 -0500 | [diff] [blame] | 95 | write32(mmio + _DPLL_B_MD, 0x3); |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 96 | |
| 97 | vga_misc_write(0x67); |
| 98 | |
| 99 | const u8 cr[] = { 0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, |
| 100 | 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, |
| 101 | 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3, |
| 102 | 0xff |
| 103 | }; |
| 104 | vga_cr_write(0x11, 0); |
| 105 | |
| 106 | for (i = 0; i <= 0x18; i++) |
| 107 | vga_cr_write(i, cr[i]); |
| 108 | |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 109 | /* Disable screen memory to prevent garbage from appearing. */ |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 110 | vga_sr_write(1, vga_sr_read(1) | 0x20); |
| 111 | |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 112 | mode = &edid->mode; |
| 113 | |
| 114 | hactive = edid->x_resolution; |
| 115 | vactive = edid->y_resolution; |
Audrey Pearson | bd0dab2 | 2015-09-29 12:36:52 -0500 | [diff] [blame] | 116 | right_border = mode->hborder; |
| 117 | bottom_border = mode->vborder; |
| 118 | hpolarity = (mode->phsync == '-'); |
| 119 | vpolarity = (mode->pvsync == '-'); |
| 120 | vsync = mode->vspw; |
| 121 | hsync = mode->hspw; |
| 122 | vblank = mode->vbl; |
| 123 | hblank = mode->hbl; |
| 124 | hfront_porch = mode->hso; |
| 125 | vfront_porch = mode->vso; |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 126 | |
Nico Huber | 6d8266b | 2017-05-20 16:46:01 +0200 | [diff] [blame] | 127 | if (IS_ENABLED(CONFIG_LINEAR_FRAMEBUFFER)) { |
Nico Huber | ee352cd | 2016-01-09 23:15:53 +0100 | [diff] [blame] | 128 | vga_sr_write(1, 1); |
| 129 | vga_sr_write(0x2, 0xf); |
| 130 | vga_sr_write(0x3, 0x0); |
| 131 | vga_sr_write(0x4, 0xe); |
| 132 | vga_gr_write(0, 0x0); |
| 133 | vga_gr_write(1, 0x0); |
| 134 | vga_gr_write(2, 0x0); |
| 135 | vga_gr_write(3, 0x0); |
| 136 | vga_gr_write(4, 0x0); |
| 137 | vga_gr_write(5, 0x0); |
| 138 | vga_gr_write(6, 0x5); |
| 139 | vga_gr_write(7, 0xf); |
| 140 | vga_gr_write(0x10, 0x1); |
| 141 | vga_gr_write(0x11, 0); |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 142 | |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 143 | edid->bytes_per_line = (edid->bytes_per_line + 63) & ~63; |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 144 | |
Nico Huber | ee352cd | 2016-01-09 23:15:53 +0100 | [diff] [blame] | 145 | write32(mmio + DSPCNTR(0), DISPPLANE_BGRX888); |
| 146 | write32(mmio + DSPADDR(0), 0); |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 147 | write32(mmio + DSPSTRIDE(0), edid->bytes_per_line); |
Nico Huber | ee352cd | 2016-01-09 23:15:53 +0100 | [diff] [blame] | 148 | write32(mmio + DSPSURF(0), 0); |
| 149 | for (i = 0; i < 0x100; i++) |
| 150 | write32(mmio + LGC_PALETTE(0) + 4 * i, i * 0x010101); |
| 151 | } else { |
| 152 | vga_textmode_init(); |
| 153 | } |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 154 | |
Arthur Heymans | fe3eabc | 2016-09-26 08:44:46 +0200 | [diff] [blame] | 155 | target_frequency = mode->pixel_clock; |
| 156 | /* |
| 157 | * p2 divisor must 7 for dual channel LVDS |
| 158 | * and 14 for single channel LVDS |
| 159 | */ |
| 160 | pixel_p2 = mode->lvds_dual_channel ? 7 : 14; |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 161 | |
Arthur Heymans | fe3eabc | 2016-09-26 08:44:46 +0200 | [diff] [blame] | 162 | /* |
| 163 | * Find suitable divisors, m1, m2, p1, n. |
| 164 | * refclock * (5 * (m1 + 2) + (m1 + 2)) / (n + 2) / p1 / p2 |
| 165 | * should be closest to target frequency as possible |
| 166 | */ |
| 167 | u32 candn, candm1, candm2, candp1; |
| 168 | for (candn = 1; candn <= 3; candn++) { |
| 169 | for (candm1 = 23; candm1 >= 17; candm1--) { |
| 170 | for (candm2 = 11; candm2 >= 5; candm2--) { |
| 171 | for (candp1 = mode->lvds_dual_channel ? 6 : 8; |
| 172 | candp1 >= 2; candp1--) { |
| 173 | u32 m = 5 * (candm1 + 2) + (candm2 + 2); |
| 174 | u32 p = candp1 * pixel_p2; |
| 175 | u32 vco = DIV_ROUND_CLOSEST(BASE_FREQUENCY * m, candn + 2); |
| 176 | u32 dot = DIV_ROUND_CLOSEST(vco, p); |
Arthur Heymans | 75f9131 | 2016-10-12 01:04:28 +0200 | [diff] [blame] | 177 | u32 this_err = MAX(dot, target_frequency) - |
| 178 | MIN(dot, target_frequency); |
Arthur Heymans | fe3eabc | 2016-09-26 08:44:46 +0200 | [diff] [blame] | 179 | if (this_err < smallest_err) { |
| 180 | smallest_err = this_err; |
| 181 | pixel_n = candn; |
| 182 | pixel_m1 = candm1; |
| 183 | pixel_m2 = candm2; |
| 184 | pixel_p1 = candp1; |
| 185 | } |
| 186 | } |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 187 | } |
| 188 | } |
| 189 | } |
| 190 | |
Arthur Heymans | fe3eabc | 2016-09-26 08:44:46 +0200 | [diff] [blame] | 191 | if (smallest_err == 0xffffffff) { |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 192 | printk (BIOS_ERR, "Couldn't find GFX clock divisors\n"); |
| 193 | return; |
| 194 | } |
| 195 | |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 196 | printk(BIOS_INFO, "bringing up panel at resolution %d x %d\n", |
| 197 | hactive, vactive); |
| 198 | printk(BIOS_DEBUG, "Borders %d x %d\n", |
| 199 | right_border, bottom_border); |
| 200 | printk(BIOS_DEBUG, "Blank %d x %d\n", |
| 201 | hblank, vblank); |
| 202 | printk(BIOS_DEBUG, "Sync %d x %d\n", |
| 203 | hsync, vsync); |
| 204 | printk(BIOS_DEBUG, "Front porch %d x %d\n", |
| 205 | hfront_porch, vfront_porch); |
Vladimir Serbinenko | a71bdc3 | 2014-08-30 00:35:39 +0200 | [diff] [blame] | 206 | printk(BIOS_DEBUG, (info->gfx.use_spread_spectrum_clock |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 207 | ? "Spread spectrum clock\n" : "DREF clock\n")); |
| 208 | printk(BIOS_DEBUG, |
Vladimir Serbinenko | 551cff0 | 2015-10-10 23:58:08 +0200 | [diff] [blame] | 209 | mode->lvds_dual_channel ? "Dual channel\n" : "Single channel\n"); |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 210 | printk(BIOS_DEBUG, "Polarities %d, %d\n", |
| 211 | hpolarity, vpolarity); |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 212 | printk(BIOS_DEBUG, "Pixel N=%d, M1=%d, M2=%d, P1=%d\n", |
| 213 | pixel_n, pixel_m1, pixel_m2, pixel_p1); |
| 214 | printk(BIOS_DEBUG, "Pixel clock %d kHz\n", |
Arthur Heymans | 1f06028 | 2017-01-19 16:45:45 +0100 | [diff] [blame] | 215 | BASE_FREQUENCY * (5 * (pixel_m1 + 2) + (pixel_m2 + 2)) / |
| 216 | (pixel_n + 2) / (pixel_p1 * pixel_p2)); |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 217 | |
| 218 | write32(mmio + LVDS, |
| 219 | (hpolarity << 20) | (vpolarity << 21) |
Vladimir Serbinenko | 551cff0 | 2015-10-10 23:58:08 +0200 | [diff] [blame] | 220 | | (mode->lvds_dual_channel ? LVDS_CLOCK_B_POWERUP_ALL |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 221 | | LVDS_CLOCK_BOTH_POWERUP_ALL : 0) |
Arthur Heymans | 8ba2010 | 2016-08-15 00:04:34 +0200 | [diff] [blame] | 222 | | LVDS_ENABLE_DITHER |
| 223 | | LVDS_CLOCK_A_POWERUP_ALL |
| 224 | | LVDS_PIPE(0)); |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 225 | mdelay(1); |
| 226 | write32(mmio + PP_CONTROL, PANEL_UNLOCK_REGS |
| 227 | | (read32(mmio + PP_CONTROL) & ~PANEL_UNLOCK_MASK)); |
| 228 | write32(mmio + FP0(0), |
Arthur Heymans | fe3eabc | 2016-09-26 08:44:46 +0200 | [diff] [blame] | 229 | (pixel_n << 16) |
| 230 | | (pixel_m1 << 8) | (pixel_m2)); |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 231 | write32(mmio + DPLL(0), |
| 232 | DPLL_VCO_ENABLE | DPLLB_MODE_LVDS |
Arthur Heymans | 8ba2010 | 2016-08-15 00:04:34 +0200 | [diff] [blame] | 233 | | DPLL_VGA_MODE_DIS |
Vladimir Serbinenko | 551cff0 | 2015-10-10 23:58:08 +0200 | [diff] [blame] | 234 | | (mode->lvds_dual_channel ? DPLLB_LVDS_P2_CLOCK_DIV_7 |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 235 | : DPLLB_LVDS_P2_CLOCK_DIV_14) |
| 236 | | (0x10000 << (pixel_p1 - 1)) |
Vladimir Serbinenko | a71bdc3 | 2014-08-30 00:35:39 +0200 | [diff] [blame] | 237 | | ((info->gfx.use_spread_spectrum_clock ? 3 : 0) << 13) |
Arthur Heymans | 8ba2010 | 2016-08-15 00:04:34 +0200 | [diff] [blame] | 238 | | (6 << PLL_LOAD_PULSE_PHASE_SHIFT)); |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 239 | mdelay(1); |
| 240 | write32(mmio + DPLL(0), |
| 241 | DPLL_VCO_ENABLE | DPLLB_MODE_LVDS |
Arthur Heymans | 8ba2010 | 2016-08-15 00:04:34 +0200 | [diff] [blame] | 242 | | DPLL_VGA_MODE_DIS |
Vladimir Serbinenko | 551cff0 | 2015-10-10 23:58:08 +0200 | [diff] [blame] | 243 | | (mode->lvds_dual_channel ? DPLLB_LVDS_P2_CLOCK_DIV_7 |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 244 | : DPLLB_LVDS_P2_CLOCK_DIV_14) |
| 245 | | (0x10000 << (pixel_p1 - 1)) |
Vladimir Serbinenko | a71bdc3 | 2014-08-30 00:35:39 +0200 | [diff] [blame] | 246 | | ((info->gfx.use_spread_spectrum_clock ? 3 : 0) << 13) |
Arthur Heymans | 8ba2010 | 2016-08-15 00:04:34 +0200 | [diff] [blame] | 247 | | (6 << PLL_LOAD_PULSE_PHASE_SHIFT)); |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 248 | /* Re-lock the registers. */ |
| 249 | write32(mmio + PP_CONTROL, |
| 250 | (read32(mmio + PP_CONTROL) & ~PANEL_UNLOCK_MASK)); |
| 251 | |
| 252 | write32(mmio + LVDS, |
| 253 | (hpolarity << 20) | (vpolarity << 21) |
Vladimir Serbinenko | 551cff0 | 2015-10-10 23:58:08 +0200 | [diff] [blame] | 254 | | (mode->lvds_dual_channel ? LVDS_CLOCK_B_POWERUP_ALL |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 255 | | LVDS_CLOCK_BOTH_POWERUP_ALL : 0) |
Arthur Heymans | 8ba2010 | 2016-08-15 00:04:34 +0200 | [diff] [blame] | 256 | | LVDS_CLOCK_A_POWERUP_ALL |
| 257 | | LVDS_ENABLE_DITHER |
| 258 | | LVDS_PIPE(0)); |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 259 | |
| 260 | write32(mmio + HTOTAL(0), |
| 261 | ((hactive + right_border + hblank - 1) << 16) |
| 262 | | (hactive - 1)); |
| 263 | write32(mmio + HBLANK(0), |
| 264 | ((hactive + right_border + hblank - 1) << 16) |
| 265 | | (hactive + right_border - 1)); |
| 266 | write32(mmio + HSYNC(0), |
| 267 | ((hactive + right_border + hfront_porch + hsync - 1) << 16) |
| 268 | | (hactive + right_border + hfront_porch - 1)); |
| 269 | |
| 270 | write32(mmio + VTOTAL(0), ((vactive + bottom_border + vblank - 1) << 16) |
| 271 | | (vactive - 1)); |
| 272 | write32(mmio + VBLANK(0), ((vactive + bottom_border + vblank - 1) << 16) |
| 273 | | (vactive + bottom_border - 1)); |
| 274 | write32(mmio + VSYNC(0), |
Arthur Heymans | 8ba2010 | 2016-08-15 00:04:34 +0200 | [diff] [blame] | 275 | ((vactive + bottom_border + vfront_porch + vsync - 1) << 16) |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 276 | | (vactive + bottom_border + vfront_porch - 1)); |
| 277 | |
| 278 | write32(mmio + PIPECONF(0), PIPECONF_DISABLE); |
| 279 | |
| 280 | write32(mmio + PF_WIN_POS(0), 0); |
Nico Huber | 6d8266b | 2017-05-20 16:46:01 +0200 | [diff] [blame] | 281 | if (IS_ENABLED(CONFIG_LINEAR_FRAMEBUFFER)) { |
Nico Huber | ee352cd | 2016-01-09 23:15:53 +0100 | [diff] [blame] | 282 | write32(mmio + PIPESRC(0), ((hactive - 1) << 16) |
| 283 | | (vactive - 1)); |
| 284 | write32(mmio + PF_CTL(0), 0); |
| 285 | write32(mmio + PF_WIN_SZ(0), 0); |
Arthur Heymans | 8ba2010 | 2016-08-15 00:04:34 +0200 | [diff] [blame] | 286 | write32(mmio + PFIT_CONTROL, 0); |
Nico Huber | ee352cd | 2016-01-09 23:15:53 +0100 | [diff] [blame] | 287 | } else { |
| 288 | write32(mmio + PIPESRC(0), (639 << 16) | 399); |
| 289 | write32(mmio + PF_CTL(0), PF_ENABLE | PF_FILTER_MED_3x3); |
| 290 | write32(mmio + PF_WIN_SZ(0), vactive | (hactive << 16)); |
Nick High | 1e302cb | 2016-04-26 17:22:05 -0400 | [diff] [blame] | 291 | write32(mmio + PFIT_CONTROL, 0x80000000); |
Nico Huber | ee352cd | 2016-01-09 23:15:53 +0100 | [diff] [blame] | 292 | } |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 293 | |
| 294 | mdelay(1); |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 295 | write32(mmio + PIPECONF(0), PIPECONF_BPP_6); |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 296 | write32(mmio + PIPECONF(0), PIPECONF_BPP_6 | PIPECONF_DITHER_EN); |
| 297 | write32(mmio + PIPECONF(0), PIPECONF_ENABLE | PIPECONF_BPP_6 | PIPECONF_DITHER_EN); |
| 298 | |
Nico Huber | 6d8266b | 2017-05-20 16:46:01 +0200 | [diff] [blame] | 299 | if (IS_ENABLED(CONFIG_LINEAR_FRAMEBUFFER)) { |
Arthur Heymans | 8ba2010 | 2016-08-15 00:04:34 +0200 | [diff] [blame] | 300 | write32(mmio + VGACNTRL, VGA_DISP_DISABLE); |
Nico Huber | ee352cd | 2016-01-09 23:15:53 +0100 | [diff] [blame] | 301 | write32(mmio + DSPCNTR(0), DISPLAY_PLANE_ENABLE |
| 302 | | DISPPLANE_BGRX888); |
| 303 | mdelay(1); |
| 304 | } else { |
Nick High | 1e302cb | 2016-04-26 17:22:05 -0400 | [diff] [blame] | 305 | write32(mmio + VGACNTRL, 0xc4008e); |
Nico Huber | ee352cd | 2016-01-09 23:15:53 +0100 | [diff] [blame] | 306 | } |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 307 | |
Arthur Heymans | 8ba2010 | 2016-08-15 00:04:34 +0200 | [diff] [blame] | 308 | write32(mmio + LVDS, LVDS_PORT_ENABLE |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 309 | | (hpolarity << 20) | (vpolarity << 21) |
Vladimir Serbinenko | 551cff0 | 2015-10-10 23:58:08 +0200 | [diff] [blame] | 310 | | (mode->lvds_dual_channel ? LVDS_CLOCK_B_POWERUP_ALL |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 311 | | LVDS_CLOCK_BOTH_POWERUP_ALL : 0) |
Arthur Heymans | 8ba2010 | 2016-08-15 00:04:34 +0200 | [diff] [blame] | 312 | | LVDS_CLOCK_A_POWERUP_ALL |
| 313 | | LVDS_ENABLE_DITHER |
| 314 | | LVDS_PIPE(0)); |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 315 | |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 316 | write32(mmio + PP_CONTROL, PANEL_POWER_ON | PANEL_POWER_RESET); |
| 317 | |
| 318 | /* Enable screen memory. */ |
| 319 | vga_sr_write(1, vga_sr_read(1) & ~0x20); |
| 320 | |
| 321 | /* Clear interrupts. */ |
| 322 | write32(mmio + DEIIR, 0xffffffff); |
| 323 | write32(mmio + SDEIIR, 0xffffffff); |
| 324 | |
Nico Huber | 6d8266b | 2017-05-20 16:46:01 +0200 | [diff] [blame] | 325 | if (IS_ENABLED(CONFIG_LINEAR_FRAMEBUFFER)) { |
Nico Huber | ee352cd | 2016-01-09 23:15:53 +0100 | [diff] [blame] | 326 | memset((void *) lfb, 0, |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 327 | edid->x_resolution * edid->y_resolution * 4); |
| 328 | set_vbe_mode_info_valid(edid, lfb); |
Nico Huber | ee352cd | 2016-01-09 23:15:53 +0100 | [diff] [blame] | 329 | } |
Vladimir Serbinenko | 8801011 | 2014-08-16 03:35:33 +0200 | [diff] [blame] | 330 | } |
| 331 | |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 332 | static void gma_init_vga(const struct northbridge_intel_gm45_config *info, |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 333 | u8 *mmio, u32 physbase, u16 piobase, u32 lfb, |
| 334 | struct edid *edid) |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 335 | { |
| 336 | |
| 337 | int i; |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 338 | struct edid_mode *mode; |
| 339 | u32 hactive, vactive, right_border, bottom_border; |
| 340 | int hpolarity, vpolarity; |
| 341 | u32 vsync, hsync, vblank, hblank, hfront_porch, vfront_porch; |
| 342 | u32 target_frequency; |
| 343 | u32 smallest_err = 0xffffffff; |
| 344 | u32 pixel_p1 = 1; |
Arthur Heymans | 063cd5f | 2016-10-12 00:05:00 +0200 | [diff] [blame] | 345 | u32 pixel_p2; |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 346 | u32 pixel_n = 1; |
| 347 | u32 pixel_m1 = 1; |
| 348 | u32 pixel_m2 = 1; |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 349 | |
| 350 | vga_gr_write(0x18, 0); |
| 351 | |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 352 | /* Set up GTT. */ |
| 353 | for (i = 0; i < 0x2000; i++) { |
| 354 | outl((i << 2) | 1, piobase); |
| 355 | outl(physbase + (i << 12) + 1, piobase + 4); |
| 356 | } |
| 357 | |
| 358 | |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 359 | write32(mmio + VGA0, 0x31108); |
| 360 | write32(mmio + VGA1, 0x31406); |
| 361 | |
| 362 | write32(mmio + ADPA, ADPA_DAC_ENABLE |
| 363 | | ADPA_PIPE_A_SELECT |
| 364 | | ADPA_CRT_HOTPLUG_MONITOR_COLOR |
| 365 | | ADPA_CRT_HOTPLUG_ENABLE |
| 366 | | ADPA_USE_VGA_HVPOLARITY |
| 367 | | ADPA_VSYNC_CNTL_ENABLE |
| 368 | | ADPA_HSYNC_CNTL_ENABLE |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 369 | | ADPA_DPMS_ON); |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 370 | |
| 371 | write32(mmio + 0x7041c, 0x0); |
| 372 | write32(mmio + DPLL_MD(0), 0x3); |
| 373 | write32(mmio + DPLL_MD(1), 0x3); |
| 374 | |
| 375 | vga_misc_write(0x67); |
| 376 | |
| 377 | const u8 cr[] = { 0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, |
| 378 | 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, |
| 379 | 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3, |
| 380 | 0xff |
| 381 | }; |
| 382 | vga_cr_write(0x11, 0); |
| 383 | |
| 384 | for (i = 0; i <= 0x18; i++) |
| 385 | vga_cr_write(i, cr[i]); |
| 386 | |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 387 | udelay(1); |
| 388 | |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 389 | /* Disable screen memory to prevent garbage from appearing. */ |
| 390 | vga_sr_write(1, vga_sr_read(1) | 0x20); |
| 391 | |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 392 | mode = &edid->mode; |
| 393 | |
| 394 | hactive = edid->x_resolution; |
| 395 | vactive = edid->y_resolution; |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 396 | right_border = mode->hborder; |
| 397 | bottom_border = mode->vborder; |
| 398 | hpolarity = (mode->phsync == '-'); |
| 399 | vpolarity = (mode->pvsync == '-'); |
| 400 | vsync = mode->vspw; |
| 401 | hsync = mode->hspw; |
| 402 | vblank = mode->vbl; |
| 403 | hblank = mode->hbl; |
| 404 | hfront_porch = mode->hso; |
| 405 | vfront_porch = mode->vso; |
| 406 | target_frequency = mode->pixel_clock; |
| 407 | |
Nico Huber | 6d8266b | 2017-05-20 16:46:01 +0200 | [diff] [blame] | 408 | if (IS_ENABLED(CONFIG_LINEAR_FRAMEBUFFER)) { |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 409 | vga_sr_write(1, 1); |
| 410 | vga_sr_write(0x2, 0xf); |
| 411 | vga_sr_write(0x3, 0x0); |
| 412 | vga_sr_write(0x4, 0xe); |
| 413 | vga_gr_write(0, 0x0); |
| 414 | vga_gr_write(1, 0x0); |
| 415 | vga_gr_write(2, 0x0); |
| 416 | vga_gr_write(3, 0x0); |
| 417 | vga_gr_write(4, 0x0); |
| 418 | vga_gr_write(5, 0x0); |
| 419 | vga_gr_write(6, 0x5); |
| 420 | vga_gr_write(7, 0xf); |
| 421 | vga_gr_write(0x10, 0x1); |
| 422 | vga_gr_write(0x11, 0); |
| 423 | |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 424 | edid->bytes_per_line = (edid->bytes_per_line + 63) & ~63; |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 425 | |
| 426 | write32(mmio + DSPCNTR(0), DISPLAY_PLANE_ENABLE |
| 427 | | DISPPLANE_BGRX888); |
| 428 | write32(mmio + DSPADDR(0), 0); |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 429 | write32(mmio + DSPSTRIDE(0), edid->bytes_per_line); |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 430 | write32(mmio + DSPSURF(0), 0); |
| 431 | for (i = 0; i < 0x100; i++) |
| 432 | write32(mmio + LGC_PALETTE(0) + 4 * i, i * 0x010101); |
| 433 | } else { |
| 434 | vga_textmode_init(); |
| 435 | } |
| 436 | |
Arthur Heymans | 063cd5f | 2016-10-12 00:05:00 +0200 | [diff] [blame] | 437 | pixel_p2 = target_frequency <= 225000 ? 10 : 5; |
| 438 | |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 439 | u32 candn, candm1, candm2, candp1; |
| 440 | for (candn = 1; candn <= 4; candn++) { |
| 441 | for (candm1 = 23; candm1 >= 17; candm1--) { |
| 442 | for (candm2 = 11; candm2 >= 5; candm2--) { |
| 443 | for (candp1 = 8; candp1 >= 1; candp1--) { |
| 444 | u32 m = 5 * (candm1 + 2) + (candm2 + 2); |
Arthur Heymans | 063cd5f | 2016-10-12 00:05:00 +0200 | [diff] [blame] | 445 | u32 p = candp1 * pixel_p2; |
Arthur Heymans | fe3eabc | 2016-09-26 08:44:46 +0200 | [diff] [blame] | 446 | u32 vco = DIV_ROUND_CLOSEST(BASE_FREQUENCY * m, candn + 2); |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 447 | u32 dot = DIV_ROUND_CLOSEST(vco, p); |
Arthur Heymans | 75f9131 | 2016-10-12 01:04:28 +0200 | [diff] [blame] | 448 | u32 this_err = MAX(dot, target_frequency) - |
| 449 | MIN(dot, target_frequency); |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 450 | if (this_err < smallest_err) { |
| 451 | smallest_err= this_err; |
| 452 | pixel_n = candn; |
| 453 | pixel_m1 = candm1; |
| 454 | pixel_m2 = candm2; |
| 455 | pixel_p1 = candp1; |
| 456 | } |
| 457 | } |
| 458 | } |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | if (smallest_err == 0xffffffff) { |
| 463 | printk(BIOS_ERR, "Error: Couldn't find GFX clock divisors\n"); |
| 464 | return; |
| 465 | } |
| 466 | |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 467 | printk(BIOS_INFO, "Bringing up panel at resolution %d x %d\n", |
| 468 | hactive, vactive); |
| 469 | printk(BIOS_SPEW, "Borders %d x %d\n", |
| 470 | right_border, bottom_border); |
| 471 | printk(BIOS_SPEW, "Blank %d x %d\n", |
| 472 | hblank, vblank); |
| 473 | printk(BIOS_SPEW, "Sync %d x %d\n", |
| 474 | hsync, vsync); |
| 475 | printk(BIOS_SPEW, "Front porch %d x %d\n", |
| 476 | hfront_porch, vfront_porch); |
| 477 | printk(BIOS_SPEW, (info->gfx.use_spread_spectrum_clock |
| 478 | ? "Spread spectrum clock\n" : "DREF clock\n")); |
| 479 | printk(BIOS_SPEW, "Polarities %d, %d\n", |
| 480 | hpolarity, vpolarity); |
Arthur Heymans | 063cd5f | 2016-10-12 00:05:00 +0200 | [diff] [blame] | 481 | printk(BIOS_SPEW, "Pixel N=%d, M1=%d, M2=%d, P1=%d, P2=%d\n", |
| 482 | pixel_n, pixel_m1, pixel_m2, pixel_p1, pixel_p2); |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 483 | printk(BIOS_SPEW, "Pixel clock %d kHz\n", |
Arthur Heymans | 1f06028 | 2017-01-19 16:45:45 +0100 | [diff] [blame] | 484 | BASE_FREQUENCY * (5 * (pixel_m1 + 2) + (pixel_m2 + 2)) / |
| 485 | (pixel_n + 2) / (pixel_p1 * pixel_p2)); |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 486 | |
| 487 | mdelay(1); |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 488 | write32(mmio + FP0(0), (pixel_n << 16) |
| 489 | | (pixel_m1 << 8) | pixel_m2); |
| 490 | write32(mmio + DPLL(0), DPLL_VCO_ENABLE |
| 491 | | DPLL_VGA_MODE_DIS | DPLLB_MODE_DAC_SERIAL |
Arthur Heymans | 063cd5f | 2016-10-12 00:05:00 +0200 | [diff] [blame] | 492 | | (pixel_p2 == 10 ? DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 : |
| 493 | DPLL_DAC_SERIAL_P2_CLOCK_DIV_5) |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 494 | | (0x10000 << (pixel_p1 - 1)) |
| 495 | | (6 << 9)); |
| 496 | |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 497 | mdelay(1); |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 498 | write32(mmio + DPLL(0), DPLL_VCO_ENABLE |
| 499 | | DPLL_VGA_MODE_DIS | DPLLB_MODE_DAC_SERIAL |
Arthur Heymans | 063cd5f | 2016-10-12 00:05:00 +0200 | [diff] [blame] | 500 | | (pixel_p2 == 10 ? DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 : |
| 501 | DPLL_DAC_SERIAL_P2_CLOCK_DIV_5) |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 502 | | (0x10000 << (pixel_p1 - 1)) |
| 503 | | (6 << 9)); |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 504 | |
| 505 | write32(mmio + ADPA, ADPA_DAC_ENABLE |
| 506 | | ADPA_PIPE_A_SELECT |
| 507 | | ADPA_CRT_HOTPLUG_MONITOR_COLOR |
| 508 | | ADPA_CRT_HOTPLUG_ENABLE |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 509 | | ADPA_VSYNC_CNTL_ENABLE |
| 510 | | ADPA_HSYNC_CNTL_ENABLE |
| 511 | | ADPA_DPMS_ON |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 512 | | (vpolarity ? ADPA_VSYNC_ACTIVE_LOW : |
| 513 | ADPA_VSYNC_ACTIVE_HIGH) |
| 514 | | (hpolarity ? ADPA_HSYNC_ACTIVE_LOW : |
| 515 | ADPA_HSYNC_ACTIVE_HIGH)); |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 516 | |
| 517 | write32(mmio + HTOTAL(0), |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 518 | ((hactive + right_border + hblank - 1) << 16) |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 519 | | (hactive - 1)); |
| 520 | write32(mmio + HBLANK(0), |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 521 | ((hactive + right_border + hblank - 1) << 16) |
| 522 | | (hactive + right_border - 1)); |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 523 | write32(mmio + HSYNC(0), |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 524 | ((hactive + right_border + hfront_porch + hsync - 1) << 16) |
| 525 | | (hactive + right_border + hfront_porch - 1)); |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 526 | |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 527 | write32(mmio + VTOTAL(0), ((vactive + bottom_border + vblank - 1) << 16) |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 528 | | (vactive - 1)); |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 529 | write32(mmio + VBLANK(0), ((vactive + bottom_border + vblank - 1) << 16) |
| 530 | | (vactive + bottom_border - 1)); |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 531 | write32(mmio + VSYNC(0), |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 532 | ((vactive + bottom_border + vfront_porch + vsync - 1) << 16) |
| 533 | | (vactive + bottom_border + vfront_porch - 1)); |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 534 | |
| 535 | write32(mmio + PIPECONF(0), PIPECONF_DISABLE); |
| 536 | |
| 537 | write32(mmio + PF_WIN_POS(0), 0); |
Nico Huber | 6d8266b | 2017-05-20 16:46:01 +0200 | [diff] [blame] | 538 | if (IS_ENABLED(CONFIG_LINEAR_FRAMEBUFFER)) { |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 539 | write32(mmio + PIPESRC(0), ((hactive - 1) << 16) |
| 540 | | (vactive - 1)); |
| 541 | write32(mmio + PF_CTL(0), 0); |
| 542 | write32(mmio + PF_WIN_SZ(0), 0); |
| 543 | write32(mmio + PFIT_CONTROL, 0); |
| 544 | } else { |
| 545 | write32(mmio + PIPESRC(0), (639 << 16) | 399); |
| 546 | write32(mmio + PF_CTL(0), PF_ENABLE | PF_FILTER_MED_3x3); |
| 547 | write32(mmio + PF_WIN_SZ(0), vactive | (hactive << 16)); |
| 548 | write32(mmio + PFIT_CONTROL, 0x80000000); |
| 549 | } |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 550 | |
| 551 | mdelay(1); |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 552 | write32(mmio + PIPECONF(0), PIPECONF_BPP_6); |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 553 | write32(mmio + PIPECONF(0), PIPECONF_BPP_6 | PIPECONF_DITHER_EN); |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 554 | write32(mmio + PIPECONF(0), PIPECONF_ENABLE |
| 555 | | PIPECONF_BPP_6 | PIPECONF_DITHER_EN); |
| 556 | |
Nico Huber | 6d8266b | 2017-05-20 16:46:01 +0200 | [diff] [blame] | 557 | if (IS_ENABLED(CONFIG_LINEAR_FRAMEBUFFER)) { |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 558 | write32(mmio + VGACNTRL, VGA_DISP_DISABLE); |
| 559 | write32(mmio + DSPCNTR(0), DISPLAY_PLANE_ENABLE |
| 560 | | DISPPLANE_BGRX888); |
| 561 | mdelay(1); |
| 562 | } else { |
| 563 | write32(mmio + VGACNTRL, 0xc4008e); |
| 564 | } |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 565 | |
| 566 | write32(mmio + ADPA, ADPA_DAC_ENABLE |
| 567 | | ADPA_PIPE_A_SELECT |
| 568 | | ADPA_CRT_HOTPLUG_MONITOR_COLOR |
| 569 | | ADPA_CRT_HOTPLUG_ENABLE |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 570 | | ADPA_VSYNC_CNTL_ENABLE |
| 571 | | ADPA_HSYNC_CNTL_ENABLE |
| 572 | | ADPA_DPMS_ON |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 573 | | (vpolarity ? ADPA_VSYNC_ACTIVE_LOW : |
| 574 | ADPA_VSYNC_ACTIVE_HIGH) |
| 575 | | (hpolarity ? ADPA_HSYNC_ACTIVE_LOW : |
| 576 | ADPA_HSYNC_ACTIVE_HIGH)); |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 577 | |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 578 | write32(mmio + PP_CONTROL, PANEL_POWER_ON | PANEL_POWER_RESET); |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 579 | |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 580 | /* Enable screen memory. */ |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 581 | vga_sr_write(1, vga_sr_read(1) & ~0x20); |
| 582 | |
| 583 | /* Clear interrupts. */ |
| 584 | write32(mmio + DEIIR, 0xffffffff); |
| 585 | write32(mmio + SDEIIR, 0xffffffff); |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 586 | |
Nico Huber | 6d8266b | 2017-05-20 16:46:01 +0200 | [diff] [blame] | 587 | if (IS_ENABLED(CONFIG_LINEAR_FRAMEBUFFER)) { |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 588 | memset((void *) lfb, 0, |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 589 | edid->x_resolution * edid->y_resolution * 4); |
| 590 | set_vbe_mode_info_valid(edid, lfb); |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 591 | } |
| 592 | |
| 593 | |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 594 | } |
| 595 | |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 596 | static void gma_ngi(struct device *const dev, struct edid *edid_lvds) |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 597 | { |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 598 | u8 edid_data_vga[128]; |
| 599 | struct edid edid_vga; |
| 600 | int vga_edid_status; |
| 601 | u8 *mmio; |
| 602 | struct northbridge_intel_gm45_config *conf = dev->chip_info; |
| 603 | |
| 604 | mmio = res2mmio(gtt_res, 0, 0); |
| 605 | printk(BIOS_DEBUG, "VGA EDID\n"); |
Arthur Heymans | 8da2286 | 2017-08-06 15:56:30 +0200 | [diff] [blame] | 606 | intel_gmbus_read_edid(mmio + GMBUS0, GMBUS_PORT_VGADDC, 0x50, |
| 607 | edid_data_vga, sizeof(edid_data_vga)); |
Arthur Heymans | c51522f | 2016-08-27 01:09:19 +0200 | [diff] [blame] | 608 | intel_gmbus_stop(mmio + GMBUS0); |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 609 | vga_edid_status = decode_edid(edid_data_vga, |
| 610 | sizeof(edid_data_vga), &edid_vga); |
| 611 | |
| 612 | u32 physbase; |
| 613 | struct resource *lfb_res; |
| 614 | struct resource *pio_res; |
| 615 | |
| 616 | lfb_res = find_resource(dev, PCI_BASE_ADDRESS_2); |
| 617 | pio_res = find_resource(dev, PCI_BASE_ADDRESS_4); |
| 618 | |
| 619 | physbase = pci_read_config32(dev, 0x5c) & ~0xf; |
| 620 | |
| 621 | if (!(physbase && pio_res && pio_res->base && lfb_res && lfb_res->base)) |
| 622 | return; |
| 623 | |
| 624 | printk(BIOS_SPEW, "Initializing display without OPROM. MMIO 0x%llx\n", |
| 625 | gtt_res->base); |
| 626 | if (vga_edid_status != EDID_ABSENT) { |
| 627 | printk(BIOS_DEBUG, "Initialising display on VGA output\n"); |
| 628 | gma_init_vga(conf, mmio, physbase, pio_res->base, lfb_res->base, |
| 629 | &edid_vga); |
| 630 | } else { |
| 631 | printk(BIOS_DEBUG, "Initialising display on LVDS output\n"); |
| 632 | gma_init_lvds(conf, mmio, physbase, pio_res->base, |
| 633 | lfb_res->base, edid_lvds); |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 634 | } |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 635 | |
| 636 | /* Linux relies on VBT for panel info. */ |
| 637 | generate_fake_intel_oprom(&conf->gfx, dev, "$VBT CANTIGA"); |
Arthur Heymans | de6ad83 | 2016-08-22 17:58:46 +0200 | [diff] [blame] | 638 | } |
| 639 | |
Nico Huber | d85a71a | 2016-11-27 14:43:12 +0100 | [diff] [blame] | 640 | static u32 get_cdclk(struct device *const dev) |
| 641 | { |
| 642 | const u16 cdclk_sel = |
| 643 | pci_read_config16 (dev, GCFGC_OFFSET) & GCFGC_CD_MASK; |
| 644 | switch (MCHBAR8(HPLLVCO_MCHBAR) & 0x7) { |
| 645 | case VCO_2666: |
| 646 | case VCO_4000: |
| 647 | case VCO_5333: |
| 648 | return cdclk_sel ? 333333333 : 222222222; |
| 649 | case VCO_3200: |
| 650 | return cdclk_sel ? 320000000 : 228571429; |
| 651 | default: |
| 652 | printk(BIOS_WARNING, |
| 653 | "Unknown VCO frequency, using default cdclk.\n"); |
| 654 | return 222222222; |
| 655 | } |
| 656 | } |
| 657 | |
Arthur Heymans | 12bed26 | 2016-11-24 13:23:05 +0100 | [diff] [blame] | 658 | static u32 freq_to_blc_pwm_ctl(struct device *const dev, |
| 659 | u16 pwm_freq, u8 duty_perc) |
| 660 | { |
| 661 | u32 blc_mod; |
| 662 | |
| 663 | blc_mod = get_cdclk(dev) / (128 * pwm_freq); |
| 664 | |
| 665 | if (duty_perc <= 100) |
| 666 | return (blc_mod << 16) | (blc_mod * duty_perc / 100); |
| 667 | else |
| 668 | return (blc_mod << 16) | blc_mod; |
| 669 | } |
| 670 | |
Arthur Heymans | 4d2d171 | 2018-11-29 12:25:31 +0100 | [diff] [blame] | 671 | u16 get_blc_pwm_freq_value(const char *edid_ascii_string) |
Arthur Heymans | c679b1f | 2018-11-29 12:21:12 +0100 | [diff] [blame] | 672 | { |
| 673 | static u16 blc_pwm_freq; |
| 674 | const struct blc_pwm_t *blc_pwm; |
| 675 | int i; |
| 676 | int blc_array_len; |
| 677 | |
| 678 | if (blc_pwm_freq > 0) |
| 679 | return blc_pwm_freq; |
| 680 | |
| 681 | blc_array_len = get_blc_values(&blc_pwm); |
| 682 | /* Find EDID string and pwm freq in lookup table */ |
| 683 | for (i = 0; i < blc_array_len; i++) { |
| 684 | if (!strcmp(blc_pwm[i].ascii_string, edid_ascii_string)) { |
| 685 | blc_pwm_freq = blc_pwm[i].pwm_freq; |
| 686 | printk(BIOS_DEBUG, "Found EDID string: %s in lookup table, pwm: %dHz\n", |
| 687 | blc_pwm[i].ascii_string, blc_pwm_freq); |
| 688 | break; |
| 689 | } |
| 690 | } |
| 691 | |
| 692 | if (i == blc_array_len) |
| 693 | printk(BIOS_NOTICE, "Your panels EDID `%s` wasn't found in the" |
| 694 | "lookup table.\n You may have issues with your panels" |
| 695 | "backlight.\n If you want to help improving coreboot" |
| 696 | "please report: this EDID string\n and the result" |
| 697 | "of `intel_read read BLC_PWM_CTL`" |
| 698 | "(from intel-gpu-tools)\n while running vendor BIOS\n", |
| 699 | edid_ascii_string); |
| 700 | |
| 701 | return blc_pwm_freq; |
| 702 | } |
| 703 | |
Arthur Heymans | 20cb85f | 2017-04-29 14:31:32 +0200 | [diff] [blame] | 704 | static void gma_pm_init_post_vbios(struct device *const dev, |
| 705 | const char *edid_ascii_string) |
Nico Huber | b851cc6 | 2016-01-09 23:27:16 +0100 | [diff] [blame] | 706 | { |
| 707 | const struct northbridge_intel_gm45_config *const conf = dev->chip_info; |
| 708 | |
| 709 | u32 reg32; |
Arthur Heymans | 12bed26 | 2016-11-24 13:23:05 +0100 | [diff] [blame] | 710 | u8 reg8; |
Arthur Heymans | c679b1f | 2018-11-29 12:21:12 +0100 | [diff] [blame] | 711 | u16 pwm_freq; |
Nico Huber | b851cc6 | 2016-01-09 23:27:16 +0100 | [diff] [blame] | 712 | |
| 713 | /* Setup Panel Power On Delays */ |
| 714 | reg32 = gtt_read(PP_ON_DELAYS); |
| 715 | if (!reg32) { |
| 716 | reg32 = (conf->gpu_panel_power_up_delay & 0x1fff) << 16; |
| 717 | reg32 |= (conf->gpu_panel_power_backlight_on_delay & 0x1fff); |
| 718 | gtt_write(PP_ON_DELAYS, reg32); |
| 719 | } |
| 720 | |
| 721 | /* Setup Panel Power Off Delays */ |
| 722 | reg32 = gtt_read(PP_OFF_DELAYS); |
| 723 | if (!reg32) { |
| 724 | reg32 = (conf->gpu_panel_power_down_delay & 0x1fff) << 16; |
| 725 | reg32 |= (conf->gpu_panel_power_backlight_off_delay & 0x1fff); |
| 726 | gtt_write(PP_OFF_DELAYS, reg32); |
| 727 | } |
| 728 | |
| 729 | /* Setup Panel Power Cycle Delay */ |
| 730 | if (conf->gpu_panel_power_cycle_delay) { |
Nico Huber | d85a71a | 2016-11-27 14:43:12 +0100 | [diff] [blame] | 731 | reg32 = (get_cdclk(dev) / 20000 - 1) |
| 732 | << PP_REFERENCE_DIVIDER_SHIFT; |
Nico Huber | b851cc6 | 2016-01-09 23:27:16 +0100 | [diff] [blame] | 733 | reg32 |= conf->gpu_panel_power_cycle_delay & 0x1f; |
| 734 | gtt_write(PP_DIVISOR, reg32); |
| 735 | } |
| 736 | |
| 737 | /* Enable Backlight */ |
| 738 | gtt_write(BLC_PWM_CTL2, (1 << 31)); |
Arthur Heymans | 12bed26 | 2016-11-24 13:23:05 +0100 | [diff] [blame] | 739 | reg8 = 100; |
| 740 | if (conf->duty_cycle != 0) |
| 741 | reg8 = conf->duty_cycle; |
Arthur Heymans | c679b1f | 2018-11-29 12:21:12 +0100 | [diff] [blame] | 742 | pwm_freq = get_blc_pwm_freq_value(edid_ascii_string); |
| 743 | if (pwm_freq == 0 && conf->default_pwm_freq != 0) |
Arthur Heymans | 20cb85f | 2017-04-29 14:31:32 +0200 | [diff] [blame] | 744 | pwm_freq = conf->default_pwm_freq; |
| 745 | |
Arthur Heymans | 20cb85f | 2017-04-29 14:31:32 +0200 | [diff] [blame] | 746 | if (pwm_freq == 0) |
Nico Huber | b851cc6 | 2016-01-09 23:27:16 +0100 | [diff] [blame] | 747 | gtt_write(BLC_PWM_CTL, 0x06100610); |
| 748 | else |
Arthur Heymans | 20cb85f | 2017-04-29 14:31:32 +0200 | [diff] [blame] | 749 | gtt_write(BLC_PWM_CTL, freq_to_blc_pwm_ctl(dev, pwm_freq, |
| 750 | reg8)); |
Nico Huber | b851cc6 | 2016-01-09 23:27:16 +0100 | [diff] [blame] | 751 | } |
| 752 | |
Vladimir Serbinenko | 6481e10 | 2014-08-10 23:48:11 +0200 | [diff] [blame] | 753 | static void gma_func0_init(struct device *dev) |
| 754 | { |
| 755 | u32 reg32; |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 756 | u8 *mmio; |
| 757 | u8 edid_data_lvds[128]; |
| 758 | struct edid edid_lvds; |
Vladimir Serbinenko | 6481e10 | 2014-08-10 23:48:11 +0200 | [diff] [blame] | 759 | |
| 760 | /* IGD needs to be Bus Master */ |
| 761 | reg32 = pci_read_config32(dev, PCI_COMMAND); |
| 762 | reg32 |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO; |
| 763 | pci_write_config32(dev, PCI_COMMAND, reg32); |
| 764 | |
Vladimir Serbinenko | 6481e10 | 2014-08-10 23:48:11 +0200 | [diff] [blame] | 765 | gtt_res = find_resource(dev, PCI_BASE_ADDRESS_0); |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 766 | if (gtt_res == NULL) |
| 767 | return; |
| 768 | mmio = res2mmio(gtt_res, 0, 0); |
Timothy Pearson | e7f7090 | 2015-04-06 22:01:23 -0500 | [diff] [blame] | 769 | |
Nico Huber | ee352cd | 2016-01-09 23:15:53 +0100 | [diff] [blame] | 770 | if (!IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) { |
| 771 | /* PCI Init, will run VBIOS */ |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 772 | printk(BIOS_DEBUG, "Initialising IGD using VBIOS\n"); |
Nico Huber | ee352cd | 2016-01-09 23:15:53 +0100 | [diff] [blame] | 773 | pci_dev_init(dev); |
Nico Huber | b851cc6 | 2016-01-09 23:27:16 +0100 | [diff] [blame] | 774 | } |
| 775 | |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 776 | printk(BIOS_DEBUG, "LVDS EDID\n"); |
Arthur Heymans | 8da2286 | 2017-08-06 15:56:30 +0200 | [diff] [blame] | 777 | intel_gmbus_read_edid(mmio + GMBUS0, GMBUS_PORT_PANEL, 0x50, |
| 778 | edid_data_lvds, sizeof(edid_data_lvds)); |
Arthur Heymans | 53485d2 | 2017-04-30 08:29:54 +0200 | [diff] [blame] | 779 | intel_gmbus_stop(mmio + GMBUS0); |
| 780 | decode_edid(edid_data_lvds, sizeof(edid_data_lvds), &edid_lvds); |
| 781 | |
Nico Huber | b851cc6 | 2016-01-09 23:27:16 +0100 | [diff] [blame] | 782 | /* Post VBIOS init */ |
Arthur Heymans | 20cb85f | 2017-04-29 14:31:32 +0200 | [diff] [blame] | 783 | gma_pm_init_post_vbios(dev, edid_lvds.ascii_string); |
Nico Huber | b851cc6 | 2016-01-09 23:27:16 +0100 | [diff] [blame] | 784 | |
Arthur Heymans | e6c8f7e | 2018-08-09 11:31:51 +0200 | [diff] [blame] | 785 | int vga_disable = (pci_read_config16(dev, D0F0_GGC) & 2) >> 1; |
| 786 | |
| 787 | if (vga_disable) { |
| 788 | printk(BIOS_INFO, |
| 789 | "IGD is not decoding legacy VGA MEM and IO: skipping NATIVE graphic init\n"); |
| 790 | } else { |
| 791 | if (IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT)) { |
| 792 | gma_ngi(dev, &edid_lvds); |
| 793 | } else if (IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) { |
| 794 | int lightup_ok; |
| 795 | gma_gfxinit(&lightup_ok); |
| 796 | } |
Nico Huber | f2dd049 | 2017-10-29 15:42:44 +0100 | [diff] [blame] | 797 | } |
Patrick Rudolph | f6aa7d9 | 2017-09-29 18:28:23 +0200 | [diff] [blame] | 798 | |
| 799 | intel_gma_restore_opregion(); |
Vladimir Serbinenko | 6481e10 | 2014-08-10 23:48:11 +0200 | [diff] [blame] | 800 | } |
| 801 | |
Elyes HAOUAS | b60920d | 2018-09-20 17:38:38 +0200 | [diff] [blame] | 802 | static void gma_set_subsystem(struct device *dev, unsigned int vendor, |
| 803 | unsigned int device) |
Vladimir Serbinenko | 6481e10 | 2014-08-10 23:48:11 +0200 | [diff] [blame] | 804 | { |
| 805 | if (!vendor || !device) { |
| 806 | pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, |
| 807 | pci_read_config32(dev, PCI_VENDOR_ID)); |
| 808 | } else { |
| 809 | pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, |
| 810 | ((device & 0xffff) << 16) | (vendor & |
| 811 | 0xffff)); |
| 812 | } |
| 813 | } |
| 814 | |
Vladimir Serbinenko | dd2bc3f | 2014-10-31 09:16:31 +0100 | [diff] [blame] | 815 | const struct i915_gpu_controller_info * |
| 816 | intel_gma_get_controller_info(void) |
| 817 | { |
Kyösti Mälkki | c70eed1 | 2018-05-22 02:18:00 +0300 | [diff] [blame^] | 818 | struct device *dev = pcidev_on_root(0x2, 0); |
Vladimir Serbinenko | dd2bc3f | 2014-10-31 09:16:31 +0100 | [diff] [blame] | 819 | if (!dev) { |
| 820 | return NULL; |
| 821 | } |
| 822 | struct northbridge_intel_gm45_config *chip = dev->chip_info; |
| 823 | return &chip->gfx; |
| 824 | } |
| 825 | |
Elyes HAOUAS | 6dcdaaf | 2018-02-09 07:44:31 +0100 | [diff] [blame] | 826 | static void gma_ssdt(struct device *device) |
Vladimir Serbinenko | dd2bc3f | 2014-10-31 09:16:31 +0100 | [diff] [blame] | 827 | { |
| 828 | const struct i915_gpu_controller_info *gfx = intel_gma_get_controller_info(); |
| 829 | if (!gfx) { |
| 830 | return; |
| 831 | } |
| 832 | |
| 833 | drivers_intel_gma_displays_ssdt_generate(gfx); |
| 834 | } |
| 835 | |
Patrick Rudolph | f6aa7d9 | 2017-09-29 18:28:23 +0200 | [diff] [blame] | 836 | static unsigned long |
| 837 | gma_write_acpi_tables(struct device *const dev, |
| 838 | unsigned long current, |
| 839 | struct acpi_rsdp *const rsdp) |
| 840 | { |
| 841 | igd_opregion_t *opregion = (igd_opregion_t *)current; |
| 842 | global_nvs_t *gnvs; |
| 843 | |
| 844 | if (intel_gma_init_igd_opregion(opregion) != CB_SUCCESS) |
| 845 | return current; |
| 846 | |
| 847 | current += sizeof(igd_opregion_t); |
| 848 | |
| 849 | /* GNVS has been already set up */ |
| 850 | gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); |
| 851 | if (gnvs) { |
| 852 | /* IGD OpRegion Base Address */ |
| 853 | gma_set_gnvs_aslb(gnvs, (uintptr_t)opregion); |
| 854 | } else { |
| 855 | printk(BIOS_ERR, "Error: GNVS table not found.\n"); |
| 856 | } |
| 857 | |
| 858 | current = acpi_align_current(current); |
| 859 | return current; |
| 860 | } |
| 861 | |
| 862 | static const char *gma_acpi_name(const struct device *dev) |
| 863 | { |
| 864 | return "GFX0"; |
| 865 | } |
| 866 | |
Vladimir Serbinenko | 6481e10 | 2014-08-10 23:48:11 +0200 | [diff] [blame] | 867 | static struct pci_operations gma_pci_ops = { |
| 868 | .set_subsystem = gma_set_subsystem, |
| 869 | }; |
| 870 | |
| 871 | static struct device_operations gma_func0_ops = { |
| 872 | .read_resources = pci_dev_read_resources, |
| 873 | .set_resources = pci_dev_set_resources, |
| 874 | .enable_resources = pci_dev_enable_resources, |
Vladimir Serbinenko | dd2bc3f | 2014-10-31 09:16:31 +0100 | [diff] [blame] | 875 | .acpi_fill_ssdt_generator = gma_ssdt, |
Vladimir Serbinenko | 6481e10 | 2014-08-10 23:48:11 +0200 | [diff] [blame] | 876 | .init = gma_func0_init, |
| 877 | .scan_bus = 0, |
| 878 | .enable = 0, |
| 879 | .ops_pci = &gma_pci_ops, |
Patrick Rudolph | f6aa7d9 | 2017-09-29 18:28:23 +0200 | [diff] [blame] | 880 | .acpi_name = gma_acpi_name, |
| 881 | .write_acpi_tables = gma_write_acpi_tables, |
Vladimir Serbinenko | 6481e10 | 2014-08-10 23:48:11 +0200 | [diff] [blame] | 882 | }; |
| 883 | |
| 884 | static const unsigned short pci_device_ids[] = |
| 885 | { |
| 886 | 0x2a42, 0 |
| 887 | }; |
| 888 | |
| 889 | static const struct pci_driver gma __pci_driver = { |
| 890 | .ops = &gma_func0_ops, |
| 891 | .vendor = PCI_VENDOR_ID_INTEL, |
| 892 | .devices = pci_device_ids, |
| 893 | }; |