From patchwork Mon Nov 7 10:09:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 9414589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6CDC360720 for ; Mon, 7 Nov 2016 10:06:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E3AE28963 for ; Mon, 7 Nov 2016 10:06:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5276A28A3D; Mon, 7 Nov 2016 10:06:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2AF028A41 for ; Mon, 7 Nov 2016 10:06:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751949AbcKGKGq (ORCPT ); Mon, 7 Nov 2016 05:06:46 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:60639 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751134AbcKGKGp (ORCPT ); Mon, 7 Nov 2016 05:06:45 -0500 Received: from epcpsbgm1new.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OG902MV7O330X00@mailout4.samsung.com>; Mon, 07 Nov 2016 19:06:42 +0900 (KST) X-AuditID: cbfee61a-f79916d0000062de-7d-58205232fd99 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 9B.38.25310.23250285; Mon, 7 Nov 2016 19:06:42 +0900 (KST) Received: from pankaj.sisodomain.com ([107.108.83.125]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OG90041ZO2UTC50@mmp1.samsung.com>; Mon, 07 Nov 2016 19:06:42 +0900 (KST) From: Pankaj Dubey To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: krzk@kernel.org, javier@osg.samsung.com, kgene@kernel.org, thomas.ab@samsung.com, myungjoo.ham@samsung.com, Pankaj Dubey , Michael Turquette , Rob Herring , devicetree@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH 3/6] clk: Add driver for Maxim-8997 PMIC clocks Date: Mon, 07 Nov 2016 15:39:33 +0530 Message-id: <1478513376-14307-4-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1478513376-14307-1-git-send-email-pankaj.dubey@samsung.com> References: <1478513376-14307-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgkeLIzCtJLcpLzFFi42I5/e+xgK5RkEKEwYlJahbzj5xjtXjzdg2T Rf/j18wW589vYLfY9Pgaq8XHnnusFjPO72OyuHjK1eJ24wo2i0Vbv7BbtO49wm7RsYzRgcfj /Y1Wdo9NqzrZPDYvqffY0n+X3aNvyypGj8+b5ALYotxsMlITU1KLFFLzkvNTMvPSbZVCQ9x0 LZQU8hJzU22VInR9Q4KUFMoSc0qBPCMDNODgHOAerKRvl+CW8fXoaraCz1oVC44eYG9gvKfc xcjJISFgIjH3xEI2CFtM4sK99UA2F4eQwFJGiZcv9zBDOD8ZJd707WEHqWIT0JV48n4uM4gt IuAtMfnMX3aQImaBpUwSqx79ZQFJCAvYS1ydchNsLIuAqsSlWWeA4hwcvAIeEvdfRkNsk5O4 ea4TbA6ngKfE5xlrwcqFgErWbdvAMoGRdwEjwypGidSC5ILipPRcw7zUcr3ixNzi0rx0veT8 3E2M4Fh4JrWD8eAu90OMAhyMSjy8Kw7KRwixJpYVV+YeYpTgYFYS4WX1U4gQ4k1JrKxKLcqP LyrNSS0+xGgKdNdEZinR5HxgnOaVxBuamJuYGxtYmFtamhgpifM2zn4WLiSQnliSmp2aWpBa BNPHxMEp1cCYG3RmHfP2SI0tegLWs+VUk6akN5XLre27GGK2YLfAyxPGc55mW1p2smxY3zNx Waqt5OWUgj/ui9X6Y7ZLGbj1JjDNcprwrvbdiY8JJ7WPOyyPb53IpbRwrnB91k3ncx7l1U0b hUN7Z/ndEq7ZK7dR8M2P5s/XL5Sb/g/fmXz8xVGeSdW7ApqVWIozEg21mIuKEwHJYM4+mwIA AA== X-MTR: 20000000000000000@CPGS Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The MAX8997 PMIC has 32.786kHz crystal oscillator which provides an accurate low frequency clock for MAX8997 internal circuit as well as external circuit. This patch adds support for these two clocks. CC: Michael Turquette CC: Rob Herring CC: devicetree@vger.kernel.org CC: linux-clk@vger.kernel.org Signed-off-by: Pankaj Dubey --- drivers/clk/Kconfig | 10 ++++ drivers/clk/Makefile | 1 + drivers/clk/clk-max8997.c | 76 +++++++++++++++++++++++++++++++ include/dt-bindings/clock/maxim,max8997.h | 23 ++++++++++ 4 files changed, 110 insertions(+) create mode 100644 drivers/clk/clk-max8997.c create mode 100644 include/dt-bindings/clock/maxim,max8997.h diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index e2d9bd7..5339cbe 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -48,6 +48,16 @@ config COMMON_CLK_MAX77802 ---help--- This driver supports Maxim 77802 crystal oscillator clock. +config COMMON_CLK_MAX8997 + tristate "Clock driver for Maxim 8997 MFD" + depends on MFD_MAX8997 + select COMMON_CLK_MAX_GEN + ---help--- + This driver supports Maxim 8997 crystal oscillator clock. + The 32.768kHz crystal oscillator clock provides an accurate + low frequency clock for MAX8997 internal circuit as well as + external circuit. + config COMMON_CLK_RK808 tristate "Clock driver for RK808/RK818" depends on MFD_RK808 diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 3b6f9cf..1cfa9ab 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -30,6 +30,7 @@ obj-$(CONFIG_MACH_LOONGSON32) += clk-ls1x.o obj-$(CONFIG_COMMON_CLK_MAX_GEN) += clk-max-gen.o obj-$(CONFIG_COMMON_CLK_MAX77686) += clk-max77686.o obj-$(CONFIG_COMMON_CLK_MAX77802) += clk-max77802.o +obj-$(CONFIG_COMMON_CLK_MAX8997) += clk-max8997.o obj-$(CONFIG_ARCH_MB86S7X) += clk-mb86s7x.o obj-$(CONFIG_ARCH_MOXART) += clk-moxart.o obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o diff --git a/drivers/clk/clk-max8997.c b/drivers/clk/clk-max8997.c new file mode 100644 index 0000000..9158354 --- /dev/null +++ b/drivers/clk/clk-max8997.c @@ -0,0 +1,76 @@ +/* + * clk-max8997.c - Clock driver for Maxim 8997 + * + * Copyright (C) 2016 Samsung Electornics + * Pankaj Dubey + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "clk-max-gen.h" + +static struct clk_init_data max8997_clks_init[MAX8997_CLKS_NUM] = { + [MAX8997_CLK_AP] = { + .name = "32khz_ap", + .ops = &max_gen_clk_ops, + }, + [MAX8997_CLK_CP] = { + .name = "32khz_cp", + .ops = &max_gen_clk_ops, + }, +}; + +static int max8997_clk_probe(struct platform_device *pdev) +{ + struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent); + + return max_gen_clk_probe(pdev, iodev->regmap, MAX8997_REG_MAINCON1, + max8997_clks_init, MAX8997_CLKS_NUM); +} + +static int max8997_clk_remove(struct platform_device *pdev) +{ + return max_gen_clk_remove(pdev, MAX8997_CLKS_NUM); +} + +static const struct platform_device_id max8997_clk_id[] = { + { "max8997-clk", 0}, + { }, +}; +MODULE_DEVICE_TABLE(platform, max8997_clk_id); + +static struct platform_driver max8997_clk_driver = { + .driver = { + .name = "max8997-clk", + }, + .probe = max8997_clk_probe, + .remove = max8997_clk_remove, + .id_table = max8997_clk_id, +}; + +module_platform_driver(max8997_clk_driver); + +MODULE_DESCRIPTION("MAXIM 8997 Clock Driver"); +MODULE_AUTHOR("Pankaj Dubey "); +MODULE_LICENSE("GPL"); diff --git a/include/dt-bindings/clock/maxim,max8997.h b/include/dt-bindings/clock/maxim,max8997.h new file mode 100644 index 0000000..f2dd972 --- /dev/null +++ b/include/dt-bindings/clock/maxim,max8997.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Author: Pankaj Dubey + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Device Tree binding constants clocks for the Maxim 8997 PMIC. + */ + +#ifndef _DT_BINDINGS_CLOCK_MAXIM_MAX8997_CLOCK_H +#define _DT_BINDINGS_CLOCK_MAXIM_MAX8997_CLOCK_H + +/* Fixed rate clocks. */ + +#define MAX8997_CLK_AP 0 +#define MAX8997_CLK_CP 1 + +/* Total number of clocks. */ +#define MAX8997_CLKS_NUM (MAX8997_CLK_CP + 1) + +#endif /* _DT_BINDINGS_CLOCK_MAXIM_MAX8997_CLOCK_H */