From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751864AbcGaTv2 (ORCPT ); Sun, 31 Jul 2016 15:51:28 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35130 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751329AbcGaTvU convert rfc822-to-8bit (ORCPT ); Sun, 31 Jul 2016 15:51:20 -0400 MIME-Version: 1.0 In-Reply-To: <1469832362-13947-1-git-send-email-zajec5@gmail.com> References: <1469797120-29298-1-git-send-email-zajec5@gmail.com> <1469832362-13947-1-git-send-email-zajec5@gmail.com> From: Paul Gortmaker Date: Sun, 31 Jul 2016 15:38:05 -0400 X-Google-Sender-Auth: PX15ozJzAf43IL-XHB1AafJoc0Y Message-ID: Subject: Re: [PATCH V2] clk: bcm: Add driver for Northstar ILP clock To: =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= Cc: Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Florian Fainelli , Jon Mason , Eric Anholt , Stephen Warren , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 29, 2016 at 6:45 PM, Rafał Miłecki wrote: > From: Rafał Miłecki > > This clock is present on cheaper Northstar devices like BCM53573 or > BCM47189 using Corex-A7. This driver uses PMU (Power Management Unit) > to calculate clock rate and allows using it in a generic (clk_*) way. > > Signed-off-by: Rafał Miłecki > --- > V2: Rebase on top of clk-next > Use ALP as parent clock > Improve comments > Switch from ioremap_nocache to ioremap > Check of_clk_add_provide result for error > --- > .../devicetree/bindings/clock/brcm,ns-ilp.txt | 26 ++++ > drivers/clk/bcm/Makefile | 1 + > drivers/clk/bcm/clk-ns-ilp.c | 147 +++++++++++++++++++++ > 3 files changed, 174 insertions(+) > create mode 100644 Documentation/devicetree/bindings/clock/brcm,ns-ilp.txt > create mode 100644 drivers/clk/bcm/clk-ns-ilp.c > > diff --git a/Documentation/devicetree/bindings/clock/brcm,ns-ilp.txt b/Documentation/devicetree/bindings/clock/brcm,ns-ilp.txt > new file mode 100644 > index 0000000..2c862a0 > --- /dev/null > +++ b/Documentation/devicetree/bindings/clock/brcm,ns-ilp.txt > @@ -0,0 +1,26 @@ > +Broadcom Northstar ILP clock > +============================ > + > +This binding uses the common clock binding: > + Documentation/devicetree/bindings/clock/clock-bindings.txt > + > +This binding is used for ILP clock on Broadcom Northstar devices using > +Corex-A7 CPU. ILP clock depends on ALP one and has to be calculated on > +runtime. > + > +Required properties: > +- compatible: "brcm,ns-ilp" > +- reg: iomem address range of PMU (Power Management Unit) > +- reg-names: "pmu", the only needed & supported reg right now > +- clocks: has to reference an ALP clock > +- #clock-cells: should be <0> > + > +Example: > + > +ilp: ilp { > + compatible = "brcm,ns-ilp"; > + reg = <0x18012000 0x1000>; > + reg-names = "pmu"; > + clocks = <&alp>; > + #clock-cells = <0>; > +}; > diff --git a/drivers/clk/bcm/Makefile b/drivers/clk/bcm/Makefile > index 1d79bd2..1389379 100644 > --- a/drivers/clk/bcm/Makefile > +++ b/drivers/clk/bcm/Makefile > @@ -10,3 +10,4 @@ obj-$(CONFIG_COMMON_CLK_IPROC) += clk-ns2.o > obj-$(CONFIG_ARCH_BCM_CYGNUS) += clk-cygnus.o > obj-$(CONFIG_ARCH_BCM_NSP) += clk-nsp.o > obj-$(CONFIG_ARCH_BCM_5301X) += clk-nsp.o > +obj-$(CONFIG_ARCH_BCM_5301X) += clk-ns-ilp.o > diff --git a/drivers/clk/bcm/clk-ns-ilp.c b/drivers/clk/bcm/clk-ns-ilp.c > new file mode 100644 > index 0000000..0337313 > --- /dev/null > +++ b/drivers/clk/bcm/clk-ns-ilp.c > @@ -0,0 +1,147 @@ > +/* > + * Copyright (C) 2016 Rafał Miłecki > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + */ > + > +#include > +#include > +#include > +#include > +#include I didn't see anything using modular content from the above header file, so I think you can remove it. Paul. -- > +#include > +#include > +#include > + > +#define PMU_XTAL_FREQ_RATIO 0x66c > +#define XTAL_ALP_PER_4ILP 0x00001fff > +#define XTAL_CTL_EN 0x80000000 > +#define PMU_SLOW_CLK_PERIOD 0x6dc > +