blob: e6fa3aa8bbf56d35d9d7ed06661cae6e067684a1 [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
6-- the Free Software Foundation; version 2 of the License.
7--
8-- This program is distributed in the hope that it will be useful,
9-- but WITHOUT ANY WARRANTY; without even the implied warranty of
10-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11-- GNU General Public License for more details.
12--
13
14with HW.Time;
15with HW.GFX.GMA.Config;
16with HW.GFX.GMA.Registers;
17
18package body HW.GFX.GMA.Power_And_Clocks_Ironlake is
19
20 PCH_DREF_CONTROL_120MHZ_CPU_OUTPUT_MASK : constant := 3 * 2 ** 13;
21 PCH_DREF_CONTROL_120MHZ_CPU_OUTPUT_SSC : constant := 2 * 2 ** 13;
22 PCH_DREF_CONTROL_120MHZ_CPU_OUTPUT_NONSSC : constant := 3 * 2 ** 13;
23 PCH_DREF_CONTROL_120MHZ_SSC_EN_MASK : constant := 3 * 2 ** 11;
24 PCH_DREF_CONTROL_120MHZ_SSC_EN : constant := 2 * 2 ** 11;
25 PCH_DREF_CONTROL_120MHZ_NONSSC_EN_MASK : constant := 3 * 2 ** 9;
26 PCH_DREF_CONTROL_120MHZ_NONSSC_EN : constant := 2 * 2 ** 9;
27 PCH_DREF_CONTROL_120MHZ_SSC4_EN_MASK : constant := 3 * 2 ** 7;
28 PCH_DREF_CONTROL_120MHZ_SSC4_EN : constant := 2 * 2 ** 7;
29 PCH_DREF_CONTROL_120MHZ_SSC4_DOWNSPREAD : constant := 0 * 2 ** 6;
30 PCH_DREF_CONTROL_120MHZ_SSC4_CENTERSPREAD : constant := 1 * 2 ** 6;
31 PCH_DREF_CONTROL_120MHZ_SSC_MODULATION_EN : constant := 1 * 2 ** 1;
32 PCH_DREF_CONTROL_120MHZ_SSC4_MODULATION_EN : constant := 1 * 2 ** 0;
33
34 procedure Initialize is
35 begin
36 -- ILK: enable non-spread spectrum clock, enable spread spectrum clock
37 Registers.Write
38 (Register => Registers.PCH_DREF_CONTROL,
39 Value => PCH_DREF_CONTROL_120MHZ_SSC_EN or
40 PCH_DREF_CONTROL_120MHZ_NONSSC_EN or
41 PCH_DREF_CONTROL_120MHZ_SSC_MODULATION_EN);
42 Registers.Posting_Read (Registers.PCH_DREF_CONTROL);
43 Time.U_Delay (1);
44 if Config.Internal_Is_EDP then -- TODO: check for presence
45 -- always use spread spectrum clock for CPU output
46 Registers.Set_Mask
47 (Register => Registers.PCH_DREF_CONTROL,
48 Mask => PCH_DREF_CONTROL_120MHZ_CPU_OUTPUT_SSC);
49 Registers.Posting_Read (Registers.PCH_DREF_CONTROL);
50 Time.U_Delay (20); -- DMI latency
51 end if;
52 end Initialize;
53
54end HW.GFX.GMA.Power_And_Clocks_Ironlake;