mbox series

[0/7] rtc: ls2x: Add support for the Loongson-2K/LS7A RTC

Message ID cover.1662190009.git.zhoubinbin@loongson.cn
Headers show
Series rtc: ls2x: Add support for the Loongson-2K/LS7A RTC | expand

Message

Binbin Zhou Sept. 3, 2022, 9:34 a.m. UTC
Hi all:

The initial DT-base ls2x rtc driver was written by Wang Xuerui, he has
released five versions of patchset before, and all related mail records
are shown below if you are interested:

https://lore.kernel.org/all/?q=ls2x-rtc

In this series of patches, based on the code above, I have added the
following support:

1. Add ACPI-related support, as Loongson-3 + LS7A is now ACPI-base
   by default on LoonArch;
2. Add rtc alarm/walarm related functions.

Unfortunately, I have only tested the Loongson-3A4000+LS7A1000/LS7A2000
under LoongArch architecture.

NOTE:
The related functions of rtc alarm/walarm depend on ACPI registers, so rtc
alarm may not be available on the DT-base environment. Such as Loongson-2k/3
under MIPS.

Thanks.

Binbin Zhou (2):
  rtc: ls2x: Add support for the Loongson-2K/LS7A RTC
  LoongArch: Enable LS2X RTC in loongson3_defconfig

WANG Xuerui (5):
  dt-bindings: rtc: Add bindings for LS2X RTC
  MIPS: Loongson64: DTS: Add RTC support to LS7A
  MIPS: Loongson: Enable LS2X RTC in loongson3_defconfig
  MIPS: Loongson64: DTS: Add RTC support to Loongson-2K
  MIPS: Loongson: Enable LS2X RTC in loongson2k_defconfig

 .../devicetree/bindings/rtc/trivial-rtc.yaml  |   2 +
 arch/loongarch/configs/loongson3_defconfig    |   1 +
 .../boot/dts/loongson/loongson64-2k1000.dtsi  |   5 +
 arch/mips/boot/dts/loongson/ls7a-pch.dtsi     |   5 +
 arch/mips/configs/loongson2k_defconfig        |   1 +
 arch/mips/configs/loongson3_defconfig         |   1 +
 drivers/rtc/Kconfig                           |  11 +
 drivers/rtc/Makefile                          |   1 +
 drivers/rtc/rtc-ls2x.c                        | 366 ++++++++++++++++++
 9 files changed, 393 insertions(+)
 create mode 100644 drivers/rtc/rtc-ls2x.c

Comments

Xi Ruoyao Sept. 3, 2022, 10:45 a.m. UTC | #1
On Sat, 2022-09-03 at 17:34 +0800, Binbin Zhou wrote:
> This is now supported, enable for Loongson-3 systems.
> Other systems are unaffected.
> 
> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> Cc: Huacai Chen <chenhuacai@kernel.org>
> Cc: WANG Xuerui <git@xen0n.name>
> Cc: loongarch@lists.linux.dev
> ---
>  arch/loongarch/configs/loongson3_defconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/loongarch/configs/loongson3_defconfig
> b/arch/loongarch/configs/loongson3_defconfig
> index 4083d3051109..b240bc4e2021 100644
> --- a/arch/loongarch/configs/loongson3_defconfig
> +++ b/arch/loongarch/configs/loongson3_defconfig
> @@ -660,6 +660,7 @@ CONFIG_USB_GADGET=y
>  CONFIG_INFINIBAND=m
>  CONFIG_RTC_CLASS=y
>  CONFIG_RTC_DRV_EFI=y
> +CONFIG_RTC_DRV_LS2X=y

We already have RTC_DRV_EFI=y, IIUC this means we leave LS7A RTC for the
firmware to drive and operate it through EFI service.  So is this really
needed for LoongArch systems?  And if we enable both RTC_DRV_EFI and
RTC_DRV_LS2X, will some bad thing (a conflict) happen?
Huacai Chen Sept. 3, 2022, 2:19 p.m. UTC | #2
Hi, Ruoyao,

On Sat, Sep 3, 2022 at 6:45 PM Xi Ruoyao <xry111@xry111.site> wrote:
>
> On Sat, 2022-09-03 at 17:34 +0800, Binbin Zhou wrote:
> > This is now supported, enable for Loongson-3 systems.
> > Other systems are unaffected.
> >
> > Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
> > Cc: Huacai Chen <chenhuacai@kernel.org>
> > Cc: WANG Xuerui <git@xen0n.name>
> > Cc: loongarch@lists.linux.dev
> > ---
> >  arch/loongarch/configs/loongson3_defconfig | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/loongarch/configs/loongson3_defconfig
> > b/arch/loongarch/configs/loongson3_defconfig
> > index 4083d3051109..b240bc4e2021 100644
> > --- a/arch/loongarch/configs/loongson3_defconfig
> > +++ b/arch/loongarch/configs/loongson3_defconfig
> > @@ -660,6 +660,7 @@ CONFIG_USB_GADGET=y
> >  CONFIG_INFINIBAND=m
> >  CONFIG_RTC_CLASS=y
> >  CONFIG_RTC_DRV_EFI=y
> > +CONFIG_RTC_DRV_LS2X=y
>
> We already have RTC_DRV_EFI=y, IIUC this means we leave LS7A RTC for the
> firmware to drive and operate it through EFI service.  So is this really
> needed for LoongArch systems?  And if we enable both RTC_DRV_EFI and
> RTC_DRV_LS2X, will some bad thing (a conflict) happen?
Don't worry, please. EFI RTC depends on EFI runtime, so we need an
available RTC if EFI runtime is disabled (by command line or any other
reasons). On the other hand, multi RTCs can perfectly co-exist, they
will be rtc0 and rtc1 under sysfs and rtc0 is the default one.

Huacai
>
> --
> Xi Ruoyao <xry111@xry111.site>
> School of Aerospace Science and Technology, Xidian University
>