diff options
author | Suresh Mangipudi <smangipudi@nvidia.com> | 2011-01-18 10:03:50 +0530 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-04-26 15:50:04 -0700 |
commit | a145bffe83da03ddebfb82f05c5d6242b9f52bfe (patch) | |
tree | 3703023b60a5c04453335d75190e1335679c335a | |
parent | 2884c6855bc7af2ff398e695fbc4491d44a9d696 (diff) |
[tegra/usb] Enable USB host.
Enabling USB host.
Bug 770363
Reviewed-on: http://git-master/r/15792
(cherry picked from commit b71c1a6c5d22ee6053405cf26520d080e439018c)
Original-Change-Id: Iff2c12453cf1efa7ee523d125a3c0b429c292ff2
Reviewed-on: http://git-master/r/16684
Reviewed-by: Suresh Mangipudi <smangipudi@nvidia.com>
Tested-by: Suresh Mangipudi <smangipudi@nvidia.com>
Reviewed-by: Scott Williams <scwilliams@nvidia.com>
Change-Id: I31ce16b026dc50016aed7fbe1722354c4c061437
-rw-r--r-- | arch/arm/mach-tegra/board-aruba.c | 30 | ||||
-rw-r--r-- | arch/arm/mach-tegra/usb_phy.c | 27 | ||||
-rw-r--r-- | drivers/usb/host/ehci-tegra.c | 4 |
3 files changed, 34 insertions, 27 deletions
diff --git a/arch/arm/mach-tegra/board-aruba.c b/arch/arm/mach-tegra/board-aruba.c index 13c8ddd72e33..1998f0af82aa 100644 --- a/arch/arm/mach-tegra/board-aruba.c +++ b/arch/arm/mach-tegra/board-aruba.c @@ -54,7 +54,7 @@ #include "gpio-names.h" #include "fuse.h" -#define ENABLE_USB_HOST 0 +#define ENABLE_OTG 0 static struct plat_serial8250_port debug_uart_platform_data[] = { { @@ -103,7 +103,6 @@ static struct tegra_utmip_config utmi_phy_config[] = { /* !!!FIXME!!! THESE ARE VENTANA SETTINGS */ static struct tegra_ulpi_config ulpi_phy_config = { - .reset_gpio = TEGRA_GPIO_PG2, // !!!FIXME!!! CABLE DETECT? if so GPIO_PC7 on aruba .clk = "clk_dev2", }; @@ -209,17 +208,6 @@ static struct i2c_board_info __initdata aruba_i2c_bus1_board_info[] = { }, }; -static struct tegra_ulpi_config aruba_ehci2_ulpi_phy_config = { - .reset_gpio = TEGRA_GPIO_PV1, - .clk = "clk_dev2", -}; - -static struct tegra_ehci_platform_data aruba_ehci2_ulpi_platform_data = { - .operating_mode = TEGRA_USB_HOST, - .power_down_on_bus_suspend = 0, - .phy_config = &aruba_ehci2_ulpi_phy_config, -}; - static struct tegra_i2c_platform_data aruba_i2c1_platform_data = { .adapter_nr = 0, .bus_count = 1, @@ -420,7 +408,7 @@ struct platform_device tegra_nand_device = { #endif static struct platform_device *aruba_devices[] __initdata = { -#if ENABLE_USB_HOST +#if ENABLE_OTG &tegra_otg_device, #endif &androidusb_device, @@ -432,9 +420,6 @@ static struct platform_device *aruba_devices[] __initdata = { &pmu_device, &tegra_rtc_device, &tegra_udc_device, -#if ENABLE_USB_HOST - &tegra_ehci2_device, -#endif #if defined(CONFIG_TEGRA_IOVMM_SMMU) &tegra_smmu_device, #endif @@ -482,13 +467,12 @@ static struct tegra_ehci_platform_data tegra_ehci_pdata[] = { }, }; -#if ENABLE_USB_HOST + static void aruba_usb_init(void) { - tegra_ehci3_device.dev.platform_data=&tegra_ehci_pdata[2]; - platform_device_register(&tegra_ehci3_device); + tegra_ehci2_device.dev.platform_data=&tegra_ehci_pdata[1]; + platform_device_register(&tegra_ehci2_device); } -#endif struct platform_device *tegra_usb_otg_host_register(void) { @@ -555,8 +539,6 @@ static void __init tegra_aruba_init(void) snprintf(serial, sizeof(serial), "%llx", tegra_chip_uid()); andusb_plat.serial_number = kstrdup(serial, GFP_KERNEL); tegra_audio_device.dev.platform_data = &tegra_audio_pdata[0]; - tegra_ehci2_device.dev.platform_data - = &aruba_ehci2_ulpi_platform_data; platform_add_devices(aruba_devices, ARRAY_SIZE(aruba_devices)); aruba_sdhci_init(); @@ -564,9 +546,7 @@ static void __init tegra_aruba_init(void) aruba_regulator_init(); aruba_touch_init(); aruba_keys_init(); -#if ENABLE_USB_HOST aruba_usb_init(); -#endif aruba_panel_init(); aruba_sensors_init(); aruba_bt_rfkill(); diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c index aab545304bfe..423872cf62d5 100644 --- a/arch/arm/mach-tegra/usb_phy.c +++ b/arch/arm/mach-tegra/usb_phy.c @@ -291,8 +291,12 @@ #define HOSTPC1_DEVLC 0x1b4 #define HOSTPC1_DEVLC_PHCD (1 << 22) -#define HOSTPC1_DEVLC_PTS(x) (((x) & 0x1f) << 29) +#define HOSTPC1_DEVLC_PTS(x) (((x) & 0x7) << 29) #define HOSTPC1_DEVLC_STS (1 << 28) + +#define TEGRA_USB_USBMODE_REG_OFFSET 0x1f8 +#define TEGRA_USB_USBMODE_HOST (3 << 0) + #endif static DEFINE_SPINLOCK(utmip_pad_lock); @@ -867,10 +871,11 @@ static int ulpi_phy_power_on(struct tegra_usb_phy *phy) void __iomem *base = phy->regs; struct tegra_ulpi_config *config = phy->config; +#if CONFIG_ARCH_TEGRA_2x_SOC gpio_direction_output(config->reset_gpio, 0); msleep(5); gpio_direction_output(config->reset_gpio, 1); - +#endif clk_enable(phy->clk); msleep(1); @@ -878,6 +883,20 @@ static int ulpi_phy_power_on(struct tegra_usb_phy *phy) val |= UHSIC_RESET; writel(val, base + USB_SUSP_CTRL); +#ifdef CONFIG_ARCH_TEGRA_3x_SOC + val = readl(base + USB_SUSP_CTRL); + val |= UTMIP_RESET; + writel(val, base + USB_SUSP_CTRL); + + val = readl(base + TEGRA_USB_USBMODE_REG_OFFSET); + writel((val | TEGRA_USB_USBMODE_HOST), + (base + TEGRA_USB_USBMODE_REG_OFFSET)); + + val = readl(base + HOSTPC1_DEVLC); + val |= HOSTPC1_DEVLC_PTS(2); + writel(val, base + HOSTPC1_DEVLC); +#endif + val = readl(base + ULPI_TIMING_CTRL_0); val |= ULPI_OUTPUT_PINMUX_BYP | ULPI_CLKOUT_PINMUX_BYP; writel(val, base + ULPI_TIMING_CTRL_0); @@ -948,7 +967,9 @@ static void ulpi_phy_power_off(struct tegra_usb_phy *phy) writel(val, base + HOSTPC1_DEVLC); #endif +#ifdef CONFIG_ARCH_TEGRA_2x_SOC gpio_direction_output(config->reset_gpio, 0); +#endif clk_disable(phy->clk); } @@ -1259,9 +1280,11 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs, err = -ENXIO; goto err1; } +#ifdef CONFIG_ARCH_TEGRA_2x_SOC tegra_gpio_enable(ulpi_config->reset_gpio); gpio_request(ulpi_config->reset_gpio, "ulpi_phy_reset_b"); gpio_direction_output(ulpi_config->reset_gpio, 0); +#endif phy->ulpi = otg_ulpi_create(&ulpi_viewport_access_ops, 0); phy->ulpi->io_priv = regs + ULPI_VIEWPORT; diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c index 7de2a0ca28a6..8c4ec25a9ad3 100644 --- a/drivers/usb/host/ehci-tegra.c +++ b/drivers/usb/host/ehci-tegra.c @@ -475,6 +475,10 @@ static int tegra_ehci_setup(struct usb_hcd *hcd) /* cache this readonly data; minimize chip reads */ ehci->hcs_params = readl(&ehci->caps->hcs_params); +#ifndef CONFIG_ARCH_TEGRA_2x_SOC + ehci->has_hostpc = 1; +#endif + /* switch to host mode */ hcd->has_tt = 1; ehci_reset(ehci); |