From patchwork Fri Aug 28 18:32:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 44545 Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7SIWtHf011101 for ; Fri, 28 Aug 2009 18:32:56 GMT Received: from dlep35.itg.ti.com ([157.170.170.118]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id n7SIUcKk023433; Fri, 28 Aug 2009 13:30:43 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep35.itg.ti.com (8.13.7/8.13.7) with ESMTP id n7SIUc1W020756; Fri, 28 Aug 2009 13:30:38 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id E0F2080628; Fri, 28 Aug 2009 13:30:37 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp51.itg.ti.com (dflp51.itg.ti.com [128.247.22.94]) by linux.omap.com (Postfix) with ESMTP id 7DD7380626 for ; Fri, 28 Aug 2009 13:30:35 -0500 (CDT) Received: from medina.ext.ti.com (localhost [127.0.0.1]) by dflp51.itg.ti.com (8.13.7/8.13.7) with ESMTP id n7SIUZi6018411 for ; Fri, 28 Aug 2009 13:30:35 -0500 (CDT) Received: from mail10-va3-R.bigfish.com (mail-va3.bigfish.com [216.32.180.111]) by medina.ext.ti.com (8.13.7/8.13.7) with ESMTP id n7SIUTwF022539 for ; Fri, 28 Aug 2009 13:30:35 -0500 Received: from mail10-va3 (localhost.localdomain [127.0.0.1]) by mail10-va3-R.bigfish.com (Postfix) with ESMTP id 2F0171BC00D6 for ; Fri, 28 Aug 2009 18:30:29 +0000 (UTC) X-SpamScore: 3 X-BigFish: vps3(zcb8kzzz1202hzzz2dh6bh62h) X-Spam-TCS-SCL: 1:0 X-FB-SS: 5, X-MS-Exchange-Organization-Antispam-Report: OrigIP: 63.81.120.155; Service: EHS Received: by mail10-va3 (MessageSwitch) id 1251484227190689_24488; Fri, 28 Aug 2009 18:30:27 +0000 (UCT) Received: from imap.sh.mvista.com (unknown [63.81.120.155]) by mail10-va3.bigfish.com (Postfix) with ESMTP id 0321011E8058 for ; Fri, 28 Aug 2009 18:30:27 +0000 (UTC) Received: from wasted.dev.rtsoft.ru (unknown [10.150.0.9]) by imap.sh.mvista.com (Postfix) with ESMTP id 839443EC9; Fri, 28 Aug 2009 11:30:25 -0700 (PDT) From: Sergei Shtylyov Organization: MontaVista Software Inc. To: davinci-linux-open-source@linux.davincidsp.com Date: Fri, 28 Aug 2009 22:32:09 +0400 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200908282232.09447.sshtylyov@ru.mvista.com> Cc: linux-usb@vger.kernel.org Subject: [PATCH 2/3] DA8xx: MUSB platform device X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com Add the function to register the MUSB platform device. Signed-off-by: Sergei Shtylyov --- The patch is against the recent DaVinci tree plus the OHCI platform patches that I posted a week ago... arch/arm/mach-davinci/devices-da8xx.c | 74 +++++++++++++++++++++++++++++ arch/arm/mach-davinci/include/mach/da8xx.h | 1 2 files changed, 75 insertions(+) Index: linux-davinci/arch/arm/mach-davinci/devices-da8xx.c =================================================================== --- linux-davinci.orig/arch/arm/mach-davinci/devices-da8xx.c +++ linux-davinci/arch/arm/mach-davinci/devices-da8xx.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -30,6 +31,7 @@ #define DA8XX_TPTC1_BASE 0x01c08400 #define DA8XX_WDOG_BASE 0x01c21000 /* DA8XX_TIMER64P1_BASE */ #define DA8XX_I2C0_BASE 0x01c22000 +#define DA8XX_USB0_BASE 0x01e00000 #define DA8XX_EMAC_CPPI_PORT_BASE 0x01e20000 #define DA8XX_EMAC_CPGMACSS_BASE 0x01e22000 #define DA8XX_EMAC_CPGMAC_BASE 0x01e23000 @@ -236,6 +238,78 @@ int __init da8xx_register_watchdog(void) return platform_device_register(&davinci_wdt_device); } +static struct musb_hdrc_eps_bits musb_eps[] = { + { "ep1_tx", 8, }, + { "ep1_rx", 8, }, + { "ep2_tx", 8, }, + { "ep2_rx", 8, }, + { "ep3_tx", 5, }, + { "ep3_rx", 5, }, + { "ep4_tx", 5, }, + { "ep4_rx", 5, }, +}; + +static struct musb_hdrc_config musb_config = { + .multipoint = true, + .dyn_fifo = true, + .soft_con = true, + .dma = true, + + .num_eps = 5, + .dma_channels = 8, + .ram_bits = 10, + .eps_bits = musb_eps, +}; + +static struct musb_hdrc_platform_data da8xx_usb20_data = { +#if defined(CONFIG_USB_MUSB_OTG) + /* OTG requires a Mini-AB connector */ + .mode = MUSB_OTG, +#elif defined(CONFIG_USB_MUSB_PERIPHERAL) + .mode = MUSB_PERIPHERAL, +#elif defined(CONFIG_USB_MUSB_HOST) + .mode = MUSB_HOST, +#endif + .clock = "usb20", + .config = &musb_config, +}; + +static struct resource da8xx_usb20_resources[] = { + { + /* physical address */ + .start = DA8XX_USB0_BASE, + .end = DA8XX_USB0_BASE + SZ_64K - 1, + .flags = IORESOURCE_MEM, + }, + { + .start = IRQ_DA8XX_USB_INT, + .end = IRQ_DA8XX_USB_INT, + .flags = IORESOURCE_IRQ, + }, +}; + +static u64 da8xx_usb20_dmamask = DMA_BIT_MASK(32); + +static struct platform_device da8xx_usb20_device = { + .name = "musb_hdrc", + .id = -1, + .dev = { + .platform_data = &da8xx_usb20_data, + .dma_mask = &da8xx_usb20_dmamask, + .coherent_dma_mask = DMA_BIT_MASK(32), + }, + .resource = da8xx_usb20_resources, + .num_resources = ARRAY_SIZE(da8xx_usb20_resources), +}; + +int __init da8xx_register_usb20(unsigned mA, unsigned potpgt) +{ + da8xx_usb20_data.power = mA > 510 ? 255 : mA / 2; + da8xx_usb20_data.potpgt = (potpgt + 1) / 2; + + return platform_device_register(&da8xx_usb20_device); +} + static struct resource da8xx_usb11_resources[] = { [0] = { .start = DA8XX_USB1_BASE, Index: linux-davinci/arch/arm/mach-davinci/include/mach/da8xx.h =================================================================== --- linux-davinci.orig/arch/arm/mach-davinci/include/mach/da8xx.h +++ linux-davinci/arch/arm/mach-davinci/include/mach/da8xx.h @@ -73,6 +73,7 @@ void __init da850_init(void); int da8xx_register_edma(void); int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata); int da8xx_register_watchdog(void); +int da8xx_register_usb20(unsigned mA, unsigned potpgt); int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata); int da8xx_register_emac(void); int da8xx_register_lcdc(void);