Skip to contentSkip to conversation

i2c: pxa: support hardware lock

PATCH In review Leo Song 2 participants 13 messages Nov 8, 2012 – Nov 16, 2012 3 messages not in the archive I2C subsystem host drivers

lore
Share & tools
lore

Leo Song

author
#0 lore raw

PATCH 1/11 i2c: pxa: support hardware lock

From: "Jett.Zhou" <[email protected]>

Append hardware lock support since it's required by Marvell PXA910

Change-Id I8cd9cdf76785ecf4b6c6fa433d577cb7e3d9956b
drivers/i2c/busses/i2c-pxa.c +3 -0
index 1034d93..73a1404 100644
@@ -1160,6 +1160,9 @@ static int i2c_pxa_probe(struct platform_device *dev)
 		i2c->slave = plat->slave;
 #endif
 		i2c->adap.class = plat->class;
+		i2c->adap.hardware_lock = plat->hardware_lock;
+		i2c->adap.hardware_unlock = plat->hardware_unlock;
+		i2c->adap.hardware_trylock = plat->hardware_trylock;
 	}
 
 	clk_enable(i2c->clk);
include/linux/i2c/pxa-i2c.h +3 -0
index 1a9f65e..eec9954 100644
@@ -67,6 +67,9 @@ struct i2c_pxa_platform_data {
 	unsigned int		class;
 	unsigned int		use_pio :1;
 	unsigned int		fast_mode :1;
+	void			(*hardware_lock)(void);
+	void			(*hardware_unlock)(void);
+	int			(*hardware_trylock)(void);
 };
 
 extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
Signature · 1 line
1.7.5.4
author
#2 lore raw

PATCH 2/11 i2c: pxa: support pxa910 in id table

In reply to a message not in the archive

From: "Jett.Zhou" <[email protected]>

Since it needs to adjust i2c standard and fast mode by customizing LCR&WCR value for pxa910, so add pxa910 in the id table;

Change-Id Ibe07f36758acf17e31845f264109fdd3d56b6bff
drivers/i2c/busses/i2c-pxa.c +34 -0
index 73a1404..063ba23 100644
@@ -47,12 +47,15 @@ struct pxa_reg_layout {
 	u32 icr;
 	u32 isr;
 	u32 isar;
+	u32 ilcr;
+	u32 iwcr;
 };
 
 enum pxa_i2c_types {
 	REGS_PXA2XX,
 	REGS_PXA3XX,
 	REGS_CE4100,
+	REGS_PXA910,
 };
 
 /*
@@ -80,12 +83,22 @@ static struct pxa_reg_layout pxa_reg_layout[] = {
 		.isr =	0x04,
 		/* no isar register */
 	},
+	[REGS_PXA910] = {
+		.ibmr = 0x00,
+		.idbr = 0x08,
+		.icr =	0x10,
+		.isr =	0x18,
+		.isar = 0x20,
+		.ilcr = 0x28,
+		.iwcr = 0x30,
+	},
 };
 
 static const struct platform_device_id i2c_pxa_id_table[] = {
 	{ "pxa2xx-i2c",		REGS_PXA2XX },
 	{ "pxa3xx-pwri2c",	REGS_PXA3XX },
 	{ "ce4100-i2c",		REGS_CE4100 },
+	{ "pxa910-i2c",		REGS_PXA910 },
 	{ },
 };
 MODULE_DEVICE_TABLE(platform, i2c_pxa_id_table);
