Re: [PATCH 2/5] ARM: NSP: add minimal Northstar Plus device tree

2015-08-26 Thread Olof Johansson
Hi,



On Wed, Aug 26, 2015 at 12:32 PM, Scott Branden sbran...@broadcom.com wrote:
 Hi Olof,

 Comments inline.

 On 15-08-25 04:36 PM, Olof Johansson wrote:

 Hi,

 I'm not sure what the strategy behind your cc:ing on this patch set
 is. I only got a couple of them in my inbox, and this one wasn't one
 of them. :)

 On Thu, Aug 20, 2015 at 10:46 AM, Jon Mason jonma...@broadcom.com wrote:

 Add a very minimalistic set of Northstar Plus Device Tree files which
 describes the SoC and the BCM958625 implementation.  The perpherials
 described are:

 ARM Cortex A9 CPU
 2 8250 UARTs
 ARM GIC
 PL310 L2 Cache
 ARM A9 Global timer

 Signed-off-by: Jon Mason jonma...@broadcom.com
 Signed-off-by: Kapil Hali kap...@broadcom.com
 Reviewed-by: Ray Jui r...@broadcom.com
 Reviewed-by: Scott Branden sbran...@broadcom.com


 Seeing reviewed-by already attached to a v1 of a patchset has limited
 value for someone on the outside.



 Reviewed-by is one of those tags that has a value that's mostly
 dependent on who it comes from. By not actually seeing the review and
 the feedback provided (and revisions made), less data is provided to
 tell if it's a valuable review or not.

 should we start using Ack'd instead then for things that were reviewed
 internally?

Best of all is to do more work in public, including sending the acks
on the list.

If you look around, it's relatively unusual that people post pre-acked
or pre-reviewed patches, even corporate contributors.

 Also, if you're posting the code you should probably have your name
 below Kapil's, since you're the one signing off the origin of the
 code. See Documentation/SubmittingPatches.txt for details on what
 S-o-b actually means.


 --- /dev/null
 +++ b/arch/arm/boot/dts/bcm-nsp.dtsi
 @@ -0,0 +1,105 @@
 +/*
 + *  BSD LICENSE
 + *
 + *  Copyright(c) 2015 Broadcom Corporation.  All rights reserved.
 + *
 + *  Redistribution and use in source and binary forms, with or without
 + *  modification, are permitted provided that the following conditions
 + *  are met:
 + *
 + ** Redistributions of source code must retain the above copyright
 + *  notice, this list of conditions and the following disclaimer.
 + ** Redistributions in binary form must reproduce the above
 copyright
 + *  notice, this list of conditions and the following disclaimer in
 + *  the documentation and/or other materials provided with the
 + *  distribution.
 + ** Neither the name of Broadcom Corporation nor the names of its
 + *  contributors may be used to endorse or promote products derived
 + *  from this software without specific prior written permission.
 + *
 + *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 + *  AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 + *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 FOR
 + *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 + *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 INCIDENTAL,
 + *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 + *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 USE,
 + *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 ANY
 + *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 USE
 + *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 + */


 I'm not sure we've seen BSD-only submissions before. I'll let DT
 maintainers (or Ian) speak up in case this would cause problems.


 Arnd is the one who require new DT content to be BSD licensed.
 We're just following his orders:

 http://lkml.iu.edu/hypermail/linux/kernel/1411.1/01109.html

Yeah, we've been asking for (at least) dual GPL/BSD. This was the
first time I noticed BSD-only which is why I brought it up.

I suspect it is not an issue in reality.

 +
 +#include dt-bindings/interrupt-controller/arm-gic.h
 +#include dt-bindings/interrupt-controller/irq.h
 +
 +#include skeleton.dtsi
 +
 +/ {
 +   compatible = brcm,nsp;
 +   model = Broadcom Northstar Plus SoC;
 +   interrupt-parent = gic;
 +
 +   cpus {
 +   #address-cells = 1;
 +   #size-cells = 0;
 +
 +   cpu@0 {
 +   device_type = cpu;
 +   compatible = arm,cortex-a9;
 +   next-level-cache = L2;
 +   reg = 0x0;
 +   };
 +   };
 +
 +   clocks {
 +   #address-cells = 1;
 +   #size-cells = 1;
 +   ranges;
 +
 +   periph_clk: periph_clk {
 +   compatible = fixed-clock;
 +   #clock-cells = 0;
 +   clock-frequency = 5;
 +   };
 +   };
 +
 +   uart0: serial@18000300 {
 +   compatible = ns16550a;
 +   reg = 0x18000300 0x100;
 +  

[PATCH v5 1/2] dtc: Plugin and fixup support

2015-08-26 Thread Pantelis Antoniou
This patch enable the generation of symbols  local fixup information
for trees compiled with the -@ (--symbols) option.

Using this patch labels in the tree and their users emit information
in __symbols__ and __local_fixups__ nodes.

The __fixups__ node make possible the dynamic resolution of phandle
references which are present in the plugin tree but lie in the
tree that are applying the overlay against.

panto: The original alternative syntax patch required the use of an empty node
which is no longer required.
Numbering of fragments in sequence was also implemented.

Signed-off-by: Pantelis Antoniou pantelis.anton...@konsulko.com
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
Signed-off-by: Jan Luebbe j...@pengutronix.de
---
 Documentation/manual.txt |  16 
 checks.c |  18 -
 dtc-lexer.l  |   5 ++
 dtc-parser.y |  54 +++--
 dtc.c|  21 -
 dtc.h|  13 ++-
 livetree.c   | 202 +++
 treesource.c |   3 +
 8 files changed, 321 insertions(+), 11 deletions(-)

diff --git a/Documentation/manual.txt b/Documentation/manual.txt
index 398de32..29682df 100644
--- a/Documentation/manual.txt
+++ b/Documentation/manual.txt
@@ -119,6 +119,20 @@ Options:
Make space for number reserve map entries
Relevant for dtb and asm output only.
 
+-@
+Generates a __symbols__ node at the root node of the resulting blob
+   for any node labels used, and for any local references using phandles
+   it also generates a __local_fixups__ node that tracks them.
+
+   When using the /plugin/ tag all unresolved label references to
+   be tracked in the __fixups__ node, making dynamic resolution possible.
+
+-A
+   Generate automatically aliases for all node labels. This is similar to
+   the -@ option (the __symbols__ node contain identical information) but
+   the semantics are slightly different since no phandles are automatically
+   generated for labeled nodes.
+
 -S bytes
Ensure the blob at least bytes long, adding additional
space if needed.
@@ -153,6 +167,8 @@ Here is a very rough overview of the layout of a DTS source 
file:
 
 devicetree:   '/' nodedef
 
+plugindecl:   '/' 'plugin' '/' ';'
+
 nodedef:  '{' list_of_property list_of_subnode '}' ';'
 
 property: label PROPNAME '=' propdata ';'
diff --git a/checks.c b/checks.c
index 0c03ac9..65bf6fd 100644
--- a/checks.c
+++ b/checks.c
@@ -466,8 +466,12 @@ static void fixup_phandle_references(struct check *c, 
struct node *dt,
 
refnode = get_node_by_ref(dt, m-ref);
if (! refnode) {
-   FAIL(c, Reference to non-existent node or label 
\%s\\n,
-m-ref);
+   if (!source_is_plugin)
+   FAIL(c, Reference to non-existent node or 
+   label \%s\\n, m-ref);
+   else /* mark the entry as unresolved */
+   *((cell_t *)(prop-val.val + m-offset)) =
+   cpu_to_fdt32(0x);
continue;
}
 
@@ -652,6 +656,15 @@ static void 
check_obsolete_chosen_interrupt_controller(struct check *c,
 }
 TREE_WARNING(obsolete_chosen_interrupt_controller, NULL);
 
+static void check_deprecated_plugin_syntax(struct check *c,
+  struct node *dt)
+{
+   if (deprecated_plugin_syntax_warning)
+   FAIL(c, Use '/dts-v1/ /plugin/'; syntax. /dts-v1/; /plugin/; 
+   is going to be removed in next versions);
+}
+TREE_WARNING(deprecated_plugin_syntax, NULL);
+
 static struct check *check_table[] = {
duplicate_node_names, duplicate_property_names,
node_name_chars, node_name_format, property_name_chars,
@@ -669,6 +682,7 @@ static struct check *check_table[] = {
 
avoid_default_addr_size,
obsolete_chosen_interrupt_controller,
+   deprecated_plugin_syntax,
 
always_fail,
 };
diff --git a/dtc-lexer.l b/dtc-lexer.l
index 0ee1caf..dd44ba2 100644
--- a/dtc-lexer.l
+++ b/dtc-lexer.l
@@ -113,6 +113,11 @@ static void lexical_error(const char *fmt, ...);
return DT_V1;
}
 
+*/plugin/  {
+   DPRINT(Keyword: /plugin/\n);
+   return DT_PLUGIN;
+   }
+
 */memreserve/  {
DPRINT(Keyword: /memreserve/\n);
BEGIN_DEFAULT();
diff --git a/dtc-parser.y b/dtc-parser.y
index 5a897e3..aba 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -19,6 +19,7 @@
  */
 %{
 #include stdio.h
+#include inttypes.h
 
 #include dtc.h
 #include srcpos.h
@@ -52,9 +53,11 @@ extern bool treesource_error;
struct node *nodelist;

[PATCH v5 0/2] dtc: Dynamic DT support

2015-08-26 Thread Pantelis Antoniou
Enable the generation of symbol  fixup information for
use with dynamic DT loading.

Changes since v4:
* Rebase to latest dtc version.
* Completely redesigned the generation of resolution data.
Now instead of being generated as part of blob generation
they are created in the live tree.
* Consequently the patchset is much smaller.
* Added -A auto-label alias generation option.
* Addressed maintainer comments.
* Added syntactic sugar for overlays in the form of .dtsi
* Added /dts-v1/ /plugin/ preferred plugin form and deprecate
the previous form (although still works for backward compatibility)

Changes since v3:
* Rebase to latest dtc version.

Changes since v2:
* Split single patch to a patchset.
* Updated to dtc mainline.
* Changed __local_fixups__ format
* Clean up for better legibility.


Pantelis Antoniou (2):
  dtc: Plugin and fixup support
  dtc: Document the dynamic plugin internals

 Documentation/dt-object-internal.txt | 317 +++
 Documentation/manual.txt |  16 ++
 checks.c |  18 +-
 dtc-lexer.l  |   5 +
 dtc-parser.y |  54 +-
 dtc.c|  21 ++-
 dtc.h|  13 +-
 livetree.c   | 202 ++
 treesource.c |   3 +
 9 files changed, 638 insertions(+), 11 deletions(-)
 create mode 100644 Documentation/dt-object-internal.txt

-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 2/2] dtc: Document the dynamic plugin internals

2015-08-26 Thread Pantelis Antoniou
Provides the document explaining the internal mechanics of
plugins and options.

Signed-off-by: Pantelis Antoniou pantelis.anton...@konsulko.com
---
 Documentation/dt-object-internal.txt | 317 +++
 1 file changed, 317 insertions(+)
 create mode 100644 Documentation/dt-object-internal.txt

diff --git a/Documentation/dt-object-internal.txt 
b/Documentation/dt-object-internal.txt
new file mode 100644
index 000..38a47b6
--- /dev/null
+++ b/Documentation/dt-object-internal.txt
@@ -0,0 +1,317 @@
+Device Tree Dynamic Object format internals
+---
+
+The Device Tree for most platforms is a static representation of
+the hardware capabilities. This is insufficient for many platforms
+that need to dynamically insert device tree fragments to the
+running kernel's live tree.
+
+This document explains the the device tree object format and the
+modifications made to the device tree compiler, which make it possible.
+
+1. Simplified Problem Definition
+
+
+Assume we have a platform which boots using following simplified device tree.
+
+ foo.dts -
+   /* FOO platform */
+   / {
+   compatible = corp,foo;
+
+   /* shared resources */
+   res: res {
+   };
+
+   /* On chip peripherals */
+   ocp: ocp {
+   /* peripherals that are always instantiated */
+   peripheral1 { ... };
+   }
+   };
+ foo.dts -
+
+We have a number of peripherals that after probing (using some undefined 
method)
+should result in different device tree configuration.
+
+We cannot boot with this static tree because due to the configuration of the
+foo platform there exist multiple conficting peripherals DT fragments.
+
+So for the bar peripheral we would have this:
+
+ foo+bar.dts -
+   /* FOO platform + bar peripheral */
+   / {
+   compatible = corp,foo;
+
+   /* shared resources */
+   res: res {
+   };
+
+   /* On chip peripherals */
+   ocp: ocp {
+   /* peripherals that are always instantiated */
+   peripheral1 { ... };
+
+   /* bar peripheral */
+   bar {
+   compatible = corp,bar;
+   ... /* various properties and child nodes */
+   }
+   }
+   };
+ foo+bar.dts -
+
+While for the baz peripheral we would have this:
+
+ foo+baz.dts -
+   /* FOO platform + baz peripheral */
+   / {
+   compatible = corp,foo;
+
+   /* shared resources */
+   res: res {
+   /* baz resources */
+   baz_res: res_baz { ... };
+   };
+
+   /* On chip peripherals */
+   ocp: ocp {
+   /* peripherals that are always instantiated */
+   peripheral1 { ... };
+
+   /* baz peripheral */
+   baz {
+   compatible = corp,baz;
+   /* reference to another point in the tree */
+   ref-to-res = baz_res;
+   ... /* various properties and child nodes */
+   }
+   }
+   };
+ foo+baz.dts -
+
+We note that the baz case is more complicated, since the baz peripheral needs 
to
+reference another node in the DT tree.
+
+2. Device Tree Object Format Requirements
+-
+
+Since the device tree is used for booting a number of very different hardware
+platforms it is imperative that we tread very carefully.
+
+2.a) No changes to the Device Tree binary format. We cannot modify the tree
+format at all and all the information we require should be encoded using device
+tree itself. We can add nodes that can be safely ignored by both bootloaders 
and
+the kernel.
+
+2.b) Changes to the DTS source format should be absolutely minimal, and should
+only be needed for the DT fragment definitions, and not the base boot DT.
+
+2.c) An explicit option should be used to instruct DTC to generate the required
+information needed for object resolution. Platforms that don't use the
+dynamic object format can safely ignore it.
+
+2.d) Finally, DT syntax changes should be kept to a minimum. It should be
+possible to express everything using the existing DT syntax.
+

[PATCH v5 2/2] dtc: Document the dynamic plugin internals

2015-08-26 Thread Pantelis Antoniou
Provides the document explaining the internal mechanics of
plugins and options.

Signed-off-by: Pantelis Antoniou pantelis.anton...@konsulko.com
---
 Documentation/dt-object-internal.txt | 317 +++
 1 file changed, 317 insertions(+)
 create mode 100644 Documentation/dt-object-internal.txt

diff --git a/Documentation/dt-object-internal.txt 
b/Documentation/dt-object-internal.txt
new file mode 100644
index 000..38a47b6
--- /dev/null
+++ b/Documentation/dt-object-internal.txt
@@ -0,0 +1,317 @@
+Device Tree Dynamic Object format internals
+---
+
+The Device Tree for most platforms is a static representation of
+the hardware capabilities. This is insufficient for many platforms
+that need to dynamically insert device tree fragments to the
+running kernel's live tree.
+
+This document explains the the device tree object format and the
+modifications made to the device tree compiler, which make it possible.
+
+1. Simplified Problem Definition
+
+
+Assume we have a platform which boots using following simplified device tree.
+
+ foo.dts -
+   /* FOO platform */
+   / {
+   compatible = corp,foo;
+
+   /* shared resources */
+   res: res {
+   };
+
+   /* On chip peripherals */
+   ocp: ocp {
+   /* peripherals that are always instantiated */
+   peripheral1 { ... };
+   }
+   };
+ foo.dts -
+
+We have a number of peripherals that after probing (using some undefined 
method)
+should result in different device tree configuration.
+
+We cannot boot with this static tree because due to the configuration of the
+foo platform there exist multiple conficting peripherals DT fragments.
+
+So for the bar peripheral we would have this:
+
+ foo+bar.dts -
+   /* FOO platform + bar peripheral */
+   / {
+   compatible = corp,foo;
+
+   /* shared resources */
+   res: res {
+   };
+
+   /* On chip peripherals */
+   ocp: ocp {
+   /* peripherals that are always instantiated */
+   peripheral1 { ... };
+
+   /* bar peripheral */
+   bar {
+   compatible = corp,bar;
+   ... /* various properties and child nodes */
+   }
+   }
+   };
+ foo+bar.dts -
+
+While for the baz peripheral we would have this:
+
+ foo+baz.dts -
+   /* FOO platform + baz peripheral */
+   / {
+   compatible = corp,foo;
+
+   /* shared resources */
+   res: res {
+   /* baz resources */
+   baz_res: res_baz { ... };
+   };
+
+   /* On chip peripherals */
+   ocp: ocp {
+   /* peripherals that are always instantiated */
+   peripheral1 { ... };
+
+   /* baz peripheral */
+   baz {
+   compatible = corp,baz;
+   /* reference to another point in the tree */
+   ref-to-res = baz_res;
+   ... /* various properties and child nodes */
+   }
+   }
+   };
+ foo+baz.dts -
+
+We note that the baz case is more complicated, since the baz peripheral needs 
to
+reference another node in the DT tree.
+
+2. Device Tree Object Format Requirements
+-
+
+Since the device tree is used for booting a number of very different hardware
+platforms it is imperative that we tread very carefully.
+
+2.a) No changes to the Device Tree binary format. We cannot modify the tree
+format at all and all the information we require should be encoded using device
+tree itself. We can add nodes that can be safely ignored by both bootloaders 
and
+the kernel.
+
+2.b) Changes to the DTS source format should be absolutely minimal, and should
+only be needed for the DT fragment definitions, and not the base boot DT.
+
+2.c) An explicit option should be used to instruct DTC to generate the required
+information needed for object resolution. Platforms that don't use the
+dynamic object format can safely ignore it.
+
+2.d) Finally, DT syntax changes should be kept to a minimum. It should be
+possible to express everything using the existing DT syntax.
+

[linux-next][PATCH v2] ARM: sun7i: dt: Add new Olimex A20 EVB device

2015-08-26 Thread codekipper
From: Marcus Cooper codekip...@gmail.com

The A20-SOM-EVB is a reference design of a 2-layer board for the
A20-SOM.
It expands the features of A20-SOM by adding VGA connector, HDMI
connector, audio In/Out, LCD connector, 2 Mpix camera, gigabit
Ethernet, SATA, USB-OTG and 2 USB hosts.

This patch adds basic support for the device
https://www.olimex.com/Products/SOM/A20/A20-SOM-EVB/

More information on the SOM can be found here
http://linux-sunxi.org/Olimex_A20-SOM.

Signed-off-by: Marcus Cooper codekip...@gmail.com
---
Changes since v1:
- renamed dts from sun7i-a20-olinuxino-evb to sun7i-a20-olimex-som-evb
- added axp209 dtsi
- change regulator settings
---
 arch/arm/boot/dts/Makefile |   1 +
 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts | 216 +
 2 files changed, 217 insertions(+)
 create mode 100644 arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index f830e1f..e4e1d29 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -588,6 +588,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
sun7i-a20-i12-tvbox.dtb \
sun7i-a20-m3.dtb \
sun7i-a20-mk808c.dtb \
+   sun7i-a20-olimex-som-evb.dtb \
sun7i-a20-olinuxino-lime.dtb \
sun7i-a20-olinuxino-lime2.dtb \
sun7i-a20-olinuxino-micro.dtb \
diff --git a/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts 
b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
new file mode 100644
index 000..36d1e77
--- /dev/null
+++ b/arch/arm/boot/dts/sun7i-a20-olimex-som-evb.dts
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2015 - Marcus Cooper codekip...@gmail.com
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file 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 option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the Software), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include sun7i-a20.dtsi
+#include sunxi-common-regulators.dtsi
+
+#include dt-bindings/gpio/gpio.h
+#include dt-bindings/interrupt-controller/irq.h
+#include dt-bindings/pinctrl/sun4i-a10.h
+
+/ {
+   model = Olimex A20-Olimex-SOM-EVB;
+   compatible = olimex,a20-olimex-som-evb, allwinner,sun7i-a20;
+
+   aliases {
+   serial0 = uart0;
+   };
+
+   chosen {
+   stdout-path = serial0:115200n8;
+   };
+
+   leds {
+   compatible = gpio-leds;
+   pinctrl-names = default;
+   pinctrl-0 = led_pins_olimex_som_evb;
+
+   green {
+   label = a20-olimex-som-evb:green:usr;
+   gpios = pio 7 2 GPIO_ACTIVE_HIGH;
+   default-state = on;
+   };
+   };
+
+   reg_axp_ipsout: axp_ipsout {
+   compatible = regulator-fixed;
+   regulator-name = axp-ipsout;
+   regulator-min-microvolt = 500;
+   regulator-max-microvolt = 500;
+   regulator-always-on;
+   };
+};
+
+ahci {
+   target-supply = reg_ahci_5v;
+   status = okay;
+};
+
+ehci0 {
+   status = okay;
+};
+
+ehci1 {
+   status = okay;
+};
+
+gmac {
+   pinctrl-names = default;
+   pinctrl-0 = gmac_pins_rgmii_a;
+   

Re: [PATCH 2/5] ARM: NSP: add minimal Northstar Plus device tree

2015-08-26 Thread Jon Mason
On Tue, Aug 25, 2015 at 04:36:45PM -0700, Olof Johansson wrote:
 Hi,
 
 I'm not sure what the strategy behind your cc:ing on this patch set
 is. I only got a couple of them in my inbox, and this one wasn't one
 of them. :)

I sent them to the people listed as maintainers in get_maintainer.pl.
It didn't seem to include you in all of them, but I thought the
mailing list would be enough of a catch all.  My apologies.  I'll CC
everyone listed as a maintainer on all of the patches in the future.

 
 On Thu, Aug 20, 2015 at 10:46 AM, Jon Mason jonma...@broadcom.com wrote:
  Add a very minimalistic set of Northstar Plus Device Tree files which
  describes the SoC and the BCM958625 implementation.  The perpherials
  described are:
 
  ARM Cortex A9 CPU
  2 8250 UARTs
  ARM GIC
  PL310 L2 Cache
  ARM A9 Global timer
 
  Signed-off-by: Jon Mason jonma...@broadcom.com
  Signed-off-by: Kapil Hali kap...@broadcom.com
  Reviewed-by: Ray Jui r...@broadcom.com
  Reviewed-by: Scott Branden sbran...@broadcom.com
 
 Seeing reviewed-by already attached to a v1 of a patchset has limited
 value for someone on the outside.
 
 Reviewed-by is one of those tags that has a value that's mostly
 dependent on who it comes from. By not actually seeing the review and
 the feedback provided (and revisions made), less data is provided to
 tell if it's a valuable review or not.
 
 Also, if you're posting the code you should probably have your name
 below Kapil's, since you're the one signing off the origin of the
 code. See Documentation/SubmittingPatches.txt for details on what
 S-o-b actually means.

We worked on it together, but I'll be happy to reorder as you suggest.

 
 
  --- /dev/null
  +++ b/arch/arm/boot/dts/bcm-nsp.dtsi
  @@ -0,0 +1,105 @@
  +/*
  + *  BSD LICENSE
  + *
  + *  Copyright(c) 2015 Broadcom Corporation.  All rights reserved.
  + *
  + *  Redistribution and use in source and binary forms, with or without
  + *  modification, are permitted provided that the following conditions
  + *  are met:
  + *
  + ** Redistributions of source code must retain the above copyright
  + *  notice, this list of conditions and the following disclaimer.
  + ** Redistributions in binary form must reproduce the above copyright
  + *  notice, this list of conditions and the following disclaimer in
  + *  the documentation and/or other materials provided with the
  + *  distribution.
  + ** Neither the name of Broadcom Corporation nor the names of its
  + *  contributors may be used to endorse or promote products derived
  + *  from this software without specific prior written permission.
  + *
  + *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  + *  AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  + *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  + *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  + *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  + *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  + *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  + *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + */
 
 I'm not sure we've seen BSD-only submissions before. I'll let DT
 maintainers (or Ian) speak up in case this would cause problems.

I was following the precedent in arch/arm/boot/dts/bcm-cygnus.dtsi.
If this is preferred to be GPL v2, then I will happily comply.

 
 
  +
  +#include dt-bindings/interrupt-controller/arm-gic.h
  +#include dt-bindings/interrupt-controller/irq.h
  +
  +#include skeleton.dtsi
  +
  +/ {
  +   compatible = brcm,nsp;
  +   model = Broadcom Northstar Plus SoC;
  +   interrupt-parent = gic;
  +
  +   cpus {
  +   #address-cells = 1;
  +   #size-cells = 0;
  +
  +   cpu@0 {
  +   device_type = cpu;
  +   compatible = arm,cortex-a9;
  +   next-level-cache = L2;
  +   reg = 0x0;
  +   };
  +   };
  +
  +   clocks {
  +   #address-cells = 1;
  +   #size-cells = 1;
  +   ranges;
  +
  +   periph_clk: periph_clk {
  +   compatible = fixed-clock;
  +   #clock-cells = 0;
  +   clock-frequency = 5;
  +   };
  +   };
  +
  +   uart0: serial@18000300 {
  +   compatible = ns16550a;
  +   reg = 0x18000300 0x100;
  +   interrupts = GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH;
  +   clock-frequency = 62499840;
  +   status = disabled;
  +   };
  +
 

Re: [PATCH 2/5] ARM: NSP: add minimal Northstar Plus device tree

2015-08-26 Thread Olof Johansson
On Wed, Aug 26, 2015 at 11:40 AM, Jon Mason jonma...@broadcom.com wrote:
 On Tue, Aug 25, 2015 at 04:36:45PM -0700, Olof Johansson wrote:
 Hi,

 I'm not sure what the strategy behind your cc:ing on this patch set
 is. I only got a couple of them in my inbox, and this one wasn't one
 of them. :)

 I sent them to the people listed as maintainers in get_maintainer.pl.
 It didn't seem to include you in all of them, but I thought the
 mailing list would be enough of a catch all.  My apologies.  I'll CC
 everyone listed as a maintainer on all of the patches in the future.

No worries. Just pointing it out since you asked me to look at the
patches and, well, I hadn't received them all. :)

 On Thu, Aug 20, 2015 at 10:46 AM, Jon Mason jonma...@broadcom.com wrote:
  Add a very minimalistic set of Northstar Plus Device Tree files which
  describes the SoC and the BCM958625 implementation.  The perpherials
  described are:
 
  ARM Cortex A9 CPU
  2 8250 UARTs
  ARM GIC
  PL310 L2 Cache
  ARM A9 Global timer
 
  Signed-off-by: Jon Mason jonma...@broadcom.com
  Signed-off-by: Kapil Hali kap...@broadcom.com
  Reviewed-by: Ray Jui r...@broadcom.com
  Reviewed-by: Scott Branden sbran...@broadcom.com

 Seeing reviewed-by already attached to a v1 of a patchset has limited
 value for someone on the outside.

 Reviewed-by is one of those tags that has a value that's mostly
 dependent on who it comes from. By not actually seeing the review and
 the feedback provided (and revisions made), less data is provided to
 tell if it's a valuable review or not.

 Also, if you're posting the code you should probably have your name
 below Kapil's, since you're the one signing off the origin of the
 code. See Documentation/SubmittingPatches.txt for details on what
 S-o-b actually means.

 We worked on it together, but I'll be happy to reorder as you suggest.



  --- /dev/null
  +++ b/arch/arm/boot/dts/bcm-nsp.dtsi
  @@ -0,0 +1,105 @@
  +/*
  + *  BSD LICENSE
  + *
  + *  Copyright(c) 2015 Broadcom Corporation.  All rights reserved.
  + *
  + *  Redistribution and use in source and binary forms, with or without
  + *  modification, are permitted provided that the following conditions
  + *  are met:
  + *
  + ** Redistributions of source code must retain the above copyright
  + *  notice, this list of conditions and the following disclaimer.
  + ** Redistributions in binary form must reproduce the above copyright
  + *  notice, this list of conditions and the following disclaimer in
  + *  the documentation and/or other materials provided with the
  + *  distribution.
  + ** Neither the name of Broadcom Corporation nor the names of its
  + *  contributors may be used to endorse or promote products derived
  + *  from this software without specific prior written permission.
  + *
  + *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  + *  AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  + *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  + *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  + *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  + *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  + *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  + *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  + *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  + */

 I'm not sure we've seen BSD-only submissions before. I'll let DT
 maintainers (or Ian) speak up in case this would cause problems.

 I was following the precedent in arch/arm/boot/dts/bcm-cygnus.dtsi.
 If this is preferred to be GPL v2, then I will happily comply.

No, we'd rather have BSD-only than GPL-only, so keeping it as it is
should be OK.

  +   chosen {
  +   stdout-path = serial0:115200n8;
  +   };

 No way to mount a root filesystem yet? How much work remains for that
 to be possible, and what's the plan for that?

 It mounts rootfs.  I am adding the rootfs to the kernel and device
 tree blob via the u-boot mkimage command.  It boots all the way to
 shell without issue.

Sure, any system with memory can use ramdisk for root, that's not what I meant.

Still, based on post from Scott it sounds like NAND support isn't far away.


-Olof
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 00/10] Add support for img AXD audio hardware decoder

2015-08-26 Thread Mark Brown
On Mon, Aug 24, 2015 at 01:39:09PM +0100, Qais Yousef wrote:

 Qais Yousef (10):
   irqchip: irq-mips-gic: export gic_send_ipi
   dt: add img,axd.txt device tree binding document
   ALSA: add AXD Audio Processing IP alsa driver
   ALSA: axd: add fw binary header manipulation files
   ALSA: axd: add buffers manipulation files
   ALSA: axd: add basic files for sending/receiving axd cmds
   ALSA: axd: add cmd interface helper functions
   ALSA: axd: add low level AXD platform setup files
   ALSA: axd: add alsa compress offload operations
   ALSA: axd: add Makefile

Please try to use subject lines matching the style for the subsystem, I
very nearly deleted this unread because it looks like an ALSA patch
series, not an ASoC one.


signature.asc
Description: Digital signature


Re: [PATCH 2/5] ARM: NSP: add minimal Northstar Plus device tree

2015-08-26 Thread Scott Branden

Hi Olof,

Comments inline.

On 15-08-25 04:36 PM, Olof Johansson wrote:

Hi,

I'm not sure what the strategy behind your cc:ing on this patch set
is. I only got a couple of them in my inbox, and this one wasn't one
of them. :)

On Thu, Aug 20, 2015 at 10:46 AM, Jon Mason jonma...@broadcom.com wrote:

Add a very minimalistic set of Northstar Plus Device Tree files which
describes the SoC and the BCM958625 implementation.  The perpherials
described are:

ARM Cortex A9 CPU
2 8250 UARTs
ARM GIC
PL310 L2 Cache
ARM A9 Global timer

Signed-off-by: Jon Mason jonma...@broadcom.com
Signed-off-by: Kapil Hali kap...@broadcom.com
Reviewed-by: Ray Jui r...@broadcom.com
Reviewed-by: Scott Branden sbran...@broadcom.com


Seeing reviewed-by already attached to a v1 of a patchset has limited
value for someone on the outside.




Reviewed-by is one of those tags that has a value that's mostly
dependent on who it comes from. By not actually seeing the review and
the feedback provided (and revisions made), less data is provided to
tell if it's a valuable review or not.
should we start using Ack'd instead then for things that were reviewed 
internally?


Also, if you're posting the code you should probably have your name
below Kapil's, since you're the one signing off the origin of the
code. See Documentation/SubmittingPatches.txt for details on what
S-o-b actually means.



--- /dev/null
+++ b/arch/arm/boot/dts/bcm-nsp.dtsi
@@ -0,0 +1,105 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2015 Broadcom Corporation.  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ ** Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ ** Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in
+ *  the documentation and/or other materials provided with the
+ *  distribution.
+ ** Neither the name of Broadcom Corporation nor the names of its
+ *  contributors may be used to endorse or promote products derived
+ *  from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */


I'm not sure we've seen BSD-only submissions before. I'll let DT
maintainers (or Ian) speak up in case this would cause problems.



Arnd is the one who require new DT content to be BSD licensed.
We're just following his orders:

http://lkml.iu.edu/hypermail/linux/kernel/1411.1/01109.html




+
+#include dt-bindings/interrupt-controller/arm-gic.h
+#include dt-bindings/interrupt-controller/irq.h
+
+#include skeleton.dtsi
+
+/ {
+   compatible = brcm,nsp;
+   model = Broadcom Northstar Plus SoC;
+   interrupt-parent = gic;
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   cpu@0 {
+   device_type = cpu;
+   compatible = arm,cortex-a9;
+   next-level-cache = L2;
+   reg = 0x0;
+   };
+   };
+
+   clocks {
+   #address-cells = 1;
+   #size-cells = 1;
+   ranges;
+
+   periph_clk: periph_clk {
+   compatible = fixed-clock;
+   #clock-cells = 0;
+   clock-frequency = 5;
+   };
+   };
+
+   uart0: serial@18000300 {
+   compatible = ns16550a;
+   reg = 0x18000300 0x100;
+   interrupts = GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH;
+   clock-frequency = 62499840;
+   status = disabled;
+   };
+
+   uart1: serial@18000400 {
+   compatible = ns16550a;
+   reg = 0x18000400 0x100;
+   interrupts = GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH;
+   clock-frequency = 62499840;
+   status = disabled;
+   };
+
+   gic: interrupt-controller@19021000 {
+   compatible = arm,cortex-a9-gic;
+   #interrupt-cells = 3;
+   

Re: [PATCH 2/2] mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller.

2015-08-26 Thread Marek Vasut
On Wednesday, August 26, 2015 at 12:09:50 AM, vikas wrote:
 Hi,
 
 On 08/21/2015 02:20 AM, Marek Vasut wrote:
  From: Graham Moore grmo...@opensource.altera.com
  
  Add support for the Cadence QSPI controller. This controller is
  present in the Altera SoCFPGA SoCs and this driver has been tested
  on the Cyclone V SoC.
  
  Signed-off-by: Graham Moore grmo...@opensource.altera.com
  Signed-off-by: Marek Vasut ma...@denx.de
  Cc: Alan Tull at...@opensource.altera.com
  Cc: Brian Norris computersforpe...@gmail.com
  Cc: David Woodhouse dw...@infradead.org
  Cc: Dinh Nguyen dingu...@opensource.altera.com
  Cc: Graham Moore grmo...@opensource.altera.com
  Cc: Vikas MANOCHA vikas.mano...@st.com
  Cc: Yves Vandervennet yvand...@opensource.altera.com
  Cc: devicetree@vger.kernel.org
  ---
  
   drivers/mtd/spi-nor/Kconfig   |   11 +
   drivers/mtd/spi-nor/Makefile  |1 +
   drivers/mtd/spi-nor/cadence-quadspi.c | 1260
   + 3 files changed, 1272 insertions(+)
   create mode 100644 drivers/mtd/spi-nor/cadence-quadspi.c
  
  V2: use NULL instead of modalias in spi_nor_scan call
  V3: Use existing property is-decoded-cs instead of creating duplicate.
  V4: Support Micron quad mode by snooping command stream for EVCR command
  
  and subsequently configuring Cadence controller for quad mode.
  
  V5: Clean up sparse and smatch complaints.  Remove snooping of Micron
  
  quad mode.  Add comment on XIP mode bit and dummy clock cycles.  Set
  up SRAM partition at 1:1 during init.
  
  V6: Remove dts patch that was included by mistake.  Incorporate Vikas's
  
  comments regarding fifo width, SRAM partition setting, and trigger
  address.  Trigger address was added as an unsigned int, as it is not
  an IO resource per se, and does not need to be mapped. Also add
  Marek Vasut's workaround for picking up OF properties on subnodes.
  
  V7: - Perform coding-style cleanup and type fixes. Remove ugly QSPI_*()
  
macros and replace them with functions. Get rid of unused
variables.
  
  - Implement support for nor-set_protocol() to handle Quad-command,
  
this patch now depends on the following patch:
mtd: spi-nor: notify (Q)SPI controller about protocol change
  
  - Replace that cqspi_fifo_read() disaster with plain old readsl()
  
and cqspi_fifo_write() tentacle horror with pretty writesl().
  
  - Remove CQSPI_SUPPORT_XIP_CHIPS, which is broken.
  - Get rid of cqspi_find_chipselect() mess, instead just place the
  
struct cqspi_st and chipselect number into struct cqspi_flash_pdata
and set nor-priv to the struct cqspi_flash_pdata of that
particular chip.
  
  - Replace the odd math in calculate_ticks_for_ns() with
  DIV_ROUND_UP(). - Make variables const where applicable.
  
  V8: - Implement a function to wait for bit being set/unset for a given
  
period of time and use it to replace the ad-hoc bits of code.
  
  - Configure the write underflow watermark to be 1/8 if FIFO size.
  - Extract out the SPI NOR flash probing code into separate function
  
to clearly mark what will soon be considered a boilerplate code.
  
  - Repair the handling of mode bits, which caused instability in V7.
  - Clean up the interrupt handling
  - Fix Kconfig help text and make the patch depend on OF and
  COMPILE_TEST.
  
  diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig
  index 89bf4c1..ed253a2 100644
  --- a/drivers/mtd/spi-nor/Kconfig
  +++ b/drivers/mtd/spi-nor/Kconfig
  @@ -40,4 +40,15 @@ config SPI_NXP_SPIFI
  
Flash. Enable this option if you have a device with a SPIFI
controller and want to access the Flash as a mtd device.
  
  +config SPI_CADENCE_QUADSPI
  +   tristate Cadence Quad SPI controller
  +   depends on OF  COMPILE_TEST
  +   help
  + Enable support for the Cadence Quad SPI Flash controller.
  +
  + Cadence QSPI is a specialized controller for connecting an SPI
  + Flash over 1/2/4-bit wide bus. Enable this option if you have a
  + device with a Cadence QSPI controller and want to access the
  + Flash as an MTD device.
  +
 
 the patch failed to apply, please rebase it to master.

it's based on -next, I'm sure you can fix trivial conflicts yourself if you
need to apply it elsewhere. Do you have any other review comments ?
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/7] dmaengine: st_fdma: Add STMicroelectronics FDMA DT binding documentation

