Skip to contentSkip to conversation

reset: add socfpga_reset_status

PATCH In review [email protected] 2 participants 2 messages Nov 3, 2014 – Nov 4, 2014 Reset controller framework

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 reset: add socfpga_reset_status

From: Dinh Nguyen <[email protected]>

Populate the reset_status callback for SOCFPGA.

---
v2: Remove spin_lock around readl

---
 drivers/reset/reset-socfpga.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/reset/reset-socfpga.c +16 -0
index 79c32ca..39da5cb 100644
@@ -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)
Signature · 1 line
2.0.3
maintainer
#1 lore raw

Hi Dinh,

Am Montag, den 03.11.2014, 16:33 -0600 schrieb
[email protected]:

Quoted 18 lines

From: Dinh Nguyen <[email protected]>

Populate the reset_status callback for SOCFPGA.

---
v2: Remove spin_lock around readl

---
 drivers/reset/reset-socfpga.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/reset/reset-socfpga.c +0 -0
index 79c32ca..39da5cb 100644
@@ -76,9 +76,25 @@ static int socfpga_reset_deassert(struct reset_controller_dev *rcdev,
 	return 0;

drivers/reset/reset-socfpga.c static int socfpga_reset_deassert(struct reset_controller_dev *rcdev, · line 86

Quoted 10 lines
drivers/reset/reset-socfpga.c +8 -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;

Now the flags variable is unused.
I'll fix it up and apply it, no need to resend.

Quoted 4 lines
drivers/reset/reset-socfpga.c +4 -0
+	u32 reg;
+
+	reg = readl(data->membase + OFFSET_MODRST + (bank * NR_BANKS));
+

drivers/reset/reset-socfpga.c static int socfpga_reset_deassert(struct reset_controller_dev *rcdev, · line 100

Quoted 10 lines
drivers/reset/reset-socfpga.c +4 -0
+	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)

thanks
Philipp