From patchwork Fri Jul 2 06:54:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WANG Xuerui X-Patchwork-Id: 12355579 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89258C11F6A for ; Fri, 2 Jul 2021 06:55:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D1A561410 for ; Fri, 2 Jul 2021 06:55:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230126AbhGBG5q (ORCPT ); Fri, 2 Jul 2021 02:57:46 -0400 Received: from [115.28.160.31] ([115.28.160.31]:41722 "EHLO mailbox.box.xen0n.name" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S230135AbhGBG5p (ORCPT ); Fri, 2 Jul 2021 02:57:45 -0400 Received: from ld50.lan (unknown [101.224.80.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id F338360105; Fri, 2 Jul 2021 14:55:11 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=xen0n.name; s=mail; t=1625208912; bh=IRoVPsaqUuthFVxQEJH9hv45Y+XPrjLxnM12c2Dg/WM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r34O4GgDrIcywexWsrHiEGKNopUa0J11rujQ7iBPY4tyqS9JaU9omrKSf64CpnpY/ 1WfaxioZx5F2cFPy08AwAN72PRwoQCsPc+zmT4at2USLEGW7VWsKU3MJHDL0Sv6QEn clb1t4aaEELGpvGT42lN2Btrauvv7rh8lKNlOlaw= From: WANG Xuerui To: linux-rtc@vger.kernel.org Cc: WANG Xuerui , Huacai Chen , Jiaxun Yang , devicetree@vger.kernel.org, linux-mips@vger.kernel.org Subject: [PATCH v5 1/6] rtc: ls2x: Add support for the Loongson-2K/LS7A RTC Date: Fri, 2 Jul 2021 14:54:46 +0800 Message-Id: <20210702065451.1175356-2-git@xen0n.name> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210702065451.1175356-1-git@xen0n.name> References: <20210702065451.1175356-1-git@xen0n.name> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org 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 Signed-off-by: WANG Xuerui Tested-by: Jiaxun Yang # loongson2k Cc: devicetree@vger.kernel.org Cc: linux-mips@vger.kernel.org --- drivers/rtc/Kconfig | 11 +++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-ls2x.c | 180 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 192 insertions(+) create mode 100644 drivers/rtc/rtc-ls2x.c diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index 12153d5801ce..8918b1d45976 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -1304,6 +1304,17 @@ config RTC_DRV_NTXEC embedded controller found in certain e-book readers designed by the original design manufacturer Netronix. +config RTC_DRV_LS2X + tristate "Loongson LS2X RTC" + depends on OF && MACH_LOONGSON64 || COMPILE_TEST + select REGMAP_MMIO + help + If you say yes here you get support for the RTC on the Loongson-2K + SoC and LS7A bridge, which first appeared on the Loongson-2H. + + This driver can also be built as a module. If so, the module + will be called rtc-ls2x. + comment "on-CPU RTC drivers" config RTC_DRV_ASM9260 diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index 2dd0dd956b0e..6042ff1e73b7 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -81,6 +81,7 @@ obj-$(CONFIG_RTC_DRV_LOONGSON1) += rtc-ls1x.o obj-$(CONFIG_RTC_DRV_LP8788) += rtc-lp8788.o obj-$(CONFIG_RTC_DRV_LPC24XX) += rtc-lpc24xx.o obj-$(CONFIG_RTC_DRV_LPC32XX) += rtc-lpc32xx.o +obj-$(CONFIG_RTC_DRV_LS2X) += rtc-ls2x.o obj-$(CONFIG_RTC_DRV_M41T80) += rtc-m41t80.o obj-$(CONFIG_RTC_DRV_M41T93) += rtc-m41t93.o obj-$(CONFIG_RTC_DRV_M41T94) += rtc-m41t94.o diff --git a/drivers/rtc/rtc-ls2x.c b/drivers/rtc/rtc-ls2x.c new file mode 100644 index 000000000000..58901323b219 --- /dev/null +++ b/drivers/rtc/rtc-ls2x.c @@ -0,0 +1,180 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Loongson-2K/7A RTC driver + * + * Based on the original out-of-tree Loongson-2H RTC driver for Linux 2.6.32, + * by Shaozong Liu . + * + * Maintained out-of-tree by Huacai Chen . + * + * Rewritten for mainline by WANG Xuerui . + */ + +#include +#include +#include +#include +#include +#include + +#define TOY_TRIM_REG 0x20 +#define TOY_WRITE0_REG 0x24 +#define TOY_WRITE1_REG 0x28 +#define TOY_READ0_REG 0x2c +#define TOY_READ1_REG 0x30 +#define TOY_MATCH0_REG 0x34 +#define TOY_MATCH1_REG 0x38 +#define TOY_MATCH2_REG 0x3c +#define RTC_CTRL_REG 0x40 +#define RTC_TRIM_REG 0x60 +#define RTC_WRITE0_REG 0x64 +#define RTC_READ0_REG 0x68 +#define RTC_MATCH0_REG 0x6c +#define RTC_MATCH1_REG 0x70 +#define RTC_MATCH2_REG 0x74 + +#define TOY_MON GENMASK(31, 26) +#define TOY_DAY GENMASK(25, 21) +#define TOY_HOUR GENMASK(20, 16) +#define TOY_MIN GENMASK(15, 10) +#define TOY_SEC GENMASK(9, 4) +#define TOY_MSEC GENMASK(3, 0) + +struct ls2x_rtc_priv { + struct regmap *regmap; +}; + +static const struct regmap_config ls2x_rtc_regmap_config = { + .reg_bits = 32, + .val_bits = 32, + .reg_stride = 4, +}; + +struct ls2x_rtc_regs { + u32 reg0; + u32 reg1; +}; + +static inline void ls2x_rtc_regs_to_time(struct ls2x_rtc_regs *regs, + struct rtc_time *tm) +{ + tm->tm_year = regs->reg1; + tm->tm_sec = FIELD_GET(TOY_SEC, regs->reg0); + tm->tm_min = FIELD_GET(TOY_MIN, regs->reg0); + tm->tm_hour = FIELD_GET(TOY_HOUR, regs->reg0); + tm->tm_mday = FIELD_GET(TOY_DAY, regs->reg0); + tm->tm_mon = FIELD_GET(TOY_MON, regs->reg0) - 1; +} + +static inline void ls2x_rtc_time_to_regs(struct rtc_time *tm, + struct ls2x_rtc_regs *regs) +{ + regs->reg0 = FIELD_PREP(TOY_SEC, tm->tm_sec); + regs->reg0 |= FIELD_PREP(TOY_MIN, tm->tm_min); + regs->reg0 |= FIELD_PREP(TOY_HOUR, tm->tm_hour); + regs->reg0 |= FIELD_PREP(TOY_DAY, tm->tm_mday); + regs->reg0 |= FIELD_PREP(TOY_MON, tm->tm_mon + 1); + regs->reg1 = tm->tm_year; +} + +static int ls2x_rtc_read_time(struct device *dev, struct rtc_time *tm) +{ + struct ls2x_rtc_priv *priv = dev_get_drvdata(dev); + struct ls2x_rtc_regs regs; + int ret; + + ret = regmap_read(priv->regmap, TOY_READ1_REG, ®s.reg1); + if (unlikely(ret)) + return ret; + + ret = regmap_read(priv->regmap, TOY_READ0_REG, ®s.reg0); + if (unlikely(ret)) + return ret; + + ls2x_rtc_regs_to_time(®s, tm); + + return 0; +} + +static int ls2x_rtc_set_time(struct device *dev, struct rtc_time *tm) +{ + struct ls2x_rtc_priv *priv = dev_get_drvdata(dev); + struct ls2x_rtc_regs regs; + int ret; + + ls2x_rtc_time_to_regs(tm, ®s); + + ret = regmap_write(priv->regmap, TOY_WRITE0_REG, regs.reg0); + if (unlikely(ret)) + return ret; + + return regmap_write(priv->regmap, TOY_WRITE1_REG, regs.reg1); +} + +static struct rtc_class_ops ls2x_rtc_ops = { + .read_time = ls2x_rtc_read_time, + .set_time = ls2x_rtc_set_time, +}; + +static int ls2x_rtc_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct rtc_device *rtc; + struct ls2x_rtc_priv *priv; + void __iomem *regs; + + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + if (unlikely(!priv)) + return -ENOMEM; + + platform_set_drvdata(pdev, priv); + + regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(regs)) + return PTR_ERR(regs); + + priv->regmap = devm_regmap_init_mmio(dev, regs, + &ls2x_rtc_regmap_config); + if (IS_ERR(priv->regmap)) + return PTR_ERR(priv->regmap); + + rtc = devm_rtc_allocate_device(dev); + if (IS_ERR(rtc)) + return PTR_ERR(rtc); + + rtc->ops = &ls2x_rtc_ops; + + /* Due to hardware erratum, all years multiple of 4 are considered + * leap year, so only years 2000 through 2099 are usable. + * + * Previous out-of-tree versions of this driver wrote tm_year directly + * into the year register, so epoch 2000 must be used to preserve + * semantics on shipped systems. + */ + rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; + rtc->range_max = RTC_TIMESTAMP_END_2099; + + return devm_rtc_register_device(rtc); +} + +static const struct of_device_id ls2x_rtc_of_match[] = { + { .compatible = "loongson,ls2x-rtc" }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, ls2x_rtc_of_match); + +static struct platform_driver ls2x_rtc_driver = { + .probe = ls2x_rtc_probe, + .driver = { + .name = "ls2x-rtc", + .of_match_table = ls2x_rtc_of_match, + }, +}; + +module_platform_driver(ls2x_rtc_driver); + +MODULE_DESCRIPTION("LS2X RTC driver"); +MODULE_AUTHOR("WANG Xuerui"); +MODULE_AUTHOR("Huacai Chen"); +MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:ls2x-rtc"); From patchwork Fri Jul 2 06:54:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WANG Xuerui X-Patchwork-Id: 12355583 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47C94C11F6F for ; Fri, 2 Jul 2021 06:55:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E3FC61410 for ; Fri, 2 Jul 2021 06:55:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230221AbhGBG5z (ORCPT ); Fri, 2 Jul 2021 02:57:55 -0400 Received: from [115.28.160.31] ([115.28.160.31]:41730 "EHLO mailbox.box.xen0n.name" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S230041AbhGBG5y (ORCPT ); Fri, 2 Jul 2021 02:57:54 -0400 Received: from ld50.lan (unknown [101.224.80.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 2CF946010F; Fri, 2 Jul 2021 14:55:20 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=xen0n.name; s=mail; t=1625208920; bh=wr8pdF/uLgE9SxIbFtGDiRnQR9+Ym3MJC/X+Rba44QM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PIYTXgYmmIaHubRfism6W9MfxuxPyR7kP68RFbZP+GUkv8tfPn5s+BGrVKA8/jizk SvhLkRSiwS1Hk6gJLc8slu0hGJatrGYB4obfEw4s0NmBPB5VwV2zfvnkH8eavDssXk nol9oifLGIuET1pe+mLBsuL8nm/FogWVTVII+SPQ= From: WANG Xuerui To: linux-rtc@vger.kernel.org Cc: WANG Xuerui , Jiaxun Yang , Rob Herring , devicetree@vger.kernel.org, linux-mips@vger.kernel.org Subject: [PATCH v5 3/6] MIPS: Loongson64: DTS: Add RTC support to LS7A Date: Fri, 2 Jul 2021 14:54:48 +0800 Message-Id: <20210702065451.1175356-4-git@xen0n.name> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210702065451.1175356-1-git@xen0n.name> References: <20210702065451.1175356-1-git@xen0n.name> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org The LS7A RTC module is now supported, enable it. Signed-off-by: WANG Xuerui Acked-by: Jiaxun Yang Cc: Rob Herring Cc: devicetree@vger.kernel.org Cc: linux-mips@vger.kernel.org --- arch/mips/boot/dts/loongson/ls7a-pch.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/mips/boot/dts/loongson/ls7a-pch.dtsi b/arch/mips/boot/dts/loongson/ls7a-pch.dtsi index 2f45fce2cdc4..82035de4774f 100644 --- a/arch/mips/boot/dts/loongson/ls7a-pch.dtsi +++ b/arch/mips/boot/dts/loongson/ls7a-pch.dtsi @@ -19,6 +19,11 @@ pic: interrupt-controller@10000000 { #interrupt-cells = <2>; }; + rtc0: rtc@100d0100 { + compatible = "loongson,ls2x-rtc"; + reg = <0 0x100d0100 0 0x78>; + }; + ls7a_uart0: serial@10080000 { compatible = "ns16550a"; reg = <0 0x10080000 0 0x100>; From patchwork Fri Jul 2 06:54:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WANG Xuerui X-Patchwork-Id: 12355581 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10978C11F6B for ; Fri, 2 Jul 2021 06:55:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F00DC61425 for ; Fri, 2 Jul 2021 06:55:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230211AbhGBG5z (ORCPT ); Fri, 2 Jul 2021 02:57:55 -0400 Received: from [115.28.160.31] ([115.28.160.31]:41736 "EHLO mailbox.box.xen0n.name" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S230170AbhGBG5y (ORCPT ); Fri, 2 Jul 2021 02:57:54 -0400 Received: from ld50.lan (unknown [101.224.80.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 07DE360105; Fri, 2 Jul 2021 14:55:21 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=xen0n.name; s=mail; t=1625208921; bh=DRjzne0ItLzPQT3F0soM35/vWix/rlub43mj4Mg5ZO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KeQS+3Oh9bJ4xAMt1tHPyM+HBgHyENS/XT4rHy12Yvjl5vhXMxOBUg4FJ3Luvo7B4 +1WDCnQtIPIUcgC5IRTfkMyJEqbS4xzZnpBgE/g+XtQVhgyxKkXOsywdKhHRAZUcbr ZiSF/6ZOF8GChze+xluyQ/8XgGfq6u0RIrfjTuP8= From: WANG Xuerui To: linux-rtc@vger.kernel.org Cc: WANG Xuerui , linux-mips@vger.kernel.org Subject: [PATCH v5 4/6] MIPS: Loongson: Enable LS2X RTC in loongson3_defconfig Date: Fri, 2 Jul 2021 14:54:49 +0800 Message-Id: <20210702065451.1175356-5-git@xen0n.name> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210702065451.1175356-1-git@xen0n.name> References: <20210702065451.1175356-1-git@xen0n.name> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org This is now supported, enable for Loongson-3 systems. Other systems are unaffected. Signed-off-by: WANG Xuerui Cc: linux-mips@vger.kernel.org --- arch/mips/configs/loongson3_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/configs/loongson3_defconfig b/arch/mips/configs/loongson3_defconfig index f02101ff04b3..fccb6906d4b4 100644 --- a/arch/mips/configs/loongson3_defconfig +++ b/arch/mips/configs/loongson3_defconfig @@ -320,6 +320,7 @@ CONFIG_USB_SERIAL_OPTION=m CONFIG_RTC_CLASS=y CONFIG_RTC_DRV_CMOS=y CONFIG_RTC_DRV_GOLDFISH=y +CONFIG_RTC_DRV_LS2X=y CONFIG_DMADEVICES=y CONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_BALLOON=m From patchwork Fri Jul 2 06:54:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WANG Xuerui X-Patchwork-Id: 12355585 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 494A8C11F6E for ; Fri, 2 Jul 2021 06:55:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37CD361413 for ; Fri, 2 Jul 2021 06:55:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230228AbhGBG5z (ORCPT ); Fri, 2 Jul 2021 02:57:55 -0400 Received: from [115.28.160.31] ([115.28.160.31]:41740 "EHLO mailbox.box.xen0n.name" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S230101AbhGBG5z (ORCPT ); Fri, 2 Jul 2021 02:57:55 -0400 Received: from ld50.lan (unknown [101.224.80.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id CE5E860110; Fri, 2 Jul 2021 14:55:21 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=xen0n.name; s=mail; t=1625208922; bh=1D8le36pNvIZZEOHon55LA/UfimI8BBPaGuhrlNC+m8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d+4KzXFqvJHIUZj/FNrN/h6McaJMfj/iz1jdmsWRNstwpJhTalklR/XNRCPGXBM5/ q9XoKJF2KsAwd2bhxucQIVPepCc1nthAlmbnZKVKPhUzaQug7ViwB+VIGNFqtjJj5C a5s6FHQ6b9sAlIFcFm8a+I0hj0zrIu2M0ZU8lRSE= From: WANG Xuerui To: linux-rtc@vger.kernel.org Cc: WANG Xuerui , Jiaxun Yang , Rob Herring , devicetree@vger.kernel.org, linux-mips@vger.kernel.org Subject: [PATCH v5 5/6] MIPS: Loongson64: DTS: Add RTC support to Loongson-2K Date: Fri, 2 Jul 2021 14:54:50 +0800 Message-Id: <20210702065451.1175356-6-git@xen0n.name> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210702065451.1175356-1-git@xen0n.name> References: <20210702065451.1175356-1-git@xen0n.name> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org 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 Tested-by: Jiaxun Yang # loongson2k Cc: Rob Herring Cc: devicetree@vger.kernel.org Cc: linux-mips@vger.kernel.org --- arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi b/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi index bfc3d3243ee7..4a04e1dc5fda 100644 --- a/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi +++ b/arch/mips/boot/dts/loongson/loongson64-2k1000.dtsi @@ -52,6 +52,11 @@ package0: bus@10000000 { 0 0x40000000 0 0x40000000 0 0x40000000 0xfe 0x00000000 0xfe 0x00000000 0 0x40000000>; + rtc0: rtc@1fe07800 { + compatible = "loongson,ls2x-rtc"; + reg = <0 0x1fe07800 0 0x78>; + }; + liointc0: interrupt-controller@1fe11400 { compatible = "loongson,liointc-2.0"; reg = <0 0x1fe11400 0 0x40>, From patchwork Fri Jul 2 06:54:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: WANG Xuerui X-Patchwork-Id: 12355587 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF857C11F76 for ; Fri, 2 Jul 2021 06:55:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D7B961156 for ; Fri, 2 Jul 2021 06:55:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230229AbhGBG54 (ORCPT ); Fri, 2 Jul 2021 02:57:56 -0400 Received: from [115.28.160.31] ([115.28.160.31]:41746 "EHLO mailbox.box.xen0n.name" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S230170AbhGBG5z (ORCPT ); Fri, 2 Jul 2021 02:57:55 -0400 Received: from ld50.lan (unknown [101.224.80.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 98AAF60114; Fri, 2 Jul 2021 14:55:22 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=xen0n.name; s=mail; t=1625208922; bh=l6nNtMBrbd9/YgzMBRPnOZZn6huLGhQUw3VJmWG6Ea0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MszcFaKvcoeEURnunI485xpT87izE0Xt/YR/BamOL9zarn33l10z1czRnG9BqJ7FA QSQGAJuMxWqAvZZEtBv7U7ImG8ewFHUbS8sxqKbsIt3HjM50JrM0EqDsBe72y94KGM onHJ+3rVkhvV2RRStXmFPfVYJvU4C6HS15HMFPC0= From: WANG Xuerui To: linux-rtc@vger.kernel.org Cc: WANG Xuerui , Jiaxun Yang , linux-mips@vger.kernel.org Subject: [PATCH v5 6/6] MIPS: Loongson: Enable LS2X RTC in loongson2k_defconfig Date: Fri, 2 Jul 2021 14:54:51 +0800 Message-Id: <20210702065451.1175356-7-git@xen0n.name> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210702065451.1175356-1-git@xen0n.name> References: <20210702065451.1175356-1-git@xen0n.name> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org This is now supported, enable for Loongson-2K systems. Other systems are unaffected. Signed-off-by: WANG Xuerui Tested-by: Jiaxun Yang # loongson2k Cc: linux-mips@vger.kernel.org --- arch/mips/configs/loongson2k_defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/mips/configs/loongson2k_defconfig b/arch/mips/configs/loongson2k_defconfig index e948ca487e2d..e15f34857956 100644 --- a/arch/mips/configs/loongson2k_defconfig +++ b/arch/mips/configs/loongson2k_defconfig @@ -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