From patchwork Fri Dec 10 14:35:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kalliguddi, Hema" X-Patchwork-Id: 398602 X-Patchwork-Delegate: me@felipebalbi.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBAEaQh8006293 for ; Fri, 10 Dec 2010 14:36:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754832Ab0LJOgY (ORCPT ); Fri, 10 Dec 2010 09:36:24 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:38876 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754485Ab0LJOgX (ORCPT ); Fri, 10 Dec 2010 09:36:23 -0500 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id oBAEaIWu010558 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 10 Dec 2010 08:36:20 -0600 Received: from localhost.localdomain (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id oBAEZggG005843; Fri, 10 Dec 2010 20:06:16 +0530 (IST) From: Hema HK To: linux-usb@vger.kernel.org Cc: linux-omap@vger.kernel.org, Hema HK , Felipe Balbi , Tony Lindgren , Kevin Hilman , "Cousson, Benoit" , Paul Walmsley Subject: [PATCH 4/5 v5] OMAP2+: musb: HWMOD adaptation for musb. Date: Fri, 10 Dec 2010 20:05:38 +0530 Message-Id: <1291991739-21705-5-git-send-email-hemahk@ti.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1291991739-21705-1-git-send-email-hemahk@ti.com> References: <1291991739-21705-1-git-send-email-hemahk@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Fri, 10 Dec 2010 14:36:27 +0000 (UTC) Index: usb/arch/arm/mach-omap2/usb-musb.c =================================================================== --- usb.orig/arch/arm/mach-omap2/usb-musb.c +++ usb/arch/arm/mach-omap2/usb-musb.c @@ -31,9 +31,12 @@ #include #include #include "control.h" +#include #if defined(CONFIG_USB_MUSB_OMAP2PLUS) || defined (CONFIG_USB_MUSB_AM35X) +static const char name[] = "musb-omap2430"; + static void am35x_musb_reset(void) { u32 regval; @@ -170,7 +173,7 @@ static struct musb_hdrc_platform_data mu static u64 musb_dmamask = DMA_BIT_MASK(32); static struct platform_device musb_device = { - .name = "musb-omap2430", + .name = "musb-am35x", .id = -1, .dev = { .dma_mask = &musb_dmamask, @@ -181,26 +184,23 @@ static struct platform_device musb_devic .resource = musb_resources, }; +static struct omap_device_pm_latency omap_musb_latency[] = { + { + .deactivate_func = omap_device_idle_hwmods, + .activate_func = omap_device_enable_hwmods, + .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, + }, +}; + void __init usb_musb_init(struct omap_musb_board_data *board_data) { - if (cpu_is_omap243x()) { - musb_resources[0].start = OMAP243X_HS_BASE; - } else if (cpu_is_omap3517() || cpu_is_omap3505()) { - musb_device.name = "musb-am35x"; - musb_resources[0].start = AM35XX_IPSS_USBOTGSS_BASE; - musb_resources[1].start = INT_35XX_USBOTG_IRQ; - board_data->set_phy_power = am35x_musb_phy_power; - board_data->clear_irq = am35x_musb_clear_irq; - board_data->set_mode = am35x_musb_set_mode; - board_data->reset = am35x_musb_reset; - } else if (cpu_is_omap34xx()) { - musb_resources[0].start = OMAP34XX_HSUSB_OTG_BASE; - } else if (cpu_is_omap44xx()) { - musb_resources[0].start = OMAP44XX_HSUSB_OTG_BASE; - musb_resources[1].start = OMAP44XX_IRQ_HS_USB_MC_N; - musb_resources[2].start = OMAP44XX_IRQ_HS_USB_DMA_N; - } - musb_resources[0].end = musb_resources[0].start + SZ_4K - 1; + struct omap_hwmod *oh; + struct omap_device *od; + struct platform_device *pdev; + struct device *dev; + int bus_id = -1; + const char *oh_name = "usb_otg_hs"; + struct musb_hdrc_platform_data *pdata; /* * REVISIT: This line can be removed once all the platforms using @@ -212,8 +212,42 @@ void __init usb_musb_init(struct omap_mu musb_plat.mode = board_data->mode; musb_plat.extvbus = board_data->extvbus; - if (platform_device_register(&musb_device) < 0) - printk(KERN_ERR "Unable to register HS-USB (MUSB) device\n"); + if (cpu_is_omap3517() || cpu_is_omap3505()) { + musb_resources[0].start = AM35XX_IPSS_USBOTGSS_BASE; + musb_resources[1].start = INT_35XX_USBOTG_IRQ; + board_data->set_phy_power = am35x_musb_phy_power; + board_data->clear_irq = am35x_musb_clear_irq; + board_data->set_mode = am35x_musb_set_mode; + board_data->reset = am35x_musb_reset; + musb_resources[0].end = musb_resources[0].start + SZ_4K - 1; + + if (platform_device_register(&musb_device) < 0) + printk(KERN_ERR "Unable to register HS-USB \ + (MUSB) device\n"); + } else { + oh = omap_hwmod_lookup(oh_name); + if (!oh) { + pr_err("Could not look up %s\n", oh_name); + return; + } + + pdata = &musb_plat; + od = omap_device_build(name, bus_id, oh, pdata, + sizeof(*pdata), omap_musb_latency, + ARRAY_SIZE(omap_musb_latency), false); + if (IS_ERR(od)) { + pr_err("Could not build omap_device for %s %s\n", + name, oh_name); + return; + } + + pdev = &od->pdev; + dev = &pdev->dev; + get_device(dev); + dev->dma_mask = &musb_dmamask; + dev->coherent_dma_mask = musb_dmamask; + put_device(dev); + } } #else