linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] i2c: append hardware lock with bus lock
       [not found] <2011042801>
@ 2011-04-28  4:02 ` Haojian Zhuang
  2011-04-28  8:22   ` Jean Delvare
  2011-04-28  4:02 ` [PATCH 2/3] i2c: pxa: support hardware lock Haojian Zhuang
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Haojian Zhuang @ 2011-04-28  4:02 UTC (permalink / raw)
  To: linux-arm-kernel

Both AP and CP are contained in Marvell PXA910 silicon. These two ARM
cores are sharing one pair of I2C pins.

In order to keep I2C transaction operated with atomic, hardware lock
(RIPC) is required. Because of this, bus lock in AP side can't afford
this requirement. Now hardware lock is appended.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Ben Dooks <ben-linux@fluff.org>
---
 drivers/i2c/i2c-core.c |   22 ++++++++++++++++++----
 include/linux/i2c.h    |    3 +++
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 045ba6e..412c7a5 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -448,8 +448,11 @@ void i2c_lock_adapter(struct i2c_adapter *adapter)
 
 	if (parent)
 		i2c_lock_adapter(parent);
-	else
+	else {
 		rt_mutex_lock(&adapter->bus_lock);
+		if (adapter->hardware_lock)
+			adapter->hardware_lock();
+	}
 }
 EXPORT_SYMBOL_GPL(i2c_lock_adapter);
 
@@ -460,11 +463,19 @@ EXPORT_SYMBOL_GPL(i2c_lock_adapter);
 static int i2c_trylock_adapter(struct i2c_adapter *adapter)
 {
 	struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter);
+	int ret = 0;
 
 	if (parent)
 		return i2c_trylock_adapter(parent);
-	else
-		return rt_mutex_trylock(&adapter->bus_lock);
+	else {
+		ret = rt_mutex_trylock(&adapter->bus_lock);
+		if (ret && adapter->hardware_trylock) {
+			ret = adapter->hardware_trylock();
+			if (!ret)
+				i2c_unlock_adapter(adapter);
+		}
+		return ret;
+	}
 }
 
 /**
@@ -477,8 +488,11 @@ void i2c_unlock_adapter(struct i2c_adapter *adapter)
 
 	if (parent)
 		i2c_unlock_adapter(parent);
-	else
+	else {
+		if (adapter->hardware_unlock)
+			adapter->hardware_unlock();
 		rt_mutex_unlock(&adapter->bus_lock);
+	}
 }
 EXPORT_SYMBOL_GPL(i2c_unlock_adapter);
 
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 06a8d9c..b283b4e 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -361,6 +361,9 @@ struct i2c_adapter {
 
 	/* data fields that are valid for all devices	*/
 	struct rt_mutex bus_lock;
+	void (*hardware_lock)(void);
+	void (*hardware_unlock)(void);
+	int (*hardware_trylock)(void);
 
 	int timeout;			/* in jiffies */
 	int retries;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/3] i2c: pxa: support hardware lock
       [not found] <2011042801>
  2011-04-28  4:02 ` [PATCH 1/3] i2c: append hardware lock with bus lock Haojian Zhuang
@ 2011-04-28  4:02 ` Haojian Zhuang
  2011-04-28  4:02 ` [PATCH 3/3] ARM: mmp: add hardware lock support in PXA910 Haojian Zhuang
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Haojian Zhuang @ 2011-04-28  4:02 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
---
 drivers/i2c/busses/i2c-pxa.c |    3 +++
 include/linux/i2c/pxa-i2c.h  |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index cab529d..e9a5dd8 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1120,6 +1120,9 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 	if (plat) {
 		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;
 		i2c->use_pio = plat->use_pio;
 		i2c->fast_mode = plat->fast_mode;
 	}
diff --git a/include/linux/i2c/pxa-i2c.h b/include/linux/i2c/pxa-i2c.h
index 1a9f65e..eec9954 100644
--- a/include/linux/i2c/pxa-i2c.h
+++ b/include/linux/i2c/pxa-i2c.h
@@ -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);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/3] ARM: mmp: add hardware lock support in PXA910
       [not found] <2011042801>
  2011-04-28  4:02 ` [PATCH 1/3] i2c: append hardware lock with bus lock Haojian Zhuang
  2011-04-28  4:02 ` [PATCH 2/3] i2c: pxa: support hardware lock Haojian Zhuang
@ 2011-04-28  4:02 ` Haojian Zhuang
  2011-04-28 15:15 ` [PATCH 1/3] i2c: append hardware lock with bus lock Haojian Zhuang
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 15+ messages in thread
From: Haojian Zhuang @ 2011-04-28  4:02 UTC (permalink / raw)
  To: linux-arm-kernel

RIPC register is used to implement hardware lock between CP and
AP in Marvell PXA910.

Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
---
 arch/arm/mach-mmp/include/mach/pxa910.h |    3 ++
 arch/arm/mach-mmp/pxa910.c              |   21 +++++++++++++-
 arch/arm/mach-mmp/ttc_dkb.c             |   45 +++++++++++++++++++++++++++++++
 3 files changed, 68 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h b/arch/arm/mach-mmp/include/mach/pxa910.h
index 91be755..e7659a1 100644
--- a/arch/arm/mach-mmp/include/mach/pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/pxa910.h
@@ -5,6 +5,9 @@ struct sys_timer;
 
 extern struct sys_timer pxa910_timer;
 extern void __init pxa910_init_irq(void);
+extern void pxa910_ripc_lock(void);
+extern void pxa910_ripc_unlock(void);
+extern int pxa910_ripc_trylock(void);
 
 #include <linux/i2c.h>
 #include <linux/i2c/pxa-i2c.h>
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 8f92ccd..3190257 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -28,7 +28,10 @@
 #include "common.h"
 #include "clock.h"
 
-#define MFPR_VIRT_BASE	(APB_VIRT_BASE + 0x1e000)
+#define MFPR_VIRT_BASE		(APB_VIRT_BASE + 0x1e000)
+
+#define RIPC0_VIRT_BASE		(APB_VIRT_BASE + 0x3D000)
+#define RIPC0_STATUS		(RIPC0_VIRT_BASE + 0x00)
 
 static struct mfp_addr_map pxa910_mfp_addr_map[] __initdata =
 {
@@ -100,6 +103,22 @@ void __init pxa910_init_irq(void)
 	pxa910_init_gpio();
 }
 
+void pxa910_ripc_lock(void)
+{
+	while (__raw_readl(RIPC0_STATUS))
+		cpu_relax();
+}
+
+int pxa910_ripc_trylock(void)
+{
+	return (!__raw_readl(RIPC0_STATUS));
+}
+
+void pxa910_ripc_unlock(void)
+{
+	__raw_writel(1, RIPC0_STATUS);
+}
+
 /* APB peripheral clocks */
 static APBC_CLK(uart1, PXA910_UART0, 1, 14745600);
 static APBC_CLK(uart2, PXA910_UART1, 1, 14745600);
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index e411039..c6af021 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -15,6 +15,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/onenand.h>
 #include <linux/interrupt.h>
+#include <linux/mfd/88pm860x.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -32,6 +33,10 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
 	GPIO47_UART2_RXD,
 	GPIO48_UART2_TXD,
 
+	/* I2C */
+	GPIO53_CI2C_SCL,
+	GPIO54_CI2C_SDA,
+
 	/* DFI */
 	DF_IO0_ND_IO0,
 	DF_IO1_ND_IO1,
@@ -113,12 +118,52 @@ static struct platform_device *ttc_dkb_devices[] = {
 	&ttc_dkb_device_onenand,
 };
 
+static struct pm860x_led_pdata dkb_pm860x_led[] = {
+	{
+		.id		= PM8606_ID_LED,
+		.iset		= PM8606_LED_CURRENT(12),
+		.flags		= PM8606_LED1_RED,
+	}, {
+		.id		= PM8606_ID_LED,
+		.iset		= PM8606_LED_CURRENT(12),
+		.flags		= PM8606_LED1_GREEN,
+	}, {
+		.id		= PM8606_ID_LED,
+		.iset		= PM8606_LED_CURRENT(12),
+		.flags		= PM8606_LED1_BLUE,
+	},
+};
+
+static struct pm860x_platform_data dkb_pm8607_info = {
+	.led			= &dkb_pm860x_led[0],
+	.i2c_port		= GI2C_PORT,
+	.companion_addr		= 0x11,
+	.irq_mode		= 0,
+	.irq_base		= IRQ_BOARD_START,
+};
+
+static struct i2c_board_info dkb_i2c_info[] = {
+	{
+		.type		= "88PM860x",
+		.addr		= 0x34,
+		.platform_data	= &dkb_pm8607_info,
+		.irq		= IRQ_PXA910_PMIC_INT,
+	},
+};
+
+static struct i2c_pxa_platform_data dkb_i2c_pdata = {
+	.hardware_lock		= pxa910_ripc_lock,
+	.hardware_unlock	= pxa910_ripc_unlock,
+	.hardware_trylock	= pxa910_ripc_trylock,
+};
+
 static void __init ttc_dkb_init(void)
 {
 	mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
 
 	/* on-chip devices */
 	pxa910_add_uart(1);
+	pxa910_add_twsi(0, &dkb_i2c_pdata, ARRAY_AND_SIZE(dkb_i2c_info));
 
 	/* off-chip devices */
 	platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 1/3] i2c: append hardware lock with bus lock
  2011-04-28  4:02 ` [PATCH 1/3] i2c: append hardware lock with bus lock Haojian Zhuang
@ 2011-04-28  8:22   ` Jean Delvare
  2011-04-28  8:36     ` Eric Miao
  0 siblings, 1 reply; 15+ messages in thread
From: Jean Delvare @ 2011-04-28  8:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Haojian,

On Thu, 28 Apr 2011 12:02:36 +0800, Haojian Zhuang wrote:
> Both AP and CP are contained in Marvell PXA910 silicon. These two ARM
> cores are sharing one pair of I2C pins.
> 
> In order to keep I2C transaction operated with atomic, hardware lock
> (RIPC) is required. Because of this, bus lock in AP side can't afford
> this requirement. Now hardware lock is appended.

I have no objection to the idea, but one question: when using the
hardware lock, isn't the software mutex redundant? I would expect that
you call the hardware_lock/unlock functions _instead_ of
rt_mutex_lock/unlock, rather than in addition to it. Or do you still
need the rt_mutex to prevent priority inversion?

> 
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> Cc: Ben Dooks <ben-linux@fluff.org>
> ---
>  drivers/i2c/i2c-core.c |   22 ++++++++++++++++++----
>  include/linux/i2c.h    |    3 +++
>  2 files changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 045ba6e..412c7a5 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -448,8 +448,11 @@ void i2c_lock_adapter(struct i2c_adapter *adapter)
>  
>  	if (parent)
>  		i2c_lock_adapter(parent);
> -	else
> +	else {
>  		rt_mutex_lock(&adapter->bus_lock);
> +		if (adapter->hardware_lock)
> +			adapter->hardware_lock();
> +	}
>  }
>  EXPORT_SYMBOL_GPL(i2c_lock_adapter);
>  
> @@ -460,11 +463,19 @@ EXPORT_SYMBOL_GPL(i2c_lock_adapter);
>  static int i2c_trylock_adapter(struct i2c_adapter *adapter)
>  {
>  	struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter);
> +	int ret = 0;
>  
>  	if (parent)
>  		return i2c_trylock_adapter(parent);
> -	else
> -		return rt_mutex_trylock(&adapter->bus_lock);
> +	else {
> +		ret = rt_mutex_trylock(&adapter->bus_lock);
> +		if (ret && adapter->hardware_trylock) {
> +			ret = adapter->hardware_trylock();
> +			if (!ret)
> +				i2c_unlock_adapter(adapter);
> +		}
> +		return ret;
> +	}
>  }
>  
>  /**
> @@ -477,8 +488,11 @@ void i2c_unlock_adapter(struct i2c_adapter *adapter)
>  
>  	if (parent)
>  		i2c_unlock_adapter(parent);
> -	else
> +	else {
> +		if (adapter->hardware_unlock)
> +			adapter->hardware_unlock();
>  		rt_mutex_unlock(&adapter->bus_lock);
> +	}
>  }
>  EXPORT_SYMBOL_GPL(i2c_unlock_adapter);
>  
> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> index 06a8d9c..b283b4e 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -361,6 +361,9 @@ struct i2c_adapter {
>  
>  	/* data fields that are valid for all devices	*/
>  	struct rt_mutex bus_lock;
> +	void (*hardware_lock)(void);
> +	void (*hardware_unlock)(void);
> +	int (*hardware_trylock)(void);
>  
>  	int timeout;			/* in jiffies */
>  	int retries;


-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/3] i2c: append hardware lock with bus lock
  2011-04-28  8:22   ` Jean Delvare
@ 2011-04-28  8:36     ` Eric Miao
  2011-04-28 14:16       ` Jean Delvare
  2011-04-28 14:19       ` Haojian Zhuang
  0 siblings, 2 replies; 15+ messages in thread
From: Eric Miao @ 2011-04-28  8:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 28, 2011 at 4:22 PM, Jean Delvare <khali@linux-fr.org> wrote:
> Hi Haojian,
>
> On Thu, 28 Apr 2011 12:02:36 +0800, Haojian Zhuang wrote:
>> Both AP and CP are contained in Marvell PXA910 silicon. These two ARM
>> cores are sharing one pair of I2C pins.
>>
>> In order to keep I2C transaction operated with atomic, hardware lock
>> (RIPC) is required. Because of this, bus lock in AP side can't afford
>> this requirement. Now hardware lock is appended.
>
> I have no objection to the idea, but one question: when using the
> hardware lock, isn't the software mutex redundant? I would expect that
> you call the hardware_lock/unlock functions _instead_ of
> rt_mutex_lock/unlock, rather than in addition to it. Or do you still
> need the rt_mutex to prevent priority inversion?
>

Jean,

It's actually not redundant. The hardware lock is used to protect
access to the same register regions between two processors (AP
and CP so called), while the software lock is used to protect
access from within the AP side.

>>
>> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
>> Cc: Ben Dooks <ben-linux@fluff.org>
>> ---
>> ?drivers/i2c/i2c-core.c | ? 22 ++++++++++++++++++----
>> ?include/linux/i2c.h ? ?| ? ?3 +++
>> ?2 files changed, 21 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
>> index 045ba6e..412c7a5 100644
>> --- a/drivers/i2c/i2c-core.c
>> +++ b/drivers/i2c/i2c-core.c
>> @@ -448,8 +448,11 @@ void i2c_lock_adapter(struct i2c_adapter *adapter)
>>
>> ? ? ? if (parent)
>> ? ? ? ? ? ? ? i2c_lock_adapter(parent);
>> - ? ? else
>> + ? ? else {
>> ? ? ? ? ? ? ? rt_mutex_lock(&adapter->bus_lock);
>> + ? ? ? ? ? ? if (adapter->hardware_lock)
>> + ? ? ? ? ? ? ? ? ? ? adapter->hardware_lock();
>> + ? ? }
>> ?}
>> ?EXPORT_SYMBOL_GPL(i2c_lock_adapter);
>>
>> @@ -460,11 +463,19 @@ EXPORT_SYMBOL_GPL(i2c_lock_adapter);
>> ?static int i2c_trylock_adapter(struct i2c_adapter *adapter)
>> ?{
>> ? ? ? struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter);
>> + ? ? int ret = 0;
>>
>> ? ? ? if (parent)
>> ? ? ? ? ? ? ? return i2c_trylock_adapter(parent);
>> - ? ? else
>> - ? ? ? ? ? ? return rt_mutex_trylock(&adapter->bus_lock);
>> + ? ? else {
>> + ? ? ? ? ? ? ret = rt_mutex_trylock(&adapter->bus_lock);
>> + ? ? ? ? ? ? if (ret && adapter->hardware_trylock) {
>> + ? ? ? ? ? ? ? ? ? ? ret = adapter->hardware_trylock();
>> + ? ? ? ? ? ? ? ? ? ? if (!ret)
>> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? i2c_unlock_adapter(adapter);
>> + ? ? ? ? ? ? }
>> + ? ? ? ? ? ? return ret;
>> + ? ? }
>> ?}
>>
>> ?/**
>> @@ -477,8 +488,11 @@ void i2c_unlock_adapter(struct i2c_adapter *adapter)
>>
>> ? ? ? if (parent)
>> ? ? ? ? ? ? ? i2c_unlock_adapter(parent);
>> - ? ? else
>> + ? ? else {
>> + ? ? ? ? ? ? if (adapter->hardware_unlock)
>> + ? ? ? ? ? ? ? ? ? ? adapter->hardware_unlock();
>> ? ? ? ? ? ? ? rt_mutex_unlock(&adapter->bus_lock);
>> + ? ? }
>> ?}
>> ?EXPORT_SYMBOL_GPL(i2c_unlock_adapter);
>>
>> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
>> index 06a8d9c..b283b4e 100644
>> --- a/include/linux/i2c.h
>> +++ b/include/linux/i2c.h
>> @@ -361,6 +361,9 @@ struct i2c_adapter {
>>
>> ? ? ? /* data fields that are valid for all devices ? */
>> ? ? ? struct rt_mutex bus_lock;
>> + ? ? void (*hardware_lock)(void);
>> + ? ? void (*hardware_unlock)(void);
>> + ? ? int (*hardware_trylock)(void);
>>
>> ? ? ? int timeout; ? ? ? ? ? ? ? ? ? ?/* in jiffies */
>> ? ? ? int retries;
>
>
> --
> Jean Delvare
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/3] i2c: append hardware lock with bus lock
  2011-04-28  8:36     ` Eric Miao
@ 2011-04-28 14:16       ` Jean Delvare
  2011-04-28 14:37         ` Russell King - ARM Linux
  2011-04-28 14:19       ` Haojian Zhuang
  1 sibling, 1 reply; 15+ messages in thread
From: Jean Delvare @ 2011-04-28 14:16 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Eric,

On Thu, 28 Apr 2011 16:36:02 +0800, Eric Miao wrote:
> On Thu, Apr 28, 2011 at 4:22 PM, Jean Delvare <khali@linux-fr.org> wrote:
> > Hi Haojian,
> >
> > On Thu, 28 Apr 2011 12:02:36 +0800, Haojian Zhuang wrote:
> >> Both AP and CP are contained in Marvell PXA910 silicon. These two ARM
> >> cores are sharing one pair of I2C pins.
> >>
> >> In order to keep I2C transaction operated with atomic, hardware lock
> >> (RIPC) is required. Because of this, bus lock in AP side can't afford
> >> this requirement. Now hardware lock is appended.
> >
> > I have no objection to the idea, but one question: when using the
> > hardware lock, isn't the software mutex redundant? I would expect that
> > you call the hardware_lock/unlock functions _instead_ of
> > rt_mutex_lock/unlock, rather than in addition to it. Or do you still
> > need the rt_mutex to prevent priority inversion?
> >
> 
> Jean,
> 
> It's actually not redundant. The hardware lock is used to protect
> access to the same register regions between two processors (AP
> and CP so called), while the software lock is used to protect
> access from within the AP side.

Are you suggesting that the hardware lock wouldn't mind being taken
twice by the AP side? If it is the case, then indeed the software mutex
is still needed to prevent it from happening.

That being said... I guess that avoiding a priority inversion is a good
enough reason to always take the rt_mutex, regardless of the hardware
lock implementation.

So, this patch is

Acked-by: Jean Delvare <khali@linux-fr.org>

I guess it makes more sense for me to let Ben apply it, as the other
two patches in the series are for him too. This will avoid a dependency
between our trees.

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/3] i2c: append hardware lock with bus lock
  2011-04-28  8:36     ` Eric Miao
  2011-04-28 14:16       ` Jean Delvare
@ 2011-04-28 14:19       ` Haojian Zhuang
  1 sibling, 0 replies; 15+ messages in thread
From: Haojian Zhuang @ 2011-04-28 14:19 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 28, 2011 at 4:36 PM, Eric Miao <eric.y.miao@gmail.com> wrote:
> On Thu, Apr 28, 2011 at 4:22 PM, Jean Delvare <khali@linux-fr.org> wrote:
>> Hi Haojian,
>>
>> On Thu, 28 Apr 2011 12:02:36 +0800, Haojian Zhuang wrote:
>>> Both AP and CP are contained in Marvell PXA910 silicon. These two ARM
>>> cores are sharing one pair of I2C pins.
>>>
>>> In order to keep I2C transaction operated with atomic, hardware lock
>>> (RIPC) is required. Because of this, bus lock in AP side can't afford
>>> this requirement. Now hardware lock is appended.
>>
>> I have no objection to the idea, but one question: when using the
>> hardware lock, isn't the software mutex redundant? I would expect that
>> you call the hardware_lock/unlock functions _instead_ of
>> rt_mutex_lock/unlock, rather than in addition to it. Or do you still
>> need the rt_mutex to prevent priority inversion?
>>
>
> Jean,
>
> It's actually not redundant. The hardware lock is used to protect
> access to the same register regions between two processors (AP
> and CP so called), while the software lock is used to protect
> access from within the AP side.
>

Jean,

It's not redundant. Reading RIPC register will try to get the lock. We're always
using __raw_readl() API to read register. I think the read operation
couldn't be
atomic and finished in one instruction cycle. If two processes in AP
side try to
get the RIPC lock with __raw_readl(), it may result dead lock. If we fetch the
RIPC lock behind software bus lock, it's safe.

