/* * Looks like the RTC in the Gemini SoC is (totaly) broken * We can't read/write directly the time from RTC registers. * We must do some "offset" calculation to get the real time * * This FIX works pretty fine and Stormlinksemi aka Cortina-Networks does * the same thing, without the rtc-lib.c calls.
*/
rtc->pclk = devm_clk_get(dev, "PCLK"); if (IS_ERR(rtc->pclk)) {
dev_err(dev, "could not get PCLK\n");
} else {
ret = clk_prepare_enable(rtc->pclk); if (ret) {
dev_err(dev, "failed to enable PCLK\n"); return ret;
}
}
rtc->extclk = devm_clk_get(dev, "EXTCLK"); if (IS_ERR(rtc->extclk)) {
dev_err(dev, "could not get EXTCLK\n");
} else {
ret = clk_prepare_enable(rtc->extclk); if (ret) {
dev_err(dev, "failed to enable EXTCLK\n"); goto err_disable_pclk;
}
}
rtc->rtc_irq = platform_get_irq(pdev, 0); if (rtc->rtc_irq < 0) {
ret = rtc->rtc_irq; goto err_disable_extclk;
}
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) {
ret = -ENODEV; goto err_disable_extclk;
}
rtc->rtc_base = devm_ioremap(dev, res->start,
resource_size(res)); if (!rtc->rtc_base) {
ret = -ENOMEM; goto err_disable_extclk;
}
rtc_dev = devm_rtc_allocate_device(dev); if (IS_ERR(rtc_dev)) {
ret = PTR_ERR(rtc_dev); goto err_disable_extclk;
}
rtc_dev->ops = &ftrtc010_rtc_ops;
sec = readl(rtc->rtc_base + FTRTC010_RTC_SECOND);
min = readl(rtc->rtc_base + FTRTC010_RTC_MINUTE);
hour = readl(rtc->rtc_base + FTRTC010_RTC_HOUR);
days = readl(rtc->rtc_base + FTRTC010_RTC_DAYS);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.