]> git.karo-electronics.de Git - karo-tx-uboot.git/commitdiff
dm: tegra: Enable driver model in SPL and adjust the GPIO driver
authorSimon Glass <sjg@chromium.org>
Tue, 3 Mar 2015 15:02:59 +0000 (08:02 -0700)
committerLothar Waßmann <LW@KARO-electronics.de>
Tue, 1 Sep 2015 12:10:28 +0000 (14:10 +0200)
Use the full driver model GPIO and serial drivers in SPL now that these are
supported. Since device tree is not available they will use platform data.

Remove the special SPL GPIO function as it is no longer needed.

This is all in one commit to maintain bisectability.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/arm/mach-tegra/Kconfig
board/nvidia/seaboard/seaboard.c
drivers/gpio/Makefile
drivers/gpio/tegra_gpio.c
include/configs/tegra-common.h

index 8615248377e4927e1ec8490b99301727590291d4..fccfd79648ac19139c2f6c46db50b5fbdd0b50ff 100644 (file)
@@ -29,6 +29,9 @@ config USE_PRIVATE_LIBGCC
 config DM
        default y
 
+config SPL_DM
+       default y
+
 config DM_SERIAL
        default y
 
index 11472ebaf20d1eb385457cf8745322460e7b94bc..25480e481d2dcc3c00f7055bed4e9b89cc242dc1 100644 (file)
 void gpio_early_init_uart(void)
 {
        /* Enable UART via GPIO_PI3 (port 8, bit 3) so serial console works */
-#ifndef CONFIG_SPL_BUILD
        gpio_request(GPIO_PI3, NULL);
-#endif
-       tegra_spl_gpio_direction_output(GPIO_PI3, 0);
+       gpio_direction_output(GPIO_PI3, 0);
 }
 #endif
 
index e035a7433366dda97a9249bce6d7d291369304e3..32394a14069cd4ac177ccfe5a6c7c5d57e51e3b3 100644 (file)
@@ -8,6 +8,10 @@
 ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_DM_GPIO)          += gpio-uclass.o
 endif
+/* TODO(sjg@chromium.org): Only tegra supports driver model in SPL */
+ifdef CONFIG_TEGRA_GPIO
+obj-$(CONFIG_DM_GPIO)          += gpio-uclass.o
+endif
 
 obj-$(CONFIG_AM33XX_GPIO)      += am33xx_gpio.o
 obj-$(CONFIG_AT91_GPIO)                += at91_gpio.o
index 43928b8812c3aad0077b8beb4a837993c653ed59..f870cdbddf6464a675767ad35ce2910278d32b23 100644 (file)
@@ -132,21 +132,6 @@ static void set_level(unsigned gpio, int high)
        writel(u, &bank->gpio_out[GPIO_PORT(gpio)]);
 }
 
-/* set GPIO pin 'gpio' as an output, with polarity 'value' */
-int tegra_spl_gpio_direction_output(int gpio, int value)
-{
-       /* Configure as a GPIO */
-       set_config(gpio, 1);
-
-       /* Configure GPIO output value. */
-       set_level(gpio, value);
-
-       /* Configure GPIO direction as output. */
-       set_direction(gpio, 1);
-
-       return 0;
-}
-
 /*
  * Generic_GPIO primitives.
  */
@@ -338,12 +323,19 @@ static int gpio_tegra_bind(struct udevice *parent)
        int bank_count;
        int bank;
        int ret;
-       int len;
 
        /* If this is a child device, there is nothing to do here */
        if (plat)
                return 0;
 
+       /* TODO(sjg@chromium.org): Remove once SPL supports device tree */
+#ifdef CONFIG_SPL_BUILD
+       ctlr = (struct gpio_ctlr *)NV_PA_GPIO_BASE;
+       bank_count = TEGRA_GPIO_BANKS;
+#else
+       {
+       int len;
+
        /*
         * This driver does not make use of interrupts, other than to figure
         * out the number of GPIO banks
@@ -353,6 +345,8 @@ static int gpio_tegra_bind(struct udevice *parent)
        bank_count = len / 3 / sizeof(u32);
        ctlr = (struct gpio_ctlr *)fdtdec_get_addr(gd->fdt_blob,
                                                   parent->of_offset, "reg");
+       }
+#endif
        for (bank = 0; bank < bank_count; bank++) {
                int port;
 
@@ -388,4 +382,5 @@ U_BOOT_DRIVER(gpio_tegra) = {
        .probe = gpio_tegra_probe,
        .priv_auto_alloc_size = sizeof(struct tegra_port_info),
        .ops    = &gpio_tegra_ops,
+       .flags  = DM_FLAG_PRE_RELOC,
 };
index f10ca52ace5aa7e0de3d8bb829ff84f8b57e7b57..ff2f8369264f0eb138d7ca3bfa3dfd637c04fd81 100644 (file)
 /*
  * NS16550 Configuration
  */
-#ifdef CONFIG_SPL_BUILD
-#define CONFIG_SYS_NS16550_SERIAL
-#define CONFIG_SYS_NS16550_REG_SIZE    (-4)
-#define CONFIG_SYS_NS16550_CLK         V_NS16550_CLK
-#else
 #define CONFIG_TEGRA_SERIAL
-#endif
 #define CONFIG_SYS_NS16550
 
 /*