From patchwork Fri Sep 26 04:37:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Qiang X-Patchwork-Id: 393516 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 9418214013F for ; Fri, 26 Sep 2014 14:54:35 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 92B2A4A036; Fri, 26 Sep 2014 06:54:31 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KumGjhL8fRBL; Fri, 26 Sep 2014 06:54:31 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 218AE4A02A; Fri, 26 Sep 2014 06:54:27 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 754884A02A for ; Fri, 26 Sep 2014 06:54:19 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fEiD+6Ju80JO for ; Fri, 26 Sep 2014 06:54:15 +0200 (CEST) X-Greylist: delayed 81923 seconds by postgrey-1.27 at theia; Fri, 26 Sep 2014 06:54:12 CEST X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bon0136.outbound.protection.outlook.com [157.56.111.136]) by theia.denx.de (Postfix) with ESMTPS id 59D124A029 for ; Fri, 26 Sep 2014 06:54:11 +0200 (CEST) Received: from DM2PR03CA0053.namprd03.prod.outlook.com (10.141.96.52) by BLUPR03MB344.namprd03.prod.outlook.com (10.141.48.24) with Microsoft SMTP Server (TLS) id 15.0.1044.7; Fri, 26 Sep 2014 04:37:58 +0000 Received: from BN1AFFO11FD057.protection.gbl (2a01:111:f400:7c10::124) by DM2PR03CA0053.outlook.office365.com (2a01:111:e400:2428::52) with Microsoft SMTP Server (TLS) id 15.0.1024.12 via Frontend Transport; Fri, 26 Sep 2014 04:37:58 +0000 Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD057.mail.protection.outlook.com (10.58.53.72) with Microsoft SMTP Server (TLS) id 15.0.1029.15 via Frontend Transport; Fri, 26 Sep 2014 04:37:57 +0000 Received: from titan.ap.freescale.net ([10.192.208.233]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s8Q4boaL002293; Thu, 25 Sep 2014 21:37:55 -0700 From: Zhao Qiang To: , Date: Fri, 26 Sep 2014 12:37:35 +0800 Message-ID: <1411706256-33037-1-git-send-email-B45475@freescale.com> X-Mailer: git-send-email 2.1.0.27.g96db324 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(199003)(189002)(81156004)(92726001)(97736003)(84676001)(50226001)(36756003)(575784001)(106466001)(93916002)(50466002)(92566001)(87936001)(229853001)(46102003)(69596002)(81342003)(74662003)(80022003)(77982003)(68736004)(107046002)(79102003)(81542003)(104166001)(90102001)(4396001)(74502003)(77156001)(120916001)(83072002)(99396003)(89996001)(50986999)(85852003)(102836001)(76482002)(10300001)(21056001)(85306004)(6806004)(64706001)(48376002)(88136002)(47776003)(44976005)(20776003)(104016003)(83322001)(62966002)(19580405001)(87286001)(31966008)(19580395003)(95666004)(105606002)(42262002); DIR:OUT; SFP:1102; SCL:1; SRVR:BLUPR03MB344; H:az84smr01.freescale.net; FPR:; MLV:sfv; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BLUPR03MB344; X-Forefront-PRVS: 03468CBA43 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=qiang.zhao@freescale.com; X-OriginatorOrg: freescale.com Cc: Zhao Qiang , R63061@freescale.com Subject: [U-Boot] [PATCH 1/2] powerpc/mpc85xx: modify erratum A007186 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de T2080 v1.0 has this errata while v1.1 has fixed this errata by hardware, add a new function to check the SVR_SOC_VER, SVR_MAJ and SVR_MIN first, if the cpu is T2080 and version is not v1.0, doesn't run the a007186 errata_workaround. Signed-off-by: Zhao Qiang --- arch/powerpc/cpu/mpc85xx/cmd_errata.c | 3 +- arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c | 210 ++++++++++++++----------- arch/powerpc/include/asm/fsl_errata.h | 14 ++ 3 files changed, 130 insertions(+), 97 deletions(-) diff --git a/arch/powerpc/cpu/mpc85xx/cmd_errata.c b/arch/powerpc/cpu/mpc85xx/cmd_errata.c index 3a04a89..741eb63 100644 --- a/arch/powerpc/cpu/mpc85xx/cmd_errata.c +++ b/arch/powerpc/cpu/mpc85xx/cmd_errata.c @@ -270,7 +270,8 @@ static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) puts("Work-around for Erratum USB14 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A007186 - puts("Work-around for Erratum A007186 enabled\n"); + if (!not_has_erratum_a007186()) + puts("Work-around for Erratum A007186 enabled\n"); #endif #ifdef CONFIG_SYS_FSL_ERRATUM_A006593 puts("Work-around for Erratum A006593 enabled\n"); diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c b/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c index d1fc76a..9b0a538 100644 --- a/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c +++ b/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "fsl_corenet2_serdes.h" #ifdef CONFIG_SYS_FSL_SRDS_1 @@ -203,108 +204,125 @@ u64 serdes_init(u32 sd, u32 sd_addr, u32 sd_prctl_mask, u32 sd_prctl_shift) * This workaround for the protocols and rates that only have the Ring VCO. */ #ifdef CONFIG_SYS_FSL_ERRATUM_A007186 - sfp_spfr0 = in_be32(&sfp_regs->fsl_spfr0); - debug("A007186: sfp_spfr0= %x\n", sfp_spfr0); + if (!not_has_erratum_a007186()) { + sfp_spfr0 = in_be32(&sfp_regs->fsl_spfr0); + debug("A007186: sfp_spfr0= %x\n", sfp_spfr0); - sel = (sfp_spfr0 >> FUSE_VAL_SHIFT) & FUSE_VAL_MASK; + sel = (sfp_spfr0 >> FUSE_VAL_SHIFT) & FUSE_VAL_MASK; - if (sel == 0x01 || sel == 0x02) { - for (pll_num = 0; pll_num < SRDS_MAX_BANK; pll_num++) { - pll_status = in_be32(&srds_regs->bank[pll_num].pllcr0); - debug("A007186: pll_num=%x pllcr0=%x\n", - pll_num, pll_status); - /* STEP 1 */ - /* Read factory pre-set SerDes calibration values - * from fuse block(SFP scratch register-sfp_spfr0) - */ - switch (pll_status & SRDS_PLLCR0_FRATE_SEL_MASK) { - case SRDS_PLLCR0_FRATE_SEL_3_0: - case SRDS_PLLCR0_FRATE_SEL_3_072: - debug("A007186: 3.0/3.072 protocol rate\n"); - bc = (sfp_spfr0 >> BC1_SHIFT) & BC_MASK; - dc = (sfp_spfr0 >> DC1_SHIFT) & DC_MASK; - fc = (sfp_spfr0 >> FC1_SHIFT) & FC_MASK; - break; - case SRDS_PLLCR0_FRATE_SEL_3_125: - debug("A007186: 3.125 protocol rate\n"); - bc = (sfp_spfr0 >> BC2_SHIFT) & BC_MASK; - dc = (sfp_spfr0 >> DC2_SHIFT) & DC_MASK; - fc = (sfp_spfr0 >> FC2_SHIFT) & FC_MASK; - break; - case SRDS_PLLCR0_FRATE_SEL_3_75: - debug("A007186: 3.75 protocol rate\n"); - bc = (sfp_spfr0 >> BC1_SHIFT) & BC_MASK; - dc = (sfp_spfr0 >> DC1_SHIFT) & DC_MASK; - fc = (sfp_spfr0 >> FC1_SHIFT) & FC_MASK; - break; - default: - continue; - } + if (sel == 0x01 || sel == 0x02) { + for (pll_num = 0; pll_num < SRDS_MAX_BANK; pll_num++) { + pll_status = in_be32(&srds_regs-> + bank[pll_num].pllcr0); + debug("A007186: pll_num=%x pllcr0=%x\n", + pll_num, pll_status); + /* STEP 1 */ + /* Read factory pre-set SerDes calibration + * values from fuse block(SFP scratch + * register-sfp_spfr0) + */ + switch (pll_status & + SRDS_PLLCR0_FRATE_SEL_MASK) { + case SRDS_PLLCR0_FRATE_SEL_3_0: + case SRDS_PLLCR0_FRATE_SEL_3_072: + debug("A007186: "); + debug("3.0/3.072 protocol rate\n"); + bc = (sfp_spfr0 >> BC1_SHIFT) & BC_MASK; + dc = (sfp_spfr0 >> DC1_SHIFT) & DC_MASK; + fc = (sfp_spfr0 >> FC1_SHIFT) & FC_MASK; + break; + case SRDS_PLLCR0_FRATE_SEL_3_125: + debug("A007186: 3.125 protocol rate\n"); + bc = (sfp_spfr0 >> BC2_SHIFT) & BC_MASK; + dc = (sfp_spfr0 >> DC2_SHIFT) & DC_MASK; + fc = (sfp_spfr0 >> FC2_SHIFT) & FC_MASK; + break; + case SRDS_PLLCR0_FRATE_SEL_3_75: + debug("A007186: 3.75 protocol rate\n"); + bc = (sfp_spfr0 >> BC1_SHIFT) & BC_MASK; + dc = (sfp_spfr0 >> DC1_SHIFT) & DC_MASK; + fc = (sfp_spfr0 >> FC1_SHIFT) & FC_MASK; + break; + default: + continue; + } - /* STEP 2 */ - /* Write SRDSxPLLnCR1[11:16] = FC - * Write SRDSxPLLnCR1[2] = BC - */ - pll_cr1 = in_be32(&srds_regs->bank[pll_num].pllcr1); - pll_cr_upd = (((bc << CR1_BCAP_SHIFT) & BCAP_MASK) | - ((fc << CR1_FCAP_SHIFT) & FCAP_MASK)); - out_be32(&srds_regs->bank[pll_num].pllcr1, - (pll_cr_upd | pll_cr1)); - debug("A007186: pll_num=%x Updated PLLCR1=%x\n", - pll_num, (pll_cr_upd | pll_cr1)); - /* Write SRDSxPLLnCR0[24:26] = DC - */ - pll_cr0 = in_be32(&srds_regs->bank[pll_num].pllcr0); - out_be32(&srds_regs->bank[pll_num].pllcr0, - pll_cr0 | (dc << CR0_DCBIAS_SHIFT)); - debug("A007186: pll_num=%x, Updated PLLCR0=%x\n", - pll_num, (pll_cr0 | (dc << CR0_DCBIAS_SHIFT))); - /* Write SRDSxPLLnCR1[3] = 1 - * Write SRDSxPLLnCR1[6] = 1 - */ - pll_cr1 = in_be32(&srds_regs->bank[pll_num].pllcr1); - pll_cr_upd = (BCAP_OVD_MASK | BYP_CAL_MASK); - out_be32(&srds_regs->bank[pll_num].pllcr1, - (pll_cr_upd | pll_cr1)); - debug("A007186: pll_num=%x Updated PLLCR1=%x\n", - pll_num, (pll_cr_upd | pll_cr1)); + /* STEP 2 */ + /* Write SRDSxPLLnCR1[11:16] = FC + * Write SRDSxPLLnCR1[2] = BC + */ + pll_cr1 = in_be32(&srds_regs-> + bank[pll_num].pllcr1); + pll_cr_upd = (((bc << CR1_BCAP_SHIFT) & + BCAP_MASK) | + ((fc << CR1_FCAP_SHIFT) & + FCAP_MASK)); + out_be32(&srds_regs->bank[pll_num].pllcr1, + (pll_cr_upd | pll_cr1)); + debug("A007186: pll_num=%x Updated PLLCR1=%x\n", + pll_num, (pll_cr_upd | pll_cr1)); + /* Write SRDSxPLLnCR0[24:26] = DC + */ + pll_cr0 = in_be32(&srds_regs-> + bank[pll_num].pllcr0); + out_be32(&srds_regs->bank[pll_num].pllcr0, + pll_cr0 | (dc << CR0_DCBIAS_SHIFT)); + debug("A007186: pll_num=%x, Update PLLCR0=%x\n", + pll_num, + (pll_cr0 | (dc << CR0_DCBIAS_SHIFT))); + /* Write SRDSxPLLnCR1[3] = 1 + * Write SRDSxPLLnCR1[6] = 1 + */ + pll_cr1 = in_be32(&srds_regs-> + bank[pll_num].pllcr1); + pll_cr_upd = (BCAP_OVD_MASK | BYP_CAL_MASK); + out_be32(&srds_regs->bank[pll_num].pllcr1, + (pll_cr_upd | pll_cr1)); + debug("A007186: pll_num=%x Updated PLLCR1=%x\n", + pll_num, (pll_cr_upd | pll_cr1)); - /* STEP 3 */ - /* Read the status Registers */ - /* Verify SRDSxPLLnSR2[8] = BC */ - pll_sr2 = in_be32(&srds_regs->bank[pll_num].pllsr2); - debug("A007186: pll_num=%x pllsr2=%x\n", - pll_num, pll_sr2); - bc_status = (pll_sr2 >> 23) & BC_MASK; - if (bc_status != bc) - debug("BC mismatch\n"); - fc_status = (pll_sr2 >> 16) & FC_MASK; - if (fc_status != fc) - debug("FC mismatch\n"); - pll_cr0 = in_be32(&srds_regs->bank[pll_num].pllcr0); - out_be32(&srds_regs->bank[pll_num].pllcr0, pll_cr0 | - 0x02000000); - pll_sr2 = in_be32(&srds_regs->bank[pll_num].pllsr2); - dc_status = (pll_sr2 >> 17) & DC_MASK; - if (dc_status != dc) - debug("DC mismatch\n"); - pll_cr0 = in_be32(&srds_regs->bank[pll_num].pllcr0); - out_be32(&srds_regs->bank[pll_num].pllcr0, pll_cr0 & - 0xfdffffff); + /* STEP 3 */ + /* Read the status Registers */ + /* Verify SRDSxPLLnSR2[8] = BC */ + pll_sr2 = in_be32(&srds_regs-> + bank[pll_num].pllsr2); + debug("A007186: pll_num=%x pllsr2=%x\n", + pll_num, pll_sr2); + bc_status = (pll_sr2 >> 23) & BC_MASK; + if (bc_status != bc) + debug("BC mismatch\n"); + fc_status = (pll_sr2 >> 16) & FC_MASK; + if (fc_status != fc) + debug("FC mismatch\n"); + pll_cr0 = in_be32(&srds_regs-> + bank[pll_num].pllcr0); + out_be32(&srds_regs->bank[pll_num].pllcr0, + pll_cr0 | 0x02000000); + pll_sr2 = in_be32(&srds_regs-> + bank[pll_num].pllsr2); + dc_status = (pll_sr2 >> 17) & DC_MASK; + if (dc_status != dc) + debug("DC mismatch\n"); + pll_cr0 = in_be32(&srds_regs-> + bank[pll_num].pllcr0); + out_be32(&srds_regs->bank[pll_num].pllcr0, + pll_cr0 & 0xfdffffff); - /* STEP 4 */ - /* Wait 750us to verify the PLL is locked - * by checking SRDSxPLLnCR0[8] = 1. - */ - udelay(750); - pll_status = in_be32(&srds_regs->bank[pll_num].pllcr0); - debug("A007186: pll_num=%x pllcr0=%x\n", - pll_num, pll_status); + /* STEP 4 */ + /* Wait 750us to verify the PLL is locked + * by checking SRDSxPLLnCR0[8] = 1. + */ + udelay(750); + pll_status = in_be32(&srds_regs-> + bank[pll_num].pllcr0); + debug("A007186: pll_num=%x pllcr0=%x\n", + pll_num, pll_status); - if ((pll_status & SRDS_PLLCR0_PLL_LCK) == 0) - printf("A007186 Serdes PLL not locked\n"); - else - debug("A007186 Serdes PLL locked\n"); + if ((pll_status & SRDS_PLLCR0_PLL_LCK) == 0) + debug("A007186 Serdes PLL not lock\n"); + else + debug("A007186 Serdes PLL lock\n"); + } } } #endif diff --git a/arch/powerpc/include/asm/fsl_errata.h b/arch/powerpc/include/asm/fsl_errata.h index 64da4bb..a977544 100644 --- a/arch/powerpc/include/asm/fsl_errata.h +++ b/arch/powerpc/include/asm/fsl_errata.h @@ -82,3 +82,17 @@ static inline bool has_erratum_a007075(void) return false; } #endif + +#ifdef CONFIG_SYS_FSL_ERRATUM_A007186 +static inline bool not_has_erratum_a007186(void) +{ + u32 svr = get_svr(); + u32 soc = SVR_SOC_VER(svr); + + if (((soc == SVR_T2080) && (SVR_MAJ(svr) > 1)) || + ((soc == SVR_T2080) && (SVR_MAJ(svr) == 1) && (SVR_MIN(svr) > 0))) + return true; + + return false; +} +#endif