Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4087595pxb; Tue, 26 Jan 2021 12:03:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzMm8uotNAtA7wPRB4H0lmkukOQnytHnfyYeJmz9lPGrZLK3X3CT7tCsaybAtB/BakSl82P X-Received: by 2002:aa7:cc18:: with SMTP id q24mr5741300edt.82.1611691425671; Tue, 26 Jan 2021 12:03:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611691425; cv=none; d=google.com; s=arc-20160816; b=ckpkkbW8OUgI0rZoBtr16O5wsalZbKDcFHZ8ogrxMJjIJ5/deIauoP6/8Qntr9o+eU 82trHUZ7VGqQXk7fD26itjS6bcUzk+T1oTmQqaQIMxVvPy4rHLfoAxA/wwmc0X3TN8kO +UTOZqVDo252FyCMnsjV/zCjNXYomw+XC6AYytT5sfsRm1a52hjG0pnBjlEUgFfTUMXK t3M0Y+YK2CPGIR3ufvjohkM54Br0M4JDpjYyYShU2GZovOGIYUEvsDBRrCdItg9+Enxr r7cP77BqWhETmK3E94QgNulNLKVndf/E8xU8pk1sE9G2gbbS+OnPse6ceKo0Dn6uTDu2 w3Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=v22t6FQaP8f2yLxw/LZ2jq6OoFRmPawYVorFtJtBFQ8=; b=GuS0+HtiirOjtoxRoe3BCahUrjpyxT4aPRbDJng7YmGIq3oO0598wlxjnR0iWGo6Vu IBHZ1fw0pKLz/3r08JugJFFaP5v4Rv2HU1kJWwSf7eEqQ1uC4kpJJzxU9fXStLVN3FFQ 1mX33rfAYkznGDdQ4Ih/P/hDJbWwvkA+5rJrTAMAT40za87xWxj1VPVa1oYnHfMJz2Hv uEZEFhkH+O7vZyyawDhVazUf35rTal0gL4iO1DDZYX1625I7wNG9XWreXgBFuauCIqhp HZzRUnUCgfSrHgxRfvskBuRbue3TMv9ouvWCWbLw5f/W+fKkb220hMpuHGp1zDTElEab tCBA== 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 v24si9045365eds.230.2021.01.26.12.03.18; Tue, 26 Jan 2021 12:03:45 -0800 (PST) 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 S2392078AbhAZRff (ORCPT + 99 others); Tue, 26 Jan 2021 12:35:35 -0500 Received: from muru.com ([72.249.23.125]:52926 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387454AbhAZHkb (ORCPT ); Tue, 26 Jan 2021 02:40:31 -0500 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id C8E28820C; Tue, 26 Jan 2021 07:28:45 +0000 (UTC) From: Tony Lindgren To: linux-omap@vger.kernel.org Cc: Dave Gerlach , Faiz Abbas , Greg Kroah-Hartman , Grygorii Strashko , Keerthy , Nishanth Menon , Suman Anna , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] bus: ti-sysc: Probe for l4_wkup and l4_cfg interconnect devices first Date: Tue, 26 Jan 2021 09:28:34 +0200 Message-Id: <20210126072835.26551-3-tony@atomide.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210126072835.26551-1-tony@atomide.com> References: <20210126072835.26551-1-tony@atomide.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We want to probe l4_wkup and l4_cfg interconnect devices first to avoid issues with missing resources. Otherwise we attempt to probe l4_per devices first causing pointless deferred probe and also annoyingh renumbering of the MMC devices for example. Signed-off-by: Tony Lindgren --- drivers/bus/ti-sysc.c | 49 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c --- a/drivers/bus/ti-sysc.c +++ b/drivers/bus/ti-sysc.c @@ -635,6 +635,51 @@ static int sysc_parse_and_check_child_range(struct sysc *ddata) return 0; } +/* Interconnect instances to probe before l4_per instances */ +static struct resource early_bus_ranges[] = { + /* am3/4 l4_wkup */ + { .start = 0x44c00000, .end = 0x44c00000 + 0x300000, }, + /* omap4/5 and dra7 l4_cfg */ + { .start = 0x4a000000, .end = 0x4a000000 + 0x300000, }, + /* omap4 l4_wkup */ + { .start = 0x4a300000, .end = 0x4a300000 + 0x30000, }, + /* omap5 and dra7 l4_wkup without dra7 dcan segment */ + { .start = 0x4ae00000, .end = 0x4ae00000 + 0x30000, }, +}; + +static atomic_t sysc_defer = ATOMIC_INIT(10); + +/** + * sysc_defer_non_critical - defer non_critical interconnect probing + * @ddata: device driver data + * + * We want to probe l4_cfg and l4_wkup interconnect instances before any + * l4_per instances as l4_per instances depend on resources on l4_cfg and + * l4_wkup interconnects. + */ +static int sysc_defer_non_critical(struct sysc *ddata) +{ + struct resource *res; + int i; + + if (!atomic_read(&sysc_defer)) + return 0; + + for (i = 0; i < ARRAY_SIZE(early_bus_ranges); i++) { + res = &early_bus_ranges[i]; + if (ddata->module_pa >= res->start && + ddata->module_pa <= res->end) { + atomic_set(&sysc_defer, 0); + + return 0; + } + } + + atomic_dec_if_positive(&sysc_defer); + + return -EPROBE_DEFER; +} + static struct device_node *stdout_path; static void sysc_init_stdout_path(struct sysc *ddata) @@ -860,6 +905,10 @@ static int sysc_map_and_check_registers(struct sysc *ddata) if (error) return error; + error = sysc_defer_non_critical(ddata); + if (error) + return error; + sysc_check_children(ddata); if (!of_get_property(np, "reg", NULL)) -- 2.30.0