aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-s3c.c
Commit message (Collapse)AuthorAgeFilesLines
* rtc: use boolean values with device_init_wakeup()Wolfram Sang2025-01-091-1/+1
| | | | | | | | | | | | device_init_wakeup() second argument is a bool type. Use proper boolean values when calling it to match the type and to produce unambiguous code which is easier to understand. Signed-off-by: Wolfram Sang <[email protected]> Reviewed-by: Charles Keepax <[email protected]> Reviewed-by: Andre Przywara <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: Switch back to struct platform_driver::remove()Uwe Kleine-König2024-11-101-1/+1
| | | | | | | | | | | | | | | After commit 0edb555a65d1 ("platform: Make platform_driver::remove() return void") .remove() is (again) the right callback to implement for platform drivers. Convert all platform drivers below drivers/rtc to use .remove(), with the eventual goal to drop struct platform_driver::remove_new(). As .remove() and .remove_new() have the same prototypes, conversion is done by just changing the structure member name in the driver initializer. Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: Explicitly include correct DT includesRob Herring2023-07-271-1/+0
| | | | | | | | | | | | | | | The DT of_device.h and of_platform.h date back to the separate of_platform_bus_type before it as merged into the regular platform bus. As part of that merge prepping Arm DT support 13 years ago, they "temporarily" include each other. They also include platform_device.h and of.h. As a result, there's a pretty much random mix of those include files used throughout the tree. In order to detangle these headers and replace the implicit includes with struct declarations, users need to explicitly include the correct includes. Signed-off-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Convert to platform remove callback returning voidUwe Kleine-König2023-03-171-4/+2
| | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is (mostly) ignored and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Switch to use dev_err_probe() helperYang Yingliang2022-11-151-8/+3
| | | | | | | | | | In the probe path, dev_err() can be replace with dev_err_probe() which will check if error code is -EPROBE_DEFER and prints the error name. Signed-off-by: Yang Yingliang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Add time rangeSam Protsenko2021-10-231-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This RTC driver starts counting from 2000 to avoid Y2K problem. Also it only supports 100 years range for all RTCs. Provide that info to RTC framework. Also remove check for 100 years range in s3c_rtc_settime(), as RTC core won't pass any invalid values to the driver, now that correct range is set. Here is the rationale on 100 years range limitation. Info on different Samsung RTCs (credit goes to Krzysztof Kozlowski): - All S3C chips have only 8-bit wide year register (can store 100 years range in BCD format) - S5Pv210 and Exynos chips have 12-bit year register (can store 1000 years range in BCD format) But in reality we usually can't make use of those 12 bits either: - RTCs might think that both 2000 and 2100 years are leap years. So when the YEAR register is 0, RTC goes from 28 Feb to 29 Feb, and when the YEAR register is 100, RTC also goes from 28 Feb to 29 Feb. This is of course incorrect: RTC breaks leap year criteria, which breaks the time contiguity, which leads to inability to use the RTC after year of 2099. It was found for example on Exynos850 SoC. - Despite having 12 bits for holding the year value, RTC might overflow the year value internally much earlier. For example, on Exynos850 the RTC overflows when YEAR=159, making the next YEAR=0. This way RTC actually has range of 160 years, not 1000 as one may think. All that said, there is no sense in trying to increase the time range for more than 100 years on RTCs that seem capable of that. It also doesn't have too much practical value -- current hardware will be probably obsolete by 2100. Tested manually on Exynos850 RTC: $ date -s "1999-12-31 23:59:50" $ hwclock -w -f /dev/rtc0 $ date -s "2100-01-01 00:00:00" $ hwclock -w -f /dev/rtc0 $ date -s "2000-01-01 00:00:00" $ hwclock -w -f /dev/rtc0 $ hwclock -r -f /dev/rtc0 $ date -s "2099-12-31 23:59:50" $ hwclock -w -f /dev/rtc0 $ hwclock -r -f /dev/rtc0 Signed-off-by: Sam Protsenko <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* rtc: s3c: Extract read/write IO into separate functionsSam Protsenko2021-10-231-36/+60
| | | | | | | | | | | | | | Create dedicated functions for I/O operations and BCD conversion. It can be useful to separate those from representation conversion and other stuff found in RTC callbacks. This patch does not introduce any functional changes, it's merely refactoring change. Signed-off-by: Sam Protsenko <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* rtc: s3c: Remove usage of devm_rtc_device_register()Sam Protsenko2021-10-231-4/+7
| | | | | | | | | | | devm_rtc_device_register() is deprecated. Use devm_rtc_allocate_device() and devm_rtc_register_device() API instead. This change doesn't change the behavior, but allows for further improvements. Signed-off-by: Sam Protsenko <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* rtc: s3c: quiet maybe-unused variable warningAlexandre Belloni2021-02-051-1/+1
| | | | | | | | When CONFIG_OF is disabled then the matching table is not referenced. Signed-off-by: Alexandre Belloni <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* rtc: s3c: stop setting bogus timeAlexandre Belloni2021-02-051-15/+0
| | | | | | | | | | | | It doesn't make sense to set the RTC to a default value at probe time. Let the core handle invalid date and time. Also, this is basically dead code since commit 22652ba72453 ("rtc: stop validating rtc_time in .read_time") Signed-off-by: Alexandre Belloni <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* rtc: s3c: Remove dead code related to periodic tick handlingMarek Szyprowski2020-12-031-224/+2
| | | | | | | | | | | | | Support for periodic tick interrupts has been moved from the RTC class to the HR-timers long time ago. Then it has been removed from this driver by commits 80d4bb515b78 ("RTC: Cleanup rtc_class_ops->irq_set_state") and 696160fec162 ("RTC: Cleanup rtc_class_ops->irq_set_freq()"). They however did not remove all the code related to the tick handling. Do it now then. Signed-off-by: Marek Szyprowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* rtc: s3c: Disable all enable (RTC, tick) bits in the probeMarek Szyprowski2020-12-031-0/+4
| | | | | | | | | | | | Bootloader might use RTC hardware and leave it in the enabled state. Ensure that the potentially enabled periodic tick interrupts are disabled before enabling the driver, because they might cause lockup if tick interrupt happens after disabling RTC gate clock. Signed-off-by: Marek Szyprowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* rtc: s3c: Simplify with dev_err_probe()Krzysztof Kozlowski2020-09-151-7/+2
| | | | | | | | | Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and the error value gets printed. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]> Link: https://lore.kernel.org/r/[email protected]
* rtc: use devm_platform_ioremap_resource() to simplify codeYueHaibing2019-10-061-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use devm_platform_ioremap_resource() to simplify the code a bit. This is detected by coccinelle. Signed-off-by: YueHaibing <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: Remove dev_err() usage after platform_get_irq()Stephen Boyd2019-08-131-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: Alessandro Zummo <[email protected]> Cc: Alexandre Belloni <[email protected]> Cc: [email protected] Cc: Greg Kroah-Hartman <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexandre Belloni <[email protected]>
* treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner2019-06-191-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Enrico Weigelt <[email protected]> Reviewed-by: Kate Stewart <[email protected]> Reviewed-by: Allison Randal <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
* rtc: s3c: Use generic helper to get driver dataMarek Szyprowski2019-01-221-11/+2
| | | | | | | | | Replace of_match_node() with of_device_get_match_data(), which removes a few lines of code from the driver. Signed-off-by: Marek Szyprowski <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Rewrite clock handlingMarek Szyprowski2019-01-221-43/+31
| | | | | | | | | | | | | | | | s3c_rtc_enable/disable_clk() functions were designed to be called multiple times without reference counting, because they were initially only used in alarm setting/clearing functions, which can be called both when alarm is already set or not. Later however, calls to those functions have been added to other places in the driver - like time and /proc reading callbacks, what results in broken alarm if any of such events happens after the alarm has been set. Fix this by simplifying s3c_rtc_enable/disable_clk() functions to rely on proper reference counting in clock core and move alarm enable counter to s3c_rtc_setaie() function. Signed-off-by: Marek Szyprowski <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Switch to use %ptRAndy Shevchenko2018-12-101-16/+4
| | | | | | | | Use %ptR instead of open coded variant to print content of struct rtc_time in human readable format. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c-rtc: Avoid using broken ALMYEAR registerMarek Szyprowski2018-11-141-6/+0
| | | | | | | | | | | | | | | | | | | | | | (RTC,ALM)YEAR registers of Exynos built-in RTC device contains 3 BCD characters. s3c-rtc driver uses only 2 lower of them and supports years from 2000..2099 range. The third BCD value is typically set to 0, but it looks that handling of it is broken in the hardware. It sometimes defaults to a random (even non-BCD) value. This is not an issue for handling RTCYEAR register, because bcd2bin() properly handles only 8bit values (2 BCD characters, the third one is skipped). The problem is however with ALMYEAR register and proper RTC alarm operation. When YEAREN bit is set for the configured alarm, RTC hardware triggers alarm only when ALMYEAR and RTCYEAR matches. This usually doesn't happen because of the random noise on the third BCD character. Fix this by simply skipping setting ALMYEAR register in alarm configuration. This workaround fixes broken alarm operation on Exynos built-in rtc device. My tests revealed that the issue happens on the following Exynos series: 3250, 4210, 4412, 5250 and 5410. Signed-off-by: Marek Szyprowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: stop validating rtc_time in .read_timeAlexandre Belloni2018-03-021-1/+1
| | | | | | | The RTC core is always calling rtc_valid_tm after the read_time callback. It is not necessary to call it just before returning from the callback. Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Handle clock enable failuresKrzysztof Kozlowski2017-06-241-15/+57
| | | | | | | clk_enable() can fail so handle such case. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Handle clock prepare failures in probeKrzysztof Kozlowski2017-06-241-2/+6
| | | | | | | clk_prepare_enable() can fail so handle such case. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Do not remove const from rodata memoryKrzysztof Kozlowski2017-06-241-3/+3
| | | | | | | | | All instances of struct s3c_rtc_data are in fact static const thus put in rodata so we should not drop the const while getting the pointer to them. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Drop unneeded cast to void pointerKrzysztof Kozlowski2017-06-241-5/+5
| | | | | | | There is no need for casting to void pointer for of_device_id data. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Minor white-space cleanupsKrzysztof Kozlowski2017-06-241-24/+23
| | | | | | | | | | Minor cleanups to make the code easier to read. No functional changes. 1. Remove one space before labels as this is nowadays mostly preferred. 2. Fix indentation of arguments in function calls. 3. Split structure member declaration. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Jump to central exit point on getting src clock errorKrzysztof Kozlowski2017-06-241-2/+2
| | | | | | | | In other error paths in probe, centralized exit point was used so make this consistent. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Add s3c_rtc_{enable/disable}_clk in s3c_rtc_setfreq()Alim Akhtar2016-07-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | As per code flow s3c_rtc_setfreq() will get called with rtc clock disabled and in set_freq we perform h/w registers read/write, which results in a kernel crash on exynos7 platform while probing rtc driver. Below is code flow: s3c_rtc_probe() clk_prepare_enable(info->rtc_clk) // rtc clock enabled s3c_rtc_gettime() // will enable clk if not done, and disable it upon exit s3c_rtc_setfreq() //then this will be called with clk disabled This patch take cares of such issue by adding s3c_rtc_{enable/disable}_clk in s3c_rtc_setfreq(). Fixes: 24e1455493da ("drivers/rtc/rtc-s3c.c: delete duplicate clock control") Cc: <[email protected]> Signed-off-by: Alim Akhtar <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Pankaj Dubey <[email protected]> Tested-by: Pankaj Dubey <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Remove unnecessary call to disable already disabled clockAlim Akhtar2016-07-191-2/+0
| | | | | | | | | | | | At the end of s3c_rtc_probe(), s3c_rtc_disable_clk() being called with rtc clock already disabled (by s3c_rtc_gettime()), which looks extra and unnecessary call. Lets clean it up. Signed-off-by: Alim Akhtar <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Pankaj Dubey <[email protected]> Tested-by: Pankaj Dubey <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: simplify implementations of read_alarmUwe Kleine-König2016-07-091-12/+0
| | | | | | | | | | Since commit d68778b80dd7 ("rtc: initialize output parameter for read alarm to "uninitialized"") there is no need to explicitly set unsupported members to -1. So drop the respective assignments from drivers. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Don't print an error on probe deferralJavier Martinez Canillas2016-03-181-5/+14
| | | | | | | | | | | | The clock and source clock looked up by the driver may not be available just because the clock controller driver was not probed yet so printing an error in this case is not correct and only adds confusion to users. However, knowing that a driver's probe was deferred may be useful so it can be printed as a debug information. Signed-off-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Set year, month, day value for setting alarmKrzysztof Kozlowski2015-11-081-0/+16
| | | | | | | | | | | | | | | | This patch sets year, month, day value for set_alarm function. The current driver omits to set the values. This fixes setting wake alarm for dates different than current day. Without the patch the alarm scheduled for tomorrow would fire today on chosen time. Signed-off-by: Donggeun Kim <[email protected]> Signed-off-by: MyungJoo Ham <[email protected]> Signed-off-by: KyungMin Park <[email protected]> [k.kozlowski: Rebase and test the patch, update commit message] Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: remove unnecessary NULL assignmentJoonyoung Shim2015-09-051-1/+0
| | | | | | | | | It's unnecessary the code that assigns info->rtc_clk to NULL in s3c_rtc_remove. Signed-off-by: Joonyoung Shim <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: add missing clk controlJoonyoung Shim2015-09-051-0/+3
| | | | | | | | | | It's missed to call clk_unprepare() about info->rtc_src_clk in s3c_rtc_remove and to call clk_disable_unprepare about info->rtc_clk in error routine of s3c_rtc_probe. Signed-off-by: Joonyoung Shim <[email protected]> Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: fix disabled clocks for alarmJoonyoung Shim2015-09-051-6/+18
| | | | | | | | | | | | | | | | The clock enable/disable codes for alarm have been removed from commit 24e1455493da ("drivers/rtc/rtc-s3c.c: delete duplicate clock control") and the clocks are disabled even if alarm is set, so alarm interrupt can't happen. The s3c_rtc_setaie function can be called several times with 'enabled' argument having same value, so it needs to check whether clocks are enabled or not. Signed-off-by: Joonyoung Shim <[email protected]> Cc: <[email protected]> # v4.1 Reviewed-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* rtc: s3c: Integrate Exynos3250 into S3C6410Krzysztof Kozlowski2015-06-191-13/+1
| | | | | | | | | | | | There are now no differences between RTC on Exynos3250 and S3C6410. Merge everything into one so duplicated code could be removed. Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Chanwoo Choi <[email protected]> Acked-by: Alexandre Belloni <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Alexandre Belloni <[email protected]>
* drivers/rtc/rtc-s3c.c: remove one superfluous rtc_valid_tm() checkKrzysztof Kozlowski2015-04-171-3/+1
| | | | | | | | | | | | | s3c_rtc_gettime() already returns the result of rtc_valid_tm() on the obtained time so get rid of another call to rtc_valid_tm(). Signed-off-by: Krzysztof Kozlowski <[email protected]> Reviewed-by: Chanwoo Choi <[email protected]> Cc: Alexandre Belloni <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Marek Szyprowski <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* drivers/rtc/rtc-s3c.c: fix failed first read of RTC timeKrzysztof Kozlowski2015-04-171-16/+16
| | | | | | | | | | | | | | | | Initialize the device time (if it is wrong) before registering RTC device to fix following error message during rtc-s3c probe: [ 2.215414] rtc (null): read_time: fail to read [ 2.216322] s3c-rtc 10070000.rtc: rtc core: registered s3c as rtc1 Signed-off-by: Krzysztof Kozlowski <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Alexandre Belloni <[email protected]> Cc: Marek Szyprowski <[email protected]> Reviewed-by: Chanwoo Choi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* drivers/rtc/rtc-s3c.c: delete duplicate clock controlChanwoo Choi2015-04-171-124/+39
| | | | | | | | | | | | | | | | The current functions in s3c-rtc driver execute clk_enable/disable() to control clocks and some functions execute s3c_rtc_alarm_clk_enable() unnecessarily. So this patch deletes the duplicate clock control and spilts s3c_rtc_alarm_clk_enable() out as s3c_rtc_enable_clk()/s3c_rtc_disable_clk() to improve readability. Signed-off-by: Chanwoo Choi <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Kukjin Kim <[email protected]> Cc: Inki Dae <[email protected]> Cc: Kyungmin Park <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* drivers/rtc/rtc-s3c.c: add .needs_src_clk to s3c6410 RTC dataJavier Martinez Canillas2015-03-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit df9e26d093d3 ("rtc: s3c: add support for RTC of Exynos3250 SoC") added an "rtc_src" DT property to specify the clock used as a source to the S3C real-time clock. Not all SoCs needs this so commit eaf3a659086e ("drivers/rtc/rtc-s3c.c: fix initialization failure without rtc source clock") changed to check the struct s3c_rtc_data .needs_src_clk to conditionally grab the clock. But that commit didn't update the data for each IP version so the RTC broke on the boards that needs a source clock. This is the case of at least Exynos5250 and Exynos5440 which uses the s3c6410 RTC IP block. This commit fixes the S3C rtc on the Exynos5250 Snow and Exynos5420 Peach Pit and Pi Chromebooks. Signed-off-by: Javier Martinez Canillas <[email protected]> Cc: Marek Szyprowski <[email protected]> Cc: Chanwoo Choi <[email protected]> Cc: Doug Anderson <[email protected]> Cc: Olof Johansson <[email protected]> Cc: Kevin Hilman <[email protected]> Cc: Tyler Baker <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* Merge branch 'platform/remove_owner' of ↵Greg Kroah-Hartman2014-11-041-1/+0
|\ | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux into driver-core-next Remove all .owner fields from platform drivers
| * rtc: drop owner assignment from platform_driversWolfram Sang2014-10-201-1/+0
| | | | | | | | | | | | | | A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <[email protected]>
* | drivers/rtc/rtc-s3c.c: fix initialization failure without rtc source clockMarek Szyprowski2014-10-291-6/+8
|/ | | | | | | | | | | | | Fix unconditional initialization failure on non-exynos3250 SoCs. Commit df9e26d093d3 ("rtc: s3c: add support for RTC of Exynos3250 SoC") introduced rtc source clock support, but also added initialization failure on SoCs, which doesn't need such clock. Signed-off-by: Marek Szyprowski <[email protected]> Reviewed-by: Chanwoo Choi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* rtc: s3c: add support for RTC of Exynos3250 SoCChanwoo Choi2014-10-141-1/+92
| | | | | | | | | | | | | | | | | | | | Add support for RTC of Exynos3250 SoC. The Exynos3250 needs source clock(32.768KHz) for RTC block. If source clock of RTC is registerd on clock list of common clk framework, Exynos RTC drvier have to control this clock. Clock list for s3c-rtc device: - rtc : CLK_RTC of CLK_GATE_IP_PERIR is gate clock for RTC. - rtc_src : XrtcXTI is 32.768.kHz source clock for RTC. (XRTCXTI: Specifies a clock from 32.768 kHz crystal pad with XRTCXTI and XRTCXTO pins. RTC uses this clock as the source of a real-time clock.) Signed-off-by: Chanwoo Choi <[email protected]> Acked-by: Kyungmin Park <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Kukjin Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* rtc: s3c: add s3c_rtc_data structure to use variant data instead of s3c_cpu_typeChanwoo Choi2014-10-141-172/+289
| | | | | | | | | | | | | Add s3c_rtc_data structure to variant data according to SoC type. The s3c_rtc_data structure includes some functions to control RTC operation and specific data dependent on SoC type. Signed-off-by: Chanwoo Choi <[email protected]> Acked-by: Kyungmin Park <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Kukjin Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* rtc: s3c: remove warning message when checking coding style with checkpatch ↵Chanwoo Choi2014-10-141-12/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | script Remove warning message when checking codeing style with checkpatch script and reduce un-necessary i2c read operation on s3c_rtc_enable. WARNING: line over 80 characters #406: FILE: drivers/rtc/rtc-s3c.c:406: + if ((readw(info->base + S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0) { WARNING: line over 80 characters #414: FILE: drivers/rtc/rtc-s3c.c:414: + if ((readw(info->base + S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)) { WARNING: line over 80 characters #422: FILE: drivers/rtc/rtc-s3c.c:422: + if ((readw(info->base + S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)) { WARNING: Missing a blank line after declarations #451: FILE: drivers/rtc/rtc-s3c.c:451: + struct s3c_rtc_drv_data *data; + if (pdev->dev.of_node) { WARNING: Missing a blank line after declarations #453: FILE: drivers/rtc/rtc-s3c.c:453: + const struct of_device_id *match; + match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node); WARNING: DT compatible string "samsung,s3c2416-rtc" appears un-documented -- check ./Documentation/devicetree/bindings/ #650: FILE: drivers/rtc/rtc-s3c.c:650: + .compatible = "samsung,s3c2416-rtc", WARNING: DT compatible string "samsung,s3c2443-rtc" appears un-documented -- check ./Documentation/devicetree/bindings/ #653: FILE: drivers/rtc/rtc-s3c.c:653: + .compatible = "samsung,s3c2443-rtc", Signed-off-by: Chanwoo Choi <[email protected]> Acked-by: Kyungmin Park <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Kukjin Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* rtc: s3c: define s3c_rtc structure to remove global variables.Chanwoo Choi2014-10-141-215/+216
| | | | | | | | | | | | | Define s3c_rtc structure including necessary variables for S3C RTC device instead of global variables. This patch improves the readability by removing global variables. Signed-off-by: Chanwoo Choi <[email protected]> Acked-by: Kyungmin Park <[email protected]> Cc: Alessandro Zummo <[email protected]> Cc: Kukjin Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* drivers/rtc/rtc-s3c.c: remove NO_IRQ macroPankaj Dubey2014-04-031-2/+2
| | | | | | | | | | | | | | NO_IRQ may be defined as '(unsigned int) -1' in some architectures (arm, sh ...), and either may not be defined in some architectures (arm64) which can enable RTC_DRV_S3C. Also since platform_get_irq returns err-code in case of any error, we do not need to intialize s3c_rtc_alarmno and s3c_rtc_tickno. Signed-off-by: Pankaj Dubey <[email protected]> Cc: Alessandro Zummo <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* drivers/rtc/rtc-s3c.c: fix incorrect way of save/restore of S3C2410_TICNT ↵Vikas Sajjan2014-03-041-5/+12
| | | | | | | | | | | | | | | | | for TYPE_S3C64XX On exynos5250, exynos5420 and exynos5260 it was observed that, after 1 cycle of S2R, the rtc-tick occurs at a very fast rate as compared to the rtc-tick occuring before S2R. This patch fixes the above issue by correcting the wrong way of save/restore of S3C2410_TICNT for TYPE_S3C64XX. Signed-off-by: Vikas Sajjan <[email protected]> Cc: Grant Likely <[email protected]> Cc: Rob Herring <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
* rtc: rtc-s3c: remove unnecessary platform_set_drvdata()Jingoo Han2013-07-031-7/+2
| | | | | | | | | | | The driver core clears the driver data to NULL after device_release or on probe failure, since commit 0998d063100 ("device-core: Ensure drvdata = NULL when no driver is bound"). Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>