From patchwork Wed Feb 19 10:03:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 11390891 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 95B3F109A for ; Wed, 19 Feb 2020 10:04:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6EFF32465D for ; Wed, 19 Feb 2020 10:04:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="C2uNySUw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726491AbgBSKEB (ORCPT ); Wed, 19 Feb 2020 05:04:01 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:35938 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726453AbgBSKEA (ORCPT ); Wed, 19 Feb 2020 05:04:00 -0500 Received: by mail-lf1-f67.google.com with SMTP id f24so16937803lfh.3 for ; Wed, 19 Feb 2020 02:03:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9ex0WUr4F2ykNAf/zHRS2tfhIPnCxChpfveEhtUGkE0=; b=C2uNySUwOeXYR/vew7ZZjkCVofjMXMj+nLEIq58Zg1YK8jCxDkcDmp2/mbQMJm83G/ piahvjEDPIwTmNhg28Yc1I5G6tVoQLboIm6/4xfUCiN50EfXiA910XCSUINyvei67vrq y3N0YOB6uW7YRBGHRbkBMXQetSjWXJoNzWiUPCjt4VLmRAHR+1OdoSKrSjxqRDTmak72 sUPMZ/PFGqMUrjBwnjThdNLGZaDcjkKs+2q1a9fHefyCo5lpvvfyFskYskw/RuvqClBz +XA8btAavsQ0y3+04JkqrR/w0y9nfgzE3uEEdZPZNLvVwpLXsZu6C7WyUIEyAo6auMRu tiWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=9ex0WUr4F2ykNAf/zHRS2tfhIPnCxChpfveEhtUGkE0=; b=fhM8v8yPwI69yPzm5dm1RahdNrYNspTlIXtayL1V46+q7PrOEkfUjP5nRijTpWaxsB RqyqQWkWHcQ5rL+OLp4kXsonJ9mYMOg0ZheqpXnRVbgivz44Qn38JcL6kEUH3OHV6USp BKGzynSKLcYpubGdEOGF36hTzYo6hRAqYoF3BpNwIvTDrOZjL6RkL34E3NU7kHlePCg+ XBxQriWQhbThtpX2vI+28Nq91RJ97jFjmnfAjsLiJ3YqmnXfpFC1WV5Dd5C1P/5lUwEk CmDl5PFn7O109Mn4jrJUi8EXBdBwejkt3/njiYAVpv1AibsM7cY64gUF+1XL1EcalEDq ZSZA== X-Gm-Message-State: APjAAAXgwI8LE50jUCUiBac0kGfGMsy5M5i8yQgNmgnfguBAjzLowQD6 GE1x5uxP7YLR61yYf/9By6k9Cw== X-Google-Smtp-Source: APXvYqzuj2PjMvzj7EzYtgRASEpJMDNCrByBqcjlHrIBICaGty2X3Tjzk6HvHNW1CVKmSUN9qM4gwg== X-Received: by 2002:a19:c3c2:: with SMTP id t185mr13021040lff.56.1582106636682; Wed, 19 Feb 2020 02:03:56 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id n1sm918913lfq.16.2020.02.19.02.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 02:03:55 -0800 (PST) From: Linus Walleij To: Michael Turquette , Stephen Boyd Cc: linux-clk@vger.kernel.org, Linus Walleij , devicetree@vger.kernel.org, Rob Herring Subject: [PATCH 1/3 v2] dt-bindings: clock: Create YAML schema for ICST clocks Date: Wed, 19 Feb 2020 11:03:44 +0100 Message-Id: <20200219100346.78227-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org The ICST clocks used in the ARM Integrator, Versatile and RealView platforms are updated to use YAML schema, and two new ICST clocks used by the Integrator IM-PD1 logical module are added in the process. Cc: devicetree@vger.kernel.org Reviewed-by: Rob Herring Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Add a literal | to preserve formatting in the bindings - Collect Rob's review tag --- .../bindings/clock/arm,syscon-icst.yaml | 102 ++++++++++++++++++ .../bindings/clock/arm-integrator.txt | 34 ------ .../bindings/clock/arm-syscon-icst.txt | 70 ------------ 3 files changed, 102 insertions(+), 104 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml delete mode 100644 Documentation/devicetree/bindings/clock/arm-integrator.txt delete mode 100644 Documentation/devicetree/bindings/clock/arm-syscon-icst.txt diff --git a/Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml b/Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml new file mode 100644 index 000000000000..06c4d84e8c3d --- /dev/null +++ b/Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml @@ -0,0 +1,102 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/arm,syscon-icst.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ARM System Conctroller ICST Clocks + +maintainers: + - Linus Walleij + +description: The ICS525 and ICS307 oscillators are produced by Integrated + Devices Technology (IDT). ARM integrated these oscillators deeply into their + reference designs by adding special control registers that manage such + oscillators to their system controllers. + + The various ARM system controllers contain logic to serialize and initialize + an ICST clock request after a write to the 32 bit register at an offset + into the system controller. Furthermore, to even be able to alter one of + these frequencies, the system controller must first be unlocked by + writing a special token to another offset in the system controller. + + Some ARM hardware contain special versions of the serial interface that only + connects the low 8 bits of the VDW (missing one bit), hardwires RDW to + different values and sometimes also hardwire the output divider. They + therefore have special compatible strings as per this table (the OD value is + the value on the pins, not the resulting output divider). + + In the core modules and logic tiles, the ICST is a configurable clock fed + from a 24 MHz clock on the motherboard (usually the main crystal) used for + generating e.g. video clocks. It is located on the core module and there is + only one of these. This clock node must be a subnode of the core module. + + Hardware variant RDW OD VDW + + Integrator/AP 22 1 Bit 8 0, rest variable + integratorap-cm + + Integrator/AP 46 3 Bit 8 0, rest variable + integratorap-sys + + Integrator/AP 22 or 1 17 or (33 or 25 MHz) + integratorap-pci 14 1 14 + + Integrator/CP 22 variable Bit 8 0, rest variable + integratorcp-cm-core + + Integrator/CP 22 variable Bit 8 0, rest variable + integratorcp-cm-mem + + The ICST oscillator must be provided inside a system controller node. + +properties: + "#clock-cells": + const: 0 + + compatible: + enum: + - arm,syscon-icst525 + - arm,syscon-icst307 + - arm,syscon-icst525-integratorap-cm + - arm,syscon-icst525-integratorap-sys + - arm,syscon-icst525-integratorap-pci + - arm,syscon-icst525-integratorcp-cm-core + - arm,syscon-icst525-integratorcp-cm-mem + - arm,integrator-cm-auxosc + - arm,versatile-cm-auxosc + - arm,impd-vco1 + - arm,impd-vco2 + + clocks: + description: Parent clock for the ICST VCO + maxItems: 1 + + clock-output-names: + maxItems: 1 + + lock-offset: + $ref: '/schemas/types.yaml#/definitions/uint32' + description: Offset to the unlocking register for the oscillator + + vco-offset: + $ref: '/schemas/types.yaml#/definitions/uint32' + description: Offset to the VCO register for the oscillator + +required: + - "#clock-cells" + - compatible + - clocks + +examples: + - | + vco1: clock@00 { + compatible = "arm,impd1-vco1"; + #clock-cells = <0>; + lock-offset = <0x08>; + vco-offset = <0x00>; + clocks = <&sysclk>; + clock-output-names = "IM-PD1-VCO1"; + }; + +... diff --git a/Documentation/devicetree/bindings/clock/arm-integrator.txt b/Documentation/devicetree/bindings/clock/arm-integrator.txt deleted file mode 100644 index 11f5f95f571b..000000000000 --- a/Documentation/devicetree/bindings/clock/arm-integrator.txt +++ /dev/null @@ -1,34 +0,0 @@ -Clock bindings for ARM Integrator and Versatile Core Module clocks - -Auxiliary Oscillator Clock - -This is a configurable clock fed from a 24 MHz chrystal, -used for generating e.g. video clocks. It is located on the -core module and there is only one of these. - -This clock node *must* be a subnode of the core module, since -it obtains the base address for it's address range from its -parent node. - - -Required properties: -- compatible: must be "arm,integrator-cm-auxosc" or "arm,versatile-cm-auxosc" -- #clock-cells: must be <0> - -Optional properties: -- clocks: parent clock(s) - -Example: - -core-module@10000000 { - xtal24mhz: xtal24mhz@24M { - #clock-cells = <0>; - compatible = "fixed-clock"; - clock-frequency = <24000000>; - }; - auxosc: cm_aux_osc@25M { - #clock-cells = <0>; - compatible = "arm,integrator-cm-auxosc"; - clocks = <&xtal24mhz>; - }; -}; diff --git a/Documentation/devicetree/bindings/clock/arm-syscon-icst.txt b/Documentation/devicetree/bindings/clock/arm-syscon-icst.txt deleted file mode 100644 index 4cd81742038f..000000000000 --- a/Documentation/devicetree/bindings/clock/arm-syscon-icst.txt +++ /dev/null @@ -1,70 +0,0 @@ -ARM System Controller ICST clocks - -The ICS525 and ICS307 oscillators are produced by Integrated Devices -Technology (IDT). ARM integrated these oscillators deeply into their -reference designs by adding special control registers that manage such -oscillators to their system controllers. - -The various ARM system controllers contain logic to serialize and initialize -an ICST clock request after a write to the 32 bit register at an offset -into the system controller. Furthermore, to even be able to alter one of -these frequencies, the system controller must first be unlocked by -writing a special token to another offset in the system controller. - -Some ARM hardware contain special versions of the serial interface that only -connects the low 8 bits of the VDW (missing one bit), hardwires RDW to -different values and sometimes also hardwire the output divider. They -therefore have special compatible strings as per this table (the OD value is -the value on the pins, not the resulting output divider): - -Hardware variant: RDW OD VDW - -Integrator/AP 22 1 Bit 8 0, rest variable -integratorap-cm - -Integrator/AP 46 3 Bit 8 0, rest variable -integratorap-sys - -Integrator/AP 22 or 1 17 or (33 or 25 MHz) -integratorap-pci 14 1 14 - -Integrator/CP 22 variable Bit 8 0, rest variable -integratorcp-cm-core - -Integrator/CP 22 variable Bit 8 0, rest variable -integratorcp-cm-mem - -The ICST oscillator must be provided inside a system controller node. - -Required properties: -- compatible: must be one of - "arm,syscon-icst525" - "arm,syscon-icst307" - "arm,syscon-icst525-integratorap-cm" - "arm,syscon-icst525-integratorap-sys" - "arm,syscon-icst525-integratorap-pci" - "arm,syscon-icst525-integratorcp-cm-core" - "arm,syscon-icst525-integratorcp-cm-mem" -- lock-offset: the offset address into the system controller where the - unlocking register is located -- vco-offset: the offset address into the system controller where the - ICST control register is located (even 32 bit address) -- #clock-cells: must be <0> -- clocks: parent clock, since the ICST needs a parent clock to derive its - frequency from, this attribute is compulsory. - -Example: - -syscon: syscon@10000000 { - compatible = "syscon"; - reg = <0x10000000 0x1000>; - - oscclk0: osc0@c { - compatible = "arm,syscon-icst307"; - #clock-cells = <0>; - lock-offset = <0x20>; - vco-offset = <0x0c>; - clocks = <&xtal24mhz>; - }; - (...) -}; From patchwork Wed Feb 19 10:03:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 11390889 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 66BBF92A for ; Wed, 19 Feb 2020 10:04:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3F6552465D for ; Wed, 19 Feb 2020 10:04:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="M9kfasFw" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726450AbgBSKEA (ORCPT ); Wed, 19 Feb 2020 05:04:00 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:42795 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbgBSKEA (ORCPT ); Wed, 19 Feb 2020 05:04:00 -0500 Received: by mail-lf1-f66.google.com with SMTP id y19so16939178lfl.9 for ; Wed, 19 Feb 2020 02:03:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ALoqKh4KGkm0WihSTPj2PM76XlFoNn+X7MPKYic/P4k=; b=M9kfasFwDQXFal31pCaQsB2/+xUQRdqpv/W+4nppEnolHNzOdDqmRKl/xj9h/9JcgE sSnMB02B8VG40waAB1YbE2lRK5hu5c8cg36XD1l2fVe+M/jSQm7dabVCN5QoJXMPiPC8 WQ9ovI6hubxpl4fMEgIE58C3keuzSeAe6+dDaX67lGDWsgfGqy/30vO5OiTO5ZpoWGuY LOwyr3ny5Q09mJ3QXIopIiNSIhSiAxhktR6SQtN1IKPOdGq2HWj7DqTeWLDSuEjcNuVA vbJMjl3xKj0NhiXDoOXUymBO3ZHWEBzEI5IgfwYfJI4WJ2s9Abc1aVVdOjtyK8erkebZ Lzgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ALoqKh4KGkm0WihSTPj2PM76XlFoNn+X7MPKYic/P4k=; b=OSTvOYSR3mfeDacmK5PSI5e+TXxXb0JrKTZGeFqLpqbrt49ey5ngY9UBJ/8iYJF86E bLN/VPjO5Eto6XK2Yy2BfSAMVbIiybhk20L3JncDthS6Z7aS0V6jrZYyHkz7s3mGWRTk tcnwYdDaVg+lq6tv2pVLRa16DMdpROBm/hi+gXNrgBmeOqZBZOT9UdyG5CQIeMbnQYlv CfLjoA1/YRm7cnK2YfkfEv+zlt6RgwonjYjy0kVfIJqqy+WY/9AOwMapEinYDlgeD+zr Xgrd8vwl9u6PPr0bn4YVMD83z4XY/Mv8TCpQkfX+U3Dpf51zoRHrtp2dUw7/DRWPdU78 TOag== X-Gm-Message-State: APjAAAWBDmNjR73Yj7tuYitf7XXiJSv6qn4Y3V5xEdzjQQFxqXGy+iV2 TolDl1VCzxHeUrIHW/lt27ybQg== X-Google-Smtp-Source: APXvYqy3RkdSSpYYO4PiyhX1Kg7Rd+SxoeRI/+TzQXfE7GZQuVe53aPjwk9RsnxaS17FWS2Pflv+pQ== X-Received: by 2002:a19:c82:: with SMTP id 124mr12835899lfm.152.1582106638733; Wed, 19 Feb 2020 02:03:58 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id n1sm918913lfq.16.2020.02.19.02.03.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 02:03:58 -0800 (PST) From: Linus Walleij To: Michael Turquette , Stephen Boyd Cc: linux-clk@vger.kernel.org, Linus Walleij Subject: [PATCH 2/3 v2] clk: versatile: Export icst_clk_setup() Date: Wed, 19 Feb 2020 11:03:45 +0100 Message-Id: <20200219100346.78227-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200219100346.78227-1-linus.walleij@linaro.org> References: <20200219100346.78227-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Export this clock setup method so we can register the IM-PD1 clocks with common code in the next step. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - New patch to reuse the machinery for properly probing device tree clocks using clk_hw etc. --- drivers/clk/versatile/clk-icst.c | 25 +++++++------------------ drivers/clk/versatile/clk-icst.h | 21 +++++++++++++++++++++ 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c index fe686f77787f..692be2fd9261 100644 --- a/drivers/clk/versatile/clk-icst.c +++ b/drivers/clk/versatile/clk-icst.c @@ -33,18 +33,6 @@ #define INTEGRATOR_AP_PCI_25_33_MHZ BIT(8) -/** - * enum icst_control_type - the type of ICST control register - */ -enum icst_control_type { - ICST_VERSATILE, /* The standard type, all control bits available */ - ICST_INTEGRATOR_AP_CM, /* Only 8 bits of VDW available */ - ICST_INTEGRATOR_AP_SYS, /* Only 8 bits of VDW available */ - ICST_INTEGRATOR_AP_PCI, /* Odd bit pattern storage */ - ICST_INTEGRATOR_CP_CM_CORE, /* Only 8 bits of VDW and 3 bits of OD */ - ICST_INTEGRATOR_CP_CM_MEM, /* Only 8 bits of VDW and 3 bits of OD */ -}; - /** * struct clk_icst - ICST VCO clock wrapper * @hw: corresponding clock hardware entry @@ -344,12 +332,12 @@ static const struct clk_ops icst_ops = { .set_rate = icst_set_rate, }; -static struct clk *icst_clk_setup(struct device *dev, - const struct clk_icst_desc *desc, - const char *name, - const char *parent_name, - struct regmap *map, - enum icst_control_type ctype) +struct clk *icst_clk_setup(struct device *dev, + const struct clk_icst_desc *desc, + const char *name, + const char *parent_name, + struct regmap *map, + enum icst_control_type ctype) { struct clk *clk; struct clk_icst *icst; @@ -386,6 +374,7 @@ static struct clk *icst_clk_setup(struct device *dev, return clk; } +EXPORT_SYMBOL_GPL(icst_clk_setup); struct clk *icst_clk_register(struct device *dev, const struct clk_icst_desc *desc, diff --git a/drivers/clk/versatile/clk-icst.h b/drivers/clk/versatile/clk-icst.h index e36ca1a20e90..1206f008c11a 100644 --- a/drivers/clk/versatile/clk-icst.h +++ b/drivers/clk/versatile/clk-icst.h @@ -1,4 +1,18 @@ /* SPDX-License-Identifier: GPL-2.0 */ +struct regmap; + +/** + * enum icst_control_type - the type of ICST control register + */ +enum icst_control_type { + ICST_VERSATILE, /* The standard type, all control bits available */ + ICST_INTEGRATOR_AP_CM, /* Only 8 bits of VDW available */ + ICST_INTEGRATOR_AP_SYS, /* Only 8 bits of VDW available */ + ICST_INTEGRATOR_AP_PCI, /* Odd bit pattern storage */ + ICST_INTEGRATOR_CP_CM_CORE, /* Only 8 bits of VDW and 3 bits of OD */ + ICST_INTEGRATOR_CP_CM_MEM, /* Only 8 bits of VDW and 3 bits of OD */ +}; + /** * struct clk_icst_desc - descriptor for the ICST VCO * @params: ICST parameters @@ -17,3 +31,10 @@ struct clk *icst_clk_register(struct device *dev, const char *name, const char *parent_name, void __iomem *base); + +struct clk *icst_clk_setup(struct device *dev, + const struct clk_icst_desc *desc, + const char *name, + const char *parent_name, + struct regmap *map, + enum icst_control_type ctype); From patchwork Wed Feb 19 10:03:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 11390893 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4A242109A for ; Wed, 19 Feb 2020 10:04:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C8E024658 for ; Wed, 19 Feb 2020 10:04:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nJbCTRQD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726497AbgBSKED (ORCPT ); Wed, 19 Feb 2020 05:04:03 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:46713 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726453AbgBSKEC (ORCPT ); Wed, 19 Feb 2020 05:04:02 -0500 Received: by mail-lj1-f193.google.com with SMTP id x14so26370675ljd.13 for ; Wed, 19 Feb 2020 02:04:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Gxi6KYGr5mqVq8fzO7WJDSPc3JwpyT1jXF3qnuigAWw=; b=nJbCTRQDnwpANyabKaPG/19zCybls6u3ODeOJgucDiBrRsrwQ3QMQyuhOaPurFINDL 9U0UoZ3fVL2ERbnh/KpcHjvAoHdTuD9O4jsNo3OLnwILNW/ZcHkWzEp7ZIwZWcfsWc2D p1E2N2rVSPQ3jhKnoXOlhgzybRfqAO9kt9RN7gIt1zaIF7oq6HJll5hI7H1EApJfonz7 B2g1naZy3xwpGBuy1FIJlpZ4JF5Tc7nW4gOW0sFMcSaGZ7fxekOSw0nD1radvAQeKCdJ zQLwMRaKHIHfZNLGtxpk9rJOcPbqN2TTgfXIVQTj0UD6F9Vb4TNaU8TFk1BIXqA47C7F Z32w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gxi6KYGr5mqVq8fzO7WJDSPc3JwpyT1jXF3qnuigAWw=; b=MGKS985hB+g2lYxnB0o2HMQkVBOG85nuDvXB8l5Zyn5eHsokCuBL1DwiUXT+3MrvK5 WMJ1inOQyrkd9fTq1HWOYkF8jqVXdOjR+3cI2J/7lm8W0Ik+f7LpsFMO3vawZqE4yV5a 68ReWW4RkaceOxDlG3NhFfZYDN/AyEv8xKzXZmagbTYXctYEGPoLygPwbV8cc1nInGwR PsDFCHMd0L68kyGyf/QF5Fjc0a7+hA715Sljec2ex89zUgObF1xZyXddTKxiZjNxwCNC Q0XzILlbO13Q/Nka76CR6hd3Gh/fOid8p9db6C4J725fdIX32zvOOF11Cz2eq3Gv4JXW Wu1A== X-Gm-Message-State: APjAAAXcQEiPBIT2IYm2OlRiKS3hwMdTanvmn8jwISYt9IeQE3USNG9m DDzAJS0S0mgFDOgu9BSNn/31hA== X-Google-Smtp-Source: APXvYqxRQGoHBZqmlCXzTgNxVMuDl3II68/RvPFDKX1WNDGxAw+Ox9rNkhWoLZzUeJaNoVA+jyYdCg== X-Received: by 2002:a2e:81d0:: with SMTP id s16mr15642739ljg.166.1582106640415; Wed, 19 Feb 2020 02:04:00 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id n1sm918913lfq.16.2020.02.19.02.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Feb 2020 02:03:59 -0800 (PST) From: Linus Walleij To: Michael Turquette , Stephen Boyd Cc: linux-clk@vger.kernel.org, Linus Walleij Subject: [PATCH 3/3 v2] clk: versatile: Add device tree probing for IM-PD1 clocks Date: Wed, 19 Feb 2020 11:03:46 +0100 Message-Id: <20200219100346.78227-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200219100346.78227-1-linus.walleij@linaro.org> References: <20200219100346.78227-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org As we want to move these clocks over to probe from the device tree we add a device tree probing path. The old platform data path will be deleted once we have the device tree overall code in place. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Drop some __init tagging - Provide MODULE_DEVICE_TABLE() - Rewrote to use the same method with regmap as clk-icst.c - The reuse of clk-icst.c makes the clock probe using hw and then it needs no special handling for clock output names. --- drivers/clk/versatile/clk-icst.h | 1 + drivers/clk/versatile/clk-impd1.c | 79 +++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/drivers/clk/versatile/clk-icst.h b/drivers/clk/versatile/clk-icst.h index 1206f008c11a..1a119ef11066 100644 --- a/drivers/clk/versatile/clk-icst.h +++ b/drivers/clk/versatile/clk-icst.h @@ -11,6 +11,7 @@ enum icst_control_type { ICST_INTEGRATOR_AP_PCI, /* Odd bit pattern storage */ ICST_INTEGRATOR_CP_CM_CORE, /* Only 8 bits of VDW and 3 bits of OD */ ICST_INTEGRATOR_CP_CM_MEM, /* Only 8 bits of VDW and 3 bits of OD */ + ICST_INTEGRATOR_IM_PD1, /* Like the Versatile, all control bits */ }; /** diff --git a/drivers/clk/versatile/clk-impd1.c b/drivers/clk/versatile/clk-impd1.c index 1991f15a5db9..b05da8516d4c 100644 --- a/drivers/clk/versatile/clk-impd1.c +++ b/drivers/clk/versatile/clk-impd1.c @@ -7,7 +7,11 @@ #include #include #include +#include #include +#include +#include +#include #include "icst.h" #include "clk-icst.h" @@ -175,3 +179,78 @@ void integrator_impd1_clk_exit(unsigned int id) kfree(imc->pclkname); } EXPORT_SYMBOL_GPL(integrator_impd1_clk_exit); + +static int integrator_impd1_clk_spawn(struct device *dev, + struct device_node *parent, + struct device_node *np) +{ + struct regmap *map; + struct clk *clk = ERR_PTR(-EINVAL); + const char *name = np->name; + const char *parent_name; + const struct clk_icst_desc *desc; + int ret; + + map = syscon_node_to_regmap(parent); + if (IS_ERR(map)) { + pr_err("no regmap for syscon IM-PD1 ICST clock parent\n"); + return PTR_ERR(map); + } + + if (of_device_is_compatible(np, "arm,impd1-vco1")) { + desc = &impd1_icst1_desc; + } else if (of_device_is_compatible(np, "arm,impd1-vco2")) { + desc = &impd1_icst2_desc; + } else { + dev_err(dev, "not a clock node %s\n", name); + return -ENODEV; + } + + parent_name = of_clk_get_parent_name(np, 0); + clk = icst_clk_setup(NULL, desc, name, parent_name, map, + ICST_INTEGRATOR_IM_PD1); + if (!IS_ERR(clk)) { + of_clk_add_provider(np, of_clk_src_simple_get, clk); + ret = 0; + } else { + dev_err(dev, "error setting up IM-PD1 ICST clock\n"); + ret = PTR_ERR(clk); + } + + return ret; +} + +static int integrator_impd1_clk_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct device_node *np = dev->of_node; + struct device_node *child; + int ret = 0; + + for_each_available_child_of_node(np, child) { + ret = integrator_impd1_clk_spawn(dev, np, child); + if (ret) + break; + } + + return ret; +} + +static const struct of_device_id impd1_syscon_match[] = { + { .compatible = "arm,im-pd1-syscon", }, + {} +}; +MODULE_DEVICE_TABLE(of, impd1_syscon_match); + +static struct platform_driver impd1_clk_driver = { + .driver = { + .name = "impd1-clk", + .of_match_table = impd1_syscon_match, + }, + .probe = integrator_impd1_clk_probe, +}; +builtin_platform_driver(impd1_clk_driver); + +MODULE_AUTHOR("Linus Walleij "); +MODULE_DESCRIPTION("Arm IM-PD1 module clock driver"); +MODULE_LICENSE("GPL v2");