From 817e84cce24b1b3fb972c247234a31b18e0bd546 Mon Sep 17 00:00:00 2001 From: Benoit Goby Date: Mon, 12 Jul 2010 15:31:22 -0700 Subject: [PATCH] [ARM] tegra: stingray: Add USB host devices Change-Id: I6775193fa1c8f7ddf3bb38d0addc29b8e5dbac2d Signed-off-by: Benoit Goby --- arch/arm/mach-tegra/board-stingray.c | 118 ++++++++++++++++++++++++--- arch/arm/mach-tegra/tegra2_clocks.c | 1 + 2 files changed, 109 insertions(+), 10 deletions(-) diff --git a/arch/arm/mach-tegra/board-stingray.c b/arch/arm/mach-tegra/board-stingray.c index 9410c8be5730..1bf1127fced1 100644 --- a/arch/arm/mach-tegra/board-stingray.c +++ b/arch/arm/mach-tegra/board-stingray.c @@ -182,10 +182,9 @@ static struct platform_device hs_uarte = { }; /* OTG gadget device */ -static u64 tegra_otg_dmamask = DMA_BIT_MASK(32); +static u64 tegra_gadget_dmamask = DMA_BIT_MASK(32); - -static struct resource tegra_otg_resources[] = { +static struct resource tegra_gadget_resources[] = { [0] = { .start = TEGRA_USB_BASE, .end = TEGRA_USB_BASE + TEGRA_USB_SIZE - 1, @@ -198,21 +197,117 @@ static struct resource tegra_otg_resources[] = { }, }; -static struct fsl_usb2_platform_data tegra_otg_pdata = { +static struct fsl_usb2_platform_data tegra_gadget_pdata = { .operating_mode = FSL_USB2_DR_DEVICE, .phy_mode = FSL_USB2_PHY_UTMI, }; -static struct platform_device tegra_otg = { +static struct platform_device tegra_gadget = { .name = "fsl-tegra-udc", .id = -1, .dev = { - .dma_mask = &tegra_otg_dmamask, + .dma_mask = &tegra_gadget_dmamask, .coherent_dma_mask = 0xffffffff, - .platform_data = &tegra_otg_pdata, + .platform_data = &tegra_gadget_pdata, + }, + .resource = tegra_gadget_resources, + .num_resources = ARRAY_SIZE(tegra_gadget_resources), +}; + +/* OTG transceiver */ +static struct resource cpcap_otg_resources[] = { + [0] = { + .start = TEGRA_USB_BASE, + .end = TEGRA_USB_BASE + TEGRA_USB_SIZE - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = INT_USB, + .end = INT_USB, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device cpcap_otg = { + .name = "cpcap-otg", + .id = -1, + .resource = cpcap_otg_resources, + .num_resources = ARRAY_SIZE(cpcap_otg_resources), +}; + +/* USB host devices */ +static u64 tegra_hcd_dmamask = DMA_BIT_MASK(32); + +static struct resource tegra_hcd_resources[][2] = { + [0] = { + [0] = { + .flags = IORESOURCE_MEM, + .start = TEGRA_USB_BASE, + .end = TEGRA_USB_BASE + TEGRA_USB_SIZE - 1, + }, + [1] = { + .flags = IORESOURCE_IRQ, + .start = INT_USB, + .end = INT_USB, + }, + }, + [1] = { + [0] = { + .flags = IORESOURCE_MEM, + .start = TEGRA_USB2_BASE, + .end = TEGRA_USB2_BASE + TEGRA_USB2_SIZE - 1, + }, + [1] = { + .flags = IORESOURCE_IRQ, + .start = INT_USB2, + .end = INT_USB2, + }, + }, + [2] = { + [0] = { + .flags = IORESOURCE_MEM, + .start = TEGRA_USB3_BASE, + .end = TEGRA_USB3_BASE + TEGRA_USB3_SIZE - 1, + }, + [1] = { + .flags = IORESOURCE_IRQ, + .start = INT_USB3, + .end = INT_USB3, + }, + }, +}; + +static struct platform_device tegra_hcd[] = { + [0] = { + .name = "tegra-ehci", + .id = 0, + .dev = { + .coherent_dma_mask = DMA_BIT_MASK(32), + .dma_mask = &tegra_hcd_dmamask, + }, + .resource = tegra_hcd_resources[0], + .num_resources = ARRAY_SIZE(tegra_hcd_resources[0]), + }, + [1] = { + .name = "tegra-ehci", + .id = 1, + .dev = { + .coherent_dma_mask = DMA_BIT_MASK(32), + .dma_mask = &tegra_hcd_dmamask, + }, + .resource = tegra_hcd_resources[1], + .num_resources = ARRAY_SIZE(tegra_hcd_resources[1]), + }, + [2] = { + .name = "tegra-ehci", + .id = 2, + .dev = { + .coherent_dma_mask = DMA_BIT_MASK(32), + .dma_mask = &tegra_hcd_dmamask, + }, + .resource = tegra_hcd_resources[2], + .num_resources = ARRAY_SIZE(tegra_hcd_resources[2]), }, - .resource = tegra_otg_resources, - .num_resources = ARRAY_SIZE(tegra_otg_resources), }; static char *usb_functions[] = { "mtp" }; @@ -378,7 +473,10 @@ static struct tegra_w1_platform_data tegra_w1_pdata = { static struct platform_device *stingray_devices[] __initdata = { &debug_uart, - &tegra_otg, + &cpcap_otg, + &tegra_gadget, + &tegra_hcd[0], + &tegra_hcd[2], &bq24617_device, &bcm4329_rfkill, &hs_uarta, diff --git a/arch/arm/mach-tegra/tegra2_clocks.c b/arch/arm/mach-tegra/tegra2_clocks.c index 59ca5b0ec412..5e32c0efb87f 100644 --- a/arch/arm/mach-tegra/tegra2_clocks.c +++ b/arch/arm/mach-tegra/tegra2_clocks.c @@ -1868,6 +1868,7 @@ struct clk_duplicate tegra_clk_duplicates[] = { CLK_DUPLICATE("pwm", "tegra_pwm.1", NULL), CLK_DUPLICATE("pwm", "tegra_pwm.2", NULL), CLK_DUPLICATE("pwm", "tegra_pwm.3", NULL), + CLK_DUPLICATE("usbd", "cpcap-otg", NULL), }; #define CLK(dev, con, ck) \ -- 2.34.1