ARM: tegra: usb: support xusb on otg port
Rohith Seelaboyina [Wed, 28 Aug 2013 14:52:06 +0000 (19:52 +0530)]
platform data to support changing port ownership
to xusb when port 0 is in host mode

Bug 1307598

Change-Id: I3fd332b07ebfbb8b3baca400500a7e984c88a99e
Signed-off-by: Rohith Seelaboyina <rseelaboyina@nvidia.com>
Reviewed-on: http://git-master/r/265537
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jui Chang Kuo <jckuo@nvidia.com>
Reviewed-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>

arch/arm/mach-tegra/board-ardbeg.c
arch/arm/mach-tegra/board-pluto.c
arch/arm/mach-tegra/include/mach/tegra_usb_pad_ctrl.h
arch/arm/mach-tegra/include/mach/tegra_usb_pmc.h
include/linux/platform_data/tegra_usb.h

index bb41df5..10e0b66 100644 (file)
@@ -626,11 +626,17 @@ static void ardbeg_usb_init(void)
        }
 
        if (!(usb_port_owner_info & UTMI1_PORT_OWNER_XUSB)) {
-               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;
+               tegra_otg_pdata.is_xhci = false;
+               tegra_udc_pdata.u_data.dev.is_xhci = false;
+       } else {
+               tegra_otg_pdata.is_xhci = true;
+               tegra_udc_pdata.u_data.dev.is_xhci = true;
        }
+       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 (!(usb_port_owner_info & UTMI2_PORT_OWNER_XUSB)) {
                if (!modem_id) {
                        tegra_ehci2_device.dev.platform_data =
index 24802b7..5af4fe9 100644 (file)
@@ -997,12 +997,17 @@ static void pluto_usb_init(void)
        int usb_port_owner_info = tegra_get_usb_port_owner_info();
 
        if (!(usb_port_owner_info & UTMI1_PORT_OWNER_XUSB)) {
-               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;
+               tegra_otg_pdata.is_xhci = false;
+               tegra_udc_pdata.u_data.dev.is_xhci = false;
+       } else {
+               tegra_otg_pdata.is_xhci = true;
+               tegra_udc_pdata.u_data.dev.is_xhci = true;
        }
+       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;
 }
 
 static void pluto_modem_init(void)
index f22b6ce..4f13920 100644 (file)
 #define SSP1_ELPG_CLAMP_EN_EARLY       (1 << 21)
 #define SSP1_ELPG_VCORE_DOWN           (1 << 22)
 
+#define XUSB_PADCTL_USB2_PAD_MUX_0             0x4
+#define USB2_OTG_PAD_PORT0_MASK                        0x3
+#define USB2_OTG_PAD_PORT0_SNPS                        0x0
+#define USB2_OTG_PAD_PORT0_XUSB                        0x1
+
 #define XUSB_PADCTL_USB3_PAD_MUX_0             0x134
 #define XUSB_PADCTL_USB3_PAD_MUX_FORCE_PCIE_PAD_IDDQ_DISABLE_MASK0     (1 << 1)
 #define XUSB_PADCTL_USB3_PAD_MUX_FORCE_PCIE_PAD_IDDQ_DISABLE_MASK1     (1 << 2)
 #define SATA_SEQ_ENABLE                                (1 << 24)
 #define SATA_SEQ_START_STATE                   (1 << 25)
 
+void tegra_xhci_release_otg_port(bool release);
 void tegra_xhci_ss_wake_on_interrupts(u32 portmap, bool enable);
 void tegra_xhci_hs_wake_on_interrupts(u32 portmap, bool enable);
 void tegra_xhci_ss_wake_signal(u32 portmap, bool enable);
index 285e2ae..0191d52 100644 (file)
@@ -258,6 +258,7 @@ struct tegra_usb_pmc_data {
        enum tegra_usb_phy_interface phy_type;
        enum tegra_usb_port_speed port_speed;
        struct tegra_usb_pmc_ops *pmc_ops;
+       bool is_xhci;
        void __iomem *usb_base;
        u32 utmip_rctrl_val;
        u32 utmip_tctrl_val;
index 139ab61..64d2765 100644 (file)
@@ -103,6 +103,7 @@ struct tegra_usb_dev_mode_data {
        int vbus_gpio;
        bool charging_supported;
        bool remote_wakeup_supported;
+       bool is_xhci;
 };
 
 /**
@@ -150,6 +151,7 @@ struct tegra_usb_otg_data {
        char *vbus_extcon_dev_name;
        char *id_extcon_dev_name;
        int id_det_gpio;
+       bool is_xhci;
 };
 
 #endif /* _TEGRA_USB_H_ */