usb: tegra: modify USB platform data structures
Rakesh Bodla [Thu, 31 May 2012 10:30:06 +0000 (15:30 +0530)]
Modify USB structures of platform data. Based on the new
platform data structures modifying the initialization in
board files.

Bug 887361

Change-Id: I49c9ea9888f743408f4f86005b8ed368b98500e7
Reviewed-on: http://git-master/r/103597

Signed-off-by: Rakesh Bodla <rbodla@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>

18 files changed:
arch/arm/mach-tegra/baseband-xmm-power.c
arch/arm/mach-tegra/board-cardhu.c
arch/arm/mach-tegra/board-dt-tegra20.c
arch/arm/mach-tegra/board-enterprise-baseband.c
arch/arm/mach-tegra/board-enterprise.c
arch/arm/mach-tegra/board-harmony.c
arch/arm/mach-tegra/board-kai.c
arch/arm/mach-tegra/board-p1852.c
arch/arm/mach-tegra/board-ventana.c
arch/arm/mach-tegra/board-whistler-baseband.c
arch/arm/mach-tegra/board-whistler.c
arch/arm/mach-tegra/devices.c
arch/arm/mach-tegra/devices.h
arch/arm/mach-tegra/include/mach/usb_phy.h
arch/arm/mach-tegra/p852/board-p852.c
arch/arm/mach-tegra/usb_phy.c
drivers/misc/tegra-baseband/bb-m7400.c
include/linux/platform_data/tegra_usb.h

index f2fa6d0..da7434b 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/suspend.h>
 #include <linux/pm_qos.h>
 #include <mach/usb_phy.h>
+#include <linux/regulator/consumer.h>
 #include "board.h"
 #include "board-enterprise.h"
 #include "devices.h"
index 94e7871..bbf74ec 100644 (file)
@@ -89,43 +89,6 @@ static struct tegra_thermal_data thermal_data = {
 #endif
 };
 
-/* !!!TODO: Change for cardhu (Taken from Ventana) */
-static struct tegra_utmip_config utmi_phy_config[] = {
-       [0] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 15,
-                       .xcvr_setup_offset = 0,
-                       .xcvr_use_fuses = 1,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-       [1] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 15,
-                       .xcvr_setup_offset = 0,
-                       .xcvr_use_fuses = 1,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-       [2] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 8,
-                       .xcvr_setup_offset = 0,
-                       .xcvr_use_fuses = 1,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-};
-
 static struct resource cardhu_bcm4329_rfkill_resources[] = {
        {
                .name   = "bcm4329_nshutdown_gpio",
@@ -867,135 +830,287 @@ static int __init cardhu_touch_init(void)
        return 0;
 }
 
-static struct tegra_uhsic_config uhsic_phy_config = {
-       .enable_gpio = EN_HSIC_GPIO,
-       .reset_gpio = -1,
-       .sync_start_delay = 9,
-       .idle_wait_delay = 17,
-       .term_range_adj = 0,
-       .elastic_underrun_limit = 16,
-       .elastic_overrun_limit = 16,
-};
-
-static struct tegra_ehci_platform_data tegra_ehci_uhsic_pdata = {
-       .phy_type = TEGRA_USB_PHY_TYPE_HSIC,
-       .phy_config = &uhsic_phy_config,
-       .operating_mode = TEGRA_USB_HOST,
-       .power_down_on_bus_suspend = 1,
-       .default_enable = true,
-};
-
-static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
-       [0] = {
-                       .phy_config = &utmi_phy_config[0],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-                       .default_enable = true,
-       },
-       [1] = {
-                       .phy_config = &utmi_phy_config[1],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-                       .default_enable = true,
-       },
-       [2] = {
-                       .phy_config = &utmi_phy_config[2],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-                       .hotplug = 1,
-                       .default_enable = true,
-       },
-};
-
-static struct tegra_otg_platform_data tegra_otg_pdata = {
-       .ehci_device = &tegra_ehci1_device,
-       .ehci_pdata = &tegra_ehci_pdata[0],
-};
-
-#ifdef CONFIG_USB_SUPPORT
-static struct usb_phy_plat_data tegra_usb_phy_pdata[] = {
-       [0] = {
-                       .instance = 0,
-                       .vbus_gpio = -1,
-                       .vbus_reg_supply = "vdd_vbus_micro_usb",
-       },
-       [1] = {
-                       .instance = 1,
-                       .vbus_gpio = -1,
-       },
-       [2] = {
-                       .instance = 2,
-                       .vbus_gpio = -1,
-                       .vbus_reg_supply = "vdd_vbus_typea_usb",
-       },
-};
-
-static int cardhu_usb_hsic_postsupend(void)
+static void cardu_usb_hsic_postsupend(void)
 {
 #ifdef CONFIG_TEGRA_BB_XMM_POWER
        baseband_xmm_set_power_status(BBXMM_PS_L2);
 #endif
-       return 0;
 }
 
-static int cardhu_usb_hsic_preresume(void)
+static void cardu_usb_hsic_preresume(void)
 {
 #ifdef CONFIG_TEGRA_BB_XMM_POWER
        baseband_xmm_set_power_status(BBXMM_PS_L2TOL0);
 #endif
-       return 0;
 }
 
-static int cardhu_usb_hsic_phy_ready(void)
+static void cardu_usb_hsic_phy_ready(void)
 {
 #ifdef CONFIG_TEGRA_BB_XMM_POWER
        baseband_xmm_set_power_status(BBXMM_PS_L0);
 #endif
-       return 0;
 }
 
-static int cardhu_usb_hsic_phy_off(void)
+static void cardu_usb_hsic_phy_off(void)
 {
 #ifdef CONFIG_TEGRA_BB_XMM_POWER
        baseband_xmm_set_power_status(BBXMM_PS_L3);
 #endif
-       return 0;
 }
 
+static struct tegra_usb_phy_platform_ops hsic_xmm_plat_ops = {
+       .post_suspend = cardu_usb_hsic_postsupend,
+       .pre_resume = cardu_usb_hsic_preresume,
+       .port_power = cardu_usb_hsic_phy_ready,
+       .post_phy_off = cardu_usb_hsic_phy_off,
+};
+
+static struct tegra_usb_platform_data tegra_ehci2_hsic_xmm_pdata = {
+       .port_otg = false,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_HSIC,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .hot_plug = false,
+               .remote_wakeup_supported = false,
+               .power_off_on_suspend = false,
+       },
+       .u_cfg.hsic = {
+               .sync_start_delay = 9,
+               .idle_wait_delay = 17,
+               .term_range_adj = 0,
+               .elastic_underrun_limit = 16,
+               .elastic_overrun_limit = 16,
+       },
+       .ops = &hsic_xmm_plat_ops,
+};
+
+
+static int hsic_enable_gpio = -1;
+static int hsic_reset_gpio = -1;
+
+void hsic_platform_open(void)
+{
+       int reset_gpio = 0, enable_gpio = 0;
+
+       if (hsic_enable_gpio != -1)
+               enable_gpio = gpio_request(hsic_enable_gpio, "uhsic_enable");
+       if (hsic_reset_gpio != -1)
+               reset_gpio = gpio_request(hsic_reset_gpio, "uhsic_reset");
+       /* hsic enable signal deasserted, hsic reset asserted */
+       if (!enable_gpio)
+               gpio_direction_output(hsic_enable_gpio, 0 /* deasserted */);
+       if (!reset_gpio)
+               gpio_direction_output(hsic_reset_gpio, 0 /* asserted */);
+       if (!enable_gpio)
+               tegra_gpio_enable(hsic_enable_gpio);
+       if (!reset_gpio)
+               tegra_gpio_enable(hsic_reset_gpio);
+       /* keep hsic reset asserted for 1 ms */
+       udelay(1000);
+       /* enable (power on) hsic */
+       if (!enable_gpio)
+               gpio_set_value_cansleep(hsic_enable_gpio, 1);
+       udelay(1000);
+       /* deassert reset */
+       if (!reset_gpio)
+               gpio_set_value_cansleep(hsic_reset_gpio, 1);
+
+}
+
+void hsic_platform_close(void)
+{
+       if (hsic_enable_gpio != -1) {
+               gpio_set_value(hsic_enable_gpio, 0);
+               gpio_free(hsic_enable_gpio);
+       }
+       if (hsic_reset_gpio != -1) {
+               gpio_set_value(hsic_reset_gpio, 0);
+               gpio_free(hsic_reset_gpio);
+       }
+}
+
+void hsic_power_on(void)
+{
+       if (hsic_enable_gpio != -1) {
+               gpio_set_value_cansleep(hsic_enable_gpio, 1);
+               udelay(1000);
+       }
+}
+
+void hsic_power_off(void)
+{
+       if (hsic_enable_gpio != -1) {
+               gpio_set_value_cansleep(hsic_enable_gpio, 0);
+               udelay(1000);
+       }
+}
+
+static struct tegra_usb_phy_platform_ops hsic_plat_ops = {
+       .open = hsic_platform_open,
+       .close = hsic_platform_close,
+       .pre_phy_on = hsic_power_on,
+       .post_phy_off = hsic_power_off,
+};
+
+static struct tegra_usb_platform_data tegra_ehci2_hsic_pdata = {
+       .port_otg = false,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_HSIC,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .hot_plug = false,
+               .remote_wakeup_supported = false,
+               .power_off_on_suspend = false,
+       },
+       .u_cfg.hsic = {
+               .sync_start_delay = 9,
+               .idle_wait_delay = 17,
+               .term_range_adj = 0,
+               .elastic_underrun_limit = 16,
+               .elastic_overrun_limit = 16,
+       },
+       .ops = &hsic_plat_ops,
+};
+
+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 = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
+       },
+};
+
+static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
+       .port_otg = true,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .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,
+               .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 = 15,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
+       },
+};
+
+static struct tegra_usb_platform_data tegra_ehci2_utmi_pdata = {
+       .port_otg = false,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .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 = 15,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
+       },
+};
+
+static struct tegra_usb_platform_data tegra_ehci3_utmi_pdata = {
+       .port_otg = false,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .vbus_reg = "vdd_vbus_typea_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_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
+       },
+};
+
+static struct tegra_usb_otg_data tegra_otg_pdata = {
+       .ehci_device = &tegra_ehci1_device,
+       .ehci_pdata = &tegra_ehci1_utmi_pdata,
+};
+
+#if CONFIG_USB_SUPPORT
 static void cardhu_usb_init(void)
 {
        struct board_info bi;
 
        tegra_get_board_info(&bi);
 
-       tegra_usb_phy_init(tegra_usb_phy_pdata,
-                       ARRAY_SIZE(tegra_usb_phy_pdata));
-
+       /* OTG should be the first to be registered */
        tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
        platform_device_register(&tegra_otg_device);
+
+       /* setup the udc platform data */
+       tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
+
        if (bi.board_id == BOARD_PM267) {
-               uhsic_phy_config.reset_gpio =
-                       PM267_SMSC4640_HSIC_HUB_RESET_GPIO;
-               tegra_ehci2_device.dev.platform_data = &tegra_ehci_uhsic_pdata;
+               hsic_enable_gpio = EN_HSIC_GPIO;
+               hsic_reset_gpio = PM267_SMSC4640_HSIC_HUB_RESET_GPIO;
+               tegra_ehci2_device.dev.platform_data = &tegra_ehci2_hsic_pdata;
                platform_device_register(&tegra_ehci2_device);
        } else if (bi.board_id == BOARD_E1256) {
-               tegra_ehci2_device.dev.platform_data = &tegra_ehci_uhsic_pdata;
+               hsic_enable_gpio = EN_HSIC_GPIO;
+               tegra_ehci2_device.dev.platform_data = &tegra_ehci2_hsic_pdata;
                platform_device_register(&tegra_ehci2_device);
        } else if (bi.board_id == BOARD_E1186) {
-               /* for baseband devices do not switch off phy during suspend */
-               tegra_ehci_uhsic_pdata.power_down_on_bus_suspend = 0;
-               uhsic_phy_config.postsuspend = cardhu_usb_hsic_postsupend;
-               uhsic_phy_config.preresume = cardhu_usb_hsic_preresume;
-               uhsic_phy_config.usb_phy_ready = cardhu_usb_hsic_phy_ready;
-               uhsic_phy_config.post_phy_off = cardhu_usb_hsic_phy_off;
-               tegra_ehci2_device.dev.platform_data = &tegra_ehci_uhsic_pdata;
-               /* baseband registration happens in baseband-xmm-power  */
+               tegra_ehci2_device.dev.platform_data =
+                                               &tegra_ehci2_hsic_xmm_pdata;
+               /* ehci2 registration happens in baseband-xmm-power  */
        } else {
-               tegra_ehci2_device.dev.platform_data = &tegra_ehci_pdata[1];
+               tegra_ehci2_device.dev.platform_data = &tegra_ehci2_utmi_pdata;
                platform_device_register(&tegra_ehci2_device);
        }
 
-       tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata[2];
+       tegra_ehci3_device.dev.platform_data = &tegra_ehci3_utmi_pdata;
        platform_device_register(&tegra_ehci3_device);
 
 }
