From patchwork Sun Jul 7 23:44:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: DrEagle X-Patchwork-Id: 257445 X-Patchwork-Delegate: sr@denx.de 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 CBD082C009D for ; Mon, 8 Jul 2013 09:44:42 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 9388A4A053; Mon, 8 Jul 2013 01:44:41 +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 xxRRzoT+a5uz; Mon, 8 Jul 2013 01:44:41 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C26A14A054; Mon, 8 Jul 2013 01:44:38 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8CE5B4A054 for ; Mon, 8 Jul 2013 01:44:33 +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 HZc9eRpen9Ln for ; Mon, 8 Jul 2013 01:44:29 +0200 (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 milenium.gk2.net (unknown [88.178.80.34]) by theia.denx.de (Postfix) with ESMTP id 02F0A4A053 for ; Mon, 8 Jul 2013 01:44:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by milenium.gk2.net (Postfix) with ESMTP id 625CE2D409D; Mon, 8 Jul 2013 01:44:21 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at milenium.gk2.net Received: from milenium.gk2.net ([127.0.0.1]) by localhost (milenium.gk2.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Tx1PEXH3YyeK; Mon, 8 Jul 2013 01:44:16 +0200 (CEST) Received: from [192.168.1.101] (astree.gk2.net [109.190.23.135]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: gek@milenium.gk2.net) by milenium.gk2.net (Postfix) with ESMTPSA id B5F342D407A; Mon, 8 Jul 2013 01:44:15 +0200 (CEST) Message-ID: <51D9FD4E.6030703@doukki.net> Date: Mon, 08 Jul 2013 01:44:14 +0200 From: DrEagle User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130623 Thunderbird/17.0.7 MIME-Version: 1.0 To: "u-boot@lists.denx.de" References: <51D3437F.9040000@doukki.net> <20130705230848.457e1e24@lilith> In-Reply-To: <20130705230848.457e1e24@lilith> X-Enigmail-Version: 1.6a1pre Cc: Lior Amsalem , Maen Suleiman , "uboot@doukki.net" , afleming@gmail.com Subject: [U-Boot] [PATCH 1/8] arm kirkwood - add kirkwood_id 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 - add kirkwood_id to detect supported devices and revisions Signed-off-by: drEagle arch/arm/cpu/arm926ejs/kirkwood/cpu.c | arch/arm/include/asm/arch-kirkwood/cpu.h | diff --git a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c index fba5e01..720fccf 100644 --- a/arch/arm/cpu/arm926ejs/kirkwood/cpu.c +++ b/arch/arm/cpu/arm926ejs/kirkwood/cpu.c @@ -350,6 +350,64 @@ int arch_cpu_init(void) } #endif /* CONFIG_ARCH_CPU_INIT */ +/***************************************************************************** + * General + ****************************************************************************/ +#if defined(CONFIG_ARCH_DEV_ID) + +void kirkwood_pcie_id(u32 *dev, u32 *rev) +{ + *dev = (readl(KW_REG_PCIE_DEVID) >> 16) & 0xffff; + *rev = readl(KW_REG_PCIE_REVID) & 0xff; +} + +/* + * Identify device ID and revision. + */ +char *kirkwood_id(void) +{ + u32 dev, rev; + + kirkwood_pcie_id(&dev, &rev); + + if (dev == MV88F6281_DEV_ID) { + if (rev == MV88F6281_REV_Z0) + return "MV88F6281-Z0"; + else if (rev == MV88F6281_REV_A0) + return "MV88F6281-A0"; + else if (rev == MV88F6281_REV_A1) + return "MV88F6281-A1"; + else + return "MV88F6281-Rev-Unsupported"; + } else if (dev == MV88F6192_DEV_ID) { + if (rev == MV88F6192_REV_Z0) + return "MV88F6192-Z0"; + else if (rev == MV88F6192_REV_A0) + return "MV88F6192-A0"; + else if (rev == MV88F6192_REV_A1) + return "MV88F6192-A1"; + else + return "MV88F6192-Rev-Unsupported"; + } else if (dev == MV88F6180_DEV_ID) { + if (rev == MV88F6180_REV_A0) + return "MV88F6180-Rev-A0"; + else if (rev == MV88F6180_REV_A1) + return "MV88F6180-Rev-A1"; + else + return "MV88F6180-Rev-Unsupported"; + } else if (dev == MV88F6282_DEV_ID) { + if (rev == MV88F6282_REV_A0) + return "MV88F6282-Rev-A0"; + else if (rev == MV88F6282_REV_A1) + return "MV88F6282-Rev-A1"; + else + return "MV88F6282-Rev-Unsupported"; + } else { + return "Device-Unknown"; + } +} +#endif /* CONFIG_ARCH_DEV_ID */ + /* * SOC specific misc init */ --- a/arch/arm/include/asm/arch-kirkwood/cpu.h +++ b/arch/arm/include/asm/arch-kirkwood/cpu.h @@ -167,5 +167,7 @@ int kw_config_mpp(unsigned int mpp0_7, unsigned int mpp8_15, unsigned int mpp32_39, unsigned int mpp40_47, unsigned int mpp48_55); unsigned int kw_winctrl_calcsize(unsigned int sizeval); +void kirkwood_pcie_id(u32 *dev, u32 *rev); +char *kirkwood_id(void); #endif /* __ASSEMBLY__ */ #endif /* _KWCPU_H */