Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp28253ybj; Wed, 6 May 2020 10:47:32 -0700 (PDT) X-Google-Smtp-Source: APiQypLoH6EsmVukSHMjTJ4fVEQTrOeZ4aJVVxDYU7M47qyXqXMD4PQzRUzTWgU+g6y12y0amIX/ X-Received: by 2002:a50:e8c7:: with SMTP id l7mr7886644edn.309.1588787252156; Wed, 06 May 2020 10:47:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588787252; cv=none; d=google.com; s=arc-20160816; b=1CW3NiAZ8xdrkbAC36MUpi8cZDxhrPpQ7O6tbM3xrJ6GsvdgjyLZRBeutqPrZveLaX XtOFHvcW5+2I3+WphN8jZe7RD+n1C35Z+QapxLTmHR3Eh2gLdX0gqQO4AdBYHoFL1J/1 EDEXfWDVInes4KgjwIkJtOr8vyBxNYYFmRFxx8vY/H4h4RMJz6Gpjr5+m5R0Ogn8dR2S z/kQ6R2TwBm1/IytnvGstWccuwYCZop1283XzukvWvzO7XQzNfId5/lSFkmAcmUFGQ0g 8xnfmCMT2eNWThUW0pJgs/IAchbrkzyIaBoOKbvh63UhnVxFwLZFa9dGNC2gtKHmGFyU eHXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=c0TzCSKrR0IZqrf2XpFQ02Ce6U8UK+A/yQm6E3GpSFw=; b=zStuSTt5emkyXeOlQG4XDSy566qdmolsWwzLaZLE4bPGTFto2qFwjQ0NGUGwU/1FEv f59gafsV9FUW/eCOZYoi2L5A3Y4ZiTX2BTRHa6031iyHzRZKml3xW9+2pRL196E5MYEC 4NlIMEnfmlrEIAmU1fP1ltRpJkr7NlhgwFRqMGtBlgHcdLdZ60pCEJqOC3oFVQdObKpE eYKGCKoPckO8/MiteXJQzQccX9ywhzjzb0i+5rwgl3KioIgHqezYjzVdyyZ+qhKPwlxm +pzDjEEZlgVXL6rtATO48BJ2p/Qb9Pnr0AMOHdQVpz23rpOBXtpJJDarangBnSQf2SL7 uVXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c1si1619099edd.366.2020.05.06.10.47.08; Wed, 06 May 2020 10:47:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730359AbgEFRo3 (ORCPT + 99 others); Wed, 6 May 2020 13:44:29 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:32852 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730167AbgEFRo0 (ORCPT ); Wed, 6 May 2020 13:44:26 -0400 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id 234AA8000B84; Wed, 6 May 2020 17:44:21 +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 Z08SmWcnA9yN; Wed, 6 May 2020 20:44:20 +0300 (MSK) From: To: Thomas Bogendoerfer CC: Serge Semin , Serge Semin , Alexey Malahov , Paul Burton , Ralf Baechle , Greg Kroah-Hartman , Arnd Bergmann , Olof Johansson , Rob Herring , , , , Subject: [PATCH v2 15/20] mips: cdmm: Add mti,mips-cdmm dtb node support Date: Wed, 6 May 2020 20:42:33 +0300 Message-ID: <20200506174238.15385-16-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20200506174238.15385-1-Sergey.Semin@baikalelectronics.ru> References: <20200306124807.3596F80307C2@mail.baikalelectronics.ru> <20200506174238.15385-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Serge Semin 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 Cc: Thomas Bogendoerfer Cc: Alexey Malahov Cc: Paul Burton Cc: Ralf Baechle Cc: Greg Kroah-Hartman Cc: Arnd Bergmann Cc: Olof Johansson Cc: Rob Herring Cc: linux-mips@vger.kernel.org Cc: linux-pm@vger.kernel.org Cc: devicetree@vger.kernel.org --- 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..7faa8c049f07 100644 --- a/drivers/bus/mips_cdmm.c +++ b/drivers/bus/mips_cdmm.c @@ -16,6 +16,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; } -- 2.25.1