@@ -636,11 +636,12 @@ extern u32 at91_pm_suspend_in_sram_sz;
636636
637637static int at91_suspend_finish (unsigned long val )
638638{
639- unsigned char modified_gray_code [] = {
640- 0x00 , 0x01 , 0x02 , 0x03 , 0x06 , 0x07 , 0x04 , 0x05 , 0x0c , 0x0d ,
641- 0x0e , 0x0f , 0x0a , 0x0b , 0x08 , 0x09 , 0x18 , 0x19 , 0x1a , 0x1b ,
642- 0x1e , 0x1f , 0x1c , 0x1d , 0x14 , 0x15 , 0x16 , 0x17 , 0x12 , 0x13 ,
643- 0x10 , 0x11 ,
639+ /* SYNOPSYS workaround to fix a bug in the calibration logic (SYNOPSYS Case Number 01331341) */
640+ unsigned char modified_fix_code [] = {
641+ 0x00 , 0x01 , 0x01 , 0x06 , 0x07 , 0x0c , 0x06 , 0x07 , 0x0b , 0x18 ,
642+ 0x0a , 0x0b , 0x0c , 0x0d , 0x0d , 0x0a , 0x13 , 0x13 , 0x12 , 0x13 ,
643+ 0x14 , 0x15 , 0x15 , 0x12 , 0x18 , 0x19 , 0x19 , 0x1e , 0x1f , 0x14 ,
644+ 0x1e , 0x1f ,
644645 };
645646 unsigned int tmp , index ;
646647 int i ;
@@ -651,25 +652,25 @@ static int at91_suspend_finish(unsigned long val)
651652 * restore the ZQ0SR0 with the value saved here. But the
652653 * calibration is buggy and restoring some values from ZQ0SR0
653654 * is forbidden and risky thus we need to provide processed
654- * values for these (modified gray code values) .
655+ * values for these.
655656 */
656657 tmp = readl (soc_pm .data .ramc_phy + DDR3PHY_ZQ0SR0 );
657658
658659 /* Store pull-down output impedance select. */
659660 index = (tmp >> DDR3PHY_ZQ0SR0_PDO_OFF ) & 0x1f ;
660- soc_pm .bu -> ddr_phy_calibration [0 ] = modified_gray_code [index ];
661+ soc_pm .bu -> ddr_phy_calibration [0 ] = modified_fix_code [index ] << DDR3PHY_ZQ0SR0_PDO_OFF ;
661662
662663 /* Store pull-up output impedance select. */
663664 index = (tmp >> DDR3PHY_ZQ0SR0_PUO_OFF ) & 0x1f ;
664- soc_pm .bu -> ddr_phy_calibration [0 ] |= modified_gray_code [index ];
665+ soc_pm .bu -> ddr_phy_calibration [0 ] |= modified_fix_code [index ] << DDR3PHY_ZQ0SR0_PUO_OFF ;
665666
666667 /* Store pull-down on-die termination impedance select. */
667668 index = (tmp >> DDR3PHY_ZQ0SR0_PDODT_OFF ) & 0x1f ;
668- soc_pm .bu -> ddr_phy_calibration [0 ] |= modified_gray_code [index ];
669+ soc_pm .bu -> ddr_phy_calibration [0 ] |= modified_fix_code [index ] << DDR3PHY_ZQ0SR0_PDODT_OFF ;
669670
670671 /* Store pull-up on-die termination impedance select. */
671672 index = (tmp >> DDR3PHY_ZQ0SRO_PUODT_OFF ) & 0x1f ;
672- soc_pm .bu -> ddr_phy_calibration [0 ] |= modified_gray_code [index ];
673+ soc_pm .bu -> ddr_phy_calibration [0 ] |= modified_fix_code [index ] << DDR3PHY_ZQ0SRO_PUODT_OFF ;
673674
674675 /*
675676 * The 1st 8 words of memory might get corrupted in the process
0 commit comments