From: Phil Reid <preid@electromag.com.au>
To: nsekhar@ti.com, khilman@kernel.org, wsa@the-dreams.de,
jarkko.nikula@linux.intel.com, andriy.shevchenko@linux.intel.com,
mika.westerberg@linux.intel.com, preid@electromag.com.au,
linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org,
fntoth@gmail.com
Subject: [PATCH v4 2/7] i2c: designware: move i2c_dw_plat_prepare_clk to common
Date: Tue, 31 Oct 2017 15:33:54 +0800 [thread overview]
Message-ID: <1509435239-64848-3-git-send-email-preid@electromag.com.au> (raw)
In-Reply-To: <1509435239-64848-1-git-send-email-preid@electromag.com.au>
Move the i2c_dw_plat_prepare_clk funciton to common file in preparation
for its use also by the master driver.
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Phil Reid <preid@electromag.com.au>
---
drivers/i2c/busses/i2c-designware-common.c | 13 +++++++++++++
drivers/i2c/busses/i2c-designware-core.h | 1 +
drivers/i2c/busses/i2c-designware-platdrv.c | 12 ------------
3 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c
index d1a6937..b79f342 100644
--- a/drivers/i2c/busses/i2c-designware-common.c
+++ b/drivers/i2c/busses/i2c-designware-common.c
@@ -21,6 +21,7 @@
* ----------------------------------------------------------------------------
*
*/
+#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/export.h>
#include <linux/errno.h>
@@ -185,6 +186,18 @@ unsigned long i2c_dw_clk_rate(struct dw_i2c_dev *dev)
return dev->get_clk_rate_khz(dev);
}
+int i2c_dw_plat_prepare_clk(struct dw_i2c_dev *i_dev, bool prepare)
+{
+ if (IS_ERR(i_dev->clk))
+ return PTR_ERR(i_dev->clk);
+
+ if (prepare)
+ return clk_prepare_enable(i_dev->clk);
+
+ clk_disable_unprepare(i_dev->clk);
+ return 0;
+}
+
int i2c_dw_acquire_lock(struct dw_i2c_dev *dev)
{
int ret;
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index 21bf619..e80a14c 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -301,6 +301,7 @@ struct dw_i2c_dev {
void __i2c_dw_enable(struct dw_i2c_dev *dev, bool enable);
void __i2c_dw_enable_and_wait(struct dw_i2c_dev *dev, bool enable);
unsigned long i2c_dw_clk_rate(struct dw_i2c_dev *dev);
+int i2c_dw_plat_prepare_clk(struct dw_i2c_dev *i_dev, bool prepare);
int i2c_dw_acquire_lock(struct dw_i2c_dev *dev);
void i2c_dw_release_lock(struct dw_i2c_dev *dev);
int i2c_dw_wait_bus_not_busy(struct dw_i2c_dev *dev);
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 58add69..a5fd0ee 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -214,18 +214,6 @@ static void i2c_dw_configure_slave(struct dw_i2c_dev *dev)
}
}
-static int i2c_dw_plat_prepare_clk(struct dw_i2c_dev *i_dev, bool prepare)
-{
- if (IS_ERR(i_dev->clk))
- return PTR_ERR(i_dev->clk);
-
- if (prepare)
- return clk_prepare_enable(i_dev->clk);
-
- clk_disable_unprepare(i_dev->clk);
- return 0;
-}
-
static void dw_i2c_set_fifo_size(struct dw_i2c_dev *dev, int id)
{
u32 param, tx_fifo_depth, rx_fifo_depth;
--
1.8.3.1
next prev parent reply other threads:[~2017-10-31 7:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 7:33 [PATCH v4 0/7] i2c: designware: add i2c gpio recovery option Phil Reid
2017-10-31 7:33 ` [PATCH v4 1/7] i2c: Switch to using gpiod interface for gpio bus recovery Phil Reid
2017-11-01 16:23 ` Jarkko Nikula
2017-10-31 7:33 ` Phil Reid [this message]
2017-10-31 7:33 ` [PATCH v4 3/7] i2c: designware: rename i2c_dw_plat_prepare_clk to i2c_dw_prepare_clk Phil Reid
2017-10-31 10:10 ` Andy Shevchenko
2017-10-31 7:33 ` [PATCH v4 4/7] i2c: designware: add i2c gpio recovery option Phil Reid
2017-11-01 16:22 ` Jarkko Nikula
2017-10-31 7:33 ` [PATCH v4 5/7] i2c: imx: switch to using gpiod for bus recovery gpios Phil Reid
2017-10-31 7:33 ` [PATCH v4 6/7] i2c: davinci: " Phil Reid
2017-10-31 7:33 ` [PATCH v4 7/7] i2c: remove legacy integer scl/sda gpio for recovery Phil Reid
2017-10-31 10:19 ` Andy Shevchenko
2017-10-31 10:17 ` [PATCH v4 0/7] i2c: designware: add i2c gpio recovery option Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1509435239-64848-3-git-send-email-preid@electromag.com.au \
--to=preid@electromag.com.au \
--cc=andriy.shevchenko@linux.intel.com \
--cc=fntoth@gmail.com \
--cc=jarkko.nikula@linux.intel.com \
--cc=khilman@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=nsekhar@ti.com \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).