aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorJosh Wu <josh.wu@atmel.com>2015-07-20 05:32:05 -0400
committerSebastian Reichel <sre@kernel.org>2015-07-20 12:12:09 -0400
commit1ae25d626cfe7e11adc2c3e71d0de1f882954ef3 (patch)
tree175a6947732fc24b64cbf9d1c1919adfadb36ede /drivers/power
parentb1a55af2773d5e4d30b748517fedfac26fc5fd81 (diff)
power: reset: at91: add sama5d3 reset function
This patch introduces a new compatible string: "atmel,sama5d3-rstc" and new reset function for sama5d3 and later chips. As in sama5d3 or later chips, we don't have to shutdown the DDR controller before reset. Shutdown the DDR controller before reset is a workaround to avoid DDR signal driving the bus, but since sama5d3 and later chips there is no such a conflict. So in this patch: 1. the sama5d3 reset function only need to write the rstc register and return. 2. we can remove the code related with sama5d3 DDR controller as we don't use it at all. Signed-off-by: Josh Wu <josh.wu@atmel.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sebastian Reichel <sre@kernel.org>
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/reset/at91-reset.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c
index 36dc52fb2ec8..c378d4ec826f 100644
--- a/drivers/power/reset/at91-reset.c
+++ b/drivers/power/reset/at91-reset.c
@@ -123,6 +123,15 @@ static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode,
123 return NOTIFY_DONE; 123 return NOTIFY_DONE;
124} 124}
125 125
126static int sama5d3_restart(struct notifier_block *this, unsigned long mode,
127 void *cmd)
128{
129 writel(cpu_to_le32(AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST),
130 at91_rstc_base);
131
132 return NOTIFY_DONE;
133}
134
126static void __init at91_reset_status(struct platform_device *pdev) 135static void __init at91_reset_status(struct platform_device *pdev)
127{ 136{
128 u32 reg = readl(at91_rstc_base + AT91_RSTC_SR); 137 u32 reg = readl(at91_rstc_base + AT91_RSTC_SR);
@@ -155,13 +164,13 @@ static void __init at91_reset_status(struct platform_device *pdev)
155static const struct of_device_id at91_ramc_of_match[] = { 164static const struct of_device_id at91_ramc_of_match[] = {
156 { .compatible = "atmel,at91sam9260-sdramc", }, 165 { .compatible = "atmel,at91sam9260-sdramc", },
157 { .compatible = "atmel,at91sam9g45-ddramc", }, 166 { .compatible = "atmel,at91sam9g45-ddramc", },
158 { .compatible = "atmel,sama5d3-ddramc", },
159 { /* sentinel */ } 167 { /* sentinel */ }
160}; 168};
161 169
162static const struct of_device_id at91_reset_of_match[] = { 170static const struct of_device_id at91_reset_of_match[] = {
163 { .compatible = "atmel,at91sam9260-rstc", .data = at91sam9260_restart }, 171 { .compatible = "atmel,at91sam9260-rstc", .data = at91sam9260_restart },
164 { .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart }, 172 { .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart },
173 { .compatible = "atmel,sama5d3-rstc", .data = sama5d3_restart },
165 { /* sentinel */ } 174 { /* sentinel */ }
166}; 175};
167 176
@@ -181,13 +190,16 @@ static int at91_reset_of_probe(struct platform_device *pdev)
181 return -ENODEV; 190 return -ENODEV;
182 } 191 }
183 192
184 for_each_matching_node(np, at91_ramc_of_match) { 193 if (!of_device_is_compatible(pdev->dev.of_node, "atmel,sama5d3-rstc")) {
185 at91_ramc_base[idx] = of_iomap(np, 0); 194 /* we need to shutdown the ddr controller, so get ramc base */
186 if (!at91_ramc_base[idx]) { 195 for_each_matching_node(np, at91_ramc_of_match) {
187 dev_err(&pdev->dev, "Could not map ram controller address\n"); 196 at91_ramc_base[idx] = of_iomap(np, 0);
188 return -ENODEV; 197 if (!at91_ramc_base[idx]) {
198 dev_err(&pdev->dev, "Could not map ram controller address\n");
199 return -ENODEV;
200 }
201 idx++;
189 } 202 }
190 idx++;
191 } 203 }
192 204
193 match = of_match_node(at91_reset_of_match, pdev->dev.of_node); 205 match = of_match_node(at91_reset_of_match, pdev->dev.of_node);