11/*
2- * Copyright (c) 2014 MediaTek Inc.
2+ * Copyright (c) 2014-2018 MediaTek Inc.
33 * Author: Flora Fu, MediaTek
44 *
55 * This program is free software; you can redistribute it and/or modify
1313 */
1414
1515#include <linux/interrupt.h>
16+ #include <linux/ioport.h>
1617#include <linux/module.h>
1718#include <linux/of_device.h>
1819#include <linux/of_irq.h>
2324#include <linux/mfd/mt6397/registers.h>
2425#include <linux/mfd/mt6323/registers.h>
2526
27+ #define MT6323_RTC_BASE 0x8000
28+ #define MT6323_RTC_SIZE 0x40
29+
2630#define MT6397_RTC_BASE 0xe000
2731#define MT6397_RTC_SIZE 0x3e
2832
33+ #define MT6323_PWRC_BASE 0x8000
34+ #define MT6323_PWRC_SIZE 0x40
35+
2936#define MT6323_CID_CODE 0x23
3037#define MT6391_CID_CODE 0x91
3138#define MT6397_CID_CODE 0x97
3239
40+ static const struct resource mt6323_rtc_resources [] = {
41+ DEFINE_RES_MEM (MT6323_RTC_BASE , MT6323_RTC_SIZE ),
42+ DEFINE_RES_IRQ (MT6323_IRQ_STATUS_RTC ),
43+ };
44+
3345static const struct resource mt6397_rtc_resources [] = {
34- {
35- .start = MT6397_RTC_BASE ,
36- .end = MT6397_RTC_BASE + MT6397_RTC_SIZE ,
37- .flags = IORESOURCE_MEM ,
38- },
39- {
40- .start = MT6397_IRQ_RTC ,
41- .end = MT6397_IRQ_RTC ,
42- .flags = IORESOURCE_IRQ ,
43- },
46+ DEFINE_RES_MEM (MT6397_RTC_BASE , MT6397_RTC_SIZE ),
47+ DEFINE_RES_IRQ (MT6397_IRQ_RTC ),
4448};
4549
4650static const struct resource mt6323_keys_resources [] = {
@@ -53,8 +57,17 @@ static const struct resource mt6397_keys_resources[] = {
5357 DEFINE_RES_IRQ (MT6397_IRQ_HOMEKEY ),
5458};
5559
60+ static const struct resource mt6323_pwrc_resources [] = {
61+ DEFINE_RES_MEM (MT6323_PWRC_BASE , MT6323_PWRC_SIZE ),
62+ };
63+
5664static const struct mfd_cell mt6323_devs [] = {
5765 {
66+ .name = "mt6323-rtc" ,
67+ .num_resources = ARRAY_SIZE (mt6323_rtc_resources ),
68+ .resources = mt6323_rtc_resources ,
69+ .of_compatible = "mediatek,mt6323-rtc" ,
70+ }, {
5871 .name = "mt6323-regulator" ,
5972 .of_compatible = "mediatek,mt6323-regulator"
6073 }, {
@@ -65,6 +78,11 @@ static const struct mfd_cell mt6323_devs[] = {
6578 .num_resources = ARRAY_SIZE (mt6323_keys_resources ),
6679 .resources = mt6323_keys_resources ,
6780 .of_compatible = "mediatek,mt6323-keys"
81+ }, {
82+ .name = "mt6323-pwrc" ,
83+ .num_resources = ARRAY_SIZE (mt6323_pwrc_resources ),
84+ .resources = mt6323_pwrc_resources ,
85+ .of_compatible = "mediatek,mt6323-pwrc"
6886 },
6987};
7088
0 commit comments