/*1* Registration of Cobalt RTC platform device.2*3* Copyright (C) 2007 Yoichi Yuasa <[email protected]>4*5* This program is free software; you can redistribute it and/or modify6* it under the terms of the GNU General Public License as published by7* the Free Software Foundation; either version 2 of the License, or8* (at your option) any later version.9*10* This program is distributed in the hope that it will be useful,11* but WITHOUT ANY WARRANTY; without even the implied warranty of12* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13* GNU General Public License for more details.14*15* You should have received a copy of the GNU General Public License16* along with this program; if not, write to the Free Software17* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18*/19#include <linux/errno.h>20#include <linux/init.h>21#include <linux/ioport.h>22#include <linux/mc146818rtc.h>23#include <linux/platform_device.h>2425static struct resource cobalt_rtc_resource[] __initdata = {26{27.start = 0x70,28.end = 0x77,29.flags = IORESOURCE_IO,30},31{32.start = RTC_IRQ,33.end = RTC_IRQ,34.flags = IORESOURCE_IRQ,35},36};3738static __init int cobalt_rtc_add(void)39{40struct platform_device *pdev;41int retval;4243pdev = platform_device_alloc("rtc_cmos", -1);44if (!pdev)45return -ENOMEM;4647retval = platform_device_add_resources(pdev, cobalt_rtc_resource,48ARRAY_SIZE(cobalt_rtc_resource));49if (retval)50goto err_free_device;5152retval = platform_device_add(pdev);53if (retval)54goto err_free_device;5556return 0;5758err_free_device:59platform_device_put(pdev);6061return retval;62}63device_initcall(cobalt_rtc_add);646566