2015-08-26 Thread Lee Jones
On Tue, 25 Aug 2015, Peter Griffin wrote:

 Hi Vinod,
 
 Thanks for reviewing.
 
 On Wed, 19 Aug 2015, Vinod Koul wrote:
 
  On Wed, Jul 08, 2015 at 05:11:22PM +0100, Peter Griffin wrote:
   This patch adds the DT binding documentation for the FDMA constroller
   found on STi based chipsets from STMicroelectronics.
   
   Signed-off-by: Ludovic Barre ludovic.ba...@st.com
   Signed-off-by: Peter Griffin peter.grif...@linaro.org
   ---
Documentation/devicetree/bindings/dma/st_fdma.txt | 76 
   +++
1 file changed, 76 insertions(+)
create mode 100644 Documentation/devicetree/bindings/dma/st_fdma.txt
   
   diff --git a/Documentation/devicetree/bindings/dma/st_fdma.txt 
   b/Documentation/devicetree/bindings/dma/st_fdma.txt
   new file mode 100644
   index 000..1ec7470
   --- /dev/null
   +++ b/Documentation/devicetree/bindings/dma/st_fdma.txt
   @@ -0,0 +1,76 @@
   +* STMicroelectronics Flexible Direct Memory Access Device Tree bindings
   +
   +The FDMA is a general-purpose direct memory access controller capable of
   +supporting 16 independent DMA channels. It accepts up to 32 DMA requests.
   +The FDMA is based on a Slim processor which require a firmware.
   +
   +* FDMA Controller
   +
   +Required properties:
   +- compatible : Should be st,fdma_mpe31
   +- reg: Should contain DMA registers location and length
   +- interrupts : Should contain one interrupt shared by all channel
  
  s/channel/channels
 
 Will fix in v2.
 
  
   +- dma-channels   : Number of channels supported by the controller
   +- #dma-cells : Must be 3.
  
  any reason three?
 
 Yes, it is documented further down in the file under DMA Client.
 
 To make it clearer in V2 I could change to
 
 - #dma-cells : Must be 3. See DMA client section below?

- #dma-cells: Must be 3
1st cell: Phandle to   ... blah
2nd cell: DMA channel  ... blah
3rd cell: Flags describing ... blah   

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v1 3/3] arm64: dts: add Hi6220 mailbox node

2015-08-26 Thread Leo Yan
Hi Haojian,

On Wed, Aug 26, 2015 at 09:25:41AM +0800, Haojian Zhuang wrote:
 On Wed, 2015-08-26 at 00:00 +0800, Leo Yan wrote:
  On Tue, Aug 25, 2015 at 09:43:14PM +0800, Haojian Zhuang wrote:
   On Tue, 2015-08-25 at 11:42 +0100, Mark Rutland wrote:
  Are you then going to hack GRUB, release a special HiKey version of
  GRUB, not support any other versions, and still can your firmware
  UEFI?
 
 I don't need to hack GRUB at all.

Then it is working for you by pure chance alone.

Please listen to the advice you are being given here; we're trying to
ensure that your platform functions (and continues to function) as best
it can.
   
   Since we discussed a lot on this, let's make a conclusion on it.
   
   1. UEFI could append the reserved buffer in it's memory mapping.
   2. These reserved buffer must be declared in DT, since we also need to
  support non-UEFI (uboot) at the same time.
   3. Mailbox node should reference reserved buffer by phandle in DT. Then
  map the buffer as non-cacheable in driver.
   4. These reserved buffer must use no-map property since it should be
  non-cacheable in driver.
  
  For more specific discussion for DTS, i list two options at here;
  
  - Option 1: just simply reserve memory regions through memory node,
and mailbox node will directly use the buffer through reg ranges;
  
  - Option 2: use reserved-memory and mailbox node will refer phandle
of reserved-memory;
  
  These two options both can work well with UEFI and Uboot, but option 1
  is more simple and straightforward; so i personally prefer it. But
  look forwarding your guys' suggestion.
  
  Option 1:
  
  memory@0 {
  device_type = memory;
  reg = 0x 0x 0x 0x05e0,
0x 0x05f0 0x 0x00eff000,
0x 0x06e0 0x 0x0060f000,
0x 0x0741 0x 0x38bf;
  };
  
  [...]
  
  mailbox: mailbox@f751 {
  #mbox-cells = 1;
  compatible = hisilicon,hi6220-mbox;
  reg = 0x0 0xf751 0x0 0x1000, /* IPC_S */
0x0 0x06dff800 0x0 0x0800; /* Mailbox buffer */
  interrupts = GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH;
  };
  
  Option 2:
  
  memory@0 {
  device_type = memory;
  reg = 0x0 0x0 0x0 0x4000;
  };
  
  reserved-memory {
  #address-cells = 2;
  #size-cells = 2;
  ranges;
  
  mcu_reserved: mcu_reserved@06dff000 {
  no-map;
  reg = 0x0 0x06dff000 0x0 0x1000,  /* MCU mailbox 
  buffer */
0x0 0x05e0 0x0 0x0010,  /* MCU firmware 
  buffer */
0x0 0x0740f000 0x0 0x1000;  /* MCU firmware 
  section */
  };
  };
  
  [...]
  
  mailbox: mailbox@f751 {
  #mbox-cells = 1;
  compatible = hisilicon,hi6220-mbox;
  reg = 0x0 0xf751 0x0 0x1000; /* IPC_S */
  memory-region = mcu_reserved;   /* Mailbox buffer */
  interrupts = GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH;
  };
 
 I prefer the second one. From my view, memory node should only describe
 the hardware information of memory.

Yes, option 2 will be more simple for memory node.

But option 2 also will introduce complexity for mailbox node, due mailbox
driver need use property reg and memory-region to sepeately depict
the regions for mailbox's ipc and slots. If later mailbox is designed to
use SRAM for both ipc and slots, then it will no matter with DDR anymore,
in this case option 1 will easily switch to support it.

Another question is a general question: for Linux kernel, which is the
best method to reserve memory regions? According to previous discussion,
we can use /memory/ node or /reseved-memory/ node to reserve memory
regions.

when review Juno's dts, i also see there have reserved 16MB DDR for secure
world. If so, looks like /reserved-memory/ node is unnecessary. if have some
specific scenarios will we use reserved-memory node to help reserve memory
regions?

Thanks,
Leo Yan
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RESEND PATCH 0/3 v6] Add Mediatek MT8173 cpufreq driver

2015-08-26 Thread Pi-Cheng Chen
On Wed, Aug 26, 2015 at 10:16 AM, Viresh Kumar viresh.ku...@linaro.org wrote:
 On 26-08-15, 09:25, Pi-Cheng Chen wrote:
 The [3/3] is based on Mediatek SoC maintainer tree[1] and the patch which
 introduce a new clock type[2] consumed by MT8173 cpufreq driver. So it will
 cause some conflicts if it goes through your tree. I am not sure how this
 should be handled, but should it be merged through Mediatek SoC maintainer
 tree?

 Just get that applied to MTK tree, it doesn't have any dependency on
 rest of the patches for build/boot. The only thing is that cpufreq
 wouldn't work and it will work as soon as Rafael's and MTK's trees are
 merged by Linus.

Thanks for your explanation.

@Rafael, Would you please apply [1,2] to your tree?

@Matthias, Would you please apply [3/3] of this series?

Thanks.

Best Regards,
Pi-Cheng


 --
 viresh
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC][PATCH 1/2] dt-bindings: drm/mediatek: Add Mediatek DRM dts binding

2015-08-26 Thread Philipp Zabel
Hi,

overall it looks to me like this binding is modeled after the Linux DRM
abstractions. Instead, the device nodes should be modeled after the
hardware.

Describing each function block as a separate device node is probably not
the best choice, as would be combining all devices in the mmsys range
into a single device node. So a somewhat arbitrary decision has to be
made what to group together. See my comments below:

Am Mittwoch, den 13.05.2015, 23:23 +0800 schrieb CK Hu:
 This patch includes
 1. Mediatek DRM Device binding
 2. Mediatek DSI Device binding
 3. Mediatek CRTC Main Device binding
 4. Mediatek DDP Device binding
 
 Signed-off-by: CK Hu ck...@mediatek.com
 ---
  .../bindings/drm/mediatek/mediatek,crtc-main.txt   | 38 
 ++
  .../bindings/drm/mediatek/mediatek,ddp.txt | 22 +
  .../bindings/drm/mediatek/mediatek,drm.txt | 27 +++
  .../bindings/drm/mediatek/mediatek,dsi.txt | 20 
  4 files changed, 107 insertions(+)
  create mode 100644 
 Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt
  create mode 100644 
 Documentation/devicetree/bindings/drm/mediatek/mediatek,ddp.txt
  create mode 100644 
 Documentation/devicetree/bindings/drm/mediatek/mediatek,drm.txt
  create mode 100644 
 Documentation/devicetree/bindings/drm/mediatek/mediatek,dsi.txt
 
 diff --git 
 a/Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt 
 b/Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt
 new file mode 100644
 index 000..5c6c420
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/drm/mediatek/mediatek,crtc-main.txt
 @@ -0,0 +1,38 @@
 +Mediatek CRTC Main Device
 +
 +
 +The Mediatek CRTC Main device is a crtc device of DRM system.

crtc does not belong in the device tree. There is no crtc hardware.
What this node describes is a useful, but fixed configuration of a part
of the DISP subsystem function blocks.

In my opinion, it would be better to not describe the separate display
pipes in the device tree at all if they are dynamically configurable.
What for example if you model two separate fixed pipelines in the device
tree and then in the future you want to support the MERGE or SPLIT
blocks (I'm not sure what MERGE does, SPLIT seems to be needed for
8-lane DSI)?

As far as I currently understand, there are five source function blocks
that can read from memory (OVL0, OVL1, RDMA0, RDMA1, RDMA2) and three
sink function blocks (DSI0, DSI1, DPI0) that can be connected to panels,
or encoder bridges. How these map to the crtcs doesn't necessarily have
to be described in the device tree.

How about a single node that contains all of the DISP functional blocks
that don't need their own node (like DSI, which has to be connectable to
bridges or panels):

disp: disp@0x1400c000 {
compatible = mediatek,mt8173-disp;
interrupts = GIC_SPI 180 IRQ_TYPE_LEVEL_LOW, /* OVL0 */
 GIC_SPI 181 IRQ_TYPE_LEVEL_LOW; /* OVL1 */
interrupt-names = ovl0, ovl1;
reg = 0 0x1400c000 0 0x1000,  /* OVL0 */
  0 0x1400d000 0 0x1000,  /* OVL1 */
  0 0x1400e000 0 0x1000,  /* RDMA0 */
  0 0x1400f000 0 0x1000,  /* RDMA1 */
  0 0x1401 0 0x1000,  /* RDMA2 */
  0 0x14013000 0 0x1000,  /* COLOR0 */
  0 0x14014000 0 0x1000,  /* COLOR1 */
  0 0x14015000 0 0x1000,  /* AAL */
  0 0x14016000 0 0x1000,  /* GAMMA */
  0 0x14017000 0 0x1000,  /* MERGE */
  0 0x14018000 0 0x1000,  /* SPLIT0 */
  0 0x14019000 0 0x1000,  /* SPLIT1 */
  0 0x1401a000 0 0x1000,  /* UFOE */
  0 0x1402 0 0x1000;  /* MUTEX */
  0 0x14023000 0 0x1000;  /* OD */
reg-names = ovl0, ovl1, rdma0, rdma1, rdma2,
color0, color1, aal, gamma, merge,
split0, split1, ufoe, mutex, od;
clocks = mmsys CLK_MM_DISP_OVL0,
 mmsys CLK_MM_DISP_OVL1,
 mmsys CLK_MM_DISP_RDMA0,
 mmsys CLK_MM_DISP_RDMA1,
 mmsys CLK_MM_DISP_RDMA2,
 mmsys CLK_MM_DISP_COLOR0,
 mmsys CLK_MM_DISP_COLOR1,
 mmsys CLK_MM_DISP_AAL,
 mmsys CLK_MM_DISP_GAMMA,
 mmsys CLK_MM_DISP_MERGE,
 mmsys CLK_MM_DISP_SPLIT0,
 mmsys CLK_MM_DISP_SPLIT1,
 mmsys CLK_MM_DISP_UFOE,
 mmsys CLK_MM_MUTEX_32K,
 mmsys CLK_MM_DISP_OD;
clock-names = ovl0, ovl1, rdma0, rdma1, rdma2,
color0, color1, aal, gamma, merge,
split0, split1, ufoe, mutex, od;
power-domains = scpsys MT8173_POWER_DOMAIN_DIS;
config = mmsys; /* syscon */
};

How the muxes in the config area are set up to connect those blocks
could be determined by the driver.

 +Required properties:
 +- 

Re: [PATCH 2/2] mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller.

2015-08-26 Thread Brian Norris
On Wed, Aug 26, 2015 at 08:47:37AM -0700, vikas wrote:
 On 08/25/2015 11:19 PM, Marek Vasut wrote:
  On Wednesday, August 26, 2015 at 12:09:50 AM, vikas wrote:
  the patch failed to apply, please rebase it to master.
  
  it's based on -next, I'm sure you can fix trivial conflicts yourself if you
  need to apply it elsewhere. Do you have any other review comments ?
 
 Always rebase the patch on master.

Development works against -next, not Linus' master:

https://lwn.net/Articles/289013/

This is also noted here:

https://www.kernel.org/doc/man-pages/linux-next.html

Technically, you should work off of the respective subsystem tree (see
entries in MAINTAINERS). For MTD, this is also documented here:

http://linux-mtd.infradead.org/source.html

In the end, most MTD patches get applied to l2-mtd.git, but l2-mtd.git
and linux-next.git should provide pretty similar MTD patching
experiences, as the former is included in the latter.

Regards,
Brian
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] remoteproc: dt: Provide bindings for ST's Remote Processor Controller driver

2015-08-26 Thread Nathan Lynch
On 08/26/2015 08:08 AM, Lee Jones wrote:
 diff --git a/Documentation/devicetree/bindings/remoteproc/st-rproc.txt 
 b/Documentation/devicetree/bindings/remoteproc/st-rproc.txt
 new file mode 100644
 index 000..6a933c1
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/remoteproc/st-rproc.txt
 @@ -0,0 +1,38 @@
 +STMicroelectronics Remote Processor
 +---
 +
 +This binding provides support for adjunct processors found on ST SoCs.
 +
 +The remote processors can be controlled from the bootloader or the primary 
 OS.
 +If the bootloader starts a remote processor processor the primary OS must 
 detect
 +its state and act accordingly.
 +
 +The node name is significant, as it defines the name of the CPU and the name
 +of the firmware to load: rproc-name-fw.

This business about the firmware name describes a behavior of Linux's
core remoteproc code and seems out of place in a binding document.

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] of/irq: export of_get_irq_byname()

2015-08-26 Thread Wolfram Sang
On Tue, Aug 25, 2015 at 05:04:02PM -0700, Dmitry Torokhov wrote:
 Similarly to of_get_irq(), let's export of_irq_get_byname(), so if a bus core
 can be compiled as a module (such as I2C) it can have access to the symbol.
 
 Reported-by: Stephen Rothwell s...@canb.auug.org.au
 Reported-by: kbuild test robot fengguang...@intel.com
 Signed-off-by: Dmitry Torokhov dmitry.torok...@gmail.com

Applied to for-next, thanks!



signature.asc
Description: Digital signature


Re: [PATCH 4/4] remoteproc: debugfs: Add ability to boot remote processor using debugfs

2015-08-26 Thread Nathan Lynch
On 08/26/2015 08:08 AM, Lee Jones wrote:
 Signed-off-by: Lee Jones lee.jo...@linaro.org
 ---
  drivers/remoteproc/remoteproc_debugfs.c | 25 +
  1 file changed, 25 insertions(+)

The commit message should describe why this is needed...


 diff --git a/drivers/remoteproc/remoteproc_debugfs.c 
 b/drivers/remoteproc/remoteproc_debugfs.c
 index 9d30809..9620962 100644
 --- a/drivers/remoteproc/remoteproc_debugfs.c
 +++ b/drivers/remoteproc/remoteproc_debugfs.c
 @@ -88,8 +88,33 @@ static ssize_t rproc_state_read(struct file *filp, char 
 __user *userbuf,
   return simple_read_from_buffer(userbuf, count, ppos, buf, i);
  }
  
 +static ssize_t rproc_state_write(struct file *filp, const char __user 
 *userbuf,
 +  size_t count, loff_t *ppos)
 +{
 + struct rproc *rproc = filp-private_data;
 + char buf[2];
 + int ret;
 +
 + ret = copy_from_user(buf, userbuf, 1);
 + if (ret)
 + return -EFAULT;
 +
 + switch (buf[0]) {
 + case '1':
 + ret = rproc_boot(rproc);
 + if (ret)
 + dev_warn(rproc-dev, Boot failed: %d\n, ret);
 + break;
 + default:
 + rproc_shutdown(rproc);
 + }
 +
 + return count;
 +}

... and I suggest that the user interface be reconsidered.  If '1' means
boot and literally anything else means shut down then you can't add
operations in the future without potentially breaking things.

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH linux-next v5 5/5] mtd: atmel-quadspi: add driver for Atmel QSPI controller

2015-08-26 Thread Marek Vasut
On Wednesday, August 26, 2015 at 02:30:27 PM, Cyrille Pitchen wrote:
 This driver add support to the new Atmel QSPI controller embedded into
 sama5d2x SoCs. It expects a NOR memory to be connected to the QSPI
 controller.
 
 Signed-off-by: Cyrille Pitchen cyrille.pitc...@atmel.com
 Acked-by: Nicolas Ferre nicolas.fe...@atmel.com

Acked-by: Marek Vasut ma...@denx.de

Best regards,
Marek Vasut
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 2/5] mtd: nand: vf610_nfc: add hardware BCH-ECC support

2015-08-26 Thread Stefan Agner
On 2015-08-25 12:54, Brian Norris wrote:
 On Mon, Aug 03, 2015 at 11:28:43AM +0200, Stefan Agner wrote:
 On 2015-08-03 11:27, Stefan Agner wrote:
 snip
  +static inline int vf610_nfc_correct_data(struct mtd_info *mtd, uint8_t 
  *dat,
  +   uint8_t *oob, int oob_loaded)
  +{
  +  struct vf610_nfc *nfc = mtd_to_nfc(mtd);
  +  u8 ecc_status;
  +  u8 ecc_count;
  +  int flip;
  +
  +  ecc_status = __raw_readb(nfc-regs + ECC_SRAM_ADDR * 8 + ECC_OFFSET);
 
 Why __raw_readb()? That's not normally encourage, and it has issues with
 endianness. It looks like maybe this is actulaly a 32-bit register, and
 you're having trouble when trying to do bytewise access? I see this
 earlier:
 
 /*
  * ECC status is stored at NFC_CFG[ECCADD] +4 for little-endian
  * and +7 for big-endian SoCs.
  */
 #ifdef __LITTLE_ENDIAN
 #define ECC_OFFSET  4
 #else
 #define ECC_OFFSET  7
 #endif
 
 So maybe you really just want:
 
 #define ECC_OFFSET4
 ...
   ecc_status = vf610_nfc_read(ECC_SRAM_ADDR * 8 + ECC_OFFSET)  0xff;
 
 ?
 

Agreed, much cleaner.

  +  ecc_count = ecc_status  ECC_ERR_COUNT;
  +
  +  if (!(ecc_status  ECC_STATUS_MASK))
  +  return ecc_count;
  +
  +  if (!oob_loaded)
  +  vf610_nfc_read_buf(mtd, oob, mtd-oobsize);
  +
  +  /*
  +   * On an erased page, bit count (including OOB) should be zero or
  +   * at least less then half of the ECC strength.
  +   */
  +  flip = count_written_bits(dat, nfc-chip.ecc.size, ecc_count);
 
 Another side note: why are you using ecc_count as a max threshold? AIUI,
 an ECC algorithm doesn't really report useful error count information if
 it's above the correction limit. So wouldn't we be looking to count up
 to our SW threshold? i.e., ecc.strength / 2, or similar? Similar
 comments below.
 

Initially, that was the only threshold below, hence it made sense. But I
agree, we should count up to the threshold used below...

  +  flip += count_written_bits(oob, mtd-oobsize - nfc-chip.ecc.bytes,
  + ecc_count);

 With ECC the controller seems to clear the ECC bytes in SRAM buffer.
 This is a dump of 64 Bit OOB with the 32-error ECC mode which requires
 60 bytes of OOB for ECC:

 [   22.190273] ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 
 Hmm, that's not really good. The point is that we need to make sure that
 everything that could have been programmed (including the ECC area) was
 not actually programmed. But your ECC controller is not, contrary to
 MTD's expectations, dumping raw uncorrected data here.
 
 [   22.209698] vf610_nfc_correct_data, flips 1

 Not sure if this is acceptable, but I now only count the bits in the
 non-ECC area of the OOB.
 
 That's not the intention of my suggestion. You're still missing out on a
 class of patterns that might look close to all 0xff but are not
 actually.
 
 If the HW ECC really doesn't give you valid data+OOB at this point, then
 you might have to re-read with ECC disabled. Of course, that's got a
 performance cost...

Yes I can do that. Not sure yet how it will look like exactly, maybe I
only need to reread the OOB area and (re-)use the main data part since
those arrive uncorrected in the error case.

 
 Or perhaps Boris has a better suggestion? He's been surveying other NAND
 drivers that need to do similar things, and he's working on providing
 some support code for common design patterns.
 
 Btw, if the ECC check fails, the controller seems kind of count the
 amount of bitflips. It works for most devices reliable, but we had
 devices for which that number was not accurate, see:
 http://thread.gmane.org/gmane.linux.ports.arm.kernel/357439
 
 I'm a little confused there. Why would you be expecting to get a count
 of bitflips, when the ECC engine can't correct all errors? How is it
 supposed to know what the right data is if the bit errors are beyond
 the correction strength?

When printing the ECC error count on ECC fail when reading an erased
NAND flash, the numbers of bit flips (stuck at zero) seem to widely
correlate with the number returned by the controller. While it seems to
correlate widely, there are exceptions, as discussed in the thread:
http://thread.gmane.org/gmane.linux.ports.arm.kernel/295424

Maybe this is an artifact of the ECC algorithm we just can't/shouldn't
rely on? I am not sure where this originated, I did not found any
indication in the reference manual about what that value contains in the
error case.

Bill, do you have an idea why we used that value as threshold in early
implementations?

Otherwise I also think we should just drop the use of this value.

--
Stefan
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller.

2015-08-26 Thread Marek Vasut
On Wednesday, August 26, 2015 at 05:47:37 PM, vikas wrote:
 Hi,

Hi,

 On 08/25/2015 11:19 PM, Marek Vasut wrote:
  On Wednesday, August 26, 2015 at 12:09:50 AM, vikas wrote:
  Hi,
  
  On 08/21/2015 02:20 AM, Marek Vasut wrote:
  From: Graham Moore grmo...@opensource.altera.com
  
  Add support for the Cadence QSPI controller. This controller is
  present in the Altera SoCFPGA SoCs and this driver has been tested
  on the Cyclone V SoC.
  
  Signed-off-by: Graham Moore grmo...@opensource.altera.com
  Signed-off-by: Marek Vasut ma...@denx.de
  Cc: Alan Tull at...@opensource.altera.com
  Cc: Brian Norris computersforpe...@gmail.com
  Cc: David Woodhouse dw...@infradead.org
  Cc: Dinh Nguyen dingu...@opensource.altera.com
  Cc: Graham Moore grmo...@opensource.altera.com
  Cc: Vikas MANOCHA vikas.mano...@st.com
  Cc: Yves Vandervennet yvand...@opensource.altera.com
  Cc: devicetree@vger.kernel.org
  ---
  
   drivers/mtd/spi-nor/Kconfig   |   11 +
   drivers/mtd/spi-nor/Makefile  |1 +
   drivers/mtd/spi-nor/cadence-quadspi.c | 1260
   + 3 files changed, 1272 insertions(+)
   create mode 100644 drivers/mtd/spi-nor/cadence-quadspi.c
  
  V2: use NULL instead of modalias in spi_nor_scan call
  V3: Use existing property is-decoded-cs instead of creating duplicate.
  V4: Support Micron quad mode by snooping command stream for EVCR
  command
  
  and subsequently configuring Cadence controller for quad mode.
  
  V5: Clean up sparse and smatch complaints.  Remove snooping of Micron
  
  quad mode.  Add comment on XIP mode bit and dummy clock cycles. 
  Set up SRAM partition at 1:1 during init.
  
  V6: Remove dts patch that was included by mistake.  Incorporate Vikas's
  
  comments regarding fifo width, SRAM partition setting, and trigger
  address.  Trigger address was added as an unsigned int, as it is
  not an IO resource per se, and does not need to be mapped. Also
  add Marek Vasut's workaround for picking up OF properties on
  subnodes.
  
  V7: - Perform coding-style cleanup and type fixes. Remove ugly QSPI_*()
  
macros and replace them with functions. Get rid of unused
variables.
  
  - Implement support for nor-set_protocol() to handle Quad-command,
  
this patch now depends on the following patch:
mtd: spi-nor: notify (Q)SPI controller about protocol change
  
  - Replace that cqspi_fifo_read() disaster with plain old readsl()
  
and cqspi_fifo_write() tentacle horror with pretty writesl().
  
  - Remove CQSPI_SUPPORT_XIP_CHIPS, which is broken.
  - Get rid of cqspi_find_chipselect() mess, instead just place the
  
struct cqspi_st and chipselect number into struct
cqspi_flash_pdata and set nor-priv to the struct
cqspi_flash_pdata of that particular chip.
  
  - Replace the odd math in calculate_ticks_for_ns() with
  DIV_ROUND_UP(). - Make variables const where applicable.
  
  V8: - Implement a function to wait for bit being set/unset for a given
  
period of time and use it to replace the ad-hoc bits of code.
  
  - Configure the write underflow watermark to be 1/8 if FIFO size.
  - Extract out the SPI NOR flash probing code into separate function
  
to clearly mark what will soon be considered a boilerplate code.
  
  - Repair the handling of mode bits, which caused instability in V7.
  - Clean up the interrupt handling
  - Fix Kconfig help text and make the patch depend on OF and
  COMPILE_TEST.
  
  diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig
  index 89bf4c1..ed253a2 100644
  --- a/drivers/mtd/spi-nor/Kconfig
  +++ b/drivers/mtd/spi-nor/Kconfig
  @@ -40,4 +40,15 @@ config SPI_NXP_SPIFI
  
Flash. Enable this option if you have a device with a SPIFI
controller and want to access the Flash as a mtd device.
  
  +config SPI_CADENCE_QUADSPI
  +   tristate Cadence Quad SPI controller
  +   depends on OF  COMPILE_TEST
  +   help
  + Enable support for the Cadence Quad SPI Flash controller.
  +
  + Cadence QSPI is a specialized controller for connecting an
  SPI + Flash over 1/2/4-bit wide bus. Enable this option if you
  have a + device with a Cadence QSPI controller and want to
  access the + Flash as an MTD device.
  +
  
  the patch failed to apply, please rebase it to master.
  
  it's based on -next, I'm sure you can fix trivial conflicts yourself if
  you need to apply it elsewhere. Do you have any other review comments ?
 
 Always rebase the patch on master.

The patch applies correctly both on next/master and l2-mtd/master.
I think the problem is on your end.

 I will be reviewing the patchset this week but on a quick look it seems
 many review comments of v7 are not there.

Aha.
--
To unsubscribe from this list: send the line unsubscribe devicetree 

Re: [PATCH 2/2] mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller.

2015-08-26 Thread vikas
Hi,

On 08/25/2015 11:19 PM, Marek Vasut wrote:
 On Wednesday, August 26, 2015 at 12:09:50 AM, vikas wrote:
 Hi,

 On 08/21/2015 02:20 AM, Marek Vasut wrote:
 From: Graham Moore grmo...@opensource.altera.com

 Add support for the Cadence QSPI controller. This controller is
 present in the Altera SoCFPGA SoCs and this driver has been tested
 on the Cyclone V SoC.

 Signed-off-by: Graham Moore grmo...@opensource.altera.com
 Signed-off-by: Marek Vasut ma...@denx.de
 Cc: Alan Tull at...@opensource.altera.com
 Cc: Brian Norris computersforpe...@gmail.com
 Cc: David Woodhouse dw...@infradead.org
 Cc: Dinh Nguyen dingu...@opensource.altera.com
 Cc: Graham Moore grmo...@opensource.altera.com
 Cc: Vikas MANOCHA vikas.mano...@st.com
 Cc: Yves Vandervennet yvand...@opensource.altera.com
 Cc: devicetree@vger.kernel.org
 ---

  drivers/mtd/spi-nor/Kconfig   |   11 +
  drivers/mtd/spi-nor/Makefile  |1 +
  drivers/mtd/spi-nor/cadence-quadspi.c | 1260
  + 3 files changed, 1272 insertions(+)
  create mode 100644 drivers/mtd/spi-nor/cadence-quadspi.c

 V2: use NULL instead of modalias in spi_nor_scan call
 V3: Use existing property is-decoded-cs instead of creating duplicate.
 V4: Support Micron quad mode by snooping command stream for EVCR command

 and subsequently configuring Cadence controller for quad mode.

 V5: Clean up sparse and smatch complaints.  Remove snooping of Micron

 quad mode.  Add comment on XIP mode bit and dummy clock cycles.  Set
 up SRAM partition at 1:1 during init.

 V6: Remove dts patch that was included by mistake.  Incorporate Vikas's

 comments regarding fifo width, SRAM partition setting, and trigger
 address.  Trigger address was added as an unsigned int, as it is not
 an IO resource per se, and does not need to be mapped. Also add
 Marek Vasut's workaround for picking up OF properties on subnodes.

 V7: - Perform coding-style cleanup and type fixes. Remove ugly QSPI_*()

   macros and replace them with functions. Get rid of unused
   variables.
 
 - Implement support for nor-set_protocol() to handle Quad-command,
 
   this patch now depends on the following patch:
   mtd: spi-nor: notify (Q)SPI controller about protocol change
 
 - Replace that cqspi_fifo_read() disaster with plain old readsl()
 
   and cqspi_fifo_write() tentacle horror with pretty writesl().
 
 - Remove CQSPI_SUPPORT_XIP_CHIPS, which is broken.
 - Get rid of cqspi_find_chipselect() mess, instead just place the
 
   struct cqspi_st and chipselect number into struct cqspi_flash_pdata
   and set nor-priv to the struct cqspi_flash_pdata of that
   particular chip.
 
 - Replace the odd math in calculate_ticks_for_ns() with
 DIV_ROUND_UP(). - Make variables const where applicable.

 V8: - Implement a function to wait for bit being set/unset for a given

   period of time and use it to replace the ad-hoc bits of code.
 
 - Configure the write underflow watermark to be 1/8 if FIFO size.
 - Extract out the SPI NOR flash probing code into separate function
 
   to clearly mark what will soon be considered a boilerplate code.
 
 - Repair the handling of mode bits, which caused instability in V7.
 - Clean up the interrupt handling
 - Fix Kconfig help text and make the patch depend on OF and
 COMPILE_TEST.

 diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig
 index 89bf4c1..ed253a2 100644
 --- a/drivers/mtd/spi-nor/Kconfig
 +++ b/drivers/mtd/spi-nor/Kconfig
 @@ -40,4 +40,15 @@ config SPI_NXP_SPIFI

   Flash. Enable this option if you have a device with a SPIFI
   controller and want to access the Flash as a mtd device.

 +config SPI_CADENCE_QUADSPI
 +   tristate Cadence Quad SPI controller
 +   depends on OF  COMPILE_TEST
 +   help
 + Enable support for the Cadence Quad SPI Flash controller.
 +
 + Cadence QSPI is a specialized controller for connecting an SPI
 + Flash over 1/2/4-bit wide bus. Enable this option if you have a
 + device with a Cadence QSPI controller and want to access the
 + Flash as an MTD device.
 +

 the patch failed to apply, please rebase it to master.
 
 it's based on -next, I'm sure you can fix trivial conflicts yourself if you
 need to apply it elsewhere. Do you have any other review comments ?

Always rebase the patch on master.
I will be reviewing the patchset this week but on a quick look it seems many 
review comments of v7 are not there.

Cheers,
Vikas

 .
 
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] remoteproc: dt: Provide bindings for ST's Remote Processor Controller driver

2015-08-26 Thread Lee Jones
On Wed, 26 Aug 2015, Nathan Lynch wrote:

 On 08/26/2015 08:08 AM, Lee Jones wrote:
  diff --git a/Documentation/devicetree/bindings/remoteproc/st-rproc.txt 
  b/Documentation/devicetree/bindings/remoteproc/st-rproc.txt
  new file mode 100644
  index 000..6a933c1
  --- /dev/null
  +++ b/Documentation/devicetree/bindings/remoteproc/st-rproc.txt
  @@ -0,0 +1,38 @@
  +STMicroelectronics Remote Processor
  +---
  +
  +This binding provides support for adjunct processors found on ST SoCs.
  +
  +The remote processors can be controlled from the bootloader or the primary 
  OS.
  +If the bootloader starts a remote processor processor the primary OS must 
  detect
  +its state and act accordingly.
  +
  +The node name is significant, as it defines the name of the CPU and the 
  name
  +of the firmware to load: rproc-name-fw.
 
 This business about the firmware name describes a behavior of Linux's
 core remoteproc code and seems out of place in a binding document.

Agreed, will remove.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] remoteproc: Supply controller driver for ST's Remote Processors

