Skip to content

Commit e657ce6

Browse files
author
Nicolas Ferre
committed
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
2 parents 3933361 + ae499f0 commit e657ce6

11 files changed

Lines changed: 551 additions & 15 deletions

File tree

‎Documentation/devicetree/bindings/arm/atmel-at91.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ RAMC SDRAM/DDR Controller required properties:
6161
- compatible: Should be "atmel,at91rm9200-sdramc",
6262
"atmel,at91sam9260-sdramc",
6363
"atmel,at91sam9g45-ddramc",
64+
"atmel,sama5d3-ddramc",
6465
- reg: Should contain registers location and length
6566
For at91sam9263 and at91sam9g45 you must specify 2 entries.
6667

‎arch/arm/mach-at91/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ config SOC_AT91SAM9
5353
select ATMEL_AIC_IRQ if !OLD_IRQ_AT91
5454
select CPU_ARM926T
5555
select GENERIC_CLOCKEVENTS
56+
select MEMORY if USE_OF
57+
select ATMEL_SDRAMC if USE_OF
5658

5759
config SOC_SAMA5
5860
bool
@@ -61,6 +63,8 @@ config SOC_SAMA5
6163
select CPU_V7
6264
select GENERIC_CLOCKEVENTS
6365
select USE_OF
66+
select MEMORY
67+
select ATMEL_SDRAMC
6468

6569
menu "Atmel AT91 System-on-Chip"
6670

‎arch/arm/mach-at91/setup.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ static struct of_device_id ramc_ids[] = {
385385
{ .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby },
386386
{ .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby },
387387
{ .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby },
388+
{ .compatible = "atmel,sama5d3-ddramc", .data = at91_ddr_standby },
388389
{ /*sentinel*/ }
389390
};
390391

‎drivers/clk/at91/clk-system.c‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,7 @@ at91_clk_register_system(struct at91_pmc *pmc, const char *name,
119119
init.ops = &system_ops;
120120
init.parent_names = &parent_name;
121121
init.num_parents = 1;
122-
/*
123-
* CLK_IGNORE_UNUSED is used to avoid ddrck switch off.
124-
* TODO : we should implement a driver supporting at91 ddr controller
125-
* (see drivers/memory) which would request and enable the ddrck clock.
126-
* When this is done we will be able to remove CLK_IGNORE_UNUSED flag.
127-
*/
128-
init.flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED;
122+
init.flags = CLK_SET_RATE_PARENT;
129123

130124
sys->id = id;
131125
sys->hw.init = &init;

‎drivers/memory/Kconfig‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@ menuconfig MEMORY
77

88
if MEMORY
99

10+
config 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+
1020
config TI_AEMIF
1121
tristate "Texas Instruments AEMIF driver"
1222
depends on (ARCH_DAVINCI || ARCH_KEYSTONE) && OF

‎drivers/memory/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
ifeq ($(CONFIG_DDR),y)
66
obj-$(CONFIG_OF) += of_memory.o
77
endif
8+
obj-$(CONFIG_ATMEL_SDRAMC) += atmel-sdramc.o
89
obj-$(CONFIG_TI_AEMIF) += ti-aemif.o
910
obj-$(CONFIG_TI_EMIF) += emif.o
1011
obj-$(CONFIG_FSL_CORENET_CF) += fsl-corenet-cf.o

‎drivers/memory/atmel-sdramc.c‎

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
27+
struct at91_ramc_caps {
28+
bool has_ddrck;
29+
bool has_mpddr_clk;
30+
};
31+
32+
static const struct at91_ramc_caps at91rm9200_caps = { };
33+
34+
static const struct at91_ramc_caps at91sam9g45_caps = {
35+
.has_ddrck = 1,
36+
.has_mpddr_clk = 0,
37+
};
38+
39+
static const struct at91_ramc_caps sama5d3_caps = {
40+
.has_ddrck = 1,
41+
.has_mpddr_clk = 1,
42+
};
43+
44+
static 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+
};
51+
MODULE_DEVICE_TABLE(of, atmel_ramc_of_match);
52+
53+
static 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+
81+
static 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+
90+
static int __init atmel_ramc_init(void)
91+
{
92+
return platform_driver_register(&atmel_ramc_driver);
93+
}
94+
module_init(atmel_ramc_init);
95+
96+
MODULE_LICENSE("GPL v2");
97+
MODULE_AUTHOR("Alexandre Belloni <alexandre.belloni@free-electrons.com>");
98+
MODULE_DESCRIPTION("Atmel (Multi-port DDR-)SDRAM Controller");

