From patchwork Sun Dec 12 18:19:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12695805 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 74E14C433EF for ; Sun, 12 Dec 2021 18:20:56 +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=Ink/wXxe6YORl7qeLUoB9Z2wLtSSB1oZ/w6DLr3hdU4=; b=mtT2dy6HwXXPIW raGL8R5Yw1CxvNZUbAgnRIaqxpmogizL18p0Z2UmajaVIYx3DKoIAEDBOC5d4kt4UD9mp6R2jCd8T gWB6Jm/1VQS88s+TQsCUNX2dI+D4ewvnYj4GSn+igmK69dktu9P0TrkoIYT330CIP5eIJyBYTM+by cntbyXcKKB1ZDGdObyBReDqfD2Xhq3zaQhbz8mIyCwFY/VR8cPm9WIdHgWHYk9ACc0/3Iq26W1TIX Kl0cU6YRTqcpWmbLRpe4ix/4NoSeuL2dXMqmEE0pkNM+qJyCqzYzVL2GkbfYKgAf4uqyNJ6UzRh1T raP8WwCw7F55+YSIMz4w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwTRV-006vdb-Kg; Sun, 12 Dec 2021 18:19:25 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwTRI-006vVm-Df for linux-arm-kernel@lists.infradead.org; Sun, 12 Dec 2021 18:19:14 +0000 Received: by mail-wm1-x32d.google.com with SMTP id y196so10459695wmc.3 for ; Sun, 12 Dec 2021 10:19:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x1CCyeqZjLQP/QA6txvGs7SUKWsOfeVon28BT2DtngA=; b=hznFwwKSFj/RrNhrHEo07pMJHMJXZWmbuDOsLT6Agc4pLBsl9j/dUHAP+NDj2fa10j GYodUskmQzWl8dFWouarmw2hKnT/irW//0m6UyrBk13xGa9ntqPbxzNLG4DHsbDfxZdO YAEmRkmhU9Zy+gN1SrB83TDpqvvEn4AQPeSyE2OMdR0mtHmEZ68I3RMKdz7HeEdWCd8i 22F9eiBnf+3YY4yLqVpGPxyPlVaqJDPmztWFm3dU3RIJf6TX46DiOeptXK5A5E2Rd8eZ ISQSWH6Sc1hKHSqx2Q2hCkdgrb31hPJrAqiz34FzI1MBpk01h9mqhp9LJsthXYKmmvN2 xxLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x1CCyeqZjLQP/QA6txvGs7SUKWsOfeVon28BT2DtngA=; b=bGZ+0A2ubitkrrkKI5S3EVZITMILFDAs6dJCcbB9HfmM7SCPSuNVxEOX8WLOxUlKBV Y+QSg60CkEh4Jn+WNR3aX6nTS3GZppIH4rTnXWq09wsbqr3H4XHItXq+fzc7+nM6TywM ddYEWMs8ZfgrGM2VCOkrQ3IHE3bj3KAhkJWoEFasc9cPu7CFrw7dzGFtLhYbb0hsxFe3 LBLcjpuVPYfU/9MMBhKghTH36rfyI2E6HW/GP/y5qV9XbjvpYBf5qgzwrbWrbon8ryRP lG/X5KjQ0BzFkwPoJhn3qOC+c84dqlVpOqDrrhROcUVmCIAdhJz3UwQfaXR/ewBc301Z m1Ww== X-Gm-Message-State: AOAM532qA9zMaUjzEBvu2gs7gCWi4Oczpze05MQtCOWflE4mk7Ii0YMv 9lnFyM+bddrRGTwdR4vpNrk= X-Google-Smtp-Source: ABdhPJw7Mz3EAN015K7fPeIar+K0oyjf3mZ4Gryw3Mw970kgkzUy0PrvnRXeArB2LiHruhwy0KH1jA== X-Received: by 2002:a1c:f416:: with SMTP id z22mr31893349wma.121.1639333150047; Sun, 12 Dec 2021 10:19:10 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id w15sm8122500wrk.77.2021.12.12.10.19.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 10:19:09 -0800 (PST) From: Romain Perier To: Daniel Lezcano , Thomas Gleixner , Daniel Palmer , Romain Perier , Rob Herring , Russell King Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/6] clocksource: Add MStar MSC313e timer support Date: Sun, 12 Dec 2021 19:19:01 +0100 Message-Id: <20211212181906.94062-2-romain.perier@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211212181906.94062-1-romain.perier@gmail.com> References: <20211212181906.94062-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-20211212_101912_492462_54A0A0C3 X-CRM114-Status: GOOD ( 25.42 ) 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 The MSC313e-compatible SoCs have 3 timer hardware blocks. All of these are free running 32-bit increasing counters and can generate interrupts. Based onto a maximum value register, each timer can either count from 0 to max, one time then stop (which generates interrupts) or can count from 0 to max and then roll. This commit adds basic support for these timers, the first timer block being used as clocksource/sched_clock and delay, while the others will be used as clockevents. Signed-off-by: Romain Perier Co-developed-by: Daniel Palmer Signed-off-by: Daniel Palmer --- MAINTAINERS | 1 + drivers/clocksource/Kconfig | 9 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-msc313e.c | 244 ++++++++++++++++++++++++++++ 4 files changed, 255 insertions(+) create mode 100644 drivers/clocksource/timer-msc313e.c diff --git a/MAINTAINERS b/MAINTAINERS index 43007f2d29e0..4dbc122c7937 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2291,6 +2291,7 @@ F: Documentation/devicetree/bindings/gpio/mstar,msc313-gpio.yaml F: arch/arm/boot/dts/mstar-* F: arch/arm/mach-mstar/ F: drivers/clk/mstar/ +F: drivers/clocksource/timer-msc313e.c F: drivers/gpio/gpio-msc313.c F: drivers/rtc/rtc-msc313.c F: drivers/watchdog/msc313e_wdt.c diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index f65e31bab9ae..ba46d6860e2d 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -671,6 +671,15 @@ config MILBEAUT_TIMER help Enables the support for Milbeaut timer driver. +config MSC313E_TIMER + bool "MSC313E timer driver" if COMPILE_TEST + select TIMER_OF + select CLKSRC_MMIO + help + Enables support for the MStar MSC313E timer driver. + This provides access to multiple interrupt generating + programmable 32-bit free running incrementing counters. + config INGENIC_TIMER bool "Clocksource/timer using the TCU in Ingenic JZ SoCs" default MACH_INGENIC diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index c17ee32a7151..fa5f624eadb6 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -88,3 +88,4 @@ obj-$(CONFIG_CSKY_MP_TIMER) += timer-mp-csky.o obj-$(CONFIG_GX6605S_TIMER) += timer-gx6605s.o obj-$(CONFIG_HYPERV_TIMER) += hyperv_timer.o obj-$(CONFIG_MICROCHIP_PIT64B) += timer-microchip-pit64b.o +obj-$(CONFIG_MSC313E_TIMER) += timer-msc313e.o diff --git a/drivers/clocksource/timer-msc313e.c b/drivers/clocksource/timer-msc313e.c new file mode 100644 index 000000000000..154e73444a0c --- /dev/null +++ b/drivers/clocksource/timer-msc313e.c @@ -0,0 +1,244 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * MStar timer driver + * + * Copyright (C) 2021 Daniel Palmer + * Copyright (C) 2021 Romain Perier + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef CONFIG_ARM +#include +#endif + +#include "timer-of.h" + +#define TIMER_NAME "msc313e_timer" + +#define MSC313E_REG_CTRL 0x00 +#define MSC313E_REG_CTRL_TIMER_EN BIT(0) +#define MSC313E_REG_CTRL_TIMER_TRIG BIT(1) +#define MSC313E_REG_CTRL_TIMER_INT_EN BIT(8) +#define MSC313E_REG_TIMER_MAX_LOW 0x08 +#define MSC313E_REG_TIMER_MAX_HIGH 0x0c +#define MSC313E_REG_COUNTER_LOW 0x10 +#define MSC313E_REG_COUNTER_HIGH 0x14 + +#define TIMER_SYNC_TICKS 3 + +#ifdef CONFIG_ARM +struct msc313e_delay { + void __iomem *base; + struct delay_timer delay; +}; +static struct msc313e_delay msc313e_delay; +#endif + +static void __iomem *msc313e_clksrc; + +static void msc313e_timer_stop(void __iomem *base) +{ + writew(0, base + MSC313E_REG_CTRL); +} + +static void msc313e_timer_start(void __iomem *base, bool periodic) +{ + u16 reg; + + reg = readw(base + MSC313E_REG_CTRL); + if (periodic) + reg |= MSC313E_REG_CTRL_TIMER_EN; + else + reg |= MSC313E_REG_CTRL_TIMER_TRIG; + writew(reg | MSC313E_REG_CTRL_TIMER_INT_EN, base + MSC313E_REG_CTRL); +} + +static void msc313e_timer_setup(void __iomem *base, unsigned long delay) +{ + unsigned long flags; + + local_irq_save(flags); + writew(delay >> 16, base + MSC313E_REG_TIMER_MAX_HIGH); + writew(delay & 0xffff, base + MSC313E_REG_TIMER_MAX_LOW); + local_irq_restore(flags); +} + +static unsigned long msc313e_timer_current_value(void __iomem *base) +{ + unsigned long flags; + u16 l, h; + + local_irq_save(flags); + l = readw(base + MSC313E_REG_COUNTER_LOW); + h = readw(base + MSC313E_REG_COUNTER_HIGH); + local_irq_restore(flags); + + return (((u32)h) << 16 | l); +} + +static int msc313e_timer_clkevt_shutdown(struct clock_event_device *evt) +{ + struct timer_of *timer = to_timer_of(evt); + + msc313e_timer_stop(timer_of_base(timer)); + + return 0; +} + +static int msc313e_timer_clkevt_set_oneshot(struct clock_event_device *evt) +{ + struct timer_of *timer = to_timer_of(evt); + + msc313e_timer_stop(timer_of_base(timer)); + msc313e_timer_start(timer_of_base(timer), false); + + return 0; +} + +static int msc313e_timer_clkevt_set_periodic(struct clock_event_device *evt) +{ + struct timer_of *timer = to_timer_of(evt); + + msc313e_timer_stop(timer_of_base(timer)); + msc313e_timer_setup(timer_of_base(timer), timer_of_period(timer)); + msc313e_timer_start(timer_of_base(timer), true); + + return 0; +} + +static int msc313e_timer_clkevt_next_event(unsigned long evt, struct clock_event_device *clkevt) +{ + struct timer_of *timer = to_timer_of(clkevt); + + msc313e_timer_stop(timer_of_base(timer)); + msc313e_timer_setup(timer_of_base(timer), evt); + msc313e_timer_start(timer_of_base(timer), false); + + return 0; +} + +static irqreturn_t msc313e_timer_clkevt_irq(int irq, void *dev_id) +{ + struct clock_event_device *evt = dev_id; + + evt->event_handler(evt); + + return IRQ_HANDLED; +} + +static u64 msc313e_timer_clksrc_read(struct clocksource *cs) +{ + return msc313e_timer_current_value(msc313e_clksrc) & cs->mask; +} + +#ifdef CONFIG_ARM +static unsigned long msc313e_read_delay_timer_read(void) +{ + return msc313e_timer_current_value(msc313e_delay.base); +} +#endif + +static u64 msc313e_timer_sched_clock_read(void) +{ + return msc313e_timer_current_value(msc313e_clksrc); +} + +static struct clock_event_device msc313e_clkevt = { + .name = TIMER_NAME, + .rating = 300, + .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, + .set_state_shutdown = msc313e_timer_clkevt_shutdown, + .set_state_periodic = msc313e_timer_clkevt_set_periodic, + .set_state_oneshot = msc313e_timer_clkevt_set_oneshot, + .tick_resume = msc313e_timer_clkevt_shutdown, + .set_next_event = msc313e_timer_clkevt_next_event, +}; + +static int __init msc313e_clkevt_init(struct device_node *np) +{ + int ret; + struct timer_of *to; + + to = kzalloc(sizeof(*to), GFP_KERNEL); + if (!to) + return -ENOMEM; + + to->flags = TIMER_OF_IRQ | TIMER_OF_CLOCK | TIMER_OF_BASE; + to->of_irq.handler = msc313e_timer_clkevt_irq; + ret = timer_of_init(np, to); + if (ret) + return ret; + + msc313e_clkevt.cpumask = cpu_possible_mask; + msc313e_clkevt.irq = to->of_irq.irq; + to->clkevt = msc313e_clkevt; + + clockevents_config_and_register(&to->clkevt, timer_of_rate(to), + TIMER_SYNC_TICKS, 0xffffffff); + return 0; +} + +static int __init msc313e_clksrc_init(struct device_node *np) +{ + struct timer_of to = { 0 }; + int ret; + u16 reg; + + to.flags = TIMER_OF_BASE | TIMER_OF_CLOCK; + ret = timer_of_init(np, &to); + if (ret) + return ret; + + msc313e_clksrc = timer_of_base(&to); + reg = readw(msc313e_clksrc + MSC313E_REG_CTRL); + reg |= MSC313E_REG_CTRL_TIMER_EN; + writew(reg, msc313e_clksrc + MSC313E_REG_CTRL); + +#ifdef CONFIG_ARM + msc313e_delay.base = timer_of_base(&to); + msc313e_delay.delay.read_current_timer = msc313e_read_delay_timer_read; + msc313e_delay.delay.freq = timer_of_rate(&to); + + register_current_timer_delay(&msc313e_delay.delay); +#endif + + sched_clock_register(msc313e_timer_sched_clock_read, 32, timer_of_rate(&to)); + return clocksource_mmio_init(timer_of_base(&to), TIMER_NAME, timer_of_rate(&to), 300, 32, + msc313e_timer_clksrc_read); +} + +static int __init msc313e_timer_init(struct device_node *np) +{ + int ret = 0; + static int num_called; + + switch (num_called) { + case 0: + ret = msc313e_clksrc_init(np); + if (ret) + return ret; + break; + + default: + ret = msc313e_clkevt_init(np); + if (ret) + return ret; + break; + } + + num_called++; + + return 0; +} + +TIMER_OF_DECLARE(msc313, "mstar,msc313e-timer", msc313e_timer_init); From patchwork Sun Dec 12 18:19:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12695806 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 45400C433EF for ; Sun, 12 Dec 2021 18:21:03 +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=rwPsmxop9t4qQYJrfwIOXcEwef5CSACCguk08XrvuQ4=; b=oQxbEXWuCPYRJw 44OaPqC4CXteb0t+Bv5zK8RFiq26xGTyyTHpsHZaVFMGkl+yKUkolbye0Foti2JLlkfhrq0ut5OGv nR+YiePDvnSx8xyGjk7lIxhUcCQ2I+9dFPMuSSiRr8cAxAVtmlT0LNriWtpMZlAx0X8UkOQWW4neC +1JUGjGjHkgc5Qp6qzDd7DbJFMo4Xr1w7BxJ13M5XCFfm6gEv8OuzO0nDDU5tLOxkqpbteOr8KwPL 6qlueecJZgBKQGxp4miDKb3i30U5Y52FarebRUXbXE2fkSWsrY2gwr4owfMj5A+5JFqOzCqeyBsFM dyA0A1w0D72w8SaBl3cA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwTRg-006vfb-2G; Sun, 12 Dec 2021 18:19:36 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwTRJ-006vW1-9t for linux-arm-kernel@lists.infradead.org; Sun, 12 Dec 2021 18:19:14 +0000 Received: by mail-wr1-x42f.google.com with SMTP id v11so23518560wrw.10 for ; Sun, 12 Dec 2021 10:19:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s89O9UyBnTEz8pj2LKhsXhinnDR/gR0LdEysrofCZnU=; b=W09La0BG+7pSgIm8pns3h5Skv/cgZCnaGCsZx3T32PGEMSnINojslOO4WUORoM0nh2 BFcfEAAuXYaBKckeiXHLVO5vrbjIqmiG81nYvey0eFnL9MvJGcZIYP5Rk44U4QeusBx7 3BUZp/PAtVdGLrhi94MaEephWMuI/WvoruuBP9PO32wCfR74zlAPa5gH4AwKEmnbxwN3 rKisWfqrclLAHGvJhgm62YYZriUkR2Tk0sWtLgBQv+nxVbE2IrjQ1OyiZlkQCov1rOSg 6btGMIi90+q3qwkWHNfSBob6k4HiQl75mOfNegfMTpYmEiRkNoDAmcMqvDS7BsPWgOnA mEIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=s89O9UyBnTEz8pj2LKhsXhinnDR/gR0LdEysrofCZnU=; b=ZtCiSbWfVasQB+D6mRkSmgmI2aX7+SmBwut6cAHvB4qJM43MQ7nonT3VSBXopYQkst irXkOo0pa8Rv3zTlhxT+EcxC9RCH91Waykum3stZJFuupLyHtF8vBIawonzTkCUV6SP5 HS07Xz7/hwZvO8R5uFGNPvtLA+X1B6gvVyB2SNw/FCd26CqUMJTX6o2xdBgy7ui2NWlQ JQUiNl1a8GwGBwNzu3HNXzq/gaNGRHvjhRdDrgbRJpkld44OBSkY1S8dtqnzPkGCmoIf 04K3NZo0kEWqnZ6e8y5mbyOO7n3ak+KKcrhko8fEA9Xy+bo04ci+PmJw38eqmCpPGo20 fTLA== X-Gm-Message-State: AOAM533836rxQdi64/E1gvxkZWPhJdK6PufREwThih7w5bDVouQcFJQi USd1BgpoMt0h3bio/NPfbe/yh0857dQ= X-Google-Smtp-Source: ABdhPJxw0+E/eGq5Uq2YIXWQ7Qq4DjXeY7Pi14KDR0/z1eOqy92l3jQg8gIKZFhe3LgUpWZX+b5yNw== X-Received: by 2002:a5d:58f9:: with SMTP id f25mr26777535wrd.206.1639333151056; Sun, 12 Dec 2021 10:19:11 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id l4sm8263879wrv.94.2021.12.12.10.19.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 10:19:10 -0800 (PST) From: Romain Perier To: Daniel Lezcano , Thomas Gleixner , Daniel Palmer , Romain Perier , Rob Herring , Russell King Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/6] clocksource: msc313e: Add support for ssd20xd-based platforms Date: Sun, 12 Dec 2021 19:19:02 +0100 Message-Id: <20211212181906.94062-3-romain.perier@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211212181906.94062-1-romain.perier@gmail.com> References: <20211212181906.94062-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-20211212_101913_365250_5EA185FB X-CRM114-Status: GOOD ( 13.92 ) 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 SSD20X family SoCs have an oscillator running at ~432Mhz for timer1 and timer2, while timer0 is running at 12Mhz. There are no ways to reduce or divide these clocks in the clktree. However, SSD20X SoCs provide an internal "timer_divide" register that can act on this input oscillator. This commit adds support for this register, as timer1 and timer2 are used as clockevents these will run at 48Mhz. Signed-off-by: Romain Perier --- drivers/clocksource/timer-msc313e.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/clocksource/timer-msc313e.c b/drivers/clocksource/timer-msc313e.c index 154e73444a0c..54c54ca7c786 100644 --- a/drivers/clocksource/timer-msc313e.c +++ b/drivers/clocksource/timer-msc313e.c @@ -33,7 +33,9 @@ #define MSC313E_REG_TIMER_MAX_HIGH 0x0c #define MSC313E_REG_COUNTER_LOW 0x10 #define MSC313E_REG_COUNTER_HIGH 0x14 +#define MSC313E_REG_TIMER_DIVIDE 0x18 +#define MSC313E_CLK_DIVIDER 9 #define TIMER_SYNC_TICKS 3 #ifdef CONFIG_ARM @@ -179,6 +181,12 @@ static int __init msc313e_clkevt_init(struct device_node *np) if (ret) return ret; + if (of_device_is_compatible(np, "sstar,ssd20xd-timer")) { + to->of_clk.rate = clk_get_rate(to->of_clk.clk) / MSC313E_CLK_DIVIDER; + to->of_clk.period = DIV_ROUND_UP(to->of_clk.rate, HZ); + writew(MSC313E_CLK_DIVIDER - 1, timer_of_base(to) + MSC313E_REG_TIMER_DIVIDE); + } + msc313e_clkevt.cpumask = cpu_possible_mask; msc313e_clkevt.irq = to->of_irq.irq; to->clkevt = msc313e_clkevt; @@ -242,3 +250,4 @@ static int __init msc313e_timer_init(struct device_node *np) } TIMER_OF_DECLARE(msc313, "mstar,msc313e-timer", msc313e_timer_init); +TIMER_OF_DECLARE(ssd20xd, "sstar,ssd20xd-timer", msc313e_timer_init); From patchwork Sun Dec 12 18:19:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12695807 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 D01C5C433EF for ; Sun, 12 Dec 2021 18:21:09 +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=YNix1q+s59RvwJbevk8phuOgqkXxz/TKtDEDGkrUGoY=; b=U8R6xl6BCh1OSK WoaDVOkR6KbVajcn7cmscgD7mpMGnxrcKBhUGW472A7BpzQFh8qSiXqePB5S6pG2EZ5CfN0dtdS9D o4Qo1qXypK8aoRGQAGzFeS6jWUnoB6YP7O3DaojLSDelKkmzSfDoyeq/oHRg/9ehS3bW9YwF6nyu9 UXExg8K8OHQnpB5UR0btY4ssaQTJamGIpngZ0trnBQDAWcJKwYveL8B8dhH/JI9qRcUTaG9bMUUcI IhT8L1f1SBa326HyN7mgb1zBZJ2E6L5HuPIAoRcbZz72InhvNmEGgZdGUQdOtUQTJ/nm7ne3TwXYo pqiQ8Dx/nt8V7EgVhxow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwTRr-006vjC-0d; Sun, 12 Dec 2021 18:19:47 +0000 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwTRJ-006vW9-GL for linux-arm-kernel@lists.infradead.org; Sun, 12 Dec 2021 18:19:15 +0000 Received: by mail-wr1-x431.google.com with SMTP id t18so23497291wrg.11 for ; Sun, 12 Dec 2021 10:19:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i19kb1HIi1Xsd5I+hkb6PULQ2un2r4KYU7MSxf9j0Is=; b=dhU6u1t5w/gbGYLFUHZif2lsTCppIrashJsHYnFTc6rtg1wfwQdztCtJANLxJLZoVW EaxDKt/qYHEo6XB1uDt7lgsurIf77Of9CFuV5FU50yHowEEnwF4Ts+za501nU3ovFWrF t0Y+bOfxxq7MdmKUQghT7PchciEMgDkIuGp3Q4oioxwj74n5FOkk/rjv4HIDAIqPGrCz aklFhLeJX0Li1o1PHTZGJZXdKXlzf/Gb9bUQ8ExYfEkSucJpgxy+N2lhRD9T9+FABhyX I/9kDuHkzw8dqBbZZdORElmGECq9CL00CzluNtj4rkvPQNsMN+Vt1rXta8gSorSMhyUl cCgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i19kb1HIi1Xsd5I+hkb6PULQ2un2r4KYU7MSxf9j0Is=; b=sZXI1w7rKP011fpSAXUXiZLiP5YXVn6vgyO4ke7WxIr9xfHf70lYqaHu83lIj8XhWF zyZCybEF0Oo+4tuc3WWdiIErIXlDDgVsQrNk4ZDCiKKR5slmT8KZwAyGuRw3hw9UP0Fw 8bqoyDrz6lJHQTrHAmSYpKsh3UNBOXQczsXzG2MKBFKOscnUE26pnTU9iZ7fX51cTsHy kImTgcGaGuZCTwdGxOaRZAy3bbc++ws14aUROFYXg7ETFjaQ+E0h4WrCoOo6nzTv+X0z EFlL9NXctL5y+jhjAcSG3jnw75fbAt4EySHf9xnlr80X5kT1+PSAjbBlzhLUBg3wEixb EnRA== X-Gm-Message-State: AOAM531TTZiT10tQfTAa50f/hZipXN5fY53+tzKa/Kd4wTEMxlGYUZcA K4BHPCt+tCq6Vcr14M+af2Y= X-Google-Smtp-Source: ABdhPJy4iscW+86WtDBokp9/K83XMVptdoD8RM/TKpnQk5wdHrqPCZyOu2ggt9K0fhR0pK6xiqWjYg== X-Received: by 2002:adf:ec45:: with SMTP id w5mr26151124wrn.183.1639333152035; Sun, 12 Dec 2021 10:19:12 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id c7sm6145660wrq.81.2021.12.12.10.19.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 10:19:11 -0800 (PST) From: Romain Perier To: Daniel Lezcano , Thomas Gleixner , Daniel Palmer , Romain Perier , Rob Herring , Russell King Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/6] ARM: mstar: Select MSC313E_TIMER Date: Sun, 12 Dec 2021 19:19:03 +0100 Message-Id: <20211212181906.94062-4-romain.perier@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211212181906.94062-1-romain.perier@gmail.com> References: <20211212181906.94062-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-20211212_101913_565687_75E5CAA9 X-CRM114-Status: GOOD ( 10.97 ) 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 All of the ARCH_MSTARV7 have timers that can act as clocksource or clockevents so select the corresponding driver. Signed-off-by: Romain Perier --- arch/arm/mach-mstar/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-mstar/Kconfig b/arch/arm/mach-mstar/Kconfig index cd300eeedc20..d079d567bb72 100644 --- a/arch/arm/mach-mstar/Kconfig +++ b/arch/arm/mach-mstar/Kconfig @@ -3,6 +3,7 @@ menuconfig ARCH_MSTARV7 depends on ARCH_MULTI_V7 select ARM_GIC select ARM_HEAVY_MB + select MSC313E_TIMER select MST_IRQ select MSTAR_MSC313_MPLL help From patchwork Sun Dec 12 18:19:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12695808 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 4EE5CC433EF for ; Sun, 12 Dec 2021 18:21:23 +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=NYP9A6x3KiVeFY8PSNTsaf0l3KK0ztfM/yBEUOMdB9c=; b=vG7MERqoHWvr3r AUisWhnipbUmTiv7tt4NHO4f2UBIuY2usB64Hv7Ey1jbdHjhM12aAge3I0ikhEFNXXAFGGf5lkUk3 ZIHXMzyzRSXxtAnp7aWgOqQTxjD20zpYuCgGC2WqqSuMCHp4WgKNMSyg/AtW/fq3L04BYWfTTMNKJ hbHX+HvZ95y7r5CGGYa7uj+na1rMCCyK22x2E0WsgqZqMZu7ig/H77/4bWXx4SzeH85S4MKoi6FMk NtrqciFzJAP/D+WAGgNOJT8n6W5PMwSoS/lLgMNUpEZHppFiGb25YErfg6iSL/PgxeqmCKpdHGiv0 odLwMfcVhUxaatoHrb8A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwTS1-006vm9-KU; Sun, 12 Dec 2021 18:19:57 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwTRK-006vWj-Ek for linux-arm-kernel@lists.infradead.org; Sun, 12 Dec 2021 18:19:16 +0000 Received: by mail-wr1-x42d.google.com with SMTP id d9so23578670wrw.4 for ; Sun, 12 Dec 2021 10:19:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t0nR4PIR3OnyUGUTm0c+KArFCzRTtEJ8r3UvB0CQeS4=; b=QFq1Bm+UG2w/MhI8RuxuY9xElFvii+rP5j8p5MLKeMkG1DqLsCY+HII7sNcPY1gasr 3GUyN0EnC69aRLdSVqPQuag3gyA4OpliXwET7SeRQjyuZpuDRotoF6RODrjr4HvL6mO8 venCb/1pdCPOgo7H+2EIAFVtIHsRdOLNv4B1MIU5ug46oiDa10Tj4PusAEUOwGxqhwHP CkNRbMPQU7eoYwQ4VrcgW/qc+vjK7NM2fyGCiBTie/PTxdlATUn3+x2cwDMnMc/yK2KV ekcv6tF/xqoH5WJ9lApEPZWumyvMBSLCIrVFfuWaX541bEA9ziilN40+CN2S6b8PdE7O 74OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=t0nR4PIR3OnyUGUTm0c+KArFCzRTtEJ8r3UvB0CQeS4=; b=nxicbmmyEV6kVYkmDv6xKji3lHNodM/3iSnh/l+Ky3wMvuiSlKODWHQg9ZwsiwkS7d 0vY4Z9irLdwxOqOxQhMmK2ZrpSZiiexjCLjGIKQrTCEqAxZQbdbzWikBXrRnW0r8X6UI aMFfx4+KN2EvLXG679RcJwGg9Qa0yiSn+0EpFAb8UQ5Ay5+7u8KRA6mM6Go/7f67kSYu c2W7grIb9Vo8XsCdKs6yR/VXf6LRd9ryW+fQ5hUDuO1jBKGHu17/8by58JAF+p/DT6LD Zj3sogf3NVgOh3hLYpAQD/r9/pg9pT2/AY1UV2RH8VIxilNjLxnhSmRXRmFjtqt9USmg hVnw== X-Gm-Message-State: AOAM533wZGl3vL3aAuGd6N2qYJPU6Wg5bmFAZf8+OgCzeoBJe3OFlHn6 UJUaQJeD20Ni32crNtUT5yg= X-Google-Smtp-Source: ABdhPJytrFUrVnTGh8Yd56GrBAMZLvk3RaThDeLPwSjdH5r/VLZ7WEBxC/FaoHdXfcBZA6GoKoTD7A== X-Received: by 2002:a05:6000:1a86:: with SMTP id f6mr87634wry.231.1639333152939; Sun, 12 Dec 2021 10:19:12 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id o12sm10580061wrc.85.2021.12.12.10.19.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 10:19:12 -0800 (PST) From: Romain Perier To: Daniel Lezcano , Thomas Gleixner , Daniel Palmer , Romain Perier , Rob Herring , Russell King Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/6] dt-bindings: timer: Add Mstar MSC313e timer devicetree bindings documentation Date: Sun, 12 Dec 2021 19:19:04 +0100 Message-Id: <20211212181906.94062-5-romain.perier@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211212181906.94062-1-romain.perier@gmail.com> References: <20211212181906.94062-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-20211212_101914_542722_A8619C68 X-CRM114-Status: GOOD ( 14.01 ) 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 documentation for the devicetree bindings of the Mstar MSC313e timer driver, found from MSC313e SoCs and newer. Signed-off-by: Romain Perier Reviewed-by: Rob Herring --- .../bindings/timer/mstar,msc313e-timer.yaml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/mstar,msc313e-timer.yaml diff --git a/Documentation/devicetree/bindings/timer/mstar,msc313e-timer.yaml b/Documentation/devicetree/bindings/timer/mstar,msc313e-timer.yaml new file mode 100644 index 000000000000..03d5dba5d5b3 --- /dev/null +++ b/Documentation/devicetree/bindings/timer/mstar,msc313e-timer.yaml @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/timer/mstar,msc313e-timer.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Mstar MSC313e Timer Device Tree Bindings + +maintainers: + - Daniel Palmer + - Romain Perier + +properties: + compatible: + enum: + - mstar,msc313e-timer + - sstar,ssd20xd-timer + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + +required: + - compatible + - reg + - interrupts + - clocks + +additionalProperties: false + +examples: + - | + #include + + timer@6040 { + compatible = "mstar,msc313e-timer"; + reg = <0x6040 0x40>; + clocks = <&xtal_div2>; + interrupts-extended = <&intc_fiq GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>; + }; +... From patchwork Sun Dec 12 18:19:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12695809 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 BD73AC433F5 for ; Sun, 12 Dec 2021 18:21:35 +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=iFMDhlzK2yDyEORwdmhp0sGTR12afxixTwVJXs58Hjk=; b=vki/Ubsv+TZge/ xSMP7IiJR24PbnZZsfKoTwxXwjIqRsaaYEGp+U+vnclErwVxiSR8KH0bKdyjc/pteJ/q1cGlzc0qn PfrNwfx4HrgvO337Q9XBHyr1tIOwCMlRE7F0IKU1OF2l3CRig4taWl12tUHsKP8F22H00X60eLIi8 8pBfim2ecB07WwJHeeO1xei56oz+mFmdAq+9QkXJ6GeTYnBAI3SNSZE18L5ldPlWZjcENRWreUBnm YqmhbPYc6mwWxJj4D8h/s2PuGDIK+RCrrFWeWvS65UXcuLmoIrwG1Q1eZSAeGefDtcUIrhU4069b0 mfaJLmNFt82QTAzXQgeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwTSE-006vqq-3R; Sun, 12 Dec 2021 18:20:10 +0000 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwTRL-006vYr-ED for linux-arm-kernel@lists.infradead.org; Sun, 12 Dec 2021 18:19:16 +0000 Received: by mail-wr1-x430.google.com with SMTP id d9so23578717wrw.4 for ; Sun, 12 Dec 2021 10:19:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a03oi73IUIbALiHeFayx9Bqv0K+rE4kVayfrAJF+ar0=; b=bJ7HV0II5L/l/UY9f/1rz7n0LlKqyMUJ5wBNEO6siMqV7t5IaFC9HBm/W+L3StgXsr HhvJzDDANYd81kVuDm7CCE+MBms93xOadoeh4IAw37lUCLxSPSRmV+jABMTwbY5sHmvM edthUPi9OIbmgMeVxwxA5OTIwMFsXGKcsKLWw5eJeTraJZ8qCj333QlAFVy5uF5H2dx3 22tOxGjVeKj18VQLfL8XmOTexrasCJlAZECAVXI5QPvMorOX8dOl/qOxzaMsRbnVVNFV r7zY1oZNomUql6Mmw6oiuYEDxntLEW5xMf79ilhLyzoxLNng7qYd/8N4WN6w+B8oLCzs rB6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a03oi73IUIbALiHeFayx9Bqv0K+rE4kVayfrAJF+ar0=; b=GvRNk5QMr1Qcppbgpnm5m79M7bImX1802tslw77w1fvBpcbANrrBykCwjs1Dl16je7 t1jE2n3rVpVHT6scUDrbN0a6RJFwFMw502NAHQpEaPfsuuwkYIQHHeEjfGWoG9KpQSh4 e6V6QcKRZZobK61I/WrWUt9rKPJBBZcz5jgxgL2O5/Rh4pDyxwaUDU8bCS1uTrl9MZoT lbO1/LsRlT862dZQJDzSXRSJBRqCUHmCxD/8nO+lZ5z6/KnOpUJGpf3dqNAs9b5+UdUk ECSwwMEw7yuzxURTEKQE2y9xRiY0e/ZKjkwzpDCMO/SjeVwjxHOtePrH3qJKDS4FrGMP rd0g== X-Gm-Message-State: AOAM5315Az2zsF2GHqJKUWjEUJOm5b2P/CCWPav3raSWmpL+403O0xBN UIok6FKab38qPGyJdzj/9UQ= X-Google-Smtp-Source: ABdhPJz2Lwt7Ww4KVXg7hy2a1buXV+yt4ukcRYrX8HH4Yyxc8ODF/E1VVMntO9HVqZV9yT6uswNFoQ== X-Received: by 2002:adf:f990:: with SMTP id f16mr26550621wrr.128.1639333153865; Sun, 12 Dec 2021 10:19:13 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id l22sm4482861wmp.34.2021.12.12.10.19.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 10:19:13 -0800 (PST) From: Romain Perier To: Daniel Lezcano , Thomas Gleixner , Daniel Palmer , Romain Perier , Rob Herring , Russell King Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/6] ARM: dts: mstar: Add timers device nodes Date: Sun, 12 Dec 2021 19:19:05 +0100 Message-Id: <20211212181906.94062-6-romain.perier@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211212181906.94062-1-romain.perier@gmail.com> References: <20211212181906.94062-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-20211212_101915_546322_48606D1C X-CRM114-Status: GOOD ( 11.58 ) 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 timers device node. Signed-off-by: Romain Perier --- arch/arm/boot/dts/mstar-v7.dtsi | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm/boot/dts/mstar-v7.dtsi b/arch/arm/boot/dts/mstar-v7.dtsi index 89ebfe4f29da..7ede4cec0af9 100644 --- a/arch/arm/boot/dts/mstar-v7.dtsi +++ b/arch/arm/boot/dts/mstar-v7.dtsi @@ -123,6 +123,26 @@ watchdog@6000 { clocks = <&xtal_div2>; }; + timer@6040 { + compatible = "mstar,msc313e-timer"; + reg = <0x6040 0x40>; + clocks = <&xtal_div2>; + interrupts-extended = <&intc_fiq GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>; + }; + + timer1: timer@6080 { + compatible = "mstar,msc313e-timer"; + reg = <0x6080 0x40>; + clocks = <&xtal_div2>; + interrupts-extended = <&intc_fiq GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>; + }; + + timer2: timer@60c0 { + compatible = "mstar,msc313e-timer"; + reg = <0x60c0 0x40>; + clocks = <&xtal_div2>; + interrupts-extended = <&intc_fiq GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>; + }; intc_fiq: interrupt-controller@201310 { compatible = "mstar,mst-intc"; From patchwork Sun Dec 12 18:19:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Romain Perier X-Patchwork-Id: 12695810 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 274B3C433EF for ; Sun, 12 Dec 2021 18:21:51 +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=GsB/dZInZKvVCpEoJ0z2/m6Yy/GqkZ8r1JTeP2zQapQ=; b=zY973U+XvP+94w h009pJZKal1FTTz7kbJkCasvamgweNYQ+qzCE6Jrx6Mf2/vsuFnKq0AS2rXX8l2gob/1RyJ1xz+l5 ta6CUtI8iUqZITSQaVg+MErV8U7X/LOMVsCNZRPL18S3epv4aeHnaifVvxUWvQ2e6T30omFZJz1SJ AmeffhqIH8yv/WemGMOhmKrFyrddN5mYswSG+As6J9n1nOTduh9xgYHF2ANO5ITwXbO7MjXZwCdyl 2WoRHBXWkc2dFDuEVFhkPcmyUu5DWLj86KkncPl7o+X7fnEHBUrlHPBS5XuBHITXWvTQna9Rv45Bn T/eDwyuXErtTVsvTsqyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwTSV-006vyo-13; Sun, 12 Dec 2021 18:20:27 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mwTRM-006vZU-CG for linux-arm-kernel@lists.infradead.org; Sun, 12 Dec 2021 18:19:17 +0000 Received: by mail-wr1-x42b.google.com with SMTP id a18so23549937wrn.6 for ; Sun, 12 Dec 2021 10:19:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nGnrWr0NF5OLbuEiP1aIoxLo7fEMlnWLFbea+5BaBr8=; b=eaVe1QK1XhzqumJqDuFZ34lO907+y5E4M/gufqJPI6YkEOMlQ+WBbDVkbrbTxzeXej g9rZ5L6qM/eXeV9/gG9kg57h8yoW0CxKWoARMmXg4Bkvl85/cVBDL7vbw97YU2M1n2mL X427RMVcvHrSTqgFptMbqbGjynR3CQQwl5EuiBWspLGH4G2/Z8gqs2a2oVrEYCJR46OG FZIO1Uks/Vqz5Moe89hwGfppUBh3yP8ljOwi+yLILgn76gGkr6WX2e6uoFHtf+PiWLyj 1IFxX/Y08yvXJ4tmXmo60cE8JJKUX4xlHVl6mUoGWZB/Yv1THgYv3TpPm/WXC5qdCEM7 Pugg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nGnrWr0NF5OLbuEiP1aIoxLo7fEMlnWLFbea+5BaBr8=; b=O2mskNucSGFmKe9rmjma9dQbnl27fVjHkl5gHh2+eDNUpfLH7wxUivvfY9GGQg9zCo KqHLuFG/d4crZ4gL7zMuCxD3Fcqpf0R6dwNj8hT4rFwvx36QZzCjAAFzfgA07+W/WepR Y6BUns9yn7ORSAc+x05+hnhdUxiKotkWMk8Q/djUg8MykjnRtxFQsXCKoW8qjf+IoFOr yJMSlgyidxqmM73tUKs1cruPY6nyLvUacQBia33R+2D/16FTxcHSn8aCVCzhnwGg3aWy 08bhTe3hRCySTr8SBoSOYGrjpdNuHln/WIU4BLfNvAgc9Lsa3Cu0X//q2+sw0MbFXZA+ PhYA== X-Gm-Message-State: AOAM530kSajwPOlsiKmNwNfgtiFkMYw7iLaLcXxmWxx6vhj8x3iXSKKv 0xpmZ92t4fyvWkPrL3zx4XQ= X-Google-Smtp-Source: ABdhPJyn8pA8sPgkLFSoPF9DUCjBtKTIOpXF3rhgdgPJFGZl5kYFWa6rYmv/W+xv3ZFgjZS+DGP4hA== X-Received: by 2002:a05:6000:120a:: with SMTP id e10mr27009896wrx.156.1639333154821; Sun, 12 Dec 2021 10:19:14 -0800 (PST) Received: from debby ([2a01:e0a:a6d:a8d0:7ff4:8f61:5574:9f95]) by smtp.gmail.com with ESMTPSA id m20sm4933803wmq.11.2021.12.12.10.19.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 Dec 2021 10:19:14 -0800 (PST) From: Romain Perier To: Daniel Lezcano , Thomas Gleixner , Daniel Palmer , Romain Perier , Rob Herring , Russell King Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 6/6] ARM: dts: mstar: Switch to compatible "sstar, ssd20xd-timer" on infinity2m Date: Sun, 12 Dec 2021 19:19:06 +0100 Message-Id: <20211212181906.94062-7-romain.perier@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211212181906.94062-1-romain.perier@gmail.com> References: <20211212181906.94062-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-20211212_101916_445137_8882660F X-CRM114-Status: GOOD ( 11.40 ) 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 defines the real oscillators as input of timer1 and timer2 and switch to "sstar,ssd20xd-timer". Signed-off-by: Romain Perier --- arch/arm/boot/dts/mstar-infinity2m.dtsi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm/boot/dts/mstar-infinity2m.dtsi b/arch/arm/boot/dts/mstar-infinity2m.dtsi index 6d4d1d224e96..080a18b9effb 100644 --- a/arch/arm/boot/dts/mstar-infinity2m.dtsi +++ b/arch/arm/boot/dts/mstar-infinity2m.dtsi @@ -6,6 +6,14 @@ #include "mstar-infinity.dtsi" +/ { + clk_timer: timer_clk { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <432000000>; + }; +}; + &cpus { cpu1: cpu@1 { device_type = "cpu"; @@ -20,3 +28,13 @@ smpctrl: smpctrl@204000 { status = "disabled"; }; }; + +&timer1 { + compatible = "sstar,ssd20xd-timer"; + clocks = <&clk_timer>; +}; + +&timer2 { + compatible = "sstar,ssd20xd-timer"; + clocks = <&clk_timer>; +};