2015-08-26 Thread Nathan Lynch
On 08/26/2015 08:08 AM, Lee Jones wrote:
 --- /dev/null
 +++ b/drivers/remoteproc/st_remoteproc.c
 @@ -0,0 +1,300 @@
 +/*
 + * ST's Remote Processor Control Driver
 + *
 + * Copyright (C) 2015 STMicroelectronics - All Rights Reserved
 + *
 + * Author: Ludovic Barre ludovic.ba...@st.com

When submitting code you didn't write, I'd say it's better practice to
clearly indicate its provenance in the commit message.  E.g. something
like Driver based on code authored by Ludovic Barre for ST.  And
obtain signoffs etc if possible.


 + *
 + * 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.

Please review the wording here.  It's unclear whether this is intended
to be v2-only or v2 or later.


 +static int st_rproc_stop(struct rproc *rproc)
 +{
 + struct st_rproc *st_rproc = rproc-priv;
 + int err = 0;
 +
 + if (st_rproc-config-sw_reset) {
 + err = reset_control_assert(st_rproc-sw_reset);
 + if (err)
 + dev_warn(rproc-dev, Failed to assert S/W Reset\n);
 + }
 +
 + if (st_rproc-config-pwr_reset) {
 + err = reset_control_assert(st_rproc-pwr_reset);
 + if (err)
 + dev_warn(rproc-dev, Failed to assert Power Reset\n);
 + }
 +
 + clk_disable(st_rproc-clk);
 +
 + return 0;
 +}

Seems like st_rproc_stop should propagate errors back to its caller
instead of always returning 0.

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 3/5] mtd: nand: vf610_nfc: add device tree bindings

2015-08-26 Thread Stefan Agner
On 2015-08-26 08:39, Boris Brezillon wrote:
 Hi Bill,
 
 On Wed, 26 Aug 2015 11:26:36 -0400
 Bill Pringlemeir bprin...@sympatico.ca wrote:
 
 On 25 Aug 2015, computersforpe...@gmail.com wrote:

  Sorry, I realized a potential issue here.

  On Mon, Aug 03, 2015 at 11:27:28AM +0200, Stefan Agner wrote:
  Signed-off-by: Bill Pringlemeir bpringlem...@nbsps.com
  Acked-by: Shawn Guo shawn...@kernel.org
  Reviewed-by: Brian Norris computersforpe...@gmail.com
  Signed-off-by: Stefan Agner ste...@agner.ch
  ---
  .../devicetree/bindings/mtd/vf610-nfc.txt | 45 ++
  1 file changed, 45 insertions(+) create mode 100644
  Documentation/devicetree/bindings/mtd/vf610-nfc.txt

  diff --git a/Documentation/devicetree/bindings/mtd/vf610-nfc.txt
  b/Documentation/devicetree/bindings/mtd/vf610-nfc.txt
  new file mode 100644
  index 000..cae5f25
  --- /dev/null
  +++ b/Documentation/devicetree/bindings/mtd/vf610-nfc.txt
  -0,0 +1,45 @@
  +- nand-bus-width: see nand.txt
  +- nand-ecc-mode: see nand.txt
  +- nand-on-flash-bbt: see nand.txt

  Stumbling across the multi-CS questions on the driver reminds me: it
  typically makes sense to define new NAND bindings using separate NAND
  *controller* and *flash* device nodes. The above 3 properties, at
  least, would apply on a per-flash basis, not per-controller
  typically. See sunxi-nand, for instance:

  http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/mtd/sunxi-nand.txt

  brcmnand had a similar pattern:

  https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/mtd/brcm,brcmnand.txt

  (Perhaps it's time we standardized this a little more formally...)

 These would apply per chip, but the controller has to be configured to
 support each and every one.  Every time an operation was performed, we
 would have to check the chip type and reconfigure the controller.
 Currently, the driver does not support this and it would add a lot of
 overhead in some cases unless a register cache was used.

 Is the flexibility of using a system with combined 8/16bit devices
 really worth all the overhead?  Isn't it sort of brain dead hardware not
 to make all of the chips similar?  Why would everyone have to pay for
 such a crazy setup?

 To separate it would at least be a lie versus the code in the current
 form.  As well, there are only a few SOC which support multiple chip
 selects.  The 'multi-CS' register bits of this controller varies between
 PowerPC, 68K/Coldfire and ARM platforms.

The DT can be a lie versus the code. The DT should reflect how the
hardware is wired, afaik, if we take shortcuts in the driver code, that
is fine. If we don't support a certain configuration right now (e.g.
second NAND chip), the driver can just return an appropriate error code.

 I looked briefly at the brcmnand.c  and it seems that it is not
 supporting different ECC per chip even though the nodes are broken out
 this way.  In fact, if some raw functions are called, I think it will
 put it in ECC mode even if it wasn't before?  Well, I agree that this
 would be good generically, I think it puts a lot of effort in the
 drivers for not so much payoff?
 
 Hm, the sunxi driver supports it, and it does not add such a big
 overhead...
 The only thing you have to do is cache a bunch of register values
 per-chip and restore/apply them when the chip is selected
 (in your -select_chip() implementation).
 
 Anyway, even if the suggested DT representation is a lie in regards to
 your implementation, it's actually pretty accurate from an hardware
 POV, and this is exactly what DT is supposed to represent.

I agree with both of you. I don't see much value implementing multi-NAND
chip support, especially with different configurations, at the moment. I
am not aware of any hardware making use of that now.

I will update the driver to parse a NAND sub node and get the ECC
properties from the per flash configuration. However, I won't add chip
select or multi-NAND support right now...

Any objection?

--
Stefan
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 3/5] mtd: nand: vf610_nfc: add device tree bindings

2015-08-26 Thread Brian Norris
On Wed, Aug 26, 2015 at 02:15:45PM -0700, Stefan Agner wrote:
 On 2015-08-26 08:39, Boris Brezillon wrote:
  On Wed, 26 Aug 2015 11:26:36 -0400
  Bill Pringlemeir bprin...@sympatico.ca wrote:
  These would apply per chip, but the controller has to be configured to
  support each and every one.  Every time an operation was performed, we
  would have to check the chip type and reconfigure the controller.
  Currently, the driver does not support this and it would add a lot of
  overhead in some cases unless a register cache was used.
 
  Is the flexibility of using a system with combined 8/16bit devices
  really worth all the overhead?  Isn't it sort of brain dead hardware not
  to make all of the chips similar?  Why would everyone have to pay for
  such a crazy setup?
 
  To separate it would at least be a lie versus the code in the current
  form.  As well, there are only a few SOC which support multiple chip
  selects.  The 'multi-CS' register bits of this controller varies between
  PowerPC, 68K/Coldfire and ARM platforms.
 
 The DT can be a lie versus the code. The DT should reflect how the
 hardware is wired, afaik, if we take shortcuts in the driver code, that
 is fine. If we don't support a certain configuration right now (e.g.
 second NAND chip), the driver can just return an appropriate error code.

Right, I was only asking for:
(1) a more accurate DT and
(2) clarity in the driver; the clarity might just be we don't support
multi-CS

  I looked briefly at the brcmnand.c  and it seems that it is not
  supporting different ECC per chip even though the nodes are broken out
  this way.  In fact, if some raw functions are called, I think it will
  put it in ECC mode even if it wasn't before?  Well, I agree that this
  would be good generically, I think it puts a lot of effort in the
  drivers for not so much payoff?
  
  Hm, the sunxi driver supports it, and it does not add such a big
  overhead...
  The only thing you have to do is cache a bunch of register values
  per-chip and restore/apply them when the chip is selected
  (in your -select_chip() implementation).
  
  Anyway, even if the suggested DT representation is a lie in regards to
  your implementation, it's actually pretty accurate from an hardware
  POV, and this is exactly what DT is supposed to represent.
 
 I agree with both of you. I don't see much value implementing multi-NAND
 chip support, especially with different configurations, at the moment. I
 am not aware of any hardware making use of that now.
 
 I will update the driver to parse a NAND sub node and get the ECC
 properties from the per flash configuration. However, I won't add chip
 select or multi-NAND support right now...
 
 Any objection?

Nope, sounds good to me.

A few tips:
 * be defensive; i.e., error out if someone specifies 2 flash in the DT
 * use the 'reg' property to be the addressing index in the flash
   sub-node; i.e., the chip-select. This fits the practice done by most
   others, I think.

Regards,
Brian
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 4/5] xhci: mediatek: support MTK xHCI host controller

2015-08-26 Thread Daniel Thompson

On 22/08/15 02:45, Chunfeng Yun wrote:

MTK xhci host controller defines some extra SW scheduling
parameters for HW to minimize the scheduling effort for
synchronous and interrupt endpoints. The parameters are
put into reseved DWs of slot context and endpoint context


According to the covering e-mail there are additional quirks beyond the 
scheduling algorithm. These should probably be mentioned here also (so 
that they end up in the changelog).





Signed-off-by: Chunfeng Yun chunfeng@mediatek.com
---
  drivers/usb/host/Kconfig|   9 +
  drivers/usb/host/Makefile   |   4 +
  drivers/usb/host/xhci-mtk-sch.c | 436 +
  drivers/usb/host/xhci-mtk.c | 831 
  drivers/usb/host/xhci-mtk.h | 133 +++
  drivers/usb/host/xhci-ring.c|  35 +-
  drivers/usb/host/xhci.c |  19 +-
  drivers/usb/host/xhci.h |   1 +
  8 files changed, 1461 insertions(+), 7 deletions(-)
  create mode 100644 drivers/usb/host/xhci-mtk-sch.c
  create mode 100644 drivers/usb/host/xhci-mtk.c
  create mode 100644 drivers/usb/host/xhci-mtk.h

[snip]

diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c
new file mode 100644
index 000..d4b41a6
--- /dev/null
+++ b/drivers/usb/host/xhci-mtk-sch.c
@@ -0,0 +1,436 @@
+/*
+ * Copyright (c) 2015 MediaTek Inc.
+ * Author:
+ *  Zhigang.Wei zhigang@mediatek.com
+ *  Chunfeng.Yun chunfeng@mediatek.com
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#include linux/kernel.h
+#include linux/module.h
+#include linux/slab.h
+
+#include xhci.h
+#include xhci-mtk.h
+
+#define SS_BW_BOUNDARY 51000
+/* table 5-5. High-speed Isoc Transaction Limits in usb_20 spec */
+#define HS_BW_BOUNDARY 6144
+/* usb2 spec section11.18.1: at most 188 FS bytes per microframe */
+#define FS_PAYLOAD_MAX 188
+
+/* mtk scheduler bitmasks */
+#define EP_BPKTS(p)((p)  0x3f)
+#define EP_BCSCOUNT(p) (((p)  0x7)  8)
+#define EP_BBM(p)  ((p)  11)
+#define EP_BOFFSET(p)  ((p)  0x3fff)
+#define EP_BREPEAT(p)  (((p)  0x7fff)  16)
+
+static int is_fs_or_ls(enum usb_device_speed speed)
+{
+   return speed == USB_SPEED_FULL || speed == USB_SPEED_LOW;
+}


This function is only used three times (and one of the uses would have 
been a switch statement except for needing to make this function call). 
Does it really make code clearer?




+
+static int get_bw_index(struct xhci_hcd *xhci, struct usb_device *udev,
+   struct usb_host_endpoint *ep)
+{
+   int bw_index;
+   int port_id;
+   struct xhci_virt_device *virt_dev;
+
+   virt_dev = xhci-devs[udev-slot_id];
+   port_id = virt_dev-real_port;
+
+   if (udev-speed == USB_SPEED_SUPER) {
+   if (usb_endpoint_dir_out(ep-desc))
+   bw_index = (port_id - 1) * 2;
+   else
+   bw_index = (port_id - 1) * 2 + 1;
+   } else {
+   bw_index = port_id + xhci-num_usb3_ports - 1;
+   }
+
+   return bw_index;
+}


This appears to be a function to help the scheduling code lookup 
per-port private data held as an array in the device private structure.


Is this really the best way to lookup this data? (and if it *is* we 
still need some comments explaining what this function does and how it 
relates to sch_array).




+
+static void setup_sch_info(struct usb_device *udev,
+   struct xhci_ep_ctx *ep_ctx, struct mu3h_sch_ep_info *sch_ep)
+{
+   u32 ep_type;
+   u32 ep_interval;
+   u32 max_packet_size;
+   u32 max_burst;
+   u32 mult;
+   u32 esit_pkts;
+
+   ep_type = CTX_TO_EP_TYPE(le32_to_cpu(ep_ctx-ep_info2));
+   ep_interval = CTX_TO_EP_INTERVAL(le32_to_cpu(ep_ctx-ep_info));
+   max_packet_size = MAX_PACKET_DECODED(le32_to_cpu(ep_ctx-ep_info2));
+   max_burst = CTX_TO_MAX_BURST(le32_to_cpu(ep_ctx-ep_info2));
+   mult = CTX_TO_EP_MULT(le32_to_cpu(ep_ctx-ep_info));
+
+   sch_ep-ep_type = ep_type;
+   sch_ep-max_packet_size = max_packet_size;
+   sch_ep-esit = 1  ep_interval;
+   sch_ep-offset = 0;
+   sch_ep-burst_mode = 0;
+
+   if (udev-speed == USB_SPEED_HIGH) {
+   sch_ep-cs_count = 0;
+   /*
+* usb_20 spec section5.9
+* a single microframe is enough for HS synchromous endpoints
+* in a interval
+*/
+   sch_ep-num_budget_microframes = 1;
+   sch_ep-repeat = 0;
+   /*
+* xHCI spec section6.2.3.4
+  

[PATCH v2 0/5] Add Broadcom Northstar Plus Support

2015-08-26 Thread Jon Mason

Changes in version 2 incorporate Olof's comments regarding:
* the removal of all Reviewed-by lines not occurring on external
  mailing lists
* reordering of s-o-b lines
* modification of the device tree file to use labels when enabling
* increated description of the modification to the MAINTAINERS entry

Also, modifying the to and cc recepients so that everyone is
receving all of the patches. 

--

This patch series adds support for the Broadcom Northstar Plus family of
SoCs.  NSP is a Cortex A9 based SoC under the Broadcom iProc family.

Jon Mason (5):
  dt-bindings: Create Documentation for NSP DT bindings
  ARM: NSP: add minimal Northstar Plus device tree
  ARM: NSP: Add basic support for Broadcom Northstar Plus SoC
  ARM: multi_v7_defconfig: Add NSP to defconfig
  MAINTAINERS: add entry for the Broadcom Northstar Plus SoCs

 .../devicetree/bindings/arm/bcm/brcm,nsp.txt   |  34 +++
 MAINTAINERS|  12 ++-
 arch/arm/boot/dts/Makefile |   2 +
 arch/arm/boot/dts/bcm-nsp.dtsi | 105 +
 arch/arm/boot/dts/bcm958625k.dts   |  57 +++
 arch/arm/configs/multi_v7_defconfig|   1 +
 arch/arm/mach-bcm/Kconfig  |  14 +++
 arch/arm/mach-bcm/Makefile |   5 +-
 arch/arm/mach-bcm/bcm_nsp.c|  25 +
 9 files changed, 252 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/arm/bcm/brcm,nsp.txt
 create mode 100644 arch/arm/boot/dts/bcm-nsp.dtsi
 create mode 100644 arch/arm/boot/dts/bcm958625k.dts
 create mode 100644 arch/arm/mach-bcm/bcm_nsp.c

-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/5] dt-bindings: Create Documentation for NSP DT bindings

2015-08-26 Thread Jon Mason
Add the documentation for the Broadcom Northstar Plus device tree
bindings.

Signed-off-by: Jon Mason jonma...@broadcom.com
---
 .../devicetree/bindings/arm/bcm/brcm,nsp.txt   | 34 ++
 1 file changed, 34 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/bcm/brcm,nsp.txt

diff --git a/Documentation/devicetree/bindings/arm/bcm/brcm,nsp.txt 
b/Documentation/devicetree/bindings/arm/bcm/brcm,nsp.txt
new file mode 100644
index 000..eae53e4
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/bcm/brcm,nsp.txt
@@ -0,0 +1,34 @@
+Broadcom Northstar Plus device tree bindings
+
+
+Broadcom Northstar Plus family of SoCs are used for switching control
+and management applications as well as residential router/gateway
+applications. The SoC features dual core Cortex A9 ARM CPUs, integrating
+several peripheral interfaces including multiple Gigabit Ethernet PHYs,
+DDR3 memory, PCIE Gen-2, USB 2.0 and USB 3.0, serial and NAND flash,
+SATA and several other IO controllers.
+
+Boards with Northstar Plus SoCs shall have the following properties:
+
+Required root node property:
+
+BCM58522
+compatible = brcm,bcm58522, brcm,nsp;
+
+BCM58525
+compatible = brcm,bcm58525, brcm,nsp;
+
+BCM58535
+compatible = brcm,bcm58535, brcm,nsp;
+
+BCM58622
+compatible = brcm,bcm58622, brcm,nsp;
+
+BCM58623
+compatible = brcm,bcm58623, brcm,nsp;
+
+BCM58625
+compatible = brcm,bcm58625, brcm,nsp;
+
+BCM88312
+compatible = brcm,bcm88312, brcm,nsp;
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/5] ARM: NSP: add minimal Northstar Plus device tree

2015-08-26 Thread Jon Mason
Add a very minimalistic set of Northstar Plus Device Tree files which
describes the SoC and the BCM958625 implementation.  The perpherials
described are:

ARM Cortex A9 CPU
2 8250 UARTs
ARM GIC
PL310 L2 Cache
ARM A9 Global timer

Signed-off-by: Kapil Hali kap...@broadcom.com
Signed-off-by: Jon Mason jonma...@broadcom.com
---
 arch/arm/boot/dts/Makefile   |   2 +
 arch/arm/boot/dts/bcm-nsp.dtsi   | 105 +++
 arch/arm/boot/dts/bcm958625k.dts |  57 +
 3 files changed, 164 insertions(+)
 create mode 100644 arch/arm/boot/dts/bcm-nsp.dtsi
 create mode 100644 arch/arm/boot/dts/bcm958625k.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 246473a..adb5732 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -82,6 +82,8 @@ dtb-$(CONFIG_ARCH_BCM_CYGNUS) += \
 dtb-$(CONFIG_ARCH_BCM_MOBILE) += \
bcm28155-ap.dtb \
bcm21664-garnet.dtb
+dtb-$(CONFIG_ARCH_BCM_NSP) += \
+   bcm958625k.dtb
 dtb-$(CONFIG_ARCH_BERLIN) += \
berlin2-sony-nsz-gs7.dtb \
berlin2cd-google-chromecast.dtb \
diff --git a/arch/arm/boot/dts/bcm-nsp.dtsi b/arch/arm/boot/dts/bcm-nsp.dtsi
new file mode 100644
index 000..77f9bfc
--- /dev/null
+++ b/arch/arm/boot/dts/bcm-nsp.dtsi
@@ -0,0 +1,105 @@
+/*
+ *  BSD LICENSE
+ *
+ *  Copyright(c) 2015 Broadcom Corporation.  All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ ** Redistributions of source code must retain the above copyright
+ *  notice, this list of conditions and the following disclaimer.
+ ** Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in
+ *  the documentation and/or other materials provided with the
+ *  distribution.
+ ** Neither the name of Broadcom Corporation nor the names of its
+ *  contributors may be used to endorse or promote products derived
+ *  from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include dt-bindings/interrupt-controller/arm-gic.h
+#include dt-bindings/interrupt-controller/irq.h
+
+#include skeleton.dtsi
+
+/ {
+   compatible = brcm,nsp;
+   model = Broadcom Northstar Plus SoC;
+   interrupt-parent = gic;
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+
+   cpu@0 {
+   device_type = cpu;
+   compatible = arm,cortex-a9;
+   next-level-cache = L2;
+   reg = 0x0;
+   };
+   };
+
+   clocks {
+   #address-cells = 1;
+   #size-cells = 1;
+   ranges;
+
+   periph_clk: periph_clk {
+   compatible = fixed-clock;
+   #clock-cells = 0;
+   clock-frequency = 5;
+   };
+   };
+
+   uart0: serial@18000300 {
+   compatible = ns16550a;
+   reg = 0x18000300 0x100;
+   interrupts = GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH;
+   clock-frequency = 62499840;
+   status = disabled;
+   };
+
+   uart1: serial@18000400 {
+   compatible = ns16550a;
+   reg = 0x18000400 0x100;
+   interrupts = GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH;
+   clock-frequency = 62499840;
+   status = disabled;
+   };
+
+   gic: interrupt-controller@19021000 {
+   compatible = arm,cortex-a9-gic;
+   #interrupt-cells = 3;
+   #address-cells = 0;
+   interrupt-controller;
+   reg = 0x19021000 0x1000,
+ 0x19020100 0x100;
+   };
+
+   L2: l2-cache {
+   compatible = arm,pl310-cache;
+   reg = 0x19022000 0x1000;
+   cache-unified;
+   cache-level = 2;
+   };
+
+   timer@19020200 {
+   compatible = arm,cortex-a9-global-timer;
+   

Re: [PATCH 1/7] drm/vc4: Add devicetree bindings for VC4.

2015-08-26 Thread Dave Airlie
On 27 August 2015 at 00:30, Rob Herring robherri...@gmail.com wrote:
 On Wed, Aug 26, 2015 at 7:09 AM, Thierry Reding
 thierry.red...@gmail.com wrote:
 On Wed, Aug 26, 2015 at 01:52:29PM +0200, Daniel Vetter wrote:
 On Tue, Aug 25, 2015 at 04:42:18PM -0400, Rob Clark wrote:
  On Mon, Aug 24, 2015 at 9:47 AM, Rob Herring robherri...@gmail.com 
  wrote:
   On Mon, Aug 17, 2015 at 1:30 PM, Eric Anholt e...@anholt.net wrote:
   Stephen Warren swar...@wwwdotorg.org writes:
  
   On 08/12/2015 06:56 PM, Eric Anholt wrote:
   Signed-off-by: Eric Anholt e...@anholt.net
  
   This one definitely needs a patch description, since someone might not
   know what a VC4 is, and git log won't show the text from the binding
   doc itself. I'd suggest adding the initial paragraph of the binding 
   doc
   as the patch description, or more.
  
   diff --git a/Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt 
   b/Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt
  
   +- hvss: List of references to HVS video scalers
   +- encoders: List of references to output encoders (HDMI, SDTV)
  
   Would it make sense to make all those nodes child node of the vc4
   object. That way, there's no need to have these lists of objects; they
   can be automatically built up as the DT is enumerated. I know that 
   e.g.
   the NVIDIA Tegra host1x binding works this way, and I think it may 
   have
   been inspired by other similar cases.
  
   I've looked at tegra, and the component system used by msm appears to 
   be
   nicer than it.  To follow tegra's model, it looks like I need to build
   this extra bus thing corresponding to host1x that is effectively the
   drivers/base/component.c code, so that I can get at vc4's structure 
   from
   the component drivers.
  
   Of course, this is only appropriate if the HW modules really are
   logically children of the VC4 HW module. Perhaps they aren't. If they
   aren't though, I wonder what this vc4 module actually represents in 
   HW?
  
   It's the subsystem, same as we use a subsystem node for msm, sti,
   rockchip, imx, and exynos.  This appears to be the common model of how
   the collection of graphics-related components is represented in the DT.
  
   I think most of these bindings are wrong. They are grouped together
   because that is what DRM wants not because that reflects the h/w. So
   convince me this is one block, not that it is what other people do.
 
  I think, when it comes to more complex driver subsystems (like drm in
  particular) we have a bit of mismatch between how things look from the
  pure hw ignoring sw perspective, and the how sw and in particular
  userspace expects things perspective.  Maybe it is less a problem in
  other subsystems, where bindings map to things that are only visible
  in the kernel, or well defined devices like uart or sata controller.
  But when given the choice, I'm going to err on the side of not
  confusing userspace and the large software stack that sits above
  drm/kms, over dt purity.
 
  Maybe it would be nice to have a sort of dt overlay that adds the bits
  needed to tie together hw blocks that should be assembled into a
  single logical device for linux and userspace (but maybe not some
  other hypothetical operating system).  But so far that doesn't exist.
  All we have is a hammer (devicetree), everything looks like a nail.
  End result is we end up adding some things in the bindings which
  aren't purely about the hw.  Until someone invents a screwdriver, I'm
  not sure what else to do.  In the end, other hypothetical OS is free
  to ignore those extra fields in the bindings if it doesn't need them.
  So meh?

 I thought we agreed a while back that these kind of pull everything for
 the logical device together dt nodes which just have piles of phandles
 are totally accepted? At least that's the point behind the component
 helpers, and Eric even suggested to create dt-specific component helpers
 to cut down a bit on the usual boilerplate. dt maintainers are also fine
 with this approach afaik. From my understanding tegra with the host1x bus
 really is the odd one out and not the norm.

 I agree that in many aspects Tegra is somewhat special. But the same
 principles that the host1x infrastructure uses could be implemented in a
 similar way for other DRM drivers. You can easily collect information
 about subdevices by walking the device tree and matching on known
 compatible strings. And you can also instantiate the top-level device
 from driver code rather than have it in DT. It should still be possible
 to make this work without an artificial device node in DT. The component
 and master infrastructure is largely orthogonal to that, and as far as I
 remember the only blocker is the need for a top-level device. I wonder
 if perhaps this could be made to work by binding the master to the top-
 level SoC device.

 Obviously adding the node in DT is easier, but to my knowledge easy has
 never been a good excuse 

Re: [PATCH 2/3] ARM: DT: STi: STiH407: Add c8sectpfe LinuxDVB DT node.

2015-08-26 Thread Lee Jones
On Tue, 25 Aug 2015, Peter Griffin wrote:

 This patch adds in the required DT node for the c8sectpfe
 Linux DVB demux driver which allows the tsin channels
 to be used on an upstream kernel.
 
 Signed-off-by: Peter Griffin peter.grif...@linaro.org
 ---
  arch/arm/boot/dts/stihxxx-b2120.dtsi | 38 
 
  1 file changed, 38 insertions(+)
 
 diff --git a/arch/arm/boot/dts/stihxxx-b2120.dtsi 
 b/arch/arm/boot/dts/stihxxx-b2120.dtsi
 index 62994ae..1bc018e 100644
 --- a/arch/arm/boot/dts/stihxxx-b2120.dtsi
 +++ b/arch/arm/boot/dts/stihxxx-b2120.dtsi
 @@ -6,6 +6,10 @@
   * it under the terms of the GNU General Public License version 2 as
   * published by the Free Software Foundation.
   */
 +
 +#include dt-bindings/clock/stih407-clks.h
 +#include dt-bindings/media/c8sectpfe.h
 +

Looks like some of the STi files are a little wavering on convention,
but I suggest the extra '\n's are superfluous.

  / {
   soc {
   sbc_serial0: serial@953 {
 @@ -85,5 +89,39 @@
   status = okay;
   };
  
 + c8sectpfe@08a2 {

This should be a device type, not a model number.

demodulator@abcdabcd {

 + compatible = st,stih407-c8sectpfe;

To the uninitiated c8sectpfe is pretty indecipherable.

How about *-c8sectpfe-demod?

 + status = okay;
 + reg = 0x08a2 0x1, 0x08a0 0x4000;
 + reg-names = c8sectpfe, c8sectpfe-ram;
 +
 + interrupts = 0 34 0, 0 35 0;

Please use the predetermined DEFINES for the flags cell.

 + interrupt-names = c8sectpfe-error-irq,
 +   c8sectpfe-idle-irq;
 +
 + pinctrl-names   = tsin0-serial, tsin0-parallel,
 +   tsin3-serial, tsin4-serial,
 +   tsin5-serial;

I would put *-names *under* the properties they pertain to and in the
same format i.e. one per line in this case, for easy eye-match.

 + pinctrl-0   = pinctrl_tsin0_serial;
 + pinctrl-1   = pinctrl_tsin0_parallel;
 + pinctrl-2   = pinctrl_tsin3_serial;
 + pinctrl-3   = pinctrl_tsin4_serial_alt3;
 + pinctrl-4   = pinctrl_tsin5_serial_alt1;
 +
 + clocks = clk_s_c0_flexgen CLK_PROC_STFE;
 + clock-names = c8sectpfe;
 +
 + /* tsin0 is TSA on NIMA */
 + tsin0: port@0 {
 +

Why the '\n'?

 + tsin-num = 0;
 + serial-not-parallel;
 + i2c-bus = ssc2;

If you are adding this property, I would get Wolfram or one of the DT
guys to Ack it.

 + rst-gpio = pio15 4 0;

Why not use the whole name reset?

-gpio should be -gpios.

So, in full: reset-gpios?

Flags: GPIO_ACTIVE_HIGH ?

 + dvb-card = STV0367_TDA18212_NIMA_1;
 + };
 + };
   };
  };

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RESEND PATCH v16 4/4] ARM: dts: add the support power-domain node on RK3288 SoCs

2015-08-26 Thread Caesar Wang



在 2015年08月26日 06:45, Kevin Hilman 写道:

Doug Anderson diand...@chromium.org writes:


Kevin,

On Tue, Aug 25, 2015 at 2:07 PM, Kevin Hilman khil...@kernel.org wrote:

Caesar Wang w...@rock-chips.com writes:


We can add more domains node in the future.
This patch add the needed clocks into power-controller.
As the discuess about all the device clocks being listed in
the power-domains itself.

There are several reasons as follows:

Firstly, the clocks need be turned off to save power when
the system enter the suspend state. So we need to enumerate
the clocks in the dts. In order to power domain can turn on and off.

Yes, but this is the job of device drivers which are runtime PM adapted
to gate their own clocks.  I agree these clocks need to be enumerated in
the DTS, but they should be in the device nodes.

I _think_ what Caesar means is that the alternative to this patch is
to leave the clocks on all the time as they were during the early days
of Rockchip (AKA last year).  If the clocks are on all the time then
the power domain patches can work fine.  However, once you start
letting clocks turn off then you need to make sure that the power
domain code turns the back on temporarily.

Yup, I understand that part, and many SoCs have this same feature.


Secondly, the reset-circuit should reset be synchronous on RK3288,
then sync revoked. So we need to enable clocks of all devices.
In other words, we have to enable the clocks before you operate them
if all the device clocks are included in someone domians.

Yes, this is pretty common for reset.


Someone wish was to get the clocks by reading the clocks from the
device nodes, We can do that but we can solve the above issues.

I don't follow this sentence.  Are you saying doing that will not solve
the above issues?  Why not?  Please explain.

If there are non-device clocks that also need to be enabled before
asserting reset, then those are candidates for the power-domain node,
but not device clocks.

It's been a long time and I don't know that I've reviewed every
revision of this series, but I think there was a proposal that we
shouldn't list clocks here.  Instead we should search through and find
all devices that refer to this power domain, reach in and find their
clocks, and turn them on.  Did I get that right?

Yes...


Sounds resonable, the domain(e.g. pd_vio...) idle will be abnormal but 
you have registered all devices.

Why?
AFAIK, you need turn on the noc/ip clocks if we are operating the 
pd_vio domain to enter the idle status.
if the noc is same clock with ip side.  We need turn on the IP side 
clocks. Otherwise we need turn on the noc clocks.



To put things in a
concrete way, for pd_vio we'd go through the entire device tree
ourselves and find all properties that look like power-domains =
power RK3288_PD_VIO;.  We'd then find the parent of those
properties and look for a property named clocks.  We'd then iterate
over all those clocks and turn those on.  Did I get that right?

... but you make it sound like more work than it is.  The genpd already
keeps a list of devices that refer to the power domain.  In fact, the
genpd 'attach' method can be platform-specific, so could be used to keep
track of a list (or a subset) of clocks which are needed for reset.


The above doesn't seem like a terribly great idea to me for a number
of reasons, including:

1. If I remember correctly, it's important to turn on clocks for
devices even if they're not something you're using / have a driver
for.  If you don't then the device won't get reset properly and this
can affect things like suspend/resume because the hardware in the SoC
will query all devices at suspend time to make sure they're ready.

Correct.  This condition also exists in the clock framework when unused
clocks are disabled, or if you have drivers but PM_RUNTIME is disabled
(which can happen from userspace on a per-device basis) so it needs to
be understood and managed already.


If
a device is wedged because its clock wasn't on at the right them then
it will cause problems.

Right.  I'm not arguing that the power domain doesn't have to deal with
device clocks. It has to for sync reset.  The objection I have have is
where these clocks are described.


2. If we absolutely need to turn all clocks and we get clocks from
device tree nodes on then it means we need device tree nodes for every
device in the domain.

Isn't that the end goal?


These would be needed even if there are no
accepted bindings for this device yet.  So we'd need to do one of: A)
Block power domain patches on feature complete bindings for all
drivers; B) Make up non-approved compatible strings for all devices
and throw them into the DTS; C) Add nodes in the DTS without a
compatible string just to satisfy the power domain requirements.  None
of these seem terribly appealing.

well, I think we can be slightly more accomodating than that and go for
somewhere in between:

D) In the power-domain DTS, clearly describe why each clock is 

Re: [PATCH v2 1/7] drm/vc4: Add devicetree bindings for VC4.

2015-08-26 Thread Luc Verhaegen
On Tue, Aug 18, 2015 at 02:54:02PM -0700, Eric Anholt wrote:
 VC4 is the GPU (display and 3D) subsystem present on the 2835 and some
 other Broadcom SoCs.
 ...
 +Broadcom VC4 GPU
 +
 +The VC4 device present on the Raspberry Pi includes a display system
 +with HDMI output and the HVS scaler for compositing display planes.

Is this a direct hw driver implementation, banging registers, or is this 
talking to the os/firmware/binary blob running on the videocore dsp?

Luc Verhaegen.
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 6/7] MAINTAINERS: Add FDMA driver files to STi section.

2015-08-26 Thread Lee Jones
On Wed, 08 Jul 2015, Peter Griffin wrote:

 This patch adds the FDMA driver files to the STi
 section of the maintainers file.
 
 Signed-off-by: Peter Griffin peter.grif...@linaro.org
 ---
  MAINTAINERS | 2 ++
  1 file changed, 2 insertions(+)
 
 diff --git a/MAINTAINERS b/MAINTAINERS
 index 8133cef..8cb1ad9 100644
 --- a/MAINTAINERS
 +++ b/MAINTAINERS
 @@ -1503,6 +1503,8 @@ S:  Maintained
  F:   arch/arm/mach-sti/
  F:   arch/arm/boot/dts/sti*
  F:   drivers/clocksource/arm_global_timer.c
 +F:   drivers/dma/st_fdma.*
 +F:   drivers/dma/st_fdma_xbar.c

How about you replace both lines with:

F:  drivers/dma/st_fdma*

  F:   drivers/i2c/busses/i2c-st.c
  F:   drivers/media/rc/st_rc.c
  F:   drivers/mmc/host/sdhci-st.c

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RESEND PATCH v16 3/4] soc: rockchip: power-domain: Add power domain driver

2015-08-26 Thread Caesar Wang



在 2015年08月26日 04:57, Kevin Hilman 写道:

Caesar Wang w...@rock-chips.com writes:


This driver is found on RK3288 SoCs.

In order to meet high performance and low power requirements, a power
management unit is designed or saving power when RK3288 in low power
mode.
The RK3288 PMU is dedicated for managing the power of the whole chip.

PMU can work in the Low Power Mode by setting bit[0] of PMU_PWRMODE_CON
register. After setting the register, PMU would enter the Low Power mode.
In the low power mode, pmu will auto power on/off the specified power
domain, send idle req to specified power domain, shut down/up pll and
so on. All of above are configurable by setting corresponding registers.

Signed-off-by: jinkun.hong jinkun.h...@rock-chips.com
Signed-off-by: Caesar Wang w...@rock-chips.com

[...]


diff --git a/drivers/soc/rockchip/Kconfig b/drivers/soc/rockchip/Kconfig
new file mode 100644
index 000..87a09c3
--- /dev/null
+++ b/drivers/soc/rockchip/Kconfig
@@ -0,0 +1,13 @@
+#
+# Rockchip Soc drivers
+#
+config PM_GENERIC_DOMAINS

Why are you (re)defining this config option?  This name is already used in 
kernel/pm/Kconfig.


Fixed.


Thanks,
Caesar


Kevin

___
Linux-rockchip mailing list
linux-rockc...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip


--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/5] add GPT timer support for mt8173

2015-08-26 Thread Daniel Lezcano

On 07/13/2015 11:32 AM, Yingjoe Chen wrote:

This series add GPT timer support for mt8173. This is based on v4.2-rc1
and Matthias' next branch (for dts parts).

The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
series [1]. I decide to move these 2 patches to this series, since it
is more relevent here. They are changed based on Matthias' and Daniel's
comments.

[1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html

Daniel Kurtz (1):
   arm64: dts: mt8173: add timer node

Yingjoe Chen (4):
   clocksource: mediatek: do not enable GPT_CLK_EVT when setup
   clocksource: mediatek: Use GPT as sched clock source
   arm64: mediatek: enable MTK_TIMER
   clk: mediatek: add 13mhz clock for MT8173

  arch/arm64/Kconfig   |  1 +
  arch/arm64/boot/dts/mediatek/mt8173.dtsi |  9 +
  drivers/clk/mediatek/clk-mt8173.c|  5 +
  drivers/clocksource/mtk_timer.c  | 26 --
  include/dt-bindings/clock/mt8173-clk.h   |  3 ++-
  5 files changed, 37 insertions(+), 7 deletions(-)


Who will take this patchset ? I can take the patch 2 if needed.


--
 http://www.linaro.org/ Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  http://www.facebook.com/pages/Linaro Facebook |
http://twitter.com/#!/linaroorg Twitter |
http://www.linaro.org/linaro-blog/ Blog

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/3] devicetree: Add led-backlight binding

2015-08-26 Thread Jacek Anaszewski

On 08/26/2015 11:11 AM, Tomi Valkeinen wrote:



On 26/08/15 10:07, Jacek Anaszewski wrote:

On 08/25/2015 05:41 PM, Tomi Valkeinen wrote:



On 25/08/15 16:39, Jacek Anaszewski wrote:


