aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-tegra/board-paz00-pinmux.c
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2011-10-25 02:01:27 +0000
committerOlof Johansson <olof@lixom.net>2011-11-09 10:38:56 -0800
commit4b91b6fb8646843d96628ae9512d8c4cd33ece2d (patch)
tree889a473dffe9c96fcb28c092dca94704746f784d /arch/arm/mach-tegra/board-paz00-pinmux.c
parentLinux 3.2-rc1 (diff)
downloadlinux-dev-4b91b6fb8646843d96628ae9512d8c4cd33ece2d.tar.xz
linux-dev-4b91b6fb8646843d96628ae9512d8c4cd33ece2d.zip
arm/tegra: Don't create duplicate gpio and pinmux devices
*_pinmux_init() register the GPIO and pinmux devices so that they're ready before any other device needs them. *_pinmux_init() are also called by board-dt.c in order to set up the GPIO and pinmux configurations. In this case, if we register the devices, they end up being probed once due to this registration, and a second time due to a device-tree node (or vice-versa). The second probe fails since the memory regions are already requested. Besides, we don't actually want the duplicated devices. To avoid this duplicate registration, modify *_pinmux_init() to check whether it's running on a DT machine. If not, register the pinmux devices. If so, don't register them. Finally, modify board-dt.c to call the *_pinmux_init() after all devices have been instantiated from device-tree. This allows the GPIO and pinmux devices to be instantiated and initialized before calling functions to configure the hardware. This has one disadvantage: The pinmux and GPIO initialization now happens after /all/ devices are instantiated, rather than after just gpio and pinmux but before anything else. So the correct HW configuration is not in place when e.g. the SD/MMC device is probed. Long-term, this should be solved by doing both: a) Initializing the HW state from DT nodes during GPIO and pinmux device probe. b) Using the deferred driver probe mechanism, so that drivers can defer their probe until after the gpio and pinmux drivers have probed. v2: s/int is_dt/bool is_dt/ v3: Use of_machine_is_compatible inside *_pinmux_init() rather than passing an explicit parameter into the function from outside. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-tegra/board-paz00-pinmux.c')
-rw-r--r--arch/arm/mach-tegra/board-paz00-pinmux.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/arm/mach-tegra/board-paz00-pinmux.c b/arch/arm/mach-tegra/board-paz00-pinmux.c
index fb20894862b0..be30e215f4b7 100644
--- a/arch/arm/mach-tegra/board-paz00-pinmux.c
+++ b/arch/arm/mach-tegra/board-paz00-pinmux.c
@@ -16,6 +16,8 @@
#include <linux/kernel.h>
#include <linux/gpio.h>
+#include <linux/of.h>
+
#include <mach/pinmux.h>
#include "gpio-names.h"
@@ -158,7 +160,9 @@ static struct tegra_gpio_table gpio_table[] = {
void paz00_pinmux_init(void)
{
- platform_add_devices(pinmux_devices, ARRAY_SIZE(pinmux_devices));
+ if (!of_machine_is_compatible("nvidia,tegra20"))
+ platform_add_devices(pinmux_devices,
+ ARRAY_SIZE(pinmux_devices));
tegra_pinmux_config_table(paz00_pinmux, ARRAY_SIZE(paz00_pinmux));