index 0952494..0d7878c 100644 (file)
@@ -67,12 +67,9 @@ struct of_dev_auxdata tegra20_auxdata_lookup[] __initdata = {
        OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S1_BASE, "tegra-i2s.0", NULL),
        OF_DEV_AUXDATA("nvidia,tegra20-i2s", TEGRA_I2S2_BASE, "tegra-i2s.1", NULL),
        OF_DEV_AUXDATA("nvidia,tegra20-das", TEGRA_APB_MISC_DAS_BASE, "tegra-das", NULL),
-       OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB_BASE, "tegra-ehci.0",
-                      &tegra_ehci1_pdata),
-       OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB2_BASE, "tegra-ehci.1",
-                      &tegra_ehci2_pdata),
-       OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB3_BASE, "tegra-ehci.2",
-                      &tegra_ehci3_pdata),
+       OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB_BASE, "tegra-ehci.0", NULL),
+       OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB2_BASE, "tegra-ehci.1", NULL),
+       OF_DEV_AUXDATA("nvidia,tegra20-ehci", TEGRA_USB3_BASE, "tegra-ehci.2", NULL),
        {}
 };
 
index 7f01698..e8fe460 100644 (file)
@@ -71,35 +71,42 @@ static struct gpio modem_gpios[] = {
        {ULPI_D1, GPIOF_OUT_INIT_LOW, "ULPI_D1"},
 };
 
-static int baseband_phy_on(void);
-static int baseband_phy_off(void);
-static void baseband_phy_restore_start(void);
-static void baseband_phy_restore_end(void);
+static void baseband_phy_init(void);
+static void baseband_phy_on(void);
+static void baseband_phy_off(void);
 
-static struct tegra_ulpi_trimmer e1219_trimmer = { 10, 1, 1, 1 };
-
-static struct tegra_ulpi_config ehci2_null_ulpi_phy_config = {
-       .trimmer = &e1219_trimmer,
-       .post_phy_on = baseband_phy_on,
+static struct tegra_usb_phy_platform_ops ulpi_null_plat_ops = {
+       .init = baseband_phy_init,
        .pre_phy_off = baseband_phy_off,
-       .phy_restore_start = baseband_phy_restore_start,
-       .phy_restore_end = baseband_phy_restore_end,
-       .phy_restore_gpio = MDM2AP_ACK,
-       .ulpi_dir_gpio = ULPI_DIR,
-       .ulpi_d0_gpio = ULPI_D0,
-       .ulpi_d1_gpio = ULPI_D1,
+       .post_phy_on = baseband_phy_on,
 };
 
-static struct tegra_ehci_platform_data ehci2_null_ulpi_platform_data = {
-       .operating_mode = TEGRA_USB_HOST,
-       .power_down_on_bus_suspend = 0,
-       .phy_config = &ehci2_null_ulpi_phy_config,
-       .phy_type = TEGRA_USB_PHY_TYPE_NULL_ULPI,
+static struct tegra_usb_platform_data tegra_ehci2_ulpi_null_pdata = {
+       .port_otg = false,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_ULPI_NULL,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .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 = 1,
+               .stpdirnxt_trimmer = 1,
+               .dir_trimmer = 1,
+               .clk = NULL,
+       },
+       .ops = &ulpi_null_plat_ops,
 };
 
 static int __init tegra_null_ulpi_init(void)
 {
-       tegra_ehci2_device.dev.platform_data = &ehci2_null_ulpi_platform_data;
+       tegra_ehci2_device.dev.platform_data = &tegra_ehci2_ulpi_null_pdata;
        platform_device_register(&tegra_ehci2_device);
        return 0;
 }
@@ -118,7 +125,7 @@ static irqreturn_t mdm_start_thread(int irq, void *data)
        return IRQ_HANDLED;
 }
 
-static int baseband_phy_on(void)
+static void baseband_phy_init(void)
 {
        static bool phy_init = false;
 
@@ -128,22 +135,15 @@ static int baseband_phy_on(void)
                phy_init = true;
        }
        pr_info("%s\n", __func__);
-       return 0;
-}
-
-static int baseband_phy_off(void)
-{
-       pr_info("%s\n", __func__);
-       return 0;
 }
 
-static void baseband_phy_restore_start(void)
+static void baseband_phy_off(void)
 {
        /* set AP2MDM_ACK2 high */
        gpio_set_value(AP2MDM_ACK2, 1);
 }
 
-static void baseband_phy_restore_end(void)
+static void baseband_phy_on(void)
 {
        /* set AP2MDM_ACK2 low */
        gpio_set_value(AP2MDM_ACK2, 0);
index 06e497a..201c367 100644 (file)
@@ -83,43 +83,6 @@ static struct tegra_thermal_data thermal_data = {
 #endif
 };
 
-/* !!!TODO: Change for enterprise (Taken from Cardhu) */
-static struct tegra_utmip_config utmi_phy_config[] = {
-       [0] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 15,
-                       .xcvr_setup_offset = 0,
-                       .xcvr_use_fuses = 1,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-       [1] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 15,
-                       .xcvr_setup_offset = 0,
-                       .xcvr_use_fuses = 1,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-       [2] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 8,
-                       .xcvr_setup_offset = 0,
-                       .xcvr_use_fuses = 1,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-};
-
 static struct resource enterprise_bcm4329_rfkill_resources[] = {
        {
                .name   = "bcm4329_nshutdown_gpio",
@@ -658,66 +621,120 @@ static int __init enterprise_touch_init(void)
        return 0;
 }
 
-static struct usb_phy_plat_data tegra_usb_phy_pdata[] = {
-       [0] = {
-                       .instance = 0,
-                       .vbus_gpio = -1,
-                       .vbus_reg_supply = "usb_vbus",
-                       .vbus_irq = ENT_TPS80031_IRQ_BASE +
-                                                       TPS80031_INT_VBUS_DET,
-       },
-       [1] = {
-                       .instance = 1,
-                       .vbus_gpio = -1,
-       },
-       [2] = {
-                       .instance = 2,
-                       .vbus_gpio = -1,
-       },
-};
+static void enterprise_usb_hsic_postsupend(void)
+{
+       pr_debug("%s\n", __func__);
+#ifdef CONFIG_TEGRA_BB_XMM_POWER
+       baseband_xmm_set_power_status(BBXMM_PS_L2);
+#endif
+}
 
-static struct tegra_uhsic_config uhsic_phy_config = {
-       .enable_gpio = -1,
-       .reset_gpio = -1,
-       .sync_start_delay = 9,
-       .idle_wait_delay = 17,
-       .term_range_adj = 0,
-       .elastic_underrun_limit = 16,
-       .elastic_overrun_limit = 16,
-};
+static void enterprise_usb_hsic_preresume(void)
+{
+       pr_debug("%s\n", __func__);
+#ifdef CONFIG_TEGRA_BB_XMM_POWER
+       baseband_xmm_set_power_status(BBXMM_PS_L2TOL0);
+#endif
+}
 
-static struct tegra_ehci_platform_data tegra_ehci_uhsic_pdata = {
-       .phy_type = TEGRA_USB_PHY_TYPE_HSIC,
-       .phy_config = &uhsic_phy_config,
-       .operating_mode = TEGRA_USB_HOST,
-       .power_down_on_bus_suspend = 1,
-       .default_enable = true,
-};
+static void enterprise_usb_hsic_phy_power(void)
+{
+       pr_debug("%s\n", __func__);
+#ifdef CONFIG_TEGRA_BB_XMM_POWER
+       baseband_xmm_set_power_status(BBXMM_PS_L0);
+#endif
+}
 
-static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
-       [0] = {
-                       .phy_config = &utmi_phy_config[0],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-                       .default_enable = false,
-       },
-       [1] = {
-                       .phy_config = &utmi_phy_config[1],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-                       .default_enable = false,
-       },
-       [2] = {
-                       .phy_config = &utmi_phy_config[2],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-                       .default_enable = false,
-       },
-};
+static void enterprise_usb_hsic_post_phy_off(void)
+{
+       pr_debug("%s\n", __func__);
+#ifdef CONFIG_TEGRA_BB_XMM_POWER
+       baseband_xmm_set_power_status(BBXMM_PS_L3);
+#endif
+}
 
-static struct tegra_otg_platform_data tegra_otg_pdata = {
+static struct tegra_usb_phy_platform_ops hsic_xmm_plat_ops = {
+       .post_suspend = enterprise_usb_hsic_postsupend,
+       .pre_resume = enterprise_usb_hsic_preresume,
+       .port_power = enterprise_usb_hsic_phy_power,
+       .post_phy_off = enterprise_usb_hsic_post_phy_off,
+};
+
+static struct tegra_usb_platform_data tegra_ehci2_hsic_xmm_pdata = {
+       .port_otg = false,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_HSIC,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .hot_plug = false,
+               .remote_wakeup_supported = false,
+               .power_off_on_suspend = false,
+       },
+       .u_cfg.hsic = {
+               .sync_start_delay = 9,
+               .idle_wait_delay = 17,
+               .term_range_adj = 0,
+               .elastic_underrun_limit = 16,
+               .elastic_overrun_limit = 16,
+       },
+       .ops = &hsic_xmm_plat_ops,
+};
+
+
+
+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 = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
+       },
+};
+
+static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
+       .port_otg = true,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .vbus_reg = "usb_vbus",
+               .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 = 15,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
+       },
+};
+
+static struct tegra_usb_otg_data tegra_otg_pdata = {
        .ehci_device = &tegra_ehci1_device,
-       .ehci_pdata = &tegra_ehci_pdata[0],
+       .ehci_pdata = &tegra_ehci1_utmi_pdata,
 };
 
 struct platform_device *tegra_usb_hsic_host_register(void)
@@ -738,8 +755,8 @@ struct platform_device *tegra_usb_hsic_host_register(void)
        pdev->dev.dma_mask =  tegra_ehci2_device.dev.dma_mask;
        pdev->dev.coherent_dma_mask = tegra_ehci2_device.dev.coherent_dma_mask;
 
-       val = platform_device_add_data(pdev, &tegra_ehci_uhsic_pdata,
-                       sizeof(struct tegra_ehci_platform_data));
+       val = platform_device_add_data(pdev, &tegra_ehci2_hsic_xmm_pdata,
+                       sizeof(struct tegra_usb_platform_data));
        if (val)
                goto error;
 
@@ -760,52 +777,12 @@ void tegra_usb_hsic_host_unregister(struct platform_device *pdev)
        platform_device_unregister(pdev);
 }
 
-static int enterprise_usb_hsic_postsupend(void)
-{
-       pr_debug("%s\n", __func__);
-#ifdef CONFIG_TEGRA_BB_XMM_POWER
-       baseband_xmm_set_power_status(BBXMM_PS_L2);
-#endif
-       return 0;
-}
-
-static int enterprise_usb_hsic_preresume(void)
-{
-       pr_debug("%s\n", __func__);
-#ifdef CONFIG_TEGRA_BB_XMM_POWER
-       baseband_xmm_set_power_status(BBXMM_PS_L2TOL0);
-#endif
-       return 0;
-}
-
-static int enterprise_usb_hsic_phy_ready(void)
-{
-       pr_debug("%s\n", __func__);
-#ifdef CONFIG_TEGRA_BB_XMM_POWER
-       baseband_xmm_set_power_status(BBXMM_PS_L0);
-#endif
-       return 0;
-}
-
-static int enterprise_usb_hsic_phy_off(void)
-{
-       pr_debug("%s\n", __func__);
-#ifdef CONFIG_TEGRA_BB_XMM_POWER
-       baseband_xmm_set_power_status(BBXMM_PS_L3);
-#endif
-       return 0;
-}
-
 static void enterprise_usb_init(void)
 {
-       struct  fsl_usb2_platform_data *udc_pdata;
-
-       tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));
+       tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
 
        tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
        platform_device_register(&tegra_otg_device);
-
-       udc_pdata = tegra_udc_device.dev.platform_data;
 }
 
 static struct platform_device *enterprise_audio_devices[] __initdata = {
@@ -915,12 +892,9 @@ static void enterprise_baseband_init(void)
                enterprise_modem_init();
                break;
        case TEGRA_BB_XMM6260: /* XMM6260 HSIC */
-               /* xmm baseband - do not switch off phy during suspend */
-               tegra_ehci_uhsic_pdata.power_down_on_bus_suspend = 0;
-               uhsic_phy_config.postsuspend = enterprise_usb_hsic_postsupend;
-               uhsic_phy_config.preresume = enterprise_usb_hsic_preresume;
-               uhsic_phy_config.usb_phy_ready = enterprise_usb_hsic_phy_ready;
-               uhsic_phy_config.post_phy_off = enterprise_usb_hsic_phy_off;
+               /* baseband-power.ko will register ehci2 device */
+               tegra_ehci2_device.dev.platform_data =
+                                       &tegra_ehci2_hsic_xmm_pdata;
                /* enable XMM6260 baseband gpio(s) */
                tegra_gpio_enable(tegra_baseband_power_data.modem.generic
                        .mdm_reset);
@@ -943,9 +917,9 @@ static void enterprise_baseband_init(void)
                break;
 #ifdef CONFIG_TEGRA_BB_M7400
        case TEGRA_BB_M7400: /* M7400 HSIC */
-               tegra_ehci_uhsic_pdata.power_down_on_bus_suspend = 0;
+               tegra_ehci2_hsic_xmm_pdata.u_data.host.power_off_on_suspend = 0;
                tegra_ehci2_device.dev.platform_data
-                       = &tegra_ehci_uhsic_pdata;
+                       = &tegra_ehci2_hsic_xmm_pdata;
                platform_device_register(&tegra_baseband_m7400_device);
                break;
 #endif
index 9507fe2..b254347 100644 (file)
@@ -32,6 +32,8 @@
 #include <linux/i2c-tegra.h>
 #include <linux/memblock.h>
 #include <linux/delay.h>
+#include <linux/mfd/tps6586x.h>
+#include <linux/platform_data/tegra_usb.h>
 
 #include <sound/wm8903.h>
 
@@ -83,20 +85,52 @@ static int __init parse_tag_nvidia(const struct tag *tag)
 }
 __tagtable(ATAG_NVIDIA, parse_tag_nvidia);
 
-static struct tegra_utmip_config utmi_phy_config = {
-       .hssync_start_delay = 0,
-       .idle_wait_delay = 17,
-       .elastic_limit = 16,
-       .term_range_adj = 6,
-       .xcvr_setup = 9,
-       .xcvr_lsfslew = 2,
-       .xcvr_lsrslew = 2,
+
+static struct tegra_usb_platform_data tegra_udc_pdata = {
+       .port_otg = false,
+       .has_hostpc = false,
+       .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 = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
+       },
 };
 
-static struct tegra_ehci_platform_data tegra_ehci_pdata = {
-       .phy_config = &utmi_phy_config,
-       .operating_mode = TEGRA_USB_HOST,
-       .power_down_on_bus_suspend = 1,
+static struct tegra_usb_platform_data tegra_ehci3_utmi_pdata = {
+       .port_otg = false,
+       .has_hostpc = false,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = TEGRA_GPIO_PD3,
+               .vbus_reg = NULL,
+               .hot_plug = true,
+               .remote_wakeup_supported = false,
+               .power_off_on_suspend = true,
+       },
+       .u_cfg.utmi = {
+               .hssync_start_delay = 9,
+               .elastic_limit = 16,
+               .idle_wait_delay = 17,
+               .term_range_adj = 6,
+               .xcvr_setup = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+       },
 };
 
 static struct tegra_nand_chip_parms nand_chip_parms[] = {
@@ -285,39 +319,6 @@ static void __init harmony_i2c_init(void)
        i2c_register_board_info(0, &wm8903_board_info, 1);
 }
 
