From patchwork Fri Oct 1 11:55:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh KUMAR X-Patchwork-Id: 66344 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-wy0-f184.google.com (mail-wy0-f184.google.com [74.125.82.184]) by ozlabs.org (Postfix) with ESMTP id 1849AB70FB for ; Fri, 1 Oct 2010 21:58:02 +1000 (EST) Received: by mail-wy0-f184.google.com with SMTP id 11sf1396646wyi.11 for ; Fri, 01 Oct 2010 04:58:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:mime-version:x-beenthere:received :received:received:received:received-spf:received:received:received :received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:in-reply-to:references:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=hGx7NO8U2njBqvATvqBoE05qGedcUVhDt00+F5Qoi1w=; b=kI6Ymq+2cIryhE7hIwUX5KI8Z2HfH6XvnvuNj7Bq+tHXXQeqd03lb5ON8o4vdTI6AC 4Di2STqESJswjRyeYaVhxV6nAP7ELJqM2fjs1eDnsZDlIjHVDQJeBM+L/o4Jp2bZt/3/ tAomsLFws99VyC8mFwCAkMqepuUEiH2XYEFw4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=mime-version:x-beenthere:received-spf:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; b=xyAMs/lb5Fv+wmtcCdQVHm7JL/wPO67vkM+jtB86cg9Jc2nLGkCFSgWJejZS33EYtX y2N/HFpL07sLYCdO4Oh4T9yEOwM0qZjpXXFGHdw1z1O3+iMF6SWomfIR/KFOLMJxLDhj +fD4zMfl0yFtenmCMsNSYi9nIDXh/eL0cgsds= Received: by 10.216.145.132 with SMTP id p4mr1145633wej.5.1285934281651; Fri, 01 Oct 2010 04:58:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: rtc-linux@googlegroups.com Received: by 10.14.36.29 with SMTP id v29ls233538eea.3.p; Fri, 01 Oct 2010 04:58:01 -0700 (PDT) Received: by 10.14.119.205 with SMTP id n53mr567144eeh.6.1285934281083; Fri, 01 Oct 2010 04:58:01 -0700 (PDT) Received: by 10.14.119.205 with SMTP id n53mr567143eeh.6.1285934281051; Fri, 01 Oct 2010 04:58:01 -0700 (PDT) Received: from eu1sys200aog114.obsmtp.com (eu1sys200aog114.obsmtp.com [207.126.144.137]) by gmr-mx.google.com with ESMTP id r57si1121420eeh.1.2010.10.01.04.57.49; Fri, 01 Oct 2010 04:58:01 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.137 is neither permitted nor denied by best guess record for domain of viresh.kumar@st.com) client-ip=207.126.144.137; Received: from source ([164.129.1.35]) (using TLSv1) by eu1sys200aob114.postini.com ([207.126.147.11]) with SMTP ID DSNKTKXMve0YBWXm7dfGt7oS7094SmAlRpRU@postini.com; Fri, 01 Oct 2010 11:58:00 UTC Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 271D2BE; Fri, 1 Oct 2010 11:57:43 +0000 (GMT) Received: from mail2.dlh.st.com (mail2.dlh.st.com [10.199.8.22]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B9A54263F; Fri, 1 Oct 2010 11:57:41 +0000 (GMT) Received: from localhost (dlhl0509.dlh.st.com [10.199.7.86]) by mail2.dlh.st.com (MOS 3.8.7a) with ESMTP id CUF00966 (AUTH viresh.kumar@st.com); Fri, 1 Oct 2010 17:27:40 +0530 (IST) From: Viresh KUMAR To: linux-arm-kernel@lists.infradead.org, rtc-linux@googlegroups.com, a.zummo@towertech.it, dbrownell@users.sourceforge.net, linux-usb@vger.kernel.org Cc: Deepak Sikri , shiraz.hashim@st.com, vipin.kumar@st.com, armando.visconti@st.com, vipulkumar.samar@st.com, rajeev-dlh.kumar@st.com, pratyush.anand@st.com, bhupesh.sharma@st.com, Viresh Kumar Subject: [rtc-linux] [PATCH V2 20/69] ST SPEAr: Adding machine support for USB host Date: Fri, 1 Oct 2010 17:25:40 +0530 Message-Id: X-Mailer: git-send-email 1.7.2.2 In-Reply-To: References: In-Reply-To: References: X-Original-Sender: viresh.kumar@st.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 207.126.144.137 is neither permitted nor denied by best guess record for domain of viresh.kumar@st.com) smtp.mail=viresh.kumar@st.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , From: Deepak Sikri Signed-off-by: Deepak Sikri Signed-off-by: Rajeev Kumar Signed-off-by: Shiraz Hashim Signed-off-by: Viresh Kumar --- arch/arm/mach-spear13xx/include/mach/generic.h | 4 + arch/arm/mach-spear13xx/spear1300_evb.c | 4 + arch/arm/mach-spear13xx/spear13xx.c | 106 +++++++++++++++++++++++ arch/arm/mach-spear3xx/include/mach/generic.h | 3 + arch/arm/mach-spear3xx/spear300_evb.c | 3 + arch/arm/mach-spear3xx/spear310_evb.c | 3 + arch/arm/mach-spear3xx/spear320_evb.c | 3 + arch/arm/mach-spear3xx/spear3xx.c | 80 +++++++++++++++++ arch/arm/mach-spear6xx/include/mach/generic.h | 4 + arch/arm/mach-spear6xx/spear600_evb.c | 4 + arch/arm/mach-spear6xx/spear6xx.c | 108 ++++++++++++++++++++++++ 11 files changed, 322 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-spear13xx/include/mach/generic.h b/arch/arm/mach-spear13xx/include/mach/generic.h index b0e25be..a75ed3a 100644 --- a/arch/arm/mach-spear13xx/include/mach/generic.h +++ b/arch/arm/mach-spear13xx/include/mach/generic.h @@ -30,7 +30,11 @@ /* Add spear13xx family device structure declarations here */ extern struct amba_device spear13xx_uart_device; +extern struct platform_device spear13xx_ehci0_device; +extern struct platform_device spear13xx_ehci1_device; extern struct platform_device spear13xx_i2c_device; +extern struct platform_device spear13xx_ohci0_device; +extern struct platform_device spear13xx_ohci1_device; extern struct platform_device spear13xx_rtc_device; extern struct sys_timer spear13xx_timer; diff --git a/arch/arm/mach-spear13xx/spear1300_evb.c b/arch/arm/mach-spear13xx/spear1300_evb.c index 4c72b7a..9f53361 100644 --- a/arch/arm/mach-spear13xx/spear1300_evb.c +++ b/arch/arm/mach-spear13xx/spear1300_evb.c @@ -22,7 +22,11 @@ static struct amba_device *amba_devs[] __initdata = { }; static struct platform_device *plat_devs[] __initdata = { + &spear13xx_ehci0_device, + &spear13xx_ehci1_device, &spear13xx_i2c_device, + &spear13xx_ohci0_device, + &spear13xx_ohci1_device, &spear13xx_rtc_device, }; diff --git a/arch/arm/mach-spear13xx/spear13xx.c b/arch/arm/mach-spear13xx/spear13xx.c index 8acf9df..c201e31 100644 --- a/arch/arm/mach-spear13xx/spear13xx.c +++ b/arch/arm/mach-spear13xx/spear13xx.c @@ -60,6 +60,112 @@ struct platform_device spear13xx_i2c_device = { .resource = i2c_resources, }; +/* usb host device registeration */ +static struct resource ehci0_resources[] = { + [0] = { + .start = SPEAR13XX_UHC0_EHCI_BASE, + .end = SPEAR13XX_UHC0_EHCI_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_USBH_EHCI0, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct resource ehci1_resources[] = { + [0] = { + .start = SPEAR13XX_UHC1_EHCI_BASE, + .end = SPEAR13XX_UHC1_EHCI_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_USBH_EHCI1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct resource ohci0_resources[] = { + [0] = { + .start = SPEAR13XX_UHC0_OHCI_BASE, + .end = SPEAR13XX_UHC0_OHCI_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_USBH_OHCI0, + .flags = IORESOURCE_IRQ, + }, +}; +static struct resource ohci1_resources[] = { + [0] = { + .start = SPEAR13XX_UHC1_OHCI_BASE, + .end = SPEAR13XX_UHC1_OHCI_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_USBH_OHCI1, + .flags = IORESOURCE_IRQ, + }, +}; + +/* usbh0_id defaults to 0, being static variable */ +static int usbh0_id; +static int usbh1_id = 1; +static u64 ehci0_dmamask = ~0; + +struct platform_device spear13xx_ehci0_device = { + .name = "spear-ehci", + .id = 0, + .dev = { + .coherent_dma_mask = ~0, + .dma_mask = &ehci0_dmamask, + .platform_data = &usbh0_id, + }, + .num_resources = ARRAY_SIZE(ehci0_resources), + .resource = ehci0_resources, +}; + +static u64 ehci1_dmamask = ~0; + +struct platform_device spear13xx_ehci1_device = { + .name = "spear-ehci", + .id = 1, + .dev = { + .coherent_dma_mask = ~0, + .dma_mask = &ehci1_dmamask, + .platform_data = &usbh1_id, + }, + .num_resources = ARRAY_SIZE(ehci1_resources), + .resource = ehci1_resources, +}; + +static u64 ohci0_dmamask = ~0; + +struct platform_device spear13xx_ohci0_device = { + .name = "spear-ohci", + .id = 0, + .dev = { + .coherent_dma_mask = ~0, + .dma_mask = &ohci0_dmamask, + .platform_data = &usbh0_id, + }, + .num_resources = ARRAY_SIZE(ohci0_resources), + .resource = ohci0_resources, +}; + +static u64 ohci1_dmamask = ~0; +struct platform_device spear13xx_ohci1_device = { + .name = "spear-ohci", + .id = 1, + .dev = { + .coherent_dma_mask = ~0, + .dma_mask = &ohci1_dmamask, + .platform_data = &usbh1_id, + }, + .num_resources = ARRAY_SIZE(ohci1_resources), + .resource = ohci1_resources, +}; + /* rtc device registration */ static struct resource rtc_resources[] = { { diff --git a/arch/arm/mach-spear3xx/include/mach/generic.h b/arch/arm/mach-spear3xx/include/mach/generic.h index 162f33b..3eb2737 100644 --- a/arch/arm/mach-spear3xx/include/mach/generic.h +++ b/arch/arm/mach-spear3xx/include/mach/generic.h @@ -33,7 +33,10 @@ /* Add spear3xx family device structure declarations here */ extern struct amba_device gpio_device; extern struct amba_device uart_device; +extern struct platform_device ehci_device; extern struct platform_device i2c_device; +extern struct platform_device ohci0_device; +extern struct platform_device ohci1_device; extern struct platform_device rtc_device; extern struct sys_timer spear3xx_timer; diff --git a/arch/arm/mach-spear3xx/spear300_evb.c b/arch/arm/mach-spear3xx/spear300_evb.c index 083f65c..3b3c6ce 100644 --- a/arch/arm/mach-spear3xx/spear300_evb.c +++ b/arch/arm/mach-spear3xx/spear300_evb.c @@ -44,7 +44,10 @@ static struct amba_device *amba_devs[] __initdata = { static struct platform_device *plat_devs[] __initdata = { /* spear3xx specific devices */ + &ehci_device, &i2c_device, + &ohci0_device, + &ohci1_device, &rtc_device, /* spear300 specific devices */ diff --git a/arch/arm/mach-spear3xx/spear310_evb.c b/arch/arm/mach-spear3xx/spear310_evb.c index 208a68ce1..d523040 100644 --- a/arch/arm/mach-spear3xx/spear310_evb.c +++ b/arch/arm/mach-spear3xx/spear310_evb.c @@ -50,7 +50,10 @@ static struct amba_device *amba_devs[] __initdata = { static struct platform_device *plat_devs[] __initdata = { /* spear3xx specific devices */ + &ehci_device, &i2c_device, + &ohci0_device, + &ohci1_device, &rtc_device, /* spear310 specific devices */ diff --git a/arch/arm/mach-spear3xx/spear320_evb.c b/arch/arm/mach-spear3xx/spear320_evb.c index 90d685e..f90a9b8 100644 --- a/arch/arm/mach-spear3xx/spear320_evb.c +++ b/arch/arm/mach-spear3xx/spear320_evb.c @@ -48,7 +48,10 @@ static struct amba_device *amba_devs[] __initdata = { static struct platform_device *plat_devs[] __initdata = { /* spear3xx specific devices */ + &ehci_device, &i2c_device, + &ohci0_device, + &ohci1_device, &rtc_device, /* spear320 specific devices */ diff --git a/arch/arm/mach-spear3xx/spear3xx.c b/arch/arm/mach-spear3xx/spear3xx.c index 22d172b..588004f 100644 --- a/arch/arm/mach-spear3xx/spear3xx.c +++ b/arch/arm/mach-spear3xx/spear3xx.c @@ -76,6 +76,86 @@ struct platform_device i2c_device = { .resource = i2c_resources, }; +/* usb host device registeration */ +static struct resource ehci_resources[] = { + [0] = { + .start = SPEAR3XX_ICM4_USB_EHCI0_1_BASE, + .end = SPEAR3XX_ICM4_USB_EHCI0_1_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_USB_H_EHCI_0, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct resource ohci0_resources[] = { + [0] = { + .start = SPEAR3XX_ICM4_USB_OHCI0_BASE, + .end = SPEAR3XX_ICM4_USB_OHCI0_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_USB_H_OHCI_0, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct resource ohci1_resources[] = { + [0] = { + .start = SPEAR3XX_ICM4_USB_OHCI1_BASE, + .end = SPEAR3XX_ICM4_USB_OHCI1_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_USB_H_OHCI_1, + .flags = IORESOURCE_IRQ, + }, +}; + +static u64 ehci_dmamask = ~0; +static int usbh_id = -1; + +struct platform_device ehci_device = { + .name = "spear-ehci", + .id = -1, + .dev = { + .coherent_dma_mask = ~0, + .dma_mask = &ehci_dmamask, + .platform_data = &usbh_id, + }, + .num_resources = ARRAY_SIZE(ehci_resources), + .resource = ehci_resources, +}; + +static u64 ohci0_dmamask = ~0; + +struct platform_device ohci0_device = { + .name = "spear-ohci", + .id = 0, + .dev = { + .coherent_dma_mask = ~0, + .dma_mask = &ohci0_dmamask, + .platform_data = &usbh_id, + }, + .num_resources = ARRAY_SIZE(ohci0_resources), + .resource = ohci0_resources, +}; + +static u64 ohci1_dmamask = ~0; + +struct platform_device ohci1_device = { + .name = "spear-ohci", + .id = 1, + .dev = { + .coherent_dma_mask = ~0, + .dma_mask = &ohci1_dmamask, + .platform_data = &usbh_id, + }, + .num_resources = ARRAY_SIZE(ohci1_resources), + .resource = ohci1_resources, +}; + /* rtc device registration */ static struct resource rtc_resources[] = { { diff --git a/arch/arm/mach-spear6xx/include/mach/generic.h b/arch/arm/mach-spear6xx/include/mach/generic.h index 44a2f99..3b15289 100644 --- a/arch/arm/mach-spear6xx/include/mach/generic.h +++ b/arch/arm/mach-spear6xx/include/mach/generic.h @@ -32,7 +32,11 @@ extern struct amba_device clcd_device; extern struct amba_device gpio_device[]; extern struct amba_device uart_device[]; +extern struct platform_device ehci0_device; +extern struct platform_device ehci1_device; extern struct platform_device i2c_device; +extern struct platform_device ohci0_device; +extern struct platform_device ohci1_device; extern struct platform_device rtc_device; extern struct sys_timer spear6xx_timer; diff --git a/arch/arm/mach-spear6xx/spear600_evb.c b/arch/arm/mach-spear6xx/spear600_evb.c index 6b0cf23..b4dfd25 100644 --- a/arch/arm/mach-spear6xx/spear600_evb.c +++ b/arch/arm/mach-spear6xx/spear600_evb.c @@ -26,7 +26,11 @@ static struct amba_device *amba_devs[] __initdata = { }; static struct platform_device *plat_devs[] __initdata = { + &ehci0_device, + &ehci1_device, &i2c_device, + &ohci0_device, + &ohci1_device, &rtc_device, }; diff --git a/arch/arm/mach-spear6xx/spear6xx.c b/arch/arm/mach-spear6xx/spear6xx.c index 646098f..94bbcdf 100644 --- a/arch/arm/mach-spear6xx/spear6xx.c +++ b/arch/arm/mach-spear6xx/spear6xx.c @@ -143,6 +143,114 @@ struct platform_device i2c_device = { .resource = i2c_resources, }; +/* usb host device registeration */ +static struct resource ehci0_resources[] = { + [0] = { + .start = SPEAR6XX_ICM4_USB_EHCI0_BASE, + .end = SPEAR6XX_ICM4_USB_EHCI0_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_USB_H_EHCI_0, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct resource ehci1_resources[] = { + [0] = { + .start = SPEAR6XX_ICM4_USB_EHCI1_BASE, + .end = SPEAR6XX_ICM4_USB_EHCI1_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_USB_H_EHCI_1, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct resource ohci0_resources[] = { + [0] = { + .start = SPEAR6XX_ICM4_USB_OHCI0_BASE, + .end = SPEAR6XX_ICM4_USB_OHCI0_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_USB_H_OHCI_0, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct resource ohci1_resources[] = { + [0] = { + .start = SPEAR6XX_ICM4_USB_OHCI1_BASE, + .end = SPEAR6XX_ICM4_USB_OHCI1_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_USB_H_OHCI_1, + .flags = IORESOURCE_IRQ, + }, +}; + +/* usbh0_id defaults to 0, being static variable */ +static int usbh0_id; +static int usbh1_id = 1; +static u64 ehci0_dmamask = ~0; + +struct platform_device ehci0_device = { + .name = "spear-ehci", + .id = 0, + .dev = { + .coherent_dma_mask = ~0, + .dma_mask = &ehci0_dmamask, + .platform_data = &usbh0_id, + }, + .num_resources = ARRAY_SIZE(ehci0_resources), + .resource = ehci0_resources, +}; + +static u64 ehci1_dmamask = ~0; + +struct platform_device ehci1_device = { + .name = "spear-ehci", + .id = 1, + .dev = { + .coherent_dma_mask = ~0, + .dma_mask = &ehci1_dmamask, + .platform_data = &usbh1_id, + }, + .num_resources = ARRAY_SIZE(ehci1_resources), + .resource = ehci1_resources, +}; + +static u64 ohci0_dmamask = ~0; + +struct platform_device ohci0_device = { + .name = "spear-ohci", + .id = 0, + .dev = { + .coherent_dma_mask = ~0, + .dma_mask = &ohci0_dmamask, + .platform_data = &usbh0_id, + }, + .num_resources = ARRAY_SIZE(ohci0_resources), + .resource = ohci0_resources, +}; + +static u64 ohci1_dmamask = ~0; + +struct platform_device ohci1_device = { + .name = "spear-ohci", + .id = 1, + .dev = { + .coherent_dma_mask = ~0, + .dma_mask = &ohci1_dmamask, + .platform_data = &usbh1_id, + }, + .num_resources = ARRAY_SIZE(ohci1_resources), + .resource = ohci1_resources, +}; + /* rtc device registration */ static struct resource rtc_resources[] = { {