@@ -148,6 +161,8 @@ struct pxa_i2c {
 	void __iomem		*reg_icr;
 	void __iomem		*reg_isr;
 	void __iomem		*reg_isar;
+	void __iomem		*reg_ilcr;
+	void __iomem		*reg_iwcr;
 
 	unsigned long		iobase;
 	unsigned long		iosize;
@@ -155,6 +170,8 @@ struct pxa_i2c {
 	int			irq;
 	unsigned int		use_pio :1;
 	unsigned int		fast_mode :1;
+	unsigned int		ilcr;
+	unsigned int		iwcr;
 };
 
 #define _IBMR(i2c)	((i2c)->reg_ibmr)
@@ -162,6 +179,8 @@ struct pxa_i2c {
 #define _ICR(i2c)	((i2c)->reg_icr)
 #define _ISR(i2c)	((i2c)->reg_isr)
 #define _ISAR(i2c)	((i2c)->reg_isar)
+#define _ILCR(i2c)	((i2c)->reg_ilcr)
+#define _IWCR(i2c)	((i2c)->reg_iwcr)
 
 /*
  * I2C Slave mode address
@@ -460,6 +479,17 @@ static void i2c_pxa_reset(struct pxa_i2c *i2c)
 	/* set control register values */
 	writel(I2C_ICR_INIT | (i2c->fast_mode ? ICR_FM : 0), _ICR(i2c));
 
+	/* There are 2 multi-masters on the I2C bus - APPS and COMM
+	 * It is important both uses the standard frequency
+	 * Adjust clock by ILCR, IWCR is important
+	 */
+	if (i2c->ilcr)
+		writel(i2c->ilcr, _ILCR(i2c));
+	if (i2c->iwcr)
+		writel(i2c->iwcr, _IWCR(i2c));
+	udelay(2);
+
+
 #ifdef CONFIG_I2C_PXA_SLAVE
 	dev_info(&i2c->adap.dev, "Enabling slave mode\n");
 	writel(readl(_ICR(i2c)) | ICR_SADIE | ICR_ALDIE | ICR_SSDIE, _ICR(i2c));
@@ -1146,6 +1176,8 @@ static int i2c_pxa_probe(struct platform_device *dev)
 	i2c->reg_isr = i2c->reg_base + pxa_reg_layout[i2c_type].isr;
 	if (i2c_type != REGS_CE4100)
 		i2c->reg_isar = i2c->reg_base + pxa_reg_layout[i2c_type].isar;
+	i2c->reg_ilcr = i2c->reg_base + pxa_reg_layout[i2c_type].ilcr;
+	i2c->reg_iwcr = i2c->reg_base + pxa_reg_layout[i2c_type].iwcr;
 
 	i2c->iobase = res->start;
 	i2c->iosize = resource_size(res);
@@ -1163,6 +1195,8 @@ static int i2c_pxa_probe(struct platform_device *dev)
 		i2c->adap.hardware_lock = plat->hardware_lock;
 		i2c->adap.hardware_unlock = plat->hardware_unlock;
 		i2c->adap.hardware_trylock = plat->hardware_trylock;
+		i2c->ilcr = plat->ilcr;
+		i2c->iwcr = plat->iwcr;
 	}
 
 	clk_enable(i2c->clk);
include/linux/i2c/pxa-i2c.h +2 -0
index eec9954..2a03e91 100644
@@ -67,6 +67,8 @@ struct i2c_pxa_platform_data {
 	unsigned int		class;
 	unsigned int		use_pio :1;
 	unsigned int		fast_mode :1;
+	unsigned int		ilcr;
+	unsigned int		iwcr;
 	void			(*hardware_lock)(void);
 	void			(*hardware_unlock)(void);
 	int			(*hardware_trylock)(void);
Signature · 1 line
1.7.5.4
author
#3 lore raw

PATCH 3/11 i2c: pxa: add more error handling for i2c controller

In reply to a message not in the archive

From: "Jett.Zhou" <[email protected]>

1 enable debug function to dump more info if there is error of i2c; 2 add i2c controller reset operation if there is "timeout" error; 3 add enable_irq/disable_irq for the i2c irq mode operation to avoid "spurious irq" caused by CP polling mode;

Change-Id Ia3c1bf54e71cbfb48edc259d7f46bec524c5c43a
drivers/i2c/busses/i2c-pxa.c +15 -3
index 063ba23..cca387b 100644
@@ -144,6 +144,7 @@ struct pxa_i2c {
 	unsigned int		msg_idx;
 	unsigned int		msg_ptr;
 	unsigned int		slave_addr;
+	unsigned int		req_slave_addr;
 
 	struct i2c_adapter	adap;
 	struct clk		*clk;
@@ -187,6 +188,9 @@ struct pxa_i2c {
  */
 #define I2C_PXA_SLAVE_ADDR      0x1
 
+#define DEBUG 0
+static void i2c_pxa_reset(struct pxa_i2c *i2c);
+
 #ifdef DEBUG
 
 struct bits {
@@ -267,11 +271,13 @@ static void i2c_pxa_show_state(struct pxa_i2c *i2c, int lno, const char *fname)
 static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why)
 {
 	unsigned int i;
-	printk(KERN_ERR "i2c: error: %s\n", why);
+	printk(KERN_ERR"i2c: <%s> slave_0x%x error: %s\n", i2c->adap.name,
+		i2c->req_slave_addr >> 1, why);
 	printk(KERN_ERR "i2c: msg_num: %d msg_idx: %d msg_ptr: %d\n",
 		i2c->msg_num, i2c->msg_idx, i2c->msg_ptr);
-	printk(KERN_ERR "i2c: ICR: %08x ISR: %08x\n",
-	       readl(_ICR(i2c)), readl(_ISR(i2c)));
+	printk(KERN_ERR "i2c: IBMR: %08x IDBR: %08x ICR: %08x ISR: %08x\n",
+		readl(_IBMR(i2c)), readl(_IDBR(i2c)), readl(_ICR(i2c)),
+		readl(_ISR(i2c)));
 	printk(KERN_DEBUG "i2c: log: ");
 	for (i = 0; i < i2c->irqlogidx; i++)
 		printk("[%08x:%08x] ", i2c->isrlog[i], i2c->icrlog[i]);
@@ -802,6 +808,9 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num)
 	}
 
  out:
+	if (ret < 0)
+		i2c_pxa_reset(i2c);
+
 	return ret;
 }
 
@@ -933,6 +942,7 @@ static void i2c_pxa_irq_txempty(struct pxa_i2c *i2c, u32 isr)
 		 * Write the next address.
 		 */
 		writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c));