-/* OTG gadget device */
-/*static u64 tegra_otg_dmamask = DMA_BIT_MASK(32);
-
-
-static struct resource tegra_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 fsl_usb2_platform_data tegra_otg_pdata = {
-       .operating_mode = FSL_USB2_DR_DEVICE,
-       .phy_mode       = FSL_USB2_PHY_UTMI,
-};
-
-static struct platform_device tegra_otg = {
-       .name = "fsl-tegra-udc",
-       .id   = -1,
-       .dev  = {
-               .dma_mask               = &tegra_otg_dmamask,
-               .coherent_dma_mask      = 0xffffffff,
-               .platform_data = &tegra_otg_pdata,
-       },
-       .resource = tegra_otg_resources,
-       .num_resources = ARRAY_SIZE(tegra_otg_resources),
-};*/
 
 /* PDA power */
 static struct pda_power_pdata pda_power_pdata = {
@@ -481,7 +482,8 @@ static void __init tegra_harmony_init(void)
        tegra_sdhci_device2.dev.platform_data = &sdhci_pdata2;
        tegra_sdhci_device4.dev.platform_data = &sdhci_pdata4;
 
-       tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata;
+       tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
+       tegra_ehci3_device.dev.platform_data = &tegra_ehci3_utmi_pdata;
 
        platform_add_devices(harmony_devices, ARRAY_SIZE(harmony_devices));
        harmony_i2c_init();
index 19e6e8e..deca543 100644 (file)
@@ -86,42 +86,6 @@ static struct tegra_thermal_data thermal_data = {
 #endif
 };
 
-/* !!!TODO: Change for kai (Taken from Ventana) */
-static struct tegra_utmip_config utmi_phy_config[] = {
-       [0] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 15,
-                       .xcvr_setup_offset = 0,
-                       .xcvr_use_fuses = 1,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-       [1] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 15,
-                       .xcvr_setup_offset = 0,
-                       .xcvr_use_fuses = 1,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-       [2] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 8,
-                       .xcvr_setup_offset = 0,
-                       .xcvr_use_fuses = 1,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-};
 
 /* wl128x BT, FM, GPS connectivity chip */
 struct ti_st_plat_data kai_wilink_pdata = {
@@ -707,47 +671,97 @@ static int __init kai_touch_init(void)
        return 0;
 }
 
-static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
-       [0] = {
-                       .phy_config = &utmi_phy_config[0],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-                       .default_enable = true,
+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,
        },
-       [1] = {
-                       .phy_config = &utmi_phy_config[1],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-                       .default_enable = false,
+       .u_cfg.utmi = {
+               .hssync_start_delay = 0,
+               .elastic_limit = 16,
+               .idle_wait_delay = 17,
+               .term_range_adj = 6,
+               .xcvr_setup = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
        },
 };
 
-static struct tegra_otg_platform_data tegra_otg_pdata = {
-       .ehci_device = &tegra_ehci1_device,
-       .ehci_pdata = &tegra_ehci_pdata[0],
+static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
+       .port_otg = true,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .vbus_reg = NULL,
+               .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 = 15,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
+       },
 };
 
-#ifdef CONFIG_USB_SUPPORT
-static struct usb_phy_plat_data tegra_usb_phy_pdata[] = {
-       [0] = {
-                       .instance = 0,
-                       .vbus_gpio = -1,
+
+static struct tegra_usb_platform_data tegra_ehci2_utmi_pdata = {
+       .port_otg = false,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .vbus_reg = NULL,
+               .hot_plug = true,
+               .remote_wakeup_supported = true,
+               .power_off_on_suspend = true,
+
        },
-       [1] = {
-                       .instance = 1,
-                       .vbus_gpio = -1,
+       .u_cfg.utmi = {
+               .hssync_start_delay = 0,
+               .elastic_limit = 16,
+               .idle_wait_delay = 17,
+               .term_range_adj = 6,
+               .xcvr_setup = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
        },
 };
 
+static struct tegra_usb_otg_data tegra_otg_pdata = {
+       .ehci_device = &tegra_ehci1_device,
+       .ehci_pdata = &tegra_ehci1_utmi_pdata,
+};
+
+#if CONFIG_USB_SUPPORT
 static void kai_usb_init(void)
 {
-       tegra_usb_phy_init(tegra_usb_phy_pdata,
-                       ARRAY_SIZE(tegra_usb_phy_pdata));
-
        tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
        platform_device_register(&tegra_otg_device);
 
-       tegra_ehci2_device.dev.platform_data = &tegra_ehci_pdata[1];
+       /* Setup the udc platform data */
+       tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
+
+       tegra_ehci2_device.dev.platform_data = &tegra_ehci2_utmi_pdata;
        platform_device_register(&tegra_ehci2_device);
 }
 
index fb0843c..f86e482 100644 (file)
 #include "gpio-names.h"
 #include "fuse.h"
 
-static struct tegra_utmip_config utmi_phy_config[] = {
-       [0] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 15,
-                       .xcvr_setup_offset = 0,
-                       .xcvr_use_fuses = 1,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-       [1] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 15,
-                       .xcvr_setup_offset = 0,
-                       .xcvr_use_fuses = 1,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-       [2] = {
-                       .hssync_start_delay = 0,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 8,
-                       .xcvr_setup_offset = 0,
-                       .xcvr_use_fuses = 1,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-};
-
 static __initdata struct tegra_clk_init_table p1852_clk_init_table[] = {
        /* name         parent          rate            enabled */
        { "pll_m",              NULL,           0,              true},
@@ -358,56 +322,91 @@ static struct platform_device *p1852_devices[] __initdata = {
        &tegra_wdt_device
 };
 
-static struct usb_phy_plat_data tegra_usb_phy_pdata[] = {
-       [0] = {
-                       .instance = 0,
-                       .vbus_gpio = -1,
-                       .vbus_reg_supply = NULL,
-       },
-       [1] = {
-                       .instance = 1,
-                       .vbus_gpio = -1,
+static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
+       .port_otg = false,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .vbus_reg = NULL,
+               .hot_plug = false,
+               .remote_wakeup_supported = true,
+               .power_off_on_suspend = true,
        },
-       [2] = {
-                       .instance = 2,
-                       .vbus_gpio = -1,
-                       .vbus_reg_supply = NULL,
+       .u_cfg.utmi = {
+               .hssync_start_delay = 0,
+               .idle_wait_delay = 17,
+               .elastic_limit = 16,
+               .term_range_adj = 6,
+               .xcvr_setup = 15,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
        },
 };
 
-static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
-       [0] = {
-                       .phy_config = &utmi_phy_config[0],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
+static struct tegra_usb_platform_data tegra_ehci2_utmi_pdata = {
+       .port_otg = false,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .vbus_reg = NULL,
+               .hot_plug = false,
+               .remote_wakeup_supported = true,
+               .power_off_on_suspend = true,
        },
-       [1] = {
-                       .phy_config = &utmi_phy_config[1],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
+       .u_cfg.utmi = {
+               .hssync_start_delay = 0,
+               .idle_wait_delay = 17,
+               .elastic_limit = 16,
+               .term_range_adj = 6,
+               .xcvr_setup = 15,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
        },
-       [2] = {
-                       .phy_config = &utmi_phy_config[2],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
+};
+
+static struct tegra_usb_platform_data tegra_ehci3_utmi_pdata = {
+       .port_otg = false,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .vbus_reg = NULL,
+               .hot_plug = false,
+               .remote_wakeup_supported = true,
+               .power_off_on_suspend = true,
+       },
+       .u_cfg.utmi = {
+               .hssync_start_delay = 0,
+               .idle_wait_delay = 17,
+               .elastic_limit = 16,
+               .term_range_adj = 6,
+               .xcvr_setup = 8,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
        },
 };
 
 static void p1852_usb_init(void)
 {
-       /* Need to parse sku info to decide host/device mode */
-       tegra_usb_phy_init(tegra_usb_phy_pdata,
-                               ARRAY_SIZE(tegra_usb_phy_pdata));
-
-       tegra_ehci1_device.dev.platform_data = &tegra_ehci_pdata[0];
+       tegra_ehci1_device.dev.platform_data = &tegra_ehci1_utmi_pdata;
        platform_device_register(&tegra_ehci1_device);
 
-       tegra_ehci2_device.dev.platform_data = &tegra_ehci_pdata[1];
+       tegra_ehci2_device.dev.platform_data = &tegra_ehci2_utmi_pdata;
        platform_device_register(&tegra_ehci2_device);
 
-       tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata[2];
+       tegra_ehci3_device.dev.platform_data = &tegra_ehci3_utmi_pdata;
        platform_device_register(&tegra_ehci3_device);
-
 }
 
 static struct tegra_nor_platform_data p1852_nor_data = {
index 125ce21..41fc9c9 100644 (file)
 #include "pm.h"
 #include "tegra2_emc.h"
 
-static struct tegra_utmip_config utmi_phy_config[] = {
-       [0] = {
-                       .hssync_start_delay = 9,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 15,
-                       .xcvr_setup_offset = 0,
-                       .xcvr_use_fuses = 1,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-       [1] = {
-                       .hssync_start_delay = 9,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 8,
-                       .xcvr_setup_offset = 0,
-                       .xcvr_use_fuses = 1,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-       },
-};
-
-static struct tegra_ulpi_config ulpi_phy_config = {
-       .reset_gpio = TEGRA_GPIO_PG2,
-       .clk = "cdev2",
-};
 
 static struct resource ventana_bcm4329_rfkill_resources[] = {
        {
@@ -169,19 +140,6 @@ static __initdata struct tegra_clk_init_table ventana_clk_init_table[] = {
        { NULL,         NULL,           0,              0},
 };
 
-static struct tegra_ulpi_config ventana_ehci2_ulpi_phy_config = {
-       .reset_gpio = TEGRA_GPIO_PV1,
-       .clk = "cdev2",
-};
-
-static struct tegra_ehci_platform_data ventana_ehci2_ulpi_platform_data = {
-       .operating_mode = TEGRA_USB_HOST,
-       .power_down_on_bus_suspend = 1,
-       .phy_config = &ventana_ehci2_ulpi_phy_config,
-       .phy_type = TEGRA_USB_PHY_TYPE_LINK_ULPI,
-       .default_enable = true,
-};
-
 static struct tegra_i2c_platform_data ventana_i2c1_platform_data = {
        .adapter_nr     = 0,
        .bus_count      = 1,
@@ -503,73 +461,146 @@ static int __init ventana_touch_init_panjit(void)
        return 0;
 }
 
-static struct usb_phy_plat_data tegra_usb_phy_pdata[] = {
-       [0] = {
-                       .instance = 0,
-                       .vbus_irq = TPS6586X_INT_BASE + TPS6586X_INT_USB_DET,
-                       .vbus_gpio = TEGRA_GPIO_PD0,
+static int __init ventana_gps_init(void)
+{
+       struct clk *clk32 = clk_get_sys(NULL, "blink");
+       if (!IS_ERR(clk32)) {
+               clk_set_rate(clk32,clk32->parent->rate);
+               clk_enable(clk32);
+       }
+
+       tegra_gpio_enable(TEGRA_GPIO_PZ3);
+       return 0;
+}
+
+static struct tegra_usb_platform_data tegra_udc_pdata = {
+       .port_otg = true,
+       .has_hostpc = false,
+       .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,
        },
-       [1] = {
-                       .instance = 1,
-                       .vbus_gpio = -1,
+       .u_cfg.utmi = {
+               .hssync_start_delay = 0,
+               .elastic_limit = 16,
+               .idle_wait_delay = 17,
+               .term_range_adj = 6,
+               .xcvr_setup = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
        },
-       [2] = {
-                       .instance = 2,
-                       .vbus_gpio = TEGRA_GPIO_PD3,
+};
+
+static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
+       .port_otg = true,
+       .has_hostpc = false,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = TEGRA_GPIO_PD0,
+               .vbus_reg = NULL,
+               .hot_plug = true,
+               .remote_wakeup_supported = false,
+               .power_off_on_suspend = true,
+       },
+       .u_cfg.utmi = {
+               .hssync_start_delay = 9,
+               .elastic_limit = 16,
+               .idle_wait_delay = 17,
+               .term_range_adj = 6,
+               .xcvr_setup = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
        },
 };
 
-static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
-       [0] = {
-                       .phy_config = &utmi_phy_config[0],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-                       .default_enable = 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 = false,
+       .phy_intf = TEGRA_USB_PHY_INTF_ULPI_LINK,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .vbus_reg = NULL,
+               .hot_plug = false,
+               .remote_wakeup_supported = false,
+               .power_off_on_suspend = true,
        },
-       [1] = {
-                       .phy_config = &ulpi_phy_config,
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-                       .phy_type = TEGRA_USB_PHY_TYPE_LINK_ULPI,
-                       .default_enable = true,
+       .u_cfg.ulpi = {
+               .shadow_clk_delay = 10,
+               .clock_out_delay = 1,
+               .data_trimmer = 4,
+               .stpdirnxt_trimmer = 4,
+               .dir_trimmer = 4,
+               .clk = "cdev2",
        },
-       [2] = {
-                       .phy_config = &utmi_phy_config[1],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-                       .hotplug = 1,
-                       .default_enable = true,
+       .ops = &ulpi_link_plat_ops,
+};
+
+static struct tegra_usb_platform_data tegra_ehci3_utmi_pdata = {
+       .port_otg = false,
+       .has_hostpc = false,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = TEGRA_GPIO_PD3,
+               .vbus_reg = NULL,
+               .hot_plug = true,
+               .remote_wakeup_supported = false,
+               .power_off_on_suspend = true,
+       },
+       .u_cfg.utmi = {
+               .hssync_start_delay = 9,
+               .elastic_limit = 16,
+               .idle_wait_delay = 17,
+               .term_range_adj = 6,
+               .xcvr_setup = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
        },
 };
 
-static struct tegra_otg_platform_data tegra_otg_pdata = {
+static struct tegra_usb_otg_data tegra_otg_pdata = {
        .ehci_device = &tegra_ehci1_device,
-       .ehci_pdata = &tegra_ehci_pdata[0],
+       .ehci_pdata = &tegra_ehci1_utmi_pdata,
 };
 
-static int __init ventana_gps_init(void)
-{
-       struct clk *clk32 = clk_get_sys(NULL, "blink");
-       if (!IS_ERR(clk32)) {
-               clk_set_rate(clk32,clk32->parent->rate);
-               clk_enable(clk32);
-       }
-
-       tegra_gpio_enable(TEGRA_GPIO_PZ3);
-       return 0;
-}
-
 static void ventana_usb_init(void)
 {
-       tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));
        /* OTG should be the first to be registered */
        tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
        platform_device_register(&tegra_otg_device);
 
+       tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
        platform_device_register(&tegra_udc_device);
+
+       tegra_ehci2_device.dev.platform_data = &tegra_ehci2_ulpi_link_pdata;
        platform_device_register(&tegra_ehci2_device);
 
-       tegra_ehci3_device.dev.platform_data=&tegra_ehci_pdata[2];
+       tegra_ehci3_device.dev.platform_data = &tegra_ehci3_utmi_pdata;
        platform_device_register(&tegra_ehci3_device);
 }
 
@@ -583,8 +614,6 @@ static void __init tegra_ventana_init(void)
        ventana_pinmux_init();
        ventana_i2c_init();
        ventana_uart_init();
-       tegra_ehci2_device.dev.platform_data
-               = &ventana_ehci2_ulpi_platform_data;
        platform_add_devices(ventana_devices, ARRAY_SIZE(ventana_devices));
        tegra_ram_console_debug_init();
        ventana_sdhci_init();
index 696255f..842598e 100644 (file)
 #include "board.h"
 #include "board-whistler-baseband.h"
 
-static int baseband_phy_on(void);
-static int baseband_phy_off(void);
-static void baseband_phy_restore_start(void);
-static void baseband_phy_restore_end(void);
+static void baseband_phy_init(void);
+static void baseband_phy_on(void);
+static void baseband_phy_off(void);
 
 static struct wake_lock mdm_wake_lock;
 
@@ -59,30 +58,38 @@ static __initdata struct tegra_pingroup_config whistler_null_ulpi_pinmux[] = {
         TEGRA_TRI_NORMAL},
 };
 
-static struct tegra_ulpi_trimmer e1219_trimmer = { 10, 1, 1, 1 };
-
-static struct tegra_ulpi_config ehci2_null_ulpi_phy_config = {
-       .trimmer = &e1219_trimmer,
-       .post_phy_on = baseband_phy_on,
+static struct tegra_usb_phy_platform_ops ulpi_null_plat_ops = {
+       .init = baseband_phy_init,
        .pre_phy_off = baseband_phy_off,
-       .phy_restore_start = baseband_phy_restore_start,
-       .phy_restore_end = baseband_phy_restore_end,
-       .phy_restore_gpio = MDM2AP_ACK,
-       .ulpi_dir_gpio = ULPI_DIR,
-       .ulpi_d0_gpio = ULPI_D0,
-       .ulpi_d1_gpio = ULPI_D1,
+       .post_phy_on = baseband_phy_on,
 };
 
-static struct tegra_ehci_platform_data ehci2_null_ulpi_platform_data = {
-       .operating_mode = TEGRA_USB_HOST,
-       .power_down_on_bus_suspend = 0,
-       .phy_config = &ehci2_null_ulpi_phy_config,
-       .phy_type = TEGRA_USB_PHY_TYPE_NULL_ULPI,
+static struct tegra_usb_platform_data tegra_ehci2_ulpi_null_pdata = {
+       .port_otg = false,
+       .has_hostpc = true,
+       .phy_intf = TEGRA_USB_PHY_INTF_ULPI_NULL,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .vbus_reg = NULL,
+               .hot_plug = false,
+               .remote_wakeup_supported = false,
+               .power_off_on_suspend = false,
+       },
+       .u_cfg.ulpi = {
+               .shadow_clk_delay = 10,
+               .clock_out_delay = 1,
+               .data_trimmer = 1,
+               .stpdirnxt_trimmer = 1,
+               .dir_trimmer = 1,
+               .clk = NULL,
+       },
+       .ops = &ulpi_null_plat_ops,
 };
 
 static int __init tegra_null_ulpi_init(void)
 {
-       tegra_ehci2_device.dev.platform_data = &ehci2_null_ulpi_platform_data;
+       tegra_ehci2_device.dev.platform_data = &tegra_ehci2_ulpi_null_pdata;
        platform_device_register(&tegra_ehci2_device);
        return 0;
 }
@@ -100,7 +107,7 @@ static irqreturn_t mdm_start_thread(int irq, void *data)
        return IRQ_HANDLED;
 }
 
-static int baseband_phy_on(void)
+static void baseband_phy_init(void)
 {
        static bool phy_init;
 
@@ -110,22 +117,15 @@ static int baseband_phy_on(void)
                phy_init = true;
        }
        pr_info("%s\n", __func__);
-       return 0;
-}
-
-static int baseband_phy_off(void)
-{
-       pr_info("%s\n", __func__);
-       return 0;
 }
 
-static void baseband_phy_restore_start(void)
+static void baseband_phy_off(void)
 {
        /* set AP2MDM_ACK2 high */
        gpio_set_value(AP2MDM_ACK2, 1);
 }
 
-static void baseband_phy_restore_end(void)
+static void baseband_phy_on    (void)
 {
        /* set AP2MDM_ACK2 low */
        gpio_set_value(AP2MDM_ACK2, 0);
index c8c6a20..bfcb27a 100644 (file)
@@ -228,32 +228,6 @@ static void __init whistler_setup_bluesleep(void)
        return;
 }
 
-static struct tegra_utmip_config utmi_phy_config[] = {
-       [0] = {
-                       .hssync_start_delay = 9,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 15,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-               },
-       [1] = {
-                       .hssync_start_delay = 9,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 8,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-               },
-};
-
-static struct tegra_ulpi_config ulpi_phy_config = {
-       .reset_gpio = TEGRA_GPIO_PG2,
-       .clk = "cdev2",
-};
-
 static __initdata struct tegra_clk_init_table whistler_clk_init_table[] = {
        /* name         parent          rate            enabled */
        { "pwm",        "clk_32k",      32768,          false},
@@ -461,61 +435,95 @@ static int __init whistler_scroll_init(void)
        return 0;
 }
 
-static struct usb_phy_plat_data tegra_usb_phy_pdata[] = {
-       [0] = {
-                       .instance = 0,
-                       .vbus_irq = MAX8907C_INT_BASE + MAX8907C_IRQ_VCHG_DC_R,
-                       .vbus_gpio = USB1_VBUS_GPIO,
+static int __init whistler_gps_init(void)
+{
+       tegra_gpio_enable(TEGRA_GPIO_PU4);
+       return 0;
+}
+
+static struct tegra_usb_platform_data tegra_udc_pdata = {
+       .port_otg = true,
+       .has_hostpc = false,
+       .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,
        },
-       [1] = {
-                       .instance = 1,
-                       .vbus_gpio = -1,
+       .u_cfg.utmi = {
+               .hssync_start_delay = 0,
+               .elastic_limit = 16,
+               .idle_wait_delay = 17,
+               .term_range_adj = 6,
+               .xcvr_setup = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
        },
-       [2] = {
-                       .instance = 2,
-                       .vbus_gpio = -1,
+};
+
+static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
+       .port_otg = true,
+       .has_hostpc = false,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = TEGRA_GPIO_PN6,
+               .vbus_reg = NULL,
+               .hot_plug = true,
+               .remote_wakeup_supported = false,
+               .power_off_on_suspend = true,
+       },
+       .u_cfg.utmi = {
+               .hssync_start_delay = 9,
+               .elastic_limit = 16,
+               .idle_wait_delay = 17,
+               .term_range_adj = 6,
+               .xcvr_setup = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
        },
 };
 
-static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
-       [0] = {
-                       .phy_config = &utmi_phy_config[0],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-                       .default_enable = false,
-               },
-       [1] = {
-                       .phy_config = &ulpi_phy_config,
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-                       .default_enable = false,
-               },
-       [2] = {
-                       .phy_config = &utmi_phy_config[1],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-                       .default_enable = false,
+static struct tegra_usb_platform_data tegra_ehci3_utmi_pdata = {
+       .port_otg = false,
+       .has_hostpc = false,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = TEGRA_GPIO_PD3,
+               .vbus_reg = NULL,
+               .hot_plug = true,
+               .remote_wakeup_supported = false,
+               .power_off_on_suspend = true,
+       },
+       .u_cfg.utmi = {
+               .hssync_start_delay = 9,
+               .elastic_limit = 16,
+               .idle_wait_delay = 17,
+               .term_range_adj = 6,
+               .xcvr_setup = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
        },
 };
 
-static struct tegra_otg_platform_data tegra_otg_pdata = {
+static struct tegra_usb_otg_data tegra_otg_pdata = {
        .ehci_device = &tegra_ehci1_device,
-       .ehci_pdata = &tegra_ehci_pdata[0],
+       .ehci_pdata = &tegra_ehci1_utmi_pdata,
 };
 
-static int __init whistler_gps_init(void)
-{
-       tegra_gpio_enable(TEGRA_GPIO_PU4);
-       return 0;
-}
-
+#define SERIAL_NUMBER_LENGTH 20
+static char usb_serial_num[SERIAL_NUMBER_LENGTH];
 static void whistler_usb_init(void)
 {
-       tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));
-
        tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
        platform_device_register(&tegra_otg_device);
 
+       tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
 }
 
 static void __init tegra_whistler_init(void)
index c4b5df3..3feab75 100644 (file)
@@ -709,28 +709,6 @@ static struct resource tegra_usb3_resources[] = {
        },
 };
 
-static struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config = {
-       /* All existing boards use GPIO PV0 for phy reset */
-       .reset_gpio = TEGRA_GPIO_PV0,
-       .clk = "cdev2",
-};
-
-struct tegra_ehci_platform_data tegra_ehci1_pdata = {
-       .operating_mode = TEGRA_USB_OTG,
-       .power_down_on_bus_suspend = 1,
-};
-
-struct tegra_ehci_platform_data tegra_ehci2_pdata = {
-       .phy_config = &tegra_ehci2_ulpi_phy_config,
-       .operating_mode = TEGRA_USB_HOST,
-       .power_down_on_bus_suspend = 1,
-};
-
-struct tegra_ehci_platform_data tegra_ehci3_pdata = {
-       .operating_mode = TEGRA_USB_HOST,
-       .power_down_on_bus_suspend = 1,
-};
-
 static u64 tegra_ehci_dmamask = DMA_BIT_MASK(32);
 
 struct platform_device tegra_ehci1_device = {
@@ -739,7 +717,6 @@ struct platform_device tegra_ehci1_device = {
        .dev    = {
                .dma_mask       = &tegra_ehci_dmamask,
                .coherent_dma_mask = DMA_BIT_MASK(32),
-               .platform_data = &tegra_ehci1_pdata,
        },
        .resource = tegra_usb1_resources,
        .num_resources = ARRAY_SIZE(tegra_usb1_resources),
@@ -751,7 +728,6 @@ struct platform_device tegra_ehci2_device = {
        .dev    = {
                .dma_mask       = &tegra_ehci_dmamask,
                .coherent_dma_mask = DMA_BIT_MASK(32),
-               .platform_data = &tegra_ehci2_pdata,
        },
        .resource = tegra_usb2_resources,
        .num_resources = ARRAY_SIZE(tegra_usb2_resources),
@@ -763,7 +739,6 @@ struct platform_device tegra_ehci3_device = {
        .dev    = {
                .dma_mask       = &tegra_ehci_dmamask,
                .coherent_dma_mask = DMA_BIT_MASK(32),
-               .platform_data = &tegra_ehci3_pdata,
        },
        .resource = tegra_usb3_resources,
        .num_resources = ARRAY_SIZE(tegra_usb3_resources),
@@ -1351,18 +1326,12 @@ static struct resource tegra_udc_resources[] = {
 
 static u64 tegra_udc_dmamask = DMA_BIT_MASK(32);
 
-static struct fsl_usb2_platform_data tegra_udc_pdata = {
-       .operating_mode = FSL_USB2_DR_DEVICE,
-       .phy_mode       = FSL_USB2_PHY_UTMI,
-};
-
 struct platform_device tegra_udc_device = {
        .name   = "tegra-udc",
        .id     = 0,
        .dev    = {
                .dma_mask       = &tegra_udc_dmamask,
                .coherent_dma_mask = DMA_BIT_MASK(32),
-               .platform_data  = &tegra_udc_pdata,
        },
        .resource = tegra_udc_resources,
        .num_resources = ARRAY_SIZE(tegra_udc_resources),
index 7a538fe..b11962e 100644 (file)
 #define __MACH_TEGRA_DEVICES_H
 
 #include <linux/platform_device.h>
-#include <linux/platform_data/tegra_usb.h>
 #include <linux/nvhost.h>
 #include <linux/platform_data/tegra_usb.h>
 
-extern struct tegra_ehci_platform_data tegra_ehci1_pdata;
-extern struct tegra_ehci_platform_data tegra_ehci2_pdata;
-extern struct tegra_ehci_platform_data tegra_ehci3_pdata;
-
 extern struct platform_device tegra_emc_device;
 extern struct platform_device tegra_gpio_device;
 extern struct platform_device tegra_pinmux_device;
index 7e71422..d03498f 100644 (file)
@@ -42,23 +42,6 @@ struct tegra_ulpi_trimmer {
        u8 stpdirnxt_trimmer;   /* 0 ~ 7 */
 };
 
-struct tegra_ulpi_config {
-       int enable_gpio;
-       int reset_gpio;
-       const char *clk;
-       const struct tegra_ulpi_trimmer *trimmer;
-       int (*pre_phy_on)(void);
-       int (*post_phy_on)(void);
-       int (*pre_phy_off)(void);
-       int (*post_phy_off)(void);
-       void (*phy_restore_start)(void);
-       void (*phy_restore_end)(void);
-       int phy_restore_gpio; /* null phy restore ack from device */
-       int ulpi_dir_gpio; /* ulpi dir */
-       int ulpi_d0_gpio; /* usb linestate[0] */
-       int ulpi_d1_gpio; /* usb linestate[1] */
-};
-
 struct tegra_uhsic_config {
        int enable_gpio;
        int reset_gpio;
@@ -105,7 +88,7 @@ struct tegra_usb_phy {
        void *config;
        struct regulator *reg_vdd;
        struct regulator *reg_vbus;
-       enum tegra_usb_phy_type usb_phy_type;
+       enum tegra_usb_phy_interface usb_phy_intf;
        bool regulator_on;
        int initialized;
        bool power_on;
@@ -122,7 +105,7 @@ typedef void (*tegra_phy_restore_end_fp)(struct tegra_usb_phy *phy);
 
 struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
                        void *config, enum tegra_usb_phy_mode phy_mode,
-                       enum tegra_usb_phy_type usb_phy_type);
+                       enum tegra_usb_phy_interface usb_phy_type);
 
 int tegra_usb_phy_power_on(struct tegra_usb_phy *phy, bool is_dpd);
 
index 21b867e..ffdf5d3 100644 (file)
@@ -288,49 +288,6 @@ static struct platform_device debug_uart = {
                },
 };
 
-static struct tegra_utmip_config utmi_phy_config[] = {
-       [0] = {
-              .hssync_start_delay = 0,
-              .idle_wait_delay = 17,
-              .elastic_limit = 16,
-              .term_range_adj = 6,
-              .xcvr_setup = 15,
-              .xcvr_lsfslew = 2,
-              .xcvr_lsrslew = 2,
-              },
-       [1] = {
-              .hssync_start_delay = 0,
-              .idle_wait_delay = 17,
-              .elastic_limit = 16,
-              .term_range_adj = 6,
-              .xcvr_setup = 8,
-              .xcvr_lsfslew = 2,
-              .xcvr_lsrslew = 2,
-              },
-};
-
-static struct tegra_ulpi_config ulpi_usb2_config = {
-       .reset_gpio = TEGRA_GPIO_PI5,
-};
-
-static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
-       [0] = {
-              .phy_config = &utmi_phy_config[0],
-              .operating_mode = TEGRA_USB_HOST,
-              .power_down_on_bus_suspend = 0,
-              },
-       [1] = {
-              .phy_config = &ulpi_usb2_config,
-              .operating_mode = TEGRA_USB_HOST,
-              .power_down_on_bus_suspend = 0,
-              .phy_type = TEGRA_USB_PHY_TYPE_LINK_ULPI,
-              },
-       [2] = {
-              .phy_config = &utmi_phy_config[1],
-              .operating_mode = TEGRA_USB_HOST,
-              .power_down_on_bus_suspend = 0,
-              },
-};
 
 static void p852_usb_gpio_config(void)
 {
@@ -529,6 +486,97 @@ static void __init p852_register_spidev(void)
 #define p852_register_spidev() do {} while (0)
 #endif
 
+/*
+  FixMe: Copied below GPIO value from Ventana board.
+  Plz correct it accordingly for embedded board usage
+*/
+#define TEGRA_GPIO_PV1         169
+
+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_ehci_ulpi_link_pdata = {
+       .port_otg = false,
+       .has_hostpc = false,
+       .phy_intf = TEGRA_USB_PHY_INTF_ULPI_LINK,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .vbus_reg = NULL,
+               .hot_plug = false,
+               .remote_wakeup_supported = false,
+               .power_off_on_suspend = false,
+       },
+       .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,
+};
+
+static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
+       .port_otg = false,
+       .has_hostpc = false,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .vbus_reg = NULL,
+               .hot_plug = true,
+               .remote_wakeup_supported = true,
+               .power_off_on_suspend = false,
+       },
+       .u_cfg.utmi = {
+              .hssync_start_delay = 0,
+              .idle_wait_delay = 17,
+              .elastic_limit = 16,
+              .term_range_adj = 6,
+              .xcvr_setup = 15,
+              .xcvr_lsfslew = 2,
+              .xcvr_lsrslew = 2,
+       },
+};
+
+static struct tegra_usb_platform_data tegra_ehci3_utmi_pdata = {
+       .port_otg = false,
+       .has_hostpc = false,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = -1,
+               .vbus_reg = NULL,
+               .hot_plug = true,
+               .remote_wakeup_supported = true,
+               .power_off_on_suspend = false,
+       },
+       .u_cfg.utmi = {
+              .hssync_start_delay = 0,
+              .idle_wait_delay = 17,
+              .elastic_limit = 16,
+              .term_range_adj = 6,
+              .xcvr_setup = 8,
+              .xcvr_lsfslew = 2,
+              .xcvr_lsrslew = 2,
+       },
+};
 static void __init p852_usb_init(void)
 {
 
@@ -541,16 +589,16 @@ static void __init p852_usb_init(void)
           else
         */
        {
-               tegra_ehci1_device.dev.platform_data = &tegra_ehci_pdata[0];
+               tegra_ehci1_device.dev.platform_data = &tegra_ehci1_utmi_pdata;
                platform_device_register(&tegra_ehci1_device);
        }
 
        if (!(p852_sku_peripherals & P852_SKU_ULPI_DISABLE)) {
-               tegra_ehci2_device.dev.platform_data = &tegra_ehci_pdata[1];
+               tegra_ehci2_device.dev.platform_data = &tegra_ehci_ulpi_link_pdata;
                platform_device_register(&tegra_ehci2_device);
        }
 
-       tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata[2];
+       tegra_ehci3_device.dev.platform_data = &tegra_ehci3_utmi_pdata;
        platform_device_register(&tegra_ehci3_device);
 }
 
index 32b869d..e936bd7 100644 (file)
@@ -2498,7 +2498,7 @@ static irqreturn_t usb_phy_vbus_irq_thr(int irq, void *pdata)
 
 struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
                        void *config, enum tegra_usb_phy_mode phy_mode,
-                       enum tegra_usb_phy_type usb_phy_type)
+                       enum tegra_usb_phy_interface usb_phy_intf)
 {
        struct tegra_usb_phy *phy;
        struct tegra_ulpi_config *ulpi_config;
@@ -2518,7 +2518,7 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
        phy->regs = regs;
        phy->config = config;
        phy->mode = phy_mode;
-       phy->usb_phy_type = usb_phy_type;
+       phy->usb_phy_intf = usb_phy_intf;
        phy->initialized = 0;
        phy->regulator_on = 0;
        phy->power_on = 0;
@@ -2527,8 +2527,8 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
        phy->xcvr_setup_value = 0;
 
        if (!phy->config) {
-               if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_LINK_ULPI ||
-                   phy->usb_phy_type == TEGRA_USB_PHY_TYPE_NULL_ULPI) {
+               if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_ULPI_LINK ||
+                   phy->usb_phy_intf == TEGRA_USB_PHY_INTF_ULPI_NULL) {
                        pr_err("%s: ulpi phy configuration missing", __func__);
                        err = -EINVAL;
                        goto err0;
@@ -2546,7 +2546,7 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
        clk_enable(phy->pll_u);
 
        parent_rate = clk_get_rate(clk_get_parent(phy->pll_u));
-       if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_HSIC) {
+       if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_HSIC) {
                for (i = 0; i < ARRAY_SIZE(tegra_uhsic_freq_table); i++) {
                        if (tegra_uhsic_freq_table[i].freq == parent_rate) {
                                phy->freq = &tegra_uhsic_freq_table[i];
@@ -2567,12 +2567,12 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
                goto err1;
        }
 
-       if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_UTMIP) {
+       if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_UTMI) {
                err = utmip_pad_open(phy);
                phy->xcvr_setup_value = tegra_phy_xcvr_setup_value(phy->config);
                if (err < 0)
                        goto err1;
-       } else if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_LINK_ULPI) {
+       } else if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_ULPI_LINK) {
                ulpi_config = config;
 
                if (ulpi_config->clk) {
@@ -2593,7 +2593,7 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
                phy->ulpi->io_priv = regs + ULPI_VIEWPORT;
        }
 #ifndef CONFIG_ARCH_TEGRA_2x_SOC
-       else if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_HSIC) {
+       else if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_HSIC) {
                uhsic_config = config;
                enable_gpio = gpio_request(uhsic_config->enable_gpio,
                        "uhsic_enable");
@@ -2640,7 +2640,7 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
 
 #ifndef CONFIG_ARCH_TEGRA_2x_SOC
        /* Power-up the VBUS detector for UTMIP PHY */
-       if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_UTMIP) {
+       if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_UTMI) {
                unsigned long val;
                void __iomem *pmc_base = IO_ADDRESS(TEGRA_PMC_BASE);
 
@@ -2661,7 +2661,7 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
                        }
                }
        }
-       if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_HSIC) {
+       if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_HSIC) {
                uhsic_powerup_pmc_wake_detect(phy);
        }
 
@@ -2706,8 +2706,8 @@ int tegra_usb_phy_power_on(struct tegra_usb_phy *phy, bool is_dpd)
                mdelay(15);
        }
 
-       if (power_on[phy->usb_phy_type])
-               ret = power_on[phy->usb_phy_type](phy, is_dpd);
+       if (power_on[phy->usb_phy_intf])
+               ret = power_on[phy->usb_phy_intf](phy, is_dpd);
 
        phy->power_on = true;
        return ret;
@@ -2730,8 +2730,8 @@ void tegra_usb_phy_power_off(struct tegra_usb_phy *phy, bool is_dpd)
                (phy->mode == TEGRA_USB_PHY_MODE_DEVICE))
                is_dpd = true;
 
-       if (power_off[phy->usb_phy_type])
-               power_off[phy->usb_phy_type](phy, is_dpd);
+       if (power_off[phy->usb_phy_intf])
+               power_off[phy->usb_phy_intf](phy, is_dpd);
 
        if (phy->reg_vdd && phy->regulator_on && is_dpd) {
 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
@@ -2752,8 +2752,8 @@ void tegra_usb_phy_preresume(struct tegra_usb_phy *phy, bool remote_wakeup)
                uhsic_phy_preresume,
        };
 
-       if (preresume[phy->usb_phy_type])
-               preresume[phy->usb_phy_type](phy, remote_wakeup);
+       if (preresume[phy->usb_phy_intf])
+               preresume[phy->usb_phy_intf](phy, remote_wakeup);
 }
 
 void tegra_usb_phy_postsuspend(struct tegra_usb_phy *phy, bool is_dpd)
@@ -2766,23 +2766,16 @@ void tegra_usb_phy_postsuspend(struct tegra_usb_phy *phy, bool is_dpd)
                uhsic_phy_postsuspend,
        };
 
-       if (postsuspend[phy->usb_phy_type])
-               postsuspend[phy->usb_phy_type](phy, is_dpd);
+       if (postsuspend[phy->usb_phy_intf])
+               postsuspend[phy->usb_phy_intf](phy, is_dpd);
 }
 
 void tegra_usb_phy_postresume(struct tegra_usb_phy *phy, bool is_dpd)
 {
-       const tegra_phy_fp postresume[] = {
-               utmi_phy_postresume,
-               NULL,
-               NULL,
-               NULL,
-       };
-
        usb_phy_set_tx_fill_tuning(phy, is_dpd);
 
        // If Phy type is utmi, call its post resume
-       if (phy->usb_phy_type == 0)
+       if (phy->usb_phy_intf == 0)
                utmi_phy_postresume(phy, is_dpd);
 }
 EXPORT_SYMBOL_GPL(tegra_usb_phy_power_off);
@@ -2796,8 +2789,8 @@ void tegra_ehci_pre_reset(struct tegra_usb_phy *phy, bool is_dpd)
                NULL,
        };
 
-       if (pre_reset[phy->usb_phy_type])
-               pre_reset[phy->usb_phy_type](phy, is_dpd);
+       if (pre_reset[phy->usb_phy_intf])
+               pre_reset[phy->usb_phy_intf](phy, is_dpd);
 }
 EXPORT_SYMBOL_GPL(tegra_usb_phy_preresume);
 
