1. 07 6月, 2013 1 次提交
    • L
      clk: remove notifier from list before freeing it · 72b5322f
      Lai Jiangshan 提交于
      The @cn is stay in @clk_notifier_list after it is freed, it cause
      memory corruption.
      
      Example, if @clk is registered(first), unregistered(first),
      registered(second), unregistered(second).
      
      The freed @cn will be used when @clk is registered(second),
      and the bug will be happened when @clk is unregistered(second):
      
      [  517.040000] clk_notif_dbg clk_notif_dbg.1: clk_notifier_unregister()
      [  517.040000] Unable to handle kernel paging request at virtual address 00df3008
      [  517.050000] pgd = ed858000
      [  517.050000] [00df3008] *pgd=00000000
      [  517.060000] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
      [  517.060000] Modules linked in: clk_notif_dbg(O-) [last unloaded: clk_notif_dbg]
      [  517.060000] CPU: 1 PID: 499 Comm: modprobe Tainted: G           O 3.10.0-rc3-00119-ga93cb29a-dirty #85
      [  517.060000] task: ee1e0180 ti: ee3e6000 task.ti: ee3e6000
      [  517.060000] PC is at srcu_readers_seq_idx+0x48/0x84
      [  517.060000] LR is at srcu_readers_seq_idx+0x60/0x84
      [  517.060000] pc : [<c0052720>]    lr : [<c0052738>]    psr: 80070013
      [  517.060000] sp : ee3e7d48  ip : 00000000  fp : ee3e7d6c
      [  517.060000] r10: 00000000  r9 : ee3e6000  r8 : 00000000
      [  517.060000] r7 : ed84fe4c  r6 : c068ec90  r5 : c068e430  r4 : 00000000
      [  517.060000] r3 : 00df3000  r2 : 00000000  r1 : 00000002  r0 : 00000000
      [  517.060000] Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
      [  517.060000] Control: 18c5387d  Table: 2d85804a  DAC: 00000015
      [  517.060000] Process modprobe (pid: 499, stack limit = 0xee3e6238)
      [  517.060000] Stack: (0xee3e7d48 to 0xee3e8000)
      ....
      [  517.060000] [<c0052720>] (srcu_readers_seq_idx+0x48/0x84) from [<c0052790>] (try_check_zero+0x34/0xfc)
      [  517.060000] [<c0052790>] (try_check_zero+0x34/0xfc) from [<c00528b0>] (srcu_advance_batches+0x58/0x114)
      [  517.060000] [<c00528b0>] (srcu_advance_batches+0x58/0x114) from [<c0052c30>] (__synchronize_srcu+0x114/0x1ac)
      [  517.060000] [<c0052c30>] (__synchronize_srcu+0x114/0x1ac) from [<c0052d14>] (synchronize_srcu+0x2c/0x34)
      [  517.060000] [<c0052d14>] (synchronize_srcu+0x2c/0x34) from [<c0053a08>] (srcu_notifier_chain_unregister+0x68/0x74)
      [  517.060000] [<c0053a08>] (srcu_notifier_chain_unregister+0x68/0x74) from [<c0375a78>] (clk_notifier_unregister+0x7c/0xc0)
      [  517.060000] [<c0375a78>] (clk_notifier_unregister+0x7c/0xc0) from [<bf008034>] (clk_notif_dbg_remove+0x34/0x9c [clk_notif_dbg])
      [  517.060000] [<bf008034>] (clk_notif_dbg_remove+0x34/0x9c [clk_notif_dbg]) from [<c02bb974>] (platform_drv_remove+0x24/0x28)
      [  517.060000] [<c02bb974>] (platform_drv_remove+0x24/0x28) from [<c02b9bf8>] (__device_release_driver+0x8c/0xd4)
      [  517.060000] [<c02b9bf8>] (__device_release_driver+0x8c/0xd4) from [<c02ba680>] (driver_detach+0x9c/0xc4)
      [  517.060000] [<c02ba680>] (driver_detach+0x9c/0xc4) from [<c02b99c4>] (bus_remove_driver+0xcc/0xfc)
      [  517.060000] [<c02b99c4>] (bus_remove_driver+0xcc/0xfc) from [<c02bace4>] (driver_unregister+0x54/0x78)
      [  517.060000] [<c02bace4>] (driver_unregister+0x54/0x78) from [<c02bbb44>] (platform_driver_unregister+0x1c/0x20)
      [  517.060000] [<c02bbb44>] (platform_driver_unregister+0x1c/0x20) from [<bf0081f8>] (clk_notif_dbg_driver_exit+0x14/0x1c [clk_notif_dbg])
      [  517.060000] [<bf0081f8>] (clk_notif_dbg_driver_exit+0x14/0x1c [clk_notif_dbg]) from [<c00835e4>] (SyS_delete_module+0x200/0x28c)
      [  517.060000] [<c00835e4>] (SyS_delete_module+0x200/0x28c) from [<c000edc0>] (ret_fast_syscall+0x0/0x48)
      [  517.060000] Code: e5973004 e7911102 e0833001 e2881002 (e7933101)
      
      Cc: stable@kernel.org
      Reported-by: NSören Brinkmann <soren.brinkmann@xilinx.com>
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      Tested-by: NSören Brinkmann <soren.brinkmann@xilinx.com>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      [mturquette@linaro.org: shortened $SUBJECT]
      72b5322f
  2. 28 4月, 2013 1 次提交
  3. 16 4月, 2013 1 次提交
  4. 11 4月, 2013 1 次提交
    • S
      clk: Properly handle notifier return values · fb72a059
      Soren Brinkmann 提交于
      Notifiers may return NOTIFY_(OK|DONE|STOP|BAD). The CCF uses an
      inconsistent mix of checking against NOTIFY_STOP or NOTIFY_BAD.
      This inconsistency leaves errors undetected in some cases:
      clk_set_parent() calls __clk_speculate_rates(), which stops when it
      hits a NOTIFIER_BAD (STOP is ignored), and passes this value back to the
      caller.
      clk_set_parent() compares this return value against NOTIFY_STOP only,
      ignoring NOTIFY_BAD returns.
      
      Use NOTIFY_STOP_MASK to detect a negative notifier return value and
      document all four return value options.
      Signed-off-by: NSoren Brinkmann <soren.brinkmann@xilinx.com>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      fb72a059
  5. 09 4月, 2013 3 次提交
    • U
      clk: Fixup locking issues for clk_set_parent · a68de8e4
      Ulf Hansson 提交于
      Updating the clock tree topology must be protected with the spinlock
      when doing clk_set_parent, otherwise we can not handle the migration
      of the enable_count in a safe manner.
      
      While issuing the .set_parent callback to make the clk-hw perform the
      switch to the new parent, we can not hold the spinlock since it is must
      be allowed to be slow path. This complicates error handling, but is still
      possible to achieve.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      a68de8e4
    • U
      clk: Fixup errorhandling for clk_set_parent · 031dcc9b
      Ulf Hansson 提交于
      Fixup the broken feature of allowing reparent of a clk to the
      orhpan list and vice verse. When operating on a single-parent
      clk, the .set_parent callback for the clk hw is optional to
      implement, but for a multi-parent clk it is mandatory.
      
      Moreover improve the errorhandling by verifying the prerequisites
      before triggering clk notifiers. This will prevent unnecessary
      rollback with ABORT_RATE_CHANGE.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      031dcc9b
    • U
      clk: Restructure code for __clk_reparent · b33d212f
      Ulf Hansson 提交于
      Split __clk_reparent into three pieces, one for doing the actual
      reparent for updating the clock tree topology, one for the
      COMMON_CLK_DEBUG code and one for doing the rate recalculation.
      
      This patch also makes it possible to hold the spinlock over the
      update of the clock tree topology, which could not be done before
      when both debugfs updates and clock rate updates was done within
      the same function.
      Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
      Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      b33d212f
  6. 03 4月, 2013 2 次提交
    • M
      clk: allow reentrant calls into the clk framework · 533ddeb1
      Mike Turquette 提交于
      Reentrancy into the clock framework is necessary for clock operations
      that result in nested calls to the clk api.  A common example is a clock
      that is prepared via an i2c transaction, such as a clock inside of a
      discrete audio chip or a power management IC.  The i2c subsystem itself
      will use the clk api resulting in a deadlock:
      
      clk_prepare(audio_clk)
      	i2c_transfer(..)
      		clk_prepare(i2c_controller_clk)
      
      The ability to reenter the clock framework prevents this deadlock.
      
      Other use cases exist such as allowing .set_rate callbacks to call
      clk_set_parent to achieve the best rate, or to save power in certain
      configurations.  Yet another example is performing pinctrl operations
      from a clk_ops callback.  Calls into the pinctrl subsystem may call
      clk_{un}prepare on an unrelated clock.  Allowing for nested calls to
      reenter the clock framework enables both of these use cases.
      
      Reentrancy is implemented by two global pointers that track the owner
      currently holding a global lock.  One pointer tracks the owner during
      sleepable, mutex-protected operations and the other one tracks the owner
      during non-interruptible, spinlock-protected operations.
      
      When the clk framework is entered we try to hold the global lock.  If it
      is held we compare the current task against the current owner; a match
      implies a nested call and we reenter.  If the values do not match then
      we block on the lock until it is released.
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
      Cc: David Brown <davidb@codeaurora.org>
      Tested-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      533ddeb1
    • M
      clk: abstract locking out into helper functions · eab89f69
      Mike Turquette 提交于
      Create locking helpers for the global mutex and global spinlock.  The
      definitions of these helpers will be expanded upon in the next patch
      which introduces reentrancy into the locking scheme.
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      Cc: Rajagopal Venkat <rajagopal.venkat@linaro.org>
      Cc: David Brown <davidb@codeaurora.org>
      Tested-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      eab89f69
  7. 23 3月, 2013 1 次提交
  8. 20 3月, 2013 3 次提交
  9. 28 2月, 2013 1 次提交
    • S
      hlist: drop the node parameter from iterators · b67bfe0d
      Sasha Levin 提交于
      I'm not sure why, but the hlist for each entry iterators were conceived
      
              list_for_each_entry(pos, head, member)
      
      The hlist ones were greedy and wanted an extra parameter:
      
              hlist_for_each_entry(tpos, pos, head, member)
      
      Why did they need an extra pos parameter? I'm not quite sure. Not only
      they don't really need it, it also prevents the iterator from looking
      exactly like the list iterator, which is unfortunate.
      
      Besides the semantic patch, there was some manual work required:
      
       - Fix up the actual hlist iterators in linux/list.h
       - Fix up the declaration of other iterators based on the hlist ones.
       - A very small amount of places were using the 'node' parameter, this
       was modified to use 'obj->member' instead.
       - Coccinelle didn't handle the hlist_for_each_entry_safe iterator
       properly, so those had to be fixed up manually.
      
      The semantic patch which is mostly the work of Peter Senna Tschudin is here:
      
      @@
      iterator name hlist_for_each_entry, hlist_for_each_entry_continue, hlist_for_each_entry_from, hlist_for_each_entry_rcu, hlist_for_each_entry_rcu_bh, hlist_for_each_entry_continue_rcu_bh, for_each_busy_worker, ax25_uid_for_each, ax25_for_each, inet_bind_bucket_for_each, sctp_for_each_hentry, sk_for_each, sk_for_each_rcu, sk_for_each_from, sk_for_each_safe, sk_for_each_bound, hlist_for_each_entry_safe, hlist_for_each_entry_continue_rcu, nr_neigh_for_each, nr_neigh_for_each_safe, nr_node_for_each, nr_node_for_each_safe, for_each_gfn_indirect_valid_sp, for_each_gfn_sp, for_each_host;
      
      type T;
      expression a,c,d,e;
      identifier b;
      statement S;
      @@
      
      -T b;
          <+... when != b
      (
      hlist_for_each_entry(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_continue(a,
      - b,
      c) S
      |
      hlist_for_each_entry_from(a,
      - b,
      c) S
      |
      hlist_for_each_entry_rcu(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_rcu_bh(a,
      - b,
      c, d) S
      |
      hlist_for_each_entry_continue_rcu_bh(a,
      - b,
      c) S
      |
      for_each_busy_worker(a, c,
      - b,
      d) S
      |
      ax25_uid_for_each(a,
      - b,
      c) S
      |
      ax25_for_each(a,
      - b,
      c) S
      |
      inet_bind_bucket_for_each(a,
      - b,
      c) S
      |
      sctp_for_each_hentry(a,
      - b,
      c) S
      |
      sk_for_each(a,
      - b,
      c) S
      |
      sk_for_each_rcu(a,
      - b,
      c) S
      |
      sk_for_each_from
      -(a, b)
      +(a)
      S
      + sk_for_each_from(a) S
      |
      sk_for_each_safe(a,
      - b,
      c, d) S
      |
      sk_for_each_bound(a,
      - b,
      c) S
      |
      hlist_for_each_entry_safe(a,
      - b,
      c, d, e) S
      |
      hlist_for_each_entry_continue_rcu(a,
      - b,
      c) S
      |
      nr_neigh_for_each(a,
      - b,
      c) S
      |
      nr_neigh_for_each_safe(a,
      - b,
      c, d) S
      |
      nr_node_for_each(a,
      - b,
      c) S
      |
      nr_node_for_each_safe(a,
      - b,
      c, d) S
      |
      - for_each_gfn_sp(a, c, d, b) S
      + for_each_gfn_sp(a, c, d) S
      |
      - for_each_gfn_indirect_valid_sp(a, c, d, b) S
      + for_each_gfn_indirect_valid_sp(a, c, d) S
      |
      for_each_host(a,
      - b,
      c) S
      |
      for_each_host_safe(a,
      - b,
      c, d) S
      |
      for_each_mesh_entry(a,
      - b,
      c, d) S
      )
          ...+>
      
      [akpm@linux-foundation.org: drop bogus change from net/ipv4/raw.c]
      [akpm@linux-foundation.org: drop bogus hunk from net/ipv6/raw.c]
      [akpm@linux-foundation.org: checkpatch fixes]
      [akpm@linux-foundation.org: fix warnings]
      [akpm@linux-foudnation.org: redo intrusive kvm changes]
      Tested-by: NPeter Senna Tschudin <peter.senna@gmail.com>
      Acked-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: NSasha Levin <sasha.levin@oracle.com>
      Cc: Wu Fengguang <fengguang.wu@intel.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Gleb Natapov <gleb@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b67bfe0d
  10. 25 1月, 2013 1 次提交
  11. 22 1月, 2013 1 次提交
  12. 12 1月, 2013 4 次提交
    • P
      clk: JSON debugfs clock tree summary · bddca894
      Prashant Gaikwad 提交于
      Clock information is dumped in JSON format which is easy
      for machines to parse.
      
      Each clock is represented as an object which has same name as
      clock and following properties
      	- enable_count
      	- prepare_count
      	- rate
      
      Output is verified using online JSON editor.
      Signed-off-by: NPrashant Gaikwad <pgaikwad@nvidia.com>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      bddca894
    • P
      clk: human-readable debugfs clock tree summary · 1af599df
      Prashant Gaikwad 提交于
      Adds debug file "clk_summary" in /sys/kernel/debug/clk dir.
      It helps to view all the clock registered in human-readable format.
      
      For example:
         clock                        enable_cnt  prepare_cnt  rate
      ---------------------------------------------------------------------
       i2s0_sync                      0           0            24000000
       spdif_in_sync                  0           0            24000000
          spdif_mux                   0           0            24000000
             spdif                    0           0            24000000
                spdif_doubler         0           0            48000000
                   spdif_div          0           0            48000000
                      spdif_2x        0           0            48000000
       clk_32k                        2           2            32768
          blink_override              1           1            32768
             blink                    1           1            32768
       clk_m                          2           2            12000000
          clk_out_3_mux               0           0            12000000
             clk_out_3                0           0            12000000
          pll_ref                     3           3            12000000
             pll_e_mux                0           0            12000000
                pll_e                 0           0            100000000
                   cml0               0           0            100000000
                   cml1               0           0            100000000
                   pciex              0           0            100000000
             pll_d2                   0           0            1000000
                pll_d2_out0           0           0            500000
             pll_d                    0           0            1000000
                pll_d_out0            0           0            500000
                   dsib_mux           0           0            500000
                      dsib            0           0            500000
                   dsia               0           0            500000
      Signed-off-by: NPrashant Gaikwad <pgaikwad@nvidia.com>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      1af599df
    • N
      clk: export __clk_get_name for re-use in imx-ipu-v3 and others · 4895084c
      Niels de Vos 提交于
      This fixes the following error when building for arm-imx:
      > ERROR: "__clk_get_name" [drivers/staging/imx-drm/ipu-v3/imx-ipu-v3.ko] undefined!
      > make[1]: *** [__modpost] Error 1
      > make: *** [modules] Error 2
      
      There are valid usecases to get the name of a clock, be it for debugging
      purposes or to register a children of a clock like done in this IPU driver.
      Therefore exporting __clk_get_name() and make it available for others makes
      sense.
      Reported-by: NPeter Robinson <pbrobinson@gmail.com>
      CC: Sascha Hauer <s.hauer@pengutronix.de>
      CC: Mike Turquette <mturquette@linaro.org>
      Signed-off-by: NNiels de Vos <ndevos@redhat.com>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      [mturquette@linaro.org: removal of inline made redundant by 65800b2c]
      4895084c
    • R
      clk: Don't mark shared helper functions as inline · 65800b2c
      Russ Dill 提交于
      The helper functions that access the opaque struct clk should
      not be marked inline since they are contained in clk.c, but expected
      to be used by other compilation units. This causes compile errors
      under gcc-4.7
      
      In file included from arch/arm/mach-omap2/clockdomain.c:25:0:
      arch/arm/mach-omap2/clockdomain.c: In function ‘clkdm_clk_disable’:
      include/linux/clk-provider.h:338:12: error: inlining failed in call to always_inline ‘__clk_get_enable_count’: function body not available
      arch/arm/mach-omap2/clockdomain.c:1001:28: error: called from here
      make[1]: *** [arch/arm/mach-omap2/clockdomain.o] Error 1
      make: *** [arch/arm/mach-omap2] Error 2
      Signed-off-by: NRuss Dill <Russ.Dill@ti.com>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      [mturquette@linaro.org: removed fixes made redundant by commit 93532c8a]
      [mturquette@linaro.org: improved $SUBJECT]
      65800b2c
  13. 11 12月, 2012 1 次提交
    • M
      clk: introduce optional disable_unused callback · 7c045a55
      Mike Turquette 提交于
      Some gate clocks have special needs which must be handled during the
      disable-unused clocks sequence.  These needs might be driven by software
      due to the fact that we're disabling a clock outside of the normal
      clk_disable path and a clk's enable_count will not be accurate.  On the
      other hand a specific hardware programming sequence might need to be
      followed for this corner case.
      
      This change is needed for the upcoming OMAP port to the common clock
      framework.  Specifically, it is undesirable to treat the disable-unused
      path identically to the normal clk_disable path since other software
      layers are involved.  In this case OMAP's clockdomain code throws WARNs
      and bails early due to the clock's enable_count being set to zero.  A
      custom callback mitigates this problem nicely.
      
      Cc: Paul Walmsley <paul@pwsan.com>
      Acked-by: NUlf Hansson <ulf.hansson@linaro.org>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      7c045a55
  14. 27 11月, 2012 1 次提交
    • M
      clk: clock multiplexers may register out of order · 1f61e5f1
      Martin Fuzzey 提交于
      When a clock, C is initialised any orphan clocks listing C as
      a possible parent are reparented to it regardless of the
      parent requested by the orphan's get_parent() operation.
      
      This means that multiplexers registered before their parents
      are reparented to the first parent subsequently declared,
      regardless of the selection made by the hardware registers.
      
      For example:
      	static const char *sel[] = { "srcA", "srcB", "dummy", "srcC" };
      
      	child = clk_register_mux(NULL, "child",  sel, ARRAY_SIZE(sel), ...);
      	clk_register_fixed(NULL, "dummy", ...);
      	clk_register_fixed(NULL, "srcA", ...);
      	clk_register_fixed(NULL, "srcB", ...);
      	clk_register_fixed(NULL, "srcC", ...);
      
      Causes child's parent to always be "dummy".
      
      To fix this, when an orphanned clock has a get_parent() operation,
      only reparent to the clock indicated by get_parent().
      Signed-off-by: NMartin Fuzzey <mfuzzey@parkeon.com>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      [mturquette@linaro.org: improve $SUBJECT]
      1f61e5f1
  15. 30 10月, 2012 2 次提交
  16. 08 9月, 2012 1 次提交
  17. 07 9月, 2012 1 次提交
  18. 31 7月, 2012 1 次提交
    • F
      clk: validate pointer in __clk_disable() · e47c6a34
      Fengguang Wu 提交于
      clk_get() returns -ENOENT on error and some careless caller might
      dereference it without error checking:
      
      In mxc_rnga_remove():
      
              struct clk *clk = clk_get(&pdev->dev, "rng");
      
      	// ...
      
              clk_disable(clk);
      
      Since it's insane to audit the lots of existing and future clk users,
      let's add a check in the callee to avoid kernel panic and warn about
      any buggy user.
      
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Viresh Kumar <viresh.kumar@st.com>
      Cc: viresh kumar <viresh.linux@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e47c6a34
  19. 12 7月, 2012 2 次提交
    • G
      clk: add DT clock binding support · 766e6a4e
      Grant Likely 提交于
      Based on work 1st by Ben Herrenschmidt and Jeremy Kerr, then by Grant
      Likely, this patch adds support to clk_get to allow drivers to retrieve
      clock data from the device tree.
      
      Platforms scan for clocks in DT with of_clk_init and a match table, and
      the register a provider through of_clk_add_provider. The provider's
      clk_src_get function will be called when a device references the
      provider's OF node for a clock reference.
      
      v6 (Rob Herring):
          - Return error values instead of NULL to match clock framework
            expectations
      
      v5 (Rob Herring):
          - Move from drivers/of into common clock subsystem
          - Squashed "dt/clock: add a simple provider get function" and
            "dt/clock: add function to get parent clock name"
          - Rebase to 3.4-rc1
          - Drop CONFIG_OF_CLOCK and just use CONFIG_OF
          - Add missing EXPORT_SYMBOL to various functions
          - s/clock-output-name/clock-output-names/
          - Define that fixed-clock binding is a single output
      
      v4 (Rob Herring):
          - Rework for common clk subsystem
          - Add of_clk_get_parent_name function
      
      v3: - Clarified documentation
      
      v2: - fixed errant ';' causing compile error
          - Editorial fixes from Shawn Guo
          - merged in adding lookup to clkdev
          - changed property names to match established convention. After
            working with the binding a bit it really made more sense to follow the
            lead of 'reg', 'gpios' and 'interrupts' by making the input simply
            'clocks' & 'clock-names' instead of 'clock-input-*', and to only use
            clock-output* for the producer nodes. (Sorry Shawn, this will mean
            you need to change some code, but it should be trivial)
          - Add ability to inherit clocks from parent nodes by using an empty
            'clock-ranges' property.  Useful for busses.  I could use some feedback
            on the new property name, 'clock-ranges' doesn't feel right to me.
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      Signed-off-by: NRob Herring <rob.herring@calxeda.com>
      Reviewed-by: NShawn Guo <shawn.guo@freescale.com>
      Cc: Sascha Hauer <kernel@pengutronix.de>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      766e6a4e
    • R
      clk: cache parent clocks only for muxes · 9ca1c5a4
      Rajendra Nayak 提交于
      caching parent clocks makes sense only when a clock has more
      than one parent (mux clocks).
      Avoid doing this for every other clock.
      Signed-off-by: NRajendra Nayak <rnayak@ti.com>
      [mturquette@linaro.org: removed extra parentheses]
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      9ca1c5a4
  20. 04 7月, 2012 1 次提交
    • R
      clk: fix parent validation in __clk_set_parent() · 863b1327
      Rajendra Nayak 提交于
      The below commit introduced a bug in __clk_set_parent()
      which could cause it to *skip* the parent validation
      which makes sure the parent passed to the api is a valid
      one.
      
          commit 7975059d
          Author: Rajendra Nayak <rnayak@ti.com>
          Date:   Wed Jun 6 14:41:31 2012 +0530
      
              clk: Allow late cache allocation for clk->parents
      
      This was identified by the following compiler warning..
      
          drivers/clk/clk.c: In function '__clk_set_parent':
          drivers/clk/clk.c:1083:5: warning: 'i' may be used uninitialized in this function [-Wuninitialized]
      
      .. as reported by Marc Kleine-Budde.
      
      There were various options discussed on how to fix this, one
      being initing 'i' to clk->num_parents, but the below approach
      was found to be more appropriate as it also makes the 'parent
      validation' code simpler to read.
      Reported-by: NMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: NRajendra Nayak <rnayak@ti.com>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      Cc: stable@kernel.org
      863b1327
  21. 26 6月, 2012 2 次提交
    • P
      clk: Check parent for NULL in clk_change_rate · bf47b4fd
      Pawel Moll 提交于
      clk_change_rate() is accessing parent's rate without checking
      if the parent exists at all. In case of root clocks this will
      cause NULL pointer dereference.
      
      This patch follows what clk_calc_new_rates() does in such
      situation.
      Signed-off-by: NPawel Moll <pawel.moll@arm.com>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      Cc: stable@kernel.org
      bf47b4fd
    • R
      clk: Allow late cache allocation for clk->parents · 7975059d
      Rajendra Nayak 提交于
      Parent clocks for muxes are cached in clk->parents to
      avoid frequent lookups, however the cache allocation happens
      only during clock registeration and later clk_set_parent()
      assumes a cache space available and allocated.
      
      This is not entirely true for platforms which do early clock
      registerations wherein the cache allocation using kzalloc
      could fail during clock registeration.
      
      Allow cache allocation to happen later as part of clk_set_parent()
      to help such cases and avoid crashes assuming a cache being
      available.
      
      While here also replace existing kmalloc() with kzalloc()
      in the file.
      Signed-off-by: NRajendra Nayak <rnayak@ti.com>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      Cc: stable@kernel.org
      7975059d
  22. 16 5月, 2012 2 次提交
  23. 09 5月, 2012 2 次提交
  24. 02 5月, 2012 2 次提交
    • V
      clk: clk_set_rate() must fail if CLK_SET_RATE_GATE is set and clk is enabled · 0e1c0301
      Viresh Kumar 提交于
      This is well documented but isn't implemented. clk_set_rate() must check if
      flags have CLK_SET_RATE_GATE bit set and is enabled too.
      Signed-off-by: NViresh Kumar <viresh.kumar@st.com>
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      0e1c0301
    • S
      clk: Use a separate struct for holding init data. · 0197b3ea
      Saravana Kannan 提交于
      Create a struct clk_init_data to hold all data that needs to be passed from
      the platfrom specific driver to the common clock framework during clock
      registration. Add a pointer to this struct inside clk_hw.
      
      This has several advantages:
      * Completely hides struct clk from many clock platform drivers and static
        clock initialization code that don't care for static initialization of
        the struct clks.
      * For platforms that want to do complete static initialization, it removed
        the need to directly mess with the struct clk's fields while still
        allowing to statically allocate struct clk. This keeps the code more
        future proof even if they include clk-private.h.
      * Simplifies the generic clk_register() function and allows adding optional
        fields in the future without modifying the function signature.
      * Simplifies the static initialization of clocks on all platforms by
        removing the need for forward delcarations or convoluted macros.
      Signed-off-by: NSaravana Kannan <skannan@codeaurora.org>
      [mturquette@linaro.org: kept DEFINE_CLK_* macros and __clk_init]
      Signed-off-by: NMike Turquette <mturquette@linaro.org>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Cc: Rob Herring <rob.herring@calxeda.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Jeremy Kerr <jeremy.kerr@canonical.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Arnd Bergman <arnd.bergmann@linaro.org>
      Cc: Paul Walmsley <paul@pwsan.com>
      Cc: Shawn Guo <shawn.guo@freescale.com>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: Jamie Iles <jamie@jamieiles.com>
      Cc: Richard Zhao <richard.zhao@linaro.org>
      Cc: Saravana Kannan <skannan@codeaurora.org>
      Cc: Magnus Damm <magnus.damm@gmail.com>
      Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
      Cc: Linus Walleij <linus.walleij@stericsson.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Amit Kucheria <amit.kucheria@linaro.org>
      Cc: Deepak Saxena <dsaxena@linaro.org>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      0197b3ea
  25. 25 4月, 2012 2 次提交