From patchwork Tue Jul 14 12:57:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 11662833 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 67D2F13B4 for ; Tue, 14 Jul 2020 12:58:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 59FE8224BE for ; Tue, 14 Jul 2020 12:58:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728338AbgGNM6C (ORCPT ); Tue, 14 Jul 2020 08:58:02 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:33260 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728269AbgGNM6B (ORCPT ); Tue, 14 Jul 2020 08:58:01 -0400 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id 33FD4803086A; Tue, 14 Jul 2020 12:57:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at baikalelectronics.ru Received: from mail.baikalelectronics.ru ([127.0.0.1]) by localhost (mail.baikalelectronics.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iCVaAnhbQw0d; Tue, 14 Jul 2020 15:57:58 +0300 (MSK) From: Serge Semin To: Thomas Gleixner , "Rafael J. Wysocki" , Daniel Lezcano , Thomas Bogendoerfer , Greg Kroah-Hartman , Serge Semin CC: Serge Semin , Alexey Malahov , Rob Herring , Arnd Bergmann , Jason Cooper , Marc Zyngier , James Hogan , , , Subject: [PATCH v5 4/6] mips: cdmm: Add mti,mips-cdmm dtb node support Date: Tue, 14 Jul 2020 15:57:50 +0300 Message-ID: <20200714125753.22466-5-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20200714125753.22466-1-Sergey.Semin@baikalelectronics.ru> References: <20200714125753.22466-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Since having and mapping the CDMM block is platform specific, then instead of just returning a zero-address, lets make the default CDMM base address search method (mips_cdmm_phys_base()) to do something useful. For instance to find the address in a dedicated dtb-node in order to support of-based platforms by default. Signed-off-by: Serge Semin --- Changelog prev: - Use alphabetical order for the include pre-processor operator. --- drivers/bus/mips_cdmm.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/bus/mips_cdmm.c b/drivers/bus/mips_cdmm.c index 1b14256376d2..9f7ed1fcd428 100644 --- a/drivers/bus/mips_cdmm.c +++ b/drivers/bus/mips_cdmm.c @@ -13,6 +13,8 @@ #include #include #include +#include +#include #include #include #include @@ -337,9 +339,22 @@ static phys_addr_t mips_cdmm_cur_base(void) * Picking a suitable physical address at which to map the CDMM region is * platform specific, so this weak function can be overridden by platform * code to pick a suitable value if none is configured by the bootloader. + * By default this method tries to find a CDMM-specific node in the system + * dtb. Note that this won't work for early serial console. */ phys_addr_t __weak mips_cdmm_phys_base(void) { + struct device_node *np; + struct resource res; + int err; + + np = of_find_compatible_node(NULL, NULL, "mti,mips-cdmm"); + if (np) { + err = of_address_to_resource(np, 0, &res); + if (!err) + return res.start; + } + return 0; }