Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp680719ybh; Sat, 3 Aug 2019 07:36:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqw9anRXgBDMj43EFP0Z7eiAXqFMcT64IrnGW99aT0QnNQtJ/DUCrUMoL5hl3ScrSW50GY1c X-Received: by 2002:a63:b11:: with SMTP id 17mr6224251pgl.283.1564842967149; Sat, 03 Aug 2019 07:36:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564842967; cv=none; d=google.com; s=arc-20160816; b=LWFEn4oGp5lW5qzZZZrD6WdhlUHVYiKVbXU8+03/uq1/Ue+340ySeJ2Bf5EuiAOCnA HPvjJ3SccfEZjqRKeg+iTQ6wEeRoqkWVatK8mJMCZQFKvFJnyyzMli3EuUw04z/gdxT5 hzMR52dH7Bnjb1CrtwYa4/xAOpfNHxJnReGikT7FxYj7rSihQYb2V5jO4xNgQaYiP79j gv5mGSy4EetG8VBSKxPj5wmkzTpXws/978JxvuSOk+5oE20oolIHN6JwPiWlXSCvvV3O xTQiokqS3ZNieWK4uDEi8C+QlxI2gSbnFBFK+NPZnBW1X5QHhOrCzqTbAAnkoT2ozm61 6zVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=PHXZ7UQEtvrCiGyBYbnKTcsB3Wh5XSY+WHSB+tYotv0=; b=O5Otuwme+GM49g7nXgThnLVX6cHwXUp4Mw/Hfg6/OyB3ga1DyMG81sXwxqlCGWKwd9 8y4NouRK1QeD+OY48thnltfYAWewEnAfXRg85OCoIfA/BCz/wDSSqA82rmulj77dqGf7 xa2HcOThavBMQ3ygwRTy/pcZud8KGkzYS95mdf8wvOMpoZi6BtgLkwGekatUF6A3oslm AEPt6HO79l68q3WGGwv1ulUy39r2tZRZGZYN8aM5/dcR3QqyxHXHQ7ofYGLKX2xlldUv AYc3tMOmRT35+KwPwEJVe3SIamrCN79E3hvA+5G+hL0DyT+uNc1rIbX/5FcamUL0e3ys FJYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AwJ+Y8vA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d21si8644076pjw.18.2019.08.03.07.35.52; Sat, 03 Aug 2019 07:36:07 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=AwJ+Y8vA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733019AbfHBPaE (ORCPT + 99 others); Fri, 2 Aug 2019 11:30:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:35106 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732277AbfHBPaE (ORCPT ); Fri, 2 Aug 2019 11:30:04 -0400 Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1E14021783; Fri, 2 Aug 2019 15:30:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564759803; bh=exi+9OQEtZ7oI8S+4n8aYHHOqvpX9ctCa2KPyOEi70c=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=AwJ+Y8vA75d/vMycBEhTJYNB+zLZA65/L8ndELebOL1ft/DqAQHcTHqtXoNjI+hyR wnANR3KMbhOl9eMeXeGdtg+otBpea3bxFK1TSVs6k6IAs/alHczr0U0oMWEdOm9fCU TrwwVTqLcoHrMnL8pt5ifUmEnAxO22zPH+lKfUOg= Received: by mail-qt1-f182.google.com with SMTP id d23so74320206qto.2; Fri, 02 Aug 2019 08:30:03 -0700 (PDT) X-Gm-Message-State: APjAAAWhEbJgIPOKpRnLV/XmmQ/qExZorShaNg1bOYaRfzZjF3jUsc14 Vh3Zl45VOIxA9XOuapYzUVmORcXmQSZTEY7L8w== X-Received: by 2002:a0c:b627:: with SMTP id f39mr99725316qve.72.1564759802191; Fri, 02 Aug 2019 08:30:02 -0700 (PDT) MIME-Version: 1.0 References: <20190801184346.7015-1-dinguyen@kernel.org> <92009928-3df1-1573-7d67-40e79d77c77e@kernel.org> In-Reply-To: <92009928-3df1-1573-7d67-40e79d77c77e@kernel.org> From: Rob Herring Date: Fri, 2 Aug 2019 09:29:50 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] drivers/amba: add reset control to primecell probe To: Dinh Nguyen Cc: devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , Frank Rowand , Kees Cook , Anton Vorontsov , Colin Cross , Tony Luck , Dinh Nguyen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 2, 2019 at 8:42 AM Dinh Nguyen wrote: > > > > On 8/2/19 9:37 AM, Rob Herring wrote: > > On Thu, Aug 1, 2019 at 12:44 PM Dinh Nguyen wrote: > >> > >> From: Dinh Nguyen > >> > >> The primecell controller on some SoCs, i.e. SoCFPGA, is held in reset by > >> default. Until recently, the DMA controller was brought out of reset by the > >> bootloader(i.e. U-Boot). But a recent change in U-Boot, the peripherals that > >> are not used are held in reset and are left to Linux to bring them out of > >> reset. > > > > You can fix this in the kernel, but any versions before this change > > will remain broken. IMO, the u-boot change should be reverted because > > it is breaking an ABI (though not a good one). > > > > Right, there exists in U-Boot to support legacy platforms before this > recent change. This would be for future versions. > > >> Add a mechanism for getting the reset property and de-assert the primecell > >> module from reset if found. This is a not a hard fail if the reset property > >> is not present in the device tree node, so the driver will continue to probe. > > > > I think this belongs in the AMBA bus code, not the DT code, as that is > > where we already have clock control code for similar reasons. > > > > Ok. > > >> > >> Signed-off-by: Dinh Nguyen > >> --- > >> drivers/of/platform.c | 14 ++++++++++++++ > >> 1 file changed, 14 insertions(+) > >> > >> diff --git a/drivers/of/platform.c b/drivers/of/platform.c > >> index 7801e25e6895..d8945705313d 100644 > >> --- a/drivers/of/platform.c > >> +++ b/drivers/of/platform.c > >> @@ -21,6 +21,7 @@ > >> #include > >> #include > >> #include > >> +#include > >> > >> const struct of_device_id of_default_bus_match_table[] = { > >> { .compatible = "simple-bus", }, > >> @@ -229,6 +230,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node, > >> struct amba_device *dev; > >> const void *prop; > >> int i, ret; > >> + struct reset_control *rstc; > >> > >> pr_debug("Creating amba device %pOF\n", node); > >> > >> @@ -270,6 +272,18 @@ static struct amba_device *of_amba_device_create(struct device_node *node, > >> goto err_free; > >> } > >> > >> + /* > >> + * reset control of the primecell block is optional > >> + * and will not fail if the reset property is not found. > >> + */ > >> + rstc = of_reset_control_get_exclusive(node, "dma"); > > > > 'dma' doesn't sound very generic. > > > > how about 'primecell' ? It should be based on what is in the TRMs. Unlike pclk, there doesn't appear to be a standard name or number of resets: pl011: PRESETn and nUARTRST pl330: ARESETn Can't you just retrieve all of them and deassert them all and ignore the name? Also, you might need to use the shared variant as the core code has to work for either dedicated or shared resets. Rob