diff options
| author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-10-08 10:00:11 -0400 |
|---|---|---|
| committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-10-11 09:30:31 -0400 |
| commit | 8a8d20600dce01553c8505b7c576f8d4307e4ba8 (patch) | |
| tree | 465b61cd90efd7b5f1e4c29cbb023be2847dcf89 | |
| parent | 67520f3a896acb1635894fd25626f7fa7c91e61c (diff) | |
ARM: imx: fix/define clocks and create devices for imx dma
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| -rw-r--r-- | arch/arm/mach-mx3/clock-imx31.c | 4 | ||||
| -rw-r--r-- | arch/arm/mach-mx3/clock-imx35.c | 2 | ||||
| -rw-r--r-- | arch/arm/mach-mx5/clock-mx51.c | 5 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/devices/Makefile | 1 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/devices/platform-imx-dma.c | 129 | ||||
| -rw-r--r-- | arch/arm/plat-mxc/include/mach/mx51.h | 2 |
6 files changed, 139 insertions, 4 deletions
diff --git a/arch/arm/mach-mx3/clock-imx31.c b/arch/arm/mach-mx3/clock-imx31.c index 18e98f1d4de0..109e98f323e0 100644 --- a/arch/arm/mach-mx3/clock-imx31.c +++ b/arch/arm/mach-mx3/clock-imx31.c | |||
| @@ -477,7 +477,7 @@ DEFINE_CLOCK(epit1_clk, 0, MXC_CCM_CGR0, 6, NULL, NULL, &perclk_clk); | |||
| 477 | DEFINE_CLOCK(epit2_clk, 1, MXC_CCM_CGR0, 8, NULL, NULL, &perclk_clk); | 477 | DEFINE_CLOCK(epit2_clk, 1, MXC_CCM_CGR0, 8, NULL, NULL, &perclk_clk); |
| 478 | DEFINE_CLOCK(iim_clk, 0, MXC_CCM_CGR0, 10, NULL, NULL, &ipg_clk); | 478 | DEFINE_CLOCK(iim_clk, 0, MXC_CCM_CGR0, 10, NULL, NULL, &ipg_clk); |
| 479 | DEFINE_CLOCK(ata_clk, 0, MXC_CCM_CGR0, 12, NULL, NULL, &ipg_clk); | 479 | DEFINE_CLOCK(ata_clk, 0, MXC_CCM_CGR0, 12, NULL, NULL, &ipg_clk); |
| 480 | DEFINE_CLOCK(sdma_clk1, 0, MXC_CCM_CGR0, 14, NULL, &sdma_clk1, &ahb_clk); | 480 | DEFINE_CLOCK(sdma_clk1, 0, MXC_CCM_CGR0, 14, NULL, NULL, &ahb_clk); |
| 481 | DEFINE_CLOCK(cspi3_clk, 2, MXC_CCM_CGR0, 16, NULL, NULL, &ipg_clk); | 481 | DEFINE_CLOCK(cspi3_clk, 2, MXC_CCM_CGR0, 16, NULL, NULL, &ipg_clk); |
| 482 | DEFINE_CLOCK(rng_clk, 0, MXC_CCM_CGR0, 18, NULL, NULL, &ipg_clk); | 482 | DEFINE_CLOCK(rng_clk, 0, MXC_CCM_CGR0, 18, NULL, NULL, &ipg_clk); |
| 483 | DEFINE_CLOCK(uart1_clk, 0, MXC_CCM_CGR0, 20, NULL, NULL, &perclk_clk); | 483 | DEFINE_CLOCK(uart1_clk, 0, MXC_CCM_CGR0, 20, NULL, NULL, &perclk_clk); |
| @@ -564,7 +564,7 @@ static struct clk_lookup lookups[] = { | |||
| 564 | _REGISTER_CLOCK(NULL, "ata", ata_clk) | 564 | _REGISTER_CLOCK(NULL, "ata", ata_clk) |
| 565 | _REGISTER_CLOCK(NULL, "rtic", rtic_clk) | 565 | _REGISTER_CLOCK(NULL, "rtic", rtic_clk) |
| 566 | _REGISTER_CLOCK(NULL, "rng", rng_clk) | 566 | _REGISTER_CLOCK(NULL, "rng", rng_clk) |
| 567 | _REGISTER_CLOCK(NULL, "sdma_ahb", sdma_clk1) | 567 | _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk1) |
| 568 | _REGISTER_CLOCK(NULL, "sdma_ipg", sdma_clk2) | 568 | _REGISTER_CLOCK(NULL, "sdma_ipg", sdma_clk2) |
| 569 | _REGISTER_CLOCK(NULL, "mstick", mstick1_clk) | 569 | _REGISTER_CLOCK(NULL, "mstick", mstick1_clk) |
| 570 | _REGISTER_CLOCK(NULL, "mstick", mstick2_clk) | 570 | _REGISTER_CLOCK(NULL, "mstick", mstick2_clk) |
diff --git a/arch/arm/mach-mx3/clock-imx35.c b/arch/arm/mach-mx3/clock-imx35.c index 9a1009884164..61e4a318980a 100644 --- a/arch/arm/mach-mx3/clock-imx35.c +++ b/arch/arm/mach-mx3/clock-imx35.c | |||
| @@ -482,7 +482,7 @@ static struct clk_lookup lookups[] = { | |||
| 482 | _REGISTER_CLOCK(NULL, "rtc", rtc_clk) | 482 | _REGISTER_CLOCK(NULL, "rtc", rtc_clk) |
| 483 | _REGISTER_CLOCK(NULL, "rtic", rtic_clk) | 483 | _REGISTER_CLOCK(NULL, "rtic", rtic_clk) |
| 484 | _REGISTER_CLOCK(NULL, "scc", scc_clk) | 484 | _REGISTER_CLOCK(NULL, "scc", scc_clk) |
| 485 | _REGISTER_CLOCK(NULL, "sdma", sdma_clk) | 485 | _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk) |
| 486 | _REGISTER_CLOCK(NULL, "spba", spba_clk) | 486 | _REGISTER_CLOCK(NULL, "spba", spba_clk) |
| 487 | _REGISTER_CLOCK(NULL, "spdif", spdif_clk) | 487 | _REGISTER_CLOCK(NULL, "spdif", spdif_clk) |
| 488 | _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) | 488 | _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) |
diff --git a/arch/arm/mach-mx5/clock-mx51.c b/arch/arm/mach-mx5/clock-mx51.c index e6c17d78189c..21cecc040172 100644 --- a/arch/arm/mach-mx5/clock-mx51.c +++ b/arch/arm/mach-mx5/clock-mx51.c | |||
| @@ -977,6 +977,10 @@ DEFINE_CLOCK(cspi_ipg_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG9_OFFSET, | |||
| 977 | DEFINE_CLOCK(cspi_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG13_OFFSET, | 977 | DEFINE_CLOCK(cspi_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG13_OFFSET, |
| 978 | NULL, NULL, &ipg_clk, &cspi_ipg_clk); | 978 | NULL, NULL, &ipg_clk, &cspi_ipg_clk); |
| 979 | 979 | ||
| 980 | /* SDMA */ | ||
| 981 | DEFINE_CLOCK(sdma_clk, 1, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG15_OFFSET, | ||
| 982 | NULL, NULL, &ahb_clk, NULL); | ||
| 983 | |||
| 980 | #define _REGISTER_CLOCK(d, n, c) \ | 984 | #define _REGISTER_CLOCK(d, n, c) \ |
| 981 | { \ | 985 | { \ |
| 982 | .dev_id = d, \ | 986 | .dev_id = d, \ |
| @@ -1003,6 +1007,7 @@ static struct clk_lookup lookups[] = { | |||
| 1003 | _REGISTER_CLOCK("mxc_nand", NULL, nfc_clk) | 1007 | _REGISTER_CLOCK("mxc_nand", NULL, nfc_clk) |
| 1004 | _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) | 1008 | _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) |
| 1005 | _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) | 1009 | _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) |
| 1010 | _REGISTER_CLOCK("imx-sdma", NULL, sdma_clk) | ||
| 1006 | _REGISTER_CLOCK(NULL, "ckih", ckih_clk) | 1011 | _REGISTER_CLOCK(NULL, "ckih", ckih_clk) |
| 1007 | _REGISTER_CLOCK(NULL, "ckih2", ckih2_clk) | 1012 | _REGISTER_CLOCK(NULL, "ckih2", ckih2_clk) |
| 1008 | _REGISTER_CLOCK(NULL, "gpt_32k", gpt_32k_clk) | 1013 | _REGISTER_CLOCK(NULL, "gpt_32k", gpt_32k_clk) |
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile index da9676e80e8d..cd0bf756c3f8 100644 --- a/arch/arm/plat-mxc/devices/Makefile +++ b/arch/arm/plat-mxc/devices/Makefile | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o | 1 | obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o |
| 2 | obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o | 2 | obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o |
| 3 | obj-y += platform-imx-dma.o | ||
| 3 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o | 4 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o |
| 4 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o | 5 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o |
| 5 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o | 6 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o |
diff --git a/arch/arm/plat-mxc/devices/platform-imx-dma.c b/arch/arm/plat-mxc/devices/platform-imx-dma.c new file mode 100644 index 000000000000..02d989018059 --- /dev/null +++ b/arch/arm/plat-mxc/devices/platform-imx-dma.c | |||
| @@ -0,0 +1,129 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2010 Pengutronix | ||
| 3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify it under | ||
| 6 | * the terms of the GNU General Public License version 2 as published by the | ||
| 7 | * Free Software Foundation. | ||
| 8 | */ | ||
| 9 | #include <linux/compiler.h> | ||
| 10 | #include <linux/err.h> | ||
| 11 | #include <linux/init.h> | ||
| 12 | |||
| 13 | #include <mach/hardware.h> | ||
| 14 | #include <mach/devices-common.h> | ||
| 15 | #ifdef SDMA_IS_MERGED | ||
| 16 | #include <mach/sdma.h> | ||
| 17 | #else | ||
| 18 | struct sdma_platform_data { | ||
| 19 | int sdma_version; | ||
| 20 | char *cpu_name; | ||
| 21 | int to_version; | ||
| 22 | }; | ||
| 23 | #endif | ||
| 24 | |||
| 25 | struct imx_imx_sdma_data { | ||
| 26 | resource_size_t iobase; | ||
| 27 | resource_size_t irq; | ||
| 28 | struct sdma_platform_data pdata; | ||
| 29 | }; | ||
| 30 | |||
| 31 | #define imx_imx_sdma_data_entry_single(soc, _sdma_version, _cpu_name, _to_version)\ | ||
| 32 | { \ | ||
| 33 | .iobase = soc ## _SDMA ## _BASE_ADDR, \ | ||
| 34 | .irq = soc ## _INT_SDMA, \ | ||
| 35 | .pdata = { \ | ||
| 36 | .sdma_version = _sdma_version, \ | ||
| 37 | .cpu_name = _cpu_name, \ | ||
| 38 | .to_version = _to_version, \ | ||
| 39 | }, \ | ||
| 40 | } | ||
| 41 | |||
| 42 | #ifdef CONFIG_ARCH_MX25 | ||
| 43 | const struct imx_imx_sdma_data imx25_imx_sdma_data __initconst = | ||
| 44 | imx_imx_sdma_data_entry_single(MX25, 1, "imx25", 0); | ||
| 45 | #endif /* ifdef CONFIG_ARCH_MX25 */ | ||
| 46 | |||
| 47 | #ifdef CONFIG_ARCH_MX31 | ||
| 48 | struct imx_imx_sdma_data imx31_imx_sdma_data __initdata = | ||
| 49 | imx_imx_sdma_data_entry_single(MX31, 1, "imx31", 0); | ||
| 50 | #endif /* ifdef CONFIG_ARCH_MX31 */ | ||
| 51 | |||
| 52 | #ifdef CONFIG_ARCH_MX35 | ||
| 53 | struct imx_imx_sdma_data imx35_imx_sdma_data __initdata = | ||
| 54 | imx_imx_sdma_data_entry_single(MX35, 2, "imx35", 0); | ||
| 55 | #endif /* ifdef CONFIG_ARCH_MX35 */ | ||
| 56 | |||
| 57 | #ifdef CONFIG_ARCH_MX51 | ||
| 58 | const struct imx_imx_sdma_data imx51_imx_sdma_data __initconst = | ||
| 59 | imx_imx_sdma_data_entry_single(MX51, 2, "imx51", 0); | ||
| 60 | #endif /* ifdef CONFIG_ARCH_MX51 */ | ||
| 61 | |||
| 62 | static struct platform_device __init __maybe_unused *imx_add_imx_sdma( | ||
| 63 | const struct imx_imx_sdma_data *data) | ||
| 64 | { | ||
| 65 | struct resource res[] = { | ||
| 66 | { | ||
| 67 | .start = data->iobase, | ||
| 68 | .end = data->iobase + SZ_4K - 1, | ||
| 69 | .flags = IORESOURCE_MEM, | ||
| 70 | }, { | ||
| 71 | .start = data->irq, | ||
| 72 | .end = data->irq, | ||
| 73 | .flags = IORESOURCE_IRQ, | ||
| 74 | }, | ||
| 75 | }; | ||
| 76 | |||
| 77 | return imx_add_platform_device("imx-sdma", -1, | ||
| 78 | res, ARRAY_SIZE(res), | ||
| 79 | &data->pdata, sizeof(data->pdata)); | ||
| 80 | } | ||
| 81 | |||
| 82 | static struct platform_device __init __maybe_unused *imx_add_imx_dma(void) | ||
| 83 | { | ||
| 84 | return imx_add_platform_device("imx-dma", -1, NULL, 0, NULL, 0); | ||
| 85 | } | ||
| 86 | |||
| 87 | static int __init imxXX_add_imx_dma(void) | ||
| 88 | { | ||
| 89 | struct platform_device *ret; | ||
| 90 | |||
| 91 | #if defined(CONFIG_SOC_IMX21) || defined(CONFIG_SOC_IMX27) | ||
| 92 | if (cpu_is_mx21() || cpu_is_mx27()) | ||
| 93 | ret = imx_add_imx_dma(); | ||
| 94 | else | ||
| 95 | #endif | ||
| 96 | |||
| 97 | #if defined(CONFIG_ARCH_MX25) | ||
| 98 | if (cpu_is_mx25()) | ||
| 99 | ret = imx_add_imx_sdma(&imx25_imx_sdma_data); | ||
| 100 | else | ||
| 101 | #endif | ||
| 102 | |||
| 103 | #if defined(CONFIG_ARCH_MX31) | ||
| 104 | if (cpu_is_mx31()) { | ||
| 105 | imx31_imx_sdma_data.pdata.to_version = mx31_revision() >> 4; | ||
| 106 | ret = imx_add_imx_sdma(&imx31_imx_sdma_data); | ||
| 107 | } else | ||
| 108 | #endif | ||
| 109 | |||
| 110 | #if defined(CONFIG_ARCH_MX35) | ||
| 111 | if (cpu_is_mx35()) { | ||
| 112 | imx35_imx_sdma_data.pdata.to_version = mx35_revision() >> 4; | ||
| 113 | ret = imx_add_imx_sdma(&imx35_imx_sdma_data); | ||
| 114 | } else | ||
| 115 | #endif | ||
| 116 | |||
| 117 | #if defined(CONFIG_ARCH_MX51) | ||
| 118 | if (cpu_is_mx51()) | ||
| 119 | ret = imx_add_imx_sdma(&imx51_imx_sdma_data); | ||
| 120 | else | ||
| 121 | #endif | ||
| 122 | ret = ERR_PTR(-ENODEV); | ||
| 123 | |||
| 124 | if (IS_ERR(ret)) | ||
| 125 | return PTR_ERR(ret); | ||
| 126 | |||
| 127 | return 0; | ||
| 128 | } | ||
| 129 | arch_initcall(imxXX_add_imx_dma); | ||
diff --git a/arch/arm/plat-mxc/include/mach/mx51.h b/arch/arm/plat-mxc/include/mach/mx51.h index c99eeab6fe09..1906ee5a5497 100644 --- a/arch/arm/plat-mxc/include/mach/mx51.h +++ b/arch/arm/plat-mxc/include/mach/mx51.h | |||
| @@ -285,7 +285,7 @@ | |||
| 285 | #define MX51_MXC_INT_MMC_SDHC3 3 | 285 | #define MX51_MXC_INT_MMC_SDHC3 3 |
| 286 | #define MX51_MXC_INT_MMC_SDHC4 4 | 286 | #define MX51_MXC_INT_MMC_SDHC4 4 |
| 287 | #define MX51_MXC_INT_RESV5 5 | 287 | #define MX51_MXC_INT_RESV5 5 |
| 288 | #define MX51_MXC_INT_SDMA 6 | 288 | #define MX51_INT_SDMA 6 |
| 289 | #define MX51_MXC_INT_IOMUX 7 | 289 | #define MX51_MXC_INT_IOMUX 7 |
| 290 | #define MX51_INT_NFC 8 | 290 | #define MX51_INT_NFC 8 |
| 291 | #define MX51_MXC_INT_VPU 9 | 291 | #define MX51_MXC_INT_VPU 9 |
