Thread (7 messages) 7 messages, 3 authors, 2016-03-28

[rtc-linux] Re: [PATCH v6] rtc: rewrite DS1302 using SPI

From: Rob Herring <robh@kernel.org>
Date: 2016-02-22 18:45:22
Also in: linux-devicetree, lkml

On Mon, Feb 22, 2016 at 04:41:22AM +0300, Sergei Ianovich wrote:
quoted hunk ↗ jump to hunk
DS1302 is half-duplex SPI device. The driver respects this fact now.

Pin configurations should be implemented using SPI subsystem.

Signed-off-by: Sergei Ianovich <redacted>
CC: Alexandre Belloni <redacted>
CC: Rob Herring <robh@kernel.org>
---
   v5..v6
   * rewrite the driver as an SPI slave device
   * use "maxim" for vendor name per Kconfig
   * stop touching device RAM in device presence test
   * only return time from device if valid
   * use burst mode for reading/writing time
   * droppped charging control. I cannot test it, and it looks broken

   v4..v5
   * drop THIS_MODULE from struct platform driver
   * use "dallas" for vendor name per vendor-prefixes.txt

   v3..v4
   * move DTS bindings to a different patch

   v2..v3
   * use usleep_range instead of custom nsleep
   * number change (07/16 -> 09/21)

   v0..v2
   * use device tree
   * use devm helpers where possible

 .../devicetree/bindings/rtc/rtc-ds1302.txt         |  46 +++
 drivers/rtc/Kconfig                                |  15 +-
 drivers/rtc/rtc-ds1302.c                           | 348 ++++++++++-----------
 3 files changed, 212 insertions(+), 197 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-ds1302.txt
diff --git a/Documentation/devicetree/bindings/rtc/rtc-ds1302.txt b/Documentation/devicetree/bindings/rtc/rtc-ds1302.txt
new file mode 100644
index 0000000..b6c0973
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/rtc-ds1302.txt
@@ -0,0 +1,46 @@
+* Maxim/Dallas Semiconductor DS-1302 RTC
+
+Simple device which could be used to store date/time between reboots.
+
+The device uses the standard MicroWire half-duplex transfer timing.
+Master output is set on low clock and sensed by the RTC on the rising
+edge. Master input is set by the RTC on the trailing edge and is sensed
+by the master on low clock.
+
+Required properties:
+
+- compatible : Should be "maxim,rtc-ds1302"
Just maxim,ds1032. RTC is implied by the part number and inline with 
existing dallas,ds1307.
+
+Required SPI properties:
+
+- reg : Should be address of the device chip select within
+  the controller.
+
+- spi-max-frequency : DS-1302 has 500 kHz if powered at 2.2V,
+  and 2MHz if powered at 5V.
+
+- spi-3wire : The device has a shared signal IN/OUT line.
+
+- spi-lsb-first : DS-1302 requires least significant bit first
+  transfers.
+
+- spi-cs-high: DS-1302 has active high chip select line. This is
+  required unless inverted in hardware.
+
+Example:
+
+spi0@901c {
spi@...
+	#address-cells = <1>;
+	#size-cells = <0>;
+	compatible = "icpdas,spi-lp8841-rtc";
And this will need updating...
+	reg = <0x901c 0x1>;
+
+	rtc@0 {
+		compatible = "maxim,rtc-ds1302";
+		reg = <0>;
+		spi-max-frequency = <500000>;
+		spi-3wire;
+		spi-lsb-first;
+		spi-cs-high;
+	};
+};
-- 
-- 
You received this message because you are subscribed to "rtc-linux".
Membership options at http://groups.google.com/group/rtc-linux .
Please read http://groups.google.com/group/rtc-linux/web/checklist
before submitting a driver.
--- 
You received this message because you are subscribed to the Google Groups "rtc-linux" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rtc-linux+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help