1. 04 3月, 2014 1 次提交
  2. 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
  3. 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
  4. 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
  5. 15 2月, 2014 2 次提交
    • F
      net: of_mdio: fix of_set_phy_supported after driver probing · ce11c436
      Florian Fainelli 提交于
      Commit 8fdade4b ("net: of_mdio: parse "max-speed" property to set PHY
      supported features") introduced a typo in of_set_phy_supported for the
      first assignment of phydev->supported which will not effectively limit
      the PHY device supported features bits if the PHY driver contains
      "higher" features (e.g: max-speed = <100> and PHY driver has
      PHY_GBIT_FEATURES set).
      
      Fix this by making sure that the very first thing is to reset to sane
      defaults (PHY_BASIC_FEATURES) and then progressively add speed features
      as we parse them.
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ce11c436
    • K
      Revert "OF: base: match each node compatible against all given matches first" · 4e8ca6ee
      Kevin Hao 提交于
      This reverts commit 10535314.
      Stephen Chivers reported this is broken as we will get a match
      entry '.type = "serial"' instead of the '.compatible = "ns16550"'
      in the following scenario:
      	serial0: serial@4500 {
      		compatible = "fsl,ns16550", "ns16550";
      	}
      
      	struct of_device_id of_platform_serial_table[] = {
      		{ .compatible = "ns8250",   .data = (void *)PORT_8250, },
      		{ .compatible = "ns16450",  .data = (void *)PORT_16450, },
      		{ .compatible = "ns16550a", .data = (void *)PORT_16550A, },
      		{ .compatible = "ns16550",  .data = (void *)PORT_16550, },
      		{ .compatible = "ns16750",  .data = (void *)PORT_16750, },
      		{ .compatible = "ns16850",  .data = (void *)PORT_16850, },
      		...
      		{ .type = "serial",         .data = (void *)PORT_UNKNOWN, },
      		{ /* end of list */ },
      	};
      
      So just revert this patch, we will use another implementation to find
      the best compatible match in a follow-on patch.
      Reported-by: NStephen N Chivers <schivers@csc.com.au>
      Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
      Signed-off-by: NKevin Hao <haokexin@gmail.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      4e8ca6ee
  6. 05 2月, 2014 3 次提交
  7. 03 2月, 2014 2 次提交
  8. 17 1月, 2014 2 次提交
    • Z
      platform: introduce OF style 'modalias' support for platform bus · b9f73067
      Zhang Rui 提交于
      Fix a problem that, the platform bus supports the OF style modalias
      in .uevent() call, but not in its device 'modalias' sysfs attribute.
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      b9f73067
    • X
      of: Fix __of_device_is_available check · 42ccd781
      Xiubo Li 提交于
      From IEEE 1275, there defined a standard 'status' property indicating the
      operational status of one device. The 'status' property has four possible
      values: 'okay/ok', 'disabled', 'fail' and 'fail-xxx'.
      
      If it is absent, that means the status of the device is unknown or okay.
      
      The __of_device_is_available checks the state of the 'status' property of
      a device. If the property is absent or set to 'okay/ok', it returns 1.
      Otherwise it returns 0.
      
      While in __of_device_is_available:
       >	status = of_get_property(device, "status", &statlen);
       >	if (status == NULL)
       >		return 1;
      The status value returned from 'of_get_property()' will be NULL in two cases:
      Firstly: the 'device' value (device node) is NULL.
      Secondly: the 'status' property is actaully not exist.
      
      If the device node is NULL, the __of_device_is_available will return true,
      that will mean the absent state of the 'status' property.
      
      So this add the device node check before checking the 'status' property's
      state, and if the device node is not exist, 0 will be returned.
      Signed-off-by: NXiubo Li <Li.Xiubo@freescale.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      42ccd781
  9. 14 1月, 2014 2 次提交
  10. 10 1月, 2014 1 次提交
  11. 31 12月, 2013 3 次提交
    • C
      of/irq: Fix device_node refcount in of_irq_parse_raw() · 2f53a713
      Cédric Le Goater 提交于
      Commit 23616132, "of/irq: Refactor interrupt-map parsing" changed
      the refcount on the device_node causing an error in of_node_put():
      
      ERROR: Bad of_node_put() on /pci@800000020000000
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.13.0-rc3-dirty #2
      Call Trace:
      [c00000003e403500] [c0000000000144fc] .show_stack+0x7c/0x1f0 (unreliable)
      [c00000003e4035d0] [c00000000070f250] .dump_stack+0x88/0xb4
      [c00000003e403650] [c0000000005e8768] .of_node_release+0xd8/0xf0
      [c00000003e4036e0] [c0000000005eeafc] .of_irq_parse_one+0x10c/0x280
      [c00000003e4037a0] [c0000000005efd4c] .of_irq_parse_pci+0x3c/0x1d0
      [c00000003e403840] [c000000000038240] .pcibios_setup_device+0xa0/0x2e0
      [c00000003e403910] [c0000000000398f0] .pcibios_setup_bus_devices+0x60/0xd0
      [c00000003e403990] [c00000000003b3a4] .__of_scan_bus+0x1a4/0x2b0
      [c00000003e403a80] [c00000000003a62c] .pcibios_scan_phb+0x30c/0x410
      [c00000003e403b60] [c0000000009fe430] .pcibios_init+0x7c/0xd4
      
      This patch adjusts the refcount in the walk of the interrupt tree.
      When a match is found, there is no need to increase the refcount
      on 'out_irq->np' as 'newpar' is already holding a ref. The refcount
      balance between 'ipar' and 'newpar' is maintained in the skiplevel:
      goto label.
      
      This patch also removes the usage of the device_node variable 'old'
      which seems useless after the latest changes.
      Signed-off-by: NCédric Le Goater <clg@fr.ibm.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      2f53a713
    • G
      5d927086
    • R
      Revert "of/address: Handle #address-cells > 2 specially" · 13fcca8f
      Rob Herring 提交于
      This reverts commit e38c0a1f.
      
      Nikita Yushchenko reports:
      While trying to make freescale p2020ds and  mpc8572ds boards working
      with mainline kernel, I faced that commit e38c0a1f (Handle
      
      Both these boards have uli1575 chip.
      Corresponding part in device tree is something like
      
                      uli1575@0 {
                              reg = <0x0 0x0 0x0 0x0 0x0>;
                              #size-cells = <2>;
                              #address-cells = <3>;
                              ranges = <0x2000000 0x0 0x80000000
                                        0x2000000 0x0 0x80000000
                                        0x0 0x20000000
      
                                        0x1000000 0x0 0x0
                                        0x1000000 0x0 0x0
                                        0x0 0x10000>;
                              isa@1e {
      ...
      
      I.e. it has #address-cells = <3>
      
      With commit e38c0a1f reverted, devices under uli1575 are registered
      correctly, e.g. for rtc
      
      OF: ** translation for device /pcie@ffe09000/pcie@0/uli1575@0/isa@1e/rtc@70 **
      OF: bus is isa (na=2, ns=1) on /pcie@ffe09000/pcie@0/uli1575@0/isa@1e
      OF: translating address: 00000001 00000070
      OF: parent bus is default (na=3, ns=2) on /pcie@ffe09000/pcie@0/uli1575@0
      OF: walking ranges...
      OF: ISA map, cp=0, s=1000, da=70
      OF: parent translation for: 01000000 00000000 00000000
      OF: with offset: 70
      OF: one level translation: 00000000 00000000 00000070
      OF: parent bus is pci (na=3, ns=2) on /pcie@ffe09000/pcie@0
      OF: walking ranges...
      OF: default map, cp=a0000000, s=20000000, da=70
      OF: default map, cp=0, s=10000, da=70
      OF: parent translation for: 01000000 00000000 00000000
      OF: with offset: 70
      OF: one level translation: 01000000 00000000 00000070
      OF: parent bus is pci (na=3, ns=2) on /pcie@ffe09000
      OF: walking ranges...
      OF: PCI map, cp=0, s=10000, da=70
      OF: parent translation for: 01000000 00000000 00000000
      OF: with offset: 70
      OF: one level translation: 01000000 00000000 00000070
      OF: parent bus is default (na=2, ns=2) on /
      OF: walking ranges...
      OF: PCI map, cp=0, s=10000, da=70
      OF: parent translation for: 00000000 ffc10000
      OF: with offset: 70
      OF: one level translation: 00000000 ffc10070
      OF: reached root node
      
      With commit e38c0a1f in place, address translation fails:
      
      OF: ** translation for device /pcie@ffe09000/pcie@0/uli1575@0/isa@1e/rtc@70 **
      OF: bus is isa (na=2, ns=1) on /pcie@ffe09000/pcie@0/uli1575@0/isa@1e
      OF: translating address: 00000001 00000070
      OF: parent bus is default (na=3, ns=2) on /pcie@ffe09000/pcie@0/uli1575@0
      OF: walking ranges...
      OF: ISA map, cp=0, s=1000, da=70
      OF: parent translation for: 01000000 00000000 00000000
      OF: with offset: 70
      OF: one level translation: 00000000 00000000 00000070
      OF: parent bus is pci (na=3, ns=2) on /pcie@ffe09000/pcie@0
      OF: walking ranges...
      OF: default map, cp=a0000000, s=20000000, da=70
      OF: default map, cp=0, s=10000, da=70
      OF: not found !
      
      Thierry Reding confirmed this commit was not needed after all:
      "We ended up merging a different address representation for Tegra PCIe
      and I've confirmed that reverting this commit doesn't cause any obvious
      regressions. I think all other drivers in drivers/pci/host ended up
      copying what we did on Tegra, so I wouldn't expect any other breakage
      either."
      
      There doesn't appear to be a simple way to support both behaviours, so
      reverting this as nothing should be depending on the new behaviour.
      
      Cc: stable@vger.kernel.org # v3.7+
      Signed-off-by: NRob Herring <robh@kernel.org>
      13fcca8f
  12. 11 12月, 2013 1 次提交
  13. 07 12月, 2013 4 次提交
  14. 05 12月, 2013 3 次提交
  15. 09 11月, 2013 1 次提交
  16. 08 11月, 2013 1 次提交
  17. 04 11月, 2013 3 次提交
  18. 31 10月, 2013 2 次提交
  19. 29 10月, 2013 1 次提交
    • G
      of/irq: create interrupts-extended property · 79d97015
      Grant Likely 提交于
      The standard interrupts property in device tree can only handle
      interrupts coming from a single interrupt parent. If a device is wired
      to multiple interrupt controllers, then it needs to be attached to a
      node with an interrupt-map property to demux the interrupt specifiers
      which is confusing. It would be a lot easier if there was a form of the
      interrupts property that allows for a separate interrupt phandle for
      each interrupt specifier.
      
      This patch does exactly that by creating a new interrupts-extended
      property which reuses the phandle+arguments pattern used by GPIOs and
      other core bindings.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Acked-by: NTony Lindgren <tony@atomide.com>
      Acked-by: NKumar Gala <galak@codeaurora.org>
      [grant.likely: removed versatile platform hunks into separate patch]
      Cc: Rob Herring <rob.herring@calxeda.com>
      79d97015
  20. 24 10月, 2013 1 次提交