From patchwork Sun Jun 24 21:34:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Otavio Salvador X-Patchwork-Id: 166911 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 01CA9B6F77 for ; Mon, 25 Jun 2012 07:32:47 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4FD6228087; Sun, 24 Jun 2012 23:32:46 +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 bLw9GRVweXom; Sun, 24 Jun 2012 23:32:46 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 984FA28088; Sun, 24 Jun 2012 23:32:45 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3B9B828088 for ; Sun, 24 Jun 2012 23:32: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 bR4XnHYyGOam for ; Sun, 24 Jun 2012 23:32:40 +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 mail-gh0-f172.google.com (mail-gh0-f172.google.com [209.85.160.172]) by theia.denx.de (Postfix) with ESMTPS id 6932828087 for ; Sun, 24 Jun 2012 23:32:38 +0200 (CEST) Received: by ghbg16 with SMTP id g16so2427268ghb.3 for ; Sun, 24 Jun 2012 14:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=7avgDw0t5j1RPGwqBGfPxqclFeaEgEDv84AfIF+vjhA=; b=iTlwH9usmCMCFJtU2eFuWuHu2hbVu/a2vWnE/IT7bIDIhQwO0u7r3+uPTuaOrAXONi jE2OHEOMmGKdHbJT3W0BUktj7MIWDcwdqfz5EvqlNCb/lNp5E7pzH8LYVgCHNqaOYj3u NH064qzJGhUdyANRoebk9ntaJL5uR9jijiA8MGub0TeAFh63DLofADohs6Ik+884aVNz AqnXFTNZGWDYD6iq5fdTYbgsH8DwvRsjnCNFqO3hDQchmm1aw1TI8p5+7oJvo/43pJqT 0LV3cNgvBhJbghiRzLb0eegxFjymAg26B4YrJA7eD9kkhoz76FaIjZzbX3hh/VX5HAq8 +Tew== Received: by 10.236.75.163 with SMTP id z23mr11375130yhd.3.1340573557503; Sun, 24 Jun 2012 14:32:37 -0700 (PDT) Received: from micro.lab.ossystems.com.br ([186.218.100.214]) by mx.google.com with ESMTPS id t22sm14887378anh.20.2012.06.24.14.32.35 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 24 Jun 2012 14:32:36 -0700 (PDT) From: Otavio Salvador To: u-boot@lists.denx.de Date: Sun, 24 Jun 2012 18:34:35 -0300 Message-Id: <1340573676-29765-2-git-send-email-otavio@ossystems.com.br> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1340573676-29765-1-git-send-email-otavio@ossystems.com.br> References: <1340573676-29765-1-git-send-email-otavio@ossystems.com.br> Cc: Marek Vasut , Fabio Estevam Subject: [U-Boot] [PATCH v2 3/3] mxs: generalize code for print_cpuinfo() 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de The information now is gathered from HW_DIGCTL_CHIPID register and includes the revision of the chip on the output. Signed-off-by: Otavio Salvador Cc: Marek Vasut Cc: Stefano Babic Cc: Fabio Estevam --- Changes since v1: * use ?? for unidentified revision and cpu type * use numeric revisions arch/arm/cpu/arm926ejs/mx28/mx28.c | 55 +++++++++++++++++++++++++- arch/arm/include/asm/arch-mx28/regs-digctl.h | 5 +++ 2 files changed, 58 insertions(+), 2 deletions(-) diff --git a/arch/arm/cpu/arm926ejs/mx28/mx28.c b/arch/arm/cpu/arm926ejs/mx28/mx28.c index a82ff25..5a527cf 100644 --- a/arch/arm/cpu/arm926ejs/mx28/mx28.c +++ b/arch/arm/cpu/arm926ejs/mx28/mx28.c @@ -190,13 +190,64 @@ int arch_cpu_init(void) #endif #if defined(CONFIG_DISPLAY_CPUINFO) +static const char *get_cpu_type(void) +{ + struct mx28_digctl_regs *digctl_regs = + (struct mx28_digctl_regs *)MXS_DIGCTL_BASE; + + switch (readl(&digctl_regs->hw_digctl_chipid) & HW_DIGCTL_CHIPID_MASK) { + case HW_DIGCTL_CHIPID_MX28: + return "28"; + case HW_DIGCTL_CHIPID_MX23: + return "23"; + default: + return "??"; + } +} + +static const char *get_cpu_rev(void) +{ + struct mx28_digctl_regs *digctl_regs = + (struct mx28_digctl_regs *)MXS_DIGCTL_BASE; + uint8_t rev = readl(&digctl_regs->hw_digctl_chipid) & 0x000000FF; + + switch (readl(&digctl_regs->hw_digctl_chipid) & HW_DIGCTL_CHIPID_MASK) { + case HW_DIGCTL_CHIPID_MX28: + switch (rev) { + case 0x1: + return "1.2"; + default: + return "??"; + } + case HW_DIGCTL_CHIPID_MX23: + switch (rev) { + case 0x0: + return "1.0"; + case 0x1: + return "1.1"; + case 0x2: + return "1.2"; + case 0x3: + return "1.3"; + case 0x4: + return "1.4"; + default: + return "??"; + } + default: + return "??"; + } +} + int print_cpuinfo(void) { struct mx28_spl_data *data = (struct mx28_spl_data *) ((CONFIG_SYS_TEXT_BASE - sizeof(struct mx28_spl_data)) & ~0xf); - printf("Freescale i.MX28 family at %d MHz\n", - mxc_get_clock(MXC_ARM_CLK) / 1000000); + printf("CPU: Freescale i.MX%s %s at rev%s MHz\n", + get_cpu_type(), + get_cpu_rev(), + mxc_get_clock(MXC_ARM_CLK) / 1000000); printf("BOOT: %s\n", mx28_boot_modes[data->boot_mode_idx].mode); return 0; } diff --git a/arch/arm/include/asm/arch-mx28/regs-digctl.h b/arch/arm/include/asm/arch-mx28/regs-digctl.h index 9a63594..67f91e7 100644 --- a/arch/arm/include/asm/arch-mx28/regs-digctl.h +++ b/arch/arm/include/asm/arch-mx28/regs-digctl.h @@ -152,4 +152,9 @@ struct mx28_digctl_regs { }; #endif +/* Product code identification */ +#define HW_DIGCTL_CHIPID_MASK (0xffff << 16) +#define HW_DIGCTL_CHIPID_MX23 (0x3780 << 16) +#define HW_DIGCTL_CHIPID_MX28 (0x2800 << 16) + #endif /* __MX28_REGS_DIGCTL_H__ */