If process on AP try to get the RIPC lock and compete with CP, it won't be an
issue. It should always be atomic.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/3] i2c: append hardware lock with bus lock
  2011-04-28 14:16       ` Jean Delvare
@ 2011-04-28 14:37         ` Russell King - ARM Linux
  2011-04-28 14:48           ` Haojian Zhuang
  0 siblings, 1 reply; 15+ messages in thread
From: Russell King - ARM Linux @ 2011-04-28 14:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 28, 2011 at 04:16:25PM +0200, Jean Delvare wrote:
> Are you suggesting that the hardware lock wouldn't mind being taken
> twice by the AP side? If it is the case, then indeed the software mutex
> is still needed to prevent it from happening.
> 
> That being said... I guess that avoiding a priority inversion is a good
> enough reason to always take the rt_mutex, regardless of the hardware
> lock implementation.
> 
> So, this patch is
> 
> Acked-by: Jean Delvare <khali@linux-fr.org>
> 
> I guess it makes more sense for me to let Ben apply it, as the other
> two patches in the series are for him too. This will avoid a dependency
> between our trees.

Only change I'd suggest is passing adapter to the hardware_lock/unlock
methods.  Having no arguments what so ever in generic code for this kind
of stuff looks rather strange and limiting.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/3] i2c: append hardware lock with bus lock
  2011-04-28 14:37         ` Russell King - ARM Linux
@ 2011-04-28 14:48           ` Haojian Zhuang
  0 siblings, 0 replies; 15+ messages in thread
From: Haojian Zhuang @ 2011-04-28 14:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 28, 2011 at 10:37 PM, Russell King - ARM Linux
<linux@arm.linux.org.uk> wrote:
> On Thu, Apr 28, 2011 at 04:16:25PM +0200, Jean Delvare wrote:
>> Are you suggesting that the hardware lock wouldn't mind being taken
>> twice by the AP side? If it is the case, then indeed the software mutex
>> is still needed to prevent it from happening.
>>
>> That being said... I guess that avoiding a priority inversion is a good
>> enough reason to always take the rt_mutex, regardless of the hardware
>> lock implementation.
>>
>> So, this patch is
>>
>> Acked-by: Jean Delvare <khali@linux-fr.org>
>>
>> I guess it makes more sense for me to let Ben apply it, as the other
>> two patches in the series are for him too. This will avoid a dependency
>> between our trees.
>
> Only change I'd suggest is passing adapter to the hardware_lock/unlock
> methods. ?Having no arguments what so ever in generic code for this kind
> of stuff looks rather strange and limiting.
>

OK. I'll update it.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/3] i2c: append hardware lock with bus lock
       [not found] <2011042801>
                   ` (2 preceding siblings ...)
  2011-04-28  4:02 ` [PATCH 3/3] ARM: mmp: add hardware lock support in PXA910 Haojian Zhuang
@ 2011-04-28 15:15 ` Haojian Zhuang
  2011-05-02  9:27   ` Ben Dooks
  2011-04-28 15:15 ` [PATCH 2/3] i2c: pxa: support hardware lock Haojian Zhuang
  2011-04-28 15:15 ` [PATCH 3/3] ARM: mmp: add hardware lock support in PXA910 Haojian Zhuang
  5 siblings, 1 reply; 15+ messages in thread
From: Haojian Zhuang @ 2011-04-28 15:15 UTC (permalink / raw)
  To: linux-arm-kernel

Both AP and CP are contained in Marvell PXA910 silicon. These two ARM
cores are sharing one pair of I2C pins.

In order to keep I2C transaction operated with atomic, hardware lock
(RIPC) is required. Because of this, bus lock in AP side can't afford
this requirement. Now hardware lock is appended.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Jean Delvare <khali@linux-fr.org>
---
 drivers/i2c/i2c-core.c |   22 ++++++++++++++++++----
 include/linux/i2c.h    |    3 +++
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 045ba6e..132d46c 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -448,8 +448,11 @@ void i2c_lock_adapter(struct i2c_adapter *adapter)
 
 	if (parent)
 		i2c_lock_adapter(parent);
-	else
+	else {
 		rt_mutex_lock(&adapter->bus_lock);
+		if (adapter->hardware_lock)
+			adapter->hardware_lock(adapter);
+	}
 }
 EXPORT_SYMBOL_GPL(i2c_lock_adapter);
 
@@ -460,11 +463,19 @@ EXPORT_SYMBOL_GPL(i2c_lock_adapter);
 static int i2c_trylock_adapter(struct i2c_adapter *adapter)
 {
 	struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter);
+	int ret = 0;
 
 	if (parent)
 		return i2c_trylock_adapter(parent);
-	else
-		return rt_mutex_trylock(&adapter->bus_lock);
+	else {
+		ret = rt_mutex_trylock(&adapter->bus_lock);
+		if (ret && adapter->hardware_trylock) {
+			ret = adapter->hardware_trylock(adapter);
+			if (!ret)
+				i2c_unlock_adapter(adapter);
+		}
+		return ret;
+	}
 }
 
 /**
@@ -477,8 +488,11 @@ void i2c_unlock_adapter(struct i2c_adapter *adapter)
 
 	if (parent)
 		i2c_unlock_adapter(parent);
-	else
+	else {
+		if (adapter->hardware_unlock)
+			adapter->hardware_unlock(adapter);
 		rt_mutex_unlock(&adapter->bus_lock);
+	}
 }
 EXPORT_SYMBOL_GPL(i2c_unlock_adapter);
 
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 06a8d9c..f4ef5b0 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -361,6 +361,9 @@ struct i2c_adapter {
 
 	/* data fields that are valid for all devices	*/
 	struct rt_mutex bus_lock;
+	void (*hardware_lock)(struct i2c_adapter *);
+	void (*hardware_unlock)(struct i2c_adapter *);
+	int (*hardware_trylock)(struct i2c_adapter *);
 
 	int timeout;			/* in jiffies */
 	int retries;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/3] i2c: pxa: support hardware lock
       [not found] <2011042801>
                   ` (3 preceding siblings ...)
  2011-04-28 15:15 ` [PATCH 1/3] i2c: append hardware lock with bus lock Haojian Zhuang
@ 2011-04-28 15:15 ` Haojian Zhuang
  2011-04-28 15:15 ` [PATCH 3/3] ARM: mmp: add hardware lock support in PXA910 Haojian Zhuang
  5 siblings, 0 replies; 15+ messages in thread
From: Haojian Zhuang @ 2011-04-28 15:15 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Jean Delvare <khali@linux-fr.org>
---
 drivers/i2c/busses/i2c-pxa.c |    3 +++
 include/linux/i2c/pxa-i2c.h  |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index cab529d..e9a5dd8 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1120,6 +1120,9 @@ static int i2c_pxa_probe(struct platform_device *dev)
 
 	if (plat) {
 		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;
 		i2c->use_pio = plat->use_pio;
 		i2c->fast_mode = plat->fast_mode;
 	}
diff --git a/include/linux/i2c/pxa-i2c.h b/include/linux/i2c/pxa-i2c.h
index 1a9f65e..076324f 100644
--- a/include/linux/i2c/pxa-i2c.h
+++ b/include/linux/i2c/pxa-i2c.h
@@ -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)(struct i2c_adapter *);
+	void			(*hardware_unlock)(struct i2c_adapter *);
+	int			(*hardware_trylock)(struct i2c_adapter *);
 };
 
 extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/3] ARM: mmp: add hardware lock support in PXA910
       [not found] <2011042801>
                   ` (4 preceding siblings ...)
  2011-04-28 15:15 ` [PATCH 2/3] i2c: pxa: support hardware lock Haojian Zhuang
@ 2011-04-28 15:15 ` Haojian Zhuang
  5 siblings, 0 replies; 15+ messages in thread
