Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 346427
b: refs/heads/master
c: cab1458
h: refs/heads/master
i:
  346425: 04d021f
  346423: aea9747
v: v3
  • Loading branch information
Afzal Mohammed authored and Linus Torvalds committed Dec 18, 2012
1 parent 9969ace commit ae4f2b8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 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: 6899e92d65c490c5292752718ff277b123f8c00a
refs/heads/master: cab1458c8c4fdfc993e86454eef785bc39517dd8
44 changes: 41 additions & 3 deletions trunk/drivers/rtc/rtc-omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
* the SoC). See the BOARD-SPECIFIC CUSTOMIZATION comment.
*/

#define DRIVER_NAME "omap_rtc"

#define OMAP_RTC_BASE 0xfffb4800

/* RTC registers */
Expand All @@ -64,6 +66,9 @@
#define OMAP_RTC_COMP_MSB_REG 0x50
#define OMAP_RTC_OSC_REG 0x54

#define OMAP_RTC_KICK0_REG 0x6c
#define OMAP_RTC_KICK1_REG 0x70

/* OMAP_RTC_CTRL_REG bit fields: */
#define OMAP_RTC_CTRL_SPLIT (1<<7)
#define OMAP_RTC_CTRL_DISABLE (1<<6)
Expand All @@ -88,10 +93,18 @@
#define OMAP_RTC_INTERRUPTS_IT_ALARM (1<<3)
#define OMAP_RTC_INTERRUPTS_IT_TIMER (1<<2)

/* OMAP_RTC_KICKER values */
#define KICK0_VALUE 0x83e70b13
#define KICK1_VALUE 0x95a4f1e0

#define OMAP_RTC_HAS_KICKER 0x1

static void __iomem *rtc_base;

#define rtc_read(addr) __raw_readb(rtc_base + (addr))
#define rtc_write(val, addr) __raw_writeb(val, rtc_base + (addr))
#define rtc_read(addr) readb(rtc_base + (addr))
#define rtc_write(val, addr) writeb(val, rtc_base + (addr))

#define rtc_writel(val, addr) writel(val, rtc_base + (addr))


/* we rely on the rtc framework to handle locking (rtc->ops_lock),
Expand Down Expand Up @@ -285,11 +298,23 @@ static struct rtc_class_ops omap_rtc_ops = {
static int omap_rtc_alarm;
static int omap_rtc_timer;

static struct platform_device_id omap_rtc_devtype[] = {
{
.name = DRIVER_NAME,
}, {
.name = "da830-rtc",
.driver_data = OMAP_RTC_HAS_KICKER,
},
{},
};
MODULE_DEVICE_TABLE(platform, omap_rtc_devtype);

static int __init omap_rtc_probe(struct platform_device *pdev)
{
struct resource *res, *mem;
struct rtc_device *rtc;
u8 reg, new_ctrl;
const struct platform_device_id *id_entry;

omap_rtc_timer = platform_get_irq(pdev, 0);
if (omap_rtc_timer <= 0) {
Expand Down Expand Up @@ -322,6 +347,12 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
goto fail;
}

id_entry = platform_get_device_id(pdev);
if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER)) {
rtc_writel(KICK0_VALUE, OMAP_RTC_KICK0_REG);
rtc_writel(KICK1_VALUE, OMAP_RTC_KICK1_REG);
}

rtc = rtc_device_register(pdev->name, &pdev->dev,
&omap_rtc_ops, THIS_MODULE);
if (IS_ERR(rtc)) {
Expand Down Expand Up @@ -398,6 +429,8 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
fail1:
rtc_device_unregister(rtc);
fail0:
if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER))
rtc_writel(0, OMAP_RTC_KICK0_REG);
iounmap(rtc_base);
fail:
release_mem_region(mem->start, resource_size(mem));
Expand All @@ -408,6 +441,8 @@ static int __exit omap_rtc_remove(struct platform_device *pdev)
{
struct rtc_device *rtc = platform_get_drvdata(pdev);
struct resource *mem = dev_get_drvdata(&rtc->dev);
const struct platform_device_id *id_entry =
platform_get_device_id(pdev);

device_init_wakeup(&pdev->dev, 0);

Expand All @@ -420,6 +455,8 @@ static int __exit omap_rtc_remove(struct platform_device *pdev)
free_irq(omap_rtc_alarm, rtc);

rtc_device_unregister(rtc);
if (id_entry && (id_entry->driver_data & OMAP_RTC_HAS_KICKER))
rtc_writel(0, OMAP_RTC_KICK0_REG);
iounmap(rtc_base);
release_mem_region(mem->start, resource_size(mem));
return 0;
Expand Down Expand Up @@ -471,9 +508,10 @@ static struct platform_driver omap_rtc_driver = {
.resume = omap_rtc_resume,
.shutdown = omap_rtc_shutdown,
.driver = {
.name = "omap_rtc",
.name = DRIVER_NAME,
.owner = THIS_MODULE,
},
.id_table = omap_rtc_devtype,
};

static int __init rtc_init(void)
Expand Down

0 comments on commit ae4f2b8

Please sign in to comment.