Commit c0df5bf5 authored by Stephen Warren's avatar Stephen Warren

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: default avatarStephen Warren <swarren@nvidia.com>
Acked-by: default avatarMarc Dietrich <marvin24@gmx.de>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarThierry Reding <treding@nvidia.com>
parent dda9d6a8
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/clk/tegra.h>
#include "nvec.h" #include "nvec.h"
...@@ -734,9 +733,9 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec) ...@@ -734,9 +733,9 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec)
clk_prepare_enable(nvec->i2c_clk); clk_prepare_enable(nvec->i2c_clk);
tegra_periph_reset_assert(nvec->i2c_clk); reset_control_assert(nvec->rst);
udelay(2); udelay(2);
tegra_periph_reset_deassert(nvec->i2c_clk); reset_control_deassert(nvec->rst);
val = I2C_CNFG_NEW_MASTER_SFM | I2C_CNFG_PACKET_MODE_EN | val = I2C_CNFG_NEW_MASTER_SFM | I2C_CNFG_PACKET_MODE_EN |
(0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT); (0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT);
...@@ -837,6 +836,12 @@ static int tegra_nvec_probe(struct platform_device *pdev) ...@@ -837,6 +836,12 @@ static int tegra_nvec_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
nvec->rst = devm_reset_control_get(&pdev->dev, "i2c");
if (IS_ERR(nvec->rst)) {
dev_err(nvec->dev, "failed to get controller reset\n");
return PTR_ERR(nvec->rst);
}
nvec->base = base; nvec->base = base;
nvec->irq = res->start; nvec->irq = res->start;
nvec->i2c_clk = i2c_clk; nvec->i2c_clk = i2c_clk;
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/reset.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
...@@ -109,7 +110,8 @@ struct nvec_msg { ...@@ -109,7 +110,8 @@ struct nvec_msg {
* @irq: The IRQ of the I2C device * @irq: The IRQ of the I2C device
* @i2c_addr: The address of the I2C slave * @i2c_addr: The address of the I2C slave
* @base: The base of the memory mapped region of the I2C device * @base: The base of the memory mapped region of the I2C device
* @clk: The clock of the I2C device * @i2c_clk: The clock of the I2C device
* @rst: The reset of the I2C device
* @notifier_list: Notifiers to be called on received messages, see * @notifier_list: Notifiers to be called on received messages, see
* nvec_register_notifier() * nvec_register_notifier()
* @rx_data: Received messages that have to be processed * @rx_data: Received messages that have to be processed
...@@ -139,6 +141,7 @@ struct nvec_chip { ...@@ -139,6 +141,7 @@ struct nvec_chip {
int i2c_addr; int i2c_addr;
void __iomem *base; void __iomem *base;
struct clk *i2c_clk; struct clk *i2c_clk;
struct reset_control *rst;
struct atomic_notifier_head notifier_list; struct atomic_notifier_head notifier_list;
struct list_head rx_data, tx_data; struct list_head rx_data, tx_data;
struct notifier_block nvec_status_notifier; struct notifier_block nvec_status_notifier;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment