|
@@ -14,10 +14,12 @@
|
|
|
#include <linux/suspend.h>
|
|
|
#include <linux/sched.h>
|
|
|
#include <linux/proc_fs.h>
|
|
|
+#include <linux/genalloc.h>
|
|
|
#include <linux/interrupt.h>
|
|
|
#include <linux/sysfs.h>
|
|
|
#include <linux/module.h>
|
|
|
#include <linux/of.h>
|
|
|
+#include <linux/of_platform.h>
|
|
|
#include <linux/platform_device.h>
|
|
|
#include <linux/io.h>
|
|
|
#include <linux/clk/at91_pmc.h>
|
|
@@ -222,10 +224,52 @@ void at91_pm_set_standby(void (*at91_standby)(void))
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#ifdef CONFIG_AT91_SLOW_CLOCK
|
|
|
+static void __init at91_pm_sram_init(void)
|
|
|
+{
|
|
|
+ struct gen_pool *sram_pool;
|
|
|
+ phys_addr_t sram_pbase;
|
|
|
+ unsigned long sram_base;
|
|
|
+ struct device_node *node;
|
|
|
+ struct platform_device *pdev;
|
|
|
+
|
|
|
+ node = of_find_compatible_node(NULL, NULL, "mmio-sram");
|
|
|
+ if (!node) {
|
|
|
+ pr_warn("%s: failed to find sram node!\n", __func__);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ pdev = of_find_device_by_node(node);
|
|
|
+ if (!pdev) {
|
|
|
+ pr_warn("%s: failed to find sram device!\n", __func__);
|
|
|
+ goto put_node;
|
|
|
+ }
|
|
|
+
|
|
|
+ sram_pool = dev_get_gen_pool(&pdev->dev);
|
|
|
+ if (!sram_pool) {
|
|
|
+ pr_warn("%s: sram pool unavailable!\n", __func__);
|
|
|
+ goto put_node;
|
|
|
+ }
|
|
|
+
|
|
|
+ sram_base = gen_pool_alloc(sram_pool, at91_slow_clock_sz);
|
|
|
+ if (!sram_base) {
|
|
|
+ pr_warn("%s: unable to alloc ocram!\n", __func__);
|
|
|
+ goto put_node;
|
|
|
+ }
|
|
|
+
|
|
|
+ sram_pbase = gen_pool_virt_to_phys(sram_pool, sram_base);
|
|
|
+ slow_clock = __arm_ioremap_exec(sram_pbase, at91_slow_clock_sz, false);
|
|
|
+
|
|
|
+put_node:
|
|
|
+ of_node_put(node);
|
|
|
+}
|
|
|
+#endif
|
|
|
+
|
|
|
+
|
|
|
static int __init at91_pm_init(void)
|
|
|
{
|
|
|
#ifdef CONFIG_AT91_SLOW_CLOCK
|
|
|
- slow_clock = (void *) (AT91_IO_VIRT_BASE - at91_slow_clock_sz);
|
|
|
+ at91_pm_sram_init();
|
|
|
#endif
|
|
|
|
|
|
pr_info("AT91: Power Management%s\n", (slow_clock ? " (with slow clock mode)" : ""));
|