From 97cb16fe6a3cb16b8a9fa952b1dd7d66faecd88b Mon Sep 17 00:00:00 2001 From: Thirupathi Chippakurthy Date: Mon, 5 Sep 2011 17:26:43 +0530 Subject: ux500: USB: Set the charging cur to 300mA for ABV3 In case of AB-V3, the eye diagram related issues are resolved. So, set the device charging current to 300mA when connected to standard host. Also, add the USB PHY tuning values to improve the USB eye diagram ST-Ericsson ID: 330203 ST-Ericsson Linux next: ER 330203 ST-Ericsson FOSS-OUT ID: NA Change-Id: I7cd49289ce7e1a6d88263198e7b1258c923c1282 Signed-off-by: Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/30031 Reviewed-by: Praveena NADAHALLY --- drivers/usb/otg/ab8500-usb.c | 59 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) (limited to 'drivers/usb') diff --git a/drivers/usb/otg/ab8500-usb.c b/drivers/usb/otg/ab8500-usb.c index d6039ec20f3..2dbd3436dc4 100644 --- a/drivers/usb/otg/ab8500-usb.c +++ b/drivers/usb/otg/ab8500-usb.c @@ -55,6 +55,18 @@ #define AB8500_V20_31952_DISABLE_DELAY_US 100 /* usec */ #define AB8500_WD_V10_DISABLE_DELAY_MS 100 /* ms */ +/* Registers in bank 0x11 */ +#define AB8500_BANK12_ACCESS 0x00 + +/* Registers in bank 0x12 */ +#define AB8500_USB_PHY_TUNE1 0x05 +#define AB8500_USB_PHY_TUNE2 0x06 +#define AB8500_USB_PHY_TUNE3 0x07 + + + + + /* Usb line status register */ enum ab8500_usb_link_status { USB_LINK_NOT_CONFIGURED = 0, @@ -568,6 +580,7 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev) dev_get_platdata(pdev->dev.parent); int err; int rev; + int ret = -1; rev = abx500_get_chip_id(&pdev->dev); if (rev < 0) { @@ -625,6 +638,52 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev) goto fail3; } + /* Write Phy tuning values */ + if (ab->rev == 0x30) { + /* Enable the PBT/Bank 0x12 access */ + ret = abx500_set_register_interruptible(ab->dev, + AB8500_DEVELOPMENT, + AB8500_BANK12_ACCESS, + 0x01); + if (ret < 0) + printk(KERN_ERR "Failed to enable bank12" + " access ret=%d\n", ret); + + ret = abx500_set_register_interruptible(ab->dev, + AB8500_DEBUG, + AB8500_USB_PHY_TUNE1, + 0xC8); + if (ret < 0) + printk(KERN_ERR "Failed to set PHY_TUNE1" + " register ret=%d\n", ret); + + ret = abx500_set_register_interruptible(ab->dev, + AB8500_DEBUG, + AB8500_USB_PHY_TUNE2, + 0x00); + if (ret < 0) + printk(KERN_ERR "Failed to set PHY_TUNE2" + " register ret=%d\n", ret); + + ret = abx500_set_register_interruptible(ab->dev, + AB8500_DEBUG, + AB8500_USB_PHY_TUNE3, + 0x78); + + if (ret < 0) + printk(KERN_ERR "Failed to set PHY_TUNE3" + " regester ret=%d\n", ret); + + /* Switch to normal mode/disable Bank 0x12 access */ + ret = abx500_set_register_interruptible(ab->dev, + AB8500_DEVELOPMENT, + AB8500_BANK12_ACCESS, + 0x00); + + if (ret < 0) + printk(KERN_ERR "Failed to switch bank12" + " access ret=%d\n", ret); + } /* Needed to enable ID detection. */ ab8500_usb_wd_workaround(ab); -- cgit v1.2.3