diff options
Diffstat (limited to 'recipes-kernel/linux/linux-omap-2.6.39/mfd/0011-MFD-TWL4030-TWL-version-checking.patch')
-rw-r--r-- | recipes-kernel/linux/linux-omap-2.6.39/mfd/0011-MFD-TWL4030-TWL-version-checking.patch | 164 |
1 files changed, 0 insertions, 164 deletions
diff --git a/recipes-kernel/linux/linux-omap-2.6.39/mfd/0011-MFD-TWL4030-TWL-version-checking.patch b/recipes-kernel/linux/linux-omap-2.6.39/mfd/0011-MFD-TWL4030-TWL-version-checking.patch deleted file mode 100644 index 6de2193d..00000000 --- a/recipes-kernel/linux/linux-omap-2.6.39/mfd/0011-MFD-TWL4030-TWL-version-checking.patch +++ /dev/null | |||
@@ -1,164 +0,0 @@ | |||
1 | From 3ceb224732230934aba7d082f3e2ca96c14a9ca0 Mon Sep 17 00:00:00 2001 | ||
2 | From: Lesly A M <leslyam@ti.com> | ||
3 | Date: Wed, 1 Jun 2011 14:56:56 -0700 | ||
4 | Subject: [PATCH 11/13] MFD: TWL4030: TWL version checking | ||
5 | |||
6 | Added API to get the TWL5030 Si version from the IDCODE register. | ||
7 | It is used for enabling the workaround for TWL erratum 27. | ||
8 | |||
9 | Signed-off-by: Lesly A M <leslyam@ti.com> | ||
10 | Cc: Nishanth Menon <nm@ti.com> | ||
11 | Cc: David Derrick <dderrick@ti.com> | ||
12 | Cc: Samuel Ortiz <sameo@linux.intel.com> | ||
13 | --- | ||
14 | drivers/mfd/twl-core.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++ | ||
15 | include/linux/i2c/twl.h | 17 ++++++++++++- | ||
16 | 2 files changed, 78 insertions(+), 1 deletions(-) | ||
17 | |||
18 | diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c | ||
19 | index 9096d7d..a60601d 100644 | ||
20 | --- a/drivers/mfd/twl-core.c | ||
21 | +++ b/drivers/mfd/twl-core.c | ||
22 | @@ -251,6 +251,9 @@ | ||
23 | /* is driver active, bound to a chip? */ | ||
24 | static bool inuse; | ||
25 | |||
26 | +/* TWL IDCODE Register value */ | ||
27 | +static u32 twl_idcode; | ||
28 | + | ||
29 | static unsigned int twl_id; | ||
30 | unsigned int twl_rev(void) | ||
31 | { | ||
32 | @@ -509,6 +512,58 @@ EXPORT_SYMBOL(twl_i2c_read_u8); | ||
33 | |||
34 | /*----------------------------------------------------------------------*/ | ||
35 | |||
36 | +/** | ||
37 | + * twl_read_idcode_register - API to read the IDCODE register. | ||
38 | + * | ||
39 | + * Unlocks the IDCODE register and read the 32 bit value. | ||
40 | + */ | ||
41 | +static int twl_read_idcode_register(void) | ||
42 | +{ | ||
43 | + int err; | ||
44 | + | ||
45 | + err = twl_i2c_write_u8(TWL4030_MODULE_INTBR, TWL_EEPROM_R_UNLOCK, | ||
46 | + REG_UNLOCK_TEST_REG); | ||
47 | + if (err) { | ||
48 | + pr_err("TWL4030 Unable to unlock IDCODE registers -%d\n", err); | ||
49 | + goto fail; | ||
50 | + } | ||
51 | + | ||
52 | + err = twl_i2c_read(TWL4030_MODULE_INTBR, (u8 *)(&twl_idcode), | ||
53 | + REG_IDCODE_7_0, 4); | ||
54 | + if (err) { | ||
55 | + pr_err("TWL4030: unable to read IDCODE -%d\n", err); | ||
56 | + goto fail; | ||
57 | + } | ||
58 | + | ||
59 | + err = twl_i2c_write_u8(TWL4030_MODULE_INTBR, 0x0, REG_UNLOCK_TEST_REG); | ||
60 | + if (err) | ||
61 | + pr_err("TWL4030 Unable to relock IDCODE registers -%d\n", err); | ||
62 | +fail: | ||
63 | + return err; | ||
64 | +} | ||
65 | + | ||
66 | +/** | ||
67 | + * twl_get_type - API to get TWL Si type. | ||
68 | + * | ||
69 | + * Api to get the TWL Si type from IDCODE value. | ||
70 | + */ | ||
71 | +int twl_get_type(void) | ||
72 | +{ | ||
73 | + return TWL_SIL_TYPE(twl_idcode); | ||
74 | +} | ||
75 | +EXPORT_SYMBOL_GPL(twl_get_type); | ||
76 | + | ||
77 | +/** | ||
78 | + * twl_get_version - API to get TWL Si version. | ||
79 | + * | ||
80 | + * Api to get the TWL Si version from IDCODE value. | ||
81 | + */ | ||
82 | +int twl_get_version(void) | ||
83 | +{ | ||
84 | + return TWL_SIL_REV(twl_idcode); | ||
85 | +} | ||
86 | +EXPORT_SYMBOL_GPL(twl_get_version); | ||
87 | + | ||
88 | static struct device * | ||
89 | add_numbered_child(unsigned chip, const char *name, int num, | ||
90 | void *pdata, unsigned pdata_len, | ||
91 | @@ -1071,6 +1126,7 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | ||
92 | unsigned i; | ||
93 | struct twl4030_platform_data *pdata = client->dev.platform_data; | ||
94 | u8 temp; | ||
95 | + int ret = 0; | ||
96 | |||
97 | if (!pdata) { | ||
98 | dev_dbg(&client->dev, "no platform data?\n"); | ||
99 | @@ -1117,6 +1173,12 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id) | ||
100 | /* setup clock framework */ | ||
101 | clocks_init(&client->dev, pdata->clock); | ||
102 | |||
103 | + /* read TWL IDCODE Register */ | ||
104 | + if (twl_id == TWL4030_CLASS_ID) { | ||
105 | + ret = twl_read_idcode_register(); | ||
106 | + WARN(ret < 0, "Error: reading twl_idcode register value\n"); | ||
107 | + } | ||
108 | + | ||
109 | /* load power event scripts */ | ||
110 | if (twl_has_power() && pdata->power) | ||
111 | twl4030_power_init(pdata->power); | ||
112 | diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h | ||
113 | index f343974..23ec058 100644 | ||
114 | --- a/include/linux/i2c/twl.h | ||
115 | +++ b/include/linux/i2c/twl.h | ||
116 | @@ -151,7 +151,12 @@ | ||
117 | #define MMC_PU (0x1 << 3) | ||
118 | #define MMC_PD (0x1 << 2) | ||
119 | |||
120 | - | ||
121 | +#define TWL_SIL_TYPE(rev) ((rev) & 0x00FFFFFF) | ||
122 | +#define TWL_SIL_REV(rev) ((rev) >> 24) | ||
123 | +#define TWL_SIL_5030 0x09002F | ||
124 | +#define TWL5030_REV_1_0 0x00 | ||
125 | +#define TWL5030_REV_1_1 0x10 | ||
126 | +#define TWL5030_REV_1_2 0x30 | ||
127 | |||
128 | #define TWL4030_CLASS_ID 0x4030 | ||
129 | #define TWL6030_CLASS_ID 0x6030 | ||
130 | @@ -181,6 +186,9 @@ int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg); | ||
131 | int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); | ||
132 | int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); | ||
133 | |||
134 | +int twl_get_type(void); | ||
135 | +int twl_get_version(void); | ||
136 | + | ||
137 | int twl6030_interrupt_unmask(u8 bit_mask, u8 offset); | ||
138 | int twl6030_interrupt_mask(u8 bit_mask, u8 offset); | ||
139 | |||
140 | @@ -286,7 +294,12 @@ extern struct twl4030_power_data twl4030_generic_script; | ||
141 | *(Use TWL_4030_MODULE_INTBR) | ||
142 | */ | ||
143 | |||
144 | +#define REG_IDCODE_7_0 0x00 | ||
145 | +#define REG_IDCODE_15_8 0x01 | ||
146 | +#define REG_IDCODE_16_23 0x02 | ||
147 | +#define REG_IDCODE_31_24 0x03 | ||
148 | #define REG_GPPUPDCTR1 0x0F | ||
149 | +#define REG_UNLOCK_TEST_REG 0x12 | ||
150 | |||
151 | /*I2C1 and I2C4(SR) SDA/SCL pull-up control bits */ | ||
152 | |||
153 | @@ -295,6 +308,8 @@ extern struct twl4030_power_data twl4030_generic_script; | ||
154 | #define SR_I2C_SCL_CTRL_PU BIT(4) | ||
155 | #define SR_I2C_SDA_CTRL_PU BIT(6) | ||
156 | |||
157 | +#define TWL_EEPROM_R_UNLOCK 0x49 | ||
158 | + | ||
159 | /*----------------------------------------------------------------------*/ | ||
160 | |||
161 | /* | ||
162 | -- | ||
163 | 1.6.6.1 | ||
164 | |||