From patchwork Tue May 10 11:48:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mugunthan V N X-Patchwork-Id: 620584 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3r3yG30T98z9t3V for ; Tue, 10 May 2016 21:49:15 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 15F5BA7613; Tue, 10 May 2016 13:49:01 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AqWLIA9qLhqI; Tue, 10 May 2016 13:49:00 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D396DA7622; Tue, 10 May 2016 13:48:53 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0CD3EA760A for ; Tue, 10 May 2016 13:48:48 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zJ79OvYbyel5 for ; Tue, 10 May 2016 13:48:47 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by theia.denx.de (Postfix) with ESMTPS id 85E6FA75CA for ; Tue, 10 May 2016 13:48:39 +0200 (CEST) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id u4ABmaCe030644; Tue, 10 May 2016 06:48:36 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id u4ABmaEn031512; Tue, 10 May 2016 06:48:36 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Tue, 10 May 2016 06:48:36 -0500 Received: from a0131834lt.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id u4ABmIeV024550; Tue, 10 May 2016 06:48:33 -0500 From: Mugunthan V N To: Date: Tue, 10 May 2016 17:18:10 +0530 Message-ID: <20160510114816.2899-6-mugunthanvnm@ti.com> X-Mailer: git-send-email 2.8.2.372.g63a3502 In-Reply-To: <20160510114816.2899-1-mugunthanvnm@ti.com> References: <20160510114816.2899-1-mugunthanvnm@ti.com> MIME-Version: 1.0 Cc: Marek Vasut , Tom Rini , Sekhar Nori Subject: [U-Boot] [PATCH v2 05/11] drivers: usb: musb: adopt musb backend driver to driver model X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Currently all backend driver ops uses hard coded physical address, so to adopt the driver to DM, add device pointer to ops call backs so that drivers can get physical addresses from the usb driver priv/plat data. Signed-off-by: Mugunthan V N Reviewed-by: Tom Rini --- arch/arm/cpu/armv7/am33xx/board.c | 4 ++-- arch/arm/cpu/armv7/omap3/am35x_musb.c | 6 +++--- arch/arm/include/asm/arch-omap3/musb.h | 6 +++--- arch/arm/include/asm/omap_musb.h | 7 ++++--- drivers/usb/musb-new/am35x.c | 14 +++++++------- drivers/usb/musb-new/musb_dsps.c | 8 ++++---- 6 files changed, 23 insertions(+), 22 deletions(-) diff --git a/arch/arm/cpu/armv7/am33xx/board.c b/arch/arm/cpu/armv7/am33xx/board.c index 8f0ff09..b8d8a3b 100644 --- a/arch/arm/cpu/armv7/am33xx/board.c +++ b/arch/arm/cpu/armv7/am33xx/board.c @@ -148,7 +148,7 @@ static struct musb_hdrc_config musb_config = { }; #ifdef CONFIG_AM335X_USB0 -static void am33xx_otg0_set_phy_power(u8 on) +static void am33xx_otg0_set_phy_power(struct udevice *dev, u8 on) { am33xx_usb_set_phy_power(on, &cdev->usb_ctrl0); } @@ -167,7 +167,7 @@ static struct musb_hdrc_platform_data otg0_plat = { #endif #ifdef CONFIG_AM335X_USB1 -static void am33xx_otg1_set_phy_power(u8 on) +static void am33xx_otg1_set_phy_power(struct udevice *dev, u8 on) { am33xx_usb_set_phy_power(on, &cdev->usb_ctrl1); } diff --git a/arch/arm/cpu/armv7/omap3/am35x_musb.c b/arch/arm/cpu/armv7/omap3/am35x_musb.c index 74dd105..d542699 100644 --- a/arch/arm/cpu/armv7/omap3/am35x_musb.c +++ b/arch/arm/cpu/armv7/omap3/am35x_musb.c @@ -13,7 +13,7 @@ #include #include -void am35x_musb_reset(void) +void am35x_musb_reset(struct udevice *dev) { /* Reset the musb interface */ clrsetbits_le32(&am35x_scm_general_regs->ip_sw_reset, @@ -22,7 +22,7 @@ void am35x_musb_reset(void) USBOTGSS_SW_RST, 0); } -void am35x_musb_phy_power(u8 on) +void am35x_musb_phy_power(struct udevice *dev, u8 on) { unsigned long start = get_timer(0); @@ -53,7 +53,7 @@ void am35x_musb_phy_power(u8 on) } } -void am35x_musb_clear_irq(void) +void am35x_musb_clear_irq(struct udevice *dev) { clrsetbits_le32(&am35x_scm_general_regs->lvl_intr_clr, 0, USBOTGSS_INT_CLR); diff --git a/arch/arm/include/asm/arch-omap3/musb.h b/arch/arm/include/asm/arch-omap3/musb.h index cee4ed3..d06a758 100644 --- a/arch/arm/include/asm/arch-omap3/musb.h +++ b/arch/arm/include/asm/arch-omap3/musb.h @@ -7,7 +7,7 @@ #ifndef __ASM_ARCH_OMAP3_MUSB_H #define __ASM_ARCH_OMAP3_MUSB_H -extern void am35x_musb_reset(void); -extern void am35x_musb_phy_power(u8 on); -extern void am35x_musb_clear_irq(void); +void am35x_musb_reset(struct udevice *dev); +void am35x_musb_phy_power(struct udevice *dev, u8 on); +void am35x_musb_clear_irq(struct udevice *dev); #endif diff --git a/arch/arm/include/asm/omap_musb.h b/arch/arm/include/asm/omap_musb.h index 8b9cb0e..7c5fb40 100644 --- a/arch/arm/include/asm/omap_musb.h +++ b/arch/arm/include/asm/omap_musb.h @@ -15,9 +15,10 @@ extern const struct musb_platform_ops omap2430_ops; struct omap_musb_board_data { u8 interface_type; - void (*set_phy_power)(u8 on); - void (*clear_irq)(void); - void (*reset)(void); + struct udevice *dev; + void (*set_phy_power)(struct udevice *dev, u8 on); + void (*clear_irq)(struct udevice *dev); + void (*reset)(struct udevice *dev); }; enum musb_interface {MUSB_INTERFACE_ULPI, MUSB_INTERFACE_UTMI}; diff --git a/drivers/usb/musb-new/am35x.c b/drivers/usb/musb-new/am35x.c index b8791dd..0167ea7 100644 --- a/drivers/usb/musb-new/am35x.c +++ b/drivers/usb/musb-new/am35x.c @@ -336,7 +336,7 @@ eoi: if (ret == IRQ_HANDLED || epintr || usbintr) { /* clear level interrupt */ if (data->clear_irq) - data->clear_irq(); + data->clear_irq(data->dev); /* write EOI */ musb_writel(reg_base, USB_END_OF_INTR_REG, 0); } @@ -401,14 +401,14 @@ static int am35x_musb_init(struct musb *musb) /* Reset the musb */ if (data->reset) - data->reset(); + data->reset(data->dev); /* Reset the controller */ musb_writel(reg_base, USB_CTRL_REG, AM35X_SOFT_RESET_MASK); /* Start the on-chip PHY and its PLL. */ if (data->set_phy_power) - data->set_phy_power(1); + data->set_phy_power(data->dev, 1); msleep(5); @@ -416,7 +416,7 @@ static int am35x_musb_init(struct musb *musb) /* clear level interrupt */ if (data->clear_irq) - data->clear_irq(); + data->clear_irq(data->dev); return 0; } @@ -439,7 +439,7 @@ static int am35x_musb_exit(struct musb *musb) /* Shutdown the on-chip PHY and its PLL. */ if (data->set_phy_power) - data->set_phy_power(0); + data->set_phy_power(data->dev, 0); #ifndef __UBOOT__ usb_put_phy(musb->xceiv); @@ -630,7 +630,7 @@ static int am35x_suspend(struct device *dev) /* Shutdown the on-chip PHY and its PLL. */ if (data->set_phy_power) - data->set_phy_power(0); + data->set_phy_power(data->dev, 0); clk_disable(glue->phy_clk); clk_disable(glue->clk); @@ -647,7 +647,7 @@ static int am35x_resume(struct device *dev) /* Start the on-chip PHY and its PLL. */ if (data->set_phy_power) - data->set_phy_power(1); + data->set_phy_power(data->dev, 1); ret = clk_enable(glue->phy_clk); if (ret) { diff --git a/drivers/usb/musb-new/musb_dsps.c b/drivers/usb/musb-new/musb_dsps.c index bb7c952..b7f3550 100644 --- a/drivers/usb/musb-new/musb_dsps.c +++ b/drivers/usb/musb-new/musb_dsps.c @@ -452,7 +452,7 @@ static int dsps_musb_init(struct musb *musb) /* Start the on-chip PHY and its PLL. */ if (data->set_phy_power) - data->set_phy_power(1); + data->set_phy_power(data->dev, 1); musb->isr = dsps_interrupt; @@ -493,7 +493,7 @@ static int dsps_musb_exit(struct musb *musb) /* Shutdown the on-chip PHY and its PLL. */ if (data->set_phy_power) - data->set_phy_power(0); + data->set_phy_power(data->dev, 0); #ifndef __UBOOT__ /* NOP driver needs change if supporting dual instance */ @@ -693,7 +693,7 @@ static int dsps_suspend(struct device *dev) /* Shutdown the on-chip PHY and its PLL. */ if (data->set_phy_power) - data->set_phy_power(0); + data->set_phy_power(data->dev, 0); return 0; } @@ -705,7 +705,7 @@ static int dsps_resume(struct device *dev) /* Start the on-chip PHY and its PLL. */ if (data->set_phy_power) - data->set_phy_power(1); + data->set_phy_power(data->dev, 1); return 0; }