From mboxrd@z Thu Jan 1 00:00:00 1970 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=-11.5 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 3157AC433FF for ; Mon, 12 Aug 2019 23:46:57 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0042D208C2 for ; Mon, 12 Aug 2019 23:46:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HpqqweCJ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fvfn+YRW" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0042D208C2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MLwM3vIOh8RSt2Z4vqWVUOHzt5W4KX7KKUJY/cYtKno=; b=HpqqweCJWSN9Dj 1TwxFbTGWQaB6dUbFgjL93nByNCwtWgqFdbaWYgDs1oX0DGb+XjL57WJBa6l9W4gK3GpoQodP/dXF stj/Y2ivlUZvjwNkojJC0o2fFsxymHcKAr77oQ9cPrmUa1GjqKyexwZO8kiuJYZuMWMO5r/OcFiRS cd7BegfGCiLNJe7PkpDAJLOhaBB+M2yFyy9puQRdXEENkUojKAgt2uiWB6t4rjWoeYOQucS5YquCB 5Dcc41amjSllzgWQHcBUsRqON81IthVJH9ho+4NVGd2lT/g+eTcSIK77Ytdqk495ShPb5eWWxCppf T2/iZq15zqTJEeiyyjGQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hxK1g-0002fP-2d; Mon, 12 Aug 2019 23:46:56 +0000 Received: from mail-ot1-x343.google.com ([2607:f8b0:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hxK1c-0002dx-Fs for linux-arm-kernel@lists.infradead.org; Mon, 12 Aug 2019 23:46:54 +0000 Received: by mail-ot1-x343.google.com with SMTP id b7so115459080otl.11 for ; Mon, 12 Aug 2019 16:46:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vEM0WhT9KiGV+XzQ8g0ACsk29KSJO4/VurYJJqZPp1s=; b=fvfn+YRWH317swlTo7hCPy+eX8eEw/abKK+fMBhLIYnM8OjH86td55IXA8ix7SQbF5 hvvGOEUBAhdjtfcpEf5pmVFoa1NtP4COg618jqD+zN1L0pDB8VjjcEuJwCc0iSLIe2Cb n+FuhOTWDugB5dRMhur5Ns2NX+syHET6SxeYowRsUaNElv6kVkop6c4o1W7Du4D6mB5q uTUoLELtMZ3fekQJuPNtEqr8mnsCtuRokYSI2NqZMAPtFUYYEeSJoOk5d6uw+JbnxC2x ZmvjPf7ES3PzdZNwPVG8iEIcjbDilYpXVVn3lnf9g2Q9tYKgi0KmhSA9ghx99su/HHsj Meuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vEM0WhT9KiGV+XzQ8g0ACsk29KSJO4/VurYJJqZPp1s=; b=Ja63M6LQA5mtLDEXj1KngJ+s6gV/8e7yhdYN0waGwsXIuHpYSFMuQc6GME6IBJOBE8 4Hlp/vmCk2LtMPhc448VAsE0uryptNa/gKdFA5PAotZGx1SisdkNKvHY/PXkF9qf9WkA QG1DD1iQ5HCEDCANK2gq2x3CME96X2EVjbM9Vc5ki76xELCTPOG37JI7RqG5QB9FJyJx /79KwjAxaGoaLaNtMy4X9YfZO6wbO0cMBgsRpBRmqiGRhq3UlarNv7F4vvCjjW0mYCCm vsngZnkMOVF9ZX++JpLiNekywT9js2qWDuW166LNhdjWrCyCeTZ5EN/0ihk9QNn55Lp8 hOvw== X-Gm-Message-State: APjAAAUzCufpBnDyqutapjbgEa6P5swgy8hpEA0WAnJsmnXHbnJCuix9 ubouWrMof4BWe8sh5MjW3P5HMKBVXteqxgYksv8= X-Google-Smtp-Source: APXvYqxgnXw3/hTVBwv8iDNhwE1yPX+hGlamB9R+ygkZWpAtXLSQV6s2CpUv+ICng0kTSrIM+MBId9mZ5Wuia3348wE= X-Received: by 2002:a6b:f002:: with SMTP id w2mr257922ioc.104.1565653610461; Mon, 12 Aug 2019 16:46:50 -0700 (PDT) MIME-Version: 1.0 References: <20190810052829.6032-1-tiny.windzz@gmail.com> <20190810052829.6032-9-tiny.windzz@gmail.com> In-Reply-To: From: Frank Lee Date: Tue, 13 Aug 2019 07:46:39 +0800 Message-ID: Subject: Re: [PATCH v5 08/18] thermal: sun8i: support mod clocks To: Vasily Khoruzhick X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190812_164652_551906_C6E3708F X-CRM114-Status: GOOD ( 22.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree , Linux PM , Maxime Ripard , Greg Kroah-Hartman , Daniel Lezcano , linux-kernel , Eduardo Valentin , Chen-Yu Tsai , Rob Herring , Jonathan.Cameron@huawei.com, Mauro Carvalho Chehab , rui.zhang@intel.com, "David S. Miller" , arm-linux Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org HI Vasily, On Sat, Aug 10, 2019 at 2:17 PM Vasily Khoruzhick wrote: > > On Fri, Aug 9, 2019 at 10:31 PM Yangtao Li wrote: > > > > H3 has extra clock, so introduce something in ths_thermal_chip/ths_device > > and adds the process of the clock. > > > > This is pre-work for supprt it. > > > > Signed-off-by: Yangtao Li > > --- > > drivers/thermal/sun8i_thermal.c | 17 ++++++++++++++++- > > 1 file changed, 16 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/thermal/sun8i_thermal.c b/drivers/thermal/sun8i_thermal.c > > index b934bc81eba7..6f4294c2aba7 100644 > > --- a/drivers/thermal/sun8i_thermal.c > > +++ b/drivers/thermal/sun8i_thermal.c > > @@ -54,6 +54,7 @@ struct tsensor { > > }; > > > > struct ths_thermal_chip { > > + bool has_mod_clk; > > int sensor_num; > > int offset; > > int scale; > > @@ -69,6 +70,7 @@ struct ths_device { > > struct regmap *regmap; > > struct reset_control *reset; > > struct clk *bus_clk; > > + struct clk *mod_clk; > > struct tsensor sensor[MAX_SENSOR_NUM]; > > }; > > > > @@ -274,6 +276,12 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev) > > if (IS_ERR(tmdev->bus_clk)) > > return PTR_ERR(tmdev->bus_clk); > > > > + if (tmdev->chip->has_mod_clk) { > > + tmdev->mod_clk = devm_clk_get(&pdev->dev, "mod"); > > + if (IS_ERR(tmdev->mod_clk)) > > + return PTR_ERR(tmdev->mod_clk); > > + } > > + > > ret = reset_control_deassert(tmdev->reset); > > if (ret) > > return ret; > > @@ -282,12 +290,18 @@ static int sun8i_ths_resource_init(struct ths_device *tmdev) > > if (ret) > > goto assert_reset; > > > > - ret = sun50i_ths_calibrate(tmdev); > > + ret = clk_prepare_enable(tmdev->mod_clk); > > You have to set rate of modclk before enabling it since you can't rely > on whatever bootloader left for you. > > Also I found that parameters you're using for PC_TEMP_PERIOD, ACQ0 and > ACQ1 are too aggressive and may result in high interrupt rate to the > point when it may stall RCU. I changed driver a bit to use params from > Philipp Rossak's work (modclk set to 4MHz, PC_TEMP_PERIOD is 7, ACQ0 > is 255, ACQ1 is 63) and it fixed RCU stalls for me, see [1] for > details. Why is the RCU stall happening, is it caused by a deadlock? Can you provide log information and your configuration? I am a bit curious. Thx, Yangtao > > [1] https://github.com/anarsoul/linux-2.6/commit/46b8bb0fe2ccd1cd88fa9181a2ecbf79e8d513b2 > > > > if (ret) > > goto bus_disable; > > > > + ret = sun50i_ths_calibrate(tmdev); > > + if (ret) > > + goto mod_disable; > > + > > return 0; > > > > +mod_disable: > > + clk_disable_unprepare(tmdev->mod_clk); > > bus_disable: > > clk_disable_unprepare(tmdev->bus_clk); > > assert_reset: > > @@ -395,6 +409,7 @@ static int sun8i_ths_remove(struct platform_device *pdev) > > { > > struct ths_device *tmdev = platform_get_drvdata(pdev); > > > > + clk_disable_unprepare(tmdev->mod_clk); > > clk_disable_unprepare(tmdev->bus_clk); > > reset_control_assert(tmdev->reset); > > > > -- > > 2.17.1 > > > > > > _______________________________________________ > > linux-arm-kernel mailing list > > linux-arm-kernel@lists.infradead.org > > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel