Received: by 10.192.165.148 with SMTP id m20csp71795imm; Wed, 9 May 2018 08:59:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpkkLj0EOFFxvs5Zx7vMW0hh90KPf55vHW6TwXD2m/vsg3z7CK6XWEit5dTwcuY8u0t4IHw X-Received: by 2002:a63:79ce:: with SMTP id u197-v6mr37012867pgc.242.1525881571906; Wed, 09 May 2018 08:59:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525881571; cv=none; d=google.com; s=arc-20160816; b=gCsm6Do5Zc3PBQSeKOK2RHD+yGzXbGosJFLiSitdc1lXL+Y6l0tBk1FnlFTwQJtbIx A5Mg+2rFCdbYk50NoQYUVWQIP4ipR30cJ+hPmukzJlAdn4FTOBG1VspY/2FphzN9TzTl THH/+LBJhJcQOnlVp5Us1A+mJtaXaxBX3KFi4IxhOSQM3cEiXd2mnNdwPUMzsyzncai/ QbnXTGg1AzVeUPcUooLgeMXDF+47a2QDD81pn4SnY9oZwxCOq/9F9YsjnLC7LXsqYjwl IgxCsDcV8OuLs7DY03psp0YW8n1fgKa+wWTTazSJvBLlSVl4psXfVi48wzFYclujwth9 M+DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=LDy7On/WDZAuoHHSN0wDu0vy0bNKInu5aPNpDH6HLzE=; b=KwB72CqncHgHh0cn8VhMlTTjT/lPx1orENYiUZpTAYQoh38SCwVQEBd4vwOXdglRm9 iJBGHHtwVL68SxtbVTqqdoRgc56HjdmyXM4PoExpo72afI5xULuz8IaGV7p2HUmoWR0b 0nIin6+Pq3f672DncBwOF865A5zDyzcjf9FoOeppZDwjnybUaFHXBrjyaDrD8219YEeT cKJ3RkunGEymb3c+mhR5V4K9aeHbS/5sbXtIzcOf2xj+S/oJaCqywDl0j5nwmVBpMf/y hKpG5StlTfRRukSZ2JDORykusY/khcLPkWU14RUAXdL8lyvA82ZQ+nf8MK8zSnI1h9CB dwCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Cg/0tzVK; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g30-v6si2769362pgn.529.2018.05.09.08.59.16; Wed, 09 May 2018 08:59:31 -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=@chromium.org header.s=google header.b=Cg/0tzVK; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965328AbeEIP6U (ORCPT + 99 others); Wed, 9 May 2018 11:58:20 -0400 Received: from mail-vk0-f68.google.com ([209.85.213.68]:40158 "EHLO mail-vk0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965055AbeEIP6S (ORCPT ); Wed, 9 May 2018 11:58:18 -0400 Received: by mail-vk0-f68.google.com with SMTP id v194-v6so5712725vkd.7 for ; Wed, 09 May 2018 08:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LDy7On/WDZAuoHHSN0wDu0vy0bNKInu5aPNpDH6HLzE=; b=Cg/0tzVKzKSVyd58lv/cEr3T+pzUnguEjxzTGYxHnjjN0i087/sl4GUX+CWz1LuvOb bjTS5uTaO7QTGXyF34GjYOn//2jSHQbBWjwIcjyHSRaP+sBIQSJ06vAi8biCpeLMOan0 4cdSWYpanTv/nl2UG2kwgPW+E11KVf9D4A+zM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LDy7On/WDZAuoHHSN0wDu0vy0bNKInu5aPNpDH6HLzE=; b=D7obojGu2izYkuDy0YgTVPQUvcfmH0WZ2aqLgJSRwBdJadiolkFt7KePW+D/vA5mC7 LmKCAggg3JnHJPuEIcwIvqBRZw5scpsAkSp0JPkMQR1qRvdfzCWC5Wda+XgfZHr9Nacg rm6VEbca3HLlH3u/tz0022BDQ4YgTzTu6HOu0JtDBok0T6Tk2vHzNmzahQOVXQXc4J2d 5EUQoPKQ8F4G5uxtVakRpMUt9TVAhV95EsiIg6atOz3k6XZ+XNwXYV+rs5Iz/AyLtJUJ jfzBA3Y7cfApaEo9hX7Xfk35bYTJHfl8zf6Da9xoXHMTaoYAlVBk1Ft/tFFGoJ2afSFn wKew== X-Gm-Message-State: ALQs6tD2qdEzlDSGkyP5LFUGNuvYogtak1OOU6JkDGMwCYiS+uvr4qmG 8fAIgP5+fU5VuijEC3Qn8ASA8qjA81DYLKOyhfEe7Q== X-Received: by 2002:a1f:94c7:: with SMTP id w190-v6mr37548360vkd.168.1525881496886; Wed, 09 May 2018 08:58:16 -0700 (PDT) MIME-Version: 1.0 References: <1525859941-23654-1-git-send-email-akshu.agrawal@amd.com> <1525859941-23654-2-git-send-email-akshu.agrawal@amd.com> In-Reply-To: <1525859941-23654-2-git-send-email-akshu.agrawal@amd.com> From: Daniel Kurtz Date: Wed, 09 May 2018 15:58:06 +0000 Message-ID: Subject: Re: [PATCH v5 1/2] clk: x86: Add ST oscout platform clock To: Akshu Agrawal Cc: Alexander.Deucher@amd.com, Mike Turquette , sboyd@kernel.org, christian.koenig@amd.com, Dave Airlie , Shaoyun.Liu@amd.com, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, "Rafael J. Wysocki" , Len Brown , linux-acpi@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 9, 2018 at 4:01 AM Akshu Agrawal wrote: > 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 Reviewed-by: Daniel Kurtz > --- > v2: config change, added SPDX tag and used clk_hw_register_. > v3: Fix kbuild warning for checking of NULL pointer > v4: unregister clk_hw in driver remove, add .suppress_bind_attrs > v5: Fix license, used static array > drivers/clk/x86/Makefile | 3 +- > drivers/clk/x86/clk-st.c | 77 ++++++++++++++++++++++++++++++++++++ > include/linux/platform_data/clk-st.h | 17 ++++++++ > 3 files changed, 96 insertions(+), 1 deletion(-) > 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..00303bc 100644 > --- a/drivers/clk/x86/Makefile > +++ b/drivers/clk/x86/Makefile > @@ -1,3 +1,4 @@ > +obj-$(CONFIG_PMC_ATOM) += clk-pmc-atom.o > +obj-$(CONFIG_X86_AMD_PLATFORM_DEVICE) += clk-st.o > clk-x86-lpss-objs := clk-lpt.o > obj-$(CONFIG_X86_INTEL_LPSS) += clk-x86-lpss.o > -obj-$(CONFIG_PMC_ATOM) += clk-pmc-atom.o > diff --git a/drivers/clk/x86/clk-st.c b/drivers/clk/x86/clk-st.c > new file mode 100644 > index 0000000..fb62f39 > --- /dev/null > +++ b/drivers/clk/x86/clk-st.c > @@ -0,0 +1,77 @@ > +// SPDX-License-Identifier: MIT > +/* > + * clock framework for AMD Stoney based clocks > + * > + * Copyright 2018 Advanced Micro Devices, Inc. > + */ > + > +#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[] = { "clk48MHz", "clk25MHz" }; > +static struct clk_hw *hws[ST_MAX_CLKS]; > + > +static int st_clk_probe(struct platform_device *pdev) > +{ > + struct st_clk_data *st_data; > + > + st_data = dev_get_platdata(&pdev->dev); > + if (!st_data || !st_data->base) > + return -EINVAL; > + > + hws[ST_CLK_48M] = clk_hw_register_fixed_rate(NULL, "clk48MHz", NULL, 0, > + 48000000); > + hws[ST_CLK_25M] = clk_hw_register_fixed_rate(NULL, "clk25MHz", NULL, 0, > + 25000000); > + > + hws[ST_CLK_MUX] = clk_hw_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(hws[ST_CLK_MUX]->clk, hws[ST_CLK_25M]->clk); > + > + hws[ST_CLK_GATE] = clk_hw_register_gate(NULL, "oscout1", "oscout1_mux", > + 0, st_data->base + MISCCLKCNTL1, OSCCLKENB, > + CLK_GATE_SET_TO_DISABLE, NULL); > + > + clk_hw_register_clkdev(hws[ST_CLK_GATE], "oscout1", NULL); > + > + return 0; > +} > + > +static int st_clk_remove(struct platform_device *pdev) > +{ > + int i; > + > + for (i = 0; i < ST_MAX_CLKS; i++) > + clk_hw_unregister(hws[i]); > + return 0; > +} > + > +static struct platform_driver st_clk_driver = { > + .driver = { > + .name = "clk-st", > + .suppress_bind_attrs = true, > + }, > + .probe = st_clk_probe, > + .remove = st_clk_remove, > +}; > +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..7cdb6a4 > --- /dev/null > +++ b/include/linux/platform_data/clk-st.h > @@ -0,0 +1,17 @@ > +/* SPDX-License-Identifier: MIT */ > +/* > + * clock framework for AMD Stoney based clock > + * > + * Copyright 2018 Advanced Micro Devices, Inc. > + */ > + > +#ifndef __CLK_ST_H > +#define __CLK_ST_H > + > +#include > + > +struct st_clk_data { > + void __iomem *base; > +}; > + > +#endif /* __CLK_ST_H */ > -- > 1.9.1