From patchwork Thu Oct 27 09:34:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Bailon X-Patchwork-Id: 79638 Delivered-To: patch@linaro.org Received: by 10.80.142.83 with SMTP id 19csp567847edx; Thu, 27 Oct 2016 03:48:29 -0700 (PDT) X-Received: by 10.98.15.92 with SMTP id x89mr13185948pfi.29.1477565308913; Thu, 27 Oct 2016 03:48:28 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id c5si7305704pgi.131.2016.10.27.03.48.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Oct 2016 03:48:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@baylibre-com.20150623.gappssmtp.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bziDU-0004QD-Kt; Thu, 27 Oct 2016 10:47:24 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bziDP-0004Fv-Tv for linux-arm-kernel@lists.infradead.org; Thu, 27 Oct 2016 10:47:21 +0000 Received: by mail-wm0-x233.google.com with SMTP id 140so20487862wmv.0 for ; Thu, 27 Oct 2016 03:46:59 -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=YnjiluN4nqIQN4say6d+2y+JDu6BbIpMwimIPGh/Kj4=; b=M5NJ+A2/JuWXhvROHEbsj0+VRRr2XxdcAH48ZkCzJdIkEnAu0dh/OlyNdHRn5bzx4Z aH9aDJIytFCTDFBktLOAFYoVle8d6W6rAYJ3U8I6ZV9M4pJEQfTGJkXS/X4zHfP8YBAw ZpL5hm+msdkT0x7FNEl2O7jSVWIOj4AVj9TKExH/rxgBsUYJZBZAFcpgtArj41p11wJl pU2zJ1AEkzIexUrKad2kL/r8gtMr+8f65+oO7lYbrgB+xhcDH8tcwnMlQhEQKFsNUAoT LWgJ8p2ZfBiV0ZpdgCBiqwUzQgCNSER99vqwDfCbXGluXt0wfbsOpaHAfJcATjX07y48 2NQA== 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=YnjiluN4nqIQN4say6d+2y+JDu6BbIpMwimIPGh/Kj4=; b=OXb371eC1K5CaYelx1m8+uKd9QlHJHtZ1RtKWS0DNZiFF8WTc+0eM/LF6xBrALsVSG FZ5tFhoXfVZRPJDLTLmWlibszuCiMF/Ti14ovQQZBYmafmCLRKeK/aB3a7EFI9hWrAFo uhpcyC269yhfmKIhDcYdBbHGL2k8JsZE9PlV3fAhSwjOIXs8fM/GkfiZr4hU5aaTjg/E fDWPgYc4sDHaUTYRC1DFvOezzQiX0aTzykl9l9jaFcV6AGIvmu9pjTJfejm35EI+Swy2 zUpTwfb9MBjIRlc/VULtphdZ7dhicm8hedsiRSmf9IR6RUVx4hNonF+NG3yQHPBFLq7z 7SBQ== X-Gm-Message-State: ABUngvdi/eRdyHiSgYAsAAozYa73ozAuOaHXIvg0xPItmIV30Alf5j+bmC3yEKvgn0GNf0Tv X-Received: by 10.194.243.167 with SMTP id wz7mr6874424wjc.65.1477560862396; Thu, 27 Oct 2016 02:34:22 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id im3sm7412558wjb.13.2016.10.27.02.34.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 27 Oct 2016 02:34:21 -0700 (PDT) From: Alexandre Bailon To: khilman@baylibre.com, robh+dt@kernel.org, b-liu@ti.com Subject: [PATCH v3 2/4] usb: musb: core: added helper function for parsing DT Date: Thu, 27 Oct 2016 11:34:05 +0200 Message-Id: <1477560847-8929-3-git-send-email-abailon@baylibre.com> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1477560847-8929-1-git-send-email-abailon@baylibre.com> References: <1477560847-8929-1-git-send-email-abailon@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161027_034720_232285_BED51D75 X-CRM114-Status: GOOD ( 12.68 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:233 listed in] [list.dnswl.org] 0.7 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Petr Kulhavy , Alexandre Bailon , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org From: Petr Kulhavy This adds the function musb_get_mode() to get the DT property "dr_mode" Signed-off-by: Petr Kulhavy Acked-by: Sergei Shtylyov Signed-off-by: Alexandre Bailon Tested-by: David Lechner --- drivers/usb/musb/musb_core.c | 19 +++++++++++++++++++ drivers/usb/musb/musb_core.h | 5 +++++ 2 files changed, 24 insertions(+) -- 2.7.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 27dadc0..bba07e7 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -100,6 +100,7 @@ #include #include #include +#include #include "musb_core.h" #include "musb_trace.h" @@ -130,6 +131,24 @@ static inline struct musb *dev_to_musb(struct device *dev) return dev_get_drvdata(dev); } +enum musb_mode musb_get_mode(struct device *dev) +{ + enum usb_dr_mode mode; + + mode = usb_get_dr_mode(dev); + switch (mode) { + case USB_DR_MODE_HOST: + return MUSB_HOST; + case USB_DR_MODE_PERIPHERAL: + return MUSB_PERIPHERAL; + case USB_DR_MODE_OTG: + case USB_DR_MODE_UNKNOWN: + default: + return MUSB_OTG; + } +} +EXPORT_SYMBOL_GPL(musb_get_mode); + /*-------------------------------------------------------------------------*/ #ifndef CONFIG_BLACKFIN diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 2cb88a49..a406468 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -617,4 +617,9 @@ static inline void musb_platform_post_root_reset_end(struct musb *musb) musb->ops->post_root_reset_end(musb); } +/* gets the "dr_mode" property from DT and converts it into musb_mode + * if the property is not found or not recognized returns MUSB_OTG + */ +extern enum musb_mode musb_get_mode(struct device *dev); + #endif /* __MUSB_CORE_H__ */