gma: Update PCH Rawclk programming for TGL

Tigerlake onwards needs the Rawclk numerator programmed into the
RAWCLK register in addition the fields from to prior generations.

(cherry picked from commit fc49b60f2378c2dd649a4826cef58e63237fec63)

Original-Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Original-Change-Id: Iad36221a44db4128332392bd6610132ea08c0e35
Original-Reviewed-on: https://review.coreboot.org/c/libgfxinit/+/67491
Original-Reviewed-by: Nico Huber <nico.h@gmx.de>
Original-Tested-by: Nico Huber <nico.h@gmx.de>
GitOrigin-RevId: fc49b60f2378c2dd649a4826cef58e63237fec63
Change-Id: Iefc08e7afb63602104f9c02690f26c9af5665b87
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/coreboot/libgfxinit/+/4588309
Tested-by: CopyBot Service Account <copybot.service@gmail.com>
Commit-Queue: Kangheui Won <khwon@chromium.org>
Reviewed-by: Kangheui Won <khwon@chromium.org>
diff --git a/common/hw-gfx-gma-config.ads.template b/common/hw-gfx-gma-config.ads.template
index e759a0c..a2bc2e8 100644
--- a/common/hw-gfx-gma-config.ads.template
+++ b/common/hw-gfx-gma-config.ads.template
@@ -293,6 +293,9 @@
    ----------- Type-C: ----------
    Has_Type_C_Ports              : <genbool> := Tigerlake_On;
 
+   ----------- Rawclk -----------
+   Need_Rawclk_Numerator         : <genbool> := Tigerlake_On;
+
    ----------------------------------------------------------------------------
 
    Max_Pipe : <ilkvar> Pipe_Index :=
diff --git a/common/hw-gfx-gma.adb b/common/hw-gfx-gma.adb
index 83ded92..cacafd3 100644
--- a/common/hw-gfx-gma.adb
+++ b/common/hw-gfx-gma.adb
@@ -97,8 +97,20 @@
 
    ----------------------------------------------------------------------------
 
-   PCH_RAWCLK_FREQ_MASK : constant :=
-     (if Config.Has_Fractional_RawClk then 16#3fff# * 2 ** 16 else 16#3ff# * 2 ** 0);
+   ICP_RAWCLK_NUM : constant := 1 * 2 ** 11;
+
+   function PCH_RAWCLK_FREQ_MASK return Word32 is
+      Mask : Word32;
+   begin
+      if Config.Need_Rawclk_Numerator then
+         Mask := 16#ffff_ffff#;
+      elsif Config.Has_Fractional_RawClk then
+         Mask := 16#3fff# * 2 ** 16;
+      else
+         Mask := 16#3ff# * 2 ** 0;
+      end if;
+      return Mask;
+   end PCH_RAWCLK_FREQ_MASK;
 
    function PCH_RAWCLK_FREQ (Freq : Frequency_Type) return Word32
    is
@@ -112,6 +124,10 @@
                Freq32 := Freq32 or Shift_Left
                  (Word32 (Div_Round_Closest (1_000, Fraction_K) - 1), 26);
             end if;
+
+            if Config.Need_Rawclk_Numerator then
+               Freq32 := Freq32 or ICP_RAWCLK_NUM;
+            end if;
             return Freq32;
          end;
       else