2019-05-19 21:51:31 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2007-05-11 20:33:30 +08:00
|
|
|
/*
|
|
|
|
* Registration of Cobalt RTC platform device.
|
|
|
|
*
|
2009-07-02 23:39:38 +08:00
|
|
|
* Copyright (C) 2007 Yoichi Yuasa <yuasa@linux-mips.org>
|
2007-05-11 20:33:30 +08:00
|
|
|
*/
|
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/ioport.h>
|
2007-09-13 22:51:26 +08:00
|
|
|
#include <linux/mc146818rtc.h>
|
2007-05-11 20:33:30 +08:00
|
|
|
#include <linux/platform_device.h>
|
|
|
|
|
|
|
|
static struct resource cobalt_rtc_resource[] __initdata = {
|
|
|
|
{
|
|
|
|
.start = 0x70,
|
|
|
|
.end = 0x77,
|
|
|
|
.flags = IORESOURCE_IO,
|
|
|
|
},
|
|
|
|
{
|
2007-09-13 22:51:26 +08:00
|
|
|
.start = RTC_IRQ,
|
|
|
|
.end = RTC_IRQ,
|
2007-05-11 20:33:30 +08:00
|
|
|
.flags = IORESOURCE_IRQ,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static __init int cobalt_rtc_add(void)
|
|
|
|
{
|
|
|
|
struct platform_device *pdev;
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
pdev = platform_device_alloc("rtc_cmos", -1);
|
|
|
|
if (!pdev)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
retval = platform_device_add_resources(pdev, cobalt_rtc_resource,
|
2013-01-22 19:59:30 +08:00
|
|
|
ARRAY_SIZE(cobalt_rtc_resource));
|
2007-05-11 20:33:30 +08:00
|
|
|
if (retval)
|
|
|
|
goto err_free_device;
|
|
|
|
|
|
|
|
retval = platform_device_add(pdev);
|
|
|
|
if (retval)
|
|
|
|
goto err_free_device;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
err_free_device:
|
|
|
|
platform_device_put(pdev);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
device_initcall(cobalt_rtc_add);
|