aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci/cpuidle.c
diff options
context:
space:
mode:
authorSekhar Nori <nsekhar@ti.com>2009-11-16 06:51:37 -0500
committerKevin Hilman <khilman@deeprootsystems.com>2010-02-04 16:29:38 -0500
commit948c66df0d5e23dbcb84bee39a11b56c8a0d3e41 (patch)
tree73f44815624ac8b43436bccb804126e910c36f94 /arch/arm/mach-davinci/cpuidle.c
parente2da3aaa4254d9e79d9524190fc7e5f0cbdc3c33 (diff)
davinci: cpuidle: move mapping of DDR2 controller registers out of driver
When suspend is supported, both cpuidle and suspend code need to work on DDR2 registers. Instead of mapping the DDR2 registers twice, do it once outside of cpuidle driver and let cpuidle driver get the virtual base address of DDR2 registers. Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/cpuidle.c')
-rw-r--r--arch/arm/mach-davinci/cpuidle.c33
1 files changed, 4 insertions, 29 deletions
diff --git a/arch/arm/mach-davinci/cpuidle.c b/arch/arm/mach-davinci/cpuidle.c
index beda3b579688..bd59f31b8a95 100644
--- a/arch/arm/mach-davinci/cpuidle.c
+++ b/arch/arm/mach-davinci/cpuidle.c
@@ -106,8 +106,6 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev)
106 int ret; 106 int ret;
107 struct cpuidle_device *device; 107 struct cpuidle_device *device;
108 struct davinci_cpuidle_config *pdata = pdev->dev.platform_data; 108 struct davinci_cpuidle_config *pdata = pdev->dev.platform_data;
109 struct resource *ddr2_regs;
110 resource_size_t len;
111 109
112 device = &per_cpu(davinci_cpuidle_device, smp_processor_id()); 110 device = &per_cpu(davinci_cpuidle_device, smp_processor_id());
113 111
@@ -116,28 +114,12 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev)
116 return -ENOENT; 114 return -ENOENT;
117 } 115 }
118 116
119 ddr2_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 117 ddr2_reg_base = pdata->ddr2_ctlr_base;
120 if (!ddr2_regs) {
121 dev_err(&pdev->dev, "cannot get DDR2 controller register base");
122 return -ENODEV;
123 }
124
125 len = resource_size(ddr2_regs);
126
127 ddr2_regs = request_mem_region(ddr2_regs->start, len, ddr2_regs->name);
128 if (!ddr2_regs)
129 return -EBUSY;
130
131 ddr2_reg_base = ioremap(ddr2_regs->start, len);
132 if (!ddr2_reg_base) {
133 ret = -ENOMEM;
134 goto ioremap_fail;
135 }
136 118
137 ret = cpuidle_register_driver(&davinci_idle_driver); 119 ret = cpuidle_register_driver(&davinci_idle_driver);
138 if (ret) { 120 if (ret) {
139 dev_err(&pdev->dev, "failed to register driver\n"); 121 dev_err(&pdev->dev, "failed to register driver\n");
140 goto driver_register_fail; 122 return ret;
141 } 123 }
142 124
143 /* Wait for interrupt state */ 125 /* Wait for interrupt state */
@@ -164,18 +146,11 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev)
164 ret = cpuidle_register_device(device); 146 ret = cpuidle_register_device(device);
165 if (ret) { 147 if (ret) {
166 dev_err(&pdev->dev, "failed to register device\n"); 148 dev_err(&pdev->dev, "failed to register device\n");
167 goto device_register_fail; 149 cpuidle_unregister_driver(&davinci_idle_driver);
150 return ret;
168 } 151 }
169 152
170 return 0; 153 return 0;
171
172device_register_fail:
173 cpuidle_unregister_driver(&davinci_idle_driver);
174driver_register_fail:
175 iounmap(ddr2_reg_base);
176ioremap_fail:
177 release_mem_region(ddr2_regs->start, len);
178 return ret;
179} 154}
180 155
181static struct platform_driver davinci_cpuidle_driver = { 156static struct platform_driver davinci_cpuidle_driver = {