From: Sylwester Nawrocki <s.nawrocki@samsung.com>
To: krzk@kernel.org
Cc: kgene@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com,
cw00.choi@samsung.com, myungjoo.ham@samsung.com,
linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org,
pankaj.dubey@samsung.com, b.zolnierkie@samsung.com,
m.szyprowski@samsung.com,
Sylwester Nawrocki <s.nawrocki@samsung.com>
Subject: [PATCH RFC 2/8] soc: samsung: Exynos chipid driver update
Date: Thu, 04 Apr 2019 19:17:29 +0200 [thread overview]
Message-ID: <20190404171735.12815-3-s.nawrocki@samsung.com> (raw)
In-Reply-To: <20190404171735.12815-1-s.nawrocki@samsung.com>
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 <s.nawrocki@samsung.com>
---
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 <linux/slab.h>
#include <linux/sys_soc.h>
-#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);
--
2.17.1
next prev parent reply other threads:[~2019-04-04 17:22 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20190404172220epcas1p3a6a8d843780321c4914a63d589c56b33@epcas1p3.samsung.com>
2019-04-04 17:17 ` [PATCH RFC 0/8] Exynos Adaptive Supply Voltage support Sylwester Nawrocki
[not found] ` <CGME20190404172224epcas2p21b449c0ae8e36f7e800ae67c18db35a2@epcas2p2.samsung.com>
2019-04-04 17:17 ` [PATCH RFC 1/8] soc: samsung: Add exynos chipid driver support Sylwester Nawrocki
2019-04-05 6:53 ` Krzysztof Kozlowski
2019-04-05 8:49 ` Sylwester Nawrocki
[not found] ` <CGME20190404172229epcas2p25a819e37035b26ccf53613e880bdcacf@epcas2p2.samsung.com>
2019-04-04 17:17 ` Sylwester Nawrocki [this message]
2019-04-05 9:22 ` [PATCH RFC 2/8] soc: samsung: Exynos chipid driver update Krzysztof Kozlowski
2019-04-05 10:04 ` Sylwester Nawrocki
[not found] ` <CGME20190404172234epcas1p37667ec0996000aff9297f13639908dfc@epcas1p3.samsung.com>
2019-04-04 17:17 ` [PATCH RFC 3/8] dt-bindings: exynos: Add ASV tables binding documentation Sylwester Nawrocki
2019-04-29 17:23 ` Rob Herring
2019-07-18 14:02 ` Sylwester Nawrocki
[not found] ` <CGME20190404172238epcas2p21ef28f46b728127dcd6e8ee72752a1b8@epcas2p2.samsung.com>
2019-04-04 17:17 ` [PATCH RFC 4/8] soc: samsung: Add Exynos Adaptive Supply Voltage driver Sylwester Nawrocki
2019-04-05 10:24 ` Krzysztof Kozlowski
2019-04-09 17:40 ` Sylwester Nawrocki
2019-04-23 10:50 ` Krzysztof Kozlowski
2019-04-24 8:11 ` Sylwester Nawrocki
2019-04-24 8:20 ` Krzysztof Kozlowski
[not found] ` <CGME20190404172243epcas1p39af2498a51772ee4ab2a31f26e469c5b@epcas1p3.samsung.com>
2019-04-04 17:17 ` [PATCH RFC 5/8] ARM: EXYNOS: enable exynos_chipid for ARCH_EXYNOS Sylwester Nawrocki
[not found] ` <CGME20190404172247epcas2p2d24f19f76db3cee177bd5b9df783eb3b@epcas2p2.samsung.com>
2019-04-04 17:17 ` [PATCH RFC 6/8] ARM64: " Sylwester Nawrocki
[not found] ` <CGME20190404172252epcas2p284b7e2e9e7102f6f95c982d547ed9d64@epcas2p2.samsung.com>
2019-04-04 17:17 ` [PATCH RFC 7/8] ARM: EXYNOS: Enable exynos-asv driver " Sylwester Nawrocki
[not found] ` <CGME20190404172257epcas1p20d789242a2353dc8e9ffd7f435dc5eee@epcas1p2.samsung.com>
2019-04-04 17:17 ` [PATCH RFC 8/8] ARM: dts: exynos: Add ASV tables for exynos5422/5800 Sylwester Nawrocki
2019-04-11 7:39 ` Anand Moon
2019-04-11 8:50 ` Willy Wolff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190404171735.12815-3-s.nawrocki@samsung.com \
--to=s.nawrocki@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=kgene@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mark.rutland@arm.com \
--cc=myungjoo.ham@samsung.com \
--cc=pankaj.dubey@samsung.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).