From patchwork Fri Sep 25 19:14:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 50152 Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8PJDHo6010282 for ; Fri, 25 Sep 2009 19:13:18 GMT Received: from dlep33.itg.ti.com ([157.170.170.112]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id n8PJBeDq021024 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 25 Sep 2009 14:11:40 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id n8PJBdOo019967; Fri, 25 Sep 2009 14:11:39 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 9E26680627; Fri, 25 Sep 2009 14:11:39 -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 D3A3B80626 for ; Fri, 25 Sep 2009 14:11:36 -0500 (CDT) Received: from white.ext.ti.com (localhost [127.0.0.1]) by dflp51.itg.ti.com (8.13.7/8.13.7) with ESMTP id n8PJBatd012260 for ; Fri, 25 Sep 2009 14:11:36 -0500 (CDT) Received: from mail73-va3-R.bigfish.com (mail-va3.bigfish.com [216.32.180.112]) by white.ext.ti.com (8.13.7/8.13.7) with ESMTP id n8PJBZAZ014905 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 25 Sep 2009 14:11:35 -0500 Received: from mail73-va3 (localhost.localdomain [127.0.0.1]) by mail73-va3-R.bigfish.com (Postfix) with ESMTP id F1AA0C40589 for ; Fri, 25 Sep 2009 19:11:34 +0000 (UTC) X-SpamScore: 11 X-BigFish: vps11(zcb8kz8c8aizz1202hzzz2dh6bh259o61h) X-Spam-TCS-SCL: 0:0 X-FB-SS: 5, X-MS-Exchange-Organization-Antispam-Report: OrigIP: 63.81.120.155; Service: EHS Received: by mail73-va3 (MessageSwitch) id 1253905890901771_16791; Fri, 25 Sep 2009 19:11:30 +0000 (UCT) Received: from VA3EHSMHS025.bigfish.com (unknown [10.7.14.241]) by mail73-va3.bigfish.com (Postfix) with ESMTP id D7D5B1528050 for ; Fri, 25 Sep 2009 19:11:30 +0000 (UTC) Received: from imap.sh.mvista.com (63.81.120.155) by VA3EHSMHS025.bigfish.com (10.7.99.35) with Microsoft SMTP Server id 14.0.482.32; Fri, 25 Sep 2009 19:11:28 +0000 Received: from wasted.dev.rtsoft.ru (unknown [10.150.0.9]) by imap.sh.mvista.com (Postfix) with ESMTP id 43F1E3EC9; Fri, 25 Sep 2009 12:11:27 -0700 (PDT) From: Sergei Shtylyov Organization: MontaVista Software Inc. To: khilman@deeprootsystems.com Date: Fri, 25 Sep 2009 23:14:02 +0400 User-Agent: KMail/1.5 MIME-Version: 1.0 Content-Disposition: inline Message-ID: <200909252314.02619.sshtylyov@ru.mvista.com> X-Reverse-DNS: unknown Cc: davinci-linux-open-source@linux.davincidsp.com, linux-usb@vger.kernel.org Subject: [PATCH 1/2] DA8xx: OHCI platform device (take 3) 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 OHCI platform device, given the root hub related platform data passed from the board specific code. The platfrom data provide for overriding the OHCI port power and over-current bits at the board level. Signed-off-by: Sergei Shtylyov --- The patch is against the recent DaVinci tree... Changes since the previous take: - moved the USB 2.0 clock entry change to another patch; - moved the OHCI platform devices from devices-da8xx.c to usb.c... arch/arm/mach-davinci/include/mach/da8xx.h | 2 + arch/arm/mach-davinci/include/mach/usb.h | 20 ++++++++++++++++ arch/arm/mach-davinci/usb.c | 36 ++++++++++++++++++++++++++++- 3 files changed, 57 insertions(+), 1 deletion(-) 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 @@ -19,6 +19,7 @@ #include #include #include +#include extern void __iomem *da8xx_syscfg_base; @@ -80,6 +81,7 @@ int da8xx_cppi41_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_usb11(struct da8xx_ohci_root_hub *pdata); int da8xx_register_emac(void); int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata); int da8xx_register_mmcsd0(struct davinci_mmc_config *config); Index: linux-davinci/arch/arm/mach-davinci/include/mach/usb.h =================================================================== --- linux-davinci.orig/arch/arm/mach-davinci/include/mach/usb.h +++ linux-davinci/arch/arm/mach-davinci/include/mach/usb.h @@ -34,4 +34,24 @@ #define CFGCHIP2_REFFREQ_24MHZ (2 << 0) #define CFGCHIP2_REFFREQ_48MHZ (3 << 0) +struct da8xx_ohci_root_hub; + +typedef void (*da8xx_ocic_handler_t)(struct da8xx_ohci_root_hub *hub, + unsigned port); + +/* Passed as the platform data to the OHCI driver */ +struct da8xx_ohci_root_hub { + /* Switch the port power on/off */ + int (*set_power)(unsigned port, int on); + /* Read the port power status */ + int (*get_power)(unsigned port); + /* Read the port over-current indicator */ + int (*get_oci)(unsigned port); + /* Over-current indicator change notification (pass NULL to disable) */ + int (*ocic_notify)(da8xx_ocic_handler_t handler); + + /* Time from power on to power good (in 2 ms units) */ + u8 potpgt; +}; + #endif /* ifndef __ASM_ARCH_USB_H */ Index: linux-davinci/arch/arm/mach-davinci/usb.c =================================================================== --- linux-davinci.orig/arch/arm/mach-davinci/usb.c +++ linux-davinci/arch/arm/mach-davinci/usb.c @@ -15,7 +15,8 @@ #include #include -#define DAVINCI_USB_OTG_BASE 0x01C64000 +#define DAVINCI_USB_OTG_BASE 0x01c64000 +#define DA8XX_USB1_BASE 0x01e25000 #if defined(CONFIG_USB_MUSB_HDRC) || defined(CONFIG_USB_MUSB_HDRC_MODULE) static struct musb_hdrc_eps_bits musb_eps[] = { @@ -108,3 +109,36 @@ void __init setup_usb(unsigned mA, unsig #endif /* CONFIG_USB_MUSB_HDRC */ +#ifdef CONFIG_ARCH_DAVINCI_DA8XX +static struct resource da8xx_usb11_resources[] = { + [0] = { + .start = DA8XX_USB1_BASE, + .end = DA8XX_USB1_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_DA8XX_IRQN, + .end = IRQ_DA8XX_IRQN, + .flags = IORESOURCE_IRQ, + }, +}; + +static u64 da8xx_usb11_dma_mask = DMA_BIT_MASK(32); + +static struct platform_device da8xx_usb11_device = { + .name = "ohci", + .id = 0, + .dev = { + .dma_mask = &da8xx_usb11_dma_mask, + .coherent_dma_mask = DMA_BIT_MASK(32), + }, + .num_resources = ARRAY_SIZE(da8xx_usb11_resources), + .resource = da8xx_usb11_resources, +}; + +int __init da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata) +{ + da8xx_usb11_device.dev.platform_data = pdata; + return platform_device_register(&da8xx_usb11_device); +} +#endif /* CONFIG_DAVINCI_DA8XX */