This source file includes following definitions.
- zynq_pm_ioremap
- zynq_pm_late_init
1
2
3
4
5
6
7
8
9
10 #include <linux/io.h>
11 #include <linux/of_address.h>
12 #include <linux/of_device.h>
13 #include "common.h"
14
15
16 #define DDRC_CTRL_REG1_OFFS 0x60
17 #define DDRC_DRAM_PARAM_REG3_OFFS 0x20
18
19
20 #define DDRC_CLOCKSTOP_MASK BIT(23)
21 #define DDRC_SELFREFRESH_MASK BIT(12)
22
23 static void __iomem *ddrc_base;
24
25
26
27
28
29
30
31
32 static void __iomem *zynq_pm_ioremap(const char *comp)
33 {
34 struct device_node *np;
35 void __iomem *base = NULL;
36
37 np = of_find_compatible_node(NULL, NULL, comp);
38 if (np) {
39 base = of_iomap(np, 0);
40 of_node_put(np);
41 } else {
42 pr_warn("%s: no compatible node found for '%s'\n", __func__,
43 comp);
44 }
45
46 return base;
47 }
48
49
50
51
52
53
54 void __init zynq_pm_late_init(void)
55 {
56 u32 reg;
57
58 ddrc_base = zynq_pm_ioremap("xlnx,zynq-ddrc-a05");
59 if (!ddrc_base) {
60 pr_warn("%s: Unable to map DDRC IO memory.\n", __func__);
61 } else {
62
63
64
65
66
67 reg = readl(ddrc_base + DDRC_DRAM_PARAM_REG3_OFFS);
68 reg |= DDRC_CLOCKSTOP_MASK;
69 writel(reg, ddrc_base + DDRC_DRAM_PARAM_REG3_OFFS);
70 }
71 }