@@ -2810,8 +2803,8 @@ void tegra_ehci_post_reset(struct tegra_usb_phy *phy, bool is_dpd)
                NULL,
        };
 
-       if (post_reset[phy->usb_phy_type])
-               post_reset[phy->usb_phy_type](phy, is_dpd);
+       if (post_reset[phy->usb_phy_intf])
+               post_reset[phy->usb_phy_intf](phy, is_dpd);
 }
 EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume);
 
@@ -2825,8 +2818,8 @@ void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy,
                NULL,
        };
 
-       if (phy_restore_start[phy->usb_phy_type])
-               phy_restore_start[phy->usb_phy_type](phy, port_speed);
+       if (phy_restore_start[phy->usb_phy_intf])
+               phy_restore_start[phy->usb_phy_intf](phy, port_speed);
 }
 EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_start);
 
@@ -2839,32 +2832,32 @@ void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy)
                NULL,
        };
 
-       if (phy_restore_end[phy->usb_phy_type])
-               phy_restore_end[phy->usb_phy_type](phy);
+       if (phy_restore_end[phy->usb_phy_intf])
+               phy_restore_end[phy->usb_phy_intf](phy);
 }
 EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_end);
 
 void tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy)
 {
-       if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_UTMIP)
+       if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_UTMI)
                utmi_phy_clk_disable(phy);
 }
 EXPORT_SYMBOL_GPL(tegra_usb_phy_clk_disable);
 
 void tegra_usb_phy_clk_enable(struct tegra_usb_phy *phy)
 {
-       if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_UTMIP)
+       if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_UTMI)
                utmi_phy_clk_enable(phy);
 }
 EXPORT_SYMBOL_GPL(tegra_usb_phy_clk_enable);
 
 void tegra_usb_phy_close(struct tegra_usb_phy *phy)
 {
-       if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_UTMIP) {
+       if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_UTMI) {
                utmip_pad_close(phy);
                utmip_phy_disable_pmc_bus_ctrl(phy);
        }
