From patchwork Thu Aug 1 18:43:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dinh Nguyen X-Patchwork-Id: 1140692 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="YAexMpfN"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 45zzjY3bP7z9s00 for ; Fri, 2 Aug 2019 04:44:33 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727656AbfHASoc (ORCPT ); Thu, 1 Aug 2019 14:44:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:48272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726409AbfHASoc (ORCPT ); Thu, 1 Aug 2019 14:44:32 -0400 Received: from localhost.localdomain (cpe-70-114-128-244.austin.res.rr.com [70.114.128.244]) (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 4B6392084C; Thu, 1 Aug 2019 18:44:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564685071; bh=3y+RqDak0UkrCLxvk0BuKlXenYkKsg6JY6DZHMkLiA8=; h=From:To:Cc:Subject:Date:From; b=YAexMpfN0WJQniiBCxagjhF5dbmJMGAUQx2JqGVz9+1X3mHJcDG3IJ020o3weANxz Ar9X7Qoksy6LHObkkDF70yWBkXlDwEwcDpDt7EMuOHyDU7HedKVOWKYsPOKZVlHi8o B3jD5BKDPL96GC7cMGte3LtdYRo8tzYqI46Q86fA= From: Dinh Nguyen To: devicetree@vger.kernel.org Cc: dinguyen@kernel.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, frowand.list@gmail.com, keescook@chromium.org, anton@enomsg.org, ccross@android.com, tony.luck@intel.com, Dinh Nguyen Subject: [PATCH] drivers/amba: add reset control to primecell probe Date: Thu, 1 Aug 2019 13:43:46 -0500 Message-Id: <20190801184346.7015-1-dinguyen@kernel.org> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org 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. 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. 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"); + 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",