From patchwork Wed Sep 26 13:44:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 1509561 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id BA13DE00F5 for ; Wed, 26 Sep 2012 13:45:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756601Ab2IZNoh (ORCPT ); Wed, 26 Sep 2012 09:44:37 -0400 Received: from mail-ie0-f174.google.com ([209.85.223.174]:49412 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756548Ab2IZNof (ORCPT ); Wed, 26 Sep 2012 09:44:35 -0400 Received: by mail-ie0-f174.google.com with SMTP id k13so1392367iea.19 for ; Wed, 26 Sep 2012 06:44:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=3P86DwuYbCqmvNQ06ytPkrU70merMPqZworku74cQS8=; b=Q2Rtqj6W8D6ssvQjMtkzAkkhSSwc6yk6kjuYauxucCqElBycQwme9BVfOX22VJIK0o zYjPz6c6Kx8Q0KsDFkI/RW62qkByfMh4epyR0fq0vhvioU4n+gHdHyzoI5w2zS7VOVyE qAUBwGAxircbZWTpegCquUb2SL9xjkRkDvNcItGufBcXaAA69Eb1ZQikbFez92HvfYnq 1dpieY3GY47PUUDYypielwkQLRmucW1UEWeOocXQbkSUH4do2ms0kf+1TB5mWFnJur0F adP7Hf5Vsj8cWK99br8xD5Dk3LMYeYZVHKqZ0vRdmCKtrlkEQXUsyDw/5f96m/MutYQ4 IdXQ== Received: by 10.50.217.227 with SMTP id pb3mr11168071igc.28.1348667074958; Wed, 26 Sep 2012 06:44:34 -0700 (PDT) Received: from beef.ohporter.com (cpe-24-166-64-7.neo.res.rr.com. [24.166.64.7]) by mx.google.com with ESMTPS id 7sm4514748igh.0.2012.09.26.06.44.33 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 26 Sep 2012 06:44:34 -0700 (PDT) From: Matt Porter To: Greg Kroah-Hartman , "Hans J. Koch" , Benoit Cousson , Paul Walmsley Cc: Tony Lindgren , Linux OMAP List , Linux Kernel Mailing List Subject: [RFC PATCH 2/3] ARM: omap: add DT support for deasserting hardware reset lines Date: Wed, 26 Sep 2012 09:44:30 -0400 Message-Id: <1348667071-12631-3-git-send-email-mporter@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1348667071-12631-1-git-send-email-mporter@ti.com> References: <1348667071-12631-1-git-send-email-mporter@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org This optional binding extension allows specification of a hwmod and associate hardware reset line which should be deasserted for the device to be functional. The implementation works for reference as to the problem that exists for utilizing uio_pruss on AM33xx but is suboptimal. The problem is that this deassertion occurs before clocks are enabled and we are warned that the hard reset failed. Ideally the list of rst lines requested to be deasserted would be cached and used within the hwmod enable sequencing (instead of it just returning if any hardware reset line is asserted). Signed-off-by: Matt Porter --- .../devicetree/bindings/arm/omap/omap.txt | 2 ++ arch/arm/plat-omap/omap_device.c | 25 ++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/arm/omap/omap.txt b/Documentation/devicetree/bindings/arm/omap/omap.txt index d0051a7..3133a4b 100644 --- a/Documentation/devicetree/bindings/arm/omap/omap.txt +++ b/Documentation/devicetree/bindings/arm/omap/omap.txt @@ -21,6 +21,8 @@ Required properties: Optional properties: - ti,no_idle_on_suspend: When present, it prevents the PM to idle the module during suspend. +- ti,deassert-hard-reset: list of hwmod and hardware reset line name pairs + (ascii strings) to be deasserted upon device instantiation. Example: diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c index d5f617c..d1ae68c 100644 --- a/arch/arm/plat-omap/omap_device.c +++ b/arch/arm/plat-omap/omap_device.c @@ -330,8 +330,8 @@ static int omap_device_build_from_dt(struct platform_device *pdev) struct omap_device *od; struct omap_hwmod *oh; struct device_node *node = pdev->dev.of_node; - const char *oh_name; - int oh_cnt, i, ret = 0; + const char *oh_name, *rst_name; + int oh_cnt, dstr_cnt, i, ret = 0; oh_cnt = of_property_count_strings(node, "ti,hwmods"); if (!oh_cnt || IS_ERR_VALUE(oh_cnt)) { @@ -376,6 +376,27 @@ static int omap_device_build_from_dt(struct platform_device *pdev) if (of_get_property(node, "ti,no_idle_on_suspend", NULL)) omap_device_disable_idle_on_suspend(pdev); + dstr_cnt = + of_property_count_strings(node, "ti,deassert-hard-reset"); + if (dstr_cnt > 0) { + for (i = 0; i < dstr_cnt; i += 2) { + of_property_read_string_index( + node, "ti,deassert-hard-reset", i, + &oh_name); + of_property_read_string_index( + node, "ti,deassert-hard-reset", i+1, + &rst_name); + oh = omap_hwmod_lookup(oh_name); + if (!oh) { + dev_warn(&pdev->dev, + "Cannot parse deassert property for '%s'\n", + oh_name); + break; + } + omap_hwmod_deassert_hardreset(oh, rst_name); + } + } + pdev->dev.pm_domain = &omap_device_pm_domain; odbfd_exit1: