ARM: tegra114: dalmore/pluto: use spi-tegra114 spi driver
Laxman Dewangan [Wed, 20 Feb 2013 12:49:22 +0000 (17:49 +0530)]
In place of using legacy dma driver, use the spi-tegra114 driver
which is based on dmaengine based dma driver.

Change-Id: I7f9f3cb4971b7780e1694e400f8d282aa6c2886e
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: http://git-master/r/202532
(cherry picked from commit 1edcfa3a68af3d6ea9d4ab8fe5c517cbd2387056)

arch/arm/mach-tegra/board-dalmore.c
arch/arm/mach-tegra/board-pluto.c
arch/arm/mach-tegra/devices.c
arch/arm/mach-tegra/tegra11_clocks.c

index ff0e82c..bb3016d 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/spi/rm31080a_ts.h>
 #include <linux/tegra_uart.h>
 #include <linux/memblock.h>
-#include <linux/spi-tegra.h>
+#include <linux/spi/spi-tegra.h>
 #include <linux/nfc/pn544.h>
 #include <linux/rfkill-gpio.h>
 #include <linux/skbuff.h>
@@ -675,49 +675,28 @@ static void dalmore_audio_init(void)
        dalmore_audio_pdata.codec_dai_name = "rt5640-aif1";
 }
 
-
+#ifndef CONFIG_USE_OF
 static struct platform_device *dalmore_spi_devices[] __initdata = {
         &tegra11_spi_device4,
 };
 
-struct spi_clk_parent spi_parent_clk_dalmore[] = {
-        [0] = {.name = "pll_p"},
-#ifndef CONFIG_TEGRA_PLLM_RESTRICTED
-        [1] = {.name = "pll_m"},
-        [2] = {.name = "clk_m"},
-#else
-        [1] = {.name = "clk_m"},
-#endif
-};
-
 static struct tegra_spi_platform_data dalmore_spi_pdata = {
-       .is_dma_based           = false,
-       .max_dma_buffer         = 16 * 1024,
-        .is_clkon_always        = false,
-        .max_rate               = 25000000,
+       .dma_req_sel            = 0,
+       .spi_max_frequency      = 25000000,
+       .clock_always_on        = false,
 };
 
 static void __init dalmore_spi_init(void)
 {
-        int i;
-        struct clk *c;
-
-        for (i = 0; i < ARRAY_SIZE(spi_parent_clk_dalmore); ++i) {
-                c = tegra_get_clock_by_name(spi_parent_clk_dalmore[i].name);
-                if (IS_ERR_OR_NULL(c)) {
-                        pr_err("Not able to get the clock for %s\n",
-                                                spi_parent_clk_dalmore[i].name);
-                        continue;
-                }
-                spi_parent_clk_dalmore[i].parent_clk = c;
-                spi_parent_clk_dalmore[i].fixed_clk_rate = clk_get_rate(c);
-        }
-        dalmore_spi_pdata.parent_clk_list = spi_parent_clk_dalmore;
-        dalmore_spi_pdata.parent_clk_count = ARRAY_SIZE(spi_parent_clk_dalmore);
        tegra11_spi_device4.dev.platform_data = &dalmore_spi_pdata;
         platform_add_devices(dalmore_spi_devices,
                                 ARRAY_SIZE(dalmore_spi_devices));
 }
+#else
+static void __init dalmore_spi_init(void)
+{
+}
+#endif
 
 static __initdata struct tegra_clk_init_table touch_clk_init_table[] = {
        /* name         parent          rate            enabled */
index c076d47..3fd5ee1 100644 (file)
@@ -36,7 +36,7 @@
 #include <linux/spi/rm31080a_ts.h>
 #include <linux/tegra_uart.h>
 #include <linux/memblock.h>
-#include <linux/spi-tegra.h>
+#include <linux/spi/spi-tegra.h>
 #include <linux/nfc/pn544.h>
 #include <linux/nfc/bcm2079x.h>
 #include <linux/rfkill-gpio.h>
@@ -1200,52 +1200,33 @@ static void pluto_audio_init(void)
 
 }
 
+#ifndef CONFIG_USE_OF
 static struct platform_device *pluto_spi_devices[] __initdata = {
         &tegra11_spi_device4,
 };
 
-struct spi_clk_parent spi_parent_clk_pluto[] = {
-        [0] = {.name = "pll_p"},
-#ifndef CONFIG_TEGRA_PLLM_RESTRICTED
-        [1] = {.name = "pll_m"},
-        [2] = {.name = "clk_m"},
-#else
-        [1] = {.name = "clk_m"},
-#endif
-};
-
 static struct tegra_spi_platform_data pluto_spi_pdata = {
-       .is_dma_based           = false,
-       .max_dma_buffer         = 16 * 1024,
-        .is_clkon_always        = false,
-        .max_rate               = 25000000,
+       .dma_req_sel            = 0,
+       .spi_max_frequency      = 25000000,
+       .clock_always_on        = false,
 };
 
 static void __init pluto_spi_init(void)
 {
-        int i;
-        struct clk *c;
         struct board_info board_info, display_board_info;
 
         tegra_get_board_info(&board_info);
         tegra_get_display_board_info(&display_board_info);
 
-        for (i = 0; i < ARRAY_SIZE(spi_parent_clk_pluto); ++i) {
-                c = tegra_get_clock_by_name(spi_parent_clk_pluto[i].name);
-                if (IS_ERR_OR_NULL(c)) {
-                        pr_err("Not able to get the clock for %s\n",
-                                                spi_parent_clk_pluto[i].name);
-                        continue;
-                }
-                spi_parent_clk_pluto[i].parent_clk = c;
-                spi_parent_clk_pluto[i].fixed_clk_rate = clk_get_rate(c);
-        }
-        pluto_spi_pdata.parent_clk_list = spi_parent_clk_pluto;
-        pluto_spi_pdata.parent_clk_count = ARRAY_SIZE(spi_parent_clk_pluto);
        tegra11_spi_device4.dev.platform_data = &pluto_spi_pdata;
         platform_add_devices(pluto_spi_devices,
                                 ARRAY_SIZE(pluto_spi_devices));
 }