+		i2c->req_slave_addr = i2c_pxa_addr_byte(i2c->msg);
 
 		/*
 		 * And trigger a repeated start, and send the byte.
@@ -1038,6 +1048,7 @@ static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num
 	struct pxa_i2c *i2c = adap->algo_data;
 	int ret, i;
 
+	enable_irq(i2c->irq);
 	for (i = adap->retries; i >= 0; i--) {
 		ret = i2c_pxa_do_xfer(i2c, msgs, num);
 		if (ret != I2C_RETRY)
@@ -1051,6 +1062,7 @@ static int i2c_pxa_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num
 	ret = -EREMOTEIO;
  out:
 	i2c_pxa_set_slave(i2c, ret);
+	disable_irq(i2c->irq);
 	return ret;
 }
 
Signature · 1 line
1.7.5.4
author
#4 lore raw

PATCH 4/11 i2c: pxa: fix irq unbalanced warning

In reply to a message not in the archive

From: Yi Zhang <[email protected]>

Change-Id Ic8b247e46950bc6b9bc0b9dfb655a3aabbd15638
drivers/i2c/busses/i2c-pxa.c +2 -0
index cca387b..833ab4d 100644
@@ -1225,6 +1225,8 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 	i2c_pxa_reset(i2c);
 
+	disable_irq(i2c->irq);
+
 	i2c->adap.algo_data = i2c;
 	i2c->adap.dev.parent = &dev->dev;
 #ifdef CONFIG_OF
Signature · 1 line
1.7.5.4
author
#5 lore raw

PATCH 5/11 i2c: pxa: add bus reset for platform data;

In reply to a message not in the archive

From: Xiaofan Tian <[email protected]>

Since there is some problemic i2c slave devices on some platforms such as dkb sometimes, it will drop down sda and make i2c bus hang, at that time, it need to config scl/sda into gpio to simulate "stop" sequence to recover i2c bus, so add this interface in platform data;

Change-Id I2f7cf98d2f6b7a3a6d3ebac840b8f89f0b31fae6
drivers/i2c/busses/i2c-pxa.c +9 -0
index 833ab4d..cab0792 100644
@@ -271,6 +271,9 @@ static void i2c_pxa_show_state(struct pxa_i2c *i2c, int lno, const char *fname)
 static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why)
 {
 	unsigned int i;
+	struct i2c_pxa_platform_data *plat =
+		(i2c->adap.dev.parent)->platform_data;
+
 	printk(KERN_ERR"i2c: <%s> slave_0x%x error: %s\n", i2c->adap.name,
 		i2c->req_slave_addr >> 1, why);
 	printk(KERN_ERR "i2c: msg_num: %d msg_idx: %d msg_ptr: %d\n",
@@ -282,6 +285,12 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why)
 	for (i = 0; i < i2c->irqlogidx; i++)
 		printk("[%08x:%08x] ", i2c->isrlog[i], i2c->icrlog[i]);
 	printk("\n");
+	if (strcmp(why, "exhausted retries") != 0) {
+		if (plat && plat->i2c_bus_reset)
+			plat->i2c_bus_reset();
+		/* reset i2c contorler when it's fail */
+		i2c_pxa_reset(i2c);
+	}
 }
 
 #else /* ifdef DEBUG */
