summaryrefslogtreecommitdiff
path: root/drivers/block
Commit message (Collapse)AuthorAgeLines
* ahci: convert to use libata functions and definitionsRob Herring2013-09-06-56/+24
| | | | | | | | | | | | | libata already has similar functions as implemented in the ahci code. Refactor the code to use the libata variants and remove the dependency on ata.h. Convert some defines to use the version from libata.h. Also, remove some unnecessary memset's of bss data. This is a step toward hopefully merging ahci.c and dw_ahsata.c which are essentially the same driver. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Reviewed-by: Tom Rini <trini@ti.com>
* ahci: increase spin-up timeout to 20 secRob Herring2013-09-06-1/+1
| | | | | | | | Based on Linux libata code, most drives are less than 10 sec, but some need up to 20 sec. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Reviewed-by: Tom Rini <trini@ti.com>
* ahci: handle COMINIT received during spin-upRob Herring2013-09-06-0/+12
| | | | | | | Some Intel SSDs can send a COMINIT after the initial COMRESET. This causes the link to go down and we need to re-initialize the link. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* ahci: move link bring-up handling to separate functionRob Herring2013-09-06-15/+25
| | | | | | | | Move the link bring-up handling to a separate weak function in order to allow platforms to override it. This is needed on highbank platform which needs special phy handling. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* ahci: add defines for PORT_SCR_STAT register bitsRob Herring2013-09-06-2/+3
| | | | | | | Replace hard-coded register values with proper defines for PORT_SCR_STAT register. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
* ahci: fix memory leak in ata_scsiop_inquiryRob Herring2013-09-06-0/+1
| | | | | | | This fixes a memory leak when scsi inquiry fails. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Reviewed-by: Tom Rini <trini@ti.com>
* ahci: fix unaligned accessRob Herring2013-09-06-1/+1
| | | | | | | | gcc 4.7 will generate unaligned accesses to local char arrays, so make them static to avoid that. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Reviewed-by: Tom Rini <trini@ti.com>
* ahci: use ports implemented map instead of num_portsRichard Gibbs2013-09-06-0/+4
| | | | | | | | | The AHCI driver was incorrectly using the Capabilities register NP (number of ports) field to determine which ports to activate. This commit changes it to correctly use the PORTS_IMPL register as a port map. Signed-off-by: Richard Gibbs <richard.gibbs@calxeda.com> Reviewed-by: Tom Rini <trini@ti.com>
* Merge branch 'master' of git://git.denx.de/u-boot-nds32Tom Rini2013-07-25-1/+1
|\
| * block: constify sect_buf argument of ide_write_dataGabor Juhos2013-07-24-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a const keyword to the sect_buf argument of ide_write_data to fix the following warning: cmd_ide.c: In function '__ide_output_data': cmd_ide.c:548: warning: passing argument 2 of 'ide_write_data' discards qualifiers from pointer target type /devel/u-boot.git/include/ide.h:76: note: expected 'ulong *' but argument is of type 'const ulong *' Also modify the driver-model documentation to match with the new prototype. Compile tested only. Cc: Macpaul Lin <macpaul@andestech.com> Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
* | Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-24-307/+21
|/ | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* dwc_ahsata: Allow use with dcache enabledEric Nelson2013-06-26-9/+25
| | | | Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
* part/dev_desc: Add log2 of blocksize to block_dev_desc data structEgbert Eich2013-05-01-0/+4
| | | | | | | | | | log2 of the device block size serves as the shift value used to calculate the block number to read in file systems when implementing avaiable block sizes. It is needed quite often in file systems thus it is pre-calculated and stored in the block device descriptor. Signed-off-by: Egbert Eich <eich@suse.com>
* Consolidate bool typeYork Sun2013-04-01-34/+27
| | | | | | | | | | | | | 'bool' is defined in random places. This patch consolidates them into a single header file include/linux/types.h, using stdbool.h introduced in C99. All other #define, typedef and enum are removed. They are all consistent with true = 1, false = 0. Replace FALSE, False with false. Replace TRUE, True with true. Skip *.py, *.php, lib/* files. Signed-off-by: York Sun <yorksun@freescale.com>
* mvsata_ide.c: Correction of typo in commentsGray Remlin2013-03-11-2/+2
| | | | Signed-off-by: Gray Remlin <gryrmln@gmail.com>
* Merge branch 'master' of git://www.denx.de/git/u-boot-microblazeTom Rini2013-02-04-2/+2
|\
| * block: systemace: Added missing "else" in "ace_writew"Alexey Brodkin2013-02-04-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | System ACE compact flash controller supports either 8-bit (default) or 16-bit data transfers. And in corresponding driver we need to implement read/write of 16-bit data words properly for both modes of operation. In existing code if width==8 both branches get executed which may cause unexpected behavior of SystemAce controller. Addition of "else" fixes described issue and execution is done as expected for both (8-bit and 16-bit) data bus widths. Signed-off-by: Alexey Brodkin <alexey.brodkin@gmail.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
* | drivers/block/systemace - fixed data type in "systemace_read" to match ↵Alexey Brodkin2013-02-04-2/+2
|/ | | | | | | | | | | | | | | | prototype in "block_dev_desc_t" Currently we have "unsigned long blkcnt" which is fine with CONFIG_SYS_64BIT_LBA undefined because "lbaint_t" is basically the same "unsigned long". If CONFIG_SYS_64BIT_LBA gets defined "lbaint_t" is defined as "unsigned long long". Even though not many embedded systems have CONFIG_SYS_64BIT_LBA defined it's good to have types in function implementation that match exactly with prototypes. Signed-off-by: Alexey Brodkin <alexey.brodkin@gmail.com>
* drivers/block/: sparse fixesKim Phillips2012-11-04-82/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sata_sil.c:371:7: warning: symbol 'sil_sata_rw_lba28' was not declared. Should it be static? sata_sil.c:399:7: warning: symbol 'sil_sata_rw_lba48' was not declared. Should it be static? sata_sil.c:429:6: warning: symbol 'sil_sata_cmd_flush_cache' was not declared. Should it be static? sata_sil.c:441:6: warning: symbol 'sil_sata_cmd_flush_cache_ext' was not declared. Should it be static? sata_sil.c:489:7: warning: symbol 'sata_read' was not declared. Should it be static? sata_sil.c:505:7: warning: symbol 'sata_write' was not declared. Should it be static? sata_sil.c:526:5: warning: symbol 'init_sata' was not declared. Should it be static? sata_sil.c:588:5: warning: symbol 'scan_sata' was not declared. Should it be static? fsl_sata.c:59:6: warning: symbol 'dprint_buffer' was not declared. Should it be static? fsl_sata.c:187:42: warning: incorrect type in assignment (different base types) fsl_sata.c:187:42: expected unsigned int [unsigned] [usertype] cda fsl_sata.c:187:42: got restricted __le32 [usertype] <noident> fsl_sata.c:291:6: warning: symbol 'fsl_sata_hardware_reset' was not declared. Should it be static? fsl_sata.c:418:27: warning: incorrect type in assignment (different base types) fsl_sata.c:418:27: expected unsigned int [unsigned] [usertype] dba fsl_sata.c:418:27: got restricted __le32 [usertype] <noident> fsl_sata.c:424:41: warning: incorrect type in assignment (different base types) fsl_sata.c:424:41: expected unsigned int [unsigned] [usertype] ext_c_ddc fsl_sata.c:424:41: got restricted __le32 [usertype] <noident> fsl_sata.c:431:41: warning: incorrect type in assignment (different base types) fsl_sata.c:431:41: expected unsigned int [unsigned] [usertype] ext_c_ddc fsl_sata.c:431:41: got restricted __le32 [usertype] <noident> fsl_sata.c:442:22: warning: incorrect type in assignment (different base types) fsl_sata.c:442:22: expected unsigned int [unsigned] [usertype] cda fsl_sata.c:442:22: got restricted __le32 [usertype] <noident> fsl_sata.c:446:31: warning: incorrect type in assignment (different base types) fsl_sata.c:446:31: expected unsigned int [unsigned] [usertype] prde_fis_len fsl_sata.c:446:31: got restricted __le32 [usertype] <noident> fsl_sata.c:448:22: warning: incorrect type in assignment (different base types) fsl_sata.c:448:22: expected unsigned int [unsigned] [usertype] ttl fsl_sata.c:448:22: got restricted __le32 [usertype] <noident> fsl_sata.c:460:28: warning: incorrect type in assignment (different base types) fsl_sata.c:460:28: expected unsigned int [unsigned] [usertype] attribute fsl_sata.c:460:28: got restricted __le32 [usertype] <noident> fsl_sata.c:623:6: warning: symbol 'fsl_sata_flush_cache' was not declared. Should it be static? fsl_sata.c:667:5: warning: symbol 'fsl_sata_rw_ncq_cmd' was not declared. Should it be static? fsl_sata.c:710:6: warning: symbol 'fsl_sata_flush_cache_ext' was not declared. Should it be static? fsl_sata.c:725:6: warning: symbol 'fsl_sata_software_reset' was not declared. Should it be static? fsl_sata.c:760:5: warning: symbol 'ata_low_level_rw_lba48' was not declared. Should it be static? fsl_sata.c:795:5: warning: symbol 'ata_low_level_rw_lba28' was not declared. Should it be static? the following compiler warnings show up after fixing the above, so remove those three functions: fsl_sata.c:59:13: warning: 'dprint_buffer' defined but not used [-Wunused-function] fsl_sata.c:291:13: warning: 'fsl_sata_hardware_reset' defined but not used [-Wunused-function] fsl_sata.c:726:13: warning: 'fsl_sata_software_reset' defined but not used [-Wunused-function] Other than that, the following are fixed by __iomem annotation: fsl_sata.c:84:39: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:84:39: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:84:39: got unsigned int volatile *addr fsl_sata.c:172:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:172:26: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:172:26: got unsigned int *<noident> fsl_sata.c:175:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:175:19: expected unsigned int volatile [noderef] <asn:2>*addr fsl_sata.c:175:19: got unsigned int *<noident> fsl_sata.c:181:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:181:19: expected unsigned int volatile [noderef] <asn:2>*addr fsl_sata.c:181:19: got unsigned int *<noident> fsl_sata.c:184:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:184:26: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:184:26: got unsigned int *<noident> fsl_sata.c:186:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:186:19: expected unsigned int volatile [noderef] <asn:2>*addr fsl_sata.c:186:19: got unsigned int *<noident> fsl_sata.c:189:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:189:26: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:189:26: got unsigned int *<noident> fsl_sata.c:191:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:191:19: expected unsigned int volatile [noderef] <asn:2>*addr fsl_sata.c:191:19: got unsigned int *<noident> fsl_sata.c:194:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:194:26: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:194:26: got unsigned int *<noident> fsl_sata.c:195:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:195:19: expected unsigned int volatile [noderef] <asn:2>*addr fsl_sata.c:195:19: got unsigned int *<noident> fsl_sata.c:198:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:198:19: expected unsigned int volatile [noderef] <asn:2>*addr fsl_sata.c:198:19: got unsigned int *<noident> fsl_sata.c:201:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:201:19: expected unsigned int volatile [noderef] <asn:2>*addr fsl_sata.c:201:19: got unsigned int *<noident> fsl_sata.c:204:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:204:26: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:204:26: got unsigned int *<noident> fsl_sata.c:205:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:205:19: expected unsigned int volatile [noderef] <asn:2>*addr fsl_sata.c:205:19: got unsigned int *<noident> fsl_sata.c:208:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:208:26: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:208:26: got unsigned int *<noident> fsl_sata.c:209:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:209:19: expected unsigned int volatile [noderef] <asn:2>*addr fsl_sata.c:209:19: got unsigned int *<noident> fsl_sata.c:212:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:212:26: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:212:26: got unsigned int *<noident> fsl_sata.c:213:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:213:19: expected unsigned int volatile [noderef] <asn:2>*addr fsl_sata.c:213:19: got unsigned int *<noident> fsl_sata.c:216:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:216:19: expected unsigned int volatile [noderef] <asn:2>*addr fsl_sata.c:216:19: got unsigned int *<noident> fsl_sata.c:219:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:219:19: expected unsigned int volatile [noderef] <asn:2>*addr fsl_sata.c:219:19: got unsigned int *<noident> fsl_sata.c:222:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:222:19: expected unsigned int volatile [noderef] <asn:2>*addr fsl_sata.c:222:19: got unsigned int *<noident> fsl_sata.c:225:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:225:26: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:225:26: got unsigned int *<noident> fsl_sata.c:227:19: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:227:19: expected unsigned int volatile [noderef] <asn:2>*addr fsl_sata.c:227:19: got unsigned int *<noident> fsl_sata.c:242:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:242:26: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:242:26: got unsigned int *<noident> fsl_sata.c:256:32: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:256:32: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:256:32: got unsigned int *<noident> fsl_sata.c:262:26: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:262:26: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:262:26: got unsigned int *<noident> fsl_sata.c:274:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:274:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:274:53: got unsigned int *<noident> fsl_sata.c:275:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:275:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:275:53: got unsigned int *<noident> fsl_sata.c:276:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:276:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:276:53: got unsigned int *<noident> fsl_sata.c:277:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:277:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:277:53: got unsigned int *<noident> fsl_sata.c:278:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:278:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:278:53: got unsigned int *<noident> fsl_sata.c:279:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:279:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:279:53: got unsigned int *<noident> fsl_sata.c:280:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:280:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:280:53: got unsigned int *<noident> fsl_sata.c:281:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:281:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:281:53: got unsigned int *<noident> fsl_sata.c:282:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:282:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:282:53: got unsigned int *<noident> fsl_sata.c:283:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:283:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:283:53: got unsigned int *<noident> fsl_sata.c:284:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:284:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:284:53: got unsigned int *<noident> fsl_sata.c:285:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:285:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:285:53: got unsigned int *<noident> fsl_sata.c:286:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:286:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:286:53: got unsigned int *<noident> fsl_sata.c:287:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:287:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:287:53: got unsigned int *<noident> fsl_sata.c:288:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:288:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:288:53: got unsigned int *<noident> fsl_sata.c:289:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:289:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:289:53: got unsigned int *<noident> fsl_sata.c:290:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:290:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:290:53: got unsigned int *<noident> fsl_sata.c:291:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:291:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:291:53: got unsigned int *<noident> fsl_sata.c:292:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:292:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:292:53: got unsigned int *<noident> fsl_sata.c:293:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:293:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:293:53: got unsigned int *<noident> fsl_sata.c:294:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:294:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:294:53: got unsigned int *<noident> fsl_sata.c:295:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:295:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:295:53: got unsigned int *<noident> fsl_sata.c:296:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:296:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:296:53: got unsigned int *<noident> fsl_sata.c:297:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:297:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:297:53: got unsigned int *<noident> fsl_sata.c:298:53: warning: incorrect type in argument 1 (different address spaces) fsl_sata.c:298:53: expected unsigned int const volatile [noderef] <asn:2>*addr fsl_sata.c:298:53: got unsigned int *<noident> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
* ahci: Expand HDD Logical Block addressability up to 32 bitsWalter Murphy2012-11-02-4/+8
| | | | | | | | | | | | | | | | | | Currently, this driver uses a 28bit interface to AHCI, this limits the number of blocks addressable to 2^28, or the max disk size to 512(2^28) or about 137GB. This change allows supporting drives up to about 2TB. Testing this is a bit difficult. There is test code that can be inserted into U-Boot that will write test patterns into certain unused blocks. These patterns can be manually checked using 'dd' after boot. Another way is to confirm the original error that exposed this bug is fixed. IOW: see if AU (Auto Update) will now work on the drive. Also, check that there are no warning messages from the 'cgpt' utility. Signed-off-by: Walter Murphy <wmurphy@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* ahci: Perform SATA flush after disk write.Marc Jones2012-11-02-1/+51
| | | | | | | | | | Writes in u-boot are so rare, and the logic to know when is the last write and do a flush only there is sufficiently difficult. Just do a flush after every write. This incurs, usually, one extra flush when the rare writes do happen. Signed-off-by: Marc Jones <marc.jones@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* ahci: Support spin-up and link-up separatelyMarc Jones2012-11-02-6/+39
| | | | | | | | Add HDD handling to the SSD-only AHCI driver, by separately dealing with spin-up and link-up. Signed-off-by: Marc Jones <marc.jones@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* ahci: Adjust SATA timeouts for hard disk (spinup delay & command timeout)Walter Murphy2012-11-02-4/+10
| | | | | | | | | | | | | | | Note: These are timeout values and not delay values, so the event being timed out will complete whenever it is actually ready, with a measurement granularity of 1 millisecond, up till the timeout value. Therefore, there is no effect on SSD booting. The values were determined by instrumenting the code and measuring the actual time taken by several different models of HDD for each of the parameters and then adding 50% more for the spinup value and just doubling the command timeout value. Signed-off-by: Walter Murphy <wmurphy@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* ahci: flush / invalidate dcache around SATA commandsTaylor Hutt2012-11-02-0/+39
| | | | | | | | | Exynos5 automatically performs DMA when the SATA controller executes commands. This adds the necessary dcache-to-memory flush & invalidation calls to allow the DMA to properly function. Signed-off-by: Taylor Hutt <thutt@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* ahci: Use virt_to_phys() to denote physical addresses for DMATaylor Hutt2012-11-02-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Update the assignment of various physical memory buffers used by the SATA controller to explicitly be denoted as physical addresses. The memory is identity-mapped, so these function calls are a nop, but they provide good semantic documentation for any maintainers. The return value of virt_to_phys() is 'unsigned long'. On machines where sizeof(unsigned long) != sizeof(pointer), a cast through (uintptr_t) is needed to appease the compiler due to the potential of losing the upper 32 bits of the address. In compilation this scenario, a physical address could be 64-bits, yet the C pointer environment only allows 32-bit addresses; the constraint is that pointers cannot address more than 4Gb of memory and if virt_to_phys() ever returns an out-of-range value for the physical address, there are issues with emmory mapping which must be solved. However, since the memory is identify mappeed, there is no problem introducing the cast: the original pointer will reside in 32-bits, so the physical address will also be within in 32-bits. Signed-off-by: Taylor Hutt <thutt@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* ahci: Fix 'Invaild' typoTaylor Hutt2012-11-02-1/+1
| | | | | | | | This fixes a spelling error in a message which can be output to the console. Signed-off-by: Taylor Hutt <thutt@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* ahci: Use sizeof(fis) instead of hardcoding '20'Taylor Hutt2012-11-02-5/+5
| | | | | | | | This cleanup replaces the hardcoded use of '20', which represents the number of bytes in the FIS, with sizeof(fis). Signed-off-by: Taylor Hutt <thutt@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* ahci: Make the AHCI code find the capacity of disks > 128 GB properlyGabe Black2012-11-02-5/+50
| | | | | | | | | | | | | | | | | | | | | | | In the structure returned by the ATA identify device command, there are two fields which describe the device capacity. One is a 32 bit data type which reports the number of sectors as a 28 bit LBA, and the other is a 64 bit data type which is for a 48 bit LBA. If the device doesn't support 48 bit LBAs, the small value is the only value with the correct size. If it supports more, if the number of sectors is small enough to fit into 28 bits, both fields reflect the correct value. If it's too large, the smaller field has 28 bits of 1s, 0xfffffff, and the other field has the correct value. The AHCI driver is implemented by attaching to the generic SCSI code and translating on the fly between SCSI binary data structures and AHCI data structures. It responds to requests to execute specific SCSI commands by executing the equivalent AHCI commands and then crafting a response which matches what a SCSI disk would send. The AHCI driver now considers both fields and chooses the correct one when implementing both the SCSI READ CAPACITY (10) and READ CAPACITY (16) commands. Signed-off-by: Gabe Black <gabeblack@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* ahci: support scsi writing in AHCI driverHung-Te Lin2012-11-02-24/+30
| | | | | | | | | | | | | | | | | | The "scsi write" command requires support from underlying driver. This CL enables SCSI_WRITE10 in AHCI driver. Tested in U-Boot console, try to i/o with sector #64: scsi read 1000 40 1 md.b 1000 200 # check if things are not 0xcc mw.b 1000 cc 200 # try to fill with 0xcc scsi write 1000 40 1 mw.b 1000 0 200 # fill with zero md.b 1000 200 # should be all 0 scsi read 1000 40 1 md.b 1000 200 # should be all 0xcc Signed-off-by: Hung-Te Lin <hungte@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* ahci: Make sending the SETFEATURES_XFER command optionalGabe Black2012-11-02-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | This command doesn't really do anything when talking to a SATA device, and sending it confuses some of them. This change makes sending the command optional, and defaults to not. The situations where it should be sent are not the common case. With the standard SSD in the machine, here are some times with the option turned off: 1. 8277 2. 8273 3. 8050 And turned on: 1. 8303 2. 8155 3. 8276 Sending that command seems to have no meaningful effect on performance. This fixes problems with an SSD marked Toshiba NV6424, Taiwan 11159AE P and TC58NVG5D2FTA10. Signed-off-by: Gabe Black <gabeblack@chromium.org> Signed-off-by: Taylor Hutt <thutt@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* ahci: cosmetics and cleanupStefan Reinauer2012-11-02-7/+18
| | | | | | | | | | | | | | | | - print the correct speed - print all the AHCI capability flags (information taken from Linux kernel driver) - clean up some comments For example, this might show the following string: AHCI 0001.0300 32 slots 6 ports 6 Gbps 0x3 impl SATA mode Signed-off-by: Stefan Reinauer <reinauer@chromium.org> Commit-Ready: Stefan Reinauer <reinauer@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Stefan Reinauer <reinauer@chromium.org>
* ahci: Improve AHCI debuggingStefan Reinauer2012-11-02-1/+2
| | | | | | | | - remove unused ssleep macro - add some useful debugging information Signed-off-by: Stefan Reinauer <reinauer@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* ahci: Optimise AHCI controller reset and start-upStefan Reinauer2012-11-02-9/+15
| | | | | | | | | | The existing code waits a whole second for the AHCI controller to reset. Instead, let's poll the status register to see if the reset has succeeded and return earlier if possible. This brings down the time for AHCI probing from 1s to 20ms. Signed-off-by: Stefan Reinauer <reinauer@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* ahci: Support splitting of read transactions into multiple chunksVadim Bendebury2012-11-02-29/+69
| | | | | | | | | | | | | With an Intel AHCI controller, the driver does not operate properly if the requested amount of blocks to read exceeds 255. It is probably possible to specify 0 as the block count and the driver will read 256 blocks, but it was decided to limit the number of blocks read at once to 128 (it should be a power of 2 for the optimal performance of solid state drives). Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
* sata.h: Make all sata/ata drivers include <sata.h>Pavel Herrmann2012-10-15-16/+7
| | | | | | | | | | - block_dev_desc_t says that block_(read|write) take lbaint_t for blkcnt not ulong. - We also move the extern of sata_dev_desc into <sata.h> - Remove now duplicate declarations from driver-specific headers. Signed-off-by: Tom Rini <trini@ti.com> Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
* sil_sata: Make sata_write() comply with <part.h>Tom Rini2012-10-15-3/+3
| | | | | | | sata_write() takes a const void as the last argument. Fixing this means we also need to make ata_low_level_rw_lba{28,48} also take a const void. Signed-off-by: Tom Rini <trini@ti.com>
* sata_dwc: Make sata_write() use const void, per <part.h>Tom Rini2012-10-15-1/+1
| | | | Signed-off-by: Tom Rini <trini@ti.com>
* pata_bfin: Make sata_{read,write}() comply with <part.h>Tom Rini2012-10-15-2/+2
| | | | | | These functions take lbaint_t for blkcnt. Signed-off-by: Tom Rini <trini@ti.com>
* fsl_sata: Make sata_{read,write}() comply with <part.h>Tom Rini2012-10-15-4/+6
| | | | | | | | | - sata_write() takes a const void as the last argument. Fixing this means we also need to make ata_low_level_rw_lba{28,48} also take a const void. - Both sata_{read,write} take lbaint_t for blkcnt and ulong for blknr Signed-off-by: Tom Rini <trini@ti.com>
* dwc_ahsata: Make sata_write() comply with <part.h>Tom Rini2012-10-15-4/+4
| | | | | | | | sata_write() takes a const void as the last argument. Fixing this means we also need to make ata_low_level_rw_lba{28,48} also take a const void. Acked-by: Stefano Babic <sbabic@denx.de> Signed-off-by: Tom Rini <trini@ti.com>
* ata_piix: sata_write must take a const void argument.Tom Rini2012-10-15-2/+2
| | | | Signed-off-by: Tom Rini <trini@ti.com>
* ata_piix: Fix checkpatch issuesTom Rini2012-10-15-267/+232
| | | | | | | | While in here also: - Switch to debug from custom PRINTF for debugging. - Use mdelay rather than custom msleep. Signed-off-by: Tom Rini <trini@ti.com>
* remove unnecessary code in ata_piixPavel Herrmann2012-09-28-3/+0
| | | | | | | | | | We set sata_curr_device to 0 right after returning from init_sata(), so there's no point in setting it to the last scanned driver at this point. Note: there are more duplicities with cmd_sata, but those might be required, as the code seems to reset the entire controller on every scan, ignoring the requested port number. Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
* block: systemace: Simplify base and width initializationMichal Simek2012-09-11-13/+25
| | | | | | | Use CONFIG parameters only at one location to simplify the code. Also create ace_readw/writew functions. Signed-off-by: Michal Simek <monstr@monstr.eu>
* Remove remaining mdelay() macrosAnatolij Gustschin2012-07-08-1/+0
| | | | | | | Drop mdelay() macros since we already have a common mdelay() func. Signed-off-by: Anatolij Gustschin <agust@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
* Block: Remove MG DISK supportMarek Vasut2012-06-21-731/+0
| | | | | | | | This driver is unused and obsolete. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Wolfgang Denk <wd@denx.de> Cc: unsik Kim <donari75@gmail.com>
* SATA: add driver for MX5 / MX6 SOCsStefano Babic2012-05-15-0/+1305
| | | | | | | | | | This driver is part of Freescale's LTIB for MX5 / MX6. Signed-off-by: Stefano Babic <sbabic@denx.de> Signed-off-by: Terry Lv <r65388@freescale.com> CC: Fabio Estevam <fabio.estevam@freescale.com> CC: Dirk Behme <dirk.behme@de.bosch.com>
* Blackfin: pata_bfin: fix printf warningMike Frysinger2012-02-12-1/+1
| | | | | | | | pata_bfin.c: In function 'bfin_ata_identify': pata_bfin.c:887:2: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'lbaint_t' Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* mvsata: fix ide_preinit for missing disksSimon Guinot2011-12-06-6/+8
| | | | | | | | Consider that ide_preinit() succeed if at least one port is successfully initialized. This allows to iniatialize IDE support on a board with two SATA ports but a single hard disk available. Signed-off-by: Simon Guinot <simon.guinot@sequanux.org>
* drivers/block/sata_dwc.c: Fix GCC 4.6 build warningWolfgang Denk2011-12-02-5/+1
| | | | | | | | | | Fix: sata_dwc.c: In function 'scan_sata': sata_dwc.c:535:38: warning: variable 'udma_mask' set but not used [-Wunused-but-set-variable] Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Kazuaki Ichinohe <kazuichi@fsi.co.jp>