aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 14:51:39 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 14:51:39 -0500
commitd01e4afdbb65e030fd6f1f96c30a558e2eb0f279 (patch)
tree02ef82b2740cf93a98199eded5ef765fa6e03052 /drivers/rtc
parent8287361abca36504da813638310d2547469283eb (diff)
parent794b175fc0c0c4844dbb7b137a73bbfd01f6c608 (diff)
Merge tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC cleanups on various subarchitectures from Olof Johansson: "Cleanup patches for various ARM platforms and some of their associated drivers. There's also a branch in here that enables Freescale i.MX to be part of the multiplatform support -- the first "big" SoC that is moved over (more multiplatform work comes in a separate branch later during the merge window)." Conflicts fixed as per Olof, including a silent semantic one in arch/arm/mach-omap2/board-generic.c (omap_prcm_restart() was renamed to omap3xxx_restart(), and a new user of the old name was added). * tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (189 commits) ARM: omap: fix typo on timer cleanup ARM: EXYNOS: Remove unused regs-mem.h file ARM: EXYNOS: Remove unused non-dt support for dwmci controller ARM: Kirkwood: Use hw_pci.ops instead of hw_pci.scan ARM: OMAP3: cm-t3517: use GPTIMER for system clock ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER ARM: SAMSUNG: use devm_ functions for ADC driver ARM: EXYNOS: no duplicate mask/unmask in eint0_15 ARM: S3C24XX: SPI clock channel setup is fixed for S3C2443 ARM: EXYNOS: Remove i2c0 resource information and setting of device names ARM: Kirkwood: checkpatch cleanups ARM: Kirkwood: Fix sparse warnings. ARM: Kirkwood: Remove unused includes ARM: kirkwood: cleanup lsxl board includes ARM: integrator: use BUG_ON where possible ARM: integrator: push down SC dependencies ARM: integrator: delete static UART1 mapping ARM: integrator: delete SC mapping on the CP ARM: integrator: remove static CP syscon mapping ARM: integrator: remove static AP syscon mapping ...
Diffstat (limited to 'drivers/rtc')
-rw-r--r--drivers/rtc/rtc-mxc.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c
index cd0106293a49..7304139934aa 100644
--- a/drivers/rtc/rtc-mxc.c
+++ b/drivers/rtc/rtc-mxc.c
@@ -17,8 +17,6 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19 19
20#include <mach/hardware.h>
21
22#define RTC_INPUT_CLK_32768HZ (0x00 << 5) 20#define RTC_INPUT_CLK_32768HZ (0x00 << 5)
23#define RTC_INPUT_CLK_32000HZ (0x01 << 5) 21#define RTC_INPUT_CLK_32000HZ (0x01 << 5)
24#define RTC_INPUT_CLK_38400HZ (0x02 << 5) 22#define RTC_INPUT_CLK_38400HZ (0x02 << 5)
@@ -72,14 +70,38 @@ static const u32 PIE_BIT_DEF[MAX_PIE_NUM][2] = {
72#define RTC_TEST2 0x2C /* 32bit rtc test reg 2 */ 70#define RTC_TEST2 0x2C /* 32bit rtc test reg 2 */
73#define RTC_TEST3 0x30 /* 32bit rtc test reg 3 */ 71#define RTC_TEST3 0x30 /* 32bit rtc test reg 3 */
74 72
73enum imx_rtc_type {
74 IMX1_RTC,
75 IMX21_RTC,
76};
77
75struct rtc_plat_data { 78struct rtc_plat_data {
76 struct rtc_device *rtc; 79 struct rtc_device *rtc;
77 void __iomem *ioaddr; 80 void __iomem *ioaddr;
78 int irq; 81 int irq;
79 struct clk *clk; 82 struct clk *clk;
80 struct rtc_time g_rtc_alarm; 83 struct rtc_time g_rtc_alarm;
84 enum imx_rtc_type devtype;
81}; 85};
82 86
87static struct platform_device_id imx_rtc_devtype[] = {
88 {
89 .name = "imx1-rtc",
90 .driver_data = IMX1_RTC,
91 }, {
92 .name = "imx21-rtc",
93 .driver_data = IMX21_RTC,
94 }, {
95 /* sentinel */
96 }
97};
98MODULE_DEVICE_TABLE(platform, imx_rtc_devtype);
99
100static inline int is_imx1_rtc(struct rtc_plat_data *data)
101{
102 return data->devtype == IMX1_RTC;
103}
104
83/* 105/*
84 * This function is used to obtain the RTC time or the alarm value in 106 * This function is used to obtain the RTC time or the alarm value in
85 * second. 107 * second.
@@ -278,10 +300,13 @@ static int mxc_rtc_read_time(struct device *dev, struct rtc_time *tm)
278 */ 300 */
279static int mxc_rtc_set_mmss(struct device *dev, unsigned long time) 301static int mxc_rtc_set_mmss(struct device *dev, unsigned long time)
280{ 302{
303 struct platform_device *pdev = to_platform_device(dev);
304 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
305
281 /* 306 /*
282 * TTC_DAYR register is 9-bit in MX1 SoC, save time and day of year only 307 * TTC_DAYR register is 9-bit in MX1 SoC, save time and day of year only
283 */ 308 */
284 if (cpu_is_mx1()) { 309 if (is_imx1_rtc(pdata)) {
285 struct rtc_time tm; 310 struct rtc_time tm;
286 311
287 rtc_time_to_tm(time, &tm); 312 rtc_time_to_tm(time, &tm);
@@ -360,6 +385,8 @@ static int __devinit mxc_rtc_probe(struct platform_device *pdev)
360 if (!pdata) 385 if (!pdata)
361 return -ENOMEM; 386 return -ENOMEM;
362 387
388 pdata->devtype = pdev->id_entry->driver_data;
389
363 if (!devm_request_mem_region(&pdev->dev, res->start, 390 if (!devm_request_mem_region(&pdev->dev, res->start,
364 resource_size(res), pdev->name)) 391 resource_size(res), pdev->name))
365 return -EBUSY; 392 return -EBUSY;
@@ -480,6 +507,7 @@ static struct platform_driver mxc_rtc_driver = {
480#endif 507#endif
481 .owner = THIS_MODULE, 508 .owner = THIS_MODULE,
482 }, 509 },
510 .id_table = imx_rtc_devtype,
483 .probe = mxc_rtc_probe, 511 .probe = mxc_rtc_probe,
484 .remove = __devexit_p(mxc_rtc_remove), 512 .remove = __devexit_p(mxc_rtc_remove),
485}; 513};