From patchwork Mon Jul 8 02:12:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Haijun.Zhang" X-Patchwork-Id: 257459 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 3E8312C030F for ; Mon, 8 Jul 2013 13:04:05 +1000 (EST) Received: from db9outboundpool.messaging.microsoft.com (mail-db9lp0251.outbound.messaging.microsoft.com [213.199.154.251]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client CN "mail.global.frontbridge.com", Issuer "MSIT Machine Auth CA 2" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 8CF6C2C0099 for ; Mon, 8 Jul 2013 13:02:15 +1000 (EST) Received: from mail226-DB9-R.bigfish.com (10.174.16.242) by DB9EHSOBE029.bigfish.com (10.174.14.92) with Microsoft SMTP Server id 14.1.225.22; Mon, 8 Jul 2013 03:02:09 +0000 Received: from mail226-DB9 (localhost [127.0.0.1]) by mail226-DB9-R.bigfish.com (Postfix) with ESMTP id E0ADA2400C8; Mon, 8 Jul 2013 03:02:09 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 3 X-BigFish: VS3(zzc8kzz1f42h1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzz8275bhz2dh2a8h668h839he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e23h1155h) Received: from mail226-DB9 (localhost.localdomain [127.0.0.1]) by mail226-DB9 (MessageSwitch) id 1373252527993022_3327; Mon, 8 Jul 2013 03:02:07 +0000 (UTC) Received: from DB9EHSMHS010.bigfish.com (unknown [10.174.16.235]) by mail226-DB9.bigfish.com (Postfix) with ESMTP id E4FCE3E0046; Mon, 8 Jul 2013 03:02:07 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB9EHSMHS010.bigfish.com (10.174.14.20) with Microsoft SMTP Server (TLS) id 14.16.227.3; Mon, 8 Jul 2013 03:02:07 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-004.039d.mgd.msft.net (10.84.1.14) with Microsoft SMTP Server (TLS) id 14.3.136.1; Mon, 8 Jul 2013 03:04:07 +0000 Received: from rock.am.freescale.net (rock.ap.freescale.net [10.193.20.106]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r6831rf7022997; Sun, 7 Jul 2013 20:01:55 -0700 From: Haijun Zhang To: , Subject: [PATCH 1/4] powerpc/85xx: Add support for 85xx cpu type detection Date: Mon, 8 Jul 2013 10:12:22 +0800 Message-ID: <1373249545-23928-1-git-send-email-Haijun.Zhang@freescale.com> X-Mailer: git-send-email 1.8.0 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Cc: Zhao Chenhui , AFLEMING@freescale.com, cbouatmailru@gmail.com, scottwood@freescale.com, cjb@laptop.org, Haijun Zhang X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Add this file to help detect cpu type in runtime. These macros and inline routines will be more favorable for driver to apply errata and workaround to specified cpu type. Signed-off-by: Haijun Zhang Signed-off-by: Zhao Chenhui --- arch/powerpc/include/asm/mpc85xx.h | 96 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 arch/powerpc/include/asm/mpc85xx.h diff --git a/arch/powerpc/include/asm/mpc85xx.h b/arch/powerpc/include/asm/mpc85xx.h new file mode 100644 index 0000000..a49fead --- /dev/null +++ b/arch/powerpc/include/asm/mpc85xx.h @@ -0,0 +1,96 @@ +/* + * MPC85xx cpu type detection + * + * Copyright 2011-2012 Freescale Semiconductor, Inc. + * + * This is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef __ASM_PPC_CPU_H +#define __ASM_PPC_CPU_H + +#define SVR_REV(svr) ((svr) & 0xFF) /* SOC design resision */ +#define SVR_MAJ(svr) (((svr) >> 4) & 0xF) /* Major revision field*/ +#define SVR_MIN(svr) (((svr) >> 0) & 0xF) /* Minor revision field*/ + +/* Some parts define SVR[0:23] as the SOC version */ +#define SVR_SOC_VER(svr) (((svr) >> 8) & 0xFFFFFF) /* SOC Version fields */ + +#define IS_SVR_REV(svr, maj, min) \ + ((SVR_MAJ(svr) == (maj)) && (SVR_MIN(svr) == (min))) + +#define SVR_8533 0x803400 +#define SVR_8533_E 0x803C00 +#define SVR_8535 0x803701 +#define SVR_8535_E 0x803F01 +#define SVR_8536 0x803700 +#define SVR_8536_E 0x803F00 +#define SVR_8540 0x803000 +#define SVR_8541 0x807200 +#define SVR_8541_E 0x807A00 +#define SVR_8543 0x803200 +#define SVR_8543_E 0x803A00 +#define SVR_8544 0x803401 +#define SVR_8544_E 0x803C01 +#define SVR_8545 0x803102 +#define SVR_8545_E 0x803902 +#define SVR_8547 0x803101 +#define SVR_8547_E 0x803901 +#define SVR_8548 0x803100 +#define SVR_8548_E 0x803900 +#define SVR_8555 0x807100 +#define SVR_8555_E 0x807900 +#define SVR_8560 0x807000 +#define SVR_8567 0x807501 +#define SVR_8567_E 0x807D01 +#define SVR_8568 0x807500 +#define SVR_8568_E 0x807D00 +#define SVR_8569 0x808000 +#define SVR_8569_E 0x808800 +#define SVR_8572 0x80E000 +#define SVR_8572_E 0x80E800 +#define SVR_P1010 0x80f900 +#define SVR_P1010_E 0x80F100 +#define SVR_P2041 0x821001 +#define SVR_P2041_E 0x821801 +#define SVR_P3041 0x821103 +#define SVR_P3041_E 0x821903 +#define SVR_P5010 0x822100 +#define SVR_P5010_E 0x822900 +#define SVR_P5020 0x822000 +#define SVR_P5020_E 0x822800 +#define SVR_P5040 0x820400 +#define SVR_P5040_E 0x820B00 +#define SVR_T4240 0x824800 +#define SVR_B4860 0x868800 + + +static inline int fsl_svr_is(u32 svr) +{ + u32 id = SVR_SOC_VER(mfspr(SPRN_SVR)); + + return (id == svr); +} + +/* Check the SOC design version of this board */ +static inline int fsl_svr_rev_is(u8 maj, u8 min) +{ + u32 rev = SVR_REV(mfspr(SPRN_SVR)); + u32 cmp = (maj << 4) | min; + + return (rev == cmp); +} + +/* Return true if current SOC revision is prior to (maj, min) */ +static inline int fsl_svr_older_than(u8 maj, u8 min) +{ + u32 rev = SVR_REV(mfspr(SPRN_SVR)); + u32 cmp = (maj << 4) | min; + + return (rev < cmp); +} + +#endif