From patchwork Tue Oct 25 13:52:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 79179 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp3125717qge; Tue, 25 Oct 2016 06:53:29 -0700 (PDT) X-Received: by 10.98.7.148 with SMTP id 20mr40290047pfh.18.1477403609751; Tue, 25 Oct 2016 06:53:29 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9si20853509pfw.3.2016.10.25.06.53.29; Tue, 25 Oct 2016 06:53:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759007AbcJYNxM (ORCPT + 27 others); Tue, 25 Oct 2016 09:53:12 -0400 Received: from mail-wm0-f46.google.com ([74.125.82.46]:33912 "EHLO mail-wm0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758887AbcJYNxJ (ORCPT ); Tue, 25 Oct 2016 09:53:09 -0400 Received: by mail-wm0-f46.google.com with SMTP id d128so4063737wmf.1 for ; Tue, 25 Oct 2016 06:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WJ+Qh1U7SArY/audoH/CZqUdWo9T0nd23B7urMm9Yvc=; b=pC1VqgQsdCApjN2d29+KC6hSKnTDSAZbZHYTMfKFk5XABF/Uvcoyq6EzET0aCJcogx 7YM950Q0QnUaKbdiWsB53EJWwSW6kPX2ta/JEmR1v6yis/S8xGSp/7TqtCYvfggT0wu+ aSuEv2eLBn6dtdfk/Ptc1IiT7OVlOOa2NBnmhzAVAEhN1LgsuYQjp+op0XMo3F5UUYcG 0ecfTkeLHvnriEcYVSfSu2s4fMi4O7g7KIuhekm/5FqSkMlvib4Jmrm8sqrNKlSeZMpg j8LCa1IA2BTDlQI77UQscdF7TFOvhqtgnVno8YKJ62M5MxoYQGzHmx7b/sDNtvPGDVKA a62w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WJ+Qh1U7SArY/audoH/CZqUdWo9T0nd23B7urMm9Yvc=; b=adbFh9qVt2fEFlN4B0nwiEEoG3YEZQfKVblqcoBXOCr4Bm6I70VvRCk01oR4HVBBOp nnaN+cg2xPOkdPmxz6GOOOXIM7wJgsmPxr1rMdN2wBX6y+ewMhkrIqVt6I/zYHnQBuvq yrTEmmJxid1B/JIGAwIoqBPrnrF3bPSZLsbVPeXCC3sFxfq8c6Gmau8eGoq9ws90pN/+ 3HkH4G1MfLSSiKpcKtxBj7v+qPQ0wJwTlbezY7iYc1fKJdO+YkcxZZHW9Mabn+tiziZY E1iSDwAqJPIRxE0eQhH9i2gJgXeWiBW3cmVOGfpVwrDzirSUSgf1MoqsdRlDHnYsSQBZ xRmA== X-Gm-Message-State: ABUngveGLhTYtXGyb/LMEFVBBWPa5nOUNR+wcrV4uwa0L6wJR459Qcz+i6J1nhQCKi8hQApV X-Received: by 10.28.227.11 with SMTP id a11mr3218940wmh.88.1477403586826; Tue, 25 Oct 2016 06:53:06 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id v4sm3801282wmd.17.2016.10.25.06.53.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 25 Oct 2016 06:53:06 -0700 (PDT) From: Alexandre Bailon To: khilman@baylibre.com, david@lechnology.com, b-liu@ti.com, balbi@kernel.org Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Alexandre Bailon Subject: [PATCH 1/3] usb: musb: da8xx: Call earlier clk_prepare_enable() Date: Tue, 25 Oct 2016 15:52:54 +0200 Message-Id: <1477403576-11825-2-git-send-email-abailon@baylibre.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1477403576-11825-1-git-send-email-abailon@baylibre.com> References: <1477403576-11825-1-git-send-email-abailon@baylibre.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The first attempt to read a register may fail because the clock may not be enabled, and then the probe of musb driver will fail. Call clk_prepare_enable() before the first register read. Signed-off-by: Alexandre Bailon --- drivers/usb/musb/da8xx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) -- 2.7.3 diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c index 210b7e4..ec93602 100644 --- a/drivers/usb/musb/da8xx.c +++ b/drivers/usb/musb/da8xx.c @@ -366,6 +366,12 @@ static int da8xx_musb_init(struct musb *musb) musb->mregs += DA8XX_MENTOR_CORE_OFFSET; + ret = clk_prepare_enable(glue->clk); + if (ret) { + dev_err(glue->dev, "failed to enable clock\n"); + goto fail; + } + /* Returns zero if e.g. not clocked */ rev = musb_readl(reg_base, DA8XX_USB_REVISION_REG); if (!rev) @@ -377,12 +383,6 @@ static int da8xx_musb_init(struct musb *musb) goto fail; } - ret = clk_prepare_enable(glue->clk); - if (ret) { - dev_err(glue->dev, "failed to enable clock\n"); - goto fail; - } - setup_timer(&otg_workaround, otg_timer, (unsigned long)musb); /* Reset the controller */