From patchwork Thu Apr 4 17:17:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 10886009 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 998E21669 for ; Thu, 4 Apr 2019 17:23:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D5F928AD0 for ; Thu, 4 Apr 2019 17:23:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 70A8028ADC; Thu, 4 Apr 2019 17:23:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B9C5C28AD0 for ; Thu, 4 Apr 2019 17:23:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-reply-to:Message-id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=rH1Gpbj2zGqDAGB0eHrR0rrIlVwqsRz5UAqPi1rGIWs=; b=YCuELqGivizFWS3wxLXyWOw3Mr DyhsMQDs+zW01diZYWppW8qUbzHjssqQOv8QDrA5wIWrACt7j/MH5Tyd9ztmMtXtzwSFf2jE2hyfF BtMq/VoxlKsfz3Nbu2q1gfLtnQU+e8Msk2vDqJyFjP+yuTgGE9jt3GY+YF8FmqRHYocmjBNfbqca2 O3++bk5icDFeypfa0buI7tm8N4DgQuP0IlrRgR9J9BLsd4oD+cLfVVD5TQJpbb7b7pHMNanLKRf/1 meO/VkuUu0auNaD90eOTwpE+mZQzoRCJI6WS/F2fsvjOdevlhhijkEt0lb6MQW1uZYt+ZW0ctD7h8 TmySf8GA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hC64j-0000SY-Pi; Thu, 04 Apr 2019 17:22:53 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hC64O-0008PC-Oz for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2019 17:22:37 +0000 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20190404172230epoutp02eb0347b6a19e3c40fe6363c4725fc900~SVT8X_-av1978019780epoutp02Q; Thu, 4 Apr 2019 17:22:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20190404172230epoutp02eb0347b6a19e3c40fe6363c4725fc900~SVT8X_-av1978019780epoutp02Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1554398550; bh=TYWpj8p9WaDYrR6UduDz4MgfkRQie1eBkkay1mt3QIA=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=NVFGohpNxt5wqIoh2igHJGxPP+BuU/88xV4BrXO3I6BKKZ/YtAe6LTfB/oDiTOzpK p6LhzB+vFxg+MHxe4NTBPwAdxT32v13VIQIaYYAVPL80DiS877QxKelO4YBk5dtAB9 PVBHq4F1PYGozaPKmZGh1+iEYBqBRnWTamKOSzUc= Received: from epsmges2p4.samsung.com (unknown [182.195.42.72]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190404172230epcas2p2cc0798d06ffe3a1feb4e9d7007e3f3cd~SVT8AoaAB1739317393epcas2p2m; Thu, 4 Apr 2019 17:22:30 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p4.samsung.com (Symantec Messaging Gateway) with SMTP id 24.13.04207.65D36AC5; Fri, 5 Apr 2019 02:22:30 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p2.samsung.com (KnoxPortal) with ESMTP id 20190404172229epcas2p25a819e37035b26ccf53613e880bdcacf~SVT7KYg813185231852epcas2p2N; Thu, 4 Apr 2019 17:22:29 +0000 (GMT) X-AuditID: b6c32a48-6a1ff7000000106f-27-5ca63d564d71 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 90.68.03620.55D36AC5; Fri, 5 Apr 2019 02:22:29 +0900 (KST) Received: from AMDC3061.DIGITAL.local ([106.120.51.75]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PPG00B165KSW780@mmp1.samsung.com>; Fri, 05 Apr 2019 02:22:29 +0900 (KST) From: Sylwester Nawrocki To: krzk@kernel.org Subject: [PATCH RFC 2/8] soc: samsung: Exynos chipid driver update Date: Thu, 04 Apr 2019 19:17:29 +0200 Message-id: <20190404171735.12815-3-s.nawrocki@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20190404171735.12815-1-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPIsWRmVeSWpSXmKPExsWy7bCmuW6Y7bIYg4c3xCw2zljPanH9y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e8EnuYqZ1/czNjD2SnUxcnBICJhIPL+b2sXIxSEksJNR4ve1T4wQzk9GiZe9G5i6GDk5 2AQMJXqP9jGC2CICwhL3li5nB7GZBb4zScyelwdiCws4SZx59RwsziKgKvHu+FUWEJtXwFri 3b7JYL0SAvISqzccYAaxOQVsJB4vecMGcoQQUM33LQkTGHkWMDKsYpRMLSjOTc8tNiowykst 1ytOzC0uzUvXS87P3cQIDMNth7X6dzA+XhJ/iFGAg1GJh1eDaVmMEGtiWXFl7iFGCQ5mJRHe 4O9LY4R4UxIrq1KL8uOLSnNSiw8xSnOwKInz8ucfixQSSE8sSc1OTS1ILYLJMnFwSjUwzsx8 I/Twiqeiyz6vLeoGCkIzHr8xYo/ZqF7IX5ewQHDSkYvdwX/zf9Z1R9oLX9K+4VZbdfjucqm7 kl3dNblZORduabhmmlxeEFmpkLM50tbltYzCG1N++6ULX3/lSzq1wO7yn55rSVvPdN97HNtX +uJxTei9gyvibkQ90P6h9PjmyZ/XF+8yUmIpzkg01GIuKk4EAKcrQJQ/AgAA X-CMS-MailID: 20190404172229epcas2p25a819e37035b26ccf53613e880bdcacf CMS-TYPE: 102P X-CMS-RootMailID: 20190404172229epcas2p25a819e37035b26ccf53613e880bdcacf References: <20190404171735.12815-1-s.nawrocki@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190404_102233_326386_2AC5D869 X-CRM114-Status: GOOD ( 16.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, b.zolnierkie@samsung.com, pankaj.dubey@samsung.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, cw00.choi@samsung.com, kgene@kernel.org, myungjoo.ham@samsung.com, Sylwester Nawrocki , linux-arm-kernel@lists.infradead.org, m.szyprowski@samsung.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds definition of selected CHIP ID register offsets and register bit field definitions for Exynos5422 SoC. exynos_chipid_read() helper function is added to allow reading the CHIP ID block registers. Signed-off-by: Sylwester Nawrocki --- drivers/soc/samsung/exynos-chipid.c | 16 +++++----- drivers/soc/samsung/exynos-chipid.h | 48 +++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 drivers/soc/samsung/exynos-chipid.h diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c index 5cb018807817..4920f0ef2c55 100644 --- a/drivers/soc/samsung/exynos-chipid.c +++ b/drivers/soc/samsung/exynos-chipid.c @@ -16,10 +16,7 @@ #include #include -#define EXYNOS_SUBREV_MASK (0xF << 4) -#define EXYNOS_MAINREV_MASK (0xF << 0) -#define EXYNOS_REV_MASK (EXYNOS_SUBREV_MASK | EXYNOS_MAINREV_MASK) -#define EXYNOS_MASK 0xFFFFF000 +#include "exynos-chipid.h" static const struct exynos_soc_id { const char *name; @@ -40,6 +37,13 @@ static const struct exynos_soc_id { { "EXYNOS5433", 0xE5433000 }, }; +static void __iomem *exynos_chipid_base; + +unsigned int exynos_chipid_read(unsigned int offset) +{ + return readl_relaxed(exynos_chipid_base + offset); +} + static const char * __init product_id_to_soc_id(unsigned int product_id) { int i; @@ -53,7 +57,6 @@ static const char * __init product_id_to_soc_id(unsigned int product_id) int __init exynos_chipid_early_init(void) { struct soc_device_attribute *soc_dev_attr; - void __iomem *exynos_chipid_base; struct soc_device *soc_dev; struct device_node *root; struct device_node *np; @@ -73,9 +76,8 @@ int __init exynos_chipid_early_init(void) return -ENXIO; } - product_id = readl_relaxed(exynos_chipid_base); + product_id = exynos_chipid_read(EXYNOS_CHIPID_REG_PRO_ID); revision = product_id & EXYNOS_REV_MASK; - iounmap(exynos_chipid_base); soc_dev_attr = kzalloc(sizeof(*soc_dev_attr), GFP_KERNEL); if (!soc_dev_attr) diff --git a/drivers/soc/samsung/exynos-chipid.h b/drivers/soc/samsung/exynos-chipid.h new file mode 100644 index 000000000000..826a12c25fa2 --- /dev/null +++ b/drivers/soc/samsung/exynos-chipid.h @@ -0,0 +1,48 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * http://www.samsung.com/ + * + * EXYNOS - CHIP ID support + */ + +#define EXYNOS_CHIPID_REG_PRO_ID 0x00 + #define EXYNOS_SUBREV_MASK (0xf << 4) + #define EXYNOS_MAINREV_MASK (0xf << 0) + #define EXYNOS_REV_MASK (EXYNOS_SUBREV_MASK | \ + EXYNOS_MAINREV_MASK) + #define EXYNOS_MASK 0xfffff000 + +#define EXYNOS_CHIPID_REG_PKG_ID 0x04 + #define EXYNOS5422_IDS_OFFSET 24 + #define EXYNOS5422_IDS_MASK 0xff + #define EXYNOS5422_USESG_OFFSET 3 + #define EXYNOS5422_USESG_MASK 0x01 + #define EXYNOS5422_SG_OFFSET 0 + #define EXYNOS5422_SG_MASK 0x07 + #define EXYNOS5422_TABLE_OFFSET 8 + #define EXYNOS5422_TABLE_MASK 0x03 + #define EXYNOS5422_SG_A_OFFSET 17 + #define EXYNOS5422_SG_A_MASK 0x0f + #define EXYNOS5422_SG_B_OFFSET 21 + #define EXYNOS5422_SG_B_MASK 0x03 + #define EXYNOS5422_SG_BSIGN_OFFSET 23 + #define EXYNOS5422_SG_BSIGN_MASK 0x01 + #define EXYNOS5422_BIN2_OFFSET 12 + #define EXYNOS5422_BIN2_MASK 0x01 + +#define EXYNOS_CHIPID_REG_LOT_ID 0x14 + +#define EXYNOS_CHIPID_AUX_INFO 0x1c + #define EXYNOS5422_TMCB_OFFSET 0 + #define EXYNOS5422_TMCB_MASK 0x7f + #define EXYNOS5422_ARM_UP_OFFSET 8 + #define EXYNOS5422_ARM_UP_MASK 0x03 + #define EXYNOS5422_ARM_DN_OFFSET 10 + #define EXYNOS5422_ARM_DN_MASK 0x03 + #define EXYNOS5422_KFC_UP_OFFSET 12 + #define EXYNOS5422_KFC_UP_MASK 0x03 + #define EXYNOS5422_KFC_DN_OFFSET 14 + #define EXYNOS5422_KFC_DN_MASK 0x03 + +unsigned int exynos_chipid_read(unsigned int offset);