+Example:
+
+backlight {
+compatible = led-backlight;
+leds = backlight_led;
+
+brightness-levels = 0 4 8 16 32 64 128 255;


brightness level is not a suitable unit for describing LED brightness
in a Device Tree, as it is not a physical unit. We have led-max-microamp
property for this, expressed in microamperes, please refer to [0] from
linux-next.


Hmm, ok, but what should the driver do with microamperes? As far as I
see, enum led_brightness (which is between 0-255) is used to set the
brightness to LEDs. I don't see any function accepting microamperes.


This is implementation detail. You can convert microamperes to
enum led_brightness in the driver. Please refer to the discussion [1].


The led_set_brightness() takes enum led_brightness, so I don't
understand what this driver would do with the microampere value. It
could, of course, do an arbitrary conversion, say, direct mapping of the
mA value to brightness, but that would just confuse things further.


OK, I was looking at the problem from LED-centric perspective. Indeed,
backlight subsystem has no other way to pass brightness to the LED
subsystem than in the form of levels. However, the last word belongs
to DT maintainer in this matter.

Cc'ing devicetree@vger.kernel.org.


If there was a led_set_microampere(), supported by all led devices, then
yes, the above should be microamperes.

Or are you saying that I should have the binding use microamperes, and
just do a naive microampere - brightness conversion in this driver, and
hope that in the future this driver can be changes to pass the
micrompere value directly to the underlying LED driver?

And speaking of microamperes for LED drivers, what's a meaningful
microampere conversion for LED drivers that don't deal with microamperes
at all? For example, the LED chip we're using, TLC59108, is basically a
PWM chip. Can we somehow calculate microamperes if we know duty cycle
and period?


For this type of drivers we have to resort to levels in DT.
It shouldn't serve as an excuse for not describing the rest of
hardware in a better way, though.

--
Best Regards,
Jacek Anaszewski
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] of/irq: export of_get_irq_byname()

2015-08-26 Thread Wolfram Sang
On Wed, Aug 26, 2015 at 10:24:25AM +1000, Stephen Rothwell wrote:
 Hi Dmitry,
 
 On Tue, 25 Aug 2015 17:04:02 -0700 Dmitry Torokhov 
 dmitry.torok...@gmail.com wrote:
 
  Similarly to of_get_irq(), let's export of_irq_get_byname(), so if a bus 
  core
  can be compiled as a module (such as I2C) it can have access to the symbol.
  
  Reported-by: Stephen Rothwell s...@canb.auug.org.au
  Reported-by: kbuild test robot fengguang...@intel.com
  Signed-off-by: Dmitry Torokhov dmitry.torok...@gmail.com
 
 I applied that to linux-next today.  Pelase get it applied to the i2c
 tree (with appropriate acks).

Waiting for Rob's Ack, then I'll pick it up...



signature.asc
Description: Digital signature


Re: [PATCH 2/3] ARM: DT: STi: STiH407: Add c8sectpfe LinuxDVB DT node.

2015-08-26 Thread Lee Jones
On Wed, 26 Aug 2015, Peter Griffin wrote:
 On Wed, 26 Aug 2015, Lee Jones wrote:
  On Tue, 25 Aug 2015, Peter Griffin wrote:
  
   This patch adds in the required DT node for the c8sectpfe
   Linux DVB demux driver which allows the tsin channels
   to be used on an upstream kernel.
   
   Signed-off-by: Peter Griffin peter.grif...@linaro.org
   ---
arch/arm/boot/dts/stihxxx-b2120.dtsi | 38 
   
1 file changed, 38 insertions(+)
   
   diff --git a/arch/arm/boot/dts/stihxxx-b2120.dtsi 
   b/arch/arm/boot/dts/stihxxx-b2120.dtsi
   index 62994ae..1bc018e 100644
   --- a/arch/arm/boot/dts/stihxxx-b2120.dtsi
   +++ b/arch/arm/boot/dts/stihxxx-b2120.dtsi

[...]

  How about *-c8sectpfe-demod?
 
 That doesn't really make sense, the demod is a seperate device
 typically controlled over I2C bus and connected to this IP block
 via the TS pins. Also although a tsin channel is normally connected
 to a demodulator device there is no reason it couldn't be connected
 for example to another STi chipset which is doing tsout.
 
 Also this IP block can do more than accept tsin, it can
 also do tsout, and merge TS channels together (some coming from
 DDR, external TS pins). Which are features we hope to add
 to the driver in the future so the name needs to be very generic.
 
 So with that in mind I would prefer to leave the compatible as
 the name of the IP block from the SoC datasheet.

Understood.  Thanks for the explanation.

[...]

   + tsin-num = 0;
   + serial-not-parallel;
   + i2c-bus = ssc2;
  
  If you are adding this property, I would get Wolfram or one of the DT
  guys to Ack it.
 
 This driver is actually already accepted, I just missed off one patch from
 the v2 series which meant this patch broke the build when Mauro applied it,
 which is the reason for re-sending it.
 
 This binding is the same way the drm display drivers use DT via ddc-i2c-bus
 property to get the i2c bus for EDID control, so I think uncontroversial.

You're still adding a non-vendor property.  If you think it's generic
enough not to require a vendor, prefix, please attempt to document
it in a generic binding document.

   + rst-gpio = pio15 4 0;
  
  Why not use the whole name reset?
  
  -gpio should be -gpios.
  
  So, in full: reset-gpios?
  
  Flags: GPIO_ACTIVE_HIGH ?
 
 Doing a grep, that does seem to be more standard. Will fix in V2 as a single
 atomic commit.

It's not just 'more standard', it's documented in the GPIO binding.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/7] drm/vc4: Add devicetree bindings for VC4.

2015-08-26 Thread Thierry Reding
On Wed, Aug 26, 2015 at 01:52:29PM +0200, Daniel Vetter wrote:
 On Tue, Aug 25, 2015 at 04:42:18PM -0400, Rob Clark wrote:
  On Mon, Aug 24, 2015 at 9:47 AM, Rob Herring robherri...@gmail.com wrote:
   On Mon, Aug 17, 2015 at 1:30 PM, Eric Anholt e...@anholt.net wrote:
   Stephen Warren swar...@wwwdotorg.org writes:
  
   On 08/12/2015 06:56 PM, Eric Anholt wrote:
   Signed-off-by: Eric Anholt e...@anholt.net
  
   This one definitely needs a patch description, since someone might not
   know what a VC4 is, and git log won't show the text from the binding
   doc itself. I'd suggest adding the initial paragraph of the binding doc
   as the patch description, or more.
  
   diff --git a/Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt 
   b/Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt
  
   +- hvss: List of references to HVS video scalers
   +- encoders: List of references to output encoders (HDMI, SDTV)
  
   Would it make sense to make all those nodes child node of the vc4
   object. That way, there's no need to have these lists of objects; they
   can be automatically built up as the DT is enumerated. I know that e.g.
   the NVIDIA Tegra host1x binding works this way, and I think it may have
   been inspired by other similar cases.
  
   I've looked at tegra, and the component system used by msm appears to be
   nicer than it.  To follow tegra's model, it looks like I need to build
   this extra bus thing corresponding to host1x that is effectively the
   drivers/base/component.c code, so that I can get at vc4's structure from
   the component drivers.
  
   Of course, this is only appropriate if the HW modules really are
   logically children of the VC4 HW module. Perhaps they aren't. If they
   aren't though, I wonder what this vc4 module actually represents in 
   HW?
  
   It's the subsystem, same as we use a subsystem node for msm, sti,
   rockchip, imx, and exynos.  This appears to be the common model of how
   the collection of graphics-related components is represented in the DT.
  
   I think most of these bindings are wrong. They are grouped together
   because that is what DRM wants not because that reflects the h/w. So
   convince me this is one block, not that it is what other people do.
  
  I think, when it comes to more complex driver subsystems (like drm in
  particular) we have a bit of mismatch between how things look from the
  pure hw ignoring sw perspective, and the how sw and in particular
  userspace expects things perspective.  Maybe it is less a problem in
  other subsystems, where bindings map to things that are only visible
  in the kernel, or well defined devices like uart or sata controller.
  But when given the choice, I'm going to err on the side of not
  confusing userspace and the large software stack that sits above
  drm/kms, over dt purity.
  
  Maybe it would be nice to have a sort of dt overlay that adds the bits
  needed to tie together hw blocks that should be assembled into a
  single logical device for linux and userspace (but maybe not some
  other hypothetical operating system).  But so far that doesn't exist.
  All we have is a hammer (devicetree), everything looks like a nail.
  End result is we end up adding some things in the bindings which
  aren't purely about the hw.  Until someone invents a screwdriver, I'm
  not sure what else to do.  In the end, other hypothetical OS is free
  to ignore those extra fields in the bindings if it doesn't need them.
  So meh?
 
 I thought we agreed a while back that these kind of pull everything for
 the logical device together dt nodes which just have piles of phandles
 are totally accepted? At least that's the point behind the component
 helpers, and Eric even suggested to create dt-specific component helpers
 to cut down a bit on the usual boilerplate. dt maintainers are also fine
 with this approach afaik. From my understanding tegra with the host1x bus
 really is the odd one out and not the norm.

I agree that in many aspects Tegra is somewhat special. But the same
principles that the host1x infrastructure uses could be implemented in a
similar way for other DRM drivers. You can easily collect information
about subdevices by walking the device tree and matching on known
compatible strings. And you can also instantiate the top-level device
from driver code rather than have it in DT. It should still be possible
to make this work without an artificial device node in DT. The component
and master infrastructure is largely orthogonal to that, and as far as I
remember the only blocker is the need for a top-level device. I wonder
if perhaps this could be made to work by binding the master to the top-
level SoC device.

Obviously adding the node in DT is easier, but to my knowledge easy has
never been a good excuse for mangling DT. Perhaps that's different these
days...

Thierry


signature.asc
Description: PGP signature


[PATCH 03/16] deps: dtc: Add option to print dependency graph as dot (Graphviz)

2015-08-26 Thread Alexander Holler
Add option -T do print a dependency graph in dot format for
generating a picture with Graphviz.

E.g.

dtc -T foo.dts | dot -T svg -o foo.svg

would generate the picture foo.png with the dependency graph.

Convential dependencies (those based on the tree structure) are having
black arrows, dependencies based on the property 'dependencies' are
having cyan arrows.

Option -D to not automatically add dependencies does still work, so
you could build a classic dependency graph with

dtc -D -T foo.dts | dot -T png -o foo_no_auto_deps.png

This works with binary blobs as input too. E.g.

CROSS_COMPILE=gcc-foo ARCH=arm make foo.dtb
scripts/dtc/dtc -I dtb -T arch/arm/boot/dts/foo.dtb

would print the dot file.

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 scripts/dtc/dependencies.c | 49 --
 scripts/dtc/dtc.c  | 19 +++---
 scripts/dtc/dtc.h  |  2 +-
 3 files changed, 60 insertions(+), 10 deletions(-)

diff --git a/scripts/dtc/dependencies.c b/scripts/dtc/dependencies.c
index 3fb5cef..2c1e0d4 100644
--- a/scripts/dtc/dependencies.c
+++ b/scripts/dtc/dependencies.c
@@ -298,7 +298,7 @@ static void __init topological_sort(void)
depth_first_search(i);
 }
 
-static int __init add_dep_list(struct device_node *node)
+static int __init add_dep_list(struct device_node *node, bool print_dot)
 {
const __be32 *list, *list_end;
uint32_t ph;
@@ -328,6 +328,9 @@ static int __init add_dep_list(struct device_node *node)
rc = insert_edge(node-phandle, ph);
if (rc)
break;
+   if (print_dot)
+   printf(  node0x%x - node0x%x [color=cyan]\n,
+   node-phandle, ph);
}
 
return rc;
@@ -352,9 +355,10 @@ static const char *of_prop_next_string(struct property 
*prop, const char *cur)
 }
 
 static int __init add_deps_lnx(struct device_node *parent,
-   struct device_node *node)
+   struct device_node *node, bool print_dot)
 {
struct device_node *child;
+   const char *cp;
int rc = 0;
 
if (!__of_device_is_available(node))
@@ -375,13 +379,34 @@ static int __init add_deps_lnx(struct device_node *parent,
return -EINVAL;
}
order.parent_by_phandle[node-phandle] = parent-phandle;
-   rc = add_dep_list(node);
+   if (print_dot) {
+   struct property *prop;
+
+   printf(node0x%x [label=\0x%x %s, node-phandle,
+   node-phandle, node-name);
+   if (node-full_name)
+   printf( (%s), node-full_name);
+   prop = get_property(node, compatible);
+   if (prop) {
+   printf(\\n);
+   for (cp = of_prop_next_string(prop, NULL); cp;
+cp = of_prop_next_string(prop, cp)) {
+   if (cp != prop-val.val)
+   putchar(' ');
+   printf(%s, cp);
+   }
+   }
+   printf(\];\n);
+   printf(  node0x%x - node0x%x\n, node-phandle,
+   parent-phandle);
+   }
+   rc = add_dep_list(node, print_dot);
if (unlikely(rc))
return rc;
parent = node; /* change the parent only if node is a driver */
}
for_each_child_of_node(node, child) {
-   rc = add_deps_lnx(parent, child);
+   rc = add_deps_lnx(parent, child, print_dot);
if (unlikely(rc))
break;
}
@@ -424,7 +449,7 @@ void __init of_init_print_order(const char *name)
}
 }
 
-int __init of_init_build_order(struct device_node *root)
+int __init of_init_build_order(struct device_node *root, const char *print_dot)
 {
struct device_node *child;
int rc = 0;
@@ -436,12 +461,24 @@ int __init of_init_build_order(struct device_node *root)
calc_max_phandle(root);
order.old_max_phandle = order.max_phandle;
 
+   if (print_dot) {
+   printf(digraph G {\n);
+   printf(node0x%x [label=\0x%x root (/)\];\n,
+   order.max_phandle+1, order.max_phandle+1);
+   }
+
for_each_child_of_node(root, child) {
-   rc = add_deps_lnx(root, child);
+   rc = add_deps_lnx(root, child, print_dot);
if (unlikely(rc))
break;
}
 
+   if (print_dot) {
+   

Re: [PATCH 2/3] ARM: DT: STi: STiH407: Add c8sectpfe LinuxDVB DT node.

2015-08-26 Thread Peter Griffin
Hi Lee,

On Wed, 26 Aug 2015, Lee Jones wrote:

 On Tue, 25 Aug 2015, Peter Griffin wrote:
 
  This patch adds in the required DT node for the c8sectpfe
  Linux DVB demux driver which allows the tsin channels
  to be used on an upstream kernel.
  
  Signed-off-by: Peter Griffin peter.grif...@linaro.org
  ---
   arch/arm/boot/dts/stihxxx-b2120.dtsi | 38 
  
   1 file changed, 38 insertions(+)
  
  diff --git a/arch/arm/boot/dts/stihxxx-b2120.dtsi 
  b/arch/arm/boot/dts/stihxxx-b2120.dtsi
  index 62994ae..1bc018e 100644
  --- a/arch/arm/boot/dts/stihxxx-b2120.dtsi
  +++ b/arch/arm/boot/dts/stihxxx-b2120.dtsi
  @@ -6,6 +6,10 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
  +
  +#include dt-bindings/clock/stih407-clks.h
  +#include dt-bindings/media/c8sectpfe.h
  +
 
 Looks like some of the STi files are a little wavering on convention,
 but I suggest the extra '\n's are superfluous.

Ok I will remove them in v2.

 
   / {
  soc {
  sbc_serial0: serial@953 {
  @@ -85,5 +89,39 @@
  status = okay;
  };
   
  +   c8sectpfe@08a2 {
 
 This should be a device type, not a model number.
 
 demodulator@abcdabcd {

Ok will change to demux@08a2 in v2

 
  +   compatible = st,stih407-c8sectpfe;
 
 To the uninitiated c8sectpfe is pretty indecipherable.

It is the name of the IP block in the datasheet. It stands
for SECurity TRansport Processor FrontEnd

 
 How about *-c8sectpfe-demod?

That doesn't really make sense, the demod is a seperate device
typically controlled over I2C bus and connected to this IP block
via the TS pins. Also although a tsin channel is normally connected
to a demodulator device there is no reason it couldn't be connected
for example to another STi chipset which is doing tsout.

Also this IP block can do more than accept tsin, it can
also do tsout, and merge TS channels together (some coming from
DDR, external TS pins). Which are features we hope to add
to the driver in the future so the name needs to be very generic.

So with that in mind I would prefer to leave the compatible as
the name of the IP block from the SoC datasheet.

 
  +   status = okay;
  +   reg = 0x08a2 0x1, 0x08a0 0x4000;
  +   reg-names = c8sectpfe, c8sectpfe-ram;
  +
  +   interrupts = 0 34 0, 0 35 0;
 
 Please use the predetermined DEFINES for the flags cell.

Will fix in V2

 
  +   interrupt-names = c8sectpfe-error-irq,
  + c8sectpfe-idle-irq;
  +
  +   pinctrl-names   = tsin0-serial, tsin0-parallel,
  + tsin3-serial, tsin4-serial,
  + tsin5-serial;
 
 I would put *-names *under* the properties they pertain to and in the
 same format i.e. one per line in this case, for easy eye-match.

Ok will change in V2.
 
  +   pinctrl-0   = pinctrl_tsin0_serial;
  +   pinctrl-1   = pinctrl_tsin0_parallel;
  +   pinctrl-2   = pinctrl_tsin3_serial;
  +   pinctrl-3   = pinctrl_tsin4_serial_alt3;
  +   pinctrl-4   = pinctrl_tsin5_serial_alt1;
  +
  +   clocks = clk_s_c0_flexgen CLK_PROC_STFE;
  +   clock-names = c8sectpfe;
  +
  +   /* tsin0 is TSA on NIMA */
  +   tsin0: port@0 {
  +
 
 Why the '\n'?

Removed in v2
 
  +   tsin-num = 0;
  +   serial-not-parallel;
  +   i2c-bus = ssc2;
 
 If you are adding this property, I would get Wolfram or one of the DT
 guys to Ack it.

This driver is actually already accepted, I just missed off one patch from
the v2 series which meant this patch broke the build when Mauro applied it,
which is the reason for re-sending it.

This binding is the same way the drm display drivers use DT via ddc-i2c-bus
property to get the i2c bus for EDID control, so I think uncontroversial.
 
  +   rst-gpio = pio15 4 0;
 
 Why not use the whole name reset?
 
 -gpio should be -gpios.
 
 So, in full: reset-gpios?
 
 Flags: GPIO_ACTIVE_HIGH ?

Doing a grep, that does seem to be more standard. Will fix in V2 as a single
atomic commit.

regards,

Peter.
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 2/2] dt: power: st: Provide bindings for ST's OPPs

2015-08-26 Thread Lee Jones
On Wed, 12 Aug 2015, Viresh Kumar wrote:

 On 11-08-15, 16:17, Lee Jones wrote:
  This would work if we only had a single variable to contend with, but
  what I showed you in my previous example is that we have 3 variables
  to consider; cut (version), pcode and substrate.
  
  Using the two (simple) examples I provided, how would your suggestion
  look in our case?
 
 So the solution I gave is for picking the microvolt based on pcode.
 The other two (cut, substrate) aren't about picking microvolt, but if
 the OPP is available or not. Right?

'pcode', 'cut' and 'substrate' all determine whether a given set of
OPPs an be used on the running platform.  I do not believe that you
can differentiate between them. 

 If these terms are generic enough, then we can add something similar
 to what you have added..

If it makes it easier, you can treat them as version numbers 2.2.1
pcode.cut.substrate, but I don't see how this can help.  Obviously
this becomes more difficult when you add wild cards to the OPPs, where
a particular OPP would be suitable for all cuts for example.

If you still think you can come up with a generic method to lay out
CPUFreq OPP nodes that will satisfy all vendors and not be a mass of
10's of separate nodes, then great.  Again, I'm struggling to see how
that might be possible.

What I believe we shouldn't do, is have this blocked forever for the
sake of adding a couple of vendor properties however.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/16] deps: deterministic driver initialization order

2015-08-26 Thread Alexander Holler
Hello,

I've already written a lot on that topic, therefor this introductory
mail doesn't explain everything.

Please have a look at the threads

dt: dependencies (for deterministic driver initialization order based on
the DT)

and

On-demand device registration

on LKML for previous discussions.

In short, the current init system is quiet old and doesn't really match
todays HW which needs much more drivers than 20 years ago.

As I've mentioned in those threads, initcalls should be identifiable
in order to sort them. My previous attempt intercepted the driver
registrations in order to do that, which unfortunately ended up with
having to deal how drivers are creating devices.

I've now spend some more time and this partly new approach now annotates
the initcalls directly, by storing a pointer to a struct device_driver in
addition to the pointer to the initcall.

This makes my previous patches smaller, cleaner and better to understand,
the result which you can see in this little patch series.

The whole patch series is made up of several parts.

The first 4 patches are modifying dtc to include dependencies (type
information for phandles).

The next 3 patches are the ones which are implementing those annotated
initcalls and the driver sort algorithm.

Then there are 3 patches with small changes on some dts.

The following 4 patches with the WIP (Work In Progress) are changing
some initcalls to annotated initcalls. I would split them up in
a bunch of patches (one for each driver), if I get the promise that
the other patches will be merged into mainline (but not without that
promise).

The final 2 patches are fixes which should end up in mainline, regardless
if this feature is merged or not.

Some numbers (5 boots on each board, without and with ordering drivers),
all times are seconds.

Kirkwood (dockstar, armv5):

Boot to Freeing unused kernel memory (includes mounting the rootfs),
unordered:
4.456016 3.937801 4.114788 4.114526 3.949480 (average 4.1145222)
ordered:
3.173054 3.164045 3.141418 3.480679 3.459298 (3.2836988)
Time needed to sort (of_init_build_order()):
0.003024
Time needed to match drivers to the order (without calling them):
0.002884

Beagleboard (rev C4, armv7):

unordered:
6.706024 6.821746 6.696014 6.673675 6.769866 (6.733465)
ordered:
5.544860 5.514160 5.505859 5.527374 5.496795 (5.5178096)
sorting: 0.021209
matching: 0.006165

Beaglebone Black (rev A5, armv7):

unordered:
3.826531 3.825662 3.826648 3.825434 3.825263 (3.8259076)
ordered:
2.838554 2.838322 2.839459 2.838467 2.838421 (2.8386446)
sorting: 0.004769
matching: 0.004860

imx6q (armv7):

unordered:
3.451998 3.418864 3.446952 3.429974 3.440996 (3.4377568)
ordered:
3.538312 3.549019 3.538105 3.515916 3.555715 (3.5394134)
sorting: 0.004622
matching: 0.003868


Because I'm using different configuration options on these boards,
the absolute times aren't comparable.

But in conclusion, most boards are booting faster when the initcalls
have been ordered.

In addition, ordering the initcalls makes the initialization sequence
more deterministic (it can even be seen without booting a machine).

But I still think the most benefit of these little series is by not having
to use in-driver hacks or that ugly brute force trial-and-error deferred
probing in order to fix a wrong default call order of initcalls.

Further improvements could be to initialize drivers in parallel (using
multiple cores) and/or to use this stuff on x86 (ACPI) too (e.g. by using a
minimal DT which just includes dependencies).


To test this series with any other DT enabled board, look at which
drivers are referenced in the DT (see patch 2 or 3), annotate these
drivers (trivial, see patch 5 or the examples with WIP in the subject),
turn on CONFIG_OF_DEPENDENCIES, compile and boot.


Just to mention it, unless CONFIG_OF_DEPENDENCIES is turned on (which is
marked as experimental), nothing will change, even if you've annotated
some drivers (the new macros will just map to the old ones).


Regards,

Alexander Holler

PS: Please keep in mind that these patches are an offer. I'm already
100+ patches above mainline and don't really care to maintain some more
for myself.
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5] qcom: ipq4019: Add basic board/dts support for IPQ4019 SoC

2015-08-26 Thread Varadarajan Narayanan
Add initial dts files and SoC support for IPQ4019

Signed-off-by: Varadarajan Narayanan var...@codeaurora.org
---
Changes in v2:
  - Added devicetree bindings documentation

Changes in v3:
  - Split 'gcnt' into a separate patch
  - Added the new entries to Makefiles, Kconfig  board.c in sorted order
  - Used qcom,ipq40xx instead of qcom,ipq40xx-r3pc in board.c

Changes in v4:
  - Removed r3pc dts
  - Removed timer frequency

 arch/arm/boot/dts/qcom-ipq4019.dtsi | 72 +
 1 file changed, 72 insertions(+)
 create mode 100644 arch/arm/boot/dts/qcom-ipq4019.dtsi

diff --git a/arch/arm/boot/dts/qcom-ipq4019.dtsi 
b/arch/arm/boot/dts/qcom-ipq4019.dtsi
new file mode 100644
index 000..668cc84
--- /dev/null
+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/dts-v1/;
+
+#include skeleton.dtsi
+
+/ {
+   model = Qualcomm Technologies, Inc. IPQ4019;
+   compatible = qcom,ipq4019;
+   interrupt-parent = intc;
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+   cpu@0 {
+   device_type = cpu;
+   compatible = arm,cortex-a7;
+   reg = 0x0;
+   };
+
+   cpu@1 {
+   device_type = cpu;
+   compatible = arm,cortex-a7;
+   reg = 0x1;
+   };
+
+   cpu@2 {
+   device_type = cpu;
+   compatible = arm,cortex-a7;
+   reg = 0x2;
+   };
+
+   cpu@3 {
+   device_type = cpu;
+   compatible = arm,cortex-a7;
+   reg = 0x3;
+   };
+   };
+
+   soc {
+   #address-cells = 1;
+   #size-cells = 1;
+   ranges;
+   compatible = simple-bus;
+
+   intc: interrupt-controller@b00 {
+   compatible = qcom,msm-qgic2;
+   interrupt-controller;
+   #interrupt-cells = 3;
+   reg = 0x0b00 0x1000,
+   0x0b002000 0x1000;
+   };
+
+   serial@78b {
+   compatible = qcom,msm-uartdm-v1.4, qcom,msm-uartdm;
+   reg = 0x78b 0x200;
+   interrupts = 0 108 0;
+   status = disabled;
+   };
+   };
+};
-- 
1.8.2.1

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH linux-next v5 2/5] Documentation: mtd: add a DT property to set the number of dummy cycles

2015-08-26 Thread Cyrille Pitchen
Depending on the SPI clock frequency, the Fast Read op code and the
Single/Dual Data Rate mode, the number of dummy cycles can be tuned to
improve transfer speed.
The actual number of dummy cycles is specific for each memory model and is
provided by the manufacturer thanks to the memory datasheet.

Signed-off-by: Cyrille Pitchen cyrille.pitc...@atmel.com
---
 Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt 
b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt
index 2bee68103b01..4387567d8024 100644
--- a/Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt
+++ b/Documentation/devicetree/bindings/mtd/jedec,spi-nor.txt
@@ -19,6 +19,11 @@ Optional properties:
all chips and support for it can not be detected at runtime.
Refer to your chips' datasheet to check if this is supported
by your chip.
+- m25p,num-dummy-cycles : Set the number of dummy cycles for Fast Read 
commands.
+  Depending on the manufacturer additional dedicated
+  commands are sent to the flash memory so the
+  controller and the memory can agree on the number of
+  dummy cycles to use.
 
 Example:
 
@@ -29,4 +34,5 @@ Example:
reg = 0;
spi-max-frequency = 4000;
m25p,fast-read;
+   m25p,num-dummy-cycles = 8;
};
-- 
1.8.2.2

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/16] phy: phy-core: fix initcall level

2015-08-26 Thread Alexander Holler
The phy-core has to be initialized before other dependent usb-drivers,
otherwise a crash might occur.

Currently phy_core_init() is called in the initcall-level device, which is
the same level where most usb-drivers will end up. By luck this seemed to
have been called most of the time before other usb-drivers without having
been explicitly enforced. But if phy_core_init() is not called before a
dependent driver, a null-pointer exception might occur (e.g. because the
phy device class isn't registered).

To fix this, phy_core_init() is moved to the initcall-level fs (right
before the standard initcall level device).

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 drivers/phy/phy-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index fc48fac..4945029 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -930,7 +930,7 @@ static int __init phy_core_init(void)
 
return 0;
 }
-module_init(phy_core_init);
+fs_initcall_sync(phy_core_init);
 
 static void __exit phy_core_exit(void)
 {
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/16] deps: WIP: omap: annotate some initcalls

2015-08-26 Thread Alexander Holler
WIP means Work In Progress.

Change some omap drivers to offer annotated initcalls.

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 arch/arm/common/edma.c | 2 +-
 drivers/bus/omap_l3_smx.c  | 2 +-
 drivers/dma/omap-dma.c | 2 +-
 drivers/gpio/gpio-twl4030.c| 2 +-
 drivers/gpu/drm/tilcdc/tilcdc_drv.c| 2 +-
 drivers/i2c/busses/i2c-omap.c  | 2 +-
 drivers/iommu/omap-iommu.c | 2 +-
 drivers/mailbox/omap-mailbox.c | 2 +-
 drivers/memory/omap-gpmc.c | 2 +-
 drivers/mfd/omap-usb-host.c| 2 +-
 drivers/mfd/omap-usb-tll.c | 2 +-
 drivers/mfd/tps65217.c | 2 +-
 drivers/net/ethernet/ti/cpsw.c | 2 +-
 drivers/net/ethernet/ti/davinci_mdio.c | 2 +-
 drivers/phy/phy-twl4030-usb.c  | 2 +-
 drivers/regulator/twl-regulator.c  | 2 +-
 drivers/tty/serial/omap-serial.c   | 2 +-
 drivers/usb/host/ehci-omap.c   | 2 +-
 drivers/usb/host/ohci-omap3.c  | 2 +-
 drivers/usb/musb/omap2430.c| 2 +-
 20 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c
index 873dbfc..29f363c 100644
--- a/arch/arm/common/edma.c
+++ b/arch/arm/common/edma.c
@@ -1872,5 +1872,5 @@ static int __init edma_init(void)
 {
return platform_driver_probe(edma_driver, edma_probe);
 }
-arch_initcall(edma_init);
+annotated_initcall(arch, edma_init, edma_driver.driver);
 
diff --git a/drivers/bus/omap_l3_smx.c b/drivers/bus/omap_l3_smx.c
index 360a5c0..e2172b8 100644
--- a/drivers/bus/omap_l3_smx.c
+++ b/drivers/bus/omap_l3_smx.c
@@ -302,7 +302,7 @@ static int __init omap3_l3_init(void)
 {
return platform_driver_register(omap3_l3_driver);
 }
-postcore_initcall_sync(omap3_l3_init);
+annotated_initcall_sync(postcore, omap3_l3_init, omap3_l3_driver.driver);
 
 static void __exit omap3_l3_exit(void)
 {
diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
index 249445c..0866ae9 100644
--- a/drivers/dma/omap-dma.c
+++ b/drivers/dma/omap-dma.c
@@ -1285,7 +1285,7 @@ static int omap_dma_init(void)
 {
return platform_driver_register(omap_dma_driver);
 }
-subsys_initcall(omap_dma_init);
+annotated_initcall(subsys, omap_dma_init, omap_dma_driver.driver);
 
 static void __exit omap_dma_exit(void)
 {
diff --git a/drivers/gpio/gpio-twl4030.c b/drivers/gpio/gpio-twl4030.c
index 9e1dbb9..60c0d1a 100644
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@ -615,7 +615,7 @@ static int __init gpio_twl4030_init(void)
 {
return platform_driver_register(gpio_twl4030_driver);
 }
-subsys_initcall(gpio_twl4030_init);
+annotated_initcall(subsys, gpio_twl4030_init, gpio_twl4030_driver.driver);
 
 static void __exit gpio_twl4030_exit(void)
 {
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 0f283a3..8c50f23 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -715,7 +715,7 @@ static void __exit tilcdc_drm_fini(void)
tilcdc_tfp410_fini();
 }
 
-module_init(tilcdc_drm_init);
+annotated_module_init(tilcdc_drm_init, tilcdc_platform_driver.driver);
 module_exit(tilcdc_drm_fini);
 
 MODULE_AUTHOR(Rob Clark robdcl...@gmail.com);
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index fc9bf7f..0a5d63b 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1541,7 +1541,7 @@ omap_i2c_init_driver(void)
 {
return platform_driver_register(omap_i2c_driver);
 }
-subsys_initcall(omap_i2c_init_driver);
+annotated_initcall(subsys, omap_i2c_init_driver, omap_i2c_driver.driver);
 
 static void __exit omap_i2c_exit_driver(void)
 {
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index a22c33d..cf2ef44 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1406,7 +1406,7 @@ static int __init omap_iommu_init(void)
return platform_driver_register(omap_iommu_driver);
 }
 /* must be ready before omap3isp is probed */
-subsys_initcall(omap_iommu_init);
+annotated_initcall(subsys, omap_iommu_init, omap_iommu_driver.driver);
 
 static void __exit omap_iommu_exit(void)
 {
diff --git a/drivers/mailbox/omap-mailbox.c b/drivers/mailbox/omap-mailbox.c
index a3dbfd9..ac12306 100644
--- a/drivers/mailbox/omap-mailbox.c
+++ b/drivers/mailbox/omap-mailbox.c
@@ -883,7 +883,7 @@ static int __init omap_mbox_init(void)
 
return platform_driver_register(omap_mbox_driver);
 }
-subsys_initcall(omap_mbox_init);
+annotated_initcall(subsys, omap_mbox_init, omap_mbox_driver.driver);
 
 static void __exit omap_mbox_exit(void)
 {
diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 9426276..65b0138 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -2217,7 +2217,7 @@ static __exit void gpmc_exit(void)
 
 }
 
-postcore_initcall(gpmc_init);
+annotated_initcall(postcore, gpmc_init, 

[PATCH 11/16] deps: WIP: generic: annotate some initcalls

2015-08-26 Thread Alexander Holler
WIP means Work In Progress.

Change some generic drivers to offer annotated initcalls.

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 drivers/input/keyboard/gpio_keys.c | 2 +-
 drivers/misc/sram.c| 2 +-
 drivers/regulator/fixed.c  | 3 ++-
 drivers/usb/phy/phy-generic.c  | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c 
b/drivers/input/keyboard/gpio_keys.c
index ddf4045..319bcf7 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -855,7 +855,7 @@ static void __exit gpio_keys_exit(void)
platform_driver_unregister(gpio_keys_device_driver);
 }
 
-late_initcall(gpio_keys_init);
+annotated_initcall(late, gpio_keys_init, gpio_keys_device_driver.driver);
 module_exit(gpio_keys_exit);
 
 MODULE_LICENSE(GPL);
diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index 15c33cc..eb662bd 100644
--- a/drivers/misc/sram.c
+++ b/drivers/misc/sram.c
@@ -243,4 +243,4 @@ static int __init sram_init(void)
return platform_driver_register(sram_driver);
 }
 
-postcore_initcall(sram_init);
+annotated_initcall(postcore, sram_init, sram_driver.driver);
diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c
index ff62d69..ec35d10 100644
--- a/drivers/regulator/fixed.c
+++ b/drivers/regulator/fixed.c
@@ -221,7 +221,8 @@ static int __init regulator_fixed_voltage_init(void)
 {
return platform_driver_register(regulator_fixed_voltage_driver);
 }
-subsys_initcall(regulator_fixed_voltage_init);
+annotated_initcall(subsys, regulator_fixed_voltage_init,
+   regulator_fixed_voltage_driver.driver);
 
 static void __exit regulator_fixed_voltage_exit(void)
 {
diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
index deee68e..baf95d0 100644
--- a/drivers/usb/phy/phy-generic.c
+++ b/drivers/usb/phy/phy-generic.c
@@ -360,7 +360,7 @@ static int __init usb_phy_generic_init(void)
 {
return platform_driver_register(usb_phy_generic_driver);
 }
-subsys_initcall(usb_phy_generic_init);
+annotated_initcall(subsys, usb_phy_generic_init, 
usb_phy_generic_driver.driver);
 
 static void __exit usb_phy_generic_exit(void)
 {
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 16/16] mmc: host: omap_hsmmc: use mmc_of_parse_voltage to get ocr_avail

2015-08-26 Thread Kishon Vijay Abraham I
Hi Ulf,

On Tuesday 25 August 2015 08:20 PM, Ulf Hansson wrote:
 On 3 August 2015 at 14:26, Kishon Vijay Abraham I kis...@ti.com wrote:
 From: Roger Quadros rog...@ti.com

 For platforms that doesn't have explicit regulator control in MMC,
 populate voltage-ranges in MMC device tree node and use
 mmc_of_parse_voltage to get ocr_avail
 
 I don't like this.
 
 If we are able to fetch the OCR mask via an external regulator, that
 shall be done.
 
 I think the mmc_of_parse_voltage() API and the corresponding DT
 binding it parses, should be used for those HW when we don't have an
 external regulator to use. For example if the MMC controller itself
 somehow controls the voltage levels. Is that really the case for you?

This was actually added to support Galileo platform which doesn't have
regulators modelled. Indeed it would be better to model external
regulators (even if it is always on) and get OCR from the regulator.

I'll drop this patch and re-send the series re-based to your next branch.

Thanks
Kishon

 
 Kind regards
 Uffe
 

 Signed-off-by: Roger Quadros rog...@ti.com
 Signed-off-by: Lokesh Vutla lokeshvu...@ti.com
 Signed-off-by: Murali Karicheri m-kariche...@ti.com
 Signed-off-by: Franklin S Cooper Jr fcoo...@ti.com
 Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
 ---
  .../devicetree/bindings/mmc/ti-omap-hsmmc.txt  |2 ++
  drivers/mmc/host/omap_hsmmc.c  |9 -
  2 files changed, 10 insertions(+), 1 deletion(-)

 diff --git a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt 
 b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
 index 76bf087..2408e87 100644
 --- a/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
 +++ b/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt
 @@ -22,6 +22,8 @@ ti,dual-volt: boolean, supports dual voltage cards
  ti,non-removable: non-removable slot (like eMMC)
  ti,needs-special-reset: Requires a special softreset sequence
  ti,needs-special-hs-handling: HSMMC IP needs special setting for handling 
 High Speed
 +voltage-ranges: Specify the voltage range supported if regulator framework
 +isn't enabled.
  dmas: List of DMA specifiers with the controller specific format
  as described in the generic DMA client binding. A tx and rx
  specifier is required.
 diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
 index 15973f1..d884d8f 100644
 --- a/drivers/mmc/host/omap_hsmmc.c
 +++ b/drivers/mmc/host/omap_hsmmc.c
 @@ -2184,7 +2184,13 @@ static int omap_hsmmc_probe(struct platform_device 
 *pdev)
 goto err_irq;
 }

 -   mmc-ocr_avail = mmc_pdata(host)-ocr_mask;
 +   if (!mmc_pdata(host)-ocr_mask) {
 +   ret = mmc_of_parse_voltage(pdev-dev.of_node, 
 mmc-ocr_avail);
 +   if (ret)
 +   goto err_parse_voltage;
 +   } else {
 +   mmc-ocr_avail = mmc_pdata(host)-ocr_mask;
 +   }

 omap_hsmmc_disable_irq(host);

 @@ -2224,6 +2230,7 @@ static int omap_hsmmc_probe(struct platform_device 
 *pdev)

  err_slot_name:
 mmc_remove_host(mmc);
 +err_parse_voltage:
 omap_hsmmc_reg_put(host);
  err_irq:
 device_init_wakeup(pdev-dev, false);
 --
 1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/16] deps: dtc: Automatically add new property 'dependencies' which contains a list of referenced phandles

2015-08-26 Thread Alexander Holler
During the step from .dts to .dtb the information about dependcies
contained in the .dts through phandle references is lost. This makes it
impossible to use the binary blob to create a dependency graph without
knowing the semantic of all cell arrays.

Therefor automatically add a new property called 'dependencies' to all
nodes which have phandle references in one of their properties.

This new property will contain an array of phandles with one value for
every phandle referenced by other properties in the node.

If such a property already exists (e.g. to manually add dependencies
through the .dts), the existing list will be expanded.

Added phandles will be the phandle of either the referenced node itself
(if it has a property named 'compatible', or of the next parent of the
referenced node which as property named 'compatible'. This ensures only
dependencies to drivers will be added.

References to phandles of parent or child nodes will not be added to this
property, because this information is already contained in the blob (in
the form of the tree itself).

No dependencies to disabled nodes will be added.

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 scripts/dtc/Makefile   |   3 +-
 scripts/dtc/Makefile.dtc   |   1 +
 scripts/dtc/dependencies.c | 108 +
 scripts/dtc/dtc.c  |  12 -
 scripts/dtc/dtc.h  |   3 ++
 5 files changed, 125 insertions(+), 2 deletions(-)
 create mode 100644 scripts/dtc/dependencies.c

diff --git a/scripts/dtc/Makefile b/scripts/dtc/Makefile
index 2a48022..1174cf9 100644
--- a/scripts/dtc/Makefile
+++ b/scripts/dtc/Makefile
@@ -4,7 +4,7 @@ hostprogs-y := dtc
 always := $(hostprogs-y)
 
 dtc-objs   := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
-  srcpos.o checks.o util.o
+  srcpos.o checks.o util.o dependencies.o
 dtc-objs   += dtc-lexer.lex.o dtc-parser.tab.o
 
 # Source files need to get at the userspace version of libfdt_env.h to compile
@@ -13,6 +13,7 @@ HOSTCFLAGS_DTC := -I$(src) -I$(src)/libfdt
 
 HOSTCFLAGS_checks.o := $(HOSTCFLAGS_DTC)
 HOSTCFLAGS_data.o := $(HOSTCFLAGS_DTC)
+HOSTCFLAGS_dependencies.o := $(HOSTCFLAGS_DTC)
 HOSTCFLAGS_dtc.o := $(HOSTCFLAGS_DTC)
 HOSTCFLAGS_flattree.o := $(HOSTCFLAGS_DTC)
 HOSTCFLAGS_fstree.o := $(HOSTCFLAGS_DTC)
diff --git a/scripts/dtc/Makefile.dtc b/scripts/dtc/Makefile.dtc
index bece49b..5fb5343 100644
--- a/scripts/dtc/Makefile.dtc
+++ b/scripts/dtc/Makefile.dtc
@@ -6,6 +6,7 @@
 DTC_SRCS = \
checks.c \
data.c \
+   dependencies.c \
dtc.c \
flattree.c \
fstree.c \
diff --git a/scripts/dtc/dependencies.c b/scripts/dtc/dependencies.c
new file mode 100644
index 000..dd4658c
--- /dev/null
+++ b/scripts/dtc/dependencies.c
@@ -0,0 +1,108 @@
+/*
+ * Code to add a property which contains dependencies (used phandle references)
+ * to all (driver) nodes which are having phandle references.
+ *
+ * Copyright (C) 2014 Alexander Holler hol...@ahsoftware.de
+ *
+ * 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 option) any later version.
+ */
+
+#include dtc.h
+
+/* Searches upwards for a node with a property 'compatible' */
+static struct node *find_compatible_not_disabled(struct node *node)
+{
+   struct property *prop;
+
+   while (node) {
+   prop = get_property(node, compatible);
+   if (prop) {
+   prop = get_property(node, status);
+   if (prop)
+   if (!prop-val.len ||
+   (strcmp(prop-val.val, okay) 
+   strcmp(prop-val.val, ok)))
+   return NULL; /* disabled */
+   return node;
+   }
+   node = node-parent;
+   }
+   return NULL;
+}
+
+static bool is_parent_of(struct node *node1, struct node *node2)
+{
+   while (node2) {
+   if (node2-parent == node1)
+   return true;
+   node2 = node2-parent;
+   }
+   return false;
+
+}
+
+static void add_deps(struct node *dt, struct node *node, struct property *prop)
+{
+   struct marker *m = prop-val.markers;
+   struct node *refnode;
+   cell_t phandle;
+   struct property *prop_deps;
+   unsigned i;
+   cell_t *cell;
+   struct node *source;
+   struct node *target;
+
+   for_each_marker_of_type(m, REF_PHANDLE) {
+   assert(m-offset + sizeof(cell_t) = prop-val.len);
+
+   refnode = get_node_by_ref(dt, m-ref);
+   if (!refnode) {
+   fprintf(stderr,
+   ERROR: Reference to non-existent node or label 

[PATCH 02/16] deps: dtc: Add option to print initialization order

2015-08-26 Thread Alexander Holler
Add option -t to print the default initialization order.
No other output will be generated.

To print the order, just use something like this:

CROSS_COMPILE=gcc-foo ARCH=arm make foo.dtb
scripts/dtc/dtc -I dtb -t arch/arm/boot/dts/foo.dtb

Since it's now possible to check to for cycles in the dependency graph,
this is now done too.

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 scripts/dtc/dependencies.c | 344 +
 scripts/dtc/dtc.c  |  24 +++-
 scripts/dtc/dtc.h  |   2 +
 3 files changed, 369 insertions(+), 1 deletion(-)

diff --git a/scripts/dtc/dependencies.c b/scripts/dtc/dependencies.c
index dd4658c..3fb5cef 100644
--- a/scripts/dtc/dependencies.c
+++ b/scripts/dtc/dependencies.c
@@ -106,3 +106,347 @@ void add_dependencies(struct boot_info *bi)
 {
process_nodes_props(bi-dt, bi-dt);
 }
+
+/*
+ * The code below is in large parts a copy of drivers/of/of_dependencies.c
+ * in the Linux kernel. So both files do share the same bugs.
+ * The next few ugly defines do exist to keep the differences at a minimum.
+ */
+static struct node *tree;
+#define pr_cont(format, ...) printf(format, ##__VA_ARGS__)
+#define pr_info(format, ...) printf(format, ##__VA_ARGS__)
+#define pr_warn(format, ...) printf(format, ##__VA_ARGS__)
+#define pr_err(format, ...) fprintf(stderr, format, ##__VA_ARGS__)
+typedef cell_t __be32;
+#define device_node node
+#define full_name fullpath
+#define __initdata
+#define __init
+#define unlikely(a) (a)
+#define of_node_put(a)
+#define of_find_node_by_phandle(v) get_node_by_phandle(tree, v)
+#define __of_get_property(a, b, c) get_property(a, b)
+#define for_each_child_of_node(a, b) for_each_child(a, b)
+
+
+#define MAX_DT_NODES 1000 /* maximum number of vertices */
+#define MAX_EDGES (MAX_DT_NODES*2) /* maximum number of edges (dependencies) */
+
+struct edgenode {
+   uint32_t y; /* phandle */
+   struct edgenode *next; /* next edge in list */
+};
+
+/*
+ * Vertex numbers do correspond to phandle numbers. That means the graph
+ * does contain as much vertices as the maximum of all phandles.
+ * Or in other words, we assume that for all phandles in the device tree
+ * 0  phandle  MAX_DT_NODES+1 is true.
+ */
+struct dep_graph {
+   struct edgenode edge_slots[MAX_EDGES]; /* used to avoid kmalloc */
+   struct edgenode *edges[MAX_DT_NODES+1]; /* adjacency info */
+   unsigned nvertices; /* number of vertices in graph */
+   unsigned nedges; /* number of edges in graph */
+   bool processed[MAX_DT_NODES+1]; /* which vertices have been processed */
+   bool include_node[MAX_DT_NODES+1]; /* which nodes to consider */
+   bool discovered[MAX_DT_NODES+1]; /* which vertices have been found */
+   bool finished; /* if true, cut off search immediately */
+};
+static struct dep_graph graph __initdata;
+
+struct init_order {
+   uint32_t max_phandle; /* the max used phandle */
+   uint32_t old_max_phandle; /* used to keep track of added phandles */
+   struct device_node *order[MAX_DT_NODES+1];
+   unsigned count;
+   /* Used to keep track of parent devices in regard to the DT */
+   uint32_t parent_by_phandle[MAX_DT_NODES+1];
+   struct device *device_by_phandle[MAX_DT_NODES+1];
+};
+static struct init_order order __initdata;
+
+
+/* Copied from drivers/of/base.c (because it's lockless). */
+static int __init __of_device_is_available(struct device_node *device)
+{
+   struct property *status;
+
+   if (!device)
+   return 0;
+
+   status = get_property(device, status);
+   if (status == NULL)
+   return 1;
+
+   if (status-val.len  0) {
+   if (!strcmp(status-val.val, okay) ||
+   !strcmp(status-val.val, ok))
+   return 1;
+   }
+
+   return 0;
+}
+
+/*
+ * x is a dependant of y or in other words
+ * y will be initialized before x.
+ */
+static int __init insert_edge(uint32_t x, uint32_t y)
+{
+   struct edgenode *p; /* temporary pointer */
+
+   if (unlikely(x  MAX_DT_NODES || y  MAX_DT_NODES)) {
+   pr_err(Node found with phandle 0x%x  MAX_DT_NODES (%d)!\n,
+   x  MAX_DT_NODES ? x : y, MAX_DT_NODES);
+   return -EINVAL;
+   }
+   if (unlikely(!x || !y))
+   return 0;
+   if (unlikely(graph.nedges = MAX_EDGES)) {
+   pr_err(Maximum number of edges (%d) reached!\n, MAX_EDGES);
+   return -EINVAL;
+   }
+   p = graph.edge_slots[graph.nedges++];
+   graph.include_node[x] = 1;
+   graph.include_node[y] = 1;
+   p-y = y;
+   p-next = graph.edges[x];
+   graph.edges[x] = p; /* insert at head of list */
+
+   graph.nvertices = (x  graph.nvertices) ? x : graph.nvertices;
+   graph.nvertices = (y  graph.nvertices) ? y : graph.nvertices;
+   return 0;
+}
+
+static void __init print_node_name(uint32_t v)

Re: [PATCH v3 1/1][Resend] misc: sram: add dev_pm_ops to support module power gate

2015-08-26 Thread Sudeep Holla



On 25/08/15 23:03, Shenwei Wang wrote:

When system goes into low power states like SUSPEND_MEM and
HIBERNATION, the hardware IP block may be powered off to reduce
the power consumption. This power down will lost all the
data inside the ram. This patch added the dev_pm_ops and
implemented two callbacks: suspend_noirq and resume_noirq, which
will save the data in the on-chip-ram right before power down
and restore it after system resumes.

A new property string named can-power-gate is added to
the devicetree bindings too.

Based-on-a-patch-by: Anson Huang b20...@freescale.com
Signed-off-by: Shenwei Wang shenwei.w...@freescale.com

---
Change log:

PATCH v3
Removed the unnecessary clk_enable/clk_disable.

PATCH v2
Use vmalloc to allocate the SRAM backup memory.
Code clean up.

  Documentation/devicetree/bindings/misc/sram.txt |  2 ++
  drivers/misc/sram.c | 42 +
  2 files changed, 44 insertions(+)

diff --git a/Documentation/devicetree/bindings/misc/sram.txt 
b/Documentation/devicetree/bindings/misc/sram.txt
index 36cbe5a..1170086 100644
--- a/Documentation/devicetree/bindings/misc/sram.txt
+++ b/Documentation/devicetree/bindings/misc/sram.txt
@@ -33,6 +33,8 @@ Optional properties in the area nodes:

  - compatible : standard definition, should contain a vendor specific string
 in the form vendor,[device-]usage
+- can-power-gate: a property to tell the driver that the sram can support
+   power gate

  Example:

diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index 15c33cc..db9f1fa 100644
--- a/drivers/misc/sram.c
+++ b/drivers/misc/sram.c
@@ -30,7 +30,9 @@

  struct sram_dev {
struct device *dev;
+   void *power_off_save;
void __iomem *virt_base;
+   u32 size;

struct gen_pool *pool;
struct clk *clk;
@@ -156,6 +158,33 @@ static int sram_reserve_regions(struct sram_dev *sram, 
struct resource *res)
return ret;
  }

+static int sram_suspend_noirq(struct device *dev)
+{
+   struct platform_device *pdev = to_platform_device(dev);
+   struct sram_dev *sram = platform_get_drvdata(pdev);
+
+   if (!sram-power_off_save)
+   return 0;
+
+   /* Save necessary regs */
+   memcpy(sram-power_off_save, sram-virt_base, sram-size);
+
+   return 0;
+}
+
+static int sram_resume_noirq(struct device *dev)
+{
+   struct platform_device *pdev = to_platform_device(dev);
+   struct sram_dev *sram = platform_get_drvdata(pdev);
+
+   if (!sram-power_off_save)
+   return 0;
+
+   memcpy(sram-virt_base, sram-power_off_save, sram-size);


As I objected in the original thread[1], I am just iterating myself here
again. IMO this is unnecessary and can be avoided. It's also not
scalable for large SRAM. I *still can't understand* what's the use-case
where you need to save/restore the entire SRAM content.

I see it's mostly used for audio/video and some crypto use-case(in the
mainline). In most of those cases, when you enter S2R, all the devices
*needs to be in quiescent state* which implies they no longer use SRAM.
So can you please care to provide your reasons for this save/restore ?

On some platforms, it's used for PM in which case it needs to be always on.

Regards,
Sudeep

[1] http://www.spinics.net/lists/arm-kernel/msg441449.html
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/7] drm/vc4: Add devicetree bindings for VC4.

2015-08-26 Thread Daniel Vetter
On Tue, Aug 25, 2015 at 04:42:18PM -0400, Rob Clark wrote:
 On Mon, Aug 24, 2015 at 9:47 AM, Rob Herring robherri...@gmail.com wrote:
  On Mon, Aug 17, 2015 at 1:30 PM, Eric Anholt e...@anholt.net wrote:
  Stephen Warren swar...@wwwdotorg.org writes:
 
  On 08/12/2015 06:56 PM, Eric Anholt wrote:
  Signed-off-by: Eric Anholt e...@anholt.net
 
  This one definitely needs a patch description, since someone might not
  know what a VC4 is, and git log won't show the text from the binding
  doc itself. I'd suggest adding the initial paragraph of the binding doc
  as the patch description, or more.
 
  diff --git a/Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt 
  b/Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt
 
  +- hvss: List of references to HVS video scalers
  +- encoders: List of references to output encoders (HDMI, SDTV)
 
  Would it make sense to make all those nodes child node of the vc4
  object. That way, there's no need to have these lists of objects; they
  can be automatically built up as the DT is enumerated. I know that e.g.
  the NVIDIA Tegra host1x binding works this way, and I think it may have
  been inspired by other similar cases.
 
  I've looked at tegra, and the component system used by msm appears to be
  nicer than it.  To follow tegra's model, it looks like I need to build
  this extra bus thing corresponding to host1x that is effectively the
  drivers/base/component.c code, so that I can get at vc4's structure from
  the component drivers.
 
  Of course, this is only appropriate if the HW modules really are
  logically children of the VC4 HW module. Perhaps they aren't. If they
  aren't though, I wonder what this vc4 module actually represents in HW?
 
  It's the subsystem, same as we use a subsystem node for msm, sti,
  rockchip, imx, and exynos.  This appears to be the common model of how
  the collection of graphics-related components is represented in the DT.
 
  I think most of these bindings are wrong. They are grouped together
  because that is what DRM wants not because that reflects the h/w. So
  convince me this is one block, not that it is what other people do.
 
 I think, when it comes to more complex driver subsystems (like drm in
 particular) we have a bit of mismatch between how things look from the
 pure hw ignoring sw perspective, and the how sw and in particular
 userspace expects things perspective.  Maybe it is less a problem in
 other subsystems, where bindings map to things that are only visible
 in the kernel, or well defined devices like uart or sata controller.
 But when given the choice, I'm going to err on the side of not
 confusing userspace and the large software stack that sits above
 drm/kms, over dt purity.
 
 Maybe it would be nice to have a sort of dt overlay that adds the bits
 needed to tie together hw blocks that should be assembled into a
 single logical device for linux and userspace (but maybe not some
 other hypothetical operating system).  But so far that doesn't exist.
 All we have is a hammer (devicetree), everything looks like a nail.
 End result is we end up adding some things in the bindings which
 aren't purely about the hw.  Until someone invents a screwdriver, I'm
 not sure what else to do.  In the end, other hypothetical OS is free
 to ignore those extra fields in the bindings if it doesn't need them.
 So meh?

I thought we agreed a while back that these kind of pull everything for
the logical device together dt nodes which just have piles of phandles
are totally accepted? At least that's the point behind the component
helpers, and Eric even suggested to create dt-specific component helpers
to cut down a bit on the usual boilerplate. dt maintainers are also fine
with this approach afaik. From my understanding tegra with the host1x bus
really is the odd one out and not the norm.

Given that and with the hope that we'll eventually see a dt-enabled
component functions to standardize this even more the overall concept is

Acked-by: Daniel Vetter daniel.vet...@ffwll.ch

Cheers, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/7] drm/vc4: Add devicetree bindings for VC4.

2015-08-26 Thread Thierry Reding
On Fri, Aug 14, 2015 at 10:38:54PM -0600, Stephen Warren wrote:
 On 08/12/2015 06:56 PM, Eric Anholt wrote:
  Signed-off-by: Eric Anholt e...@anholt.net
 
 This one definitely needs a patch description, since someone might not
 know what a VC4 is, and git log won't show the text from the binding
 doc itself. I'd suggest adding the initial paragraph of the binding doc
 as the patch description, or more.
 
  diff --git a/Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt 
  b/Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt
 
  +Required properties for VC4:
  +- compatible:  Should be brcm,vc4
  +- crtcs:   List of references to pixelvalve scanout engines
 
 s/references to/phandles of/ would be more typical DT language.
 
  +- hvss:List of references to HVS video scalers
  +- encoders:List of references to output encoders (HDMI, SDTV)
 
 Would it make sense to make all those nodes child node of the vc4
 object. That way, there's no need to have these lists of objects; they
 can be automatically built up as the DT is enumerated. I know that e.g.
 the NVIDIA Tegra host1x binding works this way, and I think it may have
 been inspired by other similar cases.

Actually the host1x binding was the first of its kind. Unfortunately for
the purposes of this discussion (but fortunately otherwise) Tegra is the
odd-ball it seems. host1x is indeed a physical parent of all the devices
pertaining to the DRM driver, so the DT description is accurate from a
hardware point of view while at the same time giving us a top-level
device that we can bind against.

Now for most other cases it seems like the central piece that they are
missing is this top-level device, hence why the virtual DRM subsystem
device is instantiated. I tried to argue in the past that it wasn't a
proper description and proposed alternatives, but I was always pretty
much the only one with this viewpoint, so my comments ended up being
ignored.

Technically there is nothing that would prevent other drivers from doing
without the lists of phandles. On Tegra, again this might be special for
this particular hardware, we've never had a need to describe these kinds
of relationships. Each display controller can essentially drive each of
the outputs, which we deal with elegantly by setting the .possible_crtcs
mask of the encoders.

Also, to pull together all devices that are needed to make up the DRM
device, we use a list of compatible strings in the driver to find these
devices. Then as each of them registers with the host1x bus we wait for
the subdevice list to become empty and -probe() the component host1x
device.

Note that while this predates component/master, this is all very similar
in principle (Russell and I did have some discussions about this back at
the time, but I'm not sure how much, if anything, he took as inspiration
from the host1x infrastructure). After component/master was merged I did
try to convert Tegra DRM to use it. Things looked pretty good, but ended
up not working because each componentized device must have a unique
master device. This poses a problem because on Tegra we needed the top-
level (i.e. master) device to be shared among multiple drivers.

I posted patches at some point to try and fix remedy the situation but
wasn't able to elicit any reactions, and since I had something that was
working did not pursue this any further.

Thierry


signature.asc
Description: PGP signature


[PATCH linux-next v5 5/5] mtd: atmel-quadspi: add driver for Atmel QSPI controller

2015-08-26 Thread Cyrille Pitchen
This driver add support to the new Atmel QSPI controller embedded into
sama5d2x SoCs. It expects a NOR memory to be connected to the QSPI
controller.

Signed-off-by: Cyrille Pitchen cyrille.pitc...@atmel.com
Acked-by: Nicolas Ferre nicolas.fe...@atmel.com
---
 drivers/mtd/spi-nor/Kconfig |   7 +
 drivers/mtd/spi-nor/Makefile|   1 +
 drivers/mtd/spi-nor/atmel-quadspi.c | 859 
 3 files changed, 867 insertions(+)
 create mode 100644 drivers/mtd/spi-nor/atmel-quadspi.c

diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig
index 89bf4c1faa2b..7a3d55429550 100644
--- a/drivers/mtd/spi-nor/Kconfig
+++ b/drivers/mtd/spi-nor/Kconfig
@@ -29,6 +29,13 @@ config SPI_FSL_QUADSPI
  This controller does not support generic SPI. It only supports
  SPI NOR.
 
+config SPI_ATMEL_QUADSPI
+   tristate Atmel Quad SPI Controller
+   depends on OF  HAS_DMA  (ARCH_AT91 || COMPILE_TEST)
+   help
+ This enables support for the Quad SPI controller in master mode.
+ We only connect the NOR to this controller now.
+
 config SPI_NXP_SPIFI
tristate NXP SPI Flash Interface (SPIFI)
depends on OF  (ARCH_LPC18XX || COMPILE_TEST)
diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
index e5ef8582..f5d23d7379bb 100644
--- a/drivers/mtd/spi-nor/Makefile
+++ b/drivers/mtd/spi-nor/Makefile
@@ -1,3 +1,4 @@
 obj-$(CONFIG_MTD_SPI_NOR)  += spi-nor.o
 obj-$(CONFIG_SPI_FSL_QUADSPI)  += fsl-quadspi.o
+obj-$(CONFIG_SPI_ATMEL_QUADSPI)+= atmel-quadspi.o
 obj-$(CONFIG_SPI_NXP_SPIFI)+= nxp-spifi.o
diff --git a/drivers/mtd/spi-nor/atmel-quadspi.c 
b/drivers/mtd/spi-nor/atmel-quadspi.c
new file mode 100644
index ..003cdf00e8b1
--- /dev/null
+++ b/drivers/mtd/spi-nor/atmel-quadspi.c
@@ -0,0 +1,859 @@
+/*
+ * Driver for Atmel QSPI Controller
+ *
+ * Copyright (C) 2015 Atmel Corporation
+ *
+ * Author: Cyrille Pitchen cyrille.pitc...@atmel.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see http://www.gnu.org/licenses/.
+ *
+ * This driver is based on drivers/mtd/spi-nor/fsl-quadspi.c from Freescale.
+ */
+
+#include linux/kernel.h
+#include linux/clk.h
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/delay.h
+#include linux/dma-mapping.h
+#include linux/dmaengine.h
+#include linux/err.h
+#include linux/interrupt.h
+#include linux/mtd/mtd.h
+#include linux/mtd/partitions.h
+#include linux/mtd/spi-nor.h
+#include linux/platform_data/atmel.h
+#include linux/platform_data/dma-atmel.h
+#include linux/of.h
+
+#include linux/io.h
+#include linux/gpio.h
+#include linux/pinctrl/consumer.h
+
+/* QSPI register offsets */
+#define QSPI_CR  0x  /* Control Register */
+#define QSPI_MR  0x0004  /* Mode Register */
+#define QSPI_RD  0x0008  /* Receive Data Register */
+#define QSPI_TD  0x000c  /* Transmit Data Register */
+#define QSPI_SR  0x0010  /* Status Register */
+#define QSPI_IER 0x0014  /* Interrupt Enable Register */
+#define QSPI_IDR 0x0018  /* Interrupt Disable Register */
+#define QSPI_IMR 0x001c  /* Interrupt Mask Register */
+#define QSPI_SCR 0x0020  /* Serial Clock Register */
+
+#define QSPI_IAR 0x0030  /* Instruction Address Register */
+#define QSPI_ICR 0x0034  /* Instruction Code Register */
+#define QSPI_IFR 0x0038  /* Instruction Frame Register */
+
+#define QSPI_SMR 0x0040  /* Scrambling Mode Register */
+#define QSPI_SKR 0x0044  /* Scrambling Key Register */
+
+#define QSPI_WPMR0x00E4  /* Write Protection Mode Register */
+#define QSPI_WPSR0x00E8  /* Write Protection Status Register */
+
+#define QSPI_VERSION 0x00FC  /* Version Register */
+
+
+/* Bitfields in QSPI_CR (Control Register) */
+#define QSPI_CR_QSPIEN  BIT(0)
+#define QSPI_CR_QSPIDIS BIT(1)
+#define QSPI_CR_SWRST   BIT(7)
+#define QSPI_CR_LASTXFERBIT(24)
+
+/* Bitfields in QSPI_MR (Mode Register) */
+#define QSPI_MR_SSM BIT(0)
+#define QSPI_MR_LLB BIT(1)
+#define QSPI_MR_WDRBT   BIT(2)
+#define QSPI_MR_SMRMBIT(3)
+#define QSPI_MR_CSMODE_MASK GENMASK(5, 4)
+#define QSPI_MR_CSMODE_NOT_RELOADED (0  4)
+#define QSPI_MR_CSMODE_LASTXFER (1  4)
+#define QSPI_MR_CSMODE_SYSTEMATICALLY   (2  4)
+#define QSPI_MR_NBBITS_MASK GENMASK(11, 8)
+#define 

[PATCH 15/16] mtd: mtdcore: fix initcall level

2015-08-26 Thread Alexander Holler
The mtd-core has to be initialized before other dependent mtd-drivers,
otherwise a crash might occur.

Currently mtd_init() is called in the initcall-level device, which is the
same level where most mtd-drivers will end up. By luck this seemed to have
been called most of the time before other mtd-drivers without having been
explicitly enforced. But if mtd_init() is not called before a dependent
driver, a null-pointer exception might occur (e.g. because the mtd device
class isn't registered).

To fix this, mtd-init() is moved to the initcall-level fs (right before
the standard initcall level device).

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 drivers/mtd/mtdcore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 875..fa8e6452 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -1303,7 +1303,7 @@ static void __exit cleanup_mtd(void)
bdi_destroy(mtd_bdi);
 }
 
-module_init(init_mtd);
+fs_initcall_sync(init_mtd);
 module_exit(cleanup_mtd);
 
 MODULE_LICENSE(GPL);
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH linux-next v5 3/5] mtd: spi-nor: allow to tune the number of dummy cycles

2015-08-26 Thread Cyrille Pitchen
The number of dummy cycles used during Fast Read commands can be reduced
to improve transfer performances. Each manufacturer has a dedicated set of
registers to provide the memory with the exact number of dummy cycles it
should expect. Both the memory and the (Q)SPI controller must agree on
this number of dummy cycles.

The number of dummy cycles can be found into the memory datasheet and
mostly depends on the SPI clock frequency, the Fast Read op code and the
Single/Dual Data Rate mode.

Probing JEDEC Serial Flash Discoverable Parameters (SFDP) tables would
only provide the driver with a high enough number of dummy cycles for each
Fast Read command to be used for all clock frequencies: this solution
would not be optimized.

Signed-off-by: Cyrille Pitchen cyrille.pitc...@atmel.com
---
 drivers/mtd/spi-nor/spi-nor.c | 102 ++
 include/linux/mtd/spi-nor.h   |   2 +
 2 files changed, 85 insertions(+), 19 deletions(-)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index c8810313a752..46d6e02f7560 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -121,24 +121,6 @@ static int read_cr(struct spi_nor *nor)
 }
 
 /*
- * Dummy Cycle calculation for different type of read.
- * It can be used to support more commands with
- * different dummy cycle requirements.
- */
-static inline int spi_nor_read_dummy_cycles(struct spi_nor *nor)
-{
-   switch (nor-flash_read) {
-   case SPI_NOR_FAST:
-   case SPI_NOR_DUAL:
-   case SPI_NOR_QUAD:
-   return 8;
-   case SPI_NOR_NORMAL:
-   return 0;
-   }
-   return 0;
-}
-
-/*
  * Write status register 1 byte
  * Returns negative if error occurred.
  */
@@ -1008,6 +990,86 @@ static int set_quad_mode(struct spi_nor *nor, const 
struct flash_info *info)
}
 }
 
+static int micron_set_dummy_cycles(struct spi_nor *nor)
+{
+   int ret;
+   u8 val, mask;
+
+   /* Read the Volatile Configuration Register (VCR). */
+   ret = nor-read_reg(nor, SPINOR_OP_RD_VCR, val, 1);
+   if (ret  0) {
+   dev_err(nor-dev, error %d reading VCR\n, ret);
+   return ret;
+   }
+
+   write_enable(nor);
+
+   /* Update the number of dummy into the VCR. */
+   mask = GENMASK(7, 4);
+   val = ~mask;
+   val |= (nor-read_dummy  4)  mask;
+   ret = nor-write_reg(nor, SPINOR_OP_WR_VCR, val, 1, 0);
+   if (ret  0) {
+   dev_err(nor-dev, error while writing VCR register\n);
+   return ret;
+   }
+
+   ret = spi_nor_wait_till_ready(nor);
+   if (ret)
+   return ret;
+
+   return 0;
+}
+
+/*
+ * Dummy Cycle calculation for different type of read.
+ * It can be used to support more commands with
+ * different dummy cycle requirements.
+ */
+static int spi_nor_read_dummy_cycles(struct spi_nor *nor,
+const struct flash_info *info)
+{
+   struct device_node *np = nor-dev-of_node;
+   struct device *dev = nor-dev;
+   u32 num_dummy_cycles;
+
+   if (np  !of_property_read_u32(np, m25p,num-dummy-cycles,
+   num_dummy_cycles)) {
+   nor-read_dummy = num_dummy_cycles;
+
+   /*
+* This switch block might be moved at the end of the function,
+* once nor-read_dummy has been set, but it was not tested with
+* all Micron memories.
+* Now the m25p,num-dummy-cycles property needs to be
+* explicitly set in the device tree so the switch statement is
+* executed. This should avoid unwanted side effects and keep
+* backward compatibility.
+*/
+   switch (JEDEC_MFR(info)) {
+   case CFI_MFR_ST:
+   return micron_set_dummy_cycles(nor);
+   default:
+   dev_warn(dev,
+Tuning of the number of dummy cycles is not 
implemented for spi-nor of this manufacturer,\n
+ignoring the DT property value and falling 
back to the framework default settings.\n);
+   break;
+   }
+   }
+
+   /* Fallback to legacy code. */
+   switch (nor-flash_read) {
+   case SPI_NOR_FAST:
+   case SPI_NOR_DUAL:
+   case SPI_NOR_QUAD:
+   nor-read_dummy = 8;
+   case SPI_NOR_NORMAL:
+   nor-read_dummy = 0;
+   }
+
+   return 0;
+}
+
 static int spi_nor_check(struct spi_nor *nor)
 {
if (!nor-dev || !nor-read || !nor-write ||
@@ -1208,7 +1270,9 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, 
enum read_mode mode)
nor-addr_width = 3;
}
 
-   nor-read_dummy = spi_nor_read_dummy_cycles(nor);
+   ret = spi_nor_read_dummy_cycles(nor, info);
+   if (ret)
+   return ret;
 

[PATCH 12/16] deps: WIP: imx: annotate some initcalls

2015-08-26 Thread Alexander Holler
WIP means Work In Progress.

Change some imx drivers to offer annotated initcalls.

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 arch/arm/mach-imx/gpc.c   | 2 +-
 arch/arm/mach-imx/mmdc.c  | 2 +-
 drivers/dma/mxs-dma.c | 2 +-
 drivers/gpio/gpio-mxc.c   | 2 +-
 drivers/i2c/busses/i2c-imx.c  | 2 +-
 drivers/pinctrl/freescale/pinctrl-imx6q.c | 2 +-
 drivers/power/reset/imx-snvs-poweroff.c   | 2 +-
 drivers/regulator/anatop-regulator.c  | 3 ++-
 drivers/tty/serial/imx.c  | 2 +-
 drivers/usb/phy/phy-mxs-usb.c | 2 +-
 sound/soc/fsl/imx-audmux.c| 2 +-
 11 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c
index 8c4467f..3802614 100644
--- a/arch/arm/mach-imx/gpc.c
+++ b/arch/arm/mach-imx/gpc.c
@@ -468,4 +468,4 @@ static int __init imx_pgc_init(void)
 {
return platform_driver_register(imx_gpc_driver);
 }
-subsys_initcall(imx_pgc_init);
+annotated_initcall(subsys, imx_pgc_init, imx_gpc_driver.driver);
diff --git a/arch/arm/mach-imx/mmdc.c b/arch/arm/mach-imx/mmdc.c
index db9621c..cf84c03 100644
--- a/arch/arm/mach-imx/mmdc.c
+++ b/arch/arm/mach-imx/mmdc.c
@@ -87,4 +87,4 @@ static int __init imx_mmdc_init(void)
 {
return platform_driver_register(imx_mmdc_driver);
 }
-postcore_initcall(imx_mmdc_init);
+annotated_initcall(postcore, imx_mmdc_init, imx_mmdc_driver.driver);
diff --git a/drivers/dma/mxs-dma.c b/drivers/dma/mxs-dma.c
index 60de352..5bfa232 100644
--- a/drivers/dma/mxs-dma.c
+++ b/drivers/dma/mxs-dma.c
@@ -884,4 +884,4 @@ static int __init mxs_dma_module_init(void)
 {
return platform_driver_probe(mxs_dma_driver, mxs_dma_probe);
 }
-subsys_initcall(mxs_dma_module_init);
+annotated_initcall(subsys, mxs_dma_module_init, mxs_dma_driver.driver);
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index ec1eb1b..0a22a62 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -506,7 +506,7 @@ static int __init gpio_mxc_init(void)
 {
return platform_driver_register(mxc_gpio_driver);
 }
