Skip to contentSkip to conversation

rtc: optee: add RTC driver for OP-TEE RTC PTA

PATCH Applied Clément Léger 3 participants 3 messages Mar 8, 2022 – Mar 25, 2022

Subsystems (2)
lore
Share & tools
lore

Clément Léger

author maintainer
#0 lore raw

PATCH v4 1/1 rtc: optee: add RTC driver for OP-TEE RTC PTA

This drivers allows to communicate with a RTC PTA handled by OP-TEE [1]. This PTA allows to query RTC information, set/get time and set/get offset depending on the supported features.

[1] https://github.com/OP-TEE/optee_os/pull/5179

---

Changes in v4:
- Remove error prints except the ones in probe

Changes in v3 (was resent as a second v2 due to a mistake);
- Fix error messages to include ret value and fix wrong IOCTL names
- Use 100 columns char limit

Changes in v2:
- Rebased over tee-shm-for-v5.18
- Switch to tee_shm_alloc_kernel_buf()
- Use export_uuid() to copy uuid
- Fix warnings reported by checkpatch
- Free SHM in error exit path

 MAINTAINERS             |   6 +
 drivers/rtc/Kconfig     |  10 ++
 drivers/rtc/Makefile    |   1 +
 drivers/rtc/rtc-optee.c | 362 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 379 insertions(+)
 create mode 100644 drivers/rtc/rtc-optee.c
MAINTAINERS +6 -0
index f41088418aae..b21375ad73d2 100644
@@ -14361,6 +14361,12 @@ L:	op-tee(a)lists.trustedfirmware.org
 S:	Maintained
 F:	drivers/char/hw_random/optee-rng.c
 
+OP-TEE RTC DRIVER
+M:	Clément Léger <[email protected]>
+L:	linux-rtc(a)vger.kernel.org
+S:	Maintained
+F:	drivers/rtc/rtc-optee.c
+
 OPA-VNIC DRIVER
 M:	Dennis Dalessandro <[email protected]>
 M:	Mike Marciniszyn <[email protected]>
drivers/rtc/Kconfig +10 -0
index d85a3c31347c..cba5427f79b3 100644
@@ -1293,6 +1293,16 @@ config RTC_DRV_OPAL
 	  This driver can also be built as a module. If so, the module
 	  will be called rtc-opal.
 
+config RTC_DRV_OPTEE
+	tristate "OP-TEE based RTC driver"
+	depends on OPTEE
+	help
+	  Select this to get support for OP-TEE based RTC control on SoCs where
+	  RTC are not accessible to the normal world (Linux).
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rtc-optee.
+
 config RTC_DRV_ZYNQMP
 	tristate "Xilinx Zynq Ultrascale+ MPSoC RTC"
 	depends on OF && HAS_IOMEM
drivers/rtc/Makefile +1 -0
index e92f3e943245..2d827d8261d5 100644
@@ -115,6 +115,7 @@ obj-$(CONFIG_RTC_DRV_GAMECUBE)	+= rtc-gamecube.o
 obj-$(CONFIG_RTC_DRV_NTXEC)	+= rtc-ntxec.o
 obj-$(CONFIG_RTC_DRV_OMAP)	+= rtc-omap.o
 obj-$(CONFIG_RTC_DRV_OPAL)	+= rtc-opal.o
+obj-$(CONFIG_RTC_DRV_OPTEE)	+= rtc-optee.o
 obj-$(CONFIG_RTC_DRV_PALMAS)	+= rtc-palmas.o
 obj-$(CONFIG_RTC_DRV_PCAP)	+= rtc-pcap.o
 obj-$(CONFIG_RTC_DRV_PCF2123)	+= rtc-pcf2123.o
drivers/rtc/rtc-optee.c new file +362 -0

362 lines not on this page · raw message

Signature · 1 line
2.34.1
Reviewed-by on v4 1/1
#1 lore raw
Quoted 24 lines · Clément Léger

This drivers allows to communicate with a RTC PTA handled by OP-TEE [1]. This PTA allows to query RTC information, set/get time and set/get offset depending on the supported features.

[1] https://github.com/OP-TEE/optee_os/pull/5179

---

Changes in v4:
- Remove error prints except the ones in probe

Changes in v3 (was resent as a second v2 due to a mistake);
- Fix error messages to include ret value and fix wrong IOCTL names
- Use 100 columns char limit

Changes in v2:
- Rebased over tee-shm-for-v5.18
- Switch to tee_shm_alloc_kernel_buf()
- Use export_uuid() to copy uuid
- Fix warnings reported by checkpatch
- Free SHM in error exit path

Quoted 6 lines
 MAINTAINERS             |   6 +
 drivers/rtc/Kconfig     |  10 ++
 drivers/rtc/Makefile    |   1 +
 drivers/rtc/rtc-optee.c | 362 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 379 insertions(+)
 create mode 100644 drivers/rtc/rtc-optee.c
maintainer Applied
#2 lore raw
In reply to Clément Léger
Quoted 8 lines · Clément Léger

This drivers allows to communicate with a RTC PTA handled by OP-TEE [1]. This PTA allows to query RTC information, set/get time and set/get offset depending on the supported features.

[1] https://github.com/OP-TEE/optee_os/pull/5179

[...]

Applied, thanks!

[1/1] rtc: optee: add RTC driver for OP-TEE RTC PTA

      commit: 81c2f059ab90b221931e78503c80dcd8fbadac53
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com