diff options
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c')
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c b/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c new file mode 100644 index 0000000000..ad053c7deb --- /dev/null +++ b/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c | |||
@@ -0,0 +1,68 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Maurus Cuelenaere | ||
11 | * | ||
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. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | #include "config.h" | ||
23 | #include "jz4740.h" | ||
24 | #include "ata.h" | ||
25 | |||
26 | #define NAND_CMD_READ1_00 0x00 | ||
27 | #define NAND_CMD_READ1_01 0x01 | ||
28 | #define NAND_CMD_READ2 0x50 | ||
29 | #define NAND_CMD_READ_ID1 0x90 | ||
30 | #define NAND_CMD_READ_ID2 0x91 | ||
31 | #define NAND_CMD_RESET 0xFF | ||
32 | #define NAND_CMD_PAGE_PROGRAM_START 0x80 | ||
33 | #define NAND_CMD_PAGE_PROGRAM_STOP 0x10 | ||
34 | #define NAND_CMD_BLOCK_ERASE_START 0x60 | ||
35 | #define NAND_CMD_BLOCK_ERASE_CONFIRM 0xD0 | ||
36 | #define NAND_CMD_READ_STATUS 0x70 | ||
37 | |||
38 | #define NANDFLASH_CLE 0x00008000 //PA[15] | ||
39 | #define NANDFLASH_ALE 0x00010000 //PA[16] | ||
40 | |||
41 | #define NANDFLASH_BASE 0xB8000000 | ||
42 | #define REG_NAND_DATA (*((volatile unsigned char *) NANDFLASH_BASE)) | ||
43 | #define REG_NAND_CMD (*((volatile unsigned char *) (NANDFLASH_BASE + NANDFLASH_CLE))) | ||
44 | #define REG_NAND_ADDR (*((volatile unsigned char *) (NANDFLASH_BASE + NANDFLASH_ALE))) | ||
45 | |||
46 | #define JZ_NAND_SET_CLE (NANDFLASH_BASE |= NANDFLASH_CLE) | ||
47 | #define JZ_NAND_CLR_CLE (NANDFLASH_BASE &= ~NANDFLASH_CLE) | ||
48 | #define JZ_NAND_SET_ALE (NANDFLASH_BASE |= NANDFLASH_ALE) | ||
49 | #define JZ_NAND_CLR_ALE (NANDFLASH_BASE &= ~NANDFLASH_ALE) | ||
50 | |||
51 | #define JZ_NAND_SELECT (REG_EMC_NFCSR |= EMC_NFCSR_NFCE1 ) | ||
52 | #define JZ_NAND_DESELECT (REG_EMC_NFCSR &= ~(EMC_NFCSR_NFCE1)) | ||
53 | |||
54 | int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf) | ||
55 | { | ||
56 | (void)start; | ||
57 | (void)count; | ||
58 | (void)buf; | ||
59 | return 0; | ||
60 | } | ||
61 | |||
62 | int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf) | ||
63 | { | ||
64 | (void)start; | ||
65 | (void)count; | ||
66 | (void)buf; | ||
67 | return 0; | ||
68 | } | ||