blob: e8a57b17c8bc18912aedb18621db76746ae67eba [file] [log] [blame]
Stefan Reinauer30140a52009-03-11 16:20:39 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2008-2009 coresystems GmbH
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
Paul Menzela46a7122013-02-23 18:37:27 +010017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Stefan Reinauer30140a52009-03-11 16:20:39 +000018 */
19
20#include <console/console.h>
Kyösti Mälkkiab56b3b2013-11-28 16:44:51 +020021#include <bootmode.h>
Patrick Georgi6444bd42012-07-06 11:31:39 +020022#include <delay.h>
Stefan Reinauer30140a52009-03-11 16:20:39 +000023#include <device/device.h>
24#include <device/pci.h>
25#include <device/pci_ids.h>
Sven Schnelleb629d142011-06-12 14:30:10 +020026#include <pc80/mc146818rtc.h>
Vladimir Serbinenko26ca08c2014-06-01 00:24:05 +020027#include <edid.h>
28#include <drivers/intel/gma/edid.h>
29#include <drivers/intel/gma/i915.h>
30#include <string.h>
31
Patrick Georgice6e9fe2012-07-20 12:37:06 +020032#include "i945.h"
Vladimir Serbinenko26ca08c2014-06-01 00:24:05 +020033#include "chip.h"
Stefan Reinauer30140a52009-03-11 16:20:39 +000034
Patrick Georgi6444bd42012-07-06 11:31:39 +020035#define GDRST 0xc0
36
Vladimir Serbinenko26ca08c2014-06-01 00:24:05 +020037#define LVDS_CLOCK_A_POWERUP_ALL (3 << 8)
38#define LVDS_CLOCK_B_POWERUP_ALL (3 << 4)
39#define LVDS_CLOCK_BOTH_POWERUP_ALL (3 << 2)
40#define DISPPLANE_BGRX888 (0x6<<26)
41#define DPLLB_LVDS_P2_CLOCK_DIV_7 (1 << 24) /* i915 */
42
43#define DPLL_INTEGRATED_CRI_CLK_VLV (1<<14)
44
45#define PGETBL_CTL 0x2020
46#define PGETBL_ENABLED 0x00000001
47
48#define BASE_FREQUENCY 120000
49
50#if CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT
51
52static int gtt_setup(unsigned int mmiobase)
53{
54 unsigned long PGETBL_save;
Paul Menzelcc95f182014-06-05 22:45:35 +020055 unsigned long tom; // top of memory
Vladimir Serbinenko26ca08c2014-06-01 00:24:05 +020056
Paul Menzelcc95f182014-06-05 22:45:35 +020057 /*
58 * The Video BIOS places the GTT right below top of memory.
59 *
60 * It is not documented in the Intel 945 datasheet, but the Intel
61 * developers said that it is normally placed there.
62 *
63 * TODO: Add option to make the GTT size runtime configurable
64 */
65 tom = pci_read_config8(dev_find_slot(0, PCI_DEVFN(0, 0)), TOLUD) << 24;
66 PGETBL_save = tom - 256 * KiB;
Vladimir Serbinenko26ca08c2014-06-01 00:24:05 +020067 PGETBL_save |= PGETBL_ENABLED;
Vladimir Serbinenko26ca08c2014-06-01 00:24:05 +020068 PGETBL_save |= 2; /* set GTT to 256kb */
69
70 write32(mmiobase + GFX_FLSH_CNTL, 0);
71
72 write32(mmiobase + PGETBL_CTL, PGETBL_save);
73
74 /* verify */
75 if (read32(mmiobase + PGETBL_CTL) & PGETBL_ENABLED) {
76 printk(BIOS_DEBUG, "gtt_setup is enabled.\n");
77 } else {
78 printk(BIOS_DEBUG, "gtt_setup failed!!!\n");
79 return 1;
80 }
81 write32(mmiobase + GFX_FLSH_CNTL, 0);
82
83 return 0;
84}
85
86static int intel_gma_init(struct northbridge_intel_i945_config *conf,
87 unsigned int pphysbase, unsigned int piobase,
88 unsigned int pmmio, unsigned int pgfx)
89{
90 struct edid edid;
91 u8 edid_data[128];
92 unsigned long temp;
93 int hpolarity, vpolarity;
94 u32 candp1, candn;
95 u32 best_delta = 0xffffffff;
96 u32 target_frequency;
97 u32 pixel_p1 = 1;
98 u32 pixel_n = 1;
99 u32 pixel_m1 = 1;
100 u32 pixel_m2 = 1;
101 u32 hactive, vactive, right_border, bottom_border;
102 u32 vsync, hsync, vblank, hblank, hfront_porch, vfront_porch;
103 u32 i, j;
104 u32 uma_size;
105 u16 reg16;
106
107 pphysbase += 0x20000;
108
109 printk(BIOS_SPEW,
110 "i915lightup: graphics %p mmio %08x addrport %04x physbase %08x\n",
111 (void *)pgfx, pmmio, piobase, pphysbase);
112
113 intel_gmbus_read_edid(pmmio + GMBUS0, 3, 0x50, edid_data, 128);
114 decode_edid(edid_data, sizeof(edid_data), &edid);
115
116 hpolarity = (edid.phsync == '-');
117 vpolarity = (edid.pvsync == '-');
118 hactive = edid.x_resolution;
119 vactive = edid.y_resolution;
120 right_border = edid.hborder;
121 bottom_border = edid.vborder;
122 vblank = edid.vbl;
123 hblank = edid.hbl;
124 vsync = edid.vspw;
125 hsync = edid.hspw;
126 hfront_porch = edid.hso;
127 vfront_porch = edid.vso;
128
129 for (i = 0; i < 2; i++)
130 for (j = 0; j < 0x100; j++)
131 /* R=j, G=j, B=j. */
132 write32(pmmio + PALETTE(i) + 4 * j, 0x10101 * j);
133
134 write32(pmmio + PCH_PP_CONTROL, PANEL_UNLOCK_REGS
135 | (read32(pmmio + PCH_PP_CONTROL) & ~PANEL_UNLOCK_MASK));
136
137 write32(pmmio + MI_ARB_STATE, MI_ARB_C3_LP_WRITE_ENABLE | (1 << 27));
138 /* Clean registers. */
139 for (i = 0; i < 0x20; i += 4)
140 write32(pmmio + RENDER_RING_BASE + i, 0);
141 for (i = 0; i < 0x20; i += 4)
142 write32(pmmio + FENCE_REG_965_0 + i, 0);
143 write32(pmmio + PP_ON_DELAYS, 0);
144 write32(pmmio + PP_OFF_DELAYS, 0);
145
146 /* Disable VGA. */
147 write32(pmmio + VGACNTRL, VGA_DISP_DISABLE);
148
149 /* Disable pipes. */
150 write32(pmmio + PIPECONF(0), 0);
151 write32(pmmio + PIPECONF(1), 0);
152
153 /* Init PRB0. */
154 write32(pmmio + HWS_PGA, 0x352d2000);
155 write32(pmmio + PRB0_CTL, 0);
156 write32(pmmio + PRB0_HEAD, 0);
157 write32(pmmio + PRB0_TAIL, 0);
158 write32(pmmio + PRB0_START, 0);
159 write32(pmmio + PRB0_CTL, 0x0001f001);
160
161 write32(pmmio + D_STATE, DSTATE_PLL_D3_OFF
162 | DSTATE_GFX_CLOCK_GATING | DSTATE_DOT_CLOCK_GATING);
163 write32(pmmio + ECOSKPD, 0x00010000);
164 write32(pmmio + HWSTAM, 0xeffe);
165 write32(pmmio + PORT_HOTPLUG_EN, conf->gpu_hotplug);
166 write32(pmmio + INSTPM, 0x08000000 | INSTPM_AGPBUSY_DIS);
167
168 target_frequency = conf->gpu_lvds_is_dual_channel ? edid.pixel_clock
169 : (2 * edid.pixel_clock);
170
171 /* Find suitable divisors. */
172 for (candp1 = 1; candp1 <= 8; candp1++) {
173 for (candn = 5; candn <= 10; candn++) {
174 u32 cur_frequency;
175 u32 m; /* 77 - 131. */
176 u32 denom; /* 35 - 560. */
177 u32 current_delta;
178
179 denom = candn * candp1 * 7;
180 /* Doesnt overflow for up to
181 5000000 kHz = 5 GHz. */
182 m = (target_frequency * denom
183 + BASE_FREQUENCY / 2) / BASE_FREQUENCY;
184
185 if (m < 77 || m > 131)
186 continue;
187
188 cur_frequency = (BASE_FREQUENCY * m) / denom;
189 if (target_frequency > cur_frequency)
190 current_delta = target_frequency - cur_frequency;
191 else
192 current_delta = cur_frequency - target_frequency;
193
194 if (best_delta > current_delta) {
195 best_delta = current_delta;
196 pixel_n = candn;
197 pixel_p1 = candp1;
198 pixel_m2 = ((m + 3) % 5) + 7;
199 pixel_m1 = (m - pixel_m2) / 5;
200 }
201 }
202 }
203
204 if (best_delta == 0xffffffff) {
205 printk (BIOS_ERR, "Couldn't find GFX clock divisors\n");
206 return -1;
207 }
208
209 printk(BIOS_INFO, "bringing up panel at resolution %d x %d\n",
210 hactive, vactive);
211 printk(BIOS_DEBUG, "Borders %d x %d\n", right_border, bottom_border);
212 printk(BIOS_DEBUG, "Blank %d x %d\n", hblank, vblank);
213 printk(BIOS_DEBUG, "Sync %d x %d\n", hsync, vsync);
214 printk(BIOS_DEBUG, "Front porch %d x %d\n", hfront_porch, vfront_porch);
215 printk(BIOS_DEBUG, (conf->gpu_lvds_use_spread_spectrum_clock
216 ? "Spread spectrum clock\n"
217 : "DREF clock\n"));
218 printk(BIOS_DEBUG, (conf->gpu_lvds_is_dual_channel
219 ? "Dual channel\n"
220 : "Single channel\n"));
221 printk(BIOS_DEBUG, "Polarities %d, %d\n",
222 hpolarity, vpolarity);
223 printk(BIOS_DEBUG, "Pixel N=%d, M1=%d, M2=%d, P1=%d\n",
224 pixel_n, pixel_m1, pixel_m2, pixel_p1);
225 printk(BIOS_DEBUG, "Pixel clock %d kHz\n",
226 BASE_FREQUENCY * (5 * pixel_m1 + pixel_m2) / pixel_n
227 / (pixel_p1 * 7));
228
229 write32(pmmio + DSPCNTR(0), DISPPLANE_BGRX888
230 | DISPPLANE_SEL_PIPE_B | DISPPLANE_GAMMA_ENABLE);
231
232 mdelay(1);
233 write32(pmmio + PP_CONTROL, PANEL_UNLOCK_REGS
234 | (read32(pmmio + PP_CONTROL) & ~PANEL_UNLOCK_MASK));
235 write32(pmmio + FP0(1),
236 ((pixel_n - 2) << 16)
237 | ((pixel_m1 - 2) << 8) | pixel_m2);
238 write32(pmmio + DPLL(1),
239 DPLL_VGA_MODE_DIS |
240 DPLL_VCO_ENABLE | DPLLB_MODE_LVDS
241 | (conf->gpu_lvds_is_dual_channel ? DPLLB_LVDS_P2_CLOCK_DIV_7
242 : DPLLB_LVDS_P2_CLOCK_DIV_14)
243 | (conf->gpu_lvds_use_spread_spectrum_clock
244 ? DPLL_INTEGRATED_CLOCK_VLV | DPLL_INTEGRATED_CRI_CLK_VLV
245 : 0)
246 | (pixel_p1 << 16)
247 | (pixel_p1));
248 mdelay(1);
249 write32(pmmio + DPLL(1),
250 DPLL_VGA_MODE_DIS |
251 DPLL_VCO_ENABLE | DPLLB_MODE_LVDS
252 | (conf->gpu_lvds_is_dual_channel ? DPLLB_LVDS_P2_CLOCK_DIV_7
253 : DPLLB_LVDS_P2_CLOCK_DIV_14)
254 | ((conf->gpu_lvds_use_spread_spectrum_clock ? 3 : 0) << 13)
255 | (pixel_p1 << 16)
256 | (pixel_p1));
257 mdelay(1);
258 write32(pmmio + HTOTAL(1),
259 ((hactive + right_border + hblank - 1) << 16)
260 | (hactive - 1));
261 write32(pmmio + HBLANK(1),
262 ((hactive + right_border + hblank - 1) << 16)
263 | (hactive + right_border - 1));
264 write32(pmmio + HSYNC(1),
265 ((hactive + right_border + hfront_porch + hsync - 1) << 16)
266 | (hactive + right_border + hfront_porch - 1));
267
268 write32(pmmio + VTOTAL(1), ((vactive + bottom_border + vblank - 1) << 16)
269 | (vactive - 1));
270 write32(pmmio + VBLANK(1), ((vactive + bottom_border + vblank - 1) << 16)
271 | (vactive + bottom_border - 1));
272 write32(pmmio + VSYNC(1),
273 (vactive + bottom_border + vfront_porch + vsync - 1)
274 | (vactive + bottom_border + vfront_porch - 1));
275
276 write32(pmmio + PIPESRC(1), ((hactive - 1) << 16) | (vactive - 1));
277
278 /* Disable panel fitter (we're in native resolution). */
279 write32(pmmio + PF_CTL(0), 0);
280 write32(pmmio + PF_WIN_SZ(0), 0);
281 write32(pmmio + PF_WIN_POS(0), 0);
282 write32(pmmio + PFIT_PGM_RATIOS, 0);
283 write32(pmmio + PFIT_CONTROL, 0);
284
285 mdelay(1);
286
287 write32(pmmio + DSPSIZE(0), (hactive - 1) | ((vactive - 1) << 16));
288 write32(pmmio + DSPPOS(0), 0);
289
290 /* Backlight init. */
291 write32(pmmio + FW_BLC_SELF, FW_BLC_SELF_EN_MASK);
292 write32(pmmio + FW_BLC, 0x011d011a);
293 write32(pmmio + FW_BLC2, 0x00000102);
294 write32(pmmio + FW_BLC_SELF, FW_BLC_SELF_EN_MASK);
295 write32(pmmio + FW_BLC_SELF, 0x0001003f);
296 write32(pmmio + FW_BLC, 0x011d0109);
297 write32(pmmio + FW_BLC2, 0x00000102);
298 write32(pmmio + FW_BLC_SELF, FW_BLC_SELF_EN_MASK);
299 write32(pmmio + BLC_PWM_CTL, conf->gpu_backlight);
300
301 edid.bytes_per_line = (edid.bytes_per_line + 63) & ~63;
302 write32(pmmio + DSPADDR(0), 0);
303 write32(pmmio + DSPSURF(0), 0);
304 write32(pmmio + DSPSTRIDE(0), edid.bytes_per_line);
305 write32(pmmio + DSPCNTR(0), DISPLAY_PLANE_ENABLE | DISPPLANE_BGRX888
306 | DISPPLANE_SEL_PIPE_B | DISPPLANE_GAMMA_ENABLE);
307 mdelay(1);
308
309 write32(pmmio + PIPECONF(1), PIPECONF_ENABLE);
310 write32(pmmio + LVDS, LVDS_ON
311 | (hpolarity << 20) | (vpolarity << 21)
312 | (conf->gpu_lvds_is_dual_channel ? LVDS_CLOCK_B_POWERUP_ALL
313 | LVDS_CLOCK_BOTH_POWERUP_ALL : 0)
314 | LVDS_CLOCK_A_POWERUP_ALL
315 | LVDS_PIPE(1));
316
317 write32(pmmio + PP_CONTROL, PANEL_UNLOCK_REGS | PANEL_POWER_OFF);
318 write32(pmmio + PP_CONTROL, PANEL_UNLOCK_REGS | PANEL_POWER_RESET);
319 mdelay(1);
320 write32(pmmio + PP_CONTROL, PANEL_UNLOCK_REGS
321 | PANEL_POWER_ON | PANEL_POWER_RESET);
322
323 printk (BIOS_DEBUG, "waiting for panel powerup\n");
324 while (1) {
325 u32 reg32;
326 reg32 = read32(pmmio + PP_STATUS);
327 if ((reg32 & PP_SEQUENCE_MASK) == PP_SEQUENCE_NONE)
328 break;
329 }
330 printk (BIOS_DEBUG, "panel powered up\n");
331
332 write32(pmmio + PP_CONTROL, PANEL_POWER_ON | PANEL_POWER_RESET);
333
334 /* Clear interrupts. */
335 write32(pmmio + DEIIR, 0xffffffff);
336 write32(pmmio + SDEIIR, 0xffffffff);
337 write32(pmmio + IIR, 0xffffffff);
338 write32(pmmio + IMR, 0xffffffff);
339 write32(pmmio + EIR, 0xffffffff);
340
341 if (gtt_setup(pmmio)) {
342 printk(BIOS_ERR, "ERROR: GTT Setup Failed!!!\n");
343 return 0;
344 }
345
346 /* Setup GTT. */
347
348 reg16 = pci_read_config16(dev_find_slot(0, PCI_DEVFN(0, 0)), GGC);
349 uma_size = 0;
350 if (!(reg16 & 2)) {
351 reg16 >>= 4;
352 reg16 &= 7;
353 switch (reg16) {
354 case 1:
355 uma_size = 1024;
356 break;
357 case 3:
358 uma_size = 8192;
359 break;
360 }
361
362 printk(BIOS_DEBUG, "%dM UMA\n", uma_size >> 10);
363 }
364
365 for (i = 0; i < uma_size / 4; i++)
366 {
367 outl((i << 2) | 1, piobase);
368 outl(pphysbase + (i << 12) + 1, piobase + 4);
369 }
370
371 temp = read32(pmmio + PGETBL_CTL);
372 printk(BIOS_INFO, "GTT PGETBL_CTL register: 0x%lx\n", temp);
373
374 if (temp & 1)
375 printk(BIOS_INFO, "GTT Enabled\n");
376 else
377 printk(BIOS_ERR, "ERROR: GTT is still Disabled!!!\n");
378
379 printk(BIOS_SPEW, "memset %p to 0x00 for %d bytes\n",
380 (void *)pgfx, hactive * vactive * 4);
381 memset((void *)pgfx, 0x00, hactive * vactive * 4);
382
383 set_vbe_mode_info_valid(&edid, pgfx);
384
385 return 0;
386}
387#endif
388
Stefan Reinauer30140a52009-03-11 16:20:39 +0000389static void gma_func0_init(struct device *dev)
390{
391 u32 reg32;
392
Patrick Georgi6444bd42012-07-06 11:31:39 +0200393 /* Unconditionally reset graphics */
394 pci_write_config8(dev, GDRST, 1);
395 udelay(50);
396 pci_write_config8(dev, GDRST, 0);
397 /* wait for device to finish */
398 while (pci_read_config8(dev, GDRST) & 1) { };
399
Stefan Reinauer30140a52009-03-11 16:20:39 +0000400 /* IGD needs to be Bus Master */
401 reg32 = pci_read_config32(dev, PCI_COMMAND);
Vladimir Serbinenko26ca08c2014-06-01 00:24:05 +0200402 pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER
403 | PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
Denis 'GNUtoo' Cariklied7e29e2013-02-24 12:01:44 +0100404
405#if !CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT
406 /* PCI Init, will run VBIOS */
Stefan Reinauer30140a52009-03-11 16:20:39 +0000407 pci_dev_init(dev);
Denis 'GNUtoo' Cariklied7e29e2013-02-24 12:01:44 +0100408#endif
409
410
411#if CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT
412 /* This should probably run before post VBIOS init. */
413 printk(BIOS_SPEW, "Initializing VGA without OPROM.\n");
Peter Stuge03e4ac62013-06-08 01:25:43 +0200414 u32 iobase, mmiobase, graphics_base;
Vladimir Serbinenko26ca08c2014-06-01 00:24:05 +0200415 struct northbridge_intel_i945_config *conf = dev->chip_info;
416
Denis 'GNUtoo' Cariklied7e29e2013-02-24 12:01:44 +0100417 iobase = dev->resource_list[1].base;
418 mmiobase = dev->resource_list[0].base;
Vladimir Serbinenko26ca08c2014-06-01 00:24:05 +0200419 graphics_base = dev->resource_list[2].base;
Denis 'GNUtoo' Cariklied7e29e2013-02-24 12:01:44 +0100420
Peter Stugec6f09972013-06-08 01:31:44 +0200421 printk(BIOS_SPEW, "GMADR=0x%08x GTTADR=0x%08x\n",
Paul Menzeld235da12014-06-03 00:15:30 +0200422 pci_read_config32(dev, GMADR),
423 pci_read_config32(dev, GTTADR)
Peter Stugec6f09972013-06-08 01:31:44 +0200424 );
425
Vladimir Serbinenko26ca08c2014-06-01 00:24:05 +0200426 int err;
427 err = intel_gma_init(conf, pci_read_config32(dev, 0x5c) & ~0xf,
428 iobase, mmiobase, graphics_base);
429 if (err == 0)
Kyösti Mälkkiab56b3b2013-11-28 16:44:51 +0200430 gfx_set_init_done(1);
Denis 'GNUtoo' Cariklied7e29e2013-02-24 12:01:44 +0100431#endif
Stefan Reinauer30140a52009-03-11 16:20:39 +0000432}
433
Patrick Georgice6e9fe2012-07-20 12:37:06 +0200434/* This doesn't reclaim stolen UMA memory, but IGD could still
435 be reenabled later. */
436static void gma_func0_disable(struct device *dev)
437{
438 struct device *dev_host = dev_find_slot(0, PCI_DEVFN(0x0, 0));
439
440 pci_write_config16(dev, GCFC, 0xa00);
441 pci_write_config16(dev_host, GGC, (1 << 1));
442
443 unsigned int reg32 = pci_read_config32(dev_host, DEVEN);
444 reg32 &= ~(DEVEN_D2F0 | DEVEN_D2F1);
445 pci_write_config32(dev_host, DEVEN, reg32);
446
447 dev->enabled = 0;
448}
449
Stefan Reinauer30140a52009-03-11 16:20:39 +0000450static void gma_func1_init(struct device *dev)
451{
452 u32 reg32;
Sven Schnelleb629d142011-06-12 14:30:10 +0200453 u8 val;
Stefan Reinauer30140a52009-03-11 16:20:39 +0000454
455 /* IGD needs to be Bus Master, also enable IO accesss */
456 reg32 = pci_read_config32(dev, PCI_COMMAND);
Stefan Reinauer109ab312009-08-12 16:08:05 +0000457 pci_write_config32(dev, PCI_COMMAND, reg32 |
Vladimir Serbinenko26ca08c2014-06-01 00:24:05 +0200458 PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO);
Sven Schnelleb629d142011-06-12 14:30:10 +0200459
Alexandru Gagniuc72dccce2013-11-23 19:22:53 -0600460 if (get_option(&val, "tft_brightness") == CB_SUCCESS)
Sven Schnelleb629d142011-06-12 14:30:10 +0200461 pci_write_config8(dev, 0xf4, val);
462 else
463 pci_write_config8(dev, 0xf4, 0xff);
Stefan Reinauer30140a52009-03-11 16:20:39 +0000464}
465
466static void gma_set_subsystem(device_t dev, unsigned vendor, unsigned device)
467{
468 if (!vendor || !device) {
469 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
470 pci_read_config32(dev, PCI_VENDOR_ID));
471 } else {
472 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
473 ((device & 0xffff) << 16) | (vendor & 0xffff));
474 }
475}
476
477static struct pci_operations gma_pci_ops = {
478 .set_subsystem = gma_set_subsystem,
479};
480
481static struct device_operations gma_func0_ops = {
482 .read_resources = pci_dev_read_resources,
483 .set_resources = pci_dev_set_resources,
484 .enable_resources = pci_dev_enable_resources,
485 .init = gma_func0_init,
486 .scan_bus = 0,
487 .enable = 0,
Patrick Georgice6e9fe2012-07-20 12:37:06 +0200488 .disable = gma_func0_disable,
Stefan Reinauer30140a52009-03-11 16:20:39 +0000489 .ops_pci = &gma_pci_ops,
490};
491
492
493static struct device_operations gma_func1_ops = {
494 .read_resources = pci_dev_read_resources,
495 .set_resources = pci_dev_set_resources,
496 .enable_resources = pci_dev_enable_resources,
497 .init = gma_func1_init,
498 .scan_bus = 0,
499 .enable = 0,
500 .ops_pci = &gma_pci_ops,
501};
502
503static const struct pci_driver i945_gma_func0_driver __pci_driver = {
504 .ops = &gma_func0_ops,
505 .vendor = PCI_VENDOR_ID_INTEL,
506 .device = 0x27a2,
507};
508
509static const struct pci_driver i945_gma_func1_driver __pci_driver = {
510 .ops = &gma_func1_ops,
511 .vendor = PCI_VENDOR_ID_INTEL,
512 .device = 0x27a6,
513};