aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/otg/twl4030-usb.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index f0d2e7530cf..11b2a1203d4 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -123,10 +123,10 @@
123#define PHY_CLK_CTRL_STS 0xFF 123#define PHY_CLK_CTRL_STS 0xFF
124#define PHY_DPLL_CLK (1 << 0) 124#define PHY_DPLL_CLK (1 << 0)
125 125
126/* In module TWL4030_MODULE_PM_MASTER */ 126/* In module TWL_MODULE_PM_MASTER */
127#define STS_HW_CONDITIONS 0x0F 127#define STS_HW_CONDITIONS 0x0F
128 128
129/* In module TWL4030_MODULE_PM_RECEIVER */ 129/* In module TWL_MODULE_PM_RECEIVER */
130#define VUSB_DEDICATED1 0x7D 130#define VUSB_DEDICATED1 0x7D
131#define VUSB_DEDICATED2 0x7E 131#define VUSB_DEDICATED2 0x7E
132#define VUSB1V5_DEV_GRP 0x71 132#define VUSB1V5_DEV_GRP 0x71
@@ -195,14 +195,14 @@ static int twl4030_i2c_write_u8_verify(struct twl4030_usb *twl,
195} 195}
196 196
197#define twl4030_usb_write_verify(twl, address, data) \ 197#define twl4030_usb_write_verify(twl, address, data) \
198 twl4030_i2c_write_u8_verify(twl, TWL4030_MODULE_USB, (data), (address)) 198 twl4030_i2c_write_u8_verify(twl, TWL_MODULE_USB, (data), (address))
199 199
200static inline int twl4030_usb_write(struct twl4030_usb *twl, 200static inline int twl4030_usb_write(struct twl4030_usb *twl,
201 u8 address, u8 data) 201 u8 address, u8 data)
202{ 202{
203 int ret = 0; 203 int ret = 0;
204 204
205 ret = twl_i2c_write_u8(TWL4030_MODULE_USB, data, address); 205 ret = twl_i2c_write_u8(TWL_MODULE_USB, data, address);
206 if (ret < 0) 206 if (ret < 0)
207 dev_dbg(twl->dev, 207 dev_dbg(twl->dev,
208 "TWL4030:USB:Write[0x%x] Error %d\n", address, ret); 208 "TWL4030:USB:Write[0x%x] Error %d\n", address, ret);
@@ -227,7 +227,7 @@ static inline int twl4030_readb(struct twl4030_usb *twl, u8 module, u8 address)
227 227
228static inline int twl4030_usb_read(struct twl4030_usb *twl, u8 address) 228static inline int twl4030_usb_read(struct twl4030_usb *twl, u8 address)
229{ 229{
230 return twl4030_readb(twl, TWL4030_MODULE_USB, address); 230 return twl4030_readb(twl, TWL_MODULE_USB, address);
231} 231}
232 232
233/*-------------------------------------------------------------------------*/ 233/*-------------------------------------------------------------------------*/
@@ -264,8 +264,7 @@ static enum omap_musb_vbus_id_status
264 * signal is active, the OTG module is activated, and 264 * signal is active, the OTG module is activated, and
265 * its interrupt may be raised (may wake the system). 265 * its interrupt may be raised (may wake the system).
266 */ 266 */
267 status = twl4030_readb(twl, TWL4030_MODULE_PM_MASTER, 267 status = twl4030_readb(twl, TWL_MODULE_PM_MASTER, STS_HW_CONDITIONS);
268 STS_HW_CONDITIONS);
269 if (status < 0) 268 if (status < 0)
270 dev_err(twl->dev, "USB link status err %d\n", status); 269 dev_err(twl->dev, "USB link status err %d\n", status);
271 else if (status & (BIT(7) | BIT(2))) { 270 else if (status & (BIT(7) | BIT(2))) {
@@ -372,8 +371,7 @@ static void twl4030_phy_power(struct twl4030_usb *twl, int on)
372 * SLEEP. We work around this by clearing the bit after usv3v1 371 * SLEEP. We work around this by clearing the bit after usv3v1
373 * is re-activated. This ensures that VUSB3V1 is really active. 372 * is re-activated. This ensures that VUSB3V1 is really active.
374 */ 373 */
375 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, 374 twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2);
376 VUSB_DEDICATED2);
377 regulator_enable(twl->usb1v5); 375 regulator_enable(twl->usb1v5);
378 __twl4030_phy_power(twl, 1); 376 __twl4030_phy_power(twl, 1);
379 twl4030_usb_write(twl, PHY_CLK_CTRL, 377 twl4030_usb_write(twl, PHY_CLK_CTRL,
@@ -419,50 +417,48 @@ static void twl4030_phy_resume(struct twl4030_usb *twl)
419static int twl4030_usb_ldo_init(struct twl4030_usb *twl) 417static int twl4030_usb_ldo_init(struct twl4030_usb *twl)
420{ 418{
421 /* Enable writing to power configuration registers */ 419 /* Enable writing to power configuration registers */
422 twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 420 twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1,
423 TWL4030_PM_MASTER_KEY_CFG1, 421 TWL4030_PM_MASTER_PROTECT_KEY);
424 TWL4030_PM_MASTER_PROTECT_KEY);
425 422
426 twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 423 twl_i2c_write_u8(TWL_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG2,
427 TWL4030_PM_MASTER_KEY_CFG2, 424 TWL4030_PM_MASTER_PROTECT_KEY);
428 TWL4030_PM_MASTER_PROTECT_KEY);
429 425
430 /* Keep VUSB3V1 LDO in sleep state until VBUS/ID change detected*/ 426 /* Keep VUSB3V1 LDO in sleep state until VBUS/ID change detected*/
431 /*twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2);*/ 427 /*twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2);*/
432 428
433 /* input to VUSB3V1 LDO is from VBAT, not VBUS */ 429 /* input to VUSB3V1 LDO is from VBAT, not VBUS */
434 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x14, VUSB_DEDICATED1); 430 twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0x14, VUSB_DEDICATED1);
435 431
436 /* Initialize 3.1V regulator */ 432 /* Initialize 3.1V regulator */
437 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_DEV_GRP); 433 twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB3V1_DEV_GRP);
438 434
439 twl->usb3v1 = regulator_get(twl->dev, "usb3v1"); 435 twl->usb3v1 = regulator_get(twl->dev, "usb3v1");
440 if (IS_ERR(twl->usb3v1)) 436 if (IS_ERR(twl->usb3v1))
441 return -ENODEV; 437 return -ENODEV;
442 438
443 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_TYPE); 439 twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB3V1_TYPE);
444 440
445 /* Initialize 1.5V regulator */ 441 /* Initialize 1.5V regulator */
446 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V5_DEV_GRP); 442 twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB1V5_DEV_GRP);
447 443
448 twl->usb1v5 = regulator_get(twl->dev, "usb1v5"); 444 twl->usb1v5 = regulator_get(twl->dev, "usb1v5");
449 if (IS_ERR(twl->usb1v5)) 445 if (IS_ERR(twl->usb1v5))
450 goto fail1; 446 goto fail1;
451 447
452 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V5_TYPE); 448 twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB1V5_TYPE);
453 449
454 /* Initialize 1.8V regulator */ 450 /* Initialize 1.8V regulator */
455 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_DEV_GRP); 451 twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB1V8_DEV_GRP);
456 452
457 twl->usb1v8 = regulator_get(twl->dev, "usb1v8"); 453 twl->usb1v8 = regulator_get(twl->dev, "usb1v8");
458 if (IS_ERR(twl->usb1v8)) 454 if (IS_ERR(twl->usb1v8))
459 goto fail2; 455 goto fail2;
460 456
461 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V8_TYPE); 457 twl_i2c_write_u8(TWL_MODULE_PM_RECEIVER, 0, VUSB1V8_TYPE);
462 458
463 /* disable access to power configuration registers */ 459 /* disable access to power configuration registers */
464 twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, 460 twl_i2c_write_u8(TWL_MODULE_PM_MASTER, 0,
465 TWL4030_PM_MASTER_PROTECT_KEY); 461 TWL4030_PM_MASTER_PROTECT_KEY);
466 462
467 return 0; 463 return 0;
468 464