This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

65930 setting TRIM1 register not working

Other Parts Discussed in Thread: DM3730

Dear Sir:

   I have an issue on USB OTG Host LS device in our platform DM3730, the OS is Android 2.3.4.

So I tried to use the following Errata according to swcz001g.pdf 

 

USB OTG HOST LS cross-over voltage is out of spec. This could lead to not recognizing the USB driver
connected on DP/DM.

• Set VUSB_3P1 at 3.4 V.
• Set PROTECT_KEY register (add 0x0000 0044) to 0xC0.
• Set PROTECT_KEY register to 0x0C.
• Set TRIM1 register (add 0x0000 006F) bits <5:4> to 11.
• Set PROTECT_KEY register to 0x00.

I modified the VUSB3V1 in kernel code twl-regulator.c

TWL4030_FIXED_LDO(VUSB3V1, 0x77, 3410, 19, 150, 0x08),

Then I modified TRIM1 register in twl4030-usb.c function as the following code but found the writing TRIM register seems not working, though it did not show error in writing TRIM1.   

I need suggestion in the forum to tell me what is the issue. Thanks.

~~~~~~~~~

static int twl4030_usb_ldo_init(struct twl4030_usb *twl)

{
u8 data;
int ret = 0;

/* Enable writing to power configuration registers */
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);

/* Keep VUSB3V1 LDO in sleep state until VBUS/ID change detected*/
/*twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2);*/

/* input to VUSB3V1 LDO is from VBAT, not VBUS */

err =twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x14, VUSB_DEDICATED1);
if( err)
printk("err write VUSBDEDICATED \n");
ret = twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &data, VUSB_DEDICATED1);

/* Initialize 3.1V regulator */

 twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_DEV_GRP);
if( err)

ret = twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &data, VUSB3V1_DEV_GRP);
twl->usb3v1 = regulator_get(twl->dev, "usb3v1");

if (IS_ERR(twl->usb3v1))
return -ENODEV;

twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB3V1_TYPE);

ret = twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &data, 0x14);

data = data | 0x30;
printk("usb init 4 0x%x\n",data);
err =twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, data, 0x14);
if( err)
printk("err write TRIM1\n");
ret = twl_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &data, 0x14);
printk("usb init 5 0x%x\n",data);


/* Initialize 1.5V regulator */
twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB1V5_DEV_GRP);

twl->usb1v5 = regulator_get(twl->dev, "usb1v5");
if (IS_ERR(twl->usb1v5))
goto fail1;

.................

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,
TWL4030_PM_MASTER_PROTECT_KEY);