summaryrefslogtreecommitdiff
path: root/board/altera/common/cfide.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2010-04-27 22:53:04 +0200
committerWolfgang Denk <wd@denx.de>2010-04-27 22:53:04 +0200
commitc88d6ab19ffab06f372b15c290bdf5d6f1ebfe9a (patch)
tree020001798e0f799032c68942bc7d0b13a65041ca /board/altera/common/cfide.c
parentfbb0030e3894119c089256f16626edd166c7629c (diff)
parent8cbb0ddd7e696c6a4be1ae3ab3c95d3c8f6a7031 (diff)
Merge branch 'next' of git://git.denx.de/u-boot-nios
Diffstat (limited to 'board/altera/common/cfide.c')
-rw-r--r--board/altera/common/cfide.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/board/altera/common/cfide.c b/board/altera/common/cfide.c
new file mode 100644
index 0000000000..40d6a12b55
--- /dev/null
+++ b/board/altera/common/cfide.c
@@ -0,0 +1,33 @@
+/*
+ * 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)
+{
+ int i;
+ writel(idereset ? ALTERA_CF_CTL_STATUS_RESET_MSK :
+ ALTERA_CF_CTL_STATUS_POWER_MSK,
+ CONFIG_SYS_CF_CTL_BASE + ALTERA_CF_CTL_STATUS);
+ /* wait 500 ms for power to stabilize */
+ for (i = 0; i < 500; i++)
+ udelay(1000);
+}
+#endif