1. 22 7月, 2017 1 次提交
  2. 16 5月, 2017 1 次提交
    • T
      of: irq: use of_irq_get() in of_irq_to_resource() · 7a4228bb
      Thomas Petazzoni 提交于
      of_irq_to_resource() currently uses irq_of_parse_and_map() to
      translate a DT interrupt specification into a Linux virtual interrupt
      number. While this works in most cases, irq_of_parse_and_map() doesn't
      properly handle the case where the interrupt controller is not yet
      available (due to deferred probing for example).
      
      So instead, use of_irq_get(), which is implemented exactly like
      irq_of_parse_and_map(), with the exception that if the interrupt
      controller is not yet available, it returns -EPROBE_DEFER. Obviously,
      we also handle this error and bail out from of_irq_to_resource() when
      of_irq_get() returns an error.
      
      This allows to avoid silly error messages at boot time caused by
      irq_create_of_mapping() when the interrupt controller is not
      available:
      
      [    0.153168] irq: no irq domain found for /ap806/config-space@f0000000/interrupt-controller@3f0100 !
      [    0.154041] irq: no irq domain found for /cp110-master/config-space@f2000000/interrupt-controller@1e0000 !
      [    0.154124] irq: no irq domain found for /cp110-master/config-space@f2000000/interrupt-controller@1e0000 !
      [    0.154207] irq: no irq domain found for /cp110-master/config-space@f2000000/interrupt-controller@1e0000 !
      [    0.154437] irq: no irq domain found for /cp110-master/config-space@f2000000/interrupt-controller@1e0000 !
      [    0.154518] irq: no irq domain found for /cp110-master/config-space@f2000000/interrupt-controller@1e0000 !
      Signed-off-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      7a4228bb
  3. 05 5月, 2017 1 次提交
    • R
      of: fix sparse warnings in fdt, irq, reserved mem, and resolver code · 17a70355
      Rob Herring 提交于
      sparse generates the following warnings in drivers/of/:
      
      ../drivers/of/fdt.c:63:36: warning: cast to restricted __be32
      ../drivers/of/fdt.c:68:33: warning: cast to restricted __be32
      ../drivers/of/irq.c:105:88: warning: incorrect type in initializer (different base types)
      ../drivers/of/irq.c:105:88:    expected restricted __be32
      ../drivers/of/irq.c:105:88:    got int
      ../drivers/of/irq.c:526:35: warning: incorrect type in assignment (different modifiers)
      ../drivers/of/irq.c:526:35:    expected int ( *const [usertype] irq_init_cb )( ... )
      ../drivers/of/irq.c:526:35:    got void const *const data
      ../drivers/of/of_reserved_mem.c:200:50: warning: incorrect type in initializer (different modifiers)
      ../drivers/of/of_reserved_mem.c:200:50:    expected int ( *[usertype] initfn )( ... )
      ../drivers/of/of_reserved_mem.c:200:50:    got void const *const data
      ../drivers/of/resolver.c:95:42: warning: incorrect type in assignment (different base types)
      ../drivers/of/resolver.c:95:42:    expected unsigned int [unsigned] [usertype] <noident>
      ../drivers/of/resolver.c:95:42:    got restricted __be32 [usertype] <noident>
      
      All these are harmless type mismatches fixed by adjusting the types.
      Signed-off-by: NRob Herring <robh@kernel.org>
      17a70355
  4. 09 1月, 2017 1 次提交
    • G
      of/irq: improve error report on irq discovery process failure · f1aa5484
      Guilherme G. Piccoli 提交于
      On PowerPC machines some PCI slots might not have level triggered
      interrupts capability (also know as level signaled interrupts),
      leading of_irq_parse_pci() to complain by presenting error messages
      on the kernel log - in this case, the properties "interrupt-map" and
      "interrupt-map-mask" are not present on device's node in the device
      tree.
      
      This patch introduces a different message for this specific case,
      and also reduces its level from error to warning. Besides, we warn
      (once) that possibly some PCI slots on the system have no level
      triggered interrupts available.
      We changed some error return codes too on function of_irq_parse_raw()
      in order other failure's cases can be presented in a more precise way.
      
      Before this patch, when an adapter was plugged in a slot without level
      interrupts capabilitiy on PowerPC, we saw a generic error message
      like this:
      
          [54.239] pci 002d:70:00.0: of_irq_parse_pci() failed with rc=-22
      
      Now, with this applied, we see the following specific message:
      
          [16.154] pci 0014:60:00.1: of_irq_parse_pci: no interrupt-map found,
          INTx interrupts not available
      
      Finally, we standardize the error path in of_irq_parse_raw() by always
      taking the fail path instead of returning directly from the loop.
      Signed-off-by: NGuilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      f1aa5484
  5. 19 10月, 2016 1 次提交
  6. 16 9月, 2016 1 次提交
  7. 10 8月, 2016 1 次提交
  8. 19 7月, 2016 1 次提交
  9. 25 6月, 2016 1 次提交
  10. 03 6月, 2016 1 次提交
    • S
      of: irq: fix of_irq_get[_byname]() kernel-doc · 39935466
      Sergei Shtylyov 提交于
      The kernel-doc for the of_irq_get[_byname]()  is clearly inadequate in
      describing the return values -- of_irq_get_byname() is documented better
      than of_irq_get() but it  still doesn't mention that 0 is returned iff
      irq_create_of_mapping() fails (it doesn't return an error code in this
      case). Document all possible return value variants, making the writing
      of the word "IRQ" consistent, while at it...
      
      Fixes: 9ec36caf ("of/irq: do irq resolution in platform_get_irq")
      Fixes: ad69674e ("of/irq: do irq resolution in platform_get_irq_byname()")
      Signed-off-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      CC: stable@vger.kernel.org
      Signed-off-by: NRob Herring <robh@kernel.org>
      39935466
  11. 12 2月, 2016 1 次提交
  12. 26 1月, 2016 1 次提交
    • M
      of: MSI: Simplify irqdomain lookup · 14a0db3c
      Marc Zyngier 提交于
      So far, when trying to associate a device with its MSI domain,
      we first lookup the domain using a MSI token, and if this
      doesn't return anything useful, we pick up any domain matching
      the same node.
      
      This logic is broken for two reasons:
      1) Only the generic MSI code (PCI or platform) sets this token
         to PCI/MSI or platform MSI. So we're guaranteed that if there
         is something to be found, we will find it with the first call.
      2) If we have a convoluted situation where:
         - a single node implements both wired and MSI interrupts
         - MSI support for that HW hasn't been compiled in
         we'll end up using the wired domain for MSIs anyway, and things
         break badly.
      
      So let's just remove __of_get_msi_domain, and replace it by a direct
      call to irq_find_matching_host, because that's what we really want.
      Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
      Acked-by: NRob Herring <robh+dt@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Jiang Liu <jiang.liu@linux.intel.com>
      Link: http://lkml.kernel.org/r/1453816347-32720-3-git-send-email-marc.zyngier@arm.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      14a0db3c
  13. 10 12月, 2015 1 次提交
  14. 09 12月, 2015 1 次提交
  15. 22 10月, 2015 1 次提交
    • J
      of/irq: add missing of_node_put · 8363ccb9
      Julia Lawall 提交于
      for_each_matching_node performs an of_node_get on each iteration, so
      a break out of the loop requires an of_node_put.
      
      A simplified version of the semantic patch that fixes this problem is as
      follows (http://coccinelle.lip6.fr):
      
      // <smpl>
      @@
      local idexpression n;
      expression e;
      identifier l;
      @@
      
       for_each_matching_node(n,...) {
         ...
      (
         of_node_put(n);
      |
         e = n
      |
      +  of_node_put(n);
      ?  goto l;
      )
         ...
       }
      ...
      l: ... when != n
      // </smpl>
      
      Besides the issue found by the semantic patch, this code also stores the
      device_node value in a list, which requires an of_node_get, and then cleans
      up the list on exit from the function, which requires an of_node_put.
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NRob Herring <robh@kernel.org>
      8363ccb9
  16. 16 10月, 2015 5 次提交
  17. 14 10月, 2015 1 次提交
  18. 27 8月, 2015 1 次提交
  19. 30 7月, 2015 1 次提交
  20. 01 7月, 2015 1 次提交
  21. 30 6月, 2015 1 次提交
  22. 19 3月, 2015 1 次提交
  23. 10 11月, 2014 1 次提交
  24. 16 8月, 2014 1 次提交
  25. 23 5月, 2014 1 次提交
    • G
      of/irq: do irq resolution in platform_get_irq_byname() · ad69674e
      Grygorii Strashko 提交于
      The commit 9ec36caf
      "of/irq: do irq resolution in platform_get_irq" from Rob Herring -
      moves resolving of the interrupt resources in platform_get_irq().
      But this solution isn't complete because platform_get_irq_byname()
      need to be modified the same way.
      
      Hence, fix it by adding interrupt resolution code at the
      platform_get_irq_byname() function too.
      
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      ad69674e
  26. 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
  27. 23 4月, 2014 1 次提交
  28. 31 12月, 2013 1 次提交
    • 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
  29. 05 12月, 2013 2 次提交
  30. 08 11月, 2013 1 次提交
  31. 04 11月, 2013 2 次提交
  32. 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
  33. 24 10月, 2013 2 次提交