From: Haojian Zhuang @ 2011-04-28 15:15 UTC (permalink / raw)
  To: linux-arm-kernel

RIPC register is used to implement hardware lock between CP and
AP in Marvell PXA910.

Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Eric Miao <eric.y.miao@gmail.com>
Cc: Russell King <linux@arm.linux.org.uk>
---
 arch/arm/mach-mmp/include/mach/pxa910.h |   13 +++++---
 arch/arm/mach-mmp/pxa910.c              |   23 +++++++++++++++-
 arch/arm/mach-mmp/ttc_dkb.c             |   45 +++++++++++++++++++++++++++++++
 3 files changed, 75 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-mmp/include/mach/pxa910.h b/arch/arm/mach-mmp/include/mach/pxa910.h
index 91be755..2973466 100644
--- a/arch/arm/mach-mmp/include/mach/pxa910.h
+++ b/arch/arm/mach-mmp/include/mach/pxa910.h
@@ -1,16 +1,19 @@
 #ifndef __ASM_MACH_PXA910_H
 #define __ASM_MACH_PXA910_H
 
-struct sys_timer;
-
-extern struct sys_timer pxa910_timer;
-extern void __init pxa910_init_irq(void);
-
 #include <linux/i2c.h>
 #include <linux/i2c/pxa-i2c.h>
 #include <mach/devices.h>
 #include <plat/pxa3xx_nand.h>
 
+struct sys_timer;
+
+extern struct sys_timer pxa910_timer;
+extern void __init pxa910_init_irq(void);
+extern void pxa910_ripc_lock(struct i2c_adapter *);
+extern void pxa910_ripc_unlock(struct i2c_adapter *);
+extern int pxa910_ripc_trylock(struct i2c_adapter *);
+
 extern struct pxa_device_desc pxa910_device_uart1;
 extern struct pxa_device_desc pxa910_device_uart2;
 extern struct pxa_device_desc pxa910_device_twsi0;
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 8f92ccd..4fbe485 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -13,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/list.h>
 #include <linux/io.h>
+#include <linux/i2c.h>
 
 #include <asm/mach/time.h>
 #include <mach/addr-map.h>
@@ -28,7 +29,10 @@
 #include "common.h"
 #include "clock.h"
 
-#define MFPR_VIRT_BASE	(APB_VIRT_BASE + 0x1e000)
+#define MFPR_VIRT_BASE		(APB_VIRT_BASE + 0x1e000)
+
+#define RIPC0_VIRT_BASE		(APB_VIRT_BASE + 0x3D000)
+#define RIPC0_STATUS		(RIPC0_VIRT_BASE + 0x00)
 
 static struct mfp_addr_map pxa910_mfp_addr_map[] __initdata =
 {
@@ -100,6 +104,23 @@ void __init pxa910_init_irq(void)
 	pxa910_init_gpio();
 }
 
