aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/memory
diff options
context:
space:
mode:
authorNicolas Ferre <nicolas.ferre@atmel.com>2014-08-25 09:35:26 -0400
committerNicolas Ferre <nicolas.ferre@atmel.com>2014-08-25 09:35:26 -0400
commite657ce689a85ff1c887b8020282e5b2ab1411ded (patch)
treeb9e9195aeaeb77fc7fa730eac0ce98bcbe267dea /drivers/memory
parent39333610ba3b1e076ac1ceccca34de037a413a03 (diff)
parentae499f0fadaf28bf3138676fa2d3f6cf7d57556a (diff)
Merge tag 'at91-drivers-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux
Pull AT91 reset, poweroff and ram drivers from Maxime Ripard: "This tag holds the various new drivers introduced to move code that used to be in mach-at91 over to the proper frameworks. These files are the reboot and poweroff code for all AT91 SoCs but the RM9200, and the ram controller driver is not doing much at the time, except for grabing the RAM clock in order to leave it always enabled." Conflicts: arch/arm/mach-at91/Kconfig
Diffstat (limited to 'drivers/memory')
-rw-r--r--drivers/memory/Kconfig10
-rw-r--r--drivers/memory/Makefile1
-rw-r--r--drivers/memory/atmel-sdramc.c98
3 files changed, 109 insertions, 0 deletions
diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
index fab81a143bd7..6d91c27fd4c8 100644
--- a/drivers/memory/Kconfig
+++ b/drivers/memory/Kconfig
@@ -7,6 +7,16 @@ menuconfig MEMORY
7 7
8if MEMORY 8if MEMORY
9 9
10config ATMEL_SDRAMC
11 bool "Atmel (Multi-port DDR-)SDRAM Controller"
12 default y
13 depends on ARCH_AT91 && OF
14 help
15 This driver is for Atmel SDRAM Controller or Atmel Multi-port
16 DDR-SDRAM Controller available on Atmel AT91SAM9 and SAMA5 SoCs.
17 Starting with the at91sam9g45, this controller supports SDR, DDR and
18 LP-DDR memories.
19
10config TI_AEMIF 20config TI_AEMIF
11 tristate "Texas Instruments AEMIF driver" 21 tristate "Texas Instruments AEMIF driver"
12 depends on (ARCH_DAVINCI || ARCH_KEYSTONE) && OF 22 depends on (ARCH_DAVINCI || ARCH_KEYSTONE) && OF
diff --git a/drivers/memory/Makefile b/drivers/memory/Makefile
index 4055c47f45ab..c32d31981be3 100644
--- a/drivers/memory/Makefile
+++ b/drivers/memory/Makefile
@@ -5,6 +5,7 @@
5ifeq ($(CONFIG_DDR),y) 5ifeq ($(CONFIG_DDR),y)
6obj-$(CONFIG_OF) += of_memory.o 6obj-$(CONFIG_OF) += of_memory.o
7endif 7endif
8obj-$(CONFIG_ATMEL_SDRAMC) += atmel-sdramc.o
8obj-$(CONFIG_TI_AEMIF) += ti-aemif.o 9obj-$(CONFIG_TI_AEMIF) += ti-aemif.o
9obj-$(CONFIG_TI_EMIF) += emif.o 10obj-$(CONFIG_TI_EMIF) += emif.o
10obj-$(CONFIG_FSL_CORENET_CF) += fsl-corenet-cf.o 11obj-$(CONFIG_FSL_CORENET_CF) += fsl-corenet-cf.o
diff --git a/drivers/memory/atmel-sdramc.c b/drivers/memory/atmel-sdramc.c
new file mode 100644
index 000000000000..fed04e8efe75
--- /dev/null
+++ b/drivers/memory/atmel-sdramc.c
@@ -0,0 +1,98 @@
1/*
2 * Atmel (Multi-port DDR-)SDRAM Controller driver
3 *
4 * Copyright (C) 2014 Atmel
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 *
18 */
19
20#include <linux/clk.h>
21#include <linux/err.h>
22#include <linux/kernel.h>
23#include <linux/module.h>
24#include <linux/of_platform.h>
25#include <linux/platform_device.h>
26
27struct at91_ramc_caps {
28 bool has_ddrck;
29 bool has_mpddr_clk;
30};
31
32static const struct at91_ramc_caps at91rm9200_caps = { };
33
34static const struct at91_ramc_caps at91sam9g45_caps = {
35 .has_ddrck = 1,
36 .has_mpddr_clk = 0,
37};
38
39static const struct at91_ramc_caps sama5d3_caps = {
40 .has_ddrck = 1,
41 .has_mpddr_clk = 1,
42};
43
44static const struct of_device_id atmel_ramc_of_match[] = {
45 { .compatible = "atmel,at91rm9200-sdramc", .data = &at91rm9200_caps, },
46 { .compatible = "atmel,at91sam9260-sdramc", .data = &at91rm9200_caps, },
47 { .compatible = "atmel,at91sam9g45-ddramc", .data = &at91sam9g45_caps, },
48 { .compatible = "atmel,sama5d3-ddramc", .data = &sama5d3_caps, },
49 {},
50};
51MODULE_DEVICE_TABLE(of, atmel_ramc_of_match);
52
53static int atmel_ramc_probe(struct platform_device *pdev)
54{
55 const struct of_device_id *match;
56 const struct at91_ramc_caps *caps;
57 struct clk *clk;
58
59 match = of_match_device(atmel_ramc_of_match, &pdev->dev);
60 caps = match->data;
61
62 if (caps->has_ddrck) {
63 clk = devm_clk_get(&pdev->dev, "ddrck");
64 if (IS_ERR(clk))
65 return PTR_ERR(clk);
66 clk_prepare_enable(clk);
67 }
68
69 if (caps->has_mpddr_clk) {
70 clk = devm_clk_get(&pdev->dev, "mpddr");
71 if (IS_ERR(clk)) {
72 pr_err("AT91 RAMC: couldn't get mpddr clock\n");
73 return PTR_ERR(clk);
74 }
75 clk_prepare_enable(clk);
76 }
77
78 return 0;
79}
80
81static struct platform_driver atmel_ramc_driver = {
82 .probe = atmel_ramc_probe,
83 .driver = {
84 .name = "atmel-ramc",
85 .owner = THIS_MODULE,
86 .of_match_table = atmel_ramc_of_match,
87 },
88};
89
90static int __init atmel_ramc_init(void)
91{
92 return platform_driver_register(&atmel_ramc_driver);
93}
94module_init(atmel_ramc_init);
95
96MODULE_LICENSE("GPL v2");
97MODULE_AUTHOR("Alexandre Belloni <alexandre.belloni@free-electrons.com>");
98MODULE_DESCRIPTION("Atmel (Multi-port DDR-)SDRAM Controller");