aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2013-11-06 18:46:24 -0500
committerStephen Warren <swarren@nvidia.com>2013-12-11 18:44:10 -0500
commitc0df5bf5369ec5d12d781491c95e3207ec5ee2b7 (patch)
treee44a003bd6dffe17b4f42d6b611f9871f13cdac9
parentdda9d6a8262cb1fa63eb815dc0de2a984389c71b (diff)
staging: nvec: use reset framework
Tegra's clock driver now provides an implementation of the common reset API (include/linux/reset.h). Use this instead of the old Tegra- specific API; that will soon be removed. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Marc Dietrich <marvin24@gmx.de> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--drivers/staging/nvec/nvec.c11
-rw-r--r--drivers/staging/nvec/nvec.h5
2 files changed, 12 insertions, 4 deletions
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 49ea76b3435d..986870593b0c 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -36,7 +36,6 @@
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/spinlock.h> 37#include <linux/spinlock.h>
38#include <linux/workqueue.h> 38#include <linux/workqueue.h>
39#include <linux/clk/tegra.h>
40 39
41#include "nvec.h" 40#include "nvec.h"
42 41
@@ -734,9 +733,9 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec)
734 733
735 clk_prepare_enable(nvec->i2c_clk); 734 clk_prepare_enable(nvec->i2c_clk);
736 735
737 tegra_periph_reset_assert(nvec->i2c_clk); 736 reset_control_assert(nvec->rst);
738 udelay(2); 737 udelay(2);
739 tegra_periph_reset_deassert(nvec->i2c_clk); 738 reset_control_deassert(nvec->rst);
740 739
741 val = I2C_CNFG_NEW_MASTER_SFM | I2C_CNFG_PACKET_MODE_EN | 740 val = I2C_CNFG_NEW_MASTER_SFM | I2C_CNFG_PACKET_MODE_EN |
742 (0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT); 741 (0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT);
@@ -837,6 +836,12 @@ static int tegra_nvec_probe(struct platform_device *pdev)
837 return -ENODEV; 836 return -ENODEV;
838 } 837 }
839 838
839 nvec->rst = devm_reset_control_get(&pdev->dev, "i2c");
840 if (IS_ERR(nvec->rst)) {
841 dev_err(nvec->dev, "failed to get controller reset\n");
842 return PTR_ERR(nvec->rst);
843 }
844
840 nvec->base = base; 845 nvec->base = base;
841 nvec->irq = res->start; 846 nvec->irq = res->start;
842 nvec->i2c_clk = i2c_clk; 847 nvec->i2c_clk = i2c_clk;
diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h
index e880518935fb..e271375053fa 100644
--- a/drivers/staging/nvec/nvec.h
+++ b/drivers/staging/nvec/nvec.h
@@ -23,6 +23,7 @@
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/mutex.h> 24#include <linux/mutex.h>
25#include <linux/notifier.h> 25#include <linux/notifier.h>
26#include <linux/reset.h>
26#include <linux/spinlock.h> 27#include <linux/spinlock.h>
27#include <linux/workqueue.h> 28#include <linux/workqueue.h>
28 29
@@ -109,7 +110,8 @@ struct nvec_msg {
109 * @irq: The IRQ of the I2C device 110 * @irq: The IRQ of the I2C device
110 * @i2c_addr: The address of the I2C slave 111 * @i2c_addr: The address of the I2C slave
111 * @base: The base of the memory mapped region of the I2C device 112 * @base: The base of the memory mapped region of the I2C device
112 * @clk: The clock of the I2C device 113 * @i2c_clk: The clock of the I2C device
114 * @rst: The reset of the I2C device
113 * @notifier_list: Notifiers to be called on received messages, see 115 * @notifier_list: Notifiers to be called on received messages, see
114 * nvec_register_notifier() 116 * nvec_register_notifier()
115 * @rx_data: Received messages that have to be processed 117 * @rx_data: Received messages that have to be processed
@@ -139,6 +141,7 @@ struct nvec_chip {
139 int i2c_addr; 141 int i2c_addr;
140 void __iomem *base; 142 void __iomem *base;
141 struct clk *i2c_clk; 143 struct clk *i2c_clk;
144 struct reset_control *rst;
142 struct atomic_notifier_head notifier_list; 145 struct atomic_notifier_head notifier_list;
143 struct list_head rx_data, tx_data; 146 struct list_head rx_data, tx_data;
144 struct notifier_block nvec_status_notifier; 147 struct notifier_block nvec_status_notifier;