]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
drivers: renesas: delay: Move to common
authorBiju Das <biju.das.jz@bp.renesas.com>
Wed, 16 Dec 2020 10:46:36 +0000 (10:46 +0000)
committerBiju Das <biju.das.jz@bp.renesas.com>
Wed, 13 Jan 2021 13:03:48 +0000 (13:03 +0000)
Move delay driver code to common directory, so that the same
code can be re-used by both R-Car Gen3 and RZ/G2 platforms.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Change-Id: I5e806bd0e0a0a4b436048513b7089db90ff9805f

drivers/renesas/common/delay/micro_delay.c [new file with mode: 0644]
drivers/renesas/common/delay/micro_delay.h [new file with mode: 0644]
drivers/renesas/rcar/delay/micro_delay.c [deleted file]
drivers/renesas/rcar/delay/micro_delay.h [deleted file]
plat/renesas/common/common.mk
plat/renesas/rcar/platform.mk

diff --git a/drivers/renesas/common/delay/micro_delay.c b/drivers/renesas/common/delay/micro_delay.c
new file mode 100644 (file)
index 0000000..a5e2a69
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018-2020, Renesas Electronics Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <arch.h>
+#include <arch_helpers.h>
+
+#include "micro_delay.h"
+
+#define RCAR_CONV_MICROSEC             1000000U
+
+void
+#if IMAGE_BL31
+       __attribute__ ((section(".system_ram")))
+#endif
+       rcar_micro_delay(uint64_t micro_sec)
+{
+       uint64_t freq;
+       uint64_t base_count;
+       uint64_t get_count;
+       uint64_t wait_time = 0U;
+
+       freq = read_cntfrq_el0();
+       base_count = read_cntpct_el0();
+       while (micro_sec > wait_time) {
+               get_count = read_cntpct_el0();
+               wait_time = ((get_count - base_count) * RCAR_CONV_MICROSEC) / freq;
+       }
+}
diff --git a/drivers/renesas/common/delay/micro_delay.h b/drivers/renesas/common/delay/micro_delay.h
new file mode 100644 (file)
index 0000000..37b71f8
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2015-2017, Renesas Electronics Corporation. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef MICRO_DELAY_H
+#define MICRO_DELAY_H
+
+#ifndef __ASSEMBLER__
+#include <stdint.h>
+void rcar_micro_delay(uint64_t micro_sec);
+#endif
+
+#endif /* MICRO_DELAY_H */
diff --git a/drivers/renesas/rcar/delay/micro_delay.c b/drivers/renesas/rcar/delay/micro_delay.c
deleted file mode 100644 (file)
index a5e2a69..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2018-2020, Renesas Electronics Corporation. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <arch.h>
-#include <arch_helpers.h>
-
-#include "micro_delay.h"
-
-#define RCAR_CONV_MICROSEC             1000000U
-
-void
-#if IMAGE_BL31
-       __attribute__ ((section(".system_ram")))
-#endif
-       rcar_micro_delay(uint64_t micro_sec)
-{
-       uint64_t freq;
-       uint64_t base_count;
-       uint64_t get_count;
-       uint64_t wait_time = 0U;
-
-       freq = read_cntfrq_el0();
-       base_count = read_cntpct_el0();
-       while (micro_sec > wait_time) {
-               get_count = read_cntpct_el0();
-               wait_time = ((get_count - base_count) * RCAR_CONV_MICROSEC) / freq;
-       }
-}
diff --git a/drivers/renesas/rcar/delay/micro_delay.h b/drivers/renesas/rcar/delay/micro_delay.h
deleted file mode 100644 (file)
index 37b71f8..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2015-2017, Renesas Electronics Corporation. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#ifndef MICRO_DELAY_H
-#define MICRO_DELAY_H
-
-#ifndef __ASSEMBLER__
-#include <stdint.h>
-void rcar_micro_delay(uint64_t micro_sec);
-#endif
-
-#endif /* MICRO_DELAY_H */
index cdcbc21443294c571b341c475261f1a3edb792f6..dda7c89f2c80269844ab8d38e3522a095b4a163a 100644 (file)
@@ -84,6 +84,7 @@ BL2_SOURCES   +=      ${RCAR_GIC_SOURCES}                             \
                        drivers/renesas/common/io/io_emmcdrv.c          \
                        drivers/renesas/common/io/io_memdrv.c           \
                        drivers/renesas/common/io/io_rcar.c             \
+                       drivers/renesas/common/delay/micro_delay.c      \
                        drivers/renesas/common/emmc/emmc_interrupt.c    \
                        drivers/renesas/common/emmc/emmc_utility.c      \
                        drivers/renesas/common/emmc/emmc_mount.c        \
@@ -98,6 +99,7 @@ BL31_SOURCES  +=      ${RCAR_GIC_SOURCES}                             \
                        plat/common/plat_psci_common.c                  \
                        drivers/renesas/common/console/rcar_console.S   \
                        drivers/renesas/common/console/rcar_printf.c    \
+                       drivers/renesas/common/delay/micro_delay.c      \
                        drivers/renesas/common/pwrc/call_sram.S         \
                        drivers/renesas/common/pwrc/pwrc.c              \
                        drivers/renesas/common/common.c                 \
index 05f9c2d260c8ac8d2703ca72be76f3c9f8a5e634..ca6fe6b73fb83932402ac12cb76e3555bf400a09 100644 (file)
@@ -304,7 +304,7 @@ PLAT_INCLUDES       +=      -Idrivers/renesas/rcar/ddr              \
                        -Idrivers/renesas/rcar/cpld/            \
                        -Idrivers/renesas/common/iic_dvfs       \
                        -Idrivers/renesas/rcar/avs              \
-                       -Idrivers/renesas/rcar/delay            \
+                       -Idrivers/renesas/common/delay          \
                        -Idrivers/renesas/rcar/rom              \
                        -Idrivers/renesas/common/scif           \
                        -Idrivers/renesas/common/emmc           \
@@ -324,7 +324,6 @@ BL2_SOURCES +=      plat/renesas/rcar/aarch64/platform_common.c     \
                        drivers/renesas/rcar/rpc/rpc_driver.c           \
                        drivers/renesas/rcar/dma/dma_driver.c           \
                        drivers/renesas/rcar/avs/avs_driver.c           \
-                       drivers/renesas/rcar/delay/micro_delay.c        \
                        drivers/renesas/rcar/watchdog/swdt.c            \
                        drivers/renesas/rcar/rom/rom_api.c              \
                        drivers/renesas/rcar/board/board.c
@@ -333,8 +332,7 @@ BL31_SOURCES        +=      plat/renesas/rcar/plat_topology.c               \
                        plat/renesas/rcar/aarch64/plat_helpers.S        \
                        plat/renesas/rcar/aarch64/platform_common.c     \
                        plat/renesas/rcar/bl31_plat_setup.c             \
-                       plat/renesas/rcar/plat_pm.c                     \
-                       drivers/renesas/rcar/delay/micro_delay.c
+                       plat/renesas/rcar/plat_pm.c
 
 ifeq (${RCAR_GEN3_ULCB},1)
 BL31_SOURCES           +=      drivers/renesas/rcar/cpld/ulcb_cpld.c