1 // SPDX-License-Identifier: GPL-2.0-only
3 * Atmel (Multi-port DDR-)SDRAM Controller driver
5 * Author: Alexandre Belloni <alexandre.belloni@free-electrons.com>
7 * Copyright (C) 2014 Atmel
10 #include <linux/clk.h>
11 #include <linux/err.h>
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/of_platform.h>
15 #include <linux/platform_device.h>
17 struct at91_ramc_caps {
22 static const struct at91_ramc_caps at91rm9200_caps = { };
24 static const struct at91_ramc_caps at91sam9g45_caps = {
29 static const struct at91_ramc_caps sama5d3_caps = {
34 static const struct of_device_id atmel_ramc_of_match[] = {
35 { .compatible = "atmel,at91rm9200-sdramc", .data = &at91rm9200_caps, },
36 { .compatible = "atmel,at91sam9260-sdramc", .data = &at91rm9200_caps, },
37 { .compatible = "atmel,at91sam9g45-ddramc", .data = &at91sam9g45_caps, },
38 { .compatible = "atmel,sama5d3-ddramc", .data = &sama5d3_caps, },
42 static int atmel_ramc_probe(struct platform_device *pdev)
44 const struct at91_ramc_caps *caps;
47 caps = of_device_get_match_data(&pdev->dev);
49 if (caps->has_ddrck) {
50 clk = devm_clk_get(&pdev->dev, "ddrck");
53 clk_prepare_enable(clk);
56 if (caps->has_mpddr_clk) {
57 clk = devm_clk_get(&pdev->dev, "mpddr");
59 pr_err("AT91 RAMC: couldn't get mpddr clock\n");
62 clk_prepare_enable(clk);
68 static struct platform_driver atmel_ramc_driver = {
69 .probe = atmel_ramc_probe,
72 .of_match_table = atmel_ramc_of_match,
76 builtin_platform_driver(atmel_ramc_driver);