fixup: tegra30 pinmux
Dan Willemsen [Tue, 27 Mar 2012 04:18:30 +0000 (21:18 -0700)]
Signed-off-by: Dan Willemsen <dwillemsen@nvidia.com>

arch/arm/mach-tegra/board-cardhu-pinmux.c
arch/arm/mach-tegra/board-enterprise-pinmux.c
arch/arm/mach-tegra/board-kai-pinmux.c
arch/arm/mach-tegra/devices.c
arch/arm/mach-tegra/include/mach/pinmux-tegra30.h
arch/arm/mach-tegra/pinmux-tegra30-tables.c
arch/arm/mach-tegra/pinmux.c

index 267493c..33dac48 100644 (file)
@@ -22,6 +22,7 @@
 #include <mach/gpio-tegra.h>
 #include "board.h"
 #include "board-cardhu.h"
+#include "devices.h"
 #include "gpio-names.h"
 
 #define DEFAULT_DRIVE(_name)                                   \
@@ -623,10 +624,19 @@ static void __init cardhu_gpio_init_configure(void)
        }
 }
 
+static struct platform_device *pinmux_devices[] = {
+       &tegra_gpio_device,
+       &tegra_pinmux_device,
+};
+
 int __init cardhu_pinmux_init(void)
 {
        struct board_info board_info;
 
+       platform_add_devices(pinmux_devices, ARRAY_SIZE(pinmux_devices));
+
+       tegra30_default_pinmux();
+
        cardhu_gpio_init_configure();
 
        tegra_pinmux_config_table(cardhu_pinmux_common, ARRAY_SIZE(cardhu_pinmux_common));
index 97016c2..f1d3448 100644 (file)
@@ -22,6 +22,7 @@
 #include <mach/gpio-tegra.h>
 #include "board.h"
 #include "board-enterprise.h"
+#include "devices.h"
 #include "gpio-names.h"
 
 #define DEFAULT_DRIVE(_name)                                   \
@@ -530,8 +531,17 @@ static void enterprise_set_unused_pin_gpio(struct pin_info_low_power_mode *lpm_p
        }
 }
 
+static struct platform_device *pinmux_devices[] = {
+       &tegra_gpio_device,
+       &tegra_pinmux_device,
+};
+
 int __init enterprise_pinmux_init(void)
 {
+       platform_add_devices(pinmux_devices, ARRAY_SIZE(pinmux_devices));
+
+       tegra30_default_pinmux();
+
        tegra_pinmux_config_table(enterprise_pinmux, ARRAY_SIZE(enterprise_pinmux));
        tegra_drive_pinmux_config_table(enterprise_drive_pinmux,
                                        ARRAY_SIZE(enterprise_drive_pinmux));
index 5b5127e..0629b5a 100644 (file)
@@ -22,6 +22,7 @@
 #include <mach/gpio-tegra.h>
 #include "board.h"
 #include "board-kai.h"
+#include "devices.h"
 #include "gpio-names.h"
 
 #define DEFAULT_DRIVE(_name)                                   \
@@ -490,11 +491,21 @@ static void __init kai_gpio_init_configure(void)
        }
 }
 
+static struct platform_device *pinmux_devices[] = {
+       &tegra_gpio_device,
+       &tegra_pinmux_device,
+};
+
 int __init kai_pinmux_init(void)
 {
        struct board_info board_info;
        tegra_get_board_info(&board_info);
        BUG_ON(board_info.board_id != BOARD_E1565);
+
+       platform_add_devices(pinmux_devices, ARRAY_SIZE(pinmux_devices));
+
+       tegra30_default_pinmux();
+
        kai_gpio_init_configure();
 
        tegra_pinmux_config_table(kai_pinmux_common, ARRAY_SIZE(kai_pinmux_common));
index f298fce..180db5e 100644 (file)
@@ -96,6 +96,7 @@ struct platform_device tegra_gpio_device = {
 };
 
 static struct resource pinmux_resource[] = {
+#ifdef CONFIG_ARCH_TEGRA_2x_SOC
        [0] = {
                /* Tri-state registers */
                .start  = TEGRA_APB_MISC_BASE + 0x14,
@@ -120,10 +121,28 @@ static struct resource pinmux_resource[] = {
                .end    = TEGRA_APB_MISC_BASE + 0x90c + 3,
                .flags  = IORESOURCE_MEM,
        },
+#else
+       [0] = {
+               /* Drive registers */
+               .start  = TEGRA_APB_MISC_BASE + 0x868,
+               .end    = TEGRA_APB_MISC_BASE + 0x938 + 3,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               /* Mux registers */
+               .start  = TEGRA_APB_MISC_BASE + 0x3000,
+               .end    = TEGRA_APB_MISC_BASE + 0x33e0 + 3,
+               .flags  = IORESOURCE_MEM,
+       },
+#endif
 };
 
 struct platform_device tegra_pinmux_device = {
-       .name           = "tegra-pinmux",
+#ifdef CONFIG_ARCH_TEGRA_3x_SOC
+       .name           = "tegra30-pinmux",
+#elif defined(CONFIG_ARCH_TEGRA_2x_SOC)
+       .name           = "tegra20-pinmux",
+#endif
        .id             = -1,
        .resource       = pinmux_resource,
        .num_resources  = ARRAY_SIZE(pinmux_resource),
index c1aee3e..c9797b3 100644 (file)
@@ -18,6 +18,8 @@
 #ifndef __MACH_TEGRA_PINMUX_TEGRA30_H
 #define __MACH_TEGRA_PINMUX_TEGRA30_H
 
+void tegra30_default_pinmux(void);
+
 enum tegra_pingroup {
        TEGRA_PINGROUP_ULPI_DATA0 = 0,
        TEGRA_PINGROUP_ULPI_DATA1,
index 54dfc55..75eef00 100644 (file)
@@ -442,7 +442,7 @@ void __devinit tegra30_pinmux_init(const struct tegra_pingroup_desc **pg,
        *gpiomap_max = TEGRA_MAX_GPIO;
 }
 
-void tegra30_default_pinmux()
+void tegra30_default_pinmux(void)
 {
        tegra_drive_pinmux_config_table(t30_def_drive_pinmux,
                                        ARRAY_SIZE(t30_def_drive_pinmux));
index 421b779..bea1632 100644 (file)
 #include <mach/iomap.h>
 #include <mach/pinmux.h>
 
+#ifdef CONFIG_ARCH_TEGRA_3x_SOC
+#define TEGRA_PINMUX_HAS_IO_DIRECTION 1
+#endif
+
 #define HSM_EN(reg)    (((reg) >> 2) & 0x1)
 #define SCHMT_EN(reg)  (((reg) >> 3) & 0x1)
 #define LPMD(reg)      (((reg) >> 4) & 0x3)
@@ -899,16 +903,12 @@ static int __devinit tegra_pinmux_probe(struct platform_device *pdev)
                ((pinmux_init)(match->data))(&pingroups, &pingroup_max,
                        &drive_pingroups, &drive_max, &gpio_to_pingroups_map,
                        &gpio_to_pingroups_max);
-#ifdef CONFIG_ARCH_TEGRA_2x_SOC
        else
-               /* no device tree available, so we must be on tegra20 */
-               tegra20_pinmux_init(&pingroups, &pingroup_max,
+               ((pinmux_init)(pdev->id_entry->driver_data))
+                                       (&pingroups, &pingroup_max,
                                        &drive_pingroups, &drive_max,
                                        &gpio_to_pingroups_map,
                                        &gpio_to_pingroups_max);
-#else
-       pr_warn("non Tegra20 platform requires pinmux devicetree node\n");
-#endif
 
        for (i = 0; ; i++) {
                res = platform_get_resource(pdev, IORESOURCE_MEM, i);
@@ -977,12 +977,25 @@ static int __devinit tegra_pinmux_probe(struct platform_device *pdev)
        return 0;
 }
 
+static struct platform_device_id tegra_pinmux_id[] = {
+#ifdef CONFIG_ARCH_TEGRA_2x_SOC
+       { .name = "tegra20-pinmux",
+         .driver_data = tegra20_pinmux_init, },
+#endif
+#ifdef CONFIG_ARCH_TEGRA_3x_SOC
+       { .name = "tegra30-pinmux",
+         .driver_data = tegra30_pinmux_init, },
+#endif
+       {},
+};
+
 static struct platform_driver tegra_pinmux_driver = {
        .driver         = {
                .name   = "tegra-pinmux",
                .owner  = THIS_MODULE,
                .of_match_table = tegra_pinmux_of_match,
        },
+       .id_table       = tegra_pinmux_id,
        .probe          = tegra_pinmux_probe,
 };