Of course there's no mdelay on c200(v1), so just use udelay
[kugel-rb.git] / firmware / target / arm / s5l8700 / ata-nand-s5l8700.c
blobad87d9ea73d9a5d5ecc7790666d9da8726be4d91
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 Dave Chapman
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #include "config.h"
22 #include "ata_idle_notify.h"
23 #include "system.h"
24 #include <string.h>
25 #include "thread.h"
26 #include "disk.h"
27 #include "storage.h"
28 #include "panic.h"
29 #include "usb.h"
30 #include "ftl-target.h"
31 #include "nand-target.h"
33 /** static, private data **/
34 static bool initialized = false;
36 /* API Functions */
37 int nand_read_sectors(IF_MD2(int drive,) unsigned long start, int incount,
38 void* inbuf)
40 return ftl_read(start, incount, inbuf);
43 int nand_write_sectors(IF_MD2(int drive,) unsigned long start, int count,
44 const void* outbuf)
46 return ftl_write(start, count, outbuf);
49 void nand_spindown(int seconds)
51 (void)seconds;
54 void nand_sleep(void)
56 nand_power_down();
59 void nand_sleepnow(void)
61 nand_power_down();
64 void nand_spin(void)
66 nand_set_active();
69 void nand_enable(bool on)
71 (void)on;
74 void nand_get_info(IF_MD2(int drive,) struct storage_info *info)
76 uint32_t ppb = ftl_banks * (*ftl_nand_type).pagesperblock;
77 (*info).sector_size = SECTOR_SIZE;
78 (*info).num_sectors = (*ftl_nand_type).userblocks * ppb;
79 (*info).vendor = "Apple";
80 (*info).product = "iPod Nano 2G";
81 (*info).revision = "1.0";
84 long nand_last_disk_activity(void)
86 return nand_last_activity();
89 #ifdef HAVE_STORAGE_FLUSH
90 int nand_flush(void)
92 int rc = ftl_sync();
93 if (rc != 0) panicf("Failed to unmount flash: %X", rc);
94 return rc;
96 #endif
98 int nand_init(void)
100 if (ftl_init()) return 1;
102 initialized = true;
103 return 0;
106 #ifdef CONFIG_STORAGE_MULTI
107 int nand_num_drives(int first_drive)
109 /* We don't care which logical drive number(s) we have been assigned */
110 (void)first_drive;
112 return 1;
114 #endif