1 From 299e9ffda004d3f5f722ebbd04be0250a618203a Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Wed, 30 Jun 2021 17:03:00 +0100
4 Subject: [PATCH] overlays: Make i2c-rtc and i2c-rtc-gpio share RTCs
6 Lift the set of RTCs out of i2c-rtc and i2c-rtc-gpio to update
7 i2c-rtc-gpio and to reduce duplication.
9 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
11 arch/arm/boot/dts/overlays/README | 10 +
12 .../arm/boot/dts/overlays/i2c-rtc-common.dtsi | 290 ++++++++++++++++++
13 .../dts/overlays/i2c-rtc-gpio-overlay.dts | 249 +--------------
14 .../arm/boot/dts/overlays/i2c-rtc-overlay.dts | 287 +----------------
15 4 files changed, 309 insertions(+), 527 deletions(-)
16 create mode 100644 arch/arm/boot/dts/overlays/i2c-rtc-common.dtsi
18 --- a/arch/arm/boot/dts/overlays/README
19 +++ b/arch/arm/boot/dts/overlays/README
20 @@ -1445,6 +1445,8 @@ Params: abx80x Select o
22 ds1339 Select the DS1339 device
24 + ds1340 Select the DS1340 device
26 ds3231 Select the DS3231 device
28 m41t62 Select the M41T62 device
29 @@ -1457,14 +1459,22 @@ Params: abx80x Select o
31 pcf2129 Select the PCF2129 device
33 + pcf85063 Select the PCF85063 device
35 + pcf85063a Select the PCF85063A device
37 pcf8523 Select the PCF8523 device
39 + pcf85363 Select the PCF85363 device
41 pcf8563 Select the PCF8563 device
43 rv1805 Select the Micro Crystal RV1805 device
45 rv3028 Select the Micro Crystal RV3028 device
47 + sd3078 Select the ZXW Shenzhen whwave SD3078 device
49 addr Sets the address for the RTC. Note that the
50 device must be configured to use the specified
53 +++ b/arch/arm/boot/dts/overlays/i2c-rtc-common.dtsi
55 +// Definitions for several I2C based Real Time Clocks
58 + compatible = "brcm,bcm2835";
63 + #address-cells = <1>;
67 + compatible = "abracon,abx80x";
69 + abracon,tc-diode = "standard";
70 + abracon,tc-resistor = <0>;
78 + #address-cells = <1>;
82 + compatible = "dallas,ds1307";
91 + #address-cells = <1>;
95 + compatible = "dallas,ds1339";
96 + trickle-resistor-ohms = <0>;
103 + target = <&i2cbus>;
105 + #address-cells = <1>;
108 + ds3231: ds3231@68 {
109 + compatible = "maxim,ds3231";
116 + target = <&i2cbus>;
118 + #address-cells = <1>;
121 + mcp7940x: mcp7940x@6f {
122 + compatible = "microchip,mcp7940x";
129 + target = <&i2cbus>;
131 + #address-cells = <1>;
134 + mcp7941x: mcp7941x@6f {
135 + compatible = "microchip,mcp7941x";
142 + target = <&i2cbus>;
144 + #address-cells = <1>;
148 + compatible = "nxp,pcf2127";
155 + target = <&i2cbus>;
157 + #address-cells = <1>;
160 + pcf8523: pcf8523@68 {
161 + compatible = "nxp,pcf8523";
168 + target = <&i2cbus>;
170 + #address-cells = <1>;
173 + pcf8563: pcf8563@51 {
174 + compatible = "nxp,pcf8563";
181 + target = <&i2cbus>;
183 + #address-cells = <1>;
186 + m41t62: m41t62@68 {
187 + compatible = "st,m41t62";
194 + target = <&i2cbus>;
196 + #address-cells = <1>;
199 + rv3028: rv3028@52 {
200 + compatible = "microcrystal,rv3028";
207 + target = <&i2cbus>;
209 + #address-cells = <1>;
213 + compatible = "nxp,pcf2129";
220 + target = <&i2cbus>;
222 + #address-cells = <1>;
226 + compatible = "nxp,pcf85363";
233 + target = <&i2cbus>;
235 + #address-cells = <1>;
238 + rv1805: rv1805@69 {
239 + compatible = "microcrystal,rv1805";
241 + abracon,tc-diode = "standard";
242 + abracon,tc-resistor = <0>;
248 + target = <&i2cbus>;
250 + #address-cells = <1>;
253 + sd3078: sd3078@32 {
254 + compatible = "whwave,sd3078";
261 + target = <&i2cbus>;
263 + #address-cells = <1>;
267 + compatible = "nxp,pcf85063";
274 + target = <&i2cbus>;
276 + #address-cells = <1>;
280 + compatible = "nxp,pcf85063a";
287 + target = <&i2cbus>;
289 + #address-cells = <1>;
292 + ds1340: ds1340@68 {
293 + compatible = "dallas,ds1340";
294 + trickle-resistor-ohms = <0>;
304 + ds1340 = <0>,"+17";
306 + mcp7940x = <0>,"+4";
307 + mcp7941x = <0>,"+5";
308 + pcf2127 = <0>,"+6";
309 + pcf8523 = <0>,"+7";
310 + pcf8563 = <0>,"+8";
312 + rv3028 = <0>,"+10";
313 + pcf2129 = <0>,"+11";
314 + pcf85363 = <0>,"+12";
315 + rv1805 = <0>,"+13";
316 + sd3078 = <0>,"+14";
317 + pcf85063 = <0>,"+15";
318 + pcf85063a = <0>,"+16";
320 + addr = <&abx80x>, "reg:0",
321 + <&ds1307>, "reg:0",
322 + <&ds1339>, "reg:0",
323 + <&ds3231>, "reg:0",
324 + <&mcp7940x>, "reg:0",
325 + <&mcp7941x>, "reg:0",
326 + <&pcf8523>, "reg:0",
327 + <&pcf8563>, "reg:0",
328 + <&m41t62>, "reg:0",
329 + <&rv1805>, "reg:0";
330 + trickle-diode-type = <&abx80x>,"abracon,tc-diode",
331 + <&rv1805>,"abracon,tc-diode";
332 + trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0",
333 + <&ds1340>,"trickle-resistor-ohms:0",
334 + <&abx80x>,"abracon,tc-resistor:0",
335 + <&rv3028>,"trickle-resistor-ohms:0",
336 + <&rv1805>,"abracon,tc-resistor:0";
337 + backup-switchover-mode = <&rv3028>,"backup-switchover-mode:0";
338 + wakeup-source = <&ds1339>,"wakeup-source?",
339 + <&ds3231>,"wakeup-source?",
340 + <&mcp7940x>,"wakeup-source?",
341 + <&mcp7941x>,"wakeup-source?",
342 + <&m41t62>,"wakeup-source?";
345 --- a/arch/arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts
346 +++ b/arch/arm/boot/dts/overlays/i2c-rtc-gpio-overlay.dts
349 #include <dt-bindings/gpio/gpio.h>
352 - compatible = "brcm,bcm2835";
353 +#include "i2c-rtc-common.dtsi"
360 - i2c_gpio: i2c-gpio-rtc@0 {
361 + i2cbus: i2c-gpio-rtc@0 {
362 compatible = "i2c-gpio";
363 gpios = <&gpio 23 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN) /* sda */
364 &gpio 24 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN) /* scl */
370 - target = <&i2c_gpio>;
372 - #address-cells = <1>;
376 - abx80x: abx80x@69 {
377 - compatible = "abracon,abx80x";
379 - abracon,tc-diode = "standard";
380 - abracon,tc-resistor = <0>;
387 - target = <&i2c_gpio>;
389 - #address-cells = <1>;
393 - ds1307: ds1307@68 {
394 - compatible = "dallas,ds1307";
402 - target = <&i2c_gpio>;
404 - #address-cells = <1>;
408 - ds1339: ds1339@68 {
409 - compatible = "dallas,ds1339";
410 - trickle-resistor-ohms = <0>;
418 - target = <&i2c_gpio>;
420 - #address-cells = <1>;
424 - ds3231: ds3231@68 {
425 - compatible = "maxim,ds3231";
433 - target = <&i2c_gpio>;
435 - #address-cells = <1>;
439 - mcp7940x: mcp7940x@6f {
440 - compatible = "microchip,mcp7940x";
448 - target = <&i2c_gpio>;
450 - #address-cells = <1>;
454 - mcp7941x: mcp7941x@6f {
455 - compatible = "microchip,mcp7941x";
463 - target = <&i2c_gpio>;
465 - #address-cells = <1>;
470 - compatible = "nxp,pcf2127";
478 - target = <&i2c_gpio>;
480 - #address-cells = <1>;
484 - pcf8523: pcf8523@68 {
485 - compatible = "nxp,pcf8523";
493 - target = <&i2c_gpio>;
495 - #address-cells = <1>;
499 - pcf8563: pcf8563@51 {
500 - compatible = "nxp,pcf8563";
508 - target = <&i2c_arm>;
510 - #address-cells = <1>;
514 - m41t62: m41t62@68 {
515 - compatible = "st,m41t62";
523 - target = <&i2c_gpio>;
525 - #address-cells = <1>;
529 - rv3028: rv3028@52 {
530 - compatible = "microcrystal,rv3028";
538 - target = <&i2c_gpio>;
540 - #address-cells = <1>;
545 - compatible = "nxp,pcf2129";
553 - target = <&i2c_gpio>;
555 - #address-cells = <1>;
559 - rv1805: rv1805@69 {
560 - compatible = "microcrystal,rv1805";
562 - abracon,tc-diode = "standard";
563 - abracon,tc-resistor = <0>;
574 - mcp7940x = <0>,"+5";
575 - mcp7941x = <0>,"+6";
576 - pcf2127 = <0>,"+7";
577 - pcf8523 = <0>,"+8";
578 - pcf8563 = <0>,"+9";
579 - m41t62 = <0>,"+10";
580 - rv3028 = <0>,"+11";
581 - pcf2129 = <0>,"+12";
582 - rv1805 = <0>,"+13";
584 - addr = <&abx80x>, "reg:0",
585 - <&ds1307>, "reg:0",
586 - <&ds1339>, "reg:0",
587 - <&ds3231>, "reg:0",
588 - <&mcp7940x>, "reg:0",
589 - <&mcp7941x>, "reg:0",
590 - <&pcf8523>, "reg:0",
591 - <&pcf8563>, "reg:0",
592 - <&m41t62>, "reg:0",
593 - <&rv1805>, "reg:0";
594 - trickle-diode-type = <&abx80x>,"abracon,tc-diode",
595 - <&rv1805>,"abracon,tc-diode";
596 - trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0",
597 - <&abx80x>,"abracon,tc-resistor:0",
598 - <&rv3028>,"trickle-resistor-ohms:0",
599 - <&rv1805>,"abracon,tc-resistor:0";
600 - backup-switchover-mode = <&rv3028>,"backup-switchover-mode:0";
601 - wakeup-source = <&ds1339>,"wakeup-source?",
602 - <&ds3231>,"wakeup-source?",
603 - <&mcp7940x>,"wakeup-source?",
604 - <&mcp7941x>,"wakeup-source?";
605 - i2c_gpio_sda = <&i2c_gpio>,"gpios:4";
606 - i2c_gpio_scl = <&i2c_gpio>,"gpios:16";
607 - i2c_gpio_delay_us = <&i2c_gpio>,"i2c-gpio,delay-us:0";
608 + i2c_gpio_sda = <&i2cbus>,"gpios:4";
609 + i2c_gpio_scl = <&i2cbus>,"gpios:16";
610 + i2c_gpio_delay_us = <&i2cbus>,"i2c-gpio,delay-us:0";
613 --- a/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts
614 +++ b/arch/arm/boot/dts/overlays/i2c-rtc-overlay.dts
620 - compatible = "brcm,bcm2835";
623 - target = <&i2cbus>;
625 - #address-cells = <1>;
628 - abx80x: abx80x@69 {
629 - compatible = "abracon,abx80x";
631 - abracon,tc-diode = "standard";
632 - abracon,tc-resistor = <0>;
638 - target = <&i2cbus>;
640 - #address-cells = <1>;
643 - ds1307: ds1307@68 {
644 - compatible = "dallas,ds1307";
651 - target = <&i2cbus>;
653 - #address-cells = <1>;
656 - ds1339: ds1339@68 {
657 - compatible = "dallas,ds1339";
658 - trickle-resistor-ohms = <0>;
665 - target = <&i2cbus>;
667 - #address-cells = <1>;
670 - ds3231: ds3231@68 {
671 - compatible = "maxim,ds3231";
678 - target = <&i2cbus>;
680 - #address-cells = <1>;
683 - mcp7940x: mcp7940x@6f {
684 - compatible = "microchip,mcp7940x";
691 - target = <&i2cbus>;
693 - #address-cells = <1>;
696 - mcp7941x: mcp7941x@6f {
697 - compatible = "microchip,mcp7941x";
704 - target = <&i2cbus>;
706 - #address-cells = <1>;
710 - compatible = "nxp,pcf2127";
717 - target = <&i2cbus>;
719 - #address-cells = <1>;
722 - pcf8523: pcf8523@68 {
723 - compatible = "nxp,pcf8523";
730 - target = <&i2cbus>;
732 - #address-cells = <1>;
735 - pcf8563: pcf8563@51 {
736 - compatible = "nxp,pcf8563";
743 - target = <&i2cbus>;
745 - #address-cells = <1>;
748 - m41t62: m41t62@68 {
749 - compatible = "st,m41t62";
756 - target = <&i2cbus>;
758 - #address-cells = <1>;
761 - rv3028: rv3028@52 {
762 - compatible = "microcrystal,rv3028";
769 - target = <&i2cbus>;
771 - #address-cells = <1>;
775 - compatible = "nxp,pcf2129";
782 - target = <&i2cbus>;
784 - #address-cells = <1>;
788 - compatible = "nxp,pcf85363";
795 - target = <&i2cbus>;
797 - #address-cells = <1>;
800 - rv1805: rv1805@69 {
801 - compatible = "microcrystal,rv1805";
803 - abracon,tc-diode = "standard";
804 - abracon,tc-resistor = <0>;
810 - target = <&i2cbus>;
812 - #address-cells = <1>;
815 - sd3078: sd3078@32 {
816 - compatible = "whwave,sd3078";
823 - target = <&i2cbus>;
825 - #address-cells = <1>;
829 - compatible = "nxp,pcf85063";
836 - target = <&i2cbus>;
838 - #address-cells = <1>;
842 - compatible = "nxp,pcf85063a";
849 - target = <&i2cbus>;
851 - #address-cells = <1>;
854 - ds1340: ds1340@68 {
855 - compatible = "dallas,ds1340";
856 - trickle-resistor-ohms = <0>;
861 +#include "i2c-rtc-common.dtsi"
864 frag100: fragment@100 {
866 i2cbus: __overlay__ {
874 - ds1340 = <0>,"+17";
876 - mcp7940x = <0>,"+4";
877 - mcp7941x = <0>,"+5";
878 - pcf2127 = <0>,"+6";
879 - pcf8523 = <0>,"+7";
880 - pcf8563 = <0>,"+8";
882 - rv3028 = <0>,"+10";
883 - pcf2129 = <0>,"+11";
884 - pcf85363 = <0>,"+12";
885 - rv1805 = <0>,"+13";
886 - sd3078 = <0>,"+14";
887 - pcf85063 = <0>,"+15";
888 - pcf85063a = <0>,"+16";
890 i2c0 = <&frag100>, "target:0=",<&i2c0>;
891 i2c_csi_dsi = <&frag100>, "target:0=",<&i2c_csi_dsi>,
894 - addr = <&abx80x>, "reg:0",
895 - <&ds1307>, "reg:0",
896 - <&ds1339>, "reg:0",
897 - <&ds3231>, "reg:0",
898 - <&mcp7940x>, "reg:0",
899 - <&mcp7941x>, "reg:0",
900 - <&pcf8523>, "reg:0",
901 - <&pcf8563>, "reg:0",
902 - <&m41t62>, "reg:0",
903 - <&rv1805>, "reg:0";
904 - trickle-diode-type = <&abx80x>,"abracon,tc-diode",
905 - <&rv1805>,"abracon,tc-diode";
906 - trickle-resistor-ohms = <&ds1339>,"trickle-resistor-ohms:0",
907 - <&ds1340>,"trickle-resistor-ohms:0",
908 - <&abx80x>,"abracon,tc-resistor:0",
909 - <&rv3028>,"trickle-resistor-ohms:0",
910 - <&rv1805>,"abracon,tc-resistor:0";
911 - backup-switchover-mode = <&rv3028>,"backup-switchover-mode:0";
912 - wakeup-source = <&ds1339>,"wakeup-source?",
913 - <&ds3231>,"wakeup-source?",
914 - <&mcp7940x>,"wakeup-source?",
915 - <&mcp7941x>,"wakeup-source?",
916 - <&m41t62>,"wakeup-source?";