Message ID | 1451927075-8656-1-git-send-email-s.trumtrar@pengutronix.de |
---|---|
State | Not Applicable, archived |
Headers | show |
On 04/01/2016 at 18:04:34 +0100, Steffen Trumtrar wrote : > Add the binding documentation for the Epson RX6110 RTC. > > Acked-by: Rob Herring <robh@kernel.org> > Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> > Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> > --- > > .../devicetree/bindings/rtc/epson,rx6110.txt | 39 ++++++++++++++++++++++ > 1 file changed, 39 insertions(+) > create mode 100644 Documentation/devicetree/bindings/rtc/epson,rx6110.txt > Applied, thanks.
On 04/01/2016 at 18:04:35 +0100, Steffen Trumtrar wrote : > The RX6110 comes in two different variants: SPI and I2C. > This driver only supports the SPI variant. > > If the need ever arises to also support the I2C variant, this driver > could easily be refactored to support both cases. > > Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> > Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> > --- > > Changes since v3: > - remove old copyright infos > - use the BIT() macro > - replace rx6110_get_week_day() with ffs() > - replace hardcoded offsets with enum > - use regmap_bulk_write in set_time > - use regmap_register_patch in init function > - return -EINVAL instead of "fixing" time in the rtc > > drivers/rtc/Kconfig | 9 ++ > drivers/rtc/Makefile | 1 + > drivers/rtc/rtc-rx6110.c | 402 +++++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 412 insertions(+) > create mode 100644 drivers/rtc/rtc-rx6110.c > Applied, after realigning some lines in rx6110_probe(). Thanks!
On Sun, Jan 31, 2016 at 12:54:57PM +0100, Alexandre Belloni wrote: > On 04/01/2016 at 18:04:35 +0100, Steffen Trumtrar wrote : > > The RX6110 comes in two different variants: SPI and I2C. > > This driver only supports the SPI variant. > > > > If the need ever arises to also support the I2C variant, this driver > > could easily be refactored to support both cases. > > > > Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> > > Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> > > --- > > > > Changes since v3: > > - remove old copyright infos > > - use the BIT() macro > > - replace rx6110_get_week_day() with ffs() > > - replace hardcoded offsets with enum > > - use regmap_bulk_write in set_time > > - use regmap_register_patch in init function > > - return -EINVAL instead of "fixing" time in the rtc > > > > drivers/rtc/Kconfig | 9 ++ > > drivers/rtc/Makefile | 1 + > > drivers/rtc/rtc-rx6110.c | 402 +++++++++++++++++++++++++++++++++++++++++++++++ > > 3 files changed, 412 insertions(+) > > create mode 100644 drivers/rtc/rtc-rx6110.c > > > Applied, after realigning some lines in rx6110_probe(). > Thanks :-) Regards, Steffen
Hi, On 03/03/2016 at 03:58:45 -0800, cvs268@gmail.com wrote : > > > > > > If the need ever arises to also support the I2C variant, this driver > > > > could easily be refactored to support both cases. > > > I will soon be getting an embedded board with this RX6110 RTC on it > connected via I2C. > So i would like to take-up the task of adding I2C support in a few weeks. > > A quick search shows drivers/rtc/rtc-rx4581.c was similarly written based > on drivers/rtc/rtc-rx8581.c > > Q. Should i proceed to create drivers/rtc/rtc-rx6110-i2c.c or whats the > recommended approach? > I did not find any RTC driver that supports both i2c and spi (eg. depending > upon some config option) > You can have a look at sound/soc/codecs/wm8750.c which register one driver for both i2c and spi. It is simple enough and you should be able to do the same. Obviously, a new category will be needed in the Kconfig to handle RTC that are both spi and i2c with the same part number.
diff --git a/Documentation/devicetree/bindings/rtc/epson,rx6110.txt b/Documentation/devicetree/bindings/rtc/epson,rx6110.txt new file mode 100644 index 000000000000..3dc313e01f77 --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/epson,rx6110.txt @@ -0,0 +1,39 @@ +Epson RX6110 Real Time Clock +============================ + +The Epson RX6110 can be used with SPI or I2C busses. The kind of +bus depends on the SPISEL pin and can not be configured via software. + +I2C mode +-------- + +Required properties: + - compatible: should be: "epson,rx6110" + - reg : the I2C address of the device for I2C + +Example: + + rtc: rtc@32 { + compatible = "epson,rx6110" + reg = <0x32>; + }; + +SPI mode +-------- + +Required properties: + - compatible: should be: "epson,rx6110" + - reg: chip select number + - spi-cs-high: RX6110 needs chipselect high + - spi-cpha: RX6110 works with SPI shifted clock phase + - spi-cpol: RX6110 works with SPI inverse clock polarity + +Example: + + rtc: rtc@3 { + compatible = "epson,rx6110" + reg = <3> + spi-cs-high; + spi-cpha; + spi-cpol; + };