aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2014-12-03 12:42:51 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-12-05 11:30:33 -0500
commit86d88bfca4758a9a95cbd183c917d623abc3ce84 (patch)
tree2fb3b851e0fc927ad50c0cabf847dcb5d87fe858 /drivers/pcmcia
parentb02cba8693fca6bd9166dd541f6a61cd82f6e231 (diff)
ARM: 8247/2: pcmcia: sa1100: make use of device clock
Use per-device clock (instead of calling cpufreq_get(0), which can return 0 if no cpu frequency driver is selected) to program timings. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r--drivers/pcmcia/sa1100_generic.c1
-rw-r--r--drivers/pcmcia/sa11xx_base.c14
2 files changed, 13 insertions, 2 deletions
diff --git a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c
index ff8a027a4afb..d2ab06048169 100644
--- a/drivers/pcmcia/sa1100_generic.c
+++ b/drivers/pcmcia/sa1100_generic.c
@@ -93,6 +93,7 @@ static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)
93 for (i = 0; i < sinfo->nskt; i++) 93 for (i = 0; i < sinfo->nskt; i++)
94 soc_pcmcia_remove_one(&sinfo->skt[i]); 94 soc_pcmcia_remove_one(&sinfo->skt[i]);
95 95
96 clk_put(sinfo->clk);
96 kfree(sinfo); 97 kfree(sinfo);
97 return 0; 98 return 0;
98} 99}
diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c
index 54d3089d157b..cf6de2c2b329 100644
--- a/drivers/pcmcia/sa11xx_base.c
+++ b/drivers/pcmcia/sa11xx_base.c
@@ -135,14 +135,16 @@ sa1100_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
135static int 135static int
136sa1100_pcmcia_set_timing(struct soc_pcmcia_socket *skt) 136sa1100_pcmcia_set_timing(struct soc_pcmcia_socket *skt)
137{ 137{
138 return sa1100_pcmcia_set_mecr(skt, cpufreq_get(0)); 138 unsigned long clk = clk_get_rate(skt->clk);
139
140 return sa1100_pcmcia_set_mecr(skt, clk / 1000);
139} 141}
140 142
141static int 143static int
142sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf) 144sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf)
143{ 145{
144 struct soc_pcmcia_timing timing; 146 struct soc_pcmcia_timing timing;
145 unsigned int clock = cpufreq_get(0); 147 unsigned int clock = clk_get_rate(skt->clk);
146 unsigned long mecr = MECR; 148 unsigned long mecr = MECR;
147 char *p = buf; 149 char *p = buf;
148 150
@@ -218,6 +220,11 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
218 struct skt_dev_info *sinfo; 220 struct skt_dev_info *sinfo;
219 struct soc_pcmcia_socket *skt; 221 struct soc_pcmcia_socket *skt;
220 int i, ret = 0; 222 int i, ret = 0;
223 struct clk *clk;
224
225 clk = clk_get(dev, NULL);
226 if (IS_ERR(clk))
227 return PTR_ERR(clk);
221 228
222 sa11xx_drv_pcmcia_ops(ops); 229 sa11xx_drv_pcmcia_ops(ops);
223 230
@@ -226,12 +233,14 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
226 return -ENOMEM; 233 return -ENOMEM;
227 234
228 sinfo->nskt = nr; 235 sinfo->nskt = nr;
236 sinfo->clk = clk;
229 237
230 /* Initialize processor specific parameters */ 238 /* Initialize processor specific parameters */
231 for (i = 0; i < nr; i++) { 239 for (i = 0; i < nr; i++) {
232 skt = &sinfo->skt[i]; 240 skt = &sinfo->skt[i];
233 241
234 skt->nr = first + i; 242 skt->nr = first + i;
243 skt->clk = clk;
235 soc_pcmcia_init_one(skt, ops, dev); 244 soc_pcmcia_init_one(skt, ops, dev);
236 245
237 ret = sa11xx_drv_pcmcia_add_one(skt); 246 ret = sa11xx_drv_pcmcia_add_one(skt);
@@ -242,6 +251,7 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
242 if (ret) { 251 if (ret) {
243 while (--i >= 0) 252 while (--i >= 0)
244 soc_pcmcia_remove_one(&sinfo->skt[i]); 253 soc_pcmcia_remove_one(&sinfo->skt[i]);
254 clk_put(clk);
245 kfree(sinfo); 255 kfree(sinfo);
246 } else { 256 } else {
247 dev_set_drvdata(dev, sinfo); 257 dev_set_drvdata(dev, sinfo);