mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fabio Baltieri <fabio.baltieri@linaro.org>
To: Felipe Balbi <balbi@ti.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Praveena Nadahally <praveen.nadahally@stericsson.com>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	Sakethram Bommisetti <sakethram.bommisetti@stericsson.com>,
	Fabio Baltieri <fabio.baltieri@linaro.org>
Subject: [PATCH 03/12] usb: phy: ab8500-usb: set phy tuning values
Date: Wed,  3 Apr 2013 10:45:04 +0200	[thread overview]
Message-ID: <1364978713-19612-4-git-send-email-fabio.baltieri@linaro.org> (raw)
In-Reply-To: <1364978713-19612-1-git-send-email-fabio.baltieri@linaro.org>

From: Sakethram Bommisetti <sakethram.bommisetti@stericsson.com>

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>
---
 drivers/usb/phy/phy-ab8500-usb.c | 87 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index ab6dd07..5b92a59 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -33,11 +33,22 @@
 #include <linux/mfd/abx500/ab8500.h>
 #include <linux/usb/musb-ux500.h>
 
+/* Bank AB8500_SYS_CTRL2_BLOCK */
 #define AB8500_MAIN_WD_CTRL_REG 0x01
+
+/* Bank AB8500_USB */
 #define AB8500_USB_LINE_STAT_REG 0x80
 #define AB8505_USB_LINE_STAT_REG 0x94
 #define AB8500_USB_PHY_CTRL_REG 0x8A
 
+/* Bank AB8500_DEVELOPMENT */
+#define AB8500_BANK12_ACCESS 0x00
+
+/* Bank AB8500_DEBUG */
+#define AB8500_USB_PHY_TUNE1 0x05
+#define AB8500_USB_PHY_TUNE2 0x06
+#define AB8500_USB_PHY_TUNE3 0x07
+
 #define AB8500_BIT_OTG_STAT_ID (1 << 0)
 #define AB8500_BIT_PHY_CTRL_HOST_EN (1 << 0)
 #define AB8500_BIT_PHY_CTRL_DEVICE_EN (1 << 1)
@@ -671,6 +682,82 @@ static int ab8500_usb_probe(struct platform_device *pdev)
 		return err;
 	}
 
+	/* Phy tuning values for AB8500 */
+	if (!is_ab8500_2p0_or_earlier(ab->ab8500)) {
+		/* Enable the PBT/Bank 0x12 access */
+		err = abx500_set_register_interruptible(ab->dev,
+				AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, 0x01);
+		if (err < 0)
+			dev_err(ab->dev, "Failed to enable bank12 access err=%d\n",
+					err);
+
+		err = abx500_set_register_interruptible(ab->dev,
+				AB8500_DEBUG, AB8500_USB_PHY_TUNE1, 0xC8);
+		if (err < 0)
+			dev_err(ab->dev, "Failed to set PHY_TUNE1 register err=%d\n",
+					err);
+
+		err = abx500_set_register_interruptible(ab->dev,
+				AB8500_DEBUG, AB8500_USB_PHY_TUNE2, 0x00);
+		if (err < 0)
+			dev_err(ab->dev, "Failed to set PHY_TUNE2 register err=%d\n",
+					err);
+
+		err = abx500_set_register_interruptible(ab->dev,
+				AB8500_DEBUG, AB8500_USB_PHY_TUNE3, 0x78);
+		if (err < 0)
+			dev_err(ab->dev, "Failed to set PHY_TUNE3 regester err=%d\n",
+					err);
+
+		/* Switch to normal mode/disable Bank 0x12 access */
+		err = abx500_set_register_interruptible(ab->dev,
+				AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS, 0x00);
+		if (err < 0)
+			dev_err(ab->dev, "Failed to switch bank12 access err=%d\n",
+					err);
+	}
+
+	/* Phy tuning values for AB8505 */
+	if (is_ab8505(ab->ab8500)) {
+		/* Enable the PBT/Bank 0x12 access */
+		err = abx500_mask_and_set_register_interruptible(ab->dev,
+				AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS,
+				0x01, 0x01);
+		if (err < 0)
+			dev_err(ab->dev, "Failed to enable bank12 access err=%d\n",
+					err);
+
+		err = abx500_mask_and_set_register_interruptible(ab->dev,
+				AB8500_DEBUG, AB8500_USB_PHY_TUNE1,
+				0xC8, 0xC8);
+		if (err < 0)
+			dev_err(ab->dev, "Failed to set PHY_TUNE1 register err=%d\n",
+					err);
+
+		err = abx500_mask_and_set_register_interruptible(ab->dev,
+				AB8500_DEBUG, AB8500_USB_PHY_TUNE2,
+				0x60, 0x60);
+		if (err < 0)
+			dev_err(ab->dev, "Failed to set PHY_TUNE2 register err=%d\n",
+					err);
+
+		err = abx500_mask_and_set_register_interruptible(ab->dev,
+				AB8500_DEBUG, AB8500_USB_PHY_TUNE3,
+				0xFC, 0x80);
+
+		if (err < 0)
+			dev_err(ab->dev, "Failed to set PHY_TUNE3 regester err=%d\n",
+					err);
+
+		/* Switch to normal mode/disable Bank 0x12 access */
+		err = abx500_mask_and_set_register_interruptible(ab->dev,
+				AB8500_DEVELOPMENT, AB8500_BANK12_ACCESS,
+				0x00, 0x00);
+		if (err < 0)
+			dev_err(ab->dev, "Failed to switch bank12 access err=%d\n",
+					err);
+	}
+
 	/* Needed to enable ID detection. */
 	ab8500_usb_wd_workaround(ab);
 
