Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3041596imu; Thu, 29 Nov 2018 14:31:41 -0800 (PST) X-Google-Smtp-Source: AFSGD/W3tipnRlEuhh5lqyHaQe8d6x/cQrhrqzDz7y6JlF+/RLOlI4W0HCxJERja1Pli9VRPB4el X-Received: by 2002:a17:902:7686:: with SMTP id m6mr3333700pll.179.1543530701211; Thu, 29 Nov 2018 14:31:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543530701; cv=none; d=google.com; s=arc-20160816; b=ZtWaSwLCCFabxSC17nT5aA83C8M+BKoPt3s002GjTnrbAxCVWRPcUnVh6QobNA5mb9 1cTV00gQG0y3DaSOymQVBDKmNbJL2mlvUS1Z2bXy0TOA6hd5OntXVP/rGFYaehfCaGUc JJVQPfIXDqfYN0dCKnJrDZZ8WS3S9Ao86AlmDmDqE8KIm5G4jCVHh3IqM5paqiEJdo8w 33CXxCOYZTdfocR47WcSPksDk8DskBQcNDU0yxklu7MBWbL3Jwezv9fzP6q8HAoGvXEH M4ejki3rMrBV+R1bicEbywKyEpTGKFXbaRIv5t38l1I7tdBDi1rjrsF9EpV4YL5tQrCL 0Wqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version:dkim-signature; bh=2QaAe4Zs9DSQ7ZMWdrOuXKDmoS5z0evRYwMmfRjPW1M=; b=Fg6B9+gAR1UE5lH9Zey6gFqHUC/OY0ekQpr7+M5f4JyJGrXJZIsLGzd96O+wVlE5Db YU8Ml7RLfFH/gJVOgHvlPNZIMFrKzWj6v4+vZdpWOCA8cqKJ4KkgA7KSjzTXB3OwJdTc WhY1l922OsoIm38YMlBkw8kkk8skj0smJp+8pV1h6cTf1AQ9VYv9xnhl0J6G/jujGD/K 5tx3tD+evesYpLPRx65dNxOmSvvL11GIAxRxPRr5TA3RhXkA7eItBvFuBH2uSJWfKwNM X27vY+y6ebzt0DRSG9lqqGLSiMrAOrjCIm+6vN5XegTHz1l/BVpsRrTYa/Ol9ZHT1boo 1OGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=t3odRjOW; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si2813419pgd.428.2018.11.29.14.31.26; Thu, 29 Nov 2018 14:31:41 -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=@kernel.org header.s=default header.b=t3odRjOW; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726827AbeK3Jgi (ORCPT + 99 others); Fri, 30 Nov 2018 04:36:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:56648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726385AbeK3Jgh (ORCPT ); Fri, 30 Nov 2018 04:36:37 -0500 Received: from localhost (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3F2B520863; Thu, 29 Nov 2018 22:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543530575; bh=2QaAe4Zs9DSQ7ZMWdrOuXKDmoS5z0evRYwMmfRjPW1M=; h=To:From:In-Reply-To:Cc:References:Subject:Date:From; b=t3odRjOWD8sO0m0lOm1DQM49DgOWK+6jn9pN5eN2zy3abLO+0TB7Tbhxy7d51jzml pz6q1m8inNGb3MEPgVmCUlKW+Gzo0DcdRyXZeLHBxbvtUQdjgSbMsGP1IxslMm/krk XY4QTginYdUvDUrDJwWlpmVEjHyTaWHbu4fnw52I= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: Janek Kotas From: Stephen Boyd In-Reply-To: Cc: "mark.rutland@arm.com" , "mturquette@baylibre.com" , "robh+dt@kernel.org" , "linux-clk@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <154223394933.88331.14659021245427374668@swboyd.mtv.corp.google.com> Message-ID: <154353057449.88331.10017415440005548379@swboyd.mtv.corp.google.com> User-Agent: alot/0.7 Subject: Re: [PATCH 2/2] clk: Add Fixed MMIO clock driver Date: Thu, 29 Nov 2018 14:29:34 -0800 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Janek Kotas (2018-11-15 00:27:15) > Thanks for the reply. > Jan > = > > On 14 Nov 2018, at 23:19, Stephen Boyd wrote: > > = > > Quoting Janek Kotas (2018-11-14 07:24:39) > >> This patch adds a driver for Fixed MMIO clock. > >> The driver reads a clock frequency value from a single 32-bit memory > >> mapped register and registers it as a fixed rate clock. > >> = > >> It can be enabled with COMMON_CLK_FIXED_MMIO Kconfig option. > >> = > >> Signed-off-by: Jan Kotas > > = > > Sounds like a fine idea. Except I can see how it will be abused if there > > are a handful of these fixed rate "clks" somewhere in memory that all > > get populated. = > > = > > Do you really have a fixed rate clk in hardware that exposes a single > > register, or do you have a set of them that some firmware is populating > > into an I/O memory space that we can read the fixed rates from? If it's > > the latter, I wonder why we can't just have the firmware populate the > > fixed rate clks into DT itself? > = > The first case. > We have a single register in a fixed location which contains = > the frequency of the main system clock. > This allows us to use the same image in emulation, FPGA > and simulation without any changes. > We usually don=E2=80=99t use a full bootloader, just a simple wrapper, > which initializes the necessary stuff and jumps to the kernel. So the hardware team has decided to throw a frequency register in there? Alright! Does that fixed rate clk generate its fixed rate from some other clk? I'm curious if this fixed rate clk has a parent source. It would also be good to make sure that any clks registered from this driver can't be populated from regions of memory like DDR. Can you confirm? I think it will fail, but it would be worth checking > = > > = > >> diff --git a/drivers/clk/clk-fixed-mmio.c b/drivers/clk/clk-fixed-mmio= .c > >> new file mode 100644 > >> index 0000000000..bbcadab345 > >> --- /dev/null > >> +++ b/drivers/clk/clk-fixed-mmio.c > = > > = > >> +} > >> + > >> +CLK_OF_DECLARE(fixed_mmio_clk, "fixed-mmio-clock", of_fixed_mmio_clk_= setup); > > = > > Any reason why this can't be a platform driver? It would make this much > > less DT specific and usable on other firmwares/platforms if we used a > > platform driver here. > > = > = > I looked at the fixed rate clock as a reference, but I can change it to = > a platform driver, if that=E2=80=99s preferred. > = Yes I'd prefer a platform driver unless there's some reason it can't be done. We may need to have both in case this needs to be populated very early, but if that isn't the case then just a platform driver for now.