summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuresh Mangipudi <smangipudi@nvidia.com>2011-02-11 11:32:08 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2011-04-26 15:51:37 -0700
commite8bf11a59f1b594d377ca35453c2a44230f9338b (patch)
tree1ac44a2e00f2b3a1e04b9e25ae1d97ca38ac7acd
parente122444f84b778d5026e2b3595f133ff110553a7 (diff)
arm: tegra: usb: Enable Host mode on USB2-UTMI port
Enable the host mode on usb2 UTMI phy interface Bug 787810 Original-Change-Id: Ia7da2a0d196f900f80812b987c9fb5302412e751 Reviewed-on: http://git-master/r/18729 Reviewed-by: Suresh Mangipudi <smangipudi@nvidia.com> Tested-by: Suresh Mangipudi <smangipudi@nvidia.com> Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Change-Id: I2e7306b82926f2ca566d595dc75252d4881306fb
-rw-r--r--arch/arm/mach-tegra/board-cardhu.c47
-rw-r--r--arch/arm/mach-tegra/include/mach/usb_phy.h11
-rw-r--r--arch/arm/mach-tegra/usb_phy.c10
-rw-r--r--drivers/usb/gadget/fsl_tegra_udc.c2
-rw-r--r--drivers/usb/host/ehci-tegra.c2
-rw-r--r--include/linux/fsl_devices.h8
-rw-r--r--include/linux/platform_data/tegra_usb.h8
7 files changed, 52 insertions, 36 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu.c b/arch/arm/mach-tegra/board-cardhu.c
index 6652ead63616..791787c439a6 100644
--- a/arch/arm/mach-tegra/board-cardhu.c
+++ b/arch/arm/mach-tegra/board-cardhu.c
@@ -54,7 +54,6 @@
#include "gpio-names.h"
#include "fuse.h"
-#define ENABLE_USB_HOST 0
static struct usb_mass_storage_platform_data tegra_usb_fsg_platform = {
.vendor = "NVIDIA",
@@ -70,7 +69,6 @@ static struct platform_device tegra_usb_fsg_device = {
},
};
-
static struct plat_serial8250_port debug_uart_platform_data[] = {
{
.membase = IO_ADDRESS(TEGRA_UARTA_BASE),
@@ -110,19 +108,21 @@ static struct tegra_utmip_config utmi_phy_config[] = {
.idle_wait_delay = 17,
.elastic_limit = 16,
.term_range_adj = 6,
+ .xcvr_setup = 15,
+ .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_lsfslew = 2,
.xcvr_lsrslew = 2,
},
};
-/* !!!TODO: Change for cardhu (Taken from Ventana) */
-static struct tegra_ulpi_config ulpi_phy_config = {
- /* !!!TODO!!! CABLE DETECT? if so GPIO_PC7 on cardhu */
- .reset_gpio = TEGRA_GPIO_PG2,
- .clk = "clk_dev2",
-};
-
#ifdef CONFIG_BCM4329_RFKILL
static struct resource cardhu_bcm4329_rfkill_resources[] = {
{
@@ -215,18 +215,6 @@ static struct i2c_board_info __initdata cardhu_i2c_bus1_board_info[] = {
},
};
-
-static struct tegra_ulpi_config cardhu_ehci2_ulpi_phy_config = {
- .reset_gpio = TEGRA_GPIO_PV1,
- .clk = "clk_dev2",
-};
-
-static struct tegra_ehci_platform_data cardhu_ehci2_ulpi_platform_data = {
- .operating_mode = TEGRA_USB_HOST,
- .power_down_on_bus_suspend = 0,
- .phy_config = &cardhu_ehci2_ulpi_phy_config,
-};
-
static struct tegra_i2c_platform_data cardhu_i2c1_platform_data = {
.adapter_nr = 0,
.bus_count = 1,
@@ -330,9 +318,6 @@ static struct platform_device *cardhu_devices[] __initdata = {
&pmu_device,
&tegra_rtc_device,
&tegra_udc_device,
-#if ENABLE_USB_HOST
- &tegra_ehci2_device,
-#endif
#if defined(CONFIG_SND_HDA_TEGRA)
&tegra_hda_device,
#endif
@@ -352,16 +337,19 @@ static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
.phy_config = &utmi_phy_config[0],
.operating_mode = TEGRA_USB_HOST,
.power_down_on_bus_suspend = 0,
+ .usb_phy_type = TEGRA_USB_PHY_TYPE_UTMIP,
},
[1] = {
- .phy_config = &ulpi_phy_config,
+ .phy_config = &utmi_phy_config[1],
.operating_mode = TEGRA_USB_HOST,
- .power_down_on_bus_suspend = 1,
+ .power_down_on_bus_suspend = 0,
+ .usb_phy_type = TEGRA_USB_PHY_TYPE_UTMIP,
},
[2] = {
- .phy_config = &utmi_phy_config[1],
+ .phy_config = &utmi_phy_config[2],
.operating_mode = TEGRA_USB_HOST,
.power_down_on_bus_suspend = 0,
+ .usb_phy_type = TEGRA_USB_PHY_TYPE_UTMIP,
},
};
@@ -422,6 +410,9 @@ static void cardhu_usb_init(void)
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];
+ platform_device_register(&tegra_ehci2_device);
+
tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata[2];
platform_device_register(&tegra_ehci3_device);
}
@@ -452,8 +443,6 @@ static void __init tegra_cardhu_init(void)
andusb_plat.serial_number = kstrdup(serial, GFP_KERNEL);
tegra_audio_device.dev.platform_data = &tegra_audio_pdata[0];
tegra_spdif_device.dev.platform_data = &tegra_spdif_pdata;
- tegra_ehci2_device.dev.platform_data
- = &cardhu_ehci2_ulpi_platform_data;
platform_add_devices(cardhu_devices, ARRAY_SIZE(cardhu_devices));
cardhu_sdhci_init();
diff --git a/arch/arm/mach-tegra/include/mach/usb_phy.h b/arch/arm/mach-tegra/include/mach/usb_phy.h
index 17ea1a214185..41132aa51689 100644
--- a/arch/arm/mach-tegra/include/mach/usb_phy.h
+++ b/arch/arm/mach-tegra/include/mach/usb_phy.h
@@ -73,6 +73,13 @@ enum tegra_usb_phy_mode {
TEGRA_USB_PHY_MODE_HOST,
};
+enum tegra_usb_phy_type {
+ TEGRA_USB_PHY_TYPE_UTMIP = 1,
+ TEGRA_USB_PHY_TYPE_ULPI = 2,
+ TEGRA_USB_PHY_TYPE_HSIC = 3,
+ TEGRA_USB_PHY_TYPE_ICUSB = 4,
+};
+
struct usb_phy_plat_data {
int instance;
int vbus_irq;
@@ -92,12 +99,14 @@ struct tegra_usb_phy {
enum tegra_usb_phy_mode mode;
void *config;
struct regulator *reg_vbus;
+ enum tegra_usb_phy_type usb_phy_type;
bool regulator_on;
struct otg_transceiver *ulpi;
};
struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
- void *config, enum tegra_usb_phy_mode phy_mode);
+ void *config, enum tegra_usb_phy_mode phy_mode,
+ enum tegra_usb_phy_type usb_phy_type);
int tegra_usb_phy_power_on(struct tegra_usb_phy *phy);
diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c
index 0327aabc679a..569ac034de4b 100644
--- a/arch/arm/mach-tegra/usb_phy.c
+++ b/arch/arm/mach-tegra/usb_phy.c
@@ -1235,7 +1235,8 @@ 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)
+ void *config, enum tegra_usb_phy_mode phy_mode,
+ enum tegra_usb_phy_type usb_phy_type)
{
struct tegra_usb_phy *phy;
struct tegra_ulpi_config *ulpi_config;
@@ -1253,6 +1254,7 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
phy->config = config;
phy->mode = phy_mode;
phy->regulator_on = 0;
+ phy->usb_phy_type = usb_phy_type;
if (!phy->config) {
if (phy_is_ulpi(phy)) {
@@ -1299,7 +1301,7 @@ struct tegra_usb_phy *tegra_usb_phy_open(int instance, void __iomem *regs,
goto err1;
}
- if (phy_is_ulpi(phy)) {
+ if (phy->usb_phy_type == TEGRA_USB_PHY_TYPE_ULPI) {
ulpi_config = config;
if (ulpi_config->inf_type == TEGRA_USB_LINK_ULPI) {
@@ -1404,7 +1406,7 @@ void tegra_usb_phy_power_off(struct tegra_usb_phy *phy)
void tegra_usb_phy_preresume(struct tegra_usb_phy *phy)
{
- if (!phy_is_ulpi(phy))
+ if (phy->usb_phy_type != TEGRA_USB_PHY_TYPE_ULPI)
utmi_phy_preresume(phy);
}
@@ -1436,7 +1438,7 @@ void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy)
void tegra_usb_phy_clk_disable(struct tegra_usb_phy *phy)
{
- if (!phy_is_ulpi(phy))
+ if (phy->usb_phy_type != TEGRA_USB_PHY_TYPE_ULPI)
utmi_phy_clk_disable(phy);
}
diff --git a/drivers/usb/gadget/fsl_tegra_udc.c b/drivers/usb/gadget/fsl_tegra_udc.c
index 14e62f40a50a..87b1d5d92cd5 100644
--- a/drivers/usb/gadget/fsl_tegra_udc.c
+++ b/drivers/usb/gadget/fsl_tegra_udc.c
@@ -63,7 +63,7 @@ int fsl_udc_clk_init(struct platform_device *pdev)
instance = 0;
phy = tegra_usb_phy_open(instance, udc_base, pdata->phy_config,
- TEGRA_USB_PHY_MODE_DEVICE);
+ TEGRA_USB_PHY_MODE_DEVICE, pdata->usb_phy_type);
if (IS_ERR(phy)) {
dev_err(&pdev->dev, "Can't open phy\n");
err = PTR_ERR(phy);
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 8c4ec25a9ad3..b9917ce8c433 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -865,7 +865,7 @@ static int tegra_ehci_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&tegra->work, tegra_hsic_connection_work);
tegra->phy = tegra_usb_phy_open(instance, hcd->regs, pdata->phy_config,
- TEGRA_USB_PHY_MODE_HOST);
+ TEGRA_USB_PHY_MODE_HOST, pdata->usb_phy_type);
if (IS_ERR(tegra->phy)) {
dev_err(&pdev->dev, "Failed to open USB phy\n");
err = -ENXIO;
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index b39a195775e3..9517375ba9f7 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -58,12 +58,20 @@ enum fsl_usb2_phy_modes {
FSL_USB2_PHY_SERIAL,
};
+enum fsl_usb2_phy_types {
+ FSL_USB2_PHY_TYPE_UTMIP = 1,
+ FSL_USB2_PHY_TYPE_ULPI = 2,
+ FSL_USB2_PHY_TYPE_HSIC = 3,
+ FSL_USB2_PHY_TYPE_ICUSB = 4,
+};
+
struct fsl_usb2_platform_data {
/* board specific information */
enum fsl_usb2_operating_modes operating_mode;
enum fsl_usb2_phy_modes phy_mode;
unsigned int port_enables;
void *phy_config;
+ enum fsl_usb2_phy_types usb_phy_type;
};
/* Flags in fsl_usb2_mph_platform_data */
diff --git a/include/linux/platform_data/tegra_usb.h b/include/linux/platform_data/tegra_usb.h
index e48ac43dd047..07ef48b69481 100644
--- a/include/linux/platform_data/tegra_usb.h
+++ b/include/linux/platform_data/tegra_usb.h
@@ -21,11 +21,19 @@ enum tegra_usb_operating_modes {
TEGRA_USB_OTG,
};
+enum tegra_usb_phy_host_type {
+ TEGRA_USB_PHY_HOST_TYPE_UTMIP = 1,
+ TEGRA_USB_PHY_HOST_TYPE_ULPI = 2,
+ TEGRA_USB_PHY_HOST_TYPE_HSIC = 3,
+ TEGRA_USB_PHY_HOST_TYPE_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;
void *phy_config;
+ enum tegra_usb_phy_host_type usb_phy_type;
};
struct tegra_otg_platform_data {