[coreboot-gerrit] Patch set updated for coreboot: 9cbdc44 Add kernel-derived support functions for DDI.

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Thu Dec 5 21:41:23 CET 2013


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4337

-gerrit

commit 9cbdc44385465904d122c2f61a82515bfde4587c
Author: Ronald G. Minnich <rminnich at google.com>
Date:   Sun Jun 30 20:30:58 2013 -0700

    Add kernel-derived support functions for DDI.
    
    Newer mainboards that use haswell -- and, presumably, chipsets to come -- need
    some support functions. Add them in the drivers/intel/gma directory.
    Currently, this is one file: intel_ddi.c, but more may come.
    
    Compilation of this file is controlled by INTEL_DDI, defined
    in the Kconfig as default n and used in the Makefile.inc
    
    Change-Id: I501ee291c0d4589925ed3e478f67106337fcad31
    Signed-off-by: Ronald G. Minnich <rminnich at google.com>
    Reviewed-on: https://gerrit.chromium.org/gerrit/60612
    Tested-by: Ronald G. Minnich <rminnich at chromium.org>
    Reviewed-by: Ronald G. Minnich <rminnich at chromium.org>
    Commit-Queue: Ronald G. Minnich <rminnich at chromium.org>
---
 src/drivers/intel/gma/Kconfig      |   6 +++
 src/drivers/intel/gma/Makefile.inc |   1 +
 src/drivers/intel/gma/intel_ddi.c  | 107 +++++++++++++++++++++++++++++++++++++
 3 files changed, 114 insertions(+)

diff --git a/src/drivers/intel/gma/Kconfig b/src/drivers/intel/gma/Kconfig
index 1a4212b..073f708 100644
--- a/src/drivers/intel/gma/Kconfig
+++ b/src/drivers/intel/gma/Kconfig
@@ -22,3 +22,9 @@ config INTEL_DP
 	default n
 	help
 	  helper functions for intel display port operations
+
+config INTEL_DDI
+	bool
+	default n
+	help
+	  helper functions for intel DDI operations
diff --git a/src/drivers/intel/gma/Makefile.inc b/src/drivers/intel/gma/Makefile.inc
index c90daa4..0c3f45a 100644
--- a/src/drivers/intel/gma/Makefile.inc
+++ b/src/drivers/intel/gma/Makefile.inc
@@ -18,4 +18,5 @@
 ##
 
 ramstage-$(CONFIG_INTEL_DP) += intel_dp.c drm_dp_helper.c
+ramstage-$(CONFIG_INTEL_DDI) += intel_ddi.c
 
diff --git a/src/drivers/intel/gma/intel_ddi.c b/src/drivers/intel/gma/intel_ddi.c
new file mode 100644
index 0000000..659d73c
--- /dev/null
+++ b/src/drivers/intel/gma/intel_ddi.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright 2013 Google Inc.
+ * Copyright © 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Eugeni Dodonov <eugeni.dodonov at intel.com>
+ *
+ */
+#include <types.h>
+#include <string.h>
+#include <stdlib.h>
+#include <device/device.h>
+#include <device/device.h>
+#include <device/pci_def.h>
+#include <device/pci_ops.h>
+#include <console/console.h>
+#include <delay.h>
+#include <pc80/mc146818rtc.h>
+#include <arch/acpi.h>
+#include <arch/io.h>
+#include <arch/interrupt.h>
+#include <boot/coreboot_tables.h>
+#include <smbios.h>
+#include <device/pci.h>
+#include <ec/google/chromeec/ec.h>
+#include <cbfs_core.h>
+
+#include <cpu/x86/tsc.h>
+#include <cpu/x86/cache.h>
+#include <cpu/x86/mtrr.h>
+#include <cpu/x86/msr.h>
+#include <edid.h>
+#include <drivers/intel/gma/i915.h>
+
+/* HDMI/DVI modes ignore everything but the last 2 items. So we share
+ * them for both DP and FDI transports, allowing those ports to
+ * automatically adapt to HDMI connections as well.
+ */
+static  u32 hsw_ddi_translations_dp[] = {
+	0x00FFFFFF, 0x0006000E,		/* DP parameters */
+	0x00D75FFF, 0x0005000A,
+	0x00C30FFF, 0x00040006,
+	0x80AAAFFF, 0x000B0000,
+	0x00FFFFFF, 0x0005000A,
+	0x00D75FFF, 0x000C0004,
+	0x80C30FFF, 0x000B0000,
+	0x00FFFFFF, 0x00040006,
+	0x80D75FFF, 0x000B0000,
+	0x00FFFFFF, 0x00040006		/* HDMI parameters */
+};
+
+static  u32 hsw_ddi_translations_fdi[] = {
+	0x00FFFFFF, 0x0007000E,		/* FDI parameters */
+	0x00D75FFF, 0x000F000A,
+	0x00C30FFF, 0x00060006,
+	0x00AAAFFF, 0x001E0000,
+	0x00FFFFFF, 0x000F000A,
+	0x00D75FFF, 0x00160004,
+	0x00C30FFF, 0x001E0000,
+	0x00FFFFFF, 0x00060006,
+	0x00D75FFF, 0x001E0000,
+	0x00FFFFFF, 0x00040006		/* HDMI parameters */
+};
+
+/* On Haswell, DDI port buffers must be programmed with correct values
+ * in advance. The buffer values are different for FDI and DP modes,
+ * but the HDMI/DVI fields are shared among those. So we program the DDI
+ * in either FDI or DP modes only, as HDMI connections will work with both
+ * of those.
+ */
+void intel_prepare_ddi_buffers(int port, int use_fdi_mode)
+{
+	u32 reg;
+	int i;
+	u32 *ddi_translations = ((use_fdi_mode) ?
+				 hsw_ddi_translations_fdi :
+				 hsw_ddi_translations_dp);
+
+	printk(BIOS_SPEW,  "Initializing DDI buffers for port %d in %s mode\n",
+	       port,
+	       use_fdi_mode ? "FDI" : "DP");
+
+	for (i=0,reg=DDI_BUF_TRANS(port);i < ARRAY_SIZE(hsw_ddi_translations_fdi);i++) {
+		io_i915_write32(ddi_translations[i], reg);
+		reg += 4;
+	}
+}
+



More information about the coreboot-gerrit mailing list