<p>Maulik V Vaghela has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/25806">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">soc/intel/common/block: Create new folder for common i2c V2 code<br><br>There is already I2C folder which is common IP and exists in common<br>folder. Intent of this patch is to create a new folder i2c_v2 and try to<br>move code which is still common across soc and still sit inside i2c.c<br>file inside specific soc folder.<br><br>Use "SOC_INTEL_COMMON_BLOCK_I2C_V2" this Kconfig to select common i2c<br>code instead of using soc dependent code.<br><br>This change will be used from cannonlake onwards and SOC will only have<br>one function which returns soc dependent i2c configuration.<br><br>Change-Id: Iaa1d8fc80b6fd06a88c76b040967e8694af256ea<br>Signed-off-by: Maulik V Vaghela <maulik.v.vaghela@intel.com><br>---<br>A src/soc/intel/common/block/i2c_v2/Kconfig<br>A src/soc/intel/common/block/i2c_v2/Makefile.inc<br>A src/soc/intel/common/block/i2c_v2/i2c.c<br>3 files changed, 77 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/25806/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/soc/intel/common/block/i2c_v2/Kconfig b/src/soc/intel/common/block/i2c_v2/Kconfig</span><br><span>new file mode 100644</span><br><span>index 0000000..1260975</span><br><span>--- /dev/null</span><br><span>+++ b/src/soc/intel/common/block/i2c_v2/Kconfig</span><br><span>@@ -0,0 +1,7 @@</span><br><span style="color: hsl(120, 100%, 40%);">+config SOC_INTEL_COMMON_BLOCK_I2C_V2</span><br><span style="color: hsl(120, 100%, 40%);">+        bool</span><br><span style="color: hsl(120, 100%, 40%);">+  select SOC_INTEL_COMMON_BLOCK_I2C</span><br><span style="color: hsl(120, 100%, 40%);">+     help</span><br><span style="color: hsl(120, 100%, 40%);">+    Intel Processor Common I2C support.</span><br><span style="color: hsl(120, 100%, 40%);">+   V2 is applicable from cannonlake onwards. This field also requires SOC</span><br><span style="color: hsl(120, 100%, 40%);">+        to implement function which returns I2C config to common code.</span><br><span>diff --git a/src/soc/intel/common/block/i2c_v2/Makefile.inc b/src/soc/intel/common/block/i2c_v2/Makefile.inc</span><br><span>new file mode 100644</span><br><span>index 0000000..97a090b</span><br><span>--- /dev/null</span><br><span>+++ b/src/soc/intel/common/block/i2c_v2/Makefile.inc</span><br><span>@@ -0,0 +1,4 @@</span><br><span style="color: hsl(120, 100%, 40%);">+bootblock-$(CONFIG_SOC_INTEL_COMMON_BLOCK_I2C_V2)+= i2c.c</span><br><span style="color: hsl(120, 100%, 40%);">+romstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_I2C_V2)+= i2c.c</span><br><span style="color: hsl(120, 100%, 40%);">+ramstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_I2C_V2)+= i2c.c</span><br><span style="color: hsl(120, 100%, 40%);">+verstage-$(CONFIG_SOC_INTEL_COMMON_BLOCK_I2C_V2)+= i2c.c</span><br><span>diff --git a/src/soc/intel/common/block/i2c_v2/i2c.c b/src/soc/intel/common/block/i2c_v2/i2c.c</span><br><span>new file mode 100644</span><br><span>index 0000000..2cb457b</span><br><span>--- /dev/null</span><br><span>+++ b/src/soc/intel/common/block/i2c_v2/i2c.c</span><br><span>@@ -0,0 +1,66 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/*</span><br><span style="color: hsl(120, 100%, 40%);">+ * This file is part of the coreboot project.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright 2016 Google Inc.</span><br><span style="color: hsl(120, 100%, 40%);">+ * Copyright (C) 2017 Intel Corporation.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+ * it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+ * the Free Software Foundation; version 2 of the License.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <console/console.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <device/device.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <device/pci_def.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <drivers/i2c/designware/dw_i2c.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <soc/iomap.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <soc/pci_devs.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include "chip.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+uintptr_t dw_i2c_get_soc_early_base(unsigned int bus)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       return EARLY_I2C_BASE(bus);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+int dw_i2c_soc_devfn_to_bus(unsigned int devfn)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+  switch (devfn) {</span><br><span style="color: hsl(120, 100%, 40%);">+      case PCH_DEVFN_I2C0:</span><br><span style="color: hsl(120, 100%, 40%);">+          return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+     case PCH_DEVFN_I2C1:</span><br><span style="color: hsl(120, 100%, 40%);">+          return 1;</span><br><span style="color: hsl(120, 100%, 40%);">+     case PCH_DEVFN_I2C2:</span><br><span style="color: hsl(120, 100%, 40%);">+          return 2;</span><br><span style="color: hsl(120, 100%, 40%);">+     case PCH_DEVFN_I2C3:</span><br><span style="color: hsl(120, 100%, 40%);">+          return 3;</span><br><span style="color: hsl(120, 100%, 40%);">+     case PCH_DEVFN_I2C4:</span><br><span style="color: hsl(120, 100%, 40%);">+          return 4;</span><br><span style="color: hsl(120, 100%, 40%);">+     case PCH_DEVFN_I2C5:</span><br><span style="color: hsl(120, 100%, 40%);">+          return 5;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+     return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+int dw_i2c_soc_bus_to_devfn(unsigned int bus)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+     switch (bus) {</span><br><span style="color: hsl(120, 100%, 40%);">+        case 0:</span><br><span style="color: hsl(120, 100%, 40%);">+               return PCH_DEVFN_I2C0;</span><br><span style="color: hsl(120, 100%, 40%);">+        case 1:</span><br><span style="color: hsl(120, 100%, 40%);">+               return PCH_DEVFN_I2C1;</span><br><span style="color: hsl(120, 100%, 40%);">+        case 2:</span><br><span style="color: hsl(120, 100%, 40%);">+               return PCH_DEVFN_I2C2;</span><br><span style="color: hsl(120, 100%, 40%);">+        case 3:</span><br><span style="color: hsl(120, 100%, 40%);">+               return PCH_DEVFN_I2C3;</span><br><span style="color: hsl(120, 100%, 40%);">+        case 4:</span><br><span style="color: hsl(120, 100%, 40%);">+               return PCH_DEVFN_I2C4;</span><br><span style="color: hsl(120, 100%, 40%);">+        case 5:</span><br><span style="color: hsl(120, 100%, 40%);">+               return PCH_DEVFN_I2C5;</span><br><span style="color: hsl(120, 100%, 40%);">+        }</span><br><span style="color: hsl(120, 100%, 40%);">+     return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/25806">change 25806</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/25806"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Iaa1d8fc80b6fd06a88c76b040967e8694af256ea </div>
<div style="display:none"> Gerrit-Change-Number: 25806 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Maulik V Vaghela <maulik.v.vaghela@intel.com> </div>