Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp6500464ybl; Wed, 15 Jan 2020 05:46:50 -0800 (PST) X-Google-Smtp-Source: APXvYqwiAdukvZffvilWLBXpbthQurK8t7leeLA+edb8sdhJ/7teIZpXS1/cP2Q75c+Rsd35u7sh X-Received: by 2002:a9d:62d9:: with SMTP id z25mr2582095otk.249.1579096010254; Wed, 15 Jan 2020 05:46:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579096010; cv=none; d=google.com; s=arc-20160816; b=HMPLjuD+FaOlfAEttHyadjeoGX86Pu/icsgzsqZRJRgVShMsMxBfgIxpXfuPJPC6WI PM9Nyb/88PQ6qqrsGISmroDW99P2bIXN1zgGAIEkkENeUC03iKpXsaAGKBcBj6ZNmAph Hq9g/feXvFiUPvJel0/NrtZ3UoUCN9pTmVYP9yMkggbmymAiXrLj5lOndWs0Xr4+bOqD NcsQXduDS0iMMEigmABJTAigP2wa0DNgZdN+xYMCjH5xmlRSnLaLGxkJUsfi5A5gN/qV +P/7CKRuknaqrUceFLeTVW/PGh1wfHeQW3+TaP0X0SXpHx60vfuDD+RLLBRPxQh/jOXB 3DCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject:dkim-signature; bh=DcJHzfmLyfO+PXyoEt3igYkw68sITV8r5Sdb5sGh2E8=; b=VSgAGV/tlfsDkB50Ss4WdOaX9Y5Z325Ef2qFPPw3CgD+S/+wLUg48xfbNSZuz5obAv DS//3ADiQDZwaDATh+tO3sNj/5AtJWfPCn/86fq/rZ4QAVQ3h9i5IXUpCPeSHSSCOKtf XtmAsrG6/Y1L7QDnOMkqsrBubeECDclInUmHHkLXoBz4WYfBLfeFBz0IDoBiotE0WmGw G3QcUJarojL880HCibxdc431m4JUrIwxr5dxQEkK8EKdmd1NpWWkdTbsHUYkkK9N8wl8 nKzIborppYfLodLkT+ZmZ8cBw4VwHj5iwQm/io+lDpUA62GQHODMv1RRIhP3XyvxY2Za /XFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xwaRsKFS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p62si9220158oig.101.2020.01.15.05.46.37; Wed, 15 Jan 2020 05:46:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xwaRsKFS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728915AbgAONon (ORCPT + 99 others); Wed, 15 Jan 2020 08:44:43 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:50491 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726088AbgAONom (ORCPT ); Wed, 15 Jan 2020 08:44:42 -0500 Received: by mail-wm1-f68.google.com with SMTP id a5so17963079wmb.0 for ; Wed, 15 Jan 2020 05:44:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=DcJHzfmLyfO+PXyoEt3igYkw68sITV8r5Sdb5sGh2E8=; b=xwaRsKFS7Fes0IEXTp1vjMIJjE/rVO9RFvA0q8WfltMr3ulVKI5K4sU8zbq828Fl4G 62Da4hzYlCgmkJ12Ji5aCjcI1TSdqTBiTAz68tw4thmXj61gE5maaMw6JtI9yHM2PNa4 Lr6KcSf5rUqcmGM113iOREIuS2CwDWY1Uwyjo1jdM57db/y0QL9I5Hi70cue7hmM2zwY CIFT0snU/6QwNWJhTYVK4489biPbTrLixu+Z5ALSXO6jodbfqXdsex3PRkK7uMQ6dvAq 3tUA9YSUDu7qoYElRHVVflicj4+iJaN8iv+s5xf3GBO22t4MBqa6YvzNVJQhDbikZgu+ QW3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=DcJHzfmLyfO+PXyoEt3igYkw68sITV8r5Sdb5sGh2E8=; b=HeIz0adVhjSnSSP4QNGS4EmGO20ENwz4uq4prch02hsSXGvQ5UmybUOU8jPS91mcbg ISEwg4kZj/fu4AS9tCeqwSqJt60z5ZeBj+m7PpuVWqufviun/MmJe/qQb2GBbQvKAFlf erdUXB+mpTCUKm7duyo8Vnutjn53uy1knD8m6+FG4PZ+rEl3He5sSGVzgvOsH6WAkyEx WzWXrS9wkYa1g0NIb+dAZvbLteK+o6+NzbX+AnisBs1fhnnBN9VRk34Fo/BzXBaxtnD9 +DSPNB8KP+i4Xk7RB8GfytwS0a9zNCOpGiDTSe5aTfmZowtRqJGQmel7nNT9vMV8xZS1 Ljew== X-Gm-Message-State: APjAAAWmWqHYT7pLmOORoFnG6ie/nHV+eYanGav/qm1MJndJQOxbr+js LxXXzote7ISQcqj0/8qrOcnw0G6bjLylZg== X-Received: by 2002:a05:600c:2290:: with SMTP id 16mr35303062wmf.93.1579095879164; Wed, 15 Jan 2020 05:44:39 -0800 (PST) Received: from ?IPv6:2a01:e34:ed2f:f020:ac8b:fcee:b80:ebae? ([2a01:e34:ed2f:f020:ac8b:fcee:b80:ebae]) by smtp.googlemail.com with ESMTPSA id e6sm25714241wru.44.2020.01.15.05.44.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Jan 2020 05:44:38 -0800 (PST) Subject: Re: [PATCH v3] clocksource: Add driver for the Ingenic JZ47xx OST To: Paul Cercueil , Thomas Gleixner Cc: od@zcrc.me, linux-kernel@vger.kernel.org, Maarten ter Huurne , Mathieu Malaterre , Artur Rojek References: <20200114150619.14611-1-paul@crapouillou.net> From: Daniel Lezcano Autocrypt: addr=daniel.lezcano@linaro.org; prefer-encrypt=mutual; keydata= xsFNBFv/yykBEADDdW8RZu7iZILSf3zxq5y8YdaeyZjI/MaqgnvG/c3WjFaunoTMspeusiFE sXvtg3ehTOoyD0oFjKkHaia1Zpa1m/gnNdT/WvTveLfGA1gH+yGes2Sr53Ht8hWYZFYMZc8V 2pbSKh8wepq4g8r5YI1XUy9YbcTdj5mVrTklyGWA49NOeJz2QbfytMT3DJmk40LqwK6CCSU0 9Ed8n0a+vevmQoRZJEd3Y1qXn2XHys0F6OHCC+VLENqNNZXdZE9E+b3FFW0lk49oLTzLRNIq 0wHeR1H54RffhLQAor2+4kSSu8mW5qB0n5Eb/zXJZZ/bRiXmT8kNg85UdYhvf03ZAsp3qxcr xMfMsC7m3+ADOtW90rNNLZnRvjhsYNrGIKH8Ub0UKXFXibHbafSuq7RqyRQzt01Ud8CAtq+w P9EftUysLtovGpLSpGDO5zQ++4ZGVygdYFr318aGDqCljKAKZ9hYgRimPBToDedho1S1uE6F 6YiBFnI3ry9+/KUnEP6L8Sfezwy7fp2JUNkUr41QF76nz43tl7oersrLxHzj2dYfWUAZWXva wW4IKF5sOPFMMgxoOJovSWqwh1b7hqI+nDlD3mmVMd20VyE9W7AgTIsvDxWUnMPvww5iExlY eIC0Wj9K4UqSYBOHcUPrVOKTcsBVPQA6SAMJlt82/v5l4J0pSQARAQABzSpEYW5pZWwg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rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200114150619.14611-1-paul@crapouillou.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/01/2020 16:06, Paul Cercueil wrote: > From: Maarten ter Huurne > > OST is the OS Timer, a 64-bit timer/counter with buffered reading. > > SoCs before the JZ4770 had (if any) a 32-bit OST; the JZ4770 and > JZ4780 have a 64-bit OST. > > This driver will register both a clocksource and a sched_clock to the > system. Is the JZ47xx OST really a mfd needing a regmap? (Note regmap_read will take a lock). > Signed-off-by: Maarten ter Huurne > Signed-off-by: Paul Cercueil > Tested-by: Mathieu Malaterre > Tested-by: Artur Rojek > --- > > Notes: > v2: local_irq_save/restore were moved within sched_clock_register > v3: Only register as 32-bit clocksource to simplify things > > drivers/clocksource/Kconfig | 8 ++ > drivers/clocksource/Makefile | 1 + > drivers/clocksource/ingenic-ost.c | 183 ++++++++++++++++++++++++++++++ > 3 files changed, 192 insertions(+) > create mode 100644 drivers/clocksource/ingenic-ost.c > > diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig > index 5fdd76cb1768..5be2f876f64f 100644 > --- a/drivers/clocksource/Kconfig > +++ b/drivers/clocksource/Kconfig > @@ -697,4 +697,12 @@ config INGENIC_TIMER > help > Support for the timer/counter unit of the Ingenic JZ SoCs. > > +config INGENIC_OST > + bool "Ingenic JZ47xx Operating System Timer" > + depends on MIPS || COMPILE_TEST > + depends on COMMON_CLK > + select MFD_SYSCON > + help > + Support for the OS Timer of the Ingenic JZ4770 or similar SoC. > + > endmenu > diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile > index 4dfe4225ece7..6bc97a6fd229 100644 > --- a/drivers/clocksource/Makefile > +++ b/drivers/clocksource/Makefile > @@ -80,6 +80,7 @@ obj-$(CONFIG_ASM9260_TIMER) += asm9260_timer.o > obj-$(CONFIG_H8300_TMR8) += h8300_timer8.o > obj-$(CONFIG_H8300_TMR16) += h8300_timer16.o > obj-$(CONFIG_H8300_TPU) += h8300_tpu.o > +obj-$(CONFIG_INGENIC_OST) += ingenic-ost.o > obj-$(CONFIG_INGENIC_TIMER) += ingenic-timer.o > obj-$(CONFIG_CLKSRC_ST_LPC) += clksrc_st_lpc.o > obj-$(CONFIG_X86_NUMACHIP) += numachip.o > diff --git a/drivers/clocksource/ingenic-ost.c b/drivers/clocksource/ingenic-ost.c > new file mode 100644 > index 000000000000..2c91e3b34572 > --- /dev/null > +++ b/drivers/clocksource/ingenic-ost.c > @@ -0,0 +1,183 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * JZ47xx SoCs TCU Operating System Timer driver > + * > + * Copyright (C) 2016 Maarten ter Huurne > + * Copyright (C) 2020 Paul Cercueil > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#define TCU_OST_TCSR_MASK 0xffc0 > +#define TCU_OST_TCSR_CNT_MD BIT(15) > + > +#define TCU_OST_CHANNEL 15 > + > +struct ingenic_ost_soc_info { > + bool is64bit; > +}; > + > +struct ingenic_ost { > + struct regmap *map; > + struct clk *clk; > + > + struct clocksource cs; > +}; > + > +static struct ingenic_ost *ingenic_ost; > + > +static u64 notrace ingenic_ost_read_cntl(void) > +{ > + u32 val; > + > + regmap_read(ingenic_ost->map, TCU_REG_OST_CNTL, &val); > + > + return val; > +} > + > +static u64 notrace ingenic_ost_read_cnth(void) > +{ > + u32 val; > + > + regmap_read(ingenic_ost->map, TCU_REG_OST_CNTH, &val); > + > + return val; > +} > + > +static u64 notrace ingenic_ost_clocksource_readl(struct clocksource *cs) > +{ > + return ingenic_ost_read_cntl(); > +} > + > +static u64 notrace ingenic_ost_clocksource_readh(struct clocksource *cs) > +{ > + return ingenic_ost_read_cnth(); > +} > + > +static int __init ingenic_ost_probe(struct platform_device *pdev) > +{ > + const struct ingenic_ost_soc_info *soc_info; > + struct device *dev = &pdev->dev; > + struct ingenic_ost *ost; > + struct clocksource *cs; > + unsigned long rate; > + int err; > + > + soc_info = device_get_match_data(dev); > + if (!soc_info) > + return -EINVAL; > + > + ost = devm_kzalloc(dev, sizeof(*ost), GFP_KERNEL); > + if (!ost) > + return -ENOMEM; > + > + ingenic_ost = ost; > + > + ost->map = device_node_to_regmap(dev->parent->of_node); > + if (!ost->map) { > + dev_err(dev, "regmap not found\n"); > + return -EINVAL; > + } > + > + ost->clk = devm_clk_get(dev, "ost"); > + if (IS_ERR(ost->clk)) > + return PTR_ERR(ost->clk); > + > + err = clk_prepare_enable(ost->clk); > + if (err) > + return err; > + > + /* Clear counter high/low registers */ > + if (soc_info->is64bit) > + regmap_write(ost->map, TCU_REG_OST_CNTL, 0); > + regmap_write(ost->map, TCU_REG_OST_CNTH, 0); > + > + /* Don't reset counter at compare value. */ > + regmap_update_bits(ost->map, TCU_REG_OST_TCSR, > + TCU_OST_TCSR_MASK, TCU_OST_TCSR_CNT_MD); > + > + rate = clk_get_rate(ost->clk); > + > + /* Enable OST TCU channel */ > + regmap_write(ost->map, TCU_REG_TESR, BIT(TCU_OST_CHANNEL)); > + > + cs = &ost->cs; > + cs->name = "ingenic-ost"; > + cs->rating = 320; > + cs->flags = CLOCK_SOURCE_IS_CONTINUOUS; > + cs->mask = CLOCKSOURCE_MASK(32); > + > + if (soc_info->is64bit) > + cs->read = ingenic_ost_clocksource_readl; > + else > + cs->read = ingenic_ost_clocksource_readh; > + > + err = clocksource_register_hz(cs, rate); > + if (err) { > + dev_err(dev, "clocksource registration failed: %d\n", err); > + clk_disable_unprepare(ost->clk); > + return err; > + } > + > + if (soc_info->is64bit) > + sched_clock_register(ingenic_ost_read_cntl, 32, rate); > + else > + sched_clock_register(ingenic_ost_read_cnth, 32, rate); > + return 0; > +} > + > +static int __maybe_unused ingenic_ost_suspend(struct device *dev) > +{ > + struct ingenic_ost *ost = dev_get_drvdata(dev); > + > + clk_disable(ost->clk); > + > + return 0; > +} > + > +static int __maybe_unused ingenic_ost_resume(struct device *dev) > +{ > + struct ingenic_ost *ost = dev_get_drvdata(dev); > + > + return clk_enable(ost->clk); > +} > + > +static const struct dev_pm_ops __maybe_unused ingenic_ost_pm_ops = { > + /* _noirq: We want the OST clock to be gated last / ungated first */ > + .suspend_noirq = ingenic_ost_suspend, > + .resume_noirq = ingenic_ost_resume, > +}; > + > +static const struct ingenic_ost_soc_info jz4725b_ost_soc_info = { > + .is64bit = false, > +}; > + > +static const struct ingenic_ost_soc_info jz4770_ost_soc_info = { > + .is64bit = true, > +}; > + > +static const struct of_device_id ingenic_ost_of_match[] = { > + { .compatible = "ingenic,jz4725b-ost", .data = &jz4725b_ost_soc_info, }, > + { .compatible = "ingenic,jz4770-ost", .data = &jz4770_ost_soc_info, }, > + { } > +}; > + > +static struct platform_driver ingenic_ost_driver = { > + .driver = { > + .name = "ingenic-ost", > +#ifdef CONFIG_PM_SUSPEND > + .pm = &ingenic_ost_pm_ops, > +#endif > + .of_match_table = ingenic_ost_of_match, > + }, > +}; > +builtin_platform_driver_probe(ingenic_ost_driver, ingenic_ost_probe); > -- Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog