From patchwork Fri Sep 28 19:37:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 1522411 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 359BC3FE80 for ; Fri, 28 Sep 2012 19:38:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031457Ab2I1TiY (ORCPT ); Fri, 28 Sep 2012 15:38:24 -0400 Received: from mail-ie0-f174.google.com ([209.85.223.174]:38829 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031425Ab2I1Thy (ORCPT ); Fri, 28 Sep 2012 15:37:54 -0400 Received: by mail-ie0-f174.google.com with SMTP id k13so8209939iea.19 for ; Fri, 28 Sep 2012 12:37:54 -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=iZJ1y2F1/e+r13WI70VBb37zDa9xWrOMPtsUX3/vquSVtPBUKd2oft9tGI+JjN+SvO 8G/Zi01o2NA2NTRXHAZHe6C1kAM155v2X1dQQZWKZwuI8sxhXswAZlWYgdBJRBc8bnE1 uOuOggZSk1ducHoT3yVvOoYuuv6f+t+UuZ745qg7HEnbiORUgLYoeCCL/MvGD3FuauMp LLX212KLNla0+Q4fNC3mj6aF7Z2AZl2PYe6htKJ7jsvxIHjOmg5xlDPQ2kkLRrjhIY5n 4ahJlun4tF4swNDoIIZrQsNBN4VZ+RzSsg/WHIUf8YqeDM82TnPM/PgrCs2GorsnOmCS 2iSg== Received: by 10.50.212.97 with SMTP id nj1mr2622404igc.26.1348861074364; Fri, 28 Sep 2012 12:37:54 -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 q1sm449747igj.15.2012.09.28.12.37.52 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 28 Sep 2012 12:37:53 -0700 (PDT) From: Matt Porter To: Greg Kroah-Hartman , "Hans J. Koch" , Benoit Cousson , Paul Walmsley , Sekhar Nori Cc: Tony Lindgren , Russell King , Linux OMAP List , Linux Kernel Mailing List , Linux ARM Kernel List , Linux DaVinci Kernel List Subject: [PATCH v2 6/7] ARM: omap: add DT support for deasserting hardware reset lines Date: Fri, 28 Sep 2012 15:37:51 -0400 Message-Id: <1348861072-14507-7-git-send-email-mporter@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1348861072-14507-1-git-send-email-mporter@ti.com> References: <1348861072-14507-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: