summaryrefslogtreecommitdiff
path: root/src/arm/BB-I2C2-RTC-DS1338.dts
blob: 8d4f06fb35fd2a65d7d38e8a10b7204b36d268b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
 * Copyright (C) 2018 Tim Small <tim@seoss.co.uk>
 *
 * Based on PB-I2C2-RTC-PCF8523.dts:
 * 
 * Copyright (C) 2018 Robert Nelson <robertcnelson@gmail.com>
 *
 * 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 overlay is for a Maxim (Dallas) DS1338 RTC connected via the
 * BeagleBone's second I2C bus.
 * https://www.maximintegrated.com/en/products/digital/real-time-clocks/DS1338.html
 * 
 * It was built for the South Coast Science "DFE" air quality monitoring
 * cape, but may be useful for any hardware which includes a DS1338
 *
 * https://www.southcoastscience.com/products/
 *
 * https://github.com/south-coast-science/scs_documentation/wiki/Digital-Front-End-%28DFE%29-for-BeagleBone-v1
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/board/am335x-bbw-bbb-base.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/am33xx.h>

/ {
	/*
	 * Helper to show loaded overlays under: /proc/device-tree/chosen/overlays/
	 */
	fragment@0 {
		target-path="/";
		__overlay__ {

			chosen {
				overlays {
					BB-I2C2-RTC-DS1338 = __TIMESTAMP__;
				};
			};
		};
	};

	fragment@1 {
		target-path="/";
		__overlay__ {
			aliases {
				rtc0 = &extrtc;
				/* The OMAP RTC implementation in the BBB is
				 * buggy, so that it cannot be used as a
				 * battery-backed RTS, so that it loses its
				 * contents when power is removed from the
				 * Beaglebone...
				 *
				 * We move the omap built-in RTC to rtc1, so
				 * that userspace defaults to using the DS1338.
				 *
				 * The omap RTC must remain enabled because it
				 * is also used during the reboot process on the
				 * BBB.
				 */
				rtc1 = "/ocp/rtc@44e3e000";
			};
		};
	};

	fragment@2 {
		target = <&i2c2>;
		__overlay__ {
			status = "okay";

			#address-cells = <1>;
			#size-cells = <0>;

			extrtc: ds1338@68 {
				compatible = "maxim,ds1338";
				reg = <0x68>; /* DS1338 has a fixed I2C addr */
			};
		};
	};
};