From patchwork Mon Jun 15 04:53:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6606011 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 19C56C0020 for ; Mon, 15 Jun 2015 04:53:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B41220534 for ; Mon, 15 Jun 2015 04:53:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CDC7320528 for ; Mon, 15 Jun 2015 04:53:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751515AbbFOExR (ORCPT ); Mon, 15 Jun 2015 00:53:17 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:27171 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750751AbbFOExQ (ORCPT ); Mon, 15 Jun 2015 00:53:16 -0400 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie2.idc.renesas.com with ESMTP; 15 Jun 2015 13:53:14 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id DF0BE4AE02; Mon, 15 Jun 2015 13:53:14 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id B7805480A3; Mon, 15 Jun 2015 13:53:14 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id B7505480A5; Mon, 15 Jun 2015 13:53:14 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac4.idc.renesas.com with ESMTP id PAM08694; Mon, 15 Jun 2015 13:53:14 +0900 X-IronPort-AV: E=Sophos;i="5.13,616,1427727600"; d="scan'";a="188296489" Received: from mail-hk1lp0125.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.125]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 15 Jun 2015 13:53:14 +0900 Authentication-Results: verge.net.au; dkim=none (message not signed) header.d=none; Received: from morimoto-PC.renesas.com (211.11.155.132) by HKNPR06MB305.apcprd06.prod.outlook.com (10.141.37.16) with Microsoft SMTP Server (TLS) id 15.1.190.14; Mon, 15 Jun 2015 04:53:11 +0000 Message-ID: <874mm9wp5h.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 1/6][RFC] clk: shmobile: add CPG common lock support for Gen3 User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Simon CC: Magnus , , YOSHIYUKI ITO , Hisao Munakata , Yusuke Goda , Yoshihiro Shimoda , TOSHIAKI KOMATSU , Gaku Inami In-Reply-To: <87616pwp7a.wl%kuninori.morimoto.gx@renesas.com> References: <87616pwp7a.wl%kuninori.morimoto.gx@renesas.com> Date: Mon, 15 Jun 2015 04:53:11 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: OS1PR01CA0023.jpnprd01.prod.outlook.com (25.161.225.161) To HKNPR06MB305.apcprd06.prod.outlook.com (10.141.37.16) X-Microsoft-Exchange-Diagnostics: 1; HKNPR06MB305; 2:UNrUL1SOVgKzAqap4US2gcJwg6uA6wFhjIGXdwDVWDjtW27LRxwz9A5YJ9DUToRn; 2:35vql+xcP8slOLRsqsEL3Ghh0C1OfQB47ICtJ+n3fuABnba0qEz23bqp8RyeaulhBU6dP00WrQp8tagdIlg4NMcaXNZhBltFncXnc7msGwBqC+CdRIe93KKi0IAI7FcTo2uCPOUvBgiyq//RfLaoKw==; 6:3S6hXpvrFkgPFfqm+oYzpge5Io/BFYduWbvRbEoYw5/kHOZjaiVgb0L9A+WW8dtJ5NgfhRzRRj2ZfluW/sJhd+tu/53YNO6QhG5GZAz73gfpVcioLyysb1iQCxp6tsNA+tN33LdKnJq+vuQgnmXQn1JBW3lmH85F+gs3JCIt6c4x5yp6uXecfg4ek+l8XZzKyI4vVft6RHvqsPl92HiDPV8f5v6ziFdvFSgPWaTVvm/FvLlYbDzs8DRAMEFBKajjoVmrLzfu4D8OlBlYVm72dgpI161gkk+Nxfvo+CFQ1sm1pau+S9VDTAwfvHxBlR7J5bvLFjfTGtpaj3lIYHXnVAeeELUjb5kVPJ+qoDPqki2x7/jGkWcwVRshfEVKUwt4EEuPJ3naVanFfTwXMLF2xvWD2WZ2aStzQVjjpsB0FMMtW33/OeeG6yCquWMGkkfnJj6KEZSDhcH4mHAt5RSlkpZLCfkjcMuk6B5m9H/T0vwix6Gee0793RfhHkwIT1pR X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKNPR06MB305; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(520003)(5005006)(3002001); SRVR:HKNPR06MB305; BCL:0; PCL:0; RULEID:; SRVR:HKNPR06MB305; X-Microsoft-Exchange-Diagnostics: 1; HKNPR06MB305; 3:H1jUho3Avr3F3h0NL/OYMZ+0SjuLcMbK85PQDA/vQhOOOGz8sOmI7zguHtRNqx3C6gayaD/7jAtlCCtSgc09F8Xb722zWOmkk0zO4suAOZiJGDthUTX49bAjuRhWG2CwFhm11UnPked8w5k7/RYfz6CAXfwCzXjm1FM/zupEjwGAp4QUaxKkCHfYmYk7wBV5RoVoQXfbKKlvgShEZhuwhV7tGwEWE3utWoosnax0nzxN0SXb3W86urxcI/k3jTtYQ1ck7jwq8lAso72DxSznYxTwSGGwFKo318g9S8cRWwpTnuW7JGJ8dNCVkUgRkTnA X-Forefront-PRVS: 0608DEDB67 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(66066001)(47776003)(4001350100001)(53416004)(42186005)(122386002)(5001960100002)(50466002)(107886002)(110136002)(62966003)(77156002)(77096005)(2950100001)(19580395003)(83506001)(87976001)(19580405001)(86362001)(189998001)(40100003)(46102003)(33646002)(92566002)(229853001)(50986999)(23726002)(36756003)(54356999)(76176999)(2004002)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:HKNPR06MB305; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; HKNPR06MB305; 9:raIy2x98yqSW2fSdznVSWxPP/UxW2OQsrmFS8gm+R1GH8c1TwB9mnlkDQ7lL1hNOBMyFlVhltWqADBlTtiSKBpAAw2hv2j+6/X1W3kQiOGdmXOtw0nWgca2YpR0+ZxLKZxyp7ntCe2VEDmaAjCp+3Zl95Q9Vb/6E35CETvp3reYRR6Nk7Ckrvhwv0hJUTtahimfkVyqhywNS/omCLJKA8PdBH6CpclLO+Zf7By+fUKxcD6HQ+UgJSeBUEi61S2kYGE02qWju55bRubFv5hX/QxUAOhvQx9MM+c7sNtmoXlITGfzLL+RH/BQES52IUYVJWcJir7+J35t9mhZGA279sadOFmQXqL0uysdQPuPIRY4dpxRGq5FlO2om+WgkB68/oQF4aNlErHaJ1u/lARx5KcWd3Ayeo+wlyb0XrlqMvAQmh6fii3tvZbFMD12aOrM6ioiIWFIlpYl5O3vJl90Ys9y4NarW7Hcpg0T8nwwhMAwBivsjBffrj4Ze7NB2pmx5gCrRxzEht8gjP5BK8OMMzKgjosqKMu5gu0VKRq0u5VUP57NAWV0tV4WeXc4svhRj6V1YsKrQxO0hwy/wr0d4cZ3NV3IL05gC1+iJWoBkKPWhEO8g265r7Dp+BkmZ/K3/baL20rTcxHBd9v6Uc6e+92kc4nqKW8UffVfuanLSotvt5YCn3uaewmYY7n0xjpPao9DESOnP0VnCjvSKVYehp8TFouZPew/mj3RKzBypwUu/dAWGACc6gf/+PCboUE3+yVjZcvH+PMR5DXiWQ/Rde6E3UbCd5PxnETa6Mh7lUo61clYezeKs8JOlim4nPZS+39MFwsMG3dy+ukrDG83P+5ZcZ1X73t3e0bGQgwvZijZmeEESc46UzXm9UaejgRlLtGGWEPA7hwymEWU58TUH8A== X-Microsoft-Exchange-Diagnostics: 1; HKNPR06MB305; 3:/bpgylg2/xj4ggdSu7LIi2OQqyB14fYVCVFhnx7FWdFXkmkC9Kr5hHZWnH2dwf0cZeMieL7iABS/8tdGLpAaa3XCsbRmugsdpChytZHziEUk7G8dgmlFZxcW+f0icgpJxa3otIkQ4X2TynQI6DY4Rw==; 10:68X/SSjJIItZ0dcad062JwALpQqwvXkUdBT1ABnSC6nT9c/nIzhSFL6ihEtCUtvqRJH1NFnHjK07uvmkAPshMbPaJiP45byz7HHRGrmqS8E=; 6:tJr1EgMAdqMGy6zJNijPdkG5DKwnZcu3vQx6khf3nEq2HVXVMpNIoAbd3ycjuXXYsZ/o/IwNVs9q54qKGXRyIxW2CY/BOYJtEWXkGp3A+nMYW+syfCsWOA5MF/HQkKwmmfSLW4rirLPboZm1FzL0uw== X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2015 04:53:11.5593 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKNPR06MB305 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Gen3 needs to access CPG write protect register for CPG/MSTP. This patch adds common spin lock method for it. Signed-off-by: Kuninori Morimoto --- drivers/clk/shmobile/Makefile | 1 + drivers/clk/shmobile/rcar-clk.c | 30 ++++++++++++++++++++++++++++++ drivers/clk/shmobile/rcar-clk.h | 21 +++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 drivers/clk/shmobile/rcar-clk.c create mode 100644 drivers/clk/shmobile/rcar-clk.h diff --git a/drivers/clk/shmobile/Makefile b/drivers/clk/shmobile/Makefile index 97c71c8..6790268 100644 --- a/drivers/clk/shmobile/Makefile +++ b/drivers/clk/shmobile/Makefile @@ -11,3 +11,4 @@ obj-$(CONFIG_ARCH_R8A7794) += clk-rcar-gen2.o obj-$(CONFIG_ARCH_SH73A0) += clk-sh73a0.o obj-$(CONFIG_ARCH_SHMOBILE_MULTI) += clk-div6.o obj-$(CONFIG_ARCH_SHMOBILE_MULTI) += clk-mstp.o +obj-$(CONFIG_ARCH_RCAR_GEN3) += rcar-clk.o diff --git a/drivers/clk/shmobile/rcar-clk.c b/drivers/clk/shmobile/rcar-clk.c new file mode 100644 index 0000000..57943aa --- /dev/null +++ b/drivers/clk/shmobile/rcar-clk.c @@ -0,0 +1,30 @@ +/* + * rcar-clk.c + * + * Copyright (c) 2015 Kuninori Morimoto + * + * 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. + */ +#include + +static DEFINE_SPINLOCK(rcar_cpg_lock); + +/* + * R-Car Gen3 needs CPGWPCR write protection for + * CPG + * MSTP + * APMU + * these lock/unlock are for CPGWPCR + */ + +void rcar_cpgwpcr_lock(unsigned long *flags) +{ + spin_lock_irqsave(&rcar_cpg_lock, *flags); +} + +void rcar_cpgwpcr_unlock(unsigned long *flags) +{ + spin_unlock_irqrestore(&rcar_cpg_lock, *flags); +} diff --git a/drivers/clk/shmobile/rcar-clk.h b/drivers/clk/shmobile/rcar-clk.h new file mode 100644 index 0000000..12cf2f0 --- /dev/null +++ b/drivers/clk/shmobile/rcar-clk.h @@ -0,0 +1,21 @@ +/* + * rcar-clk.h + * + * Copyright (c) 2015 Kuninori Morimoto + * + * 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. + */ +#ifndef __RCAR_CLK_H +#define __RCAR_CLK_H + +#if defined(CONFIG_ARCH_RCAR_GEN3) +void rcar_cpgwpcr_lock(unsigned long *flags); +void rcar_cpgwpcr_unlock(unsigned long *flags); +#else +#define rcar_cpgwpcr_lock(flags) +#define rcar_cpgwpcr_unlock(flags) +#endif + +#endif /* __RCAR_CLK_H */