Received: by 10.223.176.46 with SMTP id f43csp1161057wra; Fri, 19 Jan 2018 07:43:44 -0800 (PST) X-Google-Smtp-Source: ACJfBout0SSz22L9SxDcYCPE5EM+1LhrIchZWEF0/jBvff8wpYkMXuCBaNN/Qxa5bZ2TtSdVTxuu X-Received: by 10.98.76.87 with SMTP id z84mr41539158pfa.208.1516376624414; Fri, 19 Jan 2018 07:43:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516376624; cv=none; d=google.com; s=arc-20160816; b=QyEti1L+4RiWCzEEbexdHwy/dzNNWe5piEKXKjAyLeQSTbKa0vXh3EVLpKkSzCmFUG 2TVIbn/f3DAJu5yYW8n43la1r84CRL2T83LGMZiW+A1/UXdTBxZmPncwL/eRH7EQGtXA Zu4jIPUzscnI+5F5CK6PUxhBfVm0dslpNJqIWiG+Xc1w2QlDgLCZcJnGpiM4/+Qs+aV+ ky9dVzBjniTolq1YmomMxQnuv5JKLLtvjVb+LYvIWoK3IdTa6SfgnNIH2xfgacgnbahx xY6dbv5PEsnMlO9JG3enTKhOy6KfWGiUDoCT9klkca7Efol4t7qS2n36KJhP0FUxG5Ah eKJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=blEatp/MsOnNtgHdhRRQ1HUwwoc6TtfdD09IqBioC0g=; b=tQBlJxK3w8rxwuNpFK0e6pTDUcseBiDR6n1myR9+LnBtK0INNCVu8O/ow8semel4pm R7fRA2eAR51N7QNmLls0L0sOK4sZjswvySI3fRSKzRWmsanoaxmmbZ2uZ6VbN7lfx5xQ gltEuoXoeVlDYqRRLnIr3Wa7bLclblA1u/PSBJ8mTz/Uh1w/y3ii61XtwF2skt8QA2Jp oQc3qbJVVDishbcwfC4Pd9VA6vTTZYv7Ow8c4im56NIoM2sYeDfl24KGkBxMaJCEe4h6 Unv8sdmFZz3uSiIu2b7TRuaKxokGAxZ/VInDIAFCNNrVXDAkNKMtK4NtUWVP0fWGWqBu 182w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92-v6si905795plw.578.2018.01.19.07.43.30; Fri, 19 Jan 2018 07:43:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932399AbeASPmg (ORCPT + 99 others); Fri, 19 Jan 2018 10:42:36 -0500 Received: from mx2.rt-rk.com ([89.216.37.149]:58995 "EHLO mail.rt-rk.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932282AbeASPm2 (ORCPT ); Fri, 19 Jan 2018 10:42:28 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.rt-rk.com (Postfix) with ESMTP id 43D0F1A4AC6; Fri, 19 Jan 2018 16:42:27 +0100 (CET) X-Virus-Scanned: amavisd-new at rt-rk.com Received: from rtrkw774-lin.domain.local (unknown [10.10.13.43]) by mail.rt-rk.com (Postfix) with ESMTPSA id 17D861A4AC2; Fri, 19 Jan 2018 16:42:27 +0100 (CET) From: Aleksandar Markovic To: linux-mips@linux-mips.org Cc: Paul Burton , Miodrag Dinic , Aleksandar Markovic , Dengcheng Zhu , Douglas Leung , Goran Ferenc , James Hogan , James Hogan , linux-kernel@vger.kernel.org, Matt Redfearn , Petar Jovanovic , Raghu Gandham , Ralf Baechle Subject: [PATCH v4 2/2] MIPS: CPC: Map registers using DT in mips_cpc_default_phys_base() Date: Fri, 19 Jan 2018 16:40:49 +0100 Message-Id: <1516376459-25672-3-git-send-email-aleksandar.markovic@rt-rk.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516376459-25672-1-git-send-email-aleksandar.markovic@rt-rk.com> References: <1516376459-25672-1-git-send-email-aleksandar.markovic@rt-rk.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paul Burton Reading mips_cpc_base value from the DT allows each platform to define it according to its needs. This is especially convenient for MIPS_GENERIC kernel where this kind of information should be determined in runtime. Use mti,mips-cpc compatible string with just a reg property to specify the register location for your platform. Signed-off-by: Paul Burton Signed-off-by: Miodrag Dinic Signed-off-by: Aleksandar Markovic --- arch/mips/kernel/mips-cpc.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/mips/kernel/mips-cpc.c b/arch/mips/kernel/mips-cpc.c index 19c88d7..fcf9af4 100644 --- a/arch/mips/kernel/mips-cpc.c +++ b/arch/mips/kernel/mips-cpc.c @@ -10,6 +10,8 @@ #include #include +#include +#include #include #include @@ -22,6 +24,17 @@ static DEFINE_PER_CPU_ALIGNED(unsigned long, cpc_core_lock_flags); phys_addr_t __weak mips_cpc_default_phys_base(void) { + struct device_node *cpc_node; + struct resource res; + int err; + + cpc_node = of_find_compatible_node(of_root, NULL, "mti,mips-cpc"); + if (cpc_node) { + err = of_address_to_resource(cpc_node, 0, &res); + if (!err) + return res.start; + } + return 0; } -- 2.7.4