Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2581524ybl; Mon, 20 Jan 2020 05:42:28 -0800 (PST) X-Google-Smtp-Source: APXvYqyFUoeQokk+OG9G6byZiArAz1MLsyWVV/rTyCfdIDgAyGzPGd97YuOBgJcnfxpTrdKVPXDh X-Received: by 2002:aca:bac3:: with SMTP id k186mr13263546oif.19.1579527747925; Mon, 20 Jan 2020 05:42:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1579527747; cv=pass; d=google.com; s=arc-20160816; b=VrXwY2aY67TgDYXqkqwLa3byT2cBWsDneLTZcGKBjkr1BB1Ujpe/jRV9KMPjFCVeMY Ba1m+WDRM9tg7+1btzVcaRqFkLFyJCYN7YFSJEyycZ95Hhf96fGzo6fGv6UC6MnwXCsT YD8JA7AelAw17Rt98kw1jsRlOQScsoa9FCgL+JadL/dTuaft7MhBAUDs9fSUfGx9Mwyf 46sDVIbtkEvcB/RM4TyI8VusrYlMo5O3vlkIuryIw3OBNbNjb6zknCd36h/bcJa58bfI Y09fVl31RSHbGZQnmy1vUgpkoPcBruwvQxgg15SCwSN+uN/HEAB/pStOooJjJXCBZAS+ vlCg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=Um2LmzTaVMSt3ymdpwDMXW3UnG+kHcqBUdDBNyphCkA=; b=mz/79aHoXMC3IFUuagu39XxmS3bAz0JRgZroWXojXgP3PKOnONtzIsDk95CDTlk978 pTyLHMzTb7J6WrFe3271/qjKhrvm55/N4RnE4Gxq4DpvJaGbwUY5YYPQJ66WY3GJjgtc PkQ6PEgqSl6poLLiQVFa38S+3dOt+25Wgjkn/+xC58GUQJKDbd61Nxw5n/P6usX+LbWC 9dLsmX+aPGP9keOjPfmDjl6w+mB31vVZnqkanAT2dkpsNTPPpYgGBN885PbKj2KUCZMH TJQKgPRFVvcNTN4fsjX811uyTKZwBZH/YtAg9TkGMicdIpOBFvTu4vuBoJt/G4/HDwk9 Ezpw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=YLyswj3y; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11si19548343otr.197.2020.01.20.05.42.15; Mon, 20 Jan 2020 05:42:27 -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=@nxp.com header.s=selector2 header.b=YLyswj3y; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727465AbgATNlS (ORCPT + 99 others); Mon, 20 Jan 2020 08:41:18 -0500 Received: from mail-eopbgr140081.outbound.protection.outlook.com ([40.107.14.81]:15266 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726626AbgATNlR (ORCPT ); Mon, 20 Jan 2020 08:41:17 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pizwg8jPLaAkRSjhFV256qFwfx2AEsEoeFRZo6KkuXw/Tq0IZwXZ/1gJpRTRCZJVSvVidKSmeh03bxutDlQ0Os/EsoY8yYyhGtZh+NapNS8sdPp5pf2hdEEYrZdwtjxjY8FVybxqZuP/wLy1NCjxgD/SaBYJNUd82UHAJYDdTiLTsoOANlIM4eOJIflaRKJj11P/5VKcYYSBGnTUKvYDTCr+1FuH3S7yVLuMmL2ABpzTRPjFszNynBJr7KOiRGU4VcV05jLdqp3r/Jf4z3+H498dS723KxaumczRFriCvLUBs1+cLMs1WOsKWJjVlPwqoEQTOxy6hLT4P90YTGBL4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Um2LmzTaVMSt3ymdpwDMXW3UnG+kHcqBUdDBNyphCkA=; b=aE2DR0d5rHfRb+Gl+aHNJU4ql0vFp16bea7P9l61Q1MR4uXLGPVi6aQJlzueGvatj4T9rkvWzDqljwVjxFodROURPqJpWqjNeKS1zZnTfB3SLdBO1N7meO63InpDaApoptFdlSTZ9A0gnuyP3ouQZB1Huy7DiL2I42ntke1YzQbfLpzrmWy3cWZsjTcZjvAjvR3BAX2yZDRLxa3mXZBWZrFAHb0Q/IBsSKC+2G6UQ1CFkX7nTQERcocAT18gl2frzpW4P1xrKRTfTXlng9AxRNVys25S1ZXsCER0+6doIkfm28ui9AsaIax2xfSKI/HpUfAJQU4JnZ8P3hzySRk6iA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Um2LmzTaVMSt3ymdpwDMXW3UnG+kHcqBUdDBNyphCkA=; b=YLyswj3yv9addm0RO1UYKh5c1J/E9YZ86I/EJeAlnl3CQqZnNeJ3xMo2nFZOAlNZ+zLonH2A5WPNLHK+JHF0Cjd15P0Yqraf4I3xLAK2wvm+K020DpJezu3oU0CwIjvK647YQNEp5mW1JS886+MG/saQhy9cyuMm1FtuYGv9fS0= Received: from VI1PR04MB7023.eurprd04.prod.outlook.com (10.186.159.144) by VI1PR04MB7149.eurprd04.prod.outlook.com (10.186.159.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.19; Mon, 20 Jan 2020 13:41:14 +0000 Received: from VI1PR04MB7023.eurprd04.prod.outlook.com ([fe80::58c5:f02f:2211:4953]) by VI1PR04MB7023.eurprd04.prod.outlook.com ([fe80::58c5:f02f:2211:4953%7]) with mapi id 15.20.2644.024; Mon, 20 Jan 2020 13:41:13 +0000 From: Leonard Crestez To: Peng Fan , "shawnguo@kernel.org" CC: "sboyd@kernel.org" , "s.hauer@pengutronix.de" , "festevam@gmail.com" , Abel Vesa , "kernel@pengutronix.de" , dl-linux-imx , Aisheng Dong , "linux-clk@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Anson Huang , Jacky Bai , "l.stach@pengutronix.de" Subject: Re: [PATCH V3 1/4] clk: imx: composite-8m: add imx8m_clk_hw_composite_core Thread-Topic: [PATCH V3 1/4] clk: imx: composite-8m: add imx8m_clk_hw_composite_core Thread-Index: AQHVzBLeomevoDMgFk6s1Cu8sUYGcA== Date: Mon, 20 Jan 2020 13:41:13 +0000 Message-ID: References: <1579140562-8060-1-git-send-email-peng.fan@nxp.com> <1579140562-8060-2-git-send-email-peng.fan@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=leonard.crestez@nxp.com; x-originating-ip: [89.37.124.34] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 3a850660-d49e-43b5-fc05-08d79dae6aec x-ms-traffictypediagnostic: VI1PR04MB7149:|VI1PR04MB7149: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3276; x-forefront-prvs: 0288CD37D9 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(346002)(366004)(39860400002)(396003)(136003)(189003)(199004)(478600001)(52536014)(55016002)(9686003)(8936002)(4326008)(7696005)(86362001)(2906002)(33656002)(81166006)(110136005)(91956017)(54906003)(44832011)(64756008)(66556008)(66446008)(81156014)(186003)(66476007)(316002)(66946007)(8676002)(71200400001)(76116006)(5660300002)(26005)(53546011)(6506007);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB7149;H:VI1PR04MB7023.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: InbLd+ERJ2hfIg/Qtot8qTJlgEEm26U+Ij7/ErMLw7v+Tt7FPgIvp4TpQjCuPBGZut28PxWX3WS9eC2Lx2aO8SkmthjBEmbEHo22/d3avv7LEtQCuIPACRBA9qKdDTHDOOMEeQ5nh+mefp1q7s6KtTsYFkGmBojXmxfv3l2VEyE+m0Ttn/Fgd4WaacYmP4vftvwqJYYlBBajtnQX2/RkWhB9vNcGfFYFpQ/l/v2kDeInqrY58ifjrIm/Nqe2FyT8HIQQvjDp7hvl+aPC45F0lSSmWq9IAqZGTQutoELFlV2T4fpDVwBZs7rvq9t9mUH5ZHGi/X2oFqfIXb0eUh/M4QtAe2fczl1k1gfUzkqufwMs9TBjMTcYaeEay54kO5ZWa/CggEjuqw/5+EiT8T8HShj2xW+6r5VxExpMptnrrjGjyTUN13Z14GTHCyqn0zcQ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3a850660-d49e-43b5-fc05-08d79dae6aec X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jan 2020 13:41:13.9005 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: aUVWKH1MBEPmQAexo8ScNNifvPVUQz/QpwFdlxMh4OlrkdhvEcRY1k47bZEEWDvD9hCX4LmDZdVJUDXEZ8otSg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7149 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.01.2020 04:15, Peng Fan wrote:=0A= > From: Peng Fan =0A= > =0A= > There are several clock slices, current composite code=0A= > only support bus/ip clock slices, it could not support core=0A= > slice.=0A= > =0A= > So introduce a new API imx8m_clk_hw_composite_core to support=0A= > core slice. To core slice, post divider with 3 bits width and=0A= > no pre divider. Other fields are same as bus/ip slices.=0A= > =0A= > Add a flag IMX_COMPOSITE_CORE for the usecase.=0A= > =0A= > Reviewed-by: Abel Vesa =0A= > Signed-off-by: Peng Fan =0A= =0A= Reviewed-by: Leonard Crestez =0A= =0A= > ---=0A= > drivers/clk/imx/clk-composite-8m.c | 18 ++++++++++++++----=0A= > drivers/clk/imx/clk.h | 13 +++++++++++--=0A= > 2 files changed, 25 insertions(+), 6 deletions(-)=0A= > =0A= > diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-com= posite-8m.c=0A= > index e0f25983e80f..4174506e8bdd 100644=0A= > --- a/drivers/clk/imx/clk-composite-8m.c=0A= > +++ b/drivers/clk/imx/clk-composite-8m.c=0A= > @@ -15,6 +15,7 @@=0A= > #define PCG_PREDIV_MAX 8=0A= > =0A= > #define PCG_DIV_SHIFT 0=0A= > +#define PCG_CORE_DIV_WIDTH 3=0A= > #define PCG_DIV_WIDTH 6=0A= > #define PCG_DIV_MAX 64=0A= > =0A= > @@ -126,6 +127,7 @@ static const struct clk_ops imx8m_clk_composite_divid= er_ops =3D {=0A= > struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,=0A= > const char * const *parent_names,=0A= > int num_parents, void __iomem *reg,=0A= > + u32 composite_flags,=0A= > unsigned long flags)=0A= > {=0A= > struct clk_hw *hw =3D ERR_PTR(-ENOMEM), *mux_hw;=0A= > @@ -133,6 +135,7 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const cha= r *name,=0A= > struct clk_divider *div =3D NULL;=0A= > struct clk_gate *gate =3D NULL;=0A= > struct clk_mux *mux =3D NULL;=0A= > + const struct clk_ops *divider_ops;=0A= > =0A= > mux =3D kzalloc(sizeof(*mux), GFP_KERNEL);=0A= > if (!mux)=0A= > @@ -149,8 +152,16 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const ch= ar *name,=0A= > =0A= > div_hw =3D &div->hw;=0A= > div->reg =3D reg;=0A= > - div->shift =3D PCG_PREDIV_SHIFT;=0A= > - div->width =3D PCG_PREDIV_WIDTH;=0A= > + if (composite_flags & IMX_COMPOSITE_CORE) {=0A= > + div->shift =3D PCG_DIV_SHIFT;=0A= > + div->width =3D PCG_CORE_DIV_WIDTH;=0A= > + divider_ops =3D &clk_divider_ops;=0A= > + } else {=0A= > + div->shift =3D PCG_PREDIV_SHIFT;=0A= > + div->width =3D PCG_PREDIV_WIDTH;=0A= > + divider_ops =3D &imx8m_clk_composite_divider_ops;=0A= > + }=0A= > +=0A= > div->lock =3D &imx_ccm_lock;=0A= > div->flags =3D CLK_DIVIDER_ROUND_CLOSEST;=0A= > =0A= > @@ -164,8 +175,7 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const cha= r *name,=0A= > =0A= > hw =3D clk_hw_register_composite(NULL, name, parent_names, num_parents= ,=0A= > mux_hw, &clk_mux_ops, div_hw,=0A= > - &imx8m_clk_composite_divider_ops,=0A= > - gate_hw, &clk_gate_ops, flags);=0A= > + divider_ops, gate_hw, &clk_gate_ops, flags);=0A= > if (IS_ERR(hw))=0A= > goto fail;=0A= > =0A= > diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h=0A= > index b05213b91dcf..f074dd8ec42e 100644=0A= > --- a/drivers/clk/imx/clk.h=0A= > +++ b/drivers/clk/imx/clk.h=0A= > @@ -477,20 +477,29 @@ struct clk_hw *imx_clk_hw_cpu(const char *name, con= st char *parent_name,=0A= > struct clk *div, struct clk *mux, struct clk *pll,=0A= > struct clk *step);=0A= > =0A= > +#define IMX_COMPOSITE_CORE BIT(0)=0A= > +=0A= > struct clk_hw *imx8m_clk_hw_composite_flags(const char *name,=0A= > const char * const *parent_names,=0A= > int num_parents,=0A= > void __iomem *reg,=0A= > + u32 composite_flags,=0A= > unsigned long flags);=0A= > =0A= > +#define imx8m_clk_hw_composite_core(name, parent_names, reg) \=0A= > + imx8m_clk_hw_composite_flags(name, parent_names, \=0A= > + ARRAY_SIZE(parent_names), reg, \=0A= > + IMX_COMPOSITE_CORE, \=0A= > + CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE)=0A= > +=0A= > #define imx8m_clk_composite_flags(name, parent_names, num_parents, reg,= \=0A= > flags) \=0A= > to_clk(imx8m_clk_hw_composite_flags(name, parent_names, \=0A= > - num_parents, reg, flags))=0A= > + num_parents, reg, 0, flags))=0A= > =0A= > #define __imx8m_clk_hw_composite(name, parent_names, reg, flags) \=0A= > imx8m_clk_hw_composite_flags(name, parent_names, \=0A= > - ARRAY_SIZE(parent_names), reg, \=0A= > + ARRAY_SIZE(parent_names), reg, 0, \=0A= > flags | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE)=0A= > =0A= > #define __imx8m_clk_composite(name, parent_names, reg, flags) \=0A= > =0A= =0A=