ARM: tegra: Check regulator_enable return values
[linux-3.10.git] / arch / arm / mach-tegra / board-pluto.c
index fe820b7..54ccf4b 100644 (file)
@@ -31,7 +31,6 @@
 #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>
@@ -54,8 +53,6 @@
 #include <linux/mfd/tlv320aic3xxx-core.h>
 #include <linux/usb/tegra_usb_phy.h>
 
-#include <asm/hardware/gic.h>
-
 #include <mach/clk.h>
 #include <mach/irqs.h>
 #include <mach/pinmux.h>
@@ -71,6 +68,7 @@
 #include <mach/tegra-bb-power.h>
 #include <mach/tegra_wakeup_monitor.h>
 #include <linux/platform_data/tegra_usb_modem_power.h>
+#include <mach/xusb.h>
 
 #include "board.h"
 #include "board-common.h"
@@ -878,10 +876,12 @@ static int baseband_init(void)
        }
 
        baseband_reg = regulator_get(NULL, "vdd_core_bb");
-       if (IS_ERR_OR_NULL(baseband_reg))
+       if (IS_ERR(baseband_reg))
                pr_warn("%s: baseband regulator get failed\n", __func__);
-       else
-               regulator_enable(baseband_reg);
+       else {
+               if (regulator_enable(baseband_reg) != 0)
+                       pr_warn("baseband regulator enable failed\n");
+       }
 
        /* enable pull-up for MDM1 UART RX */
        tegra_pinmux_set_pullupdown(TEGRA_PINGROUP_GPIO_PU1,
@@ -1032,13 +1032,6 @@ 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)) {
-               if ((tegra_get_chipid() == TEGRA_CHIPID_TEGRA11) &&
-                       (tegra_revision == TEGRA_REVISION_A02)) {
-                       tegra_ehci1_utmi_pdata \
-                       .unaligned_dma_buf_supported = true;
-                       tegra_udc_pdata \
-                       .unaligned_dma_buf_supported = true;
-               }
                tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
                platform_device_register(&tegra_otg_device);
 
@@ -1058,22 +1051,12 @@ static void pluto_modem_init(void)
 
        switch (modem_id) {
        case TEGRA_BB_I500: /* on board i500 HSIC */
-               if (!(usb_port_owner_info & HSIC1_PORT_OWNER_XUSB)) {
-                       if ((tegra_get_chipid() == TEGRA_CHIPID_TEGRA11) &&
-                               (tegra_revision == TEGRA_REVISION_A02))
-                               tegra_ehci2_hsic_baseband_pdata \
-                               .unaligned_dma_buf_supported = true;
+               if (!(usb_port_owner_info & HSIC1_PORT_OWNER_XUSB))
                        platform_device_register(&icera_baseband_device);
-               }
                break;
        case TEGRA_BB_I500SWD: /* i500 SWD HSIC */
-               if (!(usb_port_owner_info & HSIC2_PORT_OWNER_XUSB)) {
-                       if ((tegra_get_chipid() == TEGRA_CHIPID_TEGRA11) &&
-                               (tegra_revision == TEGRA_REVISION_A02))
-                               tegra_ehci3_hsic_baseband2_pdata \
-                               .unaligned_dma_buf_supported = true;
+               if (!(usb_port_owner_info & HSIC2_PORT_OWNER_XUSB))
                        platform_device_register(&icera_baseband2_device);
-               }
                break;
        case TEGRA_BB_OEM1:     /* OEM1 HSIC */
                if ((board_info.board_id == BOARD_E1575) ||
@@ -1087,10 +1070,6 @@ static void pluto_modem_init(void)
                        tegra_hsic_pdata.ops = &oem1_hsic_pops;
                        tegra_ehci3_device.dev.platform_data
                                = &tegra_hsic_pdata;
-                       if ((tegra_get_chipid() == TEGRA_CHIPID_TEGRA11) &&
-                               (tegra_revision == TEGRA_REVISION_A02))
-                               tegra_hsic_pdata \
-                               .unaligned_dma_buf_supported = true;
                        platform_device_register(&tegra_bb_oem1);
                }
                break;
@@ -1145,10 +1124,6 @@ static void pluto_modem_init(void)
                break;
        case TEGRA_BB_HSIC_HUB: /* HSIC hub */
                if (!(usb_port_owner_info & HSIC2_PORT_OWNER_XUSB)) {
-                       if ((tegra_get_chipid() == TEGRA_CHIPID_TEGRA11) &&
-                               (tegra_revision == TEGRA_REVISION_A02))
-                               tegra_ehci3_hsic_smsc_hub_pdata \
-                               .unaligned_dma_buf_supported = true;
                        tegra_ehci3_device.dev.platform_data =
                                &tegra_ehci3_hsic_smsc_hub_pdata;
                        platform_device_register(&tegra_ehci3_device);
@@ -1159,54 +1134,18 @@ static void pluto_modem_init(void)
        }
 }
 
-static struct tegra_xusb_pad_data xusb_padctl_data = {
-       .pad_mux = (0x1 << 0),
-       .port_cap = (0x1 << 0),
-       .snps_oc_map = (0x1ff << 0),
-       .usb2_oc_map = (0x3c << 0),
-       .ss_port_map = (0x0 << 0),
-       .oc_det = (0x3f << 10),
-       .rx_wander = (0xf << 4),
-       .rx_eq = (0x3070 << 8),
-       .cdr_cntl = (0x26 << 24),
-       .dfe_cntl = 0x002008EE,
-       .hs_slew = (0xE << 6),
-       .ls_rslew = (0x3 << 14),
-       .otg_pad0_ctl0 = (0x0 << 19),
-       .otg_pad1_ctl0 = (0x7 << 19),
-       .otg_pad0_ctl1 = (0x3 << 0),
-       .otg_pad1_ctl1 = (0x4 << 0),
-       .hs_disc_lvl = (0x5 << 2),
-       .hsic_pad0_ctl0 = (0x00 << 8),
-       .hsic_pad0_ctl1 = (0x00 << 8),
+static struct tegra_xusb_board_data xusb_bdata = {
+       .portmap = TEGRA_XUSB_SS_P0 | TEGRA_XUSB_USB2_P0,
+       /* ss_portmap[0:3] = SS0 map, ss_portmap[4:7] = SS1 map */
+       .ss_portmap = (TEGRA_XUSB_SS_PORT_MAP_USB2_P0 << 0),
 };
 
 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);
-
-               pr_info("dalmore_xusb_init: usb_calib0 = 0x%08x\n", usb_calib0);
-               /*
-                * read from usb_calib0 and pass to driver
-                * set HS_CURR_LEVEL (PAD0)     = usb_calib0[5:0]
-                * set TERM_RANGE_ADJ           = usb_calib0[10:7]
-                * set HS_SQUELCH_LEVEL         = usb_calib0[12:11]
-                * set HS_IREF_CAP              = usb_calib0[14:13]
-                * set HS_CURR_LEVEL (PAD1)     = usb_calib0[20:15]
-                */
-
-               xusb_padctl_data.hs_curr_level_pad0 = (usb_calib0 >> 0) & 0x3f;
-               xusb_padctl_data.hs_term_range_adj = (usb_calib0 >> 7) & 0xf;
-               xusb_padctl_data.hs_squelch_level = (usb_calib0 >> 11) & 0x3;
-               xusb_padctl_data.hs_iref_cap = (usb_calib0 >> 13) & 0x3;
-               xusb_padctl_data.hs_curr_level_pad1 = (usb_calib0 >> 15) & 0x3f;
-
-               tegra_xhci_device.dev.platform_data = &xusb_padctl_data;
-               platform_device_register(&tegra_xhci_device);
-       }
+       if (usb_port_owner_info & UTMI1_PORT_OWNER_XUSB)
+               tegra_xusb_init(&xusb_bdata);
 }
 #else
 static void pluto_usb_init(void) { }
@@ -1322,7 +1261,7 @@ static struct spi_board_info synaptics_9999_spi_board_pluto[] = {
 static int __init pluto_touch_init(void)
 {
        tegra_clk_init_from_table(touch_clk_init_table);
-       if (tegra_get_touch_id() == RAYDIUM_TOUCH) {
+       if (tegra_get_touch_vendor_id() == RAYDIUM_TOUCH) {
                pr_info("%s: initializing raydium\n", __func__);
                rm31080a_pluto_spi_board[0].irq =
                        gpio_to_irq(TOUCH_GPIO_IRQ_RAYDIUM_SPI);
@@ -1435,6 +1374,7 @@ static void __init tegra_pluto_late_init(void)
        pluto_soctherm_init();
        tegra_register_fuse();
        pluto_sysedp_core_init();
+       pluto_sysedp_psydepl_init();
 }
 
 static void __init pluto_ramconsole_reserve(unsigned long size)
@@ -1476,8 +1416,7 @@ MACHINE_START(TEGRA_PLUTO, "tegra_pluto")
        .reserve        = tegra_pluto_reserve,
        .init_early     = tegra11x_init_early,
        .init_irq       = tegra_dt_init_irq,
-       .handle_irq     = gic_handle_irq,
-       .timer          = &tegra_sys_timer,
+       .init_time      = tegra_init_timer,
        .init_machine   = tegra_pluto_dt_init,
        .restart        = tegra_assert_system_reset,
        .dt_compat      = pluto_dt_board_compat,