include/linux/i2c/pxa-i2c.h +1 -0
index 2a03e91..a247f48 100644
@@ -72,6 +72,7 @@ struct i2c_pxa_platform_data {
 	void			(*hardware_lock)(void);
 	void			(*hardware_unlock)(void);
 	int			(*hardware_trylock)(void);
+	void			(*i2c_bus_reset) (void);
 };
 
 extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
Signature · 1 line
1.7.5.4
author
#6 lore raw

PATCH 6/11 i2c: pxa: Keep i2c clock enabled when system suspends/resumes.

In reply to a message not in the archive

From: Xiaofan Tian <[email protected]>

If a PMIC interrupt occurs after i2c clock disables, since PMIC interrupt handler uses i2c bus, phone hang or key value missing might happen. So i2c clock should keep enabled when system suspends/resumes.

Change-Id I983c5d3fe2dc18149d5d836d986e65e356913b47
drivers/i2c/busses/i2c-pxa.c +0 -33
index cab0792..ad6e69b 100644
@@ -1295,45 +1295,12 @@ static int __exit i2c_pxa_remove(struct platform_device *dev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int i2c_pxa_suspend_noirq(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	struct pxa_i2c *i2c = platform_get_drvdata(pdev);
-
-	clk_disable(i2c->clk);
-
-	return 0;
-}
-
-static int i2c_pxa_resume_noirq(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	struct pxa_i2c *i2c = platform_get_drvdata(pdev);
-
-	clk_enable(i2c->clk);
-	i2c_pxa_reset(i2c);
-
-	return 0;
-}
-
-static const struct dev_pm_ops i2c_pxa_dev_pm_ops = {
-	.suspend_noirq = i2c_pxa_suspend_noirq,
-	.resume_noirq = i2c_pxa_resume_noirq,
-};
-
-#define I2C_PXA_DEV_PM_OPS (&i2c_pxa_dev_pm_ops)
-#else
-#define I2C_PXA_DEV_PM_OPS NULL
-#endif
-
 static struct platform_driver i2c_pxa_driver = {
 	.probe		= i2c_pxa_probe,
 	.remove		= __exit_p(i2c_pxa_remove),
 	.driver		= {
 		.name	= "pxa2xx-i2c",
 		.owner	= THIS_MODULE,
-		.pm	= I2C_PXA_DEV_PM_OPS,
 		.of_match_table = i2c_pxa_dt_ids,
 	},
 	.id_table	= i2c_pxa_id_table,
Signature · 1 line
1.7.5.4
author
#7 lore raw

PATCH 7/11 i2c: pxa: keep i2c irq on in suspend

In reply to a message not in the archive

From: Xiaofan Tian <[email protected]>

During suspending there may still be some i2c accessing, if don't keep i2c irq on there may be i2c access timeout if i2c is in irq mode.

Change-Id I43689ab9ee054d235678de83ea4424c03074ea62
drivers/i2c/busses/i2c-pxa.c +3 -2
index ad6e69b..f4bbbcc 100644
@@ -1226,8 +1226,9 @@ static int i2c_pxa_probe(struct platform_device *dev)
 		i2c->adap.algo = &i2c_pxa_pio_algorithm;
 	} else {
 		i2c->adap.algo = &i2c_pxa_algorithm;
-		ret = request_irq(irq, i2c_pxa_handler, IRQF_SHARED,
-				  i2c->adap.name, i2c);
+		ret = request_irq(irq, i2c_pxa_handler,
+				IRQF_SHARED | IRQF_NO_SUSPEND,
+				i2c->adap.name, i2c);
 		if (ret)
 			goto ereqirq;
 	}
Signature · 1 line
1.7.5.4
author
#8 lore raw

PATCH 8/11 i2c: pxa: bugfix the slave addr in the transaction

In reply to a message not in the archive

From: "Jett.Zhou" <[email protected]>

The slave address of i2c device should be got in the start of the msg tranaction, or it will dump wrong slave addr and make confusion.

Change-Id I9520c245e6bb0a9a1e478aa275841842b588d4cd
drivers/i2c/busses/i2c-pxa.c +1 -0
index f4bbbcc..5893110 100644
@@ -677,6 +677,7 @@ static inline void i2c_pxa_start_message(struct pxa_i2c *i2c)
 	 * Step 1: target slave address into IDBR
 	 */
 	writel(i2c_pxa_addr_byte(i2c->msg), _IDBR(i2c));
+	i2c->req_slave_addr = i2c_pxa_addr_byte(i2c->msg);
 
 	/*
 	 * Step 2: initiate the write.
Signature · 1 line
1.7.5.4
author
#9 lore raw

PATCH 9/11 i2c: pxa: add qos as constraint for cpu-idle

In reply to a message not in the archive

From: "Jett.Zhou" <[email protected]>

Add qos as constraint for cpu-idle, which is standard way, then sysfs could get accurae result.

Change-Id I4165e01ca2c30f8422b4b4850497c70233d741f8
drivers/i2c/busses/i2c-pxa.c +22 -3
index 5893110..f3811d5 100644
@@ -38,6 +38,7 @@
 #include <linux/slab.h>
 #include <linux/io.h>
 #include <linux/i2c/pxa-i2c.h>
+#include <plat/pm.h>
 
 #include <asm/irq.h>
 
@@ -173,6 +174,7 @@ struct pxa_i2c {
 	unsigned int		fast_mode :1;
 	unsigned int		ilcr;
 	unsigned int		iwcr;
+	struct pm_qos_request	qos_idle;
 };
 
 #define _IBMR(i2c)	((i2c)->reg_ibmr)
@@ -729,7 +731,7 @@ static int i2c_pxa_pio_set_master(struct pxa_i2c *i2c)
 static int i2c_pxa_do_pio_xfer(struct pxa_i2c *i2c,
 			       struct i2c_msg *msg, int num)
 {
-	unsigned long timeout = 500000; /* 5 seconds */
+	unsigned long timeout = 100000; /* 1 seconds */
 	int ret = 0;
 
 	ret = i2c_pxa_pio_set_master(i2c);
@@ -742,6 +744,8 @@ static int i2c_pxa_do_pio_xfer(struct pxa_i2c *i2c,
 	i2c->msg_ptr = 0;
 	i2c->irqlogidx = 0;
 
+	pm_qos_update_request(&i2c->qos_idle, PM_QOS_CONSTRAINT);
+
 	i2c_pxa_start_message(i2c);
 
 	while (i2c->msg_num > 0 && --timeout) {
@@ -751,6 +755,7 @@ static int i2c_pxa_do_pio_xfer(struct pxa_i2c *i2c,
 
 	i2c_pxa_stop_message(i2c);
 
+	pm_qos_update_request(&i2c->qos_idle, PM_QOS_DEFAULT_VALUE);
 	/*
 	 * We place the return code in i2c->msg_idx.
 	 */
@@ -760,6 +765,9 @@ out:
 	if (timeout == 0)
 		i2c_pxa_scream_blue_murder(i2c, "timeout");
 
+	if (ret < 0)
+		i2c_pxa_reset(i2c);
+
 	return ret;
 }
 
@@ -797,6 +805,8 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num)
 	i2c->msg_ptr = 0;
 	i2c->irqlogidx = 0;
 
+	pm_qos_update_request(&i2c->qos_idle, PM_QOS_CONSTRAINT);
+
 	i2c_pxa_start_message(i2c);
 
 	spin_unlock_irq(&i2c->lock);
@@ -804,9 +814,11 @@ static int i2c_pxa_do_xfer(struct pxa_i2c *i2c, struct i2c_msg *msg, int num)
 	/*
 	 * The rest of the processing occurs in the interrupt handler.
 	 */
-	timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5);
+	timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 1);
 	i2c_pxa_stop_message(i2c);
 
