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=-5.7 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, URIBL_BLOCKED,USER_AGENT_NEOMUTT 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 489A9C43387 for ; Fri, 14 Dec 2018 15:33:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 60F34206DD for ; Fri, 14 Dec 2018 15:33:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=verge.net.au header.i=@verge.net.au header.b="Zx9J+jur" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727668AbeLNPdg (ORCPT ); Fri, 14 Dec 2018 10:33:36 -0500 Received: from kirsty.vergenet.net ([202.4.237.240]:35572 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726344AbeLNPdg (ORCPT ); Fri, 14 Dec 2018 10:33:36 -0500 Received: from reginn.horms.nl (watermunt.horms.nl [80.127.179.77]) by kirsty.vergenet.net (Postfix) with ESMTPA id 61D8A25AD76; Sat, 15 Dec 2018 02:33:34 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=verge.net.au; s=mail; t=1544801614; bh=38cf1kJeuuuFhK9SU/edUHvVa7qRxa4ggOpmDGBaVr8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Zx9J+jurfWqZ+XWRhHMpkTyKgqMoXpWeL2+tcAJzBRpsVOIeUMID5VWn89Sz7jETC thnSuAhyKDJzZdwi+P9qVi+4uMm92EcBUfoloeV/ZXBd2bVUkWMEyJJ7TtsZSd7ESE YMPE6CfCQNgPhn0bvfZQqLdhigahcGLKnZ8Nj7x0= Received: by reginn.horms.nl (Postfix, from userid 7100) id 7C92B9403C3; Fri, 14 Dec 2018 16:33:32 +0100 (CET) Date: Fri, 14 Dec 2018 16:33:32 +0100 From: Simon Horman To: Sergei Shtylyov Cc: linux-renesas-soc@vger.kernel.org, Michael Turquette , Stephen Boyd , Geert Uytterhoeven , linux-clk@vger.kernel.org Subject: Re: [PATCH v2 2/4] clk: renesas: rcar-gen3-cpg: add spinlock Message-ID: <20181214153332.47ukfkkgdrnsysmb@verge.net.au> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organisation: Horms Solutions BV User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org On Tue, Dec 04, 2018 at 10:49:44PM +0300, Sergei Shtylyov wrote: > Protect the CPG register read-modify-write sequence with a spinlock. Spinlocks are expensive, I think an explanation of why this is necessary would be worthwhile. > > Signed-off-by: Sergei Shtylyov > > --- > Changes in version 2: > - new patch. > > drivers/clk/renesas/rcar-gen3-cpg.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > Index: renesas-drivers/drivers/clk/renesas/rcar-gen3-cpg.c > =================================================================== > --- renesas-drivers.orig/drivers/clk/renesas/rcar-gen3-cpg.c > +++ renesas-drivers/drivers/clk/renesas/rcar-gen3-cpg.c > @@ -30,14 +30,19 @@ > > #define CPG_RCKCR_CKSEL BIT(15) /* RCLK Clock Source Select */ > > +static spinlock_t cpg_lock; > + > static void cpg_reg_modify(void __iomem *reg, u32 clear, u32 set) > { > + unsigned long flags; > u32 val; > > + spin_lock_irqsave(&cpg_lock, flags); > val = readl(reg); > val &= ~clear; > val |= set; > writel(val, reg); > + spin_unlock_irqrestore(&cpg_lock, flags); > }; > > struct cpg_simple_notifier { > @@ -604,5 +609,8 @@ int __init rcar_gen3_cpg_init(const stru > if (attr) > cpg_quirks = (uintptr_t)attr->data; > pr_debug("%s: mode = 0x%x quirks = 0x%x\n", __func__, mode, cpg_quirks); > + > + spin_lock_init(&cpg_lock); > + > return 0; > } >