1. 06 Feb, 2017 1 commit
    • Douglas Raillard's avatar
      Replace some memset call by zeromem · 32f0d3c6
      Douglas Raillard authored
      
      
      Replace all use of memset by zeromem when zeroing moderately-sized
      structure by applying the following transformation:
      memset(x, 0, sizeof(x)) => zeromem(x, sizeof(x))
      
      As the Trusted Firmware is compiled with -ffreestanding, it forbids the
      compiler from using __builtin_memset and forces it to generate calls to
      the slow memset implementation. Zeromem is a near drop in replacement
      for this use case, with a more efficient implementation on both AArch32
      and AArch64.
      
      Change-Id: Ia7f3a90e888b96d056881be09f0b4d65b41aa79e
      Signed-off-by: default avatarDouglas Raillard <douglas.raillard@arm.com>
      32f0d3c6
  2. 23 Jan, 2017 1 commit
    • Masahiro Yamada's avatar
      Use #ifdef for IMAGE_BL* instead of #if · 3d8256b2
      Masahiro Yamada authored
      
      
      One nasty part of ATF is some of boolean macros are always defined
      as 1 or 0, and the rest of them are only defined under certain
      conditions.
      
      For the former group, "#if FOO" or "#if !FOO" must be used because
      "#ifdef FOO" is always true.  (Options passed by $(call add_define,)
      are the cases.)
      
      For the latter, "#ifdef FOO" or "#ifndef FOO" should be used because
      checking the value of an undefined macro is strange.
      
      Here, IMAGE_BL* is handled by make_helpers/build_macro.mk like
      follows:
      
        $(eval IMAGE := IMAGE_BL$(call uppercase,$(3)))
      
        $(OBJ): $(2)
                @echo "  CC      $$<"
                $$(Q)$$(CC) $$(TF_CFLAGS) $$(CFLAGS) -D$(IMAGE) -c $$< -o $$@
      
      This means, IMAGE_BL* is defined when building the corresponding
      image, but *undefined* for the other images.
      
      So, IMAGE_BL* belongs to the latter group where we should use #ifdef
      or #ifndef.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      3d8256b2
  3. 18 Jan, 2017 1 commit
  4. 12 Jan, 2017 1 commit
  5. 04 Jan, 2017 1 commit
  6. 14 Dec, 2016 1 commit
  7. 24 Nov, 2016 1 commit
    • Soren Brinkmann's avatar
      rk3399: Add CFI debug information to SRAM functions · aa2345e9
      Soren Brinkmann authored
      Commit b91d935f
      ("Add CFI debug frame information for ASM functions") modifies the
      assembly macros 'func' and 'endfunc' to include CFI debug frame
      information.
      
      The rockchip platform uses a custom version of the 'func' macro with the
      common 'endfunc' macro. The custom macro wasn't updated in
      b91d935f resulting in the following
      build error:
        plat/rockchip/rk3399/drivers/pmu/plat_pmu_macros.S: Assembler messages:
        plat/rockchip/rk3399/drivers/pmu/plat_pmu_macros.S:155: Error: .cfi_endproc without corresponding .cfi_startproc
        Makefile:532: recipe for target 'build/rk3399/release/bl31/plat_helpers.o' failed
        make: *** [build/rk3399/release/bl31/plat_helpers.o] Error 1
      
      Fixing this by updating the sram_func macro in the rk3399 port.
      
      Fixes: b91d935f
      
       ("Add CFI debug frame information for ASM functions")
      Signed-off-by: default avatarSoren Brinkmann <soren.brinkmann@xilinx.com>
      aa2345e9
  8. 07 Nov, 2016 2 commits
    • Caesar Wang's avatar
      rockchip: remove no needed code for rk3399 · 06077161
      Caesar Wang authored
      
      
      We have do something for clocks gate.
      
      Fox example as the below:
      susped:
      clk_gate_con_save();
      clk_gate_con_disable();
      
      resume:
      clk_gate_con_restore();
      --
      
      SO, add the plls_suspend_prepare() and plls_resume_finish() are not
      necessary to S2R, that will save S2R time if remove them.
      
      BRANCH=none
      BUG=chrome-os-partner:58870,chrome-os-partner:55934
      TEST=build kevin, two dogfooders with suspend_stress_test
      passing 3000 cycles and still going on.
      
      Change-Id: Icfbabc0b3ea8d2b5108d4f3de99a803b6d459669
      Signed-off-by: default avatarCaesar Wang <wxt@rock-chips.com>
      06077161
    • Caesar Wang's avatar
      rockchip: disable watchdog during suspend · a14e0916
      Caesar Wang authored
      
      
      The CA53 and CM0 WDT clock gating in rk3399 SGRF, and ATF is in charge of
      it because the kernel can't touch SGRF.
      
      Basically the WDT didn't stop at suspend time, it just switched from the
      24M to the 32k clock. That meant that the WDT would fire if you slept for
      long enough. In other word, the watchdog timer over count will increase to
      750 (24*1000/32) times.
      The RK3399 HW watchdog interval is 21 seconds. When machine enters the
      suspend, the watchdog will reset the system after 35.7 (750/21) hours.
      
      BUG=chrome-os-partner:59257
      TEST=daisydog checked and set value, powerd_dbus_suspend to verify.
      
      Change-Id: I88bb2a05b7d67d5ffd292f9d05d033ae9a6a3593
      Signed-off-by: default avatarCaesar Wang <wxt@rock-chips.com>
      a14e0916
  9. 03 Nov, 2016 2 commits
    • Julius Werner's avatar
      rockchip: Add proper dependency tracking to M0 Makefile · 71581c9c
      Julius Werner authored
      
      
      This patch adds dependency rule generation and inclusion to the M0
      Makefile, so that M0 objects will get correctly remade with an
      incremental build if a header file they included changed.
      
      Change-Id: I2067bd9fd4d9dad3e77a09cbf09c7b4db3c1eda5
      Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
      71581c9c
    • Julius Werner's avatar
      rockchip: Clean up parent directory creation for M0 · e77ade28
      Julius Werner authored
      
      
      The dependencies in the M0 Makefile are not correctly laid out, which
      may lead to errors with make -j if the binary target gets evaluated
      before the target that creates the directory. In addition, the M0
      Makefile just calls mkdir without using the platform-independent macros
      from the main ARM TF build system. This patch fixes those issues,
      removes some unused (and broken) M0 build targets and merges the two M0
      output directories into one (since there's no real point splitting it up
      and it creates more hassle).
      
      Change-Id: Ia5002479cf9c57fea7aefa8ca88e373df3a51f61
      Signed-off-by: default avatarJulius Werner <jwerner@chromium.org>
      e77ade28
  10. 26 Oct, 2016 5 commits
  11. 24 Oct, 2016 4 commits
  12. 21 Oct, 2016 1 commit
  13. 28 Sep, 2016 1 commit
  14. 13 Sep, 2016 1 commit
    • Caesar Wang's avatar
      rockchip: fixes the gic panic for rk3399 resume · 0587788a
      Caesar Wang authored
      We make sure the resuming of gic need to be enabled.
      Otherwise, The resume will hit the below panic.
      ...
      [   24.230541] CPU0: update max cpu_capacity 451
      [   24.236029] CPU5: update max cpu_capacity 1024
      [   24.236046] CPU4: shutdown
      [   24.243205] psci: CPU4 killed.
      [   24.258730] CPU5: shutdown
      [   24.261472] psci: CPU5 killed.
      [   24.270417] GIC: unable to set SRE (disabled at EL2), panic ahead
      [   24.270417] cat[7801]: undefined instruction: pc=ffffffc0004e65d0
      [   24.270417] Code: b0003940 91274400 97f871af d2801e00 (d5184600)
      [   24.270417] Internal error: Oops - undefined instruction: 0 [#1] PREEMPT
      
      Change-Id: Ie9542c8d5768ba0accfa073453da8bfe06d4f921
      0587788a
  15. 09 Sep, 2016 5 commits
    • Caesar Wang's avatar
      rockchip: fixes some typo · 7e1bedb6
      Caesar Wang authored
      As the checkpatch reports the warning or error.
      
      plat/rockchip/common/plat_pm.c:96:
      ERROR: do not set execute permissions for source files
      plat/rockchip/rk3399/drivers/pmu/pmu.c:294:
      ERROR: do not set execute permissions for source files
      
      plat/rockchip/common/plat_pm.c:286: WARNING: line over 80 characters
      plat/rockchip/common/plat_pm.c:287: WARNING: line over 80 characters
      
      Change-Id: Ib347da21c56551c31df3f90f03777b13c75d5c26
      7e1bedb6
    • Caesar Wang's avatar
      rockchip: SIP call use 32 bit return value for rk3399 · a8656400
      Caesar Wang authored
      for compatible 32bit and 64bit, we use 0x82xxxxxx as function ID,
      we modify SIP call function return value to 32 bit.
      
      Change-Id: Ib99b03a9ea423853aaa296dcc634ee82c622a552
      a8656400
    • Caesar Wang's avatar
      rockchip: set gpio2 ~ gpio4 to input and pull none mode · 2bff35bb
      Caesar Wang authored
      For save power cosumption, if gpio power supply shut down, we need to
      set gpio2 ~ gpio4 to input and HiZ status when suspend, and recovery
      they status when rusume. we do it base on apio pass from loader.
      
      Change-Id: I59fd2395e5e37e63425472a39f519822c9197e4c
      2bff35bb
    • Caesar Wang's avatar
      rockchip: support disable/enable specific gpio when suspend/resume · e550c631
      Caesar Wang authored
      some specific board need to disable/enable specific gpio when
      suspend/resume, so we add this function, bootloader can pass the
      specific gpio, and we can handle these gpios in bl31 suspend/resuem
      function.
      
      Change-Id: I373b03ef9202ee4a05a2b9caacdfa01b47ee2177
      e550c631
    • Caesar Wang's avatar
      rockchip/rk3399: improve gpio driver and support get pull mode function · 536c2492
      Caesar Wang authored
      We may need gpio pull mode later, so add this function.
      Besides fix a set pull mode bug, and save gpio clock gate,
      when operate the gpio, we will enable gpio clock, when
      finish gpio operate, restore gpio clock gate status.
      
      Change-Id: Ia1d602804f571a17f5ddc499908663b968b02974
      536c2492
  16. 08 Sep, 2016 1 commit
    • Tony Xie's avatar
      rockchip: fix the scu idle for rk3399 · 63ebf051
      Tony Xie authored
      As rk3399 reported the d8/octane scores drop 10% with cpu idle.
      The root cause is thc cpu cluster enter the slow mode.
      We don't need switch the clock to 24MHz if cpu cluster enter the
      retention mode. In order to improve performance, it just needs for
      cluster enter powering off mode.
      
      Also, we shouldn't do anything for hlvl if the system is off.
      
      Change-Id: I2a02962a01343abd0cba47ed63192c1cdf88b119
      63ebf051
  17. 25 Aug, 2016 5 commits
  18. 24 Aug, 2016 1 commit
    • Caesar Wang's avatar
      rockchip: on rk3399 init the PMU counts at boot; set 24M/32k properly · 0786d688
      Caesar Wang authored
      In a previous change we mistakenly thought that PMU_24M_EN_CFG directly
      controlled whether the PMU counts ran off the 32k vs. 24M clock.
      Apparently that's not true.  Real logic is now documented in code.
      
      Also in the previous change we mistaknely though that PMU_24M_EN_CFG was
      normally supposed to be 1 and we should "restore" it at resume time.
      This is a terrible idea and made the system totally unreliable after
      resume.  Apparently PMU_24M_EN_CFG should always be 0 with all the
      current code and settings.
      
      Let's fix the above two problems.  While we're changing all of this,
      let's also:
      
      1. Init at boot time.  Many of these counts are used when the system is
         running normally.  We want the behavior at boot to match the behavior
         after suspend/resume.
      
      2. Init CPU counts to be 1 us.  Although old code was trying to set this
         to 1 ms (1000x slower) at suspend/resume time, we've been testing the
         kernel with 1 us for a long time now.  That's because the kernel (at
         boot time) set these values to 24.  Let's keep at 24 until we know
         that's wrong.
      
      3. Init GPU counts to be 1 us.  Old code wasn't touching the GPU, but as
         documented in comments it makes sense to init here.  Do it.
      
      4. Document the crap out of this code, since the SoC's behavior is
         confusing and poorly documented in the TRM.
      
      5. Increase some stabilization times to 30 ms (from 3 ms).  It's unclear
         that a full 30 ms is needed, but let's be safe for now.
      
      This also inits the counts for the GPU.
      
      (Thanks to Doug's patch that come from https://crosreview.com/372381)
      
      Change-Id: Id1bc159a5a99916aeab043895e5c4585c4adab22
      0786d688
  19. 11 Aug, 2016 3 commits
    • Caesar Wang's avatar
      rockchip: fix the reset-hold release for rk3399 resume · 78f7017c
      Caesar Wang authored
      The pmusgrf reset-hold bits needs to be released, since the
      pmusgrf reset-hold bits needs to be held.
      
      Change-Id: Ia1eccc8fba18294f26b4cc07d47bc5e513dd9a1f
      78f7017c
    • Caesar Wang's avatar
      rockchip: fix the power up/dowm cnt for rk3399 · 545bff0e
      Caesar Wang authored
      Sometimes this will cause the long delay for suspend/resume.
      Since the 24M OCS will be turned off in power mode.
      Also, remove the ERROR_DEPRECATED config define.
      
      Change-Id: I78f21c35912c2250972e551695cdacc7bc4c020a
      545bff0e
    • Caesar Wang's avatar
      rockchip: update to handle PWMs for rk3399 · 5d3b1067
      Caesar Wang authored
      This patch updates some things for rk3399, as following:
      
      1) Add the new file to handle the pwm. (e.g. the pwm regulator)
      Make sure that good deal with the pwm related things.
      Also, remove some pwm setting for pmu.c.
      
      2) Set the plls slow mode and bypass in suspend, and restore them.
      
      Change-Id: I112806700bf433c87763aac23d22fa7e6a7f5264
      5d3b1067
  20. 09 Aug, 2016 1 commit
  21. 28 Jul, 2016 1 commit
    • Caesar Wang's avatar
      rockchip: fixes typo and some bugs for suspend/resume tests · e6517abd
      Caesar Wang authored
      1. Remove the AP_PWROFF in ATF, should configure it in kernel.
      2. Save and restore the PWMs pin/regs for suspend/resume.
      3. The pmusgrf reset-hold bits needs to be released. since the
         pmusgrf reset-hold bits needs to be held.
      4. Configure the PMU power up/down cycles about delay 3ms.
      5. With the MMIO register block as one big mapping.
      6. Fix the build error with psci_entrypoint since PSCI lib updated.
      
      Fixes the commit
      9ec78bdf ("rockchip: support the suspend/resume for rk3399").
      
      Change-Id: I112806700bf433c87763aac23d22fa7e6a7f5264
      e6517abd