[U-Boot] [PATCH v1 1/2] fsl_sata: Add the workaround for errata SATA-A001

After power on, the SATA host controller of P1022 Rev1 is configured in legacy mode instead of the expected enterprise mode.
Software needs to clear bit[28] of HControl register to change to enterprise mode after bringing the host offline.
Signed-off-by: Dave Liu daveliu@freescale.com --- * address Kumar's comments
drivers/block/fsl_sata.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/drivers/block/fsl_sata.c b/drivers/block/fsl_sata.c index abcda6f..896b2e6 100644 --- a/drivers/block/fsl_sata.c +++ b/drivers/block/fsl_sata.c @@ -21,6 +21,7 @@ #include <common.h> #include <command.h> #include <asm/io.h> +#include <asm/processor.h> #include <malloc.h> #include <libata.h> #include <fis.h> @@ -191,6 +192,24 @@ int init_sata(int dev) /* Wait the controller offline */ ata_wait_register(®->hstatus, HSTATUS_ONOFF, 0, 1000);
+#if defined(CONFIG_FSL_SATA_V2) && defined(CONFIG_FSL_SATA_ERRATUM_A001) + /* For P1022/1013 Rev1.0 silicon, after power on SATA host + * controller is configured in legacy mode instead of + * the expected enterprise mode. software needs to clear + * bit[28] of HControl register to change to enterprise + * mode from legacy mode. + */ + u32 svr = get_svr(); + if (IS_SVR_REV(svr, 1, 0) && + ((SVR_SOC_VER(svr) == SVR_P1022) || + (SVR_SOC_VER(svr) == SVR_P1022_E) || + (SVR_SOC_VER(svr) == SVR_P1013) || + (SVR_SOC_VER(svr) == SVR_P1013_E))) { + out_le32(®->hstatus, 0x20000000); + out_le32(®->hcontrol, 0x00000100); + } +#endif + /* Set the command header base address to CHBA register to tell DMA */ out_le32(®->chba, (u32)cmd_hdr & ~0x3);

On Thu, Apr 8, 2010 at 6:32 PM, Dave Liu daveliu@freescale.com wrote:
+#if defined(CONFIG_FSL_SATA_V2) && defined(CONFIG_FSL_SATA_ERRATUM_A001)
Is there ever a situation where CONFIG_FSL_SATA_ERRATUM_A001 is defined but CONFIG_FSL_SATA_V2 is not defined?

On Apr 8, 2010, at 8:15 PM, Timur Tabi wrote:
On Thu, Apr 8, 2010 at 6:32 PM, Dave Liu daveliu@freescale.com wrote:
+#if defined(CONFIG_FSL_SATA_V2) && defined(CONFIG_FSL_SATA_ERRATUM_A001)
Is there ever a situation where CONFIG_FSL_SATA_ERRATUM_A001 is defined but CONFIG_FSL_SATA_V2 is not defined?
No, but I want to be explicit about it in the code.. so we'll leave it as is.
- k

On Apr 8, 2010, at 6:32 PM, Dave Liu wrote:
After power on, the SATA host controller of P1022 Rev1 is configured in legacy mode instead of the expected enterprise mode.
Software needs to clear bit[28] of HControl register to change to enterprise mode after bringing the host offline.
Signed-off-by: Dave Liu daveliu@freescale.com
- address Kumar's comments
drivers/block/fsl_sata.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/drivers/block/fsl_sata.c b/drivers/block/fsl_sata.c index abcda6f..896b2e6 100644 --- a/drivers/block/fsl_sata.c +++ b/drivers/block/fsl_sata.c @@ -21,6 +21,7 @@ #include <common.h> #include <command.h> #include <asm/io.h> +#include <asm/processor.h> #include <malloc.h> #include <libata.h> #include <fis.h> @@ -191,6 +192,24 @@ int init_sata(int dev) /* Wait the controller offline */ ata_wait_register(®->hstatus, HSTATUS_ONOFF, 0, 1000);
+#if defined(CONFIG_FSL_SATA_V2) && defined(CONFIG_FSL_SATA_ERRATUM_A001)
- /* For P1022/1013 Rev1.0 silicon, after power on SATA host
* controller is configured in legacy mode instead of
* the expected enterprise mode. software needs to clear
* bit[28] of HControl register to change to enterprise
* mode from legacy mode.
*/
Add
{
- u32 svr = get_svr();
- if (IS_SVR_REV(svr, 1, 0) &&
((SVR_SOC_VER(svr) == SVR_P1022) ||
(SVR_SOC_VER(svr) == SVR_P1022_E) ||
(SVR_SOC_VER(svr) == SVR_P1013) ||
(SVR_SOC_VER(svr) == SVR_P1013_E))) {
out_le32(®->hstatus, 0x20000000);
out_le32(®->hcontrol, 0x00000100);
- }
}
+#endif
- /* Set the command header base address to CHBA register to tell DMA */ out_le32(®->chba, (u32)cmd_hdr & ~0x3);
-- 1.6.4

Dear Dave Liu,
In message 1270769522-27230-1-git-send-email-daveliu@freescale.com you wrote:
After power on, the SATA host controller of P1022 Rev1 is configured in legacy mode instead of the expected enterprise mode.
Software needs to clear bit[28] of HControl register to change to enterprise mode after bringing the host offline.
Signed-off-by: Dave Liu daveliu@freescale.com
...
+#if defined(CONFIG_FSL_SATA_V2) && defined(CONFIG_FSL_SATA_ERRATUM_A001)
- /* For P1022/1013 Rev1.0 silicon, after power on SATA host
* controller is configured in legacy mode instead of
* the expected enterprise mode. software needs to clear
* bit[28] of HControl register to change to enterprise
* mode from legacy mode.
*/
Incorrect multiline comment style.
participants (4)
-
Dave Liu
-
Kumar Gala
-
Timur Tabi
-
Wolfgang Denk