Commit Graph

112 Commits

Author SHA1 Message Date
Masahiro Yamada
710f1d3d5f drivers: convert makefiles to Kbuild style
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2013-10-31 13:26:01 -04:00
Wolfgang Denk
3765b3e7bd Coding Style cleanup: remove trailing white space
Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-10-14 16:06:53 -04:00
Robert P. J. Day
1f8b546f9e Fix some obvious typos across multiple subsystems.
Typoes fixed:

  "partion" -> "partition"
  "retrive", "retreive" -> "retrieve"
  "th" -> "to"

Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca>
2013-09-20 10:29:48 -04:00
Rob Herring
344ca0b40c ahci: convert to use libata functions and definitions
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>
2013-09-06 13:09:07 -04:00
Rob Herring
7610b41ddf ahci: increase spin-up timeout to 20 sec
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>
2013-09-06 13:09:07 -04:00
Rob Herring
178210847f ahci: handle COMINIT received during spin-up
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>
2013-09-06 13:09:07 -04:00
Rob Herring
124e9fa132 ahci: move link bring-up handling to separate function
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>
2013-09-06 13:09:07 -04:00
Rob Herring
2bdb10dbf5 ahci: add defines for PORT_SCR_STAT register bits
Replace hard-coded register values with proper defines for PORT_SCR_STAT
register.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2013-09-06 13:09:07 -04:00
Rob Herring
796c2ebd6f ahci: fix memory leak in ata_scsiop_inquiry
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>
2013-09-06 13:09:07 -04:00
Rob Herring
48c3a87c0a ahci: fix unaligned access
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>
2013-09-06 13:09:07 -04:00
Richard Gibbs
2915a0223a ahci: use ports implemented map instead of num_ports
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>
2013-09-06 13:09:07 -04:00
Tom Rini
aaf5e82560 Merge branch 'master' of git://git.denx.de/u-boot-nds32 2013-07-25 08:51:51 -04:00
Wolfgang Denk
1a4596601f Add GPL-2.0+ SPDX-License-Identifier to source files
Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>
2013-07-24 09:44:38 -04:00
Gabor Juhos
c575180bae block: constify sect_buf argument of ide_write_data
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>
2013-07-24 11:49:17 +08:00
Eric Nelson
2dbe64ca24 dwc_ahsata: Allow use with dcache enabled
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
2013-06-26 16:26:45 +02:00
Egbert Eich
0472fbfd32 part/dev_desc: Add log2 of blocksize to block_dev_desc data struct
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>
2013-05-01 16:24:02 -04:00
York Sun
472d546054 Consolidate bool type
'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>
2013-04-01 16:33:52 -04:00
Gray Remlin
c08349e77c mvsata_ide.c: Correction of typo in comments
Signed-off-by: Gray Remlin <gryrmln@gmail.com>
2013-03-11 17:00:28 -04:00
Tom Rini
2d795c9621 Merge branch 'master' of git://www.denx.de/git/u-boot-microblaze 2013-02-04 09:14:22 -05:00
Alexey Brodkin
ac1048ae1c drivers/block/systemace - fixed data type in "systemace_read" to match 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>
2013-02-04 09:07:20 -05:00
Alexey Brodkin
7cde9f35d6 block: systemace: Added missing "else" in "ace_writew"
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>
2013-02-04 12:07:08 +01:00
Kim Phillips
00caa7f508 drivers/block/: sparse fixes
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>
2012-11-04 11:00:37 -07:00
Walter Murphy
fe1f808ce7 ahci: Expand HDD Logical Block addressability up to 32 bits
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>
2012-11-02 15:20:43 -07:00
Marc Jones
766b16fe18 ahci: Perform SATA flush after disk write.
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>
2012-11-02 15:20:43 -07:00
Marc Jones
2a0c61d401 ahci: Support spin-up and link-up separately
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>
2012-11-02 15:20:43 -07:00
Walter Murphy
57847660bb ahci: Adjust SATA timeouts for hard disk (spinup delay & command timeout)
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>
2012-11-02 15:20:42 -07:00
Taylor Hutt
90b276f6a2 ahci: flush / invalidate dcache around SATA commands
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>
2012-11-02 15:20:42 -07:00
Taylor Hutt
64738e8ae8 ahci: Use virt_to_phys() to denote physical addresses for DMA
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>
2012-11-02 15:20:42 -07:00
Taylor Hutt
5a2b77f47d ahci: Fix 'Invaild' typo
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>
2012-11-02 15:20:42 -07:00
Taylor Hutt
c873111565 ahci: Use sizeof(fis) instead of hardcoding '20'
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>
2012-11-02 15:20:42 -07:00
Gabe Black
19d1d41e84 ahci: Make the AHCI code find the capacity of disks > 128 GB properly
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>
2012-11-02 15:20:41 -07:00
Hung-Te Lin
b7a21b70d0 ahci: support scsi writing in AHCI driver
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>
2012-11-02 15:20:41 -07:00
Gabe Black
e81058c05b ahci: Make sending the SETFEATURES_XFER command optional
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>
2012-11-02 15:20:41 -07:00
Stefan Reinauer
4e422bce8a ahci: cosmetics and cleanup
- 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>
2012-11-02 15:20:41 -07:00
Stefan Reinauer
7ba7917c91 ahci: Improve AHCI debugging
- 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>
2012-11-02 15:20:41 -07:00
Stefan Reinauer
9a65b8754c ahci: Optimise AHCI controller reset and start-up
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>
2012-11-02 15:20:41 -07:00
Vadim Bendebury
284231e49a ahci: Support splitting of read transactions into multiple chunks
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>
2012-11-02 15:20:40 -07:00
Pavel Herrmann
e46a4350b4 sata.h: Make all sata/ata drivers include <sata.h>
- 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>
2012-10-15 11:54:03 -07:00
Tom Rini
0e7d856ea5 sil_sata: Make sata_write() comply with <part.h>
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>
2012-10-15 11:54:03 -07:00
Tom Rini
98391ff143 sata_dwc: Make sata_write() use const void, per <part.h>
Signed-off-by: Tom Rini <trini@ti.com>
2012-10-15 11:54:02 -07:00
Tom Rini
974d801401 pata_bfin: Make sata_{read,write}() comply with <part.h>
These functions take lbaint_t for blkcnt.

