1. 08 9月, 2012 1 次提交
    • V
      ARM: OMAP: omap_device: Do not overwrite resources allocated by OF layer · b82b04e8
      Vaibhav Hiremath 提交于
      With the new devices (like, AM33XX and OMAP5) we now only support
      DT boot mode of operation and now it is the time to start killing
      slowly the dependency on hwmod, so with this patch, we are starting
      with device resources.
      The idea here is implemented considering to both boot modes -
        - DT boot mode
          OF framework will construct the resource structure (currently
          does for MEM & IRQ resource) and we should respect/use these
          resources, killing hwmod dependency.
          If pdev->num_resources > 0, we assume that MEM & IRQ resources
          have been allocated by OF layer already (through DTB).
      
          Once DMA resource is available from OF layer, we should
          kill filling any resources from hwmod.
      
        - Non-DT boot mode
          Here, pdev->num_resources = 0, and we should get all the
          resources from hwmod (following existing steps)
      Signed-off-by: NVaibhav Hiremath <hvaibhav@ti.com>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Paul Walmsley <paul@pwsan.com>
      Cc: Kevin Hilman <khilman@ti.com>
      [b-cousson@ti.com: Fix some checkpatch CHECK issues]
      Signed-off-by: NBenoit Cousson <b-cousson@ti.com>
      b82b04e8
  2. 06 9月, 2012 1 次提交
    • P
      ARM: OMAP: omap_device: Fix up resource names when booted with devicetree · 3956a1a0
      Peter Ujfalusi 提交于
      When booted with some resource will have their name set to NULL. This can
      cause later kernel crash since this is not expected by the platform code.
      
      When we boot without DT the devices are created with platform_device_add()
      which itself fixes up the missing resource names:
      if (r->name == NULL)
      	r->name = dev_name(&pdev->dev);
      
      The of core also fixes up the resource names when taking the information
      from DT data - in __of_address_to_resource():
      r->name = name ? name : dev->full_name;
      
      When we boot OMAP with devicetree: of will create the devices based on the
      DT data so the resource names are guarantied to be not NULL. Since we have
      the 'ti,hwmod' tag, we remove the of created resources from the device and
      re-create them based on hwmod data. If the hwmod data does not specify a
      name for a resource it will be NULL.
      This can cause kernel crash if the driver uses
      platform_get_resource_byname() to get any resource.
      Signed-off-by: NPeter Ujfalusi <peter.ujfalusi@ti.com>
      [b-cousson@ti.com: Change omap_hwmod to omap_device in subject]
      Signed-off-by: NBenoit Cousson <b-cousson@ti.com>
      3956a1a0
  3. 18 4月, 2012 1 次提交
    • P
      ARM: OMAP2+: clean up some cppcheck warnings · eeb3711b
      Paul Walmsley 提交于
      Resolve some warnings identified by cppcheck in arch/arm/mach-omap2:
      
          [arch/arm/mach-omap2/usb-tusb6010.c:129]: (style) Checking if unsigned variable 'tmp' is less than zero.
          [arch/arm/mach-omap2/prm_common.c:241]: (error) Possible null pointer dereference: irq_setup - otherwise it is redundant to check if irq_setup is null at line 247
          [arch/arm/mach-omap2/pm34xx.c:790]: (style) Variable 'per_clkdm' is assigned a value that is never used
          [arch/arm/mach-omap2/pm34xx.c:790]: (style) Variable 'core_clkdm' is assigned a value that is never used
          [arch/arm/mach-omap2/pm24xx.c:185]: (style) Variable 'only_idle' is assigned a value that is never used
          [arch/arm/mach-omap2/mux.c:254]: (error) Possible null pointer dereference: mux
          [arch/arm/mach-omap2/mux.c:258]: (error) Possible null pointer dereference: mux
          [arch/arm/mach-omap2/gpmc-onenand.c:178]: (style) Variable 'tick_ns' is assigned a value that is never used
          [arch/arm/mach-omap2/gpio.c:56]: (error) Possible null pointer dereference: pdata - otherwise it is redundant to check if pdata is null at line 57
          [arch/arm/mach-omap2/devices.c:45]: (style) Variable 'l' is assigned a value that is never used
          [arch/arm/mach-omap2/board-omap3evm.c:641] -> [arch/arm/mach-omap2/board-omap3evm.c:639]: (style) Found duplicate branches for if and else.
          [arch/arm/mach-omap2/am35xx-emac.c:95]: (style) Variable 'regval' is assigned a value that is never used
          [arch/arm/mach-omap2/devices.c:74]: (style) Variable 'l' is assigned a value that is never used
          [arch/arm/mach-omap2/pm34xx.c:277]: (style) Variable 'per_prev_state' is assigned a value that is never used
          [arch/arm/plat-omap/dmtimer.c:352]: (error) Possible null pointer dereference: timer - otherwise it is redundant to check if timer is null at line 354
          [arch/arm/plat-omap/omap_device.c:478]: (style) Variable 'c' is assigned a value that is never used
          [arch/arm/plat-omap/usb.c:42]: (style) Variable 'status' is assigned a value that is never used
          [arch/arm/mach-omap1/clock.c:197]: (style) Variable 'dpll1_rate' is assigned a value that is never used
          [arch/arm/mach-omap1/lcd_dma.c:60]: (style) struct or union member 'lcd_dma_info::size' is never used
          [arch/arm/mach-omap1/pm.c:572]: (style) Variable 'entry' is assigned a value that is never used
      
      Some of them are pretty good catches, such as gpio.c:56 and
      usb-tusb6010.c:129.
      
      Thanks to Jarkko Nikula for some comments on the sscanf() warnings.
      It seems that the kernel sscanf() ignores the field width anyway for the
      %d format, so those changes have been dropped from this second version.
      
      Thanks to Daniel Marjamäki <daniel.marjamaki@gmail.com> for pointing
      out that a variable was unnecessarily marked static in the
      board-omap3evm.c change.
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      Cc: Felipe Balbi <balbi@ti.com>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Kevin Hilman <khilman@ti.com>
      Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
      Cc: Jarkko Nikula <jarkko.nikula@bitmer.com>
      Cc: Charulatha Varadarajan <charu@ti.com>
      Cc: Daniel Marjamäki <daniel.marjamaki@gmail.com>
      Cc: Tarun Kanti DebBarma <tarun.kanti@ti.com>
      Reviewed-by: Charulatha Varadarajan <charu@ti.com> # for gpio.c
      eeb3711b
  4. 06 3月, 2012 2 次提交
    • P
      ARM: OMAP2+: omap_device: call all suspend, resume callbacks when... · b7c39a3f
      Paul Walmsley 提交于
      ARM: OMAP2+: omap_device: call all suspend, resume callbacks when OMAP_DEVICE_NO_IDLE_ON_SUSPEND is set
      
      During system suspend, when OMAP_DEVICE_NO_IDLE_ON_SUSPEND is set on
      an omap_device, call the corresponding driver's ->suspend() and
      ->suspend_noirq() callbacks (if present).  Similarly, during resume,
      the driver's ->resume() and ->resume_noirq() callbacks must both be
      called, if present.  (The previous code only called ->suspend_noirq()
      and ->resume_noirq().)
      
      If all of these callbacks aren't called, some important driver
      suspend/resume code may not get executed.
      
      In current mainline, the bug fixed by this patch is only a problem
      under the following conditions:
      
      - the kernel is running on an OMAP4
      
      - an OMAP UART is used as a console
      
      - the kernel command line parameter 'no_console_suspend' is specified
      
      - and the system enters suspend ("echo mem > /sys/power/state").
      
      Under this combined circumstance, the system cannot be awakened via
      the serial port after commit be4b0281c
      ("tty: serial: OMAP: block idle while the UART is transferring data in
      PIO mode").  This is because the OMAP UART driver's ->suspend()
      callback is never called.  The ->suspend() callback would have called
      uart_suspend_port() which in turn would call enable_irq_wake().  Since
      enable_irq_wake() isn't called for the UART's IRQ, check_wakeup_irqs()
      would mask off the UART IRQ in the GIC.
      
      On v3.3 kernels prior to the above commit, serial resume from suspend
      presumably occurred via the PRCM interrupt.  The UART was in
      smart-idle mode, so it was able to send a PRCM wakeup which in turn
      would be converted into a PRCM interrupt to the GIC, waking up the
      kernel.  But after the above commit, when the system is suspended in
      the middle of a UART transmit, the UART IP block would be in no-idle
      mode.  In no-idle mode, the UART won't generate wakeups to the PRCM
      when incoming characters are received; only GIC interrupts.  But since
      the UART driver's ->suspend() callback is never called,
      uart_suspend_port() and enable_irq_wake() is never called; so the UART
      interrupt is masked by check_wakeup_irqs() and the UART can't wake up
      the MPU.
      
      The remaining mechanism that could have awakened the system would have
      been I/O chain wakeups.  These wouldn't be active because the console
      UART's clocks are never disabled when no_console_suspend is used,
      preventing the full chip from idling.  Also, current mainline doesn't
      yet support full chip idle states for OMAP4, so I/O chain wakeups are
      not enabled.
      
      This patch is the result of a collaboration.  John Stultz
      <johnstul@us.ibm.com> and Andy Green <andy.green@linaro.org> reported
      the serial wakeup problem that led to the discovery of this problem.
      Kevin Hilman <khilman@ti.com> narrowed the problem down to the use of
      no_console_suspend.
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      Cc: John Stultz <johnstul@us.ibm.com>
      Cc: Andy Green <andy.green@linaro.org>
      Reviewed-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      b7c39a3f
    • K
      ARM: OMAP: omap_device: remove omap_device_parent · 3ec2decb
      Kevin Hilman 提交于
      Currently all omap_devices are forced to have the dummy device
      'omap_device_parent' as a parent.  This was used to distinguish
      omap_devices from "normal" platform_devices in the OMAP PM core code.
      
      Now that we implement the PM core using PM domains, this is no longer
      needed, and is removed.
      
      This also frees up omap_devices to have a more complex parent/child
      relationships that model actual device relationships.
      
      The only in-tree user of omap_device_parent was the OMAP PM layer to
      handle lost-context count for omap_devices.  That is now converted to
      use the presence of the omap_device_pm_domain instead.
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      3ec2decb
  5. 25 2月, 2012 1 次提交
  6. 21 2月, 2012 1 次提交
    • O
      ARM: OMAP: omap_device: Expose omap_device_{alloc, delete, register} · 993e4fbd
      Ohad Ben-Cohen 提交于
      Expose omap_device_{alloc, delete, register} so we can use them outside
      of omap_device.c.
      
      This approach allows users, which need to manipulate an archdata member
      of a device before it is registered, to do so. This is also useful
      for users who have their devices created very early so they can be used
      at ->reserve() time to reserve CMA memory.
      
      The immediate use case for this is to set the private iommu archdata
      member, which binds a device to its associated iommu controller.
      This way, generic code will be able to attach omap devices to their
      iommus, without calling any omap-specific API.
      
      With this in hand, we can further clean the existing mainline OMAP iommu
      driver and its mainline users, and focus on generic IOMMU approaches
      for future users (rpmsg/remoteproc and the upcoming generic DMA API).
      
      This patch is still considered an interim solution until DT fully materializes
      for omap; at that point, this functionality will be removed as DT will
      take care of creating the devices and configuring them correctly.
      
      Tested on OMAP4 with a generic rpmsg/remoteproc that doesn't use any
      omap-specific IOMMU API anymore.
      Signed-off-by: NOhad Ben-Cohen <ohad@wizery.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      993e4fbd
  7. 17 2月, 2012 1 次提交
  8. 08 11月, 2011 1 次提交
    • A
      ARM: OMAP: omap_device: Include linux/export.h · 55581415
      Axel Lin 提交于
      Include linux/export.h to fix below build warning:
      
        CC      arch/arm/plat-omap/omap_device.o
      arch/arm/plat-omap/omap_device.c:1055: warning: data definition has no type or storage class
      arch/arm/plat-omap/omap_device.c:1055: warning: type defaults to 'int' in declaration of 'EXPORT_SYMBOL'
      arch/arm/plat-omap/omap_device.c:1055: warning: parameter names (without types) in function declaration
      Signed-off-by: NAxel Lin <axel.lin@gmail.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      55581415
  9. 05 11月, 2011 1 次提交
  10. 05 10月, 2011 4 次提交
    • B
      ARM: OMAP: omap_device: Add a method to build an omap_device from a DT node · dc2d07eb
      Benoit Cousson 提交于
      Add a notifier called during device_add phase. If an of_node is present,
      retrieve the hwmod entry in order to populate properly the omap_device
      structure.
      
      For the moment the resource from the device-tree are overloaded.
      DT does not support named resource yet, and thus, most driver will not
      work without that information.
      
      Add a documentation to capture the specifics OMAP bindings needed for
      device-tree support.
      Signed-off-by: NBenoit Cousson <b-cousson@ti.com>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      dc2d07eb
    • B
      ARM: OMAP: omap_device: Add omap_device_[alloc|delete] for DT integration · a4f6cdb0
      Benoit Cousson 提交于
      Split the omap_device_build_ss into two smaller functions
      that will allow to populate a platform_device already allocated by
      device-tree.
      
      The functionality of the omap_device_build_ss is still the same, but
      the omap_device_alloc will be usable with devices already built by
      device-tree.
      Signed-off-by: NBenoit Cousson <b-cousson@ti.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      a4f6cdb0
    • B
      ARM: OMAP: omap_device: Create a default omap_device_pm_latency · b7b5bc91
      Benoit Cousson 提交于
      Most devices are using the same default omap_device_pm_latency structure
      during device built. In order to avoid the duplication of the same
      structure everywhere, add a default structure that will be used if
      the device does not have an explicit one.
      
      Next patches will clean the duplicated structures.
      Signed-off-by: NBenoit Cousson <b-cousson@ti.com>
      Cc: Paul Walmsley <paul@pwsan.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      b7b5bc91
    • N
      ARM: OMAP: omap_device: Add omap_device_get_by_hwmod_name · 1f8a7d52
      Nishanth Menon 提交于
      An API which translates a standard hwmod name to corresponding
      platform_device is useful for drivers when they need to look up the
      device associated with a hwmod name to map back into the device
      structure pointers. These ideally should be used by drivers in
      mach directory. Using a generic hwmod name like "gpu" instead of
      the actual device name which could change in the future, allows
      us to:
      a) Could in effect help replace apis such as omap2_get_mpuss_device,
      omap2_get_iva_device, omap2_get_l3_device, omap4_get_dsp_device,
      etc..
      b) Scale to more devices rather than be restricted to named functions
      c) Simplify driver's platform_data from passing additional fields
      all doing the same thing with different function pointer names
      just for accessing a different device name.
      Signed-off-by: NNishanth Menon <nm@ti.com>
      [b-cousson@ti.com: Adapt it to the new pdev pointer inside od,
      remove the unneeded helpers, and fold the next patch here]
      Signed-off-by: NBenoit Cousson <b-cousson@ti.com>
      Signed-off-by: NKevin Hilman <khilman@ti.com>
      1f8a7d52
  11. 16 9月, 2011 6 次提交
  12. 07 9月, 2011 1 次提交
  13. 25 8月, 2011 1 次提交
  14. 13 7月, 2011 3 次提交
  15. 10 7月, 2011 2 次提交
  16. 02 7月, 2011 1 次提交
    • R
      PM / Domains: Rename struct dev_power_domain to struct dev_pm_domain · 564b905a
      Rafael J. Wysocki 提交于
      The naming convention used by commit 7538e3db6e015e890825fbd9f86599b
      (PM: Add support for device power domains), which introduced the
      struct dev_power_domain type for representing device power domains,
      evidently confuses some developers who tend to think that objects
      of this type must correspond to "power domains" as defined by
      hardware, which is not the case.  Namely, at the kernel level, a
      struct dev_power_domain object can represent arbitrary set of devices
      that are mutually dependent power management-wise and need not belong
      to one hardware power domain.  To avoid that confusion, rename struct
      dev_power_domain to struct dev_pm_domain and rename the related
      pointers in struct device and struct pm_clk_notifier_block from
      pwr_domain to pm_domain.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NKevin Hilman <khilman@ti.com>
      564b905a
  17. 07 6月, 2011 1 次提交
  18. 29 4月, 2011 1 次提交
  19. 02 3月, 2011 1 次提交
    • R
      OMAP2+: omap_device/clock: Do not expect an entry in clkdev for opt_clks · da0653fe
      Rajendra Nayak 提交于
      The _add_optional_clock_alias function expects an entry
      already existing in the clkdev table in the form of
      <dev-id=NULL, con-id=role> which might not be the case
      always.
      
      Instead, just check if an entry already exists in clkdev
      in the <dev-id=dev_name, con-id=role> form, else go ahead
      and add one.
      
      Remove any assumption of an entry already existing in clkdev
      table in any form.
      
      Since this means, adding a new entry in clkdev if it does
      not already exist, and not really adding an 'alias',
      also rename the function name
      (s/_add_optional_clock_alias/_add_optional_clock_clkdev)
      to reflect this.
      Signed-off-by: NRajendra Nayak <rnayak@ti.com>
      Reported-by: NSumit Semwal <sumit.semwal@ti.com>
      Cc: Sumit Semwal <sumit.semwal@ti.com>
      Cc: Paul Walmsley <paul@pwsan.com>
      Cc: Benoit Cousson <b-cousson@ti.com>
      Cc: Kevin Hilman <khilman@ti.com>
      Cc: Partha Basak <p-basak2@ti.com>
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      da0653fe
  20. 22 12月, 2010 1 次提交
    • K
      OMAP: PM: implement context loss count APIs · c80705aa
      Kevin Hilman 提交于
      Implement OMAP PM layer omap_pm_get_dev_context_loss_count() API by
      creating similar APIs at the omap_device and omap_hwmod levels.  The
      omap_hwmod level call is the layer with access to the powerdomain
      core, so it is the place where the powerdomain is queried to get the
      context loss count.
      
      The new APIs return an unsigned value that can wrap as the
      context-loss count grows.  However, the wrapping is not important as
      the role of this function is to determine context loss by checking for
      any difference in subsequent calls to this function.
      
      Note that these APIs at each level can return zero when no context
      loss is detected, or on errors.  This is to avoid returning error
      codes which could potentially be mistaken for large context loss
      counters.
      
      NOTE: only works for devices which have been converted to use
            omap_device/omap_hwmod.
      
      Longer term, we could possibly remove this API from the OMAP PM layer,
      and instead directly use the omap_device level API.
      Signed-off-by: NKevin Hilman <khilman@deeprootsystems.com>
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      c80705aa
  21. 25 9月, 2010 1 次提交
  22. 24 9月, 2010 2 次提交
    • K
      OMAP: omap_device: make all devices a child of a new parent device · 0d5e8252
      Kevin Hilman 提交于
      In order to help differentiate omap_devices from normal
      platform_devices, make them all a parent of a new common parent
      device.
      
      Then, in order to determine if a platform_device is also an
      omap_device, checking the parent is all that is needed.
      
      Users of this feature are the runtime PM core for OMAP, where we need
      to know if a device being passed in is an omap_device or not in order
      to know whether to call the omap_device API with it.
      
      In addition, all omap_devices will now show up under /sys/devices/omap
      instead of /sys/devices/platform
      Acked-by: NPaul Walmsley <paul@pwsan.com>
      Signed-off-by: NKevin Hilman <khilman@deeprootsystems.com>
      0d5e8252
    • K
      Revert "OMAP: omap_device: add omap_device_is_valid()" · a1ed40cb
      Kevin Hilman 提交于
      This reverts commit 0007122a.
      
      The dereference method of checking for a valid omap_device when
      wrapping a platform_device is rather unsafe and dangerous.
      
      Instead, a better way of checking for a valid omap-device is
      to use a common parent device for all omap_devices, then a check
      can simply be made using the device parent.  The only user of this
      API was the initial version of the runtime PM core for OMAP.  This
      has now been switched to check device parent, so there are no more
      users of this API.
      Acked-by: NPaul Walmsley <paul@pwsan.com>
      Signed-off-by: NKevin Hilman <khilman@deeprootsystems.com>
      a1ed40cb
  23. 22 9月, 2010 1 次提交
  24. 04 8月, 2010 1 次提交
  25. 27 7月, 2010 3 次提交
    • P
      OMAP2+: hwmod/device: update documentation and copyright · 887adeac
      Paul Walmsley 提交于
      Update some minor documentation issues and update copyright for
      omap_device/omap_hwmod code.
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      Cc: Kevin Hilman <khilman@deeprootsystems.com>
      Cc: Benoît Cousson <b-cousson@ti.com>
      887adeac
    • P
      OMAP: hwmod/device: add omap_{device,hwmod}_get_mpu_rt_va · db2a60bf
      Paul Walmsley 提交于
      Add omap_device_get_mpu_rt_va().  This is intended to be used by
      device drivers (currently, via a struct platform_data function
      pointer) to retrieve their corresponding device's virtual base address
      that the MPU should use to access the device.  This is needed because
      the omap_hwmod code does its own ioremap(), in order to gain access to
      the module's OCP_SYSCONFIG register.
      
      Add omap_hwmod_get_mpu_rt_va().  omap_device_get_mpu_rt_va() calls this
      function to do the real work.
      
      While here, rename struct omap_hwmod._rt_va to struct
      omap_hwmod._mpu_rt_va, to reinforce that it refers to the MPU's
      register target virtual address base (as opposed to, for example, the
      L3's).
      
      In the future, this belongs as a function in an omap_bus, so it is not
      necessary to call this through a platform_data function pointer.
      
      The use-case for this function was originally presented by Santosh
      Shilimkar <santosh.shilimkar@ti.com>.
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
      db2a60bf
    • K
      OMAP: omap_device: ensure hwmod tracks attached omap_device pointer · 06563581
      Kevin Hilman 提交于
      The omap_hwmod struct has a field to track the omap_device that is
      attached to it, but it was not being assigned.  Fix by assigning omap_device
      pointer when omap_device is built.
      Signed-off-by: NKevin Hilman <khilman@deeprootsystems.com>
      [paul@pwsan.com: use an array index rather than pointer arithmetic]
      Signed-off-by: NPaul Walmsley <paul@pwsan.com>
      06563581