projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of git://git.denx.de/u-boot-blackfin
[oweals/u-boot.git]
/
drivers
/
block
/
fsl_sata.c
diff --git
a/drivers/block/fsl_sata.c
b/drivers/block/fsl_sata.c
index d14f5bc6bf8e5de12f78cbe38df1159147d37e7d..abcda6fb5fd6852a3bf775383df95666f3cf562b 100644
(file)
--- a/
drivers/block/fsl_sata.c
+++ b/
drivers/block/fsl_sata.c
@@
-26,23
+26,23
@@
#include <fis.h>
#include "fsl_sata.h"
#include <fis.h>
#include "fsl_sata.h"
-extern block_dev_desc_t sata_dev_desc[C
FG
_SATA_MAX_DEVICE];
+extern block_dev_desc_t sata_dev_desc[C
ONFIG_SYS
_SATA_MAX_DEVICE];
-#ifndef C
FG
_SATA1_FLAGS
- #define C
FG_SATA1_FLAGS
FLAGS_DMA
+#ifndef C
ONFIG_SYS
_SATA1_FLAGS
+ #define C
ONFIG_SYS_SATA1_FLAGS
FLAGS_DMA
#endif
#endif
-#ifndef C
FG
_SATA2_FLAGS
- #define C
FG_SATA2_FLAGS
FLAGS_DMA
+#ifndef C
ONFIG_SYS
_SATA2_FLAGS
+ #define C
ONFIG_SYS_SATA2_FLAGS
FLAGS_DMA
#endif
static struct fsl_sata_info fsl_sata_info[] = {
#ifdef CONFIG_SATA1
#endif
static struct fsl_sata_info fsl_sata_info[] = {
#ifdef CONFIG_SATA1
- {C
FG_SATA1, CFG
_SATA1_FLAGS},
+ {C
ONFIG_SYS_SATA1, CONFIG_SYS
_SATA1_FLAGS},
#else
{0, 0},
#endif
#ifdef CONFIG_SATA2
#else
{0, 0},
#endif
#ifdef CONFIG_SATA2
- {C
FG_SATA2, CFG
_SATA2_FLAGS},
+ {C
ONFIG_SYS_SATA2, CONFIG_SYS
_SATA2_FLAGS},
#else
{0, 0},
#endif
#else
{0, 0},
#endif
@@
-81,7
+81,7
@@
void dprint_buffer(unsigned char *buf, int len)
printf("\n\r");
}
printf("\n\r");
}
-static void fsl_sata_dump_sfis(struct s
fis
*s)
+static void fsl_sata_dump_sfis(struct s
ata_fis_d2h
*s)
{
printf("Status FIS dump:\n\r");
printf("fis_type: %02x\n\r", s->fis_type);
{
printf("Status FIS dump:\n\r");
printf("fis_type: %02x\n\r", s->fis_type);
@@
-123,7
+123,7
@@
int init_sata(int dev)
int i;
fsl_sata_t *sata;
int i;
fsl_sata_t *sata;
- if (dev < 0 || dev > (C
FG
_SATA_MAX_DEVICE - 1)) {
+ if (dev < 0 || dev > (C
ONFIG_SYS
_SATA_MAX_DEVICE - 1)) {
printf("the sata index %d is out of ranges\n\r", dev);
return -1;
}
printf("the sata index %d is out of ranges\n\r", dev);
return -1;
}
@@
-248,6
+248,10
@@
int init_sata(int dev)
else
printf(" %s ", sata->name);
else
printf(" %s ", sata->name);
+ /* Wait PHY RDY signal changed for 500ms */
+ ata_wait_register(®->hstatus, HSTATUS_PHY_RDY,
+ HSTATUS_PHY_RDY, 500);
+
/* Check PHYRDY */
val32 = in_le32(®->hstatus);
if (val32 & HSTATUS_PHY_RDY) {
/* Check PHYRDY */
val32 = in_le32(®->hstatus);
if (val32 & HSTATUS_PHY_RDY) {
@@
-258,6
+262,10
@@
int init_sata(int dev)
return -1;
}
return -1;
}
+ /* Wait for signature updated, which is 1st D2H */
+ ata_wait_register(®->hstatus, HSTATUS_SIGNATURE,
+ HSTATUS_SIGNATURE, 10000);
+
if (val32 & HSTATUS_SIGNATURE) {
sig = in_le32(®->sig);
debug("Signature updated, the sig =%08x\n\r", sig);
if (val32 & HSTATUS_SIGNATURE) {
sig = in_le32(®->sig);
debug("Signature updated, the sig =%08x\n\r", sig);
@@
-339,7
+347,7
@@
static void fsl_sata_dump_regs(fsl_sata_reg_t *reg)
printf("SYSPR: %08x\n\r", in_be32(®->syspr));
}
printf("SYSPR: %08x\n\r", in_be32(®->syspr));
}
-static int fsl_ata_exec_ata_cmd(struct fsl_sata *sata, struct
cfis
*cfis,
+static int fsl_ata_exec_ata_cmd(struct fsl_sata *sata, struct
sata_fis_h2d
*cfis,
int is_ncq, int tag, u8 *buffer, u32 len)
{
cmd_hdr_entry_t *cmd_hdr;
int is_ncq, int tag, u8 *buffer, u32 len)
{
cmd_hdr_entry_t *cmd_hdr;
@@
-475,7
+483,7
@@
static int fsl_ata_exec_ata_cmd(struct fsl_sata *sata, struct cfis *cfis,
if (val32) {
u32 der;
if (val32) {
u32 der;
- fsl_sata_dump_sfis((struct s
fis
*)cmd_desc->sfis);
+ fsl_sata_dump_sfis((struct s
ata_fis_d2h
*)cmd_desc->sfis);
printf("CE at device\n\r");
fsl_sata_dump_regs(reg);
der = in_le32(®->der);
printf("CE at device\n\r");
fsl_sata_dump_regs(reg);
der = in_le32(®->der);
@@
-490,19
+498,19
@@
static int fsl_ata_exec_ata_cmd(struct fsl_sata *sata, struct cfis *cfis,
return len;
}
return len;
}
-static int fsl_ata_exec_reset_cmd(struct fsl_sata *sata, struct
cfis
*cfis,
+static int fsl_ata_exec_reset_cmd(struct fsl_sata *sata, struct
sata_fis_h2d
*cfis,
int tag, u8 *buffer, u32 len)
{
return 0;
}
int tag, u8 *buffer, u32 len)
{
return 0;
}
-static int fsl_sata_exec_cmd(struct fsl_sata *sata, struct
cfis
*cfis,
+static int fsl_sata_exec_cmd(struct fsl_sata *sata, struct
sata_fis_h2d
*cfis,
enum cmd_type command_type, int tag, u8 *buffer, u32 len)
{
int rc;
if (tag > SATA_HC_MAX_CMD || tag < 0) {
enum cmd_type command_type, int tag, u8 *buffer, u32 len)
{
int rc;
if (tag > SATA_HC_MAX_CMD || tag < 0) {
- printf("tag is out of range, tag=\n\r", tag);
+ printf("tag is out of range, tag=
%d
\n\r", tag);
return -1;
}
return -1;
}
@@
-531,11
+539,9
@@
static int fsl_sata_exec_cmd(struct fsl_sata *sata, struct cfis *cfis,
static void fsl_sata_identify(int dev, u16 *id)
{
fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
static void fsl_sata_identify(int dev, u16 *id)
{
fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
- struct sata_fis_h2d h2d;
- struct cfis *cfis;
+ struct sata_fis_h2d h2d, *cfis = &h2d;
- cfis = (struct cfis *)&h2d;
- memset((void *)cfis, 0, sizeof(struct cfis));
+ memset(cfis, 0, sizeof(struct sata_fis_h2d));
cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
cfis->pm_port_c = 0x80; /* is command */
cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
cfis->pm_port_c = 0x80; /* is command */
@@
-558,12
+564,10
@@
static void fsl_sata_xfer_mode(int dev, u16 *id)
static void fsl_sata_set_features(int dev)
{
fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
static void fsl_sata_set_features(int dev)
{
fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
- struct sata_fis_h2d h2d;
- struct cfis *cfis;
+ struct sata_fis_h2d h2d, *cfis = &h2d;
u8 udma_cap;
u8 udma_cap;
- cfis = (struct cfis *)&h2d;
- memset((void *)cfis, 0, sizeof(struct cfis));
+ memset(cfis, 0, sizeof(struct sata_fis_h2d));
cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
cfis->pm_port_c = 0x80; /* is command */
cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
cfis->pm_port_c = 0x80; /* is command */
@@
-589,14
+593,12
@@
static void fsl_sata_set_features(int dev)
static u32 fsl_sata_rw_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_write)
{
fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
static u32 fsl_sata_rw_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_write)
{
fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
- struct sata_fis_h2d h2d;
- struct cfis *cfis;
+ struct sata_fis_h2d h2d, *cfis = &h2d;
u32 block;
block = start;
u32 block;
block = start;
- cfis = (struct cfis *)&h2d;
- memset(
(void *)cfis, 0, sizeof(struct cfis
));
+ memset(
cfis, 0, sizeof(struct sata_fis_h2d
));
cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
cfis->pm_port_c = 0x80; /* is command */
cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
cfis->pm_port_c = 0x80; /* is command */
@@
-616,12
+618,9
@@
static u32 fsl_sata_rw_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_wr
void fsl_sata_flush_cache(int dev)
{
fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
void fsl_sata_flush_cache(int dev)
{
fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
- struct sata_fis_h2d h2d;
- struct cfis *cfis;
+ struct sata_fis_h2d h2d, *cfis = &h2d;
- cfis = (struct cfis *)&h2d;
-
- memset((void *)cfis, 0, sizeof(struct cfis));
+ memset(cfis, 0, sizeof(struct sata_fis_h2d));
cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
cfis->pm_port_c = 0x80; /* is command */
cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
cfis->pm_port_c = 0x80; /* is command */
@@
-633,14
+632,12
@@
void fsl_sata_flush_cache(int dev)
static u32 fsl_sata_rw_cmd_ext(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_write)
{
fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
static u32 fsl_sata_rw_cmd_ext(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_write)
{
fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
- struct sata_fis_h2d h2d;
- struct cfis *cfis;
+ struct sata_fis_h2d h2d, *cfis = &h2d;
u64 block;
block = (u64)start;
u64 block;
block = (u64)start;
- cfis = (struct cfis *)&h2d;
- memset(
(void *)cfis, 0, sizeof(struct cfis
));
+ memset(
cfis, 0, sizeof(struct sata_fis_h2d
));
cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
cfis->pm_port_c = 0x80; /* is command */
cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
cfis->pm_port_c = 0x80; /* is command */
@@
-665,8
+662,7
@@
static u32 fsl_sata_rw_cmd_ext(int dev, u32 start, u32 blkcnt, u8 *buffer, int i
u32 fsl_sata_rw_ncq_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_write)
{
fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
u32 fsl_sata_rw_ncq_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_write)
{
fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
- struct sata_fis_h2d h2d;
- struct cfis *cfis;
+ struct sata_fis_h2d h2d, *cfis = &h2d;
int ncq_channel;
u64 block;
int ncq_channel;
u64 block;
@@
-676,9
+672,8
@@
u32 fsl_sata_rw_ncq_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_write
}
block = (u64)start;
}
block = (u64)start;
- cfis = (struct cfis *)&h2d;
- memset(
(void *)cfis, 0, sizeof(struct cfis
));
+ memset(
cfis, 0, sizeof(struct sata_fis_h2d
));
cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
cfis->pm_port_c = 0x80; /* is command */
cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
cfis->pm_port_c = 0x80; /* is command */
@@
-710,12
+705,9
@@
u32 fsl_sata_rw_ncq_cmd(int dev, u32 start, u32 blkcnt, u8 *buffer, int is_write
void fsl_sata_flush_cache_ext(int dev)
{
fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
void fsl_sata_flush_cache_ext(int dev)
{
fsl_sata_t *sata = (fsl_sata_t *)sata_dev_desc[dev].priv;
- struct sata_fis_h2d h2d;
- struct cfis *cfis;
-
- cfis = (struct cfis *)&h2d;
+ struct sata_fis_h2d h2d, *cfis = &h2d;
- memset(
(void *)cfis, 0, sizeof(struct cfis
));
+ memset(
cfis, 0, sizeof(struct sata_fis_h2d
));
cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
cfis->pm_port_c = 0x80; /* is command */
cfis->fis_type = SATA_FIS_TYPE_REGISTER_H2D;
cfis->pm_port_c = 0x80; /* is command */