From patchwork Mon Sep 17 09:05:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhao X-Patchwork-Id: 1466331 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 5A11DDFFFF for ; Mon, 17 Sep 2012 09:07:43 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TDXG1-0003DK-RI; Mon, 17 Sep 2012 09:04:45 +0000 Received: from va3ehsobe002.messaging.microsoft.com ([216.32.180.12] helo=va3outboundpool.messaging.microsoft.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TDXFy-0003CP-UH for linux-arm-kernel@lists.infradead.org; Mon, 17 Sep 2012 09:04:43 +0000 Received: from mail211-va3-R.bigfish.com (10.7.14.240) by VA3EHSOBE002.bigfish.com (10.7.40.22) with Microsoft SMTP Server id 14.1.225.23; Mon, 17 Sep 2012 09:04:32 +0000 Received: from mail211-va3 (localhost [127.0.0.1]) by mail211-va3-R.bigfish.com (Postfix) with ESMTP id A06DF5200A5; Mon, 17 Sep 2012 09:04:32 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1202h1d1ah1d2ahzz8275bhz2dh2a8h668h839hd24he5bhf0ah107ah1288h12a5h12a9h12bdh12e5h1155h) Received: from mail211-va3 (localhost.localdomain [127.0.0.1]) by mail211-va3 (MessageSwitch) id 1347872670256220_5236; Mon, 17 Sep 2012 09:04:30 +0000 (UTC) Received: from VA3EHSMHS036.bigfish.com (unknown [10.7.14.236]) by mail211-va3.bigfish.com (Postfix) with ESMTP id 3A4FE240050; Mon, 17 Sep 2012 09:04:30 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS036.bigfish.com (10.7.99.46) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 17 Sep 2012 09:04:28 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server (TLS) id 14.2.309.3; Mon, 17 Sep 2012 04:04:27 -0500 Received: from b20223-02.ap.freescale.net (b20223-02.ap.freescale.net [10.192.242.124]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id q8H94LxG006969; Mon, 17 Sep 2012 02:04:22 -0700 From: Richard Zhao To: , Subject: [PATCH v3] USB: mxs-phy: add basic otg support Date: Mon, 17 Sep 2012 17:05:03 +0800 Message-ID: <1347872703-15167-1-git-send-email-richard.zhao@freescale.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [216.32.180.12 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: marex@denx.de, B20596@freescale.com, dong.aisheng@linaro.org, fabio.estevam@freescale.com, alexander.shishkin@linux.intel.com, B29397@freescale.com, balbi@ti.com, stern@rowland.harvard.edu, kernel@pengutronix.de, gregkh@linuxfoundation.org, richard.zhao@freescale.com, shawn.guo@linaro.org, mkl@pengutronix.de, linuxzsc@gmail.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Signed-off-by: Richard Zhao Acked-by: Felipe Balbi --- Changes from v2: - assign host/gadget in mxs_phy_set_host/mxs_phy_set_peripheral drivers/usb/otg/mxs-phy.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/usb/otg/mxs-phy.c b/drivers/usb/otg/mxs-phy.c index 88db976..3255112 100644 --- a/drivers/usb/otg/mxs-phy.c +++ b/drivers/usb/otg/mxs-phy.c @@ -129,12 +129,28 @@ static int mxs_phy_on_disconnect(struct usb_phy *phy, int port) return 0; } +static int mxs_phy_set_host(struct usb_otg *otg, struct usb_bus *host) +{ + otg->host = host; + + return 0; +} + +static int mxs_phy_set_peripheral(struct usb_otg *otg, + struct usb_gadget *gadget) +{ + otg->gadget = gadget; + + return 0; +} + static int mxs_phy_probe(struct platform_device *pdev) { struct resource *res; void __iomem *base; struct clk *clk; struct mxs_phy *mxs_phy; + struct usb_otg *otg; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { @@ -171,6 +187,15 @@ static int mxs_phy_probe(struct platform_device *pdev) mxs_phy->clk = clk; + otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg), GFP_KERNEL); + if (!otg) + return -ENOMEM; + otg->phy = &mxs_phy->phy; + otg->set_host = mxs_phy_set_host; + otg->set_peripheral = mxs_phy_set_peripheral; + + mxs_phy->phy.otg = otg; + platform_set_drvdata(pdev, &mxs_phy->phy); return 0;