From patchwork Fri Nov 4 16:43:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 80892 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp71533qge; Fri, 4 Nov 2016 09:43:55 -0700 (PDT) X-Received: by 10.98.15.206 with SMTP id 75mr28296837pfp.105.1478277835666; Fri, 04 Nov 2016 09:43:55 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si5152461pax.219.2016.11.04.09.43.55; Fri, 04 Nov 2016 09:43:55 -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 S965023AbcKDQnw (ORCPT + 27 others); Fri, 4 Nov 2016 12:43:52 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:38129 "EHLO mail-wm0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964921AbcKDQnq (ORCPT ); Fri, 4 Nov 2016 12:43:46 -0400 Received: by mail-wm0-f44.google.com with SMTP id f82so2116316wmf.1 for ; Fri, 04 Nov 2016 09:43:45 -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=IoLENEydYaHLreK1z9SzZPXQH3p+8K7b14v6YnvDZHM=; b=SS5yyBN+RG6tgo0Lj9JADnDxQKIJW3HHS5mJvt+o7GMbLWjQcXt0+umnbSaTcT12pg 4BerH9Q1TyjtMxfNbY1ffjjeGifkNi5QOcNjcEbRZkeu8HOFyCGmiQ+xsxK9NFDy8m8K ioIOSFM9dU/HKng25sIat01chXeG4aI59RkiFH5hrEOChVz8w49efqLBEdm//1VciOWy E9HKsQZXdDxsksAlfhdEe1fEZRRsGNQ7tkJ7oCfPszo9gx1N3mmEIveZEiCTykiEfIzO xfUh9uc3LmADZTuBNllmO7GmHJa14RssiYt2XzI6RQtdxbZHxMJ7iDD1R+mUpUb/ofVT 1YxA== 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=IoLENEydYaHLreK1z9SzZPXQH3p+8K7b14v6YnvDZHM=; b=V1+zWtZbEgfzwbQbKnN0VPoUKaRh0sANWY2Px3HWPwwR8a2JfM3bv3NBJ8tZphG9AS LbQX7mSafbrWnc284+5SBJz7dbXx/D3k2HZOPnn2a0E1lxdGJgpBrB2AvJ00Je2uFOdw lq4NmdMoT139LHfMDdJTXnlTfM8ePl7dU4L2NOaZ6zkN/oEmpVm1KwsiXX359AJzX2// mGV+QfY4o1SJfASHw+X6TXLYnvNc9wj4EVCEl45O3lQfnQlZkRA3tSVlna0hEB67pN8X NcX24aAm+BeeeqVFWa+O4wpTJPOcKgQPodInY6Hhn0FadJS6L/raDSg1OZAzbZSvcBDh /QYA== X-Gm-Message-State: ABUngvfyxYFfM6gQQOw1bkM+yOBcA13C2klHPcYjrHsTEY06MPRSvwoYX6Mf4JZgqA/TcOGk X-Received: by 10.28.24.80 with SMTP id 77mr4631341wmy.74.1478277824945; Fri, 04 Nov 2016 09:43:44 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id af4sm15148128wjc.17.2016.11.04.09.43.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 04 Nov 2016 09:43:44 -0700 (PDT) From: Alexandre Bailon To: david@lechnology.com, b-liu@ti.com, balbi@kernel.org Cc: kishon@ti.com, khilman@baylibre.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, nsekhar@ti.com, Alexandre Bailon Subject: [PATCH v4 3/4] usb: musb: Add a quirk flag to skip the phy set mode Date: Fri, 4 Nov 2016 17:43:37 +0100 Message-Id: <1478277818-5091-4-git-send-email-abailon@baylibre.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1478277818-5091-1-git-send-email-abailon@baylibre.com> References: <1478277818-5091-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 During the init, the driver will use the mode to configure the controller mode and the phy mode. The PHY of DA8xx has some issues when the phy is forced in host or device. Add way to skip the set mode and let the da8xx glue manage the phy mode. Signed-off-by: Alexandre Bailon --- drivers/usb/musb/musb_core.c | 15 ++++++++++----- drivers/usb/musb/musb_core.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) -- 2.7.3 diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 27dadc0..6f5f039 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2046,6 +2046,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) { int status; struct musb *musb; + enum musb_mode mode = MUSB_UNDEFINED; struct musb_hdrc_platform_data *plat = dev_get_platdata(dev); /* The driver might handle more features than the board; OK. @@ -2261,13 +2262,13 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) status = musb_host_setup(musb, plat->power); if (status < 0) goto fail3; - status = musb_platform_set_mode(musb, MUSB_HOST); + mode = MUSB_HOST; break; case MUSB_PORT_MODE_GADGET: status = musb_gadget_setup(musb); if (status < 0) goto fail3; - status = musb_platform_set_mode(musb, MUSB_PERIPHERAL); + mode = MUSB_PERIPHERAL; break; case MUSB_PORT_MODE_DUAL_ROLE: status = musb_host_setup(musb, plat->power); @@ -2278,15 +2279,19 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) musb_host_cleanup(musb); goto fail3; } - status = musb_platform_set_mode(musb, MUSB_OTG); + mode = MUSB_OTG; break; default: dev_err(dev, "unsupported port mode %d\n", musb->port_mode); break; } - if (status < 0) - goto fail3; + if (mode != MUSB_UNDEFINED && + !(musb->io.quirks & MUSB_SKIP_SET_MODE)) { + status = musb_platform_set_mode(musb, mode); + if (status < 0) + goto fail3; + } status = musb_init_debugfs(musb); if (status < 0) diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 2cb88a49..9bd8b6b 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -172,6 +172,7 @@ struct musb_io; */ struct musb_platform_ops { +#define MUSB_SKIP_SET_MODE BIT(7) #define MUSB_DMA_UX500 BIT(6) #define MUSB_DMA_CPPI41 BIT(5) #define MUSB_DMA_CPPI BIT(4)