From 89da52e28b4fbbe9af0310f3fd82adafc7fa1d23 Mon Sep 17 00:00:00 2001 From: Steve Lin Date: Wed, 20 Jun 2012 12:59:43 -0700 Subject: arm: tegra: usb: restore the AP/modem handshaking Restore the AP/modem handshaking functions and clean up the null phy driver. Bug 996035 Signed-off-by: Steve Lin Reviewed-on: http://git-master/r/109044 (cherry picked from commit ff27e8a48a53fe70949d95915f62dd2e03c73df7) Change-Id: I12a2401a7fcc540a657ab15378d440ef85561001 Reviewed-on: http://git-master/r/110145 Reviewed-by: Automatic_Commit_Validation_User Tested-by: Steve Lin Reviewed-by: Steve Lin --- arch/arm/mach-tegra/board-whistler-baseband.c | 95 +++------------------------ 1 file changed, 9 insertions(+), 86 deletions(-) (limited to 'arch/arm/mach-tegra/board-whistler-baseband.c') diff --git a/arch/arm/mach-tegra/board-whistler-baseband.c b/arch/arm/mach-tegra/board-whistler-baseband.c index b602cd3f44c1..ad3dbd316ded 100644 --- a/arch/arm/mach-tegra/board-whistler-baseband.c +++ b/arch/arm/mach-tegra/board-whistler-baseband.c @@ -1,7 +1,7 @@ /* * arch/arm/mach-tegra/board-whistler-baseband.c * - * Copyright (C) 2011 NVIDIA Corporation + * Copyright (c) 2011-2012, NVIDIA CORPORATION. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and @@ -16,32 +16,18 @@ #include #include -#include -#include -#include #include - #include "board.h" #include "board-whistler-baseband.h" -static void baseband_phy_init(void); -static void baseband_phy_on(void); -static void baseband_pre_phy_off(void); -static void baseband_post_phy_off(void); -static bool ap2mdm_ack_gpio_off = false; static struct wake_lock mdm_wake_lock; static struct gpio modem_gpios[] = { {MODEM_PWR_ON, GPIOF_OUT_INIT_LOW, "MODEM PWR ON"}, {MODEM_RESET, GPIOF_IN, "MODEM RESET"}, {BB_RST_OUT, GPIOF_IN, "BB RST OUT"}, - {MDM2AP_ACK, GPIOF_IN, "MDM2AP_ACK"}, {AP2MDM_ACK2, GPIOF_OUT_INIT_HIGH, "AP2MDM ACK2"}, {AP2MDM_ACK, GPIOF_OUT_INIT_LOW, "AP2MDM ACK"}, - {ULPI_STP, GPIOF_IN, "ULPI_STP"}, - {ULPI_DIR, GPIOF_OUT_INIT_LOW, "ULPI_DIR"}, - {ULPI_D0, GPIOF_OUT_INIT_LOW, "ULPI_D0"}, - {ULPI_D1, GPIOF_OUT_INIT_LOW, "ULPI_D1"}, }; static __initdata struct tegra_pingroup_config whistler_null_ulpi_pinmux[] = { @@ -57,11 +43,12 @@ static __initdata struct tegra_pingroup_config whistler_null_ulpi_pinmux[] = { TEGRA_TRI_NORMAL}, }; +static void baseband_post_phy_on(void); +static void baseband_pre_phy_off(void); + static struct tegra_usb_phy_platform_ops ulpi_null_plat_ops = { - .init = baseband_phy_init, .pre_phy_off = baseband_pre_phy_off, - .post_phy_off = baseband_post_phy_off, - .post_phy_on = baseband_phy_on, + .post_phy_on = baseband_post_phy_on, }; static struct tegra_usb_platform_data tegra_ehci2_ulpi_null_pdata = { @@ -83,6 +70,7 @@ static struct tegra_usb_platform_data tegra_ehci2_ulpi_null_pdata = { .stpdirnxt_trimmer = 1, .dir_trimmer = 1, .clk = NULL, + .phy_restore_gpio = MDM2AP_ACK, }, .ops = &ulpi_null_plat_ops, }; @@ -107,72 +95,18 @@ static irqreturn_t mdm_start_thread(int irq, void *data) return IRQ_HANDLED; } -static inline void null_phy_set_tristate(bool enable) +static void baseband_post_phy_on(void) { - int tristate = (enable) ? TEGRA_TRI_TRISTATE : TEGRA_TRI_NORMAL; - - tegra_pinmux_set_tristate(TEGRA_PINGROUP_UDA, tristate); - tegra_pinmux_set_tristate(TEGRA_PINGROUP_UAA, tristate); - tegra_pinmux_set_tristate(TEGRA_PINGROUP_UAB, tristate); -} - -static void baseband_phy_init(void) -{ - static bool phy_init; - - if (!phy_init) { - /* set AP2MDM_ACK2 low */ - gpio_set_value(AP2MDM_ACK2, 0); - phy_init = true; - } - pr_info("%s\n", __func__); + /* set AP2MDM_ACK2 low */ + gpio_set_value(AP2MDM_ACK2, 0); } static void baseband_pre_phy_off(void) { /* set AP2MDM_ACK2 high */ gpio_set_value(AP2MDM_ACK2, 1); - ap2mdm_ack_gpio_off = true; -} - -static void baseband_post_phy_off(void) -{ - null_phy_set_tristate(true); } -static void baseband_phy_on(void) -{ - if (ap2mdm_ack_gpio_off) { - - /* driving linestate using GPIO */ - gpio_set_value(ULPI_D0, 0); - gpio_set_value(ULPI_D1, 0); - - /* driving DIR high */ - gpio_set_value(ULPI_DIR, 1); - - /* remove ULPI tristate */ - null_phy_set_tristate(false); - - gpio_set_value(AP2MDM_ACK2, 0); - - if (gpio_is_valid(MDM2AP_ACK2)) { - int retry = 20000; - while (retry) { - /* poll phy_restore_gpio high */ - if (gpio_get_value(MDM2AP_ACK2)) - break; - retry--; - } - - if (retry == 0) - pr_info("phy_restore_gpio timeout\n"); - } - ap2mdm_ack_gpio_off = false; - } -} - - static void baseband_start(void) { /* @@ -205,17 +139,6 @@ static int baseband_init(void) tegra_pinmux_set_pullupdown(TEGRA_PINGROUP_UAC, TEGRA_PUPD_PULL_UP); - tegra_gpio_enable(MODEM_PWR_ON); - tegra_gpio_enable(MODEM_RESET); - tegra_gpio_enable(AP2MDM_ACK2); - tegra_gpio_enable(BB_RST_OUT); - tegra_gpio_enable(AP2MDM_ACK); - tegra_gpio_enable(MDM2AP_ACK); - tegra_gpio_enable(TEGRA_GPIO_PY3); - tegra_gpio_enable(TEGRA_GPIO_PY1); - tegra_gpio_enable(TEGRA_GPIO_PO1); - tegra_gpio_enable(TEGRA_GPIO_PO2); - /* export GPIO for user space access through sysfs */ gpio_export(MODEM_PWR_ON, false); -- cgit v1.2.3