From: WANG Xuerui <hidden> Date: 2021-05-05 16:50:35
It has been a while since v1 of this series was sent (2020-09);
apparently, I did not have enough time or resource figuring out the exact
difference between rtc-ls1x and rtc-ls2x to see if the two can in fact be
merged, even today. Sorry for the long delay!
According to the manuals, though, the initialization sequence and
bitfield descriptions look certainly different, so I'm a bit wary about
just going ahead and merging these. Per Tiezhu's suggestion in the
previous thread, I'm just re-submitting this series with tags collected
and Huacai's e-mail address updated. If anyone (probably Loongson guys?)
could provide more information regarding the possible merger of rtc-ls1x
and rtc-ls2x, that would be great.
This patch series adds support for the RTC module found on various
Loongson systems with the Loongson-2K SoC or the LS7A bridge chip.
The driver is rewritten from an out-of-tree version to meet mainline
standards. I write kernel code as a hobby, though, so there might still
be overlooked issues. Any suggestions are welcome.
Note that, the Loongson-2K platform was upstreamed after v1 of this
series, so v2 additionally contains enablement for it. I'm unable to
test with my 2K board now, however, so Loongson guys, please test this
series again on your collection of LS7A and 2K systems, thanks!
v2:
- Rebased on top of latest linux-next
- Updated Huacai's e-mail address to the kernel.org one
- Added collected tags
- Added adaptation for newly upstreamed Loongson-2K platforms
WANG Xuerui (6):
rtc: ls2x: Add support for the Loongson-2K/LS7A RTC
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 +
.../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 | 225 ++++++++++++++++++
8 files changed, 251 insertions(+)
create mode 100644 drivers/rtc/rtc-ls2x.c
--
2.30.1
From: WANG Xuerui <hidden> Date: 2021-05-05 16:50:30
The Loongson-2K RTC module is now supported, enable it.
The MMIO address is unclear from the Loongson 2K1000 user manual, I took
it from Loongson's out-of-tree fork of Linux 4.19.
Signed-off-by: WANG Xuerui <redacted>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
---
arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi | 5 +++++
1 file changed, 5 insertions(+)
From: WANG Xuerui <hidden> Date: 2021-05-05 16:50:32
This is now supported, enable for Loongson-3 systems.
Other systems are unaffected.
Signed-off-by: WANG Xuerui <redacted>
---
arch/mips/configs/loongson3_defconfig | 1 +
1 file changed, 1 insertion(+)
From: WANG Xuerui <hidden> Date: 2021-05-05 16:50:34
Document the binding for the LS2X RTC block found on the Loongson-2K SoC
and the LS7A bridge, originally appearing on the Loongson-2H.
Signed-off-by: WANG Xuerui <redacted>
Acked-by: Rob Herring <robh@kernel.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
---
Documentation/devicetree/bindings/rtc/trivial-rtc.yaml | 2 ++
1 file changed, 2 insertions(+)
@@ -42,6 +42,8 @@ properties:-isil,isl1218# Intersil ISL12022 Real-time Clock-isil,isl12022+# Loongson LS2X RTC+-loongson,ls2x-rtc# Real Time Clock Module with I2C-Bus-microcrystal,rv3028# Real Time Clock Module with I2C-Bus
From: WANG Xuerui <hidden> Date: 2021-05-05 16:50:36
This is now supported, enable for Loongson-2K systems.
Other systems are unaffected.
Signed-off-by: WANG Xuerui <redacted>
---
arch/mips/configs/loongson2k_defconfig | 1 +
1 file changed, 1 insertion(+)
@@ -280,6 +280,7 @@ CONFIG_USB_SERIAL=m CONFIG_USB_SERIAL_OPTION=m CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_CMOS=y+CONFIG_RTC_DRV_LS2X=y CONFIG_DMADEVICES=y # CONFIG_CPU_HWMON is not set CONFIG_PM_DEVFREQ=y
From: WANG Xuerui <hidden> Date: 2021-05-05 16:55:05
The LS7A RTC module is now supported, enable it.
Signed-off-by: WANG Xuerui <redacted>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
---
arch/mips/boot/dts/loongson/ls7a-pch.dtsi | 5 +++++
1 file changed, 5 insertions(+)
From: WANG Xuerui <hidden> Date: 2021-05-05 17:27:04
This RTC module is integrated into the Loongson-2K SoC and the LS7A
bridge chip. This version is almost entirely rewritten to make use of
current kernel API.
Signed-off-by: Huacai Chen <chenhuacai@kernel.org>
Signed-off-by: WANG Xuerui <redacted>
Tested-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
drivers/rtc/Kconfig | 11 ++
drivers/rtc/Makefile | 1 +
drivers/rtc/rtc-ls2x.c | 225 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 237 insertions(+)
create mode 100644 drivers/rtc/rtc-ls2x.c
From: kernel test robot <hidden> Date: 2021-05-05 21:57:32
Hi WANG,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on next-20210505]
[cannot apply to abelloni/rtc-next robh/for-next v5.12]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/WANG-Xuerui/rtc-ls2x-Add-support-for-the-Loongson-2K-LS7A-RTC/20210506-013703
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git d665ea6ea86c785760ee4bad4543dab3267ad074
config: parisc-allyesconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/a4a12242f17c2ad92025b724458a31eb088e1893
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review WANG-Xuerui/rtc-ls2x-Add-support-for-the-Loongson-2K-LS7A-RTC/20210506-013703
git checkout a4a12242f17c2ad92025b724458a31eb088e1893
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=parisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>
All warnings (new ones prefixed by >>):
drivers/rtc/rtc-ls2x.c: In function 'ls2x_rtc_probe':
drivers/rtc/rtc-ls2x.c:202:9: error: implicit declaration of function 'rtc_register_device'; did you mean 'devm_rtc_register_device'? [-Werror=implicit-function-declaration]
202 | return rtc_register_device(rtc);
| ^~~~~~~~~~~~~~~~~~~
| devm_rtc_register_device
drivers/rtc/rtc-ls2x.c: At top level:
drivers/rtc/rtc-ls2x.c:215:21: error: implicit declaration of function 'of_match_ptr' [-Werror=implicit-function-declaration]
215 | .of_match_table = of_match_ptr(ls2x_rtc_of_match),
| ^~~~~~~~~~~~
quoted
drivers/rtc/rtc-ls2x.c:215:21: warning: initialization of 'const struct of_device_id *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
drivers/rtc/rtc-ls2x.c:215:21: note: (near initialization for 'ls2x_rtc_driver.driver.of_match_table')
drivers/rtc/rtc-ls2x.c:215:21: error: initializer element is not constant
drivers/rtc/rtc-ls2x.c:215:21: note: (near initialization for 'ls2x_rtc_driver.driver.of_match_table')
cc1: some warnings being treated as errors
vim +215 drivers/rtc/rtc-ls2x.c
210
211 static struct platform_driver ls2x_rtc_driver = {
212 .probe = ls2x_rtc_probe,
213 .driver = {
214 .name = "ls2x-rtc",
> 215 .of_match_table = of_match_ptr(ls2x_rtc_of_match),
216 },
217 };
218
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
drivers/rtc/rtc-ls2x.c:202:9: error: implicit declaration of function 'rtc_register_device'; did you mean 'devm_rtc_register_device'? [-Werror=implicit-function-declaration]
202 | return rtc_register_device(rtc);
| ^~~~~~~~~~~~~~~~~~~
| devm_rtc_register_device
drivers/rtc/rtc-ls2x.c: At top level:
quoted
drivers/rtc/rtc-ls2x.c:205:34: error: array type has incomplete element type 'struct of_device_id'
From: WANG Xuerui <kernel@xen0n.name> Date: 2021-05-06 00:21:35
Sorry for the noise, there's one compile error not caught after rebase.
It was late in the night and I didn't watch the test compile finish
before sending the series.
Will resend very soon. (/me yawns)
On 5/6/21 00:39, WANG Xuerui wrote:
quoted hunk
This RTC module is integrated into the Loongson-2K SoC and the LS7A
bridge chip. This version is almost entirely rewritten to make use of
current kernel API.
Signed-off-by: Huacai Chen <chenhuacai@kernel.org>
Signed-off-by: WANG Xuerui <redacted>
Tested-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
drivers/rtc/Kconfig | 11 ++
drivers/rtc/Makefile | 1 +
drivers/rtc/rtc-ls2x.c | 225 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 237 insertions(+)
create mode 100644 drivers/rtc/rtc-ls2x.c