From patchwork Wed Sep 13 15:16:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 13383295 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AFDFFEDEC73 for ; Wed, 13 Sep 2023 15:17:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=s0IjIx4tAXkgFayFLWf6r5oFtNOAcw+Me1ylh1537/E=; b=CmMwc81j6bZVx1 R4WkvbhaOp8NHNyt7irzoFBIN/jg0HujDQ1WEqeeIadgfdD+9zX5xpwJq9DIPW+lNr8k9Pw38rPrj md41HvtMPVgB0veGpAKhCsay2jn39zqWTkCM7vA2JgNNWkLtKfzjB3FXI2ZvlAIQyIKoR8yyePlEu pT1MJRGMUNCT5+cnipJ4ZU5S0R0Gem6yhrE+zsYoDJAv9fpFe6qQ2amMAszw5DH1n0Mbqb7LeVNa3 d/1yzZx49TFZZaSlYeI3VDSBSnGohfGua9td5gJYfCNW4GLW1hhg5xa5KHjmlB3/MgS2yE1QJ3gOh jlrlTBqHpHYXJaYueh7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qgRbU-006CCl-2S; Wed, 13 Sep 2023 15:16:32 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qgRbO-006C9s-0G for linux-arm-kernel@lists.infradead.org; Wed, 13 Sep 2023 15:16:27 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-401d67434daso75562095e9.2 for ; Wed, 13 Sep 2023 08:16:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694618182; x=1695222982; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=072YJrk5Gsy2bq4yUlijuT8JKmshwKnpnmiZoFXozDk=; b=Eff6FM9rxEZP/sx59g6g5jDhp8oQL4d82lD0iLN/S8phdZMJ6QHFjRssZi1FXG9NNy j/mRJzy1urFpLm9RF4Xg4/OlYWhy4gd+rGV+ex4o147+p5ZgBFltUKxzSDZHr/iYl30H ej7TmnrEVbWftLW9gsEJ1TZ9g15ga6y7A5m3iYNz39hqJcudbbYsWQ0jFrOY8wrowy6t pq2s1DU60+jYYicNAM+xLB201zTJlar4ko6trDz1HriLclq8nrWcbxP5IJp1JVapICBx Iuozlq7IVpOKafTS6ngMPOVMwfrYCdv2w0hb8OvGPhWU0u2BYnUlRup8cizLydWY3WAk K97A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694618183; x=1695222983; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=072YJrk5Gsy2bq4yUlijuT8JKmshwKnpnmiZoFXozDk=; b=wfGL4xCDfrB5v/ZSHB8qeK05/EBSWGGG2zfTcrBQKDmuJx52O3TZyKdkek8XqZkoCI GwSnloXJJrAX4fXngBb78Df4BCb5mxe1CTEaiMdpyX1ST9Putbmf0NGbGN9YBUDeoV+O PFjNpOje2Dx+j64UDe8FP9WjyCjV6Vr+pY4c12nsV5NDXbvDm2nWzyAQJePEx/Z3XC1h wg1ITrG/yPc+0yvKGwEKzIpu+DwnSQEY0OtLAaN65kkWrJOTf1j7nE0t2XZ+REKFVd9h 0gm0cm6zi8QxWQ7RGsgF0Zw4tnsichLmbq8ocovK4Cdoc6C99E+Xkene0aBKWgSowpx1 reyg== X-Gm-Message-State: AOJu0YwqkrzE5RYYscQUX6DHyj0/W5miE5deRPcTiD/RzOo4bKwMjEZB eG7KlVGFHEh0ahgRwZwc9tIpmNIPhaqxzA== X-Google-Smtp-Source: AGHT+IEd/4icH+OCrB98jAeWL0me/9kKV05TD9d+6akO1+csfozUhRaahZUf8y+5fJwYaZHei9B4Xw== X-Received: by 2002:a7b:c045:0:b0:402:e68f:8896 with SMTP id u5-20020a7bc045000000b00402e68f8896mr2430801wmc.0.1694618182223; Wed, 13 Sep 2023 08:16:22 -0700 (PDT) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id f20-20020a7bcd14000000b003fe2b6d64c8sm2299620wmj.21.2023.09.13.08.16.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 08:16:21 -0700 (PDT) From: Romain Perier To: Alessandro Zummo , Alexandre Belloni , Daniel Palmer , Romain Perier , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/3] rtc: Add support for the SSD202D RTC Date: Wed, 13 Sep 2023 17:16:04 +0200 Message-Id: <20230913151606.69494-2-romain.perier@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230913151606.69494-1-romain.perier@gmail.com> References: <20230913151606.69494-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230913_081626_121649_BE78A6BA X-CRM114-Status: GOOD ( 30.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Newer SigmaStar SSD202D SoCs contain a Real Time Clock, capable of running while the system is sleeping (battery powered), this is not the case with the other RTC on older SoCs. This adds basic support for this RTC block. Signed-off-by: Romain Perier Co-developed-by: Daniel Palmer Signed-off-by: Daniel Palmer --- drivers/rtc/Kconfig | 11 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-ssd202d.c | 249 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 261 insertions(+) create mode 100644 drivers/rtc/rtc-ssd202d.c diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index d7502433c78a..f6c49348d7aa 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -1984,4 +1984,15 @@ config RTC_DRV_POLARFIRE_SOC This driver can also be built as a module, if so, the module will be called "rtc-mpfs". +config RTC_DRV_SSD202D + tristate "SigmaStar SSD202D RTC" + depends on ARCH_MSTARV7 || COMPILE_TEST + default ARCH_MSTARV7 + help + If you say yes here you get support for the SigmaStar SSD202D On-Chip + Real Time Clock. + + This driver can also be built as a module, if so, the module + will be called "rtc-ssd20xd". + endif # RTC_CLASS diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile index fd209883ee2e..7b03c3abfd78 100644 --- a/drivers/rtc/Makefile +++ b/drivers/rtc/Makefile @@ -103,6 +103,7 @@ obj-$(CONFIG_RTC_DRV_MESON) += rtc-meson.o obj-$(CONFIG_RTC_DRV_MOXART) += rtc-moxart.o obj-$(CONFIG_RTC_DRV_MPC5121) += rtc-mpc5121.o obj-$(CONFIG_RTC_DRV_MSC313) += rtc-msc313.o +obj-$(CONFIG_RTC_DRV_SSD202D) += rtc-ssd202d.o obj-$(CONFIG_RTC_DRV_MSM6242) += rtc-msm6242.o obj-$(CONFIG_RTC_DRV_MT2712) += rtc-mt2712.o obj-$(CONFIG_RTC_DRV_MT6397) += rtc-mt6397.o diff --git a/drivers/rtc/rtc-ssd202d.c b/drivers/rtc/rtc-ssd202d.c new file mode 100644 index 000000000000..a69e062ad1b4 --- /dev/null +++ b/drivers/rtc/rtc-ssd202d.c @@ -0,0 +1,249 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Real time clocks driver for MStar/SigmaStar SSD202D SoCs. + * + * (C) 2021 Daniel Palmer + * (C) 2023 Romain Perier + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define REG_CTRL 0x0 +#define REG_CTRL1 0x4 +#define REG_ISO_CTRL 0xc +#define REG_WRDATA_L 0x10 +#define REG_WRDATA_H 0x14 +#define REG_ISOACK 0x20 +#define REG_RDDATA_L 0x24 +#define REG_RDDATA_H 0x28 +#define REG_RDCNT_L 0x30 +#define REG_RDCNT_H 0x34 +#define REG_CNT_TRIG 0x38 +#define REG_PWRCTRL 0x3c +#define REG_RTC_TEST 0x54 + +#define CNT_RD_TRIG_BIT BIT(0) +#define CNT_RD_BIT BIT(0) +#define BASE_WR_BIT BIT(1) +#define BASE_RD_BIT BIT(2) +#define CNT_RST_BIT BIT(3) +#define ISO_CTRL_ACK_MASK BIT(3) +#define ISO_CTRL_ACK_SHIFT 3 +#define SW0_WR_BIT BIT(5) +#define SW1_WR_BIT BIT(6) +#define SW0_RD_BIT BIT(7) +#define SW1_RD_BIT BIT(8) + +#define ISO_CTRL_MASK GENMASK(2, 0) + +struct ssd202d_rtc { + struct rtc_device *rtc_dev; + void __iomem *base; +}; + +static u8 read_iso_en(void __iomem *base) +{ + return readb(base + REG_RTC_TEST) & 0x1; +} + +static u8 read_iso_ctrl_ack(void __iomem *base) +{ + return (readb(base + REG_ISOACK) & ISO_CTRL_ACK_MASK) >> ISO_CTRL_ACK_SHIFT; +} + +static int ssd202d_rtc_isoctrl(struct ssd202d_rtc *priv) +{ + static const unsigned int sequence[] = { 0x0, 0x1, 0x3, 0x7, 0x5, 0x1, 0x0 }; + unsigned int val; + struct device *dev = &priv->rtc_dev->dev; + int i, ret; + + /* + * This gates iso_en by writing a special sequence of bytes to iso_ctrl + * and ensuring that it has been correctly applied by reading iso_ctrl_ack + */ + for (i = 0; i < ARRAY_SIZE(sequence); i++) { + writeb(sequence[i] & ISO_CTRL_MASK, priv->base + REG_ISO_CTRL); + + ret = read_poll_timeout(read_iso_ctrl_ack, val, val == (i % 2), 100, + 20 * 100, true, priv->base); + if (ret) { + dev_dbg(dev, "Timeout waiting for ack byte %i (%x) of sequence\n", i, + sequence[i]); + return ret; + } + } + + /* + * At this point iso_en should be raised for 1ms + */ + ret = read_poll_timeout(read_iso_en, val, val, 100, 22 * 100, true, priv->base); + if (ret) + dev_dbg(dev, "Timeout waiting for iso_en\n"); + mdelay(2); + return 0; +} + +static void ssd202d_rtc_read_reg(struct ssd202d_rtc *priv, unsigned int reg, + unsigned int field, unsigned int *base) +{ + unsigned int l, h; + u16 val; + + /* Ask for the content of an RTC value into RDDATA by gating iso_en, + * then iso_en is gated and the content of RDDATA can be read + */ + val = readw(priv->base + reg); + writew(val | field, priv->base + reg); + ssd202d_rtc_isoctrl(priv); + writew(val & ~field, priv->base + reg); + + l = readw(priv->base + REG_RDDATA_L); + h = readw(priv->base + REG_RDDATA_H); + + *base = (h << 16) | l; +} + +static void ssd202d_rtc_write_reg(struct ssd202d_rtc *priv, unsigned int reg, + unsigned int field, u32 base) +{ + u16 val; + + /* Set the content of an RTC value from WRDATA by gating iso_en */ + val = readw(priv->base + reg); + writew(val | field, priv->base + reg); + writew(base, priv->base + REG_WRDATA_L); + writew(base >> 16, priv->base + REG_WRDATA_H); + ssd202d_rtc_isoctrl(priv); + writew(val & ~field, priv->base + reg); +} + +static int ssd202d_rtc_read_counter(struct ssd202d_rtc *priv, unsigned int *counter) +{ + unsigned int l, h; + u16 val; + + val = readw(priv->base + REG_CTRL1); + writew(val | CNT_RD_BIT, priv->base + REG_CTRL1); + ssd202d_rtc_isoctrl(priv); + writew(val & ~CNT_RD_BIT, priv->base + REG_CTRL1); + + val = readw(priv->base + REG_CTRL1); + writew(val | CNT_RD_TRIG_BIT, priv->base + REG_CNT_TRIG); + writew(val & ~CNT_RD_TRIG_BIT, priv->base + REG_CNT_TRIG); + + l = readw(priv->base + REG_RDCNT_L); + h = readw(priv->base + REG_RDCNT_H); + + *counter = (h << 16) | l; + + return 0; +} + +static int ssd202d_rtc_read_time(struct device *dev, struct rtc_time *tm) +{ + struct ssd202d_rtc *priv = dev_get_drvdata(dev); + unsigned int sw0, base, counter; + u32 seconds; + int ret; + + /* Check that RTC is enabled by SW */ + ssd202d_rtc_read_reg(priv, REG_CTRL, SW0_RD_BIT, &sw0); + if (sw0 != 1) + return -EINVAL; + + /* Get RTC base value from RDDATA */ + ssd202d_rtc_read_reg(priv, REG_CTRL, BASE_RD_BIT, &base); + /* Get RTC counter value from RDDATA */ + ret = ssd202d_rtc_read_counter(priv, &counter); + if (ret) + return ret; + + seconds = base + counter; + + rtc_time64_to_tm(seconds, tm); + + return 0; +} + +static int ssd202d_rtc_reset_counter(struct ssd202d_rtc *priv) +{ + u16 val; + + val = readw(priv->base + REG_CTRL); + writew(val | CNT_RST_BIT, priv->base + REG_CTRL); + ssd202d_rtc_isoctrl(priv); + writew(val & ~CNT_RST_BIT, priv->base + REG_CTRL); + ssd202d_rtc_isoctrl(priv); + + return 0; +} + +static int ssd202d_rtc_set_time(struct device *dev, struct rtc_time *tm) +{ + struct ssd202d_rtc *priv = dev_get_drvdata(dev); + unsigned long seconds = rtc_tm_to_time64(tm); + + ssd202d_rtc_write_reg(priv, REG_CTRL, BASE_WR_BIT, seconds); + ssd202d_rtc_reset_counter(priv); + ssd202d_rtc_write_reg(priv, REG_CTRL, SW0_WR_BIT, 1); + + return 0; +} + +static const struct rtc_class_ops ssd202d_rtc_ops = { + .read_time = ssd202d_rtc_read_time, + .set_time = ssd202d_rtc_set_time, +}; + +static int ssd202d_rtc_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct ssd202d_rtc *priv; + + priv = devm_kzalloc(&pdev->dev, sizeof(struct ssd202d_rtc), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + priv->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(priv->base)) + return PTR_ERR(priv->base); + + priv->rtc_dev = devm_rtc_allocate_device(dev); + if (IS_ERR(priv->rtc_dev)) + return PTR_ERR(priv->rtc_dev); + + priv->rtc_dev->ops = &ssd202d_rtc_ops; + priv->rtc_dev->range_max = U32_MAX; + + platform_set_drvdata(pdev, priv); + + return devm_rtc_register_device(priv->rtc_dev); +} + +static const struct of_device_id ssd202d_rtc_of_match_table[] = { + { .compatible = "mstar,ssd202d-rtc" }, + { } +}; +MODULE_DEVICE_TABLE(of, ssd202d_rtc_of_match_table); + +static struct platform_driver ssd202d_rtc_driver = { + .probe = ssd202d_rtc_probe, + .driver = { + .name = "ssd202d-rtc", + .of_match_table = ssd202d_rtc_of_match_table, + }, +}; +module_platform_driver(ssd202d_rtc_driver); + +MODULE_AUTHOR("Daniel Palmer "); +MODULE_AUTHOR("Romain Perier "); +MODULE_DESCRIPTION("MStar SSD202D RTC Driver"); +MODULE_LICENSE("GPL v2"); From patchwork Wed Sep 13 15:16:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 13383292 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F2FFEDEC73 for ; Wed, 13 Sep 2023 15:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=G9FEqTXDTEa2xTBnBPa8u7ezE0D/V92JAAPOmJWMYZ0=; b=HM8mInpsnT6FAT YSXVDBqWBTe+786FMpfY9NIPxcCu87I22lfadX1CrW54PbuHHGM+2areXCaziHzVFPXTV5p4D7jlE u2EuMokoW4czcV6fIVXvlXVTa4gumVhLOphn8YBqYkcnp1sB/K80vNUp96BACs6Rr43BiMkE0ReGq 84kVvVmBI1/guSWDxdLOUJfOT8By0lQkipHBtowMALueBwYTtzXI6CNqwG2LjGAWTat9rk+riL5m4 Ss+bheTy+QtqT6MoPgKvnEBGcMaKni8jLU0tD1r1cnr8isHqWzespJabcWM6YRgeTqUpy9EcE6fmb I+m6PoKkJCC5YWbMF7qw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qgRbV-006CD8-11; Wed, 13 Sep 2023 15:16:33 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qgRbP-006CA0-21 for linux-arm-kernel@lists.infradead.org; Wed, 13 Sep 2023 15:16:29 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-403012f27e3so52005925e9.3 for ; Wed, 13 Sep 2023 08:16:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694618183; x=1695222983; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pNvYjKW7PomV76gyvQhLurgIb+vmLHOwQJgyz6Ao3Z4=; b=A9gLdav1uiGambJ4aY2fqwhyC6EcioHij3p+7rhYkbEijQlRss0mJbEEucmhu12qIE uJlO6E/I7fYgM848soHtoFb7cwmqfPZEBsdhpBzW6qF0Du43DI+BpAA4Wg3ft4CQh0Ka jcTd7fqDLuIMiz7doO6nT6XgX9akxEevFOifoMMwHIhOZdo0uYCRXiQV2YCRaLHsxzxI 7WbrZjIBUtQHamnbsTcc0ltKiHsr2JsyVVv6bTTK9Zd1o+TsywM/oF0GFT11uOqmrloX oGLuHCddO/G5LUhKBQp0oRLNfYujRrmyMCDz1g18q64K67kJqwgD+DpfyOkIBqL0ggmo y0vQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694618183; x=1695222983; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pNvYjKW7PomV76gyvQhLurgIb+vmLHOwQJgyz6Ao3Z4=; b=IxH2fmwoj/qHmkCfLE/qiaCzDOT6/h6Mop7QsOqDv62Er9kv1IJCpISuo0EzQDyij4 qUfHuUAahOAPoygmMTpvh2DGWGrZcNL8D8mTcrOc9ItnNCUnWByGGhFgBIAjD02uLSMx zba0vwwKJp+hm55jppWuhUXJ2rphpTqgmtrklbzBGUyNeTIuFGkw6g7tW8jT5YyK7V3A N5EQu2F3Fjnk3KINn5F74D3Rj6W93Lw1mFHnZGFUzgBeyiC76XBRKa669oGaIab6Wlo5 mOPLIe2wLO/CELLMYa5Ihj2a2KFs1GUm794ELHLpI5frf0nQ0rYUhvIUeuT+ZwWrdgc4 naag== X-Gm-Message-State: AOJu0Yx9jOIGnWbBjmpS1q+sKph3E/MSB0vI4/w6LhkGxcZpwjYq7PEM 4e+AsY2FceMq7/uHEGfdKM66bg1SsvfOjA== X-Google-Smtp-Source: AGHT+IGn4OleF+wn7zer6c5nSeHVXOWrMzBtMjTRpP5K22bLCa0F/2iJByN4iCAY73vGnev+is5GPg== X-Received: by 2002:a05:6000:1006:b0:319:7472:f0b6 with SMTP id a6-20020a056000100600b003197472f0b6mr2171418wrx.15.1694618183348; Wed, 13 Sep 2023 08:16:23 -0700 (PDT) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id h5-20020adfe985000000b0031ae8d86af4sm15664490wrm.103.2023.09.13.08.16.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 08:16:23 -0700 (PDT) From: Romain Perier To: Alessandro Zummo , Alexandre Belloni , Daniel Palmer , Romain Perier , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/3] dt-bindings: rtc: Add Mstar SSD202D RTC Date: Wed, 13 Sep 2023 17:16:05 +0200 Message-Id: <20230913151606.69494-3-romain.perier@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230913151606.69494-1-romain.perier@gmail.com> References: <20230913151606.69494-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230913_081627_683931_D1F98225 X-CRM114-Status: GOOD ( 14.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add YAML bindings for Mstar SSD202D RTC. Signed-off-by: Romain Perier --- .../bindings/rtc/mstar,ssd202d-rtc.yaml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Documentation/devicetree/bindings/rtc/mstar,ssd202d-rtc.yaml diff --git a/Documentation/devicetree/bindings/rtc/mstar,ssd202d-rtc.yaml b/Documentation/devicetree/bindings/rtc/mstar,ssd202d-rtc.yaml new file mode 100644 index 000000000000..4c1f22ef5a2c --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/mstar,ssd202d-rtc.yaml @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/rtc/mstar,ssd202d-rtc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Mstar SSD202D Real Time Clock + +maintainers: + - Daniel Palmer + - Romain Perier + +allOf: + - $ref: rtc.yaml# + +properties: + compatible: + enum: + - mstar,ssd202d-rtc + reg: + maxItems: 1 + +required: + - compatible + - reg + +unevaluatedProperties: false + +examples: + - | + rtc@6800 { + compatible = "mstar,ssd202d-rtc"; + reg = <0x6800 0x200>; + }; +... From patchwork Wed Sep 13 15:16:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 13383294 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AC28EDEC71 for ; Wed, 13 Sep 2023 15:17:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=3QLfRi1Fyi1x1la8tuvCer7V7RacJRh/cEMgX79JbdQ=; b=utn1yVKch53gc2 q8kgKtCuCZwhJNFmhvSAxoQYzuHX4h5/3FtsyW8k2M+7PBK50WqW+ME9ItDjZCCU7jox20DZ1iz5E kxEjubPGy82n0GYgwDxeXum6iaFeOCx4BYB+cG0/7Q/i90G8PX2dlHB3c/w05uCq6Gb4C7FhV2jQC SfVb2mV3qSRaOkubL2R83tOkcRE8OMp70sKu9hYsimX2YXy7a+1kegJq4T2+Yzp0D4ZptuEVf1FBm GN8cfAd0ayjSasiCHQVcdITKbWUVyCgjcMSvp6XAt9ogi2LsSYdBUyOC2sqZrbOhthtCV1zsJ43iS 0LdrxaKaHEM8xarr4jVA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qgRbV-006CDb-2k; Wed, 13 Sep 2023 15:16:33 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qgRbR-006CA7-1l for linux-arm-kernel@lists.infradead.org; Wed, 13 Sep 2023 15:16:30 +0000 Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-401d80f4ef8so75603685e9.1 for ; Wed, 13 Sep 2023 08:16:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694618185; x=1695222985; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WNiCJ4XPctshWY8ffyi9hR4b/TdmnnAhBF7gV8ICkpY=; b=IHmOUc4LPcuEFDcMbOkA6dbDGBFragkjcWB5jV/HC+lVVFVFAbL/SyLNESUVF7jDBA Yseeeo/AYaaYy67qV/7uucu5kPMviaPeTpeCZFE70+Y0S8LOnCrSBYjYQDA841biILhu krIdMWbD+OYQpJaeOwImbXoCkATInsZDnyLMQJAcvlnDUS9i94FTWTpTe8h6UkOiVghP tfYL2KGgzahW0EkUS4tz7kLurXMN17ai5WQxmS9D+RwmET57+7jNhw9NUAwdr95vvK8C Hwh+EkxvlMNSKg4ACOKrkKQcx3e+gC1q/3hv1PqBtko7YsGYNhX/9+Q+HIeno7zE8X3v 4XFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694618185; x=1695222985; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WNiCJ4XPctshWY8ffyi9hR4b/TdmnnAhBF7gV8ICkpY=; b=sTw62Rfk7HHeJWmBBOau4gUB+qBFNRKi45Q1EjEruIo4fhwLm8r9zjlwefBuq4TNtH 82n8UwBsCkGFK3cxMZOEd/R52EnfElN6meh8kztVz2Hpy/K7ezVUx0yOK7eyqzMNOrsv mdkrOp5dFAHjTuoByLfpMEPr3EFJhYCtjAG1uvyxhNg+OE5p3Ll2z89j/xeuxBcMnbDk 6D/TTzO0jxMjnuK34Hh9XwfMQz2D8RKfqAnOz0CRi9AEid3HgUD/PRF3qa36gPhUjNsW 9/Lz51uI2Ah2OPFaciid2MXmBVNUf+/oUzc983OWRthVSdMuOUsjQ/nIZnZXh2t9xgPp FHGw== X-Gm-Message-State: AOJu0YwUBgH0SgLjaxAm1V1kqg4rwlM6+r8qG69VnqCAnMv4bEg4nN+m WWwetGGytSXCnSqVfPNKQ0jdWqxj0cKzfQ== X-Google-Smtp-Source: AGHT+IFtGPwLNzmJ9lGo6bgRROyUOek+CMPJmj33rLwvWVE4I8uylAeEe5p5UpRZq9go6jeZN8Tc3g== X-Received: by 2002:a1c:ed01:0:b0:3fc:21:2c43 with SMTP id l1-20020a1ced01000000b003fc00212c43mr2401041wmh.13.1694618184540; Wed, 13 Sep 2023 08:16:24 -0700 (PDT) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id s4-20020a05600c044400b003fee567235bsm2305140wmb.1.2023.09.13.08.16.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 08:16:24 -0700 (PDT) From: Romain Perier To: Alessandro Zummo , Alexandre Belloni , Daniel Palmer , Romain Perier , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-rtc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/3] ARM: dts: mstar: Enable rtc for SSD202D Date: Wed, 13 Sep 2023 17:16:06 +0200 Message-Id: <20230913151606.69494-4-romain.perier@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230913151606.69494-1-romain.perier@gmail.com> References: <20230913151606.69494-1-romain.perier@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230913_081629_588948_9B4AB2B8 X-CRM114-Status: GOOD ( 13.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This adds the definition of the rtc device node. It enables RTC block for SSD202D SoCs and newer. Signed-off-by: Romain Perier --- arch/arm/boot/dts/sigmastar/mstar-infinity2m.dtsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm/boot/dts/sigmastar/mstar-infinity2m.dtsi b/arch/arm/boot/dts/sigmastar/mstar-infinity2m.dtsi index 1b485efd7156..b4ac535a73c8 100644 --- a/arch/arm/boot/dts/sigmastar/mstar-infinity2m.dtsi +++ b/arch/arm/boot/dts/sigmastar/mstar-infinity2m.dtsi @@ -32,6 +32,11 @@ cpu1: cpu@1 { }; &riu { + rtc@6800 { + compatible = "mstar,ssd202d-rtc"; + reg = <0x6800 0x200>; + }; + smpctrl: smpctrl@204000 { reg = <0x204000 0x200>; status = "disabled";