diff options
author | Sakethram Bommisetti <sakethram.bommisetti@stericsson.com> | 2013-04-03 04:45:04 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-04-03 04:59:42 -0400 |
commit | 7124631aa892712fc8b317ff34d25c14dee6f63d (patch) | |
tree | b477f796cfbe291f261de00082fd0ac800629a0e /drivers/usb | |
parent | 81ef6724302e0c7ba3f087403de24760601b1839 (diff) |
usb: phy: ab8500-usb: set phy tuning values
Set phy tuning values proposed by the hardware teams for AB8500 and
AB8505 to improve USB eye diagram performances.
Signed-off-by: Sakethram Bommisetti <sakethram.bommisetti@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/phy/phy-ab8500-usb.c | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index ab6dd072ae25..5b92a59804eb 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c | |||
@@ -33,11 +33,22 @@ | |||
33 | #include <linux/mfd/abx500/ab8500.h> | 33 | #include <linux/mfd/abx500/ab8500.h> |
34 | #include <linux/usb/musb-ux500.h> | 34 | #include <linux/usb/musb-ux500.h> |
35 | 35 | ||
36 | /* Bank AB8500_SYS_CTRL2_BLOCK */ | ||
36 | #define AB8500_MAIN_WD_CTRL_REG 0x01 | 37 | #define AB8500_MAIN_WD_CTRL_REG 0x01 |
38 | |||
39 | /* Bank AB8500_USB */ | ||
37 | #define AB8500_USB_LINE_STAT_REG 0x80 | 40 | #define AB8500_USB_LINE_STAT_REG 0x80 |
38 | #define AB8505_USB_LINE_STAT_REG 0x94 | 41 | #define AB8505_USB_LINE_STAT_REG 0x94 |
39 | #define AB8500_USB_PHY_CTRL_REG 0x8A | 42 | #define AB8500_USB_PHY_CTRL_REG 0x8A |
40 | 43 | ||
44 | /* Bank AB8500_DEVELOPMENT */ | ||
45 | #define AB8500_BANK12_ACCESS 0x00 | ||
46 | |||
47 | /* Bank AB8500_DEBUG */ | ||
48 | #define AB8500_USB_PHY_TUNE1 0x05 | ||
49 | #define AB8500_USB_PHY_TUNE2 0x06 | ||
50 | #define AB8500_USB_PHY_TUNE3 0x07 | ||
51 | |||
41 | #define AB8500_BIT_OTG_STAT_ID (1 << 0) | 52 | #define AB8500_BIT_OTG_STAT_ID (1 << 0) |
42 | #define AB8500_BIT_PHY_CTRL_HOST_EN (1 << 0) | 53 | #define AB8500_BIT_PHY_CTRL_HOST_EN (1 << 0) |
43 | #define AB8500_BIT_PHY_CTRL_DEVICE_EN (1 << 1) | 54 | #define AB8500_BIT_PHY_CTRL_DEVICE_EN (1 << 1) |
@@ -671,6 +682,82 @@ static int ab8500_usb_probe(struct platform_device *pdev) | |||
671 | return err; | 682 | return err; |
672 | } | 683 | } |
673 | 684 | ||
685 | /* Phy tuning values for AB8500 */ | ||
686 | if (!is_ab8500_2p0_or_earlier(ab->ab8500)) { | ||
687 | /* Enable the PBT/Bank 0x12 access */ | ||
688 | err = abx500_set_register_interruptible(ab->dev, | ||
689 | AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, 0x01); | ||
690 | if (err < 0) | ||
691 | dev_err(ab->dev, "Failed to enable bank12 access err=%d\n", | ||
692 | err); | ||
693 | |||
694 | err = abx500_set_register_interruptible(ab->dev, | ||
695 | AB8500_DEBUG, AB8500_USB_PHY_TUNE1, 0xC8); | ||
696 | if (err < 0) | ||
697 | dev_err(ab->dev, "Failed to set PHY_TUNE1 register err=%d\n", | ||
698 | err); | ||
699 | |||
700 | err = abx500_set_register_interruptible(ab->dev, | ||
701 | AB8500_DEBUG, AB8500_USB_PHY_TUNE2, 0x00); | ||
702 | if (err < 0) | ||
703 | dev_err(ab->dev, "Failed to set PHY_TUNE2 register err=%d\n", | ||
704 | err); | ||
705 | |||
706 | err = abx500_set_register_interruptible(ab->dev, | ||
707 | AB8500_DEBUG, AB8500_USB_PHY_TUNE3, 0x78); | ||
708 | if (err < 0) | ||
709 | dev_err(ab->dev, "Failed to set PHY_TUNE3 regester err=%d\n", | ||
710 | err); | ||
711 | |||
712 | /* Switch to normal mode/disable Bank 0x12 access */ | ||
713 | err = abx500_set_register_interruptible(ab->dev, | ||
714 | AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, 0x00); | ||
715 | if (err < 0) | ||
716 | dev_err(ab->dev, "Failed to switch bank12 access err=%d\n", | ||
717 | err); | ||
718 | } | ||
719 | |||
720 | /* Phy tuning values for AB8505 */ | ||
721 | if (is_ab8505(ab->ab8500)) { | ||
722 | /* Enable the PBT/Bank 0x12 access */ | ||
723 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
724 | AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, | ||
725 | 0x01, 0x01); | ||
726 | if (err < 0) | ||
727 | dev_err(ab->dev, "Failed to enable bank12 access err=%d\n", | ||
728 | err); | ||
729 | |||
730 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
731 | AB8500_DEBUG, AB8500_USB_PHY_TUNE1, | ||
732 | 0xC8, 0xC8); | ||
733 | if (err < 0) | ||
734 | dev_err(ab->dev, "Failed to set PHY_TUNE1 register err=%d\n", | ||
735 | err); | ||
736 | |||
737 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
738 | AB8500_DEBUG, AB8500_USB_PHY_TUNE2, | ||
739 | 0x60, 0x60); | ||
740 | if (err < 0) | ||
741 | dev_err(ab->dev, "Failed to set PHY_TUNE2 register err=%d\n", | ||
742 | err); | ||
743 | |||
744 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
745 | AB8500_DEBUG, AB8500_USB_PHY_TUNE3, | ||
746 | 0xFC, 0x80); | ||
747 | |||
748 | if (err < 0) | ||
749 | dev_err(ab->dev, "Failed to set PHY_TUNE3 regester err=%d\n", | ||
750 | err); | ||
751 | |||
752 | /* Switch to normal mode/disable Bank 0x12 access */ | ||
753 | err = abx500_mask_and_set_register_interruptible(ab->dev, | ||
754 | AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, | ||
755 | 0x00, 0x00); | ||
756 | if (err < 0) | ||
757 | dev_err(ab->dev, "Failed to switch bank12 access err=%d\n", | ||
758 | err); | ||
759 | } | ||
760 | |||
674 | /* Needed to enable ID detection. */ | 761 | /* Needed to enable ID detection. */ |
675 | ab8500_usb_wd_workaround(ab); | 762 | ab8500_usb_wd_workaround(ab); |
676 | 763 | ||