Re: [PATCH v5] rtc: support DS1302 RTC on ICP DAS LP-8x4x

From: Sergei Ianovich
Date: Sun Dec 20 2015 - 07:14:58 EST


On Sat, 2015-12-19 at 21:38 -0600, Rob Herring wrote:
> On Tue, Dec 15, 2015 at 08:45:23PM +0300, Sergei Ianovich wrote:
>
> Nothing in this is specific to ICP, so the subject should be updated.
>
> > Signed-off-by: Sergei Ianovich <ynvich@xxxxxxxxx>
> > CC: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxxxxxxxxx>
> > ---
> > ÂÂÂ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ÂÂÂÂÂÂÂÂÂ|ÂÂ14 +++
> > Âdrivers/rtc/KconfigÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂÂ2 +-
> > Âdrivers/rtc/rtc-ds1302.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 100
> > ++++++++++++++++++++-
> > Â3 files changed, 113 insertions(+), 3 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..810613b
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/rtc/rtc-ds1302.txt
> > @@ -0,0 +1,14 @@
> > +* Dallas Semiconductor DS-1302 RTC
> > +
> > +Simple device which could be used to store date/time between
> > reboots.
> > +
> > +Required properties:
> > +- compatible : Should be "dallas,rtc-ds1302"
> > +- reg : Should be address and size of IO memory region
>
> This device is a SPI (or SPI like?) interface. So you have some sort
> of
> of FPGA logic in between the cpu and ds1302. The DT should have a node
> for the controller and then the ds1302 as a child of it. A full blown
> SPI driver may be overkill here, but that's a separate discussion from
> the DT binding.

Below is the quote from the actual DT of LP-8x4x:
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂfpga@5 {
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcompatible = "simple-bus";
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ#address-cells = <1>;
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ#size-cells = <1>;
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂranges = <0 5 0x3000000 0x10000>;
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂinterrupt-parent = <&fpgairq>;
>
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂrtc@901c {
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcompatible = "dallas,rtc-ds1302";
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreg = <0x901c 0x1>;
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂstatus = "okay";
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ};

You are right about the topology. ds1302 is a half-duplex SPI device.
Does this mean I should rewrite the driver to handle the chip as a slave
SPI device, and then provide a master SPI functionality at the FPGA?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/