[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1557922984-20811-1-git-send-email-Anson.Huang@nxp.com>
Date: Wed, 15 May 2019 12:28:13 +0000
From: Anson Huang <anson.huang@....com>
To: "mturquette@...libre.com" <mturquette@...libre.com>,
"sboyd@...nel.org" <sboyd@...nel.org>,
"shawnguo@...nel.org" <shawnguo@...nel.org>,
"s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
"kernel@...gutronix.de" <kernel@...gutronix.de>,
"festevam@...il.com" <festevam@...il.com>,
"l.stach@...gutronix.de" <l.stach@...gutronix.de>,
Aisheng Dong <aisheng.dong@....com>,
"tiny.windzz@...il.com" <tiny.windzz@...il.com>,
"pp@...ix.com" <pp@...ix.com>,
"colin.didier@...ialet.com" <colin.didier@...ialet.com>,
"robh@...nel.org" <robh@...nel.org>,
"hofrat@...dl.org" <hofrat@...dl.org>,
Jacky Bai <ping.bai@....com>,
Leonard Crestez <leonard.crestez@....com>,
"stefan@...er.ch" <stefan@...er.ch>,
"michael@...rulasolutions.com" <michael@...rulasolutions.com>,
Abel Vesa <abel.vesa@....com>,
"linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
CC: dl-linux-imx <linux-imx@....com>
Subject: [PATCH V2 1/2] clk: imx: Add common API for masking MMDC handshake
All i.MX6 SoCs need to mask unused MMDC channel's handshake
for low power modes, this patch provides common API for masking
the MMDC channel passed from caller.
Signed-off-by: Anson Huang <Anson.Huang@....com>
Reviewed-by: Dong Aisheng <aisheng.dong@....com>
---
Changes since V1:
- add necessary "io.h" head file to avoid build error based on latest linux-next.
---
drivers/clk/imx/clk.c | 15 +++++++++++++++
drivers/clk/imx/clk.h | 1 +
2 files changed, 16 insertions(+)
diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c
index 1efed86..9cd7097 100644
--- a/drivers/clk/imx/clk.c
+++ b/drivers/clk/imx/clk.c
@@ -1,13 +1,28 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/clk.h>
#include <linux/err.h>
+#include <linux/io.h>
#include <linux/of.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include "clk.h"
+#define CCM_CCDR 0x4
+#define CCDR_MMDC_CH0_MASK BIT(17)
+#define CCDR_MMDC_CH1_MASK BIT(16)
+
DEFINE_SPINLOCK(imx_ccm_lock);
+void __init imx_mmdc_mask_handshake(void __iomem *ccm_base,
+ unsigned int chn)
+{
+ unsigned int reg;
+
+ reg = readl_relaxed(ccm_base + CCM_CCDR);
+ reg |= chn == 0 ? CCDR_MMDC_CH0_MASK : CCDR_MMDC_CH1_MASK;
+ writel_relaxed(reg, ccm_base + CCM_CCDR);
+}
+
void __init imx_check_clocks(struct clk *clks[], unsigned int count)
{
unsigned i;
diff --git a/drivers/clk/imx/clk.h b/drivers/clk/imx/clk.h
index 8639a8f..6dcdc91 100644
--- a/drivers/clk/imx/clk.h
+++ b/drivers/clk/imx/clk.h
@@ -10,6 +10,7 @@ extern spinlock_t imx_ccm_lock;
void imx_check_clocks(struct clk *clks[], unsigned int count);
void imx_check_clk_hws(struct clk_hw *clks[], unsigned int count);
void imx_register_uart_clocks(struct clk ** const clks[]);
+void imx_mmdc_mask_handshake(void __iomem *ccm_base, unsigned int chn);
extern void imx_cscmr1_fixup(u32 *val);
--
2.7.4
Powered by blists - more mailing lists