From patchwork Mon May 10 10:37:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 98132 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4AAb1hR006457 for ; Mon, 10 May 2010 10:37:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756601Ab0EJKg7 (ORCPT ); Mon, 10 May 2010 06:36:59 -0400 Received: from smtp.nokia.com ([192.100.105.134]:57442 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756593Ab0EJKg4 (ORCPT ); Mon, 10 May 2010 06:36:56 -0400 Received: from esebh106.NOE.Nokia.com (esebh106.ntc.nokia.com [172.21.138.213]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o4AAZFO8002673; Mon, 10 May 2010 05:35:43 -0500 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 10 May 2010 13:35:40 +0300 Received: from mgw-da02.ext.nokia.com ([147.243.128.26]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Mon, 10 May 2010 13:35:39 +0300 Received: from manganga.research.nokia.com (esdhcp04199.research.nokia.com [172.21.41.99]) by mgw-da02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o4AAZPpX022644; Mon, 10 May 2010 13:35:33 +0300 From: Eduardo Valentin To: LKML , linux-arm-kernel@lists.infradead.org, Linux-OMAP Cc: Russell King , Andrew Morton , ext Tony Lindgren , ext Kevin Hilman , Peter De-Schrijver , santosh.shilimkar@ti.com, Ambresh , felipe.balbi@nokia.com, Eduardo Valentin Subject: [PATCHv4 2/4] mach-omap2: export omap2 info under /proc/socinfo Date: Mon, 10 May 2010 13:37:35 +0300 Message-Id: <1273487857-32281-3-git-send-email-eduardo.valentin@nokia.com> X-Mailer: git-send-email 1.7.0.4.361.g8b5fe.dirty In-Reply-To: <1273487857-32281-1-git-send-email-eduardo.valentin@nokia.com> References: <1273487857-32281-1-git-send-email-eduardo.valentin@nokia.com> X-OriginalArrivalTime: 10 May 2010 10:35:39.0759 (UTC) FILETIME=[88C91FF0:01CAF02C] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 10 May 2010 10:37:09 +0000 (UTC) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index c5408bf..7456967 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -798,6 +798,7 @@ config ARCH_OMAP select GENERIC_TIME select GENERIC_CLOCKEVENTS select ARCH_HAS_HOLES_MEMORYMODEL + select PROC_SOC_INFO help Support for TI's OMAP platform (OMAP1 and OMAP2). diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index 37b8a1a..8ecd8e2 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c @@ -18,6 +18,7 @@ #include #include #include +#include #include @@ -101,10 +102,12 @@ static struct omap_id omap_ids[] __initdata = { static void __iomem *tap_base; static u16 tap_prod_id; +#define SOCINFO_SZ 128 +static char socinfo[SOCINFO_SZ]; void __init omap24xx_check_revision(void) { - int i, j; + int i, j, sz; u32 idcode, prod_id; u16 hawkeye; u8 dev_type, rev; @@ -152,10 +155,11 @@ void __init omap24xx_check_revision(void) j = i; } - pr_info("OMAP%04x", omap_rev() >> 16); + sz = snprintf(socinfo, SOCINFO_SZ, "OMAP%04x", omap_rev() >> 16); if ((omap_rev() >> 8) & 0x0f) - pr_info("ES%x", (omap_rev() >> 12) & 0xf); - pr_info("\n"); + snprintf(socinfo + sz, SOCINFO_SZ - sz, "ES%x", + (omap_rev() >> 12) & 0xf); + pr_info("%s\n", socinfo); } #define OMAP3_CHECK_FEATURE(status,feat) \ @@ -286,7 +290,9 @@ void __init omap4_check_revision(void) if ((hawkeye == 0xb852) && (rev == 0x0)) { omap_revision = OMAP4430_REV_ES1_0; omap_chip.oc |= CHIP_IS_OMAP4430ES1; - pr_info("OMAP%04x %s\n", omap_rev() >> 16, rev_name); + snprintf(socinfo, SOCINFO_SZ, "OMAP%04x %s\n", + omap_rev() >> 16, rev_name); + pr_info("%s\n", socinfo); return; } @@ -356,7 +362,8 @@ void __init omap3_cpuinfo(void) } /* Print verbose information */ - pr_info("%s ES%s (", cpu_name, cpu_rev); + snprintf(socinfo, SOCINFO_SZ, "%s ES%s", cpu_name, cpu_rev); + pr_info("%s (", socinfo); OMAP3_SHOW_FEATURE(l2cache); OMAP3_SHOW_FEATURE(iva); @@ -425,3 +432,32 @@ void __init omap2_set_globals_tap(struct omap_globals *omap2_globals) else tap_prod_id = 0x0208; } + +static int c_show(struct seq_file *m, void *v) +{ + seq_printf(m, "SoC\t: %s\n", socinfo); + + return 0; +} + +static void *c_start(struct seq_file *m, loff_t *pos) +{ + return *pos < 1 ? (void *)1 : NULL; +} + +static void *c_next(struct seq_file *m, void *v, loff_t *pos) +{ + ++*pos; + return NULL; +} + +static void c_stop(struct seq_file *m, void *v) +{ +} + +const struct seq_operations socinfo_op = { + .start = c_start, + .next = c_next, + .stop = c_stop, + .show = c_show +};