summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary King <gking@nvidia.com>2010-01-07 20:41:47 -0800
committerGary King <gking@nvidia.com>2010-01-08 20:20:24 -0800
commitb93651bb2ab90cd41f08ca98f8cd5e76fd918375 (patch)
tree14f25b257895575699f3fd67e0bd2e701a0fc9f7
parent5970e4c5c9f56836e74d4fd12c5c0746a4faa40c (diff)
tegra: allow native serial driver uarts to be registered
init_common was using a preprocessor conditional to compile-out the uart platform device registration code, but was only checking for the ddk-based uart driver (CONFIG_SERIAL_TEGRA_DDK), not the native one (CONFIG_SERIAL_TEGRA). Furthermore, the registration was registering all controllers on the chip, not the number of valid UARTs on the system. Change-Id: I49b96412c27deed1afe039cfecf2bede681cf320
-rw-r--r--arch/arm/mach-tegra/init_common.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/arch/arm/mach-tegra/init_common.c b/arch/arm/mach-tegra/init_common.c
index 33c13b035a13..fa87882fc45e 100644
--- a/arch/arm/mach-tegra/init_common.c
+++ b/arch/arm/mach-tegra/init_common.c
@@ -377,7 +377,7 @@ static void __init tegra_register_i2c(void)
}
#endif
-#if !defined(CONFIG_SERIAL_TEGRA_DDK)
+#if !(defined(CONFIG_SERIAL_TEGRA_DDK) || defined(CONFIG_SERIAL_TEGRA))
#define tegra_register_uart() do {} while (0)
#else
@@ -390,11 +390,16 @@ void __init tegra_register_uart(void)
NvU32 i;
NvOdmDebugConsole Console;
NvU32 Port = ~0;
+ const NvU32 *pPinMuxes;
+ NvU32 NumPinMuxes;
+ NvU32 Cnt = 0;
Console = NvOdmQueryDebugConsole();
NumberOfUarts = NvRmModuleGetNumInstances(s_hRmGlobal,
NvRmModuleID_Uart);
+ NvOdmQueryPinMux(NvOdmIoModule_Uart, &pPinMuxes, &NumPinMuxes);
+
/* Skip the UART port used as a debug console */
if (((NvU32)Console >= (NvU32)NvOdmDebugConsole_UartA) &&
((NvU32)Console <= (NvU32)NvOdmDebugConsole_UartE))
@@ -402,12 +407,12 @@ void __init tegra_register_uart(void)
Port = (NvU32)(Console - NvOdmDebugConsole_UartA);
}
- for (i=0; i< NumberOfUarts ; i++)
+ for (i=0; i<NumberOfUarts && i<NumPinMuxes; i++)
{
- if (i == Port)
+ if (i==Port || !pPinMuxes[i])
continue;
- pDev = platform_device_alloc("tegra_uart", i);
+ pDev = platform_device_alloc("tegra_uart", Cnt++);
if (!pDev)
goto fail;
if (platform_device_add(pDev))