rockbox/firmware/target/arm
Cástor Muñoz 52a6db3a36 iPod Classic: optimize UDMA timming for ATA drives
This patch optimizes UDMA timings to increase write transfer rate on
ATA bus, these transfers are clocked by HCLK, tDVS+tDVH is modified to
decrease Tcyctyp (typical write cycle period). This is not overclocking,
we meet the ATA standar, the settings used by OF are not well optimized
for each UDMA mode, we will never know but probably this was due some
documentation issue.

ATA_UDMA_TIME register is documented on s3c6400 datasheet, information
included in s5l8700 datasheet is wrong or not valid for s5l8702.

From ATA specs, (Minimum, Maximum) values in nanoseconds:

             UDMA 0      UDMA 1      UDMA 2      UDMA 3      UDMA 4
 tACKENV     (20, 70)    (20, 70)    (20, 70)    (20, 55)    (20, 55)
 tRP         (160, --)   (125, --)   (100, --)   (100, --)   (100, --)
 tSS         (50, --)    (50, --)    (50, --)    (50, --)    (50, --)
 tDVS        (70, --)    (48, --)    (31, --)    (20, --)    (6.7, --)
 tDVH        (6.2, --)   (6.2, --)   (6.2, --)   (6.2, --)   (6.2, --)
 tDVS+tDVH   (120, --)   (80, --)    (60, --)    (45, --)    (30, --)

 Tcyc = tDVS+tDVH
 WR[bytes/s] = 1/Tcyc[s] * 2[bytes]

On Classic (boosted):
 HClk = 108 MHz. -> T = ~9.26 ns.

Old values (used by OF):
 UDMA  ATA_UDMA_TIME  tACK  tRP    tSS   tDVS  tDVH  Tcyc   WR(MB/s)
 0     0x5071152      27.8  166.7  55.6  74.1  55.6  129.7  15.4
 1     0x3050a52      27.8  101.8  55.6  55.6  37     92.6  21.6
 2     0x3030a52      27.8  101.8  55.6  37    37     74    27
 3     0x2020a52      27.8  101.8  55.6  27.8  27.8   55.6  36
 4     0x2010a52      27.8  101.8  55.6  18.5  27.8   46.3  43.2

New values:
 UDMA  ATA_UDMA_TIME  tACK  tRP    tSS   tDVS  tDVH  Tcyc   WR(MB/s)
 0     0x4071152      27.8  166.7  55.6  74.1  46.3  120.4  16.6
 1     0x2050d52      27.8  129.6  55.6  55.6  27.8   83.4  24
 2     0x2030a52      27.8  101.8  55.6  37    27.8   64.8  30.9
 3     0x1020a52      27.8  101.8  55.6  27.8  18.5   46.3  43.2
 4     0x1010a52      27.8  101.8  55.6  18.5  18.5   37    54

To verify that the settings are correct, a write-to-cache test was
performed using emCORE, the measured transfer rate (WRm) is compared
against the theoric transfer rate (WR) at 108 Mhz for the old and
the new UDMA4 settings (iPod 160, HDD Toshiba MK1634GAL):

 UDMA  ATA_UDMA_TIME  Tcyc(ns)  WR(MB/s)  WRm(MB/s)  RDm(MB/s)
 4     0x2010a52      46.3      43.2      42.9       59.8
 4     0x1010a52      37        54        53.5       59.8

Notes:
 - The new UDMA4 settings increases ~25% the ATA transfer rate for
   cached-writes. The real HDD write speed is limited by the internal
   transfer rate (depends on cilinder, for the MK1634GAL it is 276 to
   573 Mbits/s). Sequential write benchmark using diskdump on USB are
   ~8% faster.
 - Read transfers are clocked by the device, it depends on UDMA mode
   selected and are not affected by HClk or ATA_UDMA_TIME settings.
   Read-from-cache tests results (RDm) using HClk=108 and HClk=54 for
   UDMA4 are 59.8 MB/s on MK1634GAL.
 - Minimum HClk is limited by tACKENV specs, using current settings
   it is 54 MHz for UDMA4,UDMA3 and 43 MHz for UDMA2,UDMA1,UDMA0.

Change-Id: I61d67060410752518a59e1ff08072b21747ca997
2016-05-15 22:57:12 +02:00
..
archos/av300 button-target.h : move prototypes to button.h 2012-01-08 00:07:19 +00:00
as3525 as3525: reverting I2C2 to non-interrupts version 2016-04-05 01:55:38 +00:00
at91sam Get rid of stupid _backlight_* function names 2015-01-12 11:09:27 +01:00
imx31 Get rid of stupid _backlight_* function names 2015-01-12 11:09:27 +01:00
imx233 Get rid of stupid _backlight_* function names 2015-01-12 11:09:27 +01:00
ipod iPod Classic: clickwheel fixes 2015-12-17 10:26:51 +01:00
iriver Get rid of stupid _backlight_* function names 2015-01-12 11:09:27 +01:00
olympus Fix red/yellow 2015-01-12 12:02:24 +01:00
pbell Fix red/yellow round #2 2015-01-12 13:25:14 +01:00
philips HDD16X0: remove unnecessary define. 2016-03-13 21:44:58 +01:00
pnx0101 Get rid of stupid _backlight_* function names 2015-01-12 11:09:27 +01:00
pp Red Alert 2016-04-06 00:39:23 +00:00
rk27xx Get rid of stupid _backlight_* function names 2015-01-12 11:09:27 +01:00
s3c2440 Get rid of stupid _backlight_* function names 2015-01-12 11:09:27 +01:00
s5l8700 iPod Nano2G: add IPOD_ACCESSORY_PROTOCOL 2016-05-14 19:39:09 +02:00
s5l8702 iPod Classic: optimize UDMA timming for ATA drives 2016-05-15 22:57:12 +02:00
samsung Samsung YH92X: Remove unneeded line. 2016-01-12 21:02:16 +01:00
sandisk Get rid of stupid _backlight_* function names 2015-01-12 11:09:27 +01:00
tatung Get rid of stupid _backlight_* function names 2015-01-12 11:09:27 +01:00
tcc77x Get rid of stupid _backlight_* function names 2015-01-12 11:09:27 +01:00
tcc780x Fix red/yellow 2015-01-12 12:02:24 +01:00
tms320dm320 Get rid of stupid _backlight_* function names 2015-01-12 11:09:27 +01:00
ata-as-arm.S
ata-nand-telechips.c Add missing kernel.h includes (hopefully all of them). 2014-01-05 20:32:09 +01:00
bits-armv4.S Do some things to make -ffunction-sections work better. 2011-12-17 01:43:32 +00:00
bits-armv6.S Do some things to make -ffunction-sections work better. 2011-12-17 01:43:32 +00:00
crt0.S arm: factor all exception handlers out of the crt0.S files 2012-04-06 13:46:32 +02:00
i2c-telechips.c Fix various reds. Some includes needed fixup. 2014-03-03 19:10:48 +01:00
lcd-c200_c200v2.c lcd drivers: Convert lcd_[remote_]framebuffer to a pointer 2012-02-28 11:44:59 +11:00
lcd-ssd1815.c lcd drivers: Convert lcd_[remote_]framebuffer to a pointer 2012-02-28 11:44:59 +11:00
mmu-arm.h Commit to certain names for cache coherency APIs and discard the aliases. 2011-12-17 07:27:24 +00:00
mmu-arm.S imx233: define HAVE_TEST_AND_CLEAN_CACHE 2012-06-07 14:48:43 +02:00
mmu-armv6.S Commit to certain names for cache coherency APIs and discard the aliases. 2011-12-17 07:27:24 +00:00
pcm-telechips.c Fix errors in unintentionally merged gerrit commit. 2012-03-03 01:45:09 -05:00
powermgmt-ascodec.c AMSv2: add proper definitions for charge current 2012-03-04 12:23:05 +01:00
system-arm.c Restore backtrace which was accidentely commented out 2012-05-19 16:55:07 +02:00
system-arm.h Create fimrware/asm directory for assembly optimized stuff. 2012-01-22 18:46:44 +01:00
uc870x.c iPod Classic: updates for uc8702 driver 2016-05-13 23:21:42 +02:00
usb-drv-arc.c Get rid of usb_drv_attach() from USB code. 2013-05-14 22:13:38 -04:00
usb-s3c6400x.c usb-s3c6400x: prevent calling usb_enable(enable) twice on USB insert 2016-03-18 14:55:53 +01:00
usb-tcc.c usb-target.h: remove 2011-12-31 18:44:55 +00:00
wmcodec-telechips.c