Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 198329
b: refs/heads/master
c: 5cf8f57
h: refs/heads/master
i:
  198327: 14a9435
v: v3
  • Loading branch information
Vladimir Zapolskiy authored and Linus Torvalds committed May 25, 2010
1 parent b240808 commit d2b527d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9f4123b78d02ba48e7e6e3cd9de789c9b85b557a
refs/heads/master: 5cf8f57d44d16652336fabdd65e727a6e6f98cd5
25 changes: 8 additions & 17 deletions trunk/drivers/rtc/rtc-mxc.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ static struct rtc_class_ops mxc_rtc_ops = {

static int __init mxc_rtc_probe(struct platform_device *pdev)
{
struct clk *clk;
struct resource *res;
struct rtc_device *rtc;
struct rtc_plat_data *pdata = NULL;
Expand All @@ -402,14 +401,15 @@ static int __init mxc_rtc_probe(struct platform_device *pdev)
pdata->ioaddr = devm_ioremap(&pdev->dev, res->start,
resource_size(res));

clk = clk_get(&pdev->dev, "ckil");
if (IS_ERR(clk)) {
ret = PTR_ERR(clk);
pdata->clk = clk_get(&pdev->dev, "rtc");
if (IS_ERR(pdata->clk)) {
dev_err(&pdev->dev, "unable to get clock!\n");
ret = PTR_ERR(pdata->clk);
goto exit_free_pdata;
}

rate = clk_get_rate(clk);
clk_put(clk);
clk_enable(pdata->clk);
rate = clk_get_rate(pdata->clk);

if (rate == 32768)
reg = RTC_INPUT_CLK_32768HZ;
Expand All @@ -420,26 +420,17 @@ static int __init mxc_rtc_probe(struct platform_device *pdev)
else {
dev_err(&pdev->dev, "rtc clock is not valid (%lu)\n", rate);
ret = -EINVAL;
goto exit_free_pdata;
goto exit_put_clk;
}

reg |= RTC_ENABLE_BIT;
writew(reg, (pdata->ioaddr + RTC_RTCCTL));
if (((readw(pdata->ioaddr + RTC_RTCCTL)) & RTC_ENABLE_BIT) == 0) {
dev_err(&pdev->dev, "hardware module can't be enabled!\n");
ret = -EIO;
goto exit_free_pdata;
}

pdata->clk = clk_get(&pdev->dev, "rtc");
if (IS_ERR(pdata->clk)) {
dev_err(&pdev->dev, "unable to get clock!\n");
ret = PTR_ERR(pdata->clk);
goto exit_free_pdata;
goto exit_put_clk;
}

clk_enable(pdata->clk);

rtc = rtc_device_register(pdev->name, &pdev->dev, &mxc_rtc_ops,
THIS_MODULE);
if (IS_ERR(rtc)) {
Expand Down

0 comments on commit d2b527d

Please sign in to comment.