Signed-off-by: Tom Rini <trini@ti.com>
2012-10-15 11:54:02 -07:00
Tom Rini
40c030f8ff fsl_sata: Make sata_{read,write}() comply with <part.h>
- 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>
2012-10-15 11:54:02 -07:00
Tom Rini
dac8757100 dwc_ahsata: Make sata_write() comply with <part.h>
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>
2012-10-15 11:54:02 -07:00
Tom Rini
5048a672d9 ata_piix: sata_write must take a const void argument.
Signed-off-by: Tom Rini <trini@ti.com>
2012-10-15 11:54:02 -07:00
Tom Rini
879a57ac0e ata_piix: Fix checkpatch issues
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>
2012-10-15 11:54:02 -07:00
Pavel Herrmann
b726a01b76 remove unnecessary code in ata_piix
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>
2012-09-28 10:40:30 -07:00
Michal Simek
5340a7f1d7 block: systemace: Simplify base and width initialization
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>
2012-09-11 09:24:16 +02:00
Anatolij Gustschin
fe749d3728 Remove remaining mdelay() macros
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>
2012-07-08 22:15:08 +02:00
Marek Vasut
b37d41aa24 Block: Remove MG DISK support
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>
2012-06-21 20:53:09 +02:00
Stefano Babic
9f472e6540 SATA: add driver for MX5 / MX6 SOCs
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>
2012-05-15 08:31:30 +02:00