Thomas Chou | 92efb27 | 2010-03-31 08:36:24 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Altera CF drvier |
| 3 | * |
| 4 | * (C) Copyright 2010, Thomas Chou <thomas@wytron.com.tw> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | #include <common.h> |
| 11 | #include <asm/io.h> |
| 12 | |
| 13 | #if defined(CONFIG_IDE_RESET) && defined(CONFIG_SYS_CF_CTL_BASE) |
| 14 | /* ide_set_reset for Altera CF interface */ |
| 15 | #define ALTERA_CF_CTL_STATUS 0 |
| 16 | #define ALTERA_CF_IDE_CTL 4 |
| 17 | #define ALTERA_CF_CTL_STATUS_PRESENT_MSK (0x1) |
| 18 | #define ALTERA_CF_CTL_STATUS_POWER_MSK (0x2) |
| 19 | #define ALTERA_CF_CTL_STATUS_RESET_MSK (0x4) |
| 20 | #define ALTERA_CF_CTL_STATUS_IRQ_EN_MSK (0x8) |
| 21 | #define ALTERA_CF_IDE_CTL_IRQ_EN_MSK (0x1) |
| 22 | |
| 23 | void ide_set_reset(int idereset) |
| 24 | { |
| 25 | int i; |
| 26 | writel(idereset ? ALTERA_CF_CTL_STATUS_RESET_MSK : |
| 27 | ALTERA_CF_CTL_STATUS_POWER_MSK, |
| 28 | CONFIG_SYS_CF_CTL_BASE + ALTERA_CF_CTL_STATUS); |
| 29 | /* wait 500 ms for power to stabilize */ |
| 30 | for (i = 0; i < 500; i++) |
| 31 | udelay(1000); |
| 32 | } |
| 33 | #endif |