+	pm_qos_update_request(&i2c->qos_idle, PM_QOS_DEFAULT_VALUE);
+
 	/*
 	 * We place the return code in i2c->msg_idx.
 	 */
@@ -1146,6 +1158,8 @@ static int i2c_pxa_probe(struct platform_device *dev)
 	struct resource *res = NULL;
 	int ret, irq;
 
+	int pm_qos_class = PM_QOS_CPUIDLE_KEEP_DDR;
+
 	i2c = kzalloc(sizeof(struct pxa_i2c), GFP_KERNEL);
 	if (!i2c) {
 		ret = -ENOMEM;
@@ -1171,7 +1185,10 @@ static int i2c_pxa_probe(struct platform_device *dev)
 	}
 
 	i2c->adap.owner   = THIS_MODULE;
-	i2c->adap.retries = 5;
+	i2c->adap.retries = 3;
+
+	pm_qos_add_request(&i2c->qos_idle, pm_qos_class,
+			PM_QOS_DEFAULT_VALUE);
 
 	spin_lock_init(&i2c->lock);
 	init_waitqueue_head(&i2c->wait);
@@ -1274,6 +1291,7 @@ eclk:
 	kfree(i2c);
 emalloc:
 	release_mem_region(res->start, resource_size(res));
+	pm_qos_remove_request(&i2c->qos_idle);
 	return ret;
 }
 
