public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] nios2: add altera cf reset
@ 2010-03-28 12:58 Thomas Chou
  2010-03-28 13:11 ` [U-Boot] [PATCH v2] " Thomas Chou
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Thomas Chou @ 2010-03-28 12:58 UTC (permalink / raw)
  To: u-boot

This patch toggles power to reset the cf card.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
---
 board/altera/common/cfide.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
 create mode 100644 board/altera/common/cfide.c

diff --git a/board/altera/common/cfide.c b/board/altera/common/cfide.c
new file mode 100644
index 0000000..665c85d
--- /dev/null
+++ b/board/altera/common/cfide.c
@@ -0,0 +1,34 @@
+/*
+ * Altera CF drvier
+ *
+ * (C) Copyright 2010, Thomas Chou <thomas@wytron.com.tw>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <common.h>
+#include <asm/io.h>
+
+#if defined(CONFIG_IDE_RESET) && defined(CONFIG_SYS_CF_CTL_BASE)
+/* ide_set_reset for Altera CF interface */
+#define ALTERA_CF_CTL_STATUS			0
+#define ALTERA_CF_IDE_CTL			4
+#define ALTERA_CF_CTL_STATUS_PRESENT_MSK	(0x1)
+#define ALTERA_CF_CTL_STATUS_POWER_MSK		(0x2)
+#define ALTERA_CF_CTL_STATUS_RESET_MSK		(0x4)
+#define ALTERA_CF_CTL_STATUS_IRQ_EN_MSK	(0x8)
+#define ALTERA_CF_IDE_CTL_IRQ_EN_MSK		(0x1)
+
+void ide_set_reset(int idereset)
+{
+	if (idereset) {
+		writel(ALTERA_CF_CTL_STATUS_RESET_MSK,	/* power down */
+		       CONFIG_SYS_CF_CTL_BASE + ALTERA_CF_CTL_STATUS);
+		udelay(500 * 1000);	/* 0.5 sec delay */
+		writel(ALTERA_CF_CTL_STATUS_POWER_MSK,	/* power up */
+		       CONFIG_SYS_CF_CTL_BASE + ALTERA_CF_CTL_STATUS);
+		udelay(500 * 1000);	/* 0.5 sec delay */
+	}
+}
+#endif
-- 
1.6.6.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-04-23  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-28 12:58 [U-Boot] [PATCH] nios2: add altera cf reset Thomas Chou
2010-03-28 13:11 ` [U-Boot] [PATCH v2] " Thomas Chou
2010-03-28 13:27 ` [U-Boot] [PATCH v3] " Thomas Chou
2010-03-28 16:06   ` Scott McNutt
2010-03-28 17:31   ` Wolfgang Denk
2010-03-29  0:40 ` [U-Boot] [PATCH v4] " Thomas Chou
2010-03-31  0:36 ` [U-Boot] [PATCH v5] " Thomas Chou
2010-04-23  0:00   ` Scott McNutt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox