Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp660659ybh; Sat, 3 Aug 2019 07:11:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwra9KCMmHI2GJ+Erd1s9ui73JIgqNI7u4xcF+doqVB75TOLn0UbzpYcQeT7DXtgJzjjpkZ X-Received: by 2002:a62:2c8e:: with SMTP id s136mr65577215pfs.3.1564841509511; Sat, 03 Aug 2019 07:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564841509; cv=none; d=google.com; s=arc-20160816; b=QDN8Wg39eY7xb1AwQXLfkpZGNu2sXQuiG31LiA1y0IfNwOlHetMH6nMFGMYABz0xpa Ho3VCfYCN23NiiN7dyym56p+eXoKgo4Xv4aVODocN92pDyjUAET53lappTS6LRSxpZ5J VQOSVXDG0JkiFHSavaVs3wWuORF34wAPwQgAv4vyA/XAaP3oJQOlODUoq2EEm/C86kvH Vym03b97fMhr0kmdzR7QXP/obSaVDUy0fQmoAODAANwAGE2iXgWoqGhmn3CRlyr88L9/ sKot/KghYbB9M/tt7Dmr4abLGcscufuI+6x1idXgO2R1ilM2LkMkH5lfKcQjMRkK0yxs z4Pw== 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=VyD94y0ZbNA0DOolNewh6y64c+vlWMR5HnZx/nP9fn8=; b=LOaEbn14dRoO7gTdHVl8Ad8mFlFkmGW6uXRgZFLWJS+A/t8hATgl5JZ9ArpWogGkU8 +9/Lp84uylM2ZNTDsE9XNIK5KyGr7zJlAZXkRraF5DLQxAtSbBEUN/qf5AuHYSD8lIiK S7fso3droW27augc4TZqLBufDIVenn3u+7wWQXtoa5NTvqmFPdmyGa5XqoeSg1+ps8I3 bNk2eLnAb7C4j7G4iCMEladKnEJoAlhTDnbrHnkWO3sS5IZ1/nqUq7mBDFMaUMd0ZF+X uHWZdjePcH/BgllcnNs5RMkDjz+mBFdL+ZOzYgHPzCVQjCpDOmQrkWH5Bxy3IcSdYI5F QUOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="pIh3/U35"; 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 j1si38793365pfr.52.2019.08.03.07.11.34; Sat, 03 Aug 2019 07:11:49 -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="pIh3/U35"; 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 S2394966AbfHBOhQ (ORCPT + 99 others); Fri, 2 Aug 2019 10:37:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:45462 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392460AbfHBOhP (ORCPT ); Fri, 2 Aug 2019 10:37:15 -0400 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (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 C764D21726; Fri, 2 Aug 2019 14:37:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564756634; bh=vd9Dv8dBGevOpOI7ckz0Ps8LNrJ4SV3q4dIJDCwbkTI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=pIh3/U350ApivszFbRNnFktXokXBKr+wTTQmTmkTcXIX77COsAo0TgRe92rHIbR0y AeUVQCIkxbsvc60rImMt90f9Qfk0s+a1NDKQxNR8zuysR3wVis/STJnYCS/0bQnTmz YqAKifhFLFjtFzCsZ+eZ0aQV0tGm9ea1esGFu1Xg= Received: by mail-qk1-f179.google.com with SMTP id 201so54907997qkm.9; Fri, 02 Aug 2019 07:37:14 -0700 (PDT) X-Gm-Message-State: APjAAAVq7uE1i/XhWmubbBf9vjI07iLLMsLKPO7EtwoVPl6U/O4hvR9a ZpvFcuPTb1Z0Mjz1alEINyJhQ4IhcUIyvhST7Q== X-Received: by 2002:a37:a44a:: with SMTP id n71mr25665655qke.393.1564756633987; Fri, 02 Aug 2019 07:37:13 -0700 (PDT) MIME-Version: 1.0 References: <20190801184346.7015-1-dinguyen@kernel.org> In-Reply-To: <20190801184346.7015-1-dinguyen@kernel.org> From: Rob Herring Date: Fri, 2 Aug 2019 08:37:02 -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 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). > 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. > > 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. > + if (!IS_ERR(rstc)) { > + reset_control_deassert(rstc); > + reset_control_put(rstc); > + } else { > + pr_debug("amba: reset control not found\n"); > + } > + > ret = amba_device_add(dev, &iomem_resource); > if (ret) { > pr_err("amba_device_add() failed (%d) for %pOF\n", > -- > 2.20.0 >