@@ -1282,6 +1300,7 @@ static int __exit i2c_pxa_remove(struct platform_device *dev)
 	struct pxa_i2c *i2c = platform_get_drvdata(dev);
 
 	platform_set_drvdata(dev, NULL);
+	pm_qos_remove_request(&i2c->qos_idle);
 
 	i2c_del_adapter(&i2c->adap);
 	if (!i2c->use_pio)
Signature · 1 line
1.7.5.4
author
#10 lore raw

PATCH 10/11 i2c: pxa: modify the parameters of i2c_bus_reset()

In reply to a message not in the archive

From: Yi Zhang <[email protected]>

there may be more than one i2c bus needs to be reset, add i2c bus number as parameter

Change-Id I74456743bf640efe2fbf0664e8212be161cef424
drivers/i2c/busses/i2c-pxa.c +1 -1
index f3811d5..3346fef 100644
@@ -289,7 +289,7 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why)
 	printk("\n");
 	if (strcmp(why, "exhausted retries") != 0) {
 		if (plat && plat->i2c_bus_reset)
-			plat->i2c_bus_reset();
+			plat->i2c_bus_reset(i2c->adap.nr);
 		/* reset i2c contorler when it's fail */
 		i2c_pxa_reset(i2c);
 	}
include/linux/i2c/pxa-i2c.h +1 -1
index a247f48..04406ba 100644
@@ -72,7 +72,7 @@ struct i2c_pxa_platform_data {
 	void			(*hardware_lock)(void);
 	void			(*hardware_unlock)(void);
 	int			(*hardware_trylock)(void);
-	void			(*i2c_bus_reset) (void);
+	void			(*i2c_bus_reset)(int i2c_bus_num);
 };
 
 extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
Signature · 1 line
1.7.5.4
author
#11 lore raw

PATCH 11/11 i2c: pxa: no need slave addr for i2c master mode reset

In reply to a message not in the archive

From: "Jett.Zhou" <[email protected]>

Normally i2c controller works as master, slave addr is not needed, or it will impact some slave device(eg. ST NFC chip) i2c access, because it has the same i2c address with controller.

Change-Id Iaf6e16cf2e211d242b21086e491b751ea311a000
drivers/i2c/busses/i2c-pxa.c +2 -0
index 3346fef..2dc3af3 100644
@@ -490,8 +490,10 @@ static void i2c_pxa_reset(struct pxa_i2c *i2c)
 	writel(I2C_ISR_INIT, _ISR(i2c));
 	writel(readl(_ICR(i2c)) & ~ICR_UR, _ICR(i2c));
 
