arm: tegra: usb_phy: Link ULPI platform data
Venkatajagadish [Fri, 13 Jul 2012 08:45:26 +0000 (13:45 +0530)]
This change provides required platform data to enable
link ULPI

Bug 986684

Change-Id: I8c0564e89b50d710fe4fc52b530d13edb4603bf0
Signed-off-by: Venkatajagadish <vjagadish@nvidia.com>
Reviewed-on: http://git-master/r/116373
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

arch/arm/mach-tegra/board-curacao.c

index fe5df12..4336ca3 100644 (file)
@@ -406,23 +406,27 @@ static int __init curacao_touch_init(void)
        return 0;
 }
 
-static struct tegra_usb_platform_data tegra_udc_pdata = {
+
+#if defined(USB_HOST_ONLY)
+static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
        .port_otg = true,
        .has_hostpc = true,
+       .unaligned_dma_buf_supported = true,
        .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
-       .op_mode = TEGRA_USB_OPMODE_DEVICE,
-       .u_data.dev = {
-               .vbus_pmu_irq = 0,
+       .op_mode = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
                .vbus_gpio = -1,
-               .charging_supported = false,
-               .remote_wakeup_supported = false,
+               .vbus_reg = "vdd_vbus_micro_usb",
+               .hot_plug = true,
+               .remote_wakeup_supported = true,
+               .power_off_on_suspend = true,
        },
        .u_cfg.utmi = {
                .hssync_start_delay = 0,
                .elastic_limit = 16,
                .idle_wait_delay = 17,
                .term_range_adj = 6,
-               .xcvr_setup = 8,
+               .xcvr_setup = 15,
                .xcvr_lsfslew = 2,
                .xcvr_lsrslew = 2,
                .xcvr_setup_offset = 0,
@@ -430,32 +434,73 @@ static struct tegra_usb_platform_data tegra_udc_pdata = {
        },
 };
 
-#if defined(USB_HOST_ONLY)
-static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
-       .port_otg = true,
+
+static void ulpi_link_platform_open(void)
+{
+       int reset_gpio = TEGRA_GPIO_PV1;
+
+       gpio_request(reset_gpio, "ulpi_phy_reset");
+       gpio_direction_output(reset_gpio, 0);
+       tegra_gpio_enable(reset_gpio);
+
+       gpio_direction_output(reset_gpio, 0);
+       msleep(5);
+       gpio_direction_output(reset_gpio, 1);
+}
+
+static struct tegra_usb_phy_platform_ops ulpi_link_plat_ops = {
+       .open = ulpi_link_platform_open,
+};
+
+static struct tegra_usb_platform_data tegra_ehci2_ulpi_link_pdata = {
+       .port_otg = false,
        .has_hostpc = true,
        .unaligned_dma_buf_supported = true,
-       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
-       .op_mode = TEGRA_USB_OPMODE_HOST,
+       .phy_intf = TEGRA_USB_PHY_INTF_ULPI_LINK,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
        .u_data.host = {
                .vbus_gpio = -1,
-               .vbus_reg = "vdd_vbus_micro_usb",
-               .hot_plug = true,
-               .remote_wakeup_supported = true,
+               .vbus_reg = NULL,
+               .hot_plug = false,
+               .remote_wakeup_supported = false,
                .power_off_on_suspend = true,
        },
+       .u_cfg.ulpi = {
+               .shadow_clk_delay = 10,
+               .clock_out_delay = 1,
+               .data_trimmer = 4,
+               .stpdirnxt_trimmer = 4,
+               .dir_trimmer = 4,
+               .clk = "cdev2",
+       },
+       .ops = &ulpi_link_plat_ops,
+};
+#else
+
+static struct tegra_usb_platform_data tegra_udc_pdata = {
+       .port_otg = true,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode = TEGRA_USB_OPMODE_DEVICE,
+       .u_data.dev = {
+               .vbus_pmu_irq = 0,
+               .vbus_gpio = -1,
+               .charging_supported = false,
+               .remote_wakeup_supported = false,
+       },
        .u_cfg.utmi = {
                .hssync_start_delay = 0,
                .elastic_limit = 16,
                .idle_wait_delay = 17,
                .term_range_adj = 6,
-               .xcvr_setup = 15,
+               .xcvr_setup = 8,
                .xcvr_lsfslew = 2,
                .xcvr_lsrslew = 2,
                .xcvr_setup_offset = 0,
                .xcvr_use_fuses = 1,
        },
 };
+
 #endif
 
 static void curacao_usb_init(void)
@@ -463,6 +508,9 @@ static void curacao_usb_init(void)
 #if defined(USB_HOST_ONLY)
        tegra_ehci1_device.dev.platform_data = &tegra_ehci1_utmi_pdata;
        platform_device_register(&tegra_ehci1_device);
+
+       tegra_ehci2_device.dev.platform_data = &tegra_ehci2_ulpi_link_pdata;
+       platform_device_register(&tegra_ehci2_device);
 #else
        /* setup the udc platform data */
        tegra_udc_device.dev.platform_data = &tegra_udc_pdata;