aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Torgue <alexandre.torgue@st.com>2013-05-24 05:59:47 -0400
committerLee Jones <lee.jones@linaro.org>2013-06-13 05:51:52 -0400
commit9c717cf3fa16f8ae8c6ccb8f4f8e784404ac9689 (patch)
tree37087f2d0e4646051c0c7a229086a87f3bd6e0ea
parent2809126512fcbd61ce3140af0bc255b441fcdaf9 (diff)
mfd: ab8500-core: Add device for new RTC version for AB8540 cut2
AB8540 RTC have changed between AB8540_cut1 and AB8540_cut2.Different ressources to define for those two version. Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Julien Delacou <julien.delacou@stericsson.com> Signed-off-by: Alexandre Torgue <alexandre.torgue@st.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r--drivers/mfd/ab8500-core.c55
-rw-r--r--include/linux/mfd/abx500/ab8500.h2
2 files changed, 49 insertions, 8 deletions
diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index 1863985df615..02698da00b78 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -650,6 +650,21 @@ static struct resource ab8500_rtc_resources[] = {
650 }, 650 },
651}; 651};
652 652
653static struct resource ab8540_rtc_resources[] = {
654 {
655 .name = "1S",
656 .start = AB8540_INT_RTC_1S,
657 .end = AB8540_INT_RTC_1S,
658 .flags = IORESOURCE_IRQ,
659 },
660 {
661 .name = "ALARM",
662 .start = AB8500_INT_RTC_ALARM,
663 .end = AB8500_INT_RTC_ALARM,
664 .flags = IORESOURCE_IRQ,
665 },
666};
667
653static struct resource ab8500_poweronkey_db_resources[] = { 668static struct resource ab8500_poweronkey_db_resources[] = {
654 { 669 {
655 .name = "ONKEY_DBF", 670 .name = "ONKEY_DBF",
@@ -1277,11 +1292,6 @@ static struct mfd_cell ab8540_devs[] = {
1277 .resources = ab8505_gpadc_resources, 1292 .resources = ab8505_gpadc_resources,
1278 }, 1293 },
1279 { 1294 {
1280 .name = "ab8500-rtc",
1281 .num_resources = ARRAY_SIZE(ab8500_rtc_resources),
1282 .resources = ab8500_rtc_resources,
1283 },
1284 {
1285 .name = "ab8500-acc-det", 1295 .name = "ab8500-acc-det",
1286 .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources), 1296 .num_resources = ARRAY_SIZE(ab8500_av_acc_detect_resources),
1287 .resources = ab8500_av_acc_detect_resources, 1297 .resources = ab8500_av_acc_detect_resources,
@@ -1318,6 +1328,24 @@ static struct mfd_cell ab8540_devs[] = {
1318 }, 1328 },
1319}; 1329};
1320 1330
1331static struct mfd_cell ab8540_cut1_devs[] = {
1332 {
1333 .name = "ab8500-rtc",
1334 .of_compatible = "stericsson,ab8500-rtc",
1335 .num_resources = ARRAY_SIZE(ab8500_rtc_resources),
1336 .resources = ab8500_rtc_resources,
1337 },
1338};
1339
1340static struct mfd_cell ab8540_cut2_devs[] = {
1341 {
1342 .name = "ab8540-rtc",
1343 .of_compatible = "stericsson,ab8540-rtc",
1344 .num_resources = ARRAY_SIZE(ab8540_rtc_resources),
1345 .resources = ab8540_rtc_resources,
1346 },
1347};
1348
1321static ssize_t show_chip_id(struct device *dev, 1349static ssize_t show_chip_id(struct device *dev,
1322 struct device_attribute *attr, char *buf) 1350 struct device_attribute *attr, char *buf)
1323{ 1351{
@@ -1721,11 +1749,22 @@ static int ab8500_probe(struct platform_device *pdev)
1721 ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs, 1749 ret = mfd_add_devices(ab8500->dev, 0, ab9540_devs,
1722 ARRAY_SIZE(ab9540_devs), NULL, 1750 ARRAY_SIZE(ab9540_devs), NULL,
1723 ab8500->irq_base, ab8500->domain); 1751 ab8500->irq_base, ab8500->domain);
1724 else if (is_ab8540(ab8500)) 1752 else if (is_ab8540(ab8500)) {
1725 ret = mfd_add_devices(ab8500->dev, 0, ab8540_devs, 1753 ret = mfd_add_devices(ab8500->dev, 0, ab8540_devs,
1726 ARRAY_SIZE(ab8540_devs), NULL, 1754 ARRAY_SIZE(ab8540_devs), NULL,
1727 ab8500->irq_base, ab8500->domain); 1755 ab8500->irq_base, NULL);
1728 else if (is_ab8505(ab8500)) 1756 if (ret)
1757 return ret;
1758
1759 if (is_ab8540_1p2_or_earlier(ab8500))
1760 ret = mfd_add_devices(ab8500->dev, 0, ab8540_cut1_devs,
1761 ARRAY_SIZE(ab8540_cut1_devs), NULL,
1762 ab8500->irq_base, NULL);
1763 else /* ab8540 >= cut2 */
1764 ret = mfd_add_devices(ab8500->dev, 0, ab8540_cut2_devs,
1765 ARRAY_SIZE(ab8540_cut2_devs), NULL,
1766 ab8500->irq_base, NULL);
1767 } else if (is_ab8505(ab8500))
1729 ret = mfd_add_devices(ab8500->dev, 0, ab8505_devs, 1768 ret = mfd_add_devices(ab8500->dev, 0, ab8505_devs,
1730 ARRAY_SIZE(ab8505_devs), NULL, 1769 ARRAY_SIZE(ab8505_devs), NULL,
1731 ab8500->irq_base, ab8500->domain); 1770 ab8500->irq_base, ab8500->domain);
diff --git a/include/linux/mfd/abx500/ab8500.h b/include/linux/mfd/abx500/ab8500.h
index 0390d5943ed6..f4acd898dac9 100644
--- a/include/linux/mfd/abx500/ab8500.h
+++ b/include/linux/mfd/abx500/ab8500.h
@@ -291,6 +291,8 @@ enum ab8500_version {
291#define AB8540_INT_FSYNC2R 213 291#define AB8540_INT_FSYNC2R 213
292#define AB8540_INT_BITCLK2F 214 292#define AB8540_INT_BITCLK2F 214
293#define AB8540_INT_BITCLK2R 215 293#define AB8540_INT_BITCLK2R 215
294/* ab8540_irq_regoffset[27] -> IT[Source|Latch|Mask]33 */
295#define AB8540_INT_RTC_1S 216
294 296
295/* 297/*
296 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the 298 * AB8500_AB9540_NR_IRQS is used when configuring the IRQ numbers for the