Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/155854/?format=api
{ "id": 155854, "url": "http://patchwork.ozlabs.org/api/patches/155854/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-tegra/patch/20120430154404.292de399627814886861b1b8@nvidia.com/", "project": { "id": 21, "url": "http://patchwork.ozlabs.org/api/projects/21/?format=api", "name": "Linux Tegra Development", "link_name": "linux-tegra", "list_id": "linux-tegra.vger.kernel.org", "list_email": "linux-tegra@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20120430154404.292de399627814886861b1b8@nvidia.com>", "list_archive_url": null, "date": "2012-04-30T12:44:04", "name": "[1/1] dt: Add general DMA window parser", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": true, "hash": "fc4721d61323a86b71a497c27c7987f948105116", "submitter": { "id": 10265, "url": "http://patchwork.ozlabs.org/api/people/10265/?format=api", "name": "Hiroshi Doyu", "email": "hdoyu@nvidia.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-tegra/patch/20120430154404.292de399627814886861b1b8@nvidia.com/mbox/", "series": [], "comments": "http://patchwork.ozlabs.org/api/patches/155854/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/155854/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-tegra-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 7C9DDB6F62\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 30 Apr 2012 22:44:21 +1000 (EST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751962Ab2D3MoU (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tMon, 30 Apr 2012 08:44:20 -0400", "from hqemgate04.nvidia.com ([216.228.121.35]:11449 \"EHLO\n\thqemgate04.nvidia.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751482Ab2D3MoT (ORCPT\n\t<rfc822;linux-tegra@vger.kernel.org>);\n\tMon, 30 Apr 2012 08:44:19 -0400", "from hqnvupgp06.nvidia.com (Not Verified[216.228.121.13]) by\n\thqemgate04.nvidia.com\n\tid <B4f9e88e40000>; Mon, 30 Apr 2012 05:43:16 -0700", "from hqemhub02.nvidia.com ([172.17.108.22])\n\tby hqnvupgp06.nvidia.com (PGP Universal service);\n\tMon, 30 Apr 2012 05:44:08 -0700", "from deemhub01.nvidia.com (10.21.69.137) by hqemhub02.nvidia.com\n\t(172.20.150.31) with Microsoft SMTP Server (TLS) id 8.3.245.1;\n\tMon, 30 Apr 2012 05:44:08 -0700", "from oreo (10.21.65.27) by deemhub01.nvidia.com (10.21.69.137) with\n\tMicrosoft SMTP Server (TLS) id 8.3.245.1;\n\tMon, 30 Apr 2012 14:44:05 +0200", "from oreo ([::1])\tby oreo with smtp (Exim 4.76)\t(envelope-from\n\t<hdoyu@nvidia.com>)\tid 1SOpxU-0002fH-Nr;\n\tMon, 30 Apr 2012 15:44:04 +0300" ], "X-PGP-Universal": "processed;\n\tby hqnvupgp06.nvidia.com on Mon, 30 Apr 2012 05:44:08 -0700", "Date": "Mon, 30 Apr 2012 15:44:04 +0300", "From": "Hiroshi Doyu <hdoyu@nvidia.com>", "To": "Grant Likely <grant.likely@secretlab.ca>,\n\t\"devicetree-discuss@lists.ozlabs.org\" \n\t<devicetree-discuss@lists.ozlabs.org>", "CC": "\"linux-tegra@vger.kernel.org\" <linux-tegra@vger.kernel.org>,\n\t\"Thierry Reding\" <thierry.reding@avionic-design.de>,\n\tRob Herring <rob.herring@calxeda.com>,\n\t\"linux-kernel@vger.kernel.org\" <linux-kernel@vger.kernel.org>", "Subject": "[PATCH 1/1] dt: Add general DMA window parser", "Message-ID": "<20120430154404.292de399627814886861b1b8@nvidia.com>", "In-Reply-To": "<1335270004-15652-1-git-send-email-hdoyu@nvidia.com>", "References": "<1335270004-15652-1-git-send-email-hdoyu@nvidia.com>", "X-Mailer": "Sylpheed 3.2.0beta3 (GTK+ 2.24.6; x86_64-pc-linux-gnu)", "X-NVConfidentiality": "public", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"US-ASCII\"", "Content-Transfer-Encoding": "7bit", "Sender": "linux-tegra-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-tegra.vger.kernel.org>", "X-Mailing-List": "linux-tegra@vger.kernel.org" }, "content": "From: Hiroshi DOYU <hdoyu@nvidia.com>\n\nThis code was based on:\n\t\"arch/microblaze/kernel/prom_parse.c\"\n\t\"arch/powerpc/kernel/prom_parse.c\"\n\n\"ibm,\" prefix could be supported with some modification.\n\nSigned-off-by: Hiroshi DOYU <hdoyu@nvidia.com>\nCc: Thierry Reding <thierry.reding@avionic-design.de>\n---\n drivers/of/Kconfig | 4 ++\n drivers/of/Makefile | 1 +\n drivers/of/of_dma.c | 70 ++++++++++++++++++++++++++++++++++++++++++++\n include/linux/of_address.h | 13 ++++++++\n 4 files changed, 88 insertions(+), 0 deletions(-)", "diff": "diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig\nindex dfba3e6..3b0298b 100644\n--- a/drivers/of/Kconfig\n+++ b/drivers/of/Kconfig\n@@ -83,4 +83,8 @@ config OF_MTD\n \tdepends on MTD\n \tdef_bool y\n \n+config OF_DMA\n+\tdepends on HAS_DMA\n+\tdef_bool y\n+\n endmenu # OF\ndiff --git a/drivers/of/Makefile b/drivers/of/Makefile\nindex e027f44..711ff5b 100644\n--- a/drivers/of/Makefile\n+++ b/drivers/of/Makefile\n@@ -11,3 +11,4 @@ obj-$(CONFIG_OF_MDIO)\t+= of_mdio.o\n obj-$(CONFIG_OF_PCI)\t+= of_pci.o\n obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o\n obj-$(CONFIG_OF_MTD)\t+= of_mtd.o\n+obj-$(CONFIG_OF_DMA)\t+= of_dma.o\ndiff --git a/drivers/of/of_dma.c b/drivers/of/of_dma.c\nnew file mode 100644\nindex 0000000..a89fe61\n--- /dev/null\n+++ b/drivers/of/of_dma.c\n@@ -0,0 +1,70 @@\n+/*\n+ * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved.\n+ *\n+ * Based on:\n+ *\t\"arch/microblaze/kernel/prom_parse.c\"\n+ *\t\"arch/powerpc/kernel/prom_parse.c\"\n+ *\n+ * This program is free software; you can redistribute it and/or modify it\n+ * under the terms and conditions of the GNU General Public License,\n+ * version 2, as published by the Free Software Foundation.\n+ *\n+ * This program is distributed in the hope it will be useful, but WITHOUT\n+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\n+ * more details.\n+ */\n+\n+#include <linux/export.h>\n+#include <linux/of_address.h>\n+\n+int of_get_dma_window(struct device_node *dn,\n+\t\t\tconst char *propname, int index,\n+\t\t\tunsigned long *busno,\n+\t\t\tdma_addr_t *addr, size_t *size)\n+{\n+\tconst __be32 *dma_window, *end;\n+\tint bytes, cur_index = 0;\n+\n+\tif (!dn || !addr || !size)\n+\t\treturn -EINVAL;\n+\n+\tif (!propname)\n+\t\tpropname = \"dma-window\";\n+\n+\tdma_window = of_get_property(dn, propname, &bytes);\n+\tif (!dma_window)\n+\t\treturn -ENODEV;\n+\tend = dma_window + bytes / sizeof(*dma_window);\n+\n+\twhile (dma_window < end) {\n+\t\tu32 cells;\n+\t\tconst void *prop;\n+\n+\t\t/* busno is always one cell */\n+\t\tif (busno)\n+\t\t\t*busno = be32_to_cpup(dma_window++);\n+\n+\t\tprop = of_get_property(dn, \"#dma-address-cells\", NULL);\n+\t\tif (!prop)\n+\t\t\tprop = of_get_property(dn, \"#address-cells\", NULL);\n+\n+\t\tcells = prop ? be32_to_cpup(prop) : of_n_addr_cells(dn);\n+\t\tif (!cells)\n+\t\t\treturn -EINVAL;\n+\t\t*addr = of_read_number(dma_window, cells);\n+\t\tdma_window += cells;\n+\n+\t\tprop = of_get_property(dn, \"#dma-size-cells\", NULL);\n+\t\tcells = prop ? be32_to_cpup(prop) : of_n_size_cells(dn);\n+\t\tif (!cells)\n+\t\t\treturn -EINVAL;\n+\t\t*size = of_read_number(dma_window, cells);\n+\t\tdma_window += cells;\n+\n+\t\tif (cur_index++ == index)\n+\t\t\tbreak;\n+\t}\n+\treturn 0;\n+}\n+EXPORT_SYMBOL(of_get_dma_window);\ndiff --git a/include/linux/of_address.h b/include/linux/of_address.h\nindex 01b925a..9d9da9d 100644\n--- a/include/linux/of_address.h\n+++ b/include/linux/of_address.h\n@@ -21,6 +21,11 @@ extern void __iomem *of_iomap(struct device_node *device, int index);\n extern const u32 *of_get_address(struct device_node *dev, int index,\n \t\t\t u64 *size, unsigned int *flags);\n \n+extern int of_get_dma_window(struct device_node *dev,\n+\t\t\t const char *propname, int index,\n+\t\t\t unsigned long *busno,\n+\t\t\t dma_addr_t *phys, size_t *size);\n+\n #ifndef pci_address_to_pio\n static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; }\n #define pci_address_to_pio pci_address_to_pio\n@@ -48,6 +53,14 @@ static inline const u32 *of_get_address(struct device_node *dev, int index,\n {\n \treturn NULL;\n }\n+\n+extern int of_get_dma_window(struct device_node *dev,\n+\t\t\t const char *propname, int index,\n+\t\t\t unsigned long *busno,\n+\t\t\t dma_addr_t *phys, size_t *size)\n+{\n+\treturn 0;\n+}\n #endif /* CONFIG_OF_ADDRESS */\n \n \n", "prefixes": [ "1/1" ] }