From patchwork Wed Jan 22 18:58:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Cartwright X-Patchwork-Id: 23557 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f70.google.com (mail-pb0-f70.google.com [209.85.160.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 08759218CB for ; Wed, 22 Jan 2014 19:03:16 +0000 (UTC) Received: by mail-pb0-f70.google.com with SMTP id rq2sf1706980pbb.9 for ; Wed, 22 Jan 2014 11:03:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=BJKEpSrP5fDE3E4ZxUWvXRC6U0gkcV6ahkOIDqB6ikc=; b=Ex+EttahRM3KDn6kUZaseIhI/laiLCbPT6U2pzqxn9fPwyLIr/n1amX4prYPGW6yVk VByiHU3nzjF62L69BVk6f6bz3DAE5BmDEF3SGu14KjOjrJWXpW61i7fZJR9OFuQ81FPM 6H+VMzyKWGrtuPurT+YPP15Z4W5l0P+Z8axXGgp65RhHlwtNH0AoqJWSZscdFsOAnN6l bnY85uyTTVV1Un3cCbDw5kuLxo9rC+V6wtK/N1+n7sbamOJtYXvPoTjr34XR1kHuv/OO nqNtx3j6NOLfy4Y7qqITdi4Cpxto6cAL/YMiFds9NjVN6OQUOd+0Mdxx7+AemhYuga7+ Meuw== X-Gm-Message-State: ALoCoQlj4t1eSLymNnw7+GHv/c4gdiTXGDn2N1LQMnB/4h25svYOEL3dz281mEsPT6l5AEVYz+EK X-Received: by 10.66.218.70 with SMTP id pe6mr1193125pac.33.1390417396291; Wed, 22 Jan 2014 11:03:16 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.96.69 with SMTP id dq5ls141009qeb.85.gmail; Wed, 22 Jan 2014 11:03:16 -0800 (PST) X-Received: by 10.221.34.211 with SMTP id st19mr1997228vcb.5.1390417396137; Wed, 22 Jan 2014 11:03:16 -0800 (PST) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id zw4si5066063vec.112.2014.01.22.11.03.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 Jan 2014 11:03:16 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id im17so476750vcb.5 for ; Wed, 22 Jan 2014 11:03:16 -0800 (PST) X-Received: by 10.220.58.202 with SMTP id i10mr1991536vch.23.1390417396029; Wed, 22 Jan 2014 11:03:16 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp205397vcz; Wed, 22 Jan 2014 11:03:15 -0800 (PST) X-Received: by 10.66.224.165 with SMTP id rd5mr3327000pac.119.1390417394995; Wed, 22 Jan 2014 11:03:14 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ad3si10921150pad.119.2014.01.22.11.03.14; Wed, 22 Jan 2014 11:03:14 -0800 (PST) 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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755622AbaAVTDF (ORCPT + 27 others); Wed, 22 Jan 2014 14:03:05 -0500 Received: from smtp.codeaurora.org ([198.145.11.231]:46057 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752773AbaAVTB4 (ORCPT ); Wed, 22 Jan 2014 14:01:56 -0500 Received: from smtp.codeaurora.org (localhost [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 362A213F142; Wed, 22 Jan 2014 19:01:56 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 486) id 23AD013F25A; Wed, 22 Jan 2014 19:01:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-caf-smtp.dmz.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.1 Received: from joshc.qualcomm.com (rrcs-67-52-129-61.west.biz.rr.com [67.52.129.61]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: joshc@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1440C13F142; Wed, 22 Jan 2014 19:01:54 +0000 (UTC) Received: by joshc.qualcomm.com (Postfix, from userid 1000) id ED1FE61402; Wed, 22 Jan 2014 12:58:54 -0600 (CST) From: Josh Cartwright To: Grant Likely , Rob Herring , linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Marek Szyprowski , Benjamin Herrenschmidt , Laura Abbott , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Rob Landley , devicetree@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH RFC 4/4] of: document bindings for reserved-memory nodes Date: Wed, 22 Jan 2014 12:58:52 -0600 Message-Id: <1390417133-6650-5-git-send-email-joshc@codeaurora.org> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <1390417133-6650-1-git-send-email-joshc@codeaurora.org> References: <1390417133-6650-1-git-send-email-joshc@codeaurora.org> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: joshc@codeaurora.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Grant Likely Reserved memory nodes allow for the reservation of static (fixed address) regions, or dynamically allocated regions for a specific purpose. [joshc: Based on binding document proposed (in non-patch form) here: http://lkml.kernel.org/g/20131030134702.19B57C402A0@trevor.secretlab.ca adapted to support #memory-region-cells] Cc: Marek Szyprowski Cc: Benjamin Herrenschmidt Cc: Laura Abbott Signed-off-by: Josh Cartwright --- Hey Grant- Seeing as you are the primary author of this binding, with only a few minor changes on my part, I've marked you as the commit author. Let me know if that's a problem. Josh .../bindings/reserved-memory/reserved-memory.txt | 137 +++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt diff --git a/Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt b/Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt new file mode 100644 index 0000000..7cd7829 --- /dev/null +++ b/Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt @@ -0,0 +1,137 @@ +*** Reserved memory regions *** + +Reserved memory is specified as a node under the /reserved-memory node. +The operating system shall exclude reserved memory from normal usage +one can create child nodes describing particular reserved (excluded from +normal use) memory regions. Such memory regions are usually designed for +the special usage by various device drivers. + +Parameters for each memory region can be encoded into the device tree +with the following nodes: + +/reserved-memory node +--------------------- +#address-cells, #size-cells (required) - standard definition + - Should use the same values as the root node +#memory-region-cells (required) - dictates number of cells used in the child + nodes memory-region specifier +ranges (required) - standard definition + - Should be empty + +/reserved-memory/ child nodes +----------------------------- +Each child of the reserved-memory node specifies one or more regions of +reserved memory. Each child node may either use a 'reg' property to +specify a specific range of reserved memory, or a 'size' property with +optional constraints to request a dynamically allocated block of memory. + +Following the generic-names recommended practice, node names should +reflect the purpose of the node (ie. "framebuffer" or "dma-pool"). Unit +address (@
) should be appended to the name if the node is a +static allocation. + +Properties: +Requires either a) or b) below. +a) static allocation + reg (required) - standard definition +b) dynamic allocation + size (required) - length based on parent's #size-cells + - Size in bytes of memory to reserve. + alignment (optional) - length based on parent's #size-cells + - Address boundary for alignment of allocation. + alloc-ranges (optional) - prop-encoded-array (address, length pairs). + - Specifies regions of memory that are + acceptable to allocate from. + +If both reg and size are present, then the reg property takes precedence +and size is ignored. + +Additional properties: +compatible (optional) - standard definition + - may contain the following strings: + - shared-dma-pool: This indicates a region of memory meant to be + used as a shared pool of DMA buffers for a set of devices. It can + be used by an operating system to instanciate the necessary pool + management subsystem if necessary. + - vendor specific string in the form ,[-] +no-map (optional) - empty property + - Indicates the operating system must not create a virtual mapping + of the region as part of its standard mapping of system memory, + nor permit speculative access to it under any circumstances other + than under the control of the device driver using the region. +reusable (optional) - empty property + - The operating system can use the memory in this region with the + limitation that the device driver(s) owning the region need to be + able to reclaim it back. Typically that means that the operating + system can use that region to store volatile or cached data that + can be otherwise regenerated or migrated elsewhere. + +Linux implementation note: +- If a "linux,cma-default" property is present, then Linux will use the + region for the default pool of the contiguous memory allocator. + +Device node references to reserved memory +----------------------------------------- +Regions in the /reserved-memory node may be referenced by other device +nodes by adding a memory-region property to the device node. + +memory-region (optional) - phandle, specifier pairs to children of /reserved-memory + +Example +------- +This example defines 3 contiguous regions are defined for Linux kernel: +one default of all device drivers (named linux,cma@72000000 and 64MiB in size), +one dedicated to the framebuffer device (named framebuffer@78000000, 8MiB), and +one for multimedia processing (named multimedia-memory@77000000, 64MiB). + +/ { + #address-cells = <1>; + #size-cells = <1>; + + memory { + reg = <0x40000000 0x40000000>; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + /* global autoconfigured region for contiguous allocations */ + linux,cma { + compatible = "shared-dma-pool"; + #memory-region-cells = <0>; + size = <0x4000000>; + alignment = <0x2000>; + linux,cma-default; + }; + + display_reserved: framebuffer@78000000 { + #memory-region-cells = <0>; + reg = <0x78000000 0x800000>; + }; + + multimedia_reserved: multimedia@77000000 { + compatible = "acme,multimedia-memory"; + #memory-region-cells = <1>; + reg = <0x77000000 0x4000000>; + }; + }; + + /* ... */ + + fb0: video@12300000 { + memory-region = <&display_reserved>; + /* ... */ + }; + + scaler: scaler@12500000 { + memory-region = <&multimedia_reserved 0xdeadbeef>; + /* ... */ + }; + + codec: codec@12600000 { + memory-region = <&multimedia_reserved 0xfeebdaed>; + /* ... */ + }; +};