Received: by 10.223.176.5 with SMTP id f5csp783380wra; Fri, 2 Feb 2018 06:07:39 -0800 (PST) X-Google-Smtp-Source: AH8x227kp/QHlaXzXVJtFHsKGzso+7mh01JroCPRrlLJLmWb+af/j/LgHFKpU5FhWcyCsm9Ap/nQ X-Received: by 10.98.182.16 with SMTP id j16mr9174828pff.220.1517580459108; Fri, 02 Feb 2018 06:07:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517580459; cv=none; d=google.com; s=arc-20160816; b=fb75Dzs0xS4G9sGcRqbTM5KsKerQoyjKXp44scjqR0r2ORy8qxPVg3L7l1VvqAjNGZ Blbtd4jhnfyll8N1hg1CY8D0r7hqL42Og7IJ2dJ9y1vfS/axZ3MHvSaHznvPaL0enEKk NP0I0PHGiC4HrpbTrBnKZjXIVO0172psF5GRpHTguAhEVwxk3awIM071LR2RUS9ysTWj Ox7leKTwf6TPryAKWwDZspaopZi5SI41ufJ8wCkOAEn8qypT97aJmcJp3xQzXXWDSin2 CkVoSiqv7hOQRZQlgOTUMnZnYZJORcc7zl7I6RarXcGR/81RC1NbQVbvHgGQUO6iEL5c minA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=smuxqDzCsgAuNIn5bS8izgoM6gGEanyiOPsXt0v38fc=; b=Wal0hNiz1/b7WfFbahRHs4qx+uW2ijepI3Xep6yLvYP8Um5SXXXeDvzieg8bDj/g9I qNXJ41tc2gxabWM9edSqPRCsylcwxoyLgZJdfdg8OBbFEvjKy/y2OH27hmIQFXbXnH1T x7mj+xXnWIQJlx9OpZDNEoZJPwDcM640HQLtyGGcbovJM7baXE2cKRCo9wezaeYSJmK5 n8YQaoHXcDQQGLU5PvQDAHQ5S8IWmoxsNz6hoZt6awd+oYMJQ4E+3lq2qL/t8TzfgeO9 AAQOYBJ7t7ibDB94JDX3j87QpTuAQO+NC3M+amhXVaOBwEmxMVCvOCc60wlkh5jN3kgf j3yg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u8si1521907pgq.203.2018.02.02.06.07.23; Fri, 02 Feb 2018 06:07:39 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752361AbeBBOFy (ORCPT + 99 others); Fri, 2 Feb 2018 09:05:54 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:58383 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751856AbeBBOEt (ORCPT ); Fri, 2 Feb 2018 09:04:49 -0500 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w12E4Fau015246; Fri, 2 Feb 2018 15:04:16 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2fvb1x4r9c-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 02 Feb 2018 15:04:16 +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 DC04F3A; Fri, 2 Feb 2018 14:04:15 +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 89096522A; Fri, 2 Feb 2018 14:04:15 +0000 (GMT) Received: from localhost (10.75.127.49) by SFHDAG4NODE2.st.com (10.75.127.11) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 2 Feb 2018 15:04:14 +0100 From: To: Rob Herring , Mark Rutland , Lee Jones , Maxime Coquelin , Alexandre Torgue , Michael Turquette , Stephen Boyd , Gabriel Fernandez CC: , , , , , Subject: [PATCH 08/14] clk: stm32mp1: add Sub System clocks Date: Fri, 2 Feb 2018 15:03:36 +0100 Message-ID: <1517580222-23301-9-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 Content-Type: text/plain X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG5NODE2.st.com (10.75.127.14) 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gabriel Fernandez The RCC handles three sub-system clocks: ck_mpuss, ck_axiss and ck_mcuss. This patch adds also some MUX system and several prescalers. Signed-off-by: Gabriel Fernandez --- drivers/clk/clk-stm32mp1.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/drivers/clk/clk-stm32mp1.c b/drivers/clk/clk-stm32mp1.c index 15cd488..d85c619 100644 --- a/drivers/clk/clk-stm32mp1.c +++ b/drivers/clk/clk-stm32mp1.c @@ -332,6 +332,26 @@ "ck_mpu", "ck_axi", "ck_mcu", "pll4_p", "ck_hse", "ck_hsi" }; +static const struct clk_div_table axi_div_table[] = { + { 0, 1 }, { 1, 2 }, { 2, 3 }, { 3, 4 }, + { 4, 4 }, { 5, 4 }, { 6, 4 }, { 7, 4 }, + { 0 }, +}; + +static const struct clk_div_table mcu_div_table[] = { + { 0, 1 }, { 1, 2 }, { 2, 4 }, { 3, 8 }, + { 4, 16 }, { 5, 32 }, { 6, 64 }, { 7, 128 }, + { 8, 512 }, { 9, 512 }, { 10, 512}, { 11, 512 }, + { 12, 512 }, { 13, 512 }, { 14, 512}, { 15, 512 }, + { 0 }, +}; + +static const struct clk_div_table apb_div_table[] = { + { 0, 1 }, { 1, 2 }, { 2, 4 }, { 3, 8 }, + { 4, 16 }, { 5, 16 }, { 6, 16 }, { 7, 16 }, + { 0 }, +}; + struct clock_config { u32 id; const char *name; @@ -1001,6 +1021,15 @@ struct clk_hw *_clk_register_pll(struct device *dev, _NO_MUX,\ } +#define _MUXDIV(_mux_offset, _mux_bit, _mux_width,\ + _div_offset, _div_shift, _div_width,\ + _div_table)\ +{\ + _DIV_TABLE(_div_offset, _div_shift, _div_width, 0, _div_table),\ + _NO_GATE,\ + _MUX(_mux_offset, _mux_bit, _mux_width, 0),\ +} + #define MP1_GATE(_id, _name, _parent, _flags, _offset, _bit_idx, _gate_flags)\ {\ .id = _id,\ @@ -1091,6 +1120,38 @@ struct clk_hw *_clk_register_pll(struct device *dev, COMPOSITE(PLL4_R, "pll4_r", PARENT("pll4"), 0, _GATEDIV(RCC_PLL4CR, 6, RCC_PLL4CFGR2, 16, 7, NULL)), + + /* MUX system clocks */ + MUX(CK_PER, "ck_per", per_src, CLK_OPS_PARENT_ENABLE, + RCC_CPERCKSELR, 0, 2, 0), + + MUX(CK_MPU, "ck_mpu", cpu_src, CLK_OPS_PARENT_ENABLE | CLK_IS_CRITICAL, + RCC_MPCKSELR, 0, 2, 0), + + COMPOSITE(CK_AXI, "ck_axi", axi_src, CLK_IS_CRITICAL | + CLK_OPS_PARENT_ENABLE, + _MUXDIV(RCC_ASSCKSELR, 0, 2, + RCC_AXIDIVR, 0, 3, axi_div_table)), + + COMPOSITE(CK_MCU, "ck_mcu", mcu_src, CLK_IS_CRITICAL | + CLK_OPS_PARENT_ENABLE, + _MUXDIV(RCC_MSSCKSELR, 0, 2, + RCC_MCUDIVR, 0, 4, mcu_div_table)), + + DIV_TABLE(NO_ID, "pclk1", "ck_mcu", CLK_IGNORE_UNUSED, RCC_APB1DIVR, 0, + 3, CLK_DIVIDER_READ_ONLY, apb_div_table), + + DIV_TABLE(NO_ID, "pclk2", "ck_mcu", CLK_IGNORE_UNUSED, RCC_APB2DIVR, 0, + 3, CLK_DIVIDER_READ_ONLY, apb_div_table), + + DIV_TABLE(NO_ID, "pclk3", "ck_mcu", CLK_IGNORE_UNUSED, RCC_APB3DIVR, 0, + 3, CLK_DIVIDER_READ_ONLY, apb_div_table), + + DIV_TABLE(NO_ID, "pclk4", "ck_axi", CLK_IGNORE_UNUSED, RCC_APB4DIVR, 0, + 3, CLK_DIVIDER_READ_ONLY, apb_div_table), + + DIV_TABLE(NO_ID, "pclk5", "ck_axi", CLK_IGNORE_UNUSED, RCC_APB5DIVR, 0, + 3, CLK_DIVIDER_READ_ONLY, apb_div_table), }; struct stm32_clock_match_data { -- 1.9.1