diff options
author | Steve Lin <stlin@nvidia.com> | 2011-05-16 11:22:57 -0700 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-05-18 12:02:20 -0700 |
commit | d8de4ab6e5b7598630b6f1b679762852c8b90b48 (patch) | |
tree | 12bc108bac1cf9ca9eec323c1e3c70655c2e4d03 | |
parent | 6c7f0ecfe90d1b3c56d1616762acee6231f5a726 (diff) |
ARM: tegra: baseband: Add PH450 modem init and reset functions
Add PH450 modem init and reset functions for Tegra Enterprise.
Bug 800301
Change-Id: I7068fa87118c2388badb664da3d1a83a3eb49dae
Reviewed-on: http://git-master/r/30920
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
-rw-r--r-- | arch/arm/mach-tegra/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise-baseband.c | 160 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise-pinmux.c | 24 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise.c | 12 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-enterprise.h | 1 |
5 files changed, 176 insertions, 22 deletions
diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile index b53bf925b330..e217e5bfedc7 100644 --- a/arch/arm/mach-tegra/Makefile +++ b/arch/arm/mach-tegra/Makefile @@ -138,3 +138,4 @@ obj-${CONFIG_MACH_TEGRA_ENTERPRISE} += board-enterprise-sdhci.o obj-${CONFIG_MACH_TEGRA_ENTERPRISE} += board-touch.o obj-${CONFIG_MACH_TEGRA_ENTERPRISE} += board-enterprise-memory.o obj-${CONFIG_MACH_TEGRA_ENTERPRISE} += board-enterprise-power.o +obj-${CONFIG_MACH_TEGRA_ENTERPRISE} += board-enterprise-baseband.o diff --git a/arch/arm/mach-tegra/board-enterprise-baseband.c b/arch/arm/mach-tegra/board-enterprise-baseband.c new file mode 100644 index 000000000000..9222f4a074e1 --- /dev/null +++ b/arch/arm/mach-tegra/board-enterprise-baseband.c @@ -0,0 +1,160 @@ +/* + * arch/arm/mach-tegra/board-enterprise-baseband.c + * + * Copyright (c) 2011, NVIDIA Corporation. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include <linux/resource.h> +#include <linux/platform_device.h> +#include <linux/delay.h> +#include <linux/gpio.h> +#include <linux/err.h> +#include <linux/platform_data/tegra_usb.h> +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <mach/pinmux.h> +#include <mach/usb_phy.h> +#include "devices.h" +#include "gpio-names.h" + +/* T30 BB GPIO */ +#define MODEM_PWR_ON TEGRA_GPIO_PE0 +#define MODEM_RESET TEGRA_GPIO_PE1 + +/* PH450 */ +#define AP2MDM_ACK TEGRA_GPIO_PE3 +#define MDM2AP_ACK TEGRA_GPIO_PU5 +#define AP2MDM_ACK2 TEGRA_GPIO_PE2 +#define MDM2AP_ACK2 TEGRA_GPIO_PV0 + +static int ph450_reset(void); +static int ph450_handshake(void); + +static struct tegra_ulpi_trimmer e1219_trimmer = { 10, 1, 1, 1 }; + +static struct tegra_ulpi_config ehci2_null_ulpi_phy_config = { + .trimmer = &e1219_trimmer, + .preinit = ph450_reset, + .postinit = ph450_handshake, +}; + +static struct tegra_ehci_platform_data ehci2_null_ulpi_platform_data = { + .operating_mode = TEGRA_USB_HOST, + .power_down_on_bus_suspend = 0, + .phy_config = &ehci2_null_ulpi_phy_config, + .phy_type = TEGRA_USB_PHY_TYPE_NULL_ULPI, +}; + +static int __init tegra_null_ulpi_init(void) +{ + tegra_ehci2_device.dev.platform_data = &ehci2_null_ulpi_platform_data; + platform_device_register(&tegra_ehci2_device); + return 0; +} + +static int __init ph450_init(void) +{ + int ret; + + ret = gpio_request(MODEM_PWR_ON, "mdm_power"); + if (ret) + return ret; + + ret = gpio_request(MODEM_RESET, "mdm_reset"); + if (ret) { + gpio_free(MODEM_PWR_ON); + return ret; + } + ret = gpio_request(AP2MDM_ACK2, "ap2mdm_ack2"); + if (ret) { + gpio_free(MODEM_PWR_ON); + gpio_free(MODEM_RESET); + return ret; + } + ret = gpio_request(MDM2AP_ACK2, "mdm2ap_ack2"); + if (ret) { + gpio_free(MODEM_PWR_ON); + gpio_free(MODEM_RESET); + gpio_free(AP2MDM_ACK2); + return ret; + } + + /* enable pull-up for MDM2AP_ACK2 */ + tegra_pinmux_set_pullupdown(TEGRA_PINGROUP_GPIO_PV0, + TEGRA_PUPD_PULL_UP); + + tegra_gpio_enable(MODEM_PWR_ON); + tegra_gpio_enable(MODEM_RESET); + tegra_gpio_enable(AP2MDM_ACK2); + tegra_gpio_enable(MDM2AP_ACK2); + + gpio_direction_output(MODEM_PWR_ON, 0); + gpio_direction_output(MODEM_RESET, 0); + gpio_direction_output(AP2MDM_ACK2, 1); + gpio_direction_input(MDM2AP_ACK2); + + return 0; +} + +static int ph450_reset(void) +{ + int retry = 100; /* retry for 10 sec */ + + gpio_set_value(AP2MDM_ACK2, 1); + gpio_set_value(MODEM_PWR_ON, 0); + gpio_set_value(MODEM_RESET, 0); + mdelay(200); + gpio_set_value(MODEM_RESET, 1); + mdelay(30); + gpio_set_value(MODEM_PWR_ON, 1); + + while (retry) { + /* wait for MDM2AP_ACK2 low */ + int val = gpio_get_value(MDM2AP_ACK2); + if (!val) { + pr_info("MDM2AP_ACK2 detected\n"); + return 0; + } else { + pr_info("."); + retry--; + mdelay(100); + } + } + return 1; +} + +static int ph450_handshake(void) +{ + /* set AP2MDM_ACK2 low */ + gpio_set_value(AP2MDM_ACK2, 0); + + return 0; +} + +int __init enterprise_baseband_init(void) +{ + int ret; + + ret = ph450_init(); + if (ret) { + pr_err("modem init failed\n"); + return ret; + } + + tegra_null_ulpi_init(); + return 0; +} diff --git a/arch/arm/mach-tegra/board-enterprise-pinmux.c b/arch/arm/mach-tegra/board-enterprise-pinmux.c index 1bddca72154d..2e329594e005 100644 --- a/arch/arm/mach-tegra/board-enterprise-pinmux.c +++ b/arch/arm/mach-tegra/board-enterprise-pinmux.c @@ -170,18 +170,18 @@ static __initdata struct tegra_pingroup_config enterprise_pinmux[] = { I2C_PINMUX(PWR_I2C_SCL, I2CPWR, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), I2C_PINMUX(PWR_I2C_SDA, I2CPWR, NORMAL, NORMAL, INPUT, DISABLE, ENABLE), - DEFAULT_PINMUX(ULPI_DATA0, UARTA, NORMAL, NORMAL, OUTPUT), - DEFAULT_PINMUX(ULPI_DATA1, UARTA, NORMAL, NORMAL, INPUT), - DEFAULT_PINMUX(ULPI_DATA2, UARTA, NORMAL, NORMAL, INPUT), - DEFAULT_PINMUX(ULPI_DATA3, UARTA, NORMAL, NORMAL, OUTPUT), - DEFAULT_PINMUX(ULPI_DATA4, UARTA, NORMAL, NORMAL, INPUT), - DEFAULT_PINMUX(ULPI_DATA5, UARTA, NORMAL, NORMAL, INPUT), - DEFAULT_PINMUX(ULPI_DATA6, UARTA, NORMAL, NORMAL, INPUT), - DEFAULT_PINMUX(ULPI_DATA7, UARTA, NORMAL, NORMAL, OUTPUT), - DEFAULT_PINMUX(ULPI_CLK, ULPI, NORMAL, NORMAL, OUTPUT), - DEFAULT_PINMUX(ULPI_DIR, ULPI, NORMAL, NORMAL, INPUT), - DEFAULT_PINMUX(ULPI_NXT, ULPI, NORMAL, NORMAL, INPUT), - DEFAULT_PINMUX(ULPI_STP, ULPI, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(ULPI_DATA0, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DATA1, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DATA2, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DATA3, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DATA4, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DATA5, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DATA6, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DATA7, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_CLK, ULPI, NORMAL, NORMAL, INPUT), + DEFAULT_PINMUX(ULPI_DIR, ULPI, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(ULPI_NXT, ULPI, NORMAL, NORMAL, OUTPUT), + DEFAULT_PINMUX(ULPI_STP, ULPI, NORMAL, NORMAL, INPUT), DEFAULT_PINMUX(DAP3_FS, I2S2, NORMAL, NORMAL, INPUT), DEFAULT_PINMUX(DAP3_DIN, I2S2, NORMAL, NORMAL, INPUT), DEFAULT_PINMUX(DAP3_DOUT, I2S2, NORMAL, NORMAL, INPUT), diff --git a/arch/arm/mach-tegra/board-enterprise.c b/arch/arm/mach-tegra/board-enterprise.c index 1793529f0ba9..af85210e3f5b 100644 --- a/arch/arm/mach-tegra/board-enterprise.c +++ b/arch/arm/mach-tegra/board-enterprise.c @@ -357,6 +357,7 @@ static struct platform_device *enterprise_devices[] __initdata = { &tegra_usb_fsg_device, &androidusb_device, &debug_uart, + &tegra_uarta_device, &tegra_uartb_device, &tegra_uartc_device, &tegra_uarte_device, @@ -467,10 +468,6 @@ static void enterprise_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); @@ -482,11 +479,6 @@ static void enterprise_gps_init(void) tegra_gpio_enable(TEGRA_GPIO_PU3); } -static void enterprise_modem_init(void) -{ - tegra_gpio_enable(TEGRA_GPIO_PH5); -} - static void __init tegra_enterprise_init(void) { char serial[20]; @@ -504,7 +496,7 @@ static void __init tegra_enterprise_init(void) touch_init(); enterprise_usb_init(); enterprise_gps_init(); - enterprise_modem_init(); + enterprise_baseband_init(); enterprise_panel_init(); enterprise_bt_rfkill(); audio_wired_jack_init(); diff --git a/arch/arm/mach-tegra/board-enterprise.h b/arch/arm/mach-tegra/board-enterprise.h index 6012c4060b53..f218c54ca008 100644 --- a/arch/arm/mach-tegra/board-enterprise.h +++ b/arch/arm/mach-tegra/board-enterprise.h @@ -31,6 +31,7 @@ int enterprise_panel_init(void); int touch_init(void); int enterprise_emc_init(void); int enterprise_regulator_init(void); +int enterprise_baseband_init(void); /* Touchscreen GPIO addresses */ #ifdef CONFIG_TOUCHSCREEN_ATMEL_MT_T9 |