1. 03 6月, 2014 2 次提交
  2. 30 5月, 2014 3 次提交
  3. 26 5月, 2014 1 次提交
  4. 23 5月, 2014 2 次提交
  5. 17 5月, 2014 1 次提交
    • T
      of: provide a binding for fixed link PHYs · 3be2a49e
      Thomas Petazzoni 提交于
      Some Ethernet MACs have a "fixed link", and are not connected to a
      normal MDIO-managed PHY device. For those situations, a Device Tree
      binding allows to describe a "fixed link" using a special PHY node.
      
      This patch adds:
      
       * A documentation for the fixed PHY Device Tree binding.
      
       * An of_phy_is_fixed_link() function that an Ethernet driver can call
         on its PHY phandle to find out whether it's a fixed link PHY or
         not. It should typically be used to know if
         of_phy_register_fixed_link() should be called.
      
       * An of_phy_register_fixed_link() function that instantiates the
         fixed PHY into the PHY subsystem, so that when the driver calls
         of_phy_connect(), the PHY device associated to the OF node will be
         found.
      
      These two additional functions also support the old fixed-link Device
      Tree binding used on PowerPC platforms, so that ultimately, the
      network device drivers for those platforms could be converted to use
      of_phy_is_fixed_link() and of_phy_register_fixed_link() instead of
      of_phy_connect_fixed_link(), while keeping compatibility with their
      respective Device Tree bindings.
      Signed-off-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Tested-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3be2a49e
  6. 14 5月, 2014 1 次提交
    • T
      of: make of_update_property() usable earlier in the boot process · 582da652
      Thomas Petazzoni 提交于
      Commit 75b57ecf ('of: Make device
      nodes kobjects so they show up in sysfs') has turned Device Tree nodes
      in kobjects and added a sysfs based representation for Device Tree
      nodes. Since the sysfs logic is only available after the execution of
      a core_initcall(), the patch took precautions in of_add_property() and
      of_remove_property() to not do any sysfs related manipulation early in
      the boot process.
      
      However, it forgot to do the same for of_update_property(), which if
      used early in the boot process (before core_initcalls have been
      called), tries to call sysfs_remove_bin_file(), and crashes:
      
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 0 at /home/thomas/projets/linux-2.6/fs/kernfs/dir.c:1216 kernfs_remove_by_name_ns+0x80/0x88()
      kernfs: can not remove '(null)', no directory
      Modules linked in:
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.15.0-rc1-00127-g1d7e7b2-dirty #423
      [<c0014910>] (unwind_backtrace) from [<c00110ec>] (show_stack+0x10/0x14)
      [<c00110ec>] (show_stack) from [<c04c84b8>] (dump_stack+0x84/0x94)
      [<c04c84b8>] (dump_stack) from [<c001d8c0>] (warn_slowpath_common+0x6c/0x88)
      [<c001d8c0>] (warn_slowpath_common) from [<c001d90c>] (warn_slowpath_fmt+0x30/0x40)
      [<c001d90c>] (warn_slowpath_fmt) from [<c0104468>] (kernfs_remove_by_name_ns+0x80/0x88)
      [<c0104468>] (kernfs_remove_by_name_ns) from [<c0394d98>] (of_update_property+0xc0/0xf0)
      [<c0394d98>] (of_update_property) from [<c0647248>] (mvebu_timer_and_clk_init+0xfc/0x194)
      [<c0647248>] (mvebu_timer_and_clk_init) from [<c0640934>] (start_kernel+0x218/0x350)
      [<c0640934>] (start_kernel) from [<00008070>] (0x8070)
      ---[ end trace 3406ff24bd97382e ]---
      Unable to handle kernel NULL pointer dereference at virtual address 0000003c
      pgd = c0004000
      [0000003c] *pgd=00000000
      Internal error: Oops: 5 [#1] SMP ARM
      Modules linked in:
      CPU: 0 PID: 0 Comm: swapper/0 Tainted: G        W     3.15.0-rc1-00127-g1d7e7b2-dirty #423
      task: c10ad4d8 ti: c10a2000 task.ti: c10a2000
      PC is at kernfs_find_ns+0x8/0xf0
      LR is at kernfs_find_and_get_ns+0x30/0x48
      pc : [<c0103834>]    lr : [<c010394c>]    psr: 600001d3
      sp : c10a3f34  ip : 00000073  fp : 00000000
      r10: 00000000  r9 : cfffc240  r8 : cfdf2980
      r7 : cf812c00  r6 : 00000000  r5 : 00000000  r4 : c10b45e0
      r3 : c10ad4d8  r2 : 00000000  r1 : cf812c00  r0 : 00000000
      Flags: nZCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment kernel
      Control: 10c53c7d  Table: 0000404a  DAC: 00000015
      Process swapper/0 (pid: 0, stack limit = 0xc10a2240)
      Stack: (0xc10a3f34 to 0xc10a4000)
      3f20:                                              c10b45e0 00000000 00000000
      3f40: cf812c00 c010394c 00000063 cf812c00 00000001 cf812c00 cfdf29ac c03932cc
      3f60: 00000063 cf812bc0 cfdf29ac cf812c00 ffffffff c03943f8 cfdf2980 c0104468
      3f80: cfdf2a04 cfdf2980 cf812bc0 c06634b0 c10aa3c0 c0394da4 c10f74dc cfdf2980
      3fa0: cf812bc0 c0647248 c10aa3c0 ffffffff c10de940 c10aa3c0 ffffffff c0640934
      3fc0: ffffffff ffffffff c06404ec 00000000 00000000 c06634b0 00000000 10c53c7d
      3fe0: c10aa434 c06634ac c10ae4c8 0000406a 414fc091 00008070 00000000 00000000
      [<c0103834>] (kernfs_find_ns) from [<00000001>] (0x1)
      Code: e5c89001 eaffffcf e92d40f0 e1a06002 (e1d023bc)
      ---[ end trace 3406ff24bd97382f ]---
      Kernel panic - not syncing: Attempted to kill the idle task!
      ---[ end Kernel panic - not syncing: Attempted to kill the idle task!
      
      To fix this problem, we simply skip the sysfs related calls in
      of_update_property(), and rely on of_init() to fix up things when it
      will be called, exactly as is done in of_add_property() and
      of_remove_property().
      Signed-off-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Fixes: 75b57ecf ("of: Make device nodes kobjects so they show up in sysfs")
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      582da652
  7. 25 4月, 2014 1 次提交
    • R
      of/irq: do irq resolution in platform_get_irq · 9ec36caf
      Rob Herring 提交于
      Currently we get the following kind of errors if we try to use interrupt
      phandles to irqchips that have not yet initialized:
      
      irq: no irq domain found for /ocp/pinmux@48002030 !
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171 of_device_alloc+0x144/0x184()
      Modules linked in:
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.12.0-00038-g42a9708 #1012
      (show_stack+0x14/0x1c)
      (dump_stack+0x6c/0xa0)
      (warn_slowpath_common+0x64/0x84)
      (warn_slowpath_null+0x1c/0x24)
      (of_device_alloc+0x144/0x184)
      (of_platform_device_create_pdata+0x44/0x9c)
      (of_platform_bus_create+0xd0/0x170)
      (of_platform_bus_create+0x12c/0x170)
      (of_platform_populate+0x60/0x98)
      
      This is because we're wrongly trying to populate resources that are not
      yet available. It's perfectly valid to create irqchips dynamically, so
      let's fix up the issue by resolving the interrupt resources when
      platform_get_irq is called.
      
      And then we also need to accept the fact that some irqdomains do not
      exist that early on, and only get initialized later on. So we can
      make the current WARN_ON into just into a pr_debug().
      
      We still attempt to populate irq resources when we create the devices.
      This allows current drivers which don't use platform_get_irq to continue
      to function. Once all drivers are fixed, this code can be removed.
      Suggested-by: NRussell King <linux@arm.linux.org.uk>
      Signed-off-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Tested-by: NTony Lindgren <tony@atomide.com>
      Cc: stable@vger.kernel.org # v3.10+
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      9ec36caf
  8. 24 4月, 2014 1 次提交
  9. 23 4月, 2014 1 次提交
  10. 16 4月, 2014 1 次提交
  11. 15 4月, 2014 1 次提交
    • X
      of: Fix the section mismatch warnings. · 5b624118
      Xiubo Li 提交于
      In tag next-20140407, building with CONFIG_DEBUG_SECTION_MISMATCH
      enabled, the following WARNING is occured:
      
      WARNING: drivers/built-in.o(.text.unlikely+0x2220): Section mismatch
      in reference from the function __reserved_mem_check_root() to the
      function .init.text:of_get_flat_dt_prop()
      The function __reserved_mem_check_root() references
      the function __init of_get_flat_dt_prop().
      This is often because __reserved_mem_check_root lacks a __init
      annotation or the annotation of of_get_flat_dt_prop is wrong.
      
      WARNING: vmlinux.o(.text.unlikely+0xb9d0): Section mismatch in reference
      from the function __reserved_mem_check_root() to the (unknown reference)
      .init.data:(unknown)
      The function __reserved_mem_check_root() references
      the (unknown reference) __initdata (unknown).
      This is often because __reserved_mem_check_root lacks a __initdata
      annotation or the annotation of (unknown) is wrong.
      
      This is cause by :
      'drivers: of: add initialization code for dynamic reserved memory'.
      Signed-off-by: NXiubo Li <Li.Xiubo@freescale.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      5b624118
  12. 28 3月, 2014 1 次提交
  13. 21 3月, 2014 1 次提交
  14. 19 3月, 2014 1 次提交
    • P
      of: device_node kobject lifecycle fixes · 0829f6d1
      Pantelis Antoniou 提交于
      After the move to having device nodes be proper kobjects the lifecycle
      of the node needs to be controlled better.
      
      At first convert of_add_node() in the unflattened functions to
      of_init_node() which initializes the kobject so that of_node_get/put
      work correctly even before of_init is called.
      
      Afterwards introduce of_node_is_initialized & of_node_is_attached that
      query the underlying kobject about the state (attached means kobj
      is visible in sysfs)
      
      Using that make sure the lifecycle of the tree is correct at all
      times.
      Signed-off-by: NPantelis Antoniou <panto@antoniou-consulting.com>
      [grant.likely: moved of_node_init() calls, fixed up locking, and
                     dropped __of_populate() hunks]
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      0829f6d1
  15. 15 3月, 2014 1 次提交
  16. 12 3月, 2014 6 次提交
    • G
      of: remove /proc/device-tree · 8357041a
      Grant Likely 提交于
      The same data is now available in sysfs, so we can remove the code
      that exports it in /proc and replace it with a symlink to the sysfs
      version.
      
      Tested on versatile qemu model and mpc5200 eval board. More testing
      would be appreciated.
      
      v5: Fixed up conflicts with mainline changes
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
      Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
      8357041a
    • G
      of/selftest: Add self tests for manipulation of properties · 7e66c5c7
      Grant Likely 提交于
      Adds a few simple test cases to ensure that addition, update and removal
      of device tree node properties works correctly.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
      Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
      7e66c5c7
    • G
      of: Make device nodes kobjects so they show up in sysfs · 75b57ecf
      Grant Likely 提交于
      Device tree nodes are already treated as objects, and we already want to
      expose them to userspace which is done using the /proc filesystem today.
      Right now the kernel has to do a lot of work to keep the /proc view in
      sync with the in-kernel representation. If device_nodes are switched to
      be kobjects then the device tree code can be a whole lot simpler. It
      also turns out that switching to using /sysfs from /proc results in
      smaller code and data size, and the userspace ABI won't change if
      /proc/device-tree symlinks to /sys/firmware/devicetree/base.
      
      v7: Add missing sysfs_bin_attr_init()
      v6: Add __of_add_property() early init fixes from Pantelis
      v5: Rename firmware/ofw to firmware/devicetree
          Fix updating property values in sysfs
      v4: Fixed build error on Powerpc
          Fixed handling of dynamic nodes on powerpc
      v3: Fixed handling of duplicate attribute and child node names
      v2: switch to using sysfs bin_attributes which solve the problem of
          reporting incorrect property size.
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Tested-by: NSascha Hauer <s.hauer@pengutronix.de>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>
      Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
      75b57ecf
    • M
      drivers: of: add support for custom reserved memory drivers · f618c470
      Marek Szyprowski 提交于
      Add support for custom reserved memory drivers. Call their init() function
      for each reserved region and prepare for using operations provided by them
      with by the reserved_mem->ops array.
      
      Based on previous code provided by Josh Cartwright <joshc@codeaurora.org>
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      f618c470
    • M
      drivers: of: add initialization code for dynamic reserved memory · 3f0c8206
      Marek Szyprowski 提交于
      This patch adds support for dynamically allocated reserved memory regions
      declared in device tree. Such regions are defined by 'size', 'alignment'
      and 'alloc-ranges' properties.
      
      Based on previous code provided by Josh Cartwright <joshc@codeaurora.org>
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      3f0c8206
    • M
      drivers: of: add initialization code for static reserved memory · e8d9d1f5
      Marek Szyprowski 提交于
      This patch adds support for static (defined by 'reg' property) reserved
      memory regions declared in device tree.
      
      Memory blocks can be reliably reserved only during early boot. This must
      happen before the whole memory management subsystem is initialized,
      because we need to ensure that the given contiguous blocks are not yet
      allocated by kernel. Also it must happen before kernel mappings for the
      whole low memory are created, to ensure that there will be no mappings
      (for reserved blocks). Typically, all this happens before device tree
      structures are unflattened, so we need to get reserved memory layout
      directly from fdt.
      
      Based on previous code provided by Josh Cartwright <joshc@codeaurora.org>
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      e8d9d1f5
  17. 11 3月, 2014 1 次提交
  18. 07 3月, 2014 5 次提交
  19. 04 3月, 2014 1 次提交
  20. 20 2月, 2014 4 次提交
    • G
      of: Allows to use the PCI translator without the PCI core · 25a31579
      Gregory CLEMENT 提交于
      Translating an address from a PCI node of the device-tree into a CPU
      physical address doesn't require the core PCI support. Those
      translations are just related to the device tree itself.
      
      The use case to translate an address from a PCI node without actually
      using the PCI core support is when one needs to access the PCI
      controller without accessing any PCI devices.
      
      Marvell SoCs, such as Kirkwood, Dove or Armada XP for instance, come
      with an IP of a PCI controller. In the registers of this controller
      are stored the ID and the revision of a SoC. With this patch it will
      be possible to read the SoC ID of a board without any PCI device and
      then without the PCI core support.
      Signed-off-by: NGregory CLEMENT <gregory.clement@free-electrons.com>
      Tested-by: NEzequiel Garcia <ezequiel.garcia@free-electrons.com>
      Reviewed-by: NEzequiel Garcia <ezequiel.garcia@free-electrons.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      25a31579
    • G
      of: Add self test for of_match_node() · 1f42e5dd
      Grant Likely 提交于
      Adds a selftest function for the of_match_node function. of_match_node
      is supposed to handle precedence for the compatible property as well as
      the name and device_type values. This patch adds some test case data and
      a function that makes sure each test node matches against the correct
      entry of an of_device_id table.
      
      This code was written to verify the new of_match_node() implementation
      that is an earlier part of this series.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Cc: Kevin Hao <haokexin@gmail.com>
      1f42e5dd
    • G
      of: Move testcase FDT data into drivers/of · b5190516
      Grant Likely 提交于
      The testcase data is usable by any platform. This patch moves it into
      the drivers/of directory so it can be included by any architecture.
      
      Using the test cases requires manually adding #include <testcases.dtsi>
      to the end of the boards .dtsi file and enabling CONFIG_OF_SELFTEST. Not
      pretty though. A useful project would be to make the testcase code
      easier to execute.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      b5190516
    • K
      of: reimplement the matching method for __of_match_node() · 215a14cf
      Kevin Hao 提交于
      In the current implementation of __of_match_node(), it will compare
      each given match entry against all the node's compatible strings
      with of_device_is_compatible().
      
      To achieve multiple compatible strings per node with ordering from
      specific to generic, this requires given matches to be ordered from
      specific to generic. For most of the drivers this is not true and
      also an alphabetical ordering is more sane there.
      
      Therefore, we define a following priority order for the match, and
      then scan all the entries to find the best match.
        1. specific compatible && type && name
        2. specific compatible && type
        3. specific compatible && name
        4. specific compatible
        5. general compatible && type && name
        6. general compatible && type
        7. general compatible && name
        8. general compatible
        9. type && name
        10. type
        11. name
      
      v5: Fix nested locking bug
      v4: Short-circuit failure cases instead of mucking with score, and
          remove extra __of_device_is_compatible() wrapper stub.
          Move scoring logic directly into __of_device_is_compatible()
      v3: Also need to bail out when there does have a compatible member in match
          entry, but it doesn't match with the device node's compatible.
      v2: Fix the bug such as we get the same score for the following two match
          entries with the empty node 'name2 { };'
      	struct of_device_id matches[] = {
      		{.name = "name2", },
      		{.name = "name2", .type = "type1", },
      		{}
      	};
      Signed-off-by: NKevin Hao <haokexin@gmail.com>
      [grant.likely: added v4 changes]
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Tested-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Tested-by: NStephen Chivers <schivers@csc.com>
      Tested-by: NSachin Kamat <sachin.kamat@linaro.org>
      215a14cf
  21. 19 2月, 2014 2 次提交
    • B
      of_mdio: fix phy interrupt passing · f15c586d
      Ben Dooks 提交于
      The of_mdiobus_register_phy() is not setting phy->irq thus causing
      some drivers to incorrectly assume that the PHY does not have an
      IRQ associated with it. Not only do some drivers report no IRQ
      they do not install an interrupt handler for the PHY.
      
      Simplify the code setting irq and set the phy->irq at the same
      time so that we cover the following issues, which should cover
      all the cases the code will find:
      
      - Set phy->irq if node has irq property and mdio->irq is NULL
      - Set phy->irq if node has no irq and mdio->irq is not NULL
      - Leave phy->irq as PHY_POLL default if none of the above
      
      This fixes the issue:
       net eth0: attached PHY 1 (IRQ -1) to driver Micrel KSZ8041RNLI
      
      to the correct:
       net eth0: attached PHY 1 (IRQ 416) to driver Micrel KSZ8041RNLI
      Signed-off-by: NBen Dooks <ben.dooks@codethink.co.uk>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f15c586d
    • K
      Revert "of: search the best compatible match first in __of_match_node()" · 71c5498e
      Kevin Hao 提交于
      This reverts commit 06b29e76.
      As pointed out by Grant Likely, we should also take the type and name
      into account when searching the best compatible match. That means the
      match with compatible, type and name should be better than the match
      just with the same compatible string. So revert this and we will
      implement another method to find the best match entry.
      Signed-off-by: NKevin Hao <haokexin@gmail.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      71c5498e
  22. 16 2月, 2014 1 次提交
    • K
      of: search the best compatible match first in __of_match_node() · 06b29e76
      Kevin Hao 提交于
      Currently, of_match_node compares each given match against all node's
      compatible strings with of_device_is_compatible.
      
      To achieve multiple compatible strings per node with ordering from
      specific to generic, this requires given matches to be ordered from
      specific to generic. For most of the drivers this is not true and also
      an alphabetical ordering is more sane there.
      
      Therefore, this patch introduces a function to match each of the node's
      compatible strings against all given compatible matches without type and
      name first, before checking the next compatible string. This implies
      that node's compatibles are ordered from specific to generic while
      given matches can be in any order. If we fail to find such a match
      entry, then fall-back to the old method in order to keep compatibility.
      
      Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
      Signed-off-by: NKevin Hao <haokexin@gmail.com>
      Tested-by: NStephen Chivers <schivers@csc.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      06b29e76
  23. 15 2月, 2014 1 次提交