Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1884774ybl; Thu, 9 Jan 2020 03:20:32 -0800 (PST) X-Google-Smtp-Source: APXvYqzuPXGaIosy8FiI+VdMfWyS+P8XUhagDIEqg2g3dByjz1mwC953kLIWSP/hEocMEqL80QeN X-Received: by 2002:aca:d544:: with SMTP id m65mr2761883oig.177.1578568832230; Thu, 09 Jan 2020 03:20:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1578568832; cv=pass; d=google.com; s=arc-20160816; b=DDeiZy9fae5CX4BTMR4zEXgi3AmkMEiwpOhs7nMGhj+IwtfD8VGo+N076wu4nd8C2l LgbGjVJlBomf5lawL8GHSTfjiy3iJ1EyvYYDNWuF37RAcV0X9q8WclOl2kSl/SFwNLXC Dz0x3enqJruRRqcZFHDPM+8UVwddQu8pOPv4+J2HdvceJSHTrBCIGLec1EYeBxkR6sTN 2S44sxcHHz57UlrK98AvdOSWk2bvvgMACaPdvnL02N7tC6YC+VMTmi0QM/CAp1XrDvpb WgrqVYEpEpX/4RDWdFmUuAyA+SpczTi901gf8L+AuQD/wpxO4bUzmoJPpe4l9QbAGm9V 4Rig== 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:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=0Cf1zCLId+N9/Ou4et2vAH1Xuiq6AnPLT30Ercj9LOE=; b=MGuJv+vGEGmdRCFrThdBrtjAXdDcwtkXgL7iK8H/TziBWT/Kb87eebzz/1TFvOhdyK QPUH6bI3+T7kGOeNQ8Kt6t6+rZZq02kdQHiwMIL9cwrTNC8ku0HavFSUYTtdZOME0eSi XK+3nPRpeHBwDRAzQy4iFepoU13SF03oxbMl7w6rbIUHrwx5+ZR56zQEM/zc8W6SaS6M PQ4wVDzpJrtMBxGnI7r2P4m8PHF2xCD8QScuN7gYTTSLBh4ds1jQ/NNIyHmjo+nuzbe7 8m8eRVSWeUxW/btyinvTksdnJfG+8EXgWdW2Mwm/OlFSyJpU52zuMseIi6BWGEgATDvd F+aA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=YwbyEoxt; 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 z14si3908797oth.15.2020.01.09.03.20.20; Thu, 09 Jan 2020 03:20:32 -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=YwbyEoxt; 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 S1729893AbgAIJv7 (ORCPT + 99 others); Thu, 9 Jan 2020 04:51:59 -0500 Received: from mail-eopbgr150077.outbound.protection.outlook.com ([40.107.15.77]:26668 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729170AbgAIJv6 (ORCPT ); Thu, 9 Jan 2020 04:51:58 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jkMfifWn6iT/RU0PzTYyz258TlCyQwn0ji4MegNu2rd2nlR2NxXdVm7a4y+8FOJMuEFiyIb63GQHo6UyzDkefxTKQlv1djuJlHdGJ/OuyyaWtM1zy2btNEw4hXl/I249FsVghZ7DZwu/rDGbNpHDESDl0zixUC6W3gvQfFy/qGYNdg3Myw5gS8iyk8tyKq1aTxZMw6Yno2Ef+o0rap8vy2xTqE3X62IARTNhITzy/wKEoS141sW+2AYeLAxXqFAiBUF0AJ3EgDhPMhVkNR5zSIPJ0WYCDzylOWgxPsWWb5P6Qs991/GIomtaw4op2+h7IE58OzrA20+NC+rHrhabFg== 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=0Cf1zCLId+N9/Ou4et2vAH1Xuiq6AnPLT30Ercj9LOE=; b=Oel0XLf+tNIBCaedtAwIMTV0wJgDzrf/phnHKnmrjCMIkWLz1u6PNsS0hRgKtwriqfPhXufYbpmR549GGfk82zM3cZwEtT0AreeINIe0Sv0IKDERdZJ0jA+lT5VleXecr+/cWzQr0aqAvVu634ckxPQD6ClNHGc0EXt15h2HxJ4e3mobw8xRnrubLMpAvToGZ7RtKZUvKQOmMepEnWB0hQmsB+Ld591HK9Tk85nIh0xJPoQJT0AKc6Df9bewL6xIkVyTPk9EIccqp0suLSpAJ9op+B+EV/JcGdAYNEzy60FBbOyugMZ3YOB5WauL15jQyC4NKKokd+v7lMrk/JWg1w== 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=0Cf1zCLId+N9/Ou4et2vAH1Xuiq6AnPLT30Ercj9LOE=; b=YwbyEoxtMLGAolplTD53TF8XubRAiHpP2lW8Q/mLbv6pkbbPtAJbXk1SkZwS+TuG46dgQJrWF54DkPrd+zq5wPUFkDjpuowZ8VmDwizQwmcjn6KarlznShsrpg/aN94k6ltlLYNywqZZFYcnp2zD+UubWmsTGEcKtjA5fdip6ig= Received: from VI1PR04MB4496.eurprd04.prod.outlook.com (20.177.54.92) by VI1PR04MB6878.eurprd04.prod.outlook.com (52.133.244.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10; Thu, 9 Jan 2020 09:51:55 +0000 Received: from VI1PR04MB4496.eurprd04.prod.outlook.com ([fe80::25c7:9207:684a:5e2b]) by VI1PR04MB4496.eurprd04.prod.outlook.com ([fe80::25c7:9207:684a:5e2b%6]) with mapi id 15.20.2623.010; Thu, 9 Jan 2020 09:51:55 +0000 Received: from localhost.localdomain (119.31.174.67) by HK2PR02CA0172.apcprd02.prod.outlook.com (2603:1096:201:1f::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2602.12 via Frontend Transport; Thu, 9 Jan 2020 09:51:49 +0000 From: Peng Fan To: "sboyd@kernel.org" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "festevam@gmail.com" , Abel Vesa , Leonard Crestez CC: "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 , Peng Fan Subject: [PATCH 1/4] clk: imx: composite-8m: add imx8m_clk_hw_core_composite Thread-Topic: [PATCH 1/4] clk: imx: composite-8m: add imx8m_clk_hw_core_composite Thread-Index: AQHVxtJtEmvfMffSOkGVxP8XepIuvA== Date: Thu, 9 Jan 2020 09:51:55 +0000 Message-ID: <1578563269-32710-2-git-send-email-peng.fan@nxp.com> References: <1578563269-32710-1-git-send-email-peng.fan@nxp.com> In-Reply-To: <1578563269-32710-1-git-send-email-peng.fan@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.7.4 x-clientproxiedby: HK2PR02CA0172.apcprd02.prod.outlook.com (2603:1096:201:1f::32) To VI1PR04MB4496.eurprd04.prod.outlook.com (2603:10a6:803:69::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.67] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: ab077a2c-971d-4998-95a2-08d794e98f6c x-ms-traffictypediagnostic: VI1PR04MB6878:|VI1PR04MB6878: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3276; x-forefront-prvs: 02778BF158 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(396003)(136003)(376002)(366004)(346002)(39860400002)(189003)(199004)(6486002)(26005)(4326008)(54906003)(69590400006)(36756003)(6636002)(71200400001)(6506007)(110136005)(52116002)(478600001)(8936002)(6512007)(316002)(16526019)(186003)(86362001)(6666004)(2616005)(956004)(44832011)(66946007)(66556008)(5660300002)(66446008)(64756008)(2906002)(8676002)(81166006)(66476007)(81156014);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR04MB6878;H:VI1PR04MB4496.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: eOSu1OnozzUUGIB+O9P4ojWAtUU1W/P9la0lDjzFvWhrzUjJzyWF0FmIZtMw1EFF3dDj2PbPYBZd8vBwXDaPf5m6X8nD70cDq4ZCSphyLLkkC1r5smUCQX08ToUc162Gbfv5ZfwfhbPs7ouKN1ipwbnmH2hvPRi/cBvECayKFxn76ZXn4axMo8IgpYbrHKEhVl6pF0iInvNDuNphmHjgK6BTrCgc6m4znYmsragljj13obq/tBjwnlgppzu5QFPPXwcjSbRiB9K7JH/hZrErY2h4kbnoCkwMvL4Wce4rxUST748xNJfbenDXpEGhKcaaeUy1wYnUyx+QpQVEwxqwwkW0Bkh3lsMg5SZmb0pulKL124rXOYl6pvZ+iXOaTasCXg0Rs7QjW6kZmte96phx7rmLmcm44kWYhczOAgZqGoATakDCGWvXA5D68/KQUZJe2nHavgzKURLPLHXVIt5FYgVHAN05NSOvjOPDiaSsZBmJxUAcuCmZbmTIQePJxGvi Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab077a2c-971d-4998-95a2-08d794e98f6c X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jan 2020 09:51:55.3321 (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: BOFzTUgSMFeEISOhI6pjMhJq2f3TnlLf8kXBPL4qKWNHgRETDx+L3VZDaz4gABBO9L37lbIkkv7fovFemDTFUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6878 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peng Fan There are several clock slices, current composite code only support bus/ip clock slices, it could not support core slice. So introduce a new API imx8m_clk_hw_core_composite to support core slice. To core slice, post divider with 3 bits width and no pre divider. Other fields are same as bus/ip slices. Add a flag IMX_COMPOSITE_CORE for the usecase. Signed-off-by: Peng Fan --- drivers/clk/imx/clk-composite-8m.c | 18 ++++++++++++++---- drivers/clk/imx/clk.h | 12 ++++++++++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-compo= site-8m.c index 20f7c91c03d2..4869c16376bf 100644 --- a/drivers/clk/imx/clk-composite-8m.c +++ b/drivers/clk/imx/clk-composite-8m.c @@ -15,6 +15,7 @@ #define PCG_PREDIV_MAX 8 =20 #define PCG_DIV_SHIFT 0 +#define PCG_CORE_DIV_WIDTH 3 #define PCG_DIV_WIDTH 6 #define PCG_DIV_MAX 64 =20 @@ -126,6 +127,7 @@ static const struct clk_ops imx8m_clk_composite_divider= _ops =3D { struct clk_hw *imx8m_clk_hw_composite_flags(const char *name, const char * const *parent_names, int num_parents, void __iomem *reg, + u32 composite_flags, unsigned long flags) { struct clk_hw *hw =3D ERR_PTR(-ENOMEM), *mux_hw; @@ -133,6 +135,7 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char = *name, struct clk_divider *div =3D NULL; struct clk_gate *gate =3D NULL; struct clk_mux *mux =3D NULL; + const struct clk_ops *divider_ops; =20 mux =3D kzalloc(sizeof(*mux), GFP_KERNEL); if (!mux) @@ -150,8 +153,16 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char= *name, =20 div_hw =3D &div->hw; div->reg =3D reg; - div->shift =3D PCG_PREDIV_SHIFT; - div->width =3D PCG_PREDIV_WIDTH; + if (composite_flags & IMX_COMPOSITE_CORE) { + div->shift =3D PCG_DIV_SHIFT; + div->width =3D PCG_CORE_DIV_WIDTH; + divider_ops =3D &clk_divider_ops; + } else { + div->shift =3D PCG_PREDIV_SHIFT; + div->width =3D PCG_PREDIV_WIDTH; + divider_ops =3D &imx8m_clk_composite_divider_ops; + } + div->lock =3D &imx_ccm_lock; div->flags =3D CLK_DIVIDER_ROUND_CLOSEST; =20 @@ -166,8 +177,7 @@ struct clk_hw *imx8m_clk_hw_composite_flags(const char = *name, =20 hw =3D clk_hw_register_composite(NULL, name, parent_names, num_parents, mux_hw, &clk_mux_ops, div_hw, - &imx8m_clk_composite_divider_ops, - gate_hw, &clk_gate_ops, flags); + divider_ops, gate_hw, &clk_gate_ops, flags); if (IS_ERR(hw)) goto fail; =20 diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h index ea84d2993b57..a74a409724e7 100644 --- a/drivers/clk/imx/clk.h +++ b/drivers/clk/imx/clk.h @@ -483,20 +483,28 @@ struct clk_hw *imx_clk_hw_cpu(const char *name, const= char *parent_name, struct clk *div, struct clk *mux, struct clk *pll, struct clk *step); =20 +#define IMX_COMPOSITE_CORE BIT(0) + struct clk_hw *imx8m_clk_hw_composite_flags(const char *name, const char * const *parent_names, int num_parents, void __iomem *reg, + u32 composite_flags, unsigned long flags); =20 +#define imx8m_clk_hw_core_composite(name, parent_names, reg) \ + imx8m_clk_hw_composite_flags(name, parent_names, \ + ARRAY_SIZE(parent_names), reg, \ + IMX_COMPOSITE_CORE, 0) + #define imx8m_clk_composite_flags(name, parent_names, num_parents, reg, \ flags) \ to_clk(imx8m_clk_hw_composite_flags(name, parent_names, \ - num_parents, reg, flags)) + num_parents, reg, 0, flags)) =20 #define __imx8m_clk_hw_composite(name, parent_names, reg, flags) \ imx8m_clk_hw_composite_flags(name, parent_names, \ - ARRAY_SIZE(parent_names), reg, \ + ARRAY_SIZE(parent_names), reg, 0, \ flags | CLK_SET_RATE_NO_REPARENT | CLK_OPS_PARENT_ENABLE) =20 #define __imx8m_clk_composite(name, parent_names, reg, flags) \ --=20 2.16.4