#include <linux/module.h>
#include <linux/rtc.h>
#include <linux/platform_device.h>
-#include <linux/platform_data/rtc-m48t86.h>
#include <linux/bcd.h>
#include <linux/io.h>
void __iomem *index_reg;
void __iomem *data_reg;
struct rtc_device *rtc;
- struct m48t86_ops *ops;
};
static unsigned char m48t86_readb(struct device *dev, unsigned long addr)
struct m48t86_rtc_info *info = dev_get_drvdata(dev);
unsigned char value;
- if (info->ops) {
- value = info->ops->readbyte(addr);
- } else {
- writeb(addr, info->index_reg);
- value = readb(info->data_reg);
- }
+ writeb(addr, info->index_reg);
+ value = readb(info->data_reg);
+
return value;
}
{
struct m48t86_rtc_info *info = dev_get_drvdata(dev);
- if (info->ops) {
- info->ops->writebyte(value, addr);
- } else {
- writeb(addr, info->index_reg);
- writeb(value, info->data_reg);
- }
+ writeb(addr, info->index_reg);
+ writeb(value, info->data_reg);
}
static int m48t86_rtc_read_time(struct device *dev, struct rtc_time *tm)
static int m48t86_rtc_probe(struct platform_device *pdev)
{
struct m48t86_rtc_info *info;
+ struct resource *res;
unsigned char reg;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;
- info->ops = dev_get_platdata(&pdev->dev);
- if (!info->ops) {
- struct resource *res;
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -ENODEV;
- info->index_reg = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(info->index_reg))
- return PTR_ERR(info->index_reg);
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if (!res)
- return -ENODEV;
- info->data_reg = devm_ioremap_resource(&pdev->dev, res);
- if (IS_ERR(info->data_reg))
- return PTR_ERR(info->data_reg);
- }
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res)
+ return -ENODEV;
+ info->index_reg = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(info->index_reg))
+ return PTR_ERR(info->index_reg);
+
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+ if (!res)
+ return -ENODEV;
+ info->data_reg = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(info->data_reg))
+ return PTR_ERR(info->data_reg);
dev_set_drvdata(&pdev->dev, info);
+++ /dev/null
-/*
- * ST M48T86 / Dallas DS12887 RTC driver
- * Copyright (c) 2006 Tower Technologies
- *
- * Author: Alessandro Zummo <a.zummo@towertech.it>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-struct m48t86_ops
-{
- void (*writebyte)(unsigned char value, unsigned long addr);
- unsigned char (*readbyte)(unsigned long addr);
-};