Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rtc: jz4740: Add support for JZ4760 SoC

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>

authored by

Paul Cercueil and committed by
Alexandre Belloni
58407485 f9b2a4d6

+3 -1
+3 -1
drivers/rtc/rtc-jz4740.c
··· 46 46 47 47 enum jz4740_rtc_type { 48 48 ID_JZ4740, 49 + ID_JZ4760, 49 50 ID_JZ4780, 50 51 }; 51 52 ··· 107 106 { 108 107 int ret = 0; 109 108 110 - if (rtc->type >= ID_JZ4780) 109 + if (rtc->type >= ID_JZ4760) 111 110 ret = jz4780_rtc_enable_write(rtc); 112 111 if (ret == 0) 113 112 ret = jz4740_rtc_wait_write_ready(rtc); ··· 299 298 300 299 static const struct of_device_id jz4740_rtc_of_match[] = { 301 300 { .compatible = "ingenic,jz4740-rtc", .data = (void *)ID_JZ4740 }, 301 + { .compatible = "ingenic,jz4760-rtc", .data = (void *)ID_JZ4760 }, 302 302 { .compatible = "ingenic,jz4780-rtc", .data = (void *)ID_JZ4780 }, 303 303 {}, 304 304 };