Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 116751
b: refs/heads/master
c: 9eb1686
h: refs/heads/master
i:
  116749: 862bcbf
  116747: d9b155b
  116743: 4d50a2a
  116735: 93efc13
v: v3
  • Loading branch information
Kyle McMartin authored and Kyle McMartin committed Oct 10, 2008
1 parent a56ed46 commit bd933ab
Show file tree
Hide file tree
Showing 6 changed files with 142 additions and 2 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: f0514ae323f19ba1ad4bea4174ea274c812f7eee
refs/heads/master: 9eb1686423756f4dfb0ad8bfb02bb8bf1b89e50a
2 changes: 2 additions & 0 deletions trunk/arch/parisc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ config PARISC
def_bool y
select HAVE_IDE
select HAVE_OPROFILE
select RTC_CLASS
select RTC_DRV_PARISC
help
The PA-RISC microprocessor is designed by Hewlett-Packard and used
in many of their workstations & servers (HP9000 700 and 800 series,
Expand Down
20 changes: 19 additions & 1 deletion trunk/arch/parisc/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/smp.h>
#include <linux/profile.h>
#include <linux/clocksource.h>
#include <linux/platform_device.h>

#include <asm/uaccess.h>
#include <asm/io.h>
Expand Down Expand Up @@ -215,6 +216,24 @@ void __init start_cpu_itimer(void)
cpu_data[cpu].it_value = next_tick;
}

struct platform_device rtc_parisc_dev = {
.name = "rtc-parisc",
.id = -1,
};

static int __init rtc_init(void)
{
int ret;

ret = platform_device_register(&rtc_parisc_dev);
if (ret < 0)
printk(KERN_ERR "unable to register rtc device...\n");

/* not necessarily an error */
return 0;
}
module_init(rtc_init);

void __init time_init(void)
{
static struct pdc_tod tod_data;
Expand Down Expand Up @@ -245,4 +264,3 @@ void __init time_init(void)
xtime.tv_nsec = 0;
}
}

8 changes: 8 additions & 0 deletions trunk/drivers/rtc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,14 @@ config RTC_DRV_RS5C313
help
If you say yes here you get support for the Ricoh RS5C313 RTC chips.

config RTC_DRV_PARISC
tristate "PA-RISC firmware RTC support"
depends on PARISC
help
Say Y or M here to enable RTC support on PA-RISC systems using
firmware calls. If you do not know what you are doing, you should
just say Y.

config RTC_DRV_PPC
tristate "PowerPC machine dependent RTC support"
depends on PPC_MERGE
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/rtc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o
obj-$(CONFIG_RTC_DRV_PCF8583) += rtc-pcf8583.o
obj-$(CONFIG_RTC_DRV_PL030) += rtc-pl030.o
obj-$(CONFIG_RTC_DRV_PL031) += rtc-pl031.o
obj-$(CONFIG_RTC_DRV_PARISC) += rtc-parisc.o
obj-$(CONFIG_RTC_DRV_PPC) += rtc-ppc.o
obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o
obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o
Expand Down
111 changes: 111 additions & 0 deletions trunk/drivers/rtc/rtc-parisc.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/* rtc-parisc: RTC for HP PA-RISC firmware
*
* Copyright (C) 2008 Kyle McMartin <kyle@mcmartin.ca>
*/

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/time.h>
#include <linux/platform_device.h>

#include <asm/rtc.h>

/* as simple as can be, and no simpler. */
struct parisc_rtc {
struct rtc_device *rtc;
spinlock_t lock;
};

static int parisc_get_time(struct device *dev, struct rtc_time *tm)
{
struct parisc_rtc *p = dev_get_drvdata(dev);
unsigned long flags, ret;

spin_lock_irqsave(&p->lock, flags);
ret = get_rtc_time(tm);
spin_unlock_irqrestore(&p->lock, flags);

if (ret & RTC_BATT_BAD)
return -EOPNOTSUPP;

return 0;
}

static int parisc_set_time(struct device *dev, struct rtc_time *tm)
{
struct parisc_rtc *p = dev_get_drvdata(dev);
unsigned long flags, ret;

spin_lock_irqsave(&p->lock, flags);
ret = set_rtc_time(tm);
spin_unlock_irqrestore(&p->lock, flags);

if (ret < 0)
return -EOPNOTSUPP;

return 0;
}

static const struct rtc_class_ops parisc_rtc_ops = {
.read_time = parisc_get_time,
.set_time = parisc_set_time,
};

static int __devinit parisc_rtc_probe(struct platform_device *dev)
{
struct parisc_rtc *p;

p = kzalloc(sizeof (*p), GFP_KERNEL);
if (!p)
return -ENOMEM;

spin_lock_init(&p->lock);

p->rtc = rtc_device_register("rtc-parisc", &dev->dev, &parisc_rtc_ops,
THIS_MODULE);
if (IS_ERR(p->rtc)) {
int err = PTR_ERR(p->rtc);
kfree(p);
return err;
}

platform_set_drvdata(dev, p);

return 0;
}

static int __devexit parisc_rtc_remove(struct platform_device *dev)
{
struct parisc_rtc *p = platform_get_drvdata(dev);

rtc_device_unregister(p->rtc);
kfree(p);

return 0;
}

static struct platform_driver parisc_rtc_driver = {
.driver = {
.name = "rtc-parisc",
.owner = THIS_MODULE,
},
.probe = parisc_rtc_probe,
.remove = __devexit_p(parisc_rtc_remove),
};

static int __init parisc_rtc_init(void)
{
return platform_driver_register(&parisc_rtc_driver);
}

static void __exit parisc_rtc_fini(void)
{
platform_driver_unregister(&parisc_rtc_driver);
}

module_init(parisc_rtc_init);
module_exit(parisc_rtc_fini);

MODULE_AUTHOR("Kyle McMartin <kyle@mcmartin.ca>");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("HP PA-RISC RTC driver");

0 comments on commit bd933ab

Please sign in to comment.