+#else
+static void __init pluto_spi_init(void)
+{
+}
+#endif
 
 static __initdata struct tegra_clk_init_table touch_clk_init_table[] = {
        /* name         parent          rate            enabled */
index cd07cae..455f743 100644 (file)
@@ -572,7 +572,7 @@ struct platform_device tegra_spi_device6 = {
 #endif
 
 struct platform_device tegra11_spi_device1 = {
-       .name           = "tegra11-spi",
+       .name           = "spi-tegra114",
        .id             = 0,
        .resource       = spi_resource1,
        .num_resources  = ARRAY_SIZE(spi_resource1),
@@ -582,7 +582,7 @@ struct platform_device tegra11_spi_device1 = {
 };
 
 struct platform_device tegra11_spi_device2 = {
-       .name           = "tegra11-spi",
+       .name           = "spi-tegra114",
        .id             = 1,
        .resource       = spi_resource2,
        .num_resources  = ARRAY_SIZE(spi_resource2),
@@ -592,7 +592,7 @@ struct platform_device tegra11_spi_device2 = {
 };
 
 struct platform_device tegra11_spi_device3 = {
-       .name           = "tegra11-spi",
+       .name           = "spi-tegra114",
        .id             = 2,
        .resource       = spi_resource3,
        .num_resources  = ARRAY_SIZE(spi_resource3),
@@ -602,7 +602,7 @@ struct platform_device tegra11_spi_device3 = {
 };
 
 struct platform_device tegra11_spi_device4 = {
-       .name           = "tegra11-spi",
+       .name           = "spi-tegra114",
        .id             = 3,
        .resource       = spi_resource4,
        .num_resources  = ARRAY_SIZE(spi_resource4),
@@ -613,7 +613,7 @@ struct platform_device tegra11_spi_device4 = {
 
 #ifndef CONFIG_ARCH_TEGRA_2x_SOC
 struct platform_device tegra11_spi_device5 = {
-       .name           = "tegra11-spi",
+       .name           = "spi-tegra114",
        .id             = 4,
        .resource       = spi_resource5,
        .num_resources  = ARRAY_SIZE(spi_resource5),
@@ -623,7 +623,7 @@ struct platform_device tegra11_spi_device5 = {
 };
 
 struct platform_device tegra11_spi_device6 = {
-       .name           = "tegra11-spi",
+       .name           = "spi-tegra114",
        .id             = 5,
        .resource       = spi_resource6,
        .num_resources  = ARRAY_SIZE(spi_resource6),
index 6816743..99b31ea 100644 (file)
@@ -6399,12 +6399,12 @@ struct clk tegra_list_clks[] = {
        PERIPH_CLK("hda",       "tegra30-hda",          "hda",          125,    0x428,  48000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
        PERIPH_CLK("hda2codec_2x",      "tegra30-hda",  "hda2codec",    111,    0x3e4,  48000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
        PERIPH_CLK("hda2hdmi",  "tegra30-hda",          "hda2hdmi",     128,    0,      48000000,  mux_clk_m,                   PERIPH_ON_APB),
-       PERIPH_CLK("sbc1",      "tegra11-spi.0",        NULL,   41,     0x134,  52000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
-       PERIPH_CLK("sbc2",      "tegra11-spi.1",        NULL,   44,     0x118,  52000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
-       PERIPH_CLK("sbc3",      "tegra11-spi.2",        NULL,   46,     0x11c,  52000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
-       PERIPH_CLK("sbc4",      "tegra11-spi.3",        NULL,   68,     0x1b4,  52000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
-       PERIPH_CLK("sbc5",      "tegra11-spi.4",        NULL,   104,    0x3c8,  52000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
-       PERIPH_CLK("sbc6",      "tegra11-spi.5",        NULL,   105,    0x3cc,  52000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
+       PERIPH_CLK("sbc1",      "spi-tegra114.0",       NULL,   41,     0x134,  52000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
+       PERIPH_CLK("sbc2",      "spi-tegra114.1",       NULL,   44,     0x118,  52000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
+       PERIPH_CLK("sbc3",      "spi-tegra114.2",       NULL,   46,     0x11c,  52000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
+       PERIPH_CLK("sbc4",      "spi-tegra114.3",       NULL,   68,     0x1b4,  52000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
+       PERIPH_CLK("sbc5",      "spi-tegra114.4",       NULL,   104,    0x3c8,  52000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
+       PERIPH_CLK("sbc6",      "spi-tegra114.5",       NULL,   105,    0x3cc,  52000000,  mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
        PERIPH_CLK("sata_oob",  "tegra_sata_oob",       NULL,   123,    0x420,  216000000, mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
        PERIPH_CLK("sata",      "tegra_sata",           NULL,   124,    0x424,  216000000, mux_pllp_pllc_pllm_clkm,     MUX | DIV_U71 | PERIPH_ON_APB),
        PERIPH_CLK("sata_cold", "tegra_sata_cold",      NULL,   129,    0,      48000000,  mux_clk_m,                   PERIPH_ON_APB),