blob: bff47504783bb85cc5ea5b23a528f00b06768a91 [file] [log] [blame]
Nico Huber83693c82016-10-08 22:17:55 +02001--
2-- Copyright (C) 2016 secunet Security Networks AG
3--
4-- This program is free software; you can redistribute it and/or modify
5-- it under the terms of the GNU General Public License as published by
Nico Huber125a29e2016-10-18 00:23:54 +02006-- the Free Software Foundation; either version 2 of the License, or
7-- (at your option) any later version.
Nico Huber83693c82016-10-08 22:17:55 +02008--
9-- This program is distributed in the hope that it will be useful,
10-- but WITHOUT ANY WARRANTY; without even the implied warranty of
11-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-- GNU General Public License for more details.
13--
14
15with HW.Time;
16with HW.GFX.GMA.Config;
17with HW.GFX.GMA.Registers;
18
19package body HW.GFX.GMA.Power_And_Clocks_Ironlake is
20
21 PCH_DREF_CONTROL_120MHZ_CPU_OUTPUT_MASK : constant := 3 * 2 ** 13;
22 PCH_DREF_CONTROL_120MHZ_CPU_OUTPUT_SSC : constant := 2 * 2 ** 13;
23 PCH_DREF_CONTROL_120MHZ_CPU_OUTPUT_NONSSC : constant := 3 * 2 ** 13;
24 PCH_DREF_CONTROL_120MHZ_SSC_EN_MASK : constant := 3 * 2 ** 11;
25 PCH_DREF_CONTROL_120MHZ_SSC_EN : constant := 2 * 2 ** 11;
26 PCH_DREF_CONTROL_120MHZ_NONSSC_EN_MASK : constant := 3 * 2 ** 9;
27 PCH_DREF_CONTROL_120MHZ_NONSSC_EN : constant := 2 * 2 ** 9;
28 PCH_DREF_CONTROL_120MHZ_SSC4_EN_MASK : constant := 3 * 2 ** 7;
29 PCH_DREF_CONTROL_120MHZ_SSC4_EN : constant := 2 * 2 ** 7;
30 PCH_DREF_CONTROL_120MHZ_SSC4_DOWNSPREAD : constant := 0 * 2 ** 6;
31 PCH_DREF_CONTROL_120MHZ_SSC4_CENTERSPREAD : constant := 1 * 2 ** 6;
32 PCH_DREF_CONTROL_120MHZ_SSC_MODULATION_EN : constant := 1 * 2 ** 1;
33 PCH_DREF_CONTROL_120MHZ_SSC4_MODULATION_EN : constant := 1 * 2 ** 0;
34
35 procedure Initialize is
36 begin
37 -- ILK: enable non-spread spectrum clock, enable spread spectrum clock
38 Registers.Write
39 (Register => Registers.PCH_DREF_CONTROL,
40 Value => PCH_DREF_CONTROL_120MHZ_SSC_EN or
41 PCH_DREF_CONTROL_120MHZ_NONSSC_EN or
42 PCH_DREF_CONTROL_120MHZ_SSC_MODULATION_EN);
43 Registers.Posting_Read (Registers.PCH_DREF_CONTROL);
44 Time.U_Delay (1);
45 if Config.Internal_Is_EDP then -- TODO: check for presence
46 -- always use spread spectrum clock for CPU output
47 Registers.Set_Mask
48 (Register => Registers.PCH_DREF_CONTROL,
49 Mask => PCH_DREF_CONTROL_120MHZ_CPU_OUTPUT_SSC);
50 Registers.Posting_Read (Registers.PCH_DREF_CONTROL);
51 Time.U_Delay (20); -- DMI latency
52 end if;
53 end Initialize;
54
55end HW.GFX.GMA.Power_And_Clocks_Ironlake;