-- 
1.8.1.3


  parent reply	other threads:[~2013-04-03  8:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-03  8:45 [PATCH 00/12] second set of musb-ux500 and ab8500-usb updates Fabio Baltieri
2013-04-03  8:45 ` [PATCH 01/12] usb: musb: ux500_dma: drop references to U5500 Fabio Baltieri
2013-04-03  8:45 ` [PATCH 02/12] usb: phy: ab8500-usb: convert to devm_kzalloc Fabio Baltieri
2013-04-03  8:45 ` Fabio Baltieri [this message]
2013-04-03  8:45 ` [PATCH 04/12] usb: phy: ab8500-usb: fix eye diagram for ab8500 v2.0 Fabio Baltieri
2013-04-03  8:53   ` Felipe Balbi
2013-04-03  8:58     ` Felipe Balbi
2013-04-03  9:12       ` Fabio Baltieri
2013-04-03  9:35         ` Felipe Balbi
2013-04-03  8:45 ` [PATCH 05/12] usb: phy: ab8500-usb: add regulator support Fabio Baltieri
2013-04-03  8:45 ` [PATCH 06/12] usb: phy: ab8500-usb: split ab8500_usb_phy_ctrl Fabio Baltieri
2013-04-03  8:45 ` [PATCH 07/12] usb: phy: ab8500-usb: enable/disable regulator on phy events Fabio Baltieri
2013-04-03  8:45 ` [PATCH 08/12] usb: phy: ab8500-usb: fix unbalanced clock and regulator disable warnings Fabio Baltieri
2013-04-03  8:45 ` [PATCH 09/12] usb: phy: ab8500-usb: fix last notifier arguments Fabio Baltieri
2013-04-03  8:45 ` [PATCH 10/12] usb: phy: ab8500-usb: adopt pinctrl support Fabio Baltieri
2013-04-03  8:45 ` [PATCH 11/12] usb: phy: ab8500-usb: drop link status delayed work Fabio Baltieri
2013-04-03  8:45 ` [PATCH 12/12] usb: phy: ab8500-usb: call phy_dis_work only when necessary Fabio Baltieri

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1364978713-19612-4-git-send-email-fabio.baltieri@linaro.org \
    --to=fabio.baltieri@linaro.org \
    --cc=balbi@ti.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=praveen.nadahally@stericsson.com \
    --cc=sakethram.bommisetti@stericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®