Topcliff: Update PCH_I2C driver to 2.6.35
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi Arjan,
Sorry, for late response.
----- Original Message -----
From: "Arjan van de Ven" <[email protected]>
To: "Masayuki Ohtak" <[email protected]>
Cc: <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>
Sent: Friday, August 06, 2010 1:40 PM
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_I2C driver to 2.6.35
Quoted 8 lines · Masayuki Ohtak
Quoted 4 lines
+config
PCH_I2C
+ tristate "PCH I2C"this is really not very descriptive. Can you make it "OKI Semi PCH I2C controller" or something
We will modify.
Quoted 11 lines
if you has human get asked "PCH I2C"... almost nobody will know what that means.+static
irqreturn_tpch_handler_ch0(int irq, void *pData);Review
Quoted 4 lines
(quoted diff) +3
-0+static irqreturn_t(*pch_handler_list[PCH_MAX_CHN]) (int irq, void *pData) = { + pch_handler_ch0, +};hummmmmm what is this for??
This is callback function list for mulit-cahnnel I2C device.
Quoted 15 lines
Review
Quoted 8 lines
(quoted diff) +5
-0+ +static inline void pch_setbit(void __iomem *addr, u32 offset, u32 bitmask) +{ + iowrite32(((ioread32(addr + offset)) | (bitmask)), (addr + offset)); +}this might be more readble if it's made 3 lines with a local variable...
+ "Cleared the registers PCH_I2CCTL,PCH_I2CMOD,PCH_I2CBUFFOR\n,"Quoted 2 lines
+ "PCH_I2CBUFSLV,PCH_I2CBUFSUB,PCH_I2CBUFMSK,\n"
I will divide to 3 lines.
Quoted 16 lines
what's that weird character ?diff --git
a/drivers/i2c/i2c-dev.cb/drivers/i2c/i2c-dev.c
+ caseI2C_MODE_SEL:Quoted 9 lines
+
pch_mode= arg;
+
+ if (pch_mode<= 4) {
+ msgbuf[0] =pch_mode;
+ msg.buf = msgbuf;
+ msg.len = 1;
+ msg.flags = 0;
+ ret =i2c_transfer(client->adapter, &msg, 1);
Quoted 3 lines
in generic code??
I will revert i2c-dev.c.
I will submit modified patch soon.
Thanks, Ohtake(OKISemi)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi, Greg
Sorry for late response.
Thanks, Ohtake(OKISemi)
----- Original Message -----
From: "Greg KH" <[email protected]>
To: "Masayuki Ohtak" <[email protected]>
Cc: <[email protected]>; "Wang Yong Y" <[email protected]>; "Wang Qi" <[email protected]>; "Andrew" <[email protected]>; <[email protected]>; <[email protected]>; <[email protected]>
Sent: Friday, August 06, 2010 11:24 PM
Subject: Re: [MeeGo-Dev][PATCH] Topcliff: Update PCH_I2C driver to 2.6.35
Quoted 9 lines · Masayuki Ohtak
Quoted 8 lines
I2C driver of Topcliff PCH
Topcliff PCH is the platform controller hub that is going to be used in Intel's upcoming general embedded platform. All IO peripherals in Topcliff PCH are actually devices sitting on AMBA bus. Topcliff PCH has I2C I/F. Using this I/F, it is able to access system devices connected to I2C.
Quoted 4 lines
Quoted 1 line
Signed-off-by Masayuki Ohtake <[email protected]>Why not run this by the i2c maintainer and developers as well?
I will add i2c maintainer and developers next submission.
Quoted 82 lines
You do know about the
scripts/get_maintainer.plprogram to tell you who to copy when sending a patch, right? Please use that.Quoted 35 lines
--- drivers/i2c/busses/Kconfig | 8 + drivers/i2c/busses/Makefile | 3 + drivers/i2c/busses/i2c-pch.c | 910 ++++++++++++++++++++++++++++++++++++++++++ drivers/i2c/busses/i2c-pch.h | 147 +++++++ drivers/i2c/i2c-dev.c | 21 + 5 files changed, 1089 insertions(+), 0 deletions(-) create mode 100644 drivers/i2c/busses/i2c-pch.c create mode 100644 drivers/i2c/busses/i2c-pch.hdrivers/i2c/busses/Kconfig +8
-0@@ -7,6 +7,14 @@ menu "I2C Hardware Bus support" comment "PC SMBus host controller drivers" depends on PCI +config PCH_I2C + tristate "PCH I2C" + depends on PCI + help + This driver is for PCH I2C of Topcliff which is an IOH for x86 + embedded processor. + This driver can access PCH I2C bus device. + config I2C_ALI1535 tristate "ALI 1535" depends on PCIdrivers/i2c/busses/Makefile +0
-0drivers/i2c/busses/Makefile obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o · line 80
Quoted 6 lines
drivers/i2c/busses/Makefile +3
-0@@ -75,3 +75,6 @@ obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o ifeq ($(CONFIG_I2C_DEBUG_BUS),y) EXTRA_CFLAGS += -DDEBUG endif + +obj-$(CONFIG_PCH_I2C) += pch_i2c.o +pch_i2c-objs := i2c-pch.oWhy not just name your file
i2c-pci.cand then you don't need this two-stepMakefilemess?Quoted 33 lines
drivers/i2c/busses/i2c-pch.c new file +27
-0@@ -0,0 +1,910 @@ +/* +* Copyright (C) 2010 OKI SEMICONDUCTOR Co., LTD. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; version 2 of the License. +* +* This program is distributed in the hope that 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. +*/ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/delay.h> +#include <linux/init.h> +#include <linux/errno.h> +#include <linux/i2c.h> +#include <linux/fs.h> +#include <linux/io.h> +#include <linux/types.h> +#include <linux/interrupt.h>
Quoted 8 lines
drivers/i2c/busses/i2c-pch.c line 33
Quoted 6 lines
drivers/i2c/busses/i2c-pch.c new file +6
-0+#include <linux/jiffies.h> +#include <linux/pci.h> +#include <linux/mutex.h> +#include <linux/ktime.h> + +#include "i2c-pch.h" Why do you need a .h file for this driver?
I will delete.
Quoted 14 lines
<snip>
drivers/i2c/i2c-dev.c line 39
Quoted 9 lines
drivers/i2c/i2c-dev.c +1
-0@@ -36,6 +36,7 @@#include <linux/i2c-dev.h> #include <linux/jiffies.h> #include <linux/uaccess.h> +#include "busses/i2c-pch.h" Note how no other i2c driver needs to be included here...
I will delete.
Quoted 29 lines
Quoted 29 lines
drivers/i2c/i2c-dev.c +15
-0static struct i2c_driver i2cdev_driver;@@ -372,6 +373,12 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)struct i2c_client *client = file->private_data;unsigned long funcs; +unsigned long pch_mode; +int ret; + +struct i2c_msg msg; +unsigned char msgbuf[1 ]; +dev_dbg (&client->adapter->dev,"ioctl, cmd=0x%02x, arg=0x%02lx\n" , cmd, arg);@@ -427,6 +434,20 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)*/ client->adapter->timeout =msecs_to_jiffies (arg *10 );break ; +case I2C_MODE_SEL : + pch_mode = arg; + +if (pch_mode <=4 ) { + msgbuf[0 ] = pch_mode; + msg.buf = msgbuf; + msg.len =1 ; + msg.flags =0 ; + ret =i2c_transfer (client->adapter, &msg,1 );
Quoted 9 lines
drivers/i2c/i2c-dev.c static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) · line 450
Quoted 5 lines
drivers/i2c/i2c-dev.c +5
-0+ }else { +printk (KERN_ERR "I2C mode sel:Invalid mode\n" ); + ret = -EINVAL ; + } +return ret;I really doubt you are allowed to add a new ioctl to the core i2c layer. You will have to run this by the i2c maintainer to get it accepted.
I will revert i2c core module.
I will submit modified patch soon.
Thanks, Ohtake(OKISemi)