[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1415053985-10552-1-git-send-email-dinguyen@opensource.altera.com>
Date: Mon, 3 Nov 2014 16:33:05 -0600
From: <dinguyen@...nsource.altera.com>
To: <p.zabel@...gutronix.de>
CC: <dinh.linux@...il.com>, <linux-kernel@...r.kernel.org>,
Dinh Nguyen <dinguyen@...nsource.altera.com>,
Alan Tull <atull@...nsource.altera.com>
Subject: [PATCHv2] reset: add socfpga_reset_status
From: Dinh Nguyen <dinguyen@...nsource.altera.com>
Populate the reset_status callback for SOCFPGA.
Signed-off-by: Alan Tull <atull@...nsource.altera.com>
Signed-off-by: Dinh Nguyen <dinguyen@...nsource.altera.com>
---
v2: Remove spin_lock around readl
---
drivers/reset/reset-socfpga.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
index 79c32ca..39da5cb 100644
--- a/drivers/reset/reset-socfpga.c
+++ b/drivers/reset/reset-socfpga.c
@@ -76,9 +76,25 @@ static int socfpga_reset_deassert(struct reset_controller_dev *rcdev,
return 0;
}
+static int socfpga_reset_status(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+ struct socfpga_reset_data *data = container_of(rcdev,
+ struct socfpga_reset_data, rcdev);
+ int bank = id / BITS_PER_LONG;
+ int offset = id % BITS_PER_LONG;
+ unsigned long flags;
+ u32 reg;
+
+ reg = readl(data->membase + OFFSET_MODRST + (bank * NR_BANKS));
+
+ return !(reg & BIT(offset));
+}
+
static struct reset_control_ops socfpga_reset_ops = {
.assert = socfpga_reset_assert,
.deassert = socfpga_reset_deassert,
+ .status = socfpga_reset_status,
};
static int socfpga_reset_probe(struct platform_device *pdev)
--
2.0.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists