From patchwork Wed Apr 3 08:45:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 15837 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9F37523E21 for ; Wed, 3 Apr 2013 08:46:55 +0000 (UTC) Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by fiordland.canonical.com (Postfix) with ESMTP id 458CFA18483 for ; Wed, 3 Apr 2013 08:46:55 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id ha11sf2012937vcb.6 for ; Wed, 03 Apr 2013 01:46:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=zSMZN59RwqnaGyP0JYgNDlJkSz+JsdC/WjEonL0Fa1E=; b=BSKOaug/Bau4UaHBJ5j+hcS8ZiIWLXIWL+32xmoAM3avrQsiiGOHf1suM8EZxcdkQr W6Xl4bNLD7WDPtnSUrMCubCaI7d2TILgZ1CoT0yZWEVfRGi/R0R0OtP6WJbxZCwTGsat apZKnWPrt8H0W8NRf5qU9ZVZBru4L0xiejcgxPmsGKyqmCYjjxcptUMeFOut/V/WiIZH k/m1xwI54MrTCxMASRKSoaA58y5IzzM6FtnultnjXn/QANx6S2A3dQol9Cbb1tjWaCA9 m2Cm+jYyCyYb3rc4C9x/oA30QzESCm4hdnDJS16uwBZhaFxabckqOSjH4kKO1y6v99jH PVVw== X-Received: by 10.224.72.199 with SMTP id n7mr700584qaj.5.1364978814783; Wed, 03 Apr 2013 01:46:54 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.60.135 with SMTP id h7ls746392qer.59.gmail; Wed, 03 Apr 2013 01:46:54 -0700 (PDT) X-Received: by 10.58.214.231 with SMTP id od7mr486885vec.44.1364978814659; Wed, 03 Apr 2013 01:46:54 -0700 (PDT) Received: from mail-vb0-x236.google.com (mail-vb0-x236.google.com [2607:f8b0:400c:c02::236]) by mx.google.com with ESMTPS id q18si4259459vcv.55.2013.04.03.01.46.54 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Apr 2013 01:46:54 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::236 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::236; Received: by mail-vb0-f54.google.com with SMTP id w16so261019vbf.41 for ; Wed, 03 Apr 2013 01:46:54 -0700 (PDT) X-Received: by 10.52.31.103 with SMTP id z7mr433616vdh.56.1364978814538; Wed, 03 Apr 2013 01:46:54 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.4.204 with SMTP id cg12csp160612ved; Wed, 3 Apr 2013 01:46:54 -0700 (PDT) X-Received: by 10.14.218.71 with SMTP id j47mr1803491eep.28.1364978813521; Wed, 03 Apr 2013 01:46:53 -0700 (PDT) Received: from mail-ea0-x232.google.com (mail-ea0-x232.google.com [2a00:1450:4013:c01::232]) by mx.google.com with ESMTPS id w41si7627417eel.7.2013.04.03.01.46.53 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 03 Apr 2013 01:46:53 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:4013:c01::232 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) client-ip=2a00:1450:4013:c01::232; Received: by mail-ea0-f178.google.com with SMTP id o10so574303eaj.9 for ; Wed, 03 Apr 2013 01:46:53 -0700 (PDT) X-Received: by 10.14.111.72 with SMTP id v48mr1916938eeg.11.1364978812981; Wed, 03 Apr 2013 01:46:52 -0700 (PDT) Received: from localhost ([2a01:2003:1:1e91:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPS id ca4sm6847901eeb.15.2013.04.03.01.46.45 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 03 Apr 2013 01:46:51 -0700 (PDT) From: Fabio Baltieri To: Felipe Balbi Cc: Linus Walleij , Praveena Nadahally , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Sakethram Bommisetti , Fabio Baltieri Subject: [PATCH 03/12] usb: phy: ab8500-usb: set phy tuning values Date: Wed, 3 Apr 2013 10:45:04 +0200 Message-Id: <1364978713-19612-4-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.8.1.3 In-Reply-To: <1364978713-19612-1-git-send-email-fabio.baltieri@linaro.org> References: <1364978713-19612-1-git-send-email-fabio.baltieri@linaro.org> X-Gm-Message-State: ALoCoQkP3+5IaD20nnxXmqGOihMZvkGlNn2+ppN3g0xerz17i0uqbSoUZex++nyELzbjosnWkTRJ X-Original-Sender: fabio.baltieri@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::236 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Sakethram Bommisetti Set phy tuning values proposed by the hardware teams for AB8500 and AB8505 to improve USB eye diagram performances. Signed-off-by: Sakethram Bommisetti Acked-by: Linus Walleij Signed-off-by: Fabio Baltieri --- 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 #include +/* 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);