1. 18 Sep, 2014 1 commit
  2. 27 Aug, 2014 1 commit
    • Geert Uytterhoeven's avatar
      regmap: Split regmap_get_endian() in two functions · cf673fbc
      Geert Uytterhoeven authored
      Split regmap_get_endian() in two functions, regmap_get_reg_endian() and
      regmap_get_val_endian().
      
      This allows to:
        - Get rid of the three switch()es on "type", incl. error handling in
          three "default" cases,
        - Get rid of the regmap_endian_type enum,
        - Get rid of the non-NULL check of "config" (regmap_init() already
          checks for that),
        - Get rid of the "endian" output parameters, and just return the
          regmap_endian enum value, as the functions can no longer fail.
      
      This saves 21 lines of code (despite the still-present
      one-comment-per-line over-documentation), and 30 bytes of code on ARM
      V7.
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: default avatarStephen Warren <swarren@nvidia.com>
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      cf673fbc
  3. 19 Aug, 2014 1 commit
    • Stephen Warren's avatar
      regmap: of_regmap_get_endian() cleanup · 45e1a279
      Stephen Warren authored
      Commit d647c199 ("regmap: add DT endianness binding support") had
      some issues. Commit ba1b53fe ("regmap: Fix DT endianess parsing
      logic") fixed the main problem. This patch fixes the other.
      
      Specifically, restore the overall default of REGMAP_ENDIAN_BIG if none of
      the config, DT, or the bus specify any endianness. Without this,
      of_regmap_get_endian() could return REGMAP_ENDIAN_DEFAULT, which the
      calling code can't handle. Since all busses do specify an endianness in
      the current code, this makes no difference right now, but I saw no
      justification in the patch description for removing this final default.
      
      Also, clean up the code a bit:
      
      * s/of_regmap_get_endian/regmap_get_endian/ since the function isn't DT-
        specific, even if the reason it was originally added was to add some
        DT-specific features.
      * After potentially reading an endianess specification from DT, the code
        checks whether DT did specify an endianness, and if so, returns it. Move
        this test outside the whole switch statement so that if the
        REGMAP_ENDIAN_REG case ever modifies *endian, this check will pick that
        up. This partially reverts part of commit ba1b53fe ("regmap: Fix DT
        endianess parsing logic"), while maintaining the bug-fix that commit
        made to this code.
      * Make the comments briefer, and only refer to the specific action taken
        at their location. This makes most of the comments independent of DT,
        and easier to follow.
      
      Cc: Xiubo Li <Li.Xiubo@freescale.com>
      Cc: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
      Cc: Thierry Reding <treding@nvidia.com>
      Fixes: d647c199 ("regmap: add DT endianness binding support")
      Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      45e1a279
  4. 18 Aug, 2014 1 commit
    • Javier Martinez Canillas's avatar
      regmap: Fix DT endianess parsing logic · ba1b53fe
      Javier Martinez Canillas authored
      Commit d647c199 ("regmap: add DT endianness binding support.")
      added support to parse the device endianness from the device tree
      but unfortunately the added logic doesn't have the same semantics
      than the old code. This leads to a NULL dereference pointer error
      when these properties are not provided by the Device Tree:
      
      Unable to handle kernel NULL pointer dereference at virtual address 00000044
      pgd = c0004000
      [00000044] *pgd=00000000
      Internal error: Oops: 5 [#1] PREEMPT SMP ARM
      Modules linked in:
      CPU: 5 PID: 1 Comm: swapper/0 Not tainted 3.17.0-rc1-next-20140818ccu #671
      task: ea412800 ti: ea484000 task.ti: ea484000
      PC is at regmap_update_bits+0xc/0x5c
      
      The problem is that platforms that rely on the default value now
      gets different values due two related issues in the current code:
      
      a) It only parses the endianness from DT for the regmap registers
         and not for the regmap values but it checks unconditionally in
         both cases if the resulting endiannes is REGMAP_ENDIAN_NATIVE.
      
      b) REGMAP_ENDIAN_NATIVE is not even a valid DT property according
         to the regmap DT binding documentation so it shouldn't be set.
      Signed-off-by: default avatarJavier Martinez Canillas <javier.martinez@collabora.co.uk>
      Signed-off-by: default avatarMark Brown <broonie@linaro.org>
      ba1b53fe
  5. 16 Aug, 2014 36 commits