diff options
Diffstat (limited to 'target/linux/ipq806x/patches/0050-drivers-of-add-initialization-code-for-dynamic-reser.patch')
-rw-r--r-- | target/linux/ipq806x/patches/0050-drivers-of-add-initialization-code-for-dynamic-reser.patch | 316 |
1 files changed, 0 insertions, 316 deletions
diff --git a/target/linux/ipq806x/patches/0050-drivers-of-add-initialization-code-for-dynamic-reser.patch b/target/linux/ipq806x/patches/0050-drivers-of-add-initialization-code-for-dynamic-reser.patch deleted file mode 100644 index 4b633b599f..0000000000 --- a/target/linux/ipq806x/patches/0050-drivers-of-add-initialization-code-for-dynamic-reser.patch +++ /dev/null @@ -1,316 +0,0 @@ -From 968b497e1027ec78e986370976c76e1652aa0459 Mon Sep 17 00:00:00 2001 -From: Marek Szyprowski <m.szyprowski@samsung.com> -Date: Fri, 28 Feb 2014 14:42:48 +0100 -Subject: [PATCH 050/182] drivers: of: add initialization code for dynamic - reserved memory - -This patch adds support for dynamically allocated reserved memory regions -declared in device tree. Such regions are defined by 'size', 'alignment' -and 'alloc-ranges' properties. - -Based on previous code provided by Josh Cartwright <joshc@codeaurora.org> - -Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> -Signed-off-by: Grant Likely <grant.likely@linaro.org> ---- - drivers/of/Kconfig | 6 ++ - drivers/of/Makefile | 1 + - drivers/of/fdt.c | 13 ++- - drivers/of/of_reserved_mem.c | 188 +++++++++++++++++++++++++++++++++++++++ - include/linux/of_reserved_mem.h | 21 +++++ - 5 files changed, 227 insertions(+), 2 deletions(-) - create mode 100644 drivers/of/of_reserved_mem.c - create mode 100644 include/linux/of_reserved_mem.h - ---- a/drivers/of/Kconfig -+++ b/drivers/of/Kconfig -@@ -75,4 +75,10 @@ config OF_MTD - depends on MTD - def_bool y - -+config OF_RESERVED_MEM -+ depends on OF_EARLY_FLATTREE -+ bool -+ help -+ Helpers to allow for reservation of memory regions -+ - endmenu # OF ---- a/drivers/of/Makefile -+++ b/drivers/of/Makefile -@@ -9,3 +9,4 @@ obj-$(CONFIG_OF_MDIO) += of_mdio.o - obj-$(CONFIG_OF_PCI) += of_pci.o - obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o - obj-$(CONFIG_OF_MTD) += of_mtd.o -+obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o ---- a/drivers/of/fdt.c -+++ b/drivers/of/fdt.c -@@ -15,6 +15,7 @@ - #include <linux/module.h> - #include <linux/of.h> - #include <linux/of_fdt.h> -+#include <linux/of_reserved_mem.h> - #include <linux/sizes.h> - #include <linux/string.h> - #include <linux/errno.h> -@@ -450,7 +451,7 @@ static int __init __reserved_mem_reserve - phys_addr_t base, size; - unsigned long len; - __be32 *prop; -- int nomap; -+ int nomap, first = 1; - - prop = of_get_flat_dt_prop(node, "reg", &len); - if (!prop) -@@ -477,6 +478,10 @@ static int __init __reserved_mem_reserve - uname, &base, (unsigned long)size / SZ_1M); - - len -= t_len; -+ if (first) { -+ fdt_reserved_mem_save_node(node, uname, base, size); -+ first = 0; -+ } - } - return 0; - } -@@ -512,6 +517,7 @@ static int __init __fdt_scan_reserved_me - { - static int found; - const char *status; -+ int err; - - if (!found && depth == 1 && strcmp(uname, "reserved-memory") == 0) { - if (__reserved_mem_check_root(node) != 0) { -@@ -534,7 +540,9 @@ static int __init __fdt_scan_reserved_me - if (status && strcmp(status, "okay") != 0 && strcmp(status, "ok") != 0) - return 0; - -- __reserved_mem_reserve_reg(node, uname); -+ err = __reserved_mem_reserve_reg(node, uname); -+ if (err == -ENOENT && of_get_flat_dt_prop(node, "size", NULL)) -+ fdt_reserved_mem_save_node(node, uname, 0, 0); - - /* scan next node */ - return 0; -@@ -550,6 +558,7 @@ static int __init __fdt_scan_reserved_me - void __init early_init_fdt_scan_reserved_mem(void) - { - of_scan_flat_dt(__fdt_scan_reserved_mem, NULL); -+ fdt_init_reserved_mem(); - } - - /** ---- /dev/null -+++ b/drivers/of/of_reserved_mem.c -@@ -0,0 +1,188 @@ -+/* -+ * Device tree based initialization code for reserved memory. -+ * -+ * Copyright (c) 2013, The Linux Foundation. All Rights Reserved. -+ * Copyright (c) 2013,2014 Samsung Electronics Co., Ltd. -+ * http://www.samsung.com -+ * Author: Marek Szyprowski <m.szyprowski@samsung.com> -+ * Author: Josh Cartwright <joshc@codeaurora.org> -+ * -+ * This program is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU General Public License as -+ * published by the Free Software Foundation; either version 2 of the -+ * License or (at your optional) any later version of the license. -+ */ -+ -+#include <linux/err.h> -+#include <linux/of.h> -+#include <linux/of_fdt.h> -+#include <linux/of_platform.h> -+#include <linux/mm.h> -+#include <linux/sizes.h> -+#include <linux/of_reserved_mem.h> -+ -+#define MAX_RESERVED_REGIONS 16 -+static struct reserved_mem reserved_mem[MAX_RESERVED_REGIONS]; -+static int reserved_mem_count; -+ -+#if defined(CONFIG_HAVE_MEMBLOCK) -+#include <linux/memblock.h> -+int __init __weak early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, -+ phys_addr_t align, phys_addr_t start, phys_addr_t end, bool nomap, -+ phys_addr_t *res_base) -+{ -+ /* -+ * We use __memblock_alloc_base() because memblock_alloc_base() -+ * panic()s on allocation failure.pre { line-height: 125%; margin: 0; }
td.linenos pre { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
span.linenos { color: #000000; background-color: #f0f0f0; padding: 0 5px 0 5px; }
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding: 0 5px 0 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight { background: #ffffff; }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */ From 968b497e1027ec78e986370976c76e1652aa0459 Mon Sep 17 00:00:00 2001
From: Marek Szyprowski <m.szyprowski@samsung.com>
Date: Fri, 28 Feb 2014 14:42:48 +0100
Subject: [PATCH 050/182] drivers: of: add initialization code for dynamic
reserved memory
This patch adds support for dynamically allocated reserved memory regions
declared in device tree. Such regions are defined by 'size', 'alignment'
and 'alloc-ranges' properties.
Based on previous code provided by Josh Cartwright <joshc@codeaurora.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
---
drivers/of/Kconfig | 6 ++
drivers/of/Makefile | 1 +
drivers/of/fdt.c | 13 ++-
drivers/of/of_reserved_mem.c | 188 +++++++++++++++++++++++++++++++++++++++
include/linux/of_reserved_mem.h | 21 +++++
5 files changed, 227 insertions(+), 2 deletions(-)
create mode 100644 drivers/of/of_reserved_mem.c
create mode 100644 include/linux/of_reserved_mem.h
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -75,4 +75,10 @@ config OF_MTD
depends on MTD
def_bool y
+config OF_RESERVED_MEM
+ depends on OF_EARLY_FLATTREE
+ bool
+ help
+ Helpers to allow for reservation of memory regions
+
endmenu # OF
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -9,3 +9,4 @@ obj-$(CONFIG_OF_MDIO) += of_mdio.o
obj-$(CONFIG_OF_PCI) += of_pci.o
obj-$(CONFIG_OF_PCI_IRQ) += of_pci_irq.o
obj-$(CONFIG_OF_MTD) += of_mtd.o
+obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_fdt.h>
+#include <linux/of_reserved_mem.h>
#include <linux/sizes.h>
#include <linux/string.h>
#include <linux/errno.h>
@@ -450,7 +451,7 @@ static int __init __reserved_mem_reserve
phys_addr_t base, size;
unsigned long len;
__be32 *prop;
- int nomap;
+ int nomap, first = 1;
prop = of_get_flat_dt_prop(node, "reg", &len);
if (!prop)
@@ -477,6 +478,10 @@ static int __init __reserved_mem_reserve
uname, &base, (unsigned long)size / SZ_1M);
len -= t_len;
+ if (first) {
+ fdt_reserved_mem_save_node(node, uname, base, size);
+ first = 0;
eserved_mem_save_node(unsigned long node, const char *uname, -+ phys_addr_t base, phys_addr_t size); -+#else -+static inline void fdt_init_reserved_mem(void) { } -+static inline void fdt_reserved_mem_save_node(unsigned long node, -+ const char *uname, phys_addr_t base, phys_addr_t size) { } -+#endif -+ -+#endif /* __OF_RESERVED_MEM_H */ |