+void pxa910_ripc_lock(struct i2c_adapter *adap)
+{
+	while (__raw_readl(RIPC0_STATUS))
+		cpu_relax();
+}
+
+/* return 1 -- succeed to get lock; 0 -- fail to get lock */
+int pxa910_ripc_trylock(struct i2c_adapter *adap)
+{
+	return (!__raw_readl(RIPC0_STATUS));
+}
+
+void pxa910_ripc_unlock(struct i2c_adapter *adap)
+{
+	__raw_writel(1, RIPC0_STATUS);
+}
+
 /* APB peripheral clocks */
 static APBC_CLK(uart1, PXA910_UART0, 1, 14745600);
 static APBC_CLK(uart2, PXA910_UART1, 1, 14745600);
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index e411039..c6af021 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -15,6 +15,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/onenand.h>
 #include <linux/interrupt.h>
+#include <linux/mfd/88pm860x.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -32,6 +33,10 @@ static unsigned long ttc_dkb_pin_config[] __initdata = {
 	GPIO47_UART2_RXD,
 	GPIO48_UART2_TXD,
 
+	/* I2C */
+	GPIO53_CI2C_SCL,
+	GPIO54_CI2C_SDA,
+
 	/* DFI */
 	DF_IO0_ND_IO0,
 	DF_IO1_ND_IO1,
@@ -113,12 +118,52 @@ static struct platform_device *ttc_dkb_devices[] = {
 	&ttc_dkb_device_onenand,
 };
 
+static struct pm860x_led_pdata dkb_pm860x_led[] = {
+	{
+		.id		= PM8606_ID_LED,
+		.iset		= PM8606_LED_CURRENT(12),
+		.flags		= PM8606_LED1_RED,
+	}, {
+		.id		= PM8606_ID_LED,
+		.iset		= PM8606_LED_CURRENT(12),
+		.flags		= PM8606_LED1_GREEN,
+	}, {
+		.id		= PM8606_ID_LED,
+		.iset		= PM8606_LED_CURRENT(12),
+		.flags		= PM8606_LED1_BLUE,
+	},
+};
+
+static struct pm860x_platform_data dkb_pm8607_info = {
+	.led			= &dkb_pm860x_led[0],
+	.i2c_port		= GI2C_PORT,
+	.companion_addr		= 0x11,
+	.irq_mode		= 0,
+	.irq_base		= IRQ_BOARD_START,
+};
+
+static struct i2c_board_info dkb_i2c_info[] = {
+	{
+		.type		= "88PM860x",
+		.addr		= 0x34,
+		.platform_data	= &dkb_pm8607_info,
+		.irq		= IRQ_PXA910_PMIC_INT,
+	},
+};
+
+static struct i2c_pxa_platform_data dkb_i2c_pdata = {
+	.hardware_lock		= pxa910_ripc_lock,
+	.hardware_unlock	= pxa910_ripc_unlock,
+	.hardware_trylock	= pxa910_ripc_trylock,
+};
+
 static void __init ttc_dkb_init(void)
 {
 	mfp_config(ARRAY_AND_SIZE(ttc_dkb_pin_config));
 
 	/* on-chip devices */
 	pxa910_add_uart(1);
+	pxa910_add_twsi(0, &dkb_i2c_pdata, ARRAY_AND_SIZE(dkb_i2c_info));
 
 	/* off-chip devices */
 	platform_add_devices(ARRAY_AND_SIZE(ttc_dkb_devices));
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 1/3] i2c: append hardware lock with bus lock
  2011-04-28 15:15 ` [PATCH 1/3] i2c: append hardware lock with bus lock Haojian Zhuang
@ 2011-05-02  9:27   ` Ben Dooks
  2011-05-02  9:46     ` Jean Delvare
  0 siblings, 1 reply; 15+ messages in thread
From: Ben Dooks @ 2011-05-02  9:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 28, 2011 at 11:15:44PM +0800, Haojian Zhuang wrote:
> Both AP and CP are contained in Marvell PXA910 silicon. These two ARM
> cores are sharing one pair of I2C pins.
> 
> In order to keep I2C transaction operated with atomic, hardware lock
> (RIPC) is required. Because of this, bus lock in AP side can't afford
> this requirement. Now hardware lock is appended.
> 
> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> Cc: Ben Dooks <ben-linux@fluff.org>
> Cc: Jean Delvare <khali@linux-fr.org>

Right, this looks like a reasonable explanation of what is going on here
and if Jean is happy with the core changes I'll look at where the driver
change can go.

> ---
>  drivers/i2c/i2c-core.c |   22 ++++++++++++++++++----
>  include/linux/i2c.h    |    3 +++
>  2 files changed, 21 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index 045ba6e..132d46c 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -448,8 +448,11 @@ void i2c_lock_adapter(struct i2c_adapter *adapter)
>  
>  	if (parent)
>  		i2c_lock_adapter(parent);
> -	else
> +	else {
>  		rt_mutex_lock(&adapter->bus_lock);
> +		if (adapter->hardware_lock)
> +			adapter->hardware_lock(adapter);
> +	}
>  }
>  EXPORT_SYMBOL_GPL(i2c_lock_adapter);
>  
> @@ -460,11 +463,19 @@ EXPORT_SYMBOL_GPL(i2c_lock_adapter);
>  static int i2c_trylock_adapter(struct i2c_adapter *adapter)
>  {
>  	struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter);
> +	int ret = 0;
>  
>  	if (parent)
>  		return i2c_trylock_adapter(parent);
> -	else
> -		return rt_mutex_trylock(&adapter->bus_lock);
> +	else {
> +		ret = rt_mutex_trylock(&adapter->bus_lock);
> +		if (ret && adapter->hardware_trylock) {
> +			ret = adapter->hardware_trylock(adapter);
> +			if (!ret)
> +				i2c_unlock_adapter(adapter);
> +		}
> +		return ret;
> +	}
>  }
>  
>  /**
> @@ -477,8 +488,11 @@ void i2c_unlock_adapter(struct i2c_adapter *adapter)
>  
>  	if (parent)
>  		i2c_unlock_adapter(parent);
> -	else
> +	else {
> +		if (adapter->hardware_unlock)
> +			adapter->hardware_unlock(adapter);
>  		rt_mutex_unlock(&adapter->bus_lock);
> +	}
>  }
>  EXPORT_SYMBOL_GPL(i2c_unlock_adapter);
>  
> diff --git a/include/linux/i2c.h b/include/linux/i2c.h
> index 06a8d9c..f4ef5b0 100644
> --- a/include/linux/i2c.h
> +++ b/include/linux/i2c.h
> @@ -361,6 +361,9 @@ struct i2c_adapter {
>  
>  	/* data fields that are valid for all devices	*/
>  	struct rt_mutex bus_lock;
> +	void (*hardware_lock)(struct i2c_adapter *);
> +	void (*hardware_unlock)(struct i2c_adapter *);
> +	int (*hardware_trylock)(struct i2c_adapter *);
>  
>  	int timeout;			/* in jiffies */
>  	int retries;
> -- 
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Ben Dooks, ben at fluff.org, http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/3] i2c: append hardware lock with bus lock
  2011-05-02  9:27   ` Ben Dooks
