Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.

My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
ndex: firmware/target/arm/as3525/debug-as3525.c
===================================================================
--- firmware/target/arm/as3525/debug-as3525.c	(revision 21977)
+++ firmware/target/arm/as3525/debug-as3525.c	(working copy)
@@ -181,20 +181,20 @@
             }
         case CLK_DBOP:
             return calc_freq(CLK_PCLK)/((CGU_DBOP & 7)+1);
-        case CLK_SD_IDENT_NAND:
+        case CLK_SD_IDENT_NAND:        /* sd_idents assume MCLK = IDECLK   */
             if(!(MCI_NAND & (1<<8)))
                 return 0;
             else if(MCI_NAND & (1<<10))
-                return calc_freq(CLK_PCLK);
+                return calc_freq(CLK_IDE);
             else
-                return calc_freq(CLK_PCLK)/(((MCI_NAND & 0xff)*2)+1);
+                return calc_freq(CLK_IDE)/(((MCI_NAND & 0xff)*2)+1);
         case CLK_SD_IDENT_MSD:
             if(!(MCI_SD & (1<<8)))
                 return 0;
             else if(MCI_SD & (1<<10))
-                return calc_freq(CLK_PCLK);
+                return calc_freq(CLK_IDE);
             else
-            return calc_freq(CLK_PCLK)/(((MCI_SD & 0xff)*2)+1);
+            return calc_freq(CLK_IDE)/(((MCI_SD & 0xff)*2)+1);
         case CLK_USB:
             switch(CGU_USB & 3) {     /* 0-> div=1  other->div=1/(2*n)  */
                 case 0:
Index: firmware/target/arm/as3525/clock-target.h
===================================================================
--- firmware/target/arm/as3525/clock-target.h	(revision 21977)
+++ firmware/target/arm/as3525/clock-target.h	(working copy)
@@ -113,7 +113,7 @@
   #define AS3525_DBOP_DIV        (CLK_DIV(AS3525_PCLK_FREQ, AS3525_DBOP_FREQ) - 1) /*div=1/(n+1)*/
   #define AS3525_I2C_PRESCALER   CLK_DIV(AS3525_PCLK_FREQ, AS3525_I2C_FREQ)
   #define AS3525_I2C_FREQ        400000
-  #define AS3525_SD_IDENT_DIV    ((CLK_DIV(AS3525_PCLK_FREQ, AS3525_SD_IDENT_FREQ) / 2) - 1)
+  #define AS3525_SD_IDENT_DIV    ((CLK_DIV(AS3525_IDE_FREQ, AS3525_SD_IDENT_FREQ) / 2) - 1)  /* assumes MCLK = IDECLK */
   #define AS3525_SD_IDENT_FREQ   400000      /* must be between 100 & 400 kHz */

 #define AS3525_IDE_SEL           AS3525_CLK_PLLA           /* Input Source   */
Index: firmware/target/arm/as3525/ata_sd_as3525.c
===================================================================
--- firmware/target/arm/as3525/ata_sd_as3525.c	(revision 21977)
+++ firmware/target/arm/as3525/ata_sd_as3525.c	(working copy)
@@ -104,8 +104,9 @@
 static tCardInfo card_info[NUM_DRIVES];

 /* maximum timeouts recommanded in the SD Specification v2.00 */
-#define SD_MAX_READ_TIMEOUT     ((AS3525_PCLK_FREQ) / 1000 * 100) /* 100 ms */
-#define SD_MAX_WRITE_TIMEOUT    ((AS3525_PCLK_FREQ) / 1000 * 250) /* 250 ms */
+  /*  Assume MCLK = IDECLK  */
+#define SD_MAX_READ_TIMEOUT     ((AS3525_IDE_FREQ) / 1000 * 100) /* 100 ms */
+#define SD_MAX_WRITE_TIMEOUT    ((AS3525_IDE_FREQ) / 1000 * 250) /* 250 ms */

 /* for compatibility */
 static long last_disk_activity = -1;