linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] twl PROTECT_KEY usage cleanup
@ 2010-08-18  6:19 felipe.balbi
  2010-08-18  6:19 ` [PATCH 1/4] i2c: twl: add register defines for pm master module felipe.balbi
                   ` (3 more replies)
  0 siblings, 4 replies; 16+ messages in thread
From: felipe.balbi @ 2010-08-18  6:19 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: linux-kernel, linux-omap, Tony Lindgren, Andrew Morton, Felipe Balbi

From: Felipe Balbi <felipe.balbi@nokia.com>

Hi all,

the following patches are cleaning up the usage
of PROTECT_KEY register.

Boot-tested on custom OMAP3 board.

Felipe Balbi (4):
  i2c: twl: add register defines for pm master module
  mfd: twl-core: switch over to defines in twl.h
  mfd: twl4030-power: switch over to defines in twl.h
  usb: otg: twl4030-usb: switch over to defines in twl.h

 drivers/mfd/twl-core.c        |   21 ++++++++----------
 drivers/mfd/twl4030-power.c   |   30 ++++++++++++++------------
 drivers/usb/otg/twl4030-usb.c |   13 ++++++++---
 include/linux/i2c/twl.h       |   46 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 80 insertions(+), 30 deletions(-)

-- 
1.7.2.1.6.g61bf12


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

* [PATCH 1/4] i2c: twl: add register defines for pm master module
  2010-08-18  6:19 [PATCH 0/4] twl PROTECT_KEY usage cleanup felipe.balbi
@ 2010-08-18  6:19 ` felipe.balbi
  2010-08-18  7:19   ` Felipe Balbi
  2010-08-18  6:19 ` [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h felipe.balbi
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 16+ messages in thread
From: felipe.balbi @ 2010-08-18  6:19 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: linux-kernel, linux-omap, Tony Lindgren, Andrew Morton, Felipe Balbi

From: Felipe Balbi <felipe.balbi@nokia.com>

Some modules already need to talk to at least PROTECT_KEY
register, while at that, add defines to the entire register
space.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 include/linux/i2c/twl.h |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 6de90bf..a3bfbe1 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -357,6 +357,52 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
 
 /*----------------------------------------------------------------------*/
 
+/*
+ * PM Master module register offsets (use TWL4030_MODULE_PM_MASTER)
+ */
+
+#define TWL4030_PM_MASTER_CFG_P1_TRANSITION	0x00
+#define TWL4030_PM_MASTER_CFG_P2_TRANSITION	0x01
+#define TWL4030_PM_MASTER_CFG_P3_TRANSITION	0x02
+#define TWL4030_PM_MASTER_CFG_P123_TRANSITION	0x03
+#define TWL4030_PM_MASTER_STS_BOOT		0x04
+#define TWL4030_PM_MASTER_CFG_BOOT		0x05
+#define TWL4030_PM_MASTER_SHUNDAN		0x06
+#define TWL4030_PM_MASTER_BOOT_BCI		0x07
+#define TWL4030_PM_MASTER_CFG_PWRANA1		0x08
+#define TWL4030_PM_MASTER_CFG_PWRANA2		0x09
+#define TWL4030_PM_MASTER_BACKUP_MISC_STS	0x0a
+#define TWL4030_PM_MASTER_BACKUP_MISC_CFG	0x0b
+#define TWL4030_PM_MASTER_BACKUP_MISC_TST	0x0c
+#define TWL4030_PM_MASTER_PROTECT_KEY		0x0d
+#define TWL4030_PM_MASTER_STS_HW_CONDITIONS	0x0e
+#define TWL4030_PM_MASTER_P1_SW_EVENTS		0x0f
+#define TWL4030_PM_MASTER_P2_SW_EVENTS		0x10
+#define TWL4030_PM_MASTER_P3_SW_EVENTS		0x11
+#define TWL4030_PM_MASTER_STS_P123_STATE	0x12
+#define TWL4030_PM_MASTER_PB_CFG		0x13
+#define TWL4030_PM_MASTER_PB_WORD_MSB		0x14
+#define TWL4030_PM_MASTER_PB_WORD_LSB		0x15
+#define TWL4030_PM_MASTER_SEQ_ADD_W2P		0x1b
+#define TWL4030_PM_MASTER_SEQ_ADD_P2A		0x1c
+#define TWL4030_PM_MASTER_SEQ_ADD_A2W		0x1d
+#define TWL4030_PM_MASTER_SEQ_ADD_A2S		0x1e
+#define TWL4030_PM_MASTER_SEQ_ADD_S2A12		0x1f
+#define TWL4030_PM_MASTER_SEQ_ADD_S2A3		0x20
+#define TWL4030_PM_MASTER_SEQ_ADD_WARM		0x21
+#define TWL4030_PM_MASTER_MEMORY_ADDRESS	0x22
+#define TWL4030_PM_MASTER_MEMORY_DATA		0x23
+
+#define TWL4030_PM_MASTER_KEY_CFG1		0xc0
+#define TWL4030_PM_MASTER_KEY_CFG2		0x0c
+
+#define TWL4030_PM_MASTER_KEY_TST1		0xe0
+#define TWL4030_PM_MASTER_KEY_TST2		0x0e
+
+#define TWL4030_PM_MASTER_GLOBAL_TST		0xb6
+
+/*----------------------------------------------------------------------*/
+
 /* Power bus message definitions */
 
 /* The TWL4030/5030 splits its power-management resources (the various
-- 
1.7.2.1.6.g61bf12


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

* [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
  2010-08-18  6:19 [PATCH 0/4] twl PROTECT_KEY usage cleanup felipe.balbi
  2010-08-18  6:19 ` [PATCH 1/4] i2c: twl: add register defines for pm master module felipe.balbi
@ 2010-08-18  6:19 ` felipe.balbi
  2010-08-18  6:32   ` Gopinath, Thara
  2010-08-18  6:19 ` [PATCH 3/4] mfd: twl4030-power: " felipe.balbi
  2010-08-18  6:19 ` [PATCH 4/4] usb: otg: twl4030-usb: " felipe.balbi
  3 siblings, 1 reply; 16+ messages in thread
From: felipe.balbi @ 2010-08-18  6:19 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: linux-kernel, linux-omap, Tony Lindgren, Andrew Morton, Felipe Balbi

From: Felipe Balbi <felipe.balbi@nokia.com>

use the new definitions on twl header for code
consistency.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/mfd/twl-core.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index 720e099..9689ecf 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -202,12 +202,6 @@
 
 /* Few power values */
 #define R_CFG_BOOT			0x05
-#define R_PROTECT_KEY			0x0E
-
-/* access control values for R_PROTECT_KEY */
-#define KEY_UNLOCK1			0xce
-#define KEY_UNLOCK2			0xec
-#define KEY_LOCK			0x00
 
 /* some fields in R_CFG_BOOT */
 #define HFCLK_FREQ_19p2_MHZ		(1 << 0)
@@ -846,8 +840,8 @@ static inline int __init protect_pm_master(void)
 {
 	int e = 0;
 
-	e = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, KEY_LOCK,
-			R_PROTECT_KEY);
+	e = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0,
+			TWL4030_PM_MASTER_PROTECT_KEY);
 	return e;
 }
 
@@ -855,10 +849,13 @@ static inline int __init unprotect_pm_master(void)
 {
 	int e = 0;
 
-	e |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER, KEY_UNLOCK1,
-			R_PROTECT_KEY);
-	e |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER, KEY_UNLOCK2,
-			R_PROTECT_KEY);
+	e |= twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER,
+			TWL4030_PM_MASTER_KEY_CFG1,
+			TWL4030_PM_MASTER_PROTECT_KEY);
+	e |= twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER,
+			TWL4030_PM_MASTER_KEY_CFG2,
+			TWL4030_PM_MASTER_PROTECT_KEY);
+
 	return e;
 }
 
-- 
1.7.2.1.6.g61bf12


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

