From 63c60e3a6dc3eca53714e8a1784c985a552bc5cd Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 5 Apr 2015 16:59:24 +0200 Subject: of: OF_IRQ should depend on IRQ_DOMAIN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If CONFIG_IRQ_DOMAIN=n: drivers/of/irq.c: In function ‘of_irq_get’: drivers/of/irq.c:406: error: implicit declaration of function ‘irq_find_host’ drivers/of/irq.c:406: warning: assignment makes pointer from integer without a cast make[2]: *** [drivers/of/irq.o] Error 1 Signed-off-by: Geert Uytterhoeven Signed-off-by: Rob Herring --- drivers/of/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index 7bcaeec876c0..0638efd15fdd 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig @@ -46,7 +46,7 @@ config OF_ADDRESS_PCI config OF_IRQ def_bool y - depends on !SPARC + depends on !SPARC && IRQ_DOMAIN config OF_NET depends on NETDEVICES -- cgit v1.2.3-59-g8ed1b From d616a703a52cf972425cddd43fc01cd4ef867faf Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Sun, 5 Apr 2015 16:59:25 +0200 Subject: of: Add dummy of_irq_to_resource_table() for IRQ_OF=n If CONFIG_IRQ_OF=n: drivers/built-in.o: In function `of_device_alloc': (.text+0x72bce): undefined reference to `of_irq_to_resource_table' make: *** [vmlinux] Error 1 of_device_alloc() calls of_irq_to_resource_table() with nr_irqs = 0 due to of_irq_count() already being a dummy, so just add a dummy for of_irq_to_resource_table(), too. Signed-off-by: Geert Uytterhoeven Signed-off-by: Rob Herring --- include/linux/of_irq.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h index bfec136a6d1e..d884929a7747 100644 --- a/include/linux/of_irq.h +++ b/include/linux/of_irq.h @@ -37,8 +37,6 @@ extern int of_irq_parse_one(struct device_node *device, int index, extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data); extern int of_irq_to_resource(struct device_node *dev, int index, struct resource *r); -extern int of_irq_to_resource_table(struct device_node *dev, - struct resource *res, int nr_irqs); extern void of_irq_init(const struct of_device_id *matches); @@ -46,6 +44,8 @@ extern void of_irq_init(const struct of_device_id *matches); extern int of_irq_count(struct device_node *dev); extern int of_irq_get(struct device_node *dev, int index); extern int of_irq_get_byname(struct device_node *dev, const char *name); +extern int of_irq_to_resource_table(struct device_node *dev, + struct resource *res, int nr_irqs); #else static inline int of_irq_count(struct device_node *dev) { @@ -59,6 +59,11 @@ static inline int of_irq_get_byname(struct device_node *dev, const char *name) { return 0; } +static inline int of_irq_to_resource_table(struct device_node *dev, + struct resource *res, int nr_irqs) +{ + return 0; +} #endif #if defined(CONFIG_OF) -- cgit v1.2.3-59-g8ed1b From 3712655914530479b424e6f3db2130c48b931a41 Mon Sep 17 00:00:00 2001 From: Alessio Igor Bogani Date: Wed, 8 Apr 2015 11:04:39 +0200 Subject: of: add vendor prefix for Artesyn Signed-off-by: Alessio Igor Bogani Signed-off-by: Rob Herring --- Documentation/devicetree/bindings/vendor-prefixes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt index fae26d014aaf..404dc47f5dae 100644 --- a/Documentation/devicetree/bindings/vendor-prefixes.txt +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt @@ -23,6 +23,7 @@ apm Applied Micro Circuits Corporation (APM) arasan Arasan Chip Systems arm ARM Ltd. armadeus ARMadeus Systems SARL +artesyn Artesyn Embedded Technologies Inc. asahi-kasei Asahi Kasei Corp. atmel Atmel Corporation auo AU Optronics Corporation -- cgit v1.2.3-59-g8ed1b From c954b36e3f5bfdd5aeceba49614a4864d7efec87 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Sun, 12 Apr 2015 13:16:26 -0700 Subject: of/fdt: Remove "reg" data prints from early_init_dt_scan_memory Commit 51975db0b7333 ("of/flattree: merge early_init_dt_scan_memory() common code") consolidated some code from PowerPC (typically big-endian), and ended-up adding a pr_debug() printing reg properties in big-endian (DT native) format, not CPU endian. This debug print suffers from two problems: - we only print 4 "reg" values, while there could be more on typical systems having multiple memory ranges - we print these 4 "reg" values in FDT endianess, that is big-endian, and these values could be confusing for little-endian configurations Since we are already printing the base address and size of the memory regions parsed by early_init_dt_scan_memory() later in a way that is both endian correct, and takes into account arbitrary number of memory banks, just remove that part of the debug print. Suggested-by: Frank Rowand Signed-off-by: Florian Fainelli Signed-off-by: Rob Herring --- drivers/of/fdt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 3a896c9aeb74..34bdc4de83d0 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -879,8 +879,7 @@ int __init early_init_dt_scan_memory(unsigned long node, const char *uname, endp = reg + (l / sizeof(__be32)); - pr_debug("memory scan node %s, reg size %d, data: %x %x %x %x,\n", - uname, l, reg[0], reg[1], reg[2], reg[3]); + pr_debug("memory scan node %s, reg size %d,\n", uname, l); while ((endp - reg) >= (dt_root_addr_cells + dt_root_size_cells)) { u64 base, size; -- cgit v1.2.3-59-g8ed1b From 37786c7fee40771d13901de129af7e084ed48b55 Mon Sep 17 00:00:00 2001 From: Kevin Cernekee Date: Thu, 9 Apr 2015 13:05:14 -0700 Subject: of: Add helper function to check MMIO register endianness SoC peripherals can come in several different flavors: - little-endian: registers always need to be accessed in LE mode (so the kernel should perform a swap if the CPU is running BE) - big-endian: registers always need to be accessed in BE mode (so the kernel should perform a swap if the CPU is running LE) - native-endian: the bus will automatically swap accesses, so the kernel should never swap Introduce a function that checks an OF device node to see whether it contains a "big-endian" or "native-endian" property. For the former case, always return true. For the latter case, return true iff the kernel was built for BE (implying that the BE MMIO accessors do not perform a swap). Otherwise return false, assuming LE registers. LE registers are assumed by default because most existing drivers (libahci, serial8250, usb) always use readl/writel in the absence of instructions to the contrary, so that will be our fallback. Signed-off-by: Kevin Cernekee Reviewed-by: Peter Hurley Acked-by: Greg Kroah-Hartman Signed-off-by: Rob Herring --- drivers/of/base.c | 23 +++++++++++++++++++++++ include/linux/of.h | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index 69566b6a876d..31ca3c8dae61 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -567,6 +567,29 @@ bool of_device_is_available(const struct device_node *device) } EXPORT_SYMBOL(of_device_is_available); +/** + * of_device_is_big_endian - check if a device has BE registers + * + * @device: Node to check for endianness + * + * Returns true if the device has a "big-endian" property, or if the kernel + * was compiled for BE *and* the device has a "native-endian" property. + * Returns false otherwise. + * + * Callers would nominally use ioread32be/iowrite32be if + * of_device_is_big_endian() == true, or readl/writel otherwise. + */ +bool of_device_is_big_endian(const struct device_node *device) +{ + if (of_property_read_bool(device, "big-endian")) + return true; + if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) && + of_property_read_bool(device, "native-endian")) + return true; + return false; +} +EXPORT_SYMBOL(of_device_is_big_endian); + /** * of_get_parent - Get a node's parent if any * @node: Node to get parent diff --git a/include/linux/of.h b/include/linux/of.h index dfde07e77a63..a0cd62ef22db 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -305,6 +305,7 @@ extern int of_property_read_string_helper(struct device_node *np, extern int of_device_is_compatible(const struct device_node *device, const char *); extern bool of_device_is_available(const struct device_node *device); +extern bool of_device_is_big_endian(const struct device_node *device); extern const void *of_get_property(const struct device_node *node, const char *name, int *lenp); @@ -466,6 +467,11 @@ static inline bool of_device_is_available(const struct device_node *device) return false; } +static inline bool of_device_is_big_endian(const struct device_node *device) +{ + return false; +} + static inline struct property *of_find_property(const struct device_node *np, const char *name, int *lenp) -- cgit v1.2.3-59-g8ed1b From cc7837867a559feba70fdf68eb53c24a84e3712f Mon Sep 17 00:00:00 2001 From: Kevin Cernekee Date: Thu, 9 Apr 2015 13:05:15 -0700 Subject: of/fdt: Add endianness helper function for early init code Provide a libfdt-based equivalent for of_device_is_big_endian(), suitable for use in the early_init_* functions. Signed-off-by: Kevin Cernekee Reviewed-by: Peter Hurley Acked-by: Greg Kroah-Hartman Signed-off-by: Rob Herring --- drivers/of/fdt.c | 19 +++++++++++++++++++ include/linux/of_fdt.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 34bdc4de83d0..4b15aa163b6e 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -108,6 +108,25 @@ int of_fdt_is_compatible(const void *blob, return 0; } +/** + * of_fdt_is_big_endian - Return true if given node needs BE MMIO accesses + * @blob: A device tree blob + * @node: node to test + * + * Returns true if the node has a "big-endian" property, or if the kernel + * was compiled for BE *and* the node has a "native-endian" property. + * Returns false otherwise. + */ +bool of_fdt_is_big_endian(const void *blob, unsigned long node) +{ + if (fdt_getprop(blob, node, "big-endian", NULL)) + return true; + if (IS_ENABLED(CONFIG_CPU_BIG_ENDIAN) && + fdt_getprop(blob, node, "native-endian", NULL)) + return true; + return false; +} + /** * of_fdt_match - Return true if node matches a list of compatible values */ diff --git a/include/linux/of_fdt.h b/include/linux/of_fdt.h index 0ff360d5b3b3..587ee507965d 100644 --- a/include/linux/of_fdt.h +++ b/include/linux/of_fdt.h @@ -33,6 +33,8 @@ extern void *of_fdt_get_property(const void *blob, extern int of_fdt_is_compatible(const void *blob, unsigned long node, const char *compat); +extern bool of_fdt_is_big_endian(const void *blob, + unsigned long node); extern int of_fdt_match(const void *blob, unsigned long node, const char *const *compat); extern void of_fdt_unflatten_tree(unsigned long *blob, -- cgit v1.2.3-59-g8ed1b From 65a71007a20cfe7ebd456d72c0bb155fe42de963 Mon Sep 17 00:00:00 2001 From: Kevin Cernekee Date: Thu, 9 Apr 2015 13:05:16 -0700 Subject: of: Document {little,big,native}-endian bindings These apply to newly converted drivers, like serial8250/libahci/... The examples were adapted from the regmap bindings document. Signed-off-by: Kevin Cernekee Reviewed-by: Peter Hurley Acked-by: Greg Kroah-Hartman Signed-off-by: Rob Herring --- .../devicetree/bindings/common-properties.txt | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Documentation/devicetree/bindings/common-properties.txt diff --git a/Documentation/devicetree/bindings/common-properties.txt b/Documentation/devicetree/bindings/common-properties.txt new file mode 100644 index 000000000000..3193979b1d05 --- /dev/null +++ b/Documentation/devicetree/bindings/common-properties.txt @@ -0,0 +1,60 @@ +Common properties + +The ePAPR specification does not define any properties related to hardware +byteswapping, but endianness issues show up frequently in porting Linux to +different machine types. This document attempts to provide a consistent +way of handling byteswapping across drivers. + +Optional properties: + - big-endian: Boolean; force big endian register accesses + unconditionally (e.g. ioread32be/iowrite32be). Use this if you + know the peripheral always needs to be accessed in BE mode. + - little-endian: Boolean; force little endian register accesses + unconditionally (e.g. readl/writel). Use this if you know the + peripheral always needs to be accessed in LE mode. + - native-endian: Boolean; always use register accesses matched to the + endianness of the kernel binary (e.g. LE vmlinux -> readl/writel, + BE vmlinux -> ioread32be/iowrite32be). In this case no byteswaps + will ever be performed. Use this if the hardware "self-adjusts" + register endianness based on the CPU's configured endianness. + +If a binding supports these properties, then the binding should also +specify the default behavior if none of these properties are present. +In such cases, little-endian is the preferred default, but it is not +a requirement. The of_device_is_big_endian() and of_fdt_is_big_endian() +helper functions do assume that little-endian is the default, because +most existing (PCI-based) drivers implicitly default to LE by using +readl/writel for MMIO accesses. + +Examples: +Scenario 1 : CPU in LE mode & device in LE mode. +dev: dev@40031000 { + compatible = "name"; + reg = <0x40031000 0x1000>; + ... + native-endian; +}; + +Scenario 2 : CPU in LE mode & device in BE mode. +dev: dev@40031000 { + compatible = "name"; + reg = <0x40031000 0x1000>; + ... + big-endian; +}; + +Scenario 3 : CPU in BE mode & device in BE mode. +dev: dev@40031000 { + compatible = "name"; + reg = <0x40031000 0x1000>; + ... + native-endian; +}; + +Scenario 4 : CPU in BE mode & device in LE mode. +dev: dev@40031000 { + compatible = "name"; + reg = <0x40031000 0x1000>; + ... + little-endian; +}; -- cgit v1.2.3-59-g8ed1b From c627f2ceb692e8a9358b64ac2d139314e7bb0d17 Mon Sep 17 00:00:00 2001 From: Kevin Cernekee Date: Thu, 9 Apr 2015 13:05:17 -0700 Subject: serial: 8250: Add support for big-endian MMIO accesses Add cases for UPIO_MEM32BE wherever there are currently cases handling UPIO_MEM32. Signed-off-by: Kevin Cernekee Reviewed-by: Peter Hurley Acked-by: Greg Kroah-Hartman Signed-off-by: Rob Herring --- drivers/tty/serial/8250/8250_core.c | 20 ++++++++++++++++++++ drivers/tty/serial/8250/8250_early.c | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index deae122c9c4b..0bffa735eaa1 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -439,6 +439,18 @@ static unsigned int mem32_serial_in(struct uart_port *p, int offset) return readl(p->membase + offset); } +static void mem32be_serial_out(struct uart_port *p, int offset, int value) +{ + offset = offset << p->regshift; + iowrite32be(value, p->membase + offset); +} + +static unsigned int mem32be_serial_in(struct uart_port *p, int offset) +{ + offset = offset << p->regshift; + return ioread32be(p->membase + offset); +} + static unsigned int io_serial_in(struct uart_port *p, int offset) { offset = offset << p->regshift; @@ -477,6 +489,11 @@ static void set_io_from_upio(struct uart_port *p) p->serial_out = mem32_serial_out; break; + case UPIO_MEM32BE: + p->serial_in = mem32be_serial_in; + p->serial_out = mem32be_serial_out; + break; + #if defined(CONFIG_MIPS_ALCHEMY) || defined(CONFIG_SERIAL_8250_RT288X) case UPIO_AU: p->serial_in = au_serial_in; @@ -502,6 +519,7 @@ serial_port_out_sync(struct uart_port *p, int offset, int value) switch (p->iotype) { case UPIO_MEM: case UPIO_MEM32: + case UPIO_MEM32BE: case UPIO_AU: p->serial_out(p, offset, value); p->serial_in(p, UART_LCR); /* safe, no side-effects */ @@ -2743,6 +2761,7 @@ static int serial8250_request_std_resource(struct uart_8250_port *up) case UPIO_AU: case UPIO_TSI: case UPIO_MEM32: + case UPIO_MEM32BE: case UPIO_MEM: if (!port->mapbase) break; @@ -2779,6 +2798,7 @@ static void serial8250_release_std_resource(struct uart_8250_port *up) case UPIO_AU: case UPIO_TSI: case UPIO_MEM32: + case UPIO_MEM32BE: case UPIO_MEM: if (!port->mapbase) break; diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c index c31a22b4f845..84f6d11bbeed 100644 --- a/drivers/tty/serial/8250/8250_early.c +++ b/drivers/tty/serial/8250/8250_early.c @@ -45,6 +45,8 @@ unsigned int __weak __init serial8250_early_in(struct uart_port *port, int offse return readb(port->membase + offset); case UPIO_MEM32: return readl(port->membase + (offset << 2)); + case UPIO_MEM32BE: + return ioread32be(port->membase + (offset << 2)); case UPIO_PORT: return inb(port->iobase + offset); default: @@ -61,6 +63,9 @@ void __weak __init serial8250_early_out(struct uart_port *port, int offset, int case UPIO_MEM32: writel(value, port->membase + (offset << 2)); break; + case UPIO_MEM32BE: + iowrite32be(value, port->membase + (offset << 2)); + break; case UPIO_PORT: outb(value, port->iobase + offset); break; -- cgit v1.2.3-59-g8ed1b From ebc5e20082160df384dedbe1c95066c3e545b689 Mon Sep 17 00:00:00 2001 From: Kevin Cernekee Date: Thu, 9 Apr 2015 13:05:18 -0700 Subject: serial: of_serial: Support big-endian register accesses If the device node has a "big-endian" property and 32-bit registers, tell the serial driver to use UPIO_MEM32BE instead of UPIO_MEM32. Signed-off-by: Kevin Cernekee Acked-by: Greg Kroah-Hartman Signed-off-by: Rob Herring --- drivers/tty/serial/of_serial.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c index 33fb94f78967..e15c443b2a3c 100644 --- a/drivers/tty/serial/of_serial.c +++ b/drivers/tty/serial/of_serial.c @@ -115,7 +115,8 @@ static int of_platform_serial_setup(struct platform_device *ofdev, port->iotype = UPIO_MEM; break; case 4: - port->iotype = UPIO_MEM32; + port->iotype = of_device_is_big_endian(np) ? + UPIO_MEM32BE : UPIO_MEM32; break; default: dev_warn(&ofdev->dev, "unsupported reg-io-width (%d)\n", -- cgit v1.2.3-59-g8ed1b From 05f4647b10233dd2e18106abb16ff7fb68abbd08 Mon Sep 17 00:00:00 2001 From: Ricky Liang Date: Tue, 14 Apr 2015 12:36:05 +0800 Subject: of/fdt: fix allocation size for device node path The allocation size of device node path is off by one which drops the '\0' terminator. Signed-off-by: Ricky Liang Signed-off-by: Rob Herring --- drivers/of/fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 4b15aa163b6e..cde35c5d0191 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -191,7 +191,7 @@ static void * unflatten_dt_node(void *blob, if (!pathp) return mem; - allocl = l++; + allocl = ++l; /* version 0x10 has a more compact unit name here instead of the full * path. we accumulate the full path size using "fpsize", we'll rebuild -- cgit v1.2.3-59-g8ed1b From 492a22aceb75e34e7b1c1b300ecc8bef2a2f42dc Mon Sep 17 00:00:00 2001 From: Pantelis Antoniou Date: Tue, 7 Apr 2015 22:23:49 +0300 Subject: of: unittest: overlay: Keep track of created overlays During the course of the overlay selftests some of them remain applied. While this does not pose a real problem, make sure you track them and destroy them at the end of the test. Signed-off-by: Pantelis Antoniou Signed-off-by: Rob Herring --- drivers/of/unittest.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index fdb597766be9..995cc73ed630 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -23,6 +23,8 @@ #include #include +#include + #include "of_private.h" static struct unittest_results { @@ -1095,6 +1097,59 @@ static const char *overlay_path(int nr) static const char *bus_path = "/testcase-data/overlay-node/test-bus"; +/* it is guaranteed that overlay ids are assigned in sequence */ +#define MAX_UNITTEST_OVERLAYS 256 +static unsigned long overlay_id_bits[BITS_TO_LONGS(MAX_UNITTEST_OVERLAYS)]; +static int overlay_first_id = -1; + +static void of_unittest_track_overlay(int id) +{ + if (overlay_first_id < 0) + overlay_first_id = id; + id -= overlay_first_id; + + /* we shouldn't need that many */ + BUG_ON(id >= MAX_UNITTEST_OVERLAYS); + overlay_id_bits[BIT_WORD(id)] |= BIT_MASK(id); +} + +static void of_unittest_untrack_overlay(int id) +{ + if (overlay_first_id < 0) + return; + id -= overlay_first_id; + BUG_ON(id >= MAX_UNITTEST_OVERLAYS); + overlay_id_bits[BIT_WORD(id)] &= ~BIT_MASK(id); +} + +static void of_unittest_destroy_tracked_overlays(void) +{ + int id, ret, defers; + + if (overlay_first_id < 0) + return; + + /* try until no defers */ + do { + defers = 0; + /* remove in reverse order */ + for (id = MAX_UNITTEST_OVERLAYS - 1; id >= 0; id--) { + if (!(overlay_id_bits[BIT_WORD(id)] & BIT_MASK(id))) + continue; + + ret = of_overlay_destroy(id + overlay_first_id); + if (ret != 0) { + defers++; + pr_warn("%s: overlay destroy failed for #%d\n", + __func__, id + overlay_first_id); + continue; + } + + overlay_id_bits[BIT_WORD(id)] &= ~BIT_MASK(id); + } + } while (defers > 0); +} + static int of_unittest_apply_overlay(int unittest_nr, int overlay_nr, int *overlay_id) { @@ -1116,6 +1171,7 @@ static int of_unittest_apply_overlay(int unittest_nr, int overlay_nr, goto out; } id = ret; + of_unittest_track_overlay(id); ret = 0; @@ -1329,6 +1385,7 @@ static void of_unittest_overlay_6(void) return; } ov_id[i] = ret; + of_unittest_track_overlay(ov_id[i]); } for (i = 0; i < 2; i++) { @@ -1353,6 +1410,7 @@ static void of_unittest_overlay_6(void) PDEV_OVERLAY)); return; } + of_unittest_untrack_overlay(ov_id[i]); } for (i = 0; i < 2; i++) { @@ -1397,6 +1455,7 @@ static void of_unittest_overlay_8(void) return; } ov_id[i] = ret; + of_unittest_track_overlay(ov_id[i]); } /* now try to remove first overlay (it should fail) */ @@ -1419,6 +1478,7 @@ static void of_unittest_overlay_8(void) PDEV_OVERLAY)); return; } + of_unittest_untrack_overlay(ov_id[i]); } unittest(1, "overlay test %d passed\n", 8); @@ -1841,6 +1901,8 @@ static void __init of_unittest_overlay(void) of_unittest_overlay_i2c_cleanup(); #endif + of_unittest_destroy_tracked_overlays(); + out: of_node_put(bus_np); } -- cgit v1.2.3-59-g8ed1b From 4155fc07fa9fd691d424e7f8fb64591cccb88788 Mon Sep 17 00:00:00 2001 From: Mark Rutland Date: Fri, 20 Mar 2015 17:57:47 +0000 Subject: Doc: dt: arch_timer: discourage clock-frequency use The ARM Generic Timer (AKA the architected timer, arm_arch_timer) features a CPU register (CNTFRQ) which firmware is intended to initialize, and non-secure software can read to determine the frequency of the timer. On CPUs with secure state, this register cannot be written from non-secure states. The firmware of early SoCs featuring the timer did not correctly initialize CNTFRQ correctly on all CPUs, requiring the frequency to be described in DT as a workaround. This workaround is not complete however as it is exposed to all software in a privileged non-secure mode (including guests running under a hypervisor). The firmware and DTs for recent SoCs have followed the example set by these early SoCs. This patch updates the arch timer binding documentation to make it clearer that the use of the clock-frequency property is a poor work-around. The MMIO generic timer binding is similarly updated, though this is less of a concern as there is generally no need to expose the MMIO timers to guest OSs. Signed-off-by: Mark Rutland Acked-by: Catalin Marinas Acked-by: Marc Zyngier Acked-by: Olof Johansson Acked-by: Stephen Boyd Cc: Rob Herring Cc: Will Deacon Signed-off-by: Rob Herring --- Documentation/devicetree/bindings/arm/arch_timer.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/arm/arch_timer.txt b/Documentation/devicetree/bindings/arm/arch_timer.txt index 256b4d8bab7b..e774128935d5 100644 --- a/Documentation/devicetree/bindings/arm/arch_timer.txt +++ b/Documentation/devicetree/bindings/arm/arch_timer.txt @@ -17,7 +17,10 @@ to deliver its interrupts via SPIs. - interrupts : Interrupt list for secure, non-secure, virtual and hypervisor timers, in that order. -- clock-frequency : The frequency of the main counter, in Hz. Optional. +- clock-frequency : The frequency of the main counter, in Hz. Should be present + only where necessary to work around broken firmware which does not configure + CNTFRQ on all CPUs to a uniform correct value. Use of this property is + strongly discouraged; fix your firmware unless absolutely impossible. - always-on : a boolean property. If present, the timer is powered through an always-on power domain, therefore it never loses context. @@ -46,7 +49,8 @@ Example: - compatible : Should at least contain "arm,armv7-timer-mem". -- clock-frequency : The frequency of the main counter, in Hz. Optional. +- clock-frequency : The frequency of the main counter, in Hz. Should be present + only when firmware has not configured the MMIO CNTFRQ registers. - reg : The control frame base address. -- cgit v1.2.3-59-g8ed1b From 6480827357923b3977b97c9413a7307be850975d Mon Sep 17 00:00:00 2001 From: Baruch Siach Date: Thu, 19 Mar 2015 14:03:41 +0200 Subject: of: base: improve of_get_next_child() kernel-doc Add two new facts to of_get_next_child() documentation: * of_get_next_child() returns NULL when there is not next child * of_get_next_child() decrements the refcount of prev Signed-off-by: Baruch Siach Signed-off-by: Rob Herring --- drivers/of/base.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index 31ca3c8dae61..7183e825d658 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -663,8 +663,9 @@ static struct device_node *__of_get_next_child(const struct device_node *node, * @node: parent node * @prev: previous child of the parent node, or NULL to get first * - * Returns a node pointer with refcount incremented, use - * of_node_put() on it when done. + * Returns a node pointer with refcount incremented, use of_node_put() on + * it when done. Returns NULL when prev is the last child. Decrements the + * refcount of prev. */ struct device_node *of_get_next_child(const struct device_node *node, struct device_node *prev) -- cgit v1.2.3-59-g8ed1b From f3b07b8611ede9584ef27288d9c35bc2fd7a8353 Mon Sep 17 00:00:00 2001 From: Dinh Nguyen Date: Mon, 20 Apr 2015 09:55:47 -0500 Subject: Documentation: DT bindings: add doc for Altera's SoCFPGA platform Document "altr,socfpga-cyclone5", "altr,socfpga-arria5", and "altr,socfpga-arria10". Signed-off-by: Dinh Nguyen Signed-off-by: Rob Herring --- Documentation/devicetree/bindings/arm/altera.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/altera.txt diff --git a/Documentation/devicetree/bindings/arm/altera.txt b/Documentation/devicetree/bindings/arm/altera.txt new file mode 100644 index 000000000000..558735aacca8 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/altera.txt @@ -0,0 +1,14 @@ +Altera's SoCFPGA platform device tree bindings +--------------------------------------------- + +Boards with Cyclone 5 SoC: +Required root node properties: +compatible = "altr,socfpga-cyclone5", "altr,socfpga"; + +Boards with Arria 5 SoC: +Required root node properties: +compatible = "altr,socfpga-arria5", "altr,socfpga"; + +Boards with Arria 10 SoC: +Required root node properties: +compatible = "altr,socfpga-arria10", "altr,socfpga"; -- cgit v1.2.3-59-g8ed1b From 601e3ad9def147f714c1b66fd397d138ba5dbd3b Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Mon, 20 Apr 2015 08:37:42 -0700 Subject: mn10300: add io{read,write}{16,32}be functions These functions are used in various drivers, including the latest version of the 8250 driver. The latter causes the following build failure. drivers/tty/serial/8250/8250_core.c: In function 'mem32be_serial_out': drivers/tty/serial/8250/8250_core.c:456:2: error: implicit declaration of function 'iowrite32be' drivers/tty/serial/8250/8250_core.c: In function 'mem32be_serial_in': drivers/tty/serial/8250/8250_core.c:462:2: error: implicit declaration of function 'ioread32be' Cc: Kevin Cernekee Acked-by: Greg Kroah-Hartman Fixes: c627f2ceb692 ("serial: 8250: Add support for big-endian MMIO accesses") Signed-off-by: Guenter Roeck Signed-off-by: Rob Herring --- arch/mn10300/include/asm/io.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/mn10300/include/asm/io.h b/arch/mn10300/include/asm/io.h index 897ba3c12b32..cc4a2ba9e228 100644 --- a/arch/mn10300/include/asm/io.h +++ b/arch/mn10300/include/asm/io.h @@ -197,6 +197,11 @@ static inline void outsl(unsigned long addr, const void *buffer, int count) #define iowrite16(v, addr) writew((v), (addr)) #define iowrite32(v, addr) writel((v), (addr)) +#define ioread16be(addr) be16_to_cpu(readw(addr)) +#define ioread32be(addr) be32_to_cpu(readl(addr)) +#define iowrite16be(v, addr) writew(cpu_to_be16(v), (addr)) +#define iowrite32be(v, addr) writel(cpu_to_be32(v), (addr)) + #define ioread8_rep(p, dst, count) \ insb((unsigned long) (p), (dst), (count)) #define ioread16_rep(p, dst, count) \ -- cgit v1.2.3-59-g8ed1b From 04fca0e390e80d88c2f959aef86e0bb7f26fea01 Mon Sep 17 00:00:00 2001 From: Guenter Roeck Date: Mon, 20 Apr 2015 08:36:15 -0700 Subject: frv: add io{read,write}{16,32}be functions These functions are used in various drivers, including the latest version of the 8250 driver. The latter causes the following build failure. drivers/tty/serial/8250/8250_core.c: In function 'mem32be_serial_out': drivers/tty/serial/8250/8250_core.c:456:2: error: implicit declaration of function 'iowrite32be' drivers/tty/serial/8250/8250_core.c: In function 'mem32be_serial_in': drivers/tty/serial/8250/8250_core.c:462:2: error: implicit declaration of function 'ioread32be' Cc: Kevin Cernekee Acked-by: Greg Kroah-Hartman Fixes: c627f2ceb692 ("serial: 8250: Add support for big-endian MMIO accesses") Signed-off-by: Guenter Roeck Signed-off-by: Rob Herring --- arch/frv/include/asm/io.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/frv/include/asm/io.h b/arch/frv/include/asm/io.h index 99bb7efaf9b7..0b78bc89e840 100644 --- a/arch/frv/include/asm/io.h +++ b/arch/frv/include/asm/io.h @@ -342,6 +342,11 @@ static inline void iowrite32(u32 val, void __iomem *p) __flush_PCI_writes(); } +#define ioread16be(addr) be16_to_cpu(ioread16(addr)) +#define ioread32be(addr) be32_to_cpu(ioread32(addr)) +#define iowrite16be(v, addr) iowrite16(cpu_to_be16(v), (addr)) +#define iowrite32be(v, addr) iowrite32(cpu_to_be32(v), (addr)) + static inline void ioread8_rep(void __iomem *p, void *dst, unsigned long count) { io_insb((unsigned long) p, dst, count); -- cgit v1.2.3-59-g8ed1b