diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-10-16 01:03:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 14:21:40 -0400 |
commit | 37fc5e2c42833c32f7c8eb5d9b3a3115bb37d9c3 (patch) | |
tree | 84af33020bac66f85d1bbce845bfb4f06373f9f9 /drivers | |
parent | 0053dc0d13eb14108ebc48619456dd9ff6e25768 (diff) |
rtc: rtc-rs5c372: add support for Ricoh R2025S/D RTC
This adds support for the Ricoh R2025S/D series of I2C RTCs, produced by
Ricoh Japan and described at:
http://www.ricoh.co.jp/LSI/product_rtc/2wire/r2025x/
This series has very minor deviations from the rest of the RS5C chips,
most of which have to do with the oscillator, which was abstracted away in
an earlier patch.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: David Brownell <david-b@pacbell.net>
Tested-by: Riku Voipio <riku.voipio@movial.fi>
Acked-by: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/rtc/rtc-rs5c372.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index c390e3355595..8b561958fb1e 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * An I2C driver for Ricoh RS5C372 and RV5C38[67] RTCs | 2 | * An I2C driver for Ricoh RS5C372, R2025S/D and RV5C38[67] RTCs |
3 | * | 3 | * |
4 | * Copyright (C) 2005 Pavel Mironchik <pmironchik@optifacio.net> | 4 | * Copyright (C) 2005 Pavel Mironchik <pmironchik@optifacio.net> |
5 | * Copyright (C) 2006 Tower Technologies | 5 | * Copyright (C) 2006 Tower Technologies |
@@ -52,7 +52,8 @@ | |||
52 | # define RS5C_CTRL1_CT4 (4 << 0) /* 1 Hz level irq */ | 52 | # define RS5C_CTRL1_CT4 (4 << 0) /* 1 Hz level irq */ |
53 | #define RS5C_REG_CTRL2 15 | 53 | #define RS5C_REG_CTRL2 15 |
54 | # define RS5C372_CTRL2_24 (1 << 5) | 54 | # define RS5C372_CTRL2_24 (1 << 5) |
55 | # define RS5C_CTRL2_XSTP (1 << 4) | 55 | # define R2025_CTRL2_XST (1 << 5) |
56 | # define RS5C_CTRL2_XSTP (1 << 4) /* only if !R2025S/D */ | ||
56 | # define RS5C_CTRL2_CTFG (1 << 2) | 57 | # define RS5C_CTRL2_CTFG (1 << 2) |
57 | # define RS5C_CTRL2_AAFG (1 << 1) /* or WAFG */ | 58 | # define RS5C_CTRL2_AAFG (1 << 1) /* or WAFG */ |
58 | # define RS5C_CTRL2_BAFG (1 << 0) /* or DAFG */ | 59 | # define RS5C_CTRL2_BAFG (1 << 0) /* or DAFG */ |
@@ -64,6 +65,7 @@ | |||
64 | 65 | ||
65 | enum rtc_type { | 66 | enum rtc_type { |
66 | rtc_undef = 0, | 67 | rtc_undef = 0, |
68 | rtc_r2025sd, | ||
67 | rtc_rs5c372a, | 69 | rtc_rs5c372a, |
68 | rtc_rs5c372b, | 70 | rtc_rs5c372b, |
69 | rtc_rv5c386, | 71 | rtc_rv5c386, |
@@ -71,6 +73,7 @@ enum rtc_type { | |||
71 | }; | 73 | }; |
72 | 74 | ||
73 | static const struct i2c_device_id rs5c372_id[] = { | 75 | static const struct i2c_device_id rs5c372_id[] = { |
76 | { "r2025sd", rtc_r2025sd }, | ||
74 | { "rs5c372a", rtc_rs5c372a }, | 77 | { "rs5c372a", rtc_rs5c372a }, |
75 | { "rs5c372b", rtc_rs5c372b }, | 78 | { "rs5c372b", rtc_rs5c372b }, |
76 | { "rv5c386", rtc_rv5c386 }, | 79 | { "rv5c386", rtc_rv5c386 }, |
@@ -531,9 +534,15 @@ static int rs5c_oscillator_setup(struct rs5c372 *rs5c372) | |||
531 | unsigned char buf[2]; | 534 | unsigned char buf[2]; |
532 | int addr, i, ret = 0; | 535 | int addr, i, ret = 0; |
533 | 536 | ||
534 | if (!(rs5c372->regs[RS5C_REG_CTRL2] & RS5C_CTRL2_XSTP)) | 537 | if (rs5c372->type == rtc_r2025sd) { |
535 | return ret; | 538 | if (!(rs5c372->regs[RS5C_REG_CTRL2] & R2025_CTRL2_XST)) |
536 | rs5c372->regs[RS5C_REG_CTRL2] &= ~RS5C_CTRL2_XSTP; | 539 | return ret; |
540 | rs5c372->regs[RS5C_REG_CTRL2] &= ~R2025_CTRL2_XST; | ||
541 | } else { | ||
542 | if (!(rs5c372->regs[RS5C_REG_CTRL2] & RS5C_CTRL2_XSTP)) | ||
543 | return ret; | ||
544 | rs5c372->regs[RS5C_REG_CTRL2] &= ~RS5C_CTRL2_XSTP; | ||
545 | } | ||
537 | 546 | ||
538 | addr = RS5C_ADDR(RS5C_REG_CTRL1); | 547 | addr = RS5C_ADDR(RS5C_REG_CTRL1); |
539 | buf[0] = rs5c372->regs[RS5C_REG_CTRL1]; | 548 | buf[0] = rs5c372->regs[RS5C_REG_CTRL1]; |
@@ -546,6 +555,7 @@ static int rs5c_oscillator_setup(struct rs5c372 *rs5c372) | |||
546 | buf[1] |= RS5C372_CTRL2_24; | 555 | buf[1] |= RS5C372_CTRL2_24; |
547 | rs5c372->time24 = 1; | 556 | rs5c372->time24 = 1; |
548 | break; | 557 | break; |
558 | case rtc_r2025sd: | ||
549 | case rtc_rv5c386: | 559 | case rtc_rv5c386: |
550 | case rtc_rv5c387a: | 560 | case rtc_rv5c387a: |
551 | buf[0] |= RV5C387_CTRL1_24; | 561 | buf[0] |= RV5C387_CTRL1_24; |
@@ -623,6 +633,7 @@ static int rs5c372_probe(struct i2c_client *client, | |||
623 | if (rs5c372->regs[RS5C_REG_CTRL2] & RS5C372_CTRL2_24) | 633 | if (rs5c372->regs[RS5C_REG_CTRL2] & RS5C372_CTRL2_24) |
624 | rs5c372->time24 = 1; | 634 | rs5c372->time24 = 1; |
625 | break; | 635 | break; |
636 | case rtc_r2025sd: | ||
626 | case rtc_rv5c386: | 637 | case rtc_rv5c386: |
627 | case rtc_rv5c387a: | 638 | case rtc_rv5c387a: |
628 | if (rs5c372->regs[RS5C_REG_CTRL1] & RV5C387_CTRL1_24) | 639 | if (rs5c372->regs[RS5C_REG_CTRL1] & RV5C387_CTRL1_24) |
@@ -638,6 +649,9 @@ static int rs5c372_probe(struct i2c_client *client, | |||
638 | 649 | ||
639 | /* if the oscillator lost power and no other software (like | 650 | /* if the oscillator lost power and no other software (like |
640 | * the bootloader) set it up, do it here. | 651 | * the bootloader) set it up, do it here. |
652 | * | ||
653 | * The R2025S/D does this a little differently than the other | ||
654 | * parts, so we special case that.. | ||
641 | */ | 655 | */ |
642 | err = rs5c_oscillator_setup(rs5c372); | 656 | err = rs5c_oscillator_setup(rs5c372); |
643 | if (unlikely(err < 0)) { | 657 | if (unlikely(err < 0)) { |
@@ -650,6 +664,7 @@ static int rs5c372_probe(struct i2c_client *client, | |||
650 | 664 | ||
651 | dev_info(&client->dev, "%s found, %s, driver version " DRV_VERSION "\n", | 665 | dev_info(&client->dev, "%s found, %s, driver version " DRV_VERSION "\n", |
652 | ({ char *s; switch (rs5c372->type) { | 666 | ({ char *s; switch (rs5c372->type) { |
667 | case rtc_r2025sd: s = "r2025sd"; break; | ||
653 | case rtc_rs5c372a: s = "rs5c372a"; break; | 668 | case rtc_rs5c372a: s = "rs5c372a"; break; |
654 | case rtc_rs5c372b: s = "rs5c372b"; break; | 669 | case rtc_rs5c372b: s = "rs5c372b"; break; |
655 | case rtc_rv5c386: s = "rv5c386"; break; | 670 | case rtc_rv5c386: s = "rv5c386"; break; |