+#ifdef CONFIG_I2C_PXA_SLAVE
 	if (i2c->reg_isar)
 		writel(i2c->slave_addr, _ISAR(i2c));
+#endif
 
 	/* set control register values */
 	writel(I2C_ICR_INIT | (i2c->fast_mode ? ICR_FM : 0), _ICR(i2c));
Signature · 1 line
1.7.5.4
author
#13 lore raw

RE: [PATCH 11/11] i2c: pxa: no need slave addr for i2c master mode reset

In reply to a message not in the archive

Hi Ben Dooks/Wolfram Sang,

Would you please help to review and merge these 11 patches for drivers/i2c/busses/i2c-pxa.c?

[PATCH 01/11] i2c: pxa: support hardware lock
[PATCH 02/11] i2c: pxa: support pxa910 in id table
[PATCH 03/11] i2c: pxa: add more error handling for i2c controller [PATCH 04/11] i2c: pxa: fix irq unbalanced warning
[PATCH 05/11] i2c: pxa: add bus reset for platform data;
[PATCH 06/11] i2c: pxa: Keep i2c clock enabled when system suspends/resumes. [PATCH 07/11] i2c: pxa: keep i2c irq on in suspend
[PATCH 08/11] i2c: pxa: bugfix the slave addr in the transaction [PATCH 09/11] i2c: pxa: add qos as constraint for cpu-idle [PATCH 10/11] i2c: pxa: modify the parameters of i2c_bus_reset() [PATCH 11/11] i2c: pxa: no need slave addr for i2c master mode reset

Thanks a lot.

Best Wishes,

Leo Song
Tel: 6194-9745, Marvell (Shanghai)
B3-F4-4D12, No. 399 of Keyuan Rd, Pudong District, Shanghai

Quoted 35 lines

-----Original Message-----
From: Leo Song [mailto:[email protected]]
Sent: 2012年11月8日 22:18
To: Ben Dooks; Wolfram Sang
Cc: Leo Song; Chao Xie; [email protected]; Jett Zhou
Subject: [PATCH 11/11] i2c: pxa: no need slave addr for i2c master mode reset

From: "Jett.Zhou" <[email protected]>

Normally i2c controller works as master, slave addr is not needed, or it will impact some slave device(eg. ST NFC chip) i2c access, because it has
the same i2c address with controller.

Change-Id Iaf6e16cf2e211d242b21086e491b751ea311a000
drivers/i2c/busses/i2c-pxa.c +2 -1
index 3346fef..2dc3af3 100644
@@ -490,8 +490,10 @@ static void i2c_pxa_reset(struct pxa_i2c *i2c)
 	writel(I2C_ISR_INIT, _ISR(i2c));
 	writel(readl(_ICR(i2c)) & ~ICR_UR, _ICR(i2c));
 
+#ifdef CONFIG_I2C_PXA_SLAVE
 	if (i2c->reg_isar)
 		writel(i2c->slave_addr, _ISAR(i2c));
+#endif
 
 	/* set control register values */
 	writel(I2C_ICR_INIT | (i2c->fast_mode ? ICR_FM : 0), _ICR(i2c));
--

1.7.5.4

#15 lore raw

Re: [PATCH 11/11] i2c: pxa: no need slave addr for i2c master mode reset

In reply to a message not in the archive

Hi,

Quoted 2 lines · Leo Song

Would you please help to review and merge these 11 patches for drivers/i2c/busses/i2c-pxa.c?

There are already a few formal things:

- For large series, please write a cover-letter describing the series in total (use --cover-letter). The omap guys do this very well, check the list archive.

- why would upstream need Change-Id: in the patch description?

- the cover letter should also state what testing you did. the pxa driver is used in lots of different SoCs and I'd like to know how much this was tested on other systems regarding regressions.

- if you can't test it on other machines, ask for help. Putting alkml on CC is one way to do this

- I'd ask you to add alkml anyway since your patches include hooks to the mach and there are people having more experience on this platform than me

I didn't really have a look at the code yet, since I ask you to resend it fixing the above points first. But from a glimpse, you should try to avoid adding function pointers to platform_data at all costs. Maybe you can think of alternative solutions.

Regards and thanks for the submission,

Wolfram

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |