1. 24 Oct, 2013 7 commits
    • Thierry Reding's avatar
      of/irq: Rework of_irq_count() · 3da52787
      Thierry Reding authored
      The of_irq_to_resource() helper that is used to implement of_irq_count()
      tries to resolve interrupts and in fact creates a mapping for resolved
      interrupts. That's pretty heavy lifting for something that claims to
      just return the number of interrupts requested by a given device node.
      
      Instead, use the more lightweight of_irq_map_one(), which, despite the
      name, doesn't create an actual mapping. Perhaps a better name would be
      of_irq_translate_one().
      Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
      Acked-by: default avatarRob Herring <rob.herring@calxeda.com>
      [grant.likely: fixup s/of_irq_map_one/of_irq_parse_one/]
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      3da52787
    • Grant Likely's avatar
      of: Add testcases for interrupt parsing · a9f10ca7
      Grant Likely authored
      This patch extends the DT selftest code with some test cases for the
      interrupt parsing functions.
      Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      a9f10ca7
    • Grant Likely's avatar
      of: Add helper for printing an of_phandle_args structure · 624cfca5
      Grant Likely authored
      It is sometimes useful for debug to get the contents of an
      of_phandle_args structure out into the kernel log.
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      624cfca5
    • Grant Likely's avatar
      of/irq: Refactor interrupt-map parsing · 23616132
      Grant Likely authored
      All the users of of_irq_parse_raw pass in a raw interrupt specifier from
      the device tree and expect it to be returned (possibly modified) in an
      of_phandle_args structure. However, the primary function of
      of_irq_parse_raw() is to check for translations due to the presence of
      one or more interrupt-map properties. The actual placing of the data
      into an of_phandle_args structure is trivial. If it is refactored to
      accept an of_phandle_args structure directly, then it becomes possible
      to consume of_phandle_args from other sources. This is important for an
      upcoming patch that allows a device to be connected to more than one
      interrupt parent. It also simplifies the code a bit.
      
      The biggest complication with this patch is that the old version works
      on the interrupt specifiers in __be32 form, but the of_phandle_args
      structure is intended to carry it in the cpu-native version. A bit of
      churn was required to make this work. In the end it results in tighter
      code, so the churn is worth it.
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      Acked-by: default avatarTony Lindgren <tony@atomide.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      23616132
    • Grant Likely's avatar
      of/irq: simplify args to irq_create_of_mapping · e6d30ab1
      Grant Likely authored
      All the callers of irq_create_of_mapping() pass the contents of a struct
      of_phandle_args structure to the function. Since all the callers already
      have an of_phandle_args pointer, why not pass it directly to
      irq_create_of_mapping()?
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      Acked-by: default avatarMichal Simek <monstr@monstr.eu>
      Acked-by: default avatarTony Lindgren <tony@atomide.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      e6d30ab1
    • Grant Likely's avatar
      of/irq: Replace of_irq with of_phandle_args · 530210c7
      Grant Likely authored
      struct of_irq and struct of_phandle_args are exactly the same structure.
      This patch makes the kernel use of_phandle_args everywhere. This in
      itself isn't a big deal, but it makes some follow-on patches simpler.
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      Acked-by: default avatarMichal Simek <monstr@monstr.eu>
      Acked-by: default avatarTony Lindgren <tony@atomide.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      530210c7
    • Grant Likely's avatar
      of/irq: Rename of_irq_map_* functions to of_irq_parse_* · 0c02c800
      Grant Likely authored
      The OF irq handling code has been overloading the term 'map' to refer to
      both parsing the data in the device tree and mapping it to the internal
      linux irq system. This is probably because the device tree does have the
      concept of an 'interrupt-map' function for translating interrupt
      references from one node to another, but 'map' is still confusing when
      the primary purpose of some of the functions are to parse the DT data.
      
      This patch renames all the of_irq_map_* functions to of_irq_parse_*
      which makes it clear that there is a difference between the parsing
      phase and the mapping phase. Kernel code can make use of just the
      parsing or just the mapping support as needed by the subsystem.
      
      The patch was generated mechanically with a handful of sed commands.
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      Acked-by: default avatarMichal Simek <monstr@monstr.eu>
      Acked-by: default avatarTony Lindgren <tony@atomide.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      0c02c800
  2. 15 Oct, 2013 4 commits
    • Tomasz Figa's avatar
      of/irq: Pass trigger type in IRQ resource flags · 4a43d686
      Tomasz Figa authored
      Some drivers might rely on availability of trigger flags in IRQ
      resource, for example to configure the hardware for particular interrupt
      type. However current code creating IRQ resources from data in device
      tree does not configure trigger flags in resulting resources.
      
      This patch tries to solve the problem, based on the fact that
      irq_of_parse_and_map() configures the trigger based on DT interrupt
      specifier and IRQD_TRIGGER_* flags are consistent with IORESOURCE_IRQ_*,
      and we can get correct trigger flags by calling irqd_get_trigger_type()
      after mapping the interrupt.
      Signed-off-by: default avatarTomasz Figa <tomasz.figa@gmail.com>
      [grant.likely: Merged the two assignments to r->flags]
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      4a43d686
    • Grant Likely's avatar
      of: Fix dereferencing node name in debug output to be safe · 8804827b
      Grant Likely authored
      Several locations in the of_address and of_irq code dereference the
      full_name parameter from a device_node pointer without checking if the
      pointer is valid.  This patch switches to use of_node_full_name() which
      always checks the pointer.
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      8804827b
    • Grant Likely's avatar
      of: Fix iteration bug over CPU reg properties · f3cea45a
      Grant Likely authored
      The size of each hwid in a cpu nodes 'reg' property is defined by the
      parents #address-cells property in the normal way. The cpu parsing code
      has a bug where it will overrun the end of the property if
      address-cells is greater than one. This commit fixes the problem by
      adjusting the array size by the number of address cells. It also makes
      sure address-cells isn't zero for that would cause an infinite loop.
      
      v2: bail if #address-cells is zero instead of forcing to
          OF_ROOT_NODE_ADDR_CELLS_DEFAULT. Forcing it will cause the reg
          property to be parsed incorrectly.
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      f3cea45a
    • David Miller's avatar
      of: Make cpu node handling more portable. · d1cb9d1a
      David Miller authored
      Use for_each_node_by_type() to iterate all cpu nodes in the
      system.
      
      Provide and overridable function arch_find_n_match_cpu_physical_id,
      which sees if the given device node matches 'cpu' and if so sets
      '*thread' when non-NULL to the cpu thread number within the core.
      
      The default implementation behaves the same as the existing code.
      
      Add a sparc64 implementation.
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Tested-by: default avatarSudeep KarkadaNagesha <Sudeep.KarkadaNagesha@arm.com>
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      d1cb9d1a
  3. 14 Oct, 2013 1 commit
    • Grant Likely's avatar
      of: fix unnecessary warning on missing /cpus node · 444c91e5
      Grant Likely authored
      Not all DT platforms have all the cpus collected under a /cpus node.
      That just happens to be a details of FDT, ePAPR and PowerPC platforms.
      Sparc does something different, but unfortunately the current code
      complains with a warning if /cpus isn't there. This became a problem
      with commit f86e4718, "driver/core cpu: initialize of_node in cpu's
      device structure", which caused the function to get called for all
      architectures.
      
      This commit is a temporary fix to fail silently if the cpus node isn't
      present. A proper fix will come later to allow arch code to provide a
      custom mechanism for decoding the CPU hwid if the 'reg' property isn't
      appropriate.
      Signed-off-by: default avatarGrant Likely <grant.likely@linaro.org>
      Cc: David Miller <davem@davemloft.net>
      Cc: Sudeep KarkadaNagesha <Sudeep.KarkadaNagesha@arm.com>
      Cc: Rob Herring <rob.herring@calxeda.com>
      444c91e5
  4. 13 Oct, 2013 17 commits
  5. 12 Oct, 2013 10 commits
  6. 11 Oct, 2013 1 commit