Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2476429pxj; Mon, 10 May 2021 04:02:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrsd3wETgek+LqLAQaCKJdHx77HhtYNN6vac74ypI4tR5sx6RWKapugXSHcIXapqtJY6aS X-Received: by 2002:a05:6e02:d53:: with SMTP id h19mr20483864ilj.232.1620644573984; Mon, 10 May 2021 04:02:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620644573; cv=none; d=google.com; s=arc-20160816; b=Gm/x8yDvDdFIQdtiXA8F760oS/TjUrlTEBGxh2YjEfzu3Fl0epUivblQAb/VvdLwPS 2ebOb/CMAnp+WjAED9wR51xN+Zezaa5XahXPUvNNZe0s+NZPkEmzInnRjOw7REEALZYx 3I1NHAa+XLSKRRayi5UqCXVysZajELXsqBnwO2ox0S+mMCy3AilaOLpiW1g5E3JlDalH ibTmnDWKEXwz0tcnivyF0abMuaz7Mvz7R0xlo06KydjgEdNR4Rz9oK771140xzB4F9n3 VLYcwdS48RLmyLxnFb/w40yMjV/LVOyQAdHBOPg+HsO2GSEtcgpTUKziUZqM/si6KN6B dUqQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lwKkhCmbW4eMlIAPHmJo9mzNuUbvPqtJPKWrUUV6gqk=; b=0vY0nzMHgMfVEwYhvInDrwi3d25WCuKS8Ub9Us7wB5uEQwMbLzYhmYereS1ZxbUL80 shh7+mjLMRp50a3gTxpNFHIMohwM0jImC0B4GOEutwgeg/UR6erNfnpO8CAp8FK+p5oc O3i/XAfCjgOORFGnptCr53a97t0e4rkYY08iBqDzN4Kv28ESi+VlMcPHyRTzBKzWtuTj IYdgmbiFfHAJVTB2i2XS7gi0HMIWgMn+Zz0FqCPG8yDv1yn2nkFJLE7NolkmQ1t9FnJy 8w/hIGI7orcLX5gy3Gfy7uPurKvlbo5yxWsMSy6Im+XaPhHBXoWfUNTVZRo7DAOl2weE pJlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xW3dt6+H; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v3si6663116jas.76.2021.05.10.04.02.37; Mon, 10 May 2021 04:02:53 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xW3dt6+H; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234400AbhEJK4U (ORCPT + 99 others); Mon, 10 May 2021 06:56:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:59672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233009AbhEJKo5 (ORCPT ); Mon, 10 May 2021 06:44:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B01DF6143B; Mon, 10 May 2021 10:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642870; bh=v5XGusImn6QmKPp8HJBTBjOXUorUWO8M4g+OdsIfnys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xW3dt6+Hts9r6t13T76Sl070s9Xb7adLWRP1YBYCjd0qRT8YXJ4p/by+zCUPo7z3n X7n7rpMy0LHMYDCFsyhec3apDiRA05uA+lPWKBmGruwCZlT9T1OM9rceURAeuSYiRL qb4OvyfUKjIZUM76zRv5s6MyNO9bu8rRoSEeCWf0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tony Lindgren , Sasha Levin Subject: [PATCH 5.10 051/299] bus: ti-sysc: Probe for l4_wkup and l4_cfg interconnect devices first Date: Mon, 10 May 2021 12:17:28 +0200 Message-Id: <20210510102006.564978575@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tony Lindgren [ Upstream commit 4700a00755fb5a4bb5109128297d6fd2d1272ee6 ] 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 Signed-off-by: Sasha Levin --- 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 index 16e389dce111..9afbe4992a1d 100644 --- 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) @@ -859,6 +904,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); error = sysc_parse_registers(ddata); -- 2.30.2