1/**
2 * \file
3 * \brief Platform code for ARMv7-A VersatileExpress EMM board
4 */
5
6/*
7 * Copyright (c) 2009-2015 ETH Zurich.
8 * All rights reserved.
9 *
10 * This file is distributed under the terms in the attached LICENSE file.
11 * If you do not find this file, copies can be found by writing to:
12 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
13 */
14
15#include <kernel.h>
16
17#include <bitmacros.h>
18#include <a9_gt.h>
19#include <a9_scu.h>
20#include <global.h>
21#include <init.h>
22#include <paging_kernel_arch.h>
23#include <platform.h>
24#include <serial.h>
25#include <startup_arch.h>
26#include <pl011.h>
27#include <assert.h>
28#include <errors/errno.h>
29#include <maps/a9mpcore_map.h>
30#include <maps/vexpress_map.h>
31#include <dev/cortex_a9_pit_dev.h>
32#include <gic.h>
33
34/********************************************************************************
35 *
36 * Implementation of serial.h
37 *
38 *******************************************************************************/
39
40errval_t serial_init(unsigned port, bool initialize_hw)
41{
42    lvaddr_t base = paging_map_device(uart_base[port], uart_size[port]);
43    pl011_init(port, base, initialize_hw);
44    return SYS_ERR_OK;
45};
46
47/*
48 * Print system identification.   MMU is NOT yet enabled.
49 * TODO - Use Mackerel to print the identification from the system
50 * configuration block.
51 */
52void platform_print_id(void)
53{
54    assert(!paging_mmu_enabled());
55
56    uint32_t id=
57        *((uint32_t *)(VEXPRESS_MAP_SYSREG + VEXPRESS_SYS_ID));
58    uint32_t procid0=
59        *((uint32_t *)(VEXPRESS_MAP_SYSREG + VEXPRESS_SYS_PROCID0));
60    uint32_t procid1=
61        *((uint32_t *)(VEXPRESS_MAP_SYSREG + VEXPRESS_SYS_PROCID1));
62
63    printf("Device: This is a VersatileExpress EMM board. "
64           "ID=%08x PROCID0=%08x PROCID1=%08x\n",
65           id, procid0, procid1);
66}
67
68void platform_get_info(struct platform_info *pi)
69{
70    pi->arch     = PI_ARCH_ARMV7A;
71    pi->platform = PI_PLATFORM_VEXPRESS;
72    armv7_get_info(&pi->arch_info.armv7);
73}
74
75uint32_t tsc_hz = 0;
76
77void
78a9_probe_tsc(void) {
79    /* A15+ don't require probing, and the A9 FVP doesn't support it.  This
80     * probe is only called on A9 platforms. */
81    if(periphclk == 0) panic("No periphclk argument supplied.");
82    tsc_hz= periphclk;
83}
84