diff options
author | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2016-11-09 11:43:38 +0000 |
---|---|---|
committer | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2016-11-10 09:51:24 +0000 |
commit | f0c152b614b077dccef94fdd5b752a7eec3900e9 (patch) | |
tree | 671ff78983894bdbe2ff1766cf5cce3f25da4e07 | |
parent | 0db861f9c1144ee031e8387251e8ac4bfcea7681 (diff) |
Share common platform timer code
Extracted the timer code from the FVP, Armstrong and Ashbrook
platform ports and placed it in plat/arm/board/common/arm_timers.c
Removed the original timer code files and modified the Makefiles to
point at the new common file.
The Juno port remains unchanged.
Change-Id: Ifdf4e5631dcf58702eaa12242999a54e6038d713
-rw-r--r-- | plat/arm/board/armstrong/armstrong_timers.c | 53 | ||||
-rw-r--r-- | plat/arm/board/armstrong/platform.mk | 1 | ||||
-rw-r--r-- | plat/arm/board/ashbrook/ashbrook_timers.c | 53 | ||||
-rw-r--r-- | plat/arm/board/ashbrook/platform.mk | 1 | ||||
-rw-r--r-- | plat/arm/board/fvp/platform.mk | 1 | ||||
-rw-r--r-- | plat/arm/common/arm_common.mk | 3 | ||||
-rw-r--r-- | plat/arm/common/arm_timers.c (renamed from plat/arm/board/fvp/fvp_timers.c) | 2 |
7 files changed, 4 insertions, 110 deletions
diff --git a/plat/arm/board/armstrong/armstrong_timers.c b/plat/arm/board/armstrong/armstrong_timers.c deleted file mode 100644 index af4d69a..0000000 --- a/plat/arm/board/armstrong/armstrong_timers.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of ARM nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <assert.h> -#include <platform.h> -#include <stddef.h> -#include <system_timer.h> -#include <timer.h> - -static const plat_timer_t plat_timers = { - .program = program_systimer, - .cancel = cancel_systimer, - .handler = handler_systimer, - .timer_step_value = 2, - .timer_irq = IRQ_CNTPSIRQ1 -}; - -int plat_initialise_timer_ops(const plat_timer_t **timer_ops) -{ - assert(timer_ops != NULL); - *timer_ops = &plat_timers; - - /* Initialise the system timer */ - init_systimer(SYS_CNT_BASE1); - return 0; -} diff --git a/plat/arm/board/armstrong/platform.mk b/plat/arm/board/armstrong/platform.mk index cf029d1..3c3a7de 100644 --- a/plat/arm/board/armstrong/platform.mk +++ b/plat/arm/board/armstrong/platform.mk @@ -37,7 +37,6 @@ PLAT_SOURCES := drivers/arm/gic/arm_gic_v2v3.c \ drivers/arm/timer/system_timer.c \ plat/arm/board/armstrong/aarch64/plat_helpers.S \ plat/arm/board/armstrong/armstrong_pwr_state.c \ - plat/arm/board/armstrong/armstrong_timers.c \ plat/arm/board/armstrong/armstrong_topology.c \ plat/arm/board/armstrong/plat_setup.c diff --git a/plat/arm/board/ashbrook/ashbrook_timers.c b/plat/arm/board/ashbrook/ashbrook_timers.c deleted file mode 100644 index f25bfb2..0000000 --- a/plat/arm/board/ashbrook/ashbrook_timers.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of ARM nor the names of its contributors may be used - * to endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <assert.h> -#include <platform.h> -#include <stddef.h> -#include <system_timer.h> -#include <timer.h> - -static const plat_timer_t plat_timers = { - .program = program_systimer, - .cancel = cancel_systimer, - .handler = handler_systimer, - .timer_step_value = 2, - .timer_irq = IRQ_CNTPSIRQ1 -}; - -int plat_initialise_timer_ops(const plat_timer_t **timer_ops) -{ - assert(timer_ops != NULL); - *timer_ops = &plat_timers; - - /* Initialise the system timer */ - init_systimer(SYS_CNT_BASE1); - return 0; -} diff --git a/plat/arm/board/ashbrook/platform.mk b/plat/arm/board/ashbrook/platform.mk index 4b94be3..d92ee3f 100644 --- a/plat/arm/board/ashbrook/platform.mk +++ b/plat/arm/board/ashbrook/platform.mk @@ -37,7 +37,6 @@ PLAT_SOURCES := drivers/arm/gic/arm_gic_v2v3.c \ drivers/arm/timer/system_timer.c \ plat/arm/board/ashbrook/aarch64/plat_helpers.S \ plat/arm/board/ashbrook/ashbrook_pwr_state.c \ - plat/arm/board/ashbrook/ashbrook_timers.c \ plat/arm/board/ashbrook/ashbrook_topology.c \ plat/arm/board/ashbrook/plat_setup.c diff --git a/plat/arm/board/fvp/platform.mk b/plat/arm/board/fvp/platform.mk index f260c9a..51504c3 100644 --- a/plat/arm/board/fvp/platform.mk +++ b/plat/arm/board/fvp/platform.mk @@ -38,7 +38,6 @@ PLAT_SOURCES := drivers/arm/gic/arm_gic_v2v3.c \ lib/semihosting/${ARCH}/semihosting_call.S \ lib/semihosting/semihosting.c \ plat/arm/board/fvp/fvp_pwr_state.c \ - plat/arm/board/fvp/fvp_timers.c \ plat/arm/board/fvp/fvp_topology.c \ plat/arm/board/fvp/plat_setup.c diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk index 7cb3664..c03dad0 100644 --- a/plat/arm/common/arm_common.mk +++ b/plat/arm/common/arm_common.mk @@ -29,7 +29,8 @@ # PLAT_SOURCES += drivers/arm/gic/gic_common.c \ - drivers/arm/pl011/${ARCH}/pl011_console.S + drivers/arm/pl011/${ARCH}/pl011_console.S \ + plat/arm/common/arm_timers.c ifeq (${USE_NVM},1) PLAT_SOURCES += drivers/io/io_storage.c \ diff --git a/plat/arm/board/fvp/fvp_timers.c b/plat/arm/common/arm_timers.c index 4631f58..9032ebc 100644 --- a/plat/arm/board/fvp/fvp_timers.c +++ b/plat/arm/common/arm_timers.c @@ -34,6 +34,8 @@ #include <system_timer.h> #include <timer.h> +#pragma weak plat_initialise_timer_ops + static const plat_timer_t plat_timers = { .program = program_systimer, .cancel = cancel_systimer, |