aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-jz4740.c
AgeCommit message (Collapse)AuthorFilesLines
2023-08-16rtc: jz4740: fix Wvoid-pointer-to-enum-cast warningKrzysztof Kozlowski1-1/+1
'type' is an enum, thus cast of pointer on 64-bit compile test with W=1 causes: rtc-jz4740.c:352:14: error: cast to smaller integer type 'enum jz4740_rtc_type' from 'const void *' [-Werror,-Wvoid-pointer-to-enum-cast] Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230810103902.151145-3-krzysztof.kozlowski@linaro.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-07-27rtc: Explicitly include correct DT includesRob Herring1-1/+1
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 <robh@kernel.org> Link: https://lore.kernel.org/r/20230724205456.767430-1-robh@kernel.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-04-28rtc: jz4740: Make sure clock provider gets removedLars-Peter Clausen1-1/+2
The jz4740 RTC driver registers a clock provider, but never removes it. This leaves a stale clock provider behind that references freed clocks when the device is unbound. Use the managed `devm_of_clk_add_hw_provider()` instead of `of_clk_add_hw_provider()` to make sure the provider gets automatically removed on unbind. Fixes: 5ddfa148de8c ("rtc: jz4740: Register clock provider for the CLK32K pin") Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20230409162544.16155-1-lars@metafoo.de Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-02-09rtc: jz4740: Register clock provider for the CLK32K pinPaul Cercueil1-0/+56
On JZ4770 and JZ4780, the CLK32K pin is configurable. By default, it is configured as a GPIO in input mode, and its value can be read through GPIO PD14. With this change, clients can now request the 32 kHz clock on the CLK32K pin, through Device Tree. This clock is simply a pass-through of the input oscillator's clock with enable/disable operations. This will permit the WiFi/Bluetooth chip to work on the MIPS CI20 board, which does source one of its clocks from the CLK32K pin. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20230129120442.22858-5-paul@crapouillou.net Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-02-09rtc: jz4740: Use dev_err_probe()Paul Cercueil1-13/+7
Use dev_err_probe() where it makes sense to simplify a bit the code. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20230129120442.22858-4-paul@crapouillou.net Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2023-02-09rtc: jz4740: Use readl_poll_timeoutPaul Cercueil1-12/+6
Use readl_poll_timeout() from <iopoll.h> instead of using custom poll loops. The timeout settings are different, but that shouldn't be much of a problem. Instead of polling 10000 times in a close loop, it polls for one millisecond. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20230129120442.22858-3-paul@crapouillou.net Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2022-10-13rtc: jz4740: Use devm_clk_get_enabled() helperChristophe JAILLET1-22/+3
The devm_clk_get_enabled() helper: - calls devm_clk_get() - calls clk_prepare_enable() and registers what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code, the error handling paths and avoid the need of a dedicated function used with devm_add_action_or_reset(). As a side effect, some error messages are not logged anymore, so also use dev_err_probe() instead of dev_err() in case of error. At least the error code will be logged (and -EPROBE_DEFER will be filtered) Based on my test with allyesconfig, this reduces the .o size from: text data bss dec hex filename 9025 2488 128 11641 2d79 drivers/rtc/rtc-jz4740.o down to: 8267 2080 128 10475 28eb drivers/rtc/rtc-jz4740.o Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/af10570000d7e103d70bbea590ce8df4f8902b67.1661330532.git.christophe.jaillet@wanadoo.fr Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-11-19rtc: rework rtc_register_device() resource managementBartosz Golaszewski1-1/+1
rtc_register_device() is a managed interface but it doesn't use devres by itself - instead it marks an rtc_device as "registered" and the devres callback for devm_rtc_allocate_device() takes care of resource release. This doesn't correspond with the design behind devres where managed structures should not be aware of being managed. The correct solution here is to register a separate devres callback for unregistering the device. While at it: rename rtc_register_device() to devm_rtc_register_device() and add it to the list of managed interfaces in devres.rst. This way we can avoid any potential confusion of driver developers who may expect there to exist a corresponding unregister function. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201109163409.24301-8-brgl@bgdev.pl
2020-05-11rtc: ingenic: Reset regulator register in probePaul Cercueil1-0/+3
The regulator register specifies how many input clock cycles (minus one) are contained in one tick of the 1 Hz clock. Since this register can contain bogus values after the system boots, it needs to be reset in the probe register, otherwise the RTC may count way to slow or way too fast. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20200505221336.222313-7-paul@crapouillou.net Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-05-11rtc: ingenic: Fix masking of error codePaul Cercueil1-1/+1
The code was returning -ENOENT on any error of platform_get_irq(), even if it returned a different error. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20200505221336.222313-6-paul@crapouillou.net Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-05-11rtc: ingenic: Remove unused fields from private structurePaul Cercueil1-14/+12
The 'clk' and 'irq' fields were only ever used in the probe function. Therefore they can be moved to be simple local variables of the probe function. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20200505221336.222313-5-paul@crapouillou.net Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-05-11rtc: ingenic: Set wakeup params in probePaul Cercueil1-51/+44
We can write the wakeup timing parameters as soon as the driver probes, there's no need to wait the very last moment. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20200505221336.222313-4-paul@crapouillou.net Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-05-11rtc: ingenic: Enable clock in probePaul Cercueil1-2/+17
It makes no sense to request a clock and not enable it even though the hardware is being used. So the driver now enables the clock in the probe. Besides, now we can properly handle errors. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20200505221336.222313-3-paul@crapouillou.net Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-05-11rtc: ingenic: Use local 'dev' variable in probePaul Cercueil1-15/+15
Clean a bit the probe function by adding a local struct device *dev variable. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20200505221336.222313-2-paul@crapouillou.net Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-05-11rtc: ingenic: Only support probing from devicetreePaul Cercueil1-17/+3
With the recent work on supporting Device Tree on Ingenic SoCs, no driver ever probes from platform code anymore, so we can clean a bit this driver by removing the non-devicetree paths. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20200505221336.222313-1-paul@crapouillou.net Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-24rtc: jz4740: Rename vendor-specific DT propertiesPaul Cercueil1-2/+3
These properties are never set anywhere within any of the upstream devicetree files, so I assume I'm not breaking the ABI with this change. Rename vendor-specific DT properties to have the 'ingenic,' prefix, which they should have had from the start. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20200311182318.22154-2-paul@crapouillou.net Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2020-03-24rtc: jz4740: Add support for JZ4760 SoCPaul Cercueil1-1/+3
The WENR feature (set a magic value to enable RTC registers read-write) first appeared on the JZ4760; the JZ4780 came much later. Since it would be dangerous to specify a newer SoC's compatible string as the fallback of an older SoC's compatible string, we add support for the "ingenic,jz4760-rtc" compatible string in the driver. This will permit to support the JZ4770 by having: compatible = "ingenic,jz4770-rtc", "ingenic,jz4760-rtc"; Instead of doing: compatible = "ingenic,jz4770-rtc", "ingenic,jz4780-rtc"; Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20200311182318.22154-1-paul@crapouillou.net Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-10-07rtc: use devm_platform_ioremap_resource() to simplify codeYueHaibing1-3/+1
Use devm_platform_ioremap_resource() to simplify the code a bit. This is detected by coccinelle. Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20191006102953.57536-2-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-3-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-4-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-5-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-6-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-7-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-8-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-9-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-10-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-11-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-12-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-13-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-14-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-15-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-16-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-17-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-18-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-19-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-20-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-21-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-22-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-23-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-24-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-25-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-26-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-27-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-28-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-29-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-30-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-31-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-32-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-33-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-34-yuehaibing@huawei.com Link: https://lore.kernel.org/r/20191006102953.57536-35-yuehaibing@huawei.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-08-21rtc: remove superfluous error messageAlexandre Belloni1-3/+1
The RTC core now has error messages in case of registration failure, there is no need to have other messages in the drivers. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20190818220041.17833-2-alexandre.belloni@bootlin.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-08-13rtc: Remove dev_err() usage after platform_get_irq()Stephen Boyd1-3/+1
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 <a.zummo@towertech.it> Cc: Alexandre Belloni <alexandre.belloni@bootlin.com> Cc: linux-rtc@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20190730181557.90391-40-swboyd@chromium.org Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-30rtc: jz4740: convert to SPDX identifierAlexandre Belloni1-10/+1
Use SPDX-License-Identifier instead of a verbose license text. Tested-by: Mathieu Malaterre <malat@debian.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-30rtc: jz4740: rework invalid time detectionAlexandre Belloni1-12/+9
The scratchpad register is used to detect an invalid time when power to the RTC has been lost. Instead of deleting that precious information and set the time to the UNIX epoch, forward it to userspace. Tested-by: Mathieu Malaterre <malat@debian.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-30rtc: jz4740: use dev_pm_set_wake_irq() to simplify codeAlexandre Belloni1-30/+7
Use dev_pm_set_wake_irq() to set the RTC as a wakeup source for suspend. This allows to remove the whole dev_pm_ops structure. Tested-by: Mathieu Malaterre <malat@debian.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-30rtc: jz4740: use .set_timeAlexandre Belloni1-3/+3
Use .set_time instead of the deprecated .set_mmss. Tested-by: Mathieu Malaterre <malat@debian.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-30rtc: jz4740: remove useless checkAlexandre Belloni1-1/+1
rtc_time64_to_tm always returns a valid tm, it is not necessary to validate it. Tested-by: Mathieu Malaterre <malat@debian.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-30rtc: jz4740: switch to rtc_time64_to_tm/rtc_tm_to_time64Alexandre Belloni1-5/+3
Call the 64bit versions of rtc_tm time conversion now that the range is enforced by the core. Tested-by: Mathieu Malaterre <malat@debian.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2019-04-30rtc: jz4740: set rangeAlexandre Belloni1-2/+10
RTC_SEC is a 32-bit seconds counter. Tested-by: Mathieu Malaterre <malat@debian.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2018-03-01rtc: stop validating rtc_time after rtc_time_to_tmAlexandre Belloni1-1/+1
rtc_time_to_tm never generates an invalid tm. It is not necessary to validate it. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2017-10-12rtc: jz4740: fix loading of rtc driverMathieu Malaterre1-2/+2
The current timeout for waiting for WRDY is not always sufficient. Always increase it to 10000 even on JZ4740. This is technically only required on JZ4780, where the current symptoms seen after a hard reboot are: jz4740-rtc 10003000.rtc: rtc core: registered 10003000.rtc as rtc0 jz4740-rtc 10003000.rtc: Could not write to RTC registers jz4740-rtc: probe of 10003000.rtc failed with error -5 Suggested-by: Alex Smith <alex.smith@imgtec.com> Cc: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com> Signed-off-by: Mathieu Malaterre <malat@debian.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-10-12rtc: jz4740: remove duplicate 'write' in messageMathieu Malaterre1-1/+1
Trivial fix in error message with duplicate 'write' Signed-off-by: Mathieu Malaterre <malat@debian.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2017-01-26rtc: jz4740: make the driver buildable as a module againAlexandre Belloni1-2/+10
By using kernel_halt() instead of machine_halt(), we can make the driver build as a module. However, jz4740 platforms not loading this module will not be able to power off. Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Revert "rtc: jz4740: make the driver builtin only" This reverts commit b9168c539c0b2de756aaffd380384dbde8adbe07.
2016-11-09rtc: jz4740: make the driver builtin onlyAlexandre Belloni1-9/+1
Since the driver is now calling machine_halt() that is not exported, it has to be built in the kernel. Building it as a module will fail at linking time. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2016-11-08rtc: jz4740: remove unused EXPORT_SYMBOLAlexandre Belloni1-2/+1
jz4740_rtc_poweroff() is only called from the driver, stop exporting it. Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2016-11-05rtc: jz4740: Add support for acting as the system power controllerPaul Cercueil1-0/+81
The 'system-power-controller' singleton entry can be used in the devicetree node of the jz4740-rtc driver to specify that the driver is granted the right to power off the system through the registers of the RTC unit. See the documentation for more details: Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt Signed-off-by: Paul Cercueil <paul@crapouillou.net> Acked-by: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2016-11-04rtc: jz4740: Add support for devicetreePaul Cercueil1-1/+15
See Documentation/devicetree/bindings/rtc/ingenic,jz4740-rtc.txt for a description of the bindings. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Acked-by: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2016-11-04rtc: jz4740: Add support for the RTC in the jz4780 SoCPaul Cercueil1-2/+48
The RTC unit present in the JZ4780 works mostly the same as the one in the JZ4740. The major difference is that register writes need to be explicitly enabled, by writing a magic code (0xA55A) to a "write enable" register before each access. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Acked-by: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2016-09-02rtc: constify rtc_class_ops structuresJulia Lawall1-1/+1
Check for rtc_class_ops structures that are only passed to devm_rtc_device_register, rtc_device_register, platform_device_register_data, all of which declare the corresponding parameter as const. Declare rtc_class_ops structures that have these properties as const. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r disable optional_qualifier@ identifier i; position p; @@ static struct rtc_class_ops i@p = { ... }; @ok@ identifier r.i; expression e1,e2,e3,e4; position p; @@ ( devm_rtc_device_register(e1,e2,&i@p,e3) | rtc_device_register(e1,e2,&i@p,e3) | platform_device_register_data(e1,e2,e3,&i@p,e4) ) @bad@ position p != {r.p,ok.p}; identifier r.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r.i; @@ static +const struct rtc_class_ops i = { ... }; // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: Baruch Siach <baruch@tkos.co.il> Acked-by: Hans Ulli Kroll <ulli.kroll@googlemail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
2014-10-20rtc: drop owner assignment from platform_driversWolfram Sang1-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 <wsa@the-dreams.de>
2014-04-03rtc: rtc-jz4740: use devm_ioremap_resource()Jingoo Han1-20/+5
Use devm_ioremap_resource() in order to make the code simpler, and move 'struct resource *mem' from 'struct jz4740_rtc' to jz4740_rtc_probe() because the 'mem' variable is used only in jz4740_rtc_probe(). Also the redundant return value check of platform_get_resource() is removed, because the value is checked by devm_ioremap_resource(). Signed-off-by: Jingoo Han <jg1.han@samsung.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03rtc: rtc-jz4740: use devm_*() functionsJingoo Han1-49/+16
Use devm_*() functions to make cleanup paths simpler. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03rtc: rtc-jz4740: remove unnecessary platform_set_drvdata()Jingoo Han1-3/+0
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 <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-01-03Drivers: rtc: remove __dev* attributes.Greg Kroah-Hartman1-3/+3
CONFIG_HOTPLUG is going away as an option. As a result, the __dev* markings need to be removed. This change removes the use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit from these drivers. Based on patches originally written by Bill Pemberton, but redone by me in order to handle some of the coding style issues better, by hand. Cc: Bill Pemberton <wfp5p@virginia.edu> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Mike Frysinger <vapier.adi@gmail.com> Cc: Wan ZongShun <mcuos.com@gmail.com> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-06drivers/rtc/rtc-jz4740.c: fix IRQ error checkLars-Peter Clausen1-1/+1
The irq field of the jz4740_irc struct is unsigned. Yet we assign the result of platform_get_irq() to it. platform_get_irq() may return a negative error code and the code checks for this condition by checking if 'irq' is less than zero. But since 'irq' is unsigned this test will always be false. Fix it by making 'irq' signed. The issue was found using the following coccinelle semantic patch: //<smpl> @@ type T; unsigned T i; @@ ( *i < 0 | *i >= 0 ) //</smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-10drivers/rtc/rtc-jz4740.c: make jz4740_rtc_driver staticAxel Lin1-1/+1
Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-01-10rtc: convert drivers/rtc/* to use module_platform_driver()Axel Lin1-11/+1
This patch converts the drivers in drivers/rtc/* to use the module_platform_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Ben Dooks <ben@simtec.co.uk> Cc: John Stultz <john.stultz@linaro.org> Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-03-09RTC: Cleanup rtc_class_ops->update_irq_enable()John Stultz1-7/+0
Now that the generic code handles UIE mode irqs via periodic alarm interrupts, no one calls the rtc_class_ops->update_irq_enable() method anymore. This patch removes the driver hooks and implementations of update_irq_enable if no one else is calling it. CC: Thomas Gleixner <tglx@linutronix.de> CC: Alessandro Zummo <a.zummo@towertech.it> CC: Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br> CC: rtc-linux@googlegroups.com Signed-off-by: John Stultz <john.stultz@linaro.org>
2010-10-27drivers/rtc/rtc-jz4740.c: add alarm functionPaul Cercueil1-5/+40
Add the "alarm" function to the jz4740 RTC. Interrupts will now be raised when the "alarm" time is reached. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Paul Cercueil <paul@crapouillou.net> Cc: Wan ZongShun <mcuos.com@gmail.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Paul Gortmaker <p_gortmaker@yahoo.com> Cc: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-05RTC: Add JZ4740 RTC driverLars-Peter Clausen1-0/+345
Add support for the RTC unit on JZ4740 SoCs. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Paul Gortmaker <p_gortmaker@yahoo.com> Cc: rtc-linux@googlegroups.com Acked-by: Wan ZongShun <mcuos.com@gmail.com> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Cc: Alessandro Zummo <a.zummo@towertech.it>, Patchwork: https://patchwork.linux-mips.org/patch/1424/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>