mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-25 21:05:15 +07:00
563b41c983
The Kconfig for this option is currently: config ATMEL_SDRAMC bool "Atmel (Multi-port DDR-)SDRAM Controller" ...meaning that it currently is not being built as a module by anyone. Lets remove the couple traces of modularity, so that when reading the driver there is no doubt it is builtin-only. Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. An alternate init level might be worth considering at a later date. Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code. We also delete the MODULE_LICENSE tag etc. since all that information was (or is now) contained at the top of the file in the comments. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
95 lines
2.4 KiB
C
95 lines
2.4 KiB
C
/*
|
|
* Atmel (Multi-port DDR-)SDRAM Controller driver
|
|
*
|
|
* Author: Alexandre Belloni <alexandre.belloni@free-electrons.com>
|
|
*
|
|
* Copyright (C) 2014 Atmel
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation version 2 of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
*/
|
|
|
|
#include <linux/clk.h>
|
|
#include <linux/err.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <linux/of_platform.h>
|
|
#include <linux/platform_device.h>
|
|
|
|
struct at91_ramc_caps {
|
|
bool has_ddrck;
|
|
bool has_mpddr_clk;
|
|
};
|
|
|
|
static const struct at91_ramc_caps at91rm9200_caps = { };
|
|
|
|
static const struct at91_ramc_caps at91sam9g45_caps = {
|
|
.has_ddrck = 1,
|
|
.has_mpddr_clk = 0,
|
|
};
|
|
|
|
static const struct at91_ramc_caps sama5d3_caps = {
|
|
.has_ddrck = 1,
|
|
.has_mpddr_clk = 1,
|
|
};
|
|
|
|
static const struct of_device_id atmel_ramc_of_match[] = {
|
|
{ .compatible = "atmel,at91rm9200-sdramc", .data = &at91rm9200_caps, },
|
|
{ .compatible = "atmel,at91sam9260-sdramc", .data = &at91rm9200_caps, },
|
|
{ .compatible = "atmel,at91sam9g45-ddramc", .data = &at91sam9g45_caps, },
|
|
{ .compatible = "atmel,sama5d3-ddramc", .data = &sama5d3_caps, },
|
|
{},
|
|
};
|
|
|
|
static int atmel_ramc_probe(struct platform_device *pdev)
|
|
{
|
|
const struct of_device_id *match;
|
|
const struct at91_ramc_caps *caps;
|
|
struct clk *clk;
|
|
|
|
match = of_match_device(atmel_ramc_of_match, &pdev->dev);
|
|
caps = match->data;
|
|
|
|
if (caps->has_ddrck) {
|
|
clk = devm_clk_get(&pdev->dev, "ddrck");
|
|
if (IS_ERR(clk))
|
|
return PTR_ERR(clk);
|
|
clk_prepare_enable(clk);
|
|
}
|
|
|
|
if (caps->has_mpddr_clk) {
|
|
clk = devm_clk_get(&pdev->dev, "mpddr");
|
|
if (IS_ERR(clk)) {
|
|
pr_err("AT91 RAMC: couldn't get mpddr clock\n");
|
|
return PTR_ERR(clk);
|
|
}
|
|
clk_prepare_enable(clk);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
static struct platform_driver atmel_ramc_driver = {
|
|
.probe = atmel_ramc_probe,
|
|
.driver = {
|
|
.name = "atmel-ramc",
|
|
.of_match_table = atmel_ramc_of_match,
|
|
},
|
|
};
|
|
|
|
static int __init atmel_ramc_init(void)
|
|
{
|
|
return platform_driver_register(&atmel_ramc_driver);
|
|
}
|
|
device_initcall(atmel_ramc_init);
|