From patchwork Thu Jul 18 06:46:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 2829475 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id CFE729F9EB for ; Thu, 18 Jul 2013 06:52:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CB25120201 for ; Thu, 18 Jul 2013 06:52:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B633F201FF for ; Thu, 18 Jul 2013 06:52:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932619Ab3GRGru (ORCPT ); Thu, 18 Jul 2013 02:47:50 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:34273 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932595Ab3GRGrs (ORCPT ); Thu, 18 Jul 2013 02:47:48 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r6I6lE33022193; Thu, 18 Jul 2013 01:47:14 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r6I6lE1l023911; Thu, 18 Jul 2013 01:47:14 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Thu, 18 Jul 2013 01:47:14 -0500 Received: from a0393678ub.apr.dhcp.ti.com (a0393678ub.apr.dhcp.ti.com [172.24.145.11]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r6I6kRjV024885; Thu, 18 Jul 2013 01:47:08 -0500 From: Kishon Vijay Abraham I To: , , , , , , CC: , , , , , , , , , , , , , , , , Subject: [PATCH 06/15] usb: musb: omap2430: use the new generic PHY framework Date: Thu, 18 Jul 2013 12:16:15 +0530 Message-ID: <1374129984-765-7-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1374129984-765-1-git-send-email-kishon@ti.com> References: <1374129984-765-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use the generic PHY framework API to get the PHY. The usb_phy_set_resume and usb_phy_set_suspend is replaced with power_on and power_off to align with the new PHY framework. musb->xceiv can't be removed as of now because musb core uses xceiv.state and xceiv.otg. Once there is a separate state machine to handle otg, these can be moved out of xceiv and then we can start using the generic PHY framework. Signed-off-by: Kishon Vijay Abraham I Reviewed-by: Sylwester Nawrocki Acked-by: Felipe Balbi --- drivers/usb/musb/Kconfig | 1 + drivers/usb/musb/musb_core.c | 1 + drivers/usb/musb/musb_core.h | 3 +++ drivers/usb/musb/omap2430.c | 26 ++++++++++++++++++++------ 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig index 797e3fd..01381ac 100644 --- a/drivers/usb/musb/Kconfig +++ b/drivers/usb/musb/Kconfig @@ -76,6 +76,7 @@ config USB_MUSB_TUSB6010 config USB_MUSB_OMAP2PLUS tristate "OMAP2430 and onwards" depends on ARCH_OMAP2PLUS + depends on GENERIC_PHY config USB_MUSB_AM35X tristate "AM35x" diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 29a24ce..cca12c0 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1814,6 +1814,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) musb->min_power = plat->min_power; musb->ops = plat->platform_ops; musb->port_mode = plat->mode; + musb->phy_label = plat->phy_label; /* The musb_platform_init() call: * - adjusts musb->mregs diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 7d341c3..8f017ab 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -46,6 +46,7 @@ #include #include #include +#include struct musb; struct musb_hw_ep; @@ -346,6 +347,7 @@ struct musb { u16 int_tx; struct usb_phy *xceiv; + struct phy *phy; int nIrq; unsigned irq_wake:1; @@ -424,6 +426,7 @@ struct musb { unsigned double_buffer_not_ok:1; struct musb_hdrc_config *config; + const char *phy_label; #ifdef MUSB_CONFIG_PROC_FS struct proc_dir_entry *proc_entry; diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 6708a3b..87dac0f 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -348,11 +348,21 @@ static int omap2430_musb_init(struct musb *musb) * up through ULPI. TWL4030-family PMICs include one, * which needs a driver, drivers aren't always needed. */ - if (dev->parent->of_node) + if (dev->parent->of_node) { + musb->phy = devm_phy_get(dev->parent, "usb2-phy"); + + /* We can't totally remove musb->xceiv as of now because + * musb core uses xceiv.state and xceiv.otg. Once we have + * a separate state machine to handle otg, these can be moved + * out of xceiv and then we can start using the generic PHY + * framework + */ musb->xceiv = devm_usb_get_phy_by_phandle(dev->parent, "usb-phy", 0); - else + } else { musb->xceiv = devm_usb_get_phy_dev(dev, 0); + musb->phy = devm_phy_get(dev, musb->phy_label); + } if (IS_ERR(musb->xceiv)) { status = PTR_ERR(musb->xceiv); @@ -364,6 +374,10 @@ static int omap2430_musb_init(struct musb *musb) return -EPROBE_DEFER; } + if (IS_ERR(musb->phy)) { + pr_err("HS USB OTG: no PHY configured\n"); + return PTR_ERR(musb->phy); + } musb->isr = omap2430_musb_interrupt; status = pm_runtime_get_sync(dev); @@ -397,7 +411,7 @@ static int omap2430_musb_init(struct musb *musb) if (glue->status != OMAP_MUSB_UNKNOWN) omap_musb_set_mailbox(glue); - usb_phy_init(musb->xceiv); + phy_init(musb->phy); pm_runtime_put_noidle(musb->controller); return 0; @@ -460,6 +474,7 @@ static int omap2430_musb_exit(struct musb *musb) del_timer_sync(&musb_idle_timer); omap2430_low_level_exit(musb); + phy_exit(musb->phy); return 0; } @@ -633,7 +648,7 @@ static int omap2430_runtime_suspend(struct device *dev) OTG_INTERFSEL); omap2430_low_level_exit(musb); - usb_phy_set_suspend(musb->xceiv, 1); + phy_power_off(musb->phy); } return 0; @@ -648,8 +663,7 @@ static int omap2430_runtime_resume(struct device *dev) omap2430_low_level_init(musb); musb_writel(musb->mregs, OTG_INTERFSEL, musb->context.otg_interfsel); - - usb_phy_set_suspend(musb->xceiv, 0); + phy_power_on(musb->phy); } return 0;