‎drivers/power/reset/Kconfig‎

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,33 @@ menuconfig POWER_RESET
66

77
Say Y here to enable board reset and power off
88

9+
if POWER_RESET
10+
911
config POWER_RESET_AS3722
1012
bool "ams AS3722 power-off driver"
11-
depends on MFD_AS3722 && POWER_RESET
13+
depends on MFD_AS3722
1214
help
1315
This driver supports turning off board via a ams AS3722 power-off.
1416

17+
config POWER_RESET_AT91_POWEROFF
18+
bool "Atmel AT91 poweroff driver"
19+
depends on MACH_AT91
20+
default SOC_AT91SAM9 || SOC_SAMA5
21+
help
22+
This driver supports poweroff for Atmel AT91SAM9 and SAMA5
23+
SoCs
24+
25+
config POWER_RESET_AT91_RESET
26+
bool "Atmel AT91 reset driver"
27+
depends on MACH_AT91
28+
default SOC_AT91SAM9 || SOC_SAMA5
29+
help
30+
This driver supports restart for Atmel AT91SAM9 and SAMA5
31+
SoCs
32+
1533
config POWER_RESET_AXXIA
1634
bool "LSI Axxia reset driver"
17-
depends on POWER_RESET && ARCH_AXXIA
35+
depends on ARCH_AXXIA
1836
help
1937
This driver supports restart for Axxia SoC.
2038

@@ -33,7 +51,7 @@ config POWER_RESET_BRCMSTB
3351

3452
config POWER_RESET_GPIO
3553
bool "GPIO power-off driver"
36-
depends on OF_GPIO && POWER_RESET
54+
depends on OF_GPIO
3755
help
3856
This driver supports turning off your board via a GPIO line.
3957
If your board needs a GPIO high/low to power down, say Y and
@@ -47,13 +65,13 @@ config POWER_RESET_HISI
4765

4866
config POWER_RESET_MSM
4967
bool "Qualcomm MSM power-off driver"
50-
depends on POWER_RESET && ARCH_QCOM
68+
depends on ARCH_QCOM
5169
help
5270
Power off and restart support for Qualcomm boards.
5371

5472
config POWER_RESET_QNAP
5573
bool "QNAP power-off driver"
56-
depends on OF_GPIO && POWER_RESET && PLAT_ORION
74+
depends on OF_GPIO && PLAT_ORION
5775
help
5876
This driver supports turning off QNAP NAS devices by sending
5977
commands to the microcontroller which controls the main power.
@@ -71,22 +89,20 @@ config POWER_RESET_RESTART
7189
config POWER_RESET_SUN6I
7290
bool "Allwinner A31 SoC reset driver"
7391
depends on ARCH_SUNXI
74-
depends on POWER_RESET
7592
help
7693
Reboot support for the Allwinner A31 SoCs.
7794

7895
config POWER_RESET_VEXPRESS
7996
bool "ARM Versatile Express power-off and reset driver"
8097
depends on ARM || ARM64
81-
depends on POWER_RESET && VEXPRESS_CONFIG
98+
depends on VEXPRESS_CONFIG
8299
help
83100
Power off and reset support for the ARM Ltd. Versatile
84101
Express boards.
85102

86103
config POWER_RESET_XGENE
87104
bool "APM SoC X-Gene reset driver"
88105
depends on ARM64
89-
depends on POWER_RESET
90106
help
91107
Reboot support for the APM SoC X-Gene Eval boards.
92108

@@ -97,3 +113,4 @@ config POWER_RESET_KEYSTONE
97113
help
98114
Reboot support for the KEYSTONE SoCs.
99115

116+
endif

‎drivers/power/reset/Makefile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
obj-$(CONFIG_POWER_RESET_AS3722) += as3722-poweroff.o
2+
obj-$(CONFIG_POWER_RESET_AT91_POWEROFF) += at91-poweroff.o
3+
obj-$(CONFIG_POWER_RESET_AT91_RESET) += at91-reset.o
24
obj-$(CONFIG_POWER_RESET_AXXIA) += axxia-reset.o
35
obj-$(CONFIG_POWER_RESET_BRCMSTB) += brcmstb-reboot.o
46
obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o

0 commit comments

Comments
 (0)