Skip to content

Commit c0df5bf

Browse files
author
Stephen Warren
committed
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>
1 parent dda9d6a commit c0df5bf

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎drivers/staging/nvec/nvec.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include <linux/slab.h>
3737
#include <linux/spinlock.h>
3838
#include <linux/workqueue.h>
39-
#include <linux/clk/tegra.h>
4039

4140
#include "nvec.h"
4241

@@ -734,9 +733,9 @@ static void tegra_init_i2c_slave(struct nvec_chip *nvec)
734733

735734
clk_prepare_enable(nvec->i2c_clk);
736735

737-
tegra_periph_reset_assert(nvec->i2c_clk);
736+
reset_control_assert(nvec->rst);
738737
udelay(2);
739-
tegra_periph_reset_deassert(nvec->i2c_clk);
738+
reset_control_deassert(nvec->rst);
740739

741740
val = I2C_CNFG_NEW_MASTER_SFM | I2C_CNFG_PACKET_MODE_EN |
742741
(0x2 << I2C_CNFG_DEBOUNCE_CNT_SHIFT);
@@ -837,6 +836,12 @@ static int tegra_nvec_probe(struct platform_device *pdev)
837836
return -ENODEV;
838837
}
839838

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+
840845
nvec->base = base;
841846
nvec->irq = res->start;
842847
nvec->i2c_clk = i2c_clk;

‎drivers/staging/nvec/nvec.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/list.h>
2424
#include <linux/mutex.h>
2525
#include <linux/notifier.h>
26+
#include <linux/reset.h>
2627
#include <linux/spinlock.h>
2728
#include <linux/workqueue.h>
2829

@@ -109,7 +110,8 @@ struct nvec_msg {
109110
* @irq: The IRQ of the I2C device
110111
* @i2c_addr: The address of the I2C slave
111112
* @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
113115
* @notifier_list: Notifiers to be called on received messages, see
114116
* nvec_register_notifier()
115117
* @rx_data: Received messages that have to be processed
@@ -139,6 +141,7 @@ struct nvec_chip {
139141
int i2c_addr;
140142
void __iomem *base;
141143
struct clk *i2c_clk;
144+
struct reset_control *rst;
142145
struct atomic_notifier_head notifier_list;
143146
struct list_head rx_data, tx_data;
144147
struct notifier_block nvec_status_notifier;

0 commit comments

Comments
 (0)