* [PATCH 3/4] mfd: twl4030-power: switch over to defines in twl.h
  2010-08-18  6:19 [PATCH 0/4] twl PROTECT_KEY usage cleanup felipe.balbi
  2010-08-18  6:19 ` [PATCH 1/4] i2c: twl: add register defines for pm master module felipe.balbi
  2010-08-18  6:19 ` [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h felipe.balbi
@ 2010-08-18  6:19 ` felipe.balbi
  2010-08-18  6:19 ` [PATCH 4/4] usb: otg: twl4030-usb: " felipe.balbi
  3 siblings, 0 replies; 16+ messages in thread
From: felipe.balbi @ 2010-08-18  6:19 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: linux-kernel, linux-omap, Tony Lindgren, Andrew Morton, Felipe Balbi

From: Felipe Balbi <felipe.balbi@nokia.com>

use the new definitions on twl header for code
consistency.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/mfd/twl4030-power.c |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 7efa878..16422de0 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -63,10 +63,6 @@ static u8 twl4030_start_script_address = 0x2b;
 #define R_MEMORY_ADDRESS	PHY_TO_OFF_PM_MASTER(0x59)
 #define R_MEMORY_DATA		PHY_TO_OFF_PM_MASTER(0x5a)
 
-#define R_PROTECT_KEY		0x0E
-#define R_KEY_1			0xC0
-#define R_KEY_2			0x0C
-
 /* resource configuration registers
    <RESOURCE>_DEV_GRP   at address 'n+0'
    <RESOURCE>_TYPE      at address 'n+1'
@@ -465,15 +461,17 @@ int twl4030_remove_script(u8 flags)
 {
 	int err = 0;
 
-	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, R_KEY_1,
-			R_PROTECT_KEY);
+	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER,
+			TWL4030_PM_MASTER_KEY_CFG1,
+			TWL4030_PM_MASTER_PROTECT_KEY);
 	if (err) {
 		pr_err("twl4030: unable to unlock PROTECT_KEY\n");
 		return err;
 	}
 
-	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, R_KEY_2,
-			R_PROTECT_KEY);
+	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER,
+			TWL4030_PM_MASTER_KEY_CFG2,
+			TWL4030_PM_MASTER_PROTECT_KEY);
 	if (err) {
 		pr_err("twl4030: unable to unlock PROTECT_KEY\n");
 		return err;
@@ -504,7 +502,8 @@ int twl4030_remove_script(u8 flags)
 			return err;
 	}
 
-	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY);
+	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0,
+			TWL4030_PM_MASTER_PROTECT_KEY);
 	if (err)
 		pr_err("TWL4030 Unable to relock registers\n");
 
@@ -518,13 +517,15 @@ void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts)
 	struct twl4030_resconfig *resconfig;
 	u8 address = twl4030_start_script_address;
 
-	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, R_KEY_1,
-				R_PROTECT_KEY);
+	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER,
+			TWL4030_PM_MASTER_KEY_CFG1,
+			TWL4030_PM_MASTER_PROTECT_KEY);
 	if (err)
 		goto unlock;
 
-	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, R_KEY_2,
-				R_PROTECT_KEY);
+	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER,
+			TWL4030_PM_MASTER_KEY_CFG2,
+			TWL4030_PM_MASTER_PROTECT_KEY);
 	if (err)
 		goto unlock;
 
@@ -546,7 +547,8 @@ void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts)
 		}
 	}
 
-	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY);
+	err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0,
+			TWL4030_PM_MASTER_PROTECT_KEY);
 	if (err)
 		pr_err("TWL4030 Unable to relock registers\n");
 	return;
-- 
1.7.2.1.6.g61bf12


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

* [PATCH 4/4] usb: otg: twl4030-usb: switch over to defines in twl.h
  2010-08-18  6:19 [PATCH 0/4] twl PROTECT_KEY usage cleanup felipe.balbi
                   ` (2 preceding siblings ...)
  2010-08-18  6:19 ` [PATCH 3/4] mfd: twl4030-power: " felipe.balbi
@ 2010-08-18  6:19 ` felipe.balbi
  3 siblings, 0 replies; 16+ messages in thread
From: felipe.balbi @ 2010-08-18  6:19 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: linux-kernel, linux-omap, Tony Lindgren, Andrew Morton, Felipe Balbi

From: Felipe Balbi <felipe.balbi@nokia.com>

use the new definitions on twl header for code
consistency.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
 drivers/usb/otg/twl4030-usb.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 0e88885..c9b7a87 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -124,7 +124,6 @@
 #define PHY_DPLL_CLK			(1 << 0)
 
 /* In module TWL4030_MODULE_PM_MASTER */
-#define PROTECT_KEY			0x0E
 #define STS_HW_CONDITIONS		0x0F
 
 /* In module TWL4030_MODULE_PM_RECEIVER */
@@ -405,8 +404,13 @@ static void twl4030_phy_resume(struct twl4030_usb *twl)
 static int twl4030_usb_ldo_init(struct twl4030_usb *twl)
 {
 	/* Enable writing to power configuration registers */
-	twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0xC0, PROTECT_KEY);
-	twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0x0C, PROTECT_KEY);
+	twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER,
+			TWL4030_PM_MASTER_KEY_CFG1,
+			TWL4030_PM_MASTER_PROTECT_KEY);
+
+	twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER,
+			TWL4030_PM_MASTER_KEY_CFG2,
+			TWL4030_PM_MASTER_PROTECT_KEY);
 
 	/* put VUSB3V1 LDO in active state */
 	twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2);
@@ -442,7 +446,8 @@ static int twl4030_usb_ldo_init(struct twl4030_usb *twl)
 	twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_TYPE);
 
 	/* disable access to power configuration registers */
-	twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, PROTECT_KEY);
+	twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0,
+			TWL4030_PM_MASTER_PROTECT_KEY);
 
 	return 0;
 
-- 
1.7.2.1.6.g61bf12


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

* RE: [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
  2010-08-18  6:19 ` [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h felipe.balbi
@ 2010-08-18  6:32   ` Gopinath, Thara
  2010-08-18  6:59     ` Felipe Balbi
  0 siblings, 1 reply; 16+ messages in thread
From: Gopinath, Thara @ 2010-08-18  6:32 UTC (permalink / raw)
  To: felipe.balbi, Samuel Ortiz
  Cc: linux-kernel, linux-omap, Tony Lindgren, Andrew Morton



>>-----Original Message-----
>>From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of
>>felipe.balbi@nokia.com
>>Sent: Wednesday, August 18, 2010 11:50 AM
>>To: Samuel Ortiz
>>Cc: linux-kernel@vger.kernel.org; linux-omap@vger.kernel.org; Tony Lindgren; Andrew Morton; Felipe
>>Balbi
>>Subject: [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
>>
>>From: Felipe Balbi <felipe.balbi@nokia.com>
>>
>>use the new definitions on twl header for code
>>consistency.
>>
>>Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
>>---
>> drivers/mfd/twl-core.c |   21 +++++++++------------
>> 1 files changed, 9 insertions(+), 12 deletions(-)
>>
>>diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
>>index 720e099..9689ecf 100644
>>--- a/drivers/mfd/twl-core.c
>>+++ b/drivers/mfd/twl-core.c
>>@@ -202,12 +202,6 @@
>>
>> /* Few power values */
>> #define R_CFG_BOOT			0x05
>>-#define R_PROTECT_KEY			0x0E
>>-
>>-/* access control values for R_PROTECT_KEY */
>>-#define KEY_UNLOCK1			0xce
>>-#define KEY_UNLOCK2			0xec
>>-#define KEY_LOCK			0x00
>>
>> /* some fields in R_CFG_BOOT */
>> #define HFCLK_FREQ_19p2_MHZ		(1 << 0)
>>@@ -846,8 +840,8 @@ static inline int __init protect_pm_master(void)
>> {
>> 	int e = 0;
>>
>>-	e = twl_i2c_write_u8(TWL_MODULE_PM_MASTER, KEY_LOCK,
>>-			R_PROTECT_KEY);
>>+	e = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0,
>>+			TWL4030_PM_MASTER_PROTECT_KEY);

Hello Felipe,

R_PROTECT_KEY offset is 0xE where as the new TWL4030_PM_MASTER_PROTECT_KEY
is defined as 0xd. I have not checked the trm to see which is correct. But
I hope this is a conscious change. Else we will end up breaking the functionality.
Also if this is a conscious change may be you should mention it in the patch
description. This comment applies to all other places where R_PROTECT_KEY has
been replaced with TWL4030_PM_MASTER_PROTECT_KEY in this patch as well as in
patch 3/4 and patch 4/4.

Regards
Thara

>> 	return e;
>> }
>>
>>@@ -855,10 +849,13 @@ static inline int __init unprotect_pm_master(void)
>> {
>> 	int e = 0;
>>
>>-	e |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER, KEY_UNLOCK1,
>>-			R_PROTECT_KEY);
>>-	e |= twl_i2c_write_u8(TWL_MODULE_PM_MASTER, KEY_UNLOCK2,
>>-			R_PROTECT_KEY);
>>+	e |= twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER,
>>+			TWL4030_PM_MASTER_KEY_CFG1,
>>+			TWL4030_PM_MASTER_PROTECT_KEY);
>>+	e |= twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER,
>>+			TWL4030_PM_MASTER_KEY_CFG2,
>>+			TWL4030_PM_MASTER_PROTECT_KEY);
>>+
>> 	return e;
>> }
>>
>>--
>>1.7.2.1.6.g61bf12
>>
>>--
>>To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>>the body of a message to majordomo@vger.kernel.org
>>More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
  2010-08-18  6:32   ` Gopinath, Thara
@ 2010-08-18  6:59     ` Felipe Balbi
  2010-08-18  7:02       ` Gopinath, Thara
  2010-08-18  7:03       ` Gopinath, Thara
  0 siblings, 2 replies; 16+ messages in thread
From: Felipe Balbi @ 2010-08-18  6:59 UTC (permalink / raw)
  To: ext Gopinath, Thara
  Cc: Balbi Felipe (Nokia-MS/Helsinki),
	Samuel Ortiz, linux-kernel, linux-omap, Tony Lindgren,
	Andrew Morton

On Wed, Aug 18, 2010 at 08:32:57AM +0200, ext Gopinath, Thara wrote:
>R_PROTECT_KEY offset is 0xE where as the new TWL4030_PM_MASTER_PROTECT_KEY
>is defined as 0xd. I have not checked the trm to see which is correct. But

you can use either 0xc0|0x0c or 0xce|0xec, both will work are unlock 
keys.

-- 
balbi

DefectiveByDesign.org

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

* RE: [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
  2010-08-18  6:59     ` Felipe Balbi
@ 2010-08-18  7:02       ` Gopinath, Thara
  2010-08-18  7:03       ` Gopinath, Thara
  1 sibling, 0 replies; 16+ messages in thread
From: Gopinath, Thara @ 2010-08-18  7:02 UTC (permalink / raw)
  To: felipe.balbi
  Cc: Samuel Ortiz, linux-kernel, linux-omap, Tony Lindgren, Andrew Morton



>>-----Original Message-----
>>From: Felipe Balbi [mailto:felipe.balbi@nokia.com]
>>Sent: Wednesday, August 18, 2010 12:29 PM
>>To: Gopinath, Thara
>>Cc: Balbi Felipe (Nokia-MS/Helsinki); Samuel Ortiz; linux-kernel@vger.kernel.org; linux-
>>omap@vger.kernel.org; Tony Lindgren; Andrew Morton
>>Subject: Re: [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
>>
>>On Wed, Aug 18, 2010 at 08:32:57AM +0200, ext Gopinath, Thara wrote:
>>>R_PROTECT_KEY offset is 0xE where as the new TWL4030_PM_MASTER_PROTECT_KEY
>>>is defined as 0xd. I have not checked the trm to see which is correct. But
>>
>>you can use either 0xc0|0x0c or 0xce|0xec, both will work are unlock
>>keys.

No I am not talking about the key values. I was talking about the register offset
for TWL4030_PM_MASTER_PROTECT_KEY. My question is, is it ok for it to be 0xd or 0xe.
Earlier we were using 0xd and in the new implementation it has been changed to 0xe.

Regards
Thara

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

* RE: [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
  2010-08-18  6:59     ` Felipe Balbi
  2010-08-18  7:02       ` Gopinath, Thara
@ 2010-08-18  7:03       ` Gopinath, Thara
  2010-08-18  7:10         ` Felipe Balbi
  1 sibling, 1 reply; 16+ messages in thread
From: Gopinath, Thara @ 2010-08-18  7:03 UTC (permalink / raw)
  To: Gopinath, Thara, felipe.balbi
  Cc: Samuel Ortiz, linux-kernel, linux-omap, Tony Lindgren, Andrew Morton



>>-----Original Message-----
>>From: Gopinath, Thara
>>Sent: Wednesday, August 18, 2010 12:33 PM
>>To: 'felipe.balbi@nokia.com'
>>Cc: Samuel Ortiz; linux-kernel@vger.kernel.org; linux-omap@vger.kernel.org; Tony Lindgren; Andrew
>>Morton
>>Subject: RE: [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
>>
>>
>>
>>>>-----Original Message-----
>>>>From: Felipe Balbi [mailto:felipe.balbi@nokia.com]
>>>>Sent: Wednesday, August 18, 2010 12:29 PM
>>>>To: Gopinath, Thara
>>>>Cc: Balbi Felipe (Nokia-MS/Helsinki); Samuel Ortiz; linux-kernel@vger.kernel.org; linux-
>>>>omap@vger.kernel.org; Tony Lindgren; Andrew Morton
>>>>Subject: Re: [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
>>>>
>>>>On Wed, Aug 18, 2010 at 08:32:57AM +0200, ext Gopinath, Thara wrote:
>>>>>R_PROTECT_KEY offset is 0xE where as the new TWL4030_PM_MASTER_PROTECT_KEY
>>>>>is defined as 0xd. I have not checked the trm to see which is correct. But
>>>>
>>>>you can use either 0xc0|0x0c or 0xce|0xec, both will work are unlock
>>>>keys.
>>
>>No I am not talking about the key values. I was talking about the register offset
>>for TWL4030_PM_MASTER_PROTECT_KEY. My question is, is it ok for it to be 0xd or 0xe.
>>Earlier we were using 0xd and in the new implementation it has been changed to 0xe.

Typo. Earlier we were using 0xe and in the new implementation it has been changed to 0xd.

Regards
Thara

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

* Re: [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
  2010-08-18  7:03       ` Gopinath, Thara
@ 2010-08-18  7:10         ` Felipe Balbi
  2010-08-18  7:16           ` Felipe Balbi
  0 siblings, 1 reply; 16+ messages in thread
From: Felipe Balbi @ 2010-08-18  7:10 UTC (permalink / raw)
  To: ext Gopinath, Thara
  Cc: Balbi Felipe (Nokia-MS/Helsinki),
	Samuel Ortiz, linux-kernel, linux-omap, Tony Lindgren,
	Andrew Morton

Hi,

On Wed, Aug 18, 2010 at 09:03:44AM +0200, ext Gopinath, Thara wrote:
>>>No I am not talking about the key values. I was talking about the register offset
>>>for TWL4030_PM_MASTER_PROTECT_KEY. My question is, is it ok for it to be 0xd or 0xe.
>>>Earlier we were using 0xd and in the new implementation it has been changed to 0xe.
>
>Typo. Earlier we were using 0xe and in the new implementation it has 
>been changed to 0xd.

you're right, I'm not sure how I came up with that value since the TRM 
shows 0x0e, maybe a copy&paste error. Will change patch 1.

-- 
balbi

DefectiveByDesign.org

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

* Re: [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
  2010-08-18  7:10         ` Felipe Balbi
@ 2010-08-18  7:16           ` Felipe Balbi
  2010-08-18 14:20             ` Gopinath, Thara
  2010-08-20 22:11             ` Samuel Ortiz
  0 siblings, 2 replies; 16+ messages in thread
From: Felipe Balbi @ 2010-08-18  7:16 UTC (permalink / raw)
  To: Balbi Felipe (Nokia-MS/Helsinki)
  Cc: ext Gopinath, Thara, Samuel Ortiz, linux-kernel, linux-omap,
	Tony Lindgren, Andrew Morton

Hi,

On Wed, Aug 18, 2010 at 09:10:22AM +0200, Balbi Felipe (Nokia-MS/Helsinki) wrote:
>On Wed, Aug 18, 2010 at 09:03:44AM +0200, ext Gopinath, Thara wrote:
>>>>No I am not talking about the key values. I was talking about the register offset
>>>>for TWL4030_PM_MASTER_PROTECT_KEY. My question is, is it ok for it to be 0xd or 0xe.
>>>>Earlier we were using 0xd and in the new implementation it has been changed to 0xe.
>>
>>Typo. Earlier we were using 0xe and in the new implementation it has
>>been changed to 0xd.
>
>you're right, I'm not sure how I came up with that value since the TRM
>shows 0x0e, maybe a copy&paste error. Will change patch 1.

ok, it's because there's no register 0x0a. And I missed that when 
defined the register space. Good catch, thanks. I wonder why it didn't 
fail to write to that register address :-?

-- 
balbi

DefectiveByDesign.org

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

* Re: [PATCH 1/4] i2c: twl: add register defines for pm master module
  2010-08-18  6:19 ` [PATCH 1/4] i2c: twl: add register defines for pm master module felipe.balbi
@ 2010-08-18  7:19   ` Felipe Balbi
  2010-09-10 15:13     ` Samuel Ortiz
  0 siblings, 1 reply; 16+ messages in thread
From: Felipe Balbi @ 2010-08-18  7:19 UTC (permalink / raw)
  To: Balbi Felipe (Nokia-MS/Helsinki)
  Cc: Samuel Ortiz, linux-kernel, linux-omap, Tony Lindgren, Andrew Morton

hi,

On Wed, Aug 18, 2010 at 08:19:34AM +0200, Balbi Felipe (Nokia-MS/Helsinki) wrote:
>From: Felipe Balbi <felipe.balbi@nokia.com>
>
>Some modules already need to talk to at least PROTECT_KEY
>register, while at that, add defines to the entire register
>space.
>
>Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
>---

here's updated patch with correct register space

8<--------------------------------------------------

 From a1021f7be2c7e277b303e6930285832f97258f85 Mon Sep 17 00:00:00 2001
From: Felipe Balbi <felipe.balbi@nokia.com>
Date: Thu, 1 Jul 2010 13:24:37 +0300
Subject: [PATCH 1/4] i2c: twl: add register defines for pm master module

Some modules already need to talk to at least PROTECT_KEY
register, while at that, add defines to the entire register
space.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
  include/linux/i2c/twl.h |   46 ++++++++++++++++++++++++++++++++++++++++++++++
  1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 6de90bf..9b17244 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -357,6 +357,52 @@ int twl6030_interrupt_mask(u8 bit_mask, u8 offset);
  
  /*----------------------------------------------------------------------*/
  
+/*
+ * PM Master module register offsets (use TWL4030_MODULE_PM_MASTER)
+ */
+
+#define TWL4030_PM_MASTER_CFG_P1_TRANSITION	0x00
+#define TWL4030_PM_MASTER_CFG_P2_TRANSITION	0x01
+#define TWL4030_PM_MASTER_CFG_P3_TRANSITION	0x02
+#define TWL4030_PM_MASTER_CFG_P123_TRANSITION	0x03
+#define TWL4030_PM_MASTER_STS_BOOT		0x04
+#define TWL4030_PM_MASTER_CFG_BOOT		0x05
+#define TWL4030_PM_MASTER_SHUNDAN		0x06
+#define TWL4030_PM_MASTER_BOOT_BCI		0x07
+#define TWL4030_PM_MASTER_CFG_PWRANA1		0x08
+#define TWL4030_PM_MASTER_CFG_PWRANA2		0x09
+#define TWL4030_PM_MASTER_BACKUP_MISC_STS	0x0b
+#define TWL4030_PM_MASTER_BACKUP_MISC_CFG	0x0c
+#define TWL4030_PM_MASTER_BACKUP_MISC_TST	0x0d
+#define TWL4030_PM_MASTER_PROTECT_KEY		0x0e
+#define TWL4030_PM_MASTER_STS_HW_CONDITIONS	0x0f
+#define TWL4030_PM_MASTER_P1_SW_EVENTS		0x10
+#define TWL4030_PM_MASTER_P2_SW_EVENTS		0x11
+#define TWL4030_PM_MASTER_P3_SW_EVENTS		0x12
+#define TWL4030_PM_MASTER_STS_P123_STATE	0x13
+#define TWL4030_PM_MASTER_PB_CFG		0x14
+#define TWL4030_PM_MASTER_PB_WORD_MSB		0x15
+#define TWL4030_PM_MASTER_PB_WORD_LSB		0x16
+#define TWL4030_PM_MASTER_SEQ_ADD_W2P		0x1c
+#define TWL4030_PM_MASTER_SEQ_ADD_P2A		0x1d
+#define TWL4030_PM_MASTER_SEQ_ADD_A2W		0x1e
+#define TWL4030_PM_MASTER_SEQ_ADD_A2S		0x1f
+#define TWL4030_PM_MASTER_SEQ_ADD_S2A12		0x20
+#define TWL4030_PM_MASTER_SEQ_ADD_S2A3		0x21
+#define TWL4030_PM_MASTER_SEQ_ADD_WARM		0x22
+#define TWL4030_PM_MASTER_MEMORY_ADDRESS	0x23
+#define TWL4030_PM_MASTER_MEMORY_DATA		0x24
+
+#define TWL4030_PM_MASTER_KEY_CFG1		0xc0
+#define TWL4030_PM_MASTER_KEY_CFG2		0x0c
+
+#define TWL4030_PM_MASTER_KEY_TST1		0xe0
+#define TWL4030_PM_MASTER_KEY_TST2		0x0e
+
+#define TWL4030_PM_MASTER_GLOBAL_TST		0xb6
+
+/*----------------------------------------------------------------------*/
+
  /* Power bus message definitions */
  
  /* The TWL4030/5030 splits its power-management resources (the various
-- 
1.7.2.1.6.g61bf12

-- 
balbi

DefectiveByDesign.org

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

* RE: [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
  2010-08-18  7:16           ` Felipe Balbi
@ 2010-08-18 14:20             ` Gopinath, Thara
  2010-08-20 22:11             ` Samuel Ortiz
  1 sibling, 0 replies; 16+ messages in thread
From: Gopinath, Thara @ 2010-08-18 14:20 UTC (permalink / raw)
  To: felipe.balbi
  Cc: Samuel Ortiz, linux-kernel, linux-omap, Tony Lindgren, Andrew Morton



>>-----Original Message-----
>>From: Felipe Balbi [mailto:felipe.balbi@nokia.com]
>>Sent: Wednesday, August 18, 2010 12:46 PM
>>To: Balbi Felipe (Nokia-MS/Helsinki)
>>Cc: Gopinath, Thara; Samuel Ortiz; linux-kernel@vger.kernel.org; linux-omap@vger.kernel.org; Tony
>>Lindgren; Andrew Morton
>>Subject: Re: [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
>>
>>Hi,
>>
>>On Wed, Aug 18, 2010 at 09:10:22AM +0200, Balbi Felipe (Nokia-MS/Helsinki) wrote:
>>>On Wed, Aug 18, 2010 at 09:03:44AM +0200, ext Gopinath, Thara wrote:
>>>>>>No I am not talking about the key values. I was talking about the register offset
>>>>>>for TWL4030_PM_MASTER_PROTECT_KEY. My question is, is it ok for it to be 0xd or 0xe.
>>>>>>Earlier we were using 0xd and in the new implementation it has been changed to 0xe.
>>>>
>>>>Typo. Earlier we were using 0xe and in the new implementation it has
>>>>been changed to 0xd.
>>>
>>>you're right, I'm not sure how I came up with that value since the TRM
>>>shows 0x0e, maybe a copy&paste error. Will change patch 1.
>>
>>ok, it's because there's no register 0x0a. And I missed that when
>>defined the register space. Good catch, thanks. I wonder why it didn't
>>fail to write to that register address :-?

0xd is a valid register offset. Hence no crash. Anyways I saw your new
patch. Looks ok to me.

Regards
Thara

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

* Re: [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
  2010-08-18  7:16           ` Felipe Balbi
  2010-08-18 14:20             ` Gopinath, Thara
@ 2010-08-20 22:11             ` Samuel Ortiz
  2010-08-21 14:07               ` Felipe Balbi
  1 sibling, 1 reply; 16+ messages in thread
From: Samuel Ortiz @ 2010-08-20 22:11 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: ext Gopinath, Thara, linux-kernel, linux-omap, Tony Lindgren,
	Andrew Morton

Hi Felipe,

On Wed, Aug 18, 2010 at 10:16:19AM +0300, Felipe Balbi wrote:
> Hi,
> 
> On Wed, Aug 18, 2010 at 09:10:22AM +0200, Balbi Felipe (Nokia-MS/Helsinki) wrote:
> >On Wed, Aug 18, 2010 at 09:03:44AM +0200, ext Gopinath, Thara wrote:
> >>>>No I am not talking about the key values. I was talking about the register offset
> >>>>for TWL4030_PM_MASTER_PROTECT_KEY. My question is, is it ok for it to be 0xd or 0xe.
> >>>>Earlier we were using 0xd and in the new implementation it has been changed to 0xe.
> >>
> >>Typo. Earlier we were using 0xe and in the new implementation it has
> >>been changed to 0xd.
> >
> >you're right, I'm not sure how I came up with that value since the TRM
> >shows 0x0e, maybe a copy&paste error. Will change patch 1.
> 
> ok, it's because there's no register 0x0a. And I missed that when
> defined the register space. Good catch, thanks. 
Should I expect a new patch then ?

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

* Re: [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h
  2010-08-20 22:11             ` Samuel Ortiz
@ 2010-08-21 14:07               ` Felipe Balbi
  0 siblings, 0 replies; 16+ messages in thread
From: Felipe Balbi @ 2010-08-21 14:07 UTC (permalink / raw)
  To: ext Samuel Ortiz
  Cc: Balbi Felipe (Nokia-MS/Helsinki),
	ext Gopinath, Thara, linux-kernel, linux-omap, Tony Lindgren,
	Andrew Morton

On Sat, Aug 21, 2010 at 12:11:46AM +0200, ext Samuel Ortiz wrote:
>Should I expect a new patch then ?

it's patch 1/4. I already replied to that patch with the new version:

https://patchwork.kernel.org/patch/120084/

-- 
balbi

DefectiveByDesign.org

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

* Re: [PATCH 1/4] i2c: twl: add register defines for pm master module
  2010-08-18  7:19   ` Felipe Balbi
@ 2010-09-10 15:13     ` Samuel Ortiz
  0 siblings, 0 replies; 16+ messages in thread
From: Samuel Ortiz @ 2010-09-10 15:13 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: linux-kernel, linux-omap, Tony Lindgren, Andrew Morton

Hi Felipe,

On Wed, Aug 18, 2010 at 10:19:16AM +0300, Felipe Balbi wrote:
> hi,
> 
> On Wed, Aug 18, 2010 at 08:19:34AM +0200, Balbi Felipe (Nokia-MS/Helsinki) wrote:
> >From: Felipe Balbi <felipe.balbi@nokia.com>
> >
> >Some modules already need to talk to at least PROTECT_KEY
> >register, while at that, add defines to the entire register
> >space.
> >
> >Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
> >---
> 
> here's updated patch with correct register space
All 4 patches applied, many thanks.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

end of thread, other threads:[~2010-09-10 15:13 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-18  6:19 [PATCH 0/4] twl PROTECT_KEY usage cleanup felipe.balbi
2010-08-18  6:19 ` [PATCH 1/4] i2c: twl: add register defines for pm master module felipe.balbi
2010-08-18  7:19   ` Felipe Balbi
2010-09-10 15:13     ` Samuel Ortiz
2010-08-18  6:19 ` [PATCH 2/4] mfd: twl-core: switch over to defines in twl.h felipe.balbi
2010-08-18  6:32   ` Gopinath, Thara
2010-08-18  6:59     ` Felipe Balbi
2010-08-18  7:02       ` Gopinath, Thara
2010-08-18  7:03       ` Gopinath, Thara
2010-08-18  7:10         ` Felipe Balbi
2010-08-18  7:16           ` Felipe Balbi
2010-08-18 14:20             ` Gopinath, Thara
2010-08-20 22:11             ` Samuel Ortiz
2010-08-21 14:07               ` Felipe Balbi
2010-08-18  6:19 ` [PATCH 3/4] mfd: twl4030-power: " felipe.balbi
2010-08-18  6:19 ` [PATCH 4/4] usb: otg: twl4030-usb: " felipe.balbi

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).