ARM: tegra: pluto: updating regulators sources for xusb
Sri Krishna chowdary [Fri, 26 Oct 2012 13:51:28 +0000 (18:51 +0530)]
1. Registering XUSB driver as consumer for regulator
   sources on Pluto board.

2. Updating pad parameters for XUSB ports.

Bug 1055592

Change-Id: Ibba14828cd6b85f71299f886b44a49c1c521f6f9
Signed-off-by: Bharath Yadav <byadav@nvidia.com>
Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com>
Signed-off-by: Ajay Gupta <ajayg@nvidia.com>
Reviewed-on: http://git-master/r/190492
(cherry picked from commit 9c24a15d241251904daa032180550d750edd0c8e)

Signed-off-by: JC Kuo <jckuo@nvidia.com>
Change-Id: I06558edc18cd6f53fd54b4dd1063944ab2b42fac
Reviewed-on: http://git-master/r/194687
Reviewed-by: Mandar Padmawar <mpadmawar@nvidia.com>
Tested-by: Mandar Padmawar <mpadmawar@nvidia.com>

arch/arm/mach-tegra/board-pluto-power.c
arch/arm/mach-tegra/board-pluto.c

index bd5b15a..f5cb6db 100644 (file)
@@ -117,6 +117,8 @@ static struct regulator_consumer_supply palmas_smps9_supply[] = {
 static struct regulator_consumer_supply palmas_smps10_supply[] = {
        REGULATOR_SUPPLY("unused_smps10", NULL),
        REGULATOR_SUPPLY("usb_vbus", "tegra-ehci.0"),
+       REGULATOR_SUPPLY("avddio_usb", "tegra-xhci"),
+       REGULATOR_SUPPLY("usb_vbus", "tegra-xhci"),
        REGULATOR_SUPPLY("vdd_vbrtr", NULL),
        REGULATOR_SUPPLY("vdd_lcd", NULL),
 };
@@ -144,6 +146,7 @@ static struct regulator_consumer_supply palmas_ldo3_supply[] = {
        REGULATOR_SUPPLY("avdd_dsi_csi", "vi"),
        REGULATOR_SUPPLY("vddio_hsic", "tegra-ehci.1"),
        REGULATOR_SUPPLY("vddio_hsic", "tegra-ehci.2"),
+       REGULATOR_SUPPLY("vddio_hsic", "tegra-xhci"),
        REGULATOR_SUPPLY("pwrdet_mipi", NULL),
        REGULATOR_SUPPLY("vddio_hsic_bb", NULL),
        REGULATOR_SUPPLY("vddio_hsic_modem2", NULL),
@@ -195,6 +198,7 @@ static struct regulator_consumer_supply palmas_ldousb_supply[] = {
        REGULATOR_SUPPLY("avdd_usb", "tegra-ehci.1"),
        REGULATOR_SUPPLY("avdd_usb", "tegra-ehci.2"),
        REGULATOR_SUPPLY("hvdd_usb", "tegra-ehci.2"),
+       REGULATOR_SUPPLY("hvdd_usb", "tegra-xhci"),
        REGULATOR_SUPPLY("avdd_hdmi", "tegradc.1"),
        REGULATOR_SUPPLY("vddio_hv", "tegradc.1"),
        REGULATOR_SUPPLY("pwrdet_hv", NULL),
@@ -393,6 +397,7 @@ static struct regulator_consumer_supply fixed_reg_en_vdd_1v2_cam_supply[] = {
 static struct regulator_consumer_supply fixed_reg_en_avdd_usb3_1v05_supply[] = {
        REGULATOR_SUPPLY("avdd_usb_pll", "tegra-ehci.2"),
        REGULATOR_SUPPLY("avddio_usb", "tegra-ehci.2"),
+       REGULATOR_SUPPLY("avdd_usb_pll", "tegra-xhci"),
 };
 
 static struct regulator_consumer_supply fixed_reg_en_vdd_mmc_sdmmc3_supply[] = {
index c02516d..806e78e 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/gpio.h>
 #include <linux/input.h>
 #include <linux/platform_data/tegra_usb.h>
+#include <linux/platform_data/tegra_xusb.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/rm31080a_ts.h>
 #include <linux/tegra_uart.h>
@@ -1014,9 +1015,52 @@ static void pluto_modem_init(void)
        }
 }
 
+static struct tegra_xusb_pad_data xusb_padctl_data = {
+       .pad_mux = 0x1,
+       .port_cap = 0x1,
+       .snps_oc_map = 0x1ff,
+       .usb2_oc_map = 0x3c,
+       .ss_port_map = 0x2,
+       .oc_det = 0,
+       .rx_wander = 0xf0,
+       .otg_pad0_ctl0 = 0xffc7ffff,
+       .otg_pad0_ctl1 = 0x7,
+       .otg_pad1_ctl0 = 0xffffffff,
+       .otg_pad1_ctl1 = 0,
+       .bias_pad_ctl0 = 0,
+       .hsic_pad0_ctl0 = 0xffff00ff,
+       .hsic_pad0_ctl1 = 0xffff00ff,
+       .pmc_value = 0xfffffff0,
+};
+
+static void pluto_xusb_init(void)
+{
+       int usb_port_owner_info = tegra_get_usb_port_owner_info();
+
+       if (usb_port_owner_info & UTMI1_PORT_OWNER_XUSB) {
+               u32 usb_calib0 = tegra_fuse_readl(FUSE_SKU_USB_CALIB_0);
+
+               /*
+                * read from usb_calib0 and pass to driver
+                * set HS_CURR_LEVEL = usb_calib0[5:0]
+                * set TERM_RANGE_ADJ = usb_calib0[10:7]
+                * set HS_IREF_CAP = usb_calib0[14:13]
+                * set HS_SQUELCH_LEVEL = usb_calib0[12:11]
+                */
+
+               xusb_padctl_data.hs_curr_level = (usb_calib0 >> 0) & 0x3f;
+               xusb_padctl_data.hs_iref_cap = (usb_calib0 >> 13) & 0x3;
+               xusb_padctl_data.hs_term_range_adj = (usb_calib0 >> 7) & 0xf;
+               xusb_padctl_data.hs_squelch_level = (usb_calib0 >> 11) & 0x3;
+
+               tegra_xhci_device.dev.platform_data = &xusb_padctl_data;
+               platform_device_register(&tegra_xhci_device);
+       }
+}
 #else
 static void pluto_usb_init(void) { }
 static void pluto_modem_init(void) { }
+static void pluto_xusb_init(void) { }
 #endif
 
 static void pluto_audio_init(void)
@@ -1173,6 +1217,7 @@ static void __init tegra_pluto_init(void)
        pluto_i2c_init();
        pluto_spi_init();
        pluto_usb_init();
+       pluto_xusb_init();
        pluto_uart_init();
        pluto_audio_init();
        platform_add_devices(pluto_devices, ARRAY_SIZE(pluto_devices));