1. 11 7月, 2014 1 次提交
    • F
      pinctrl: avoid duplicated calling enable_pinmux_setting for a pin · 2243a87d
      Fan Wu 提交于
      What the patch does:
      1. Call pinmux_disable_setting ahead of pinmux_enable_setting
        each time pinctrl_select_state is called
      2. Remove the HW disable operation in pinmux_disable_setting function.
      3. Remove the disable ops in struct pinmux_ops
      4. Remove all the disable ops users in current code base.
      
      Notes:
      1. Great thanks for the suggestion from Linus, Tony Lindgren and
         Stephen Warren and Everyone that shared comments on this patch.
      2. The patch also includes comment fixes from Stephen Warren.
      
      The reason why we do this:
      1. To avoid duplicated calling of the enable_setting operation
         without disabling operation inbetween which will let the pin
         descriptor desc->mux_usecount increase monotonously.
      2. The HW pin disable operation is not useful for any of the
         existing platforms.
         And this can be used to avoid the HW glitch after using the
         item #1 modification.
      
      In the following case, the issue can be reproduced:
      1. There is a driver that need to switch pin state dynamically,
         e.g. between "sleep" and "default" state
      2. The pin setting configuration in a DTS node may be like this:
      
        component a {
      	pinctrl-names = "default", "sleep";
      	pinctrl-0 = <&a_grp_setting &c_grp_setting>;
      	pinctrl-1 = <&b_grp_setting &c_grp_setting>;
        }
      
        The "c_grp_setting" config node is totally identical, maybe like
        following one:
      
        c_grp_setting: c_grp_setting {
      	pinctrl-single,pins = <GPIO48 AF6>;
        }
      
      3. When switching the pin state in the following official pinctrl
         sequence:
      	pin = pinctrl_get();
      	state = pinctrl_lookup_state(wanted_state);
      	pinctrl_select_state(state);
      	pinctrl_put();
      
      Test Result:
      1. The switch is completed as expected, that is: the device's
         pin configuration is changed according to the description in the
         "wanted_state" group setting
      2. The "desc->mux_usecount" of the corresponding pins in "c_group"
         is increased without being decreased, because the "desc" is for
         each physical pin while the setting is for each setting node
         in the DTS.
         Thus, if the "c_grp_setting" in pinctrl-0 is not disabled ahead
         of enabling "c_grp_setting" in pinctrl-1, the desc->mux_usecount
         will keep increasing without any chance to be decreased.
      
      According to the comments in the original code, only the setting,
      in old state but not in new state, will be "disabled" (calling
      pinmux_disable_setting), which is correct logic but not intact. We
      still need consider case that the setting is in both old state
      and new state. We can do this in the following two ways:
      
      1. Avoid to "enable"(calling pinmux_enable_setting) the "same pin
         setting" repeatedly
      2. "Disable"(calling pinmux_disable_setting) the "same pin setting",
         actually two setting instances, ahead of enabling them.
      
      Analysis:
      1. The solution #2 is better because it can avoid too much
         iteration.
      2. If we disable all of the settings in the old state and one of
         the setting(s) exist in the new state, the pins mux function
         change may happen when some SoC vendors defined the
         "pinctrl-single,function-off"
         in their DTS file.
         old_setting => disabled_setting => new_setting.
      3. In the pinmux framework, when a pin state is switched, the
         setting in the old state should be marked as "disabled".
      
      Conclusion:
      1. To Remove the HW disabling operation to above the glitch mentioned
         above.
      2. Handle the issue mentioned above by disabling all of the settings
         in old state and then enable the all of the settings in new state.
      Signed-off-by: NFan Wu <fwu@marvell.com>
      Acked-by: NStephen Warren <swarren@nvidia.com>
      Acked-by: NPatrice Chotard <patrice.chotard@st.com>
      Acked-by: NHeiko Stuebner <heiko@sntech.de>
      Acked-by: NMaxime Coquelin <maxime.coquelin@st.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      2243a87d
  2. 14 4月, 2014 1 次提交
  3. 26 3月, 2014 1 次提交
  4. 25 3月, 2014 2 次提交
  5. 18 3月, 2014 1 次提交
    • L
      gpio: switch drivers to use new callback · 57ef0428
      Linus Walleij 提交于
      This switches all GPIO and pin control drivers with irqchips
      that were using .startup() and .shutdown() callbacks to lock
      GPIO lines for IRQ usage over to using the .request_resources()
      and .release_resources() callbacks just introduced into the
      irqchip vtable.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      57ef0428
  6. 25 2月, 2014 2 次提交
  7. 04 12月, 2013 1 次提交
    • L
      gpio/pinctrl: make gpio_chip members typed boolean · 9fb1f39e
      Linus Walleij 提交于
      This switches the two members of struct gpio_chip that were
      defined as unsigned foo:1 to bool, because that is indeed what
      they are. Switch all users in the gpio and pinctrl subsystems
      to assign these values with true/false instead of 0/1. The
      users outside these subsystems will survive since true/false
      is 1/0, atleast we set some kind of more strict typing example.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      9fb1f39e
  8. 27 11月, 2013 2 次提交
  9. 25 11月, 2013 1 次提交
  10. 16 10月, 2013 1 次提交
    • L
      pinctrl: nomadik: mark GPIO lines used for IRQ · 494336f3
      Linus Walleij 提交于
      When an IRQ is started on a GPIO line, mark this GPIO as IRQ in
      the gpiolib so we can keep track of the usage centrally.
      
      Cc: Enric Balletbo i Serra <eballetbo@gmail.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
      Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
      Cc: Stephen Warren <swarren@wwwdotorg.org>
      Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      494336f3
  11. 28 8月, 2013 1 次提交
  12. 16 8月, 2013 2 次提交
    • J
      pinctrl: nomadik: simplify use of devm_ioremap_resource · 690ebabb
      Julia Lawall 提交于
      Remove unneeded error handling on the result of a call to
      platform_get_resource when the value is passed to devm_ioremap_resource.
      
      Move the call to platform_get_resource adjacent to the call to
      devm_ioremap_resource to make the connection between them more clear.
      
      A simplified version of the semantic patch that makes this change is as
      follows: (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      expression pdev,res,n,e,e1;
      expression ret != 0;
      identifier l;
      @@
      
      - res = platform_get_resource(pdev, IORESOURCE_MEM, n);
        ... when != res
      - if (res == NULL) { ... \(goto l;\|return ret;\) }
        ... when != res
      + res = platform_get_resource(pdev, IORESOURCE_MEM, n);
        e = devm_ioremap_resource(e1, res);
      // </smpl>
      Signed-off-by: NJulia Lawall <Julia.Lawall@lip6.fr>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      690ebabb
    • L
      pinctrl: nomadik: shut up a warning for flags · f84b4171
      Linus Walleij 提交于
      The irq flags variable gets a warning like this after
      commit bf4dae5c
      "pinctrl: nomadik: delete ancient pin control API":
      
      In file included from include/linux/seqlock.h:29:0,
                       from include/linux/time.h:5,
                       from include/linux/stat.h:18,
                       from include/linux/module.h:10,
                       from
      drivers/pinctrl/pinctrl-nomadik.c:14:
      drivers/pinctrl/pinctrl-nomadik.c: In function 'nmk_pmx_enable':
      include/linux/spinlock.h:348:122: warning:
      'flags' may be used uninitialized in this function
      [-Wmaybe-uninitialized]
        raw_spin_unlock_irqrestore(&lock->rlock, flags);
                                                         ^
      drivers/pinctrl/pinctrl-nomadik.c:1515:16: note:
      'flags' was declared here
        unsigned long flags;
      
      The function is question was never changed but it appears
      the semantic checker could previously determine that the code
      path that would use the flags was going to either use it or
      not, but now it can't for some reason. Just fix it up.
      Reported-by: NOlof Johansson <olof@lixom.net>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      f84b4171
  13. 08 8月, 2013 1 次提交
  14. 18 6月, 2013 1 次提交
  15. 28 5月, 2013 1 次提交
  16. 27 5月, 2013 1 次提交
  17. 04 4月, 2013 1 次提交
  18. 28 3月, 2013 1 次提交
  19. 27 3月, 2013 1 次提交
  20. 07 3月, 2013 1 次提交
  21. 30 1月, 2013 1 次提交
    • A
      pinctrl: nomadik: nmk_prcm_gpiocr_get_mode may be unused · 0fafd50e
      Arnd Bergmann 提交于
      nmk_prcm_gpiocr_get_mode is only needed for debugfs output at
      the moment, which can be compile-time disabled. Marking
      the function __maybe_unused still gives us compile-time
      coverage, but avoids a gcc warning.
      
      Without this patch, building nhk8815_defconfig results in:
      
      drivers/pinctrl/pinctrl-nomadik.c:676:12: warning: 'nmk_prcm_gpiocr_get_mode' defined but not used [-Wunused-function]
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Jean-Nicolas Graux <jean-nicolas.graux@stericsson.com>
      Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      0fafd50e
  22. 29 1月, 2013 1 次提交
  23. 23 1月, 2013 1 次提交
  24. 19 1月, 2013 1 次提交
    • L
      pinctrl: nomadik: Allow prcm_base to be extracted from Device Tree · 32e67eee
      Lee Jones 提交于
      The Nomadik Pinctrl driver requires access to some PRCMU registers
      in order to run with full functionality. When Device Tree is
      disabled the required PRCMU base address is passed in via platform
      data, so in order for Device Tree booting to be as functional, we
      need a similar mechanism to fetch it from Device Tree.
      
      The new semantics goes like this: Parse the Device Tree and look
      for the PRCMU node using a provided Phandle. Obtain the ioremaped
      address from that node. If one was supplied via platform data
      over-write it with anything found in Device Tree. Fail if either
      the prcm_base can't be found if we're running on anything other
      than an STN8815 ASIC.
      Signed-off-by: NLee Jones <lee.jones@linaro.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      32e67eee
  25. 12 1月, 2013 4 次提交
  26. 04 1月, 2013 1 次提交
    • G
      Drivers: pinctrl: remove __dev* attributes. · 150632b0
      Greg Kroah-Hartman 提交于
      CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
      markings need to be removed.
      
      This change removes the use of __devinit, __devexit_p, __devinitdata,
      and __devexit from these drivers.
      
      Based on patches originally written by Bill Pemberton, but redone by me
      in order to handle some of the coding style issues better, by hand.
      
      Cc: Bill Pemberton <wfp5p@virginia.edu>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
      Cc: Stephen Warren <swarren@wwwdotorg.org>
      Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
      Cc: Barry Song <baohua.song@csr.com>
      Cc: Viresh Kumar <viresh.linux@gmail.com>
      Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      150632b0
  27. 26 12月, 2012 1 次提交
    • F
      pinctrl: nomadik: return if prcm_base is NULL · 4ca075de
      Fabio Baltieri 提交于
      This patch adds a check for npct->prcm_base to make sure that the
      address is not NULL before using it, as the driver was made capable of
      loading even without a proper memory resource in:
      
      f1671bf5 pinctrl/nomadik: make independent of prcmu driver
      
      Also, refuses to probe without prcm_base on anything else than nomadik.
      
      This solves the following crash, introduced during the merge window when
      booting on U8500 with device tree:
      
      pinctrl-nomadik pinctrl-db8500: No PRCM base, assume no ALT-Cx control is available
      Unable to handle kernel NULL pointer dereference at virtual address 00000138
      pgd = c0004000
      [00000138] *pgd=00000000
      Internal error: Oops: 5 [#1] PREEMPT SMP ARM
      Modules linked in:
      CPU: 0    Not tainted  (3.7.0-02892-g1ebaf4f4 #631)
      PC is at nmk_pmx_enable+0x1bc/0x4d0
      LR is at clk_disable+0x40/0x44
      [snip]
      [<c01d5e50>] (nmk_pmx_enable+0x1bc/0x4d0) from [<c01d3ba8>] (pinmux_enable_setting+0x12c/0x1ec)
      [<c01d3ba8>] (pinmux_enable_setting+0x12c/0x1ec) from [<c01d1dc8>] (pinctrl_select_state_locked+0xfc/0x134)
      [<c01d1dc8>] (pinctrl_select_state_locked+0xfc/0x134) from [<c01d2814>] (pinctrl_register+0x26c/0x43c)
      [<c01d2814>] (pinctrl_register+0x26c/0x43c) from [<c01d668c>] (nmk_pinctrl_probe+0x114/0x238)
      [<c01d668c>] (nmk_pinctrl_probe+0x114/0x238) from [<c0211cc4>] (platform_drv_probe+0x28/0x2c)
      [<c0211cc4>] (platform_drv_probe+0x28/0x2c) from [<c0210738>] (driver_probe_device+0x84/0x21c)
      [<c0210738>] (driver_probe_device+0x84/0x21c) from [<c02109c0>] (__device_attach+0x50/0x54)
      [<c02109c0>] (__device_attach+0x50/0x54) from [<c020eb1c>] (bus_for_each_drv+0x54/0x9c)
      [<c020eb1c>] (bus_for_each_drv+0x54/0x9c) from [<c0210668>] (device_attach+0x84/0x9c)
      [<c0210668>] (device_attach+0x84/0x9c) from [<c020fbac>] (bus_probe_device+0x94/0xb8)
      [<c020fbac>] (bus_probe_device+0x94/0xb8) from [<c020e084>] (device_add+0x4f0/0x5bc)
      [<c020e084>] (device_add+0x4f0/0x5bc) from [<c0276400>] (of_device_add+0x40/0x48)
      [<c0276400>] (of_device_add+0x40/0x48) from [<c0276a98>] (of_platform_device_create_pdata+0x68/0x98)
      [<c0276a98>] (of_platform_device_create_pdata+0x68/0x98) from [<c0276bac>] (of_platform_bus_create+0xe4/0x260)
      [<c0276bac>] (of_platform_bus_create+0xe4/0x260) from [<c0276bf8>] (of_platform_bus_create+0x130/0x260)
      [<c0276bf8>] (of_platform_bus_create+0x130/0x260) from [<c0276d94>] (of_platform_populate+0x6c/0xac)
      [<c0276d94>] (of_platform_populate+0x6c/0xac) from [<c04a8224>] (u8500_init_machine+0x78/0x140)
      [<c04a8224>] (u8500_init_machine+0x78/0x140) from [<c04a3560>] (customize_machine+0x24/0x30)
      [<c04a3560>] (customize_machine+0x24/0x30) from [<c00087b0>] (do_one_initcall+0x130/0x1b0)
      [<c00087b0>] (do_one_initcall+0x130/0x1b0) from [<c033ff9c>] (kernel_init+0x138/0x2e8)
      [<c033ff9c>] (kernel_init+0x138/0x2e8) from [<c000eb18>] (ret_from_fork+0x14/0x20)
      Code: 0a00001b e19400b2 e59a200c e0822000 (e592c000)
      ---[ end trace 1b75b31a2719ed1c ]---
      note: swapper/0[1] exited with preempt_count 1
      Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
      Signed-off-by: NFabio Baltieri <fabio.baltieri@linaro.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      4ca075de
  28. 16 11月, 2012 1 次提交
  29. 15 11月, 2012 1 次提交
  30. 09 11月, 2012 1 次提交
    • J
      pinctrl/nomadik: make independent of prcmu driver · f1671bf5
      Jonas Aaberg 提交于
      Currently there are some unnecessary criss-cross
      dependencies between the PRCMU driver in MFD and a lot of
      other drivers, mainly because other drivers need to poke
      around in the PRCM register range.
      
      In cases like this there are actually just a few select
      registers that the pinctrl driver need to read/modify/write,
      and it turns out that no other driver is actually using
      these registers, so there are no concurrency issues
      whatsoever.
      
      So: don't let the location of the register range complicate
      things, just poke into these registers directly and skip
      a layer of indirection.
      
      Take this opportunity to add kerneldoc to the pinctrl
      state container.
      
      Cc: Loic Pallardy <loic.pallardy@st.com>
      Signed-off-by: NJonas Aaberg <jonas.aberg@stericsson.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      f1671bf5
  31. 05 11月, 2012 3 次提交