* [patch FYI] twl4030 dumps revision info
@ 2008-10-16 4:23 David Brownell
2008-10-16 23:19 ` Pandita, Vikram
2008-10-16 23:27 ` Pandita, Vikram
0 siblings, 2 replies; 5+ messages in thread
From: David Brownell @ 2008-10-16 4:23 UTC (permalink / raw)
To: linux-omap
This is a diagnostic patch, dumping the IDCODE of the
TWL4030/TWL5030/... family chips.
Not for merging, at least for now. Later this may be
useful to make sure the reduced-functionality catalog
parts (TPS series) don't go registering components that
don't exist, like the battery charger.
The main curiousity we've uncovered is that TWL5030 ES1.0
mis-identifies itself as TWL4030 ES1.0 ... unclear just now
whether that's also true of ES1.1 and later parts.
- Dave
---
drivers/mfd/twl4030-core.c | 62 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -748,6 +748,66 @@ static int twl4030_remove(struct i2c_cli
return 0;
}
+struct es_desc {
+ u8 nibble;
+ char name[4];
+};
+
+static const struct es_desc twl4030_es[] = {
+ { 0, "1.0", },
+ { 1, "2.x", },
+ { 4, "3.0", },
+ { 5, "3.1", },
+ { },
+};
+static const struct es_desc twl5030_es[] = {
+ { 0, "1.0", },
+ { 1, "1.1", },
+ { },
+};
+
+static u32 twl_id(struct device *dev)
+{
+ const u32 mask = ((1 << 16) - 1) << 12;
+ union { u8 bytes[4]; u32 word; } idcode;
+ int status;
+ u8 nibble;
+ char *chip;
+ const struct es_desc *desc;
+
+ status = twl4030_i2c_read(TWL4030_MODULE_INTBR,
+ idcode.bytes, 0, 4);
+ if (status < 0)
+ return 0;
+
+ idcode.word = le32_to_cpu(idcode.word),
+ nibble = idcode.word >> 28;
+
+ /* NOTE: TWL5030 / TPS65930 ES1.0 mis-identifies as TWL4030 */
+
+ if ((idcode.word & mask) == (0x0009002F & mask)) {
+ chip = "TWL4030";
+ desc = twl4030_es;
+ } else if ((idcode.word & mask) == (0x0009802F & mask)) {
+ chip = "TWL5030";
+ desc = twl5030_es;
+ } else {
+ chip = "unrecognized";
+ desc = NULL;
+ }
+
+ while (desc && desc->name[0]) {
+ if (desc->nibble == nibble) {
+ dev_info(dev, "%s ES %s; idcode %08x\n",
+ chip, desc->name, idcode.word);
+ return idcode.word;
+ }
+ desc++;
+ }
+ dev_info(dev, "%s; idcode %08x\n", chip, idcode.word);
+ return idcode.word;
+}
+
/* NOTE: this driver only handles a single twl4030/tps659x0 chip */
static int
twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id)
@@ -795,6 +855,8 @@ twl4030_probe(struct i2c_client *client,
if(0)dumpit();
+ twl_id(&client->dev);
+
/* setup clock framework */
clocks_init();
^ permalink raw reply [flat|nested] 5+ messages in thread* RE: [patch FYI] twl4030 dumps revision info
2008-10-16 4:23 [patch FYI] twl4030 dumps revision info David Brownell
@ 2008-10-16 23:19 ` Pandita, Vikram
2008-10-16 23:27 ` Pandita, Vikram
1 sibling, 0 replies; 5+ messages in thread
From: Pandita, Vikram @ 2008-10-16 23:19 UTC (permalink / raw)
To: David Brownell, linux-omap@vger.kernel.org
>Sent: Wednesday, October 15, 2008 11:24 PM
>To: linux-omap@vger.kernel.org
>Subject: [patch FYI] twl4030 dumps revision info
>
>
>---
> drivers/mfd/twl4030-core.c | 62 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 62 insertions(+)
>
>+};
>+
>+static u32 twl_id(struct device *dev)
>+{
>+ const u32 mask = ((1 << 16) - 1) << 12;
>+ union { u8 bytes[4]; u32 word; } idcode;
>+ int status;
>+ u8 nibble;
>+ char *chip;
>+ const struct es_desc *desc;
>+
>+ status = twl4030_i2c_read(TWL4030_MODULE_INTBR,
>+ idcode.bytes, 0, 4);
>+ if (status < 0)
>+ return 0;
>+
>+ idcode.word = le32_to_cpu(idcode.word),
End of line should be ;
Hope you are not using , operator :-)
>+ nibble = idcode.word >> 28;
>+
>+ /* NOTE: TWL5030 / TPS65930 ES1.0 mis-identifies as TWL4030 */
>+
>+ if ((idcode.word & mask) == (0x0009002F & mask)) {
>+ chip = "TWL4030";
>+ desc = twl4030_es;
>+ } else if ((idcode.word & mask) == (0x0009802F & mask)) {
>+ chip = "TWL5030";
>+ desc = twl5030_es;
>+ } else {
>+ chip = "unrecognized";
>+ desc = NULL;
>+ }
>+
>+ while (desc && desc->name[0]) {
>+ if (desc->nibble == nibble) {
>+ dev_info(dev, "%s ES %s; idcode %08x\n",
>+ chip, desc->name, idcode.word);
>+ return idcode.word;
>+ }
>+ desc++;
>+ }
>+ dev_info(dev, "%s; idcode %08x\n", chip, idcode.word);
>+ return idcode.word;
>+}
>+
> /* NOTE: this driver only handles a single twl4030/tps659x0 chip */
> static int
> twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id)
>@@ -795,6 +855,8 @@ twl4030_probe(struct i2c_client *client,
>
> if(0)dumpit();
>
>+ twl_id(&client->dev);
>+
> /* setup clock framework */
> clocks_init();
>
>--
>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] 5+ messages in thread* RE: [patch FYI] twl4030 dumps revision info
2008-10-16 4:23 [patch FYI] twl4030 dumps revision info David Brownell
2008-10-16 23:19 ` Pandita, Vikram
@ 2008-10-16 23:27 ` Pandita, Vikram
2008-10-17 0:16 ` David Brownell
1 sibling, 1 reply; 5+ messages in thread
From: Pandita, Vikram @ 2008-10-16 23:27 UTC (permalink / raw)
To: David Brownell, linux-omap@vger.kernel.org
Dave
>Sent: Wednesday, October 15, 2008 11:24 PM
>To: linux-omap@vger.kernel.org
>Subject: [patch FYI] twl4030 dumps revision info
>
>This is a diagnostic patch, dumping the IDCODE of the
>TWL4030/TWL5030/... family chips.
>
>Not for merging, at least for now. Later this may be
>useful to make sure the reduced-functionality catalog
>parts (TPS series) don't go registering components that
>don't exist, like the battery charger.
>
>The main curiousity we've uncovered is that TWL5030 ES1.0
>mis-identifies itself as TWL4030 ES1.0 ... unclear just now
>whether that's also true of ES1.1 and later parts.
As per TRM,
the idcode for TWL5030 should be: 0x0009802F
is it not what you are observing? Or was it the , bug !!
>
>- Dave
>
>---
> drivers/mfd/twl4030-core.c | 62 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 62 insertions(+)
>
>--- a/drivers/mfd/twl4030-core.c
>+++ b/drivers/mfd/twl4030-core.c
>@@ -748,6 +748,66 @@ static int twl4030_remove(struct i2c_cli
> return 0;
> }
>
>+struct es_desc {
>+ u8 nibble;
>+ char name[4];
>+};
>+
>+static const struct es_desc twl4030_es[] = {
>+ { 0, "1.0", },
>+ { 1, "2.x", },
>+ { 4, "3.0", },
>+ { 5, "3.1", },
>+ { },
>+};
>+static const struct es_desc twl5030_es[] = {
>+ { 0, "1.0", },
>+ { 1, "1.1", },
>+ { },
>+};
>+
>+static u32 twl_id(struct device *dev)
>+{
>+ const u32 mask = ((1 << 16) - 1) << 12;
>+ union { u8 bytes[4]; u32 word; } idcode;
>+ int status;
>+ u8 nibble;
>+ char *chip;
>+ const struct es_desc *desc;
>+
>+ status = twl4030_i2c_read(TWL4030_MODULE_INTBR,
>+ idcode.bytes, 0, 4);
>+ if (status < 0)
>+ return 0;
>+
>+ idcode.word = le32_to_cpu(idcode.word),
>+ nibble = idcode.word >> 28;
>+
>+ /* NOTE: TWL5030 / TPS65930 ES1.0 mis-identifies as TWL4030 */
>+
>+ if ((idcode.word & mask) == (0x0009002F & mask)) {
>+ chip = "TWL4030";
>+ desc = twl4030_es;
>+ } else if ((idcode.word & mask) == (0x0009802F & mask)) {
>+ chip = "TWL5030";
>+ desc = twl5030_es;
>+ } else {
>+ chip = "unrecognized";
>+ desc = NULL;
>+ }
>+
>+ while (desc && desc->name[0]) {
>+ if (desc->nibble == nibble) {
>+ dev_info(dev, "%s ES %s; idcode %08x\n",
>+ chip, desc->name, idcode.word);
>+ return idcode.word;
>+ }
>+ desc++;
>+ }
>+ dev_info(dev, "%s; idcode %08x\n", chip, idcode.word);
>+ return idcode.word;
>+}
>+
> /* NOTE: this driver only handles a single twl4030/tps659x0 chip */
> static int
> twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id)
>@@ -795,6 +855,8 @@ twl4030_probe(struct i2c_client *client,
>
> if(0)dumpit();
>
>+ twl_id(&client->dev);
>+
> /* setup clock framework */
> clocks_init();
>
>--
>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] 5+ messages in thread* Re: [patch FYI] twl4030 dumps revision info
2008-10-16 23:27 ` Pandita, Vikram
@ 2008-10-17 0:16 ` David Brownell
2008-10-17 8:31 ` Pakaravoor, Jagadeesh
0 siblings, 1 reply; 5+ messages in thread
From: David Brownell @ 2008-10-17 0:16 UTC (permalink / raw)
To: Pandita, Vikram; +Cc: linux-omap@vger.kernel.org
On Thursday 16 October 2008, Pandita, Vikram wrote:
> >The main curiousity we've uncovered is that TWL5030 ES1.0
> >mis-identifies itself as TWL4030 ES1.0 ... unclear just now
> >whether that's also true of ES1.1 and later parts.
>
> As per TRM,
> the idcode for TWL5030 should be: 0x0009802F
>
> is it not what you are observing? Or was it the , bug !!
On one part labeled tps65950, it was 00009002F.
On one labeled as a twl5030, ditto.
On one labeled as a twl4030, it was 5009002f.
Ergo the observation that the TWL5030 ES1.0
parts seem to mis-identify themselves.
- Dave
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [patch FYI] twl4030 dumps revision info
2008-10-17 0:16 ` David Brownell
@ 2008-10-17 8:31 ` Pakaravoor, Jagadeesh
0 siblings, 0 replies; 5+ messages in thread
From: Pakaravoor, Jagadeesh @ 2008-10-17 8:31 UTC (permalink / raw)
To: David Brownell, Pandita, Vikram; +Cc: linux-omap@vger.kernel.org
> Ergo the observation that the TWL5030 ES1.0
> parts seem to mis-identify themselves.
>
The delta TRM between TWL4030 and TWL5030 has a note, which says,
"The part code number is meaning less when accessed through the I2C";
which means, over JTAG, the ID code should reflect 0x0009802F.
I have not verified the same though.
As of now I2C read will give the ID code for TWL5030 as TWL4030 ES1.0.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-10-17 8:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-16 4:23 [patch FYI] twl4030 dumps revision info David Brownell
2008-10-16 23:19 ` Pandita, Vikram
2008-10-16 23:27 ` Pandita, Vikram
2008-10-17 0:16 ` David Brownell
2008-10-17 8:31 ` Pakaravoor, Jagadeesh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox