summaryrefslogtreecommitdiff
path: root/firmware/drivers/nand_id.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2018-06-28 06:24:26 -0400
committerMichael Giacomelli <giac2000@hotmail.com>2018-07-28 10:56:31 -0400
commit0662793ca0050e823cd1207cc4689a1cba5068bd (patch)
tree08cd2ec59c9044c96b697b5bf8d0640841d044e0 /firmware/drivers/nand_id.c
parentb3e2bd619b1b7ea94ef29d32db48e80b347a1990 (diff)
downloadrockbox-0662793ca0050e823cd1207cc4689a1cba5068bd.tar.gz
rockbox-0662793ca0050e823cd1207cc4689a1cba5068bd.zip
Add cleaned-up xDuoo X3 support
Cleaned up, rebased, and forward-ported from the xvortex fork. (original credit to vsoftster@gmail.com) Change-Id: Ibcc023a0271ea81e901450a88317708c2683236d Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
Diffstat (limited to 'firmware/drivers/nand_id.c')
-rw-r--r--firmware/drivers/nand_id.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/firmware/drivers/nand_id.c b/firmware/drivers/nand_id.c
index f2b9861c7c..56132ab090 100644
--- a/firmware/drivers/nand_id.c
+++ b/firmware/drivers/nand_id.c
@@ -34,27 +34,38 @@ static const struct nand_info samsung[] =
34/* 34/*
35 id1, id2 35 id1, id2
36 pages/block, blocks, page_size, spare_size, col_cycles, row_cycles, planes 36 pages/block, blocks, page_size, spare_size, col_cycles, row_cycles, planes
37*/ 37*/
38 {0xDC, 0x10, /* K9F4G08UOM */ 38 {0xDC, 0x10, /* K9F4G08UOM */
39 64, 4096, 2048, 64, 2, 3, 1 }, 39 64, 4096, 2048, 64, 2, 3, 1 },
40 40
41 {0xD3, 0x51, /* K9K8G08UOM */ 41 {0xD3, 0x51, /* K9K8G08UOM */
42 64, 8192, 2048, 64, 2, 3, 1 }, 42 64, 8192, 2048, 64, 2, 3, 1 },
43 43
44 {0xD5, 0x14, /* K9GAG08UOM */ 44 {0xD5, 0x14, /* K9GAG08UOM */
45 128, 4096, 4096, 128, 2, 3, 2 }, 45 128, 4096, 4096, 128, 2, 3, 2 },
46 46
47 {0xD5, 0x55, /* K9LAG08UOM, K9HBG08U1M, K9MCG08U5M */ 47 {0xD5, 0x55, /* K9LAG08UOM, K9HBG08U1M, K9MCG08U5M */
48 128, 8192, 2048, 64, 2, 3, 4 }, 48 128, 8192, 2048, 64, 2, 3, 4 },
49 49
50 {0xD7, 0x55, /* K9LBG08UOM */ 50 {0xD7, 0x55, /* K9LBG08UOM */
51 128, 8192, 4096, 128, 2, 3, 4 }, 51 128, 8192, 4096, 128, 2, 3, 4 },
52}; 52};
53 53
54static const struct nand_info gigadevice[] =
55{
56/*
57 id1, id2
58 pages/block, blocks, page_size, spare_size, col_cycles, row_cycles, planes
59*/
60 {0xB1, 0x80, /* MD5N01G51MSD1B */
61 64, 1024, 2048, 64, 2, 2, 1 },
62};
63
54#define NI(id, x) {id, (struct nand_info*)x, (sizeof(x)/sizeof(struct nand_info))} 64#define NI(id, x) {id, (struct nand_info*)x, (sizeof(x)/sizeof(struct nand_info))}
55static const struct nand_manufacturer all[] = 65static const struct nand_manufacturer all[] =
56{ 66{
57 NI(0xEC, samsung), 67 NI(0xEC, samsung),
68 NI(0x98, gigadevice),
58}; 69};
59 70
60// ----------------------------------------------------------------------------- 71// -----------------------------------------------------------------------------
@@ -63,7 +74,7 @@ struct nand_info* nand_identify(unsigned char data[5])
63 { 74 {
64 unsigned int i; 75 unsigned int i;
65 int found = -1; 76 int found = -1;
66 77
67 for(i = 0; i < (sizeof(all)/sizeof(struct nand_manufacturer)); i++) 78 for(i = 0; i < (sizeof(all)/sizeof(struct nand_manufacturer)); i++)
68 { 79 {
69 if(data[0] == all[i].id) 80 if(data[0] == all[i].id)
@@ -72,16 +83,16 @@ struct nand_info* nand_identify(unsigned char data[5])
72 break; 83 break;
73 } 84 }
74 } 85 }
75 86
76 if(found < 0) 87 if(found < 0)
77 return NULL; 88 return NULL;
78 89
79 for(i = 0; i < all[found].total; i++) 90 for(i = 0; i < all[found].total; i++)
80 { 91 {
81 if(data[1] == all[found].info[i].dev_id && 92 if(data[1] == all[found].info[i].dev_id &&
82 data[2] == all[found].info[i].dev_id2) 93 data[2] == all[found].info[i].dev_id2)
83 return &all[found].info[i]; 94 return &all[found].info[i];
84 } 95 }
85 96
86 return NULL; 97 return NULL;
87} 98}