blob: 57e13291aeab5a0e350b4637c7162bd74315551e [file] [log] [blame]
Duncan Lauriee3f75f82013-10-28 15:49:34 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2013 Google Inc.
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.
Duncan Lauriee3f75f82013-10-28 15:49:34 -070014 */
15
16#include <arch/io.h>
17#include <console/console.h>
18#include <delay.h>
19#include <device/device.h>
20#include <device/pci.h>
21#include <device/pci_ids.h>
Duncan Laurie223d4a4f2013-10-31 08:27:29 -070022#include <reg_script.h>
Patrick Georgi04f68c12014-11-17 08:45:02 +010023#include <stdlib.h>
Duncan Lauriee3f75f82013-10-28 15:49:34 -070024
Julius Werner18ea2d32014-10-07 16:42:17 -070025#include <soc/gfx.h>
26#include <soc/iosf.h>
27#include <soc/pci_devs.h>
28#include <soc/ramstage.h>
Duncan Lauriee3f75f82013-10-28 15:49:34 -070029
Duncan Laurieb40e4442013-12-09 14:38:57 -080030#include "chip.h"
31
Duncan Laurie223d4a4f2013-10-31 08:27:29 -070032#define GFX_TIMEOUT 100000 /* 100ms */
Duncan Lauriee3f75f82013-10-28 15:49:34 -070033
34/*
35 * Lock Power Context Base Register to point to a 24KB block
36 * of memory in GSM. Power context save data is stored here.
37 */
38static void gfx_lock_pcbase(device_t dev)
39{
Duncan Laurie223d4a4f2013-10-31 08:27:29 -070040 struct resource *res = find_resource(dev, PCI_BASE_ADDRESS_0);
Duncan Lauriee3f75f82013-10-28 15:49:34 -070041 const u16 gms_size_map[17] = { 0,32,64,96,128,160,192,224,256,
42 288,320,352,384,416,448,480,512 };
43 u32 pcsize = 24 << 10; /* 24KB */
44 u32 wopcmsz = 0x100000; /* PAVP offset */
45 u32 gms, gmsize, pcbase;
46
47 gms = pci_read_config32(dev, GGC) & GGC_GSM_SIZE_MASK;
48 gms >>= 3;
Patrick Georgi04f68c12014-11-17 08:45:02 +010049 if (gms > ARRAY_SIZE(gms_size_map))
Duncan Lauriee3f75f82013-10-28 15:49:34 -070050 return;
51 gmsize = gms_size_map[gms];
52
53 /* PcBase = BDSM + GMS Size - WOPCMSZ - PowerContextSize */
54 pcbase = pci_read_config32(dev, GSM_BASE) & 0xfff00000;
55 pcbase += (gmsize-1) * wopcmsz - pcsize;
56 pcbase |= 1; /* Lock */
57
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080058 write32((u32 *)(uintptr_t)(res->base + 0x182120), pcbase);
Duncan Laurie223d4a4f2013-10-31 08:27:29 -070059}
60
61static const struct reg_script gfx_init_script[] = {
62 /* Allow-Wake render/media wells */
63 REG_RES_RMW32(PCI_BASE_ADDRESS_0, 0x130090, ~1, 1),
64 REG_RES_POLL32(PCI_BASE_ADDRESS_0, 0x130094, 1, 1, GFX_TIMEOUT),
65 /* Render Force-Wake */
66 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x1300b0, 0x80008000),
67 REG_RES_POLL32(PCI_BASE_ADDRESS_0, 0x1300b4, 0x8000, 0x8000,
68 GFX_TIMEOUT),
69 /* Media Force-Wake */
70 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x1300b8, 0x80008000),
71 REG_RES_POLL32(PCI_BASE_ADDRESS_0, 0x1300bc, 0x8000, 0x8000,
72 GFX_TIMEOUT),
73 /* Workaround - X0:261954/A0:261955 */
74 REG_RES_RMW32(PCI_BASE_ADDRESS_0, 0x182060, ~0xf, 1),
75
76 /*
77 * PowerMeter Weights
78 */
79
80 /* SET1 */
81 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA800, 0x00000000),
82 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA804, 0x00000000),
83 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA808, 0x0000ff0A),
84 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA80C, 0x1D000000),
85 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA810, 0xAC004900),
86 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA814, 0x000F0000),
87 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA818, 0x5A000000),
88 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA81C, 0x2600001F),
89 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA820, 0x00090000),
90 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA824, 0x2000ff00),
91 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA828, 0xff090016),
92 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA82C, 0x00000000),
93 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA830, 0x00000100),
94 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA834, 0x00A00F51),
95 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA838, 0x000B0000),
96 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA83C, 0xcb7D3307),
97 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA840, 0x003C0000),
98 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA844, 0xFFFF0000),
99 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA848, 0x00220000),
100 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA84c, 0x43000000),
101 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA850, 0x00000800),
102 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA854, 0x00000F00),
103 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA858, 0x00000021),
104 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA85c, 0x00000000),
105 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA860, 0x00190000),
106 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xAA80, 0x00FF00FF),
107 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xAA84, 0x00000000),
108 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x1300A4, 0x00000000),
109 /* SET2 */
110 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA900, 0x00000000),
111 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA904, 0x00000000),
112 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA908, 0x00000000),
113 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa90c, 0x1D000000),
114 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa910, 0xAC005000),
115 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa914, 0x000F0000),
116 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa918, 0x5A000000),
117 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa91c, 0x2600001F),
118 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa920, 0x00090000),
119 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa924, 0x2000ff00),
120 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa928, 0xff090016),
121 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa92c, 0x00000000),
122 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa930, 0x00000100),
123 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa934, 0x00A00F51),
124 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa938, 0x000B0000),
125 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA93C, 0xcb7D3307),
126 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA940, 0x003C0000),
127 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA944, 0xFFFF0000),
128 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA948, 0x00220000),
129 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA94C, 0x43000000),
130 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA950, 0x00000800),
131 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA954, 0x00000000),
132 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA960, 0x00000000),
133 /* SET3 */
134 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xaa3c, 0x00000000),
135 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xaa54, 0x00000000),
136 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xaa60, 0x00000000),
137 /* Enable PowerMeter Counters */
138 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA248, 0x00000058),
139
140 /* Program PUNIT_GPU_EC_VIRUS based on DPTF SDP */
141 /* SDP Profile 4 == 0x11940, others 0xcf08 */
Shawn Nematbakhsh51d787a2014-01-16 17:52:21 -0800142 REG_IOSF_WRITE(IOSF_PORT_PMC, PUNIT_GPU_EC_VIRUS, 0xcf08),
Duncan Laurie223d4a4f2013-10-31 08:27:29 -0700143
144 /* GfxPause */
145 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa000, 0x00071388),
146
147 /* Dynamic EU Control Settings */
148 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa080, 0x00000004),
149
150 /* Lock ECO Bit Settings */
151 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa180, 0x80000000),
152
153 /* DOP Clock Gating */
154 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x9424, 0x00000001),
155
156 /* MBCunit will send the VCR (Fuse) writes as NP-W */
157 REG_RES_RMW32(PCI_BASE_ADDRESS_0, 0x907c, 0xfffeffff, 0x00010000),
158
159 /*
160 * RC6 Settings
161 */
162 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA090, 0x00000000),
163 /* RC1e - RC6/6p - RC6pp Wake Rate Limits */
164 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA09C, 0x00280000),
165 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA0A8, 0x0001E848),
166 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA0AC, 0x00000019),
167 /* RC Sleep / RCx Thresholds */
168 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA0B0, 0x00000000),
169 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA0B8, 0x00000557),
170
171 /*
172 * Turbo Settings
173 */
174
175 /* Render/Video/Blitter Idle Max Count */
176 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x2054, 0x0000000A),
177 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x12054, 0x0000000A),
178 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x22054, 0x0000000A),
179 /* RP Down Timeout */
180 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA010, 0x000F4240),
181
182 /*
183 * Turbo Control Settings
184 */
185
186 /* RP Up/Down Threshold */
187 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA02C, 0x0000E8E8),
188 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA030, 0x0003BD08),
189 /* RP Up/Down EI */
190 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA068, 0x000101D0),
191 REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xA06C, 0x00055730),
192
193 /* RP Idle Hysteresis */
194 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa070, 0x0000000a),
195
196 /* HW RC6 Control Settings */
197 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa090, 0x11000000),
198
199 /* RP Control */
200 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa024, 0x00000592),
201
202 /* Enable PM Interrupts */
203 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x44024, 0x03000000),
204 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x4402c, 0x03000076),
205 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa168, 0x0000007e),
206
207 /* Aggressive Clock Gating */
208 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x9400, 0),
209 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x9404, 0),
210 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x9408, 0),
211 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x940c, 0),
Aaron Durbin35494622014-01-15 11:59:10 -0600212
213 /* Enable Gfx Turbo. */
214 REG_IOSF_RMW(IOSF_PORT_PMC, SB_BIOS_CONFIG,
215 ~SB_BIOS_CONFIG_GFX_TURBO_DIS, 0),
Duncan Laurie223d4a4f2013-10-31 08:27:29 -0700216 REG_SCRIPT_END
217};
218
219static const struct reg_script gpu_pre_vbios_script[] = {
220 /* Make sure GFX is bus master with MMIO access */
221 REG_PCI_OR32(PCI_COMMAND, PCI_COMMAND_MASTER|PCI_COMMAND_MEMORY),
222 /* Display */
223 REG_IOSF_WRITE(IOSF_PORT_PMC, PUNIT_PWRGT_CONTROL, 0xc0),
224 REG_IOSF_POLL(IOSF_PORT_PMC, PUNIT_PWRGT_STATUS, 0xc0, 0xc0,
225 GFX_TIMEOUT),
226 /* Tx/Rx Lanes */
227 REG_IOSF_WRITE(IOSF_PORT_PMC, PUNIT_PWRGT_CONTROL, 0xfff0c0),
228 REG_IOSF_POLL(IOSF_PORT_PMC, PUNIT_PWRGT_STATUS, 0xfff0c0, 0xfff0c0,
229 GFX_TIMEOUT),
230 /* Common Lane */
231 REG_IOSF_WRITE(IOSF_PORT_PMC, PUNIT_PWRGT_CONTROL, 0xfffcc0),
232 REG_IOSF_POLL(IOSF_PORT_PMC, PUNIT_PWRGT_STATUS, 0xfffcc0, 0xfffcc0,
233 GFX_TIMEOUT),
234 /* Ungating Tx only */
235 REG_IOSF_WRITE(IOSF_PORT_PMC, PUNIT_PWRGT_CONTROL, 0xf00cc0),
236 REG_IOSF_POLL(IOSF_PORT_PMC, PUNIT_PWRGT_STATUS, 0xfffcc0, 0xf00cc0,
237 GFX_TIMEOUT),
238 /* Ungating Common Lane only */
239 REG_IOSF_WRITE(IOSF_PORT_PMC, PUNIT_PWRGT_CONTROL, 0xf000c0),
240 REG_IOSF_POLL(IOSF_PORT_PMC, PUNIT_PWRGT_STATUS, 0xffffc0, 0xf000c0,
241 GFX_TIMEOUT),
242 /* Ungating Display */
243 REG_IOSF_WRITE(IOSF_PORT_PMC, PUNIT_PWRGT_CONTROL, 0xf00000),
244 REG_IOSF_POLL(IOSF_PORT_PMC, PUNIT_PWRGT_STATUS, 0xfffff0, 0xf00000,
245 GFX_TIMEOUT),
246 REG_SCRIPT_END
247};
248
249static const struct reg_script gfx_post_vbios_script[] = {
250 /* Deassert Render Force-Wake */
251 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x1300b0, 0x80000000),
252 REG_RES_POLL32(PCI_BASE_ADDRESS_0, 0x1300b4, 0x8000, 0, GFX_TIMEOUT),
253 /* Deassert Media Force-Wake */
254 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x1300b8, 0x80000000),
255 REG_RES_POLL32(PCI_BASE_ADDRESS_0, 0x1300bc, 0x8000, 0, GFX_TIMEOUT),
256 /* Set Lock bits */
257 REG_PCI_RMW32(GGC, 0xffffffff, 1),
258 REG_PCI_RMW32(GSM_BASE, 0xffffffff, 1),
259 REG_PCI_RMW32(GTT_BASE, 0xffffffff, 1),
260 REG_SCRIPT_END
261};
262
Aaron Durbin616f3942013-12-10 17:12:44 -0800263static inline void gfx_run_script(device_t dev, const struct reg_script *ops)
Duncan Laurie223d4a4f2013-10-31 08:27:29 -0700264{
Aaron Durbin616f3942013-12-10 17:12:44 -0800265 reg_script_run_on_dev(dev, ops);
Duncan Laurie223d4a4f2013-10-31 08:27:29 -0700266}
267
268static void gfx_pre_vbios_init(device_t dev)
269{
270 printk(BIOS_INFO, "GFX: Pre VBIOS Init\n");
271 gfx_run_script(dev, gpu_pre_vbios_script);
Duncan Lauriee3f75f82013-10-28 15:49:34 -0700272}
273
274static void gfx_pm_init(device_t dev)
275{
276 printk(BIOS_INFO, "GFX: Power Management Init\n");
Duncan Laurie223d4a4f2013-10-31 08:27:29 -0700277 gfx_run_script(dev, gfx_init_script);
Duncan Lauriee3f75f82013-10-28 15:49:34 -0700278
279 /* Lock power context base */
280 gfx_lock_pcbase(dev);
Duncan Lauriee3f75f82013-10-28 15:49:34 -0700281}
282
283static void gfx_post_vbios_init(device_t dev)
284{
Duncan Laurie223d4a4f2013-10-31 08:27:29 -0700285 printk(BIOS_INFO, "GFX: Post VBIOS Init\n");
286 gfx_run_script(dev, gfx_post_vbios_script);
Duncan Lauriee3f75f82013-10-28 15:49:34 -0700287}
288
Aaron Durbin59e209a2014-04-24 11:35:28 -0500289static void set_backlight_pwm(device_t dev, uint32_t bklt_reg, int req_hz)
290{
291 int divider;
292 struct resource *res;
293
294 res = find_resource(dev, PCI_BASE_ADDRESS_0);
295
296 if (res == NULL)
297 return;
298
299 /* Default to 200 Hz if nothing is set. */
300 if (req_hz == 0)
301 req_hz = 200;
302
303 /* Base clock is 25MHz */
304 divider = 25 * 1000 * 1000 / (16 * req_hz);
305
306 /* Do not set duty cycle (lower 16 bits). Just set the divider. */
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -0800307 write32((u32 *)(uintptr_t)(res->base + bklt_reg), divider << 16);
Aaron Durbin59e209a2014-04-24 11:35:28 -0500308}
309
Duncan Laurieb40e4442013-12-09 14:38:57 -0800310static void gfx_panel_setup(device_t dev)
311{
312 struct soc_intel_baytrail_config *config = dev->chip_info;
313 struct reg_script gfx_pipea_init[] = {
Duncan Laurieb40e4442013-12-09 14:38:57 -0800314 /* CONTROL */
315 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, PIPEA_REG(PP_CONTROL),
316 PP_CONTROL_UNLOCK | PP_CONTROL_EDP_FORCE_VDD),
Duncan Laurieb40e4442013-12-09 14:38:57 -0800317 /* POWER ON */
318 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, PIPEA_REG(PP_ON_DELAYS),
319 (config->gpu_pipea_port_select << 30 |
320 config->gpu_pipea_power_on_delay << 16 |
321 config->gpu_pipea_light_on_delay)),
322 /* POWER OFF */
323 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, PIPEA_REG(PP_OFF_DELAYS),
324 (config->gpu_pipea_power_off_delay << 16 |
325 config->gpu_pipea_light_off_delay)),
326 /* DIVISOR */
327 REG_RES_RMW32(PCI_BASE_ADDRESS_0, PIPEA_REG(PP_DIVISOR),
328 ~0x1f, config->gpu_pipea_power_cycle_delay),
Duncan Laurieb40e4442013-12-09 14:38:57 -0800329 REG_SCRIPT_END
330 };
331 struct reg_script gfx_pipeb_init[] = {
Duncan Laurieb40e4442013-12-09 14:38:57 -0800332 /* CONTROL */
333 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, PIPEB_REG(PP_CONTROL),
334 PP_CONTROL_UNLOCK | PP_CONTROL_EDP_FORCE_VDD),
Duncan Laurieb40e4442013-12-09 14:38:57 -0800335 /* POWER ON */
336 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, PIPEB_REG(PP_ON_DELAYS),
337 (config->gpu_pipeb_port_select << 30 |
338 config->gpu_pipeb_power_on_delay << 16 |
339 config->gpu_pipeb_light_on_delay)),
340 /* POWER OFF */
341 REG_RES_WRITE32(PCI_BASE_ADDRESS_0, PIPEB_REG(PP_OFF_DELAYS),
342 (config->gpu_pipeb_power_off_delay << 16 |
343 config->gpu_pipeb_light_off_delay)),
344 /* DIVISOR */
345 REG_RES_RMW32(PCI_BASE_ADDRESS_0, PIPEB_REG(PP_DIVISOR),
346 ~0x1f, config->gpu_pipeb_power_cycle_delay),
Duncan Laurieb40e4442013-12-09 14:38:57 -0800347 REG_SCRIPT_END
348 };
349
350 if (config->gpu_pipea_port_select) {
351 printk(BIOS_INFO, "GFX: Initialize PIPEA\n");
Aaron Durbin616f3942013-12-10 17:12:44 -0800352 reg_script_run_on_dev(dev, gfx_pipea_init);
Aaron Durbin59e209a2014-04-24 11:35:28 -0500353 set_backlight_pwm(dev, PIPEA_REG(BACKLIGHT_CTL),
354 config->gpu_pipea_pwm_freq_hz);
Duncan Laurieb40e4442013-12-09 14:38:57 -0800355 }
356
357 if (config->gpu_pipeb_port_select) {
358 printk(BIOS_INFO, "GFX: Initialize PIPEB\n");
Aaron Durbin616f3942013-12-10 17:12:44 -0800359 reg_script_run_on_dev(dev, gfx_pipeb_init);
Aaron Durbin59e209a2014-04-24 11:35:28 -0500360 set_backlight_pwm(dev, PIPEB_REG(BACKLIGHT_CTL),
361 config->gpu_pipeb_pwm_freq_hz);
Duncan Laurieb40e4442013-12-09 14:38:57 -0800362 }
363}
364
Duncan Lauriee3f75f82013-10-28 15:49:34 -0700365static void gfx_init(device_t dev)
366{
Duncan Lauriee3f75f82013-10-28 15:49:34 -0700367 /* Pre VBIOS Init */
368 gfx_pre_vbios_init(dev);
Duncan Laurie223d4a4f2013-10-31 08:27:29 -0700369
370 /* Power Management Init */
Duncan Lauriee3f75f82013-10-28 15:49:34 -0700371 gfx_pm_init(dev);
372
Duncan Laurieb40e4442013-12-09 14:38:57 -0800373 gfx_panel_setup(dev);
374
Duncan Lauriee3f75f82013-10-28 15:49:34 -0700375 /* Run VBIOS */
376 pci_dev_init(dev);
377
378 /* Post VBIOS Init */
379 gfx_post_vbios_init(dev);
380}
381
382static struct device_operations gfx_device_ops = {
383 .read_resources = pci_dev_read_resources,
384 .set_resources = pci_dev_set_resources,
385 .enable_resources = pci_dev_enable_resources,
386 .init = gfx_init,
387 .ops_pci = &soc_pci_ops,
388};
389
390static const struct pci_driver gfx_driver __pci_driver = {
391 .ops = &gfx_device_ops,
392 .vendor = PCI_VENDOR_ID_INTEL,
393 .device = GFX_DEVID,
394};