spi: master driver to enable RTC on ICPDAS LP-8841
Subsystems (2)
PATCH 1/1 spi: master driver to enable RTC on ICPDAS LP-8841
ICP DAS LP-8841 contains a DS-1302 RTC. This driver provides an SPI master which makes the RTC usable. The driver is not supposed to work with anything else.
The driver 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.
--- .../devicetree/bindings/spi/spi-lp8841-rtc.txt | 55 +++++ drivers/spi/Kconfig | 10 + drivers/spi/Makefile | 1 + drivers/spi/spi-lp8841-rtc.c | 272 +++++++++++++++++++++ 4 files changed, 338 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt create mode 100644 drivers/spi/spi-lp8841-rtc.c
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt new file +55 -0
@@ -0,0 +1,55 @@ +* ICP DAS LP-8841 SPI Controller for RTC + +ICP DAS LP-8841 contains a DS-1302 RTC. This driver provides an SPI +master which makes the RTC usable. The driver is not supposed to work +with anything else. + +The driver 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: + +- #address-cells: should be 1 + +- #size-cells: should be 0 + +- compatible: should be "icpdas,spi-lp8841-rtc" + +- reg: should provide IO memory address + +Requirements to SPI slave nodes: + +- There can be only one slave device. + +- The spi slave node should claim the following flags which are + required by the spi controller. + + - spi-3wire: The master itself has only 3 wire. It cannor work in + full duplex mode. + + - spi-cs-high: DS-1302 has active high chip select line. The master + doesn't support active low. + + - spi-lsb-first: DS-1302 requires least significant bit first + transfers. The master only support this type of bit ordering. + + +Example: + +spi0@901c { + #address-cells = <1>; + #size-cells = <0>; + compatible = "icpdas,spi-lp8841-rtc"; + reg = <0x901c 0x1>; + + rtc@0 { + compatible = "maxim,rtc-ds1302"; + reg = <0>; + spi-max-frequency = <500000>; + spi-3wire; + spi-lsb-first; + spi-cs-high; + }; +};
drivers/spi/Kconfig +10 -0
@@ -271,6 +271,16 @@ config SPI_LM70_LLP which interfaces to an LM70 temperature sensor using a parallel port. +config SPI_LP8841_RTC + tristate "ICP DAS LP-8841 SPI Controller for RTC" + depends on OF && (MACH_PXA27X_DT || COMPILE_TEST) + help + This driver provides an SPI master device to drive Maxim + DS-1302 real time clock. + + Say N here unless you plan to run the kernel on an ICP DAS + LP-8x4x industrial computer. + config SPI_MPC52xx tristate "Freescale MPC52xx SPI (non-PSC) controller support" depends on PPC_MPC52xx
drivers/spi/Makefile +1 -0
@@ -46,6 +46,7 @@ obj-$(CONFIG_SPI_GPIO) += spi-gpio.o obj-$(CONFIG_SPI_IMG_SPFI) += spi-img-spfi.o obj-$(CONFIG_SPI_IMX) += spi-imx.o obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o +obj-$(CONFIG_SPI_LP8841_RTC) += spi-lp8841-rtc.o obj-$(CONFIG_SPI_MESON_SPIFC) += spi-meson-spifc.o obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o
drivers/spi/spi-lp8841-rtc.c new file +272 -0
272 lines not on this page · raw message
Signature · 1 line
2.6.3
Mark Brown
maintainerQuoted 3 lines · Sergei Ianovich
ICP DAS LP-8841 contains a DS-1302 RTC. This driver provides an SPI master which makes the RTC usable. The driver is not supposed to work with anything else.
So this is something that is internal to a single chip or something? I'm slightly unclear from the above if this is or is not a SPI controller. If it isn't generic the DT should probably just describe the IP and let the driver create the SPI controller and device if that is an expedient way of doing things.
Quoted 5 lines
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt new file +5
-0+spi0@901c { + #address-cells = <1>; + #size-cells = <0>; + compatible = "icpdas,spi-lp8841-rtc"; + reg = <0x901c 0x1>;
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt line 55
Quoted 10 lines
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt new file +10
-0+ + rtc@0 { + compatible = "maxim,rtc-ds1302"; + reg = <0>; + spi-max-frequency = <500000>; + spi-3wire; + spi-lsb-first; + spi-cs-high; + }; +};
This example makes it seem like an actual SPI controller but just one that's broken/limited?
drivers/spi/Kconfig config SPI_LM70_LLP · line 276
Quoted 3 lines
drivers/spi/Kconfig +3
-0+config SPI_LP8841_RTC + tristate "ICP DAS LP-8841 SPI Controller for RTC" + depends on OF && (MACH_PXA27X_DT || COMPILE_TEST)
Does this need a strict DT dependency or can it build without DT?
Quoted 5 lines
+/*
+ * REVISIT If there is support forSPI_3WIREandSPI_LSB_FIRSTin SPI
+ * GPIO driver, this SPI driver can be replaced by a simple GPIO driver
+ * providing 3 GPIO pins.
+ */
What's the advantage of not doing that? Overall the driver looks fairly good but it does seem to just implement a straight bitbanging driver with less flexibility.
drivers/spi/spi-lp8841-rtc.c line 49
Quoted 3 lines
drivers/spi/spi-lp8841-rtc.c new file +3
-0+#ifndef DRIVER_NAME +#define DRIVER_NAME "spi_lp8841_rtc" +#endif
If you want to use a define for this just use a define for it, don't do this ifdef stuff.
drivers/spi/spi-lp8841-rtc.c line 81
Quoted 5 lines
drivers/spi/spi-lp8841-rtc.c new file +5
-0+static inline void +spidelay (unsigned usec) +{ +usleep_range (usec, usec +1 ); +}
Just use usleep_range() directly.
drivers/spi/spi-lp8841-rtc.c line 193
Quoted 4 lines
drivers/spi/spi-lp8841-rtc.c new file +4
-0+static void +spi_lp8841_rtc_cleanup (struct spi_device *spi) +{ +}
Remove empty functions, if they can be empty the core will support ignoring them if they are missing.
Quoted 23 lines · Mark Brown
Quoted 4 lines · Sergei Ianovich
ICP DAS LP-8841 contains a DS-1302 RTC. This driver provides an SPI master which makes the RTC usable. The driver is not supposed to work
with anything else.So this is something that is internal to a single chip or something? I'm slightly unclear from the above if this is or is not a SPI controller. If it isn't generic the DT should probably just describe the IP and let the driver create the SPI controller and device if that
is an expedient way of doing things.Quoted 10 lines
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt new file +10
-0+spi0@901c { + #address-cells = <1>; + #size-cells = <0>; + compatible = "icpdas,spi-lp8841-rtc"; + reg = <0x901c 0x1>; + + rtc@0 { + compatible = "maxim,rtc-ds1302"; + reg = <0>; + spi-max-frequency = <500000>;
Quoted 8 lines
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt line 55
Quoted 5 lines
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt new file +5
-0+ spi-3wire; + spi-lsb-first; + spi-cs-high; + }; +};This example makes it seem like an actual SPI controller but just one that's broken/limited?
Yes. This is an actual SPI controller with minimal required functionality. I didn't implement anything I don't need.
Quoted 5 lines
drivers/spi/Kconfig config SPI_LM70_LLP · line 276
Quoted 3 lines
drivers/spi/Kconfig +3
-0+config SPI_LP8841_RTC + tristate "ICP DAS LP-8841 SPI Controller for RTC" + depends on OF && (MACH_PXA27X_DT || COMPILE_TEST)Does this need a strict DT dependency or can it build without DT?
The driver can only be useful on a single industrial PC. That PC requires DT, so I made this a strict dependency. The dependency can be removed by using ifdefs, but I see no point why.
Quoted 8 lines
Quoted 7 lines
+/*
+ * REVISIT If there is support forSPI_3WIREandSPI_LSB_FIRSTin SPI
+ * GPIO driver, this SPI driver can be replaced by a simple GPIO driver
+ * providing 3 GPIO pins.
+ */
Quoted 4 lines
What's the advantage of not doing that? Overall the driver looks fairly
good but it does seem to just implement a straight bitbanging driver with less flexibility.
MicroWire (SPI_3WIRE) mode is slightly different from the modes implemented in spi-bitbang-txrx.h. I was getting junk from device in both Mode0 and Mode2 until I changed the implementation. The change is documented in the patch.
There will also need to be changes in bitbang.c. SPI_LSB_FIRST will require a new flasg in txrx_word(). To keep overhead low will require to grow txrx_word[] from 4 to 16 or even 32. CPOL, CPHA, LSB_FIRST, 3_WIRE each requires an additional power of 2.
While this change could be benefitial to both spi-gpio and spi-bitbang, it is very big.
Quoted 7 lines
drivers/spi/spi-lp8841-rtc.c line 49
Quoted 3 lines
drivers/spi/spi-lp8841-rtc.c new file +3
-0+#ifndef DRIVER_NAME +#define DRIVER_NAME "spi_lp8841_rtc" +#endif If you want to use a define for this just use a define for it, don't do
this ifdef stuff.
Yes, I'll fix this. This has been blindly copied from spi-gpio.c.
Quoted 7 lines
drivers/spi/spi-lp8841-rtc.c line 81
Quoted 5 lines
drivers/spi/spi-lp8841-rtc.c new file +5
-0+static inline void +spidelay (unsigned usec) +{ +usleep_range (usec, usec +1 ); +}Just use
usleep_range()directly.
Yes, I will.
Quoted 7 lines
drivers/spi/spi-lp8841-rtc.c line 193
Quoted 4 lines
drivers/spi/spi-lp8841-rtc.c new file +4
-0+static void +spi_lp8841_rtc_cleanup (struct spi_device *spi) +{ +}Remove empty functions, if they can be empty the core will support ignoring them if they are missing.
Yes, I will.
Thanks for a lightning fast review.
Quoted 1 line
>
Mark Brown
maintainerQuoted 9 lines · Sergei Ianovich
Quoted 7 lines · Mark Brown
drivers/spi/Kconfig config SPI_LM70_LLP · line 276
Quoted 3 lines · Sergei Ianovich
drivers/spi/Kconfig +3
-0+config SPI_LP8841_RTC + tristate "ICP DAS LP-8841 SPI Controller for RTC" + depends on OF && (MACH_PXA27X_DT || COMPILE_TEST)Does this need a strict DT dependency or can it build without DT?
Quoted 3 lines
The driver can only be useful on a single industrial PC. That PC requires DT, so I made this a strict dependency. The dependency can be removed by using ifdefs, but I see no point why.
It makes it easier for anyone doing generic work on the kernel to build test, one could make exactly the same argument about the dependency on the PXA27x machine.
Quoted 18 lines
Quoted 8 lines
Quoted 7 lines
+/*
+ * REVISIT If there is support forSPI_3WIREandSPI_LSB_FIRSTin SPI
+ * GPIO driver, this SPI driver can be replaced by a simple GPIO driver
+ * providing 3 GPIO pins.
+ */Quoted 4 lines
What's the advantage of not doing that? Overall the driver looks fairly
good but it does seem to just implement a straight bitbanging driver with less flexibility.MicroWire (
SPI_3WIRE) mode is slightly different from the modes implemented in spi-bitbang-txrx.h. I was getting junk from device in both Mode0 and Mode2 until I changed the implementation. The change is documented in the patch.
Quoted 7 lines
There will also need to be changes in
bitbang.c.SPI_LSB_FIRSTwill require a new flasg intxrx_word(). To keep overhead low will require to grow txrx_word[] from 4 to 16 or even 32. CPOL, CPHA,LSB_FIRST, 3_WIRE each requires an additional power of 2.While this change could be benefitial to both spi-gpio and spi-bitbang, it is very big.
OK, the number of users is probably small enough that it's not worth worryinng about duplication.
PATCH v2 1/1 spi: master driver to enable RTC on ICPDAS LP-8841
In reply to Sergei IanovichICP DAS LP-8841 contains a DS-1302 RTC. This driver provides an SPI master which makes the RTC usable. The driver is not supposed to work with anything else.
The driver 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.
---
v1..v2 to fix Mark Brown review comments
* drop ifdef around MODULE_NAME
* use usleep_range directly
* drop empty master->cleanup
.../devicetree/bindings/spi/spi-lp8841-rtc.txt | 55 +++++ drivers/spi/Kconfig | 10 + drivers/spi/Makefile | 1 + drivers/spi/spi-lp8841-rtc.c | 258 +++++++++++++++++++++ 4 files changed, 324 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt create mode 100644 drivers/spi/spi-lp8841-rtc.c
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt new file +55 -0
@@ -0,0 +1,55 @@ +* ICP DAS LP-8841 SPI Controller for RTC + +ICP DAS LP-8841 contains a DS-1302 RTC. This driver provides an SPI +master which makes the RTC usable. The driver is not supposed to work +with anything else. + +The driver 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: + +- #address-cells: should be 1 + +- #size-cells: should be 0 + +- compatible: should be "icpdas,spi-lp8841-rtc" + +- reg: should provide IO memory address + +Requirements to SPI slave nodes: + +- There can be only one slave device. + +- The spi slave node should claim the following flags which are + required by the spi controller. + + - spi-3wire: The master itself has only 3 wire. It cannor work in + full duplex mode. + + - spi-cs-high: DS-1302 has active high chip select line. The master + doesn't support active low. + + - spi-lsb-first: DS-1302 requires least significant bit first + transfers. The master only support this type of bit ordering. + + +Example: + +spi0@901c { + #address-cells = <1>; + #size-cells = <0>; + compatible = "icpdas,spi-lp8841-rtc"; + reg = <0x901c 0x1>; + + rtc@0 { + compatible = "maxim,rtc-ds1302"; + reg = <0>; + spi-max-frequency = <500000>; + spi-3wire; + spi-lsb-first; + spi-cs-high; + }; +};
drivers/spi/Kconfig +10 -0
@@ -271,6 +271,16 @@ config SPI_LM70_LLP which interfaces to an LM70 temperature sensor using a parallel port. +config SPI_LP8841_RTC + tristate "ICP DAS LP-8841 SPI Controller for RTC" + depends on OF && (MACH_PXA27X_DT || COMPILE_TEST) + help + This driver provides an SPI master device to drive Maxim + DS-1302 real time clock. + + Say N here unless you plan to run the kernel on an ICP DAS + LP-8x4x industrial computer. + config SPI_MPC52xx tristate "Freescale MPC52xx SPI (non-PSC) controller support" depends on PPC_MPC52xx
drivers/spi/Makefile +1 -0
@@ -46,6 +46,7 @@ obj-$(CONFIG_SPI_GPIO) += spi-gpio.o obj-$(CONFIG_SPI_IMG_SPFI) += spi-img-spfi.o obj-$(CONFIG_SPI_IMX) += spi-imx.o obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o +obj-$(CONFIG_SPI_LP8841_RTC) += spi-lp8841-rtc.o obj-$(CONFIG_SPI_MESON_SPIFC) += spi-meson-spifc.o obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o
drivers/spi/spi-lp8841-rtc.c new file +258 -0
258 lines not on this page · raw message
Signature · 1 line
2.6.3
Mark Brown
maintainerQuoted 1 line · Sergei Ianovich
* drop empty
master->cleanup
You still have an empty remove() function.
PATCH v3 1/1 spi: master driver to enable RTC on ICPDAS LP-8841
In reply to Sergei IanovichICP DAS LP-8841 contains a DS-1302 RTC. This driver provides an SPI master which makes the RTC usable. The driver is not supposed to work with anything else.
The driver 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.
---
v2..v3 to fix Mark Brown review comments
* drop dependencies in Kconfig
* use #ifdef CONFIG_OF to allow build without DT
* drop empty driver->remove
v1..v2 to fix Mark Brown review comments
* drop ifdef around MODULE_NAME
* use usleep_range directly
* drop empty master->cleanup
.../devicetree/bindings/spi/spi-lp8841-rtc.txt | 55 +++++ drivers/spi/Kconfig | 9 + drivers/spi/Makefile | 1 + drivers/spi/spi-lp8841-rtc.c | 255 +++++++++++++++++++++ 4 files changed, 320 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt create mode 100644 drivers/spi/spi-lp8841-rtc.c
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt new file +55 -0
@@ -0,0 +1,55 @@ +* ICP DAS LP-8841 SPI Controller for RTC + +ICP DAS LP-8841 contains a DS-1302 RTC. This driver provides an SPI +master which makes the RTC usable. The driver is not supposed to work +with anything else. + +The driver 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: + +- #address-cells: should be 1 + +- #size-cells: should be 0 + +- compatible: should be "icpdas,spi-lp8841-rtc" + +- reg: should provide IO memory address + +Requirements to SPI slave nodes: + +- There can be only one slave device. + +- The spi slave node should claim the following flags which are + required by the spi controller. + + - spi-3wire: The master itself has only 3 wire. It cannor work in + full duplex mode. + + - spi-cs-high: DS-1302 has active high chip select line. The master + doesn't support active low. + + - spi-lsb-first: DS-1302 requires least significant bit first + transfers. The master only support this type of bit ordering. + + +Example: + +spi0@901c { + #address-cells = <1>; + #size-cells = <0>; + compatible = "icpdas,spi-lp8841-rtc"; + reg = <0x901c 0x1>; + + rtc@0 { + compatible = "maxim,rtc-ds1302"; + reg = <0>; + spi-max-frequency = <500000>; + spi-3wire; + spi-lsb-first; + spi-cs-high; + }; +};
drivers/spi/Kconfig +9 -0
@@ -271,6 +271,15 @@ config SPI_LM70_LLP which interfaces to an LM70 temperature sensor using a parallel port. +config SPI_LP8841_RTC + tristate "ICP DAS LP-8841 SPI Controller for RTC" + help + This driver provides an SPI master device to drive Maxim + DS-1302 real time clock. + + Say N here unless you plan to run the kernel on an ICP DAS + LP-8x4x industrial computer. + config SPI_MPC52xx tristate "Freescale MPC52xx SPI (non-PSC) controller support" depends on PPC_MPC52xx
drivers/spi/Makefile +1 -0
@@ -46,6 +46,7 @@ obj-$(CONFIG_SPI_GPIO) += spi-gpio.o obj-$(CONFIG_SPI_IMG_SPFI) += spi-img-spfi.o obj-$(CONFIG_SPI_IMX) += spi-imx.o obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o +obj-$(CONFIG_SPI_LP8841_RTC) += spi-lp8841-rtc.o obj-$(CONFIG_SPI_MESON_SPIFC) += spi-meson-spifc.o obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o
drivers/spi/spi-lp8841-rtc.c new file +255 -0
255 lines not on this page · raw message
Signature · 1 line
2.6.3
Mark Brown
maintainerOn Mon, Feb 22, 2016 at 02:57:42PM +0300, Sergei Ianovich wrote:
Please don't send new patches in the middle of old threads, it makes it hard to find what the current versions of things are.
Quoted 2 lines
v2..v3 to fix Mark Brown review comments
* drop dependencies inKconfig
No, what I was asking you to do was to change where the || COMPILE_TEST was grouped. It is good to hide things from users where they clearly can't use the driver, that's what COMPILE_TEST is for.
Rob Herring
maintainerQuoted 25 lines · Sergei Ianovich
ICP DAS LP-8841 contains a DS-1302 RTC. This driver provides an SPI master which makes the RTC usable. The driver is not supposed to work with anything else.
The driver 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.
Signed-off-by Sergei Ianovich <[email protected]>--- .../devicetree/bindings/spi/spi-lp8841-rtc.txt | 55 +++++ drivers/spi/Kconfig | 10 + drivers/spi/Makefile | 1 + drivers/spi/spi-lp8841-rtc.c | 272 +++++++++++++++++++++ 4 files changed, 338 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt create mode 100644 drivers/spi/spi-lp8841-rtc.cDocumentation/devicetree/bindings/spi/spi-lp8841-rtc.txt new file +0
-0
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt line 5
Quoted 5 lines
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt new file +5
-0@@ -0,0 +1,55 @@ +* ICP DAS LP-8841 SPI Controller for RTC + +ICP DAS LP-8841 contains a DS-1302 RTC. This driver provides an SPI +master which makes the RTC usable. The driver is not supposed to work +with anything else.
Bindings describe h/w not drivers.
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt line 18
Quoted 12 lines
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt new file +12
-0+The driver 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: + +- #address-cells: should be 1 + +- #size-cells: should be 0 + +- compatible: should be "icpdas,spi-lp8841-rtc"
icpdas,lp8841-spi-rtc would be more inline with naming conventions.
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt line 29
Quoted 11 lines
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt new file +11
-0+ +- reg: should provide IO memory address + +Requirements to SPI slave nodes: + +- There can be only one slave device. + +- The spi slave node should claim the following flags which are + required by the spi controller. + + - spi-3wire: The master itself has only 3 wire. It cannor work in
s/cannor/cannot/
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt line 41
Quoted 12 lines
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt new file +12
-0+ full duplex mode. + + - spi-cs-high: DS-1302 has active high chip select line. The master + doesn't support active low. + + - spi-lsb-first: DS-1302 requires least significant bit first + transfers. The master only support this type of bit ordering. + + +Example: + +spi0@901c {
spi@901c
Quoted 4 lines
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt new file +4
-0+ #address-cells = <1>; + #size-cells = <0>; + compatible = "icpdas,spi-lp8841-rtc"; + reg = <0x901c 0x1>;
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt line 55
Quoted 10 lines
Documentation/devicetree/bindings/spi/spi-lp8841-rtc.txt new file +10
-0+ + rtc@0 { + compatible = "maxim,rtc-ds1302"; + reg = <0>; + spi-max-frequency = <500000>; + spi-3wire; + spi-lsb-first; + spi-cs-high; + }; +};
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v4 1/1 spi: master driver to enable RTC on ICPDAS LP-8841
In reply to Sergei IanovichICP DAS LP-8841 contains a DS-1302 RTC. This driver provides an SPI master which makes the RTC usable. The driver is not supposed to work with anything else.
The driver 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.
v3..v4
fix Mark Brown review comments
* fix dependencies in Kconfig
fix Rob Herring review comments
* rewrite binding description
* change binding and doc file names
* fix typo
v2..v3 to fix Mark Brown review comments
* drop dependencies in Kconfig
* use #ifdef CONFIG_OF to allow build without DT
* drop empty driver->remove
v1..v2 to fix Mark Brown review comments
* drop ifdef around MODULE_NAME
* use usleep_range directly
* drop empty master->cleanup
--- .../bindings/spi/icpdas-lp8841-spi-rtc.txt | 54 +++++ drivers/spi/Kconfig | 10 + drivers/spi/Makefile | 1 + drivers/spi/spi-lp8841-rtc.c | 255 +++++++++++++++++++++ 4 files changed, 320 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/icpdas-lp8841-spi-rtc.txt create mode 100644 drivers/spi/spi-lp8841-rtc.c
Documentation/devicetree/bindings/spi/icpdas-lp8841-spi-rtc.txt new file +54 -0
@@ -0,0 +1,54 @@ +* ICP DAS LP-8841 SPI Controller for RTC + +ICP DAS LP-8841 contains a DS-1302 RTC. RTC is connected to an IO +memory register, which acts as an SPI master device. + +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: + +- #address-cells: should be 1 + +- #size-cells: should be 0 + +- compatible: should be "icpdas,lp8841-spi-rtc" + +- reg: should provide IO memory address + +Requirements to SPI slave nodes: + +- There can be only one slave device. + +- The spi slave node should claim the following flags which are + required by the spi controller. + + - spi-3wire: The master itself has only 3 wire. It cannor work in + full duplex mode. + + - spi-cs-high: DS-1302 has active high chip select line. The master + doesn't support active low. + + - spi-lsb-first: DS-1302 requires least significant bit first + transfers. The master only support this type of bit ordering. + + +Example: + +spi@901c { + #address-cells = <1>; + #size-cells = <0>; + compatible = "icpdas,lp8841-spi-rtc"; + reg = <0x901c 0x1>; + + rtc@0 { + compatible = "maxim,ds1302"; + reg = <0>; + spi-max-frequency = <500000>; + spi-3wire; + spi-lsb-first; + spi-cs-high; + }; +};
drivers/spi/Kconfig +10 -0
@@ -271,6 +271,16 @@ config SPI_LM70_LLP which interfaces to an LM70 temperature sensor using a parallel port. +config SPI_LP8841_RTC + tristate "ICP DAS LP-8841 SPI Controller for RTC" + depends on MACH_PXA27X_DT || COMPILE_TEST + help + This driver provides an SPI master device to drive Maxim + DS-1302 real time clock. + + Say N here unless you plan to run the kernel on an ICP DAS + LP-8x4x industrial computer. + config SPI_MPC52xx tristate "Freescale MPC52xx SPI (non-PSC) controller support" depends on PPC_MPC52xx
drivers/spi/Makefile +1 -0
@@ -46,6 +46,7 @@ obj-$(CONFIG_SPI_GPIO) += spi-gpio.o obj-$(CONFIG_SPI_IMG_SPFI) += spi-img-spfi.o obj-$(CONFIG_SPI_IMX) += spi-imx.o obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o +obj-$(CONFIG_SPI_LP8841_RTC) += spi-lp8841-rtc.o obj-$(CONFIG_SPI_MESON_SPIFC) += spi-meson-spifc.o obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o
drivers/spi/spi-lp8841-rtc.c new file +255 -0
255 lines not on this page · raw message
Signature · 6 lines
2.7.0 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 27 lines · Sergei Ianovich
ICP DAS LP-8841 contains a DS-1302 RTC. This driver provides an SPI master which makes the RTC usable. The driver is not supposed to work with anything else.
The driver 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.
Signed-off-by Sergei Ianovich <[email protected]>CC Mark Brown <[email protected]>CC Rob Herring <[email protected]>v3..v4
fix Mark Brown review comments
* fix dependencies inKconfigfix Rob Herring review comments
* rewrite binding description
* change binding and doc file names
* fix typov2..v3 to fix Mark Brown review comments
* drop dependencies inKconfig
* use #ifdefCONFIG_OFto allow build without DT
* drop emptydriver->remove
Quoted 6 lines
v1..v2 to fix Mark Brown review comments
* drop ifdef aroundMODULE_NAME
* useusleep_rangedirectly
* drop emptymaster->cleanup--- .../bindings/spi/icpdas-lp8841-spi-rtc.txt | 54 +++++
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Mark Brown
maintainerQuoted 8 lines · Sergei Ianovich
CC Mark Brown <[email protected]>CC Rob Herring <[email protected]>v3..v4
fix Mark Brown review comments
* fix dependencies inKconfig---
As covered in SubmittingPatches please put inter-version changelogs after the --- so they get stripped out when applied.
A message that is not in the archive (sent off-list or not yet received): 1456224272-4391-1-git-send-email-ynvich-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Applied "spi: master driver to enable RTC on ICPDAS LP-8841" to the spi tree
The patch
spi: master driver to enable RTC on ICPDAS LP-8841
has been applied to the spi tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
7ecbfff6711fb331591003ac32c002ce55a0758fMon Sep 17 00:00:00 2001
From: Sergei Ianovich <[email protected]>
Date: Tue, 23 Feb 2016 13:44:28 +0300
Subject: [PATCH] spi: master driver to enable RTC on ICPDAS LP-8841
ICP DAS LP-8841 contains a DS-1302 RTC. This driver provides an SPI master which makes the RTC usable. The driver is not supposed to work with anything else.
The driver 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.
--- .../bindings/spi/icpdas-lp8841-spi-rtc.txt | 54 +++++ drivers/spi/Kconfig | 10 + drivers/spi/Makefile | 1 + drivers/spi/spi-lp8841-rtc.c | 255 +++++++++++++++++++++ 4 files changed, 320 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/icpdas-lp8841-spi-rtc.txt create mode 100644 drivers/spi/spi-lp8841-rtc.c
Documentation/devicetree/bindings/spi/icpdas-lp8841-spi-rtc.txt new file +54 -0
@@ -0,0 +1,54 @@ +* ICP DAS LP-8841 SPI Controller for RTC + +ICP DAS LP-8841 contains a DS-1302 RTC. RTC is connected to an IO +memory register, which acts as an SPI master device. + +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: + +- #address-cells: should be 1 + +- #size-cells: should be 0 + +- compatible: should be "icpdas,lp8841-spi-rtc" + +- reg: should provide IO memory address + +Requirements to SPI slave nodes: + +- There can be only one slave device. + +- The spi slave node should claim the following flags which are + required by the spi controller. + + - spi-3wire: The master itself has only 3 wire. It cannor work in + full duplex mode. + + - spi-cs-high: DS-1302 has active high chip select line. The master + doesn't support active low. + + - spi-lsb-first: DS-1302 requires least significant bit first + transfers. The master only support this type of bit ordering. + + +Example: + +spi@901c { + #address-cells = <1>; + #size-cells = <0>; + compatible = "icpdas,lp8841-spi-rtc"; + reg = <0x901c 0x1>; + + rtc@0 { + compatible = "maxim,ds1302"; + reg = <0>; + spi-max-frequency = <500000>; + spi-3wire; + spi-lsb-first; + spi-cs-high; + }; +};
drivers/spi/Kconfig +10 -0
@@ -271,6 +271,16 @@ config SPI_LM70_LLP which interfaces to an LM70 temperature sensor using a parallel port. +config SPI_LP8841_RTC + tristate "ICP DAS LP-8841 SPI Controller for RTC" + depends on MACH_PXA27X_DT || COMPILE_TEST + help + This driver provides an SPI master device to drive Maxim + DS-1302 real time clock. + + Say N here unless you plan to run the kernel on an ICP DAS + LP-8x4x industrial computer. + config SPI_MPC52xx tristate "Freescale MPC52xx SPI (non-PSC) controller support" depends on PPC_MPC52xx
drivers/spi/Makefile +1 -0
@@ -46,6 +46,7 @@ obj-$(CONFIG_SPI_GPIO) += spi-gpio.o obj-$(CONFIG_SPI_IMG_SPFI) += spi-img-spfi.o obj-$(CONFIG_SPI_IMX) += spi-imx.o obj-$(CONFIG_SPI_LM70_LLP) += spi-lm70llp.o +obj-$(CONFIG_SPI_LP8841_RTC) += spi-lp8841-rtc.o obj-$(CONFIG_SPI_MESON_SPIFC) += spi-meson-spifc.o obj-$(CONFIG_SPI_MPC512x_PSC) += spi-mpc512x-psc.o obj-$(CONFIG_SPI_MPC52xx_PSC) += spi-mpc52xx-psc.o
drivers/spi/spi-lp8841-rtc.c new file +255 -0
255 lines not on this page · raw message
Signature · 6 lines
2.7.0 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html