Add Mediatek SoC RTC driver
Subsystems (4)
Eddie Huang
maintainerv4 cover Add Mediatek SoC RTC driver
RTC is one submodule of Mediatek MT6397 PMIC chip[1]. This series support RTC driver that work with Mediatek SoC like MT8135, MT8173. It implements second counter and also provide alarm function.
This series base on 4.1-rc1, Test ok on MT8173 platform.
[1] https://lkml.org/lkml/2015/1/23/325
Change in v4:
1. Align mt6397-core.c resource in straight lines.
2. Modify mtk_rtc_write_trigger according Joe Perches and Alexandre Belloni suggestion.
3. Align function parameters to the open parenthesis.
4. Modify MAINTAINER to use file full name.
Change in v3:
1. Replace magic number in mt6397-core.c
2. Add comment for some equation and write trigger.
3. Use regmap_bulk_read and regmap_bulk_write to avoid muliple regmap_read and regmap_write
4. Replace devm_request_threaded_irq with request_threaded_irq and add irq_dispose_mapping
5. Fix Tomasz Figa review comment.
Change in v2:
1. Move RTC address and interrupt to mt6397-core.c, and register these resource in mfd_cell.
http://lists.infradead.org/pipermail/linux-arm-kernel/2015-February/323239.html
2. Remove dt-binding document due to register resouce in mfd_cell, not from device tree.
3. Update MAINTAINER file to add Mediatek RTC mainainter.
4. Add prefix mtk_ to some internal functions.
5. Fix racy condition
6. Check return value of regmap_read and regmap_write
7. Remove some unnecessary register readback, clear, then write.
8. Add disable alarm in mtk_rtc_set_alarm function
9. Fix Uwe Kleine-K?nig review comment
Eddie Huang (2):
mfd: provide RTC resource in MT6397 MFD
MAINTAINERS: add Mediatek RTC driver
Tianping Fang (1):
rtc: mediatek: Add MT6397 RTC driver
MAINTAINERS | 7 + drivers/mfd/mt6397-core.c | 18 +++ drivers/rtc/Kconfig | 10 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-mt6397.c | 394 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 430 insertions(+) create mode 100644 drivers/rtc/rtc-mt6397.c
--
1.8.1.1.dirty
Eddie Huang
maintainerPATCH v4 1/3 mfd: provide RTC resource in MT6397 MFD
Provide MT6397 RTC interrupt, base address, and register in MT6397 MFD.
--- drivers/mfd/mt6397-core.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/mfd/mt6397-core.c +18 -0
@@ -21,9 +21,27 @@#include <linux/mfd/mt6397/core.h> #include <linux/mfd/mt6397/registers.h> +#define MT6397_RTC_BASE 0xe000 +#define MT6397_RTC_SIZE 0x3e + +static const struct resource mt6397_rtc_resources[] = { + { + .start =MT6397_RTC_BASE , + .end =MT6397_RTC_BASE +MT6397_RTC_SIZE , + .flags =IORESOURCE_MEM , + }, + { + .start =MT6397_IRQ_RTC , + .end =MT6397_IRQ_RTC , + .flags =IORESOURCE_IRQ , + }, +}; +static const struct mfd_cell mt6397_devs[] = { { .name ="mt6397-rtc" , + .num_resources =ARRAY_SIZE (mt6397_rtc_resources), + .resources = mt6397_rtc_resources, .of_compatible ="mediatek,mt6397-rtc" , }, { .name ="mt6397-regulator" ,
Signature · 1 line
1.8.1.1.dirty
Eddie Huang
maintainerPATCH v4 2/3 rtc: mediatek: Add MT6397 RTC driver
In reply to Eddie HuangFrom: Tianping Fang <[email protected]>
Add Mediatek MT6397 RTC driver
--- drivers/rtc/Kconfig | 10 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-mt6397.c | 394 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 405 insertions(+) create mode 100644 drivers/rtc/rtc-mt6397.c
drivers/rtc/Kconfig +10 -0
@@ -1520,6 +1520,16 @@ config RTC_DRV_MOXART This driver can also be built as a module. If so, the module will be called rtc-moxart +config RTC_DRV_MT6397 + tristate "Mediatek Real Time Clock driver" + depends on MFD_MT6397 || COMPILE_TEST + help + This selects the Mediatek(R) RTC driver. RTC is part of Mediatek + MT6397 PMIC. You should enable MT6397 PMIC MFD before select + Mediatek(R) RTC driver. + + If you want to use Mediatek(R) RTC interface, select Y or M here. + config RTC_DRV_XGENE tristate "APM X-Gene RTC" depends on HAS_IOMEM
drivers/rtc/Makefile +1 -0
@@ -154,3 +154,4 @@ obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o obj-$(CONFIG_RTC_DRV_XGENE) += rtc-xgene.o obj-$(CONFIG_RTC_DRV_SIRFSOC) += rtc-sirfsoc.o obj-$(CONFIG_RTC_DRV_MOXART) += rtc-moxart.o +obj-$(CONFIG_RTC_DRV_MT6397) += rtc-mt6397.o
drivers/rtc/rtc-mt6397.c new file +394 -0
394 lines not on this page · raw message
Signature · 1 line
1.8.1.1.dirty
Re: [PATCH v4 2/3] rtc: mediatek: Add MT6397 RTC driver
Quoted 1 line · Eddie Huang
From: Tianping Fang <[email protected]>
trivia: no need to resend now, maybe in a future patch.
drivers/rtc/rtc-mt6397.c
Quoted 1 line
drivers/rtc/rtc-mt6397.c +0
-0
[]
drivers/rtc/rtc-mt6397.c
Quoted 2 lines
drivers/rtc/rtc-mt6397.c +2
-0+static int mtk_rtc_probe (struct platform_device *pdev) +{
[]
drivers/rtc/rtc-mt6397.c line 338
Quoted 4 lines
drivers/rtc/rtc-mt6397.c +4
-0+ ret =request_threaded_irq (rtc->irq,NULL , + mtk_rtc_irq_handler_thread, +IRQF_ONESHOT |IRQF_TRIGGER_HIGH , +"mt6397-rtc" , rtc);
It'd be nicer to align all the statement lines
to that open parenthesis
Re: [PATCH v4 2/3] rtc: mediatek: Add MT6397 RTC driver
Quoted 10 lines · Joe Perches
Quoted 1 line · Eddie Huang
From: Tianping Fang <[email protected]>
trivia: no need to resend now, maybe in a future patch.
drivers/rtc/rtc-mt6397.c
Quoted 1 line
drivers/rtc/rtc-mt6397.c +0
-0[]
drivers/rtc/rtc-mt6397.c
Quoted 2 lines
drivers/rtc/rtc-mt6397.c +2
-0+static int mtk_rtc_probe (struct platform_device *pdev) +{[]
Quoted 9 lines
drivers/rtc/rtc-mt6397.c line 338
Quoted 4 lines
drivers/rtc/rtc-mt6397.c +4
-0+ ret =request_threaded_irq (rtc->irq,NULL , + mtk_rtc_irq_handler_thread, +IRQF_ONESHOT |IRQF_TRIGGER_HIGH , +"mt6397-rtc" , rtc);It'd be nicer to align all the statement lines
to that open parenthesis
I'll fix it up when applying.
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Eddie Huang
maintainerRe: [PATCH v4 2/3] rtc: mediatek: Add MT6397 RTC driver
Hi Alexandre,
Quoted 21 lines · Alexandre Belloni
Quoted 10 lines · Joe Perches
Quoted 1 line · Eddie Huang
From: Tianping Fang <[email protected]>
trivia: no need to resend now, maybe in a future patch.
drivers/rtc/rtc-mt6397.c
Quoted 1 line
drivers/rtc/rtc-mt6397.c +0
-0[]
drivers/rtc/rtc-mt6397.c
Quoted 2 lines
drivers/rtc/rtc-mt6397.c +2
-0+static int mtk_rtc_probe (struct platform_device *pdev) +{[]
Quoted 9 lines
drivers/rtc/rtc-mt6397.c line 338
Quoted 4 lines
drivers/rtc/rtc-mt6397.c +4
-0+ ret =request_threaded_irq (rtc->irq,NULL , + mtk_rtc_irq_handler_thread, +IRQF_ONESHOT |IRQF_TRIGGER_HIGH , +"mt6397-rtc" , rtc);It'd be nicer to align all the statement lines
to that open parenthesis
Quoted 2 lines
I'll fix it up when applying.
Thanks your great help
Eddie
Eddie Huang
maintainerPATCH v4 3/3 MAINTAINERS: add Mediatek RTC driver
In reply to Eddie HuangAdd Mediatek RTC driver to maintainer entry.
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -1223,6 +1223,13 @@ W: http://www.digriz.org.uk/ts78xx/kernel S: Maintained F: arch/arm/mach-orion5x/ts78xx-* +ARM/Mediatek RTC DRIVER +M: Eddie Huang <[email protected]> +L: linux-arm-kernel at lists.infradead.org (moderated for non-subscribers) +L: linux-mediatek at lists.infradead.org (moderated for non-subscribers) +S: Maintained +F: drivers/rtc/rtc-mt6397.c + ARM/Mediatek SoC support M: Matthias Brugger <[email protected]> L: linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
Signature · 1 line
1.8.1.1.dirty
Quoted 8 lines · Eddie Huang
RTC is one submodule of Mediatek MT6397 PMIC chip[1]. This series support RTC driver that work with Mediatek SoC like MT8135, MT8173. It implements second counter and also provide alarm function.
This series base on 4.1-rc1, Test ok on MT8173 platform.
All applied, thanks!
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Hi Alexandre,
Quoted 11 lines · Alexandre Belloni
Quoted 8 lines · Eddie Huang
RTC is one submodule of Mediatek MT6397 PMIC chip[1]. This series support RTC driver that work with Mediatek SoC like MT8135, MT8173. It implements second counter and also provide alarm function.
This series base on 4.1-rc1, Test ok on MT8173 platform.
All applied, thanks!
To which git tree & branch did you apply these patches?
Thanks,
-Daniel
Quoted 11 lines
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Hi,
Quoted 7 lines · Daniel Kurtz
Quoted 5 lines · Alexandre Belloni
Quoted 4 lines · Eddie Huang
RTC is one submodule of Mediatek MT6397 PMIC chip[1]. This series support RTC driver that work with Mediatek SoC like MT8135, MT8173. It implements second counter and also provide alarm function.
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
This series base on 4.1-rc1, Test ok on MT8173 platform.
All applied, thanks!
To which git tree & branch did you apply these patches?
They are ingit://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
They also landed in linux-next
I'll update the MAINTAINERS file to add the location of that git tree.
Signature · 3 lines
Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com