-       else if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_LINK_ULPI && phy->clk)
+       else if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_ULPI_LINK && phy->clk)
                clk_put(phy->clk);
        if (phy->mode == TEGRA_USB_PHY_MODE_HOST) {
                vbus_disable(phy);
@@ -2887,7 +2880,7 @@ int tegra_usb_phy_bus_connect(struct tegra_usb_phy *phy)
        void __iomem *base = phy->regs;
        struct tegra_uhsic_config *uhsic_config = phy->config;
 
-       if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_HSIC) {
+       if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_HSIC) {
 #ifndef CONFIG_ARCH_TEGRA_2x_SOC
                val = readl(base + TEGRA_USB_USBMODE_REG_OFFSET);
                val |= TEGRA_USB_USBMODE_HOST;
@@ -2945,7 +2938,7 @@ int tegra_usb_phy_bus_reset(struct tegra_usb_phy *phy)
        unsigned long val;
        void __iomem *base = phy->regs;
 
-       if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_HSIC) {
+       if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_HSIC) {
 #ifndef CONFIG_ARCH_TEGRA_2x_SOC
                /* Change the USB controller PHY type to HSIC */
                val = readl(base + HOSTPC1_DEVLC);
@@ -3034,7 +3027,7 @@ int tegra_usb_phy_bus_idle(struct tegra_usb_phy *phy)
        void __iomem *base = phy->regs;
        struct tegra_uhsic_config *uhsic_config = phy->config;
 
-       if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_HSIC) {
+       if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_HSIC) {
 
 #ifndef CONFIG_ARCH_TEGRA_2x_SOC
                val = readl(base + TEGRA_USB_USBMODE_REG_OFFSET);
@@ -3088,7 +3081,7 @@ bool tegra_usb_phy_is_device_connected(struct tegra_usb_phy *phy)
 {
        void __iomem *base = phy->regs;
 
-       if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_HSIC) {
+       if (phy->usb_phy_intf == TEGRA_USB_PHY_INTF_HSIC) {
                if (utmi_wait_register(base + UHSIC_STAT_CFG0,
                        UHSIC_CONNECT_DETECT, UHSIC_CONNECT_DETECT) < 0) {
                        pr_err("%s: no hsic connection\n", __func__);
@@ -3110,7 +3103,7 @@ bool tegra_usb_phy_charger_detect(struct tegra_usb_phy *phy)
        void __iomem *base = phy->regs;
        bool status;
 
-       if (phy->usb_phy_type != TEGRA_USB_PHY_TYPE_UTMIP)
+       if (phy->usb_phy_intf != TEGRA_USB_PHY_INTF_UTMI)
        {
                /* Charger detection is not there for ULPI
                 * return Charger not available */
index 5808a6e..99698a8 100644 (file)
 #include <linux/device.h>
 #include <linux/usb.h>
 #include <linux/wakelock.h>
+#include <linux/platform_data/tegra_usb.h>
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <mach/tegra-bb-power.h>
 #include <mach/usb_phy.h>
+
 #include "bb-power.h"
 
 static struct tegra_bb_gpio_data m7400_gpios[] = {
@@ -193,20 +195,17 @@ static int m7400_power(int code)
 
 static void m7400_ehci_customize(struct platform_device *pdev)
 {
-       struct tegra_ehci_platform_data *ehci_pdata;
-       struct tegra_uhsic_config *hsic_config;
+       struct tegra_usb_platform_data *ehci_pdata;
 
-       ehci_pdata = (struct tegra_ehci_platform_data *)
+       ehci_pdata = (struct usb_platform_data *)
                        pdev->dev.platform_data;
-       hsic_config = (struct tegra_uhsic_config *)
-                       ehci_pdata->phy_config;
 
        /* Register PHY callbacks */
-       hsic_config->postsuspend = m7400_l2_suspend;
-       hsic_config->preresume = m7400_l2_resume;
+       ehci_pdata->ops->post_suspend = m7400_l2_suspend;
+       ehci_pdata->ops->pre_resume = m7400_l2_resume;
 
        /* Override required settings */
-       ehci_pdata->power_down_on_bus_suspend = 0;
+       ehci_pdata->u_data.host.power_off_on_suspend = false;
 }
 
 static int m7400_attrib_write(struct device *dev, int value)
index e6377c3..9111750 100644 (file)
 #ifndef _TEGRA_USB_H_
 #define _TEGRA_USB_H_
 
-enum tegra_usb_operating_modes {
-       TEGRA_USB_DEVICE,
-       TEGRA_USB_HOST,
-       TEGRA_USB_OTG,
+/**
+ * defines operation mode of the USB controller
+ */
+enum tegra_usb_operation_mode {
+       TEGRA_USB_OPMODE_DEVICE,
+       TEGRA_USB_OPMODE_HOST,
 };
 
-enum tegra_usb_phy_type {
-       TEGRA_USB_PHY_TYPE_UTMIP = 0,
-       TEGRA_USB_PHY_TYPE_LINK_ULPI = 1,
-       TEGRA_USB_PHY_TYPE_NULL_ULPI = 2,
-       TEGRA_USB_PHY_TYPE_HSIC = 3,
-       TEGRA_USB_PHY_TYPE_ICUSB = 4,
+/**
+ * defines the various phy interface mode supported by controller
+ */
+enum tegra_usb_phy_interface {
+       TEGRA_USB_PHY_INTF_UTMI = 0,
+       TEGRA_USB_PHY_INTF_ULPI_LINK = 1,
+       TEGRA_USB_PHY_INTF_ULPI_NULL = 2,
+       TEGRA_USB_PHY_INTF_HSIC = 3,
+       TEGRA_USB_PHY_INTF_ICUSB = 4,
 };
 
-struct tegra_ehci_platform_data {
-       enum tegra_usb_operating_modes operating_mode;
-       /* power down the phy on bus suspend */
-       int power_down_on_bus_suspend;
-       int hotplug;
-       int default_enable;
-       void *phy_config;
-       enum tegra_usb_phy_type phy_type;
+/**
+ * configuration structure for setting up utmi phy
+ */
+struct tegra_utmi_config {
+       u8 hssync_start_delay;
+       u8 elastic_limit;
+       u8 idle_wait_delay;
+       u8 term_range_adj;
+       u8 xcvr_setup;
+       u8 xcvr_lsfslew;
+       u8 xcvr_lsrslew;
+       signed char xcvr_setup_offset;
+       u8 xcvr_use_fuses;
 };
 
-struct tegra_otg_platform_data {
+/**
+ * configuration structure for setting up ulpi phy
+ */
+struct tegra_ulpi_config {
+       u8 shadow_clk_delay;
+       u8 clock_out_delay;
+       u8 data_trimmer;
+       u8 stpdirnxt_trimmer;
+       u8 dir_trimmer;
+       const char *clk;
+};
+
+/**
+ * configuration structure for setting up hsic phy
+ */
+struct tegra_hsic_config {
+       u8 sync_start_delay;
+       u8 idle_wait_delay;
+       u8 term_range_adj;
+       u8 elastic_underrun_limit;
+       u8 elastic_overrun_limit;
+};
+
+/**
+ * Platform specific operations that will be controlled
+ * during the phy operations.
+ */
+struct tegra_usb_phy_platform_ops {
+       void (*open)(void);
+       void (*init)(void);
+       void (*pre_suspend)(void);
+       void (*post_suspend)(void);
+       void (*pre_resume)(void);
+       void (*post_resume)(void);
+       void (*pre_phy_off)(void);
+       void (*post_phy_off)(void);
+       void (*pre_phy_on)(void);
+       void (*post_phy_on)(void);
+       void (*port_power)(void);
+       void (*close)(void);
+};
+
+/**
+ * defines structure for platform dependent device parameters
+ */
+struct tegra_usb_dev_mode_data {
+       int vbus_pmu_irq;
+       int vbus_gpio;
+       bool charging_supported;
+       bool remote_wakeup_supported;
+};
+
+/**
+ * defines structure for platform dependent host parameters
+ */
+struct tegra_usb_host_mode_data {
+       int vbus_gpio;
+       const char *vbus_reg;
+       bool hot_plug;
+       bool remote_wakeup_supported;
+       bool power_off_on_suspend;
+};
+
+/**
+ * defines structure for usb platform data
+ */
+struct tegra_usb_platform_data {
+       bool port_otg;
+       bool has_hostpc;
+       enum tegra_usb_phy_interface phy_intf;
+       enum tegra_usb_operation_mode op_mode;
+
+       union {
+               struct tegra_usb_dev_mode_data dev;
+               struct tegra_usb_host_mode_data host;
+       } u_data;
+
+       union {
+               struct tegra_utmi_config utmi;
+               struct tegra_ulpi_config ulpi;
+               struct tegra_hsic_config hsic;
+       } u_cfg;
+
+       struct tegra_usb_phy_platform_ops *ops;
+};
+
+/**
+ * defines structure for platform dependent OTG parameters
+ */
+struct tegra_usb_otg_data {
        struct platform_device *ehci_device;
-       struct tegra_ehci_platform_data *ehci_pdata;
+       struct tegra_usb_platform_data *ehci_pdata;
 };
 
 #endif /* _TEGRA_USB_H_ */