From patchwork Wed Jul 31 07:01:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Fan X-Patchwork-Id: 1139545 X-Patchwork-Delegate: lukma@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=nxp.com header.i=@nxp.com header.b="Oadkaz8c"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45z4KL5wv3z9sDQ for ; Wed, 31 Jul 2019 17:08:54 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 7B6ACC21E2F; Wed, 31 Jul 2019 07:05:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 7D7A6C21E34; Wed, 31 Jul 2019 07:02:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9C6C9C21E2C; Wed, 31 Jul 2019 07:02:01 +0000 (UTC) Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20086.outbound.protection.outlook.com [40.107.2.86]) by lists.denx.de (Postfix) with ESMTPS id 6FCF5C21E1B for ; Wed, 31 Jul 2019 07:01:58 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q4G0KUWtDA/0Hhr5HCD1HbuFqva4i+RZtCjskod7mrnJLBHWx93IM46hfRdOB9rcXYfxPTagTnIchDdnkKYlEMYOAYQ4qrLI3Q20eE0k+sV9ftIlEQf5W58OMWNTuoR+HuMwn2hu09vDUIbChy4lAQNzZ5rFMhA8bJ0vkvAqEcgJd2G4styYKuPiAXA+YaAZfMtVkDhl/68ELirgZQZ3N5Q61uwo6lczEba+BYW0X9Pn3VsKc5bjBW3rUOvSNMSzSfYSmDLVHjeck8s+U/Tt8gg38QT/y/f5rJRulI9dK0bMloYERHd5CL2u37A+DSn1Cf2e2Rom75fsrL/cE6gkEg== 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=jMOVjOWWxzyYqCUNyuugqhYoJLLawBvs8Re+f4fiXWk=; b=ApXopU388sYm68NbLBRso0ATZ2PZ6ATz4l01IEh4JN/TdhWXns3PqYVB4H9e8IlG4d6H7VfmBm+rdKyTeKbOfFEK38mX/UKGIigWF3v2xNNBT/gUEAXGQQX7lWVdpD1af9olIsu0IutGSXcBHvyraTpBqkjWObZE8Op+grSVxQ0bQhWdwxme5vrB02NojvnNlSjKP7nAL70eQlAe9Zqh76k3zQfjiXVZsph7EyCALETbRepACwY6SYNtIZWl7Hqm134HaCUUBQp/PNepuxIn0W/DV/HwqC6EOlLs2PMULinWmHVEbQruzyddUnGUiMuS7OOr3WPKSEU8dQ7917qoGQ== 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=jMOVjOWWxzyYqCUNyuugqhYoJLLawBvs8Re+f4fiXWk=; b=Oadkaz8c2d1yZUW1vf5bskYTy1cxRiyu01fDX/KjzbHyR0IacKmfsprwHrKXMy1Bct+mgDIZ+JbSaMyAC6AYhZHaAnXk8LNZeFH8cSiAO/UXkr4g5ldm6DUE1QHLB51CzzwWPbYlllDg2/eecxZM5bHWH9CiL8kva+5h/f/CUho= Received: from AM0PR04MB4481.eurprd04.prod.outlook.com (52.135.147.15) by AM0PR04MB4193.eurprd04.prod.outlook.com (52.134.91.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2115.15; Wed, 31 Jul 2019 07:01:57 +0000 Received: from AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::5d98:e1f4:aa72:16b4]) by AM0PR04MB4481.eurprd04.prod.outlook.com ([fe80::5d98:e1f4:aa72:16b4%4]) with mapi id 15.20.2115.005; Wed, 31 Jul 2019 07:01:57 +0000 From: Peng Fan To: "lukma@denx.de" Thread-Topic: [PATCH V3 13/16] clk: gate: support sandbox Thread-Index: AQHVR23Xugi1YlWVqU2fuU4kkQ11rg== Date: Wed, 31 Jul 2019 07:01:57 +0000 Message-ID: <20190731071654.9970-13-peng.fan@nxp.com> References: <20190731071654.9970-1-peng.fan@nxp.com> In-Reply-To: <20190731071654.9970-1-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.16.4 x-clientproxiedby: HK0PR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:2f::14) To AM0PR04MB4481.eurprd04.prod.outlook.com (2603:10a6:208:70::15) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peng.fan@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.71] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c8cf091a-c09b-4477-004d-08d71584fa1b x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600148)(711020)(4605104)(1401327)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:AM0PR04MB4193; x-ms-traffictypediagnostic: AM0PR04MB4193: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2331; x-forefront-prvs: 011579F31F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(136003)(376002)(346002)(39860400002)(396003)(366004)(199004)(189003)(1076003)(25786009)(5660300002)(66476007)(6916009)(66946007)(66446008)(64756008)(66556008)(26005)(99286004)(52116002)(11346002)(446003)(186003)(66066001)(2906002)(4326008)(102836004)(316002)(386003)(6506007)(7736002)(8676002)(53936002)(8936002)(81166006)(68736007)(86362001)(5640700003)(71190400001)(6486002)(2501003)(478600001)(305945005)(6512007)(81156014)(1730700003)(71200400001)(36756003)(476003)(44832011)(54906003)(2351001)(76176011)(486006)(6436002)(256004)(2616005)(3846002)(14454004)(50226002)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR04MB4193; H:AM0PR04MB4481.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: FRMgg6Tsjn21ZDXKUn7MtMQrKRaVijaujbyu4OAQHokOo4L3ABqktVYnJkiw/CGcKd1guLBzrd+dIVCDLVciJZjzH1PlD2lQiPTAOpRsefxElWmRuI4+uykYv4uXIwN7GCp/xz8UkTidhYX5u/NQoz8xdO+0z+Ax3Kdmf5wWaCWN8F+sT/WvkWfJ4innRS6iuFbDs5l/V74wARAF27q2o5m8juRukUuEkyazeSKHjGf+Vw1AXylCkDtKOW0+2V3tS5G1Y85fkthb0QrXZZToGs94nEtPBa36uY4IduqnVKiBamlrKz9rgB718ZM0Gdc8cAWEucF/QexfHoGhPVlgNHNtqC1wUqhbTVHVCuy2jBr5mON0D3+zzpb9dmfDG/9F5XTHoC5vAIARMIE0ArDdzvdvLqCW+KRymE7yoKOIIq8= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c8cf091a-c09b-4477-004d-08d71584fa1b X-MS-Exchange-CrossTenant-originalarrivaltime: 31 Jul 2019 07:01:57.3803 (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: peng.fan@nxp.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4193 Cc: "u-boot@lists.denx.de" , dl-uboot-imx Subject: [U-Boot] [PATCH V3 13/16] clk: gate: support sandbox X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Introduce io_gate_val for sandbox clk gate test usage Signed-off-by: Peng Fan --- V3: None V2: Rebase drivers/clk/clk-gate.c | 11 +++++++++++ include/linux/clk-provider.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index a3a1fdd3b2..70b8794554 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -55,7 +55,11 @@ static void clk_gate_endisable(struct clk *clk, int enable) if (set) reg |= BIT(gate->bit_idx); } else { +#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF) + reg = gate->io_gate_val; +#else reg = readl(gate->reg); +#endif if (set) reg |= BIT(gate->bit_idx); @@ -86,7 +90,11 @@ int clk_gate_is_enabled(struct clk *clk) dev_get_clk_ptr(clk->dev) : clk); u32 reg; +#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF) + reg = gate->io_gate_val; +#else reg = readl(gate->reg); +#endif /* if a set bit disables this clk, flip it before masking */ if (gate->flags & CLK_GATE_SET_TO_DISABLE) @@ -128,6 +136,9 @@ struct clk *clk_register_gate(struct device *dev, const char *name, gate->reg = reg; gate->bit_idx = bit_idx; gate->flags = clk_gate_flags; +#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF) + gate->io_gate_val = *(u32 *)reg; +#endif clk = &gate->clk; diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index b9547736ee..02ff1a311a 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -75,6 +75,9 @@ struct clk_gate { void __iomem *reg; u8 bit_idx; u8 flags; +#if CONFIG_IS_ENABLED(SANDBOX_CLK_CCF) + u32 io_gate_val; +#endif }; #define to_clk_gate(_clk) container_of(_clk, struct clk_gate, clk)