-postcore_initcall(gpio_mxc_init);
+annotated_initcall(postcore, gpio_mxc_init, mxc_gpio_driver.driver);
 
 MODULE_AUTHOR(Freescale Semiconductor, 
  Daniel Mack danielncaiaq.de, 
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 785aa67..c20d03c 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1110,7 +1110,7 @@ static int __init i2c_adap_imx_init(void)
 {
return platform_driver_register(i2c_imx_driver);
 }
-subsys_initcall(i2c_adap_imx_init);
+annotated_initcall(subsys, i2c_adap_imx_init, i2c_imx_driver.driver);
 
 static void __exit i2c_adap_imx_exit(void)
 {
diff --git a/drivers/pinctrl/freescale/pinctrl-imx6q.c 
b/drivers/pinctrl/freescale/pinctrl-imx6q.c
index 4d1fcb8..77a1ffd 100644
--- a/drivers/pinctrl/freescale/pinctrl-imx6q.c
+++ b/drivers/pinctrl/freescale/pinctrl-imx6q.c
@@ -489,7 +489,7 @@ static int __init imx6q_pinctrl_init(void)
 {
return platform_driver_register(imx6q_pinctrl_driver);
 }
-arch_initcall(imx6q_pinctrl_init);
+annotated_initcall(arch, imx6q_pinctrl_init, imx6q_pinctrl_driver.driver);
 
 static void __exit imx6q_pinctrl_exit(void)
 {
diff --git a/drivers/power/reset/imx-snvs-poweroff.c 
b/drivers/power/reset/imx-snvs-poweroff.c
index ad6ce50..57a06dc 100644
--- a/drivers/power/reset/imx-snvs-poweroff.c
+++ b/drivers/power/reset/imx-snvs-poweroff.c
@@ -63,4 +63,4 @@ static int __init imx_poweroff_init(void)
 {
return platform_driver_register(imx_poweroff_driver);
 }
-device_initcall(imx_poweroff_init);
+annotated_initcall(device, imx_poweroff_init, imx_poweroff_driver.driver);
diff --git a/drivers/regulator/anatop-regulator.c 
b/drivers/regulator/anatop-regulator.c
index 738adfa..97808da 100644
--- a/drivers/regulator/anatop-regulator.c
+++ b/drivers/regulator/anatop-regulator.c
@@ -331,7 +331,8 @@ static int __init anatop_regulator_init(void)
 {
return platform_driver_register(anatop_regulator_driver);
 }
-postcore_initcall(anatop_regulator_init);
+annotated_initcall(postcore, anatop_regulator_init,
+   anatop_regulator_driver.driver);
 
 static void __exit anatop_regulator_exit(void)
 {
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
index 54fdc78..c79e19b 100644
--- a/drivers/tty/serial/imx.c
+++ b/drivers/tty/serial/imx.c
@@ -2024,7 +2024,7 @@ static void __exit imx_serial_exit(void)
uart_unregister_driver(imx_reg);
 }
 
-module_init(imx_serial_init);
+annotated_module_init(imx_serial_init, serial_imx_driver.driver);
 module_exit(imx_serial_exit);
 
 MODULE_AUTHOR(Sascha Hauer);
diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index 3fcc048..dd2768d 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -577,7 +577,7 @@ static int 

[PATCH 14/16] deps: WIP: kirkwood: annotate some initcalls

2015-08-26 Thread Alexander Holler
WIP means Work In Progress.

Change some kirkwood drivers to offer annotated initcalls.

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 drivers/dma/mv_xor.c   | 2 +-
 drivers/net/ethernet/marvell/mv643xx_eth.c | 3 ++-
 drivers/usb/host/ehci-orion.c  | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index f1325f6..e766ab2 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1295,7 +1295,7 @@ static int __init mv_xor_init(void)
 {
return platform_driver_register(mv_xor_driver);
 }
-module_init(mv_xor_init);
+annotated_module_init(mv_xor_init, mv_xor_driver.driver);
 
 /* it's currently unsafe to unload this module */
 #if 0
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c 
b/drivers/net/ethernet/marvell/mv643xx_eth.c
index d52639b..5eec4d8 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -3239,7 +3239,8 @@ static int __init mv643xx_eth_init_module(void)
 
return rc;
 }
-module_init(mv643xx_eth_init_module);
+annotated_module_init(mv643xx_eth_init_module,
+ mv643xx_eth_shared_driver.driver);
 
 static void __exit mv643xx_eth_cleanup_module(void)
 {
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index bfcbb9a..28f8793 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -333,7 +333,7 @@ static int __init ehci_orion_init(void)
ehci_init_driver(ehci_orion_hc_driver, orion_overrides);
return platform_driver_register(ehci_orion_driver);
 }
-module_init(ehci_orion_init);
+annotated_module_init(ehci_orion_init, ehci_orion_driver.driver);
 
 static void __exit ehci_orion_cleanup(void)
 {
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH linux-next v5 4/5] Documentation: atmel-quadspi: add binding file for Atmel QSPI driver

2015-08-26 Thread Cyrille Pitchen
This patch documents the DT bindings for the driver of the Atmel QSPI
controller embedded inside sama5d2x SoCs.

Signed-off-by: Cyrille Pitchen cyrille.pitc...@atmel.com
Acked-by: Nicolas Ferre nicolas.fe...@atmel.com
Acked-by: Marek Vasut ma...@denx.de
---
 .../devicetree/bindings/mtd/atmel-quadspi.txt  | 29 ++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mtd/atmel-quadspi.txt

diff --git a/Documentation/devicetree/bindings/mtd/atmel-quadspi.txt 
b/Documentation/devicetree/bindings/mtd/atmel-quadspi.txt
new file mode 100644
index ..0b8d545bb198
--- /dev/null
+++ b/Documentation/devicetree/bindings/mtd/atmel-quadspi.txt
@@ -0,0 +1,29 @@
+* Atmel Quad Serial Peripheral Interface (QSPI)
+
+Required properties:
+- compatible: should be atmel,sama5d2-qspi
+- reg:the first contains the register location and length,
+  the second contains the memory mapping address and length
+- interrupts: should contain the interrupt for the device
+- clocks: the phandle of the clock needed by the QSPI controller
+- #address-cells: should be 1
+- #size-cells:should be 0
+
+Example:
+
+spi@f002 {
+   compatible = atmel,sama5d2-qspi;
+   reg = 0xf002 0x100,
+ 0xd000 0x800;
+   interrupts = 52 IRQ_TYPE_LEVEL_HIGH 7;
+   clocks = spi0_clk;
+   #address-cells = 1;
+   #size-cells = 0;
+   pinctrl-names = default;
+   pinctrl-0 = pinctrl_spi0_default;
+   status = okay;
+
+   m25p80@0 {
+   ...
+   };
+};
-- 
1.8.2.2

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] ARM: uniphier: add outer cache support

2015-08-26 Thread Arnd Bergmann
On Wednesday 26 August 2015 10:38:59 Masahiro Yamada wrote:
 
 2015-08-25 4:59 GMT+09:00 Arnd Bergmann a...@arndb.de:
  On Monday 24 August 2015 11:18:10 Masahiro Yamada wrote:

 Nothing.
 
 This outer cache is not a variant of l2x0/pl310.
 It was designed only for our SoCs from scratch.

Ok, I see.

  Would it make sense to at least share the
  common entry point at l2x0_of_init() so you don't need to call it from
  the platform file?
 
 I do not think so.
 
 
 l2x0_of_init() checks L2X0_AUX_CTRL register,
 but the cache-uniphier does not have such register,
 so the boot code crashes.
 
 
 
 BTW, what makes l2x0_of_init() so special?
 
 Only L2x0/L310 and variants can be initialized
 directly from init_IRQ().

The only thing that is special about it is that almost everyone
uses it because it is often licensed together with the Cortex-A
cores from ARM. There are a few variants that are closely related
(tauros3 and aurora, both from Marvell. All other outer_cache
implementations (feroceon, xscale, tauros2) are for older
Marvell (or Intel) cores that have since been replaced with
Cortex-A cores in newer products.

 Moreover, outer-cache init seems to be unrelated to
 IRQ init.

Agreed, this is also just a historic artifact, as we don't really
have a place to put cache controller initialization, and the
irq init callback was already there at the time when people
added code to init their outer caches. It often does not matter
much where you call it, but doing it early speeds up the boot
time.

It would be nice to unify the cache initialization a bit further,
apparently only a few older platforms still call the l2x0 init
manually and we can probably all convert them to the implicit
configuration in one way or another.

As we now have three kinds of cache controllers (l2x0, tauros2
and uniphier) that we need to support using DT, it would be nice
for generalize that init sequence a bit more.

A first step would be to add the tauros2 and uniphier outer cache
init to the init_IRQ() function, and then have another patch
that moves all the outercache initialization into a new place
like arch/arm/mm/outercache.c so we don't clutter up irq.c
with unrelated stuff.

Russell probably also has some ideas on this topic, in doubt
just do what he suggests.

Arnd
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/16] deps: dts: imx6q: make some remote-endpoints non-dependencies

2015-08-26 Thread Alexander Holler
This is necessary to remove dependency cycles introduced by
'remote-endpoints'.

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 arch/arm/boot/dts/imx6q.dtsi   | 2 ++
 arch/arm/boot/dts/imx6qdl.dtsi | 4 
 2 files changed, 6 insertions(+)

diff --git a/arch/arm/boot/dts/imx6q.dtsi b/arch/arm/boot/dts/imx6q.dtsi
index 399103b..8db7f25 100644
--- a/arch/arm/boot/dts/imx6q.dtsi
+++ b/arch/arm/boot/dts/imx6q.dtsi
@@ -184,6 +184,7 @@
 
ipu2_di0_hdmi: endpoint@1 {
remote-endpoint = hdmi_mux_2;
+   no-dependencies = hdmi_mux_2;
};
 
ipu2_di0_mipi: endpoint@2 {
@@ -205,6 +206,7 @@
 
ipu2_di1_hdmi: endpoint@1 {
remote-endpoint = hdmi_mux_3;
+   no-dependencies = hdmi_mux_3;
};
 
ipu2_di1_mipi: endpoint@2 {
diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi
index b57033e..db3d0d0 100644
--- a/arch/arm/boot/dts/imx6qdl.dtsi
+++ b/arch/arm/boot/dts/imx6qdl.dtsi
@@ -1150,10 +1150,12 @@
 
ipu1_di0_hdmi: endpoint@1 {
remote-endpoint = hdmi_mux_0;
+   no-dependencies = hdmi_mux_0;
};
 
ipu1_di0_mipi: endpoint@2 {
remote-endpoint = mipi_mux_0;
+   no-dependencies = mipi_mux_0;
};
 
ipu1_di0_lvds0: endpoint@3 {
@@ -1175,10 +1177,12 @@
 
ipu1_di1_hdmi: endpoint@1 {
remote-endpoint = hdmi_mux_1;
+   no-dependencies = hdmi_mux_1;
};
 
ipu1_di1_mipi: endpoint@2 {
remote-endpoint = mipi_mux_1;
+   no-dependencies = mipi_mux_1;
};
 
ipu1_di1_lvds0: endpoint@3 {
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/16] deps: deterministic driver initialization sequence based on dependencies from the DT

2015-08-26 Thread Alexander Holler
Use annotated initcalls along with dependencies found in the DT to sort
the initialization of drivers.

This makes stuff like in-driver hacks (e.g. omap), bruteforce
trial-and-error (deferred probe calls which are killing error messages)
and similar workarounds to circumvent the limited level based
driver initialization sequence unnecessary.

If enabled, this changes the driver initialization sequence as
described in the following table.

old (level based)   new (ordered, in parts)
-
early   early
pure (0)pure (0)
core (1, 1s)core (1, 1s)
postcore (2, 2s)postcore (2, 2s)
arch (3, 3s)arch (3, 3s)
subsys (4. 4s)  subsys (4, 4s)
fs (5, 5s)  fs (5, 5s)
rootfs  rootfs
device (6. 6s)  annotated initcalls (ordered by DT)
annotated initcalls (not found in DT)
device (6. 6s)
late (7, 7s)late (7, 7s)

To use this feature new binary DT blobs which are including dependencies
(type information for phandles) have to be used and most drivers found
in the DT should have been annotated.

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 drivers/of/Kconfig  |  12 ++
 drivers/of/Makefile |   1 +
 drivers/of/of_dependencies.c| 410 
 include/linux/of_dependencies.h |  20 ++
 init/main.c |  11 +-
 5 files changed, 453 insertions(+), 1 deletion(-)
 create mode 100644 drivers/of/of_dependencies.c
 create mode 100644 include/linux/of_dependencies.h

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 59bb855..9bf6c73 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -102,4 +102,16 @@ config OF_OVERLAY
  While this option is selected automatically when needed, you can
  enable it manually to improve device tree unit test coverage.
 
+config OF_DEPENDENCIES
+   bool Device Tree dependency based initialization order (EXPERIMENTAL)
+   select ANNOTATED_INITCALLS
+   help
+ Enables dependency based initialization order of drivers.
+
+ For correct operation the binary DT blob should have been
+ populated with properties of type dependencies and the
+ drivers referenced in the DT should have been annotated.
+
+ If unsure, say N here.
+
 endif # OF
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index 156c072..05ced0d 100644
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -14,5 +14,6 @@ obj-$(CONFIG_OF_MTD)  += of_mtd.o
 obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o
 obj-$(CONFIG_OF_RESOLVE)  += resolver.o
 obj-$(CONFIG_OF_OVERLAY) += overlay.o
+obj-$(CONFIG_OF_DEPENDENCIES)  += of_dependencies.o
 
 obj-$(CONFIG_OF_UNITTEST) += unittest-data/
diff --git a/drivers/of/of_dependencies.c b/drivers/of/of_dependencies.c
new file mode 100644
index 000..64ed049
--- /dev/null
+++ b/drivers/of/of_dependencies.c
@@ -0,0 +1,410 @@
+/*
+ * Code for building a deterministic initialization order based on dependencies
+ * defined in the device tree.
+ *
+ * Copyright (C) 2014 Alexander Holler hol...@ahsoftware.de
+ *
+ * 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 option) any later version.
+ */
+
+#include linux/of_dependencies.h
+
+#define MAX_DT_NODES 1000 /* maximum number of vertices */
+#define MAX_EDGES (MAX_DT_NODES*2) /* maximum number of edges (dependencies) */
+
+struct edgenode {
+   uint32_t y; /* phandle */
+   struct edgenode *next; /* next edge in list */
+};
+
+/*
+ * Vertex numbers do correspond to phandle numbers. That means the graph
+ * does contain as much vertices as the maximum of all phandles.
+ * Or in other words, we assume that for all phandles in the device tree
+ * 0  phandle  MAX_DT_NODES+1 is true.
+ */
+struct dep_graph {
+   struct edgenode edge_slots[MAX_EDGES]; /* used to avoid kmalloc */
+   struct edgenode *edges[MAX_DT_NODES+1]; /* adjacency info */
+   unsigned nvertices; /* number of vertices in graph */
+   unsigned nedges; /* number of edges in graph */
+   bool processed[MAX_DT_NODES+1]; /* which vertices have been processed */
+   bool include_node[MAX_DT_NODES+1]; /* which nodes to consider */
+   bool discovered[MAX_DT_NODES+1]; /* which vertices have been found */
+   bool finished; /* if true, cut off search immediately */
+};
+static struct dep_graph graph __initdata;
+
+struct init_order {
+   uint32_t max_phandle; /* the max used phandle */
+   uint32_t old_max_phandle; /* used to keep track of added phandles */
+   struct device_node *order[MAX_DT_NODES+1];
+   unsigned count;
+   uint32_t ph_root; /* the phandle of the root */
+};

[PATCH 04/16] deps: dtc: introduce new (virtual) property no-dependencies

2015-08-26 Thread Alexander Holler
In some cases it makes sense to handle some phandles not as dependencies.

This is escpecially true for 'remote-endpoint' properties, because these
otherwise introducing dependency cycles into the graph. To avoid these,
one end of each remote-endpoint pairs has not to be handled as a
dependency.

The syntax is like

foo {
remote-endpoint = bar;
};
bar {
remote-endpoint = foo;
no-dependencies = foo;
};

Without that 'no-dependencies' property dtc would automatically add a
dependency to foo to the property 'dependencies' of the node bar.
But with that 'no-dependencies' it will not automatically add the
listed dependencies.

The property 'no-dependencies' is virtual property and will not be added
to any output file.

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 scripts/dtc/dependencies.c | 33 +
 1 file changed, 33 insertions(+)

diff --git a/scripts/dtc/dependencies.c b/scripts/dtc/dependencies.c
index 2c1e0d4..76e4d91 100644
--- a/scripts/dtc/dependencies.c
+++ b/scripts/dtc/dependencies.c
@@ -44,6 +44,23 @@ static bool is_parent_of(struct node *node1, struct node 
*node2)
 
 }
 
+static bool is_no_dependency(struct node *dt, struct property *prop, cell_t ph)
+{
+   struct node *node;
+   unsigned i;
+   cell_t *cell = (cell_t *)(prop-val.val);
+
+   for (i = 0; i  prop-val.len/4; ++i) {
+   node = get_node_by_phandle(dt, cpu_to_fdt32(*cell++));
+   if (node) {
+   node = find_compatible_not_disabled(node);
+   if (node  get_node_phandle(dt, node) == ph)
+   return true;
+   }
+   }
+   return false;
+}
+
 static void add_deps(struct node *dt, struct node *node, struct property *prop)
 {
struct marker *m = prop-val.markers;
@@ -73,6 +90,10 @@ static void add_deps(struct node *dt, struct node *node, 
struct property *prop)
is_parent_of(target, source))
continue;
phandle = get_node_phandle(dt, target);
+   prop_deps = get_property(node, no-dependencies);
+   if (prop_deps  is_no_dependency(dt, prop_deps, phandle))
+   /* avoid adding non-dependencies */
+   continue;
prop_deps = get_property(source, dependencies);
if (!prop_deps) {
add_property(source,
@@ -102,9 +123,21 @@ static void process_nodes_props(struct node *dt, struct 
node *node)
process_nodes_props(dt, child);
 }
 
+static void del_prop_no_dependencies(struct node *node)
+{
+   struct node *child;
+
+   if (!node)
+   return;
+   delete_property_by_name(node, no-dependencies);
+   for_each_child(node, child)
+   del_prop_no_dependencies(child);
+}
+
 void add_dependencies(struct boot_info *bi)
 {
process_nodes_props(bi-dt, bi-dt);
+   del_prop_no_dependencies(bi-dt);
 }
 
 /*
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/16] deps: introduce initcalls annotated with a struct device_driver

2015-08-26 Thread Alexander Holler
Make it possible to identify initcalls before calling them by adding
a pointer to a struct device_driver to the stored pointer to an initcall.

This is e.g. necessary in order to sort initcalls by whatever means
before calling them.

To annotate an initcall, the following changes are necessary on
drivers which want to offer that feature:

now annotated
--
pure_initcall(fn)   annotated_initcall(pure, fn, dev_drv)
core_initcall(fn)   annotated_initcall(core, fn, dev_drv)
core_initcall_sync(fn)  annotated_initcall_sync(core, fn, dev_drv)
...
late_initcall(fn)   annotated_initcall(late, fn, dev_drv)
module_init(fn) annotated_module_init(fn, dev_drv)

module_platform_driver(drv) no changes necessary, done automatically
module_platform_driver_probe(drv, probe)no changes necessary
module_i2c_driver(i2c_drv)  no changes necessary, done automatically

E.g. to make the driver sram offering an annotated initcall the
following patch is necessary:


-postcore_initcall(sram_init);
+annotated_initcall(postcore, sram_init, sram_driver.driver);


These changes can be done without any fear. If the feature is disabled,
which is the default, the new macros will just map to the old ones and
nothing is changed at all.

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 arch/arm/kernel/vmlinux.lds.S |  1 +
 include/asm-generic/vmlinux.lds.h |  6 ++
 include/linux/device.h| 12 
 include/linux/i2c.h   |  2 +-
 include/linux/init.h  | 33 +
 include/linux/module.h|  2 ++
 include/linux/platform_device.h   | 16 
 init/Kconfig  |  3 +++
 8 files changed, 70 insertions(+), 5 deletions(-)

diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 8b60fde..10a328f 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -213,6 +213,7 @@ SECTIONS
 #endif
INIT_SETUP(16)
INIT_CALLS
+   ANNOTATED_INITCALL
CON_INITCALL
SECURITY_INITCALL
INIT_RAM_FS
diff --git a/include/asm-generic/vmlinux.lds.h 
b/include/asm-generic/vmlinux.lds.h
index 8bd374d..7318ba7 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -660,6 +660,11 @@
INIT_CALLS_LEVEL(7) \
VMLINUX_SYMBOL(__initcall_end) = .;
 
+#define ANNOTATED_INITCALL \
+   VMLINUX_SYMBOL(__annotated_initcall_start) = .; \
+   *(.annotated_initcall.init) \
+   VMLINUX_SYMBOL(__annotated_initcall_end) = .;
+
 #define CON_INITCALL   \
VMLINUX_SYMBOL(__con_initcall_start) = .;   \
*(.con_initcall.init)   \
@@ -816,6 +821,7 @@
INIT_DATA   \
INIT_SETUP(initsetup_align) \
INIT_CALLS  \
+   ANNOTATED_INITCALL  \
CON_INITCALL\
SECURITY_INITCALL   \
INIT_RAM_FS \
diff --git a/include/linux/device.h b/include/linux/device.h
index a2b4ea7..128fddd 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1321,4 +1321,16 @@ static int __init __driver##_init(void) \
 } \
 device_initcall(__driver##_init);
 
+#define annotated_module_driver(__driver, __register, __unregister, ...) \
+static int __init __driver##_init(void) \
+{ \
+   return __register((__driver), ##__VA_ARGS__); \
+} \
+annotated_module_init(__driver##_init, __driver.driver); \
+static void __exit __driver##_exit(void) \
+{ \
+   __unregister((__driver), ##__VA_ARGS__); \
+} \
+module_exit(__driver##_exit)
+
 #endif /* _DEVICE_H_ */
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index e83a738..fa63ec1 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -626,7 +626,7 @@ static inline int i2c_adapter_id(struct i2c_adapter *adap)
  * use this macro once, and calling it replaces module_init() and module_exit()
  */
 #define module_i2c_driver(__i2c_driver) \
-   module_driver(__i2c_driver, i2c_add_driver, \
+   annotated_module_driver(__i2c_driver, i2c_add_driver, \
i2c_del_driver)
 
 #endif /* I2C */
diff --git a/include/linux/init.h b/include/linux/init.h
index b449f37..52ea986 100644
--- 

[PATCH 10/16] deps: dts: omap: beagle: make some remote-endpoints non-dependencies

2015-08-26 Thread Alexander Holler
This is necessary to remove dependency cycles introduced by
'remote-endpoints'.

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 arch/arm/boot/dts/omap3-beagle.dts | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/omap3-beagle.dts 
b/arch/arm/boot/dts/omap3-beagle.dts
index a547411..78ba39e 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -101,6 +101,7 @@
 
tfp410_in: endpoint@0 {
remote-endpoint = dpi_out;
+   no-dependencies = dpi_out;
};
};
 
@@ -109,6 +110,7 @@
 
tfp410_out: endpoint@0 {
remote-endpoint = dvi_connector_in;
+   no-dependencies = dvi_connector_in;
};
};
};
@@ -150,6 +152,7 @@
etb_in: endpoint {
slave-mode;
remote-endpoint = etm_out;
+   no-dependencies = etm_out;
};
};
};
@@ -373,6 +376,7 @@
port {
venc_out: endpoint {
remote-endpoint = tv_connector_in;
+   no-dependencies = tv_connector_in;
ti,channels = 2;
};
};
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH linux-next v5 0/5] add driver for Atmel QSPI controller

2015-08-26 Thread Cyrille Pitchen
ChangeLog

v5:
- remove unused inline functions qspi_read[bw]() and qspi_write[bw](),
  keep only qspi_readl() and qspi_writel().
- use reinit_completion() instead of init_completion() during run time,
  call init_completion() once for all in the probe().
- add a dev_warn() when trying to tune the number of dummy cycles for
  spi-nor of a not supported manufacturer then fall back to the default
  framework value.
- reword some comments.
- add Acked-by: Marek Vasut ma...@denx.de for patches 1 and 4.
- add Acked-by: Bean Huo bean...@micron.com for patch 1.

v4:
- add OF  HAS_DMA dependency in Kconfig for Atmel Quad SPI driver.
- return -ENOMEM instead of the return code of dma_mapping_error() as this
  function returns a boolean on ARM achitecture.
- add Acked-by: Nicolas Ferre nicolas.fe...@atmel.com for Atmel Quad
  SPI driver and its DT binding documentation.

v3:
- reword the comment which explains that spi_nor_set_protocol() is used by
  the spi-nor framework to notify lower layers, especially the (Q)SPI
  controller about a protocol change.
- change the definitions of register/bitfield macros in the Atmel QSPI
  controller driver: get rid of concatenation operator and use BIT and
  GENMASK macros when possible.
- use #define[SPACE] instead of #define[TAB]

v2:
- remove the patches to set the latency code of Spansion QSPI memories
  (support of Spansion memories may be submitted in later series).
- rename qspi node into spi in the DT example to fit ePAPR standard.
- remove the useless qspi0 label from the DT node example.
- remove the leading 0 from the size of the second memory region to make
  it consistent with the size of the first memory region.
- indent the DT bindings documentation to make it more readable.
- remove the useless .bus  = platform_bus_type, line from the
  platform driver definition.

v1:

This series of patches add support for the new Atmel QSPI controller
embedded inside sama5d2x SoCs.

These patches were first developped for linux-3.18-at91 and tested on a
sama5d27 Xplained ultra board, which embeds a Micron n25q128a13 QSPI NOR
flash memory. Then the series was adapted for mainline.

Cyrille Pitchen (5):
  mtd: spi-nor: notify (Q)SPI controller about protocol change
  Documentation: mtd: add a DT property to set the number of dummy
cycles
  mtd: spi-nor: allow to tune the number of dummy cycles
  Documentation: atmel-quadspi: add binding file for Atmel QSPI driver
  mtd: atmel-quadspi: add driver for Atmel QSPI controller

 .../devicetree/bindings/mtd/atmel-quadspi.txt  |  29 +
 .../devicetree/bindings/mtd/jedec,spi-nor.txt  |   6 +
 drivers/mtd/spi-nor/Kconfig|   7 +
 drivers/mtd/spi-nor/Makefile   |   1 +
 drivers/mtd/spi-nor/atmel-quadspi.c| 859 +
 drivers/mtd/spi-nor/spi-nor.c  | 123 ++-
 include/linux/mtd/spi-nor.h|  15 +
 7 files changed, 1021 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mtd/atmel-quadspi.txt
 create mode 100644 drivers/mtd/spi-nor/atmel-quadspi.c

-- 
1.8.2.2

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH linux-next v5 1/5] mtd: spi-nor: notify (Q)SPI controller about protocol change

2015-08-26 Thread Cyrille Pitchen
Once the Quad SPI mode has been enabled on a Micron flash memory, this
device expects ALL the following commands to use the SPI 4-4-4 protocol.
The (Q)SPI controller needs to be notified about the protocol change so it
can adapt and keep on dialoging with the Micron memory.

Signed-off-by: Cyrille Pitchen cyrille.pitc...@atmel.com
Acked-by: Marek Vasut ma...@denx.de
Acked-by: Bean Huo bean...@micron.com
---
 drivers/mtd/spi-nor/spi-nor.c | 21 +
 include/linux/mtd/spi-nor.h   | 13 +
 2 files changed, 34 insertions(+)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index c27d427fead4..c8810313a752 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -165,6 +165,22 @@ static inline int write_disable(struct spi_nor *nor)
return nor-write_reg(nor, SPINOR_OP_WRDI, NULL, 0, 0);
 }
 
+/*
+ * Let the spi-nor framework notify lower layers, especially the driver of the
+ * (Q)SPI controller, about the new protocol to be used. Indeed, once the
+ * spi-nor framework has sent manufacturer specific commands to a memory to
+ * enable its Quad SPI mode, it should immediately after tell the QSPI
+ * controller to use the very same Quad SPI protocol as expected by the memory.
+ */
+static inline int spi_nor_set_protocol(struct spi_nor *nor,
+  enum spi_protocol proto)
+{
+   if (nor-set_protocol)
+   return nor-set_protocol(nor, proto);
+
+   return 0;
+}
+
 static inline struct spi_nor *mtd_to_spi_nor(struct mtd_info *mtd)
 {
return mtd-priv;
@@ -940,6 +956,11 @@ static int micron_quad_enable(struct spi_nor *nor)
return ret;
}
 
+   /* switch protocol to Quad CMD 4-4-4 */
+   ret = spi_nor_set_protocol(nor, SPI_PROTO_4_4_4);
+   if (ret)
+   return ret;
+
ret = spi_nor_wait_till_ready(nor);
if (ret)
return ret;
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index e5409524bb0a..1bf6f11310ef 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -87,6 +87,16 @@ enum read_mode {
SPI_NOR_QUAD,
 };
 
+enum spi_protocol {
+   SPI_PROTO_1_1_1,/* SPI */
+   SPI_PROTO_1_1_2,/* Dual Output */
+   SPI_PROTO_1_1_4,/* Quad Output */
+   SPI_PROTO_1_2_2,/* Dual IO */
+   SPI_PROTO_1_4_4,/* Quad IO */
+   SPI_PROTO_2_2_2,/* Dual Command */
+   SPI_PROTO_4_4_4,/* Quad Command */
+};
+
 /**
  * struct spi_nor_xfer_cfg - Structure for defining a Serial Flash transfer
  * @wren:  command for Write Enable, or 0x00 for not required
@@ -149,6 +159,7 @@ enum spi_nor_option_flags {
  * read/write/erase/lock/unlock operations
  * @read_xfer: [OPTIONAL] the read fundamental primitive
  * @write_xfer:[OPTIONAL] the writefundamental primitive
+ * @set_protocol:  [OPTIONAL] notify about protocol change
  * @read_reg:  [DRIVER-SPECIFIC] read out the register
  * @write_reg: [DRIVER-SPECIFIC] write data to the register
  * @read:  [DRIVER-SPECIFIC] read data from the SPI NOR
@@ -185,6 +196,8 @@ struct spi_nor {
int (*write_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, int len,
int write_enable);
 
+   int (*set_protocol)(struct spi_nor *nor, enum spi_protocol proto);
+
int (*read)(struct spi_nor *nor, loff_t from,
size_t len, size_t *retlen, u_char *read_buf);
void (*write)(struct spi_nor *nor, loff_t to,
-- 
1.8.2.2

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/16] deps: dts: kirkwood: dockstar: add dependency ehci - usb power regulator

2015-08-26 Thread Alexander Holler
This serves as an example how easy it is to fix an initialization order
if the order depends on the DT. No source code changes will be necessary.

If you look at the dependency graph for the dockstar, you will see that
there is no dependency between ehci and the usb power regulator. This
ends up with the fact that the regulator will be initialized after ehci.

Fix this by adding one dependency to the .dts.

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 arch/arm/boot/dts/kirkwood-dockstar.dts | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/kirkwood-dockstar.dts 
b/arch/arm/boot/dts/kirkwood-dockstar.dts
index 8497363..426d8840 100644
--- a/arch/arm/boot/dts/kirkwood-dockstar.dts
+++ b/arch/arm/boot/dts/kirkwood-dockstar.dts
@@ -107,3 +107,7 @@
phy-handle = ethphy0;
};
 };
+
+usb0 {
+   dependencies = usb_power;
+};
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/16] deps: add debug configuration options

2015-08-26 Thread Alexander Holler
Add some debug options to print annotated initcalls, the ordered list of
annotated initcalls and to print a message right before an annotated
initcall is called.

Signed-off-by: Alexander Holler hol...@ahsoftware.de
---
 drivers/of/Kconfig   | 18 ++
 drivers/of/of_dependencies.c | 57 ++--
 2 files changed, 73 insertions(+), 2 deletions(-)

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 9bf6c73..26c4b1a 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -114,4 +114,22 @@ config OF_DEPENDENCIES
 
  If unsure, say N here.
 
+config OF_DEPENDENCIES_PRINT_INIT_ORDER
+   bool Print dependency based initialization order
+   depends on OF_DEPENDENCIES
+   help
+ Used for debugging purposes.
+
+config OF_DEPENDENCIES_PRINT_ANNOTATED_INITCALLS
+   bool Print names of annotated drivers
+   depends on OF_DEPENDENCIES
+   help
+ Used for debugging purposes.
+
+config OF_DEPENDENCIES_DEBUG_CALLS_OF_ANNOTATED_INITCALLS
+   bool Show when annotated initcalls are actually called
+   depends on OF_DEPENDENCIES
+   help
+ Used for debugging purposes.
+
 endif # OF
diff --git a/drivers/of/of_dependencies.c b/drivers/of/of_dependencies.c
index 64ed049..06435d5 100644
--- a/drivers/of/of_dependencies.c
+++ b/drivers/of/of_dependencies.c
@@ -336,6 +336,41 @@ static void __init of_init_remove_duplicates(void)
}
 }
 
+#ifdef CONFIG_OF_DEPENDENCIES_PRINT_INIT_ORDER
+static void __init of_init_print_order(void)
+{
+   unsigned i;
+   struct property *prop;
+   const char *cp;
+
+   pr_info(Initialization order:\n);
+   for (i = 0; i  order.count; ++i) {
+   pr_info(init %u 0x%x, i, order.order[i]-phandle);
+   if (order.order[i]-name)
+   pr_cont( %s, order.order[i]-name);
+   if (order.order[i]-full_name)
+   pr_cont( (%s), order.order[i]-full_name);
+   prop = __of_find_property(order.order[i], compatible, NULL);
+   for (cp = of_prop_next_string(prop, NULL); cp;
+cp = of_prop_next_string(prop, cp))
+   pr_cont( %s, cp);
+   }
+}
+#endif
+
+#ifdef CONFIG_OF_DEPENDENCIES_PRINT_ANNOTATED_INITCALLS
+static void __init of_init_print_annotated(void)
+{
+   struct _annotated_initcall *ac;
+
+   pr_info(Annotated drivers:\n);
+   ac = __annotated_initcall_start;
+   for (; ac  __annotated_initcall_end; ++ac)
+   pr_info(Driver '%s' (%s)\n, ac-driver-name,
+   ac-driver-of_match_table-compatible);
+}
+#endif
+
 static int __init of_init_build_order(void)
 {
int rc = 0;
@@ -363,7 +398,12 @@ static int __init of_init_build_order(void)
return -EINVAL; /* cycle found */
 
of_init_remove_duplicates();
-
+#ifdef CONFIG_OF_DEPENDENCIES_PRINT_INIT_ORDER
+   of_init_print_order();
+#endif
+#ifdef CONFIG_OF_DEPENDENCIES_PRINT_ANNOTATED_INITCALLS
+   of_init_print_annotated();
+#endif
return rc;
 }
 
@@ -386,6 +426,12 @@ static void __init init_if_matched(struct device_node 
*node)
if (ac-initcall  ac-driver-of_match_table)
if (of_match_node(ac-driver-of_match_table,
 node)) {
+#ifdef CONFIG_OF_DEPENDENCIES_DEBUG_CALLS_OF_ANNOTATED_INITCALLS
+   pr_info(Calling (ordered) initcall for driver 
%s (%s)\n,
+   ac-driver-name,
+   ac-driver-of_match_table ?
+   
ac-driver-of_match_table-compatible : );
+#endif
do_one_initcall(*ac-initcall);
ac-initcall = 0;
}
@@ -404,7 +450,14 @@ void __init of_init_drivers(void)
}
ac = __annotated_initcall_start;
for (; ac  __annotated_initcall_end; ++ac) {
-   if (ac-initcall)
+   if (ac-initcall) {
+#ifdef CONFIG_OF_DEPENDENCIES_DEBUG_CALLS_OF_ANNOTATED_INITCALLS
+   pr_info(Calling (unordered) initcall for driver %s 
(%s)\n,
+   ac-driver-name,
+   ac-driver-of_match_table ?
+   ac-driver-of_match_table-compatible 
: );
+#endif
do_one_initcall(*ac-initcall);
+   }
}
 }
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/7] drm/vc4: Add devicetree bindings for VC4.

2015-08-26 Thread Rob Herring
On Wed, Aug 26, 2015 at 7:09 AM, Thierry Reding
thierry.red...@gmail.com wrote:
 On Wed, Aug 26, 2015 at 01:52:29PM +0200, Daniel Vetter wrote:
 On Tue, Aug 25, 2015 at 04:42:18PM -0400, Rob Clark wrote:
  On Mon, Aug 24, 2015 at 9:47 AM, Rob Herring robherri...@gmail.com wrote:
   On Mon, Aug 17, 2015 at 1:30 PM, Eric Anholt e...@anholt.net wrote:
   Stephen Warren swar...@wwwdotorg.org writes:
  
   On 08/12/2015 06:56 PM, Eric Anholt wrote:
   Signed-off-by: Eric Anholt e...@anholt.net
  
   This one definitely needs a patch description, since someone might not
   know what a VC4 is, and git log won't show the text from the binding
   doc itself. I'd suggest adding the initial paragraph of the binding doc
   as the patch description, or more.
  
   diff --git a/Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt 
   b/Documentation/devicetree/bindings/gpu/brcm,bcm-vc4.txt
  
   +- hvss: List of references to HVS video scalers
   +- encoders: List of references to output encoders (HDMI, SDTV)
  
   Would it make sense to make all those nodes child node of the vc4
   object. That way, there's no need to have these lists of objects; they
   can be automatically built up as the DT is enumerated. I know that e.g.
   the NVIDIA Tegra host1x binding works this way, and I think it may have
   been inspired by other similar cases.
  
   I've looked at tegra, and the component system used by msm appears to be
   nicer than it.  To follow tegra's model, it looks like I need to build
   this extra bus thing corresponding to host1x that is effectively the
   drivers/base/component.c code, so that I can get at vc4's structure from
   the component drivers.
  
   Of course, this is only appropriate if the HW modules really are
   logically children of the VC4 HW module. Perhaps they aren't. If they
   aren't though, I wonder what this vc4 module actually represents in 
   HW?
  
   It's the subsystem, same as we use a subsystem node for msm, sti,
   rockchip, imx, and exynos.  This appears to be the common model of how
   the collection of graphics-related components is represented in the DT.
  
   I think most of these bindings are wrong. They are grouped together
   because that is what DRM wants not because that reflects the h/w. So
   convince me this is one block, not that it is what other people do.
 
  I think, when it comes to more complex driver subsystems (like drm in
  particular) we have a bit of mismatch between how things look from the
  pure hw ignoring sw perspective, and the how sw and in particular
  userspace expects things perspective.  Maybe it is less a problem in
  other subsystems, where bindings map to things that are only visible
  in the kernel, or well defined devices like uart or sata controller.
  But when given the choice, I'm going to err on the side of not
  confusing userspace and the large software stack that sits above
  drm/kms, over dt purity.
 
  Maybe it would be nice to have a sort of dt overlay that adds the bits
  needed to tie together hw blocks that should be assembled into a
  single logical device for linux and userspace (but maybe not some
  other hypothetical operating system).  But so far that doesn't exist.
  All we have is a hammer (devicetree), everything looks like a nail.
  End result is we end up adding some things in the bindings which
  aren't purely about the hw.  Until someone invents a screwdriver, I'm
  not sure what else to do.  In the end, other hypothetical OS is free
  to ignore those extra fields in the bindings if it doesn't need them.
  So meh?

 I thought we agreed a while back that these kind of pull everything for
 the logical device together dt nodes which just have piles of phandles
 are totally accepted? At least that's the point behind the component
 helpers, and Eric even suggested to create dt-specific component helpers
 to cut down a bit on the usual boilerplate. dt maintainers are also fine
 with this approach afaik. From my understanding tegra with the host1x bus
 really is the odd one out and not the norm.

 I agree that in many aspects Tegra is somewhat special. But the same
 principles that the host1x infrastructure uses could be implemented in a
 similar way for other DRM drivers. You can easily collect information
 about subdevices by walking the device tree and matching on known
 compatible strings. And you can also instantiate the top-level device
 from driver code rather than have it in DT. It should still be possible
 to make this work without an artificial device node in DT. The component
 and master infrastructure is largely orthogonal to that, and as far as I
 remember the only blocker is the need for a top-level device. I wonder
 if perhaps this could be made to work by binding the master to the top-
 level SoC device.

 Obviously adding the node in DT is easier, but to my knowledge easy has
 never been a good excuse for mangling DT. Perhaps that's different these
 days...

I agree we should avoid the virtual 

Re: [PATCH linux-next v5 3/5] mtd: spi-nor: allow to tune the number of dummy cycles

2015-08-26 Thread Marek Vasut
On Wednesday, August 26, 2015 at 02:30:25 PM, Cyrille Pitchen wrote:
 The number of dummy cycles used during Fast Read commands can be reduced
 to improve transfer performances. Each manufacturer has a dedicated set of
 registers to provide the memory with the exact number of dummy cycles it
 should expect. Both the memory and the (Q)SPI controller must agree on
 this number of dummy cycles.
 
 The number of dummy cycles can be found into the memory datasheet and
 mostly depends on the SPI clock frequency, the Fast Read op code and the
 Single/Dual Data Rate mode.
 
 Probing JEDEC Serial Flash Discoverable Parameters (SFDP) tables would
 only provide the driver with a high enough number of dummy cycles for each
 Fast Read command to be used for all clock frequencies: this solution
 would not be optimized.
 
 Signed-off-by: Cyrille Pitchen cyrille.pitc...@atmel.com

Acked-by: Marek Vasut ma...@denx.de

Best regards,
Marek Vasut
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] remoteproc: debugfs: Add ability to boot remote processor using debugfs

2015-08-26 Thread Lee Jones
Signed-off-by: Lee Jones lee.jo...@linaro.org
---
 drivers/remoteproc/remoteproc_debugfs.c | 25 +
 1 file changed, 25 insertions(+)

diff --git a/drivers/remoteproc/remoteproc_debugfs.c 
b/drivers/remoteproc/remoteproc_debugfs.c
index 9d30809..9620962 100644
--- a/drivers/remoteproc/remoteproc_debugfs.c
+++ b/drivers/remoteproc/remoteproc_debugfs.c
@@ -88,8 +88,33 @@ static ssize_t rproc_state_read(struct file *filp, char 
__user *userbuf,
return simple_read_from_buffer(userbuf, count, ppos, buf, i);
 }
 
+static ssize_t rproc_state_write(struct file *filp, const char __user *userbuf,
+size_t count, loff_t *ppos)
+{
+   struct rproc *rproc = filp-private_data;
+   char buf[2];
+   int ret;
+
+   ret = copy_from_user(buf, userbuf, 1);
+   if (ret)
+   return -EFAULT;
+
+   switch (buf[0]) {
+   case '1':
+   ret = rproc_boot(rproc);
+   if (ret)
+   dev_warn(rproc-dev, Boot failed: %d\n, ret);
+   break;
+   default:
+   rproc_shutdown(rproc);
+   }
+
+   return count;
+}
+
 static const struct file_operations rproc_state_ops = {
.read = rproc_state_read,
+   .write = rproc_state_write,
.open = simple_open,
.llseek = generic_file_llseek,
 };
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/7] ARM: STi: DT: STiH407: Add FDMA driver and xbar driver dt nodes.

2015-08-26 Thread Lee Jones
On Wed, 08 Jul 2015, Peter Griffin wrote:

 These nodes are required to get the fdma and xbar driver working
 on STiH407 based silicon.
 
 Signed-off-by: Peter Griffin peter.grif...@linaro.org
 ---
  arch/arm/boot/dts/stih407-family.dtsi | 59 
 +++
  1 file changed, 59 insertions(+)
 
 diff --git a/arch/arm/boot/dts/stih407-family.dtsi 
 b/arch/arm/boot/dts/stih407-family.dtsi
 index 838b812..b6d9e20 100644
 --- a/arch/arm/boot/dts/stih407-family.dtsi
 +++ b/arch/arm/boot/dts/stih407-family.dtsi
 @@ -565,5 +565,64 @@
 phy_port2 PHY_TYPE_USB3;
   };
   };
 +
 + xbar0: fdma-xbar-mpe@0 {

The unit address should match the one in the reg property.

 + compatible = st,fdma-xbar-1.0;

Is that a version number in the compatible string?

 + reg = 0x8e8 0x1000;
 + dma-requests = 79;
 + #st,fdma-xbar-cells = 1;

Why can't FDMA use the generic DMA properties?

 + };
 +
 + fdma0: fdma-audio@0 {

Same comment as above.

 + compatible = st,fdma_mpe31;

DT doesn't usually like underscores.

 + reg = 0x8e2 0x2;
 + interrupts = GIC_SPI 5 IRQ_TYPE_NONE;
 + dma-channels = 16;
 + #dma-cells = 3;
 + st,fw-name = fdma_STiH407_0.elf;

I've bought this up before somewhere (although there doesn't appear to
be a Firmware Maintainer), surely we should define a generic binding
for passing firmware names?  Many vendors are going to require it.

 + clocks = clk_s_c0_flexgen CLK_FDMA,
 +  clk_s_c0_flexgen CLK_EXT2F_A9,
 +  clk_s_c0_flexgen CLK_EXT2F_A9,
 +  clk_s_c0_flexgen CLK_EXT2F_A9;
 + clock-names = fdma_slim,
 +   fdma_hi,
 +   fdma_low,
 +   fdma_ic;
 + };
 +
 + fdma1: fdma-app@1 {

As above.

 + compatible = st,fdma_mpe31;

As above.

 + reg = 0x8e4 0x2;
 + interrupts = GIC_SPI 7 IRQ_TYPE_NONE;
 + dma-channels = 16;
 + #dma-cells = 3;
 + st,fdma-xbar = xbar0 0;
 + st,fw-name = fdma_STiH407_1.elf;
 + clocks = clk_s_c0_flexgen CLK_FDMA,
 +  clk_s_c0_flexgen CLK_TX_ICN_DMU,
 +  clk_s_c0_flexgen CLK_TX_ICN_DMU,
 +  clk_s_c0_flexgen CLK_EXT2F_A9;
 + clock-names = fdma_slim,
 +   fdma_hi,
 +   fdma_low,
 +   fdma_ic;
 + };
 +
 + fdma2: fdma-free_running@2 {
 + compatible = st,fdma_mpe31;
 + reg = 0x8e6 0x2;
 + interrupts = GIC_SPI 9 IRQ_TYPE_NONE;
 + dma-channels = 16;
 + #dma-cells = 3;
 + st,fw-name = fdma_STiH407_2.elf;
 + clocks = clk_s_c0_flexgen CLK_FDMA,
 +  clk_s_c0_flexgen CLK_EXT2F_A9,
 +  clk_s_c0_flexgen CLK_TX_ICN_DISP_0,
 +  clk_s_c0_flexgen CLK_EXT2F_A9;
 + clock-names = fdma_slim,
 +   fdma_hi,
 +   fdma_low,
 +   fdma_ic;
 + };
   };
  };

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] of: device: fix NULL pointer dereference on driver removal

2015-08-26 Thread Rob Herring
On Tue, Aug 25, 2015 at 2:34 PM, Felipe Balbi ba...@ti.com wrote:
 If we don't insert resources into the resource tree,
 calls to of_platform_depopulate() will end up in NULL
 pointer dereferences because the resource parent will
 be set to NULL even though we still have more resources
 to go through.

Long standing problem. A fix is in -next now and will go into 4.3 (plus stable):

commit 11c63e4718acad3d8f04601c80fddd4b3d1455b1
Author: Grant Likely grant.lik...@linaro.org
Date:   Sun Jun 7 15:20:11 2015 +0100

drivercore: Fix unregistration path of platform devices


 Without this patch, the result is as follows:

 [   28.238158] Unable to handle kernel NULL pointer dereference at virtual 
 address 0008
 [   28.246646] pgd = ed3d8000
 [   28.249480] [0008] *pgd=
 [   28.253247] Internal error: Oops: 5 [#1] SMP ARM
 [   28.258072] Modules linked in: input_leds hid_generic usbkbd usbhid
 xhci_plat_hcd xhci_hcd usbcore joydev dwc3 udc_core usb_common m25p80 evdev 
 spi_nor omapfb cfbfillrect cfbimg blt cpufreq_dt cfbcopyarea thermal_sys 
 snd_soc_simple_card leds_gpio matrix_keypad pwm_bl hwmon led_class 
 matrix_keymap panel_dpi snd_soc_tlv320aic3x snd_soc_davinci_mcasp 
 snd_soc_edma snd_soc_omap snd_soc_core omapdss snd_compress snd_pcm_dmaengine 
 snd_pcm dwc3_omap(-) extcon snd_timer pwm_tiecap snd lis3lv02d_i2c lis3lv02d 
 soundcore input_polldev rtc_omap spi_ti_qspi tps65218_pwrbutton omap_wdt 
 phy_omap_usb2 autofs4
 [   28.313186] CPU: 0 PID: 289 Comm: modprobe Not tainted 
 4.2.0-rc7-next-20150824-2-g5681a109a938-dirty #1093
 [   28.323643] Hardware name: Generic AM43 (Flattened Device Tree)
 [   28.329836] task: ed39d180 ti: ed076000 task.ti: ed076000
 [   28.335496] PC is at __release_resource+0x30/0x13c
 [   28.340501] LR is at __release_resource+0x24/0x13c
 [   28.345501] pc : [c00439e0]lr : [c00439d4]psr: 600d0013
 [   28.345501] sp : ed077e98  ip : 0007  fp : befb3e14
 [   28.357487] r10:   r9 : ed076000  r8 : c000f724
 [   28.362941] r7 :   r6 : ee6f9800  r5 : ed268d40  r4 : c094679c
 [   28.369755] r3 :   r2 : 00f4  r1 : c0648b34  r0 : 0045
 [   28.376560] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM Segment 
 user
 [   28.384008] Control: 10c5387d  Table: ad3d8059  DAC: 0015
 [   28.390005] Process modprobe (pid: 289, stack limit = 0xed076218)
 [   28.396375] Stack: (0xed077e98 to 0xed078000)
 [   28.400924] 7e80: ed268d40 
 [   28.409455] 7ea0: befb3e14 c0640838 0001 c094679c ed268d40 ee6f9800 
 0081 c0043b1c
 [   28.417996] 7ec0: 001c 0001 ee6f9800 c03e2674 ee6f9800  
 c04d3f20 c03e26ac
 [   28.426537] 7ee0: ee6f9810 c04d3fac  c03dcf10 ee1592c0 ed268cf0 
 ee170010 ee170010
 [   28.435065] 7f00: ee170044 c04d3f08 ed268ed0 bf093208 ee170010 bf093c94 
 ee170044 c03e2754
 [   28.443607] 7f20: ee170010 bf093c94 ee170044 c03e095c ee170010 bf093c94 
 ee170044 c03e116c
 [   28.452150] 7f40: bf093c94 7f6232fc 0800 c03e04e4 bf093d00 c00c8a80 
  33637764
 [   28.460703] 7f60: 616d6f5f b6f70070 ed39d180  ed076000  
 befb3e14 c005be74
 [   28.469241] 7f80:  ed076000 7f6232c0 7f6232c0 0001 f67c 
 7f6232c0 7f6232c0
 [   28.477783] 7fa0: 0001 c000f540 7f6232c0 7f6232c0 7f6232fc 0800 
 66d19c00 
 [   28.486341] 7fc0: 7f6232c0 7f6232c0 0001 0081  0001 
 7f6232c0 befb3e14
 [   28.494903] 7fe0: b6f1c2e1 befb2a3c 7f60638f b6f1c2e6 800d0030 7f6232fc 
  
 [   28.503476] [c00439e0] (__release_resource) from [c0043b1c] 
 (release_resource+0x30/0x54)
 [   28.512299] [c0043b1c] (release_resource) from [c03e2674] 
 (platform_device_del+0x70/0x9c)
 [   28.521218] [c03e2674] (platform_device_del) from [c03e26ac] 
 (platform_device_unregister+0xc/0x20)
 [   28.530962] [c03e26ac] (platform_device_unregister) from [c04d3fac] 
 (of_platform_device_destroy+0x8c/0x98)
 [   28.541425] [c04d3fac] (of_platform_device_destroy) from [c03dcf10] 
 (device_for_each_child+0x50/0x7c)
 [   28.551430] [c03dcf10] (device_for_each_child) from [c04d3f08] 
 (of_platform_depopulate+0x2c/0x44)
 [   28.561101] [c04d3f08] (of_platform_depopulate) from [bf093208] 
 (dwc3_omap_remove+0x3c/0x5c [dwc3_omap])
 [   28.571390] [bf093208] (dwc3_omap_remove [dwc3_omap]) from [c03e2754] 
 (platform_drv_remove+0x18/0x30)
 [   28.581387] [c03e2754] (platform_drv_remove) from [c03e095c] 
 (__device_release_driver+0x88/0x114)
 [   28.591023] [c03e095c] (__device_release_driver) from [c03e116c] 
 (driver_detach+0xb4/0xb8)
 [   28.600014] [c03e116c] (driver_detach) from [c03e04e4] 
 (bus_remove_driver+0x4c/0xa0)
 [   28.608485] [c03e04e4] (bus_remove_driver) from [c00c8a80] 
 (SyS_delete_module+0x11c/0x1e4)
 [   28.617518] [c00c8a80] (SyS_delete_module) from [c000f540] 
 (ret_fast_syscall+0x0/0x54)
 [   28.626172] Code: eb0354bf e5957010 e3a020f4 e59f10f0 (e5973008)
 [   28.632722] ---[ end trace d2a21fc5d73a2dfd ]---

 Cc: 

Re: [PATCH v5 3/5] pci: altera: Add Altera PCIe MSI driver

2015-08-26 Thread Ley Foon Tan
On Tue, Aug 25, 2015 at 7:25 PM, Marc Zyngier marc.zyng...@arm.com wrote:

  +
  +static void altera_msi_isr(unsigned int irq, struct irq_desc *desc)
  +{
  + struct irq_chip *chip = irq_desc_get_chip(desc);
  + struct altera_msi *msi;
  + unsigned long status;
  + u32 num_of_vectors;
  + u32 bit;
  + u32 virq;
  +
  + chained_irq_enter(chip, desc);
  + msi = irq_desc_get_handler_data(desc);
  + num_of_vectors = msi-num_of_vectors;
  +
  + do {
  + status = msi_readl(msi, MSI_STATUS);
  + if (!status)
  + break;
  +
  + do {
  + bit = find_first_bit(status, num_of_vectors);
  + /* Dummy read from vector to clear the interrupt */
  + readl_relaxed(msi-vector_base + (bit * sizeof(u32)));
  +
  + virq = irq_find_mapping(msi-inner_domain, bit);
  + if (virq  test_bit(bit, msi-used))

 I still wonder under which circumstances you can obtain a valid virq and
 yet not find the bit in the bitmap. Unless you have a scenario when that
 can happen, I suggest you remove that test.

  + generic_handle_irq(virq);
  + else
  + dev_err(msi-pdev-dev, unexpected MSI\n);
  +
  + /* Clear the bit from status and repeat without 
  reading
  +  * again status register. */
  + __clear_bit(bit, status);
  + } while (status);
  + } while (1);

 I think this could be rewritten as:

 while ((status = msi_readl(msi, MSI_STATUS)) != 0) {
 for_each_set_bit(bit, status, msi-num_of_vectors) {
 /* Dummy read from vector to clear the interrupt */
 readl_relaxed(msi-vector_base + (bit * sizeof(u32)));

 virq = irq_find_mapping(msi-inner_domain, bit);
 if (virq)
 generic_handle_irq(virq);
 else
 dev_err(msi-pdev-dev, unexpected MSI\n);
 }
 }

 which saves the __clear_bit call and the double test of status which I
 find a bit awkward.
Okay.


  +
  + chained_irq_exit(chip, desc);
  +}
  +
  +static struct irq_chip altera_msi_irq_chip = {
  + .name = Altera PCIe MSI,
  + .irq_enable = pci_msi_unmask_irq,
  + .irq_disable = pci_msi_mask_irq,
  + .irq_mask = pci_msi_mask_irq,
  + .irq_unmask = pci_msi_unmask_irq,

 Why do you have both enable/disable and unmask/mask? Specially pointing
 to the same function? This is completely useless. Just stick with
 unmask/mask and remove the enable/disable.
Okay.

  +};
  +
  +static struct msi_domain_info altera_msi_domain_info = {
  + .flags  = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
  +  MSI_FLAG_PCI_MSIX),
  + .chip   = altera_msi_irq_chip,
  +};
  +
  +static void altera_compose_msi_msg(struct irq_data *data, struct msi_msg 
  *msg)
  +{
  + struct altera_msi *msi = irq_data_get_irq_chip_data(data);
  + phys_addr_t addr = msi-vector_phy + (data-hwirq * sizeof(u32));
  +
  + msg-address_lo = lower_32_bits(addr);
  + msg-address_hi = upper_32_bits(addr);
  + msg-data = data-hwirq;
  +
  + dev_dbg(msi-pdev-dev, msi#%d address_lo 0x%x address_hi 0x%x\n,
  + (int)data-hwirq, msg-address_hi, msg-address_lo);
  +}
  +
  +static int altera_msi_set_affinity(struct irq_data *irq_data,
  +const struct cpumask *mask, bool force)
  +{
  +  return -EINVAL;
  +}
  +
  +static struct irq_chip altera_msi_bottom_irq_chip = {
  + .name   = Altera MSI,
  + .irq_compose_msi_msg= altera_compose_msi_msg,
  + .irq_set_affinity   = altera_msi_set_affinity,
  +};
  +
  +static int altera_irq_domain_alloc(struct irq_domain *domain, unsigned int 
  virq,
  +unsigned int nr_irqs, void *args)
  +{
  + struct altera_msi *msi = domain-host_data;
  + unsigned long bit;
  + u32 mask;
  +
  + WARN_ON(nr_irqs != 1);
  + mutex_lock(msi-lock);
  +
  + bit = find_first_zero_bit(msi-used, msi-num_of_vectors);
  + if (bit = msi-num_of_vectors)
  + return -ENOSPC;
  +
  + set_bit(bit, msi-used);
  +
  + mutex_unlock(msi-lock);
  +
  + irq_domain_set_info(domain, virq, bit, altera_msi_bottom_irq_chip,
  + domain-host_data, handle_simple_irq,
  + NULL, NULL);
  + set_irq_flags(virq, IRQF_VALID);
  +
  + mask = msi_readl(msi, MSI_INTMASK);
  + mask |= 1  bit;
  + msi_writel(msi, mask, MSI_INTMASK);
  +
  + return 0;
  +}
  +
  +static void altera_irq_domain_free(struct irq_domain *domain,
  +unsigned int virq, unsigned int nr_irqs)
  +{
  + struct irq_data *d = irq_domain_get_irq_data(domain, virq);
  + 

Re: [PATCH v5 2/5] pci:host: Add Altera PCIe host controller driver

2015-08-26 Thread Ley Foon Tan
On Tue, Aug 25, 2015 at 7:39 PM, Marc Zyngier marc.zyng...@arm.com wrote:


  +
  +static void altera_pcie_retrain(struct pci_dev *dev)
  +{
  + u16 linkcap, linkstat;
  +
  + /*
  +  * Set the retrain bit if the PCIe rootport support  2.5GB/s, but
  +  * current speed is 2.5 GB/s.
  +  */
  + pcie_capability_read_word(dev, PCI_EXP_LNKCAP, linkcap);
  +
  + if ((linkcap  PCI_EXP_LNKCAP_SLS) = PCI_EXP_LNKCAP_SLS_2_5GB)
  + return;
  +
  + pcie_capability_read_word(dev, PCI_EXP_LNKSTA, linkstat);
  + if ((linkstat  PCI_EXP_LNKSTA_CLS) == PCI_EXP_LNKSTA_CLS_2_5GB)
  + pcie_capability_set_word(dev, PCI_EXP_LNKCTL,
  +  PCI_EXP_LNKCTL_RL);
  +}
  +DECLARE_PCI_FIXUP_EARLY(PCI_ANY_ID, PCI_ANY_ID, altera_pcie_retrain);

 Do I read this correctly? This function is being called on any PCI
 device, without any filtering? What if the platform is not using this
 driver despite the driver being compiled in?
Will change it to Altera vendor ID.


  +
  +static void altera_pcie_fixup_res(struct pci_dev *dev)
  +{
  + /*
  +  * Prevent enumeration of root port.
  +  */
  + if (!dev-bus-parent  dev-devfn == 0) {
  + int i;
  +
  + for (i = 0; i  PCI_NUM_RESOURCES; i++) {
  + dev-resource[i].start = 0;
  + dev-resource[i].end   = 0;
  + dev-resource[i].flags   = 0;
  + }
  + }
  +}
  +DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, altera_pcie_fixup_res);

 Same here. I also question the validity of nuking the resources, but I'm
 not a PCI expert.
We want to hide the host BARs from kernel as their content doesn't fix
well in the resource management and cause the pci enumeration failed.
Some other controllers also using same way to hide the host BARs resources.

  +
  +static inline void cra_writel(struct altera_pcie *pcie, u32 value, u32 reg)
  +{
  + writel_relaxed(value, pcie-cra_base + reg);
  +}
  +
  +static inline u32 cra_readl(struct altera_pcie *pcie, u32 reg)
  +{
  + return readl_relaxed(pcie-cra_base + reg);
  +}
  +
  +static void tlp_read_rx(struct altera_pcie *pcie,
  + struct tlp_rp_regpair_t *tlp_rp_regdata)
  +{
  + tlp_rp_regdata-ctrl = cra_readl(pcie, RP_RXCPL_STATUS);
  + tlp_rp_regdata-reg0 = cra_readl(pcie, RP_RXCPL_REG0);
  + tlp_rp_regdata-reg1 = cra_readl(pcie, RP_RXCPL_REG1);
  +}
  +
  +static void tlp_write_tx(struct altera_pcie *pcie,
  +  struct tlp_rp_regpair_t *tlp_rp_regdata)
  +{
  + cra_writel(pcie, tlp_rp_regdata-reg0, RP_TX_REG0);
  + cra_writel(pcie, tlp_rp_regdata-reg1, RP_TX_REG1);
  + cra_writel(pcie, tlp_rp_regdata-ctrl, RP_TX_CNTRL);
  +}
  +
  +static bool altera_pcie_link_is_up(struct altera_pcie *pcie)
  +{
  + return !!(cra_readl(pcie, RP_LTSSM)  LTSSM_L0);
  +}
  +
  +static bool altera_pcie_valid_config(struct altera_pcie *pcie,
  +  struct pci_bus *bus, int dev)
  +{
  + /* If there is no link, then there is no device */
  + if (bus-number != pcie-root_bus_nr) {
  + if (!altera_pcie_link_is_up(pcie))
  + return false;
  + }
  +
  + /* access only one slot on each root port */
  + if (bus-number == pcie-root_bus_nr  dev  0)
  + return false;
  +
  + /*
  +  * Do not read more than one device on the bus directly attached
  +  * to RC.
  +  */
  + if (bus-primary == pcie-root_bus_nr  dev  0)
  + return false;
  +
  +  return true;
  +}
  +
  +static int tlp_read_packet(struct altera_pcie *pcie, u32 *value)
  +{
  + u8 loop;
  + struct tlp_rp_regpair_t tlp_rp_regdata;
  +
  + for (loop = 0; loop  TLP_LOOP; loop++) {
  + tlp_read_rx(pcie, tlp_rp_regdata);
  + if (tlp_rp_regdata.ctrl  RP_RXCPL_EOP) {
  + if (value)
  + *value = tlp_rp_regdata.reg0;
  + return PCIBIOS_SUCCESSFUL;
  + }
  + udelay(5);
  + }
  +
  + return -ENOENT;
  +}
  +
  +static void tlp_write_packet_unaligned(struct altera_pcie *pcie, u32 
  *headers,
  +u32 data)
  +{
  + struct tlp_rp_regpair_t tlp_rp_regdata;
  +
  + tlp_rp_regdata.reg0 = headers[0];
  + tlp_rp_regdata.reg1 = headers[1];
  + tlp_rp_regdata.ctrl = RP_TX_SOP;
  + tlp_write_tx(pcie, tlp_rp_regdata);
  +
  + tlp_rp_regdata.reg0 = headers[2];
  + tlp_rp_regdata.reg1 = data;
  + tlp_rp_regdata.ctrl = RP_TX_EOP;
  + tlp_write_tx(pcie, tlp_rp_regdata);
  +}
  +
  +static void tlp_write_packet_aligned(struct altera_pcie *pcie, u32 
  *headers,
  +  u32 data)
  +{
  + struct tlp_rp_regpair_t tlp_rp_regdata;
  +
  + tlp_rp_regdata.reg0 = headers[0];
  + tlp_rp_regdata.reg1 = headers[1];
  +

Re: [PATCH] of: device: fix NULL pointer dereference on driver removal

2015-08-26 Thread Felipe Balbi
On Wed, Aug 26, 2015 at 08:14:36AM -0500, Rob Herring wrote:
 On Tue, Aug 25, 2015 at 2:34 PM, Felipe Balbi ba...@ti.com wrote:
  If we don't insert resources into the resource tree,
  calls to of_platform_depopulate() will end up in NULL
  pointer dereferences because the resource parent will
  be set to NULL even though we still have more resources
  to go through.
 
 Long standing problem. A fix is in -next now and will go into 4.3 (plus 
 stable):
 
 commit 11c63e4718acad3d8f04601c80fddd4b3d1455b1
 Author: Grant Likely grant.lik...@linaro.org
 Date:   Sun Jun 7 15:20:11 2015 +0100
 
 drivercore: Fix unregistration path of platform devices

that commit works, but too late to add a Tested-by :-)

-- 
balbi


signature.asc
Description: Digital signature


[PATCH 0/4] remoteproc: Add driver for STMicroelectronics platforms

2015-08-26 Thread Lee Jones
ST's platforms often have multiple co-processors (usually ST40s or ST231s)
on-board.  This provides the Linux-side infrastructure to flash and boot
them successfully.

This set has been tested on an STiH410-B2120.

Lee Jones (4):
  remoteproc: dt: Provide bindings for ST's Remote Processor Controller
driver
  remoteproc: Supply controller driver for ST's Remote Processors
  ARM: STiH407: Add nodes for RemoteProc
  remoteproc: debugfs: Add ability to boot remote processor using
debugfs

 .../devicetree/bindings/remoteproc/st-rproc.txt|  38 +++
 arch/arm/boot/dts/stih407-family.dtsi  |  48 
 drivers/remoteproc/Kconfig |   9 +
 drivers/remoteproc/Makefile|   1 +
 drivers/remoteproc/remoteproc_debugfs.c|  25 ++
 drivers/remoteproc/st_remoteproc.c | 300 +
 6 files changed, 421 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/st-rproc.txt
 create mode 100644 drivers/remoteproc/st_remoteproc.c

-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/4] ARM: STiH407: Add nodes for RemoteProc

2015-08-26 Thread Lee Jones
Signed-off-by: Lee Jones lee.jo...@linaro.org
---
 arch/arm/boot/dts/stih407-family.dtsi | 48 +++
 1 file changed, 48 insertions(+)

diff --git a/arch/arm/boot/dts/stih407-family.dtsi 
b/arch/arm/boot/dts/stih407-family.dtsi
index 33daa49..89a363c 100644
--- a/arch/arm/boot/dts/stih407-family.dtsi
+++ b/arch/arm/boot/dts/stih407-family.dtsi
@@ -608,5 +608,53 @@
status  = okay;
tx-only;
};
+
+   st231_gp0: st231-gp0@0 {
+   compatible = st,st231-rproc;
+   reg = 0x4000 0x0100;
+   reg-names = carveout;
+   resets = softreset STIH407_ST231_GP0_SOFTRESET;
+   reset-names = sw_reset;
+   clocks = clk_s_c0_flexgen CLK_ST231_GP_0;
+   clock-names = rproc_clk;
+   clock-frequency = 6;
+   st,syscfg-boot = syscfg_core 0x22C;
+   };
+
+   st231_gp1: st231-gp1@0 {
+   compatible = st,st231-rproc;
+   reg = 0x4100 0x0100;
+   reg-names = carveout;
+   resets = softreset STIH407_ST231_GP1_SOFTRESET;
+   reset-names = sw_reset;
+   clocks = clk_s_c0_flexgen CLK_ST231_GP_1;
+   clock-names = rproc_clk;
+   clock-frequency = 6;
+   st,syscfg-boot = syscfg_core 0x220;
+   };
+
+   st231_audio: st231-audio@0 {
+   compatible = st,st231-rproc;
+   reg = 0x4200 0x0100;
+   reg-names = carveout;
+   resets = softreset STIH407_ST231_AUD_SOFTRESET;
+   reset-names = sw_reset;
+   clocks = clk_s_c0_flexgen CLK_ST231_AUD_0;
+   clock-names = rproc_clk;
+   clock-frequency = 6;
+   st,syscfg-boot = syscfg_core 0x228;
+   };
+
+   st231_dmu: st231-dmu@0 {
+   compatible = st,st231-rproc;
+   reg = 0x4300 0x0100;
+   reg-names = carveout;
+   resets = softreset STIH407_ST231_DMU_SOFTRESET;
+   reset-names = sw_reset;
+   clocks = clk_s_c0_flexgen CLK_ST231_DMU;
+   clock-names = rproc_clk;
+   clock-frequency = 6;
+   st,syscfg-boot = syscfg_core 0x224;
+   };
};
 };
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/4] remoteproc: dt: Provide bindings for ST's Remote Processor Controller driver

2015-08-26 Thread Lee Jones
Signed-off-by: Lee Jones lee.jo...@linaro.org
---
 .../devicetree/bindings/remoteproc/st-rproc.txt| 38 ++
 1 file changed, 38 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/st-rproc.txt

diff --git a/Documentation/devicetree/bindings/remoteproc/st-rproc.txt 
b/Documentation/devicetree/bindings/remoteproc/st-rproc.txt
new file mode 100644
index 000..6a933c1
--- /dev/null
+++ b/Documentation/devicetree/bindings/remoteproc/st-rproc.txt
@@ -0,0 +1,38 @@
+STMicroelectronics Remote Processor
+---
+
+This binding provides support for adjunct processors found on ST SoCs.
+
+The remote processors can be controlled from the bootloader or the primary OS.
+If the bootloader starts a remote processor processor the primary OS must 
detect
+its state and act accordingly.
+
+The node name is significant, as it defines the name of the CPU and the name
+of the firmware to load: rproc-name-fw.
+
+Required properties:
+- compatible   Should be one of:
+   st,st231-rproc
+   st,st40-rproc
+- reg  Size and length of reserved co-processor memory
+- resets   Reset lines (See: ../reset/reset.txt)
+- reset-names  Must be sw_reset and pwr_reset
+- clocks   Clock for co-processor (See: 
../clock/clock-bindings.txt)
+- clock-names  Must be rproc_clk
+- clock-frequency  Clock frequency to set co-processor at if the bootloader
+   hasn't already done so
+- st,syscfg-boot   The register that holds the boot vector for the 
co-processor
+
+Example:
+
+   st231-audio@bae0 {
+   compatible  = st,st231-rproc;
+   reg = 0xbae0 0x0100;
+   reg-names   = rproc_mem;
+   resets  = softreset STIH407_ST231_AUD_SOFTRESET;
+   reset-names = sw_reset;
+   clocks  = clk_s_c0_flexgen CLK_ST231_AUD_0;
+   clock-names = rproc_clk;
+   clock-frequency = 6;
+   st,syscfg-boot  = syscfg_core 0x228;
+   };
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] remoteproc: Supply controller driver for ST's Remote Processors

2015-08-26 Thread Lee Jones
Signed-off-by: Lee Jones lee.jo...@linaro.org
---
 drivers/remoteproc/Kconfig |   9 ++
 drivers/remoteproc/Makefile|   1 +
 drivers/remoteproc/st_remoteproc.c | 300 +
 3 files changed, 310 insertions(+)
 create mode 100644 drivers/remoteproc/st_remoteproc.c

diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
index 28c711f..72e97d7 100644
--- a/drivers/remoteproc/Kconfig
+++ b/drivers/remoteproc/Kconfig
@@ -77,4 +77,13 @@ config DA8XX_REMOTEPROC
  It's safe to say n here if you're not interested in multimedia
  offloading.
 
+config ST_REMOTEPROC
+   tristate ST remoteproc support
+   depends on ARCH_STI
+   select REMOTEPROC
+   help
+ Say y here to support ST's adjunct processors via the remote
+ processor framework.
+ This can be either built-in or a loadable module.
+
 endmenu
diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
index 81b04d1..279cb2e 100644
--- a/drivers/remoteproc/Makefile
+++ b/drivers/remoteproc/Makefile
@@ -11,3 +11,4 @@ obj-$(CONFIG_OMAP_REMOTEPROC) += omap_remoteproc.o
 obj-$(CONFIG_STE_MODEM_RPROC)  += ste_modem_rproc.o
 obj-$(CONFIG_WKUP_M3_RPROC)+= wkup_m3_rproc.o
 obj-$(CONFIG_DA8XX_REMOTEPROC) += da8xx_remoteproc.o
+obj-$(CONFIG_ST_REMOTEPROC)+= st_remoteproc.o
diff --git a/drivers/remoteproc/st_remoteproc.c 
b/drivers/remoteproc/st_remoteproc.c
new file mode 100644
index 000..7afcfaf
--- /dev/null
+++ b/drivers/remoteproc/st_remoteproc.c
@@ -0,0 +1,300 @@
+/*
+ * ST's Remote Processor Control Driver
+ *
+ * Copyright (C) 2015 STMicroelectronics - All Rights Reserved
+ *
+ * Author: Ludovic Barre ludovic.ba...@st.com
+ *
+ * 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.
+ */
+
+#include linux/clk.h
+#include linux/dma-mapping.h
+#include linux/err.h
+#include linux/interrupt.h
+#include linux/kernel.h
+#include linux/mfd/syscon.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/platform_device.h
+#include linux/regmap.h
+#include linux/remoteproc.h
+#include linux/reset.h
+
+struct st_rproc_config {
+   boolsw_reset;
+   boolpwr_reset;
+   u32 bootaddr_mask;
+};
+
+struct st_rproc {
+   struct st_rproc_config  *config;
+   struct reset_control*sw_reset;
+   struct reset_control*pwr_reset;
+   struct clk  *clk;
+   u32 clk_rate;
+   struct  regmap  *boot_base;
+   u32 boot_offset;
+};
+
+static int st_rproc_stop(struct rproc *rproc)
+{
+   struct st_rproc *st_rproc = rproc-priv;
+   int err = 0;
+
+   if (st_rproc-config-sw_reset) {
+   err = reset_control_assert(st_rproc-sw_reset);
+   if (err)
+   dev_warn(rproc-dev, Failed to assert S/W Reset\n);
+   }
+
+   if (st_rproc-config-pwr_reset) {
+   err = reset_control_assert(st_rproc-pwr_reset);
+   if (err)
+   dev_warn(rproc-dev, Failed to assert Power Reset\n);
+   }
+
+   clk_disable(st_rproc-clk);
+
+   return 0;
+}
+
+static int st_rproc_start(struct rproc *rproc)
+{
+   struct st_rproc *st_rproc = rproc-priv;
+   int err;
+
+   regmap_update_bits(st_rproc-boot_base, st_rproc-boot_offset,
+  st_rproc-config-bootaddr_mask, rproc-bootaddr);
+
+   err = clk_enable(st_rproc-clk);
+   if (err) {
+   dev_err(rproc-dev, Failed to enable clock\n);
+   return err;
+   }
+
+   if (st_rproc-config-sw_reset) {
+   err = reset_control_deassert(st_rproc-sw_reset);
+   if (err) {
+   dev_err(rproc-dev, Failed to deassert S/W Reset\n);
+   return err;
+   }
+   }
+
+   if (st_rproc-config-pwr_reset) {
+   err = reset_control_deassert(st_rproc-pwr_reset);
+   if (err) {
+   dev_err(rproc-dev, Failed to deassert Power 
Reset\n);
+   return err;
+   }
+   }
+
+   dev_info(rproc-dev, Started from 0x%x\n, rproc-bootaddr);
+
+   return 0;
+}
+
+static struct rproc_ops st_rproc_ops = {
+   .start  = st_rproc_start,
+   .stop   = st_rproc_stop,
+};
+
+/*
+ * Fetch state of the processor: 0 is off, 1 is on.
+ */
+static int st_rproc_state(struct st_rproc *st_rproc)
+{
+   int reset_sw, reset_pwr;
+
+   reset_sw = st_rproc-config-sw_reset ?
+   reset_control_status(st_rproc-sw_reset) : 0;
+
+   reset_pwr = st_rproc-config-pwr_reset ?
+   

Re: [PATCH] of/irq: export of_get_irq_byname()

2015-08-26 Thread Rob Herring
On Tue, Aug 25, 2015 at 7:04 PM, Dmitry Torokhov
dmitry.torok...@gmail.com wrote:
 Similarly to of_get_irq(), let's export of_irq_get_byname(), so if a bus core
 can be compiled as a module (such as I2C) it can have access to the symbol.

 Reported-by: Stephen Rothwell s...@canb.auug.org.au
 Reported-by: kbuild test robot fengguang...@intel.com
 Signed-off-by: Dmitry Torokhov dmitry.torok...@gmail.com

Acked-by: Rob Herring r...@kernel.org

 ---
  drivers/of/irq.c | 1 +
  1 file changed, 1 insertion(+)

 diff --git a/drivers/of/irq.c b/drivers/of/irq.c
 index 7ef837e..1a7911d 100644
 --- a/drivers/of/irq.c
 +++ b/drivers/of/irq.c
 @@ -446,6 +446,7 @@ int of_irq_get_byname(struct device_node *dev, const char 
 *name)

 return of_irq_get(dev, index);
  }
 +EXPORT_SYMBOL_GPL(of_irq_get_byname);

  /**
   * of_irq_count - Count the number of IRQs a node uses
 --
 2.5.0.457.gab17608


 --
 Dmitry
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] ARM: uniphier: add outer cache support

2015-08-26 Thread Linus Walleij
On Mon, Aug 24, 2015 at 4:18 AM, Masahiro Yamada
yamada.masah...@socionext.com wrote:
 This commit adds support for UniPhier outer cache controller.
 All the UniPhier SoCs are equipped with the L2 cache, while the L3
 cache is currently only integrated on PH1-Pro5 SoC.

 Signed-off-by: Masahiro Yamada yamada.masah...@socionext.com

Wow it is really a custom L2$ controller. Wow. Just wow. That's
really brave, given all the problems we've seen in l2x0.

 +UniPhier SoCs are integrated with a level 2 cache controller that resides
 +outside of the ARM cores, some of them also have a level 3 cache controller.
 +
 +Required properties:
 +- compatible: should be one of the followings:
 +   socionext,uniphier-l2-cache   (L2 cache)
 +   socionext,uniphier-l3-cache   (L3 cache)

Refer to and use the 3.7.3 ePAPR v1.1 specification too:
https://www.power.org/wp-content/uploads/2012/06/Power_ePAPR_APPROVED_v1.1.pdf

cache-unified and cache-level are *not* optional and should be required.

So:

 +The L2 cache must exist to use the L3 cache; adding only an L3 cache device
 +node to the device tree causes the initialization failure of the whole outer
 +cache system.
 +
 +Example:
 +   l2-cache@500c {
 +   compatible = socionext,uniphier-l2-cache;
 +   reg = 0x500c 0x2000, 0x503c0100 0x8,
 + 0x506c 0x400;

cache-unified;
cache-level = 2;

 +   /* Not all of UniPhier SoCs have L3 cache */
 +   l3-cache@500c8000 {
 +   compatible = socionext,uniphier-l3-cache;
 +   reg = 0x500c8000 0x2000, 0x503c8100 0x8,
 + 0x506c8000 0x400;

cache-unified;
cache-level = 3;

(I'm just assuming this cache is unified, anything else would be baffling.)

Further the ePAPR spec optionally supports specifying things like the
cache size, number of sets, block size and line size, unless this can
be hard coded.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH linux-next v5 1/5] mtd: spi-nor: notify (Q)SPI controller about protocol change

2015-08-26 Thread Jonas Gorski
On Wed, Aug 26, 2015 at 2:30 PM, Cyrille Pitchen
cyrille.pitc...@atmel.com wrote:
 Once the Quad SPI mode has been enabled on a Micron flash memory, this
 device expects ALL the following commands to use the SPI 4-4-4 protocol.
 The (Q)SPI controller needs to be notified about the protocol change so it
 can adapt and keep on dialoging with the Micron memory.

Doesn't that mean you need to disable quad mode on removal? Else the
following will break/fail:

insmod atmel-quadspi.ko ~ spi-nor attaches - sees micron - enables quad mode
rmmod atmel-quadspi.ko ~ spi-nor detaches
insmod atmel-quadspi.ko ~ spi-nor attaches - fails to read the id
because flash is still in quad mode.

 Signed-off-by: Cyrille Pitchen cyrille.pitc...@atmel.com
 Acked-by: Marek Vasut ma...@denx.de
 Acked-by: Bean Huo bean...@micron.com
 ---
  drivers/mtd/spi-nor/spi-nor.c | 21 +
  include/linux/mtd/spi-nor.h   | 13 +
  2 files changed, 34 insertions(+)

 diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
 index c27d427fead4..c8810313a752 100644
 --- a/drivers/mtd/spi-nor/spi-nor.c
 +++ b/drivers/mtd/spi-nor/spi-nor.c
 @@ -165,6 +165,22 @@ static inline int write_disable(struct spi_nor *nor)
 return nor-write_reg(nor, SPINOR_OP_WRDI, NULL, 0, 0);
  }

 +/*
 + * Let the spi-nor framework notify lower layers, especially the driver of 
 the
 + * (Q)SPI controller, about the new protocol to be used. Indeed, once the
 + * spi-nor framework has sent manufacturer specific commands to a memory to
 + * enable its Quad SPI mode, it should immediately after tell the QSPI
 + * controller to use the very same Quad SPI protocol as expected by the 
 memory.
 + */
 +static inline int spi_nor_set_protocol(struct spi_nor *nor,
 +  enum spi_protocol proto)
 +{
 +   if (nor-set_protocol)
 +   return nor-set_protocol(nor, proto);
 +
 +   return 0;

Shouldn't the default assumption be that it won't support it? Also it
might make sense to first check if it's supported before enabling it
in the chip, so that we don't enable something just to then find out
we can't back out of it.

I also wonder if we need an extra flag for that as at least SPI has
RX_{DUAL,QUAD} and TX_{DUAL,QUAD} separated, so in theory there could
be a controller that supports quad read, but not quad write, so we
shouldn't be using the quad mode in that case. m25p80 currently sets
SPI_NOR_{DUAL,QUAD} only based on SPI_RX_{DUAL,QUAD}, so that would
then fail.

At least the n25q32 seems to support the boring 1_1_2 and 1_1_4
commands, so these should work in case the spi controller does not
support quad tx, but quad rx.

So maybe an additional flag for the full dual/quad modes would be in order.

Last but not least, the protocol probably should be stored somewhere
in the nor struct, so that users don't have to store it themselves (I
assume they will need to check it for each command again to know if
the cmd/address should be send in serial or quad mode).


Jonas
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/5] add GPT timer support for mt8173

2015-08-26 Thread Yingjoe Chen
On Wed, 2015-08-26 at 09:37 +0200, Daniel Lezcano wrote:
 On 07/13/2015 11:32 AM, Yingjoe Chen wrote:
  This series add GPT timer support for mt8173. This is based on v4.2-rc1
  and Matthias' next branch (for dts parts).
 
  The first 2 patches comes from 'Add SMP bringup support for mt65xx socs'
  series [1]. I decide to move these 2 patches to this series, since it
  is more relevent here. They are changed based on Matthias' and Daniel's
  comments.
 
  [1] http://lists.infradead.org/pipermail/linux-mediatek/2015-May/000714.html
 
  Daniel Kurtz (1):
 arm64: dts: mt8173: add timer node
 
  Yingjoe Chen (4):
 clocksource: mediatek: do not enable GPT_CLK_EVT when setup
 clocksource: mediatek: Use GPT as sched clock source
 arm64: mediatek: enable MTK_TIMER
 clk: mediatek: add 13mhz clock for MT8173
 
arch/arm64/Kconfig   |  1 +
arch/arm64/boot/dts/mediatek/mt8173.dtsi |  9 +
drivers/clk/mediatek/clk-mt8173.c|  5 +
drivers/clocksource/mtk_timer.c  | 26 --
include/dt-bindings/clock/mt8173-clk.h   |  3 ++-
5 files changed, 37 insertions(+), 7 deletions(-)
 
 Who will take this patchset ? I can take the patch 2 if needed.
 
 

Hi Daniel,

Please take patch 2 with your fix. Thanks.

I think patch 3(enable MTK_TIMER in Kconfig) and 5 (add timer node)
should go through Matthias' tree to arm-soc and patch 4(add 13mhz clock)
should go through James' mtk-clk tree to clk maintainer.

Joe.C


--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] mmc: mediatek: Add online-tuning support of EMMC/SD

2015-08-26 Thread Ulf Hansson
On 26 August 2015 at 10:40, Chaotian Jing chaotian.j...@mediatek.com wrote:
 On Tue, 2015-08-25 at 14:07 +0200, Ulf Hansson wrote:
 On 17 August 2015 at 14:01, Chaotian Jing chaotian.j...@mediatek.com wrote:
  Hi Ulf,
  Thanks, please see my comment:
  On Mon, 2015-08-17 at 13:31 +0200, Ulf Hansson wrote:
  On 12 August 2015 at 10:24, Chaotian Jing chaotian.j...@mediatek.com 
  wrote:
   Schedule a workqueue to do tuning when CRC error
   Call mmc_hw_reset to re-init card when data timeout
 
  Thanks to Adrian Hunter, the mmc core already supports re-tuning for
  the above scenarios through the mmc_retune_*() APIs.
 
  SDHCI driver has already adopted to use that feature, you should do
  that for the mtk-sd driver as well.
 
  Kind regards
  Uffe
 
  I also noticed that the mmc core already supports re-tuning, but it is
  not suitable for our host.
  For EMMC, the CMD21 only support HS200/HS400 mode, for SD card, CMD19
  only support SDR50/SDR104 mode, but in our host, even 50Mhz clock
  frequency may also occur CRC error, Cannot find a parameter that can
  cover all SD cards which running at 50Mhz, even 25Mhz, will occur CRC
  error for stress test, DDR50 mode is worse.

 I don't follow. You may run for example HS200 in lower speed, nothing
 will prevent tuning and re-tuning from happen for these scenarios.

 Or you are talking about other speed modes than HS200/400 and
 SDR50/104? If so, which speed modes are these?

 Yes, I am talking about other speed modes.
 For SD card, the speed mode is High Speed, for EMMC, the speed may be
 High Speed or DDR mode.
 If CRC error occurs at these speed modes, the MMC core layer will never
 handler it. even propagate the -EILSEQ towards to the mmc core, it will
 not start mmc_retune.

That's true and that's because the MMC/SD/SDIO specs states it.
Moreover, there a no tuning ever executed even while initializing such
cards. I think you need to elaborate more on what kind of tuning
your controller needs for these legacy speed modes, can you please do
that?

Currently the mmc block layer has request retry mechanism when
encountering IO errors. That may even reset or power cycle the card,
via mmc_hw_reset(). Isn't that sufficient?

 BTW, there are currently a patch being discussed which is about adding
 tuning for DDR mode. Please have look.
 http://www.spinics.net/lists/arm-kernel/msg438434.html

 Regarding re-tuning on CRC errors, that's already supported by the mmc
 core. More precisely when a host driver returns -EILSEQ for a request.

  By the way,there are too many tune parameters need try for response,
  read data, write crc status CRC error, these parameters are
  multidimensional, it is hard to find a best parameter, and, try
  thousands of parameters will take long time.

 As I see, it's your responsibility from the host driver to propagate
 the proper error code towards the mmc core. If you encounter an error
 that you want to trigger a retune, just return -EILSEQ.

 Moreover, if you see a need to extend the tuning/re-tuning support in
 the mmc core to suit your need - I am definitely open to look into
 that. More importantly, I don't want to see host specific hacks trying
 to deal with this.

 In addition, the CMD21 is only valid for HS200 mode, do not support
 HS400, So that there is no chance to tune the HS400 read/write data with
 current mmc core layer codes.
 As you see, in our platform, tune of HS200 and HS400 is different, but
 if use the CMD21, it will never work at HS400 mode, even with
 prepare_hs400_tuning, but it prepare what ? what we need is that
 running at HS400 mode and tune the read/write parameters, but not HS200,
 because for data Rx path, the tune result of HS200 is meaningless for
 HS400.

So, should we perhaps add another host_ops callback to satisfy your
need for HS400?

Kind regards
Uffe
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 1/5] mtd: nand: vf610_nfc: Freescale NFC for VF610, MPC5125 and others

2015-08-26 Thread Stefan Agner
On 2015-08-25 13:16, Brian Norris wrote:
 A few more comments.
 
 On Mon, Aug 03, 2015 at 11:27:26AM +0200, Stefan Agner wrote:
 diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c
 new file mode 100644
 index 000..5c8dfe8
 --- /dev/null
 +++ b/drivers/mtd/nand/vf610_nfc.c
 @@ -0,0 +1,645 @@
 
 ...
 
 +/*
 + * This function supports Vybrid only (MPC5125 would have full RB and four 
 CS)
 + */
 +static void vf610_nfc_select_chip(struct mtd_info *mtd, int chip)
 +{
 +#ifdef CONFIG_SOC_VF610
 
 Why the #ifdef? I don't see anything compile-time specific to SOC_VF610.
 
 If this is trying to handle the comment above (This function supports
 Vybrid only (MPC5125 would have full RB and four CS)) then that's the
 wrong way of doing it, as you need to support multiplatform kernels.
 You'll need to have a way to differentiate the different platform
 support at runtime, not compile time.

Yes it is trying to handle the comment above. Well, the other two
platforms I am aware of are also different architectures... (PowerPC and
ColdFire). I think we won't have a multi-architecture kernel anytime
soon, hence I think removing the code at compile time is the right thing
todo.

However, probably CONFIG_SOC_VF610 is the wrong symbol then, I could
just use CONFIG_ARM and add a comment that this might be different on
another other ARM SoC than VF610.

Just checked CodingStyle, and I see that IS_ENABLED is the preferred way
for conditional compiling.

So my suggestion:

static void vf610_nfc_select_chip(struct mtd_info *mtd, int chip)
{
struct vf610_nfc *nfc = mtd_to_nfc(mtd);
u32 tmp = vf610_nfc_read(nfc, NFC_ROW_ADDR);

if (!IS_ENABLED(CONFIG_ARM))
return;

/*
 * This code is only tested on the ARM platform VF610
 * PowerPC based MPC5125 would have full RB and four CS
 */


With that the compiler should be able to remove this (currently) ARM
VF610 specific code on the other supported architectures...

What do you think?


 
 +struct vf610_nfc *nfc = mtd_to_nfc(mtd);
 +u32 tmp = vf610_nfc_read(nfc, NFC_ROW_ADDR);
 +
 +tmp = ~(ROW_ADDR_CHIP_SEL_RB_MASK | ROW_ADDR_CHIP_SEL_MASK);
 +tmp |= 1  ROW_ADDR_CHIP_SEL_RB_SHIFT;
 +
 +if (chip == 0)
 +tmp |= 1  ROW_ADDR_CHIP_SEL_SHIFT;
 +else if (chip == 1)
 +tmp |= 2  ROW_ADDR_CHIP_SEL_SHIFT;
 
   else ... ?
 
 Maybe you can write this as a formulaic pattern (e.g.:
 
   tmp |= (chip + 1)  ROW_ADDR_CHIP_SEL_SHIFT;
 
 ) and just do the max # of chips checks on a per-platform basis in the
 probe(). Then I'm guessing this same function can apply to both
 platforms. (I'm not looking at HW datasheets for this, BTW, just
 guessing based on the context here.)

It seems that MCP5125 is different than VF610. MCP5125 has 4 chip
selects and 4 R/B signals, whereas VF610 has only 2 chip selects and
just 1 R/B signals...

 But wait...I see that you call nand_scan_ident() with a max of 1 chip.
 So you won't ever see the chip  0 case, right?
 
 So does this driver support multiple flash attached or not? Looks like
 you're assuming you'll only be using chip-select 0. (This is fine for
 now, but at least your code should acknowledge this. Perhaps a comment
 at the top under limitations.)
 

Ok, will add that information under limitations.


 +
 +vf610_nfc_write(nfc, NFC_ROW_ADDR, tmp);
 +#endif
 +}
 
 ...
 
 +static int vf610_nfc_probe(struct platform_device *pdev)
 +{
 
 ...
 
 +/* first scan to find the device and get the page size */
 +if (nand_scan_ident(mtd, 1, NULL)) {
 +err = -ENXIO;
 +goto error;
 +}

--
Stefan
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller.

2015-08-26 Thread vikas
Hi,

On 08/26/2015 11:06 AM, Brian Norris wrote:
 On Wed, Aug 26, 2015 at 08:47:37AM -0700, vikas wrote:
 On 08/25/2015 11:19 PM, Marek Vasut wrote:
 On Wednesday, August 26, 2015 at 12:09:50 AM, vikas wrote:
 the patch failed to apply, please rebase it to master.

 it's based on -next, I'm sure you can fix trivial conflicts yourself if you
 need to apply it elsewhere. Do you have any other review comments ?

 Always rebase the patch on master.
 
 Development works against -next, not Linus' master:
 
 https://lwn.net/Articles/289013/
 
 This is also noted here:
 
 https://www.kernel.org/doc/man-pages/linux-next.html
 
 Technically, you should work off of the respective subsystem tree (see
 entries in MAINTAINERS). For MTD, this is also documented here:
 
 http://linux-mtd.infradead.org/source.html
 
 In the end, most MTD patches get applied to l2-mtd.git, but l2-mtd.git
 and linux-next.git should provide pretty similar MTD patching
 experiences, as the former is included in the latter.

Thanks Brian for these useful links, appreciate it.

Rgds,
Vikas

 
 Regards,
 Brian
 .
 
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/7] drm/vc4: Add devicetree bindings for VC4.

2015-08-26 Thread Rob Herring
On Wed, Aug 26, 2015 at 3:59 PM, Dave Airlie airl...@gmail.com wrote:
 On 27 August 2015 at 00:30, Rob Herring robherri...@gmail.com wrote:
 On Wed, Aug 26, 2015 at 7:09 AM, Thierry Reding
 thierry.red...@gmail.com wrote:
 On Wed, Aug 26, 2015 at 01:52:29PM +0200, Daniel Vetter wrote:
 On Tue, Aug 25, 2015 at 04:42:18PM -0400, Rob Clark wrote:
  On Mon, Aug 24, 2015 at 9:47 AM, Rob Herring robherri...@gmail.com 
  wrote:
   On Mon, Aug 17, 2015 at 1:30 PM, Eric Anholt e...@anholt.net wrote:
   Stephen Warren swar...@wwwdotorg.org writes:
  
   On 08/12/2015 06:56 PM, Eric Anholt wrote:
   Signed-off-by: Eric Anholt e...@anholt.net
[...]
   +- hvss: List of references to HVS video scalers
   +- encoders: List of references to output encoders (HDMI, SDTV)
[...]
   Of course, this is only appropriate if the HW modules really are
   logically children of the VC4 HW module. Perhaps they aren't. If they
   aren't though, I wonder what this vc4 module actually represents 
   in HW?
  
   It's the subsystem, same as we use a subsystem node for msm, sti,
   rockchip, imx, and exynos.  This appears to be the common model of how
   the collection of graphics-related components is represented in the 
   DT.
  
   I think most of these bindings are wrong. They are grouped together
   because that is what DRM wants not because that reflects the h/w. So
   convince me this is one block, not that it is what other people do.
 
  I think, when it comes to more complex driver subsystems (like drm in
  particular) we have a bit of mismatch between how things look from the
  pure hw ignoring sw perspective, and the how sw and in particular
  userspace expects things perspective.  Maybe it is less a problem in
  other subsystems, where bindings map to things that are only visible
  in the kernel, or well defined devices like uart or sata controller.
  But when given the choice, I'm going to err on the side of not
  confusing userspace and the large software stack that sits above
  drm/kms, over dt purity.
 
  Maybe it would be nice to have a sort of dt overlay that adds the bits
  needed to tie together hw blocks that should be assembled into a
  single logical device for linux and userspace (but maybe not some
  other hypothetical operating system).  But so far that doesn't exist.
  All we have is a hammer (devicetree), everything looks like a nail.
  End result is we end up adding some things in the bindings which
  aren't purely about the hw.  Until someone invents a screwdriver, I'm
  not sure what else to do.  In the end, other hypothetical OS is free
  to ignore those extra fields in the bindings if it doesn't need them.
  So meh?

 I thought we agreed a while back that these kind of pull everything for
 the logical device together dt nodes which just have piles of phandles
 are totally accepted? At least that's the point behind the component
 helpers, and Eric even suggested to create dt-specific component helpers
 to cut down a bit on the usual boilerplate. dt maintainers are also fine
 with this approach afaik. From my understanding tegra with the host1x bus
 really is the odd one out and not the norm.

 I agree that in many aspects Tegra is somewhat special. But the same
 principles that the host1x infrastructure uses could be implemented in a
 similar way for other DRM drivers. You can easily collect information
 about subdevices by walking the device tree and matching on known
 compatible strings. And you can also instantiate the top-level device
 from driver code rather than have it in DT. It should still be possible
 to make this work without an artificial device node in DT. The component
 and master infrastructure is largely orthogonal to that, and as far as I
 remember the only blocker is the need for a top-level device. I wonder
 if perhaps this could be made to work by binding the master to the top-
 level SoC device.

 Obviously adding the node in DT is easier, but to my knowledge easy has
 never been a good excuse for mangling DT. Perhaps that's different these
 days...

 I agree we should avoid the virtual node if possible. It is certainly
 possible as I started out with one and removed it. At least in my
 case, it essentially required the drm_device and crtc to be a single
 driver rather than 2 components. However, I'm more concerned that we
 are consistent from platform to platform where it makes sense than
 whether we have a somewhat questionable node or not.

 http://lists.freedesktop.org/archives/dri-devel/2013-July/041159.html

 So can we at least have some continuity of decision making,
 bikeshedding this every time we submit a driver isn't giving me any
 hope going forward.

As I said, whether we have a virtual node or not is a minor part of
having some consistency in bindings and was the only part Grant
discussed. We have though diverged from the specific problems with
this binding which is that it invents yet another way to describe the
relationship between components. The use of DRM 

Re: [PATCH v10 1/5] mtd: nand: vf610_nfc: Freescale NFC for VF610, MPC5125 and others

2015-08-26 Thread Stefan Agner
On 2015-08-25 13:34, Brian Norris wrote:
 One more thing...
 
 On Mon, Aug 03, 2015 at 11:27:26AM +0200, Stefan Agner wrote:
 --- /dev/null
 +++ b/drivers/mtd/nand/vf610_nfc.c
 @@ -0,0 +1,645 @@
 ...
 +struct vf610_nfc {
 +struct mtd_info mtd;
 +struct nand_chip chip;
 +struct device *dev;
 +void __iomem *regs;
 +struct completion cmd_done;
 +uint buf_offset;
 +int page_sz;
 
 AFAICT (even with the 2nd patch), you never really use this field. You
 just set it/increment it, but don't use it for anything. Kill it?

It is used in the write path, I think I meant to use it for subpage
writes, when I thought it would just mean to transfer only parts of the
page to the controller.

However, as the subpage discussion basically concluded in not using it
for now on this controller, we can as well transfer the complete page
(page_sz). Or is there another case in which vf610_nfc_write_buf could
be called with less than page_sz?

--
Stefan
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v10 2/5] mtd: nand: vf610_nfc: add hardware BCH-ECC support

2015-08-26 Thread Brian Norris
On Wed, Aug 26, 2015 at 10:57:38AM -0700, Stefan Agner wrote:
 On 2015-08-25 12:54, Brian Norris wrote:
  On Mon, Aug 03, 2015 at 11:28:43AM +0200, Stefan Agner wrote:
  Btw, if the ECC check fails, the controller seems kind of count the
  amount of bitflips. It works for most devices reliable, but we had
  devices for which that number was not accurate, see:
  http://thread.gmane.org/gmane.linux.ports.arm.kernel/357439
  
  I'm a little confused there. Why would you be expecting to get a count
  of bitflips, when the ECC engine can't correct all errors? How is it
  supposed to know what the right data is if the bit errors are beyond
  the correction strength?
 
 When printing the ECC error count on ECC fail when reading an erased
 NAND flash, the numbers of bit flips (stuck at zero) seem to widely
 correlate with the number returned by the controller. While it seems to
 correlate widely, there are exceptions, as discussed in the thread:
 http://thread.gmane.org/gmane.linux.ports.arm.kernel/295424
 
 Maybe this is an artifact of the ECC algorithm we just can't/shouldn't
 rely on? I am not sure where this originated, I did not found any
 indication in the reference manual about what that value contains in the
 error case.

Doesn't sound too reliable to me. And I'm not sure even if it was
reliable, that it would provide much value. We have to a lot of
re-counting anyway, so we might as well just be using our own threshold.
Or maybe I'm missing the point.

 Bill, do you have an idea why we used that value as threshold in early
 implementations?
 
 Otherwise I also think we should just drop the use of this value.

Brian
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 4/5] ARM: multi_v7_defconfig: Add NSP to defconfig

2015-08-26 Thread Jon Mason
Add the Broadcom Northstar Plus SoC to the multi_v7_defconfig

Signed-off-by: Jon Mason jonma...@broadcom.com
---
 arch/arm/configs/multi_v7_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/multi_v7_defconfig 
b/arch/arm/configs/multi_v7_defconfig
index 5fd8df6..3fd46f7 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -25,6 +25,7 @@ CONFIG_SOC_SAMA5D3=y
 CONFIG_SOC_SAMA5D4=y
 CONFIG_ARCH_BCM=y
 CONFIG_ARCH_BCM_CYGNUS=y
+CONFIG_ARCH_BCM_NSP=y
 CONFIG_ARCH_BCM_21664=y
 CONFIG_ARCH_BCM_281XX=y
 CONFIG_ARCH_BCM_5301X=y
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 3/5] ARM: NSP: Add basic support for Broadcom Northstar Plus SoC

2015-08-26 Thread Jon Mason
Broadcom Northstar Plus family of SoCs are used for switching
control and management applications as well as residential
router/gateway applications. The SoC features dual core Cortex
A9 ARM CPUs, integrating several peripheral interfaces including
multiple Gigabit Ethernet PHYs, DDR3 memory, PCIE Gen-2, USB 2.0
and USB 3.0, serial and NAND flash, SATA and several other IO
controllers.

Signed-off-by: Kapil Hali kap...@broadcom.com
Signed-off-by: Jon Mason jonma...@broadcom.com
---
 arch/arm/mach-bcm/Kconfig   | 14 ++
 arch/arm/mach-bcm/Makefile  |  5 -
 arch/arm/mach-bcm/bcm_nsp.c | 25 +
 3 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-bcm/bcm_nsp.c

diff --git a/arch/arm/mach-bcm/Kconfig b/arch/arm/mach-bcm/Kconfig
index 0ac9e4b3..22c85b1 100644
--- a/arch/arm/mach-bcm/Kconfig
+++ b/arch/arm/mach-bcm/Kconfig
@@ -35,6 +35,20 @@ config ARCH_BCM_CYGNUS
  BCM11300, BCM11320, BCM11350, BCM11360,
  BCM58300, BCM58302, BCM58303, BCM58305.
 
+config ARCH_BCM_NSP
+   bool Broadcom Northstar Plus SoC Support if ARCH_MULTI_V7
+   select ARCH_BCM_IPROC
+   select ARM_ERRATA_754322
+   select ARM_ERRATA_775420
+   help
+ Support for Broadcom Northstar Plus SoC.
+ Broadcom Northstar Plus family of SoCs are used for switching control
+ and management applications as well as residential router/gateway
+ applications. The SoC features dual core Cortex A9 ARM CPUs,
+ integrating several peripheral interfaces including multiple Gigabit
+ Ethernet PHYs, DDR3 memory, PCIE Gen-2, USB 2.0 and USB 3.0, serial 
and
+ NAND flash, SATA and several other IO controllers.
+
 config ARCH_BCM_5301X
bool Broadcom BCM470X / BCM5301X ARM SoC if ARCH_MULTI_V7
select ARCH_BCM_IPROC
diff --git a/arch/arm/mach-bcm/Makefile b/arch/arm/mach-bcm/Makefile
index 4fb0da4..786d720 100644
--- a/arch/arm/mach-bcm/Makefile
+++ b/arch/arm/mach-bcm/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2012-2014 Broadcom Corporation
+# Copyright (C) 2012-2015 Broadcom Corporation
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License as
@@ -13,6 +13,9 @@
 # Cygnus
 obj-$(CONFIG_ARCH_BCM_CYGNUS) +=  bcm_cygnus.o
 
+# Northstar Plus
+obj-$(CONFIG_ARCH_BCM_NSP) += bcm_nsp.o
+
 # BCM281XX
 obj-$(CONFIG_ARCH_BCM_281XX)   += board_bcm281xx.o
 
diff --git a/arch/arm/mach-bcm/bcm_nsp.c b/arch/arm/mach-bcm/bcm_nsp.c
new file mode 100644
index 000..a1101a3
--- /dev/null
+++ b/arch/arm/mach-bcm/bcm_nsp.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2015 Broadcom Corporation
+ *
+ * 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 version 2.
+ *
+ * This program is distributed as is WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include asm/mach/arch.h
+
+static const char *const bcm_nsp_dt_compat[] __initconst = {
+   brcm,nsp,
+   NULL,
+};
+
+DT_MACHINE_START(NSP_DT, Broadcom Northstar Plus SoC)
+   .l2c_aux_val= 0,
+   .l2c_aux_mask   = ~0,
+   .dt_compat = bcm_nsp_dt_compat,
+MACHINE_END
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 5/5] MAINTAINERS: add entry for the Broadcom Northstar Plus SoCs

2015-08-26 Thread Jon Mason
Modify the iProc MAINTAINER to cover the Nortstar Plus SoCs, and add me
to the list of people responsible for it.  Since iProc is a family of
SoCs that includes more than just Cygnus (i.e., Northstar (BCM5301X),
Northstar Plus, Northstar 2, and a number of other platforms), remove it
from the title to avoid any future confusion.

Signed-off-by: Jon Mason jonma...@broadcom.com
Acked-by: Scott Branden sbran...@broadcom.com
---
 MAINTAINERS | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index a9ae6c1..4b851f5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2315,19 +2315,27 @@ L:  linux-s...@vger.kernel.org
 S: Supported
 F: drivers/scsi/bnx2i/
 
-BROADCOM CYGNUS/IPROC ARM ARCHITECTURE
+BROADCOM IPROC ARM ARCHITECTURE
 M: Ray Jui r...@broadcom.com
 M: Scott Branden sbran...@broadcom.com
+M: Jon Mason jonma...@broadcom.com
 L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers)
 L: bcm-kernel-feedback-l...@broadcom.com
 T: git git://github.com/broadcom/cygnus-linux.git
 S: Maintained
 N: iproc
 N: cygnus
+N: nsp
 N: bcm9113*
 N: bcm9583*
-N: bcm583*
+N: bcm9585*
+N: bcm9586*
+N: bcm988312
 N: bcm113*
+N: bcm583*
+N: bcm585*
+N: bcm586*
+N: bcm88312
 
 BROADCOM BRCMSTB GPIO DRIVER
 M: Gregory Fong gregory.0...@gmail.com
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 5/6] ARM: dts: qs600: add alias to serial0

2015-08-26 Thread Andy Gross
On Tue, Aug 25, 2015 at 04:46:22PM -0500, Andy Gross wrote:
 On Tue, Aug 18, 2015 at 02:10:27PM +0100, Srinivas Kandagatla wrote:
  This patch add alias node with serial0.
  
  Signed-off-by: Srinivas Kandagatla srinivas.kandaga...@linaro.org
  ---
   arch/arm/boot/dts/qcom-apq8064-cm-qs600.dts | 4 
   1 file changed, 4 insertions(+)
 
 Looks fine.  Applied.

Scratch that.  I dropped it from the patch list due to stephen's set.

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4] qcom: ipq4019: Add basic board/dts support for IPQ4019 SoC

2015-08-26 Thread Varadarajan Narayanan
Add initial dts files and SoC support for IPQ4019

Signed-off-by: Varadarajan Narayanan var...@codeaurora.org
---
All,
Missed linux-arm-msm mailing list last time and
incorrectly versioned the patch as v5.
Kindly excuse.

Changes in v2:
  - Added devicetree bindings documentation

Changes in v3:
  - Split 'gcnt' into a separate patch
  - Added the new entries to Makefiles, Kconfig  board.c in sorted order
  - Used qcom,ipq40xx instead of qcom,ipq40xx-r3pc in board.c

Changes in v4:
  - Removed r3pc dts
  - Removed timer frequency

 arch/arm/boot/dts/qcom-ipq4019.dtsi | 72 +
 1 file changed, 72 insertions(+)
 create mode 100644 arch/arm/boot/dts/qcom-ipq4019.dtsi

diff --git a/arch/arm/boot/dts/qcom-ipq4019.dtsi 
b/arch/arm/boot/dts/qcom-ipq4019.dtsi
new file mode 100644
index 000..668cc84
--- /dev/null
+++ b/arch/arm/boot/dts/qcom-ipq4019.dtsi
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/dts-v1/;
+
+#include skeleton.dtsi
+
+/ {
+   model = Qualcomm Technologies, Inc. IPQ4019;
+   compatible = qcom,ipq4019;
+   interrupt-parent = intc;
+
+   cpus {
+   #address-cells = 1;
+   #size-cells = 0;
+   cpu@0 {
+   device_type = cpu;
+   compatible = arm,cortex-a7;
+   reg = 0x0;
+   };
+
+   cpu@1 {
+   device_type = cpu;
+   compatible = arm,cortex-a7;
+   reg = 0x1;
+   };
+
+   cpu@2 {
+   device_type = cpu;
+   compatible = arm,cortex-a7;
+   reg = 0x2;
+   };
+
+   cpu@3 {
+   device_type = cpu;
+   compatible = arm,cortex-a7;
+   reg = 0x3;
+   };
+   };
+
+   soc {
+   #address-cells = 1;
+   #size-cells = 1;
+   ranges;
+   compatible = simple-bus;
+
+   intc: interrupt-controller@b00 {
+   compatible = qcom,msm-qgic2;
+   interrupt-controller;
+   #interrupt-cells = 3;
+   reg = 0x0b00 0x1000,
+   0x0b002000 0x1000;
+   };
+
+   serial@78b {
+   compatible = qcom,msm-uartdm-v1.4, qcom,msm-uartdm;
+   reg = 0x78b 0x200;
+   interrupts = 0 108 0;
+   status = disabled;
+   };
+   };
+};
-- 
1.8.2.1

--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   >