summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-gamecube.c
AgeCommit message (Collapse)AuthorFilesLines
2022-08-23rtc: gamecube: Always reset HW_SRNPROT after readEmmanuel Gil Peyrot1-6/+5
This register would fail to be reset if reading the RTC bias failed for whichever reason. This commit reorganises the code around to unconditionally write it back to its previous value, unmap it, and return the result of regmap_read(), which makes it both simpler and more correct in the error case. Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20220823130702.1046-1-linkmauve@linkmauve.fr
2022-05-18rtc: gamecube: Add missing iounmap in gamecube_rtc_read_offset_from_sramYuan Can1-0/+1
The hw_srnprot needs to be unmapped when gamecube_rtc_read_offset_from_sram returns. Fixs: 86559400b3ef9d (rtc: gamecube: Add a RTC driver for the GameCube, Wii and Wii U) Signed-off-by: Yuan Can <yuancan@huawei.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20220511071354.46202-1-yuancan@huawei.com
2022-03-29rtc: gamecube: Fix refcount leak in gamecube_rtc_read_offset_from_sramMiaoqian Lin1-0/+1
The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount. Fixes: 86559400b3ef ("rtc: gamecube: Add a RTC driver for the GameCube, Wii and Wii U") Signed-off-by: Miaoqian Lin <linmq006@gmail.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20220309092225.6930-1-linmq006@gmail.com
2022-01-17rtc: gamecube: Fix an IS_ERR() vs NULL checkDan Carpenter1-2/+2
The devm_kzalloc() function returns NULL on error, it doesn't return error pointers. Fixes: 86559400b3ef ("rtc: gamecube: Add a RTC driver for the GameCube, Wii and Wii U") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20220107073340.GF22086@kili
2021-12-16rtc: gamecube: Report low battery as invalid dataEmmanuel Gil Peyrot1-0/+30
I haven’t been able to test this patch as all of my consoles have a working RTC battery, but according to the documentation it should work like that. Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc) Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20211215175501.6761-3-linkmauve@linkmauve.fr
2021-12-16rtc: gamecube: Add a RTC driver for the GameCube, Wii and Wii UEmmanuel Gil Peyrot1-0/+347
These three consoles share a device, the MX23L4005, which contains a clock and 64 bytes of SRAM storage, and is exposed on the EXI bus (similar to SPI) on channel 0, device 1. This driver allows it to be used as a Linux RTC device, where time can be read and set. The hardware also exposes two timers, one which shuts down the console and one which powers it on, but these aren’t supported currently. On the Wii U, the counter bias is stored in a XML file, /config/rtc.xml, encrypted in the SLC (eMMC storage), using a proprietary filesystem. In order to avoid having to implement all that, this driver assumes a bootloader will parse this XML file and write the bias into the SRAM, at the same location the other two consoles have it. Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc) Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20211215175501.6761-2-linkmauve@linkmauve.fr