@ 2011-05-02  9:46     ` Jean Delvare
  2011-05-10 23:08       ` Ben Dooks
  0 siblings, 1 reply; 15+ messages in thread
From: Jean Delvare @ 2011-05-02  9:46 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2 May 2011 10:27:34 +0100, Ben Dooks wrote:
> On Thu, Apr 28, 2011 at 11:15:44PM +0800, Haojian Zhuang wrote:
> > Both AP and CP are contained in Marvell PXA910 silicon. These two ARM
> > cores are sharing one pair of I2C pins.
> > 
> > In order to keep I2C transaction operated with atomic, hardware lock
> > (RIPC) is required. Because of this, bus lock in AP side can't afford
> > this requirement. Now hardware lock is appended.
> > 
> > Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> > Cc: Ben Dooks <ben-linux@fluff.org>
> > Cc: Jean Delvare <khali@linux-fr.org>
> 
> Right, this looks like a reasonable explanation of what is going on here
> and if Jean is happy with the core changes I'll look at where the driver
> change can go.

Yes I am!

Let me know if you want me to take the core change in my tree or if you
prefer to have it in yours to avoid a dependency.

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/3] i2c: append hardware lock with bus lock
  2011-05-02  9:46     ` Jean Delvare
@ 2011-05-10 23:08       ` Ben Dooks
  0 siblings, 0 replies; 15+ messages in thread
From: Ben Dooks @ 2011-05-10 23:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 02, 2011 at 11:46:16AM +0200, Jean Delvare wrote:
> On Mon, 2 May 2011 10:27:34 +0100, Ben Dooks wrote:
> > On Thu, Apr 28, 2011 at 11:15:44PM +0800, Haojian Zhuang wrote:
> > > Both AP and CP are contained in Marvell PXA910 silicon. These two ARM
> > > cores are sharing one pair of I2C pins.
> > > 
> > > In order to keep I2C transaction operated with atomic, hardware lock
> > > (RIPC) is required. Because of this, bus lock in AP side can't afford
> > > this requirement. Now hardware lock is appended.
> > > 
> > > Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
> > > Cc: Ben Dooks <ben-linux@fluff.org>
> > > Cc: Jean Delvare <khali@linux-fr.org>
> > 
> > Right, this looks like a reasonable explanation of what is going on here
> > and if Jean is happy with the core changes I'll look at where the driver
> > change can go.
> 
> Yes I am!
> 
> Let me know if you want me to take the core change in my tree or if you
> prefer to have it in yours to avoid a dependency.

if it'll go in my tree ok, then yes.
Will publish a new tree soon.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-05-10 23:08 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <2011042801>
2011-04-28  4:02 ` [PATCH 1/3] i2c: append hardware lock with bus lock Haojian Zhuang
2011-04-28  8:22   ` Jean Delvare
2011-04-28  8:36     ` Eric Miao
2011-04-28 14:16       ` Jean Delvare
2011-04-28 14:37         ` Russell King - ARM Linux
2011-04-28 14:48           ` Haojian Zhuang
2011-04-28 14:19       ` Haojian Zhuang
2011-04-28  4:02 ` [PATCH 2/3] i2c: pxa: support hardware lock Haojian Zhuang
2011-04-28  4:02 ` [PATCH 3/3] ARM: mmp: add hardware lock support in PXA910 Haojian Zhuang
2011-04-28 15:15 ` [PATCH 1/3] i2c: append hardware lock with bus lock Haojian Zhuang
2011-05-02  9:27   ` Ben Dooks
2011-05-02  9:46     ` Jean Delvare
2011-05-10 23:08       ` Ben Dooks
2011-04-28 15:15 ` [PATCH 2/3] i2c: pxa: support hardware lock Haojian Zhuang
2011-04-28 15:15 ` [PATCH 3/3] ARM: mmp: add hardware lock support in PXA910 Haojian Zhuang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).