Blackfin libata PATA ATAPI Driver Starting from Linux kernel 2.6.19, the Parallel ATA (Advanced Technology Attachment (hard drives!)) (PATA (Parallel ATA (IDE hard drives!))) driver based on libata can be used to drive the IDE (Integrated Drive Electronics (hard drives!)) devices. A configuration example for the pata platform driver can be found here: cf_common_memory_example_using_pata_platform_driver Libata PATA driver for IDE board Please refer ide-blackfin for hardware setting on bf533/bf537/bf561. Kernel configuration Enable Libata platform PATA (Parallel ATA (IDE hard drives!)) driver and SCSI (Small Computer System Interface) drivers Device Drivers ---> Serial ATA (prod) and Parallel ATA (experimental) drivers ---> <*> ATA device support <*> Generic platform device PATA support SCSI device support ---> <*> SCSI disk support <*> SCSI CDROM support <*> SCSI generic support Set proper wait states for the async memory bank that the IDE (Integrated Drive Electronics (hard drives!)) board connects. Blackfin Processor Options ---> EBIU_AMBCTL Control ---> (0x7BB0) Bank 0 (0x7BB0) Bank 1 (0x7BB0) Bank 2 (0xffc3) Bank 3 Enabling ext2 and fat File System support File systems ---> <*> Second extended fs support DOS/FAT/NT Filesystems ---> <*> MSDOS fs support <*> VFAT (Windows-95) fs support (437) Default codepage for FAT (iso8859-1) Default iocharset for FAT Enabling Native Language Support File systems ---> Native Language Support ---> (iso8859-1) Default NLS Option <*> Codepage 437 (United States, Canada) Testing PATA interface A configured kernel should print messages as following when start up. You should find your hard disk name “WDC WD800BB-00JHC0”, capacitor “156301488 sectors”, working mode “configured for PIO”, partiton name “sda: sda1 sda2”, etc. U-Boot 1.1.6-svn737 (ADI-2007R1) (Apr 5 2007 - 11:19:27) CPU: ADSP BF537 Rev.: 0.2 Board: ADI BF537 stamp board Support: http://blackfin.uclinux.org/ Clock: VCO: 500 MHz, Core: 500 MHz, System: 100 MHz SDRAM: 64 MB FLASH: 4 MB In: serial Out: serial Err: serial Net: BF537 ETHERNET I2C: ready Hit any key to stop autoboot: 0 bf537> boot Using BF537 ETHERNET device TFTP from server 10.100.4.174; our IP address is 10.100.4.50 Filename 'linux'. Load address: 0x1000000 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ############################### done Bytes transferred = 4814070 (4974f6 hex) Loading .text @ 0x00001000 (1129696 bytes) Loading .rodata @ 0x00115000 (236388 bytes) Loading __ksymtab @ 0x0014eb64 (14608 bytes) Loading __ksymtab_gpl @ 0x00152474 (4688 bytes) Loading __ksymtab_strings @ 0x001536c4 (46372 bytes) Loading __param @ 0x0015ebe8 (620 bytes) Loading .data @ 0x0015f000 (77824 bytes) Loading .init @ 0x00172000 (2706300 bytes) Loading .text_l1 @ 0xffa00000 (8404 bytes) sh_addr: FFA00000, p_paddr: 00406B7C Loading from: 01407000 to 00406B7C, size: 8404 Loading .data_l1 @ 0xff800000 (6464 bytes) sh_addr: FF800000, p_paddr: 00408C50 Loading from: 0140A000 to 00408C50, size: 6464 Clearing .bss @ 0x0040a590 (58276 bytes) ## Starting application at 0x00172000 ... Linux version 2.6.21.4-ADI-2007R2-pre-svn3288 (root@sevens) (gcc version 4.1.1 (ADI 07R1)) #187 Thu Ju7 Warning: limiting memory to 56MB due to hardware anomaly 05000263 Blackfin support (C) 2004-2007 Analog Devices, Inc. Compiled for ADSP-BF537 Rev 0.2 Blackfin Linux support by http://blackfin.uclinux.org/ Processor Speed: 500 MHz core clock and 100 Mhz System Clock Board Memory: 64MB Kernel Managed Memory: 64MB Memory map: text = 0x00001000-0x00114ce0 init = 0x00172000-0x0040a590 data = 0x0015f000-0x00172000 stack = 0x00160000-0x00162000 bss = 0x0040a590-0x00418934 available = 0x00418934-0x037ff000 DMA Zone = 0x03f00000-0x04000000 Instruction Cache Enabled Data Cache Enabled (write-through) Hardware Trace Enabled Built 1 zonelists. Total pages: 14224 Kernel command line: root=/dev/mtdblock0 rw console=ttyBF0,57600 ip=10.100.4.50:10.100.4.174:192.168.0f Configuring Blackfin Priority Driven Interrupts PID hash table entries: 256 (order: 8, 1024 bytes) Dentry cache hash table entries: 8192 (order: 3, 32768 bytes) Inode-cache hash table entries: 4096 (order: 2, 16384 bytes) Physical pages: 37ff Memory available: 52508k/64132k RAM, (2657k init code, 1103k kernel code, 56k data, 1024k dma) Blackfin Scratchpad data SRAM: 4 KB Blackfin Data A SRAM: 16 KB (9 KB free) Blackfin Data B SRAM: 16 KB (16 KB free) Blackfin Instruction SRAM: 48 KB (39 KB free) Security Framework v1.0.0 initialized Mount-cache hash table entries: 512 NET: Registered protocol family 16 Blackfin GPIO Controller Blackfin DMA Controller stamp_init(): registering device resources SCSI subsystem initialized NET: Registered protocol family 2. IP route cache hash table entries: 1024 (order: 0, 4096 bytes) TCP established hash table entries: 2048 (order: 2, 16384 bytes) TCP bind hash table entries: 2048 (order: 1, 8192 bytes) TCP: Hash tables configured (established 2048 bind 2048) TCP reno registered io scheduler noop registered io scheduler anticipatory registered (default) io scheduler cfq registered Dynamic Power Management Controller Driver v0.1: major=10, minor = 254 after bfin-wdt: initialized: timeout=20 sec (nowayout=0) Serial: Blackfin serial driver bfin-uart.1: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize Blackfin mac net device registered dma_alloc_init: dma_page @ 0x00755000 - 256 pages at 0x03f00000 ata1: PATA max PIO0 cmd 0x20314020 ctl 0x2031401c bmdma 0x00000000 irq 55 scsi0 : pata_platform ata1.00: ATA-6: WDC WD800BB-00JHC0, 05.01C05, max UDMA/100 ata1.00: 156301488 sectors, multi 0: LBA ata1.00: configured for PIO scsi 0:0:0:0: Direct-Access ATA WDC WD800BB-00JH 05.0 PQ: 0 ANSI: 5 SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB) sda: Write Protect is off SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO or FUA SCSI device sda: 156301488 512-byte hdwr sectors (80026 MB) sda: Write Protect is off SCSI device sda: write cache: enabled, read cache: enabled, doesn't support DPO or FUA sda: sda1 sda2 sd 0:0:0:0: Attached scsi disk sda sd 0:0:0:0: Attached scsi generic sg0 type 0 rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0 TCP cubic registered NET: Registered protocol family 1 NET: Registered protocol family 17 rtc-bfin rtc-bfin: setting the system clock to 1970-01-01 04:18:54 (15534) IP-Config: Gateway not on directly connected network. Freeing unused kernel memory: 2656k freed (0x172000 - 0x409000) Welcome to: ____ _ _ / __| ||_| _ _ _ _| | | | _ ____ _ _ \ \/ / | | | | | | || | _ \| | | | \ / | |_| | |__| || | | | | |_| | / \ | ___\____|_||_|_| |_|\____|/_/\_\ |_| For further information see: http://www.uclinux.org/ http://blackfin.uclinux.org/ BusyBox v1.4.1 (2007-06-13 16:15:11 CST) Built-in shell (msh) Enter 'help' for a list of built-in commands. root:~> Mounting the disk device root:~>mount /dev/sda1 /mnt/ Display drive content root:~>cd mnt/root:/mnt> ls -l -rw-r--r-- 1 root root 51200000 Jan 1 02:28 foo drwxr-xr-x 2 root root 16384 Jan 1 01:45 lost+found -rw-r--r-- 1 root root 698379296 Jan 1 02:27 testfile root:/mnt> Simple read/write test root:/mnt>cp /bin/busybox .root:/mnt>ls -l-rwxr-xr-x 1 root root 445628 Jan 1 00:11 busybox -rw-r--r-- 1 root root 51200000 Jan 1 02:28 foo drwxr-xr-x 2 root root 16384 Jan 1 01:45 lost+found -rw-r--r-- 1 root root 698379296 Jan 1 02:27 testfile root:/mnt>md5sum busybox2ba3478024c263fe8fd015a82bdae16d busybox Throughput test show that the average read byte rate is about 5M byes/s. root:/mnt>time cat foo > /dev/nullreal 0m 9.33s user 0m 0.03s sys 0m 6.08s Displaying Drive Information root:~>cat proc/partitionsmajor minor #blocks name 8 0 78150744 sda 8 1 10079968 sda1 8 2 1008000 sda2 Checking disk space root:/mnt>dfFilesystem 1k-blocks Used Available Use% Mounted on /dev/sda1 9921584 733200 8684388 8% /mnt Unmount the disk device root:~>umount mnt/ PATA Performance Test on BF537 System Setting Board Version , CCLK (Core Clock) , SCLK (System Clock) , Kernel Version , Toolchain Version , Hard Disk BF537 STAMP-2.1 - Rev 0.2 , 500MHz , 100MHz , 2.6.28-rc2-ADI (Analog Devices, Inc.)-2009R1-pre-svn5938 , gcc 4.1.2 (svn) , WDC WD1600AAJB-5 Test Case 1: Bonnie++ on Ext2 root:/> mkfs.ext2 /dev/sda1 root:/> mount /dev/sda1 /mnt/ root:/> bonnie++ -u root -d /mnt/ Result: Version 1.94 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP blackfin 300M 48 99 6224 75 1782 37 124 99 2874 26 100.4 5 Latency 348ms 428ms 936ms 84000us 788ms 543ms Version 1.94 ------Sequential Create------ --------Random Create-------- blackfin -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 233 99 6543 100 3690 89 235 99 6907 100 825 98 Latency 79999us 4000us 4000us 148ms 4000us 4000us