Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <assert.h> |
Antonio Nino Diaz | 09a00ef | 2019-01-11 13:12:58 +0000 | [diff] [blame] | 8 | #include <drivers/arm/sp804.h> |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 9 | #include <platform.h> |
| 10 | #include <platform_def.h> |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 11 | #include <stddef.h> |
| 12 | #include <timer.h> |
| 13 | |
| 14 | static const plat_timer_t plat_timers = { |
| 15 | .program = sp804_timer_program, |
| 16 | .cancel = sp804_timer_cancel, |
| 17 | .handler = sp804_timer_handler, |
| 18 | .timer_step_value = 2, |
| 19 | .timer_irq = MB_TIMER1_IRQ /* Motherboard SP804 timer1 IRQ */ |
| 20 | }; |
| 21 | |
| 22 | int plat_initialise_timer_ops(const plat_timer_t **timer_ops) |
| 23 | { |
| 24 | assert(timer_ops != NULL); |
| 25 | *timer_ops = &plat_timers; |
| 26 | |
| 27 | /* Initialise the system timer */ |
| 28 | sp804_timer_init(MB_TIMER1_BASE, MB_TIMER1_FREQ); |
| 29 | |
| 30 | return 0; |
| 31 | } |