1. 02 Jun, 2021 1 commit
    • Pali Rohár's avatar
      fix(plat/marvell/a3720/uart): fix UART parent clock rate determination · 5a91c439
      Pali Rohár authored
      
      
      The UART code for the A3K platform assumes that UART parent clock rate
      is always 25 MHz. This is incorrect, because the xtal clock can also run
      at 40 MHz (this is board specific).
      
      The frequency of the xtal clock is determined by a value on a strapping
      pin during SOC reset. The code to determine this frequency is already in
      A3K's comphy driver.
      
      Move the get_ref_clk() function from the comphy driver to a separate
      file and use it for UART parent clock rate determination.
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Change-Id: I8bb18a2d020ef18fe65aa06ffa4ab205c71be92e
      5a91c439
  2. 01 Jun, 2021 2 commits
  3. 28 May, 2021 1 commit
    • Pali Rohár's avatar
      fix(plat/marvell/a3720/uart): fix UART clock rate value and divisor calculation · 66a77528
      Pali Rohár authored
      
      
      UART parent clock is by default the platform's xtal clock, which is
      25 MHz.
      
      The value defined in the driver, though, is 25.8048 MHz. This is a hack
      for the suboptimal divisor calculation
        Divisor = UART clock / (16 * baudrate)
      which does not use rounding division, resulting in a suboptimal value
      for divisor if the correct parent clock rate was used.
      
      Change the code for divisor calculation to
        Divisor = Round(UART clock / (16 * baudrate))
      and change the parent clock rate value to 25 MHz.
      
      The final UART divisor for default baudrate 115200 is not affected by
      this change.
      
      (Note that the parent clock rate should not be defined via a macro,
      since the xtal clock can also be 40 MHz. This is outside of the scope of
      this fix, though.)
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Change-Id: Iaa401173df87aec94f2dd1b38a90fb6ed0bf0ec6
      66a77528
  4. 27 Apr, 2021 1 commit
    • Pali Rohár's avatar
      plat: marvell: armada: a3k: Add new compile option A3720_DB_PM_WAKEUP_SRC · f2800a47
      Pali Rohár authored
      
      
      This new compile option is only for Armada 3720 Development Board. When
      it is set to 1 then TF-A will setup PM wake up src configuration.
      
      By default this new option is disabled as it is board specific and no
      other A37xx board has PM wake up src configuration.
      
      Currently neither upstream U-Boot nor upstream Linux kernel has wakeup
      support for A37xx platforms, so having it disabled does not cause any
      issue.
      
      Prior this commit PM wake up src configuration specific for Armada 3720
      Development Board was enabled for every A37xx board. After this change it
      is enabled only when compiling with build flag A3720_DB_PM_WAKEUP_SRC=1
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Change-Id: I09fea1172c532df639acb3bb009cfde32d3c5766
      f2800a47
  5. 20 Apr, 2021 12 commits
  6. 25 Feb, 2021 2 commits
  7. 24 Feb, 2021 1 commit
  8. 11 Feb, 2021 2 commits
  9. 29 Jan, 2021 10 commits
  10. 28 Jan, 2021 1 commit
  11. 11 Jan, 2021 1 commit
    • Marek Behún's avatar
      plat: marvell: armada: a3k: improve 4GB DRAM usage from 3.375 GB to 3.75 GB · b04921f7
      Marek Behún authored
      
      
      The current configuration of CPU windows on Armada 37x0 with 4 GB DRAM
      can only utilize 3.375 GB of memory. This is because there are only 5
      configuration windows, configured as such (in hexadecimal, also showing
      ranges not configurable by CPU windows):
      
               0 - 80000000 |   2 GB | DDR  | CPU window 0
        80000000 - C0000000 |   1 GB | DDR  | CPU window 1
        C0000000 - D0000000 | 256 MB | DDR  | CPU window 2
        D0000000 - D2000000 |  32 MB |      | Internal regs
            empty space     |        |      |
        D8000000 - D8010000 |  64 KB |      | CCI regs
            empty space     |        |      |
        E0000000 - E8000000 | 128 MB | DDR  | CPU window 3
        E8000000 - F0000000 | 128 MB | PCIe | CPU window 4
            empty space     |        |      |
        FFF00000 - end      |  64 KB |      | Boot ROM
      
      This can be improved by taking into account that:
      - CCI window can be moved (the base address is only hardcoded in TF-A;
        U-Boot and Linux will not break with changing of this address)
      - PCIe window can be moved (upstream U-Boot can change device-tree
        ranges of PCIe if PCIe window is moved)
      
      Change the layout after the Internal regs as such:
      
        D2000000 - F2000000 | 512 MB | DDR  | CPU window 3
        F2000000 - FA000000 | 128 MB | PCIe | CPU window 4
            empty space     |        |      |
        FE000000 - FE010000 |  64 KB |      | CCI regs
            empty space     |        |      |
        FFF00000 - end      |  64 KB |      | Boot ROM
      
      (Note that CCI regs base address is moved from D8000000 to FE000000 in
       all cases, not only for the configuration with 4 GB of DRAM. This is
       because TF-A is built with this address as a constant, so we cannot
       change this address at runtime only on some boards.)
      
      This yields 3.75 GB of usable RAM.
      
      Moreover U-Boot can theoretically reconfigure the PCIe window to DDR if
      it discovers that no PCIe card is connected. This can add another 128 MB
      of DRAM (resulting only in 128 MB of DRAM not being used).
      Signed-off-by: default avatarMarek Behún <marek.behun@nic.cz>
      Change-Id: I4ca1999f852f90055fac8b2c4f7e80275a13ad7e
      b04921f7
  12. 07 Jan, 2021 1 commit
    • Pali Rohár's avatar
      Makefile: Do not mark file targets as .PHONY target · a9812206
      Pali Rohár authored
      
      
      Only non-file targets should be set a .PHONY. Otherwise if file target is
      set as .PHONY then targets which depends on those file .PHONY targets would
      be always rebuilt even when their prerequisites are not changed.
      
      File target which needs to be always rebuilt can be specified in Make
      system via having a prerequisite on some .PHONY target, instead of marking
      whole target as .PHONY. In Makefile projects it is common to create empty
      .PHONY target named FORCE for this purpose.
      
      This patch changes all file targets which are set as .PHONY to depends on
      new .PHONY target FORCE, to ensure that these file targets are always
      rebuilt (as before). Basically they are those targets which calls external
      make subprocess.
      
      After FORCE target is specified in main Makefile, remove it from other
      Makefile files to prevent duplicate definitions.
      Signed-off-by: default avatarPali Rohár <pali@kernel.org>
      Change-Id: Iee3b4e0de93879b95eb29a1745a041538412e69e
      a9812206
  13. 05 Jan, 2021 1 commit
    • Marek Behún's avatar
      plat: marvell: armada: a3k: support doing system reset via CM3 secure coprocessor · d9243f26
      Marek Behún authored
      
      
      Introduce a new build option CM3_SYSTEM_RESET for A3700 platform, which,
      when enabled, adds code to the PSCI reset handler to try to do system
      reset by the WTMI firmware running on the Cortex-M3 secure coprocessor.
      (This function is exposed via the mailbox interface.)
      
      The reason is that the Turris MOX board has a HW bug which causes reset
      to hang unpredictably. This issue can be solved by putting the board in
      a specific state before reset.
      Signed-off-by: default avatarMarek Behún <marek.behun@nic.cz>
      Change-Id: I3f60b9f244f334adcd33d6db6a361fbc8b8d209f
      d9243f26
  14. 07 Dec, 2020 4 commits