From ba2c05a72faf66fd23063cf066d8500539eb4e1c Mon Sep 17 00:00:00 2001 From: Srikanth Srinivasan Date: Wed, 6 Jan 2010 15:04:49 +0800 Subject: fixed for sata errata On P1022, the data snoop bit (in the sata ip) is at bit 28. Account for this. Additionally, change the mode to enterprise mode since on reset, it is in legacy mode. Signed-off-by: Srikanth Srinivasan --- board/freescale/p1022ds/p1022ds.c | 12 ++++++++++++ drivers/block/fsl_sata.h | 6 +++++- include/configs/P1022DS.h | 8 ++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/board/freescale/p1022ds/p1022ds.c b/board/freescale/p1022ds/p1022ds.c index 1cc04f4ca5..39c441009e 100644 --- a/board/freescale/p1022ds/p1022ds.c +++ b/board/freescale/p1022ds/p1022ds.c @@ -183,6 +183,8 @@ phys_size_t fixed_sdram(void) int misc_init_r(void) { u8 tmp_val; + fsl_sata_reg_t *sata1_reg = (fsl_sata_reg_t *)CONFIG_SYS_MPC85xx_SATA1_ADDR; + fsl_sata_reg_t *sata2_reg = (fsl_sata_reg_t *)CONFIG_SYS_MPC85xx_SATA2_ADDR; /* Enable the TFP410 Encoder (I2C address 0x38) */ @@ -207,6 +209,16 @@ int misc_init_r(void) /* p1022ds_diu_init(); */ /* #endif */ + /* Changing the SATA controller to operate in enterprise mode + * By default, on Rev 1, it comes up in "legacy" mode. + */ +#ifdef CONFIG_P1022_LEGACY_ERRATUM_WORKAROUND + out_le32(&sata1_reg->hstatus, 0x20000000); + out_le32(&sata1_reg->hcontrol, 0x00000100); + out_le32(&sata2_reg->hstatus, 0x20000000); + out_le32(&sata2_reg->hcontrol, 0x00000100); +#endif + return 0; } diff --git a/drivers/block/fsl_sata.h b/drivers/block/fsl_sata.h index 18e88fa4ad..7e236d36f8 100644 --- a/drivers/block/fsl_sata.h +++ b/drivers/block/fsl_sata.h @@ -244,7 +244,11 @@ typedef struct prd_entry { /* ext_c_ddc */ #define PRD_ENTRY_EXT 0x80000000 /* extension flag or called indirect descriptor flag */ -#define PRD_ENTRY_DATA_SNOOP 0x00400000 /* Snoop enable for all data associated with the PRD entry */ +#ifdef CONFIG_P1022_SATA_SNOOP_BIT_SHIFTED +#define PRD_ENTRY_DATA_SNOOP 0x10000000 /* Snoop enable for all data associated with the PRD entry */ +#else +#define PRD_ENTRY_DATA_SNOOP 0x00400000 /* Snoop enable for all data associated with the PRD entry */ +#endif #define PRD_ENTRY_LEN_MASK 0x003fffff /* Data word count */ #define PRD_ENTRY_MAX_XFER_SZ (PRD_ENTRY_LEN_MASK + 1) diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h index 447f32904e..4fc39be3d3 100644 --- a/include/configs/P1022DS.h +++ b/include/configs/P1022DS.h @@ -531,6 +531,14 @@ extern unsigned long calculate_board_ddr_clk(unsigned long dummy); #define CONFIG_SYS_SATA2 CONFIG_SYS_MPC85xx_SATA2_ADDR #define CONFIG_SYS_SATA2_FLAGS FLAGS_DMA +/* Change from legacy to enterprise mode */ +#define CONFIG_P1022_LEGACY_ERRATUM_WORKAROUND 1 + +/* In Rev 2.0 of SATA IP, the DATA SNOOP bit is 28 instead of 22 + * in older revs. Not sure if this will be listed as an erratum. + */ +#define CONFIG_P1022_SATA_SNOOP_BIT_SHIFTED 1 + #ifdef CONFIG_FSL_SATA #define CONFIG_LBA48 #define CONFIG_CMD_SATA -- cgit v1.2.3