Add pcf2131 rtc support
Subsystems (3)
v2 cover Add pcf2131 rtc support
The patchset supports pcf2131 rtc.
For the details, please check the patch commit log.
Joy Zou (3):
drivers: rtc: add pcf2131 rtc driver
imx: imx93_evk: add rtc pcf2131
configs: Enable RTC pcf2131 support
arch/arm/dts/imx93-11x11-evk-u-boot.dtsi | 8 + arch/arm/dts/imx93-11x11-evk.dts | 25 +++ arch/arm/dts/imx93.dtsi | 2 +- configs/imx93_11x11_evk_defconfig | 2 +- drivers/rtc/Kconfig | 10 ++ drivers/rtc/Makefile | 1 + drivers/rtc/pcf2131.c | 184 +++++++++++++++++++++++ 7 files changed, 230 insertions(+), 2 deletions(-) create mode 100644 drivers/rtc/pcf2131.c
Signature · 1 line
2.37.1
PATCH v2 1/3 drivers: rtc: add pcf2131 rtc driver
Adding support for pcf2131 RTC chip.
The pcf2131 is similar to the pcf2127. The driver support rtc register read/write by using rtc cmd and rtc date set/get by using date cmd.
---
Changes in v1:
1. delete the unnecessary initialization in v2.
2. retrun directly function insteand of redundancy return ret in v2.
3. delete the unnecessary comment line.
--- drivers/rtc/Kconfig | 10 +++ drivers/rtc/Makefile | 1 + drivers/rtc/pcf2131.c | 184 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 195 insertions(+) create mode 100644 drivers/rtc/pcf2131.c
drivers/rtc/Kconfig +10 -0
@@ -64,6 +64,16 @@ config RTC_PCF2127 has a selectable I2C-bus or SPI-bus, a backup battery switch-over circuit, a programmable watchdog function, a timestamp function, and many other features. +config RTC_PCF2131 + bool "Enable PCF2131 driver" + depends on DM_RTC + help + The PCF2131 is a CMOS Real Time Clock (RTC) and calendar with an integrated + Temperature Compensated Crystal (Xtal) Oscillator (TCXO) and a 32.768 kHz quartz + crystal optimized for very high accuracy and very low power consumption. The PCF2127 + has a selectable I2C-bus or SPI-bus, a backup battery switch-over circuit, a + programmable watchdog function, a timestamp function, and many other features. + config RTC_DS1307 bool "Enable DS1307 driver" depends on DM_RTC
drivers/rtc/Makefile +1 -0
@@ -27,6 +27,7 @@ obj-$(CONFIG_RTC_MV) += mvrtc.o obj-$(CONFIG_RTC_MXS) += mxsrtc.o obj-$(CONFIG_RTC_PCF8563) += pcf8563.o obj-$(CONFIG_RTC_PCF2127) += pcf2127.o +obj-$(CONFIG_RTC_PCF2131) += pcf2131.o obj-$(CONFIG_RTC_PL031) += pl031.o obj-$(CONFIG_RTC_PT7C4338) += pt7c4338.o obj-$(CONFIG_RTC_RV3028) += rv3028.o
drivers/rtc/pcf2131.c new file +184 -0
184 lines not on this page · raw message
Signature · 1 line
2.37.1
PATCH v2 2/3 imx: imx93_evk: add rtc pcf2131
In reply to Joy Zousupport rtc pcf2131 for imx93.
---
Changes in v1:
1. use the flag bootph-pre-ram instead of uboot,dm-spl.
--- arch/arm/dts/imx93-11x11-evk-u-boot.dtsi | 8 ++++++++ arch/arm/dts/imx93-11x11-evk.dts | 25 ++++++++++++++++++++++++ arch/arm/dts/imx93.dtsi | 2 +- 3 files changed, 34 insertions(+), 1 deletion(-)
arch/arm/dts/imx93-11x11-evk-u-boot.dtsi +8 -0
@@ -113,6 +113,10 @@ bootph-pre-ram; }; +&lpi2c3 { + bootph-pre-ram; +}; + &{/soc@0/bus@44000000/i2c@44350000/pmic@25} { bootph-pre-ram; };
@@ -125,6 +129,10 @@ bootph-pre-ram; }; +&pinctrl_lpi2c3 { + bootph-pre-ram; +}; + &fec { phy-reset-gpios = <&pcal6524 16 GPIO_ACTIVE_LOW>; phy-reset-duration = <15>;
arch/arm/dts/imx93-11x11-evk.dts +25 -0
@@ -244,6 +244,24 @@ }; }; +&lpi2c3 { + #address-cells = <1>; + #size-cells = <0>; + clock-frequency = <400000>; + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&pinctrl_lpi2c3>; + pinctrl-1 = <&pinctrl_lpi2c3>; + status = "okay"; + + pcf2131: rtc@53 { + compatible = "nxp,pcf2131"; + reg = <0x53>; + interrupt-parent = <&pcal6524>; + interrupts = <1 IRQ_TYPE_LEVEL_LOW>; + status = "okay"; + }; +}; + &lpuart1 { /* console */ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart1>;
@@ -461,6 +479,13 @@ >; }; + pinctrl_lpi2c3: lpi2c3grp { + fsl,pins = < + MX93_PAD_GPIO_IO28__LPI2C3_SDA 0x40000b9e + MX93_PAD_GPIO_IO29__LPI2C3_SCL 0x40000b9e + >; + }; + pinctrl_pcal6524: pcal6524grp { fsl,pins = < MX93_PAD_CCM_CLKO2__GPIO3_IO27 0x31e
arch/arm/dts/imx93.dtsi +1 -1
@@ -319,7 +319,7 @@ reg = <0x42530000 0x10000>; interrupts = <GIC_SPI 62 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk IMX93_CLK_LPI2C3_GATE>, - <&clk IMX93_CLK_LPI2C3_GATE>; + <&clk IMX93_CLK_BUS_WAKEUP>; clock-names = "per", "ipg"; status = "disabled"; };
Signature · 1 line
2.37.1
PATCH v2 3/3 configs: Enable RTC pcf2131 support
In reply to Joy ZouEnable CONFIG_RTC_PCF2131 configs to support pcf2131.
Disable CONFIG_RTC_EMULATION configs. The default rtc0 change into pcf2131.
--- configs/imx93_11x11_evk_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
configs/imx93_11x11_evk_defconfig +1 -1
@@ -13,6 +13,7 @@ CONFIG_DEFAULT_DEVICE_TREE="imx93-11x11-evk" CONFIG_SPL_TEXT_BASE=0x2049A000 CONFIG_TARGET_IMX93_11X11_EVK=y CONFIG_SYS_PROMPT="u-boot=> " +CONFIG_RTC_PCF2131=y CONFIG_SPL_SERIAL=y CONFIG_SPL_DRIVERS_MISC=y CONFIG_SPL_STACK=0x2051ddd0
@@ -107,7 +108,6 @@ CONFIG_DM_REGULATOR=y CONFIG_DM_REGULATOR_FIXED=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_DM_RTC=y -CONFIG_RTC_EMULATION=y CONFIG_DM_SERIAL=y CONFIG_FSL_LPUART=y CONFIG_ULP_WATCHDOG=y
Signature · 1 line
2.37.1