From patchwork Thu Sep 17 00:41:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 1365671 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=oRxGxbel; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=DVXF5KbZ; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BsJ8S1W1jzB414 for ; Thu, 17 Sep 2020 10:42:32 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=JC4TY1Q/PMgXyd2wp3Jd2u/a0ghqgXR0hXTbgWEJbYo=; b=oRxGxbelVGg63o2U7glz3DhuaB mJkO2oLjjYxw1dwV3wvP5BvXFOSVRDNY+uha1u7yHOSIBWujxP5bKP8YUfz5B9WhpeQVSw6TM4UCC nf6s4qUHRS1WZpG4JNQ0nutHkCu/gryPt6U7dkRAA835fwDbV21fEII9Ur/O9z0pa8ACopJHKcPdl Kz+nGWdY32avmuv6WYEUqZQRjtMAW6stiDPpKZKUDC21mkV4ax5D4ORHBr+058zvSZdq7iX1VqxXN xp9QX8cX8q2jfLM8HJ9BivmomVsi6KKYMJT5UpyjRww5oHEKU2+Q8uOUR3tpMT9DZKfrBDAhHygG1 hnLbFQ4g==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIi02-0002tf-Ot; Thu, 17 Sep 2020 00:42:10 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIhzy-0002sP-At for linux-arm-kernel@lists.infradead.org; Thu, 17 Sep 2020 00:42:07 +0000 Received: by mail-qt1-x843.google.com with SMTP id y11so503883qtn.9 for ; Wed, 16 Sep 2020 17:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B3Aeb3EieL4LbfqM+ewr6EfYhIGfMyCZvarN0yol0iI=; b=DVXF5KbZNsuicWhJh5HIF09wGY4R7+mmOwLMjS2tyVwxdJc+JKMyJD1nmrQMYDi/RV S1sOoVqfXvU9Jp2Smc+j7LaDfsF0HX/6I3x0WpptlCyEwLe/2F/DMvrM1Ya4cBrcWklo a/gR3VOR8CPh0N39GHBnBWamHqoFWVVMDKKQWuX1Emxf8nfu/ufrvvd4mzhlEUV9XqRz TzsrzVaUY6XotFdCM6zAvBDB0rVmrdy4QTgZyfh2pkbMhTma1c+eLrv/lejOZhOlgaRD sUr63XG+W1bU9ayeWzMJBoiBmIfx5/ErjqI1agZLJQygR0rg+qenoNPw3WMxamuD8SNT 69DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=B3Aeb3EieL4LbfqM+ewr6EfYhIGfMyCZvarN0yol0iI=; b=AeA+19nqI04Wx862n3slaVzhibNOG7hXSRUyGIF8Ad7R9BlABnb0RvcjBBxX/23a6d Rx/iINrfoVLoBigjsxmdk1sn5O8+OleOAWrqS4QvIa9oMAnhBIW1cc9tbgR21KrredTZ RCPc4KxxRyNcf12RUPs89hdNvVpk0k/kyNT3XRfyraHMw+iz1hZGt5fvTJZo1a4eyJG/ iCqrw01UsGuS30DzdY3e+WCGaRyR5elhW/zWD4S5lGSqWq7t6fOc+3mrXxSJIaLO7mTh XB7YhJqxoK1vWG5BeHGzYBMKCe4EzKMPzAiWP7UClIDZhuzWMeP8eDndRiDoHBQQGMbC xjfw== X-Gm-Message-State: AOAM530ClQiKV2HhFwHbuW0xXD2lL5aoUX7K883l4noMg8SZ4G1oG+7q XkVdpL5A1X+k3YRYi42wLPk= X-Google-Smtp-Source: ABdhPJzgodyPX9X26rOHkH31jTczUts6CaiUU7vHKQv1GkrFfMX46TkRsVq9kmMcJchc/0JOik3Fxg== X-Received: by 2002:ac8:7650:: with SMTP id i16mr26160046qtr.268.1600303324627; Wed, 16 Sep 2020 17:42:04 -0700 (PDT) Received: from localhost.localdomain ([2804:14c:482:640::1000]) by smtp.gmail.com with ESMTPSA id w6sm20127893qti.63.2020.09.16.17.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Sep 2020 17:42:03 -0700 (PDT) From: Fabio Estevam To: shawnguo@kernel.org Subject: [PATCH v2 01/11] ARM: imx27: Retrieve the SYSCTRL base address from devicetree Date: Wed, 16 Sep 2020 21:41:15 -0300 Message-Id: <20200917004125.18487-2-festevam@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200917004125.18487-1-festevam@gmail.com> References: <20200917004125.18487-1-festevam@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_204206_415019_56750B22 X-CRM114-Status: GOOD ( 16.65 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:843 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [festevam[at]gmail.com] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, Fabio Estevam , arnd@arndb.de, linux-imx@nxp.com, kernel@pengutronix.de MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org Now that imx27 has been converted to a devicetree-only platform, retrieve the SYSCTRL base address from devicetree. To keep devicetree compatibilty the SYSCTRL base address will be retrieved from the CCM base address plus an 0x800 offset. This is not a problem as the imx27.dtsi describes the CCM register range as 0x1000. Signed-off-by: Fabio Estevam --- Changes since v1: - Do not introduce a sysctrl node to avoid breaking DT compatibility (Arnd) arch/arm/mach-imx/cpu-imx27.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/cpu-imx27.c b/arch/arm/mach-imx/cpu-imx27.c index a969aa71b60f..bf70e13bbe9e 100644 --- a/arch/arm/mach-imx/cpu-imx27.c +++ b/arch/arm/mach-imx/cpu-imx27.c @@ -9,6 +9,7 @@ */ #include +#include #include #include "hardware.h" @@ -17,16 +18,23 @@ static int mx27_cpu_rev = -1; static int mx27_cpu_partnumber; #define SYS_CHIP_ID 0x00 /* The offset of CHIP ID register */ +#define SYSCTRL_OFFSET 0x800 /* Offset from CCM base address */ static int mx27_read_cpu_rev(void) { + void __iomem *ccm_base; + struct device_node *np; u32 val; + + np = of_find_compatible_node(NULL, NULL, "fsl,imx27-ccm"); + ccm_base = of_iomap(np, 0); + BUG_ON(!ccm_base); /* * now we have access to the IO registers. As we need * the silicon revision very early we read it here to * avoid any further hooks */ - val = imx_readl(MX27_IO_ADDRESS(MX27_SYSCTRL_BASE_ADDR + SYS_CHIP_ID)); + val = imx_readl(ccm_base + SYSCTRL_OFFSET + SYS_CHIP_ID); mx27_cpu_partnumber = (int)((val >> 12) & 0xFFFF);