From patchwork Thu Sep 1 12:27:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 3841 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 658D723F41 for ; Thu, 1 Sep 2011 12:27:50 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 5A412A185E4 for ; Thu, 1 Sep 2011 12:27:50 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id 18so912369fxd.11 for ; Thu, 01 Sep 2011 05:27:50 -0700 (PDT) Received: by 10.223.88.214 with SMTP id b22mr285600fam.5.1314880070211; Thu, 01 Sep 2011 05:27:50 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.11.8 with SMTP id m8cs50608lab; Thu, 1 Sep 2011 05:27:50 -0700 (PDT) Received: by 10.216.168.67 with SMTP id j45mr146780wel.23.1314880069743; Thu, 01 Sep 2011 05:27:49 -0700 (PDT) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id n55si1273537wed.40.2011.09.01.05.27.49 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 01 Sep 2011 05:27:49 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=74.125.82.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-ww0-f50.google.com with SMTP id 36so1877121wwi.31 for ; Thu, 01 Sep 2011 05:27:49 -0700 (PDT) Received: by 10.216.161.200 with SMTP id w50mr116114wek.69.1314880068995; Thu, 01 Sep 2011 05:27:48 -0700 (PDT) Received: from localhost.localdomain (cpc2-aztw13-0-0-cust146.aztw.cable.virginmedia.com [77.99.12.147]) by mx.google.com with ESMTPS id r57sm355985weq.12.2011.09.01.05.27.47 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 01 Sep 2011 05:27:48 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org Cc: linus.walleij@stericsson.com, arnd@arndb.de, jamie@jamieiles.com, gregkh@suse.de, Lee Jones Subject: [PATCH 5/5] mach-ux500: add a SoC ID (serial) callback for the u8500 Date: Thu, 1 Sep 2011 13:27:23 +0100 Message-Id: <1314880043-22517-5-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1314880043-22517-1-git-send-email-lee.jones@linaro.org> References: <1314880043-22517-1-git-send-email-lee.jones@linaro.org> With this patch applied the Export SoC Information framework will be able to callback into u8500 Platform code in order to probe for the SoC's unique Identification (serial) number. Signed-off-by: Lee Jones --- arch/arm/mach-ux500/cpu-db8500.c | 16 ++++++++++++++++ arch/arm/mach-ux500/include/mach/db8500-regs.h | 4 ++++ 2 files changed, 20 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c index 655639e..9824cd3 100644 --- a/arch/arm/mach-ux500/cpu-db8500.c +++ b/arch/arm/mach-ux500/cpu-db8500.c @@ -167,6 +167,20 @@ static void __init db8500_add_gpios(void) IRQ_DB8500_GPIO0, &pdata); } +static const char *db8500_get_soc_id(void) +{ + void __iomem *uid_base; + char buf[1024]; + ssize_t sz = 0; + int i; + + uid_base = __io_address(U8500_BB_UID_BASE); + for (i = 0; i < U8500_BB_UID_LENGTH; i++) { + sz += sprintf(buf + sz, "%08x", readl(uid_base + i * sizeof(u32))); + } + return kasprintf(GFP_KERNEL, "%s", buf); +} + static int usb_db8500_rx_dma_cfg[] = { DB8500_DMA_DEV38_USB_OTG_IEP_1_9, DB8500_DMA_DEV37_USB_OTG_IEP_2_10, @@ -208,6 +222,8 @@ void __init u8500_init_devices(void) "cpufreq-u8500", -1, NULL, 0, NULL, 0); if (soc_dev) { + soc_dev->pfn_soc_id = db8500_get_soc_id; + for (i=0; idev.parent = &soc_dev->dev; } diff --git a/arch/arm/mach-ux500/include/mach/db8500-regs.h b/arch/arm/mach-ux500/include/mach/db8500-regs.h index 0499971..f569d5c 100644 --- a/arch/arm/mach-ux500/include/mach/db8500-regs.h +++ b/arch/arm/mach-ux500/include/mach/db8500-regs.h @@ -166,4 +166,8 @@ #define U8500_MODEM_BASE 0xe000000 #define U8500_APE_BASE 0x6000000 +/* SoC identification number information */ +#define U8500_BB_UID_BASE (U8500_BACKUPRAM1_BASE + 0xFC0) +#define U8500_BB_UID_LENGTH 5 + #endif