Received: by 10.192.165.148 with SMTP id m20csp723897imm; Fri, 4 May 2018 19:27:59 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpflfZSRuYfE+GSuTCHQt4kn97MUewPDM5jsjEE/KExLD+e4Tl5PDt6REfeIU/yp7yVZDCc X-Received: by 10.98.200.29 with SMTP id z29mr28938611pff.81.1525487279076; Fri, 04 May 2018 19:27:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525487279; cv=none; d=google.com; s=arc-20160816; b=x8d/Ir2lHnfm6dDN18oRY8HR52nBjcAp6aY0X/1/9ZPo7yF7YRuLlSWF9ku0zniRdw SgZO0GU1kxBfVdlmfOgVQogyEGdMNdRtrHu/FxkKI4CVIKjTcrV8lv7CpFcaUE6FO61k LZWXhV4tNJUtq+WKiiw3TiqfzFiYDwQZRFZjnCY8WBMPwqNR4Dm5AzHTQBYh8NGZL6au goKOjuN6CO6oBsoVMT2W3XG6pypG2seftmypvR06L1eoYR1vhjnFd0elOMfM1NF3C/fi efVmV4D9c/W+rlBDJUeQjCGelqZCDYNh8zyP/3Ut8KBiCQ62+juEQvx1WYmbSV2yTSdw ncvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version:dkim-signature:arc-authentication-results; bh=8RUDkz+7M2SMF5kc4ppN4uqyLhev3K5VZwCNW2iTXOI=; b=gJ37DDnjJjjEic1i54naS9Kf0KTDc5FuIa0RIcDm2+fVrA+nr7MlRyRXeNexPMqAdB oYRVscYnCCQLG8Wmvd4SAfkYzwACp++6yTC59tmaM1DyT/eratKNzyqJ3VqIJXJTCE1l 76iqhunJ7JExDYhrZNp3DXSKqijPenF9oKVYV3B44hlgoHxFdCP5rMLvNeVROTKc3Ny2 b8fdEjsPYeNSL1Pud1UY+r7mVqV0ml8S/BFuiGIqsC/3a21tgK000GupQAmogRD/C3Fm eBp0cK0tWZg9L1+lYZpw1bt7/q1mbEqWHZsKVye2OxyP9wvmq+Glv25D55cd3ZFbs/gy TdJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=default header.b=MYXogltp; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7si15759493pfa.78.2018.05.04.19.27.14; Fri, 04 May 2018 19:27:59 -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=fail header.i=@kernel.org header.s=default header.b=MYXogltp; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751851AbeEEC0n (ORCPT + 99 others); Fri, 4 May 2018 22:26:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:40438 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751684AbeEEC0l (ORCPT ); Fri, 4 May 2018 22:26:41 -0400 Received: from localhost (unknown [104.132.1.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 160B920834; Sat, 5 May 2018 02:26:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1525487201; bh=oH+w+VfCO3iahrYJ6IoG+Jx+jZMJ6bTXuH8+755uykQ=; h=To:From:In-Reply-To:Cc:References:Subject:Date:From; b=MYXogltpyr1AOdHggNOJ9xzkZk15Zx+yT2ETm7q649BespsUY5XzhZlH5mr+MuF4c 7Kgwy4xsR7qNgBpDF2aH6QwR0IkkxM8u30ZVHaxQDoFTciZOtn7ihss77kkNaoy88v EcEgpQicR2QuYN/0wqN9cPma6+5MHDIu2Dv+taic= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: Akshu Agrawal From: Stephen Boyd In-Reply-To: <1525336264-29243-1-git-send-email-akshu.agrawal@amd.com> Cc: djkurtz@chromium.org, akshu.agrawal@amd.com, Alexander.Deucher@amd.com, Michael Turquette , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , Shaoyun Liu , Dave Airlie , open list , "open list:COMMON CLK FRAMEWORK" References: <1525336264-29243-1-git-send-email-akshu.agrawal@amd.com> Message-ID: <152548720041.138124.2994178054788686137@swboyd.mtv.corp.google.com> User-Agent: alot/0.7 Subject: Re: [PATCH v2] clk: x86: Add ST oscout platform clock Date: Fri, 04 May 2018 19:26:40 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Akshu Agrawal (2018-05-03 01:30:26) > diff --git a/drivers/clk/x86/Makefile b/drivers/clk/x86/Makefile > index 1367afb..2aee002 100644 > --- a/drivers/clk/x86/Makefile > +++ b/drivers/clk/x86/Makefile > @@ -1,3 +1,4 @@ > clk-x86-lpss-objs :=3D clk-lpt.o > obj-$(CONFIG_X86_INTEL_LPSS) +=3D clk-x86-lpss.o > obj-$(CONFIG_PMC_ATOM) +=3D clk-pmc-atom.o > +obj-$(CONFIG_X86_AMD_PLATFORM_DEVICE) +=3D clk-st.o Ok. Can you sort this by kconfig? Or by file name? > diff --git a/drivers/clk/x86/clk-st.c b/drivers/clk/x86/clk-st.c > new file mode 100644 > index 0000000..d8c283c > --- /dev/null > +++ b/drivers/clk/x86/clk-st.c > @@ -0,0 +1,86 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * 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 "Softwa= re"), > + * to deal in the Software without restriction, including without limita= tion > + * the rights to use, copy, modify, merge, publish, distribute, sublicen= se, > + * 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 includ= ed in > + * all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRE= SS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILI= TY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SH= ALL > + * 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. One point of SPDX is to avoid this boiler plate multi-line license comments. Can you remove this and just leave the AMD copyright part? > + */ > + > +#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 > + > +#define ST_CLK_48M 0 > +#define ST_CLK_25M 1 > +#define ST_CLK_MUX 2 > +#define ST_CLK_GATE 3 > +#define ST_MAX_CLKS 4 > + > +static const char * const clk_oscout1_parents[] =3D { "clk48MHz", "clk25= MHz" }; > + > +static int st_clk_probe(struct platform_device *pdev) > +{ > + struct st_clk_data *st_data; > + struct clk_hw **hws; > + > + st_data =3D dev_get_platdata(&pdev->dev); > + if (!st_data || !st_data->base) > + return -EINVAL; > + > + hws =3D kzalloc(sizeof(*hws) * ST_MAX_CLKS, GFP_KERNEL); Fix the kbuild robot errors please. > + > + hws[ST_CLK_48M] =3D clk_hw_register_fixed_rate(NULL, "clk48MHz", = NULL, 0, > + 48000000); > + hws[ST_CLK_25M] =3D clk_hw_register_fixed_rate(NULL, "clk25MHz", = NULL, 0, > + 25000000); I'm not sure why we even keep these pointers around though. The driver doesn't expose them as clks that clk_get() can find so they could just be local variables and no heap allocation is needed. > + > + hws[ST_CLK_MUX] =3D clk_hw_register_mux(NULL, "oscout1_mux", > + clk_oscout1_parents, ARRAY_SIZE(clk_oscout1_parents), > + 0, st_data->base + CLKDRVSTR2, OSCOUT1CLK25MHZ, 3, 0, NUL= L); > + > + clk_set_parent(hws[ST_CLK_MUX]->clk, hws[ST_CLK_25M]->clk); > + > + hws[ST_CLK_GATE] =3D clk_hw_register_gate(NULL, "oscout1", "oscou= t1_mux", > + 0, st_data->base + MISCCLKCNTL1, OSCCLKENB, > + CLK_GATE_SET_TO_DISABLE, NULL); > + > + clk_hw_register_clkdev(hws[ST_CLK_GATE], "oscout1", NULL); Could use devm_*() here in case you want to drop this stuff on driver removal? > + > + return 0; > +} > + > +static struct platform_driver st_clk_driver =3D { > + .driver =3D { > + .name =3D "clk-st", > + }, > + .probe =3D st_clk_probe, suppress attributes here to prevent unbinding from sysfs? > +}; > +builtin_platform_driver(st_clk_driver);