From patchwork Wed May 15 12:03:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 16965 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6DE092396C for ; Wed, 15 May 2013 12:13:05 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id ih17sf1977723qab.8 for ; Wed, 15 May 2013 05:12:28 -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=2KKJVUMO7xc/hWvPjSApSSKKVlrNeTe+8wDJMB/9kok=; b=hlDOKyqJKgM2HDjTVaMxQT2gHXetBJWXrQd9dbD0ZU29kTqI6djmJT9vWfdcBOWM/w Dz74tQHAVsWutGv8sPxlG13u+E8wnUHhp8G/4JabY9JuJGZY4d6rhZwimtpv0cWUDqud DJ39YYplxuOvYPzO9wbdXikuBweHmxSpTkknXRdQTsvsuS2B8A+ATpyAeg8nn9HaeSH6 b7wH9AjjB2er+ARTNiFrLlUCLr9rW/cyN84IDi4AiM8FXWQftR361GujZrKwvQRXZHf+ eNNf/FlctV6wDjWiOGGMSu58C5OnZvoyogZh946bi4QLXW2rgjyhfW9Ncbf7jQ8x/pUA oCLw== X-Received: by 10.224.200.202 with SMTP id ex10mr23248488qab.8.1368619948383; Wed, 15 May 2013 05:12:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.30.41 with SMTP id p9ls699961qeh.3.gmail; Wed, 15 May 2013 05:12:28 -0700 (PDT) X-Received: by 10.58.75.46 with SMTP id z14mr7214215vev.52.1368619948067; Wed, 15 May 2013 05:12:28 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id p8si1268556vdv.31.2013.05.15.05.12.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 May 2013 05:12:28 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.182 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id ia10so1733771vcb.27 for ; Wed, 15 May 2013 05:12:27 -0700 (PDT) X-Received: by 10.58.48.166 with SMTP id m6mr24138935ven.59.1368619947616; Wed, 15 May 2013 05:12:27 -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.220.217.15 with SMTP id hk15csp16402vcb; Wed, 15 May 2013 05:12:26 -0700 (PDT) X-Received: by 10.194.60.212 with SMTP id j20mr3674637wjr.56.1368619475163; Wed, 15 May 2013 05:04:35 -0700 (PDT) Received: from mail-wg0-x231.google.com (mail-wg0-x231.google.com [2a00:1450:400c:c00::231]) by mx.google.com with ESMTPS id cv3si7004428wib.67.2013.05.15.05.04.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 May 2013 05:04:35 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::231 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) client-ip=2a00:1450:400c:c00::231; Received: by mail-wg0-f49.google.com with SMTP id j13so1452835wgh.4 for ; Wed, 15 May 2013 05:04:34 -0700 (PDT) X-Received: by 10.180.82.74 with SMTP id g10mr14161047wiy.10.1368619471354; Wed, 15 May 2013 05:04:31 -0700 (PDT) Received: from localhost ([2a01:2003:1:1025:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPSA id dq8sm3741304wib.1.2013.05.15.05.04.25 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 15 May 2013 05:04:30 -0700 (PDT) From: Fabio Baltieri To: Felipe Balbi Cc: Linus Walleij , Lee Jones , Praveena Nadahally , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Sakethram Bommisetti , Fabio Baltieri Subject: [PATCH 04/10] usb: phy: ab8500-usb: restart phy during probe Date: Wed, 15 May 2013 14:03:27 +0200 Message-Id: <1368619413-24647-5-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.8.2 In-Reply-To: <1368619413-24647-1-git-send-email-fabio.baltieri@linaro.org> References: <1368619413-24647-1-git-send-email-fabio.baltieri@linaro.org> X-Gm-Message-State: ALoCoQl3Py4iZTochtVvYO+H3j9zN1tCoaMggxbZJs6dNGn7VWjIJzKmIje7yf26T7+71HyC9Ffc X-Original-Sender: fabio.baltieri@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.182 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 Add an ab8500_usb_restart_phy() function called during probe to ensure that the AB8500 USB phy is initialized properly even when a cable is connected at probe time. Without this fix subsequent host reconnections are not detected properly. Acked-by: Linus Walleij Acked-by: Maxime Coquelin Signed-off-by: Sakethram Bommisetti Signed-off-by: Fabio Baltieri --- drivers/usb/phy/phy-ab8500-usb.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c index cc0d7e5..bbe51cc 100644 --- a/drivers/usb/phy/phy-ab8500-usb.c +++ b/drivers/usb/phy/phy-ab8500-usb.c @@ -668,6 +668,33 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host) return 0; } +static void ab8500_usb_restart_phy(struct ab8500_usb *ab) +{ + abx500_mask_and_set_register_interruptible(ab->dev, + AB8500_USB, AB8500_USB_PHY_CTRL_REG, + AB8500_BIT_PHY_CTRL_DEVICE_EN, + AB8500_BIT_PHY_CTRL_DEVICE_EN); + + udelay(100); + + abx500_mask_and_set_register_interruptible(ab->dev, + AB8500_USB, AB8500_USB_PHY_CTRL_REG, + AB8500_BIT_PHY_CTRL_DEVICE_EN, + 0); + + abx500_mask_and_set_register_interruptible(ab->dev, + AB8500_USB, AB8500_USB_PHY_CTRL_REG, + AB8500_BIT_PHY_CTRL_HOST_EN, + AB8500_BIT_PHY_CTRL_HOST_EN); + + udelay(100); + + abx500_mask_and_set_register_interruptible(ab->dev, + AB8500_USB, AB8500_USB_PHY_CTRL_REG, + AB8500_BIT_PHY_CTRL_HOST_EN, + 0); +} + static int ab8500_usb_regulator_get(struct ab8500_usb *ab) { int err; @@ -887,6 +914,12 @@ static int ab8500_usb_probe(struct platform_device *pdev) /* Needed to enable ID detection. */ ab8500_usb_wd_workaround(ab); + /* + * This is required for usb-link-status to work properly when a + * cable is connected at boot time. + */ + ab8500_usb_restart_phy(ab); + abx500_usb_link_status_update(ab); dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", rev);