From patchwork Fri Feb 2 14:03:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel FERNANDEZ X-Patchwork-Id: 10196753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EB2E96037D for ; Fri, 2 Feb 2018 14:06:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D99CB28E61 for ; Fri, 2 Feb 2018 14:06:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE07A28E68; Fri, 2 Feb 2018 14:06:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 59F2F28E67 for ; Fri, 2 Feb 2018 14:06:24 +0000 (UTC) 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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tnpQbeCPTyVbgfQXTux5j6v0AIpVLoFZmNWRJYwhsMk=; b=fvIqQpjlShVIjz wNnQ5Knola+Y11eWTPVzqDV6lnk4A1kK9MQbzJwf5kRriSY/wI0FF0VW/g81qUzVcXckmJoNjcVpD KUFQEHG1gonQM+HAuQjce5xhDTsnNXN977HIIepzMM3THxK1DI2xwqGQvZLE0Siy113oPOUzciBvI VfHG2u7jam0YaMa/Sigd949pYrLqdB9xY/AzQxWDPRzqn+n3tAJl8/QRABLHFxiA85HRFAHtksoSe Lh1E1lARliEs/MB8r1XGsHWygoXJc9D+q90F+IbRl69o5m/JBj+Tizgr/G6WX5HJ/X2QOnIZleKFg cQ/yEogHgk+ZiKAVjXGw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1ehbyw-0006ys-1A; Fri, 02 Feb 2018 14:06:22 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ehbxO-0004DB-Dm for linux-arm-kernel@bombadil.infradead.org; Fri, 02 Feb 2018 14:04:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=fWONfY+Phvdu6lZNdAvNlfJiYMPE4xrevRb9S2PcKl0=; b=LkQ6D+JZp11DULctvUrquZXN5 a/+znzvKqVI2gwOLPzr+iWFuhomVBxMM+I8hwKfD9qqfFqlzUYEys/Vwyz6fY39v+HWIgyy4Yyqyq PxS0kzDvrTlTntw+3IpD9Mg84C0tY9Ad0YNCcCzckDkHJ+gE1u9ziIVroEIylhU4DupxIqR9nivel E2M0/RlmEPdvVkFmXZSlTJFUKPVHjlWoiP99mpwJ3IRNp79cuhfLUP5refcSfxCiT4ECq7j2DFHJS CxX94wdiPQRQE5cnhKteifM5Rb6+SCfjNvOft8a3vQGzBqIYRmg5piV0xFX9x78z60wbDycYso9zv ywJlIjXjg==; Received: from mx08-00178001.pphosted.com ([91.207.212.93] helo=mx07-00178001.pphosted.com) by merlin.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ehbxE-0002Xz-BX for linux-arm-kernel@lists.infradead.org; Fri, 02 Feb 2018 14:04:39 +0000 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w12E3pgK028128; Fri, 2 Feb 2018 15:04:20 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx08-00178001.pphosted.com with ESMTP id 2fvr42rg2f-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 02 Feb 2018 15:04:20 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A9AD034; Fri, 2 Feb 2018 14:04:19 +0000 (GMT) Received: from Webmail-eu.st.com (sfhdag4node2.st.com [10.75.127.11]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 88EF75228; Fri, 2 Feb 2018 14:04:19 +0000 (GMT) Received: from localhost (10.75.127.47) by SFHDAG4NODE2.st.com (10.75.127.11) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 2 Feb 2018 15:04:18 +0100 From: To: Rob Herring , Mark Rutland , Lee Jones , Maxime Coquelin , Alexandre Torgue , Michael Turquette , Stephen Boyd , Gabriel Fernandez Subject: [PATCH 13/14] clk: stm32mp1: add MCO clocks Date: Fri, 2 Feb 2018 15:03:41 +0100 Message-ID: <1517580222-23301-14-git-send-email-gabriel.fernandez@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1517580222-23301-1-git-send-email-gabriel.fernandez@st.com> References: <1517580222-23301-1-git-send-email-gabriel.fernandez@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG4NODE2.st.com (10.75.127.11) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-02-02_04:, , signatures=0 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, olivier.bideau@st.com, linux-kernel@vger.kernel.org, gabriel.fernandez.st@gmail.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Gabriel Fernandez Two micro-controller clock output (MCO) pins are available: MCO1 and MCO2. For each output, it is possible to select a clock source. The selected clock can be divided thanks to configurable prescaler. Signed-off-by: Gabriel Fernandez --- drivers/clk/clk-stm32mp1.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/clk/clk-stm32mp1.c b/drivers/clk/clk-stm32mp1.c index 1cb06b0..0402a0e 100644 --- a/drivers/clk/clk-stm32mp1.c +++ b/drivers/clk/clk-stm32mp1.c @@ -1188,6 +1188,16 @@ static struct clk_hw *_clk_register_cktim(struct device *dev, _MUX(_mux_offset, _mux_bit, _mux_width, 0),\ } +#define _GATEMUXDIV(_gate_offset, _bit_idx,\ + _mux_offset, _mux_bit, _mux_width,\ + _div_offset, _div_bit, _div_width\ + )\ +{\ + _DIV(_div_offset, _div_bit, _div_width, 0),\ + _GATE(_gate_offset, _bit_idx, 0),\ + _MUX(_mux_offset, _mux_bit, _mux_width, 0),\ +} + #define _MP1_GATE(_gate_offset, _bit_idx, _flags)\ _GATE_OPS(_gate_offset, _bit_idx, _flags, &mp1_gate_clk_ops) @@ -1543,6 +1553,19 @@ static struct clk_hw *_clk_register_cktim(struct device *dev, COMPOSITE(RTC, "ck_rtc", rtc_src, CLK_OPS_PARENT_ENABLE | CLK_SET_RATE_PARENT, _GATEMUX(RCC_BDCR, 20, RCC_BDCR, 16, 2)), + + /* MCO clocks */ + COMPOSITE(CK_MCO1, "ck_mco1", mco1_src, CLK_OPS_PARENT_ENABLE | + CLK_SET_RATE_NO_REPARENT, + _GATEMUXDIV(RCC_MCO1CFGR, 12, + RCC_MCO1CFGR, 0, 3, + RCC_MCO1CFGR, 4, 4)), + + COMPOSITE(CK_MCO2, "ck_mco2", mco2_src, CLK_OPS_PARENT_ENABLE | + CLK_SET_RATE_NO_REPARENT, + _GATEMUXDIV(RCC_MCO2CFGR, 12, + RCC_MCO2CFGR, 0, 3, + RCC_MCO2CFGR, 4, 4)), }; struct stm32_clock_match_data {