[PATCH] I2C driver supporting Moorestown and Medfield platform

2010-10-27 Thread Alan Cox
(Updated to address Ben's comments. With regard to the message segment
 restriction it's not something we hit on the actual platform so while
 I will investigate that further I don't think its a blocker to submission.
 At worst its a spot over-restrictive)

From: Wen Wang wen.w.w...@intel.com

Initial release of the driver. Updated and verified on hardware.

Cleaned up as follows

Alan Cox:
   Squash down the switches into tables, and use the PCI ident field. We
   could perhaps take this further and put the platform and port number into
   this.
   uint32t - u32
   bracketing of case statements
   spacing and '!' usage
   Check the speed (which is now 0/1/2) is valid and ignore otherwise.
   Fix remaining problems/suggestions from Jean's review
   Fix items from Ben's review

Arjan van de Ven:
   Initial power management hooks

Yong Wang youg.y.w...@intel.com:
   Shared IRQ support

Wen Wang wen.w.w...@intel.com:
   D3 support
   Fixes for OCT test runs
   Interrupt optimisations

Hong Liu hong@intel.com
   The runtime PM code is working on the wrong device (i2c_adapter-dev).
   The correct one should be pci_dev-dev. This breaks attached i2c
   slave devices with runtime PM enabled. Slave device needs to runtime
   resume parent device before runtime resuming itself, but we always get
   error since we don't have pm_runtime callback for i2c_adapter-dev.

Bin Yang bin.y...@intel.com:
   Update speed table

Saadi Maalem saadi.maa...@intel.com:
   Clear all interrupts in the hardware init

Celine Chotard celinex.chot...@intel.com:
   Correct ordering of clear/disable of IRQs

Signed-off-by: Wen Wang wen.w.w...@intel.com
Signed-off-by: Yong Wang yong.y.w...@intel.com
Signed-off-by: Hong Liu hong@intel.com
Signed-off-by: Bin Yang bin.y...@intel.com
Signed-off-by: Arjan van de Ven ar...@linux.intel.com
Signed-off-by: Alan Cox a...@linux.intel.com
---

 drivers/i2c/busses/Kconfig |9 
 drivers/i2c/busses/Makefile|1 
 drivers/i2c/busses/i2c-intel-mid.c | 1135 
 3 files changed, 1145 insertions(+), 0 deletions(-)
 create mode 100644 drivers/i2c/busses/i2c-intel-mid.c


diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index fd455a2..a62f99e 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -396,6 +396,15 @@ config I2C_IMX
  This driver can also be built as a module.  If so, the module
  will be called i2c-imx.
 
+config I2C_INTEL_MID
+   tristate Intel Moorestown/Medfield Platform I2C controller
+   help
+ Say Y here if you have an Intel Moorestown/Medfield platform I2C
+ controller.
+
+ This support is also available as a module. If so, the module
+ will be called i2c-intel-mid.
+
 config I2C_IOP3XX
tristate Intel IOPx3xx and IXP4xx on-chip I2C interface
depends on ARCH_IOP32X || ARCH_IOP33X || ARCH_IXP4XX || ARCH_IOP13XX
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 033ad41..84cb16a 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_I2C_GPIO)+= i2c-gpio.o
 obj-$(CONFIG_I2C_HIGHLANDER)   += i2c-highlander.o
 obj-$(CONFIG_I2C_IBM_IIC)  += i2c-ibm_iic.o
 obj-$(CONFIG_I2C_IMX)  += i2c-imx.o
+obj-$(CONFIG_I2C_INTEL_MID)+= i2c-intel-mid.o
 obj-$(CONFIG_I2C_IOP3XX)   += i2c-iop3xx.o
 obj-$(CONFIG_I2C_IXP2000)  += i2c-ixp2000.o
 obj-$(CONFIG_I2C_MPC)  += i2c-mpc.o
diff --git a/drivers/i2c/busses/i2c-intel-mid.c 
b/drivers/i2c/busses/i2c-intel-mid.c
new file mode 100644
index 000..80f70d3
--- /dev/null
+++ b/drivers/i2c/busses/i2c-intel-mid.c
@@ -0,0 +1,1135 @@
+/*
+ * Support for Moorestown/Medfield I2C chip
+ *
+ * Copyright (c) 2009 Intel Corporation.
+ * Copyright (c) 2009 Synopsys. Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License, version
+ * 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+#include linux/module.h
+#include linux/kernel.h
+#include linux/err.h
+#include linux/slab.h
+#include linux/stat.h
+#include linux/delay.h
+#include linux/i2c.h
+#include linux/init.h
+#include linux/pci.h
+#include linux/interrupt.h
+#include linux/pm_runtime.h
+#include linux/io.h
+
+#define DRIVER_NAMEi2c-intel-mid
+#define VERSIONVersion 0.5ac2
+#define PLATFORM   Moorestown/Medfield
+
+/* Tables use: 0 

Re: [PATCH v3] Topcliff: Update PCH_I2C driver to 2.6.36

2010-10-27 Thread Linus Walleij
2010/10/26 Jean Delvare kh...@linux-fr.org:
 On Tue, 26 Oct 2010 18:47:37 +0900, Tomoya MORINAGA wrote:
 Must we get Intel's signature ?
 We have already got the following. Isn't  this enough ?
  Reviewed-by: Linus Walleij linus.wall...@stericsson.com

 Though I haven't heard like the requirement,
 if Intel's signature is mandatory, I will request to Intel.

 It's not mandatory, but the time Ben and myself have to review new
 drivers is scarce, so it's in your own interest to have the code
 reviewed by people with more time and more interest in the specific
 hardware.

I agree. My Reviewed-by is mainly about the code structure,
a few antipatterns were removed and it looks nice to me now.
We indeed need someone who knows the hardware to look at this.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line unsubscribe linux-i2c in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html