Received: by 10.192.165.148 with SMTP id m20csp3467932imm; Mon, 30 Apr 2018 00:10:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrrDtnyZkgl43Li0gLOEog71N9lXyg6hYwLbpVOzPu4Ss8Qmrv3agAwcElCBv8duawtxlW1 X-Received: by 2002:a17:902:20cb:: with SMTP id v11-v6mr11168221plg.82.1525072232592; Mon, 30 Apr 2018 00:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525072232; cv=none; d=google.com; s=arc-20160816; b=L1W6c3TzedBu3XVZwML0wduu0QGqRX3ZfmbqG2vhPbL2GneJXywbEiOkn01tIKIfTV qmOdGeds5R7CjfbDnlaiKhzkYASxUGliwxQvp8jiw5uWm/oo1iSZ1mW/HtI830qWRuZ4 /5NN8VKy5EKERm7i+NCGUeDEdkbhzpfJBT7sv0kVDu1cZo4AoayWOFj79gt8EnwCk3Vv Jj1SxM03k0RCSPYh1qSybQieQtBfkcLh+hrEnJjZKCVEY93yfJs4ywNaj1Wc1tldaujc +Y8wOI8Slt3YwCDCqqXDPSBJTTikSA0l7/9GMkJbK9ec5UHgZQMDcVCp/jvrJQI5ML0+ EamQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:message-id:date:subject:cc:from :dkim-signature:arc-authentication-results; bh=2xz1b+gIa5BEn/YIMt9+WDgkD/iU7RSdywC+Wv7zksg=; b=jPMvwgNQG79MV7LPZB1kALwsq5DBsDSn43nle/ajVhMRof+MMMmKG5HcC6LWy3fbJB MlUGlhlVk4HukPzTrGmLO2xNOaRXvzOceOW0zQ21/9CYVzZPmhd1S16Bn8UvNCxnuJgF /W5R3ltGARmoiBimjjmzGzj2dgGHsrWW4XMabfEkks/iexRfUq/GboYsVtgVyouygv6Y thszgRiLnMJb64WoQj52sVDQYFx85ReQd3ZuvwXpnjC7NSfWk+SeVDas1ldRaIS/v9Qt oh2CArBhBgWf0AqrdjKC19dladuyxpx38YXQCHOXyMm8BAtNOBDciyF50OxerlmnMjw3 4vKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=egAErm4Q; 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 c8si7049319pfj.138.2018.04.30.00.10.18; Mon, 30 Apr 2018 00:10:32 -0700 (PDT) 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=@amdcloud.onmicrosoft.com header.s=selector1-amd-com header.b=egAErm4Q; 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 S1751807AbeD3HKA (ORCPT + 99 others); Mon, 30 Apr 2018 03:10:00 -0400 Received: from mail-bn3nam01on0077.outbound.protection.outlook.com ([104.47.33.77]:38151 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751659AbeD3HJ6 (ORCPT ); Mon, 30 Apr 2018 03:09:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=2xz1b+gIa5BEn/YIMt9+WDgkD/iU7RSdywC+Wv7zksg=; b=egAErm4QTI/kQiM0yRJdxK5cmFDiWDx9eXt1bTAjrMrgvm3e7gz9/CEoOO6IMh5UWna6mfeMWK8o+W27pknET6iSGPp/kIhd6pfu+3yWHrpvqOYAw1aOHDgBhcVIa9O28B8/ZLuBErys18y5r0sYnpNdD1ADmrS5I8RZBa2IDTA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Akshu.Agrawal@amd.com; Received: from akshu-HP-EliteBook-745-G2.mshome.net (202.56.249.162) by SN1PR12MB2368.namprd12.prod.outlook.com (2603:10b6:802:25::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.18; Mon, 30 Apr 2018 07:09:46 +0000 From: Akshu Agrawal Cc: djkurtz@chromium.org, akshu.agrawal@amd.com, Alexander.Deucher@amd.com, Michael Turquette , Stephen Boyd , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , Dave Airlie , Shaoyun Liu , linux-kernel@vger.kernel.org (open list), linux-clk@vger.kernel.org (open list:COMMON CLK FRAMEWORK) Subject: [PATCH] clk: x86: Add ST oscout platform clock Date: Mon, 30 Apr 2018 15:06:53 +0800 Message-Id: <1525072055-17898-1-git-send-email-akshu.agrawal@amd.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [202.56.249.162] X-ClientProxiedBy: PN1PR0101CA0040.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c00:c::26) To SN1PR12MB2368.namprd12.prod.outlook.com (2603:10b6:802:25::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020);SRVR:SN1PR12MB2368; X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB2368;3:BhYz9aXbKO1OzjOEBsZJEr7e9kuYgJtRl12dtaPUWkNOev2Glu18608uuosalOhKj/A84B7uy25YIvwLIUWu6CpBk3OdLWgC9gKMC545b1DmtvR9IyO3Dvi5EDSXfD7mZtlItC57P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GAiPlK901sF9DmqJktMaHu0lz6WwXB24UptAyoNdZ8GHWnieA8v70yGhqZS5GQSsi9mlK4A0KDzbt5jt/yAKzEJuvahAiQ9+hKShUBPf6YuDp3tOMOeXkSHUtlM0OmnwTL42yP2y6fcStHkNVDaiFCjyzXyTcL1ib3Q3BQ5pTBHQx16iMvNxuG9YV3oYb/AiKEtmMYyN7XB2I/3pScRqLbII44p;4:HCx+8FZD5ALcbV7JPZr+NE8hiS0D8HOAm275D9gBST/Ra0dJe/x592GguxJUdzRHXZrwAHgy2PTLaBsAQ3yyhfzKqD7eqAr5b9IqoPZReZRjoEfYtL3gpyfjt73sqLQ1UKuuyIbV52GXysqQBqdZwt6CagurjHCrtRcqHz9vQF1zsqSJbsFmByGtHWRcuG8NuHnMDl0CkV2i4PRnWDZdosT6lmihwFu6qdPs+3rrqAwAWyXaXE/NNXtoZe9bhovOrEj6sqsGoXXDGJqh8NlSASnvae3VAMvdJmYpPXGUqHxWOECYY9eHBjC6npAuAiNL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231254)(944501410)(52105095)(6055026)(6041310)(20161123564045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(6072148)(201708071742011);SRVR:SN1PR12MB2368;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB2368; X-Forefront-PRVS: 0658BAF71F X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39380400002)(346002)(376002)(39860400002)(366004)(396003)(189003)(199004)(6666003)(4326008)(2906002)(53416004)(69596002)(97736004)(6512007)(48376002)(575784001)(106356001)(105586002)(109986005)(53936002)(86362001)(305945005)(6116002)(72206003)(3846002)(25786009)(81166006)(7736002)(50466002)(1857600001)(956004)(44832011)(478600001)(54906003)(2616005)(16586007)(1671002)(476003)(59450400001)(5660300001)(316002)(66066001)(36756003)(8936002)(51416003)(47776003)(6506007)(386003)(16526019)(52116002)(186003)(50226002)(486006)(68736007)(6486002)(8676002)(26005)(81156014)(266003);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR12MB2368;H:akshu-HP-EliteBook-745-G2.mshome.net;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;SN1PR12MB2368;23:CcYqcCARnXyt/gb8/MRrKuXJXCfi/xP1MGrg/joj1?= =?us-ascii?Q?GNgwdDB/ninq9w6/+WRl487f+GLCoyc6OJscxkccD0L8FcFQOEe3ZzN6/H7T?= =?us-ascii?Q?CylDdNdX0Y8vD/wzRwwQDOaTspzSPu/5qZhIMRv/bCa7fE72aM7wCtjTqDON?= =?us-ascii?Q?TOy8M4KgXfo3n7b+mnj/lfr5hf4k6Inv3vLAObRgAlPsYvZadyQNnNXiRQV4?= =?us-ascii?Q?B4LDEYTJPa9hur2OO5DSbfXKpvsOB87i5cQvUE7n8hPfD5dHm7aIGev7qHoq?= =?us-ascii?Q?BnhVmlo/mZxZ0OyMD8ARcC7IbqHuUR5oP8ytw82tI3bSesBOJP6hWedeOdYL?= =?us-ascii?Q?2LB7QcWMjsRvWOk0vr59sSoKXSf0zA/65sTehmlSyM3n9tta8iXLKOCPeE2R?= =?us-ascii?Q?aOM0jeMl0MwV3dz4BoehQUSllLGCZzVRwK7DGpwUQRHxAf8GK8091RI+4/2S?= =?us-ascii?Q?yn2M4JrAWWiuc8qS7YFupuro0r6KcOrBsy1zju9saScjdPd1ZhNkySRpX0wx?= =?us-ascii?Q?DK4b1qrF7vt5O/I+6FUU0wXJlJSeSvXS8XPoVouIzKKDNXVc0G5iM8JB9qpz?= =?us-ascii?Q?pXKLxXPtfISDObew2SL6hls+E8q77hQbTKXpZwGS6Sb1NN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d9F9XsOv/WF1T92HnTuiDQPN+3BmESyTPnPkxYoDE64j/u4e5yKLBkcY1lY+4X7F3CbQVy;20:tUqGa/nL/NknVeJ1ZBC3sCNfuYuz5cB5dSVAbOPcgw9gUFkn+TnV/zdF0fEZ8HHUd/r/Z8NC11dmsvQHoc7E0ZllDQbp4P06ccB+6JLZXryqC2ZnPtANjzuYlaQNFAEHHi5yIU7oFyKfJgLwliqjy5We0c6/BPWTJqs3Ffil2fnnYb713kEqiu+3kpIVGS0WhfmDBRpOCOwEWwSl/BZPga6F5gIc4yDZbEWwX5KQaYkObbGZDOxPHMjXCUCQBxVK X-MS-Office365-Filtering-Correlation-Id: 69ba1f70-e72a-423f-5a6f-08d5ae69607d X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2018 07:09:46.6887 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 69ba1f70-e72a-423f-5a6f-08d5ae69607d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB2368 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Stoney SoC provides oscout clock. This clock can support 25Mhz and 48Mhz of frequency. The clock is available for general system use. Signed-off-by: Akshu Agrawal --- drivers/clk/x86/Makefile | 1 + drivers/clk/x86/clk-st.c | 80 ++++++++++++++++++++++++++++++++++++ include/linux/platform_data/clk-st.h | 32 +++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 drivers/clk/x86/clk-st.c create mode 100644 include/linux/platform_data/clk-st.h diff --git a/drivers/clk/x86/Makefile b/drivers/clk/x86/Makefile index 1367afb..f7ebae1 100644 --- a/drivers/clk/x86/Makefile +++ b/drivers/clk/x86/Makefile @@ -1,3 +1,4 @@ clk-x86-lpss-objs := clk-lpt.o obj-$(CONFIG_X86_INTEL_LPSS) += clk-x86-lpss.o obj-$(CONFIG_PMC_ATOM) += clk-pmc-atom.o +obj-$(CONFIG_X86) += clk-st.o diff --git a/drivers/clk/x86/clk-st.c b/drivers/clk/x86/clk-st.c new file mode 100644 index 0000000..6ac0dc5 --- /dev/null +++ b/drivers/clk/x86/clk-st.c @@ -0,0 +1,80 @@ +/* + * clock framework for AMD Stoney based clocks + * + * Copyright 2018 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#include +#include +#include +#include +#include + +/* Clock Driving Strength 2 register */ +#define CLKDRVSTR2 0x28 +/* Clock Control 1 register */ +#define MISCCLKCNTL1 0x40 +/* Auxiliary clock1 enable bit */ +#define OSCCLKENB 2 +/* 25Mhz auxiliary output clock freq bit */ +#define OSCOUT1CLK25MHZ 16 + +static const char * const clk_oscout1_parents[] = { "clk48MHz", "clk25MHz" }; + +static int st_clk_probe(struct platform_device *pdev) +{ + struct st_clk_data *st_data; + struct clk *clk_48m; + struct clk *clk_25m; + struct clk *clk_oscout1_mux; + struct clk *clk_oscout1; + + st_data = dev_get_platdata(&pdev->dev); + if (!st_data || !st_data->base) + return -EINVAL; + + clk_48m = clk_register_fixed_rate(NULL, "clk48MHz", NULL, 0, + 48000000); + clk_25m = clk_register_fixed_rate(NULL, "clk25MHz", NULL, 0, + 25000000); + + clk_oscout1_mux = clk_register_mux(NULL, "oscout1_mux", + clk_oscout1_parents, ARRAY_SIZE(clk_oscout1_parents), + 0, st_data->base + CLKDRVSTR2, OSCOUT1CLK25MHZ, 3, 0, NULL); + + clk_set_parent(clk_oscout1_mux, clk_25m); + + clk_oscout1 = clk_register_gate(NULL, "oscout1", "oscout1_mux", + 0, st_data->base + MISCCLKCNTL1, OSCCLKENB, + CLK_GATE_SET_TO_DISABLE, NULL); + + clk_register_clkdev(clk_oscout1, "oscout1", NULL); + + return 0; +} + +static struct platform_driver st_clk_driver = { + .driver = { + .name = "clk-st", + }, + .probe = st_clk_probe, +}; +builtin_platform_driver(st_clk_driver); diff --git a/include/linux/platform_data/clk-st.h b/include/linux/platform_data/clk-st.h new file mode 100644 index 0000000..5ede980 --- /dev/null +++ b/include/linux/platform_data/clk-st.h @@ -0,0 +1,32 @@ +/* + * clock framework for AMD Stoney based clock + * + * Copyright 2018 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __CLK_ST_H +#define __CLK_ST_H + +struct st_clk_data { + void __iomem *base; +}; + +#endif /* __CLK_ST_H */ -- 1.9.1