Skip to content

Commit

Permalink
ARM: 8247/2: pcmcia: sa1100: make use of device clock
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Russell King <[email protected]>
  • Loading branch information
lumag authored and Russell King committed Dec 5, 2014
1 parent b02cba8 commit 86d88bf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/pcmcia/sa1100_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ static int sa11x0_drv_pcmcia_remove(struct platform_device *dev)
for (i = 0; i < sinfo->nskt; i++)
soc_pcmcia_remove_one(&sinfo->skt[i]);

clk_put(sinfo->clk);
kfree(sinfo);
return 0;
}
Expand Down
14 changes: 12 additions & 2 deletions drivers/pcmcia/sa11xx_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,16 @@ sa1100_pcmcia_frequency_change(struct soc_pcmcia_socket *skt,
static int
sa1100_pcmcia_set_timing(struct soc_pcmcia_socket *skt)
{
return sa1100_pcmcia_set_mecr(skt, cpufreq_get(0));
unsigned long clk = clk_get_rate(skt->clk);

return sa1100_pcmcia_set_mecr(skt, clk / 1000);
}

static int
sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf)
{
struct soc_pcmcia_timing timing;
unsigned int clock = cpufreq_get(0);
unsigned int clock = clk_get_rate(skt->clk);
unsigned long mecr = MECR;
char *p = buf;

Expand Down Expand Up @@ -218,6 +220,11 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
struct skt_dev_info *sinfo;
struct soc_pcmcia_socket *skt;
int i, ret = 0;
struct clk *clk;

clk = clk_get(dev, NULL);
if (IS_ERR(clk))
return PTR_ERR(clk);

sa11xx_drv_pcmcia_ops(ops);

Expand All @@ -226,12 +233,14 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
return -ENOMEM;

sinfo->nskt = nr;
sinfo->clk = clk;

/* Initialize processor specific parameters */
for (i = 0; i < nr; i++) {
skt = &sinfo->skt[i];

skt->nr = first + i;
skt->clk = clk;
soc_pcmcia_init_one(skt, ops, dev);

ret = sa11xx_drv_pcmcia_add_one(skt);
Expand All @@ -242,6 +251,7 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
if (ret) {
while (--i >= 0)
soc_pcmcia_remove_one(&sinfo->skt[i]);
clk_put(clk);
kfree(sinfo);
} else {
dev_set_drvdata(dev, sinfo);
Expand Down

0 comments on commit 86d88bf

Please sign in to comment.